Changeset 1318 in ExiteCMS
- Timestamp:
- 02/27/08 22:01:07 (4 years ago)
- Location:
- modules/common/forum_threads_list_panel/php-files/modules/forum_threads_list_panel
- Files:
-
- 5 edited
-
my_posts.php (modified) (3 diffs)
-
my_threads.php (modified) (3 diffs)
-
new_posts.php (modified) (3 diffs)
-
new_posts_detail.php (modified) (4 diffs)
-
templates/modules.forum_threads_list_panel.new_posts_detail.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
modules/common/forum_threads_list_panel/php-files/modules/forum_threads_list_panel/my_posts.php
r1113 r1318 53 53 ); 54 54 $rows = dbrows($result); 55 $variables['rows'] = $rows; 55 56 56 57 // make sure rowstart has a valid value 57 58 if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0; 59 $variables['rowstart'] = $rowstart; 58 60 59 61 $result = dbquery( … … 61 63 INNER JOIN ".$db_prefix."forums tf USING(forum_id) 62 64 WHERE ".groupaccess('forum_access')." AND post_author='".$id."' 63 ORDER BY post_datestamp DESC LIMIT $rowstart,".ITEMS_PER_PAGE 65 ORDER BY post_datestamp DESC 66 LIMIT $rowstart,".ITEMS_PER_PAGE 64 67 ); 65 68 … … 72 75 73 76 // required template variables 74 $variables['rows'] = $rows;75 $variables['rowstart'] = $rowstart;76 77 $variables['pagenav_url'] = FUSION_SELF."?id=".$id."&"; 77 78 -
modules/common/forum_threads_list_panel/php-files/modules/forum_threads_list_panel/my_threads.php
r844 r1318 36 36 ); 37 37 $rows = dbrows($result); 38 $variables['rows'] = $rows; 38 39 39 40 // make sure rowstart has a valid value 40 41 if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0; 42 $variables['rowstart'] = $rowstart; 41 43 42 44 // get the threads for this page … … 46 48 INNER JOIN ".$db_prefix."users tu ON tt.thread_lastuser=tu.user_id 47 49 WHERE ".groupaccess('forum_access')." AND thread_author='".$userdata['user_id']."' 48 ORDER BY thread_lastpost DESC LIMIT $rowstart,".ITEMS_PER_PAGE 50 ORDER BY thread_lastpost DESC 51 LIMIT $rowstart,".ITEMS_PER_PAGE 49 52 ); 50 53 … … 57 60 $variables['threads'] = $threads; 58 61 59 // required template variables60 $variables['rows'] = $rows;61 $variables['rowstart'] = $rowstart;62 63 62 // define the search body panel variables 64 63 $template_panels[] = array('type' => 'body', 'name' => 'my_threads', 'template' => 'modules.forum_threads_list_panel.my_threads.tpl'); -
modules/common/forum_threads_list_panel/php-files/modules/forum_threads_list_panel/new_posts.php
r1282 r1318 37 37 WHERE tr.user_id = '".$userdata['user_id']."' 38 38 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 39 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 39 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 40 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 40 41 GROUP BY p.thread_id 41 42 "); 42 43 // update the last_read datestamp of all threads found 43 44 while ($data = dbarray($result)) { 44 $result2 = dbquery("UPDATE ".$db_prefix."threads_read SET thread_ last_read = '".time()."' WHERE user_id = '".$userdata['user_id']."' AND thread_id = '".$data['thread_id']."'");45 $result2 = dbquery("UPDATE ".$db_prefix."threads_read SET thread_first_read = '0', thread_last_read = '".time()."' WHERE user_id = '".$userdata['user_id']."' AND thread_id = '".$data['thread_id']."'"); 45 46 } 46 47 // done, fall back to the homepage … … 53 54 // check if there are any unread posts for this user 54 55 if ($userdata['user_posts_unread']) { 55 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 56 $result = dbquery(" 57 SELECT count(*) as unread 58 FROM ".$db_prefix."posts p 59 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 60 WHERE tr.user_id = '".$userdata['user_id']."' 61 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 62 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 63 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 64 ); 56 65 } else { 57 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 58 } 66 $result = dbquery(" 67 SELECT count(*) as unread 68 FROM ".$db_prefix."posts p 69 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 70 WHERE tr.user_id = '".$userdata['user_id']."' 71 AND p.post_author != '".$userdata['user_id']."' 72 AND p.post_edituser != '".$userdata['user_id']."' 73 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 74 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 75 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 76 ); 77 } 59 78 $variables['unread'] = ($result ? mysql_result($result, 0) : 0); 79 80 // make sure rowstart has a valid value 81 if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0; 82 $variables['rowstart'] = $rowstart; 60 83 61 84 // and if so, get them … … 67 90 $result = dbquery(" 68 91 SELECT p.forum_id, p.thread_id, count( * ) AS unread, f.forum_name, f.forum_cat, t.thread_subject, t.thread_views, t.thread_lastpost, MIN( p.post_id ) AS post_id 69 FROM ".$db_prefix."posts p 92 FROM ".$db_prefix."posts p 70 93 LEFT JOIN ".$db_prefix."forums f ON p.forum_id = f.forum_id 71 94 LEFT JOIN ".$db_prefix."threads t ON p.thread_id = t.thread_id 72 95 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 73 WHERE tr.user_id = '".$userdata['user_id']."' 96 WHERE tr.user_id = '".$userdata['user_id']."' 74 97 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 75 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 98 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 99 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 76 100 GROUP BY p.thread_id 77 "); 101 ORDER BY t.thread_lastpost ASC 102 LIMIT ".$rowstart.", ".ITEMS_PER_PAGE 103 ); 78 104 } else { 79 105 $result = dbquery(" 80 106 SELECT p.forum_id, p.thread_id, count( * ) AS unread, f.forum_name, f.forum_cat, t.thread_subject, t.thread_views, t.thread_lastpost, MIN( p.post_id ) AS post_id 81 FROM ".$db_prefix."posts p 107 FROM ".$db_prefix."posts p 82 108 LEFT JOIN ".$db_prefix."forums f ON p.forum_id = f.forum_id 83 109 LEFT JOIN ".$db_prefix."threads t ON p.thread_id = t.thread_id 84 110 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 85 WHERE tr.user_id = '".$userdata['user_id']."' 111 WHERE tr.user_id = '".$userdata['user_id']."' 86 112 AND p.post_author != '".$userdata['user_id']."' 87 113 AND p.post_edituser != '".$userdata['user_id']."' 88 114 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 89 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 115 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 116 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 90 117 GROUP BY p.thread_id 91 "); 92 } 118 ORDER BY t.thread_lastpost ASC 119 LIMIT ".$rowstart.", ".ITEMS_PER_PAGE 120 ); 121 } 93 122 // get the number of unread threads 94 123 $rows = dbrows($result); 95 124 $variables['rows'] = $rows; 96 97 // make sure rowstart has a valid value98 if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;99 $variables['rowstart'] = $rowstart;100 125 101 126 // add additional info to the data retrieved -
modules/common/forum_threads_list_panel/php-files/modules/forum_threads_list_panel/new_posts_detail.php
r1282 r1318 37 37 WHERE tr.user_id = '".$userdata['user_id']."' 38 38 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 39 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 39 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 40 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 40 41 GROUP BY p.thread_id 41 42 "); 42 43 // update the last_read datestamp of all threads found 43 44 while ($data = dbarray($result)) { 44 $result2 = dbquery("UPDATE ".$db_prefix."threads_read SET thread_ last_read = '".time()."' WHERE user_id = '".$userdata['user_id']."' AND thread_id = '".$data['thread_id']."'");45 $result2 = dbquery("UPDATE ".$db_prefix."threads_read SET thread_first_read = '0', thread_last_read = '".time()."' WHERE user_id = '".$userdata['user_id']."' AND thread_id = '".$data['thread_id']."'"); 45 46 } 46 47 // done, fall back to the homepage … … 53 54 // check if there are any unread threads for this user 54 55 if ($userdata['user_posts_unread']) { 55 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) GROUP BY tr.thread_id", false); 56 $result = dbquery(" 57 SELECT count(*) as unread, tr.thread_id 58 FROM ".$db_prefix."posts p 59 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 60 WHERE tr.user_id = '".$userdata['user_id']."' 61 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 62 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 63 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 64 GROUP BY tr.thread_id" 65 ); 56 66 } else { 57 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edittime != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) GROUP BY tr.thread_id", false); 58 } 59 if (dbrows($result)) { 60 $data = dbarray($result); 61 $variables['threads'] = $data['unread']; 62 } else { 63 $variables['threads'] = 0; 64 } 67 $result = dbquery(" 68 SELECT count(*) as unread, tr.thread_id 69 FROM ".$db_prefix."posts p 70 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 71 WHERE tr.user_id = '".$userdata['user_id']."' 72 AND p.post_author != '".$userdata['user_id']."' 73 AND p.post_edituser != '".$userdata['user_id']."' 74 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 75 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 76 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 77 GROUP BY tr.thread_id" 78 ); 79 } 80 $variables['threads'] = dbrows($result); 65 81 66 // if any data found82 // if there are unread threads ... 67 83 if ($variables['threads']) { 68 84 69 // check if there are any unread threads for this user85 // get the unread posts 70 86 if ($userdata['user_posts_unread']) { 71 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 87 $result = dbquery(" 88 SELECT count(*) as unread 89 FROM ".$db_prefix."posts p 90 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 91 WHERE tr.user_id = '".$userdata['user_id']."' 92 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 93 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 94 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 95 ); 72 96 } else { 73 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 74 } 75 if (dbrows($result)) { 76 $data = dbarray($result); 77 $variables['rows'] = $data['unread']; 78 } else { 79 $variables['rows'] = 0; 80 } 97 $result = dbquery(" 98 SELECT count(*) as unread 99 FROM ".$db_prefix."posts p 100 LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 101 WHERE tr.user_id = '".$userdata['user_id']."' 102 AND p.post_author != '".$userdata['user_id']."' 103 AND p.post_edituser != '".$userdata['user_id']."' 104 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 105 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 106 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read)))" 107 ); 108 } 109 $variables['rows'] = ($result ? mysql_result($result, 0) : 0); 81 110 82 111 // make sure rowstart has a valid value … … 95 124 WHERE tr.user_id = '".$userdata['user_id']."' 96 125 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 97 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 98 ORDER BY post_datestamp ASC LIMIT $rowstart,".ITEMS_PER_PAGE 126 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 127 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 128 ORDER BY post_datestamp ASC 129 LIMIT $rowstart,".ITEMS_PER_PAGE 99 130 ); 100 131 } else { … … 110 141 AND p.post_edituser != '".$userdata['user_id']."' 111 142 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") 112 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 113 ORDER BY post_datestamp ASC LIMIT $rowstart,".ITEMS_PER_PAGE 143 AND ((p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 144 OR (p.post_datestamp < tr.thread_first_read OR (p.post_edittime != 0 AND p.post_edittime < tr.thread_first_read))) 145 ORDER BY post_datestamp ASC 146 LIMIT $rowstart,".ITEMS_PER_PAGE 114 147 ); 115 148 } -
modules/common/forum_threads_list_panel/php-files/modules/forum_threads_list_panel/templates/modules.forum_threads_list_panel.new_posts_detail.tpl
r1197 r1318 51 51 <tr> 52 52 <td align='center' colspan='4' class='{cycle values='tbl1,tbl2'}'> 53 {if $ rows == 1}54 {if $ threads == 1}53 {if $threads == 1} 54 {if $rows == 1} 55 55 <b>{$locale.039a}</b> 56 56 {else}
Note: See TracChangeset
for help on using the changeset viewer.
