Changeset 10213
- Timestamp:
- Apr 9, 2011, 6:40:27 PM (13 years ago)
- Location:
- extensions/Comments_on_Albums
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_on_Albums/include/coa_albums.php
r9766 r10213 31 31 if (can_manage_comment('edit', $author_id)) { 32 32 if (!empty($_POST['content'])) { 33 update_user_comment_albums(array( 34 'comment_id' => $_GET['comment_to_edit'], 35 'image_id' => $category['id'], 36 'content' => $_POST['content'] 37 ), $_POST['key']); 38 39 redirect($url_self); 33 $comment_action = update_user_comment_albums( 34 array( 35 'comment_id' => $_GET['comment_to_edit'], 36 'image_id' => $category['id'], 37 'content' => $_POST['content'] 38 ), 39 $_POST['key'] 40 ); 41 42 $infos = array(); 43 44 switch ($comment_action) 45 { 46 case 'moderate': 47 array_push($infos, l10n('An administrator must authorize your comment before it is visible.')); 48 case 'validate': 49 array_push($infos, l10n('Your comment has been registered')); 50 break; 51 case 'reject': 52 set_status_header(403); 53 array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules')); 54 break; 55 default: 56 trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING); 57 } 58 59 $template->assign( 60 ($comment_action=='reject') ? 'errors' : 'infos', 61 $infos 62 ); 63 64 unset($_POST['content']); 65 break; 40 66 } else { 41 67 $edit_comment = $_GET['comment_to_edit']; -
extensions/Comments_on_Albums/include/functions_comment.inc.php
r9634 r10213 217 217 * @param content 218 218 */ 219 220 219 function update_user_comment_albums($comment, $post_key) 220 { 221 global $conf; 222 223 $comment_action = 'validate'; 224 225 if ( !verify_ephemeral_key($post_key, $comment['image_id']) ) 226 { 227 $comment_action='reject'; 228 } 229 230 // perform more spam check 231 $comment_action = 232 trigger_event('user_comment_check', 233 $comment_action, 234 array_merge($comment, 235 array('author' => $GLOBALS['user']['username']) 236 ) 237 ); 238 239 if ( $comment_action!='reject' ) 240 { 241 $user_where_clause = ''; 242 if (!is_admin()) 243 { 244 $user_where_clause = ' AND author_id = \''. 245 $GLOBALS['user']['id'].'\''; 246 } 247 248 // should the updated comment must be validated 249 if (!$conf['comments_validation'] or is_admin()) 250 { 251 $comment_action='validate'; //one of validate, moderate, reject 252 } 253 else 254 { 255 $comment_action='moderate'; //one of validate, moderate, reject 256 } 257 258 $query = ' 259 UPDATE '.COA_TABLE.' 260 SET content = \''.$comment['content'].'\', 261 validated = \''.($comment_action=='validate' ? 'true':'false').'\', 262 validation_date = '.($comment_action=='validate' ? 'NOW()':'NULL').' 263 WHERE id = '.$comment['comment_id']. 264 $user_where_clause.' 265 ;'; 266 $result = pwg_query($query); 267 268 // mail admin and ask to validate the comment 269 if ($result and $conf['email_admin_on_comment_validation'] and 'moderate' == $comment_action) 270 { 271 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 272 273 $comment_url = get_absolute_root_url().'comments.php?display_mode=albums&comment_id='.$comment['comment_id']; 274 275 $keyargs_content = array 276 ( 277 get_l10n_args('Author: %s', stripslashes($GLOBALS['user']['username']) ), 278 get_l10n_args('Comment: %s', stripslashes($comment['content']) ), 279 get_l10n_args('', ''), 280 get_l10n_args('Manage this user comment: %s', $comment_url), 281 get_l10n_args('', ''), 282 get_l10n_args('(!) This comment requires validation', ''), 283 ); 284 285 pwg_mail_notification_admins 286 ( 287 get_l10n_args('Comment by %s', stripslashes($GLOBALS['user']['username']) ), 288 $keyargs_content 289 ); 290 } 291 // just mail admin 292 else if ($result) 293 { 294 email_admin('edit', array('author' => $GLOBALS['user']['username'], 295 'content' => stripslashes($comment['content'])) ); 296 } 297 } 298 299 return $comment_action; 300 } 301 302 /* function update_user_comment_albums($comment, $post_key) 221 303 { 222 304 global $conf; … … 259 341 } 260 342 } 261 } 343 }*/ 262 344 263 345 if (!function_exists('email_admin')) { -
extensions/Comments_on_Albums/main.inc.php
r9968 r10213 2 2 /* 3 3 Plugin Name: Comments on Albums 4 Version: 1. 04 Version: 1.1 5 5 Description: Activate comments on albums pages 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512 … … 40 40 global $template, $page, $conf, $pwg_loaded_plugins; 41 41 42 if ($page['section'] == 'categories' AND isset($page['category'])) { 42 if ($page['section'] == 'categories' AND isset($page['category']) 43 AND (!isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0)) 44 { 45 43 46 if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) set_bbcode_bar(); 44 47 else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) set_smiliessupport();
Note: See TracChangeset
for help on using the changeset viewer.