Changeset 8071

Show
Ignore:
Timestamp:
02/26/07 06:05:33 (1 year ago)
Author:
GamerZ
Message:

Commit For The Day

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wp-stats/trunk/readme.html

    r7998 r8071  
    288288                              <b>Version 2.11 (01-05-2007)</b> 
    289289                              <ul> 
     290                                    <li>NEW: Post Categories Are Now Hierarchical</li> 
     291                                    <li>NEW: Used WordPress's Date/Time Format</li> 
    290292                                    <li>FIXED: Missing WHERE in get_authorsstats()</li> 
    291293                                    <li>FIXED: Password Protected Post Comments Viewable On Comment Author Stats</li> 
     294                                    <li>FIXED: Wrong URL For Page Under Certain Stat Posts Listing</li> 
    292295                              </ul> 
    293296                        </li> 
  • wp-stats/trunk/stats/stats.php

    r7998 r8071  
    134134            $where = '1=1'; 
    135135      } 
    136     $recentposts = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, post_date, user_login, display_name FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER  BY post_date DESC LIMIT $limit"); 
     136    $recentposts = $wpdb->get_results("SELECT $wpdb->posts.*, $wpdb->users.* FROM $wpdb->posts LEFT JOIN $wpdb->users ON $wpdb->users.ID = $wpdb->posts.post_author WHERE post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER  BY post_date DESC LIMIT $limit"); 
    137137      if($recentposts) { 
    138138            foreach ($recentposts as $post) { 
    139                   $post_title = htmlspecialchars(stripslashes($post->post_title)); 
    140                   $post_date = mysql2date('d.m.Y', $post->post_date); 
    141                   $display_name = stripslashes($post->display_name); 
     139                  $post_title = get_the_title(); 
     140                  $post_date = get_the_time(get_option('date_format').' @ '.get_option('time_format')); 
     141                  $display_name = get_the_author(); 
    142142                  $temp .= "<li>$post_date - <a href=\"".get_permalink()."\" title=\"".sprintf(__('View post %s', 'wp-stats'), $post_title)."\">$post_title</a> ($display_name)</li>\n"; 
    143143            } 
     
    163163            $where = '1=1'; 
    164164      } 
    165     $recentcomments = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, comment_author, post_date, comment_date FROM $wpdb->posts INNER JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER  BY comment_date DESC LIMIT $limit"); 
     165    $recentcomments = $wpdb->get_results("SELECT $wpdb->posts.*, comment_date FROM $wpdb->posts INNER JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' ORDER  BY comment_date DESC LIMIT $limit"); 
    166166      if($recentcomments) { 
    167167            foreach ($recentcomments as $post) { 
    168                   $post_title = htmlspecialchars(stripslashes($post->post_title)); 
     168                  $post_title = get_the_title(); 
    169169                  $comment_author = htmlspecialchars(stripslashes($post->comment_author)); 
    170                   $comment_date = mysql2date('d.m.Y @ H:i', $post->comment_date); 
     170                  $comment_date = get_the_time(get_option('date_format')); 
    171171                  $temp .= "<li>$comment_date - $comment_author (<a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">$post_title</a>)</li>\n"; 
    172172            } 
     
    192192            $where = '1=1'; 
    193193      } 
    194     $mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, post_date, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER  BY comment_total DESC LIMIT $limit"); 
     194    $mostcommenteds = $wpdb->get_results("SELECT $wpdb->posts.*, COUNT($wpdb->comments.comment_post_ID) AS 'comment_total' FROM $wpdb->posts LEFT JOIN $wpdb->comments ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND post_password = '' GROUP BY $wpdb->comments.comment_post_ID ORDER  BY comment_total DESC LIMIT $limit"); 
    195195      if($mostcommenteds) { 
    196196            if($chars > 0) { 
    197197                  foreach ($mostcommenteds as $post) { 
    198                         $post_title = htmlspecialchars(stripslashes($post->post_title)); 
     198                        $post_title = get_the_title(); 
    199199                        $comment_total = intval($post->comment_total); 
    200200                        $temp .= "<li><a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">".snippet_chars($post_title, $chars)."</a> - $comment_total ".__('comments', 'wp-stats')."</li>"; 
     
    202202            } else { 
    203203                  foreach ($mostcommenteds as $post) { 
    204                         $post_title = htmlspecialchars(stripslashes($post->post_title)); 
     204                        $post_title = get_the_title(); 
    205205                        $comment_total = intval($post->comment_total); 
    206206                        $temp .= "<li><a href=\"".get_permalink()."\" title=\"".sprintf(__('View comments in post %s', 'wp-stats'), $post_title)."\">$post_title</a> - $comment_total ".__('comments', 'wp-stats')."</li>"; 
     
    257257// Treshhold = Number Of Posts User Must Have Before It Will Display His Name Out 
    258258// 5 = Default Treshhold; -1 = Disable Treshhold 
    259 function get_commentmembersstats($threshhold = -1, $display = true) { 
     259function get_commentmembersstats($threshhold = -1, $limit = 0, $display = true) { 
    260260      global $wpdb; 
    261261      $temp = ''; 
    262       $comments = $wpdb->get_results("SELECT comment_author, COUNT(comment_ID) AS 'comment_total' FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_author ORDER BY comment_total DESC"); 
     262      $limit_sql = ''; 
     263      if($limit > 0) { 
     264            $limit_sql = "LIMIT $limit"; 
     265      } 
     266      $comments = $wpdb->get_results("SELECT comment_author, COUNT(comment_ID) AS 'comment_total' FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' GROUP BY comment_author ORDER BY comment_total DESC $limit_sql"); 
    263267      if($comments) { 
    264268            foreach ($comments as $comment) { 
     
    287291      global $wpdb; 
    288292      $temp = ''; 
    289       $cats = get_categories("type=post"); 
    290       if ($cats) { 
    291             foreach ($cats as $cat) { 
    292                   $temp .= '<li><a href="'.get_category_link($cat->cat_ID).'" title="View all posts in '.$cat->cat_name.'">'.$cat->cat_name.'</a> ('.$cat->category_count.")</li>\n"; 
    293             } 
     293      $defaults = array('type' => 'post', 'style' => 'list', 'show_count' => 1); 
     294      $categories = get_categories($defaults); 
     295      if (empty($categories)){ 
     296            $temp .= '<li>'.__('No categories', 'wp-stats').'</li>'; 
     297      } else { 
     298            $temp .= walk_category_tree($categories, 0, $defaults); 
    294299      } 
    295300      if($display) { 
     
    519524                  $temp_stats .= '<p><strong>'.__('Comment Members', 'wp-stats').'</strong></p>'."\n"; 
    520525                  $temp_stats .= '<ol>'."\n"; 
    521                   $temp_stats .= get_commentmembersstats(-1, false); 
     526                  $temp_stats .= get_commentmembersstats(-1, 0, false); 
    522527                  $temp_stats .= '</ol>'."\n"; 
    523528            } 
     
    555560            $comment_author_sql = $wpdb->escape($comment_author); 
    556561            // Total Comments Posted By User 
    557             $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_author='$comment_author_sql'"); 
     562            $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author =  '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = ''"); 
    558563            // Checking $page and $offset 
    559564            if (empty($page) || $page == 0) { $page = 1; } 
     
    567572            $totalpages = ceil($totalcomments/$perpage); 
    568573            // Getting The Comments 
    569             $gmz_comments =  $wpdb->get_results("SELECT $wpdb->posts.ID, comment_author, comment_date, comment_content, ID, comment_ID, post_date, post_title, post_name, post_password FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author =  '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' ORDER  BY comment_post_ID DESC, comment_date DESC  LIMIT $offset, $perpage"); 
    570  
     574            $gmz_comments =  $wpdb->get_results("SELECT $wpdb->posts.*, $wpdb->comments.* FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author =  '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND post_status = 'publish' AND post_password = '' ORDER  BY comment_post_ID DESC, comment_date DESC  LIMIT $offset, $perpage"); 
    571575            $temp_stats .= '<h2>'.__('Comments Posted By', 'wp-stats').' '.$comment_author.'</h2>'; 
    572576            $temp_stats .= '<p>'.sprintf(__('Displaying <strong>%s</strong> To <strong>%s</strong> Of <strong>%s</strong> Comments', 'wp-stats'), $displayonpage, $maxonpage, $totalcomments).'</p>'; 
     
    575579            if($gmz_comments) { 
    576580                  foreach($gmz_comments as $post) { 
    577                         $comment_id = intval($post-> comment_ID); 
     581                        $comment_id = intval($post->comment_ID); 
    578582                        $comment_author2 = htmlspecialchars(stripslashes($post->comment_author)); 
    579                         $comment_date = mysql2date('d.m.Y @ H:i', $post->comment_date); 
     583                        $comment_date = mysql2date(get_option('date_format').' @ '.get_option('time_format'), $post->comment_date); 
    580584                        $comment_content = wpautop(stripslashes($post->comment_content)); 
    581                         $post_date = mysql2date('d.m.Y @ H:i', $post->post_date); 
    582                         $post_title = htmlspecialchars(stripslashes($post->post_title)); 
     585                        $post_date = get_the_time(get_option('date_format').' @ '.get_option('time_format')); 
     586                        $post_title = get_the_title(); 
    583587 
    584588                        // Check For Password Protected Post 
  • wp-stats/trunk/stats/wp-stats.pot

    r7998 r8071  
    33"Project-Id-Version: WP-Stats 2.11\n" 
    44"POT-Creation-Date: \n" 
    5 "PO-Revision-Date: 2007-02-17 23:22+0800\n" 
     5"PO-Revision-Date: 2007-02-26 14:00+0800\n" 
    66"Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n" 
    77"Language-Team: Lester Chan <gamerz84@homtail.com>\n" 
     
    5555 
    5656#: stats-options.php:81 
    57 #: stats.php:382 
     57#: stats.php:387 
    5858msgid "General Stats" 
    5959msgstr "" 
     
    6464 
    6565#: stats-options.php:88 
    66 #: stats.php:401 
     66#: stats.php:406 
    6767msgid "WP-EMail" 
    6868msgstr "" 
    6969 
    7070#: stats-options.php:93 
    71 #: stats.php:411 
     71#: stats.php:416 
    7272msgid "WP-Polls" 
    7373msgstr "" 
    7474 
    7575#: stats-options.php:98 
    76 #: stats.php:421 
     76#: stats.php:426 
    7777msgid "WP-PostRatings" 
    7878msgstr "" 
    7979 
    8080#: stats-options.php:103 
    81 #: stats.php:430 
     81#: stats.php:435 
    8282msgid "WP-PostViews" 
    8383msgstr "" 
    8484 
    8585#: stats-options.php:108 
    86 #: stats.php:438 
     86#: stats.php:443 
    8787msgid "WP-UserOnline" 
    8888msgstr "" 
    8989 
    9090#: stats-options.php:111 
    91 #: stats.php:448 
     91#: stats.php:453 
    9292#, php-format 
    9393msgid "Top %s Post Stats" 
     
    128128 
    129129#: stats-options.php:135 
    130 #: stats.php:509 
     130#: stats.php:514 
    131131msgid "Authors Stats" 
    132132msgstr "" 
     
    134134#: stats-options.php:136 
    135135#: stats-widget.php:54 
    136 #: stats.php:510 
     136#: stats.php:515 
    137137msgid "Authors" 
    138138msgstr "" 
    139139 
    140140#: stats-options.php:137 
    141 #: stats.php:518 
     141#: stats.php:523 
    142142msgid "Comments' Members Stats" 
    143143msgstr "" 
    144144 
    145145#: stats-options.php:138 
    146 #: stats.php:519 
     146#: stats.php:524 
    147147msgid "Comment Members" 
    148148msgstr "" 
    149149 
    150150#: stats-options.php:139 
    151 #: stats.php:527 
     151#: stats.php:532 
    152152msgid "Misc Stats" 
    153153msgstr "" 
    154154 
    155155#: stats-options.php:140 
    156 #: stats.php:532 
     156#: stats.php:537 
    157157msgid "Post Categories" 
    158158msgstr "" 
    159159 
    160160#: stats-options.php:141 
    161 #: stats.php:540 
     161#: stats.php:545 
    162162msgid "Link Categories" 
    163163msgstr "" 
     
    168168 
    169169#: stats-widget.php:49 
    170 #: stats.php:383 
     170#: stats.php:388 
    171171msgid "Total Stats" 
    172172msgstr "" 
     
    289289#: stats.php:210 
    290290#: stats.php:246 
    291 #: stats.php:275 
     291#: stats.php:279 
    292292msgid "N/A" 
    293293msgstr "" 
     
    311311msgstr "" 
    312312 
    313 #: stats.php:268 
     313#: stats.php:272 
    314314#, php-format 
    315315msgid "View all comments posted by %s" 
    316316msgstr "" 
    317317 
    318 #: stats.php:385 
     318#: stats.php:296 
     319msgid "No categories" 
     320msgstr "" 
     321 
     322#: stats.php:390 
    319323msgid "Authors To This Blog." 
    320324msgstr "" 
    321325 
    322 #: stats.php:386 
     326#: stats.php:391 
    323327msgid "Posts Were Posted." 
    324328msgstr "" 
    325329 
    326 #: stats.php:387 
     330#: stats.php:392 
    327331msgid "Pages Were Created." 
    328332msgstr "" 
    329333 
    330 #: stats.php:388 
     334#: stats.php:393 
    331335msgid "Comments Were Posted." 
    332336msgstr "" 
    333337 
    334 #: stats.php:389 
     338#: stats.php:394 
    335339msgid "Different Nicks Were Represented In The Comments." 
    336340msgstr "" 
    337341 
    338 #: stats.php:390 
     342#: stats.php:395 
    339343msgid "Links Were Added" 
    340344msgstr "" 
    341345 
    342 #: stats.php:396 
     346#: stats.php:401 
    343347msgid "Plugins Stats" 
    344348msgstr "" 
    345349 
    346 #: stats.php:403 
     350#: stats.php:408 
    347351msgid "Emails Were Sent." 
    348352msgstr "" 
    349353 
    350 #: stats.php:404 
     354#: stats.php:409 
    351355msgid "Emails Were Sent Successfully." 
    352356msgstr "" 
    353357 
    354 #: stats.php:405 
     358#: stats.php:410 
    355359msgid "Emails Failed To Send." 
    356360msgstr "" 
    357361 
    358 #: stats.php:413 
     362#: stats.php:418 
    359363msgid "Polls Were Created." 
    360364msgstr "" 
    361365 
    362 #: stats.php:414 
     366#: stats.php:419 
    363367msgid "Polls' Answers Were Given." 
    364368msgstr "" 
    365369 
    366 #: stats.php:415 
    367 #: stats.php:423 
     370#: stats.php:420 
     371#: stats.php:428 
    368372msgid "Votes Were Casted." 
    369373msgstr "" 
    370374 
    371 #: stats.php:424 
     375#: stats.php:429 
    372376msgid "Users Casted Their Vote." 
    373377msgstr "" 
    374378 
    375 #: stats.php:432 
     379#: stats.php:437 
    376380msgid "Views Were Generated." 
    377381msgstr "" 
    378382 
    379 #: stats.php:440 
     383#: stats.php:445 
    380384msgid "User(s) Online Now." 
    381385msgstr "" 
    382386 
    383 #: stats.php:441 
     387#: stats.php:446 
    384388msgid "Most users ever online was" 
    385389msgstr "" 
    386390 
    387 #: stats.php:442 
    388 #: stats.php:596 
     391#: stats.php:447 
     392#: stats.php:600 
    389393msgid "On" 
    390394msgstr "" 
    391395 
    392 #: stats.php:453 
     396#: stats.php:458 
    393397msgid "Recent Posts" 
    394398msgstr "" 
    395399 
    396 #: stats.php:461 
     400#: stats.php:466 
    397401msgid "Recent Comments" 
    398402msgstr "" 
    399403 
    400 #: stats.php:469 
     404#: stats.php:474 
    401405msgid "Most Commented Post" 
    402406msgstr "" 
    403407 
    404 #: stats.php:477 
     408#: stats.php:482 
    405409msgid "Most Emailed Post" 
    406410msgstr "" 
    407411 
    408 #: stats.php:486 
     412#: stats.php:491 
    409413msgid "Highest Rated Post" 
    410414msgstr "" 
    411415 
    412 #: stats.php:492 
     416#: stats.php:497 
    413417msgid "Most Rated Post" 
    414418msgstr "" 
    415419 
    416 #: stats.php:501 
     420#: stats.php:506 
    417421msgid "Most Viewed Post" 
    418422msgstr "" 
    419423 
    420 #: stats.php:571 
     424#: stats.php:575 
    421425msgid "Comments Posted By" 
    422426msgstr "" 
    423427 
    424 #: stats.php:572 
     428#: stats.php:576 
    425429#, php-format 
    426430msgid "Displaying <strong>%s</strong> To <strong>%s</strong> Of <strong>%s</strong> Comments" 
    427431msgstr "" 
    428432 
    429 #: stats.php:588 
    430 #: stats.php:594 
     433#: stats.php:592 
     434#: stats.php:598 
    431435msgid "Posted On" 
    432436msgstr "" 
    433437 
    434 #: stats.php:588 
     438#: stats.php:592 
    435439msgid "Protected" 
    436440msgstr "" 
    437441 
    438 #: stats.php:589 
     442#: stats.php:593 
    439443msgid "Comments Protected" 
    440444msgstr "" 
    441445 
    442 #: stats.php:596 
     446#: stats.php:600 
    443447#, php-format 
    444448msgid "View the comment posted by %s" 
    445449msgstr "" 
    446450 
    447 #: stats.php:596 
     451#: stats.php:600 
    448452msgid "Posted By" 
    449453msgstr "" 
    450454 
    451 #: stats.php:601 
     455#: stats.php:605 
    452456msgid "has not made any comments yet." 
    453457msgstr "" 
    454458 
    455 #: stats.php:610 
     459#: stats.php:614 
    456460msgid "Previous Page" 
    457461msgstr "" 
    458462 
    459 #: stats.php:618 
     463#: stats.php:622 
    460464msgid "Next Page" 
    461465msgstr "" 
    462466 
    463 #: stats.php:627 
     467#: stats.php:631 
    464468#, php-format 
    465469msgid "Pages (%s)" 
    466470msgstr "" 
    467471 
    468 #: stats.php:629 
     472#: stats.php:633 
    469473msgid "Go to First Page" 
    470474msgstr "" 
    471475 
    472 #: stats.php:629 
     476#: stats.php:633 
    473477msgid "First" 
    474478msgstr "" 
    475479 
    476 #: stats.php:632 
    477 #: stats.php:644 
     480#: stats.php:636 
     481#: stats.php:648 
    478482msgid "Go to Page" 
    479483msgstr "" 
    480484 
    481 #: stats.php:639 
     485#: stats.php:643 
    482486msgid "Page" 
    483487msgstr "" 
    484488 
    485 #: stats.php:647 
     489#: stats.php:651 
    486490msgid "Go to Last Page" 
    487491msgstr "" 
    488492 
    489 #: stats.php:647 
     493#: stats.php:651 
    490494msgid "Last" 
    491495msgstr "" 
    492496 
    493 #: stats.php:651 
     497#: stats.php:655 
    494498msgid "Back To Stats Page" 
    495499msgstr ""