Changeset 26089 for extensions/Comments_on_Albums
- Timestamp:
- Dec 22, 2013, 8:30:51 PM (10 years ago)
- Location:
- extensions/Comments_on_Albums/trunk
- Files:
-
- 2 added
- 5 deleted
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_on_Albums/trunk/admin.php
r23490 r26089 1 1 <?php 2 2 /* Code adapted from admin/comments.php */ 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 5 global $template, $conf, $user; 6 load_language('plugin.lang', COA_PATH); 7 8 // +-----------------------------------------------------------------------+ 9 // | tabsheet | 10 // +-----------------------------------------------------------------------+ 11 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 12 13 if (isset($_GET['section']) and $_GET['section'] == 'albums') 14 { 15 $page['tab'] = 'albums'; 16 } 17 else 18 { 19 $page['tab'] = 'pictures'; 20 } 21 22 $tabsheet = new tabsheet(); 23 $tabsheet->add('pictures', l10n('Comments on photos'), get_root_url().'admin.php?page=comments'); 24 $tabsheet->add('albums', l10n('Comments on albums'), get_root_url().'admin.php?page=comments&section=albums'); 25 $tabsheet->select($page['tab']); 26 $tabsheet->assign(); 27 28 29 if ($page['tab'] == 'albums') 30 { 31 // clear template sended by original page 32 $template->clear_assign(array('ADMIN_CONTENT', 'comments', 'LIST', 'F_ACTION')); 33 34 // +-----------------------------------------------------------------------+ 35 // | actions | 36 // +-----------------------------------------------------------------------+ 37 if (!empty($_POST)) 38 { 39 if (empty($_POST['comments'])) 3 defined('COA_ID') or die('Hacking attempt!'); 4 5 $page['active_menu'] = get_active_menu('comments'); 6 7 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 8 9 if (isset($_GET['start']) and is_numeric($_GET['start'])) 10 { 11 $page['start'] = $_GET['start']; 12 } 13 else 14 { 15 $page['start'] = 0; 16 } 17 18 // +-----------------------------------------------------------------------+ 19 // | Check Access and exit when user status is not ok | 20 // +-----------------------------------------------------------------------+ 21 22 check_status(ACCESS_ADMINISTRATOR); 23 24 // +-----------------------------------------------------------------------+ 25 // | actions | 26 // +-----------------------------------------------------------------------+ 27 if (!empty($_POST)) 28 { 29 if (empty($_POST['comments'])) 30 { 31 $page['errors'][] = l10n('Select at least one comment'); 32 } 33 else 34 { 35 include_once(COA_PATH.'include/functions_comment.inc.php'); 36 check_input_parameter('comments', $_POST, true, PATTERN_ID); 37 38 if (isset($_POST['validate'])) 40 39 { 41 array_push( 42 $page['errors'], 43 l10n('Select at least one comment') 40 validate_user_comment_albums($_POST['comments']); 41 42 $page['infos'][] = l10n_dec( 43 '%d user comment validated', '%d user comments validated', 44 count($_POST['comments']) 44 45 ); 45 46 } 46 else 47 48 if (isset($_POST['reject'])) 47 49 { 48 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom functions 49 check_input_parameter('comments', $_POST, true, PATTERN_ID); 50 51 if (isset($_POST['validate_albums'])) 52 { 53 validate_user_comment_albums($_POST['comments']); 54 55 array_push( 56 $page['infos'], 57 l10n_dec( 58 '%d user comment validated', '%d user comments validated', 59 count($_POST['comments']) 60 ) 61 ); 62 } 63 64 if (isset($_POST['reject_albums'])) 65 { 66 delete_user_comment_albums($_POST['comments']); 67 68 array_push( 69 $page['infos'], 70 l10n_dec( 71 '%d user comment rejected', '%d user comments rejected', 72 count($_POST['comments']) 73 ) 74 ); 75 } 50 delete_user_comment_albums($_POST['comments']); 51 52 $page['infos'][] = l10n_dec( 53 '%d user comment rejected', '%d user comments rejected', 54 count($_POST['comments']) 55 ); 76 56 } 77 57 } 78 79 // +-----------------------------------------------------------------------+ 80 // | template init | 81 // +-----------------------------------------------------------------------+ 82 83 $template->set_filename('comments', dirname(__FILE__) .'/../template/admin_comments.tpl'); 84 85 $template->assign( 86 array( 87 'F_ACTION' => get_root_url().'admin.php?page=comments&section=albums' 88 ) 89 ); 90 91 if (count($page['infos']) != 0) 92 { 93 $template->assign('infos', $page['infos']); 94 } 95 96 // +-----------------------------------------------------------------------+ 97 // | comments display | 98 // +-----------------------------------------------------------------------+ 99 $list = array(); 100 101 $query = ' 102 SELECT 103 com.id, 104 com.category_id, 105 com.date, 58 } 59 60 // +-----------------------------------------------------------------------+ 61 // | template init | 62 // +-----------------------------------------------------------------------+ 63 64 $template->set_filename('comments', 'comments.tpl'); 65 $template->set_prefilter('comments', 'coa_admin_add_category_name'); 66 67 $template->assign('F_ACTION', COA_ADMIN); 68 69 // +-----------------------------------------------------------------------+ 70 // | Tabs | 71 // +-----------------------------------------------------------------------+ 72 73 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 74 75 $tabsheet = new tabsheet(); 76 $tabsheet->set_id('comments'); 77 $tabsheet->select('albums'); 78 $tabsheet->assign(); 79 80 // +-----------------------------------------------------------------------+ 81 // | comments display | 82 // +-----------------------------------------------------------------------+ 83 84 $nb_total = 0; 85 $nb_pending = 0; 86 87 $query = ' 88 SELECT 89 COUNT(*) AS counter, 90 validated 91 FROM '.COA_TABLE.' 92 GROUP BY validated 93 ;'; 94 $result = pwg_query($query); 95 while ($row = pwg_db_fetch_assoc($result)) 96 { 97 $nb_total+= $row['counter']; 98 99 if ('false' == $row['validated']) 100 { 101 $nb_pending = $row['counter']; 102 } 103 } 104 105 if (!isset($_GET['filter']) and $nb_pending > 0) 106 { 107 $page['filter'] = 'pending'; 108 } 109 else 110 { 111 $page['filter'] = 'all'; 112 } 113 114 if (isset($_GET['filter']) and 'pending' == $_GET['filter']) 115 { 116 $page['filter'] = 'pending'; 117 } 118 119 $template->assign( 120 array( 121 'nb_total' => $nb_total, 122 'nb_pending' => $nb_pending, 123 'filter' => $page['filter'], 124 ) 125 ); 126 127 $where_clauses = array('1=1'); 128 129 if ('pending' == $page['filter']) 130 { 131 $where_clauses[] = 'validated=\'false\''; 132 } 133 134 $query = ' 135 SELECT 136 com.id, 137 com.category_id, 138 com.date, 106 139 com.author, 107 u.'.$conf['user_fields']['username'].' AS username, 108 com.content, 140 u.'.$conf['user_fields']['username'].' AS username, 141 com.content, 109 142 cat.name, 110 143 img.id AS image_id, 111 img.path 144 img.path, 145 com.validated 112 146 FROM '.COA_TABLE.' AS com 113 147 LEFT JOIN '.CATEGORIES_TABLE.' AS cat … … 115 149 LEFT JOIN '.USERS_TABLE.' AS u 116 150 ON u.'.$conf['user_fields']['id'].' = com.author_id 117 LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 151 LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 118 152 ON ucc.cat_id = com.category_id AND ucc.user_id = '.$user['id'].' 119 153 LEFT JOIN '.IMAGES_TABLE.' AS img 120 154 ON img.id = ucc.user_representative_picture_id 121 WHERE validated = \'false\'155 WHERE '.implode(' AND ', $where_clauses).' 122 156 ORDER BY com.date DESC 157 LIMIT '.$page['start'].', '.$conf['comments_page_nb_comments'].' 123 158 ;'; 124 $result = pwg_query($query); 125 126 while ($row = pwg_db_fetch_assoc($result)) 127 { 128 // author 129 if (empty($row['author_id'])) 130 { 131 $author_name = $row['author']; 132 } 133 else 134 { 135 $author_name = stripslashes($row['username']); 136 } 137 138 // thumbnail 139 $row['thumb'] = DerivativeImage::thumb_url( 140 array( 141 'id'=>$row['image_id'], 142 'path'=>$row['path'], 143 ) 144 ); 145 146 // comment content 147 $template->append( 148 'comments', 149 array( 150 'ID' => $row['id'], 151 'CAT_URL' => PHPWG_ROOT_PATH.'admin.php?page=album-'.$row['category_id'], 152 'CAT_NAME' => trigger_event('render_category_name', $row['name']), 153 'TN_SRC' => $row['thumb'], 154 'AUTHOR' => trigger_event('render_comment_author', $author_name), 155 'DATE' => format_date($row['date'], true), 156 'CONTENT' => trigger_event('render_comment_content', $row['content'], 'album'), 157 ) 158 ); 159 160 array_push($list, $row['id']); 161 } 162 163 $template->assign('LIST', implode(',', $list)); 164 165 // +-----------------------------------------------------------------------+ 166 // | sending html code | 167 // +-----------------------------------------------------------------------+ 168 169 $template->assign_var_from_handle('ADMIN_CONTENT', 'comments'); 170 171 } 172 173 ?> 159 $result = pwg_query($query); 160 161 while ($row = pwg_db_fetch_assoc($result)) 162 { 163 $thumb = DerivativeImage::thumb_url( 164 array( 165 'id'=>$row['image_id'], 166 'path'=>$row['path'], 167 ) 168 ); 169 170 if (empty($row['author_id'])) 171 { 172 $author_name = $row['author']; 173 } 174 else 175 { 176 $author_name = stripslashes($row['username']); 177 } 178 179 $template->append( 180 'comments', 181 array( 182 'ID' => $row['id'], 183 'U_PICTURE' => get_root_url().'admin.php?page=album-'.$row['category_id'], 184 'CATEGORY_NAME' => trigger_change('render_category_name', $row['name']), 185 'TN_SRC' => $thumb, 186 'AUTHOR' => trigger_change('render_comment_author', $author_name), 187 'DATE' => format_date($row['date'], true), 188 'CONTENT' => trigger_change('render_comment_content', $row['content'], 'album'), 189 'IS_PENDING' => ('false' == $row['validated']), 190 ) 191 ); 192 } 193 194 // +-----------------------------------------------------------------------+ 195 // | navigation bar | 196 // +-----------------------------------------------------------------------+ 197 198 $navbar = create_navigation_bar( 199 get_root_url().'admin.php'.get_query_string_diff(array('start')), 200 ('pending' == $page['filter'] ? $nb_pending : $nb_total), 201 $page['start'], 202 $conf['comments_page_nb_comments'] 203 ); 204 205 $template->assign('navbar', $navbar); 206 207 // +-----------------------------------------------------------------------+ 208 // | sending html code | 209 // +-----------------------------------------------------------------------+ 210 211 $template->assign_var_from_handle('ADMIN_CONTENT', 'comments'); 212 213 214 function coa_admin_add_category_name($content) 215 { 216 $search = '<img src="{$comment.TN_SRC}">'; 217 $add = '<br>{$comment.CATEGORY_NAME}'; 218 return str_replace($search, $search.$add, $content); 219 } -
extensions/Comments_on_Albums/trunk/include/coa_albums.php
r21347 r26089 1 1 <?php 2 2 /* Code adapted from include/picture_comment.inc.php and picture.php */ 3 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');4 5 global $ conf, $user;3 defined('COA_ID') or die('Hacking attempt!'); 4 5 global $template, $page, $conf, $pwg_loaded_plugins, $user; 6 6 7 7 // +-----------------------------------------------------------------------+ … … 12 12 $url_self = duplicate_index_url(array( 13 13 'category' => array( 14 'id' => $category['id'], 15 'name' => $category['name'], 14 'id' => $category['id'], 15 'name' => $category['name'], 16 16 'permalink' => $category['permalink'] 17 ), 17 ), 18 18 array('start') 19 19 )); … … 23 23 // | actions | 24 24 // +-----------------------------------------------------------------------+ 25 if (isset($_GET['action'])) 25 if (isset($_GET['action'])) 26 26 { 27 switch ($_GET['action']) 28 { 29 case 'edit_comment' : 30 { 31 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions27 switch ($_GET['action']) 28 { 29 case 'edit_comment' : 30 { 31 include_once(COA_PATH.'include/functions_comment.inc.php'); 32 32 check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID); 33 33 $author_id = get_comment_author_id_albums($_GET['comment_to_edit']); 34 34 35 if (can_manage_comment('edit', $author_id)) 36 { 37 if (!empty($_POST['content'])) 35 if (can_manage_comment('edit', $author_id)) 36 { 37 if (!empty($_POST['content'])) 38 38 { 39 39 check_pwg_token(); … … 42 42 'comment_id' => $_GET['comment_to_edit'], 43 43 'category_id' => $category['id'], 44 'content' => $_POST['content'] 44 'content' => $_POST['content'], 45 'website_url' => @$_POST['website_url'], 45 46 ), 46 47 $_POST['key'] 47 48 ); 48 49 49 50 $perform_redirect = false; 50 51 switch ($comment_action) … … 69 70 } 70 71 unset($_POST['content']); 71 } 72 else 72 } 73 else 73 74 { 74 75 $edit_comment = $_GET['comment_to_edit']; 75 76 } 77 78 $template->assign('DISPLAY_COMMENTS_BLOCK', true); 76 79 break; 77 80 } 78 81 } 79 case 'delete_comment' : 82 case 'delete_comment' : 80 83 { 81 84 check_pwg_token(); 82 83 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions84 85 86 include_once(COA_PATH.'include/functions_comment.inc.php'); 87 85 88 check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID); 86 89 87 90 $author_id = get_comment_author_id_albums($_GET['comment_to_delete']); 88 91 89 if (can_manage_comment('delete', $author_id)) 92 if (can_manage_comment('delete', $author_id)) 90 93 { 91 94 delete_user_comment_albums($_GET['comment_to_delete']); … … 94 97 redirect($url_self); 95 98 } 96 case 'validate_comment' : 99 case 'validate_comment' : 97 100 { 98 101 check_pwg_token(); 99 100 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions101 102 103 include_once(COA_PATH.'include/functions_comment.inc.php'); 104 102 105 check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID); 103 106 104 107 $author_id = get_comment_author_id_albums($_GET['comment_to_validate']); 105 108 106 if (can_manage_comment('validate', $author_id)) 109 if (can_manage_comment('validate', $author_id)) 107 110 { 108 111 validate_user_comment_albums($_GET['comment_to_validate']); … … 118 121 // | insert comment | 119 122 // +-----------------------------------------------------------------------+ 120 if ($category['commentable'] and isset($_POST['content'])) 123 if ($category['commentable'] and isset($_POST['content'])) 121 124 { 122 if (is_a_guest() and !$conf['comments_forall']) 125 if (is_a_guest() and !$conf['comments_forall']) 123 126 { 124 127 die('Session expired'); 125 128 } 126 129 127 130 $comm = array( 128 131 'author' => trim( @$_POST['author'] ), … … 133 136 ); 134 137 135 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions136 138 include_once(COA_PATH.'include/functions_comment.inc.php'); 139 137 140 $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $page['errors']); 138 141 139 switch ($comment_action) 142 switch ($comment_action) 140 143 { 141 144 case 'moderate': 142 array_push($page['infos'], l10n('An administrator must authorize your comment before it is visible.'));145 $page['infos'][] = l10n('An administrator must authorize your comment before it is visible.'); 143 146 case 'validate': 144 array_push($page['infos'], l10n('Your comment has been registered'));147 $page['infos'][] = l10n('Your comment has been registered'); 145 148 break; 146 149 case 'reject': 147 150 set_status_header(403); 148 array_push($page['errors'], l10n('Your comment has NOT been registered because it did not pass the validation rules'));151 $page['errors'][] = l10n('Your comment has NOT been registered because it did not pass the validation rules'); 149 152 break; 150 153 default: 151 154 trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING); 152 155 } 153 156 154 157 // allow plugins to notify what's going on 155 158 trigger_action( 'user_comment_insertion', 156 159 array_merge($comm, array('action'=>$comment_action) ) 157 160 ); 158 161 159 162 $template->assign('DISPLAY_COMMENTS_BLOCK', true); 160 } 161 else if (isset($_POST['content'])) 163 } 164 else if (isset($_POST['content'])) 162 165 { 163 166 set_status_header(403); … … 169 172 // | display comments | 170 173 // +-----------------------------------------------------------------------+ 171 if ($category['commentable']) 174 if ($category['commentable']) 172 175 { 173 if (!is_admin()) 176 if (isset($_GET['coa_open'])) 177 { 178 $template->assign('DISPLAY_COMMENTS_BLOCK', true); 179 } 180 181 if (!is_admin()) 174 182 { 175 183 $validated_clause = " AND validated = 'true'"; 176 } 177 else 184 } 185 else 178 186 { 179 187 $validated_clause = null; … … 182 190 // number of comments for this category 183 191 $query = ' 184 SELECT 192 SELECT 185 193 COUNT(*) AS nb_comments 186 194 FROM '.COA_TABLE.' … … 190 198 $row = pwg_db_fetch_assoc(pwg_query($query)); 191 199 192 // navigation bar creation, can't use $_GET['start'] because used by thumbnails navigation bar 193 if (isset($_GET['start_comments'])) 200 // navigation bar creation 201 // can't use $_GET['start'] because used by thumbnails navigation bar 202 if (isset($_GET['start_comments'])) 194 203 { 195 204 $page['start_comments'] = $_GET['start_comments']; 196 } 197 else 205 } 206 else 198 207 { 199 208 $page['start_comments'] = 0; 200 209 } 201 include_once(COA_PATH.'include/functions.inc.php'); // custom fonctions 202 203 $navigation_bar = create_comment_navigation_bar( 204 duplicate_index_url(array(), array('start')), 210 211 $navigation_bar = create_navigation_bar( 212 add_url_params(duplicate_index_url(array(), array('start_comments')), array('coa_open'=>null)), 205 213 $row['nb_comments'], 206 214 $page['start_comments'], 207 $conf['nb_comment_page'] 215 $conf['nb_comment_page'], 216 false, 217 'start_comments' 208 218 ); 209 219 … … 215 225 ); 216 226 217 if ($row['nb_comments'] > 0) 227 if ($row['nb_comments'] > 0) 218 228 { 219 229 // comments order (get, session, conf) … … 225 235 226 236 $template->assign(array( 227 'COMMENTS_ORDER_URL' => add_url_params( duplicate_index_url(), array('comments_order'=> ($comments_order == 'ASC' ? 'DESC' : 'ASC')) ),237 'COMMENTS_ORDER_URL' => add_url_params(duplicate_index_url(), array('comments_order'=> ($comments_order == 'ASC' ? 'DESC' : 'ASC'), 'coa_open'=>null ) ), 228 238 'COMMENTS_ORDER_TITLE' => $comments_order == 'ASC' ? l10n('Show latest comments first') : l10n('Show oldest comments first'), 229 239 )); 230 240 231 241 // get comments 232 242 $query = ' … … 235 245 com.author, 236 246 com.author_id, 237 u.'.$conf['user_fields']['username'].' AS username,238 247 u.'.$conf['user_fields']['email'].' AS user_email, 248 com.date, 249 com.category_id, 250 com.website_url, 239 251 com.email, 240 com.date,241 com.website_url,242 com.category_id,243 252 com.content, 244 253 com.validated … … 253 262 $result = pwg_query($query); 254 263 255 while ($row = pwg_db_fetch_assoc($result)) 264 while ($row = pwg_db_fetch_assoc($result)) 256 265 { 257 266 if ($row['author'] == 'guest') … … 259 268 $row['author'] = l10n('guest'); 260 269 } 261 270 262 271 $email = null; 263 272 if (!empty($row['user_email'])) … … 269 278 $email = $row['email']; 270 279 } 271 280 272 281 // comment content 273 282 $tpl_comment = array( … … 275 284 'AUTHOR' => trigger_event('render_comment_author', $row['author']), 276 285 'DATE' => format_date($row['date'], true), 286 'CONTENT' => trigger_event('render_comment_content', $row['content'], 'album'), 277 287 'WEBSITE_URL' => $row['website_url'], 278 'CONTENT' => trigger_event('render_comment_content', $row['content'], 'album'),279 288 ); 280 289 281 290 // rights 282 if (can_manage_comment('delete', $row['author_id'])) 291 if (can_manage_comment('delete', $row['author_id'])) 283 292 { 284 293 $tpl_comment['U_DELETE'] = add_url_params( 285 $url_self, 294 $url_self, 286 295 array( 287 296 'action' => 'delete_comment', … … 291 300 ); 292 301 } 293 if (can_manage_comment('edit', $row['author_id'])) 302 if (can_manage_comment('edit', $row['author_id'])) 294 303 { 295 304 $tpl_comment['U_EDIT'] = add_url_params( 296 $url_self, 305 $url_self, 297 306 array( 298 307 'action' => 'edit_comment', … … 300 309 ) 301 310 ); 302 if (isset($edit_comment) and ($row['id'] == $edit_comment)) 311 if (isset($edit_comment) and ($row['id'] == $edit_comment)) 303 312 { 304 313 $tpl_comment['IN_EDIT'] = true; … … 307 316 $tpl_comment['CONTENT'] = $row['content']; 308 317 $tpl_comment['PWG_TOKEN'] = get_pwg_token(); 318 $tpl_comment['U_CANCEL'] = $url_self; 309 319 } 310 320 } … … 312 322 { 313 323 $tpl_comment['EMAIL'] = $email; 314 315 if ($row['validated'] != 'true') 324 325 if ($row['validated'] != 'true') 316 326 { 317 327 $tpl_comment['U_VALIDATE'] = add_url_params( 318 $url_self, 328 $url_self, 319 329 array( 320 330 'action' => 'validate_comment', … … 325 335 } 326 336 } 327 337 328 338 $template->append('comments', $tpl_comment); 329 339 } … … 332 342 // comment form 333 343 $show_add_comment_form = true; 334 if (isset($edit_comment)) 344 if (isset($edit_comment)) 335 345 { 336 346 $show_add_comment_form = false; 337 347 } 338 if (is_a_guest() and !$conf['comments_forall']) 348 if (is_a_guest() and !$conf['comments_forall']) 339 349 { 340 350 $show_add_comment_form = false; 341 351 } 342 352 343 if ($show_add_comment_form) 353 if ($show_add_comment_form) 344 354 { 345 355 $key = get_ephemeral_key(3, $category['id']); 346 347 $template->assign('comment_add', 348 array( 356 357 $tpl_var = array( 349 358 'F_ACTION' => $url_self, 350 359 'KEY' => $key, 351 'CONTENT' => stripslashes(@$_POST['content']),360 'CONTENT' => '', 352 361 'SHOW_AUTHOR' => !is_classic_user(), 353 362 'AUTHOR_MANDATORY' => $conf['comments_author_mandatory'], 354 'AUTHOR' => stripslashes(@$_POST['author']),355 'WEBSITE_URL' => stripslashes(@$_POST['website_url']),363 'AUTHOR' => '', 364 'WEBSITE_URL' => '', 356 365 'SHOW_EMAIL' => !is_classic_user() or empty($user['email']), 357 366 'EMAIL_MANDATORY' => $conf['comments_email_mandatory'], 358 'EMAIL' => stripslashes(@$_POST['email']), 359 ) 360 ); 361 } 362 367 'EMAIL' => '', 368 ); 369 370 if ('reject'==@$comment_action) 371 { 372 foreach (array('content', 'author', 'website_url', 'email') as $k) 373 { 374 $tpl_var[strtoupper($k)] = htmlspecialchars( stripslashes(@$_POST[$k]) ); 375 } 376 } 377 $template->assign('comment_add', $tpl_var); 378 } 379 363 380 // template 364 381 $template->assign(array( 365 'COA_PATH' => COA_PATH, // for css366 'COA_ABSOLUTE_PATH' => dirname(__FILE__) .'/../', // for template382 'COA_PATH' => COA_PATH, 383 'COA_ABSOLUTE_PATH' => realpath(COA_PATH) . '/', 367 384 )); 368 369 $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/albums.tpl'); 370 if (isset($pwg_loaded_plugins['rv_tscroller']) AND count($page['navigation_bar']) != 0) 385 386 $template->set_filename('comments_on_albums', realpath(COA_PATH . 'template/albums.tpl')); 387 388 if (isset($pwg_loaded_plugins['rv_tscroller']) and count($page['navigation_bar']) != 0) 371 389 { 372 390 $template->assign('COMMENTS_ON_TOP', true); … … 378 396 } 379 397 } 380 381 ?> -
extensions/Comments_on_Albums/trunk/include/coa_comments_page.php
r24609 r26089 1 <?php 1 <?php 2 2 /* inspired by comments.php */ 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 load_language('plugin.lang', COA_PATH); 3 defined('COA_ID') or die('Hacking attempt!'); 4 5 global $template, $page, $conf, $user; 5 6 6 7 // +-----------------------------------------------------------------------+ … … 10 11 $template->set_prefilter('comments', 'coa_add_button'); 11 12 12 function coa_add_button($content, &$smarty) 13 { 13 function coa_add_button($content, &$smarty) 14 { 14 15 $search ='<form class="filter" action="{$F_ACTION}" method="get">'; 15 $replacement = ' 16 <form class="filter"> 16 17 $add = ' 17 18 <fieldset> 18 <legend>{\'Display comments on\'|@translate}</legend> 19 <span style="font-size:1.1em;"><a href="comments.php" {if $COA_MODE=="photos"}style="font-weight:bold;"{/if}>{\'Photos\'|@translate}</a> | 20 <a href="comments.php?display_mode=albums" {if $COA_MODE=="albums"}style="font-weight:bold;"{/if}>{\'Albums\'|@translate}</a></span> 21 </fieldset> 22 </form>'; 23 24 return str_replace($search, $replacement.$search, $content); 19 <legend>{\'Display comments on\'|@translate}</legend> 20 <span style="font-size:1.1em;"><a href="comments.php" {if $COA_MODE=="photos"}style="font-weight:bold;"{/if}>{\'Photos\'|@translate}</a> | 21 <a href="comments.php?display_mode=albums" {if $COA_MODE=="albums"}style="font-weight:bold;"{/if}>{\'Albums\'|@translate}</a></span> 22 </fieldset>'; 23 24 return str_replace($search, $add.$search, $content); 25 25 } 26 26 … … 29 29 // comments on albums page | 30 30 // +-----------------------------------------------------------------------+ 31 if ( isset($_GET['display_mode']) and $_GET['display_mode'] == 'albums' ) 32 { 33 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom functions 34 35 // reset some template vars 36 $template->clear_assign(array('comments', 'navbar', 'sort_by_options')); 37 38 // sort_by : database fields proposed for sorting comments list 39 $sort_by = array( 40 'date' => l10n('comment date'), 41 'category_id' => l10n('album') 42 ); 43 $template->assign('sort_by_options', $sort_by); 44 45 // clean where_clauses from unknown column 46 foreach ($page['where_clauses'] as &$cond) 47 { 48 if (strpos($cond, 'ic.image_id') !== false) 49 { 50 $cond = get_sql_condition_FandF(array( 31 if (!isset($_GET['display_mode']) or $_GET['display_mode'] != 'albums') 32 { 33 return; 34 } 35 36 $url_self = PHPWG_ROOT_PATH.'comments.php' 37 .get_query_string_diff(array('edit_albums','delete_albums','validate_albums','pwg_token')); 38 39 // reset some template vars 40 $template->clear_assign(array('F_ACTION', 'comments', 'navbar', 'sort_by_options')); 41 42 // sort_by : database fields proposed for sorting comments list 43 global $sort_by; 44 $sort_by = array( 45 'date' => l10n('comment date'), 46 'category_id' => l10n('Album') 47 ); 48 $template->assign(array( 49 'F_ACTION' => PHPWG_ROOT_PATH.'comments.php?display_mode=albums', 50 'sort_by_options' => $sort_by, 51 )); 52 53 // clean where_clauses from unknown column 54 foreach ($page['where_clauses'] as &$cond) 55 { 56 if (strpos($cond, 'ic.image_id') !== false) 57 { 58 $cond = get_sql_condition_FandF( 59 array( 51 60 'forbidden_categories' => 'category_id', 52 61 'visible_categories' => 'category_id' 53 62 ), 54 '', true); 55 } 56 } 57 unset($cond); 58 59 // +-----------------------------------------------------------------------+ 60 // | comments management | 61 // +-----------------------------------------------------------------------+ 62 $comment_id = null; 63 $action = null; 64 65 $actions = array('delete_albums', 'validate_albums', 'edit_albums'); // different indexes to not interfer with the main process 66 foreach ($actions as $loop_action) 67 { 68 if (isset($_GET[$loop_action])) 69 { 70 $action = $loop_action; 71 check_input_parameter($action, $_GET, false, PATTERN_ID); 72 $comment_id = $_GET[$action]; 73 break; 74 } 75 } 76 77 if (isset($action)) 78 { 79 $comment_author_id = get_comment_author_id_albums($comment_id); 80 81 if (can_manage_comment(str_replace('_albums', null, $action), $comment_author_id)) 82 { 83 $perform_redirect = false; 84 85 if ('delete_albums' == $action) 63 '', true 64 ); 65 } 66 } 67 unset($cond); 68 69 // +-----------------------------------------------------------------------+ 70 // | comments management | 71 // +-----------------------------------------------------------------------+ 72 73 $comment_id = null; 74 $action = null; 75 76 $actions = array('delete_albums', 'validate_albums', 'edit_albums'); 77 foreach ($actions as $loop_action) 78 { 79 if (isset($_GET[$loop_action])) 80 { 81 $action = $loop_action; 82 check_input_parameter($action, $_GET, false, PATTERN_ID); 83 $comment_id = $_GET[$action]; 84 break; 85 } 86 } 87 88 if (isset($action)) 89 { 90 include_once(COA_PATH.'include/functions_comment.inc.php'); 91 92 $comment_author_id = get_comment_author_id_albums($comment_id); 93 94 if (can_manage_comment(str_replace('_albums', null, $action), $comment_author_id)) 95 { 96 $perform_redirect = false; 97 98 if ('delete_albums' == $action) 99 { 100 check_pwg_token(); 101 delete_user_comment_albums($comment_id); 102 $perform_redirect = true; 103 } 104 if ('validate_albums' == $action) 105 { 106 check_pwg_token(); 107 validate_user_comment_albums($comment_id); 108 $perform_redirect = true; 109 } 110 if ('edit_albums' == $action) 111 { 112 if (!empty($_POST['content'])) 86 113 { 87 114 check_pwg_token(); 88 delete_user_comment_albums($comment_id); 89 $perform_redirect = true; 90 } 91 if ('validate_albums' == $action) 92 { 93 check_pwg_token(); 94 validate_user_comment_albums($comment_id); 95 $perform_redirect = true; 96 } 97 if ('edit_albums' == $action) 98 { 99 if (!empty($_POST['content'])) 115 $comment_action = update_user_comment_albums( 116 array( 117 'comment_id' => $_GET['edit_albums'], 118 'category_id' => $_POST['image_id'], 119 'content' => $_POST['content'], 120 'website_url' => @$_POST['website_url'], 121 ), 122 $_POST['key'] 123 ); 124 125 switch ($comment_action) 100 126 { 101 check_pwg_token(); 102 update_user_comment_albums( 103 array( 104 'comment_id' => $_GET['edit_albums'], 105 'category_id' => $_POST['image_id'], 106 'content' => $_POST['content'] 107 ), 108 $_POST['key'] 109 ); 110 111 $perform_redirect = true; 112 } 113 else 114 { 115 $edit_comment = $_GET['edit_albums']; 127 case 'moderate': 128 $_SESSION['page_infos'][] = l10n('An administrator must authorize your comment before it is visible.'); 129 case 'validate': 130 $_SESSION['page_infos'][] = l10n('Your comment has been registered'); 131 $perform_redirect = true; 132 break; 133 case 'reject': 134 $_SESSION['page_errors'][] = l10n('Your comment has NOT been registered because it did not pass the validation rules'); 135 break; 136 default: 137 trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING); 116 138 } 117 139 } 118 if ($perform_redirect)140 else 119 141 { 120 $redirect_url = 121 PHPWG_ROOT_PATH 122 .'comments.php' 123 .get_query_string_diff(array('delete_albums','validate_albums','edit_albums','pwg_token')); 124 125 redirect($redirect_url); 142 $edit_comment = $_GET['edit_albums']; 126 143 } 127 144 } 128 } 129 130 // +-----------------------------------------------------------------------+ 131 // | navigation bar | 132 // +-----------------------------------------------------------------------+ 133 if (isset($_GET['start']) and is_numeric($_GET['start'])) 134 { 135 $start = $_GET['start']; 136 } 137 else 138 { 139 $start = 0; 140 } 141 142 $query = ' 145 if ($perform_redirect) 146 { 147 redirect($url_self); 148 } 149 } 150 } 151 152 // +-----------------------------------------------------------------------+ 153 // | navigation bar | 154 // +-----------------------------------------------------------------------+ 155 156 if (isset($_GET['start']) and is_numeric($_GET['start'])) 157 { 158 $start = $_GET['start']; 159 } 160 else 161 { 162 $start = 0; 163 } 164 165 $query = ' 143 166 SELECT COUNT(DISTINCT(com.id)) 144 FROM '.COA_TABLE.' AS com 145 LEFT JOIN '.USERS_TABLE.' As u 167 FROM '.CATEGORIES_TABLE.' AS cat 168 INNER JOIN '.COA_TABLE.' AS com 169 ON cat.id = com.category_id 170 LEFT JOIN '.USERS_TABLE.' AS u 146 171 ON u.'.$conf['user_fields']['id'].' = com.author_id 147 172 WHERE '.implode(' 148 173 AND ', $page['where_clauses']).' 149 174 ;'; 150 151 152 $url = PHPWG_ROOT_PATH 153 .'comments.php'154 .get_query_string_diff(array('start','delete_albums','validate_albums','edit_albums','pwg_token')); 155 156 $ navbar = create_navigation_bar(157 $url,158 $counter,159 $start,160 $page['items_number'],161 ''162 ); 163 164 $template->assign('navbar', $navbar); 165 166 // +-----------------------------------------------------------------------+ 167 // | last comments display | 168 // +-----------------------------------------------------------------------+ 169 170 171 172 173 175 list($counter) = pwg_db_fetch_row(pwg_query($query)); 176 177 $url = PHPWG_ROOT_PATH.'comments.php' 178 .get_query_string_diff(array('start','delete_albums','validate_albums','edit_albums','pwg_token')); 179 180 $navbar = create_navigation_bar( 181 $url, 182 $counter, 183 $start, 184 $page['items_number'], 185 '' 186 ); 187 188 $template->assign('navbar', $navbar); 189 190 // +-----------------------------------------------------------------------+ 191 // | last comments display | 192 // +-----------------------------------------------------------------------+ 193 194 $comments = array(); 195 $element_ids = array(); 196 $category_ids = array(); 197 198 $query = ' 174 199 SELECT 175 200 com.id AS comment_id, … … 184 209 com.content, 185 210 com.validated 186 FROM '.COA_TABLE.' AS com 211 FROM '.CATEGORIES_TABLE.' AS cat 212 INNER JOIN '.COA_TABLE.' AS com 213 ON cat.id = com.category_id 187 214 LEFT JOIN '.USERS_TABLE.' As u 188 215 ON u.'.$conf['user_fields']['id'].' = com.author_id … … 198 225 com.validated 199 226 ORDER BY '.$page['sort_by'].' '.$page['sort_order']; 200 if ('all' != $page['items_number']) 201 {202 $query.= '203 LIMIT '.$page['items_number'].' OFFSET '.$start;204 }227 if ('all' != $page['items_number']) 228 { 229 $query.= ' 230 LIMIT '.$page['items_number'].' OFFSET '.$start; 231 } 205 232 $query.= ' 206 233 ;'; 207 208 209 while ($row = pwg_db_fetch_assoc($result)) 210 211 array_push($comments, $row);212 array_push($element_ids, $row['category_id']);213 214 215 if (count($comments) > 0) 216 217 218 219 SELECT 220 cat.id, 221 cat.name, 222 cat.permalink, 223 cat.uppercats, 234 $result = pwg_query($query); 235 236 while ($row = pwg_db_fetch_assoc($result)) 237 { 238 $comments[] = $row; 239 $element_ids[] = $row['category_id']; 240 } 241 242 if (count($comments) > 0) 243 { 244 // retrieving category informations 245 $query = ' 246 SELECT 247 cat.id, 248 cat.name, 249 cat.permalink, 250 cat.uppercats, 224 251 com.id as comment_id, 225 252 img.id AS image_id, … … 228 255 LEFT JOIN '.COA_TABLE.' AS com 229 256 ON com.category_id = cat.id 230 LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 257 LEFT JOIN '.USER_CACHE_CATEGORIES_TABLE.' AS ucc 231 258 ON ucc.cat_id = cat.id AND ucc.user_id = '.$user['id'].' 232 259 LEFT JOIN '.IMAGES_TABLE.' AS img … … 236 263 'forbidden_categories' => 'cat.id', 237 264 'visible_categories' => 'cat.id' 238 ), 265 ), 239 266 'WHERE' 240 267 ).' 241 268 AND cat.id IN ('.implode(',', $element_ids).') 242 269 ;'; 243 $categories = hash_from_query($query, 'comment_id'); 244 245 foreach ($comments as $comment) 246 { 247 // source of the thumbnail picture 248 $comment['src_image'] = new SrcImage($categories[$comment['comment_id']]); 249 250 // category url 251 $comment['cat_url'] = duplicate_index_url( 270 $categories = hash_from_query($query, 'comment_id'); 271 272 foreach ($comments as $comment) 273 { 274 // source of the thumbnail picture 275 $comment['src_image'] = new SrcImage($categories[$comment['comment_id']]); 276 277 // category url 278 $comment['cat_url'] = make_index_url( 279 array( 280 'section' => 'categories', 281 'category' => $categories[$comment['comment_id']], 282 ) 283 ); 284 285 $email = null; 286 if (!empty($comment['user_email'])) 287 { 288 $email = $comment['user_email']; 289 } 290 else if (!empty($comment['email'])) 291 { 292 $email = $comment['email']; 293 } 294 295 // comment content 296 $tpl_comment = array( 297 'ID' => $comment['comment_id'], 298 'U_PICTURE' => $comment['cat_url'], 299 'src_image' => $comment['src_image'], 300 'ALT' => trigger_event('render_category_name', $categories[$comment['comment_id']]['name']), 301 'AUTHOR' => trigger_event('render_comment_author', $comment['author']), 302 'WEBSITE_URL' => $comment['website_url'], 303 'DATE' => format_date($comment['date'], true), 304 'CONTENT' => trigger_event('render_comment_content', $comment['content'], 'album'), 305 ); 306 307 if (is_admin()) 308 { 309 $tpl_comment['EMAIL'] = $email; 310 } 311 312 // rights 313 if (can_manage_comment('delete', $comment['author_id'])) 314 { 315 $tpl_comment['U_DELETE'] = add_url_params( 316 $url_self, 252 317 array( 253 'category' => array( 254 'id' => $categories[$comment['comment_id']]['id'], 255 'name' => $categories[$comment['comment_id']]['name'], 256 'permalink' => $categories[$comment['comment_id']]['permalink'], 257 ), 258 array('start') 318 'delete_albums' => $comment['comment_id'], 319 'pwg_token' => get_pwg_token(), 259 320 ) 260 321 ); 261 262 $email = null; 263 if (!empty($comment['user_email'])) 322 } 323 if (can_manage_comment('edit', $comment['author_id'])) 324 { 325 $tpl_comment['U_EDIT'] = add_url_params( 326 $url_self, 327 array( 328 'edit_albums' => $comment['comment_id'], 329 ) 330 ); 331 332 if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) 264 333 { 265 $email = $comment['user_email']; 334 $tpl_comment['IN_EDIT'] = true; 335 $key = get_ephemeral_key(2, $comment['category_id']); 336 $tpl_comment['KEY'] = $key; 337 $tpl_comment['IMAGE_ID'] = $comment['category_id']; 338 $tpl_comment['CONTENT'] = $comment['content']; 339 $tpl_comment['PWG_TOKEN'] = get_pwg_token(); 340 $tpl_comment['U_CANCEL'] = $url_self; 266 341 } 267 else if (!empty($comment['email'])) 342 } 343 if (can_manage_comment('validate', $comment['author_id'])) 344 { 345 if ('true' != $comment['validated']) 268 346 { 269 $email = $comment['email']; 270 } 271 272 // comment content 273 $tpl_comment = array( 274 'ID' => $comment['comment_id'], 275 'U_PICTURE' => $comment['cat_url'], 276 'ALT' => trigger_event('render_category_name', $categories[$comment['comment_id']]['name']), 277 'src_image' => $comment['src_image'], 278 'AUTHOR' => trigger_event('render_comment_author', $comment['author']), 279 'WEBSITE_URL' => $comment['website_url'], 280 'DATE' => format_date($comment['date'], true), 281 'CONTENT' => trigger_event('render_comment_content', $comment['content'], 'album'), 282 ); 283 284 if (is_admin()) 285 { 286 $tpl_comment['EMAIL'] = $email; 287 } 288 289 // rights 290 if (can_manage_comment('delete', $comment['author_id'])) 291 { 292 $tpl_comment['U_DELETE'] = add_url_params( 293 $url, 347 $tpl_comment['U_VALIDATE'] = add_url_params( 348 $url_self, 294 349 array( 295 ' delete_albums'=> $comment['comment_id'],350 'validate_albums'=> $comment['comment_id'], 296 351 'pwg_token' => get_pwg_token(), 297 352 ) 298 353 ); 299 354 } 300 if (can_manage_comment('edit', $comment['author_id'])) 301 { 302 $tpl_comment['U_EDIT'] = add_url_params( 303 $url, 304 array( 305 'edit_albums' => $comment['comment_id'], 306 ) 307 ); 308 309 if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) 310 { 311 $tpl_comment['IN_EDIT'] = true; 312 $key = get_ephemeral_key(2, $comment['category_id']); 313 $tpl_comment['KEY'] = $key; 314 $tpl_comment['IMAGE_ID'] = $comment['category_id']; 315 $tpl_comment['CONTENT'] = $comment['content']; 316 $tpl_comment['PWG_TOKEN'] = get_pwg_token(); 317 } 318 } 319 if (can_manage_comment('validate', $comment['author_id'])) 320 { 321 if ('true' != $comment['validated']) 322 { 323 $tpl_comment['U_VALIDATE'] = add_url_params( 324 $url, 325 array( 326 'validate_albums'=> $comment['comment_id'], 327 'pwg_token' => get_pwg_token(), 328 ) 329 ); 330 } 331 } 332 333 $template->append('comments', $tpl_comment); 334 } 335 } 336 337 // +-----------------------------------------------------------------------+ 338 // | template | 339 // +-----------------------------------------------------------------------+ 340 // add a line to display category name 341 $template->set_prefilter('comments', 'coa_change_comments_list'); 342 343 function coa_change_comments_list($content, &$smarty) { 344 $search[0] = '<a href="{$comment.U_PICTURE}">'; 345 $replacement[0] = $search[0].'{$comment.ALT}<br/>'; 346 $search[1] = '<input type="submit"'; 347 $replacement[1] = '<input type=hidden name=display_mode value=albums>'.$search[1]; 348 return str_replace($search, $replacement, $content); 349 } 350 } 351 352 ?> 355 } 356 357 $template->append('comments', $tpl_comment); 358 } 359 } 360 361 // +-----------------------------------------------------------------------+ 362 // | template | 363 // +-----------------------------------------------------------------------+ 364 // add a line to display category name 365 $template->set_prefilter('comments', 'coa_change_comments_list'); 366 367 function coa_change_comments_list($content, &$smarty) { 368 $search = '<a href="{$comment.U_PICTURE}">'; 369 $replacement = $search.'{$comment.ALT}<br>'; 370 return str_replace($search, $replacement, $content); 371 } -
extensions/Comments_on_Albums/trunk/include/functions_comment.inc.php
r21347 r26089 1 1 <?php 2 2 /* This is a copy of include/functions_comment.inc.php but adapted for Comments On Albums */ 3 defined('COA_ID') or die('Hacking attempt!'); 3 4 4 5 include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php'); 5 add_event_handler('user_comment_check_albums', 'user_comment_check',6 EVENT_HANDLER_PRIORITY_NEUTRAL, 2);7 6 8 7 /** 9 * Tries to insert a user comment in the database and returns one of : 10 * validate, moderate, reject 11 * @param array comm contains author, content, category_id 12 * @param string key secret key sent back to the browser 13 * @param array infos out array of messages 8 * Tries to insert a user comment and returns action to perform. 9 * 10 * @param array &$comm 11 * @param string $key secret key sent back to the browser 12 * @param array &$infos output array of error messages 13 * @return string validate, moderate, reject 14 14 */ 15 function insert_user_comment_albums( &$comm, $key, &$infos)15 function insert_user_comment_albums(&$comm, $key, &$infos) 16 16 { 17 17 global $conf, $user; … … 37 37 if (!is_classic_user()) 38 38 { 39 if ( empty($comm['author']))39 if (empty($comm['author'])) 40 40 { 41 41 if ($conf['comments_author_mandatory']) 42 42 { 43 array_push($infos, l10n('Username is mandatory'));43 $infos[] = l10n('Username is mandatory'); 44 44 $comment_action='reject'; 45 45 } … … 47 47 } 48 48 $comm['author_id'] = $conf['guest_id']; 49 // if a guest try to use the name of an already existing user, he must be50 // rejected51 if ( $comm['author'] != 'guest')49 // if a guest try to use the name of an already existing user, 50 // he must be rejected 51 if ($comm['author'] != 'guest') 52 52 { 53 53 $query = ' 54 54 SELECT COUNT(*) AS user_exists 55 55 FROM '.USERS_TABLE.' 56 WHERE '.$conf['user_fields']['username']." = '".addslashes($comm['author'])."'"; 56 WHERE '.$conf['user_fields']['username']." = '".addslashes($comm['author'])."' 57 ;"; 57 58 $row = pwg_db_fetch_assoc( pwg_query( $query ) ); 58 if ( $row['user_exists'] == 1)59 if ($row['user_exists'] == 1) 59 60 { 60 array_push($infos, l10n('This login is already used by another user'));61 $infos[] = l10n('This login is already used by another user'); 61 62 $comment_action='reject'; 62 63 } … … 69 70 } 70 71 71 if ( empty($comm['content']) ) 72 { // empty comment content 72 // content 73 if (empty($comm['content'])) 74 { 73 75 $comment_action='reject'; 74 76 } 75 77 76 if ( !verify_ephemeral_key(@$key, $comm['category_id']) ) 78 // key 79 if (!verify_ephemeral_key(@$key, $comm['category_id'])) 77 80 { 78 81 $comment_action='reject'; 79 82 $_POST['cr'][] = 'key'; 80 83 } 81 84 82 85 // website 83 86 if (!empty($comm['website_url'])) … … 89 92 if (!url_check_format($comm['website_url'])) 90 93 { 91 array_push($infos, l10n('Your website URL is invalid'));94 $infos[] = l10n('Your website URL is invalid'); 92 95 $comment_action='reject'; 93 96 } 94 97 } 95 98 96 99 // email 97 100 if (empty($comm['email'])) … … 103 106 else if ($conf['comments_email_mandatory']) 104 107 { 105 array_push($infos, l10n('Email address is missing. Please specify an email address.'));108 $infos[] = l10n('Email address is missing. Please specify an email address.'); 106 109 $comment_action='reject'; 107 110 } … … 109 112 else if (!email_check_format($comm['email'])) 110 113 { 111 array_push($infos, l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'));114 $infos[] = l10n('mail address must be like xxx@yyy.eee (example : jack@altern.org)'); 112 115 $comment_action='reject'; 113 116 } 114 117 115 118 // anonymous id = ip address 116 119 $ip_components = explode('.', $comm['ip']); … … 138 141 139 142 list($counter) = pwg_db_fetch_row(pwg_query($query)); 140 if ( $counter > 0)141 { 142 array_push( $infos, l10n('Anti-flood system : please wait for a moment before trying to post another comment'));143 if ($counter > 0) 144 { 145 $infos[] = l10n('Anti-flood system : please wait for a moment before trying to post another comment'); 143 146 $comment_action='reject'; 144 147 } … … 146 149 147 150 // perform more spam check 148 $comment_action = trigger_event('user_comment_check _albums',151 $comment_action = trigger_event('user_comment_check', 149 152 $comment_action, $comm 150 153 ); 151 154 152 if ( $comment_action!='reject')155 if ($comment_action!='reject') 153 156 { 154 157 $query = ' … … 168 171 ) 169 172 '; 170 171 173 pwg_query($query); 172 173 174 $comm['id'] = pwg_db_insert_id(COA_TABLE); 174 175 … … 191 192 if ('moderate' == $comment_action) 192 193 { 193 $keyargs_content[] = get_l10n_args('', '');194 194 $keyargs_content[] = get_l10n_args('(!) This comment requires validation', ''); 195 195 } 196 196 197 pwg_mail_notification_admins 198 ( 197 pwg_mail_notification_admins( 199 198 get_l10n_args('Comment by %s', stripslashes($comm['author']) ), 200 199 $keyargs_content … … 202 201 } 203 202 } 203 204 204 return $comment_action; 205 205 } 206 206 207 207 /** 208 * Tries to delete a user comment in the database 209 * only admin can delete all comments 210 * other users can delete their own comments 211 * so to avoid a new sql request we add author in where clause 208 * Tries to delete a (or more) user comment. 209 * only admin can delete all comments 210 * other users can delete their own comments 212 211 * 213 * @param comment_id 212 * @param int|int[] $comment_id 213 * @return bool false if nothing deleted 214 214 */ 215 function delete_user_comment_albums($comment_id) 215 function delete_user_comment_albums($comment_id) 216 216 { 217 217 $user_where_clause = ''; … … 220 220 $user_where_clause = ' AND author_id = \''.$GLOBALS['user']['id'].'\''; 221 221 } 222 222 223 223 if (is_array($comment_id)) 224 { 224 225 $where_clause = 'id IN('.implode(',', $comment_id).')'; 226 } 225 227 else 228 { 226 229 $where_clause = 'id = '.$comment_id; 227 230 } 231 228 232 $query = ' 229 233 DELETE FROM '.COA_TABLE.' … … 231 235 $user_where_clause.' 232 236 ;'; 233 $result = pwg_query($query); 234 235 if ($result) 236 { 237 email_admin('delete', 237 238 if (pwg_db_changes(pwg_query($query))) 239 { 240 email_admin('delete', 238 241 array('author' => $GLOBALS['user']['username'], 239 242 'comment_id' => $comment_id 240 243 )); 241 } 242 243 trigger_action('user_comment_deletion', $comment_id, 'category'); 244 trigger_action('user_comment_deletion', $comment_id, 'category'); 245 246 return true; 247 } 248 249 return false; 244 250 } 245 251 246 252 /** 247 * Tries to update a user comment in the database 248 * only admin can update all comments 249 * users can edit their own comments if admin allow them 250 * so to avoid a new sql request we add author in where clause 253 * Tries to update a user comment 254 * only admin can update all comments 255 * users can edit their own comments if admin allow them 251 256 * 252 * @param comment_id253 * @param post_key254 * @ param content257 * @param array $comment 258 * @param string $post_key secret key sent back to the browser 259 * @return string validate, moderate, reject 255 260 */ 256 261 function update_user_comment_albums($comment, $post_key) … … 260 265 $comment_action = 'validate'; 261 266 262 if ( !verify_ephemeral_key($post_key, $comment['category_id']))267 if (!verify_ephemeral_key($post_key, $comment['category_id'])) 263 268 { 264 269 $comment_action='reject'; … … 275 280 // perform more spam check 276 281 $comment_action = 277 trigger_event('user_comment_check _albums',282 trigger_event('user_comment_check', 278 283 $comment_action, 279 284 array_merge($comment, … … 282 287 ); 283 288 289 // website 290 if (!empty($comment['website_url'])) 291 { 292 if (!preg_match('/^https?/i', $comment['website_url'])) 293 { 294 $comment['website_url'] = 'http://'.$comment['website_url']; 295 } 296 if (!url_check_format($comment['website_url'])) 297 { 298 $page['errors'][] = l10n('Your website URL is invalid'); 299 $comment_action='reject'; 300 } 301 } 302 284 303 if ( $comment_action!='reject' ) 285 304 { … … 294 313 UPDATE '.COA_TABLE.' 295 314 SET content = \''.$comment['content'].'\', 315 website_url = '.(!empty($comment['website_url']) ? '\''.$comment['website_url'].'\'' : 'NULL').', 296 316 validated = \''.($comment_action=='validate' ? 'true':'false').'\', 297 317 validation_date = '.($comment_action=='validate' ? 'NOW()':'NULL').' … … 300 320 ;'; 301 321 $result = pwg_query($query); 302 322 303 323 // mail admin and ask to validate the comment 304 if ($result and $conf['email_admin_on_comment_validation'] and 'moderate' == $comment_action) 324 if ($result and $conf['email_admin_on_comment_validation'] and 'moderate' == $comment_action) 305 325 { 306 326 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); … … 314 334 get_l10n_args('', ''), 315 335 get_l10n_args('Manage this user comment: %s', $comment_url), 316 get_l10n_args('', ''),317 336 get_l10n_args('(!) This comment requires validation', ''), 318 337 ); 319 338 320 pwg_mail_notification_admins 321 ( 339 pwg_mail_notification_admins( 322 340 get_l10n_args('Comment by %s', stripslashes($GLOBALS['user']['username']) ), 323 341 $keyargs_content … … 331 349 } 332 350 } 333 351 334 352 return $comment_action; 335 353 } 336 354 355 /** 356 * Returns the author id of a comment 357 * 358 * @param int $comment_id 359 * @param bool $die_on_error 360 * @return int 361 */ 337 362 function get_comment_author_id_albums($comment_id, $die_on_error=true) 338 363 { … … 355 380 } 356 381 } 357 382 358 383 list($author_id) = pwg_db_fetch_row($result); 359 384 … … 362 387 363 388 /** 364 * Tries to validate a user comment in the database 365 * @param int or array of int comment_id 389 * Tries to validate a user comment. 390 * 391 * @param int|int[] $comment_id 366 392 */ 367 393 function validate_user_comment_albums($comment_id) 368 394 { 369 395 if (is_array($comment_id)) 396 { 370 397 $where_clause = 'id IN('.implode(',', $comment_id).')'; 398 } 371 399 else 400 { 372 401 $where_clause = 'id = '.$comment_id; 373 402 } 403 374 404 $query = ' 375 405 UPDATE '.COA_TABLE.' … … 379 409 ;'; 380 410 pwg_query($query); 381 411 382 412 trigger_action('user_comment_validation', $comment_id, 'category'); 383 413 } 384 ?> -
extensions/Comments_on_Albums/trunk/language/en_UK/plugin.lang.php
r21347 r26089 6 6 $lang['Last comments on albums'] = 'Last comments on albums'; 7 7 $lang['Display last posted comments on albums'] = 'Display last posted comments on albums'; 8 $lang['%d comment on album'] = '%d comment on album'; 9 $lang['%d comments on albums'] = '%d comments on albums'; 10 $lang['Photos'] = 'Photos'; 8 11 9 12 ?> -
extensions/Comments_on_Albums/trunk/language/fr_FR/plugin.lang.php
r21347 r26089 6 6 $lang['Last comments on albums'] = 'Derniers commentaires sur les albums'; 7 7 $lang['Display last posted comments on albums'] = 'Affiche les derniers commentaires postés sur les albums'; 8 $lang['%d comment on album'] = '%d commentaire sur un album'; 9 $lang['%d comments on albums'] = '%d commentaires sur albums'; 10 $lang['Photos'] = 'Photos'; 11 8 12 ?> -
extensions/Comments_on_Albums/trunk/main.inc.php
r24545 r26089 9 9 */ 10 10 11 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');11 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 12 12 13 13 if (mobile_theme()) … … 18 18 global $prefixeTable; 19 19 20 // +-----------------------------------------------------------------------+ 21 // Global variables 22 // +-----------------------------------------------------------------------+ 23 defined('COA_ID') or define('COA_ID', basename(dirname(__FILE__))); 20 21 define('COA_ID', basename(dirname(__FILE__))); 24 22 define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_ID . '/'); 25 23 define('COA_TABLE' , $prefixeTable . 'comments_categories'); … … 28 26 29 27 30 // +-----------------------------------------------------------------------+31 // Triggers32 // +-----------------------------------------------------------------------+33 28 add_event_handler('init', 'coa_init'); 29 34 30 function coa_init() 35 31 { 36 32 global $user, $conf, $pwg_loaded_plugins; 37 33 34 include_once(COA_PATH . 'maintain.inc.php'); 35 $maintain = new Comments_on_Albums_maintain(COA_ID); 36 $maintain->autoUpdate(COA_VERSION, 'install'); 37 38 38 // luciano doesn't use comments 39 39 // incompatible with dynamic display of Stripped & Collumns 40 40 if ($user['theme'] == 'luciano' or $user['theme'] == 'stripped_black_bloc') return; 41 42 // apply upgrade if needed 43 if ( 44 COA_VERSION == 'auto' or 45 $pwg_loaded_plugins[COA_ID]['version'] == 'auto' or 46 version_compare($pwg_loaded_plugins[COA_ID]['version'], COA_VERSION, '<') 47 ) 48 { 49 // call install function 50 include_once(COA_PATH . 'include/install.inc.php'); 51 coa_install(); 52 53 // update plugin version in database 54 if ( $pwg_loaded_plugins[COA_ID]['version'] != 'auto' and COA_VERSION != 'auto' ) 55 { 56 $query = ' 57 UPDATE '. PLUGINS_TABLE .' 58 SET version = "'. COA_VERSION .'" 59 WHERE id = "'. COA_ID .'"'; 60 pwg_query($query); 61 62 $pwg_loaded_plugins[COA_ID]['version'] = COA_VERSION; 63 64 if (defined('IN_ADMIN')) 65 { 66 $_SESSION['page_infos'][] = 'Comments on Albums updated to version '. COA_VERSION; 67 } 68 } 69 } 70 71 // add events handlers 41 42 include_once(COA_PATH . 'include/events.inc.php'); 43 72 44 if (defined('IN_ADMIN')) 73 45 { 46 add_event_handler('tabsheet_before_select', 'coa_tabsheet_before_select', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 74 47 add_event_handler('loc_begin_admin_page', 'coa_admin_intro'); 75 add_event_handler('loc_end_admin', 'coa_admin_comments');76 48 } 77 49 else 78 50 { 79 51 add_event_handler('loc_after_page_header', 'coa_albums'); 80 add_event_handler('loc_after_page_header', 'coa_comments_page'); 81 } 52 add_event_handler('loc_end_comments', 'coa_comments'); 53 } 54 82 55 add_event_handler('get_stuffs_modules', 'coa_register_stuffs_module'); 56 57 load_language('plugin.lang', COA_PATH); 83 58 } 84 85 86 // +-----------------------------------------------------------------------+87 // Functions88 // +-----------------------------------------------------------------------+89 90 function coa_albums()91 {92 global $template, $page, $conf, $pwg_loaded_plugins;93 94 if ( !empty($page['section']) AND $page['section'] == 'categories' AND isset($page['category']) AND $page['body_id'] == 'theCategoryPage' )95 {96 trigger_action('loc_begin_coa');97 include(COA_PATH . 'include/coa_albums.php');98 }99 }100 101 function coa_comments_page()102 {103 global $template, $page, $conf, $user;104 105 if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')106 {107 include(COA_PATH . 'include/coa_comments_page.php');108 }109 }110 111 function coa_admin_intro()112 {113 global $page;114 115 if ($page['page'] == 'intro')116 {117 include(COA_PATH . 'include/coa_admin_intro.php');118 }119 }120 121 function coa_admin_comments()122 {123 global $page;124 125 if ($page['page'] == 'comments')126 {127 include(COA_PATH . 'include/coa_admin_comments.php');128 }129 }130 131 function coa_register_stuffs_module($modules)132 {133 load_language('plugin.lang', COA_PATH);134 135 array_push($modules, array(136 'path' => COA_PATH . '/stuffs_module',137 'name' => l10n('Last comments on albums'),138 'description' => l10n('Display last posted comments on albums'),139 ));140 141 return $modules;142 }143 144 ?> -
extensions/Comments_on_Albums/trunk/maintain.inc.php
r19991 r26089 1 1 <?php 2 if (!defined('PHPWG_ROOT_PATH'))die('Hacking attempt!');2 defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); 3 3 4 defined('COA_ID') or define('COA_ID', basename(dirname(__FILE__))); 5 include_once(PHPWG_PLUGINS_PATH . COA_ID . '/include/install.inc.php'); 4 class Comments_on_Albums_maintain extends PluginMaintain 5 { 6 private $installed = false; 6 7 7 function plugin_install() 8 { 9 coa_install(); 10 define('coa_installed', true); 11 } 8 function install($plugin_version, &$errors=array()) 9 { 10 global $prefixeTable; 12 11 13 function plugin_activate() 14 { 15 if (!defined('coa_installed')) 12 pwg_query(' 13 CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'comments_categories` ( 14 `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 15 `category_id` mediumint(8) unsigned NOT NULL DEFAULT 0, 16 `date` datetime NOT NULL DEFAULT "0000-00-00 00:00:00", 17 `author` varchar(255) DEFAULT NULL, 18 `email` varchar(255) DEFAULT NULL, 19 `author_id` smallint(5) DEFAULT NULL, 20 `anonymous_id` varchar(45) NOT NULL, 21 `website_url` varchar(255) DEFAULT NULL, 22 `content` longtext, 23 `validated` enum("true","false") NOT NULL DEFAULT "false", 24 `validation_date` datetime DEFAULT NULL, 25 PRIMARY KEY (`id`), 26 KEY `comments_i2` (`validation_date`), 27 KEY `comments_i1` (`category_id`) 28 ) ENGINE=MyISAM DEFAULT CHARSET=utf8'); 29 30 $result = pwg_query('SHOW COLUMNS FROM `' . $prefixeTable . 'comments_categories` LIKE "anonymous_id";'); 31 if (!pwg_db_num_rows($result)) 32 { 33 pwg_query('ALTER TABLE `' . $prefixeTable . 'comments_categories` ADD `anonymous_id` VARCHAR(45) DEFAULT NULL;'); 34 } 35 36 $result = pwg_query('SHOW COLUMNS FROM `' . $prefixeTable . 'comments_categories` LIKE "email";'); 37 if (!pwg_db_num_rows($result)) 38 { 39 pwg_query(' 40 ALTER TABLE `' . $prefixeTable . 'comments_categories` 41 ADD `email` varchar(255) DEFAULT NULL, 42 ADD `website_url` varchar(255) DEFAULT NULL, 43 ADD KEY `comments_i2` (`validation_date`), 44 ADD KEY `comments_i1` (`category_id`) 45 ;'); 46 } 47 48 $this->installed = true; 49 } 50 51 function activate($plugin_version, &$errors=array()) 16 52 { 17 coa_install(); 53 if (!$this->installed) 54 { 55 $this->install($plugin_version, $errors); 56 } 57 } 58 59 function deactivate() 60 { 61 } 62 63 function uninstall() 64 { 65 global $prefixeTable; 66 67 pwg_query('DROP TABLE `' . $prefixeTable . 'comments_categories`;'); 18 68 } 19 69 } 20 21 function plugin_uninstall()22 {23 global $prefixeTable;24 25 pwg_query('DROP TABLE `' . $prefixeTable . 'comments_categories`;');26 }27 28 ?> -
extensions/Comments_on_Albums/trunk/template/albums.tpl
r18927 r26089 1 {* this is inspired by theme/defaults/template/picture.tpl *} 2 3 {* <!-- need some css modifications, specific to each theme --> *} 4 {html_head} 5 <style type="text/css"> 6 #comments .commentElement {ldelim} width:98%;} 1 {*<!-- this is inspired by theme/defaults/template/picture.tpl -->*} 2 3 {combine_script id='coa.script' load='footer' require='jquery' path=$COA_PATH|cat:'template/script.js'} 4 5 {html_style}{strip} 6 #comments { margin:10px 0 0 0; padding: 2px 5px !important; position:relative; } 7 #comments .commentElement { width:98%; } 8 7 9 {if $COMMENTS_ON_TOP} 8 #commentAdd, #pictureCommentList {ldelim} float:none; display:inline-block; width:47.5%; vertical-align:top;} 9 #commentsSwitcher {ldelim} float:none; display:inline-block; margin: 2px 0; cursor:pointer;} 10 .noCommentContent #commentsSwitcher {ldelim} display: none;} 11 .switchArrow{ldelim} width: 16px; height: 16px; margin: 5px;} 12 .commentshidden #pictureComments {ldelim} display: none;} 13 .commentContent .comments_toggle {ldelim} cursor: pointer;} 14 {/if} 15 {if $themeconf.name == 'Sylvia'} 16 #comments .description {ldelim} padding: 15px 2px 6px 12px;} 17 #comments .commentElement {ldelim} border: 1px solid #666;} 18 {/if} 19 {if $themeconf.name|strstr:"stripped"} 20 #comments {ldelim} text-align: left;} 21 #comments .description {ldelim} height:auto;} 22 #thumbnails_block2 {ldelim} min-height:0;} 10 #comments { margin:0 0 10px 0; } 23 11 {/if} 24 12 25 </style> 26 {/html_head} 27 28 {* <!-- if RV Thumb Scroller is installed comments block is displayed on top with a drop-down --> *} 29 {if $COMMENTS_ON_TOP} 30 {footer_script}{literal} 31 // comments show/hide 32 var commentsswicther=jQuery("#commentsSwitcher"); 33 var comments=jQuery("#theCategoryPage #comments"); 34 35 commentsswicther.html('<div class="switchArrow"> </div>'); 36 {/literal}{if $themeconf.name != 'elegant'}switcharrow = commentsswicther.children(".switchArrow");{else}switcharrow = $('<div></div>');{/if}{literal} 37 38 if (comments.length == 1) { 39 var comments_button=jQuery("#comments h3"); 40 41 if (comments_button.length == 0) { 42 jQuery("#addComment").before('<h3>Comments</h3>'); 43 comments_button=jQuery("#comments h3"); 44 } 45 46 {/literal}{if $DISPLAY_COMMENTS_BLOCK} 47 comments.addClass("commentsshown"); 48 comments_button.addClass("comments_toggle").addClass("comments_toggle_on"); 49 switcharrow.html("↑"); 50 {else} 51 comments.addClass("commentshidden"); 52 comments_button.addClass("comments_toggle").addClass("comments_toggle_off"); 53 switcharrow.html("↓"); 54 {/if}{literal} 55 56 comments_button.click(function() { commentsToggle() }); 57 commentsswicther.click(function() { commentsToggle() }); 58 59 } 60 61 function commentsToggle() { 62 var comments=jQuery("#theCategoryPage #comments"); 63 var comments_button=jQuery("#comments h3"); 64 65 if (comments.hasClass("commentshidden")) { 66 comments.removeClass("commentshidden").addClass("commentsshown"); 67 comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_off"); 68 switcharrow.html("↑"); 69 } else { 70 comments.addClass("commentshidden").removeClass("commentsshown"); 71 comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_on"); 72 switcharrow.html("↓"); 73 } 74 75 } 76 {/literal}{/footer_script} 13 {if $themeconf.name == 'elegant'} 14 #content { padding-bottom:0; } 15 #comments { background-color:#333333; } 16 #comments h3 { margin: 10px 0px; } 77 17 {/if} 78 18 19 {if $themeconf.name == 'Sylvia'} 20 #comments .description { padding: 15px 2px 6px 12px; } 21 #comments .commentElement { border: 1px solid #666; } 22 {/if} 23 24 {if $themeconf.name|strstr:"stripped"} 25 #comments { text-align: left; } 26 #comments .description { height:auto; } 27 #thumbnails_block2 { min-height:0; } 28 {/if} 29 30 {if $themeconf.name != 'elegant'} 31 #comments { background:rgba(127,127,127,0.1); } 32 #comments.commentshidden #pictureComments { display:none; } 33 #comments .comments_toggle { cursor:pointer; } 34 #commentsSwitcher { float:left; margin:2px 0; cursor:pointer; } 35 #comments .switchArrow { width:16px; height:16px; margin:8px 5px 8px 4px; } 36 #comments .switchArrow:before { content:"\BB"; display:inline-block; font-size:22px; } 37 #comments.commentshidden .switchArrow:before { -webkit-transform:rotate(90deg); transform:rotate(90deg); } 38 #comments.commentsshown .switchArrow:before { -webkit-transform:rotate(-90deg); transform:rotate(-90deg); } 39 {/if} 40 {/strip}{/html_style} 41 42 {footer_script} 43 var coa_on_top = {intval(isset($COMMENTS_ON_TOP))}, coa_force_open = {intval(isset($DISPLAY_COMMENTS_BLOCK))}; 44 {/footer_script} 45 46 79 47 {if isset($COMMENT_COUNT)} 80 <div id="comments" style="margin:10px 0 10px 0;" {if (!isset($comment_add) && ($COMMENT_COUNT == 0))}class="noCommentContent"{else}class="commentContent"{/if}>81 <h3 style="margin:0 0 0 5px;"><div id="commentsSwitcher"></div>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3>48 <div id="comments" {if (!isset($comment_add) && ($COMMENT_COUNT == 0))}class="noCommentContent"{else}class="commentContent"{/if}><div id="commentsSwitcher"></div> 49 <h3>{$COMMENT_COUNT|translate_dec:'%d comment':'%d comments'}</h3> 82 50 83 <div id="pictureComments"> <fieldset>51 <div id="pictureComments"> 84 52 {if isset($comment_add)} 85 53 <div id="commentAdd"> 86 <h4>{'Add a comment'| @translate}</h4>54 <h4>{'Add a comment'|translate}</h4> 87 55 <form method="post" action="{$comment_add.F_ACTION}" id="addComment"> 88 56 {if $comment_add.SHOW_AUTHOR} 89 <p><label for="author">{'Author'| @translate}{if $comment_add.AUTHOR_MANDATORY} ({'mandatory'|@translate}){/if} :</label></p>57 <p><label for="author">{'Author'|translate}{if $comment_add.AUTHOR_MANDATORY} ({'mandatory'|translate}){/if} :</label></p> 90 58 <p><input type="text" name="author" id="author" value="{$comment_add.AUTHOR}"></p> 91 59 {/if} 92 60 {if $comment_add.SHOW_EMAIL} 93 <p><label for="email">{'Email '|@translate}{if $comment_add.EMAIL_MANDATORY} ({'mandatory'|@translate}){/if} :</label></p>61 <p><label for="email">{'Email address'|translate}{if $comment_add.EMAIL_MANDATORY} ({'mandatory'|translate}){/if} :</label></p> 94 62 <p><input type="text" name="email" id="email" value="{$comment_add.EMAIL}"></p> 95 63 {/if} 96 <p><label for="website_url">{'Website'| @translate} :</label></p>64 <p><label for="website_url">{'Website'|translate} :</label></p> 97 65 <p><input type="text" name="website_url" id="website_url" value="{$comment_add.WEBSITE_URL}"></p> 98 <p><label for="contentid">{'Comment'| @translate} ({'mandatory'|@translate}) :</label></p>66 <p><label for="contentid">{'Comment'|translate} ({'mandatory'|translate}) :</label></p> 99 67 <p><textarea name="content" id="contentid" rows="5" cols="50">{$comment_add.CONTENT}</textarea></p> 100 68 <p><input type="hidden" name="key" value="{$comment_add.KEY}"> 101 <input type="submit" value="{'Submit'| @translate}"></p>69 <input type="submit" value="{'Submit'|translate}"></p> 102 70 </form> 103 71 </div> … … 110 78 <a href="{$COMMENTS_ORDER_URL}#comments" rel="nofollow" class="commentsOrder">{$COMMENTS_ORDER_TITLE}</a> 111 79 {/if} 112 {if !empty($comment_navbar) }{include file=$COA_ABSOLUTE_PATH|@cat:'template/navigation_bar.tpl'|@get_extent:'navbar'}{/if} 80 {if !empty($comment_navbar)} 81 {include file='navigation_bar.tpl'|get_extent:'navbar' navbar=$comment_navbar} 82 {/if} 113 83 </div> 114 84 {/if} … … 116 86 </div> 117 87 {/if} 118 {if not $COMMENTS_ON_TOP}<div style="clear:both"></div>{/if}119 </ fieldset></div>88 <div style="clear:both"></div> 89 </div> 120 90 121 91 </div>
Note: See TracChangeset
for help on using the changeset viewer.