- Timestamp:
- May 22, 2011, 12:34:18 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_on_Albums/include/functions_comment.inc.php
r10301 r10984 4 4 //returns string action to perform on a new comment: validate, moderate, reject 5 5 if (!function_exists('user_comment_check')) { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 6 function user_comment_check($action, $comment) 7 { 8 global $conf,$user; 9 10 if ($action=='reject') 11 return $action; 12 13 $my_action = $conf['comment_spam_reject'] ? 'reject':'moderate'; 14 15 if ($action==$my_action) 16 return $action; 17 18 // we do here only BASIC spam check (plugins can do more) 19 if ( !is_a_guest() ) 20 return $action; 21 22 $link_count = preg_match_all( '/https?:\/\//', 23 $comment['content'], $matches); 24 25 if ( strpos($comment['author'], 'http://')!==false ) 26 { 27 $link_count++; 28 } 29 30 if ( $link_count>$conf['comment_spam_max_links'] ) 31 return $my_action; 32 33 return $action; 34 } 35 35 } 36 36 … … 231 231 $comment_action = 232 232 trigger_event('user_comment_check', 233 234 235 236 237 233 $comment_action, 234 array_merge($comment, 235 array('author' => $GLOBALS['user']['username']) 236 ) 237 ); 238 238 239 239 if ( $comment_action!='reject' ) … … 243 243 { 244 244 $user_where_clause = ' AND author_id = \''. 245 245 $GLOBALS['user']['id'].'\''; 246 246 } 247 247 … … 293 293 { 294 294 email_admin('edit', array('author' => $GLOBALS['user']['username'], 295 295 'content' => stripslashes($comment['content'])) ); 296 296 } 297 297 } … … 301 301 302 302 if (!function_exists('email_admin')) { 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 303 function email_admin($action, $comment) 304 { 305 global $conf; 306 307 if (!in_array($action, array('edit', 'delete')) 308 or (($action=='edit') and !$conf['email_admin_on_comment_edition']) 309 or (($action=='delete') and !$conf['email_admin_on_comment_deletion'])) 310 { 311 return; 312 } 313 314 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 315 316 $keyargs_content = array(); 317 $keyargs_content[] = get_l10n_args('Author: %s', $comment['author']); 318 if ($action=='delete') 319 { 320 $keyargs_content[] = get_l10n_args('This author removed the comment with id %d', 321 $comment['comment_id'] 322 ); 323 } 324 else 325 { 326 $keyargs_content[] = get_l10n_args('This author modified following comment:', ''); 327 $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']); 328 } 329 330 pwg_mail_notification_admins(get_l10n_args('Comment by %s', 331 $comment['author']), 332 $keyargs_content 333 ); 334 } 335 335 } 336 336
Note: See TracChangeset
for help on using the changeset viewer.