Changeset 18927 for extensions/Comments_on_Albums/include/coa_albums.php
- Timestamp:
- Nov 4, 2012, 3:59:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_on_Albums/include/coa_albums.php
r14528 r18927 2 2 /* Code adapted from include/picture_comment.inc.php and picture.php */ 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 5 global $conf, $user; 4 6 5 7 // +-----------------------------------------------------------------------+ … … 122 124 die('Session expired'); 123 125 } 124 126 125 127 $comm = array( 126 128 'author' => trim( @$_POST['author'] ), 127 129 'content' => trim( $_POST['content'] ), 130 'website_url' => trim( $_POST['website_url'] ), 131 'email' => trim( @$_POST['email'] ), 128 132 'category_id' => $category['id'], 129 );133 ); 130 134 131 135 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions 132 136 133 $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $page[' infos']);137 $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $page['errors']); 134 138 135 139 switch ($comment_action) … … 231 235 com.author, 232 236 com.author_id, 233 '.$conf['user_fields']['username'].' AS username, 237 u.'.$conf['user_fields']['username'].' AS username, 238 u.'.$conf['user_fields']['email'].' AS user_email, 239 com.email, 234 240 com.date, 241 com.website_url, 235 242 com.category_id, 236 243 com.content, … … 248 255 while ($row = pwg_db_fetch_assoc($result)) 249 256 { 250 // author 251 if (!empty($row['author'])) 252 { 253 $author = $row['author']; 254 if ($author == 'guest') 255 { 256 $author = l10n('guest'); 257 } 258 } 259 else 260 { 261 $author = stripslashes($row['username']); 257 if ($row['author'] == 'guest') 258 { 259 $row['author'] = l10n('guest'); 260 } 261 262 $email = null; 263 if (!empty($row['user_email'])) 264 { 265 $email = $row['user_email']; 266 } 267 else if (!empty($row['email'])) 268 { 269 $email = $row['email']; 262 270 } 263 271 … … 265 273 $tpl_comment = array( 266 274 'ID' => $row['id'], 267 'AUTHOR' => trigger_event('render_comment_author', $ author),275 'AUTHOR' => trigger_event('render_comment_author', $row['author']), 268 276 'DATE' => format_date($row['date'], true), 277 'WEBSITE_URL' => $row['website_url'], 269 278 'CONTENT' => trigger_event('render_comment_content', $row['content'], 'album'), 270 279 ); … … 300 309 } 301 310 } 302 if (is_admin() AND $row['validated'] != 'true') 303 { 304 $tpl_comment['U_VALIDATE'] = add_url_params( 305 $url_self, 306 array( 307 'action' => 'validate_comment', 308 'comment_to_validate' => $row['id'], 309 'pwg_token' => get_pwg_token(), 310 ) 311 ); 311 if (is_admin()) 312 { 313 $tpl_comment['EMAIL'] = $email; 314 315 if ($row['validated'] != 'true') 316 { 317 $tpl_comment['U_VALIDATE'] = add_url_params( 318 $url_self, 319 array( 320 'action' => 'validate_comment', 321 'comment_to_validate' => $row['id'], 322 'pwg_token' => get_pwg_token(), 323 ) 324 ); 325 } 312 326 } 313 327 … … 330 344 { 331 345 $key = get_ephemeral_key(3, $category['id']); 332 $content = null; 333 if ('reject'===@$comment_action) 334 { 335 $content = htmlspecialchars(stripslashes($comm['content'])); 336 } 346 337 347 $template->assign('comment_add', 338 348 array( 339 'F_ACTION' => $url_self, 340 'KEY' => $key, 341 'CONTENT' => $content, 342 'SHOW_AUTHOR' => !is_classic_user(), 349 'F_ACTION' => $url_self, 350 'KEY' => $key, 351 'CONTENT' => stripslashes(@$_POST['content']), 352 'SHOW_AUTHOR' => !is_classic_user(), 353 'AUTHOR_MANDATORY' => $conf['comments_author_mandatory'], 354 'AUTHOR' => stripslashes(@$_POST['author']), 355 'WEBSITE_URL' => stripslashes(@$_POST['website_url']), 356 'SHOW_EMAIL' => !is_classic_user() or empty($user['email']), 357 'EMAIL_MANDATORY' => $conf['comments_email_mandatory'], 358 'EMAIL' => stripslashes(@$_POST['email']), 343 359 ) 344 360 );
Note: See TracChangeset
for help on using the changeset viewer.