Changeset 1190


Ignore:
Timestamp:
02/20/10 11:29:15 (3 years ago)
Author:
nick_ramsay
Message:

[TRUNK] Hotaru 1.1 - run install/upgrade.php and upgrade the plugins by turning them off and back on again. Details in forum soon.

Location:
trunk
Files:
1 deleted
96 edited
25 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Hotaru.php

    r1081 r1190  
    2626class Hotaru 
    2727{ 
    28     protected $version              = "1.0.5";  // Hotaru CMS version 
     28    protected $version              = "1.1";  // 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 
     
    357357     
    358358    /** 
    359      * Prepare pagination 
    360      * 
    361      * @param array $items - array of all items to show 
     359     * Pagination with query and row count (better for large sets of data) 
     360     * 
     361     * @param string $query - SQL query 
     362     * @param int $total_items - total row count 
    362363     * @param int $items_per_page 
    363      * @param int $pg - current page number 
    364      * @return object - object of type Paginated 
    365      */ 
    366     public function pagination($items = array(), $items_per_page = 10, $pg = 0) 
    367     { 
    368         $pageHandling = new PageHandling(); 
    369         return $pageHandling->pagination($this, $items, $items_per_page, $pg); 
     364     * @param string $cache_table - must provide a table, e.g. "posts" for caching to be used 
     365     * @return object|false - object 
     366     */ 
     367    public function pagination($query, $total_items, $items_per_page = 10, $cache_table = '') 
     368    { 
     369        require_once(LIBS . 'Paginator.php'); 
     370        $paginator = new Paginator(); 
     371        return $paginator->pagination($this, $query, $total_items, $items_per_page, $cache_table); 
     372    } 
     373     
     374 
     375    /** 
     376     * Pagination with full dataset (easier for small sets of data) 
     377     * 
     378     * @param array $data - array of results for paginating 
     379     * @param int $items_per_page 
     380     * @return object|false - object 
     381     */ 
     382    public function paginationFull($data, $items_per_page = 10) 
     383    { 
     384        require_once(LIBS . 'Paginator.php'); 
     385        $paginator = new Paginator(); 
     386        return $paginator->paginationFull($this, $data, $items_per_page); 
    370387    } 
    371388     
     
    374391     * Return page numbers bar 
    375392     * 
    376      * @param object $pageObject - current object of type Paginated 
     393     * @param object $paginator - current object of type Paginator 
    377394     * @return string - HTML for page number bar 
    378395     */ 
    379     public function pageBar($pageObject = NULL) 
    380     { 
    381         $pageHandling = new PageHandling(); 
    382         return $pageHandling->pageBar($this, $pageObject); 
     396    public function pageBar($paginator = NULL) 
     397    { 
     398        return $paginator->pageBar($this); 
    383399    } 
    384400     
     
    10641080        $version_js = $this->includes->combineIncludes($this, 'js'); 
    10651081        $version_css = $this->includes->combineIncludes($this, 'css'); 
    1066         $this->includes->includeCombined($version_js, $version_css, $this->isAdmin); 
     1082        $this->includes->includeCombined($this, $version_js, $version_css, $this->isAdmin); 
    10671083     } 
    10681084      
     
    18781894     
    18791895     
     1896    /** 
     1897     * Returns meta description and keywords for the category (if available) 
     1898     * 
     1899     * @param int $cat_id 
     1900     * @return array|false 
     1901     */ 
     1902    public function getCatMeta($cat_id) 
     1903    { 
     1904        require_once(LIBS . 'Category.php'); 
     1905        $category = new Category(); 
     1906        return $category->getCatMeta($this, $cat_id); 
     1907    } 
     1908     
     1909     
    18801910/* ************************************************************* 
    18811911 * 
  • trunk/READ_ME.txt

    r1081 r1190  
    11HOTARU CMS 
    2 Version: 1.0.5 
    3 Released: Feb 1st 2010 
     2Version: 1.1 
     3Released: Feb 20th 2010 
    44 
    55INSTALLATION 
  • trunk/content/admin_themes/admin_default/blocked_list.php

    r1081 r1190  
    3636<?php echo $h->showMessage(); ?> 
    3737 
    38 <form name='blocked_list_new_form' action='<?php echo BASEURL; ?>admin_index.php' method='post'> 
     38<form name='blocked_list_new_form' action='<?php echo BASEURL; ?>admin_index.php?page=blocked_list' method='post'> 
    3939    <h3><?php echo $h->lang["admin_theme_blocked_new"]; ?></h3> 
    4040    <table> 
     
    5050        </tr> 
    5151    </table> 
    52     <input type='hidden' name='page' value='blocked_list' /> 
    5352    <input type='hidden' name='type' value='new' /> 
    5453    <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> 
     
    5756<table><tr><td> 
    5857 
    59 <form name='blocked_list_search_form' action='<?php echo BASEURL; ?>admin_index.php' method='post'> 
     58<form name='blocked_list_search_form' action='<?php echo BASEURL; ?>admin_index.php?page=blocked_list' method='post'> 
    6059    <h3><?php echo $h->lang["admin_theme_blocked_search"]; ?></h3> 
    6160    <table> 
     
    6564        </tr> 
    6665    </table> 
    67     <input type='hidden' name='page' value='blocked_list' /> 
    6866    <input type='hidden' name='type' value='search' /> 
    6967    <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> 
     
    7270</td><td> 
    7371 
    74 <form name='blocked_list_filter_form' action='<?php echo BASEURL; ?>admin_index.php' method='post'> 
     72<form name='blocked_list_filter_form' action='<?php echo BASEURL; ?>admin_index.php?page=blocked_list' method='post'> 
    7573    <h3><?php echo $h->lang["admin_theme_blocked_filter"]; ?></h3> 
    7674    <table> 
     
    8684        </tr> 
    8785    </table> 
    88     <input type='hidden' name='page' value='blocked_list' /> 
    8986    <input type='hidden' name='type' value='filter' /> 
    9087    <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> 
     
    107104<?php  
    108105    if (isset($pagedResults)) { 
    109         $pagedResults->setLayout(new DoubleBarLayout()); 
    110         echo $pagedResults->fetchPagedNavigation($h); 
     106        echo $h->pageBar($pagedResults); 
    111107    } 
    112108?> 
  • trunk/content/admin_themes/admin_default/header.php

    r1081 r1190  
    3333<html> 
    3434<head> 
    35     <meta http-equiv=Content-Type content="text/html; charset=UTF-8"> 
     35    <meta http-equiv=Content-Type content="text/html; charset=UTF-8" /> 
    3636     
    3737    <title><?php echo $h->getTitle(); ?></title> 
  • trunk/content/main_language.php

    r1081 r1190  
    7676/* Errors */ 
    7777$lang["main_theme_page_not_found"] = "Page not found"; 
    78 $lang['error_csrf'] = "Ah! You've triggered a CSRF error. That's only supposed to happen when someone tries hacking into the site..."; 
     78$lang['error_csrf'] = "CSRF error. Please refresh the page and try again."; 
    7979 
    8080/* header */ 
  • trunk/content/plugins/activity/activity.php

    r1127 r1190  
    33 * name: Activity 
    44 * description: Show recent activity 
    5  * version: 0.4 
     5 * version: 0.5 
    66 * folder: activity 
    77 * class: Activity 
     
    292292     
    293293    /** 
     294     * Get activity count 
     295     * 
     296     * @param int $limit 
     297     * @param int $userid 
     298     * @param string $return 'activity', 'query' or 'count' 
     299     * return array $activity 
     300     */ 
     301    public function getLatestActivityCount($h, $userid = 0) 
     302    { 
     303        if (!$userid) { 
     304            $sql = "SELECT count(useract_id) AS number FROM " . TABLE_USERACTIVITY . " WHERE useract_status = %s ORDER BY useract_date DESC "; 
     305            $activity = $h->db->get_var($h->db->prepare($sql, 'show')); 
     306        } else { 
     307            $sql = "SELECT count(useract_id) AS number FROM " . TABLE_USERACTIVITY . " WHERE useract_status = %s AND useract_userid = %d ORDER BY useract_date DESC "; 
     308            $activity = $h->db->get_var($h->db->prepare($sql, 'show', $userid)); 
     309        } 
     310         
     311        if ($activity) { return $activity; } else { return false; } 
     312    } 
     313     
     314     
     315    /** 
     316     * Get activity 
     317     * 
     318     * return array $activity 
     319     */ 
     320    public function getLatestActivityQuery($h, $userid = 0) 
     321    { 
     322        if (!$userid) { 
     323            $sql = "SELECT * FROM " . TABLE_USERACTIVITY . " WHERE useract_status = %s ORDER BY useract_date DESC "; 
     324            $query = $h->db->prepare($sql, 'show'); 
     325            return $query; 
     326        } else { 
     327            $sql = "SELECT * FROM " . TABLE_USERACTIVITY . " WHERE useract_status = %s AND useract_userid = %d ORDER BY useract_date DESC "; 
     328            $query = $h->db->prepare($sql, 'show', $userid); 
     329            return $query; 
     330        } 
     331    } 
     332     
     333     
     334    /** 
    294335     * Get sidebar activity items 
    295336     * 
     
    539580        $activity_settings = $h->getSerializedSettings('activity'); 
    540581         
    541         // gets however many are items shown per page on activity pages: 
    542         $activity = $this->getLatestActivity($h); 
     582        // gets query and total count for pagination 
     583        $act_query = $this->getLatestActivityQuery($h); 
     584        $act_count = $this->getLatestActivityCount($h); 
    543585         
    544586        // pagination  
    545         $pg = $h->cage->get->testInt('pg'); 
    546         $h->vars['pagedResults'] = $h->pagination($activity, $activity_settings['number'], $pg); 
     587        $h->vars['pagedResults'] = $h->pagination($act_query, $act_count, $activity_settings['number'], 'activity'); 
    547588         
    548589        $h->displayTemplate('activity'); 
     
    563604        $activity_settings = $h->getSerializedSettings('activity'); 
    564605 
    565         // gets however many are items shown per page on activity pages: 
    566         $activity = $this->getLatestActivity($h, 0, $userid); // 0 means no limit, ALL activity 
    567          
    568         // pagination 
    569         $pg = $h->cage->get->testInt('pg'); 
    570         $h->vars['pagedResults'] = $h->pagination($activity, $activity_settings['number'], $pg); 
     606        // gets query and total count for pagination 
     607        $act_query = $this->getLatestActivityQuery($h, $userid); 
     608        $act_count = $this->getLatestActivityCount($h, $userid); 
     609         
     610        // pagination  
     611        $h->vars['pagedResults'] = $h->pagination($act_query, $act_count, $activity_settings['number'], 'activity'); 
    571612         
    572613        $h->displayTemplate('activity_profile'); 
  • trunk/content/plugins/activity/readme.txt

    r1081 r1190  
    1616Changelog 
    1717--------- 
     18v.0.5 2010/02/18 - Nick - Code changes for pagination 
    1819v.0.4 2010/01/24 - Nick - HTML for user profiles and Activity page moved into templates 
    1920v.0.3 2010/01/15 - Nick - Fixes for deleting items and refreshing the cache 
  • trunk/content/plugins/activity/templates/activity.php

    r1127 r1190  
    3636        <?php  
    3737            $act = new Activity(); 
    38             if ($h->vars['pagedResults']) {  
    39                 while($action = $h->vars['pagedResults']->fetchPagedRow()) { 
     38            if ($h->vars['pagedResults']->items) {  
     39                foreach ($h->vars['pagedResults']->items as $action) { 
    4040                    if (!$act->postSafe($h, $action)) { continue; } // skip if postis buried or pending 
    4141                    $user_id = $action->useract_userid; 
  • trunk/content/plugins/activity/templates/activity_profile.php

    r1127 r1190  
    3535        <?php  
    3636            $act = new Activity(); 
    37             if ($h->vars['pagedResults']) {  
    38                 while($action = $h->vars['pagedResults']->fetchPagedRow()) { 
     37            if ($h->vars['pagedResults']->items) {  
     38                foreach ($h->vars['pagedResults']->items as $action) { 
    3939                    if (!$act->postSafe($h, $action)) { continue; } // skip if postis buried or pending 
    4040                    $user_id = $action->useract_userid; 
  • trunk/content/plugins/admin_email/admin_email.php

    r1081 r1190  
    152152        // reload the page, without any html... 
    153153        $url = BASEURL . "admin_index.php?page=plugin_settings&plugin=admin_email&mailing=1"; 
    154         echo "<meta http-equiv='Refresh' content='0; URL=" . $url . "'>"; 
     154        echo "<meta http-equiv='Refresh' content='0; URL=" . $url . "' />"; 
    155155        echo $h->lang["admin_email_redirecting"]; 
    156156        ob_flush(); 
  • trunk/content/plugins/categories/categories.php

    r1108 r1190  
    33 * name: Categories 
    44 * description: Enables categories for posts 
    5  * version: 1.2 
     5 * version: 1.3 
    66 * folder: categories 
    77 * class: Categories 
    88 * type: categories 
    99 * requires: sb_base 0.1, submit 1.9, category_manager 0.7 
    10  * hooks: sb_base_theme_index_top, header_include, pagehandling_getpagename, sb_base_functions_preparelist, sb_base_show_post_author_date, header_end, breadcrumbs 
     10 * hooks: sb_base_theme_index_top, header_include, pagehandling_getpagename, sb_base_functions_preparelist, sb_base_show_post_author_date, header_end, breadcrumbs, header_meta 
    1111 * author: Nick Ramsay 
    1212 * authorurl: http://hotarucms.org/member.php?1-Nick 
     
    146146     
    147147    /** 
     148     * Also changes meta when browsing a category page 
     149     */ 
     150    public function header_meta($h) 
     151    {     
     152        if ($h->subPage == 'category') 
     153        {  
     154            $cat_meta = $h->getCatMeta($h->vars['category_id']); 
     155             
     156            if ($cat_meta->category_desc) { 
     157                echo '<meta name="description" content="' . urldecode($cat_meta->category_desc) . '" />' . "\n"; 
     158            } else { 
     159                echo '<meta name="description" content="' . $h->lang['header_meta_description'] . '" />' . "\n";  // default meta tags 
     160            } 
     161             
     162            if ($cat_meta->category_keywords) { 
     163                echo '<meta name="keywords" content="' . urldecode($cat_meta->category_keywords) . '" />' . "\n"; 
     164            } else { 
     165                echo '<meta name="description" content="' . $h->lang['header_meta_keywords'] . '" />' . "\n";  // default meta tags 
     166            } 
     167 
     168            return true; 
     169        } 
     170    } 
     171     
     172     
     173    /** 
    148174     * Read category settings 
    149175     */ 
  • trunk/content/plugins/categories/readme.txt

    r1081 r1190  
    1313Changelog 
    1414--------- 
     15v.1.3 2010/02/20 - Nick - Meta description and keywords taken from Category Manager 
    1516v.1.2 2009/12/28 - Nick - Updated for compatibility with Hotaru 1.0 
    1617v.1.1 2009/11/30 - Nick - Categories before post title in breadcrumbs,  
  • trunk/content/plugins/comment_manager/comment_manager.php

    r1081 r1190  
    33 * name: Comment Manager 
    44 * description: Manage comments. 
    5  * version: 0.4 
     5 * version: 0.5 
    66 * folder: comment_manager 
    77 * class: CommentManager 
  • trunk/content/plugins/comment_manager/comment_manager_settings.php

    r1127 r1190  
    9595                 
    9696                // Akismet uses this to report Akismet mistakes  
    97                 $h->pluginHook('com_man_delete_comment', true, '', array($h->comment)); 
     97                $h->pluginHook('com_man_delete_comment', '', array($h->comment)); 
    9898                 
    9999                $h->comment->deleteComment($h); // delete this comment 
     
    191191                $where_clause = "WHERE MATCH (comment_content) AGAINST (%s IN BOOLEAN MODE) ";  
    192192 
     193                $search_term_like = '%' . $search_term . '%'; 
     194                $count_sql = "SELECT count(*) AS number, MATCH(comment_content) AGAINST ('%s') AS relevance FROM " . TABLE_COMMENTS . " " . $where_clause; 
     195                $count = $h->db->get_var($h->db->prepare($count_sql, $search_term, $search_term_like)); 
     196 
    193197                $sql = $select_clause . $where_clause . $sort_clause; 
    194                 $search_term_like = '%' . $search_term . '%'; 
    195                 $results = $h->db->get_results($h->db->prepare($sql, $search_term, $search_term_like));  
    196             } 
    197              
    198             if (isset($results)) { $comments = $results; } else {  $comments = array(); } 
     198                $query = $h->db->prepare($sql, $search_term, $search_term_like); 
     199            } 
    199200        } 
    200201         
     
    209210                    $where_clause = " WHERE comment_status = %s";  
    210211                    $sort_clause = ' ORDER BY comment_date DESC';  // same as "all" 
     212                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS . $where_clause; 
     213                    $count = $h->db->get_var($h->db->prepare($count_sql, 'pending')); 
    211214                    $sql = "SELECT * FROM " . TABLE_COMMENTS . $where_clause . $sort_clause; 
    212                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'pending'));  
     215                    $query = $h->db->prepare($sql, 'pending'); 
    213216                    break; 
    214217                case 'buried': 
    215218                    $where_clause = " WHERE comment_status = %s";  
    216219                    $sort_clause = ' ORDER BY comment_date DESC';  // same as "all" 
     220                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS . $where_clause; 
     221                    $count = $h->db->get_var($h->db->prepare($count_sql, 'buried')); 
    217222                    $sql = "SELECT * FROM " . TABLE_COMMENTS . $where_clause . $sort_clause; 
    218                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'buried'));  
     223                    $query = $h->db->prepare($sql, 'buried'); 
    219224                    break; 
    220225                case 'approved':  
    221226                    $where_clause = " WHERE comment_status = %s";  
    222227                    $sort_clause = ' ORDER BY comment_date DESC'; // ordered newest first for convenience 
     228                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS . $where_clause; 
     229                    $count = $h->db->get_var($h->db->prepare($count_sql, 'approved')); 
    223230                    $sql = "SELECT * FROM " . TABLE_COMMENTS . $where_clause . $sort_clause; 
    224                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'approved'));  
     231                    $query = $h->db->prepare($sql, 'approved'); 
    225232                    break; 
    226233                case 'oldest': 
    227234                    $sort_clause = ' ORDER BY comment_date ASC'; // ordered oldest first 
     235                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS; 
     236                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    228237                    $sql = "SELECT * FROM " . TABLE_COMMENTS . $sort_clause; 
    229                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     238                    $query = $h->db->prepare($sql); 
    230239                    break; 
    231240                case 'all':  
     
    233242                default: 
    234243                    $sort_clause = ' ORDER BY comment_date DESC'; // ordered newest first for convenience 
     244                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS; 
     245                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    235246                    $sql = "SELECT * FROM " . TABLE_COMMENTS . $sort_clause; 
    236                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
    237                     break; 
    238             } 
    239  
    240             if (isset($filtered_results)) { $comments = $filtered_results; } else {  $comments = array(); } 
    241         } 
    242  
    243         if(!isset($comments)) { 
     247                    $query = $h->db->prepare($sql);  
     248                    break; 
     249            } 
     250        } 
     251 
     252        if(!isset($query)) { 
    244253            // default list 
    245254            if ($h->vars['comment_status_filter'] == 'pending') { 
    246255                $where_clause = " WHERE comment_status = %s"; 
    247256                $sort_clause = ' ORDER BY comment_date DESC';  
     257                $count_sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS . $where_clause; 
     258                $count = $h->db->get_var($h->db->prepare($count_sql, 'pending')); 
    248259                $sql = "SELECT * FROM " . TABLE_COMMENTS . $where_clause . $sort_clause; 
    249                 $posts = $h->db->get_results($h->db->prepare($sql, 'pending'));  
     260                $query = $h->db->prepare($sql, 'pending');  
    250261            } else { 
    251262                $sort_clause = ' ORDER BY comment_date DESC';  // same as "all" 
     263                $count_sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS; 
     264                $count = $h->db->get_var($h->db->prepare($count_sql)); 
    252265                $sql = "SELECT * FROM " . TABLE_COMMENTS . $sort_clause; 
    253                 $comments = $h->db->get_results($h->db->prepare($sql)); 
    254             } 
    255         } 
    256          
    257         if ($comments) {  
    258             $h->vars['com_man_rows'] = $this->drawRows($h, $comments, $filter, $search_term); 
     266                $query = $h->db->prepare($sql); 
     267            } 
     268        } 
     269         
     270        $pagedResults = $h->pagination($query, $count, 20, 'comments'); 
     271         
     272        if ($pagedResults) {  
     273            $h->vars['com_man_rows'] = $this->drawRows($h, $pagedResults, $filter, $search_term); 
    259274        } elseif ($h->vars['comment_status_filter'] == 'pending') { 
    260275            $h->message = $h->lang['com_man_no_pending_comments']; 
     
    267282     
    268283     
    269     public function drawRows($h, $comments, $filter = '', $search_term = '') 
     284    public function drawRows($h, $pagedResults, $filter = '', $search_term = '') 
    270285    { 
    271         // prepare for showing comments, 20 per page 
    272         $pg = $h->cage->get->getInt('pg'); 
    273         $items = 20; 
    274  
    275         $pagedResults = $h->pagination($comments, $items, $pg); 
    276          
    277286        $output = ""; 
    278287        $alt = 0; 
    279         while($comments = $pagedResults->fetchPagedRow()) {    //when $story is false loop terminates     
     288        $pg = $h->cage->get->getInt('pg'); 
     289         
     290        if (!$pagedResults->items) { return ""; } 
     291         
     292        foreach ($pagedResults->items as $comments)  
     293        { 
    280294            $alt++; 
    281295             
  • trunk/content/plugins/comment_manager/readme.txt

    r1081 r1190  
    1414Changelog 
    1515--------- 
     16v.0.5 2010/02/20 - Nick - Fix for deleting comments and code changes for pagination 
    1617v.0.4 2010/02/02 - Nick - User links added for easier spam management 
    1718v.0.3 2010/01/03 - Nick - Updated for compatibility with Hotaru 1.0 
  • trunk/content/plugins/comment_voting/comment_voting.php

    r1081 r1190  
    33 * name: Comment Voting 
    44 * description: Adds voting ability to posted stories. 
    5  * version: 0.1 
     5 * version: 0.2 
    66 * folder: comment_voting 
    77 * class: CommentVoting 
  • trunk/content/plugins/comment_voting/comment_voting_functions.php

    r1081 r1190  
    4242         
    4343    //get comment_voting settings 
    44     $comment_voting_settings = unserialize($h->getSetting('comment_voting_settings', 'comment_voting'));  
     44    $comments_settings = $h->getSerializedSettings('comments'); 
     45    if (isset($comments_settings) && isset($comments_settings['comment_bury'])) { 
     46        $bury = $comments_settings['comment_bury']; 
     47    } 
    4548     
    4649    // Only proceed if the user is logged in 
     
    5962            return false; 
    6063        } 
     64         
     65        // get current status and down votes 
     66        $sql = "SELECT comment_votes_down, comment_status FROM " . TABLE_COMMENTS . " WHERE comment_id = %d"; 
     67        $c_row = $h->db->get_row($h->db->prepare($sql, $comment_id)); 
    6168             
    6269        if ($cvote_rating > 0) 
    6370        { 
    64              
    6571            // Update comments table 
    6672            $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_up = comment_votes_up + 1 WHERE comment_id = %d"; 
     
    7783            if ($cvote_rating && ($cvote_rating < 0)) 
    7884            { 
    79                 // Update Posts table 
    80                 $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_down=comment_votes_down + 1 WHERE comment_id = %d"; 
    81                 $h->db->query($h->db->prepare($sql, $comment_id)); 
     85                // Increase down votes and set to buried 
     86                if (isset($bury) && ($c_row->comment_votes_down+1 >= $bury) && ($c_row->comment_status != 'buried')) { 
     87                    $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_down=comment_votes_down + 1, comment_status = %s WHERE comment_id = %d"; 
     88                    $h->db->query($h->db->prepare($sql, 'buried', $comment_id)); 
     89                } else { 
     90                    // Just increase the down votes 
     91                    $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_down=comment_votes_down + 1 WHERE comment_id = %d"; 
     92                    $h->db->query($h->db->prepare($sql, $comment_id)); 
     93                } 
    8294 
    8395                // Update commentvotes table 
  • trunk/content/plugins/comment_voting/readme.txt

    r1081 r1190  
    1515Changelog 
    1616--------- 
     17v.0.2 2010/02/09 - Nick - Added options to hide and bury comments 
    1718v.0.1 2010/01/24 - Nick - Released first version 
  • trunk/content/plugins/comments/comments.php

    r1127 r1190  
    33 * name: Comments 
    44 * description: Enables logged-in users to comment on posts 
    5  * version: 1.3 
     5 * version: 1.4 
    66 * folder: comments 
    77 * class: Comments 
     
    106106        if (!isset($comments_settings['comment_daily_limit'])) { $comments_settings['comment_daily_limit'] = 0; } 
    107107        if (!isset($comments_settings['comment_avatar_size'])) { $comments_settings['comment_avatar_size'] = "16"; } 
     108        if (!isset($comments_settings['comment_hide'])) { $comments_settings['comment_hide'] = "3"; } 
     109        if (!isset($comments_settings['comment_bury'])) { $comments_settings['comment_bury'] = "10"; } 
    108110         
    109111        if ($h->isActive('avatar')) { 
     
    138140        $h->comment->setPending = $comments_settings['comment_set_pending']; 
    139141        $h->comment->allForms = $comments_settings['comment_all_forms']; 
     142        $h->vars['comment_hide'] = $comments_settings['comment_hide']; 
    140143         
    141144         
     
    373376            if ($h->comment->pagination) 
    374377            { 
    375                 $pg = $h->cage->get->getInt('pg'); 
    376                 $pagedResults = $h->pagination($parents, $h->comment->itemsPerPage, $pg); 
    377  
    378                 if ($pagedResults) { 
     378                $pagedResults = $h->paginationFull($parents, $h->comment->itemsPerPage); 
     379 
     380                if ($pagedResults->items) { 
    379381                // cycle through the parents, and go get their children 
    380                     while($parent = $pagedResults->fetchPagedRow()) { 
     382                    foreach($pagedResults->items as $parent) { 
    381383         
    382384                            $this->displayComment($h, $parent); 
     
    528530        } 
    529531 
    530         $comments = $h->comment->getAllComments($h, 0, 'DESC', 0, $userid); 
    531         if (!$comments) { 
     532        $comments_settings = $h->getSerializedSettings(); 
     533        $h->comment->itemsPerPage = $comments_settings['comment_items_per_page']; 
     534         
     535        if ($userid) { 
     536            $comments_count = $h->comment->getAllCommentsCount($h, '', $userid); 
     537            $comments_query = $h->comment->getAllCommentsQuery($h, 'DESC', $userid); 
     538        } else { 
     539            $comments_count = $h->comment->getAllCommentsCount($h); 
     540            $comments_query = $h->comment->getAllCommentsQuery($h, 'DESC'); 
     541        } 
     542         
     543        if (!$comments_count) { 
    532544            $h->showMessage($h->lang['comments_user_no_comments'], 'red'); 
    533545            return true;  
    534546        } 
    535          
    536         $comments_settings = $h->getSerializedSettings(); 
    537         $h->comment->itemsPerPage = $comments_settings['comment_items_per_page']; 
    538          
    539         $pg = $h->cage->get->getInt('pg'); 
    540         $pagedResults = $h->pagination($comments, $h->comment->itemsPerPage, $pg); 
    541          
    542         if ($pagedResults) { 
    543             while($comment = $pagedResults->fetchPagedRow()) { 
     547             
     548        $pagedResults = $h->pagination($comments_query, $comments_count, $h->comment->itemsPerPage, 'comments'); 
     549         
     550        if ($pagedResults->items) { 
     551            foreach ($pagedResults->items as $comment) { 
    544552                $h->readPost($comment->comment_post_id); 
    545553                // don't show this comment if its post is buried or pending: 
     
    629637                $comments = 'open'; 
    630638            } else {  
    631                 // use existing setting: 
    632                 $h->post->comments = 'closed'; 
    633                 $comments = 'closed';  
     639                if ($h->currentUser->getPermission('can_edit_posts') == 'yes') { 
     640                    $h->post->comments = 'closed'; 
     641                    $comments = 'closed';  
     642                } else { 
     643                    $comments = $h->post->comments; // keep existing setting 
     644                } 
    634645            } 
    635646        } else { 
  • trunk/content/plugins/comments/comments_settings.php

    r1081 r1190  
    6262        $url_limit = $comments_settings['comment_url_limit']; 
    6363        $daily_limit = $comments_settings['comment_daily_limit']; 
     64        $hide = $comments_settings['comment_hide']; 
     65        $bury = $comments_settings['comment_bury']; 
    6466         
    6567        echo "<h1>" . $h->lang["comments_settings_header"] . "</h1>\n"; 
     
    8082        if (!$daily_limit) { $daily_limit = 0; } 
    8183        if (!$x_comments) { $x_comments = 1; } 
     84        if (!$hide) { $hide = 3; } 
     85        if (!$bury) { $bury = 10; } 
    8286     
    8387        // Determine if checkboxes are checked or not 
     
    101105        echo "<p><input type='checkbox' name='comment_avatars' value='comment_avatars' " . $check_avatars . " >&nbsp;&nbsp;" . $h->lang["comments_settings_avatars"] . "</p>\n"; 
    102106        echo "<p>" . " <input type='text' size=5 name='avatar_size' value='" . $h->comment->avatarSize . "' /> " . $h->lang["comments_settings_avatar_size"] . "</p>"; 
    103         echo "<p><input type='checkbox' name='comment_voting' value='comment_voting' " . $check_votes . " >&nbsp;&nbsp;" . $h->lang["comments_settings_votes"] . "</p>\n";  
     107        echo "<p><input type='checkbox' name='comment_voting' value='comment_voting' " . $check_votes . " >&nbsp;&nbsp;" . $h->lang["comments_settings_votes"] . "</p>\n"; 
     108        echo "<p>" . " <input type='text' size=5 name='hide' value='" . $hide . "' /> " . $h->lang["comments_settings_hide"] . "</p>"; 
     109        echo "<p>" . " <input type='text' size=5 name='bury' value='" . $bury . "' /> " . $h->lang["comments_settings_bury"] . "</p>"; 
    104110     
    105111        echo "<p>" . " <input type='text' size=5 name='levels' value='" . $h->comment->levels . "' /> " . $h->lang["comments_settings_levels"] . "</p>"; 
     
    248254        } 
    249255         
     256        // Number of down votes to hide a comment 
     257        $hide = $h->cage->post->testInt('hide');  
     258        if (!$hide) { $hide = 3; } // default 
     259         
     260        // Number of down votes to bury a comment 
     261        $bury = $h->cage->post->testInt('bury');  
     262        if (!$bury) { $bury = 10; } // default 
     263         
    250264        // levels 
    251265        if ($h->cage->post->keyExists('levels')) {  
     
    361375        $comments_settings['comment_email_notify'] = $email_notify; 
    362376        $comments_settings['comment_email_notify_mods'] = $email_mods; //array 
     377        $comments_settings['comment_hide'] = $hide; 
     378        $comments_settings['comment_bury'] = $bury; 
    363379         
    364380        $h->updateSetting('comments_settings', serialize($comments_settings)); 
  • trunk/content/plugins/comments/css/comments.css

    r1123 r1190  
    9090.comment_post_link {margin: 0.6em 0.6em 0.4em; text-align:right;} 
    9191 
     92.comment_show_hide  { margin-left: 2.0em; font-size: 0.8em; } 
     93 
    9294.clear  { clear: both; margin: 0; line-height: 0em;} /* need line-height for IE */ 
  • trunk/content/plugins/comments/javascript/comments.js

    r1081 r1190  
    5050        });  
    5151         
     52        // Show/Hide comment content 
     53        $(".comment_show_hide").click(function () { 
     54                var target = $(this).parents(".comment_header"); 
     55                target = $(target).next("div").next("div"); // finds div surrounding form 
     56                target.fadeToggle(); 
     57 
     58                target2 = $(target).find("div.comment_status"); // finds div in form 
     59                target2.show(); 
     60 
     61                return false; 
     62        });  
     63         
    5264});   
    5365 
  • trunk/content/plugins/comments/languages/comments_language.php

    r1108 r1190  
    3939$lang['comments_reply_link'] = "Reply"; 
    4040$lang['comments_edit_link'] = "Edit"; 
     41$lang['comments_show_hide'] = "Show / Hide"; 
    4142 
    4243/* Comment Form */ 
     
    6667$lang["comments_settings_avatar_size"] = "Avatar size in pixels <small>(default: 16)</small>"; 
    6768$lang["comments_settings_votes"] = "Enable votes on comments (requires a comment voting plugin)"; 
     69$lang["comments_settings_hide"] = "Hide comment content with this many down votes or more <small>(default: 3)</small>"; 
     70$lang["comments_settings_bury"] = "Bury comments completely with this many down votes or more <small>(default: 10)</small>"; 
    6871$lang["comments_settings_levels"] = "Comment nesting levels <small>(default: 5)</small>"; 
    6972$lang["comments_settings_pagination"] = "Pagination (spread comments over pages)"; 
  • trunk/content/plugins/comments/readme.txt

    r1081 r1190  
    55Description 
    66----------- 
    7 Enable your registered users to comment on each post. Supports avatars (e.g. Gravatar plugin), replies, unlimited nesting, editing, HTML tags (chosen by the Admin) and comment subscription. Note: You can't vote on comments yet, maybe in a later version or through a separate plugin. 
     7Enable your registered users to comment on each post. Supports avatars (e.g. Gravatar plugin), replies, unlimited nesting, editing, HTML tags (chosen by the Admin) and comment subscription.  
    88 
    99Instructions 
     
    1515Changelog 
    1616--------- 
     17v.1.4 2009/02/09 - Nick - Option to hide comments after X down votes, plus pagination code changes 
    1718v.1.3 2009/01/17 - Nick - Added option for avatar size 
    1819v.1.2 2009/12/30 - Nick - Updates for compatibility with Hotaru 1.0 
  • trunk/content/plugins/comments/templates/all_comments.php

    r1081 r1190  
    2525 */ 
    2626 
     27$display = ($h->comment->votes_down >= $h->vars['comment_hide']) ? 'display: none;' : ''; // comments are shown unless they have X negative votes 
    2728?> 
    2829    <a id="c<?php echo $h->comment->id; ?>"></a> 
     
    4748                        echo time_difference(unixtimestamp($h->comment->date), $h->lang) . " "; 
    4849                        echo $h->lang['comments_time_ago'] . "."; 
     50                        if ($display) { echo "<a href='#' class='comment_show_hide'>" . $h->lang['comments_show_hide'] . "</a>"; } 
    4951                ?> 
    5052                </div> 
     
    6062        <div class="clear"></div> 
    6163 
    62         <div class="comment_main"> 
     64        <div class="comment_main" style="<?php echo $display; ?>"> 
    6365            <div class="comment_content"> 
    6466                <?php 
  • trunk/content/plugins/comments/templates/show_comments.php

    r1081 r1190  
    2424 * @link      http://www.hotarucms.org/ 
    2525 */ 
    26   
    2726 
     27$display = ($h->comment->votes_down >= $h->vars['comment_hide']) ? 'display: none;' : ''; // comments are shown unless they have X negative votes 
    2828?> 
    2929    <a id="c<?php echo $h->comment->id; ?>"></a> 
     
    3131    <?php if ($h->comment->avatarSize < 16) {$comment_header_size=16;} else { $comment_header_size= $h->comment->avatarSize; } ?> 
    3232    <div class="comment" style="margin-left: <?php echo $h->comment->depth * 2.0; ?>em;"> 
     33     
    3334        <div class="comment_header" style="height:<?php echo $comment_header_size; ?>px;"> 
    3435            <div class="comment_header_left"> 
     
    4849                        echo time_difference(unixtimestamp($h->comment->date), $h->lang) . " "; 
    4950                        echo $h->lang['comments_time_ago'] . "."; 
     51                        if ($display) { echo "<a href='#' class='comment_show_hide'>" . $h->lang['comments_show_hide'] . "</a>"; } 
    5052                ?> 
    5153                </div> 
     
    6163        <div class="clear"></div> 
    6264 
    63         <div class="comment_main"> 
     65        <div class="comment_main" style="<?php echo $display; ?>"> 
    6466            <div class="comment_content"> 
    6567                <?php 
     
    8789                <?php } ?> 
    8890 
    89                 <?php   // EDIT LINK - (if comment owner AND permission to edit own comments) OR (permission to edit ALL comments)... 
    90                     if (($h->currentUser->id == $h->comment->author && ($h->currentUser->getPermission('can_edit_comments') == 'own')) 
    91                         || ($h->currentUser->getPermission('can_edit_comments') == 'yes')) { ?> 
    92                         <a href='#' class='comment_edit_link' onclick="edit_comment( 
    93                             '<?php echo BASEURL; ?>', 
    94                             '<?php echo $h->comment->id; ?>', 
    95                             '<?php echo urlencode($h->comment->content); ?>', 
    96                             '<?php echo $h->lang['comments_form_edit']; ?>'); 
    97                             return false;" ><?php echo $h->lang['comments_edit_link']; ?></a> 
     91                <?php   // EDIT LINK - (if comment form is open AND ((comment owner AND permission to edit own comments) OR (permission to edit ALL comments))... 
     92                    if ($h->comment->thisForm == 'open') { 
     93                        if (($h->currentUser->id == $h->comment->author && ($h->currentUser->getPermission('can_edit_comments') == 'own')) 
     94                            || ($h->currentUser->getPermission('can_edit_comments') == 'yes')) { ?> 
     95                            <a href='#' class='comment_edit_link' onclick="edit_comment( 
     96                                '<?php echo BASEURL; ?>', 
     97                                '<?php echo $h->comment->id; ?>', 
     98                                '<?php echo urlencode($h->comment->content); ?>', 
     99                                '<?php echo $h->lang['comments_form_edit']; ?>'); 
     100                                return false;" ><?php echo $h->lang['comments_edit_link']; ?></a> 
     101                    <?php } ?> 
    98102                <?php } ?> 
    99103            </div> 
  • trunk/content/plugins/comments_widget/comments_widget.php

    r1127 r1190  
    103103    public function getCommentsWidget($h, $limit) 
    104104    { 
    105         $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_status = %s ORDER BY comment_date DESC LIMIT " . $limit; 
    106         $comments = $h->db->get_results($h->db->prepare($sql, 'approved')); 
     105        $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_archived = %s AND comment_status = %s ORDER BY comment_date DESC LIMIT " . $limit; 
     106        $comments = $h->db->get_results($h->db->prepare($sql, 'N', 'approved')); 
    107107         
    108108        if ($comments) { return $comments; } else { return false; } 
  • trunk/content/plugins/comments_widget/readme.txt

    r1081 r1190  
    1515Changelog 
    1616--------- 
     17v.0.2 2010/02/19 - Nick - Restricted SQL query to non-archived comments 
    1718v.0.1 2010/01/03 - Nick - Released first version 
  • trunk/content/plugins/gravatar/gravatar.php

    r1081 r1190  
    33 * name: Gravatar 
    44 * description: Enables Gravatar avatars for users 
    5  * version: 0.7 
     5 * version: 0.8 
    66 * folder: gravatar 
    77 * class: Gravatar 
    88 * type: avatar 
    99 * requires: users 1.1 
    10  * hooks: avatar_set_avatar, avatar_get_avatar, avatar_show_avatar 
     10 * hooks: avatar_set_avatar, avatar_get_avatar, avatar_show_avatar, avatar_test_avatar 
    1111 * author: Nick Ramsay 
    1212 * authorurl: http://hotarucms.org/member.php?1-Nick 
     
    6868     * @return return the avatar 
    6969     */ 
     70    public function avatar_test_avatar($h) 
     71    { 
     72        $grav_url = $this->buildGravatarUrl($h->vars['avatar_user_email'], $h->vars['avatar_size'], $h->vars['avatar_rating'], '404'); 
     73 
     74        $headers = @get_headers($grav_url); 
     75        if (preg_match("|200|", $headers[0])) { 
     76            return $this->buildGravatarImage($grav_url, $h->vars['avatar_size']); 
     77        } 
     78    } 
     79     
     80     
     81    /** 
     82     * return the avatar with no surrounding HTML div 
     83     * 
     84     * @return return the avatar 
     85     */ 
    7086    public function avatar_get_avatar($h) 
    7187    { 
    72         return $this->buildGravatarImage($h->vars['avatar_user_email'], $h->vars['avatar_size'], $h->vars['avatar_rating']); 
     88        $grav_url = $this->buildGravatarUrl($h->vars['avatar_user_email'], $h->vars['avatar_size'], $h->vars['avatar_rating']); 
     89        $img_url = $this->buildGravatarImage($grav_url, $h->vars['avatar_size']); 
     90        return $img_url; 
    7391    } 
    7492     
     
    82100     * @return string - html for image 
    83101     */ 
    84     public function buildGravatarImage($email = '', $size = 32, $rating = 'g') 
     102    public function buildGravatarUrl($email = '', $size = 32, $rating = 'g', $default = '') 
    85103    { 
    86         // Look in the theme's images folder for a default avatar before using the one in the Gravatar images folder 
    87         if (file_exists(THEMES . THEME . "images/default_80.png")) { 
    88             $default_image = BASEURL . "content/themes/"  . THEME . "images/default_80.png"; 
    89         } else {  
    90             $default_image = BASEURL . "content/plugins/gravatar/images/default_80.png";  
     104        if ($default != '404') { 
     105            // Look in the theme's images folder for a default avatar before using the one in the Gravatar images folder 
     106            if (file_exists(THEMES . THEME . "images/default_80.png")) { 
     107                $default_image = BASEURL . "content/themes/"  . THEME . "images/default_80.png"; 
     108                $default = urlencode($default_image); 
     109            } else {  
     110                $default_image = BASEURL . "content/plugins/gravatar/images/default_80.png";  
     111                $default = urlencode($default_image); 
     112            } 
    91113        } 
    92114         
    93         $resized = "style='height: " . $size . "px; width: " . $size . "px'"; 
    94          
    95         $grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5( strtolower($email) ). 
    96             "&amp;default=".urlencode($default_image). 
     115        $grav_url = "http://www.gravatar.com/avatar/".md5( strtolower($email) ). 
     116            "?d=". $default . 
    97117            "&amp;size=" . $size .  
    98118            "&amp;r=" . $rating; 
    99              
     119         
     120        return $grav_url; 
     121    } 
     122     
     123     
     124    /** 
     125     * Build Gravatar image 
     126     * 
     127     * @param string $email - email of avatar user 
     128     * @param int $size - size (1 ~ 512 pixels) 
     129     * @param string $rating - g, pg, r or x 
     130     * @return string - html for image 
     131     */ 
     132    public function buildGravatarImage($grav_url = '', $size = 32) 
     133    { 
     134        if (!$grav_url) { return false; } 
     135         
     136        $resized = "style='height: " . $size . "px; width: " . $size . "px'"; 
     137                 
    100138        $img_url = "<img class='avatar' src='" . $grav_url . "' " . $resized  ." alt='' />"; 
    101          
    102139        return $img_url; 
    103140    } 
  • trunk/content/plugins/gravatar/readme.txt

    r1081 r1190  
    1414Changelog 
    1515--------- 
     16v.0.8 2010/02/10 - Nick - Added ability to test if a user has a Gravatar 
    1617v.0.7 2009/12/26 - Nick - Updates for compatibility with Hotaru 1.0 
    1718v.0.6 2009/10/31 - Nick - Changes to make it easier for other plugins to use Gravatar 
  • trunk/content/plugins/post_manager/post_manager.php

    r1081 r1190  
    33 * name: Post Manager 
    44 * description: Manage posts. 
    5  * version: 0.5 
     5 * version: 0.6 
    66 * folder: post_manager 
    77 * class: PostManager 
  • trunk/content/plugins/post_manager/post_manager_settings.php

    r1127 r1190  
    114114                    require_once(PLUGINS . 'sb_base/libs/SbBaseFunctions.php'); 
    115115                    $sbFuncs = new SbBaseFunctions(); 
    116                     $s->prepareSearchFilter($h, stripslashes(trim($h->db->escape($search_term)))); 
     116                     
     117                    // get count 
     118                    $s->prepareSearchFilter($h, stripslashes(trim($h->db->escape($search_term))), 'count'); 
    117119                    $filtered_search = $sbFuncs->filter($h->vars['filter'], 0, true, $h->vars['select'], $h->vars['orderby']); 
    118                     $posts = $sbFuncs->getPosts($h, $filtered_search); 
     120                    $posts_count = $sbFuncs->getPosts($h, $filtered_search); 
     121                    $count = $posts_count[0]->number; 
     122                     
     123                    // get query 
     124                    $s->prepareSearchFilter($h, stripslashes(trim($h->db->escape($search_term))), 'query'); 
     125                    $prepared_filter = $sbFuncs->filter($h->vars['filter'], 0, true, $h->vars['select'], $h->vars['orderby']); 
     126                    if (isset($prepared_filter[1])) { 
     127                        $query = $h->db->prepare($prepared_filter); 
     128                    } else { 
     129                        $query = $prepared_filter[0];    // returns the prepared query array 
     130                    } 
    119131                } 
    120132            } else { 
     
    133145                case 'all':  
    134146                    $sort_clause = ' ORDER BY post_date DESC'; // ordered newest first for convenience 
     147                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_POSTS; 
     148                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    135149                    $sql = "SELECT * FROM " . TABLE_POSTS . $sort_clause; 
    136                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     150                    $query = $h->db->prepare($sql);  
    137151                    break; 
    138152                case 'not_buried':  
    139153                    $where_clause = " WHERE post_status != %s";  
    140154                    $sort_clause = ' ORDER BY post_date DESC'; // ordered newest first for convenience 
     155                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_POSTS . $where_clause; 
     156                    $count = $h->db->get_var($h->db->prepare($count_sql, 'buried')); 
    141157                    $sql = "SELECT * FROM " . TABLE_POSTS . $where_clause . $sort_clause; 
    142                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'buried'));  
     158                    $query = $h->db->prepare($sql, 'buried');  
    143159                    break; 
    144160                case 'newest': 
    145161                    $sort_clause = ' ORDER BY post_date DESC';  // same as "all" 
     162                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_POSTS; 
     163                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    146164                    $sql = "SELECT * FROM " . TABLE_POSTS . $sort_clause; 
    147                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     165                    $query = $h->db->prepare($sql);  
    148166                    break; 
    149167                case 'oldest': 
    150168                    $sort_clause = ' ORDER BY post_date ASC'; 
     169                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_POSTS; 
     170                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    151171                    $sql = "SELECT * FROM " . TABLE_POSTS . $sort_clause; 
    152                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     172                    $query = $h->db->prepare($sql);  
    153173                    break; 
    154174                default: 
    155175                    $where_clause = " WHERE post_status = %s"; $sort_clause = ' ORDER BY post_date DESC'; // ordered newest first for convenience 
     176                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_POSTS . $where_clause; 
     177                    $count = $h->db->get_var($h->db->prepare($count_sql, $filter)); 
    156178                    $sql = "SELECT * FROM " . TABLE_POSTS . $where_clause . $sort_clause; 
    157                     $filtered_results = $h->db->get_results($h->db->prepare($sql, $filter)); // filter = new, top, or other post status 
    158                     break; 
    159             } 
    160  
    161             if (isset($filtered_results)) { $posts = $filtered_results; } else {  $posts = array(); } 
    162         } 
    163  
    164         if(!isset($posts)) { 
     179                    $query = $h->db->prepare($sql, $filter); // filter = new, top, or other post status 
     180                    break; 
     181            } 
     182        } 
     183 
     184        if(!isset($query)) { 
    165185            // default list 
    166186            if ($h->vars['post_status_filter'] == 'pending') { 
    167187                $where_clause = " WHERE post_status = %s"; 
    168188                $sort_clause = ' ORDER BY post_date DESC'; // ordered newest first for convenience 
     189                $count_sql = "SELECT count(*) AS number FROM " . TABLE_POSTS . $where_clause; 
     190                $count = $h->db->get_var($h->db->prepare($count_sql, 'pending')); 
    169191                $sql = "SELECT * FROM " . TABLE_POSTS . $where_clause . $sort_clause; 
    170                 $posts = $h->db->get_results($h->db->prepare($sql, 'pending'));  
     192                $query = $h->db->prepare($sql, 'pending');  
    171193            } else { 
    172194                $sort_clause = ' ORDER BY post_date DESC'; // ordered newest first for convenience 
     195                $count_sql = "SELECT count(*) AS number FROM " . TABLE_POSTS; 
     196                $count = $h->db->get_var($h->db->prepare($count_sql)); 
    173197                $sql = "SELECT * FROM " . TABLE_POSTS . $sort_clause; 
    174                 $posts = $h->db->get_results($h->db->prepare($sql));  
    175             } 
    176         } 
    177          
    178         if ($posts) {  
    179             $h->vars['post_man_rows'] = $this->drawRows($h, $p, $posts, $filter, $search_term); 
     198                $query = $h->db->prepare($sql);  
     199            } 
     200        } 
     201         
     202        $pagedResults = $h->pagination($query, $count, 20, 'posts'); 
     203         
     204        if ($pagedResults) {  
     205            $h->vars['post_man_rows'] = $this->drawRows($h, $p, $pagedResults, $filter, $search_term); 
    180206        } elseif ($h->vars['post_status_filter'] == 'pending') { 
    181207            $h->message = $h->lang['post_man_no_pending_posts']; 
     
    188214     
    189215     
    190     public function drawRows($h, $p, $posts, $filter = '', $search_term = '') 
     216    public function drawRows($h, $p, $pagedResults, $filter = '', $search_term = '') 
    191217    { 
    192         // prepare for showing posts, 20 per page 
    193         $pg = $h->cage->get->getInt('pg'); 
    194         $items = 20; 
    195          
    196         $pagedResults = $h->pagination($posts, $items, $pg); 
    197          
    198218        $output = ""; 
    199219        $alt = 0; 
    200         while($post = $pagedResults->fetchPagedRow()) {    //when $story is false loop terminates     
     220        $pg = $h->cage->get->getInt('pg'); 
     221         
     222        if (!$pagedResults->items) { return ""; } 
     223         
     224        foreach ($pagedResults->items as $post)  
     225        { 
    201226            $alt++; 
    202227             
  • trunk/content/plugins/post_manager/readme.txt

    r1081 r1190  
    1414Changelog 
    1515--------- 
     16v.0.6 2010/02/18 - Nick - Code changes for pagination 
    1617v.0.5 2010/02/02 - Nick - User links added for easier spam management 
    1718v.0.4 2010/01/04 - Nick - Updates for compatibility with Hotaru 1.0 
  • trunk/content/plugins/recent_visitors/languages/recent_visitors_language.php

    r1123 r1190  
    3636$lang["recent_visitors_settings_avatars"] = "Show user avatars <small>(Requires an avatar plugin)</small>"; 
    3737$lang["recent_visitors_settings_avatar_size"] = "Size (pixels):"; 
     38$lang["recent_visitors_settings_avatar_filter"] = "Filter out users who don't have an avatar"; 
    3839$lang["recent_visitors_settings_names"] = "Show user names"; 
    3940$lang["recent_visitors_settings_show_widget_title"] = "Show widget title <small>(Default: \"Recent Visitors\". You can edit it in recent_visitors_language.php)</small>"; 
  • trunk/content/plugins/recent_visitors/readme.txt

    r1123 r1190  
    1717Changelog 
    1818--------- 
     19v.0.4 2010/02/10 - Nick - Added ability to filter out users who don't have an avatar 
    1920v.0.3 2010/02/06 - Nick - Added "Need an avatar? Get Gravatar!", filtered out users below "undermod" and hide users who registered within the last 24 hours 
    2021v.0.2 2010/01/15 - Nick - Replaced "lastlogin" with "lastvisit" for more up-to-date stats 
  • trunk/content/plugins/recent_visitors/recent_visitors.php

    r1123 r1190  
    33 * name: Recent Visitors 
    44 * description: Show recent visitors in a widget 
    5  * version: 0.3 
     5 * version: 0.4 
    66 * folder: recent_visitors 
    77 * class: RecentVisitors 
     
    5050        if (!isset($recent_visitors_settings['visitors_avatars'])) { $recent_visitors_settings['visitors_avatars'] = ''; } 
    5151        if (!isset($recent_visitors_settings['visitors_avatar_size'])) { $recent_visitors_settings['visitors_avatar_size'] = '16'; } 
     52        if (!isset($recent_visitors_settings['visitors_avatar_filter'])) { $recent_visitors_settings['visitors_avatar_filter'] = ''; } 
    5253        if (!isset($recent_visitors_settings['visitors_names'])) { $recent_visitors_settings['visitors_names'] = 'checked'; } 
    5354        if (!isset($recent_visitors_settings['visitors_widget_title'])) { $recent_visitors_settings['visitors_widget_title'] = 'checked'; } 
     
    8283        $avatars = $recent_visitors_settings['visitors_avatars']; 
    8384        $avatar_size = $recent_visitors_settings['visitors_avatar_size']; 
     85        $avatar_filter = $recent_visitors_settings['visitors_avatar_filter']; 
    8486        $names = $recent_visitors_settings['visitors_names']; 
    8587        $show_title = $recent_visitors_settings['visitors_widget_title']; 
     
    111113        foreach ($visitors as $visitor)  
    112114        { 
    113             if ($list) { 
    114                 $output .="<li class='recent_visitors_item'>"; 
    115             } 
     115            $has_avatar = false; 
    116116             
    117117            if ($avatars) { 
     
    120120                $avatar->user_name = $visitor->user_username; 
    121121                $avatar->setVars($h); 
    122                 $output .= $avatar->linkAvatar($h) . " \n"; 
     122                if ($avatar_filter) { 
     123                    $has_avatar = $avatar->testAvatar($h); // testif user has an avatar 
     124                    if (!$has_avatar) { continue; } // skip to the next user 
     125                } 
     126            } 
     127             
     128            if ($list) { 
     129                $output .="<li class='recent_visitors_item'>"; 
     130            } 
     131             
     132            if ($avatars) { 
     133                if ($has_avatar) { 
     134                    $output .= $avatar->linkAvatarImage($h, $has_avatar) . " \n"; // we got the avatar with IMG tags when we tested if the user had an avatar 
     135                } else { 
     136                    $output .= $avatar->linkAvatar($h) . " \n"; 
     137                } 
    123138            } 
    124139             
     
    138153         
    139154        if ($need_cache) { 
    140             $h->smartCache('html', 'users', 10, $output, $label); // make or rewrite the cache file 
     155            $h->smartCache('html', 'users', 60, $output, $label); // make or rewrite the cache file 
    141156        } 
    142157         
  • trunk/content/plugins/recent_visitors/recent_visitors_settings.php

    r1123 r1190  
    4747        $avatars = $recent_visitors_settings['visitors_avatars']; 
    4848        $avatar_size = $recent_visitors_settings['visitors_avatar_size']; 
     49        $avatar_filter = $recent_visitors_settings['visitors_avatar_filter']; 
    4950        $names = $recent_visitors_settings['visitors_names']; 
    5051        $show_title = $recent_visitors_settings['visitors_widget_title']; 
     
    6566            echo $h->lang["recent_visitors_settings_avatar_size"]; 
    6667            echo " <input type='text' size=5 name='avatar_size' value='" . $avatar_size . "'></p>\n"; 
     68             
     69        echo "<p><input type='checkbox' name='avatar_filter' value='avatar_filter' " . $avatar_filter . ">&nbsp;&nbsp;"; 
     70            echo $h->lang["recent_visitors_settings_avatar_filter"] . "</p>\n"; 
    6771             
    6872        echo "<p><input type='checkbox' name='names' value='names' " . $names . ">&nbsp;&nbsp;"; 
     
    132136         
    133137         
     138        // filter users with no avatars: 
     139        if ($h->cage->post->keyExists('avatar_filter')) {  
     140            $avatar_filter = 'checked'; 
     141        } else { 
     142            $avatar_filter = '';  
     143        } 
     144         
     145         
    134146        // show names: 
    135147        if ($h->cage->post->keyExists('names')) {  
     
    149161            $recent_visitors_settings['visitors_avatars'] = $avatars; 
    150162            $recent_visitors_settings['visitors_avatar_size'] = $avatar_size; 
     163            $recent_visitors_settings['visitors_avatar_filter'] = $avatar_filter; 
    151164            $recent_visitors_settings['visitors_names'] = $names; 
    152165            $h->updateSetting('recent_visitors_settings', serialize($recent_visitors_settings)); 
  • trunk/content/plugins/related_posts/readme.txt

    r1081 r1190  
    1515Changelog 
    1616--------- 
     17v.0.3 2010/02/20 - Nick - Fix for SQL warning when no tags present 
    1718v.0.2 2009/12/31 - Nick - Compatibility with Hotaru 1.0 
    1819v.0.1 2009/11/23 - Nick - Released first version 
  • trunk/content/plugins/related_posts/related_posts.php

    r1081 r1190  
    33 * name: Related Posts 
    44 * description: Show a list of related posts 
    5  * version: 0.2 
     5 * version: 0.3 
    66 * folder: related_posts 
    77 * class: relatedPosts 
     
    154154           which we need later to show comments and whatnot. */ 
    155155        $original_id = $h->post->id; 
    156  
    157         /* strip all words less than 4 chars from the title 
    158            and make a space separated string:  
    159         $title = $h->post->title; 
    160         $title_array = explode(' ', $title); 
    161         $new_title = ""; 
    162         foreach($title_array as $title_word) { 
    163             if (strlen(trim($title_word)) >= 4) { 
    164                 $new_title .= $title_word . " "; 
    165             } 
    166         }*/ 
    167          
    168         // remove hyphens from category safe name 
    169         /* 
    170         if ($h->post->vars['useCategories']) { 
    171             require_once(PLUGINS . 'categories/libs/Category.php'); 
    172             $cat = new Category($this->db); 
    173             $cat_safe_name = $cat->getCatSafeName($h->post->vars['category']); 
    174             $category = str_replace("-"," ", $cat_safe_name);  
    175         }*/ 
    176156         
    177157        // make the tags a space separated string 
    178158        $tags = str_replace(', ', ' ', $h->post->tags); 
    179159        $tags = str_replace(',', ' ', $tags); // if no space after commas 
    180          
    181         // search terms in a space separated string 
    182         //$search_terms = trim($new_title) . " " . $tags . " " . $category; 
     160        $tags = trim($tags);    // remove any spaces at the start and end 
     161         
     162        // abort of no tags for this post 
     163        if (!$tags) { echo $this->noRelatedPosts($h); return true; } 
    183164         
    184165        $search_terms = $tags; 
     
    199180    public function showRelatedPosts($h, $search_terms = '', $num_posts = 10) 
    200181    { 
     182        $output = ''; 
     183         
    201184        $results = $this->getRelatedPosts($h, $search_terms, $num_posts); 
    202         if ($results)  
    203         { 
    204             $output = "<h2 id='related_posts_title'>" . $h->lang['related_posts'] . "</h2>"; 
    205          
    206             $output .= "<ul class='related_posts'>\n"; 
    207             foreach ($results as $item) { 
    208                 $h->readPost(0, $item); // needed for the url function 
    209                 $output .= "<li class='related_posts_item'>\n"; 
    210                 if (!isset($item->post_votes_up)) { $item->post_votes_up = '&nbsp;'; } 
    211                 $output .= "<div class='related_posts_vote vote_color_" . $item->post_status . "'>"; 
    212                 $output .= $item->post_votes_up; 
    213                 $output .= "</div>\n"; 
    214                 $output .= "<div class='related_posts_link related_posts_indent'>\n"; 
    215                 $output .= "<a href='" . $h->url(array('page'=>$item->post_id)) . "' "; 
    216                 $output .= "title='" . $h->lang['related_links_new_tab'] . "'>\n"; 
    217                 $output .= stripslashes(urldecode($item->post_title));  
    218                 $output .= "</a>"; 
    219                 $output .= "</div>"; 
    220                 $output .= "</li>\n"; 
    221             } 
    222             $output .= "</ul>\n"; 
     185        if (!$results) { 
     186            // Show "No other posts found with matching tags" 
     187            return $this->noRelatedPosts($h); 
     188        }  
     189 
     190        $output = "<h2 id='related_posts_title'>" . $h->lang['related_posts'] . "</h2>"; 
     191     
     192        $output .= "<ul class='related_posts'>\n"; 
     193        foreach ($results as $item) { 
     194            $h->readPost(0, $item); // needed for the url function 
     195            $output .= "<li class='related_posts_item'>\n"; 
     196            if (!isset($item->post_votes_up)) { $item->post_votes_up = '&nbsp;'; } 
     197            $output .= "<div class='related_posts_vote vote_color_" . $item->post_status . "'>"; 
     198            $output .= $item->post_votes_up; 
     199            $output .= "</div>\n"; 
     200            $output .= "<div class='related_posts_link related_posts_indent'>\n"; 
     201            $output .= "<a href='" . $h->url(array('page'=>$item->post_id)) . "' "; 
     202            $output .= "title='" . $h->lang['related_links_new_tab'] . "'>\n"; 
     203            $output .= stripslashes(urldecode($item->post_title));  
     204            $output .= "</a>"; 
     205            $output .= "</div>"; 
     206            $output .= "</li>\n"; 
    223207        } 
    224         else  
    225         { 
    226             // Show "No other posts found with matching tags" 
    227             $output = "<div id='related_posts_none'>\n"; 
    228             $output .= $h->lang['related_links_no_results']; 
    229             $output .= "</div>\n"; 
    230         } 
     208        $output .= "</ul>\n"; 
    231209 
    232210        return $output; 
    233211    } 
     212     
     213     
     214    /** 
     215     * Message when no related posts found, or no tags present 
     216     * 
     217     * @param string $output 
     218     * return string $output 
     219     */ 
     220    public function noRelatedPosts($h, $output = '') 
     221    { 
     222        // Commented this out because I doubt anyone will want to see a "No related posts found" message. Handy for testing, though! 
     223        /* 
     224        $output .= "<div id='related_posts_none'>\n"; 
     225        $output .= $h->lang['related_links_no_results']; 
     226        $output .= "</div>\n"; 
     227        */ 
     228         
     229        return $output; 
     230    } 
     231     
    234232     
    235233    /** 
  • trunk/content/plugins/sb_base/languages/sb_base_language.php

    r1081 r1190  
    6464/* Maintenance page */ 
    6565$lang["sb_base_maintenance_update_archive"] = "Update the post archive"; 
    66 $lang["sb_base_maintenance_update_archive_remove"] = "Move any archived posts out of the archive. <small>(See Submit Settings)</small>"; 
     66$lang["sb_base_maintenance_update_archive_remove"] = "Move any archived posts out of the archive. <small>(See SB Base Settings)</small>"; 
    6767$lang["sb_base_maintenance_update_archive_desc_1"] = "Posts older than "; 
    6868$lang["sb_base_maintenance_update_archive_desc_2"] = " will be moved into the archive. <small>(See SB Base Settings)</small>"; 
  • trunk/content/plugins/sb_base/libs/SbBaseFunctions.php

    r1108 r1190  
    3434     * 
    3535     * @param string $type e.g. latest, upcoming, top-24-hours 
     36     * @param string $return - 'posts', 'count' or 'query' 
    3637     * @return array 
    3738     */ 
    38     public function prepareList($h, $type = '') 
     39    public function prepareList($h, $type = '', $return = 'posts') 
    3940    { 
    4041        if (!isset($h->vars['filter'])) { $h->vars['filter'] = array(); } 
     
    6566                } 
    6667 
    67             $h->pluginHook('sb_base_functions_preparelist'); // formerly post_list_filter 
     68            $h->pluginHook('sb_base_functions_preparelist', '', array('return' => $return)); // formerly post_list_filter 
    6869        } 
    6970         
     
    8081        } 
    8182         
     83        // if we want to count the totals, we need to replace the select clause with COUNT, but some queries that use MATCH and relevance are a bit complicated,  
     84        // so we'll let those plugins (e.g. search) add COUNT to their queries themselves and skip them here (which we can do by checking for MATCH). 
     85        if ($return == 'count' && (strpos($h->vars['select'], "MATCH") === false)) { $h->vars['select'] = "count(post_id) AS number"; } 
     86        if ($return == 'query') { $all = true; }    // this removes the "LIMIT" parameter so we can add it later when paginating. 
     87         
    8288        $prepared_filter = $this->filter($h->vars['filter'], $limit, $all, $h->vars['select'], $h->vars['orderby']); 
    83         $stories = $this->getPosts($h, $prepared_filter); 
    84          
    85         return $stories; 
     89         
     90        if ($return == 'query') {  
     91            if (isset($prepared_filter[1])) { 
     92                return $h->db->prepare($prepared_filter); 
     93            } else { 
     94                return $prepared_filter[0];    // returns the prepared query array 
     95            } 
     96        } elseif($return == 'count') { 
     97            unset($h->vars['select']);  // so it doesn't get used again unintentionally 
     98            $count_array = $this->getPosts($h, $prepared_filter); 
     99            return $count_array[0]->number; // returns the number of posts 
     100        } else { 
     101            return $this->getPosts($h, $prepared_filter);   // returns the posts OR post count depending on the query 
     102        } 
    86103    } 
    87104     
  • trunk/content/plugins/sb_base/readme.txt

    r1081 r1190  
    1414Changelog 
    1515--------- 
     16v.0.2 2010/02/18 - Nick - Code changes for pagination 
    1617v.0.1 2009/12/16 - Nick - Released first version 
  • trunk/content/plugins/sb_base/sb_base.php

    r1108 r1190  
    33 * name: SB Base 
    44 * description: Social Bookmarking base - provides "list" and "post" templates.  
    5  * version: 0.1 
     5 * version: 0.2 
    66 * folder: sb_base 
    77 * class: SbBase 
     
    129129        { 
    130130            case 'list': 
    131                 $h->vars['posts'] = $sb_funcs->prepareList($h); 
     131                $h->vars['post_count'] = $sb_funcs->prepareList($h, '', 'count');   // get the number of posts 
     132                $h->vars['post_query'] = $sb_funcs->prepareList($h, '', 'query');   // and the SQL query used 
    132133                break; 
    133134            case 'post': 
     
    194195        $meta_content = sanitize($h->post->content, 'all'); 
    195196        $meta_content = truncate($meta_content, 200); 
    196         echo '<meta name="description" content="' . $meta_content . '">' . "\n"; 
     197        echo '<meta name="description" content="' . $meta_content . '" />' . "\n"; 
    197198        return true; 
    198199    } 
  • trunk/content/plugins/sb_base/templates/sb_list.php

    r1081 r1190  
    2727?> 
    2828<?php  
    29  
    30 if ($h->vars['posts']) { 
    31     $pg = $h->cage->get->getInt('pg'); 
     29if ($h->vars['post_count']) { 
    3230     
    33     $pagedResults = $h->pagination($h->vars['posts'], $h->vars['posts_per_page'], $pg); 
    34     while($post = $pagedResults->fetchPagedRow()) { 
     31    $pagedResults = $h->pagination($h->vars['post_query'], $h->vars['post_count'], $h->vars['posts_per_page'], 'posts'); 
     32    foreach ($pagedResults->items as $post) { 
    3533        $h->readPost(0, $post); 
    3634        $user = new UserBase(); 
     
    4139<?php $h->pluginHook('sb_base_pre_show_post'); ?> 
    4240 
    43     <div class="show_post vote_button_space"> 
     41    <div class="show_post vote_button_space" id="show_post_<?php echo $h->post->id ?>" > 
    4442     
    4543        <?php $h->pluginHook('sb_base_show_post_pre_title'); ?> 
     
    5452        <div class="show_post_title"> 
    5553            <?php if ($h->vars['link_action'] == 'source') { ?> 
    56                 <a href='<?php echo $h->post->origUrl; ?>' <?php echo $h->vars['target']; ?>><?php echo $h->post->title; ?></a> 
     54                <a href='<?php echo $h->post->origUrl; ?>' <?php echo $h->vars['target']; ?> class="click_to_source"><?php echo $h->post->title; ?></a> 
    5755            <?php } else { ?> 
    58                 <a href='<?php echo $h->url(array('page'=>$h->post->id)); ?>' <?php echo $h->vars['target']; ?>><?php echo $h->post->title; ?></a> 
     56                <a href='<?php echo $h->url(array('page'=>$h->post->id)); ?>' <?php echo $h->vars['target']; ?> class="click_to_post"><?php echo $h->post->title; ?></a> 
    5957            <?php } ?> 
    6058            <?php $h->pluginHook('sb_base_show_post_title'); ?> 
  • trunk/content/plugins/sb_base/templates/sb_post.php

    r1081 r1190  
    3333 
    3434<!-- POST --> 
    35 <div class="show_post vote_button_space"> 
     35<div class="show_post vote_button_space" id="show_post_<?php echo $h->post->id ?>" > 
    3636 
    3737    <?php $h->pluginHook('sb_base_show_post_pre_title'); ?> 
     
    4646    <div class="show_post_title"> 
    4747        <?php if (!$h->vars['editorial']) { ?>  
    48             <a href='<?php echo $h->post->origUrl; ?>' <?php echo $h->vars['target']; ?>><?php echo $h->post->title; ?></a> 
     48            <a href='<?php echo $h->post->origUrl; ?>' <?php echo $h->vars['target']; ?> class="click_to_source"><?php echo $h->post->title; ?></a> 
    4949        <?php } else { ?> 
    5050            <?php echo $h->post->title; ?> 
  • trunk/content/plugins/search/readme.txt

    r1081 r1190  
    2121Changelog 
    2222--------- 
     23v.0.9 2010/02/18 - Nick - Code changes for pagination 
    2324v.0.8 2009/12/31 - Nick - Updates for compatibility with Hotaru 1.0 
    2425v.0.7 2009/11/04 - Nick - Updates for compatibility with Hotaru 0.8 
  • trunk/content/plugins/search/search.php

    r1108 r1190  
    33 * name: Search 
    44 * description: Displays "Search!" 
    5  * version: 0.8 
     5 * version: 0.9 
    66 * folder: search 
    77 * class: Search 
     
    9191     * Use the search terms to build a filter 
    9292     */ 
    93     public function sb_base_functions_preparelist($h) 
     93    public function sb_base_functions_preparelist($h, $vars) 
    9494    { 
    9595        if ($h->cage->get->keyExists('search'))  
    9696        { 
     97            $return = $vars['return'];  // are we getting the count or the result set? 
    9798            $orig_search_terms = stripslashes($h->cage->get->sanitizeTags('search')); 
    9899            $search_terms = $orig_search_terms; 
     
    101102            { 
    102103                // fetch select, orderby and filter... 
    103                 $prepared_search = $this->prepareSearchFilter($h, $search_terms); 
     104                $prepared_search = $this->prepareSearchFilter($h, $search_terms, $return); 
    104105                extract($prepared_search); 
    105106                 
     
    118119     * Prepare search filter 
    119120     */ 
    120     public function prepareSearchFilter($h, $search) 
     121    public function prepareSearchFilter($h, $search, $return = 'posts') 
    121122    { 
    122123        $search_terms = strtolower($search); 
     
    146147         
    147148        if ($full_index) { 
    148             $h->vars['select'] = "*, MATCH(post_title, post_domain, post_url, post_content, post_tags) AGAINST ('" . $search_terms_clean . "') AS relevance"; 
    149             $h->vars['orderby'] = "relevance DESC";         
     149            if ($return == 'count') { $select = "count(*) AS number "; } else { $select = "*"; } 
     150            $h->vars['select'] = $select . ", MATCH(post_title, post_domain, post_url, post_content, post_tags) AGAINST ('" . $search_terms_clean . "') AS relevance"; 
     151            $h->vars['orderby'] = "relevance DESC"; 
    150152            $h->vars['filter']["MATCH (post_title, post_domain, post_url, post_content, post_tags) AGAINST (%s IN BOOLEAN MODE)"] = $search_terms_clean;  
    151153        } else { 
    152             $h->vars['select'] = "*"; 
     154            if ($return == 'count') { $select = "count(*) AS number "; } else { $select = "*"; } 
     155            $h->vars['select'] = $select; 
    153156            $h->vars['orderby'] = "post_date DESC"; 
    154157            $h->vars['filter_vars'] = array(); 
  • trunk/content/plugins/submit/libs/SubmitFunctions.php

    r1129 r1190  
    347347        } 
    348348         
    349         // check CSRF 
    350         if ($h->cage->post->keyExists('submit1')) { 
    351             // this is used for submit forms in the sidebar, etc. 
    352             $page = $h->cage->post->testPage('page'); 
    353             if ($page == 'submit1') { $page = 'submit'; } // this is a bug fix 
    354             if (!$h->csrf('check', $page)) { 
    355                 $h->message = $h->lang['error_csrf']; 
    356                 $h->messageType = 'red'; 
    357                 return true; //error found 
    358             } 
    359         } 
    360          
    361349        // check user has permission to post 
    362350        if ($h->currentUser->getPermission('can_submit') == 'no') { 
  • trunk/content/plugins/submit/readme.txt

    r1081 r1190  
    1313Changelog 
    1414--------- 
     15v.2.1 2009/02/15 - Nick - Removed CSRF check from submission step 1  
     16v.2.0 2009/02/11 - Nick - Bug fixes for character problems and stripped HTML 
    1517v.1.9 2009/12/16 - Nick - Updated for compatibility with Hotaru 1.0 
    1618v.1.8 2009/11/29 - Nick - Added plugin hooks in post descriptions 
  • trunk/content/plugins/submit/submit.php

    r1108 r1190  
    33 * name: Submit 
    44 * description: Social Bookmarking submit - Enables post submission 
    5  * version: 1.9 
     5 * version: 2.1 
    66 * folder: submit 
    77 * class: Submit 
     
    525525                $h->vars['submit_orig_url'] = urldecode($h->vars['submitted_data']['submit_orig_url']); 
    526526                $h->vars['submit_title'] = sanitize($h->vars['submitted_data']['submit_title'], 'all'); 
    527                 $h->vars['submit_content'] = sanitize($h->vars['submitted_data']['submit_content'], 'all'); 
     527                $h->vars['submit_content'] = sanitize($h->vars['submitted_data']['submit_content'], 'tags', $allowable_tags); 
    528528                $h->vars['submit_post_id'] = $h->vars['submitted_data']['submit_id']; 
    529529                $h->vars['submit_category'] = $h->vars['submitted_data']['submit_category']; 
     
    593593                 
    594594                // strip htmlentities before showing in the form: 
    595                 $h->vars['submit_title'] = html_entity_decode($h->vars['submit_title']); 
     595                $h->vars['submit_title'] = $h->vars['submit_title']; 
    596596                $h->vars['submit_content'] = html_entity_decode($h->vars['submit_content']); 
    597597                $h->vars['submit_tags'] = html_entity_decode($h->vars['submit_tags']); 
  • trunk/content/plugins/submit/templates/submit1.php

    r1117 r1190  
    4343        <input type='hidden' name='submit1' value='true' /> 
    4444        <input type='hidden' name='page' value='<?php echo $h->pageName; ?>' /> 
    45         <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> 
    4645        <br /> 
    4746        <input id="submit_button_1" type='submit' class='submit' name='submit' value='<?php echo $h->lang['main_form_next']; ?>' /> 
  • trunk/content/plugins/submit_light/readme.txt

    r1081 r1190  
    1515Changelog 
    1616--------- 
     17v.0.2 2009/02/11 - Nick - Bug fix for missing moderation language item 
    1718v.0.1 2010/01/10 - Nick - Released first version 
  • trunk/content/plugins/submit_light/submit_light.php

    r1108 r1190  
    33 * name: Submit Light 
    44 * description: Reduces Submit to two steps 
    5  * version: 0.1 
     5 * version: 0.2 
    66 * folder: submit_light 
    77 * class: SubmitLight 
     
    173173                        // Submitted posts given 'pending' for this user 
    174174                            $h->changePostStatus('pending'); 
    175                             $h->messages[$h->lang['submit_form_moderation']] = 'green'; 
     175                            $h->messages[$h->lang['submit_moderation']] = 'green'; 
    176176                            $return = 1; // will return false just after we notify admins of the post (see about 10 lines down) 
    177177                        } 
  • trunk/content/plugins/tags/css/tags.css

    r1085 r1190  
    22 *          TAGS PLUGIN CSS           * 
    33 ************************************** */ 
    4  
     4  
    55.tags_link      { padding-left: 1.5em; background-image: url(content/themes/default/images/tags.png); } 
    66.show_tags ul li {float:left; margin-right:0.6em;} 
  • trunk/content/plugins/tags/languages/tags_language.php

    r1081 r1190  
    2727$lang['tags'] = 'Tags'; 
    2828$lang['tags_list'] = 'Tags:'; 
     29$lang['tags_meta_description_before'] = 'Posts tagged '; 
     30$lang['tags_meta_description_after'] = ''; 
     31$lang['tags_meta_keywords_more'] = ''; // e.g. ", sport, exercise" - you need the first comma. 
    2932?> 
  • trunk/content/plugins/tags/readme.txt

    r1081 r1190  
    1313Changelog 
    1414--------- 
     15v.1.5 2010/02/20 - Nick - Meta description and keywords added for browsing tag pages 
    1516v.1.4 2009/12/28 - Nick - Updated for compatibility with Hotaru 1.0 
    1617v.1.3 2009/11/26 - Nick - Filter tag cloud to tags from "top" and "new" posts only. Added a cache. 
  • trunk/content/plugins/tags/tags.php

    r1085 r1190  
    33 * name: Tags 
    44 * description: Show tags, filter tags and RSS for tags 
    5  * version: 1.4 
     5 * version: 1.5 
    66 * folder: tags 
    77 * class: Tags 
     
    5353    /** 
    5454     * Match meta tag to a post's keywords (description is done in the Submit plugin) 
     55     * Also changes meta when browsing a tag page 
    5556     */ 
    5657    public function header_meta($h) 
    5758    {     
    58         if ($h->pageType == 'post') { 
    59             echo '<meta name="keywords" content="' . stripslashes($h->post->tags) . '">' . "\n"; 
     59        if ($h->pageType == 'post') 
     60        { 
     61            echo '<meta name="keywords" content="' . stripslashes($h->post->tags) . '" />' . "\n"; 
    6062            return true; 
     63        }  
     64        elseif ($h->subPage == 'tags') 
     65        {  
     66            $tag = stripslashes($h->vars['tag']);  
     67             
     68            if ($tag) { 
     69                echo '<meta name="description" content="' . $h->lang['tags_meta_description_before'] . $tag . $h->lang['tags_meta_description_after'] . '" />' . "\n"; 
     70                echo '<meta name="keywords" content="' . $tag . $h->lang['tags_meta_keywords_more'] . '" />' . "\n"; 
     71                return true; 
     72            } 
    6173        } 
    6274    } 
  • trunk/content/plugins/text_widget/readme.txt

    r1081 r1190  
    1515Changelog 
    1616--------- 
     17v.0.5 2010/02/15 - Nick - Minor widget ids fix for W3C compatibility  
    1718v.0.4 2010/01/04 - Nick - Updates for compatibility with Hotaru 1.0 
    1819v.0.3 2009/11/04 - Nick - Updated install function for easier upgrading 
  • trunk/content/plugins/text_widget/text_widget.php

    r1120 r1190  
    33 * name: Text Widget 
    44 * description: Paste text or code into a blank widget 
    5  * version: 0.4 
     5 * version: 0.5 
    66 * folder: text_widget 
    77 * class: TextWidget 
     
    8888 
    8989            if ($settings['text_widget_title']) { 
    90                 echo "<h2 class='widget_head' id='text_widget_" . $id . "'>" . stripslashes($title) . "</h2>\n"; 
     90                echo "<h2 class='widget_head' id='text_widget_" . $id . "_head'>" . stripslashes($title) . "</h2>\n"; 
    9191            } 
    9292 
    9393            if ($settings['text_widget_php']) { 
    94                 echo "<div class='widget_body' id='text_widget_" . $id . "'>"; eval($content); echo "</div>\n"; 
     94                echo "<div class='widget_body' id='text_widget_" . $id . "_body'>"; eval($content); echo "</div>\n"; 
    9595            } else { 
    96                 echo "<div class='widget_body' id='text_widget_" . $id . "'>"; echo $content; echo "</div>\n"; 
     96                echo "<div class='widget_body' id='text_widget_" . $id . "_body'>"; echo $content; echo "</div>\n"; 
    9797            } 
    9898 
  • trunk/content/plugins/user_manager/readme.txt

    r1081 r1190  
    1515Changelog 
    1616--------- 
     17v.0.8 2010/02/18 - Nick - Fixes for changing user permissions and pagination 
    1718v.0.7 2010/02/02 - Nick - Improvements for spam management 
    1819v.0.6 2010/01/15 - Nick - Added user permissions and settings editors 
  • trunk/content/plugins/user_manager/user_manager.php

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

    r1108 r1190  
    8484                    $u->role = $new_role; 
    8585                    $new_perms = $u->getDefaultPermissions($h, $new_role); 
    86                     $u->setAllPermissions($h, $new_perms); 
     86                    $u->setAllPermissions($new_perms); 
    8787                    $u->updatePermissions($h); 
    8888                    $u->updateUserBasic($h, $id); 
     
    116116                $where_clause = " WHERE user_username LIKE %s OR user_email LIKE %s";  
    117117                $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
     118                $search_term = '%' . $search_term . '%'; 
     119                $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     120                $count = $h->db->get_var($h->db->prepare($count_sql, $search_term, $search_term)); 
    118121                $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    119                 $search_term = '%' . $search_term . '%'; 
    120                 $results = $h->db->get_results($h->db->prepare($sql, $search_term, $search_term));  
    121             } 
    122              
    123             if (isset($results)) { $users = $results; } else {  $users = array(); } 
     122                $query = $h->db->prepare($sql, $search_term, $search_term);  
     123            } 
    124124        } 
    125125         
     
    133133                case 'all':  
    134134                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
     135                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $sort_clause; 
     136                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    135137                    $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 
    136                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     138                    $query = $h->db->prepare($sql); 
    137139                    break; 
    138140                case 'not_killspammed':  
    139141                    $where_clause = " WHERE user_role != %s";  
    140142                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    141                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    142                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'killspammed'));  
     143                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     144                    $count = $h->db->get_var($h->db->prepare($count_sql, 'killspammed')); 
     145                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     146                    $query = $h->db->prepare($sql, 'killspammed'); 
    143147                    break; 
    144148                case 'admin':  
    145149                    $where_clause = " WHERE user_role = %s";  
    146150                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    147                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    148                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'admin'));  
     151                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     152                    $count = $h->db->get_var($h->db->prepare($count_sql, 'admin')); 
     153                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     154                    $query = $h->db->prepare($sql, 'admin'); 
    149155                    break; 
    150156                case 'supermod':  
    151157                    $where_clause = " WHERE user_role = %s";  
    152158                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    153                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    154                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'mod'));  
     159                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     160                    $count = $h->db->get_var($h->db->prepare($count_sql, 'supermod')); 
     161                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     162                    $query = $h->db->prepare($sql, 'supermod'); 
    155163                    break; 
    156164                case 'moderator':  
    157165                    $where_clause = " WHERE user_role = %s";  
    158166                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    159                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    160                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'mod'));  
     167                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     168                    $count = $h->db->get_var($h->db->prepare($count_sql, 'moderator')); 
     169                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     170                    $query = $h->db->prepare($sql, 'moderator'); 
    161171                    break; 
    162172                case 'member':  
    163173                    $where_clause = " WHERE user_role = %s";  
    164174                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    165                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    166                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'member'));  
     175                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     176                    $count = $h->db->get_var($h->db->prepare($count_sql, 'member')); 
     177                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     178                    $query = $h->db->prepare($sql, 'member'); 
    167179                    break; 
    168180                case 'pending':  
    169181                    $where_clause = " WHERE user_role = %s";  
    170182                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    171                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    172                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'pending'));  
     183                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     184                    $count = $h->db->get_var($h->db->prepare($count_sql, 'pending')); 
     185                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     186                    $query = $h->db->prepare($sql, 'pending'); 
    173187                    break; 
    174188                case 'undermod':  
    175189                    $where_clause = " WHERE user_role = %s";  
    176190                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    177                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    178                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'undermod'));  
     191                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     192                    $count = $h->db->get_var($h->db->prepare($count_sql, 'undermod')); 
     193                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     194                    $query = $h->db->prepare($sql, 'undermod'); 
    179195                    break; 
    180196                case 'suspended':  
    181197                    $where_clause = " WHERE user_role = %s";  
    182198                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    183                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    184                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'suspended'));  
     199                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     200                    $count = $h->db->get_var($h->db->prepare($count_sql, 'suspended')); 
     201                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     202                    $query = $h->db->prepare($sql, 'suspended'); 
    185203                    break; 
    186204                case 'banned':  
    187205                    $where_clause = " WHERE user_role = %s";  
    188206                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    189                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    190                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'banned'));  
     207                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     208                    $count = $h->db->get_var($h->db->prepare($count_sql, 'banned')); 
     209                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     210                    $query = $h->db->prepare($sql, 'banned'); 
    191211                    break; 
    192212                case 'killspammed':  
    193213                    $where_clause = " WHERE user_role = %s";  
    194214                    $sort_clause = ' ORDER BY user_date DESC'; // ordered by registration date 
    195                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    196                     $filtered_results = $h->db->get_results($h->db->prepare($sql, 'killspammed'));  
     215                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     216                    $count = $h->db->get_var($h->db->prepare($count_sql, 'killspammed')); 
     217                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     218                    $query = $h->db->prepare($sql, 'killspammed'); 
    197219                    break; 
    198220                case 'newest': 
    199221                    $sort_clause = ' ORDER BY user_date DESC';  // same as "all" 
     222                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS; 
     223                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    200224                    $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 
    201                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     225                    $query = $h->db->prepare($sql); 
    202226                    break; 
    203227                case 'oldest': 
    204228                    $sort_clause = ' ORDER BY user_date ASC'; 
     229                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS; 
     230                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    205231                    $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 
    206                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     232                    $query = $h->db->prepare($sql); 
    207233                    break; 
    208234                case 'last_visited': 
    209235                    $sort_clause = ' ORDER BY user_lastvisit DESC'; 
     236                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS; 
     237                    $count = $h->db->get_var($h->db->prepare($count_sql)); 
    210238                    $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 
    211                     $filtered_results = $h->db->get_results($h->db->prepare($sql));  
     239                    $query = $h->db->prepare($sql); 
    212240                    break; 
    213241                default: 
    214242                    $where_clause = " WHERE user_role = %s"; $sort_clause = ' ORDER BY user_date DESC'; // ordered newest first for convenience 
    215                     $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    216                     $filtered_results = $h->db->get_results($h->db->prepare($sql, $filter)); // filter = new, top, or other post status 
    217                     break; 
    218             } 
    219              
    220             if (isset($filtered_results)) { $users = $filtered_results; } else {  $users = array(); } 
    221         } 
    222  
    223         if(!isset($users)) { 
     243                    $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     244                    $count = $h->db->get_var($h->db->prepare($count_sql, $filter)); 
     245                    $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     246                    $query = $h->db->prepare($sql, $filter);    // filter = 'admin', 'member', etc. 
     247                    break; 
     248            } 
     249        } 
     250 
     251        if(!isset($query)) { 
    224252            // default list 
    225253             
     
    228256                $where_clause = " WHERE user_role = %s";  
    229257                $sort_clause = ' ORDER BY user_date DESC'; 
     258                $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $where_clause . $sort_clause; 
     259                $count = $h->db->get_var($h->db->prepare($count_sql, 'pending')); 
    230260                $sql = "SELECT * FROM " . TABLE_USERS . $where_clause . $sort_clause; 
    231                 $users = $h->db->get_results($h->db->prepare($sql, 'pending'));  
     261                $query = $h->db->prepare($sql, 'pending');  
    232262            } 
    233263            // else show all users by newest... 
     
    235265            { 
    236266                $sort_clause = ' ORDER BY user_date DESC'; // ordered by newest 
     267                $count_sql = "SELECT count(*) AS number FROM " . TABLE_USERS . $sort_clause; 
     268                $count = $h->db->get_var($h->db->prepare($count_sql)); 
    237269                $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 
    238                 $users = $h->db->get_results($h->db->prepare($sql));  
    239             } 
    240         } 
    241          
    242         if ($users) {  
    243             $h->vars['user_man_rows'] = $this->drawRows($h, $users, $filter, $search_term); 
     270                $query = $h->db->prepare($sql);  
     271            } 
     272        } 
     273 
     274        $pagedResults = $h->pagination($query, $count, 30, 'users'); 
     275         
     276        if ($pagedResults) {  
     277            $h->vars['user_man_rows'] = $this->drawRows($h, $pagedResults, $filter, $search_term); 
    244278        } elseif ($h->vars['user_filter'] == 'pending') { 
    245279            $h->message = $h->lang['user_man_no_pending_users']; 
     
    255289     * Draw Rows 
    256290     */ 
    257     public function drawRows($h, $users, $filter = '', $search_term = '') 
     291    public function drawRows($h, $pagedResults, $filter = '', $search_term = '') 
    258292    { 
    259         // prepare for showing users, 30 per page 
    260         $pg = $h->cage->get->getInt('pg'); 
    261         $items = 30; 
    262          
    263         $pagedResults = $h->pagination($users, $items, $pg); 
    264          
    265293        $output = ""; 
    266294        $alt = 0; 
    267         while($user = $pagedResults->fetchPagedRow()) {    //when $story is false loop terminates     
     295         
     296        if (!$pagedResults->items) { return ""; } 
     297         
     298        foreach ($pagedResults->items as $user) 
     299        {    //when $story is false loop terminates     
    268300            $alt++; 
    269301 
     
    275307            $user_icon = ''; 
    276308            if ($h->vars['useEmailConf']) { 
    277                 if ($user->user_email_valid == 0) { 
     309                if ($user->user_role == 'pending' && $user->user_email_valid == 0) { 
    278310                    $user_icon .= " <img src = '" . BASEURL . "content/plugins/user_manager/images/email.png' title='" . $h->lang["user_man_user_email_icon"] . "'>"; 
    279311                } 
  • trunk/content/plugins/users/languages/users_language.php

    r1081 r1190  
    138138$lang['userfunctions_notifymods_body_regards'] = "Thank you,"; 
    139139$lang['userfunctions_notifymods_body_sign'] = SITE_NAME . " Admin"; 
     140 
     141/* User Meta Tags */ 
     142$lang['users_default_meta_description_before'] = "I'm "; 
     143$lang['users_default_meta_description_after'] = " and this is my profile on " . SITE_NAME; 
     144$lang['users_profile_meta_keywords_more'] = ", profile, activity"; // you need the comma because the user's name is the first keyword  
     145$lang['users_meta_description_results_before'] = ""; 
     146$lang['users_meta_description_results_middle'] = " by "; 
     147$lang['users_meta_description_results_after'] = " on " . SITE_NAME; 
     148$lang['users_meta_description_popular'] = "Popular posts"; 
    140149?> 
  • trunk/content/plugins/users/readme.txt

    r1081 r1190  
    1414Changelog 
    1515--------- 
     16v.1.2 2010/02/20 - Nick - Meta tags generated from user details and profile 
    1617v.1.1 2009/12/22 - Nick - Updated for compatibility with Hotaru 1.0 
    1718v.1.0 2009/11/25 - Nick - Cleaned up user_settings.php for better plugin integration 
  • trunk/content/plugins/users/users.php

    r1081 r1190  
    33 * name: Users 
    44 * description: Provides profile, settings and permission pages 
    5  * version: 1.1 
     5 * version: 1.2 
    66 * folder: users 
    77 * type: users 
    88 * class: Users 
    9  * hooks: pagehandling_getpagename, theme_index_top, header_include, sb_base_functions_preparelist, breadcrumbs, theme_index_post_breadcrumbs, theme_index_main, users_edit_profile_save, user_settings_save, admin_theme_main_stats 
     9 * hooks: pagehandling_getpagename, theme_index_top, header_include, sb_base_functions_preparelist, breadcrumbs, theme_index_post_breadcrumbs, theme_index_main, users_edit_profile_save, user_settings_save, admin_theme_main_stats, header_meta 
    1010 * author: Nick Ramsay 
    1111 * authorurl: http://hotarucms.org/member.php?1-Nick 
     
    115115    } 
    116116     
     117     
     118    /** 
     119     * Match meta tags when browsing results for individual users  
     120     */ 
     121    public function header_meta($h) 
     122    { 
     123        if ($h->pageName == 'profile') { 
     124            if (isset($h->vars['profile']['bio']) && ($h->vars['profile']['bio'] != $h->lang['users_profile_default_bio'])) {  
     125                echo '<meta name="description" content="' . $h->vars['profile']['bio'] . '" />' . "\n"; 
     126            } else { 
     127                echo '<meta name="description" content="' . $h->lang['users_default_meta_description_before'] . $h->vars['user']->name . $h->lang['users_default_meta_description_after'] . '" />' . "\n";  // default profile meta description (see language file) 
     128            } 
     129             
     130            echo '<meta name="keywords" content="' . $h->vars['user']->name . $h->lang['users_profile_meta_keywords_more'] . '" />' . "\n";  // default profile meta keywords (see language file) 
     131             
     132            return true; 
     133        } 
     134         
     135         
     136        if ($h->subPage == 'user' && ($h->pageName != 'profile')) 
     137        {  
     138            $user = $h->cage->get->testUsername('user'); 
     139            if ($user) { 
     140                $first_word = $h->pageName; 
     141                if ($first_word == 'sort') { $first_word = $h->cage->get->testPage('sort'); } 
     142                if ($first_word == 'index') { $first_word = $h->lang['users_meta_description_popular']; } 
     143                $first_word = ucfirst(strtolower(make_name($first_word, '-'))); 
     144                echo '<meta name="description" content="' . $h->lang['users_meta_description_results_before'] . $first_word . $h->lang['users_meta_description_results_middle'] . $user . $h->lang['users_meta_description_results_after'] . '" />' . "\n"; 
     145                echo '<meta name="keywords" content="' . $user . $h->lang['users_profile_meta_keywords_more'] . '" />' . "\n";  // default profile meta keywords (see language file) 
     146                return true; 
     147            } 
     148        } 
     149    } 
     150     
     151     
     152     
    117153    /** 
    118154     * Filter posts to this user 
  • trunk/content/plugins/vote/css/vote.css

    r1081 r1190  
    3939.vote_color_new { border: 1px solid #d0d0d0; background-color: #ffffff; color: #000; } 
    4040 
     41.vote_color_top_clicked { background-color: #f0f0aa; } 
     42.vote_color_top_just_voted { background-color: #f99555; } 
    4143/* *********************************** 
    4244 * ** SPACE BETWEEN BUTTON AND POST ** 
  • trunk/content/plugins/vote/javascript/vote.js

    r1081 r1190  
    3737                target.fadeToggle(); 
    3838                return false; 
    39         });   
    40          
     39        }); 
     40 
     41 
     42       if ($('#loggedIn').hasClass('loggedIn_true')) { 
     43            $(".show_post_title a").click(function(event) { 
     44                if (vote_on_url_click == "checked") { 
     45                    if ($(this).hasClass('click_to_source')) { 
     46                        event.preventDefault(); 
     47                        var post_id = $(this).parent().parent().attr("id"); 
     48                        var parts = post_id.split('_'); 
     49                        post_id = parts[parts.length-1]; 
     50 
     51                        vote( post_id, 10, 'link' ); 
     52                        link = $(this).attr('href'); 
     53 
     54                        setTimeout(function () { 
     55                            window.location.href = link 
     56                        }, 500); 
     57                        return false; 
     58                        } 
     59                    } 
     60                    return true; 
     61            }); 
     62       } 
     63 
    4164});  
    4265 
     
    4871 ********************************************************************** */ 
    4972          
    50 function vote(baseurl, ip, id, rating) 
     73function vote(id, rating, referer) 
    5174{ 
    52         url = baseurl+"content/plugins/vote/vote_functions.php"; 
     75        sendurl = BASEURL +"content/plugins/vote/vote_functions.php"; 
    5376         
    54         var target_votes = document.getElementById("votes_"+id); 
    55         var target_text_vote = document.getElementById("text_vote_"+id); 
    56         var target_text_unvote = document.getElementById("text_unvote_"+id); 
     77        $target_votes = $("#votes_"+id); 
     78        $target_text_vote = $("#text_vote_"+id); 
     79        $target_text_unvote = $("#text_unvote_"+id); 
     80 
     81    var formdata = "post_id="+id+"&rating="+rating+"&referer="+referer; 
     82 
     83        $.ajax( 
     84            { 
     85            type: 'post', 
     86            url: sendurl, 
     87            data: formdata, 
     88            beforeSend: function () { 
     89                            $target_votes.addClass('vote_color_top_clicked'); 
     90                    }, 
     91            error:      function(XMLHttpRequest, textStatus, errorThrown) { 
     92                             $target_votes.html('err'); 
     93            }, 
     94            success: function(data) { // success means it returned some form of json code to us. may be code with custom error msg 
     95                    if (data.error === true || referer === "link") { 
     96                    } 
     97                    else {                         
     98                        $target_votes.html(data.votes); 
     99                        $target_votes.addClass('vote_color_top_just_voted'); 
     100                        if(rating > 0) { 
     101                            $target_text_vote.css('display','none'); 
     102                            $target_text_unvote.css('display','block'); 
     103                        } else if(rating < 0) { 
     104                            $target_text_vote.css('display','block'); 
     105                            $target_text_unvote.css('display','none'); 
     106                        } 
     107                    } 
     108            }, 
     109            dataType: "json" 
     110        }); 
    57111         
    58         if (xmlhttp) { 
    59                 mycontent = "baseurl="+baseurl+"&user_ip="+ip+"&post_id="+id+"&rating="+rating; 
    60                 ajax['response'] = new myXMLHttpRequest (); 
    61                  
    62                 if (ajax) { 
    63                         ajax['response'].open ("POST", url, true); 
    64                         ajax['response'].setRequestHeader ('Content-Type', 
    65                                            'application/x-www-form-urlencoded'); 
    66  
    67                         ajax['response'].send (mycontent); 
    68                         ajax['response'].onreadystatechange = function () { 
    69                                 if (ajax['response'].readyState == 4) { 
    70                                         try{ 
    71                                                 var returnvalue = []; 
    72                                                 returnvalue = json_decode(ajax['response'].responseText); 
    73                                         } 
    74                                         catch(e) { 
    75                                                 alert("Unable to add your vote. Sorry!"); 
    76                                         } 
    77                                                  
    78                                         if(returnvalue.result) { 
    79                                                 alert(returnvalue.result); 
    80                                                 return; 
    81                                         } 
    82                                                          
    83  
    84                                         target_votes.innerHTML = returnvalue.votes; 
    85                                         if(rating > 0) { 
    86                                                 target_text_vote.style.display = 'none'; 
    87                                                 target_text_unvote.style.display = ''; 
    88                                         } else if(rating < 0) { 
    89                                                 target_text_vote.style.display = ''; 
    90                                                 target_text_unvote.style.display = 'none'; 
    91                                         } 
    92  
    93                                 }  
    94                         } 
    95                 } 
    96         } 
    97112} 
  • trunk/content/plugins/vote/languages/vote_language.php

    r1081 r1190  
    9090$lang["vote_settings_other"] = "Other"; 
    9191$lang["vote_settings_posts_widget"] = "Show vote count before post links in widgets <small>(requires Posts Widget plugin)</small>"; 
     92$lang["vote_settings_vote_on_url_click"] = "Automatically count a users vote when they click on the URL link"; 
    9293 
    9394?> 
  • trunk/content/plugins/vote/readme.txt

    r1081 r1190  
    1515Changelog 
    1616--------- 
     17v.1.3 2010/02/10 - shibuya246 - Option to automatically increase vote count when clicking a post link 
    1718v.1.2 2010/01/12 - Nick - Fixes for auto-vote on post submission 
    1819v.1.1 2010/01/03 - Nick - Updated for Hotaru 1.0 
  • trunk/content/plugins/vote/templates/vote_button.php

    r1081 r1190  
    2727*/ 
    2828 
    29 $user_ip = $h->cage->server->testIp('REMOTE_ADDR'); 
     29//$user_ip = $h->cage->server->testIp('REMOTE_ADDR'); 
    3030 
    3131// Determine the status of the post so we can apply different css to top and new vote buttons: 
     
    4747    <!-- Shown --> 
    4848    <div id='text_vote_<?php echo $h->post->id; ?>' class='vote_button_bottom'> 
    49         <a href="#" onclick="vote('<?php echo BASEURL; ?>', '<?php echo $user_ip; ?>', <?php echo $h->post->id; ?>, 10); return false;"><b><?php echo $h->lang["vote_button_vote"]; ?></b></a> 
     49        <a href="#" onclick="vote( <?php echo $h->post->id; ?>, 10); return false;"><b><?php echo $h->lang["vote_button_vote"]; ?></b></a> 
    5050    </div>     
    5151     
    5252    <!-- Hidden --> 
    5353    <div id='text_unvote_<?php echo $h->post->id; ?>' class='vote_button_bottom' style="display: none;"> 
    54         <a href="#" onclick="vote('<?php echo BASEURL; ?>', '<?php echo $user_ip; ?>', <?php echo $h->post->id; ?>, -10); return false;"><?php echo $h->lang["vote_button_unvote"]; ?></a> 
     54        <a href="#" onclick="vote(<?php echo $h->post->id; ?>, -10); return false;"><?php echo $h->lang["vote_button_unvote"]; ?></a> 
    5555    </div>         
    5656     
     
    6060    <!-- Hidden --> 
    6161    <div id='text_vote_<?php echo $h->post->id; ?>' class='vote_button_bottom' style="display: none;"> 
    62         <a href="#" onclick="vote('<?php echo BASEURL; ?>', '<?php echo $user_ip; ?>', <?php echo $h->post->id; ?>, 10); return false;"><b><?php echo $h->lang["vote_button_vote"]; ?></b></a> 
     62        <a href="#" onclick="vote(<?php echo $h->post->id; ?>, 10); return false;"><b><?php echo $h->lang["vote_button_vote"]; ?></b></a> 
    6363    </div> 
    6464     
    6565    <!-- Shown --> 
    6666    <div id='text_unvote_<?php echo $h->post->id; ?>' class='vote_button_bottom'> 
    67         <a href="#" onclick="vote('<?php echo BASEURL; ?>', '<?php echo $user_ip; ?>', <?php echo $h->post->id; ?>, -10); return false;"><?php echo $h->lang["vote_button_unvote"]; ?></a> 
     67        <a href="#" onclick="vote(<?php echo $h->post->id; ?>, -10); return false;"><?php echo $h->lang["vote_button_unvote"]; ?></a> 
    6868    </div> 
    6969     
  • trunk/content/plugins/vote/vote.php

    r1108 r1190  
    33 * name: Vote 
    44 * description: Adds voting ability to posted stories. 
    5  * version: 1.2 
     5 * version: 1.3 
    66 * folder: vote 
    77 * class: Vote 
    88 * type: vote 
    99 * requires: submit 1.9, users 1.1 
    10  * hooks: install_plugin, theme_index_top, post_read_post, header_include, sb_base_show_post_title, sb_base_pre_show_post, admin_plugin_settings, admin_sidebar_plugin_settings, post_add_post, submit_confirm_pre_trackback, sb_base_show_post_extra_fields, sb_base_show_post_extras, post_delete_post 
     10 * hooks: install_plugin, theme_index_top, post_read_post, header_include, sb_base_show_post_title, sb_base_pre_show_post, admin_plugin_settings, admin_sidebar_plugin_settings, post_add_post, submit_confirm_pre_trackback, sb_base_show_post_extra_fields, sb_base_show_post_extras, post_delete_post, header_include_raw 
    1111 * author: Nick Ramsay 
    1212 * authorurl: http://hotarucms.org/member.php?1-Nick 
     
    5353        if (!isset($vote_settings['no_front_page'])) { $vote_settings['no_front_page'] = 5; } 
    5454        if (!isset($vote_settings['posts_widget'])) { $vote_settings['posts_widget'] = 'checked'; } 
     55        if (!isset($vote_settings['vote_on_url_click'])) { $vote_settings['vote_on_url_click'] = ''; } 
     56 
    5557         
    5658        $h->updateSetting('vote_settings', serialize($vote_settings)); 
     
    8082     
    8183     
    82     /** 
    83      * Includes css and javascript for the vote buttons. 
    84      */ 
    85     public function header_include($h) 
    86     { 
    87         $h->includeCss('vote'); 
    88         $h->includeJs('vote'); 
    89         $h->includeJs('vote', 'json2.min'); 
     84     
     85 
     86    /** 
     87     * includes for raw data 
     88     */ 
     89    public function header_include_raw($h) 
     90    { 
     91     $vote_settings = $h->getSerializedSettings(); 
     92     echo '<script type="text/javascript">$(document).ready(function(){ vote_on_url_click = "' . $vote_settings['vote_on_url_click'] . '" });</script>'; 
    9093    } 
    9194     
  • trunk/content/plugins/vote/vote_functions.php

    r1081 r1190  
    66 * PHP version 5 
    77 * 
    8  * LICENSE: Hotaru CMS is free software: you can redistribute it and/or  
    9  * modify it under the terms of the GNU General Public License as  
    10  * published by the Free Software Foundation, either version 3 of  
    11  * the License, or (at your option) any later version.  
     8 * LICENSE: Hotaru CMS is free software: you can redistribute it and/or 
     9 * modify it under the terms of the GNU General Public License as 
     10 * published by the Free Software Foundation, either version 3 of 
     11 * the License, or (at your option) any later version. 
    1212 * 
    13  * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT  
    14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  
    15  * FITNESS FOR A PARTICULAR PURPOSE.  
     13 * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT 
     14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
     15 * FITNESS FOR A PARTICULAR PURPOSE. 
    1616 * 
    17  * You should have received a copy of the GNU General Public License along  
     17 * You should have received a copy of the GNU General Public License along 
    1818 * with Hotaru CMS. If not, see http://www.gnu.org/licenses/. 
    19  *  
     19 * 
    2020 * @category  Content Management System 
    2121 * @package   HotaruCMS 
     
    3939if ($h->cage->post->keyExists('post_id')) { 
    4040    $post_id = $h->cage->post->testInt('post_id'); 
    41     $user_ip = $h->cage->post->testIp('user_ip'); 
     41    //$user_ip = $h->cage->post->testIp('user_ip'); 
    4242    $vote_rating = $h->cage->post->testInt('rating'); 
    43          
     43    $user_ip = $h->cage->server->testIp('REMOTE_ADDR'); 
     44    $referer = $h->cage->post->testAlnum('referer'); 
     45 
    4446    //get vote settings 
    45     $vote_settings = unserialize($h->getSetting('vote_settings', 'vote'));  
    46      
     47    $vote_settings = unserialize($h->getSetting('vote_settings', 'vote')); 
     48 
    4749    // Only proceed if the user is logged in 
    4850    if ($h->currentUser->loggedIn) { 
    49              
     51 
    5052        $user_id = $h->currentUser->id; 
    51          
     53 
    5254        // get vote history for this post: 
    53          
     55 
    5456        $sql = "SELECT vote_rating FROM " . TABLE_POSTVOTES . " WHERE vote_post_id = %d AND vote_user_id = %d AND vote_rating != %d"; 
    5557        $voted = $h->db->get_var($h->db->prepare($sql, $post_id, $user_id, -999)); 
    56          
     58 
    5759        if ($voted == $vote_rating) { 
    58             // Repeat vote. Must be from a double-click. Return false and  
     60            // Repeat vote. Must be from a double-click. Return false and 
    5961            $json_array = array('result'=>$h->lang['vote_already_voted']); 
    6062            echo json_encode($json_array); 
    6163            return false; 
    6264        } 
    63          
     65 
    6466        // get current vote count and status 
    6567        $sql = "SELECT post_votes_up, post_status, post_date FROM " . TABLE_POSTS . " WHERE post_id = %d"; 
    6668        $result = $h->db->get_row($h->db->prepare($sql, $post_id)); 
    67              
     69 
    6870        if ($vote_rating > 0) 
    6971        { 
     
    7375            if ((($result->post_votes_up + 1) >= $vote_settings['votes_to_promote']) 
    7476                && ($result->post_date >= $sql_deadline)) { $post_status = 'top'; } else { $post_status = $result->post_status; } 
    75                  
     77 
    7678            //if ($result->post_date >= $sql_deadline) { $test = "ok"; } 
    7779            //$json_array = array('result'=>$test); 
    7880            //echo json_encode($json_array); exit; 
    79              
     81 
    8082            // Update Posts table 
    8183            $sql = "UPDATE " . TABLE_POSTS . " SET post_status = %s, post_votes_up = post_votes_up + 1 WHERE post_id = %d"; 
    8284            $h->db->query($h->db->prepare($sql, $post_status, $post_id)); 
    83                  
     85 
    8486            // Update Postvotes table 
    8587            $sql = "INSERT INTO " . TABLE_POSTVOTES . " (vote_post_id, vote_user_id, vote_user_ip, vote_date, vote_type, vote_rating, vote_updateby) VALUES (%d, %d, %s, CURRENT_TIMESTAMP, %s, %d, %d)"; 
    8688            $h->db->query($h->db->prepare($sql, $post_id, $user_id, $user_ip, 'vote', $vote_rating, $user_id)); 
    87              
     89 
    8890            $h->pluginHook('vote_positive_vote', '', array('user' => $user_id, 'post'=>$post_id)); 
    89         }  
     91        } 
    9092        else // negative vote 
    9193        { 
     
    9698                $sql = "UPDATE " . TABLE_POSTS . " SET post_votes_up=post_votes_up-1 WHERE post_id = %d"; 
    9799                $h->db->query($h->db->prepare($sql, $post_id)); 
    98                  
     100 
    99101                // Change status to "new" if demoting a post 
    100102                if ($vote_settings['use_demote'] && (($result->post_votes_up - 1) < $vote_settings['votes_to_promote'])) { 
     
    106108                $sql = "DELETE FROM  " . TABLE_POSTVOTES . " WHERE vote_post_id = %d AND vote_user_id = %d AND vote_rating = %d"; 
    107109                $h->db->query($h->db->prepare($sql, $post_id, $user_id, $voted)); 
    108                  
     110 
    109111                $h->pluginHook('vote_negative_vote', '', array('user' => $user_id, 'post'=>$post_id)); 
    110112            } 
    111113        } 
    112          
     114 
     115        if ($referer == "link") { 
     116           // $h->readPost($post_id); 
     117           // header("Location: " . $h->post->origUrl); 
     118           } 
     119 
    113120        $sql = "SELECT post_votes_up, post_votes_down FROM " . TABLE_POSTS . " WHERE post_id = %d"; 
    114121        $votes = $h->db->get_row($h->db->prepare($sql, $post_id)); 
    115          
     122 
    116123        $json_array = array('votes'=>$votes->post_votes_up); 
    117          
     124 
    118125        echo json_encode($json_array); 
    119126    } 
  • trunk/content/plugins/vote/vote_settings.php

    r1081 r1190  
    5353        $no_front_page = $vote_settings['no_front_page']; 
    5454        $posts_widget = $vote_settings['posts_widget']; 
     55        $vote_on_url_click = $vote_settings['vote_on_url_click']; 
    5556         
    5657        //...otherwise set to blank or default: 
     
    6566        if (!$no_front_page) { $no_front_page = 5; } 
    6667        if (!$posts_widget) { $posts_widget = 'checked'; } 
     68        if (!$vote_on_url_click) { $vote_on_url_click = ''; } 
    6769         
    6870        // A plugin hook so other plugin developers can add settings 
     
    9294         
    9395        echo "<br /><p><b>" . $h->lang["vote_settings_other"] . "</b></p>"; 
    94 echo "<p><input type='checkbox' name='widget_votes' value='widget_votes' " . $posts_widget . ">&nbsp;&nbsp;" . $h->lang["vote_settings_posts_widget"] . "</p>\n";  
    95              
     96        echo "<p><input type='checkbox' name='widget_votes' value='widget_votes' " . $posts_widget . ">&nbsp;&nbsp;" . $h->lang["vote_settings_posts_widget"] . "</p>\n"; 
     97        echo "<p><input type='checkbox' name='vote_on_url_click' value=vote_on_url_click' " . $vote_on_url_click . ">&nbsp;&nbsp;" . $h->lang["vote_settings_vote_on_url_click"] . "</p>\n"; 
     98 
     99 
    96100        // A plugin hook so other plugin developers can show settings 
    97101        $h->pluginHook('vote_settings_form_2'); 
     
    224228            $posts_widget = ''; 
    225229        } 
     230         
     231        // vote_on_url_click 
     232        if ($h->cage->post->keyExists('vote_on_url_click')) {  
     233            $vote_on_url_click = 'checked'; 
     234        } else {  
     235            $vote_on_url_click = ''; 
     236        } 
     237 
    226238         
    227239        // A plugin hook so other plugin developers can save settings    
     
    239251        $vote_settings['no_front_page'] = $no_front_page; 
    240252        $vote_settings['posts_widget'] = $posts_widget; 
    241          
     253        $vote_settings['vote_on_url_click'] = $vote_on_url_click; 
     254        
    242255        // parameters: plugin folder name, setting name, setting value 
    243256        $h->updateSetting('vote_settings', serialize($vote_settings)); 
  • trunk/content/themes/keep-it-simple/css/style.css

    r1120 r1190  
    2121} 
    2222/* Links */ 
    23 a:link, a:visited {  
     23a:link {  
    2424        text-decoration: none; 
    2525        color: #AE855C;  
     26} 
     27a:visited {  
     28        text-decoration: none; 
     29        color: #666;     
     30        font-weight:normal; 
    2631} 
    2732a:hover { 
     
    190195        margin: 0 auto;  
    191196        text-align: left; 
    192         background: #fff url(../images/content-bg.gif) repeat-y center top;      
     197        background: #fff url(../images/content-bg.gif) repeat-y center;  
    193198        padding-bottom: 35px; 
    194199        padding-top: 5px;                
     
    303308        text-transform: uppercase;       
    304309} 
    305 #header #nav ul li a:hover,  
     310#header #nav ul li a:hover,      
    306311#header #nav ul li a:active { 
    307312        border: none; 
     
    310315} 
    311316 
    312 #header #nav ul li#navigation_active { 
     317#header #nav ul li.navigation_active { 
    313318        background: transparent url(../images/left-tab.gif) no-repeat;   
    314319} 
     
    334339} 
    335340/* left columns */ 
    336 #left-columns h3 .{ 
     341#left-columns h3 { 
    337342        color: #444; 
    338343        font: normal 1.8em Georgia, 'Times New Roman', Times, Serif; 
     
    348353        margin: 12px 0 5px 0; 
    349354} 
    350 #left-columns h3 a:link, a:visited { 
    351 color:#444; 
     355#left-columns  a:link { 
    352356text-decoration:none; 
    353357} 
    354  
    355  
     358#left-columns  a:visited { 
     359text-decoration:none; 
     360} 
    356361/* sidebar menu */ 
    357362.sidemenu ul { 
     
    612617        font-family:'Trebuchet MS','Helvetica Neue',Arial,Sans-Serif; 
    613618        font-size:18px; 
    614         font-size-adjust:none; 
    615         font-stretch:normal; 
    616619        font-style:normal; 
    617620        font-variant:normal; 
     
    624627 
    625628#breadcrumbs{ 
     629        width:480px; 
     630        overflow: auto; 
    626631        color: #7BA857; 
    627632        padding-bottom: 25px; 
     
    632637} 
    633638 
    634 #sort_box {margin-top: -32px; margin-botton: 20px;} 
     639#sort_box {margin-top: -32px; margin-bottom: 20px;} 
     640 
     641.user_tabs { 
     642background-color:#F0F0F0; 
     643margin-bottom:4em; 
     644padding-bottom:0.4em; 
     645padding-top:0.4em; 
     646} 
    635647 
    636648/* sidebar */ 
     
    667679} 
    668680 
     681/* who voted*/ 
     682#main h2#who_voted_title {font-size:2em; font-weight:normal; letter-spacing:-0.5px; padding-top:15px;} 
     683#who_voted_content {padding: 12px 0 0 40px;} 
    669684 
    670685/* comments */ 
     
    702717        width: 665px; 
    703718} 
     719#submit_button_1 { 
     720float:right; 
     721margin: -10px -20px 0 0; 
     722} 
    704723 
    705724/* Widget*/ 
    706725.widget_head { 
     726color:#666; 
    707727margin-top:0.4em; 
    708 } 
    709 .widget_head h2{ 
    710 color:#663333; 
    711 font-size:22px; 
     728font-size:18px; 
     729font-weight:normal; 
     730} 
     731.widget_head:first-letter{ 
     732color: #7BA857; 
     733font-weight:bold; 
    712734} 
    713735.widget_body { 
     
    715737padding-left:12px; 
    716738} 
    717  
    718739.message { 
    719740    margin: 1.0em auto 1.0em auto; 
  • trunk/content/themes/keep-it-simple/footer.php

    r1081 r1190  
    115115            // Link to forums... 
    116116            echo "<p><a href='http://hotarucms.org'><img src='" . BASEURL . "content/themes/" . THEME . "images/hotarucms.png' "; 
    117             echo "title='" . $h->lang["main_theme_footer_hotaru_link"] . "'></a></p>"; 
     117            echo "title='" . $h->lang["main_theme_footer_hotaru_link"] . " ' alt='Powered by HotaruCMS'/></a></p>"; 
    118118         
    119119            $h->showQueriesAndTime(); 
     
    123123<?php $h->pluginHook('pre_close_body'); ?> 
    124124 
     125 <script type='text/javascript'> 
     126 
     127    jQuery('document').ready(function($) { 
     128        $("a#navigation_active").parent("li").addClass("navigation_active"); 
     129        }); 
     130         
     131</script> 
    125132</body> 
    126133</html> 
  • trunk/content/themes/keep-it-simple/navigation.php

    r1081 r1190  
    4242    ?>           
    4343                <?php if (($h->pageType == 'user') && ($h->vars['user']->id == $h->currentUser->id)) { $status = "id='navigation_active'"; } else { $status = ""; } ?> 
    44                 <li <?php echo $status; ?>><a <?php echo $status; ?> href='<?php echo $h->url(array('user' => $h->currentUser->name)); ?>' title='<?php echo $h->lang["users_profile"]; ?>'> 
     44                <li><a <?php echo $status; ?> href='<?php echo $h->url(array('user' => $h->currentUser->name)); ?>' title='<?php echo $h->lang["users_profile"]; ?>'> 
    4545                    <?php echo $h->currentUser->name; ?> 
    4646                </a></li> 
     
    4848 
    4949    <?php if ($h->pageName == 'index') { $status = "id='navigation_active'"; } else { $status = ""; } ?> 
    50         <li <?php echo $status; ?>><a <?php echo $status; ?> href="<?php echo BASEURL; ?>"><?php echo $h->lang["main_theme_navigation_home"]; ?></a></li> 
     50        <li><a <?php echo $status; ?> href="<?php echo BASEURL; ?>"><?php echo $h->lang["main_theme_navigation_home"]; ?></a></li> 
    5151     
    5252        <?php $h->pluginHook('navigation'); ?> 
     
    7979                <div id="iconrss"> 
    8080                <a href="<?php echo $h->url(array('page'=>'rss')); ?>"> 
    81                     <img src="<?php echo BASEURL; ?>content/themes/<?php echo THEME; ?>images/new-rss.png"> 
     81                    <img src="<?php echo BASEURL; ?>content/themes/<?php echo THEME; ?>images/new-rss.png" alt="Feed RSS" /> 
    8282        </a> 
    8383                </div> 
  • trunk/content/themes/keep-it-simple/sb_sort_filter.php

    r1081 r1190  
    4949            <a href="<?php echo $h->vars['all_link']; ?>"> 
    5050            <?php echo $h->lang["sb_base_sort_all"]; ?></a> 
    51         </li> 
     51        <br/> 
     52                </li> 
    5253         
    53         <br /> 
    5454        <li> 
    5555        <?php echo $h->lang["sb_base_sort_best_from"]; ?></li> 
  • trunk/content/themes/shibuya/css/style.css

    r1108 r1190  
    4343 
    4444#announcement { 
    45     background-color: #f8f8f8; 
     45    background-color: #ffcc00 ; 
    4646    border-bottom: 1px solid #000; 
    4747    padding: 0.4em; 
     
    6060#hd_title h1 { font-size: 2.2em; font-weight: bold; padding: 0.5em 0.4em 0.4em 0.4em;}    /* Site title */ 
    6161#hd_title h1 a { color: #fff; } 
    62 #hd_title h1 a:hover { color: #000; background-color:#FFCC00;  } 
     62#hd_title h1 a:hover { color: #000; background-color:transparent;  } 
    6363 
    6464#hd_block2 { float: right; height: 60px; width:468px;  } 
  • trunk/content/themes/shibuya/header.php

    r1081 r1190  
    5555    <link rel="stylesheet" href="<?php echo BASEURL . 'content/themes/' . THEME . 'css/style.css'; ?>" type="text/css" /> 
    5656    <!-- <link rel="shortcut icon" href="<?php echo BASEURL; ?>favicon.ico" /> --> 
    57     
     57 
     58    <?php   
     59        if (isset($h->vars['settings']['site_color'])) {  
     60            $site_color = '#' . $h->vars['settings']['site_color']; ?> 
     61            <style type="text/css"> 
     62            <!-- 
     63            #hd, #ft, #annoucement {background-color:<?php echo $site_color; ?> !important; } 
     64            a#navigation_active {color: <?php echo $site_color; ?> !important;} 
     65            --> 
     66            </style> 
     67    <?php } ?> 
     68 
    5869    <?php $h->pluginHook('header_include_raw'); ?> 
    5970    
  • trunk/content/themes/shibuya/index.php

    r1081 r1190  
    11<?php  
    22/** 
    3  * Theme name: shibuya 
    4  * Template name: index.php 
    5  * Template author: shibuya246 
     3 * name: shibuya 
     4 * version: 1.1 
     5 * author: shibuya246 
     6 * description: Flexible starter theme for hotaru 
     7 * authorurl: http:/shibuya246.com 
    68 * 
    79 * PHP version 5 
     
    2628 * @link      http://www.shibuya246.com/ 
    2729 */ 
     30 
     31// get settings: 
     32$h->vars['settings'] =  $h->getThemeSettings(); 
     33 
     34// get language 
     35$h->includeThemeLanguage(); 
    2836 
    2937// plugin hook 
  • trunk/install/upgrade.php

    r1081 r1190  
    339339    } 
    340340     
     341    // 1.0.5 to 1.1 
     342    if ($old_version == "1.0.5") { 
     343         
     344        // update "old version" for next set of upgrades 
     345        $old_version = "1.1"; 
     346    } 
     347     
    341348    // Update Hotaru version number to the database (referred to when upgrading) 
    342349    $sql = "UPDATE " . TABLE_MISCDATA . " SET miscdata_key = %s, miscdata_value = %s, miscdata_default = %s WHERE miscdata_key = %s"; 
  • trunk/javascript/hotaru.js

    r1081 r1190  
    106106}); 
    107107 
     108/*********************************************** 
     109* encode and decode function for jQuery 
     110* http://jqueryjournal.com/jquerys-url-encode-decode/ 
     111***********************************************/ 
     112 
     113$.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/; 
     114  while(x<c.length){var m=r.exec(c.substr(x)); 
     115    if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length; 
     116    }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16); 
     117    o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}, 
     118URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/; 
     119  while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16); 
     120  t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;} 
     121}); 
     122 
    108123 
    109124/*********************************************** 
     
    130145        return true; 
    131146} 
     147 
     148 
     149 
  • trunk/libs/Avatar.php

    r1081 r1190  
    4242    public $size        = 32; 
    4343    public $rating      = 'g';  // "global" used by Gravatar 
     44    public $valid       = true; 
    4445     
    4546     
     
    8889     
    8990    /** 
     91     * test the avatar to see if it's valid 
     92     * 
     93     * @return bool 
     94     */ 
     95    public function testAvatar($h) 
     96    { 
     97        if (!$this->user_id) { return false; } 
     98         
     99        $result = $h->pluginHook('avatar_test_avatar'); 
     100 
     101        if (!$result) { 
     102            $this->valid = false; 
     103            return false; 
     104        }  
     105         
     106        $this->valid = true; 
     107        return $result[key($result)];   // returns the result (i.e. Gravatar url in the case of Gravatar) 
     108 
     109    } 
     110     
     111     
     112    /** 
    90113     * get the plain avatar with no surrounding HTML div 
    91114     * 
     
    109132 
    110133    /** 
    111      * option to display the avatar linked to ther user's profile 
     134     * option to display the avatar linked to ther user's profile (image obtained from plugin) 
    112135     */ 
    113136    public function linkAvatar($h) 
     
    129152 
    130153    /** 
    131      * option to display the profile-linked avatar wrapped in a div 
     154     * option to display the profile-linked avatar wrapped in a div (image obtained from plugin) 
    132155     */ 
    133156    public function wrapAvatar($h) 
     
    148171        return $output; 
    149172    } 
     173     
     174     
     175    /** 
     176     * option to display the avatar linked to ther user's profile (image already set) 
     177     */ 
     178    public function linkAvatarImage($h, $avatar_image = '') 
     179    { 
     180        if (!$this->user_id) { return false; } 
     181         
     182        $output = "<a href='" . $h->url(array('user' => $this->user_name)) . "' title='" . $this->user_name . "'>\n"; 
     183        $output .= $avatar_image; // avatar in img tags 
     184        $output .= "</a>\n"; 
     185        return $output; 
     186    } 
     187 
     188 
     189    /** 
     190     * option to display the profile-linked avatar wrapped in a div (image already set) 
     191     */ 
     192    public function wrapAvatarImage($h, $avatar_image = '') 
     193    { 
     194        if (!$this->user_id) { return false; } 
     195         
     196        $output = "<div class='avatar_wrapper'>"; 
     197        $output .= "<a href='" . $h->url(array('user' => $this->user_name)) . "' title='" . $this->user_name . "'>\n"; 
     198        $output .= $avatar_image; // avatar in img tags 
     199        $output .= "</a>\n"; 
     200        $output .= "</div>\n"; 
     201        return $output; 
     202    } 
    150203} 
    151204?> 
  • trunk/libs/Blocked.php

    r1108 r1190  
    7777        // GET CURRENTLY BLOCKED ITEMS... 
    7878         
     79        $query = ''; 
    7980        $where_clause = ''; 
     81        $sort_clause = " ORDER BY blocked_updatedts DESC"; 
    8082         
    8183        // if search 
    8284        if ($safe && $h->cage->post->getAlpha('type') == 'search') { 
    8385            $search_term = $h->cage->post->sanitizeTags('search_value'); 
    84             $where_clause = " WHERE blocked_value LIKE '%" . trim($h->db->escape($search_term)) . "%'"; 
     86            $where_clause = " WHERE blocked_value LIKE %s"; 
     87            $count_sql = "SELECT count(*) AS number FROM " . TABLE_BLOCKED . $where_clause; 
     88            $count = $h->db->get_var($h->db->prepare($count_sql, '%' . trim($search_term) . '%')); 
     89            $sql = "SELECT * FROM " . TABLE_BLOCKED . $where_clause . $sort_clause; 
     90            $query = $h->db->prepare($sql, '%' . trim($search_term) . '%'); 
    8591        } 
    8692         
    8793        // if filter 
     94        $filter = ''; 
    8895        if ($safe && $h->cage->post->getAlpha('type') == 'filter') { 
    8996            $filter = $h->cage->post->testAlnumLines('blocked_type'); 
    90             if ($filter == 'all') { $where_clause = ''; } else { $where_clause = " WHERE blocked_type = %s"; } 
     97            if ($filter == 'all') {  
     98                $count_sql = "SELECT count(*) AS number FROM " . TABLE_BLOCKED; 
     99                $count = $h->db->get_var($h->db->prepare($count_sql)); 
     100                $sql = "SELECT * FROM " . TABLE_BLOCKED . $sort_clause; 
     101                $query = $h->db->prepare($sql); 
     102            } else { 
     103                $count_sql = "SELECT count(*) AS number FROM " . TABLE_BLOCKED . " WHERE blocked_type = %s"; 
     104                $count = $h->db->get_var($h->db->prepare($count_sql, $filter)); 
     105                $sql = "SELECT * FROM " . TABLE_BLOCKED . " WHERE blocked_type = %s" . $sort_clause; 
     106                $query = $h->db->prepare($sql, $filter); 
     107            } 
    91108        } 
    92109         
    93110        // SQL 
    94         $sql = "SELECT * FROM " . TABLE_BLOCKED . $where_clause; 
    95  
    96         if (isset($search_term)) {  
    97             $blocked_items = $h->db->get_results($sql); 
    98         } elseif (isset($filter)) {  
    99             $blocked_items = $h->db->get_results($h->db->prepare($sql, $filter)); 
    100         } else { 
    101             $blocked_items = $h->db->get_results($h->db->prepare($sql)); 
    102         } 
    103          
    104         if (!$blocked_items) { return array(); } 
    105          
    106         $pg = $h->cage->get->getInt('pg'); 
    107         $items = 20; 
     111        if (!$query) {  
     112            $count_sql = "SELECT count(*) AS number FROM " . TABLE_BLOCKED; 
     113            $count = $h->db->get_var($h->db->prepare($count_sql)); 
     114            $sql = "SELECT * FROM " . TABLE_BLOCKED . $sort_clause; 
     115            $query = $h->db->prepare($sql); 
     116        } 
     117         
     118        $items_per_page = 20; 
    108119        $output = ""; 
    109120         
    110         require_once(EXTENSIONS . 'Paginated/Paginated.php'); 
    111         require_once(EXTENSIONS . 'Paginated/DoubleBarLayout.php'); 
    112         $pagedResults = new Paginated($blocked_items, $items, $pg); 
     121        $pagedResults = $h->pagination($query, $count, $items_per_page, 'blocked'); 
    113122         
    114123        $alt = 0; 
    115         while($block = $pagedResults->fetchPagedRow()) {    //when $story is false loop terminates     
    116             $alt++; 
    117             $output .= "<tr class='table_row_" . $alt % 2 . "'>\n"; 
    118             $output .= "<td>" . $block->blocked_type . "</td>\n"; 
    119             $output .= "<td>" . $block->blocked_value . "</td>\n"; 
    120             $output .= "<td>" . "<a class='table_drop_down' href='#'>\n"; 
    121             $output .= "<img src='" . BASEURL . "content/admin_themes/" . ADMIN_THEME . "images/edit.png'>" . "</a></td>\n"; 
    122             $output .= "<td>" . "<a href='" . BASEURL . "admin_index.php?page=blocked_list&amp;action=remove&amp;id=" . $block->blocked_id . "'>\n"; 
    123             $output .= "<img src='" . BASEURL . "content/admin_themes/" . ADMIN_THEME . "images/delete.png'>" . "</a></td>\n"; 
    124             $output .= "</tr>\n"; 
    125             $output .= "<tr class='table_tr_details' style='display:none;'>\n"; 
    126             $output .= "<td colspan=3 class='table_description'>\n"; 
    127             $output .= "<form name='blocked_list_edit_form' action='" . BASEURL . "admin_index.php' method='post'>\n"; 
    128             $output .= "<table><tr><td><select name='blocked_type'>\n"; 
    129              
    130             switch($block->blocked_type) {  
    131                 case 'url': 
    132                     $text = $h->lang["admin_theme_blocked_url"]; 
    133                     break; 
    134                 case 'email': 
    135                     $text = $h->lang["admin_theme_blocked_email"]; 
    136                     break; 
    137                 default: 
    138                     $text = $h->lang["admin_theme_blocked_ip"]; 
    139                     break; 
    140             } 
    141              
    142             $output .= "<option value='" . $block->blocked_type . "'>" . $text . "</option>\n"; 
    143             $output .= "<option value='ip'>" . $h->lang["admin_theme_blocked_ip"] . "</option>\n"; 
    144             $output .= "<option value='url'>" . $h->lang["admin_theme_blocked_url"] . "</option>\n"; 
    145             $output .= "<option value='email'>" . $h->lang["admin_theme_blocked_email"] . "</option>\n"; 
    146             $output .= "<option value='user'>" . $h->lang["admin_theme_blocked_username"] . "</option>\n"; 
    147             $output .= "</select></td>\n"; 
    148             $output .= "<td><input type='text' size=30 name='value' value='" . $block->blocked_value . "' /></td>\n"; 
    149             $output .= "<td><input class='submit' type='submit' value='" . $h->lang['admin_blocked_list_update'] . "' /></td>\n"; 
    150             $output .= "</tr></table>\n"; 
    151             $output .= "<input type='hidden' name='id' value='" . $block->blocked_id . "' />\n"; 
    152             $output .= "<input type='hidden' name='page' value='blocked_list' />\n"; 
    153             $output .= "<input type='hidden' name='type' value='edit' />\n"; 
    154             $output .= "<input type='hidden' name='csrf' value='" . $h->csrfToken . "' />"; 
    155             $output .= "</form>\n"; 
    156             $output .= "</td>"; 
    157             $output .= "<td class='table_description_close'><a class='table_hide_details' href='#'>" . $h->lang["admin_theme_plugins_close"] . "</a></td>"; 
    158             $output .= "</tr>"; 
     124        if ($pagedResults->items) { 
     125            foreach ($pagedResults->items as $block) { 
     126                $alt++; 
     127                $output .= "<tr class='table_row_" . $alt % 2 . "'>\n"; 
     128                $output .= "<td>" . $block->blocked_type . "</td>\n"; 
     129                $output .= "<td>" . $block->blocked_value . "</td>\n"; 
     130                $output .= "<td>" . "<a class='table_drop_down' href='#'>\n"; 
     131                $output .= "<img src='" . BASEURL . "content/admin_themes/" . ADMIN_THEME . "images/edit.png'>" . "</a></td>\n"; 
     132                $output .= "<td>" . "<a href='" . BASEURL . "admin_index.php?page=blocked_list&amp;action=remove&amp;id=" . $block->blocked_id . "'>\n"; 
     133                $output .= "<img src='" . BASEURL . "content/admin_themes/" . ADMIN_THEME . "images/delete.png'>" . "</a></td>\n"; 
     134                $output .= "</tr>\n"; 
     135                $output .= "<tr class='table_tr_details' style='display:none;'>\n"; 
     136                $output .= "<td colspan=3 class='table_description'>\n"; 
     137                $output .= "<form name='blocked_list_edit_form' action='" . BASEURL . "admin_index.php' method='post'>\n"; 
     138                $output .= "<table><tr><td><select name='blocked_type'>\n"; 
     139                 
     140                switch($block->blocked_type) {  
     141                    case 'url': 
     142                        $text = $h->lang["admin_theme_blocked_url"]; 
     143                        break; 
     144                    case 'email': 
     145                        $text = $h->lang["admin_theme_blocked_email"]; 
     146                        break; 
     147                    default: 
     148                        $text = $h->lang["admin_theme_blocked_ip"]; 
     149                        break; 
     150                } 
     151                 
     152                $output .= "<option value='" . $block->blocked_type . "'>" . $text . "</option>\n"; 
     153                $output .= "<option value='ip'>" . $h->lang["admin_theme_blocked_ip"] . "</option>\n"; 
     154                $output .= "<option value='url'>" . $h->lang["admin_theme_blocked_url"] . "</option>\n"; 
     155                $output .= "<option value='email'>" . $h->lang["admin_theme_blocked_email"] . "</option>\n"; 
     156                $output .= "<option value='user'>" . $h->lang["admin_theme_blocked_username"] . "</option>\n"; 
     157                $output .= "</select></td>\n"; 
     158                $output .= "<td><input type='text' size=30 name='value' value='" . $block->blocked_value . "' /></td>\n"; 
     159                $output .= "<td><input class='submit' type='submit' value='" . $h->lang['admin_blocked_list_update'] . "' /></td>\n"; 
     160                $output .= "</tr></table>\n"; 
     161                $output .= "<input type='hidden' name='id' value='" . $block->blocked_id . "' />\n"; 
     162                $output .= "<input type='hidden' name='page' value='blocked_list' />\n"; 
     163                $output .= "<input type='hidden' name='type' value='edit' />\n"; 
     164                $output .= "<input type='hidden' name='csrf' value='" . $h->csrfToken . "' />"; 
     165                $output .= "</form>\n"; 
     166                $output .= "</td>"; 
     167                $output .= "<td class='table_description_close'><a class='table_hide_details' href='#'>" . $h->lang["admin_theme_plugins_close"] . "</a></td>"; 
     168                $output .= "</tr>"; 
     169            } 
    159170        } 
    160171 
  • trunk/libs/Caching.php

    r1081 r1190  
    230230                $sql = "SELECT miscdata_updatedts FROM " . DB_PREFIX . "miscdata ORDER BY miscdata_updatedts DESC"; 
    231231                break; 
     232            case 'blocked': 
     233                $sql = "SELECT blocked_updatedts FROM " . DB_PREFIX . "blocked ORDER BY blocked_updatedts DESC"; 
     234                break; 
    232235            default: 
    233236                return false; 
  • trunk/libs/Category.php

    r1081 r1190  
    137137        if ($cat_children_ids) { return $cat_children_ids; } else { return false; } 
    138138    } 
     139     
     140     
     141    /** 
     142     * Returns meta description and keywords for the category (if available) 
     143     * 
     144     * @param int $cat_id 
     145     * @return array|false 
     146     */ 
     147    public function getCatMeta($h, $cat_id) 
     148    { 
     149        $sql = "SELECT category_desc, category_keywords FROM " . TABLE_CATEGORIES . " WHERE category_id = %d"; 
     150        $cat_meta = $h->db->get_row($h->db->prepare($sql, $cat_id)); 
     151        if ($cat_meta) { return $cat_meta; } else { return false; } 
     152    } 
    139153} 
    140154 
  • trunk/libs/Comment.php

    r1127 r1190  
    3333    protected $date         = ''; 
    3434    protected $status       = 'approved'; 
    35     protected $votes        = 0; 
     35    protected $votes_up     = 0; 
     36    protected $votes_down   = 0; 
    3637    protected $content      = ''; 
    3738    protected $type         = 'newcomment';   // or "editcomment" 
     
    159160            // get all comments 
    160161            if ($userid) {  
    161                 $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_status = %s AND comment_user_id = %d ORDER BY comment_date " . $order . $limit; 
    162                 $comments = $h->db->get_results($h->db->prepare($sql, 'approved', $userid)); 
     162                $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_archived = %s AND comment_status = %s AND comment_user_id = %d ORDER BY comment_date " . $order . $limit; 
     163                $comments = $h->db->get_results($h->db->prepare($sql, 'N', 'approved', $userid)); 
    163164            } else { 
    164                 $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_status = %s ORDER BY comment_date " . $order . $limit; 
    165                 $comments = $h->db->get_results($h->db->prepare($sql, 'approved')); 
     165                $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_archived = %s AND comment_status = %s ORDER BY comment_date " . $order . $limit; 
     166                $comments = $h->db->get_results($h->db->prepare($sql, 'N', 'approved')); 
    166167            } 
    167168        } 
    168169         
    169170        if($comments) { return $comments; } else { return false; } 
     171    } 
     172     
     173     
     174    /** 
     175     * Get all comments from database 
     176     * 
     177     * @param int $post_id - you can limit comments to a single post 
     178     * @return array|false 
     179     */ 
     180    function getAllCommentsCount($h, $order = "ASC", $userid = 0) 
     181    { 
     182        // get all comments 
     183        if ($userid) {  
     184            $sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS . " WHERE comment_archived = %s AND comment_status = %s AND comment_user_id = %d ORDER BY comment_date " . $order; 
     185            $comment_count = $h->db->get_var($h->db->prepare($sql, 'N', 'approved', $userid)); 
     186        } else { 
     187            $sql = "SELECT count(*) AS number FROM " . TABLE_COMMENTS . " WHERE comment_archived = %s AND comment_status = %s ORDER BY comment_date " . $order; 
     188            $comment_count = $h->db->get_var($h->db->prepare($sql, 'N', 'approved')); 
     189        } 
     190         
     191        if($comment_count) { return $comment_count; } else { return false; } 
     192    } 
     193     
     194     
     195    /** 
     196     * Get all comments from database 
     197     * 
     198     * @param int $post_id - you can limit comments to a single post 
     199     * @return array|false 
     200     */ 
     201    function getAllCommentsQuery($h, $order = "ASC", $userid = 0) 
     202    { 
     203        // get all comments 
     204        if ($userid) {  
     205            $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_status = %s AND comment_user_id = %d ORDER BY comment_date " . $order; 
     206            $query = $h->db->prepare($sql, 'approved', $userid); 
     207        } else { 
     208            $sql = "SELECT * FROM " . TABLE_COMMENTS . " WHERE comment_status = %s ORDER BY comment_date " . $order; 
     209            $query = $h->db->prepare($sql, 'approved'); 
     210        } 
     211         
     212        if($query) { return $query; } else { return false; } 
    170213    } 
    171214     
     
    269312    public function deleteComment($h, $comment_id = 0) 
    270313    { 
     314        if (!$comment_id) { $comment_id = $this->id; } 
    271315        if (!$comment_id) { return false; } 
    272          
     316 
    273317        $sql = "DELETE FROM " . TABLE_COMMENTS . " WHERE comment_id = %d"; 
    274318        $h->db->query($h->db->prepare($sql, $comment_id)); 
    275319         
    276320        // delete any votes for this comment 
    277         //$sql = "DELETE FROM " . TABLE_COMMENTVOTES . " WHERE cvote_comment_id = %d"; 
    278         //$h->db->query($h->db->prepare($sql, $this->id)); 
     321        $sql = "DELETE FROM " . TABLE_COMMENTVOTES . " WHERE cvote_comment_id = %d"; 
     322        $h->db->query($h->db->prepare($sql, $this->id)); 
    279323         
    280324        $h->comment->id = $comment_id; // a small hack to get the id for use in plugins. 
  • trunk/libs/IncludeCssJs.php

    r1081 r1190  
    346346     * @param bool $admin  
    347347     */ 
    348      public function includeCombined($version_js = 0, $version_css = 0, $admin = false) 
     348     public function includeCombined($h, $version_js = 0, $version_css = 0, $admin = false) 
    349349     {         
    350350        if ($admin) { $index = 'admin_index'; } else { $index = 'index'; } 
     
    357357            echo "<link rel='stylesheet' href='" . BASEURL . $index . ".php?combine=1&amp;type=css&amp;version=" . $version_css . "' type='text/css' />\n"; 
    358358        } 
    359  
     359        if ($h->currentUser->loggedIn) {echo "<div id='loggedIn' class='loggedIn_true'/>"; } else {"<div id='loggedIn' class='loggedIn_false'/>";} 
    360360     } 
    361361} 
  • trunk/libs/Initialize.php

    r1108 r1190  
    174174        $cage->addAccessor('sanitizeAll'); 
    175175        $cage->addAccessor('sanitizeTags'); 
     176        $cage->addAccessor('sanitizeEnts'); 
    176177        $cage->addAccessor('getHtmLawed'); 
    177178         
  • trunk/libs/Maintenance.php

    r1108 r1190  
    102102            if ($file != 'placeholder.txt') { 
    103103                if (@unlink($dir.'/'.$file)) { 
    104                     $success = true; 
     104                    // ignore setting $success for the JavascriptConstants file which is ALWAYS present (even gets regenerated after deletion) 
     105                    if ($file != 'JavascriptConstants.js') { $success = true; } 
    105106                } else { 
    106107                    $success = false; 
  • trunk/libs/PageHandling.php

    r1108 r1190  
    303303     
    304304    /** 
    305      * Prepare pagination and display page numbers bar 
    306      * 
    307      * @param array $items - array of all items to show 
    308      * @param int $items_per_page 
    309      * @param int $pg - current page number 
    310      * @return object - object of type Paginated 
    311      */ 
    312     public function pagination($h, $items = array(), $items_per_page = 10, $pg = 0) 
    313     { 
    314         if (!$items) { return false; } 
    315          
    316         require_once(EXTENSIONS . 'Paginated/Paginated.php'); 
    317         require_once(EXTENSIONS . 'Paginated/DoubleBarLayout.php'); 
    318  
    319         $pg = $h->cage->get->getInt('pg'); 
    320         return new Paginated($items, $items_per_page, $pg); 
    321     } 
    322      
    323      
    324     /** 
    325305     * Return page numbers bar 
    326306     * 
  • trunk/libs/PluginManagement.php

    r1120 r1190  
    275275            return false; 
    276276        } 
    277                      
    278         $sql = "REPLACE INTO " . TABLE_PLUGINS . " (plugin_enabled, plugin_name, plugin_folder, plugin_class, plugin_extends, plugin_type, plugin_desc, plugin_requires, plugin_version, plugin_author, plugin_authorurl, plugin_updateby) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d)"; 
    279         $h->db->query($h->db->prepare($sql, $h->plugin->enabled, $h->plugin->name, $h->plugin->folder, $h->plugin->class, $h->plugin->extends, $h->plugin->type, $h->plugin->desc, $h->plugin->requires, $h->plugin->version, $h->plugin->author, urlencode($h->plugin->authorurl), $h->currentUser->id)); 
    280  
    281         // Get the last order number - doing this after REPLACE INTO because  
    282         // we don't know whether the above will insert or replace. 
    283         $sql = "SELECT plugin_order FROM " . TABLE_PLUGINS . " ORDER BY plugin_order DESC LIMIT 1"; 
    284         $highest_order = $h->db->get_var($h->db->prepare($sql)); 
    285  
    286         // Give the new plugin the order number + 1 
    287         $sql = "UPDATE " . TABLE_PLUGINS . " SET plugin_order = %d WHERE plugin_id = LAST_INSERT_ID()"; 
    288         $h->db->query($h->db->prepare($sql, ($highest_order + 1))); 
     277 
     278        // set a new plugin order if NOT upgrading 
     279        if ($upgrade == 0) { 
     280         
     281            $sql = "REPLACE INTO " . TABLE_PLUGINS . " (plugin_enabled, plugin_name, plugin_folder, plugin_class, plugin_extends, plugin_type, plugin_desc, plugin_requires, plugin_version, plugin_author, plugin_authorurl, plugin_updateby) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d)"; 
     282            $h->db->query($h->db->prepare($sql, $h->plugin->enabled, $h->plugin->name, $h->plugin->folder, $h->plugin->class, $h->plugin->extends, $h->plugin->type, $h->plugin->desc, $h->plugin->requires, $h->plugin->version, $h->plugin->author, urlencode($h->plugin->authorurl), $h->currentUser->id)); 
     283 
     284            // Get the last order number - doing this after REPLACE INTO because  
     285            // we don't know whether the above will insert or replace. 
     286            $sql = "SELECT plugin_order FROM " . TABLE_PLUGINS . " ORDER BY plugin_order DESC LIMIT 1"; 
     287            $highest_order = $h->db->get_var($h->db->prepare($sql)); 
     288     
     289            // Give the new plugin the order number + 1 
     290            $sql = "UPDATE " . TABLE_PLUGINS . " SET plugin_order = %d WHERE plugin_id = LAST_INSERT_ID()"; 
     291            $h->db->query($h->db->prepare($sql, ($highest_order + 1))); 
     292        } else { 
     293            // upgrading: 
     294            $sql = "UPDATE " . TABLE_PLUGINS . " SET plugin_enabled = %d, plugin_name = %s, plugin_folder = %s, plugin_class = %s, plugin_extends = %s, plugin_type = %s, plugin_desc = %s, plugin_requires = %s, plugin_version = %s, plugin_author = %s, plugin_authorurl = %s, plugin_updateby = %d WHERE plugin_folder = %s"; 
     295            $h->db->query($h->db->prepare($sql, $h->plugin->enabled, $h->plugin->name, $h->plugin->folder, $h->plugin->class, $h->plugin->extends, $h->plugin->type, $h->plugin->desc, $h->plugin->requires, $h->plugin->version, $h->plugin->author, urlencode($h->plugin->authorurl), $h->currentUser->id, $h->plugin->folder)); 
     296        } 
    289297         
    290298        // Add any plugin hooks to the hooks table 
     
    405413        $h->deleteFiles(CACHE . 'css_js_cache'); 
    406414 
    407         $h->db->query($h->db->prepare("DELETE FROM " . TABLE_PLUGINS . " WHERE plugin_folder = %s", $h->plugin->folder)); 
     415        if ($upgrade == 0) { // don't delete plugin when we're upgrading 
     416            $h->db->query($h->db->prepare("DELETE FROM " . TABLE_PLUGINS . " WHERE plugin_folder = %s", $h->plugin->folder)); 
     417        } 
     418         
    408419        $h->db->query($h->db->prepare("DELETE FROM " . TABLE_PLUGINHOOKS . " WHERE plugin_folder = %s", $h->plugin->folder)); 
    409420         
     
    590601            // If file version is newer the the current plugin version, then upgrade... 
    591602            if (version_compare($file_version, $db_version, '>')) { 
    592                 $this->upgrade($h); // runs the install function ans hows "upgraded!" message instead of "installed". 
     603                $this->upgrade($h); // runs the install function and shows "upgraded!" message instead of "installed". 
    593604            } else { 
    594605                // else simply show an activated message... 
     
    604615            $h->messages[$h->lang["admin_plugins_deactivated"]] = 'green';  
    605616        } 
     617         
     618        $h->pluginHook('activate_deactivate', '', array('enabled' => $enabled)); 
    606619    } 
    607620     
  • trunk/libs/ThemeSettings.php

    r1081 r1190  
    6767        } 
    6868         
    69         return $settings;  
     69        if ($settings) { return $settings; } else { return false; }  
    7070    } 
    7171     
  • trunk/libs/UserAuth.php

    r1103 r1190  
    309309                $viewee->role = $role_check; 
    310310                $new_perms = $viewee->getDefaultPermissions($h, $role_check); 
    311                 $viewee->setAllPermissions($h, $new_perms); 
     311                $viewee->setAllPermissions($new_perms); 
    312312                $viewee->updatePermissions($h); 
    313313                if ($role_check == 'killspammed' || $role_check == 'deleted') { 
  • trunk/libs/extensions/csrf/csrf_class.php

    r1081 r1190  
    1111 
    1212 
    13     public function csrfInit($h, $type = 'check', $action = 'unspecified', $life = 10) 
     13    public function csrfInit($h, $type = 'check', $action = 'unspecified', $life = 30) 
    1414    { 
    1515        $this->sid  = preg_replace('/[^a-z0-9]+/i', '', session_id()); 
Note: See TracChangeset for help on using the changeset viewer.