- Timestamp:
- 05/07/10 05:59:40 (2 years ago)
- Location:
- trunk
- Files:
-
- 7 modified
-
. (modified) (1 prop)
-
content/plugins (modified) (1 prop)
-
content/plugins/sb_base/libs/SbBaseFunctions.php (modified) (6 diffs)
-
content/plugins/sb_base/readme.txt (modified) (1 diff)
-
functions/funcs.times.php (modified) (1 diff)
-
libs/Comment.php (modified) (1 diff)
-
libs/Post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/1.2 merged: 1665-1666
- Property svn:mergeinfo changed
-
trunk/content/plugins
- Property svn:mergeinfo changed
/branches/1.2/content/plugins merged: 1665-1666
- Property svn:mergeinfo changed
-
trunk/content/plugins/sb_base/libs/SbBaseFunctions.php
r1662 r1667 149 149 $h->vars['filter']['post_archived = %s'] = 'N'; 150 150 $h->vars['filter']['post_status = %s'] = 'new'; 151 $start = date('YmdHis', strtotime("now"));151 $start = date('YmdHis', time_block()); 152 152 $end = date('YmdHis', strtotime($upcoming_duration)); // should be negative 153 153 $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start); … … 158 158 // Filters page to "top" stories from the last 24 hours only 159 159 $h->vars['filter']['post_status = %s'] = 'top'; 160 $start = date('YmdHis', strtotime("now"));160 $start = date('YmdHis', time_block()); 161 161 $end = date('YmdHis', strtotime("-1 day")); 162 162 $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start); … … 167 167 // Filters page to "top" stories from the last 48 hours only 168 168 $h->vars['filter']['post_status = %s'] = 'top'; 169 $start = date('YmdHis', strtotime("now"));169 $start = date('YmdHis', time_block()); 170 170 $end = date('YmdHis', strtotime("-2 days")); 171 171 $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start); … … 176 176 // Filters page to "top" stories from the last 7 days only 177 177 $h->vars['filter']['post_status = %s'] = 'top'; 178 $start = date('YmdHis', strtotime("now"));178 $start = date('YmdHis', time_block()); 179 179 $end = date('YmdHis', strtotime("-7 days")); 180 180 $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start); … … 185 185 // Filters page to "top" stories from the last 30 days only 186 186 $h->vars['filter']['post_status = %s'] = 'top'; 187 $start = date('YmdHis', strtotime("now"));187 $start = date('YmdHis', time_block()); 188 188 $end = date('YmdHis', strtotime("-30 days")); 189 189 $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start); … … 194 194 // Filters page to "top" stories from the last 365 days only 195 195 $h->vars['filter']['post_status = %s'] = 'top'; 196 $start = date('YmdHis', strtotime("now"));196 $start = date('YmdHis', time_block()); 197 197 $end = date('YmdHis', strtotime("-365 days")); 198 198 $h->vars['filter']['(post_date >= %s AND post_date <= %s)'] = array($end, $start); -
trunk/content/plugins/sb_base/readme.txt
r1662 r1667 14 14 Changelog 15 15 --------- 16 v.1.0 2010/05/07 - Nick - Fixes for better caching 16 17 v.1.0 2010/04/14 - Nick - Changes to enable home page overriding 17 18 v.0.9 2010/03/27 - Nick - 1 & 3 month options for post archiving, plus reorganization of post RSS methods -
trunk/functions/funcs.times.php
r1662 r1667 149 149 } 150 150 } 151 152 /** 153 * Returns the next time block of the day, e.g. now: 1:25, so returns 2:00 (if block = 1 hour) 154 * 155 * @param int $block - time in HOURS 156 * @return int - time in SECONDS 157 */ 158 function time_block($block = 1) 159 { 160 $block = ($block * 60) * 60; // change into seconds 161 $time_now = time(); 162 $start_of_current_block = floor($time_now/$block); 163 $start_of_current_block *= $block; 164 165 $start_of_next_block = $start_of_current_block + $block; 166 167 return $start_of_next_block; 168 } 151 169 ?> -
trunk/libs/Comment.php
r1662 r1667 536 536 public function countDailyComments($h) 537 537 { 538 $start = date('YmdHis', strtotime("now"));538 $start = date('YmdHis', time_block()); 539 539 $end = date('YmdHis', strtotime("-1 day")); 540 540 $sql = "SELECT COUNT(comment_id) FROM " . TABLE_COMMENTS . " WHERE comment_archived = %s AND comment_user_id = %d AND (comment_date >= %s AND comment_date <= %s)"; -
trunk/libs/Post.php
r1664 r1667 413 413 } 414 414 415 $start = date('YmdHis', strtotime("now"));415 $start = date('YmdHis', time_block()); 416 416 $end = date('YmdHis', strtotime($time_ago)); 417 417 $sql = "SELECT COUNT(post_id) FROM " . TABLE_POSTS . " WHERE post_archived = %s AND post_author = %d AND post_type = %s AND (post_date >= %s AND post_date <= %s)";