Changeset 1190
- Timestamp:
- 02/20/10 11:29:15 (3 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 96 edited
- 25 copied
-
. (modified) (1 prop)
-
Hotaru.php (modified) (5 diffs)
-
READ_ME.txt (modified) (1 diff)
-
content/admin_themes/admin_default/blocked_list.php (modified) (7 diffs)
-
content/admin_themes/admin_default/header.php (modified) (1 diff)
-
content/main_language.php (modified) (1 diff)
-
content/plugins/activity/activity.php (modified) (4 diffs)
-
content/plugins/activity/readme.txt (modified) (1 diff)
-
content/plugins/activity/templates/activity.php (modified) (1 diff)
-
content/plugins/activity/templates/activity_profile.php (modified) (1 diff)
-
content/plugins/admin_email/admin_email.php (modified) (1 diff)
-
content/plugins/buzz_it (copied) (copied from branches/1.0/content/plugins/buzz_it)
-
content/plugins/buzz_it/buzz_it.php (copied) (copied from branches/1.0/content/plugins/buzz_it/buzz_it.php)
-
content/plugins/buzz_it/buzz_it_settings.php (copied) (copied from branches/1.0/content/plugins/buzz_it/buzz_it_settings.php)
-
content/plugins/buzz_it/css (copied) (copied from branches/1.0/content/plugins/buzz_it/css)
-
content/plugins/buzz_it/css/buzz_it.css (copied) (copied from branches/1.0/content/plugins/buzz_it/css/buzz_it.css)
-
content/plugins/buzz_it/images (copied) (copied from branches/1.0/content/plugins/buzz_it/images)
-
content/plugins/buzz_it/images/google-buzz-icon-single.png (copied) (copied from branches/1.0/content/plugins/buzz_it/images/google-buzz-icon-single.png)
-
content/plugins/buzz_it/images/google-buzz-icon.png (copied) (copied from branches/1.0/content/plugins/buzz_it/images/google-buzz-icon.png)
-
content/plugins/buzz_it/languages (copied) (copied from branches/1.0/content/plugins/buzz_it/languages)
-
content/plugins/buzz_it/languages/buzz_it_language.php (copied) (copied from branches/1.0/content/plugins/buzz_it/languages/buzz_it_language.php)
-
content/plugins/buzz_it/readme.txt (copied) (copied from branches/1.0/content/plugins/buzz_it/readme.txt)
-
content/plugins/categories/categories.php (modified) (2 diffs)
-
content/plugins/categories/readme.txt (modified) (1 diff)
-
content/plugins/comment_manager/comment_manager.php (modified) (1 diff)
-
content/plugins/comment_manager/comment_manager_settings.php (modified) (5 diffs)
-
content/plugins/comment_manager/readme.txt (modified) (1 diff)
-
content/plugins/comment_voting/comment_voting.php (modified) (1 diff)
-
content/plugins/comment_voting/comment_voting_functions.php (modified) (3 diffs)
-
content/plugins/comment_voting/readme.txt (modified) (1 diff)
-
content/plugins/comments/comments.php (modified) (6 diffs)
-
content/plugins/comments/comments_settings.php (modified) (5 diffs)
-
content/plugins/comments/css/comments.css (modified) (1 diff)
-
content/plugins/comments/javascript/comments.js (modified) (1 diff)
-
content/plugins/comments/languages/comments_language.php (modified) (2 diffs)
-
content/plugins/comments/readme.txt (modified) (2 diffs)
-
content/plugins/comments/templates/all_comments.php (modified) (3 diffs)
-
content/plugins/comments/templates/show_comments.php (modified) (5 diffs)
-
content/plugins/comments_widget/comments_widget.php (modified) (1 diff)
-
content/plugins/comments_widget/readme.txt (modified) (1 diff)
-
content/plugins/facebook_share (copied) (copied from branches/1.0/content/plugins/facebook_share)
-
content/plugins/facebook_share/css (copied) (copied from branches/1.0/content/plugins/facebook_share/css)
-
content/plugins/facebook_share/css/facebook_share.css (copied) (copied from branches/1.0/content/plugins/facebook_share/css/facebook_share.css)
-
content/plugins/facebook_share/facebook_share.php (copied) (copied from branches/1.0/content/plugins/facebook_share/facebook_share.php)
-
content/plugins/facebook_share/facebook_share_settings.php (copied) (copied from branches/1.0/content/plugins/facebook_share/facebook_share_settings.php)
-
content/plugins/facebook_share/languages (copied) (copied from branches/1.0/content/plugins/facebook_share/languages)
-
content/plugins/facebook_share/languages/facebook_share_language.php (copied) (copied from branches/1.0/content/plugins/facebook_share/languages/facebook_share_language.php)
-
content/plugins/facebook_share/readme.txt (copied) (copied from branches/1.0/content/plugins/facebook_share/readme.txt)
-
content/plugins/gravatar/gravatar.php (modified) (3 diffs)
-
content/plugins/gravatar/readme.txt (modified) (1 diff)
-
content/plugins/post_manager/post_manager.php (modified) (1 diff)
-
content/plugins/post_manager/post_manager_settings.php (modified) (3 diffs)
-
content/plugins/post_manager/readme.txt (modified) (1 diff)
-
content/plugins/recent_visitors/languages/recent_visitors_language.php (modified) (1 diff)
-
content/plugins/recent_visitors/readme.txt (modified) (1 diff)
-
content/plugins/recent_visitors/recent_visitors.php (modified) (6 diffs)
-
content/plugins/recent_visitors/recent_visitors_settings.php (modified) (4 diffs)
-
content/plugins/related_posts/readme.txt (modified) (1 diff)
-
content/plugins/related_posts/related_posts.php (modified) (3 diffs)
-
content/plugins/sb_base/languages/sb_base_language.php (modified) (1 diff)
-
content/plugins/sb_base/libs/SbBaseFunctions.php (modified) (3 diffs)
-
content/plugins/sb_base/readme.txt (modified) (1 diff)
-
content/plugins/sb_base/sb_base.php (modified) (3 diffs)
-
content/plugins/sb_base/templates/sb_list.php (modified) (3 diffs)
-
content/plugins/sb_base/templates/sb_post.php (modified) (2 diffs)
-
content/plugins/search/readme.txt (modified) (1 diff)
-
content/plugins/search/search.php (modified) (5 diffs)
-
content/plugins/submit/libs/SubmitFunctions.php (modified) (1 diff)
-
content/plugins/submit/readme.txt (modified) (1 diff)
-
content/plugins/submit/submit.php (modified) (3 diffs)
-
content/plugins/submit/templates/submit1.php (modified) (1 diff)
-
content/plugins/submit_light/readme.txt (modified) (1 diff)
-
content/plugins/submit_light/submit_light.php (modified) (2 diffs)
-
content/plugins/tags/css/tags.css (modified) (1 diff)
-
content/plugins/tags/languages/tags_language.php (modified) (1 diff)
-
content/plugins/tags/readme.txt (modified) (1 diff)
-
content/plugins/tags/tags.php (modified) (2 diffs)
-
content/plugins/text_widget/readme.txt (modified) (1 diff)
-
content/plugins/text_widget/text_widget.php (modified) (2 diffs)
-
content/plugins/user_manager/readme.txt (modified) (1 diff)
-
content/plugins/user_manager/user_manager.php (modified) (1 diff)
-
content/plugins/user_manager/user_manager_settings.php (modified) (7 diffs)
-
content/plugins/users/languages/users_language.php (modified) (1 diff)
-
content/plugins/users/readme.txt (modified) (1 diff)
-
content/plugins/users/users.php (modified) (2 diffs)
-
content/plugins/vote/css/vote.css (modified) (1 diff)
-
content/plugins/vote/javascript/vote.js (modified) (2 diffs)
-
content/plugins/vote/languages/vote_language.php (modified) (1 diff)
-
content/plugins/vote/readme.txt (modified) (1 diff)
-
content/plugins/vote/templates/vote_button.php (modified) (3 diffs)
-
content/plugins/vote/vote.php (modified) (3 diffs)
-
content/plugins/vote/vote_functions.php (modified) (5 diffs)
-
content/plugins/vote/vote_settings.php (modified) (5 diffs)
-
content/themes/hotaru-light/images/hotarucms.png (copied) (copied from branches/1.0/content/themes/hotaru-light/images/hotarucms.png)
-
content/themes/keep-it-simple/css/categories.css (copied) (copied from branches/1.0/content/themes/keep-it-simple/css/categories.css)
-
content/themes/keep-it-simple/css/related_posts.css (copied) (copied from branches/1.0/content/themes/keep-it-simple/css/related_posts.css)
-
content/themes/keep-it-simple/css/style.css (modified) (12 diffs)
-
content/themes/keep-it-simple/css/tags.css (copied) (copied from branches/1.0/content/themes/keep-it-simple/css/tags.css)
-
content/themes/keep-it-simple/footer.php (modified) (2 diffs)
-
content/themes/keep-it-simple/navigation.php (modified) (3 diffs)
-
content/themes/keep-it-simple/sb_sort_filter.php (modified) (1 diff)
-
content/themes/shibuya/css/style.css (modified) (2 diffs)
-
content/themes/shibuya/header.php (modified) (1 diff)
-
content/themes/shibuya/index.php (modified) (2 diffs)
-
content/themes/shibuya/settings.php (copied) (copied from branches/1.0/content/themes/shibuya/settings.php)
-
install/upgrade.php (modified) (1 diff)
-
javascript/hotaru.js (modified) (2 diffs)
-
libs/Avatar.php (modified) (5 diffs)
-
libs/Blocked.php (modified) (1 diff)
-
libs/Caching.php (modified) (1 diff)
-
libs/Category.php (modified) (1 diff)
-
libs/Comment.php (modified) (3 diffs)
-
libs/IncludeCssJs.php (modified) (2 diffs)
-
libs/Initialize.php (modified) (1 diff)
-
libs/Maintenance.php (modified) (1 diff)
-
libs/PageHandling.php (modified) (1 diff)
-
libs/Paginator.php (copied) (copied from branches/1.0/libs/Paginator.php)
-
libs/PluginManagement.php (modified) (4 diffs)
-
libs/ThemeSettings.php (modified) (1 diff)
-
libs/UserAuth.php (modified) (1 diff)
-
libs/extensions/Paginated (deleted)
-
libs/extensions/csrf/csrf_class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/1.0 merged: 1135-1189
- Property svn:mergeinfo changed
-
trunk/Hotaru.php
r1081 r1190 26 26 class Hotaru 27 27 { 28 protected $version = "1. 0.5"; // Hotaru CMS version28 protected $version = "1.1"; // Hotaru CMS version 29 29 protected $isDebug = false; // show db queries and page loading time 30 30 protected $isAdmin = false; // flag to tell if we are in Admin or not … … 357 357 358 358 /** 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 362 363 * @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); 370 387 } 371 388 … … 374 391 * Return page numbers bar 375 392 * 376 * @param object $pag eObject - current object of type Paginated393 * @param object $paginator - current object of type Paginator 377 394 * @return string - HTML for page number bar 378 395 */ 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); 383 399 } 384 400 … … 1064 1080 $version_js = $this->includes->combineIncludes($this, 'js'); 1065 1081 $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); 1067 1083 } 1068 1084 … … 1878 1894 1879 1895 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 1880 1910 /* ************************************************************* 1881 1911 * -
trunk/READ_ME.txt
r1081 r1190 1 1 HOTARU CMS 2 Version: 1. 0.53 Released: Feb 1st20102 Version: 1.1 3 Released: Feb 20th 2010 4 4 5 5 INSTALLATION -
trunk/content/admin_themes/admin_default/blocked_list.php
r1081 r1190 36 36 <?php echo $h->showMessage(); ?> 37 37 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'> 39 39 <h3><?php echo $h->lang["admin_theme_blocked_new"]; ?></h3> 40 40 <table> … … 50 50 </tr> 51 51 </table> 52 <input type='hidden' name='page' value='blocked_list' />53 52 <input type='hidden' name='type' value='new' /> 54 53 <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> … … 57 56 <table><tr><td> 58 57 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'> 60 59 <h3><?php echo $h->lang["admin_theme_blocked_search"]; ?></h3> 61 60 <table> … … 65 64 </tr> 66 65 </table> 67 <input type='hidden' name='page' value='blocked_list' />68 66 <input type='hidden' name='type' value='search' /> 69 67 <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> … … 72 70 </td><td> 73 71 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'> 75 73 <h3><?php echo $h->lang["admin_theme_blocked_filter"]; ?></h3> 76 74 <table> … … 86 84 </tr> 87 85 </table> 88 <input type='hidden' name='page' value='blocked_list' />89 86 <input type='hidden' name='type' value='filter' /> 90 87 <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' /> … … 107 104 <?php 108 105 if (isset($pagedResults)) { 109 $pagedResults->setLayout(new DoubleBarLayout()); 110 echo $pagedResults->fetchPagedNavigation($h); 106 echo $h->pageBar($pagedResults); 111 107 } 112 108 ?> -
trunk/content/admin_themes/admin_default/header.php
r1081 r1190 33 33 <html> 34 34 <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" /> 36 36 37 37 <title><?php echo $h->getTitle(); ?></title> -
trunk/content/main_language.php
r1081 r1190 76 76 /* Errors */ 77 77 $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."; 79 79 80 80 /* header */ -
trunk/content/plugins/activity/activity.php
r1127 r1190 3 3 * name: Activity 4 4 * description: Show recent activity 5 * version: 0. 45 * version: 0.5 6 6 * folder: activity 7 7 * class: Activity … … 292 292 293 293 /** 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 /** 294 335 * Get sidebar activity items 295 336 * … … 539 580 $activity_settings = $h->getSerializedSettings('activity'); 540 581 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); 543 585 544 586 // 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'); 547 588 548 589 $h->displayTemplate('activity'); … … 563 604 $activity_settings = $h->getSerializedSettings('activity'); 564 605 565 // gets however many are items shown per page on activity pages:566 $act ivity = $this->getLatestActivity($h, 0, $userid); // 0 means no limit, ALL activity567 568 // pagination569 $pg = $h->cage->get->testInt('pg');570 $h->vars['pagedResults'] = $h->pagination($act ivity, $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'); 571 612 572 613 $h->displayTemplate('activity_profile'); -
trunk/content/plugins/activity/readme.txt
r1081 r1190 16 16 Changelog 17 17 --------- 18 v.0.5 2010/02/18 - Nick - Code changes for pagination 18 19 v.0.4 2010/01/24 - Nick - HTML for user profiles and Activity page moved into templates 19 20 v.0.3 2010/01/15 - Nick - Fixes for deleting items and refreshing the cache -
trunk/content/plugins/activity/templates/activity.php
r1127 r1190 36 36 <?php 37 37 $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) { 40 40 if (!$act->postSafe($h, $action)) { continue; } // skip if postis buried or pending 41 41 $user_id = $action->useract_userid; -
trunk/content/plugins/activity/templates/activity_profile.php
r1127 r1190 35 35 <?php 36 36 $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) { 39 39 if (!$act->postSafe($h, $action)) { continue; } // skip if postis buried or pending 40 40 $user_id = $action->useract_userid; -
trunk/content/plugins/admin_email/admin_email.php
r1081 r1190 152 152 // reload the page, without any html... 153 153 $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 . "' />"; 155 155 echo $h->lang["admin_email_redirecting"]; 156 156 ob_flush(); -
trunk/content/plugins/categories/categories.php
r1108 r1190 3 3 * name: Categories 4 4 * description: Enables categories for posts 5 * version: 1. 25 * version: 1.3 6 6 * folder: categories 7 7 * class: Categories 8 8 * type: categories 9 9 * 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 11 11 * author: Nick Ramsay 12 12 * authorurl: http://hotarucms.org/member.php?1-Nick … … 146 146 147 147 /** 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 /** 148 174 * Read category settings 149 175 */ -
trunk/content/plugins/categories/readme.txt
r1081 r1190 13 13 Changelog 14 14 --------- 15 v.1.3 2010/02/20 - Nick - Meta description and keywords taken from Category Manager 15 16 v.1.2 2009/12/28 - Nick - Updated for compatibility with Hotaru 1.0 16 17 v.1.1 2009/11/30 - Nick - Categories before post title in breadcrumbs, -
trunk/content/plugins/comment_manager/comment_manager.php
r1081 r1190 3 3 * name: Comment Manager 4 4 * description: Manage comments. 5 * version: 0. 45 * version: 0.5 6 6 * folder: comment_manager 7 7 * class: CommentManager -
trunk/content/plugins/comment_manager/comment_manager_settings.php
r1127 r1190 95 95 96 96 // 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)); 98 98 99 99 $h->comment->deleteComment($h); // delete this comment … … 191 191 $where_clause = "WHERE MATCH (comment_content) AGAINST (%s IN BOOLEAN MODE) "; 192 192 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 193 197 $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 } 199 200 } 200 201 … … 209 210 $where_clause = " WHERE comment_status = %s"; 210 211 $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')); 211 214 $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'); 213 216 break; 214 217 case 'buried': 215 218 $where_clause = " WHERE comment_status = %s"; 216 219 $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')); 217 222 $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'); 219 224 break; 220 225 case 'approved': 221 226 $where_clause = " WHERE comment_status = %s"; 222 227 $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')); 223 230 $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'); 225 232 break; 226 233 case 'oldest': 227 234 $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)); 228 237 $sql = "SELECT * FROM " . TABLE_COMMENTS . $sort_clause; 229 $ filtered_results = $h->db->get_results($h->db->prepare($sql));238 $query = $h->db->prepare($sql); 230 239 break; 231 240 case 'all': … … 233 242 default: 234 243 $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)); 235 246 $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)) { 244 253 // default list 245 254 if ($h->vars['comment_status_filter'] == 'pending') { 246 255 $where_clause = " WHERE comment_status = %s"; 247 256 $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')); 248 259 $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'); 250 261 } else { 251 262 $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)); 252 265 $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); 259 274 } elseif ($h->vars['comment_status_filter'] == 'pending') { 260 275 $h->message = $h->lang['com_man_no_pending_comments']; … … 267 282 268 283 269 public function drawRows($h, $ comments, $filter = '', $search_term = '')284 public function drawRows($h, $pagedResults, $filter = '', $search_term = '') 270 285 { 271 // prepare for showing comments, 20 per page272 $pg = $h->cage->get->getInt('pg');273 $items = 20;274 275 $pagedResults = $h->pagination($comments, $items, $pg);276 277 286 $output = ""; 278 287 $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 { 280 294 $alt++; 281 295 -
trunk/content/plugins/comment_manager/readme.txt
r1081 r1190 14 14 Changelog 15 15 --------- 16 v.0.5 2010/02/20 - Nick - Fix for deleting comments and code changes for pagination 16 17 v.0.4 2010/02/02 - Nick - User links added for easier spam management 17 18 v.0.3 2010/01/03 - Nick - Updated for compatibility with Hotaru 1.0 -
trunk/content/plugins/comment_voting/comment_voting.php
r1081 r1190 3 3 * name: Comment Voting 4 4 * description: Adds voting ability to posted stories. 5 * version: 0. 15 * version: 0.2 6 6 * folder: comment_voting 7 7 * class: CommentVoting -
trunk/content/plugins/comment_voting/comment_voting_functions.php
r1081 r1190 42 42 43 43 //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 } 45 48 46 49 // Only proceed if the user is logged in … … 59 62 return false; 60 63 } 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)); 61 68 62 69 if ($cvote_rating > 0) 63 70 { 64 65 71 // Update comments table 66 72 $sql = "UPDATE " . TABLE_COMMENTS . " SET comment_votes_up = comment_votes_up + 1 WHERE comment_id = %d"; … … 77 83 if ($cvote_rating && ($cvote_rating < 0)) 78 84 { 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 } 82 94 83 95 // Update commentvotes table -
trunk/content/plugins/comment_voting/readme.txt
r1081 r1190 15 15 Changelog 16 16 --------- 17 v.0.2 2010/02/09 - Nick - Added options to hide and bury comments 17 18 v.0.1 2010/01/24 - Nick - Released first version -
trunk/content/plugins/comments/comments.php
r1127 r1190 3 3 * name: Comments 4 4 * description: Enables logged-in users to comment on posts 5 * version: 1. 35 * version: 1.4 6 6 * folder: comments 7 7 * class: Comments … … 106 106 if (!isset($comments_settings['comment_daily_limit'])) { $comments_settings['comment_daily_limit'] = 0; } 107 107 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"; } 108 110 109 111 if ($h->isActive('avatar')) { … … 138 140 $h->comment->setPending = $comments_settings['comment_set_pending']; 139 141 $h->comment->allForms = $comments_settings['comment_all_forms']; 142 $h->vars['comment_hide'] = $comments_settings['comment_hide']; 140 143 141 144 … … 373 376 if ($h->comment->pagination) 374 377 { 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) { 379 381 // cycle through the parents, and go get their children 380 while($parent = $pagedResults->fetchPagedRow()) {382 foreach($pagedResults->items as $parent) { 381 383 382 384 $this->displayComment($h, $parent); … … 528 530 } 529 531 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) { 532 544 $h->showMessage($h->lang['comments_user_no_comments'], 'red'); 533 545 return true; 534 546 } 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) { 544 552 $h->readPost($comment->comment_post_id); 545 553 // don't show this comment if its post is buried or pending: … … 629 637 $comments = 'open'; 630 638 } 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 } 634 645 } 635 646 } else { -
trunk/content/plugins/comments/comments_settings.php
r1081 r1190 62 62 $url_limit = $comments_settings['comment_url_limit']; 63 63 $daily_limit = $comments_settings['comment_daily_limit']; 64 $hide = $comments_settings['comment_hide']; 65 $bury = $comments_settings['comment_bury']; 64 66 65 67 echo "<h1>" . $h->lang["comments_settings_header"] . "</h1>\n"; … … 80 82 if (!$daily_limit) { $daily_limit = 0; } 81 83 if (!$x_comments) { $x_comments = 1; } 84 if (!$hide) { $hide = 3; } 85 if (!$bury) { $bury = 10; } 82 86 83 87 // Determine if checkboxes are checked or not … … 101 105 echo "<p><input type='checkbox' name='comment_avatars' value='comment_avatars' " . $check_avatars . " > " . $h->lang["comments_settings_avatars"] . "</p>\n"; 102 106 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 . " > " . $h->lang["comments_settings_votes"] . "</p>\n"; 107 echo "<p><input type='checkbox' name='comment_voting' value='comment_voting' " . $check_votes . " > " . $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>"; 104 110 105 111 echo "<p>" . " <input type='text' size=5 name='levels' value='" . $h->comment->levels . "' /> " . $h->lang["comments_settings_levels"] . "</p>"; … … 248 254 } 249 255 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 250 264 // levels 251 265 if ($h->cage->post->keyExists('levels')) { … … 361 375 $comments_settings['comment_email_notify'] = $email_notify; 362 376 $comments_settings['comment_email_notify_mods'] = $email_mods; //array 377 $comments_settings['comment_hide'] = $hide; 378 $comments_settings['comment_bury'] = $bury; 363 379 364 380 $h->updateSetting('comments_settings', serialize($comments_settings)); -
trunk/content/plugins/comments/css/comments.css
r1123 r1190 90 90 .comment_post_link {margin: 0.6em 0.6em 0.4em; text-align:right;} 91 91 92 .comment_show_hide { margin-left: 2.0em; font-size: 0.8em; } 93 92 94 .clear { clear: both; margin: 0; line-height: 0em;} /* need line-height for IE */ -
trunk/content/plugins/comments/javascript/comments.js
r1081 r1190 50 50 }); 51 51 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 52 64 }); 53 65 -
trunk/content/plugins/comments/languages/comments_language.php
r1108 r1190 39 39 $lang['comments_reply_link'] = "Reply"; 40 40 $lang['comments_edit_link'] = "Edit"; 41 $lang['comments_show_hide'] = "Show / Hide"; 41 42 42 43 /* Comment Form */ … … 66 67 $lang["comments_settings_avatar_size"] = "Avatar size in pixels <small>(default: 16)</small>"; 67 68 $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>"; 68 71 $lang["comments_settings_levels"] = "Comment nesting levels <small>(default: 5)</small>"; 69 72 $lang["comments_settings_pagination"] = "Pagination (spread comments over pages)"; -
trunk/content/plugins/comments/readme.txt
r1081 r1190 5 5 Description 6 6 ----------- 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.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. 8 8 9 9 Instructions … … 15 15 Changelog 16 16 --------- 17 v.1.4 2009/02/09 - Nick - Option to hide comments after X down votes, plus pagination code changes 17 18 v.1.3 2009/01/17 - Nick - Added option for avatar size 18 19 v.1.2 2009/12/30 - Nick - Updates for compatibility with Hotaru 1.0 -
trunk/content/plugins/comments/templates/all_comments.php
r1081 r1190 25 25 */ 26 26 27 $display = ($h->comment->votes_down >= $h->vars['comment_hide']) ? 'display: none;' : ''; // comments are shown unless they have X negative votes 27 28 ?> 28 29 <a id="c<?php echo $h->comment->id; ?>"></a> … … 47 48 echo time_difference(unixtimestamp($h->comment->date), $h->lang) . " "; 48 49 echo $h->lang['comments_time_ago'] . "."; 50 if ($display) { echo "<a href='#' class='comment_show_hide'>" . $h->lang['comments_show_hide'] . "</a>"; } 49 51 ?> 50 52 </div> … … 60 62 <div class="clear"></div> 61 63 62 <div class="comment_main" >64 <div class="comment_main" style="<?php echo $display; ?>"> 63 65 <div class="comment_content"> 64 66 <?php -
trunk/content/plugins/comments/templates/show_comments.php
r1081 r1190 24 24 * @link http://www.hotarucms.org/ 25 25 */ 26 27 26 27 $display = ($h->comment->votes_down >= $h->vars['comment_hide']) ? 'display: none;' : ''; // comments are shown unless they have X negative votes 28 28 ?> 29 29 <a id="c<?php echo $h->comment->id; ?>"></a> … … 31 31 <?php if ($h->comment->avatarSize < 16) {$comment_header_size=16;} else { $comment_header_size= $h->comment->avatarSize; } ?> 32 32 <div class="comment" style="margin-left: <?php echo $h->comment->depth * 2.0; ?>em;"> 33 33 34 <div class="comment_header" style="height:<?php echo $comment_header_size; ?>px;"> 34 35 <div class="comment_header_left"> … … 48 49 echo time_difference(unixtimestamp($h->comment->date), $h->lang) . " "; 49 50 echo $h->lang['comments_time_ago'] . "."; 51 if ($display) { echo "<a href='#' class='comment_show_hide'>" . $h->lang['comments_show_hide'] . "</a>"; } 50 52 ?> 51 53 </div> … … 61 63 <div class="clear"></div> 62 64 63 <div class="comment_main" >65 <div class="comment_main" style="<?php echo $display; ?>"> 64 66 <div class="comment_content"> 65 67 <?php … … 87 89 <?php } ?> 88 90 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 } ?> 98 102 <?php } ?> 99 103 </div> -
trunk/content/plugins/comments_widget/comments_widget.php
r1127 r1190 103 103 public function getCommentsWidget($h, $limit) 104 104 { 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')); 107 107 108 108 if ($comments) { return $comments; } else { return false; } -
trunk/content/plugins/comments_widget/readme.txt
r1081 r1190 15 15 Changelog 16 16 --------- 17 v.0.2 2010/02/19 - Nick - Restricted SQL query to non-archived comments 17 18 v.0.1 2010/01/03 - Nick - Released first version -
trunk/content/plugins/gravatar/gravatar.php
r1081 r1190 3 3 * name: Gravatar 4 4 * description: Enables Gravatar avatars for users 5 * version: 0. 75 * version: 0.8 6 6 * folder: gravatar 7 7 * class: Gravatar 8 8 * type: avatar 9 9 * 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 11 11 * author: Nick Ramsay 12 12 * authorurl: http://hotarucms.org/member.php?1-Nick … … 68 68 * @return return the avatar 69 69 */ 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 */ 70 86 public function avatar_get_avatar($h) 71 87 { 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; 73 91 } 74 92 … … 82 100 * @return string - html for image 83 101 */ 84 public function buildGravatar Image($email = '', $size = 32, $rating = 'g')102 public function buildGravatarUrl($email = '', $size = 32, $rating = 'g', $default = '') 85 103 { 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 } 91 113 } 92 114 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 "&default=".urlencode($default_image). 115 $grav_url = "http://www.gravatar.com/avatar/".md5( strtolower($email) ). 116 "?d=". $default . 97 117 "&size=" . $size . 98 118 "&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 100 138 $img_url = "<img class='avatar' src='" . $grav_url . "' " . $resized ." alt='' />"; 101 102 139 return $img_url; 103 140 } -
trunk/content/plugins/gravatar/readme.txt
r1081 r1190 14 14 Changelog 15 15 --------- 16 v.0.8 2010/02/10 - Nick - Added ability to test if a user has a Gravatar 16 17 v.0.7 2009/12/26 - Nick - Updates for compatibility with Hotaru 1.0 17 18 v.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 3 3 * name: Post Manager 4 4 * description: Manage posts. 5 * version: 0. 55 * version: 0.6 6 6 * folder: post_manager 7 7 * class: PostManager -
trunk/content/plugins/post_manager/post_manager_settings.php
r1127 r1190 114 114 require_once(PLUGINS . 'sb_base/libs/SbBaseFunctions.php'); 115 115 $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'); 117 119 $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 } 119 131 } 120 132 } else { … … 133 145 case 'all': 134 146 $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)); 135 149 $sql = "SELECT * FROM " . TABLE_POSTS . $sort_clause; 136 $ filtered_results = $h->db->get_results($h->db->prepare($sql));150 $query = $h->db->prepare($sql); 137 151 break; 138 152 case 'not_buried': 139 153 $where_clause = " WHERE post_status != %s"; 140 154 $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')); 141 157 $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'); 143 159 break; 144 160 case 'newest': 145 161 $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)); 146 164 $sql = "SELECT * FROM " . TABLE_POSTS . $sort_clause; 147 $ filtered_results = $h->db->get_results($h->db->prepare($sql));165 $query = $h->db->prepare($sql); 148 166 break; 149 167 case 'oldest': 150 168 $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)); 151 171 $sql = "SELECT * FROM " . TABLE_POSTS . $sort_clause; 152 $ filtered_results = $h->db->get_results($h->db->prepare($sql));172 $query = $h->db->prepare($sql); 153 173 break; 154 174 default: 155 175 $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)); 156 178 $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)) { 165 185 // default list 166 186 if ($h->vars['post_status_filter'] == 'pending') { 167 187 $where_clause = " WHERE post_status = %s"; 168 188 $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')); 169 191 $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'); 171 193 } else { 172 194 $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)); 173 197 $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); 180 206 } elseif ($h->vars['post_status_filter'] == 'pending') { 181 207 $h->message = $h->lang['post_man_no_pending_posts']; … … 188 214 189 215 190 public function drawRows($h, $p, $p osts, $filter = '', $search_term = '')216 public function drawRows($h, $p, $pagedResults, $filter = '', $search_term = '') 191 217 { 192 // prepare for showing posts, 20 per page193 $pg = $h->cage->get->getInt('pg');194 $items = 20;195 196 $pagedResults = $h->pagination($posts, $items, $pg);197 198 218 $output = ""; 199 219 $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 { 201 226 $alt++; 202 227 -
trunk/content/plugins/post_manager/readme.txt
r1081 r1190 14 14 Changelog 15 15 --------- 16 v.0.6 2010/02/18 - Nick - Code changes for pagination 16 17 v.0.5 2010/02/02 - Nick - User links added for easier spam management 17 18 v.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 36 36 $lang["recent_visitors_settings_avatars"] = "Show user avatars <small>(Requires an avatar plugin)</small>"; 37 37 $lang["recent_visitors_settings_avatar_size"] = "Size (pixels):"; 38 $lang["recent_visitors_settings_avatar_filter"] = "Filter out users who don't have an avatar"; 38 39 $lang["recent_visitors_settings_names"] = "Show user names"; 39 40 $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 17 17 Changelog 18 18 --------- 19 v.0.4 2010/02/10 - Nick - Added ability to filter out users who don't have an avatar 19 20 v.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 20 21 v.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 3 3 * name: Recent Visitors 4 4 * description: Show recent visitors in a widget 5 * version: 0. 35 * version: 0.4 6 6 * folder: recent_visitors 7 7 * class: RecentVisitors … … 50 50 if (!isset($recent_visitors_settings['visitors_avatars'])) { $recent_visitors_settings['visitors_avatars'] = ''; } 51 51 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'] = ''; } 52 53 if (!isset($recent_visitors_settings['visitors_names'])) { $recent_visitors_settings['visitors_names'] = 'checked'; } 53 54 if (!isset($recent_visitors_settings['visitors_widget_title'])) { $recent_visitors_settings['visitors_widget_title'] = 'checked'; } … … 82 83 $avatars = $recent_visitors_settings['visitors_avatars']; 83 84 $avatar_size = $recent_visitors_settings['visitors_avatar_size']; 85 $avatar_filter = $recent_visitors_settings['visitors_avatar_filter']; 84 86 $names = $recent_visitors_settings['visitors_names']; 85 87 $show_title = $recent_visitors_settings['visitors_widget_title']; … … 111 113 foreach ($visitors as $visitor) 112 114 { 113 if ($list) { 114 $output .="<li class='recent_visitors_item'>"; 115 } 115 $has_avatar = false; 116 116 117 117 if ($avatars) { … … 120 120 $avatar->user_name = $visitor->user_username; 121 121 $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 } 123 138 } 124 139 … … 138 153 139 154 if ($need_cache) { 140 $h->smartCache('html', 'users', 10, $output, $label); // make or rewrite the cache file155 $h->smartCache('html', 'users', 60, $output, $label); // make or rewrite the cache file 141 156 } 142 157 -
trunk/content/plugins/recent_visitors/recent_visitors_settings.php
r1123 r1190 47 47 $avatars = $recent_visitors_settings['visitors_avatars']; 48 48 $avatar_size = $recent_visitors_settings['visitors_avatar_size']; 49 $avatar_filter = $recent_visitors_settings['visitors_avatar_filter']; 49 50 $names = $recent_visitors_settings['visitors_names']; 50 51 $show_title = $recent_visitors_settings['visitors_widget_title']; … … 65 66 echo $h->lang["recent_visitors_settings_avatar_size"]; 66 67 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 . "> "; 70 echo $h->lang["recent_visitors_settings_avatar_filter"] . "</p>\n"; 67 71 68 72 echo "<p><input type='checkbox' name='names' value='names' " . $names . "> "; … … 132 136 133 137 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 134 146 // show names: 135 147 if ($h->cage->post->keyExists('names')) { … … 149 161 $recent_visitors_settings['visitors_avatars'] = $avatars; 150 162 $recent_visitors_settings['visitors_avatar_size'] = $avatar_size; 163 $recent_visitors_settings['visitors_avatar_filter'] = $avatar_filter; 151 164 $recent_visitors_settings['visitors_names'] = $names; 152 165 $h->updateSetting('recent_visitors_settings', serialize($recent_visitors_settings)); -
trunk/content/plugins/related_posts/readme.txt
r1081 r1190 15 15 Changelog 16 16 --------- 17 v.0.3 2010/02/20 - Nick - Fix for SQL warning when no tags present 17 18 v.0.2 2009/12/31 - Nick - Compatibility with Hotaru 1.0 18 19 v.0.1 2009/11/23 - Nick - Released first version -
trunk/content/plugins/related_posts/related_posts.php
r1081 r1190 3 3 * name: Related Posts 4 4 * description: Show a list of related posts 5 * version: 0. 25 * version: 0.3 6 6 * folder: related_posts 7 7 * class: relatedPosts … … 154 154 which we need later to show comments and whatnot. */ 155 155 $original_id = $h->post->id; 156 157 /* strip all words less than 4 chars from the title158 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 name169 /*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 }*/176 156 177 157 // make the tags a space separated string 178 158 $tags = str_replace(', ', ' ', $h->post->tags); 179 159 $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; } 183 164 184 165 $search_terms = $tags; … … 199 180 public function showRelatedPosts($h, $search_terms = '', $num_posts = 10) 200 181 { 182 $output = ''; 183 201 184 $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 = ' '; } 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 = ' '; } 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"; 223 207 } 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"; 231 209 232 210 return $output; 233 211 } 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 234 232 235 233 /** -
trunk/content/plugins/sb_base/languages/sb_base_language.php
r1081 r1190 64 64 /* Maintenance page */ 65 65 $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 S ubmitSettings)</small>";66 $lang["sb_base_maintenance_update_archive_remove"] = "Move any archived posts out of the archive. <small>(See SB Base Settings)</small>"; 67 67 $lang["sb_base_maintenance_update_archive_desc_1"] = "Posts older than "; 68 68 $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 34 34 * 35 35 * @param string $type e.g. latest, upcoming, top-24-hours 36 * @param string $return - 'posts', 'count' or 'query' 36 37 * @return array 37 38 */ 38 public function prepareList($h, $type = '' )39 public function prepareList($h, $type = '', $return = 'posts') 39 40 { 40 41 if (!isset($h->vars['filter'])) { $h->vars['filter'] = array(); } … … 65 66 } 66 67 67 $h->pluginHook('sb_base_functions_preparelist' ); // formerly post_list_filter68 $h->pluginHook('sb_base_functions_preparelist', '', array('return' => $return)); // formerly post_list_filter 68 69 } 69 70 … … 80 81 } 81 82 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 82 88 $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 } 86 103 } 87 104 -
trunk/content/plugins/sb_base/readme.txt
r1081 r1190 14 14 Changelog 15 15 --------- 16 v.0.2 2010/02/18 - Nick - Code changes for pagination 16 17 v.0.1 2009/12/16 - Nick - Released first version -
trunk/content/plugins/sb_base/sb_base.php
r1108 r1190 3 3 * name: SB Base 4 4 * description: Social Bookmarking base - provides "list" and "post" templates. 5 * version: 0. 15 * version: 0.2 6 6 * folder: sb_base 7 7 * class: SbBase … … 129 129 { 130 130 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 132 133 break; 133 134 case 'post': … … 194 195 $meta_content = sanitize($h->post->content, 'all'); 195 196 $meta_content = truncate($meta_content, 200); 196 echo '<meta name="description" content="' . $meta_content . '" >' . "\n";197 echo '<meta name="description" content="' . $meta_content . '" />' . "\n"; 197 198 return true; 198 199 } -
trunk/content/plugins/sb_base/templates/sb_list.php
r1081 r1190 27 27 ?> 28 28 <?php 29 30 if ($h->vars['posts']) { 31 $pg = $h->cage->get->getInt('pg'); 29 if ($h->vars['post_count']) { 32 30 33 $pagedResults = $h->pagination($h->vars['post s'], $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) { 35 33 $h->readPost(0, $post); 36 34 $user = new UserBase(); … … 41 39 <?php $h->pluginHook('sb_base_pre_show_post'); ?> 42 40 43 <div class="show_post vote_button_space" >41 <div class="show_post vote_button_space" id="show_post_<?php echo $h->post->id ?>" > 44 42 45 43 <?php $h->pluginHook('sb_base_show_post_pre_title'); ?> … … 54 52 <div class="show_post_title"> 55 53 <?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> 57 55 <?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> 59 57 <?php } ?> 60 58 <?php $h->pluginHook('sb_base_show_post_title'); ?> -
trunk/content/plugins/sb_base/templates/sb_post.php
r1081 r1190 33 33 34 34 <!-- 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 ?>" > 36 36 37 37 <?php $h->pluginHook('sb_base_show_post_pre_title'); ?> … … 46 46 <div class="show_post_title"> 47 47 <?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> 49 49 <?php } else { ?> 50 50 <?php echo $h->post->title; ?> -
trunk/content/plugins/search/readme.txt
r1081 r1190 21 21 Changelog 22 22 --------- 23 v.0.9 2010/02/18 - Nick - Code changes for pagination 23 24 v.0.8 2009/12/31 - Nick - Updates for compatibility with Hotaru 1.0 24 25 v.0.7 2009/11/04 - Nick - Updates for compatibility with Hotaru 0.8 -
trunk/content/plugins/search/search.php
r1108 r1190 3 3 * name: Search 4 4 * description: Displays "Search!" 5 * version: 0. 85 * version: 0.9 6 6 * folder: search 7 7 * class: Search … … 91 91 * Use the search terms to build a filter 92 92 */ 93 public function sb_base_functions_preparelist($h )93 public function sb_base_functions_preparelist($h, $vars) 94 94 { 95 95 if ($h->cage->get->keyExists('search')) 96 96 { 97 $return = $vars['return']; // are we getting the count or the result set? 97 98 $orig_search_terms = stripslashes($h->cage->get->sanitizeTags('search')); 98 99 $search_terms = $orig_search_terms; … … 101 102 { 102 103 // fetch select, orderby and filter... 103 $prepared_search = $this->prepareSearchFilter($h, $search_terms );104 $prepared_search = $this->prepareSearchFilter($h, $search_terms, $return); 104 105 extract($prepared_search); 105 106 … … 118 119 * Prepare search filter 119 120 */ 120 public function prepareSearchFilter($h, $search )121 public function prepareSearchFilter($h, $search, $return = 'posts') 121 122 { 122 123 $search_terms = strtolower($search); … … 146 147 147 148 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"; 150 152 $h->vars['filter']["MATCH (post_title, post_domain, post_url, post_content, post_tags) AGAINST (%s IN BOOLEAN MODE)"] = $search_terms_clean; 151 153 } else { 152 $h->vars['select'] = "*"; 154 if ($return == 'count') { $select = "count(*) AS number "; } else { $select = "*"; } 155 $h->vars['select'] = $select; 153 156 $h->vars['orderby'] = "post_date DESC"; 154 157 $h->vars['filter_vars'] = array(); -
trunk/content/plugins/submit/libs/SubmitFunctions.php
r1129 r1190 347 347 } 348 348 349 // check CSRF350 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 fix354 if (!$h->csrf('check', $page)) {355 $h->message = $h->lang['error_csrf'];356 $h->messageType = 'red';357 return true; //error found358 }359 }360 361 349 // check user has permission to post 362 350 if ($h->currentUser->getPermission('can_submit') == 'no') { -
trunk/content/plugins/submit/readme.txt
r1081 r1190 13 13 Changelog 14 14 --------- 15 v.2.1 2009/02/15 - Nick - Removed CSRF check from submission step 1 16 v.2.0 2009/02/11 - Nick - Bug fixes for character problems and stripped HTML 15 17 v.1.9 2009/12/16 - Nick - Updated for compatibility with Hotaru 1.0 16 18 v.1.8 2009/11/29 - Nick - Added plugin hooks in post descriptions -
trunk/content/plugins/submit/submit.php
r1108 r1190 3 3 * name: Submit 4 4 * description: Social Bookmarking submit - Enables post submission 5 * version: 1.95 * version: 2.1 6 6 * folder: submit 7 7 * class: Submit … … 525 525 $h->vars['submit_orig_url'] = urldecode($h->vars['submitted_data']['submit_orig_url']); 526 526 $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); 528 528 $h->vars['submit_post_id'] = $h->vars['submitted_data']['submit_id']; 529 529 $h->vars['submit_category'] = $h->vars['submitted_data']['submit_category']; … … 593 593 594 594 // 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']; 596 596 $h->vars['submit_content'] = html_entity_decode($h->vars['submit_content']); 597 597 $h->vars['submit_tags'] = html_entity_decode($h->vars['submit_tags']); -
trunk/content/plugins/submit/templates/submit1.php
r1117 r1190 43 43 <input type='hidden' name='submit1' value='true' /> 44 44 <input type='hidden' name='page' value='<?php echo $h->pageName; ?>' /> 45 <input type='hidden' name='csrf' value='<?php echo $h->csrfToken; ?>' />46 45 <br /> 47 46 <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 15 15 Changelog 16 16 --------- 17 v.0.2 2009/02/11 - Nick - Bug fix for missing moderation language item 17 18 v.0.1 2010/01/10 - Nick - Released first version -
trunk/content/plugins/submit_light/submit_light.php
r1108 r1190 3 3 * name: Submit Light 4 4 * description: Reduces Submit to two steps 5 * version: 0. 15 * version: 0.2 6 6 * folder: submit_light 7 7 * class: SubmitLight … … 173 173 // Submitted posts given 'pending' for this user 174 174 $h->changePostStatus('pending'); 175 $h->messages[$h->lang['submit_ form_moderation']] = 'green';175 $h->messages[$h->lang['submit_moderation']] = 'green'; 176 176 $return = 1; // will return false just after we notify admins of the post (see about 10 lines down) 177 177 } -
trunk/content/plugins/tags/css/tags.css
r1085 r1190 2 2 * TAGS PLUGIN CSS * 3 3 ************************************** */ 4 4 5 5 .tags_link { padding-left: 1.5em; background-image: url(content/themes/default/images/tags.png); } 6 6 .show_tags ul li {float:left; margin-right:0.6em;} -
trunk/content/plugins/tags/languages/tags_language.php
r1081 r1190 27 27 $lang['tags'] = 'Tags'; 28 28 $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. 29 32 ?> -
trunk/content/plugins/tags/readme.txt
r1081 r1190 13 13 Changelog 14 14 --------- 15 v.1.5 2010/02/20 - Nick - Meta description and keywords added for browsing tag pages 15 16 v.1.4 2009/12/28 - Nick - Updated for compatibility with Hotaru 1.0 16 17 v.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 3 3 * name: Tags 4 4 * description: Show tags, filter tags and RSS for tags 5 * version: 1. 45 * version: 1.5 6 6 * folder: tags 7 7 * class: Tags … … 53 53 /** 54 54 * Match meta tag to a post's keywords (description is done in the Submit plugin) 55 * Also changes meta when browsing a tag page 55 56 */ 56 57 public function header_meta($h) 57 58 { 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"; 60 62 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 } 61 73 } 62 74 } -
trunk/content/plugins/text_widget/readme.txt
r1081 r1190 15 15 Changelog 16 16 --------- 17 v.0.5 2010/02/15 - Nick - Minor widget ids fix for W3C compatibility 17 18 v.0.4 2010/01/04 - Nick - Updates for compatibility with Hotaru 1.0 18 19 v.0.3 2009/11/04 - Nick - Updated install function for easier upgrading -
trunk/content/plugins/text_widget/text_widget.php
r1120 r1190 3 3 * name: Text Widget 4 4 * description: Paste text or code into a blank widget 5 * version: 0. 45 * version: 0.5 6 6 * folder: text_widget 7 7 * class: TextWidget … … 88 88 89 89 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"; 91 91 } 92 92 93 93 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"; 95 95 } 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"; 97 97 } 98 98 -
trunk/content/plugins/user_manager/readme.txt
r1081 r1190 15 15 Changelog 16 16 --------- 17 v.0.8 2010/02/18 - Nick - Fixes for changing user permissions and pagination 17 18 v.0.7 2010/02/02 - Nick - Improvements for spam management 18 19 v.0.6 2010/01/15 - Nick - Added user permissions and settings editors -
trunk/content/plugins/user_manager/user_manager.php
r1081 r1190 3 3 * name: User Manager 4 4 * description: Manage users. 5 * version: 0. 75 * version: 0.8 6 6 * folder: user_manager 7 7 * class: UserManager -
trunk/content/plugins/user_manager/user_manager_settings.php
r1108 r1190 84 84 $u->role = $new_role; 85 85 $new_perms = $u->getDefaultPermissions($h, $new_role); 86 $u->setAllPermissions($ h, $new_perms);86 $u->setAllPermissions($new_perms); 87 87 $u->updatePermissions($h); 88 88 $u->updateUserBasic($h, $id); … … 116 116 $where_clause = " WHERE user_username LIKE %s OR user_email LIKE %s"; 117 117 $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)); 118 121 $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 } 124 124 } 125 125 … … 133 133 case 'all': 134 134 $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)); 135 137 $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 136 $ filtered_results = $h->db->get_results($h->db->prepare($sql));138 $query = $h->db->prepare($sql); 137 139 break; 138 140 case 'not_killspammed': 139 141 $where_clause = " WHERE user_role != %s"; 140 142 $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'); 143 147 break; 144 148 case 'admin': 145 149 $where_clause = " WHERE user_role = %s"; 146 150 $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'); 149 155 break; 150 156 case 'supermod': 151 157 $where_clause = " WHERE user_role = %s"; 152 158 $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'); 155 163 break; 156 164 case 'moderator': 157 165 $where_clause = " WHERE user_role = %s"; 158 166 $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'); 161 171 break; 162 172 case 'member': 163 173 $where_clause = " WHERE user_role = %s"; 164 174 $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'); 167 179 break; 168 180 case 'pending': 169 181 $where_clause = " WHERE user_role = %s"; 170 182 $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'); 173 187 break; 174 188 case 'undermod': 175 189 $where_clause = " WHERE user_role = %s"; 176 190 $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'); 179 195 break; 180 196 case 'suspended': 181 197 $where_clause = " WHERE user_role = %s"; 182 198 $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'); 185 203 break; 186 204 case 'banned': 187 205 $where_clause = " WHERE user_role = %s"; 188 206 $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'); 191 211 break; 192 212 case 'killspammed': 193 213 $where_clause = " WHERE user_role = %s"; 194 214 $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'); 197 219 break; 198 220 case 'newest': 199 221 $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)); 200 224 $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 201 $ filtered_results = $h->db->get_results($h->db->prepare($sql));225 $query = $h->db->prepare($sql); 202 226 break; 203 227 case 'oldest': 204 228 $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)); 205 231 $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 206 $ filtered_results = $h->db->get_results($h->db->prepare($sql));232 $query = $h->db->prepare($sql); 207 233 break; 208 234 case 'last_visited': 209 235 $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)); 210 238 $sql = "SELECT * FROM " . TABLE_USERS . $sort_clause; 211 $ filtered_results = $h->db->get_results($h->db->prepare($sql));239 $query = $h->db->prepare($sql); 212 240 break; 213 241 default: 214 242 $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 status217 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)) { 224 252 // default list 225 253 … … 228 256 $where_clause = " WHERE user_role = %s"; 229 257 $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')); 230 260 $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'); 232 262 } 233 263 // else show all users by newest... … … 235 265 { 236 266 $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)); 237 269 $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); 244 278 } elseif ($h->vars['user_filter'] == 'pending') { 245 279 $h->message = $h->lang['user_man_no_pending_users']; … … 255 289 * Draw Rows 256 290 */ 257 public function drawRows($h, $ users, $filter = '', $search_term = '')291 public function drawRows($h, $pagedResults, $filter = '', $search_term = '') 258 292 { 259 // prepare for showing users, 30 per page260 $pg = $h->cage->get->getInt('pg');261 $items = 30;262 263 $pagedResults = $h->pagination($users, $items, $pg);264 265 293 $output = ""; 266 294 $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 268 300 $alt++; 269 301 … … 275 307 $user_icon = ''; 276 308 if ($h->vars['useEmailConf']) { 277 if ($user->user_ email_valid == 0) {309 if ($user->user_role == 'pending' && $user->user_email_valid == 0) { 278 310 $user_icon .= " <img src = '" . BASEURL . "content/plugins/user_manager/images/email.png' title='" . $h->lang["user_man_user_email_icon"] . "'>"; 279 311 } -
trunk/content/plugins/users/languages/users_language.php
r1081 r1190 138 138 $lang['userfunctions_notifymods_body_regards'] = "Thank you,"; 139 139 $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"; 140 149 ?> -
trunk/content/plugins/users/readme.txt
r1081 r1190 14 14 Changelog 15 15 --------- 16 v.1.2 2010/02/20 - Nick - Meta tags generated from user details and profile 16 17 v.1.1 2009/12/22 - Nick - Updated for compatibility with Hotaru 1.0 17 18 v.1.0 2009/11/25 - Nick - Cleaned up user_settings.php for better plugin integration -
trunk/content/plugins/users/users.php
r1081 r1190 3 3 * name: Users 4 4 * description: Provides profile, settings and permission pages 5 * version: 1. 15 * version: 1.2 6 6 * folder: users 7 7 * type: users 8 8 * 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 10 10 * author: Nick Ramsay 11 11 * authorurl: http://hotarucms.org/member.php?1-Nick … … 115 115 } 116 116 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 117 153 /** 118 154 * Filter posts to this user -
trunk/content/plugins/vote/css/vote.css
r1081 r1190 39 39 .vote_color_new { border: 1px solid #d0d0d0; background-color: #ffffff; color: #000; } 40 40 41 .vote_color_top_clicked { background-color: #f0f0aa; } 42 .vote_color_top_just_voted { background-color: #f99555; } 41 43 /* *********************************** 42 44 * ** SPACE BETWEEN BUTTON AND POST ** -
trunk/content/plugins/vote/javascript/vote.js
r1081 r1190 37 37 target.fadeToggle(); 38 38 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 41 64 }); 42 65 … … 48 71 ********************************************************************** */ 49 72 50 function vote( baseurl, ip, id, rating)73 function vote(id, rating, referer) 51 74 { 52 url = baseurl+"content/plugins/vote/vote_functions.php";75 sendurl = BASEURL +"content/plugins/vote/vote_functions.php"; 53 76 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 }); 57 111 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 }97 112 } -
trunk/content/plugins/vote/languages/vote_language.php
r1081 r1190 90 90 $lang["vote_settings_other"] = "Other"; 91 91 $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"; 92 93 93 94 ?> -
trunk/content/plugins/vote/readme.txt
r1081 r1190 15 15 Changelog 16 16 --------- 17 v.1.3 2010/02/10 - shibuya246 - Option to automatically increase vote count when clicking a post link 17 18 v.1.2 2010/01/12 - Nick - Fixes for auto-vote on post submission 18 19 v.1.1 2010/01/03 - Nick - Updated for Hotaru 1.0 -
trunk/content/plugins/vote/templates/vote_button.php
r1081 r1190 27 27 */ 28 28 29 $user_ip = $h->cage->server->testIp('REMOTE_ADDR');29 //$user_ip = $h->cage->server->testIp('REMOTE_ADDR'); 30 30 31 31 // Determine the status of the post so we can apply different css to top and new vote buttons: … … 47 47 <!-- Shown --> 48 48 <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> 50 50 </div> 51 51 52 52 <!-- Hidden --> 53 53 <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> 55 55 </div> 56 56 … … 60 60 <!-- Hidden --> 61 61 <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> 63 63 </div> 64 64 65 65 <!-- Shown --> 66 66 <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> 68 68 </div> 69 69 -
trunk/content/plugins/vote/vote.php
r1108 r1190 3 3 * name: Vote 4 4 * description: Adds voting ability to posted stories. 5 * version: 1. 25 * version: 1.3 6 6 * folder: vote 7 7 * class: Vote 8 8 * type: vote 9 9 * 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 11 11 * author: Nick Ramsay 12 12 * authorurl: http://hotarucms.org/member.php?1-Nick … … 53 53 if (!isset($vote_settings['no_front_page'])) { $vote_settings['no_front_page'] = 5; } 54 54 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 55 57 56 58 $h->updateSetting('vote_settings', serialize($vote_settings)); … … 80 82 81 83 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>'; 90 93 } 91 94 -
trunk/content/plugins/vote/vote_functions.php
r1081 r1190 6 6 * PHP version 5 7 7 * 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. 12 12 * 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. 16 16 * 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 18 18 * with Hotaru CMS. If not, see http://www.gnu.org/licenses/. 19 * 19 * 20 20 * @category Content Management System 21 21 * @package HotaruCMS … … 39 39 if ($h->cage->post->keyExists('post_id')) { 40 40 $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'); 42 42 $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 44 46 //get vote settings 45 $vote_settings = unserialize($h->getSetting('vote_settings', 'vote')); 46 47 $vote_settings = unserialize($h->getSetting('vote_settings', 'vote')); 48 47 49 // Only proceed if the user is logged in 48 50 if ($h->currentUser->loggedIn) { 49 51 50 52 $user_id = $h->currentUser->id; 51 53 52 54 // get vote history for this post: 53 55 54 56 $sql = "SELECT vote_rating FROM " . TABLE_POSTVOTES . " WHERE vote_post_id = %d AND vote_user_id = %d AND vote_rating != %d"; 55 57 $voted = $h->db->get_var($h->db->prepare($sql, $post_id, $user_id, -999)); 56 58 57 59 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 59 61 $json_array = array('result'=>$h->lang['vote_already_voted']); 60 62 echo json_encode($json_array); 61 63 return false; 62 64 } 63 65 64 66 // get current vote count and status 65 67 $sql = "SELECT post_votes_up, post_status, post_date FROM " . TABLE_POSTS . " WHERE post_id = %d"; 66 68 $result = $h->db->get_row($h->db->prepare($sql, $post_id)); 67 69 68 70 if ($vote_rating > 0) 69 71 { … … 73 75 if ((($result->post_votes_up + 1) >= $vote_settings['votes_to_promote']) 74 76 && ($result->post_date >= $sql_deadline)) { $post_status = 'top'; } else { $post_status = $result->post_status; } 75 77 76 78 //if ($result->post_date >= $sql_deadline) { $test = "ok"; } 77 79 //$json_array = array('result'=>$test); 78 80 //echo json_encode($json_array); exit; 79 81 80 82 // Update Posts table 81 83 $sql = "UPDATE " . TABLE_POSTS . " SET post_status = %s, post_votes_up = post_votes_up + 1 WHERE post_id = %d"; 82 84 $h->db->query($h->db->prepare($sql, $post_status, $post_id)); 83 85 84 86 // Update Postvotes table 85 87 $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)"; 86 88 $h->db->query($h->db->prepare($sql, $post_id, $user_id, $user_ip, 'vote', $vote_rating, $user_id)); 87 89 88 90 $h->pluginHook('vote_positive_vote', '', array('user' => $user_id, 'post'=>$post_id)); 89 } 91 } 90 92 else // negative vote 91 93 { … … 96 98 $sql = "UPDATE " . TABLE_POSTS . " SET post_votes_up=post_votes_up-1 WHERE post_id = %d"; 97 99 $h->db->query($h->db->prepare($sql, $post_id)); 98 100 99 101 // Change status to "new" if demoting a post 100 102 if ($vote_settings['use_demote'] && (($result->post_votes_up - 1) < $vote_settings['votes_to_promote'])) { … … 106 108 $sql = "DELETE FROM " . TABLE_POSTVOTES . " WHERE vote_post_id = %d AND vote_user_id = %d AND vote_rating = %d"; 107 109 $h->db->query($h->db->prepare($sql, $post_id, $user_id, $voted)); 108 110 109 111 $h->pluginHook('vote_negative_vote', '', array('user' => $user_id, 'post'=>$post_id)); 110 112 } 111 113 } 112 114 115 if ($referer == "link") { 116 // $h->readPost($post_id); 117 // header("Location: " . $h->post->origUrl); 118 } 119 113 120 $sql = "SELECT post_votes_up, post_votes_down FROM " . TABLE_POSTS . " WHERE post_id = %d"; 114 121 $votes = $h->db->get_row($h->db->prepare($sql, $post_id)); 115 122 116 123 $json_array = array('votes'=>$votes->post_votes_up); 117 124 118 125 echo json_encode($json_array); 119 126 } -
trunk/content/plugins/vote/vote_settings.php
r1081 r1190 53 53 $no_front_page = $vote_settings['no_front_page']; 54 54 $posts_widget = $vote_settings['posts_widget']; 55 $vote_on_url_click = $vote_settings['vote_on_url_click']; 55 56 56 57 //...otherwise set to blank or default: … … 65 66 if (!$no_front_page) { $no_front_page = 5; } 66 67 if (!$posts_widget) { $posts_widget = 'checked'; } 68 if (!$vote_on_url_click) { $vote_on_url_click = ''; } 67 69 68 70 // A plugin hook so other plugin developers can add settings … … 92 94 93 95 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 . "> " . $h->lang["vote_settings_posts_widget"] . "</p>\n"; 95 96 echo "<p><input type='checkbox' name='widget_votes' value='widget_votes' " . $posts_widget . "> " . $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 . "> " . $h->lang["vote_settings_vote_on_url_click"] . "</p>\n"; 98 99 96 100 // A plugin hook so other plugin developers can show settings 97 101 $h->pluginHook('vote_settings_form_2'); … … 224 228 $posts_widget = ''; 225 229 } 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 226 238 227 239 // A plugin hook so other plugin developers can save settings … … 239 251 $vote_settings['no_front_page'] = $no_front_page; 240 252 $vote_settings['posts_widget'] = $posts_widget; 241 253 $vote_settings['vote_on_url_click'] = $vote_on_url_click; 254 242 255 // parameters: plugin folder name, setting name, setting value 243 256 $h->updateSetting('vote_settings', serialize($vote_settings)); -
trunk/content/themes/keep-it-simple/css/style.css
r1120 r1190 21 21 } 22 22 /* Links */ 23 a:link , a:visited{23 a:link { 24 24 text-decoration: none; 25 25 color: #AE855C; 26 } 27 a:visited { 28 text-decoration: none; 29 color: #666; 30 font-weight:normal; 26 31 } 27 32 a:hover { … … 190 195 margin: 0 auto; 191 196 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; 193 198 padding-bottom: 35px; 194 199 padding-top: 5px; … … 303 308 text-transform: uppercase; 304 309 } 305 #header #nav ul li a:hover, 310 #header #nav ul li a:hover, 306 311 #header #nav ul li a:active { 307 312 border: none; … … 310 315 } 311 316 312 #header #nav ul li #navigation_active {317 #header #nav ul li.navigation_active { 313 318 background: transparent url(../images/left-tab.gif) no-repeat; 314 319 } … … 334 339 } 335 340 /* left columns */ 336 #left-columns h3 .{341 #left-columns h3 { 337 342 color: #444; 338 343 font: normal 1.8em Georgia, 'Times New Roman', Times, Serif; … … 348 353 margin: 12px 0 5px 0; 349 354 } 350 #left-columns h3 a:link, a:visited { 351 color:#444; 355 #left-columns a:link { 352 356 text-decoration:none; 353 357 } 354 355 358 #left-columns a:visited { 359 text-decoration:none; 360 } 356 361 /* sidebar menu */ 357 362 .sidemenu ul { … … 612 617 font-family:'Trebuchet MS','Helvetica Neue',Arial,Sans-Serif; 613 618 font-size:18px; 614 font-size-adjust:none;615 font-stretch:normal;616 619 font-style:normal; 617 620 font-variant:normal; … … 624 627 625 628 #breadcrumbs{ 629 width:480px; 630 overflow: auto; 626 631 color: #7BA857; 627 632 padding-bottom: 25px; … … 632 637 } 633 638 634 #sort_box {margin-top: -32px; margin-botton: 20px;} 639 #sort_box {margin-top: -32px; margin-bottom: 20px;} 640 641 .user_tabs { 642 background-color:#F0F0F0; 643 margin-bottom:4em; 644 padding-bottom:0.4em; 645 padding-top:0.4em; 646 } 635 647 636 648 /* sidebar */ … … 667 679 } 668 680 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;} 669 684 670 685 /* comments */ … … 702 717 width: 665px; 703 718 } 719 #submit_button_1 { 720 float:right; 721 margin: -10px -20px 0 0; 722 } 704 723 705 724 /* Widget*/ 706 725 .widget_head { 726 color:#666; 707 727 margin-top:0.4em; 708 } 709 .widget_head h2{ 710 color:#663333; 711 font-size:22px; 728 font-size:18px; 729 font-weight:normal; 730 } 731 .widget_head:first-letter{ 732 color: #7BA857; 733 font-weight:bold; 712 734 } 713 735 .widget_body { … … 715 737 padding-left:12px; 716 738 } 717 718 739 .message { 719 740 margin: 1.0em auto 1.0em auto; -
trunk/content/themes/keep-it-simple/footer.php
r1081 r1190 115 115 // Link to forums... 116 116 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>"; 118 118 119 119 $h->showQueriesAndTime(); … … 123 123 <?php $h->pluginHook('pre_close_body'); ?> 124 124 125 <script type='text/javascript'> 126 127 jQuery('document').ready(function($) { 128 $("a#navigation_active").parent("li").addClass("navigation_active"); 129 }); 130 131 </script> 125 132 </body> 126 133 </html> -
trunk/content/themes/keep-it-simple/navigation.php
r1081 r1190 42 42 ?> 43 43 <?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"]; ?>'> 45 45 <?php echo $h->currentUser->name; ?> 46 46 </a></li> … … 48 48 49 49 <?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> 51 51 52 52 <?php $h->pluginHook('navigation'); ?> … … 79 79 <div id="iconrss"> 80 80 <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" /> 82 82 </a> 83 83 </div> -
trunk/content/themes/keep-it-simple/sb_sort_filter.php
r1081 r1190 49 49 <a href="<?php echo $h->vars['all_link']; ?>"> 50 50 <?php echo $h->lang["sb_base_sort_all"]; ?></a> 51 </li> 51 <br/> 52 </li> 52 53 53 <br />54 54 <li> 55 55 <?php echo $h->lang["sb_base_sort_best_from"]; ?></li> -
trunk/content/themes/shibuya/css/style.css
r1108 r1190 43 43 44 44 #announcement { 45 background-color: #f 8f8f8;45 background-color: #ffcc00 ; 46 46 border-bottom: 1px solid #000; 47 47 padding: 0.4em; … … 60 60 #hd_title h1 { font-size: 2.2em; font-weight: bold; padding: 0.5em 0.4em 0.4em 0.4em;} /* Site title */ 61 61 #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; } 63 63 64 64 #hd_block2 { float: right; height: 60px; width:468px; } -
trunk/content/themes/shibuya/header.php
r1081 r1190 55 55 <link rel="stylesheet" href="<?php echo BASEURL . 'content/themes/' . THEME . 'css/style.css'; ?>" type="text/css" /> 56 56 <!-- <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 58 69 <?php $h->pluginHook('header_include_raw'); ?> 59 70 -
trunk/content/themes/shibuya/index.php
r1081 r1190 1 1 <?php 2 2 /** 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 6 8 * 7 9 * PHP version 5 … … 26 28 * @link http://www.shibuya246.com/ 27 29 */ 30 31 // get settings: 32 $h->vars['settings'] = $h->getThemeSettings(); 33 34 // get language 35 $h->includeThemeLanguage(); 28 36 29 37 // plugin hook -
trunk/install/upgrade.php
r1081 r1190 339 339 } 340 340 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 341 348 // Update Hotaru version number to the database (referred to when upgrading) 342 349 $sql = "UPDATE " . TABLE_MISCDATA . " SET miscdata_key = %s, miscdata_value = %s, miscdata_default = %s WHERE miscdata_key = %s"; -
trunk/javascript/hotaru.js
r1081 r1190 106 106 }); 107 107 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;}, 118 URLDecode: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 108 123 109 124 /*********************************************** … … 130 145 return true; 131 146 } 147 148 149 -
trunk/libs/Avatar.php
r1081 r1190 42 42 public $size = 32; 43 43 public $rating = 'g'; // "global" used by Gravatar 44 public $valid = true; 44 45 45 46 … … 88 89 89 90 /** 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 /** 90 113 * get the plain avatar with no surrounding HTML div 91 114 * … … 109 132 110 133 /** 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) 112 135 */ 113 136 public function linkAvatar($h) … … 129 152 130 153 /** 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) 132 155 */ 133 156 public function wrapAvatar($h) … … 148 171 return $output; 149 172 } 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 } 150 203 } 151 204 ?> -
trunk/libs/Blocked.php
r1108 r1190 77 77 // GET CURRENTLY BLOCKED ITEMS... 78 78 79 $query = ''; 79 80 $where_clause = ''; 81 $sort_clause = " ORDER BY blocked_updatedts DESC"; 80 82 81 83 // if search 82 84 if ($safe && $h->cage->post->getAlpha('type') == 'search') { 83 85 $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) . '%'); 85 91 } 86 92 87 93 // if filter 94 $filter = ''; 88 95 if ($safe && $h->cage->post->getAlpha('type') == 'filter') { 89 96 $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 } 91 108 } 92 109 93 110 // 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; 108 119 $output = ""; 109 120 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'); 113 122 114 123 $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&action=remove&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&action=remove&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 } 159 170 } 160 171 -
trunk/libs/Caching.php
r1081 r1190 230 230 $sql = "SELECT miscdata_updatedts FROM " . DB_PREFIX . "miscdata ORDER BY miscdata_updatedts DESC"; 231 231 break; 232 case 'blocked': 233 $sql = "SELECT blocked_updatedts FROM " . DB_PREFIX . "blocked ORDER BY blocked_updatedts DESC"; 234 break; 232 235 default: 233 236 return false; -
trunk/libs/Category.php
r1081 r1190 137 137 if ($cat_children_ids) { return $cat_children_ids; } else { return false; } 138 138 } 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 } 139 153 } 140 154 -
trunk/libs/Comment.php
r1127 r1190 33 33 protected $date = ''; 34 34 protected $status = 'approved'; 35 protected $votes = 0; 35 protected $votes_up = 0; 36 protected $votes_down = 0; 36 37 protected $content = ''; 37 38 protected $type = 'newcomment'; // or "editcomment" … … 159 160 // get all comments 160 161 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)); 163 164 } 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')); 166 167 } 167 168 } 168 169 169 170 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; } 170 213 } 171 214 … … 269 312 public function deleteComment($h, $comment_id = 0) 270 313 { 314 if (!$comment_id) { $comment_id = $this->id; } 271 315 if (!$comment_id) { return false; } 272 316 273 317 $sql = "DELETE FROM " . TABLE_COMMENTS . " WHERE comment_id = %d"; 274 318 $h->db->query($h->db->prepare($sql, $comment_id)); 275 319 276 320 // 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)); 279 323 280 324 $h->comment->id = $comment_id; // a small hack to get the id for use in plugins. -
trunk/libs/IncludeCssJs.php
r1081 r1190 346 346 * @param bool $admin 347 347 */ 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) 349 349 { 350 350 if ($admin) { $index = 'admin_index'; } else { $index = 'index'; } … … 357 357 echo "<link rel='stylesheet' href='" . BASEURL . $index . ".php?combine=1&type=css&version=" . $version_css . "' type='text/css' />\n"; 358 358 } 359 359 if ($h->currentUser->loggedIn) {echo "<div id='loggedIn' class='loggedIn_true'/>"; } else {"<div id='loggedIn' class='loggedIn_false'/>";} 360 360 } 361 361 } -
trunk/libs/Initialize.php
r1108 r1190 174 174 $cage->addAccessor('sanitizeAll'); 175 175 $cage->addAccessor('sanitizeTags'); 176 $cage->addAccessor('sanitizeEnts'); 176 177 $cage->addAccessor('getHtmLawed'); 177 178 -
trunk/libs/Maintenance.php
r1108 r1190 102 102 if ($file != 'placeholder.txt') { 103 103 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; } 105 106 } else { 106 107 $success = false; -
trunk/libs/PageHandling.php
r1108 r1190 303 303 304 304 /** 305 * Prepare pagination and display page numbers bar306 *307 * @param array $items - array of all items to show308 * @param int $items_per_page309 * @param int $pg - current page number310 * @return object - object of type Paginated311 */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 /**325 305 * Return page numbers bar 326 306 * -
trunk/libs/PluginManagement.php
r1120 r1190 275 275 return false; 276 276 } 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 } 289 297 290 298 // Add any plugin hooks to the hooks table … … 405 413 $h->deleteFiles(CACHE . 'css_js_cache'); 406 414 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 408 419 $h->db->query($h->db->prepare("DELETE FROM " . TABLE_PLUGINHOOKS . " WHERE plugin_folder = %s", $h->plugin->folder)); 409 420 … … 590 601 // If file version is newer the the current plugin version, then upgrade... 591 602 if (version_compare($file_version, $db_version, '>')) { 592 $this->upgrade($h); // runs the install function an shows "upgraded!" message instead of "installed".603 $this->upgrade($h); // runs the install function and shows "upgraded!" message instead of "installed". 593 604 } else { 594 605 // else simply show an activated message... … … 604 615 $h->messages[$h->lang["admin_plugins_deactivated"]] = 'green'; 605 616 } 617 618 $h->pluginHook('activate_deactivate', '', array('enabled' => $enabled)); 606 619 } 607 620 -
trunk/libs/ThemeSettings.php
r1081 r1190 67 67 } 68 68 69 return $settings;69 if ($settings) { return $settings; } else { return false; } 70 70 } 71 71 -
trunk/libs/UserAuth.php
r1103 r1190 309 309 $viewee->role = $role_check; 310 310 $new_perms = $viewee->getDefaultPermissions($h, $role_check); 311 $viewee->setAllPermissions($ h, $new_perms);311 $viewee->setAllPermissions($new_perms); 312 312 $viewee->updatePermissions($h); 313 313 if ($role_check == 'killspammed' || $role_check == 'deleted') { -
trunk/libs/extensions/csrf/csrf_class.php
r1081 r1190 11 11 12 12 13 public function csrfInit($h, $type = 'check', $action = 'unspecified', $life = 10)13 public function csrfInit($h, $type = 'check', $action = 'unspecified', $life = 30) 14 14 { 15 15 $this->sid = preg_replace('/[^a-z0-9]+/i', '', session_id());
Note: See TracChangeset
for help on using the changeset viewer.