Changeset 25084 for trunk/admin/comments.php
- Timestamp:
- Oct 22, 2013, 10:39:10 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/comments.php
r25018 r25084 98 98 // +-----------------------------------------------------------------------+ 99 99 100 $list = array(); 100 $nb_total = 0; 101 $nb_pending = 0; 101 102 102 103 $query = ' 103 SELECT c.id, c.image_id, c.date, c.author, '. 104 $conf['user_fields']['username'].' AS username, c.content, i.path, i.representative_ext 104 SELECT 105 COUNT(*) AS counter, 106 validated 107 FROM '.COMMENTS_TABLE.' 108 GROUP BY validated 109 ;'; 110 $result = pwg_query($query); 111 while ($row = pwg_db_fetch_assoc($result)) 112 { 113 $nb_total+= $row['counter']; 114 115 if ('false' == $row['validated']) 116 { 117 $nb_pending = $row['counter']; 118 } 119 } 120 121 if (!isset($_GET['filter']) and $nb_pending > 0) 122 { 123 $page['filter'] = 'pending'; 124 } 125 else 126 { 127 $page['filter'] = 'all'; 128 } 129 130 if (isset($_GET['filter']) and 'pending' == $_GET['filter']) 131 { 132 $page['filter'] = $_GET['filter']; 133 } 134 135 $template->assign( 136 array( 137 'nb_total' => $nb_total, 138 'nb_pending' => $nb_pending, 139 'filter' => $page['filter'], 140 ) 141 ); 142 143 $where_clauses = array('1=1'); 144 145 if ('pending' == $page['filter']) 146 { 147 $where_clauses[] = 'validated=\'false\''; 148 } 149 150 $query = ' 151 SELECT 152 c.id, 153 c.image_id, 154 c.date, 155 c.author, 156 '.$conf['user_fields']['username'].' AS username, 157 c.content, 158 i.path, 159 i.representative_ext, 160 validated 105 161 FROM '.COMMENTS_TABLE.' AS c 106 162 INNER JOIN '.IMAGES_TABLE.' AS i … … 108 164 LEFT JOIN '.USERS_TABLE.' AS u 109 165 ON u.'.$conf['user_fields']['id'].' = c.author_id 110 WHERE validated = \'false\'166 WHERE '.implode(' AND ', $where_clauses).' 111 167 ORDER BY c.date DESC 112 168 ;'; … … 136 192 'AUTHOR' => trigger_event('render_comment_author', $author_name), 137 193 'DATE' => format_date($row['date'], true), 138 'CONTENT' => trigger_event('render_comment_content',$row['content']) 194 'CONTENT' => trigger_event('render_comment_content',$row['content']), 195 'IS_PENDING' => ('false' == $row['validated']), 139 196 ) 140 197 ); … … 143 200 } 144 201 145 $template->assign('LIST', implode(',', $list) );146 147 202 // +-----------------------------------------------------------------------+ 148 203 // | sending html code |
Note: See TracChangeset
for help on using the changeset viewer.