Changeset 1375 for trunk


Ignore:
Timestamp:
03/21/10 12:48:36 (4 years ago)
Author:
nick_ramsay
Message:

[Trunk] Hotaru 1.1.3 [Run upgrade script]

Location:
trunk
Files:
52 edited
85 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Hotaru.php

    r1305 r1375  
    2626class Hotaru 
    2727{ 
    28     protected $version              = "1.1.2";  // Hotaru CMS version 
     28    protected $version              = "1.1.3";  // Hotaru CMS version 
    2929    protected $isDebug              = false;    // show db queries and page loading time 
    3030    protected $isAdmin              = false;    // flag to tell if we are in Admin or not 
     
    993993     */ 
    994994    public function updateSetting($setting = '', $value = '', $folder = '') 
    995     { 
     995    {         
    996996        $pluginSettings = new PluginSettings(); 
    997997        return $pluginSettings->updateSetting($this, $setting, $value, $folder); 
     
    12151215     
    12161216     
    1217       
     1217    /** 
     1218     * Generate a system report 
     1219     * 
     1220     * @param string $type "log" or "object" 
     1221     */ 
     1222    public function generateReport($type = 'log') 
     1223    { 
     1224        return $this->debug->generateReport($this, $type); 
     1225    } 
     1226 
    12181227     
    12191228 /* ************************************************************* 
     
    12331242     * @return object|false $sp 
    12341243     */ 
    1235     public function newSimplePie($feed='', $cache=RSS_CACHE_ON, $cache_duration=RSS_CACHE_DURATION) 
     1244    public function newSimplePie($feed='', $cache=RSS_CACHE, $cache_duration=RSS_CACHE_DURATION) 
    12361245    { 
    12371246        require_once(LIBS . 'Feeds.php'); 
     
    13171326        if ($this->currentUser->getPermission('can_access_admin') == 'yes') { return true; } 
    13181327         
    1319         if ($this->pageName == 'admin_login') { return true; } 
     1328        if ($this->pageName == 'admin_login' || $this->pageName == 'api' ) { return true; } 
    13201329         
    13211330        require_once(LIBS . 'Maintenance.php'); 
     
    14461455        return $maintenance->getFiles($dir, $exclude); 
    14471456    } 
     1457     
     1458 
     1459    /**  
     1460     * System Report is under Debug Functions 
     1461     */ 
    14481462     
    14491463     
  • trunk/READ_ME.txt

    r1304 r1375  
    11HOTARU CMS 
    2 Version: 1.1.2 
    3 Released: Mar 8th 2010 
     2Version: 1.1.3 
     3Released: Mar 21st 2010 
    44 
    55INSTALLATION 
  • trunk/content/admin_language.php

    r1305 r1375  
    142142$lang["admin_maintenance_site_opened"] = SITE_NAME . " will be opened next page view"; 
    143143$lang['admin_maintenance_announcement_updated'] = "Site announcement updated"; 
     144$lang['admin_maintenance_system_report_success'] = "New system report generated"; 
     145$lang['admin_maintenance_system_report_failure'] = "Unable to generate a system report"; 
     146$lang['admin_maintenance_system_report_emailed'] = "System report emailed to HotaruCMS.org"; 
     147 
    144148$lang["admin_theme_maintenance"] = "Maintenance"; 
    145149$lang["admin_theme_maintenance_title"] = "Hotaru Maintenance"; 
     
    167171$lang["admin_theme_maintenance_rss_cache_desc"] = "deletes cached RSS feeds."; 
    168172$lang["admin_theme_maintenance_debug"] = "Debug:"; 
     173$lang["admin_theme_maintenance_system_report"] = "Generate a system report"; 
     174$lang["admin_theme_maintenance_email_system_report"] = "Email a system report to HotaruCMS.org"; 
     175$lang["admin_theme_maintenance_email_system_report_note"] = "<span style='color: red'>(Only use if requested in the forums)</span>"; 
    169176$lang["admin_theme_maintenance_debug_delete"] = "Clear debug files from the cache"; 
    170177$lang["admin_theme_maintenance_debug_view"] = "Click the filenames to view the logs:"; 
  • trunk/content/admin_themes/admin_default/admin_home.php

    r1081 r1375  
    3535<!-- TITLE FOR ADMIN NEWS --> 
    3636    <h2> 
    37         <a href="http://feeds2.feedburner.com/hotarucms"><img src="<?php echo BASEURL; ?>content/admin_themes/<?php echo ADMIN_THEME; ?>images/rss_16.png"></a> 
     37        <a href="http://feeds2.feedburner.com/hotarucms"><img src="<?php echo BASEURL; ?>content/admin_themes/<?php echo ADMIN_THEME; ?>images/rss_16.png" alt="rss" /></a> 
    3838        &nbsp;<?php echo $h->lang["admin_theme_main_latest"]; ?> 
    3939    </h2> 
     
    4141    <!-- Feed items, number to show content for, max characters for content --> 
    4242    <?php echo $h->adminNews(10, 3, 300); ?> 
     43 
     44    <br/> 
     45     <h2>Join us on Facebook and <a href="http://twitter.com/hotarucms">Twitter</a></h2> 
     46            <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US"></script><script type="text/javascript">FB.init("0ad945f33921afd2275ff6ca8997c2a3");</script><fb:fan profile_id="116731959368" stream="" connections="16" width="460"></fb:fan> 
     47            <div style="font-size:12px; padding-left:10px"><a href="http://www.facebook.com/hotarucms">HotaruCMS on Facebook</a> 
     48     </div> 
     49 
    4350</td> 
    4451 
     
    4754    <ul id="site-stats"> 
    4855    <li>Hotaru CMS v.<?php echo $h->version; ?></li> 
     56    <?php $h->pluginHook('admin_theme_main_stats_post_version'); ?> 
    4957    <?php $h->pluginHook('admin_theme_main_stats', 'users', array('total_users', 'admins', 'supermods', 'moderators')); ?> 
    5058    <?php $h->pluginHook('admin_theme_main_stats', 'users', array('approved_users', 'undermod_users', 'pending_users', 'banned_users', 'killspammed_users')); ?> 
  • trunk/content/admin_themes/admin_default/index.php

    r1081 r1375  
    2626 * @link      http://www.hotarucms.org/ 
    2727 */ 
     28 
     29// merge custom admin_language.php if exists in admin theme's languages folder 
     30// can be overridden by an admin_languages.php in a user theme's languages folder 
     31$h->includeThemeLanguage('admin'); 
     32 
    2833// plugin hook 
    2934$result = $h->pluginHook('admin_theme_index_top'); 
  • trunk/content/admin_themes/admin_default/maintenance.php

    r1081 r1375  
    8888<h2><?php echo $h->lang["admin_theme_maintenance_debug"]; ?></h2> 
    8989<ul> 
    90     <li style="margin-bottom: 1em;"><a href="<?php echo BASEURL; ?>admin_index.php?page=maintenance&amp;action=delete_debugs"> 
     90    <li><a href="<?php echo BASEURL; ?>admin_index.php?page=maintenance&amp;action=delete_debugs"> 
    9191        <?php echo $h->lang["admin_theme_maintenance_debug_delete"]; ?></a></li> 
     92    <li style="margin-bottom: 1em;"><a href="<?php echo BASEURL; ?>admin_index.php?page=maintenance&amp;action=system_report"> 
     93        <?php echo $h->lang["admin_theme_maintenance_system_report"]; ?></a></li> 
     94    <li style="margin-bottom: 1em;"><a href="<?php echo BASEURL; ?>admin_index.php?page=maintenance&amp;action=email_report"> 
     95        <?php echo $h->lang["admin_theme_maintenance_email_system_report"]; ?></a> 
     96        <?php echo $h->lang["admin_theme_maintenance_email_system_report_note"]; ?></li> 
    9297</ul> 
    9398 
     
    95100            echo $h->lang["admin_theme_maintenance_debug_view"] . "<br />"; 
    96101            foreach ($h->vars['debug_files'] as $file) { 
    97                 echo "<a href='" . BASEURL . "cache/debug_logs/" . $file . "'>" . $file . "</a><br />"; 
     102                echo "<a href='" . BASEURL . "admin_index.php?page=maintenance&amp;debug=" . $file . "'>" . $file . "</a><br />"; 
    98103            } 
    99104        } else { 
     
    109114    <?php $h->pluginHook('admin_maintenance_database'); ?> 
    110115</ul> 
     116 
     117<?php $h->pluginHook('admin_maintenance_middle'); ?> 
    111118 
    112119<br /> 
  • trunk/content/plugins

  • trunk/content/plugins/comments/comments.php

    r1305 r1375  
    33 * name: Comments 
    44 * description: Enables logged-in users to comment on posts 
    5  * version: 1.7 
     5 * version: 1.8 
    66 * folder: comments 
    77 * class: Comments 
     
    258258                            if ($h->comment->content != '') { 
    259259                                $result = $h->comment->addComment($h); 
    260              
     260 
    261261                                // notify chosen mods of new comment by email if enabled and UserFunctions file exists 
    262262                                if (($comments_settings['comment_email_notify']) && (file_exists(PLUGINS . 'users/libs/UserFunctions.php'))) 
     
    266266                                    $uf->notifyMods($h, 'comment', $h->comment->status, $h->comment->postId, $h->comment->id); 
    267267                                } 
    268                      
     268 
    269269                                // email comment subscribers if this comment has 'approved' status: 
    270270                                if ($h->comment->status == 'approved') { 
     
    807807        $subscribers = array(); 
    808808        $subscriber_ids = array_unique($subscriber_ids); 
     809         
    809810        foreach ($subscriber_ids as $subscriber_id) { 
    810811            // remove the current comment author so he/she doesn't get emailed his own comment 
     
    833834        $message .= $h->lang["comment_email_unsubscribe"]; 
    834835         
     836        if (!$h->comment->email) { 
     837            // Get settings from database if they exist... 
     838            $comments_settings = $h->getSerializedSettings('comments'); 
     839            $h->comment->email = $comments_settings['comment_email']; 
     840        } 
     841         
    835842        $from = SITE_EMAIL; 
    836843        $to = $h->comment->email;  // send email to address specified in Comment Settings;  
     
    840847            $bcc = ""; 
    841848        } 
    842         $headers = "From: " . $from . $bcc . "\r\nReply-To: " . $from . "\r\nX-Priority: 3\r\n"; 
    843      
    844         /* 
    845         echo "to: " . $to . "<br />"; 
    846         echo "bcc: " . $bcc . "<br />"; 
    847         echo "subject: " . $subject . "<br />"; 
    848         echo "message: " . $message . "<br />"; 
    849         echo "headers: " . $headers . "<br />"; 
    850         exit; 
    851         */ 
    852      
    853         $h->email($to, $subject, $message, $headers); 
     849 
     850        if (SMTP == 'true') { 
     851            $recipients['To'] = $to; 
     852            $recipients['Bcc'] = $send_to; 
     853            // no SMTP headers because they get overwritten in EmailFunctions anyway 
     854            $h->email($recipients, $subject, $message); 
     855        } else { 
     856            $recipients = $to; 
     857            $headers = "From: " . $from . $bcc . "\r\nReply-To: " . $from . "\r\nX-Priority: 3\r\n"; 
     858            $h->email($recipients, $subject, $message, $headers); 
     859        } 
    854860    } 
    855861} 
  • trunk/content/plugins/comments/readme.txt

    r1305 r1375  
    1515Changelog 
    1616--------- 
     17v.1.8 2010/03/18 - Nick - Fix for not sending comment subscriptions when using SMTP email authentication. 
    1718v.1.7 2010/03/11 - Nick - Fix for a previous change that broke the set pending and delete links within comments. 
    1819v.1.6 2010/02/26 - Nick - Adds link to profile navigation; Email changed to go through Hotaru's "email" function  
  • trunk/content/plugins/messaging/libs/MessagingFuncs.php

    r1256 r1375  
    195195         
    196196        // Hi username... 
    197         $email_message = "Hi " . $this->to . "," . $skip_line; 
     197        $email_message = $h->lang['messaging_email_greeting'] . $this->to . "," . $skip_line; 
    198198         
    199199        // You've been sent a private message from... 
  • trunk/content/plugins/sb_base/languages/sb_base_language.php

    r1210 r1375  
    5353/* SB Base Settings */ 
    5454$lang["sb_base_settings_header"] = "SB Base Configuration"; 
    55 $lang["sb_base_settings_posts_per_page"] = "posts per page <small>(default: 10)</small>"; 
     55$lang["sb_base_settings_posts_per_page"] = "Posts per page <small>(default: 10)</small>"; 
     56$lang["sb_base_settings_rss_redirect"] = "Automatically redirect RSS links to their original sources"; 
    5657$lang["sb_base_settings_post_archiving"] = "<b>Post Archiving</b>"; 
    5758$lang["sb_base_settings_post_archive_desc"] = "On the Maintenance page, there's a link you can use to archive old posts (or remove an existing archive). Archiving speeds up your site by excluding old posts and their comments, votes and tags from most database usage. Old posts can still be accessed via the search box or when loaded directly (e.g. from Google). <i>Note: Archiving is not automatic. You will need to update the archive periodically from the Maintenance page.</i>"; 
  • trunk/content/plugins/sb_base/libs/SbBaseFunctions.php

    r1305 r1375  
    411411             
    412412        if ($results) { 
     413         
     414            // get sb base settings 
     415            $sb_base_settings = $h->getSerializedSettings('sb_base'); 
     416             
    413417            foreach ($results as $result)  
    414418            { 
     
    419423                $title = html_entity_decode(urldecode($result->post_title), ENT_QUOTES,'UTF-8'); 
    420424                $item->title = stripslashes($title); 
    421                 $item->link  = $h->url(array('page'=>$result->post_id)); 
     425                 
     426                // if RSS redirecting is enabled, append forward=1 to the url 
     427                if (isset($sb_base_settings['rss_redirect']) && !empty($sb_base_settings['rss_redirect'])) { 
     428                    $item->link  = html_entity_decode($h->url(array('page'=>$result->post_id, 'forward'=>$result->post_id)), ENT_QUOTES,'UTF-8'); 
     429                } else { 
     430                    $item->link  = $h->url(array('page'=>$result->post_id)); 
     431                } 
    422432                $item->setPubDate($result->post_date);  
    423433                $item->description = "<![CDATA[ " . stripslashes(urldecode($result->post_content)) . " ]]>"; 
  • trunk/content/plugins/sb_base/readme.txt

    r1309 r1375  
    1414Changelog 
    1515--------- 
     16v.0.7 2010/03/15 - Nick - Added option to redirect RSS feeds through your site to their sources [courtesy of Gunaxin.com] 
    1617v.0.6 2010/03/13 - Nick - Lists ranked by vote are now ranked first by vote, second by recency 
    1718v.0.5 2010/02/26 - Nick - Filters hidden from user pages; Added profile navigation link 
  • trunk/content/plugins/sb_base/sb_base.php

    r1309 r1375  
    33 * name: SB Base 
    44 * description: Social Bookmarking base - provides "list" and "post" templates.  
    5  * version: 0.6 
     5 * version: 0.7 
    66 * folder: sb_base 
    77 * class: SbBase 
     
    4343        $sb_base_settings = $h->getSerializedSettings(); 
    4444        if (!isset($sb_base_settings['posts_per_page'])) { $sb_base_settings['posts_per_page'] = 10; } 
     45        if (!isset($sb_base_settings['rss_redirect'])) { $sb_base_settings['rss_redirect'] = ''; } 
    4546        if (!isset($sb_base_settings['archive'])) { $sb_base_settings['archive'] = "no_archive"; } 
    4647        $h->updateSetting('sb_base_settings', serialize($sb_base_settings)); 
     
    7071        if ($h->cage->get->keyExists('sort')) { 
    7172            $h->pageName = 'sort'; 
     73        } 
     74         
     75        // check if this is an RSS link forwarding to the source 
     76        if ($h->cage->get->keyExists('forward')) { 
     77            $post_id = $h->cage->get->testInt('forward'); 
     78            if ($post_id) { $post = $h->getPost($post_id); } 
     79            if (isset($post->post_orig_url)) {  
     80                header("Location:" . urldecode($post->post_orig_url)); 
     81                exit; 
     82            } 
    7283        } 
    7384         
  • trunk/content/plugins/sb_base/sb_base_settings.php

    r1081 r1375  
    4545         
    4646        $posts_per_page = $sb_base_settings['posts_per_page']; 
     47        $rss_redirect = $sb_base_settings['rss_redirect']; 
    4748        $archive = $sb_base_settings['archive']; 
    4849     
     
    5152        //...otherwise set to blank: 
    5253        if (!$posts_per_page) { $posts_per_page = 10; } 
     54        if (!$rss_redirect) { $rss_redirect = ''; } 
    5355        if (!$archive) { $archive = 'no_archive'; } 
    5456         
    5557        echo "<form name='sb_base_settings_form' action='" . BASEURL . "admin_index.php?page=plugin_settings&amp;plugin=sb_base' method='post'>\n"; 
    5658 
     59        // posts per page 
    5760        echo "<p><input type='text' size=5 name='posts_per_page' value='" . $posts_per_page . "' /> "; 
    5861        echo $h->lang["sb_base_settings_posts_per_page"] . "</p>\n"; 
     62 
     63        // rss redirecting? 
     64        echo "<p><input type='checkbox' name='rss_redirect' value='rss_redirect' " . $rss_redirect . " >&nbsp;&nbsp;" . $h->lang["sb_base_settings_rss_redirect"] . "<br />\n";  
    5965     
    6066        $h->pluginHook('sb_base_settings_form'); 
     
    6268        echo "<br />\n"; 
    6369 
     70        // post archiving 
    6471        echo $h->lang["sb_base_settings_post_archiving"] . "<br /><br />\n"; 
    6572        echo $h->lang["sb_base_settings_post_archive_desc"] . "<br /><br />\n"; 
     
    95102            $posts_per_page = $sb_base_settings['posts_per_page'];  
    96103        } 
     104         
     105     
     106        // RSS Redirecting 
     107        if ($h->cage->post->keyExists('rss_redirect')) {  
     108            $rss_redirect = 'checked';  
     109        } else {  
     110            $rss_redirect = '';  
     111        } 
    97112     
    98113        // Post Archiving 
     
    105120         
    106121        $sb_base_settings['posts_per_page'] = $posts_per_page; 
     122        $sb_base_settings['rss_redirect'] = $rss_redirect; 
    107123        $sb_base_settings['archive'] = $archive; 
    108124     
  • trunk/content/plugins/submit/libs/SubmitFunctions.php

    r1210 r1375  
    703703            $encoding=trim($matches[1]); 
    704704 
    705             //you need iconv to encode to utf-8 
    706             if (function_exists("iconv")) 
    707             { 
    708                 if (strcasecmp($encoding, 'utf-8') != 0) { 
    709                     //convert the html code into utf-8 whatever encoding it is using 
    710                     $string=iconv($encoding, 'UTF-8//IGNORE', $string); 
    711                 } 
     705            //you need iconv to encode to utf-8 (if not, use custom iconv in funcs.strings.php) 
     706            if (strcasecmp($encoding, 'utf-8') != 0) { 
     707                //convert the html code into utf-8 whatever encoding it is using 
     708                $string=iconv($encoding, 'UTF-8//IGNORE', $string); 
    712709            } 
    713710        } 
  • trunk/content/plugins/user_manager/css/user_manager.css

    r1307 r1375  
    2121 
    2222.user_manager_name_icons { padding: 0.4em; display:none;} 
     23 
     24#user_man_add_user form { border-bottom: 1px solid #ccc; } 
  • trunk/content/plugins/user_manager/languages/user_manager_language.php

    r1081 r1375  
    126126$lang['user_man_no_settings'] = "There haven't been any settings installed by plugins yet"; 
    127127 
     128 
     129/* User Man Create User */ 
     130 
     131$lang['user_man_add'] = "Add New User"; 
     132$lang['user_man_add_new_user'] = "Add a new user"; 
     133$lang["user_man_add_desc"] = "Use this page to add new users, send new passwords and request email validation."; 
     134$lang["user_man_add_detail"] = "Enter a username and email address for the new user."; 
     135$lang['user_man_add_success_password_sent'] = "User Created and Password Emailed"; 
     136$lang['user_man_create_send'] = "Create User &amp; Send Password"; 
     137 
     138$lang["user_man_send_new_password"] = "Send a new random password"; 
     139$lang["user_man_send_password_detail"] = "Enter a username for the user you wish to generate a new password for."; 
     140$lang['user_man_send_password'] = "Send Password"; 
     141$lang['user_man_new_password_sent'] = "New password generated and emailed."; 
     142$lang['user_man_user_not_found'] = "Sorry, no user found with that name"; 
     143 
     144$lang["user_man_send_email_validation"] = "Send an email validation request"; 
     145$lang["user_man_send_email_validation_detail"] = "Enter a username for the user you wish to send an email validation message to."; 
     146$lang['user_man_request_valid_email'] = "Request Email Validation"; 
     147$lang['user_man_email_validation_request_sent'] = "Email validation request sent."; 
     148 
    128149?> 
  • trunk/content/plugins/user_manager/readme.txt

    r1190 r1375  
    1515Changelog 
    1616--------- 
     17v.0.9 2010/03/17 - Nick - New page for creating users, sending new passwords and email validation requests 
    1718v.0.8 2010/02/18 - Nick - Fixes for changing user permissions and pagination 
    1819v.0.7 2010/02/02 - Nick - Improvements for spam management 
  • trunk/content/plugins/user_manager/templates/user_man_main.php

    r1081 r1375  
    4141    <b><u><?php echo $h->lang["user_man"]; ?></u></b> &nbsp;&nbsp; 
    4242    <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=default_perms'>" . $h->lang["user_man_default_perms"] . "</a>"; ?> &nbsp;&nbsp; 
    43     <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=default_settings'>" . $h->lang["user_man_default_settings"] . "</a>"; ?> 
     43    <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=default_settings'>" . $h->lang["user_man_default_settings"] . "</a>"; ?> &nbsp;&nbsp; 
     44    <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=add_user'>" . $h->lang["user_man_add"] . "</a>"; ?> 
    4445</p> 
    4546 
  • trunk/content/plugins/user_manager/templates/user_man_perms.php

    r1081 r1375  
    3535    <a href='<?php echo BASEURL; ?>admin_index.php?plugin=user_manager&page=plugin_settings'><?php echo $h->lang["user_man"]; ?></a>&nbsp;&nbsp; 
    3636    <b><u><?php echo $h->lang["user_man_default_perms"]; ?></u></b> &nbsp;&nbsp; 
    37     <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=default_settings'>" . $h->lang["user_man_default_settings"] . "</a>"; ?> 
     37    <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=default_settings'>" . $h->lang["user_man_default_settings"] . "</a>"; ?> &nbsp;&nbsp; 
     38    <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=add_user'>" . $h->lang["user_man_add"] . "</a>"; ?> 
    3839</p> 
    3940 
  • trunk/content/plugins/user_manager/templates/user_man_user_settings.php

    r1081 r1375  
    3939    <a href='<?php echo BASEURL; ?>admin_index.php?plugin=user_manager&page=plugin_settings'><?php echo $h->lang["user_man"]; ?></a>&nbsp;&nbsp; 
    4040    <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=default_perms'>" . $h->lang["user_man_default_perms"] . "</a>"; ?>&nbsp;&nbsp; 
    41     <b><u><?php echo $h->lang["user_man_default_settings"]; ?></u></b> 
     41    <b><u><?php echo $h->lang["user_man_default_settings"]; ?></u></b> &nbsp;&nbsp; 
     42    <?php echo "<a href='" . BASEURL . "admin_index.php?plugin=user_manager&page=plugin_settings&subpage=add_user'>" . $h->lang["user_man_add"] . "</a>"; ?> 
    4243</p> 
    4344 
  • trunk/content/plugins/user_manager/user_manager.php

    r1190 r1375  
    33 * name: User Manager 
    44 * description: Manage users. 
    5  * version: 0.8 
     5 * version: 0.9 
    66 * folder: user_manager 
    77 * class: UserManager 
  • trunk/content/plugins/user_manager/user_manager_settings.php

    r1304 r1375  
    4444            || ($h->cage->post->testPage('subpage') == 'default_settings')) { 
    4545            $this->defaultSettings($h); 
     46            return true; 
     47        } 
     48         
     49        if (($h->cage->get->testPage('subpage') == 'add_user') 
     50            || ($h->cage->post->testPage('subpage') == 'add_user')) { 
     51            $this->addUserPage($h); 
    4652            return true; 
    4753        } 
     
    610616        $h->displayTemplate('user_man_user_settings', 'user_manager'); 
    611617    } 
     618     
     619     
     620    /** 
     621     * add User Page 
     622     */ 
     623    public function addUserPage($h) 
     624    { 
     625        switch ($h->cage->post->testAlnumLines('submitted')) 
     626        { 
     627            case 'new_user': 
     628                $this->createUser($h); 
     629                break; 
     630            case 'new_password': 
     631                $this->sendPassword($h); 
     632                break; 
     633            case 'email_validation': 
     634                $this->sendEmailValidationRequest($h); 
     635                break; 
     636        } 
     637         
     638        // one username for each of the three forms, otherwise they all get pre-filled 
     639        if (!isset($h->vars['user_man_username_1'])) { $h->vars['user_man_username_1'] = ''; } 
     640        if (!isset($h->vars['user_man_username_2'])) { $h->vars['user_man_username_2'] = ''; } 
     641        if (!isset($h->vars['user_man_username_3'])) { $h->vars['user_man_username_3'] = ''; } 
     642        if (!isset($h->vars['user_man_email'])) { $h->vars['user_man_email'] = ''; } 
     643         
     644        $h->displayTemplate('user_man_add'); 
     645    } 
     646     
     647     
     648    /** 
     649     * Create a new user 
     650     */ 
     651    public function createUser($h) 
     652    { 
     653        $error = 0; 
     654 
     655        // check username 
     656        $username = $h->cage->post->testUsername('username'); // alphanumeric, dashes and underscores okay, case insensitive 
     657        if (!$username) { 
     658            $h->messages[$h->lang['user_signin_register_username_error']] = 'red'; 
     659            $error = 1; 
     660        } else { 
     661            $h->vars['user_man_username_1'] = $username; 
     662        } 
     663         
     664        // check email 
     665        $email = $h->cage->post->testEmail('email'); 
     666        if (!$email) { 
     667            $h->messages[$h->lang['user_signin_register_email_error']] = 'red'; 
     668            $error = 1; 
     669        } else { 
     670            $h->vars['user_man_email'] = $email; 
     671        } 
     672         
     673        // process new user 
     674        if (!$error) { 
     675            $us = new UserSignin(); 
     676            $blocked = $us->checkBlocked($h, $username, $email); // true if blocked, false if safe 
     677            $exists = $h->userExists(0, $username, $email); 
     678            if (!$blocked && ($exists == 'no')) { 
     679                 
     680                // SUCCESS!!! 
     681                $userAuth = new UserAuth(); 
     682                $userAuth->name = $username; 
     683                $userAuth->email = $email; 
     684                $userAuth->emailValid = 1; 
     685                $userAuth->password = random_string(10); // temporary until user is created 
     686                $userAuth->addUserBasic($h); 
     687                $last_insert_id = $h->db->get_var($h->db->prepare("SELECT LAST_INSERT_ID()")); 
     688                 
     689                // send password! 
     690                $passconf = md5(crypt(md5($userAuth->email),md5($userAuth->email))); 
     691                $userAuth->newRandomPassword($h, $last_insert_id, $passconf); 
     692                $h->messages[$h->lang['user_man_add_success_password_sent']] = 'green'; 
     693                 
     694                $user = ''; $email = ''; // clear the form. 
     695                 
     696            } elseif ($exists == 'id') { 
     697                $h->messages[$h->lang['user_signin_register_id_exists']] = 'red'; 
     698     
     699            } elseif ($exists == 'name') { 
     700                $h->messages[$h->lang['user_signin_register_username_exists']] = 'red'; 
     701     
     702            } elseif ($exists == 'email') { 
     703                $h->messages[$h->lang['user_signin_register_email_exists']] = 'red'; 
     704                 
     705            } elseif ($blocked) { 
     706                $h->messages[$h->lang['user_signin_register_user_blocked']] = 'red'; 
     707            } 
     708        } 
     709    } 
     710     
     711     
     712    /** 
     713     * Send new password 
     714     */ 
     715    public function sendPassword($h) 
     716    { 
     717        // check username 
     718        $username = $h->cage->post->testUsername('username'); 
     719         
     720        $userAuth = new UserAuth(); 
     721        $userAuth->getUserBasic($h, 0, $username); 
     722        if ($userAuth->id) { 
     723            // send password! 
     724            $passconf = md5(crypt(md5($userAuth->email),md5($userAuth->email))); 
     725            $userAuth->newRandomPassword($h, $userAuth->id, $passconf); 
     726            $h->messages[$h->lang['user_man_new_password_sent']] = 'green'; 
     727        } else { 
     728            $h->vars['user_man_username_2'] = $username; // to fill the username field  
     729            $h->messages[$h->lang['user_man_user_not_found']] = 'red'; 
     730        } 
     731    } 
     732     
     733     
     734    /** 
     735     * Send email validation request 
     736     */ 
     737    public function sendEmailValidationRequest($h) 
     738    { 
     739        // check username 
     740        $username = $h->cage->post->testUsername('username'); 
     741        $userid = $h->getUserIdFromName($username); 
     742         
     743        if ($userid) { 
     744            // send email validation request 
     745            $us = new UserSignin(); 
     746            $us->sendConfirmationEmail($h, $userid); 
     747            $h->messages[$h->lang['user_man_email_validation_request_sent']] = 'green'; 
     748        } else { 
     749            $h->vars['user_man_username_3'] = $username; // to fill the username field  
     750            $h->messages[$h->lang['user_man_user_not_found']] = 'red'; 
     751        } 
     752    } 
    612753} 
    613754?> 
  • trunk/content/plugins/user_signin/readme.txt

    r1248 r1375  
    1515Changelog 
    1616--------- 
     17v.0.4 2010/03/20 - Nick - Fix for emails when using SMTP email authentication 
    1718v.0.3 2010/02/26 - Nick - New plugin hook in the registration form; mail sent through Hotaru's email function 
    1819v.0.2 2010/02/23 - Nick - Throws out killspammed, banned or suspended users when checking the cookie 
  • trunk/content/plugins/user_signin/user_signin.php

    r1248 r1375  
    33 * name: User Signin 
    44 * description: Provides user registration and login 
    5  * version: 0.3 
     5 * version: 0.4 
    66 * folder: user_signin 
    77 * type: signin 
     
    589589        $body .= $h->lang['user_signin_register_emailconf_body_sign']; 
    590590        $to = $user->email; 
    591         $headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    592591         
    593592        /* 
     
    598597        */ 
    599598 
    600         $h->email($to, $subject, $body, $headers);     
     599        $h->email($to, $subject, $body);     
    601600    } 
    602601     
  • trunk/content/plugins/users/css/users.css

    r1307 r1375  
    1818 
    1919#profile_avatar { float: left; margin: 0.6em 1.0em 1.0em 0; } 
    20 #profile_bio { float: left; margin: 0.6em 1.0em 1.0em 0; } 
     20#profile_bio { float: left; margin: 0.6em 0 1.0em 0; width: 80%; } 
    2121#profile_usage { margin: 0 1.0em 1.0em 0; } 
  • trunk/content/plugins/users/libs/UserFunctions.php

    r1305 r1375  
    122122            $body .= $h->lang['userfunctions_notifymods_body_sign']; 
    123123            $to = $mod['email']; 
    124             $headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    125          
    126             $h->email($to, $subject, $body, $headers); 
     124             
     125            $h->email($to, $subject, $body); 
    127126        } 
    128127         
  • trunk/content/plugins/users/readme.txt

    r1311 r1375  
    1414Changelog 
    1515--------- 
     16v.1.7 2010/03/20 - Nick - Fix for moderator email notification when using SMTP email authentication 
    1617v.1.6 2010/03/13 - Nick - Fix for missing user menu when viewing a message 
    1718v.1.5 2010/02/28 - Nick - Fix for undefined $user errors 
  • trunk/content/plugins/users/users.php

    r1311 r1375  
    33 * name: Users 
    44 * description: Provides profile, settings and permission pages 
    5  * version: 1.6 
     5 * version: 1.7 
    66 * folder: users 
    77 * type: users 
  • trunk/content/themes/hotaru-light/css/style.css

    r1108 r1375  
    7575.red     { background-color: #FF6A55; color: #ffffff; } 
    7676.bold_red { color: red; font-weight: bold; } 
     77.yellow   { background-color: #fbe760; } 
    7778 
    7879/* SITE CLOSED MESSAGE */ 
     
    8081#site_closed { background-color: #fff; border-top: 2px solid #000; border-bottom: 2px solid #000;  
    8182                text-align: center; margin-top: 4em; font-size: 1.6em; line-height: 1.8em; } 
    82  
     83#site_closed_admin_link { font-size: 8pt; margin-top: 1.0em; } 
    8384 
    8485.post_breadcrumbs_links_bar { 
  • trunk/content/themes/keep-it-simple/css/style.css

    r1190 r1375  
    7070p, dl { padding: 10px 15px; } 
    7171 
     72/* SITE CLOSED MESSAGE */ 
     73 
     74#site_closed { background-color: #fff; border-top: 2px solid #000; border-bottom: 2px solid #000;  
     75                text-align: center; margin-top: 4em; font-size: 1.6em; line-height: 1.8em; } 
     76                 
     77#site_closed_admin_link { font-size: 8pt; margin-top: 1.0em; } 
     78 
    7279/* Images */ 
    7380img { 
     
    748755} 
    749756 
     757.green    { background-color: #99FF66; } 
     758.yellow   { background-color: #fbe760; } 
     759.red      { background-color: #FF6A55; color: #ffffff; } 
     760.bold_red { color: red; font-weight: bold; } 
     761 
    750762/* Search Box */ 
    751763 
  • trunk/content/themes/shibuya/css/style.css

    r1199 r1375  
    9898 
    9999.green    { background-color: #99FF66; } 
     100.yellow    { background-color: #fbe760; } 
    100101.red      { background-color: #FF6A55; color: #ffffff; } 
    101102.bold_red { color: red; font-weight: bold; } 
     
    105106#site_closed { background-color: #fff; border-top: 2px solid #000; border-bottom: 2px solid #000;  
    106107                text-align: center; margin-top: 4em; font-size: 1.6em; line-height: 1.8em; } 
     108 
     109#site_closed_admin_link { font-size: 8pt; margin-top: 1.0em; } 
    107110 
    108111/* BREADCRUMBS */ 
  • trunk/functions/funcs.arrays.php

    r1081 r1375  
    117117} 
    118118 
     119 
     120/** 
     121 * Is serialized? 
     122 * 
     123 * @param mixed $data 
     124 * @return bool  
     125 * @link http://www.weberdev.com/get_example-4099.html 
     126 */ 
     127function is_serialized($data) 
     128{ 
     129    if (!$data || !is_string($data)) { 
     130        return false; 
     131    } 
     132     
     133    if (preg_match("/^(i|s|a|o|d)(.*);/si",$data)) { 
     134        return true; 
     135    } 
     136    return false; 
     137} 
     138 
    119139?> 
  • trunk/functions/funcs.strings.php

    r1108 r1375  
    558558 
    559559 
     560if(!function_exists("iconv")) 
     561{ 
     562    /** 
     563     * Convert string to requested character encoding if iconv library not installed 
     564     * 
     565     * @param string $from 
     566     * @param string $to 
     567     * @param string $string 
     568     * @return string 
     569     * @link http://www.jpfox.fr/?post/2007/07/25/165-alternative-a-la-fonction-php-iconv 
     570     */ 
     571    function iconv($from, $to, $string) 
     572    { 
     573        $converted = htmlentities($string, ENT_NOQUOTES, $from);  
     574        $converted = html_entity_decode($converted, ENT_NOQUOTES, $to); 
     575        return $converted; 
     576    } 
     577} 
     578 
     579 
     580/** 
     581 * Count urls within a block of text 
     582 * 
     583 * @return int  
     584 * @link http://www.liamdelahunty.com/tips/php_url_count_check_for_comment_spam.php 
     585 */ 
     586function countUrls($text = '') 
     587{ 
     588    //$http = substr_count($text, "http"); 
     589    $href = substr_count($text, "href"); 
     590    $url = substr_count($text, "[url"); 
     591     
     592    return $href + $url; 
     593} 
     594 
     595 
    560596/** 
    561597 * Strip foreign characters from latin1/utf8 database yuckiness 
     
    573609    return $str; 
    574610} 
    575  
    576  
    577 /** 
    578  * Count urls within a block of text 
    579  * 
    580  * @return int  
    581  * @link http://www.liamdelahunty.com/tips/php_url_count_check_for_comment_spam.php 
    582  */ 
    583 function countUrls($text = '') 
    584 { 
    585     //$http = substr_count($text, "http"); 
    586     $href = substr_count($text, "href"); 
    587     $url = substr_count($text, "[url"); 
    588      
    589     return $href + $url; 
    590 } 
    591611?> 
  • trunk/htaccess_default

    r1234 r1375  
    88## If Hotaru is installed in a subfolder, change the below line to RewriteBase /name-of-subfolder 
    99RewriteBase / 
    10 ## If installed in a subfolder you may need to add ## to the beginning of the next line 
     10## If installed in a subfolder or subdomain you may need to add ## to the beginning of the next line 
    1111RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/ 
    1212 
    13 ## Remove these two lines if you have a sub-domain like  http://bookmarking.myhotarusite.com  or http://localhost 
     13## Remove these two lines if you have a subdomain like  http://bookmarking.myhotarusite.com  or http://localhost 
    1414## Keep if your site url looks like http://www.myhotarusite.com 
    1515RewriteCond %{HTTP_HOST} !^www\. 
  • trunk/install/install.php

    r1081 r1375  
    325325            // Insert default settings 
    326326            $sql = "INSERT INTO " . TABLE_USERS . " (user_username, user_role, user_date, user_password, user_email, user_permissions) VALUES (%s, %s, CURRENT_TIMESTAMP, %s, %s, %s)"; 
    327             $h->db->query($h->db->prepare($sql, 'admin', 'admin', 'password', 'admin@mysite.com', serialize($h->currentUser->getDefaultPermissions($h, 'admin')))); 
     327            $h->db->query($h->db->prepare($sql, 'admin', 'admin', 'password', 'admin@example.com', serialize($h->currentUser->getDefaultPermissions($h, 'admin')))); 
    328328            $user_name = 'admin'; 
    329             $user_email = 'admin@mysite.com'; 
     329            $user_email = 'admin@example.com'; 
    330330            $user_password = 'password'; 
    331331        }  
  • trunk/install/install_tables.php

    r1305 r1375  
    343343        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    344344        $db->query($db->prepare($sql, 'SITE_EMAIL', 'email@example.com', 'email@example.com', 'Must be changed')); 
     345 
     346         // GMT Offset 
     347        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     348        $db->query($db->prepare($sql, 'SYS_FEEDBACK', 'true', 'true', 'send system report')); 
    345349         
    346350        // Database cache 
    347351        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    348         $db->query($db->prepare($sql, 'DB_CACHE_ON', 'false', 'false', '')); 
     352        $db->query($db->prepare($sql, 'DB_CACHE', 'false', 'false', '')); 
    349353         
    350354        // Database cache duration (hours) 
     
    354358        // RSS cache 
    355359        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    356         $db->query($db->prepare($sql, 'RSS_CACHE_ON', 'true', 'true', '')); 
     360        $db->query($db->prepare($sql, 'RSS_CACHE', 'true', 'true', '')); 
    357361         
    358362        // RSS cache duration (hours) 
     
    362366        // CSS/JavaScript cache 
    363367        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    364         $db->query($db->prepare($sql, 'CSS_JS_CACHE_ON', 'true', 'true', '')); 
     368        $db->query($db->prepare($sql, 'CSS_JS_CACHE', 'true', 'true', '')); 
    365369         
    366370        // HTML cache 
    367371        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    368         $db->query($db->prepare($sql, 'HTML_CACHE_ON', 'true', 'true', '')); 
     372        $db->query($db->prepare($sql, 'HTML_CACHE', 'true', 'true', '')); 
    369373         
    370374        // Debug 
     
    374378        // SMTP on 
    375379        $sql = "INSERT INTO " . DB_PREFIX . $table_name . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
    376         $db->query($db->prepare($sql, 'SMTP_ON', 'false', 'false', 'Email auth')); 
     380        $db->query($db->prepare($sql, 'SMTP', 'false', 'false', 'Email auth')); 
    377381         
    378382        // SMTP host 
  • trunk/install/upgrade.php

    r1305 r1375  
    371371        $old_version = "1.1.2";  
    372372    } 
     373 
     374     // 1.1.2 to 1.1.3 
     375    if ($old_version == "1.1.2") { 
     376 
     377        // System Feedback 
     378        $sql = "INSERT INTO " . TABLE_SETTINGS . " (settings_name, settings_value, settings_default, settings_note) VALUES (%s, %s, %s, %s)"; 
     379        $h->db->query($h->db->prepare($sql, 'SYS_FEEDBACK', 'true', 'true', 'send system report')); 
     380 
     381        // Remove ON from constant names 
     382        $sql = "UPDATE " . TABLE_SETTINGS . " SET settings_name = %s WHERE settings_name = %s"; 
     383        $h->db->query($h->db->prepare($sql, 'DB_CACHE', 'DB_CACHE_ON')); 
     384 
     385        $sql = "UPDATE " . TABLE_SETTINGS . " SET settings_name = %s WHERE settings_name = %s"; 
     386        $h->db->query($h->db->prepare($sql, 'RSS_CACHE', 'RSS_CACHE_ON')); 
     387 
     388        $sql = "UPDATE " . TABLE_SETTINGS . " SET settings_name = %s WHERE settings_name = %s"; 
     389        $h->db->query($h->db->prepare($sql, 'CSS_JS_CACHE', 'CSS_JS_CACHE_ON')); 
     390         
     391        $sql = "UPDATE " . TABLE_SETTINGS . " SET settings_name = %s WHERE settings_name = %s"; 
     392        $h->db->query($h->db->prepare($sql, 'HTML_CACHE', 'HTML_CACHE_ON')); 
     393 
     394        $sql = "UPDATE " . TABLE_SETTINGS . " SET settings_name = %s WHERE settings_name = %s"; 
     395        $h->db->query($h->db->prepare($sql, 'SMTP', 'SMTP_ON')); 
     396         
     397        // update "old version" for next set of upgrades 
     398        $old_version = "1.1.3";  
     399    } 
    373400     
    374401    // Update Hotaru version number to the database (referred to when upgrading) 
  • trunk/libs/AdminPages.php

    r1305 r1375  
    153153                } 
    154154            } 
     155 
     156            // cron hook to include SYS_FEEDBACK job 
     157            if ($h->cage->post->keyExists('SYS_FEEDBACK') == 'true' ) { 
     158                $timestamp = time(); 
     159                $recurrence = "daily"; 
     160                $hook = "cron_hotaru_feedback"; 
     161                $cron_data = array('timestamp'=>$timestamp, 'recurrence'=>$recurrence, 'hook'=>$hook); 
     162                $h->pluginHook('cron_update_job', 'cron', $cron_data); 
     163            } 
     164            else { 
     165                $hook = "cron_hotaru_feedback"; 
     166                $cron_data = array('hook'=>$hook); 
     167                $h->pluginHook('cron_delete_job', 'cron', $cron_data); 
     168            } 
     169 
    155170             
    156171            if ($error == 0) { 
     
    246261        $maintenance->getSiteAnnouncement($h); 
    247262         
    248         $h->vars['debug_files'] = $h->getFiles(CACHE . 'debug_logs'); 
    249          
    250         // if no action, return now 
    251         if (!$action = $h->cage->get->testAlnumLines('action')) { return false; } 
     263        // check if we're viewing a debug file 
     264        $debug_file = $h->cage->get->noPath('debug'); 
     265        if ($debug_file) { 
     266            // skip the opening die() statement and echo debug file 
     267            $debug_contents = file_get_contents(CACHE . 'debug_logs/' . $debug_file, NULL, NULL, 16); 
     268            echo nl2br($debug_contents); 
     269            exit;  
     270        } 
     271                 
     272        // check if we're performing an action 
     273        $action = $h->cage->get->testAlnumLines('action'); 
    252274         
    253275        if ($action == 'announcement') { $maintenance->addSiteAnnouncement($h); } 
     
    270292        if ($action == 'drop') { $h->dropTable($h->cage->get->testAlnumLines('table')); } 
    271293        if ($action == 'remove_settings') { $h->removeSettings($h->cage->get->testAlnumLines('settings')); } 
     294        if ($action == 'system_report') { $h->generateReport(); }  
     295        if ($action == 'email_report') { $h->generateReport('email'); }  
    272296        if ($action == 'delete_debugs') {  
    273297            $h->clearCache('debug_logs'); 
    274298            $h->vars['debug_files'] = $h->getFiles(CACHE . 'debug_logs'); 
    275299        } 
     300         
     301        // get list of debug logs 
     302        $h->vars['debug_files'] = $h->getFiles(CACHE . 'debug_logs'); 
    276303    } 
    277304     
  • trunk/libs/Caching.php

    r1304 r1375  
    6666    public function smartCacheHTML($h, $table = '', $timeout = 0, $html = '', $label = '') 
    6767    { 
    68         if (!$table || !$timeout || (HTML_CACHE_ON != 'true')) { return false; } 
     68        if (!$table || !$timeout || (HTML_CACHE != 'true')) { return false; } 
    6969         
    7070        if(isset($h->vars['last_updates'][$table])) { 
     
    159159         
    160160        // use caching? 
    161         if (DB_CACHE_ON == 'true') { 
     161        if (DB_CACHE == 'true') { 
    162162            $h->db->cache_queries = true;    // start using cache 
    163163        } else { 
     
    259259    public function cacheHTML($h, $timeout = 0, $html = '', $label = '') 
    260260    { 
    261         if (!$timeout || (HTML_CACHE_ON != 'true') || !$label) { return false; } 
     261        if (!$timeout || (HTML_CACHE != 'true') || !$label) { return false; } 
    262262         
    263263        $cache_length = $timeout*60;   // seconds 
  • trunk/libs/Category.php

    r1234 r1375  
    180180 
    181181        $sql = "SELECT * FROM " . TABLE_CATEGORIES . $where . $orderBy ; 
    182         print $sql; 
     182         
    183183        $categories = $h->db->get_results($h->db->prepare($sql, $where_d)); 
    184184        if ($categories) { return $categories; } else { return false; } 
  • trunk/libs/Debug.php

    r1280 r1375  
    6161    public function openLog($type = 'debug', $mode = 'a+') 
    6262    { 
    63         $this->log[$type] = CACHE . "debug_logs/" . $type . ".txt"; 
    64          
    65         // auto-delete the file after 1 week: 
    66         /* 
    67         $last_modified = filemtime($this->log[$type]); 
    68         $expire = (7 * 24 * 60 * 60); // 1 week 
    69         if ($last_modified < (time() - $expire)) { unlink ($this->log[$type]); } 
    70         */ 
    71          
    72         // open/create a file: 
    73         $this->fh[$type] = fopen($this->log[$type], $mode) or die("can't open file"); 
     63        $this->log[$type] = CACHE . "debug_logs/" . $type . ".php"; 
     64         
     65        // delete file if over 500KB 
     66        if (file_exists($this->log[$type]) && (filesize($this->log[$type]) > 500000)) { 
     67            unlink($this->log[$type]);  
     68        } 
     69         
     70        // If doesn't exist or rewriting, create a new file with die() at the top 
     71        if (!file_exists($this->log[$type]) || ($mode != 'a' && $mode != 'a+')) { 
     72            $this->fh[$type] = fopen($this->log[$type], $mode) or die("Sorry, I can't open cache/debug_logs/" . $type . ".php"); 
     73            fwrite($this->fh[$type], "<?php die(); ?>\r\n"); 
     74        } else { 
     75            // open existing file: 
     76            $this->fh[$type] = fopen($this->log[$type], $mode) or die("can't open file"); 
     77        } 
    7478    } 
    7579     
     
    8387    { 
    8488        if ($string) { 
    85             $string = date('d M Y H:i:s', time()) . ": " . $string . "\n"; 
     89            $string = date('d M Y H:i:s', time()) . " " . $string . "\n"; 
    8690            fwrite($this->fh[$type], $string); 
    8791        } 
     
    97101    { 
    98102        if (isset($this->fh[$type])) { fclose($this->fh[$type]); } 
     103    } 
     104     
     105     
     106    /** 
     107     * Generate a System Report 
     108     * 
     109     * @param string $type 'log', 'email' or 'object' 
     110     */ 
     111    public function generateReport($h, $type = 'log') 
     112    { 
     113        $report = $this->getSystemData($h); 
     114         
     115        if ($type == 'object') { return $report; } 
     116         
     117        if ($type == 'email') { 
     118            $to = "admin@hotarucms.org"; // do not change! 
     119            $subject = "System Report from " . SITE_NAME; 
     120            $body = $this->logSystemReport($h, $report); 
     121            $h->email($to, $subject, $body); 
     122            $h->message = $h->lang['admin_maintenance_system_report_emailed']; 
     123            $h->messageType = 'green'; 
     124            return true; 
     125        } 
     126         
     127        $h->openLog('system_report', 'w'); 
     128         
     129        // convert object to text 
     130        $output = $this->logSystemReport($h, $report); 
     131        if ($output) { 
     132            $h->writeLog('system_report', $output); 
     133            $h->closeLog('system_report'); 
     134             
     135            $h->message = $h->lang['admin_maintenance_system_report_success']; 
     136            $h->messageType = 'green'; 
     137            return true; 
     138        } else { 
     139            $h->message = $h->lang['admin_maintenance_system_report_failure']; 
     140            $h->messageType = 'red'; 
     141            return false; 
     142        } 
     143    } 
     144 
     145    /** 
     146     * Get system data 
     147     * 
     148     * @param string $type 'log' or 'object' 
     149     * @return object 
     150     */ 
     151    public function getSystemData($h) 
     152    { 
     153        // essentials: 
     154         
     155        $report['hotaru_site_name'] = SITE_NAME; 
     156        $report['hotaru_baseurl'] = BASEURL; 
     157         
     158        $report['php_version'] = phpversion(); 
     159        $report['mysql_version'] = $h->db->get_var("SELECT VERSION() AS VE"); 
     160        $report['hotaru_version'] = $h->version; 
     161        $report['php_extensions'] = get_loaded_extensions(); 
     162         
     163        $sql = "SELECT miscdata_value FROM " . TABLE_MISCDATA . " WHERE miscdata_key = %s"; 
     164        $report['hotaru_version_db'] = $h->db->get_var($h->db->prepare($sql, 'hotaru_version')); 
     165         
     166        // default permissions 
     167         
     168        $sql = "SELECT miscdata_value FROM " . TABLE_MISCDATA . " WHERE miscdata_key = %s"; 
     169        $report['hotaru_permissions'] = $h->db->get_var($h->db->prepare($sql, 'permissions')); 
     170         
     171        // default user settings 
     172         
     173        $sql = "SELECT miscdata_value FROM " . TABLE_MISCDATA . " WHERE miscdata_key = %s"; 
     174        $report['hotaru_user_settings'] = $h->db->get_var($h->db->prepare($sql, 'user_settings')); 
     175         
     176        // plugins: folder, enabled, version, order 
     177         
     178        $sql = "SELECT plugin_folder, plugin_enabled, plugin_version, plugin_order FROM " . TABLE_PLUGINS . " ORDER BY plugin_order"; 
     179        $plugins = $h->db->get_results($h->db->prepare($sql)); 
     180        if ($plugins) { 
     181            foreach ($plugins as $plugin) { 
     182                $report['hotaru_plugins'][$plugin->plugin_folder]['enabled'] = $plugin->plugin_enabled; 
     183                $report['hotaru_plugins'][$plugin->plugin_folder]['version'] = $plugin->plugin_version; 
     184                $report['hotaru_plugins'][$plugin->plugin_folder]['order'] = $plugin->plugin_order; 
     185            } 
     186        } 
     187         
     188        // plugin hooks: id, folder, hook name 
     189         
     190        $sql = "SELECT phook_id, plugin_folder, plugin_hook FROM " . TABLE_PLUGINHOOKS; 
     191        $plugins = $h->db->get_results($h->db->prepare($sql)); 
     192        if ($plugins) { 
     193            foreach ($plugins as $plugin) { 
     194                $report['hotaru_plugin_hooks'][$plugin->phook_id]['folder'] = $plugin->plugin_folder; 
     195                $report['hotaru_plugin_hooks'][$plugin->phook_id]['hook'] = $plugin->plugin_hook; 
     196            } 
     197        } 
     198 
     199        // plugin settings: folder, setting (can't use value because might include passwords) 
     200         
     201        $sql = "SELECT plugin_folder, plugin_setting, plugin_value FROM " . TABLE_PLUGINSETTINGS; 
     202        $plugins = $h->db->get_results($h->db->prepare($sql)); 
     203        if ($plugins) { 
     204            foreach ($plugins as $plugin) { 
     205                if (is_serialized($plugin->plugin_value)) { $plugin->plugin_value = unserialize($plugin->plugin_value); } 
     206                $report['hotaru_plugin_settings'][$plugin->plugin_folder][$plugin->plugin_setting] = $this->applyMaskToArrays($h, $plugin->plugin_value); 
     207            } 
     208        } 
     209         
     210        // Settings: Name, value (excluding SMTP PASSWORD) 
     211         
     212        $sql = "SELECT settings_name, settings_value FROM " . TABLE_SETTINGS; 
     213        $settings = $h->db->get_results($h->db->prepare($sql)); 
     214        if ($settings) { 
     215            foreach ($settings as $setting) { 
     216                // mask sensitive data 
     217                switch ($setting->settings_name) { 
     218                    case 'SITE_EMAIL': 
     219                    case 'SMTP_HOST': 
     220                    case 'SMTP_PORT': 
     221                    case 'SMTP_USERNAME': 
     222                    case 'SMTP_PASSWORD': 
     223                        $setting->settings_value = preg_replace("/[a-zA-Z0-9]/", "*", $setting->settings_value); 
     224                        break; 
     225                } 
     226                $report['hotaru_settings'][$setting->settings_name] = $setting->settings_value; 
     227            } 
     228        } 
     229         
     230        // Widgets: plugin, function, args 
     231         
     232        $sql = "SELECT widget_plugin, widget_function, widget_args FROM " . TABLE_WIDGETS; 
     233        $widgets = $h->db->get_results($h->db->prepare($sql)); 
     234        if ($widgets) { 
     235            foreach ($widgets as $widget) { 
     236                $report['hotaru_widgets'][$widget->widget_plugin]['function'] = $widget->widget_function; 
     237                $report['hotaru_widgets'][$widget->widget_plugin]['args'] = $widget->widget_args; 
     238            } 
     239        } 
     240         
     241        // Counts for all tables 
     242         
     243        foreach ( $h->db->get_col("SHOW TABLES",0) as $table_name ) 
     244        { 
     245            $report['hotaru_table_count'][$table_name] = $h->db->get_var("SELECT COUNT(*) FROM " . $table_name); 
     246        } 
     247 
     248        return $report; 
     249    } 
     250 
     251 
     252    /** 
     253     * Recurse through arrays, applying * mask to all values, but not keys 
     254     * 
     255     * @param array $array 
     256     * @return array 
     257     */ 
     258     public function applyMaskToArrays($h, $array) 
     259     { 
     260        //echo "<pre>"; print_r($array); echo "</pre>"; exit; 
     261        if (!is_array($array) && !is_object($array)) { return false; } 
     262         
     263        foreach ($array as $key => $value) { 
     264            if (is_array($value) || is_object($value)) { 
     265                $array[$key] = $this->applyMaskToArrays($h, $value); 
     266            } else { 
     267                $array[$key] = preg_replace("/[a-zA-Z0-9]/", "*", $value); 
     268            } 
     269        } 
     270        return $array; 
     271    } 
     272 
     273     
     274    /** 
     275     * Convert report object to text for logging to file 
     276     * 
     277     * @param object $report 
     278     */ 
     279    public function logSystemReport($h, $report = NULL) 
     280    { 
     281        $output = "\n\n"; 
     282 
     283        $output .= "Name: " . $report['hotaru_site_name'] . "\n"; 
     284        $output .= "URL: " . $report['hotaru_baseurl'] . "\n"; 
     285        $output .= "Hotaru version: " . $report['hotaru_version'] . "\n"; 
     286        $output .= "Hotaru version in database: " . $report['hotaru_version_db'] . "\n"; 
     287        $output .= "PHP version: " . $report['php_version'] . "\n"; 
     288        $output .= "MySQL version: " . $report['mysql_version'] . "\n"; 
     289        $output .= "PHP extensions: " . implode(', ', $report['php_extensions']) . "\n"; 
     290         
     291        $output .= "\n"; 
     292         
     293        $output .= "Default site permissions: \n"; 
     294        $perms = unserialize($report['hotaru_permissions']); 
     295        unset($perms['options']); // don't need to display these 
     296        foreach ($perms as $key => $value) { 
     297            $output .= $key . " => ("; 
     298            foreach ($value as $k => $v) { 
     299                $output .= $k . ": " . $v . ", "; 
     300            } 
     301            $output = rtrim($output, ", "); 
     302            $output .= ")\n"; 
     303        } 
     304         
     305        $output .= "\n"; 
     306         
     307        $output .= "Default user settings: \n"; 
     308        $user_settings = unserialize($report['hotaru_user_settings']); 
     309        foreach ($user_settings as $key => $value) { 
     310            $output .= $key . " => " . $value . "\n"; 
     311        } 
     312         
     313        $output .= "\n"; 
     314         
     315        $output .= "Plugins: \n"; 
     316        if (isset($report['hotaru_plugins'])) { 
     317            foreach ($report['hotaru_plugins'] as $key => $value) { 
     318                $output .= $value['order'] . ". " . $key . " v." . $value['version'] . " "; 
     319                if ($value['enabled']) { $output .= "[enabled] \n"; } else { $output .= "[disabled] \n"; } 
     320            } 
     321        } 
     322         
     323        $output .= "\n"; 
     324         
     325        $output .= "Plugin Hooks: \n"; 
     326        if (isset($report['hotaru_plugin_hooks'])) { 
     327            foreach ($report['hotaru_plugin_hooks'] as $key => $value) { 
     328                $output .= $key . ". " . $value['folder'] . " => " . $value['hook'] . " \n"; 
     329            } 
     330        } 
     331         
     332        $output .= "\n"; 
     333 
     334        $output .= "Plugin Settings: \n"; 
     335        if (isset($report['hotaru_plugin_settings'])) { 
     336            foreach ($report['hotaru_plugin_settings'] as $key => $value) { 
     337                foreach ($value as $k => $v) { 
     338                    if (!is_array($v)) { 
     339                        $output .= "\nPlugin settings for " . $key . ":\n...." . $k . " = " . $v . " \n"; 
     340                    } else { 
     341                        $output .= "\nPlugin settings for " . $key . ":\n"; 
     342                        $output = $this->outputArrays($h, $v, $output); 
     343                    } 
     344                } 
     345            } 
     346        } 
     347         
     348        $output .= "\n"; 
     349 
     350        $output .= "Hotaru Settings: \n"; 
     351        if (isset($report['hotaru_settings'])) { 
     352            foreach ($report['hotaru_settings'] as $key => $value) { 
     353                $output .= $key . " => " . $value . " \n"; 
     354            } 
     355        } 
     356 
     357        $output .= "\n"; 
     358         
     359        $output .= "Widgets: \n"; 
     360        if (isset($report['hotaru_widgets'])) { 
     361            foreach ($report['hotaru_widgets'] as $key => $value) { 
     362                $output .= $key . " => " . $value['function']; 
     363                if ($value['args']) { $output .= " (args: " . $value['args'] . ")"; } 
     364                $output .= "\n"; 
     365            } 
     366        } 
     367         
     368        $output .= "\n"; 
     369         
     370        $output .= "Number of rows in each table: \n"; 
     371        if (isset($report['hotaru_table_count'])) { 
     372            foreach ($report['hotaru_table_count'] as $key => $value) { 
     373                $output .= $key . " => " . $value . " \n"; 
     374            } 
     375        } 
     376         
     377        return $output; 
     378    } 
     379     
     380     
     381    /** 
     382     * Recurse through arrays, adding them to $output for display 
     383     * 
     384     * @param array $array 
     385     * @return array 
     386     */ 
     387     public function outputArrays($h, $array = array(), $output = '') 
     388     { 
     389        if (!is_array($array) && !is_object($array)) { return $output; } 
     390         
     391        foreach ($array as $key => $value) { 
     392            if (is_array($value) || is_object($array)) { 
     393                $output .= "..... " . $key . ":\n"; 
     394                $output = $this->outputArrays($h, $value, $output); 
     395            } else { 
     396                $output .= "..... " . $key . ": " . $value . " \n"; 
     397            } 
     398        } 
     399        return $output; 
    99400    } 
    100401} 
  • trunk/libs/EmailFunctions.php

    r1305 r1375  
    6464        if (!$this->from) { $this->from = SITE_NAME . ' <' . SITE_EMAIL . '>'; } 
    6565         
    66         if (SMTP_ON == 'true') { 
     66        if (SMTP == 'true') { 
    6767            // note: this overwrites headers passed to this function: 
    68             $this->headers = array ('From' => $this->from, 'To' => $this->to, 'Subject' => $this->subject); 
     68            if (is_array($this->to)) { $to = $this->to['To']; } else { $to = $this->to; } 
     69            $this->headers = array ('From' => $this->from, 'To' => $to, 'Subject' => $this->subject); 
    6970        } else { 
    7071            // if not using SMTP and no headers passed to this function, use default 
     
    9697                break; 
    9798            default: 
    98                 if (SMTP_ON == 'true') { 
     99                if (SMTP == 'true') { 
    99100                    $this->doSmtpEmail(); 
    100101                } else { 
     
    127128 
    128129        $mail = $this->smtp->send($this->to, $this->headers, $this->body); 
    129  
    130130         
    131131        if (PEAR::isError($mail)) { 
  • trunk/libs/Feeds.php

    r1305 r1375  
    3535     * @return object|false $sp 
    3636     */ 
    37     public function newSimplePie($feed='', $cache=RSS_CACHE_ON, $cache_duration=RSS_CACHE_DURATION) 
     37    public function newSimplePie($feed='', $cache=RSS_CACHE, $cache_duration=RSS_CACHE_DURATION) 
    3838    { 
    3939        include_once(EXTENSIONS . "SimplePie/simplepie.inc"); 
  • trunk/libs/IncludeCssJs.php

    r1280 r1375  
    273273 
    274274            // get code from archive folder if it exists, otherwise grab latest files, merge and save in archive folder 
    275             if ((CSS_JS_CACHE_ON == "true") && file_exists($cache . $prefix . $type . '_' . $iETag . '.cache')) { 
     275            if ((CSS_JS_CACHE == "true") && file_exists($cache . $prefix . $type . '_' . $iETag . '.cache')) { 
    276276                $sCode = file_get_contents($cache . $prefix . $type . '_' . $iETag . '.cache'); 
    277277            } else { 
  • trunk/libs/Initialize.php

    r1234 r1375  
    8686        error_reporting(E_ALL); 
    8787         
    88         // log errors to a file - the custom error handler below wasn't catching fatal errors, so using PHP's one 
    89         ini_set('error_log', CACHE . 'debug_logs/error_log.txt'); 
    90         /* 
    91         require_once(EXTENSIONS . 'SWCMS/swcms_error_handler.php'); // error_handler class 
    92         $error_handler = new swcms_error_handler(0, 0, 1, NULL, CACHE . 'debug_logs/error_log.txt'); 
    93         set_error_handler(array($error_handler, "handler")); 
    94         */ 
     88        // error log filename 
     89        $filename = CACHE . 'debug_logs/error_log.php'; 
     90         
     91        // delete file if over 500KB 
     92        if (file_exists($filename) && (filesize($filename) > 500000)) { 
     93            unlink($filename);  
     94        } 
     95         
     96        // If doesn't exist, create a new file with die() at the top 
     97        if (!file_exists($filename)) { 
     98            $fh = fopen($filename, 'w') or die("Sorry, I can't open cache/debug_logs/error_log.php"); 
     99            fwrite($fh, "<?php die(); ?>\r\n"); 
     100            fclose($fh); 
     101        } 
     102         
     103        // point PHP to our error log 
     104        ini_set('error_log', $filename); 
    95105    } 
    96106 
     
    214224        $this->db->cache_timeout = DB_CACHE_DURATION; // Note: this is hours 
    215225        $this->db->cache_dir = CACHE . 'db_cache'; 
    216         if (DB_CACHE_ON == "true") { 
     226        if (DB_CACHE == "true") { 
    217227            $this->db->use_disk_cache = true; 
    218228            return true; 
     
    236246            timer_start(); 
    237247            ini_set('display_errors', 1); // show errors 
    238             ini_set('error_log', CACHE . 'debug_logs/error_log.txt'); 
    239248            return true; 
    240249        } else { 
  • trunk/libs/Language.php

    r1081 r1375  
    101101    public function includeThemeLanguage($h, $filename = 'main') 
    102102    { 
    103         // Look in the current theme a language file... 
     103        if ($filename == 'admin') { 
     104            $this->includeAdminLanguage($h); 
     105            return true; 
     106        } 
     107         
     108        // Look in the current theme for a language file... 
    104109        if (file_exists(THEMES . THEME . 'languages/' . $filename . '_language.php')) { 
    105110            include_once(THEMES . THEME . 'languages/' . $filename . '_language.php'); 
     
    113118        } 
    114119    } 
     120     
     121     
     122    /** 
     123     * Include admin_language.php 
     124     * 
     125     * Hotaru has already got the base admin_language.php file from /content, but 
     126     * all or parts of it can be overidden. 
     127     *  
     128     * First Hotaru looks for admin_languages.php in the admin theme's "languages" folder 
     129     * Second, it looks for admin_languages.php in the user theme's "languages" folder. 
     130     * All files are merged with priority in this order: user theme, admin theme, content/admin_language.php 
     131     */     
     132    public function includeAdminLanguage($h) 
     133    { 
     134        // 1. We already have admin_language.php from content/admin_language.php 
     135         
     136        // 2. Merge in anything from admin_language.php in admin theme languages folder 
     137         
     138        if (file_exists(ADMIN_THEMES . ADMIN_THEME . 'languages/admin_language.php')) { 
     139            include_once(ADMIN_THEMES . ADMIN_THEME . 'languages/admin_language.php'); 
     140            // Add new language to our lang property 
     141            if (isset($lang)) { 
     142                foreach($lang as $l => $text) { 
     143                    $h->lang[$l] = $text; 
     144                } 
     145            } 
     146        } 
     147         
     148        // 2. Merge in anything from admin_language.php in user theme languages folder 
     149         
     150        if (file_exists(THEMES . THEME . 'languages/admin_language.php')) { 
     151            include_once(THEMES . THEME . 'languages/admin_language.php'); 
     152            // Add new language to our lang property 
     153            if (isset($lang)) { 
     154                foreach($lang as $l => $text) { 
     155                    $h->lang[$l] = $text; 
     156                } 
     157            } 
     158        }  
     159    } 
    115160} 
    116161?> 
  • trunk/libs/Maintenance.php

    r1304 r1375  
    2626class Maintenance 
    2727{ 
     28    /**  
     29     * System Report is in libs/Debug.php  
     30     */ 
     31      
     32 
    2833    /** 
    2934     * Calls the delete_files function, then displays a message. 
  • trunk/libs/Post.php

    r1108 r1375  
    160160        $this->vars['last_insert_id'] = $last_insert_id;    // make it available outside this class 
    161161         
     162        // Update post_date field if $this->date has been declared 
     163        // Normally used when scheduling or auto-submitting posts 
     164        if ($this->date) { 
     165           $date = date('YmdHis', $this->date); 
     166           $sql = "UPDATE " . TABLE_POSTS . " SET post_date = %s WHERE post_id = %d"; 
     167           $h->db->query($h->db->prepare($sql, $date, $last_insert_id)); 
     168        } 
     169 
    162170        // Add tags to the Tags table: 
    163171        require_once(LIBS . 'Tags.php'); 
  • trunk/libs/UserAuth.php

    r1234 r1375  
    282282                $error = 1; 
    283283            } 
    284      
     284         
    285285            $username_check = $h->cage->post->testUsername('username'); // alphanumeric, dashes and underscores okay, case insensitive 
    286286            if (!$username_check) { 
    287287                $h->messages[$h->lang['main_user_account_update_username_error']] = 'red'; 
    288288                $error = 1; 
    289             } elseif($h->nameExists($username_check, '', $viewee->id)) { 
     289            } elseif($h->nameExists($username_check, '', $viewee->id) || $h->isBlocked('user', $username_check)) { 
    290290                $h->messages[$h->lang['main_user_account_update_username_exists']] = 'red'; 
    291291                $error = 1; 
     
    299299                $h->messages[$h->lang['main_user_account_update_email_error']] = 'red'; 
    300300                $error = 1; 
    301             } elseif($h->emailExists($email_check, '', $viewee->id)) { 
     301            } elseif($h->emailExists($email_check, '', $viewee->id) || $h->isBlocked('email', $email_check)) { 
    302302                $h->messages[$h->lang['main_user_account_update_email_exists']] = 'red'; 
    303303                $error = 1; 
     
    490490        $body .= $h->lang['main_user_email_password_conf_body_sign']; 
    491491        $to = $email; 
    492         $headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    493      
    494         mail($to, $subject, $body, $headers);     
     492     
     493        $h->email($to, $subject, $body);     
    495494         
    496495        return true; 
     
    544543        $body .= $h->lang['main_user_email_password_conf_body_sign']; 
    545544        $to = $email; 
    546         $headers = "From: " . SITE_EMAIL . "\r\nReply-To: " . SITE_EMAIL . "\r\nX-Priority: 3\r\n"; 
    547      
    548         mail($to, $subject, $body, $headers);     
     545     
     546        $h->email($to, $subject, $body);     
    549547         
    550548        return true; 
Note: See TracChangeset for help on using the changeset viewer.