Changeset 1210


Ignore:
Timestamp:
02/22/10 05:41:34 (3 years ago)
Author:
nick_ramsay
Message:

[Trunk] SB Base 0.3, Stop Spam 0.3, Related Posts 0.4 - upgrade those plugins. Note the new changes in the sb_list.php template.

Location:
trunk/content/plugins
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/content/plugins

  • trunk/content/plugins/related_posts/readme.txt

    r1190 r1210  
    1515Changelog 
    1616--------- 
     17v.0.4 2010/02/22 - Nick - Caches the HTML results until the tags table is updated 
    1718v.0.3 2010/02/20 - Nick - Fix for SQL warning when no tags present 
    1819v.0.2 2009/12/31 - Nick - Compatibility with Hotaru 1.0 
  • trunk/content/plugins/related_posts/related_posts.php

    r1190 r1210  
    33 * name: Related Posts 
    44 * description: Show a list of related posts 
    5  * version: 0.3 
     5 * version: 0.4 
    66 * folder: related_posts 
    77 * class: relatedPosts 
     
    165165        $search_terms = $tags; 
    166166         
     167        $need_cache = false; 
     168         
     169        // check for a cached version and use it if no recent update: 
     170        $output = $h->smartCache('html', 'tags', 60, '', 'related_posts_' . $original_id); 
     171        if ($output) { 
     172            echo $output; // cached HTML 
     173            return true; 
     174        } else { 
     175            $need_cache = true; 
     176        } 
     177         
     178        // get the results and generate HTML: 
    167179        $output = $this->showRelatedPosts($h, $search_terms, $num_posts); 
     180         
     181        // write them to the cache 
     182        if ($need_cache) { 
     183            $h->smartCache('html', 'tags', 60, $output, 'related_posts_' . $original_id); // make or rewrite the cache file 
     184        } 
     185         
    168186        echo $output; 
    169187         
     
    213231     
    214232    /** 
    215      * Message when no related posts found, or no tags present 
     233     * Message when no related posts found, or no tags present on submit step 3 
    216234     * 
    217235     * @param string $output 
     
    220238    public function noRelatedPosts($h, $output = '') 
    221239    { 
    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         */ 
     240        if ($h->isPage('submit3')) {  
     241            $output .= "<div id='related_posts_none'>\n"; 
     242            $output .= $h->lang['related_links_no_results']; 
     243            $output .= "</div>\n"; 
     244        } 
    228245         
    229246        return $output; 
  • trunk/content/plugins/sb_base/languages/sb_base_language.php

    r1190 r1210  
    4040$lang["sb_base_top_365_days"] = "Top Posts (last 365 Days)"; 
    4141$lang["sb_base_top_all_time"] = "Top Posts (All-Time)"; 
     42$lang["sb_base_no_posts"] = "No posts found."; 
    4243 
    4344/* Post */ 
  • trunk/content/plugins/sb_base/libs/SbBaseFunctions.php

    r1190 r1210  
    327327        // When a user clicks a parent category, we need to show posts from all child categories, too. 
    328328        // This only works for one level of sub-categories. 
    329         if ($category) { 
     329        if ($category && $cat_id) { 
    330330            $filter_string = '(post_category = %d'; 
    331331            $values = array($cat_id); 
  • trunk/content/plugins/sb_base/readme.txt

    r1190 r1210  
    1414Changelog 
    1515--------- 
     16v.0.3 2010/02/21 - Nick - Bug fixes, cleaner list template and new "sb_no_posts" template 
    1617v.0.2 2010/02/18 - Nick - Code changes for pagination 
    1718v.0.1 2009/12/16 - Nick - Released first version 
  • trunk/content/plugins/sb_base/sb_base.php

    r1190 r1210  
    33 * name: SB Base 
    44 * description: Social Bookmarking base - provides "list" and "post" templates.  
    5  * version: 0.2 
     5 * version: 0.3 
    66 * folder: sb_base 
    77 * class: SbBase 
     
    123123        // get settings 
    124124        $h->vars['sb_base_settings'] = $h->getSerializedSettings('sb_base'); 
    125         $h->vars['posts_per_page'] = $h->vars['sb_base_settings']['posts_per_page']; 
     125        $posts_per_page = $h->vars['sb_base_settings']['posts_per_page']; 
    126126         
    127127        // if a list, get the posts: 
     
    129129        { 
    130130            case 'list': 
    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 
     131                $post_count = $sb_funcs->prepareList($h, '', 'count');   // get the number of posts 
     132                $post_query = $sb_funcs->prepareList($h, '', 'query');   // and the SQL query used 
     133                $h->vars['pagedResults'] = $h->pagination($post_query, $post_count, $posts_per_page, 'posts'); 
    133134                break; 
    134135            case 'post': 
     
    289290                 
    290291            case 'list': 
    291                  
    292                 $h->displayTemplate('sb_list'); 
     292                if (isset($h->vars['pagedResults']->items)) { 
     293                    $h->displayTemplate('sb_list'); 
     294                    echo $h->pageBar($h->vars['pagedResults']); 
     295                } else { 
     296                    $h->displayTemplate('sb_no_posts'); 
     297                }  
    293298                return true; 
    294299        } 
  • trunk/content/plugins/sb_base/templates/sb_list.php

    r1190 r1210  
    2525 */ 
    2626 
    27 ?> 
    28 <?php  
    29 if ($h->vars['post_count']) { 
    30      
    31     $pagedResults = $h->pagination($h->vars['post_query'], $h->vars['post_count'], $h->vars['posts_per_page'], 'posts'); 
    32     foreach ($pagedResults->items as $post) { 
    33         $h->readPost(0, $post); 
    34         $user = new UserBase(); 
    35         $user->getUserBasic($h, $h->post->author); 
     27foreach ($h->vars['pagedResults']->items as $post) { 
     28    $h->readPost(0, $post); 
     29    $user = new UserBase(); 
     30    $user->getUserBasic($h, $h->post->author); 
    3631?> 
    3732 
     
    9792    <!-- END POST -->  
    9893 
    99 <?php     
    100     } 
    101     echo $h->pageBar($pagedResults); 
    102 } 
    103 ?> 
     94<?php } ?> 
  • trunk/content/plugins/stop_spam/libs/StopSpam.php

    r1081 r1210  
    100100        $url .= "&api_key=" . $apikey; 
    101101         
    102         /* 
    103         // Old method: 
    104102        require_once(EXTENSIONS . 'SWCMS/class.httprequest.php'); 
    105103        $r = new HTTPRequest($url); 
    106104        $error = $r->DownloadToString(); 
    107         if (!$error) { echo "Success"; } else { echo $error; } 
    108         */ 
    109          
    110         // New method: 
    111         // http://www.phpfour.com/blog/2008/01/php-http-class/ 
    112         require_once(EXTENSIONS . 'http/class.http.php'); 
    113         $http = new Http(); 
    114         $http->execute($url); 
    115         //if (!$http->error) { echo "Success"; } else { echo $http->error; } 
     105        //if (!$error) { echo "Success"; } else { echo $error; } 
    116106    } 
    117107} 
  • trunk/content/plugins/stop_spam/readme.txt

    r1081 r1210  
    2727Changelog 
    2828--------- 
     29v.0.3 2010/02/22 - Nick - Reverted to SWCMS httprequest class to avoid CURL warnings 
    2930v.0.2 2010/01/04 - Nick - Updates for compatibility with Hotaru 1.0 
    3031v.0.1 2009/11/23 - Nick - Released first version 
  • trunk/content/plugins/stop_spam/stop_spam.php

    r1081 r1210  
    33 * name: StopSpam 
    44 * description: Checks new users against the StopForumSpam.com blacklist 
    5  * version: 0.2 
     5 * version: 0.3 
    66 * folder: stop_spam 
    77 * class: StopSpam 
  • trunk/content/plugins/submit/libs/SubmitFunctions.php

    r1190 r1210  
    692692    { 
    693693        require_once(EXTENSIONS . 'SWCMS/class.httprequest.php'); 
    694         //require_once(EXTENSIONS . 'http/class.http.php'); 
    695694         
    696695        if ($url != 'http://' && $url != ''){ 
    697696            $r = new HTTPRequest($url); 
    698697            $string = $r->DownloadToString(); 
    699             //$http = new Http(); 
    700             //$http->execute($url); 
    701             //$string = $http->result; 
    702698        } else { 
    703699            $string = ''; 
Note: See TracChangeset for help on using the changeset viewer.