Changeset 9634
- Timestamp:
- Mar 12, 2011, 10:56:58 PM (13 years ago)
- Location:
- extensions/Comments_on_Albums
- Files:
-
- 13 added
- 3 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_on_Albums/changelog.txt
r9624 r9634 1 0.1.a 1 0.2 2 - Test version 2 3 - bug corrected on coa_admin_comments.php 4 - public listing is available 5 - table is created in utf8 3 6 4 7 0.1 -
extensions/Comments_on_Albums/include/coa_admin_comments.php
r9624 r9634 127 127 128 128 // template 129 $template->set_filename('comments', dirname(__FILE__) .'/../template/coa_admin .tpl');129 $template->set_filename('comments', dirname(__FILE__) .'/../template/coa_admin_comments.tpl'); 130 130 $template->assign(array( 131 131 'F_ACTION' => get_root_url().'admin.php?page=comments&section=albums', -
extensions/Comments_on_Albums/include/coa_admin_intro.php
r9624 r9634 10 10 list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); 11 11 12 $template->assign(' NB_COMMENTS', l10n_dec('%d comment', '%d comments', $nb_comments) .' ('. l10n('Albums') .')');12 $template->assign('DB_COMMENTS_ALBUMS', l10n_dec('%d comment', '%d comments', $nb_comments)); 13 13 14 14 // unvalidated comments … … 28 28 29 29 // template 30 $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/coa_ intro.tpl');30 $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/coa_admin_intro.tpl'); 31 31 $template->concat('ADMIN_CONTENT', $template->parse('comments_on_albums', true)); 32 32 -
extensions/Comments_on_Albums/include/coa_albums.php
r9624 r9634 27 27 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions 28 28 check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID); 29 $author_id = get_comment_author_id ($_GET['comment_to_edit']);29 $author_id = get_comment_author_id_albums($_GET['comment_to_edit']); 30 30 31 31 if (can_manage_comment('edit', $author_id)) { 32 32 if (!empty($_POST['content'])) { 33 update_user_comment (array(33 update_user_comment_albums(array( 34 34 'comment_id' => $_GET['comment_to_edit'], 35 35 'image_id' => $category['id'], … … 49 49 include_once(COA_PATH.'include/functions_comment.inc.php'); 50 50 check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID); 51 $author_id = get_comment_author_id ($_GET['comment_to_delete']);51 $author_id = get_comment_author_id_albums($_GET['comment_to_delete']); 52 52 53 53 if (can_manage_comment('delete', $author_id)) { 54 delete_user_comment ($_GET['comment_to_delete']);54 delete_user_comment_albums($_GET['comment_to_delete']); 55 55 } 56 56 … … 62 62 include_once(COA_PATH.'include/functions_comment.inc.php'); 63 63 check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID); 64 $author_id = get_comment_author_id ($_GET['comment_to_validate']);64 $author_id = get_comment_author_id_albums($_GET['comment_to_validate']); 65 65 66 66 if (can_manage_comment('validate', $author_id)) { 67 validate_user_comment ($_GET['comment_to_validate']);67 validate_user_comment_albums($_GET['comment_to_validate']); 68 68 } 69 69 … … 124 124 } 125 125 126 // number of comments for this picture126 // number of comments for this category 127 127 $query = 'SELECT COUNT(*) AS nb_comments 128 128 FROM '.COA_TABLE.' -
extensions/Comments_on_Albums/include/functions_comment.inc.php
r9624 r9634 3 3 4 4 //returns string action to perform on a new comment: validate, moderate, reject 5 function user_comment_check($action, $comment) 6 { 7 global $conf,$user; 8 9 if ($action=='reject') 10 return $action; 11 12 $my_action = $conf['comment_spam_reject'] ? 'reject':'moderate'; 13 14 if ($action==$my_action) 15 return $action; 16 17 // we do here only BASIC spam check (plugins can do more) 18 if ( !is_a_guest() ) 19 return $action; 20 21 $link_count = preg_match_all( '/https?:\/\//', 22 $comment['content'], $matches); 23 24 if ( strpos($comment['author'], 'http://')!==false ) 25 { 26 $link_count++; 27 } 28 29 if ( $link_count>$conf['comment_spam_max_links'] ) 30 return $my_action; 31 32 return $action; 5 if (!function_exists('user_comment_check')) { 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 } 33 35 } 34 36 … … 44 46 * @param array infos out array of messages 45 47 */ 46 function insert_user_comment ( &$comm, $key, &$infos )48 function insert_user_comment_albums( &$comm, $key, &$infos ) 47 49 { 48 50 global $conf, $user; … … 185 187 * @param comment_id 186 188 */ 187 function delete_user_comment ($comment_id) {189 function delete_user_comment_albums($comment_id) { 188 190 $user_where_clause = ''; 189 191 if (!is_admin()) … … 216 218 */ 217 219 218 function update_user_comment ($comment, $post_key)220 function update_user_comment_albums($comment, $post_key) 219 221 { 220 222 global $conf; … … 259 261 } 260 262 261 function email_admin($action, $comment) 262 { 263 global $conf; 264 265 if (!in_array($action, array('edit', 'delete')) 266 or (($action=='edit') and !$conf['email_admin_on_comment_edition']) 267 or (($action=='delete') and !$conf['email_admin_on_comment_deletion'])) 268 { 269 return; 270 } 271 272 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 273 274 $keyargs_content = array(); 275 $keyargs_content[] = get_l10n_args('Author: %s', $comment['author']); 276 if ($action=='delete') 277 { 278 $keyargs_content[] = get_l10n_args('This author removed the comment with id %d', 279 $comment['comment_id'] 280 ); 281 } 282 else 283 { 284 $keyargs_content[] = get_l10n_args('This author modified following comment:', ''); 285 $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']); 286 } 287 288 pwg_mail_notification_admins(get_l10n_args('Comment by %s', 289 $comment['author']), 290 $keyargs_content 291 ); 292 } 293 294 function get_comment_author_id($comment_id, $die_on_error=true) 263 if (!function_exists('email_admin')) { 264 function email_admin($action, $comment) 265 { 266 global $conf; 267 268 if (!in_array($action, array('edit', 'delete')) 269 or (($action=='edit') and !$conf['email_admin_on_comment_edition']) 270 or (($action=='delete') and !$conf['email_admin_on_comment_deletion'])) 271 { 272 return; 273 } 274 275 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 276 277 $keyargs_content = array(); 278 $keyargs_content[] = get_l10n_args('Author: %s', $comment['author']); 279 if ($action=='delete') 280 { 281 $keyargs_content[] = get_l10n_args('This author removed the comment with id %d', 282 $comment['comment_id'] 283 ); 284 } 285 else 286 { 287 $keyargs_content[] = get_l10n_args('This author modified following comment:', ''); 288 $keyargs_content[] = get_l10n_args('Comment: %s', $comment['content']); 289 } 290 291 pwg_mail_notification_admins(get_l10n_args('Comment by %s', 292 $comment['author']), 293 $keyargs_content 294 ); 295 } 296 } 297 298 function get_comment_author_id_albums($comment_id, $die_on_error=true) 295 299 { 296 300 $query = ' … … 318 322 } 319 323 320 function validate_user_comment ($comment_id)324 function validate_user_comment_albums($comment_id) 321 325 { 322 326 $query = ' -
extensions/Comments_on_Albums/main.inc.php
r9624 r9634 2 2 /* 3 3 Plugin Name: Comment on Albums 4 Version: 0. 1.a4 Version: 0.2 5 5 Description: Allows users to comment albums 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512 … … 17 17 // +-----------------------------------------------------------------------+ 18 18 define('COA_NAME' , 'Comment on Albums'); 19 define('COA_VERSION', '0. 1.a');19 define('COA_VERSION', '0.2'); 20 20 define('COA_DIR' , basename(dirname(__FILE__))); 21 21 define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/'); … … 27 27 // +-----------------------------------------------------------------------+ 28 28 add_event_handler('loc_end_index', 'COA_index'); 29 add_event_handler('loc_after_page_header', 'COA_comments_page'); 29 30 add_event_handler('loc_end_admin', 'COA_admin'); 30 31 31 32 32 33 // +-----------------------------------------------------------------------+ 33 // F onctions34 // Functions 34 35 // +-----------------------------------------------------------------------+ 35 36 … … 39 40 if ($page['section'] == 'categories' AND isset($page['category'])) { 40 41 include(COA_PATH . 'include/coa_albums.php'); 42 } 43 } 44 45 function COA_comments_page() { 46 global $template, $page, $conf; 47 48 if ($page['body_id'] == 'theCommentsPage') { 49 include(COA_PATH . 'include/coa_comments_page.php'); 41 50 } 42 51 } -
extensions/Comments_on_Albums/maintain.inc.php
r9624 r9634 16 16 `validation_date` datetime DEFAULT NULL, 17 17 PRIMARY KEY (`id`) 18 ) ;");18 ) DEFAULT CHARSET=utf8;"); 19 19 } 20 20 -
extensions/Comments_on_Albums/template/coa_albums.tpl
r9624 r9634 1 1 {combine_script id="jquery"} 2 {combine_css path=$COA_PATH|@cat:'template/style .css'}2 {combine_css path=$COA_PATH|@cat:'template/style_albums.css'} 3 3 4 {footer_script equire="jquery"}{literal}4 {footer_script require="jquery"}{literal} 5 5 // cancel all color changements and set default color to comments 6 6 jQuery('.thumbnailCategory').css('color', jQuery('body').css('color'));
Note: See TracChangeset
for help on using the changeset viewer.