Changeset 10984
- Timestamp:
- 05/22/11 12:34:18 (2 years ago)
- Location:
- extensions/Comments_on_Albums
- Files:
-
- 1 removed
- 24 modified
-
admin.php (modified) (1 diff)
-
admin/config.php (modified) (2 diffs)
-
admin/template/config.tpl (modified) (1 diff)
-
admin/template/style.css (modified) (1 diff)
-
include/coa_admin_comments.php (modified) (3 diffs)
-
include/coa_admin_intro.php (modified) (2 diffs)
-
include/coa_albums.php (modified) (1 diff)
-
include/coa_comments_page.php (modified) (1 diff)
-
include/functions_comment.inc.php (modified) (5 diffs)
-
language/de_DE/plugin.lang.php (modified) (1 diff)
-
language/en_UK/plugin.lang.php (modified) (1 diff)
-
language/fr_FR/plugin.lang.php (modified) (1 diff)
-
language/hu_HU/plugin.lang.php (modified) (1 diff)
-
language/it_IT/plugin.lang.php (modified) (1 diff)
-
main.inc.php (modified) (4 diffs)
-
maintain.inc.php (modified) (1 diff)
-
template/coa_admin_comments.tpl (modified) (2 diffs)
-
template/coa_admin_intro.tpl (modified) (1 diff)
-
template/coa_albums.tpl (modified) (2 diffs)
-
template/coa_comments_page.tpl (modified) (3 diffs)
-
template/coa_messages.tpl (modified) (1 diff)
-
template/navigation_bar.tpl (modified) (1 diff)
-
template/style_albums.css (modified) (1 diff)
-
template/style_albums_sylvia.css (modified) (1 diff)
-
template/style_comments.css (deleted)
Legend:
- Unmodified
- Added
- Removed
-
extensions/Comments_on_Albums/admin.php
r9641 r10984 6 6 7 7 // +-----------------------------------------------------------------------+ 8 // Tabsheet8 // Tabsheet 9 9 // +-----------------------------------------------------------------------+ 10 10 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 11 11 $page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'config'; 12 12 13 13 $tabsheet = new tabsheet(); 14 $tabsheet->add('config', l10n('Configuration'), COA_ADMIN . '-config'); // Configuration14 $tabsheet->add('config', l10n('Configuration'), COA_ADMIN . '-config'); // Configuration 15 15 $tabsheet->select($page['tab']); 16 16 $tabsheet->assign(); 17 17 18 18 // +-----------------------------------------------------------------------+ 19 // Template19 // Template 20 20 // +-----------------------------------------------------------------------+ 21 21 $template->assign(array( 22 'COA_VERSION' => COA_NAME . ' ' . COA_VERSION, 23 'COA_PATH' => COA_PATH, 24 'COA_ADMIN' => COA_ADMIN, 22 'COA_PATH' => COA_PATH, 23 'COA_ADMIN' => COA_ADMIN, 25 24 )); 26 25 -
extensions/Comments_on_Albums/admin/config.php
r9766 r10984 3 3 4 4 // +-----------------------------------------------------------------------+ 5 // Save configuration5 // Save configuration 6 6 // +-----------------------------------------------------------------------+ 7 7 if (isset($_POST['config_submit'])) { 8 $conf['comments_on_albums'] = array(9 'icon_color' => $_POST['icon_color'],10 'icon_color_over' => $_POST['icon_color_over'],11 );12 13 pwg_query("UPDATE " . CONFIG_TABLE . " SET `value` = '" . serialize($conf['comments_on_albums']) . "' WHERE `param` = 'comments_on_albums';");14 array_push($page['infos'], l10n('Information data registered in database'));15 } 8 $conf['comments_on_albums'] = array( 9 'icon_color' => $_POST['icon_color'], 10 'icon_color_over' => $_POST['icon_color_over'], 11 ); 12 13 conf_update_param('comments_on_albums', serialize($conf['comments_on_albums'])); 14 array_push($page['infos'], l10n('Information data registered in database')); 15 } 16 16 17 17 18 18 // +-----------------------------------------------------------------------+ 19 // Template19 // Template 20 20 // +-----------------------------------------------------------------------+ 21 21 … … 23 23 $dh = opendir(COA_PATH . 'template/s26'); 24 24 while (($file = readdir($dh)) !== false ) { 25 if ($file !== '.' AND $file !== '..'26 AND in_array(strtolower(end(explode('.', $file))), array('jpg', 'png', 'gif'))) {27 $template->append('COLORS', $file);28 }25 if ($file !== '.' AND $file !== '..' 26 AND in_array(strtolower(end(explode('.', $file))), array('jpg', 'png', 'gif'))) { 27 $template->append('COLORS', $file); 28 } 29 29 } 30 30 closedir($dh); 31 31 32 32 $template->assign(array( 33 'ICON_COLOR' => $conf['comments_on_albums']['icon_color'],34 'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'],33 'ICON_COLOR' => $conf['comments_on_albums']['icon_color'], 34 'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'], 35 35 )); 36 36 -
extensions/Comments_on_Albums/admin/template/config.tpl
r10301 r10984 4 4 {footer_script require='jquery'} 5 5 {literal} 6 jQuery().ready(function(){7 // Cluetip8 jQuery('.cluetip').cluetip({9 width: 550,10 splitTitle: '|'11 });12 {/literal} 13 jQuery('select').change(function() {ldelim}14 jQuery('#' + jQuery(this).attr('name') + '_live').attr('src', '{$COA_PATH}template/s26/' + jQuery(this).val());15 });16 });6 jQuery().ready(function(){ 7 // Cluetip 8 jQuery('.cluetip').cluetip({ 9 width: 550, 10 splitTitle: '|' 11 }); 12 {/literal} 13 jQuery('select').change(function() {ldelim} 14 jQuery('#' + jQuery(this).attr('name') + '_live').attr('src', '{$COA_PATH}template/s26/' + jQuery(this).val()); 15 }); 16 }); 17 17 {/footer_script} 18 18 19 19 {html_head} 20 20 <style type="text/css"> 21 .cluetip:after {ldelim}22 content:url('{$themeconf.admin_icon_dir}/help.png');23 }21 .cluetip:after {ldelim} 22 content:url('{$themeconf.admin_icon_dir}/help.png'); 23 } 24 24 </style> 25 25 {/html_head} 26 26 27 <h2 class="version_title"> {$COA_VERSION}</h2>27 <h2 class="version_title">Comments on Albums</h2> 28 28 29 29 <div class="titrePage"> 30 <h2>{'Configuration'|@translate}</h2>30 <h2>{'Configuration'|@translate}</h2> 31 31 </div> 32 32 33 33 <form method="post" action="" class="properties" id="CR_config"> 34 <fieldset>35 <legend><span class="title cluetip" title="{'COA_icon_pack'|@translate}|{'COA_help_icon_pack'|@translate}">{'COA_icon_pack'|@translate}</span></legend>36 <table> 37 <tr>38 <td><span class="title">{'COA_icon_normal'|@translate}</span></td>39 <td>40 <select name="icon_color">41 {foreach from=$COLORS item=COLOR}42 <option value="{$COLOR}" {if $COLOR == $ICON_COLOR}selected="selected"{/if}>{$COLOR}</option>43 {/foreach}44 </select>45 46 <img id="icon_color_live" class="pwg-icon" src="{$COA_PATH}template/s26/{$ICON_COLOR}"/>47 </td>48 </tr>49 <tr>50 <td><span class="title">{'COA_icon_over'|@translate}</span></td>51 <td>52 <select name="icon_color_over">53 {foreach from=$COLORS item=COLOR}54 <option value="{$COLOR}" style="color:#{$COLOR};" {if $COLOR == $ICON_COLOR_OVER}selected="selected"{/if}>{$COLOR}</option>55 {/foreach}56 </select>57 58 <img id="icon_color_over_live" class="pwg-icon" src="{$COA_PATH}template/s26/{$ICON_COLOR_OVER}"/>59 </td>60 </tr>61 </table>62 </fieldset>34 <fieldset> 35 <legend><span class="title cluetip" title="{'COA_icon_pack'|@translate}|{'COA_help_icon_pack'|@translate}">{'COA_icon_pack'|@translate}</span></legend> 36 <table> 37 <tr> 38 <td><span class="title">{'COA_icon_normal'|@translate}</span></td> 39 <td> 40 <select name="icon_color"> 41 {foreach from=$COLORS item=COLOR} 42 <option value="{$COLOR}" {if $COLOR == $ICON_COLOR}selected="selected"{/if}>{$COLOR}</option> 43 {/foreach} 44 </select> 45 46 <img id="icon_color_live" class="pwg-icon" src="{$COA_PATH}template/s26/{$ICON_COLOR}"/> 47 </td> 48 </tr> 49 <tr> 50 <td><span class="title">{'COA_icon_over'|@translate}</span></td> 51 <td> 52 <select name="icon_color_over"> 53 {foreach from=$COLORS item=COLOR} 54 <option value="{$COLOR}" style="color:#{$COLOR};" {if $COLOR == $ICON_COLOR_OVER}selected="selected"{/if}>{$COLOR}</option> 55 {/foreach} 56 </select> 57 58 <img id="icon_color_over_live" class="pwg-icon" src="{$COA_PATH}template/s26/{$ICON_COLOR_OVER}"/> 59 </td> 60 </tr> 61 </table> 62 </fieldset> 63 63 64 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="config_submit"/></p>64 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="config_submit"/></p> 65 65 </form> 66 66 -
extensions/Comments_on_Albums/admin/template/style.css
r9968 r10984 1 1 .titrePage { 2 clear:right;2 clear:right; 3 3 } 4 4 5 6 5 table { 7 width:80%;6 width:80%; 8 7 } 9 8 td { 10 width:50%;11 white-space: nowrap;9 width:50%; 10 white-space: nowrap; 12 11 } 13 12 .title { 14 display:block;15 font-weight:bold;16 text-align:right;17 margin-right:10px;13 display:block; 14 font-weight:bold; 15 text-align:right; 16 margin-right:10px; 18 17 } 19 18 .title.cluetip:after { 20 margin-left:5px;21 vertical-align:top;19 margin-left:5px; 20 vertical-align:top; 22 21 } 23 22 24 23 .pwg-icon { 25 margin:-5px 0;24 margin:-5px 0; 26 25 } 27 26 28 27 .version_title { 29 float:right;30 position:relative;31 top:-24px;32 margin-bottom:-20px !important;33 font-size:12px !important;34 font-style:italic;35 font-weight:normal;28 float:right; 29 position:relative; 30 top:-24px; 31 margin-bottom:-20px !important; 32 font-size:12px !important; 33 font-style:italic; 34 font-weight:normal; 36 35 } -
extensions/Comments_on_Albums/include/coa_admin_comments.php
r9766 r10984 6 6 7 7 // +-----------------------------------------------------------------------+ 8 // Tabsheet8 // Tabsheet 9 9 // +-----------------------------------------------------------------------+ 10 10 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); 11 11 12 12 $tabs = array( 13 array(14 'code' => 'pictures',15 'label' => l10n('COA_comments_photos'),16 ),17 array(18 'code' => 'albums',19 'label' => l10n('COA_comments_albums'),20 ),13 array( 14 'code' => 'pictures', 15 'label' => l10n('COA_comments_photos'), 16 ), 17 array( 18 'code' => 'albums', 19 'label' => l10n('COA_comments_albums'), 20 ), 21 21 ); 22 22 … … 24 24 25 25 if (isset($_GET['section']) and in_array($_GET['section'], $tab_codes)) { 26 $page['tab'] = $_GET['section'];26 $page['tab'] = $_GET['section']; 27 27 } else { 28 $page['tab'] = $tabs[0]['code'];28 $page['tab'] = $tabs[0]['code']; 29 29 } 30 30 31 31 $tabsheet = new tabsheet(); 32 32 foreach ($tabs as $tab) { 33 $tabsheet->add(34 $tab['code'],35 $tab['label'],36 get_root_url().'admin.php?page=comments&section='.$tab['code']37 );33 $tabsheet->add( 34 $tab['code'], 35 $tab['label'], 36 get_root_url().'admin.php?page=comments&section='.$tab['code'] 37 ); 38 38 } 39 39 $tabsheet->select($page['tab']); … … 42 42 43 43 if ($page['tab'] == 'albums') { 44 $template->clear_assign(array('ADMIN_CONTENT', 'comments', 'LIST', 'F_ACTION'));44 $template->clear_assign(array('ADMIN_CONTENT', 'comments', 'LIST', 'F_ACTION')); 45 45 46 // +-----------------------------------------------------------------------+47 //Actions48 // +-----------------------------------------------------------------------+49 if (!empty($_POST)) {50 if (!empty($_POST['comments'])) {51 check_input_parameter('comments', $_POST, true, PATTERN_ID);46 // +-----------------------------------------------------------------------+ 47 // Actions 48 // +-----------------------------------------------------------------------+ 49 if (!empty($_POST)) { 50 if (!empty($_POST['comments'])) { 51 check_input_parameter('comments', $_POST, true, PATTERN_ID); 52 52 53 if (isset($_POST['validate_albums'])) {54 $query = 'UPDATE '.COA_TABLE.' SET55 validated = \'true\',56 validation_date = NOW()57 WHERE id IN ('.implode(',', $_POST['comments']).')58 ;';59 pwg_query($query);53 if (isset($_POST['validate_albums'])) { 54 $query = 'UPDATE '.COA_TABLE.' SET 55 validated = \'true\', 56 validation_date = NOW() 57 WHERE id IN ('.implode(',', $_POST['comments']).') 58 ;'; 59 pwg_query($query); 60 60 61 array_push($page['infos'], l10n_dec(62 '%d user comment validated', '%d user comments validated',63 count($_POST['comments'])64 ));65 }61 array_push($page['infos'], l10n_dec( 62 '%d user comment validated', '%d user comments validated', 63 count($_POST['comments']) 64 )); 65 } 66 66 67 if (isset($_POST['reject_albums'])) {68 $query = 'DELETE FROM '.COA_TABLE.'69 WHERE id IN ('.implode(',', $_POST['comments']).')70 ;';71 pwg_query($query);67 if (isset($_POST['reject_albums'])) { 68 $query = 'DELETE FROM '.COA_TABLE.' 69 WHERE id IN ('.implode(',', $_POST['comments']).') 70 ;'; 71 pwg_query($query); 72 72 73 array_push($page['infos'], l10n_dec(74 '%d user comment rejected', '%d user comments rejected',75 count($_POST['comments'])76 ));77 }78 }79 }73 array_push($page['infos'], l10n_dec( 74 '%d user comment rejected', '%d user comments rejected', 75 count($_POST['comments']) 76 )); 77 } 78 } 79 } 80 80 81 // +-----------------------------------------------------------------------+82 //Infos (re-assignation needed)83 // +-----------------------------------------------------------------------+84 if (count($page['infos']) != 0) {85 $template->assign('infos', $page['infos']);86 }81 // +-----------------------------------------------------------------------+ 82 // Infos (re-assignation needed) 83 // +-----------------------------------------------------------------------+ 84 if (count($page['infos']) != 0) { 85 $template->assign('infos', $page['infos']); 86 } 87 87 88 // +-----------------------------------------------------------------------+89 //Comments display90 // +-----------------------------------------------------------------------+91 $list = array();88 // +-----------------------------------------------------------------------+ 89 // Comments display 90 // +-----------------------------------------------------------------------+ 91 $list = array(); 92 92 93 $query = 'SELECT94 com.id,95 com.category_id,96 com.date,97 com.author,98 '.$conf['user_fields']['username'].' AS username,99 com.content,100 cat.name101 FROM '.COA_TABLE.' AS com102 INNER JOIN '.CATEGORIES_TABLE.' AS cat103 ON cat.id = com.category_id104 LEFT JOIN '.USERS_TABLE.' AS u105 ON u.'.$conf['user_fields']['id'].' = com.author_id106 WHERE validated = \'false\'107 ORDER BY com.date DESC108 ;';109 $result = pwg_query($query);93 $query = 'SELECT 94 com.id, 95 com.category_id, 96 com.date, 97 com.author, 98 '.$conf['user_fields']['username'].' AS username, 99 com.content, 100 cat.name 101 FROM '.COA_TABLE.' AS com 102 INNER JOIN '.CATEGORIES_TABLE.' AS cat 103 ON cat.id = com.category_id 104 LEFT JOIN '.USERS_TABLE.' AS u 105 ON u.'.$conf['user_fields']['id'].' = com.author_id 106 WHERE validated = \'false\' 107 ORDER BY com.date DESC 108 ;'; 109 $result = pwg_query($query); 110 110 111 while ($row = pwg_db_fetch_assoc($result)) {112 // author113 if (empty($row['author_id'])) {114 $author_name = $row['author'];115 } else {116 $author_name = stripslashes($row['username']);117 }118 119 // comment content120 $template->append('comments', array(121 'CAT_URL' => PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$row['category_id'],122 'CAT_NAME' => $row['name'],123 'ID' => $row['id'],124 'AUTHOR' => trigger_event('render_comment_author', $author_name),125 'DATE' => format_date($row['date'], true),126 'CONTENT' => trigger_event('render_comment_content',$row['content']),127 ));111 while ($row = pwg_db_fetch_assoc($result)) { 112 // author 113 if (empty($row['author_id'])) { 114 $author_name = $row['author']; 115 } else { 116 $author_name = stripslashes($row['username']); 117 } 118 119 // comment content 120 $template->append('comments', array( 121 'CAT_URL' => PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$row['category_id'], 122 'CAT_NAME' => $row['name'], 123 'ID' => $row['id'], 124 'AUTHOR' => trigger_event('render_comment_author', $author_name), 125 'DATE' => format_date($row['date'], true), 126 'CONTENT' => trigger_event('render_comment_content',$row['content']), 127 )); 128 128 129 array_push($list, $row['id']);130 }129 array_push($list, $row['id']); 130 } 131 131 132 // template133 $template->set_filename('comments', dirname(__FILE__) .'/../template/coa_admin_comments.tpl');134 $template->assign(array(135 'F_ACTION' => get_root_url().'admin.php?page=comments&section=albums',136 'LIST' => implode(',', $list),137 ));138 $template->assign_var_from_handle('ADMIN_CONTENT', 'comments');132 // template 133 $template->set_filename('comments', dirname(__FILE__) .'/../template/coa_admin_comments.tpl'); 134 $template->assign(array( 135 'F_ACTION' => get_root_url().'admin.php?page=comments&section=albums', 136 'LIST' => implode(',', $list), 137 )); 138 $template->assign_var_from_handle('ADMIN_CONTENT', 'comments'); 139 139 } 140 140 -
extensions/Comments_on_Albums/include/coa_admin_intro.php
r9634 r10984 6 6 $query = ' 7 7 SELECT COUNT(*) 8 FROM '.COA_TABLE.'8 FROM '.COA_TABLE.' 9 9 ;'; 10 10 list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); … … 15 15 $query = ' 16 16 SELECT COUNT(*) 17 FROM '.COA_TABLE.'18 WHERE validated=\'false\'17 FROM '.COA_TABLE.' 18 WHERE validated=\'false\' 19 19 ;'; 20 20 list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); 21 21 22 22 if ($nb_comments > 0) { 23 $template->assign('unvalidated_albums', array(24 'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments&section=albums',25 'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)26 ));23 $template->assign('unvalidated_albums', array( 24 'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments&section=albums', 25 'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments) 26 )); 27 27 } 28 28 -
extensions/Comments_on_Albums/include/coa_albums.php
r10213 r10984 4 4 5 5 // +-----------------------------------------------------------------------+ 6 // Category's infos6 // Category's infos 7 7 // +-----------------------------------------------------------------------+ 8 8 $category = $page['category']; 9 9 10 10 $url_self = duplicate_index_url(array( 11 'category' => array(12 'id'=>$category['id'],13 'name'=>$category['name'],14 'permalink'=>$category['permalink']15 ),16 array('start')11 'category' => array( 12 'id'=>$category['id'], 13 'name'=>$category['name'], 14 'permalink'=>$category['permalink'] 15 ), 16 array('start') 17 17 )); 18 18 19 19 20 20 // +-----------------------------------------------------------------------+ 21 // Actions21 // Actions 22 22 // +-----------------------------------------------------------------------+ 23 23 if (isset($_GET['action'])) { 24 switch ($_GET['action']) {25 case 'edit_comment' : {26 check_pwg_token();27 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions28 check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID);29 $author_id = get_comment_author_id_albums($_GET['comment_to_edit']);30 31 if (can_manage_comment('edit', $author_id)) {32 if (!empty($_POST['content'])) {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 $infos62 );63 64 unset($_POST['content']);65 break;66 } else {67 $edit_comment = $_GET['comment_to_edit'];68 break;69 }70 }71 }72 case 'delete_comment' : {73 check_pwg_token();74 include_once(COA_PATH.'include/functions_comment.inc.php');75 check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID);76 $author_id = get_comment_author_id_albums($_GET['comment_to_delete']);77 78 if (can_manage_comment('delete', $author_id)) {79 delete_user_comment_albums($_GET['comment_to_delete']);80 }81 82 redirect($url_self);83 }84 case 'validate_comment' : {85 check_pwg_token();86 include_once(COA_PATH.'include/functions_comment.inc.php');87 check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID);88 $author_id = get_comment_author_id_albums($_GET['comment_to_validate']);89 90 if (can_manage_comment('validate', $author_id)) {91 validate_user_comment_albums($_GET['comment_to_validate']);92 }93 94 redirect($url_self);95 }96 }24 switch ($_GET['action']) { 25 case 'edit_comment' : { 26 check_pwg_token(); 27 include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions 28 check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID); 29 $author_id = get_comment_author_id_albums($_GET['comment_to_edit']); 30 31 if (can_manage_comment('edit', $author_id)) { 32 if (!empty($_POST['content'])) { 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; 66 } else { 67 $edit_comment = $_GET['comment_to_edit']; 68 break; 69 } 70 } 71 } 72 case 'delete_comment' : { 73 check_pwg_token(); 74 include_once(COA_PATH.'include/functions_comment.inc.php'); 75 check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID); 76 $author_id = get_comment_author_id_albums($_GET['comment_to_delete']); 77 78 if (can_manage_comment('delete', $author_id)) { 79 delete_user_comment_albums($_GET['comment_to_delete']); 80 } 81 82 redirect($url_self); 83 } 84 case 'validate_comment' : { 85 check_pwg_token(); 86 include_once(COA_PATH.'include/functions_comment.inc.php'); 87 check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID); 88 $author_id = get_comment_author_id_albums($_GET['comment_to_validate']); 89 90 if (can_manage_comment('validate', $author_id)) { 91 validate_user_comment_albums($_GET['comment_to_validate']); 92 } 93 94 redirect($url_self); 95 } 96 } 97 97 } 98 98 99 99 100 100 // +-----------------------------------------------------------------------+ 101 // Insert comment101 // Insert comment 102 102 // +-----------------------------------------------------------------------+ 103 103 if ($category['commentable'] and isset($_POST['content'])) { 104 if (is_a_guest() and !$conf['comments_forall']) {105 die('Session expired');106 }107 108 $comm = array(109 'author' => trim( @$_POST['author'] ),110 'content' => trim( $_POST['content'] ),111 'image_id' => $category['id'],112 );113 114 include_once(COA_PATH.'include/functions_comment.inc.php');115 $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $infos);116 117 switch ($comment_action) {118 case 'moderate':119 array_push($infos, l10n('An administrator must authorize your comment before it is visible.'));120 case 'validate':121 array_push($infos, l10n('Your comment has been registered'));122 break;123 case 'reject':124 set_status_header(403);125 array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules'));126 break;127 default:128 trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);129 }130 131 $template->assign(($comment_action=='reject') ? 'errors' : 'infos', $infos);132 trigger_action('user_comment_insertion', array_merge($comm, array('action'=>$comment_action)));133 104 if (is_a_guest() and !$conf['comments_forall']) { 105 die('Session expired'); 106 } 107 108 $comm = array( 109 'author' => trim( @$_POST['author'] ), 110 'content' => trim( $_POST['content'] ), 111 'image_id' => $category['id'], 112 ); 113 114 include_once(COA_PATH.'include/functions_comment.inc.php'); 115 $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $infos); 116 117 switch ($comment_action) { 118 case 'moderate': 119 array_push($infos, l10n('An administrator must authorize your comment before it is visible.')); 120 case 'validate': 121 array_push($infos, l10n('Your comment has been registered')); 122 break; 123 case 'reject': 124 set_status_header(403); 125 array_push($infos, l10n('Your comment has NOT been registered because it did not pass the validation rules')); 126 break; 127 default: 128 trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING); 129 } 130 131 $template->assign(($comment_action=='reject') ? 'errors' : 'infos', $infos); 132 trigger_action('user_comment_insertion', array_merge($comm, array('action'=>$comment_action))); 133 134 134 } elseif (isset($_POST['content'])) { 135 set_status_header(403);136 die('ugly spammer');135 set_status_header(403); 136 die('ugly spammer'); 137 137 } 138 138 139 139 140 140 // +-----------------------------------------------------------------------+ 141 // Display comments141 // Display comments 142 142 // +-----------------------------------------------------------------------+ 143 143 if ($category['commentable']) { 144 if (!is_admin()) {145 $validated_clause = " AND validated = 'true'";146 } else {147 $validated_clause = null;148 }149 150 // number of comments for this category151 $query = 'SELECT COUNT(*) AS nb_comments152 FROM '.COA_TABLE.'153 WHERE category_id = '.$category['id']154 .$validated_clause.'155 ;';156 $row = pwg_db_fetch_assoc(pwg_query($query));157 158 // navigation bar creation, custom again159 if (isset($_GET['start_comments'])) {160 $page['start_comments'] = $_GET['start_comments'];161 } else {162 $page['start_comments'] = 0;163 }164 include_once(COA_PATH.'include/functions.inc.php');165 166 $navigation_bar = create_comment_navigation_bar(167 duplicate_index_url(array(), array('start')),168 $row['nb_comments'],169 $page['start_comments'],170 $conf['nb_comment_page']171 );172 173 $template->assign(array(174 'COMMENT_COUNT' => $row['nb_comments'],175 'comment_navbar' => $navigation_bar,176 ));177 178 if ($row['nb_comments'] > 0) {179 // get comments180 $query = 'SELECT181 com.id,182 com.author,183 com.author_id,184 '.$conf['user_fields']['username'].' AS username,185 com.date,186 com.category_id,187 com.content,188 com.validated189 FROM '.COA_TABLE.' AS com190 LEFT JOIN '.USERS_TABLE.' AS u191 ON u.'.$conf['user_fields']['id'].' = author_id192 WHERE category_id = '.$category['id'].'193 '.$validated_clause.'194 ORDER BY date ASC195 LIMIT '.$conf['nb_comment_page'].' OFFSET '.$page['start_comments'].'196 ;';197 $result = pwg_query($query);198 199 while ($row = pwg_db_fetch_assoc($result)) {200 // author201 if (!empty($row['author'])) {202 $author = $row['author'];203 if ($author == 'guest') {204 $author = l10n('guest');205 }206 } else {207 $author = stripslashes($row['username']);208 }209 210 // comment content211 $tpl_comment = array(212 'AUTHOR' => trigger_event('render_comment_author', $author),213 'DATE' => format_date($row['date'], true),214 'CONTENT' => trigger_event('render_comment_content', $row['content']),215 );216 217 // rights218 if (can_manage_comment('delete', $row['author_id'])) {219 $tpl_comment['U_DELETE'] = add_url_params($url_self, array(220 'action' => 'delete_comment',221 'comment_to_delete' => $row['id'],222 'pwg_token' => get_pwg_token(),223 ));224 }225 if (can_manage_comment('edit', $row['author_id'])) {226 $tpl_comment['U_EDIT'] = add_url_params($url_self, array(227 'action' => 'edit_comment',228 'comment_to_edit' => $row['id'],229 'pwg_token' => get_pwg_token(),230 ));231 if (isset($edit_comment) and ($row['id'] == $edit_comment)) {232 $key = get_ephemeral_key(2, $category['id']);233 $tpl_comment['IN_EDIT'] = true;234 $tpl_comment['KEY'] = $key;235 $tpl_comment['CONTENT'] = $row['content'];236 }237 }238 if (is_admin() AND $row['validated'] != 'true') {239 $tpl_comment['U_VALIDATE'] = add_url_params($url_self, array(240 'action' => 'validate_comment',241 'comment_to_validate' => $row['id'],242 'pwg_token' => get_pwg_token(),243 ));244 }245 246 // template247 $template->append('comments', $tpl_comment);248 }249 }250 251 // comment form252 $show_add_comment_form = true;253 if (isset($edit_comment)) {254 $show_add_comment_form = false;255 }256 if (is_a_guest() and !$conf['comments_forall']) {257 $show_add_comment_form = false;258 }259 260 if ($show_add_comment_form) {261 $key = get_ephemeral_key(3, $category['id']);262 $content = null;263 if ('reject'===@$comment_action) {264 $content = htmlspecialchars(stripslashes($comm['content']));265 }266 $template->assign('comment_add', array(267 'F_ACTION' => $url_self,268 'KEY' => $key,269 'CONTENT' => $content,270 'SHOW_AUTHOR' => !is_classic_user(),271 ));272 }273 274 // template275 $template->assign(array(276 'COA_PATH' => COA_PATH, // for css277 'COA_ABSOLUTE_PATH' => dirname(__FILE__) .'/../', // for template278 ));279 280 $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/coa_albums.tpl');281 $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('comments_on_albums', true));282 283 $template->set_filename('comments_on_albums_messages', dirname(__FILE__) .'/../template/coa_messages.tpl');284 $template->concat('PLUGIN_INDEX_CONTENT_BEFORE', $template->parse('comments_on_albums_messages', true));144 if (!is_admin()) { 145 $validated_clause = " AND validated = 'true'"; 146 } else { 147 $validated_clause = null; 148 } 149 150 // number of comments for this category 151 $query = 'SELECT COUNT(*) AS nb_comments 152 FROM '.COA_TABLE.' 153 WHERE category_id = '.$category['id'] 154 .$validated_clause.' 155 ;'; 156 $row = pwg_db_fetch_assoc(pwg_query($query)); 157 158 // navigation bar creation, custom again 159 if (isset($_GET['start_comments'])) { 160 $page['start_comments'] = $_GET['start_comments']; 161 } else { 162 $page['start_comments'] = 0; 163 } 164 include_once(COA_PATH.'include/functions.inc.php'); 165 166 $navigation_bar = create_comment_navigation_bar( 167 duplicate_index_url(array(), array('start')), 168 $row['nb_comments'], 169 $page['start_comments'], 170 $conf['nb_comment_page'] 171 ); 172 173 $template->assign(array( 174 'COMMENT_COUNT' => $row['nb_comments'], 175 'comment_navbar' => $navigation_bar, 176 )); 177 178 if ($row['nb_comments'] > 0) { 179 // get comments 180 $query = 'SELECT 181 com.id, 182 com.author, 183 com.author_id, 184 '.$conf['user_fields']['username'].' AS username, 185 com.date, 186 com.category_id, 187 com.content, 188 com.validated 189 FROM '.COA_TABLE.' AS com 190 LEFT JOIN '.USERS_TABLE.' AS u 191 ON u.'.$conf['user_fields']['id'].' = author_id 192 WHERE category_id = '.$category['id'].' 193 '.$validated_clause.' 194 ORDER BY date ASC 195 LIMIT '.$conf['nb_comment_page'].' OFFSET '.$page['start_comments'].' 196 ;'; 197 $result = pwg_query($query); 198 199 while ($row = pwg_db_fetch_assoc($result)) { 200 // author 201 if (!empty($row['author'])) { 202 $author = $row['author']; 203 if ($author == 'guest') { 204 $author = l10n('guest'); 205 } 206 } else { 207 $author = stripslashes($row['username']); 208 } 209 210 // comment content 211 $tpl_comment = array( 212 'AUTHOR' => trigger_event('render_comment_author', $author), 213 'DATE' => format_date($row['date'], true), 214 'CONTENT' => trigger_event('render_comment_content', $row['content']), 215 ); 216 217 // rights 218 if (can_manage_comment('delete', $row['author_id'])) { 219 $tpl_comment['U_DELETE'] = add_url_params($url_self, array( 220 'action' => 'delete_comment', 221 'comment_to_delete' => $row['id'], 222 'pwg_token' => get_pwg_token(), 223 )); 224 } 225 if (can_manage_comment('edit', $row['author_id'])) { 226 $tpl_comment['U_EDIT'] = add_url_params($url_self, array( 227 'action' => 'edit_comment', 228 'comment_to_edit' => $row['id'], 229 'pwg_token' => get_pwg_token(), 230 )); 231 if (isset($edit_comment) and ($row['id'] == $edit_comment)) { 232 $key = get_ephemeral_key(2, $category['id']); 233 $tpl_comment['IN_EDIT'] = true; 234 $tpl_comment['KEY'] = $key; 235 $tpl_comment['CONTENT'] = $row['content']; 236 } 237 } 238 if (is_admin() AND $row['validated'] != 'true') { 239 $tpl_comment['U_VALIDATE'] = add_url_params($url_self, array( 240 'action' => 'validate_comment', 241 'comment_to_validate' => $row['id'], 242 'pwg_token' => get_pwg_token(), 243 )); 244 } 245 246 // template 247 $template->append('comments', $tpl_comment); 248 } 249 } 250 251 // comment form 252 $show_add_comment_form = true; 253 if (isset($edit_comment)) { 254 $show_add_comment_form = false; 255 } 256 if (is_a_guest() and !$conf['comments_forall']) { 257 $show_add_comment_form = false; 258 } 259 260 if ($show_add_comment_form) { 261 $key = get_ephemeral_key(3, $category['id']); 262 $content = null; 263 if ('reject'===@$comment_action) { 264 $content = htmlspecialchars(stripslashes($comm['content'])); 265 } 266 $template->assign('comment_add', array( 267 'F_ACTION' => $url_self, 268 'KEY' => $key, 269 'CONTENT' => $content, 270 'SHOW_AUTHOR' => !is_classic_user(), 271 )); 272 } 273 274 // template 275 $template->assign(array( 276 'COA_PATH' => COA_PATH, // for css 277 'COA_ABSOLUTE_PATH' => dirname(__FILE__) .'/../', // for template 278 )); 279 280 $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/coa_albums.tpl'); 281 $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('comments_on_albums', true)); 282 283 $template->set_filename('comments_on_albums_messages', dirname(__FILE__) .'/../template/coa_messages.tpl'); 284 $template->concat('PLUGIN_INDEX_CONTENT_BEFORE', $template->parse('comments_on_albums_messages', true)); 285 285 } 286 286 -
extensions/Comments_on_Albums/include/coa_comments_page.php
r9766 r10984 7 7 8 8 $template->assign(array( 9 'COA_PATH' => COA_PATH,10 'ICON_COLOR' => $conf['comments_on_albums']['icon_color'],11 'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'],9 'COA_PATH' => COA_PATH, 10 'ICON_COLOR' => $conf['comments_on_albums']['icon_color'], 11 'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'], 12 12 )); 13 13 14 14 15 15 // +-----------------------------------------------------------------------+ 16 // Main page (comments on photos)17 // +-----------------------------------------------------------------------+ 18 19 if (!isset($_GET['display_mode'])) { 20 // adds a button for switch page21 $template->set_prefilter('comments', 'coa_add_button');22 function coa_add_button($content, &$smarty) {23 $search = '<ul class="categoryActions">';16 // Main page (comments on photos) 17 // +-----------------------------------------------------------------------+ 18 19 if (!isset($_GET['display_mode'])) { 20 // adds a button for switch page 21 $template->set_prefilter('comments', 'coa_add_button'); 22 function coa_add_button($content, &$smarty) { 23 $search = '<ul class="categoryActions">'; 24 24 25 25 $replacement = ' 26 26 {html_head} 27 <style type="text/css">28 .pwg-icon-comments-albums {ldelim}29 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR});30 background-position: -26px 0;31 }32 a:hover .pwg-icon-comments-albums {ldelim}33 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR_OVER});34 background-position: -26px 0;35 }36 </style>27 <style type="text/css"> 28 .pwg-icon-comments-albums {ldelim} 29 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR}); 30 background-position: -26px 0; 31 } 32 a:hover .pwg-icon-comments-albums {ldelim} 33 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR_OVER}); 34 background-position: -26px 0; 35 } 36 </style> 37 37 {/html_head} 38 38 39 <ul class="categoryActions">40 <li><a href="comments.php?display_mode=albums" title="' . l10n('COA_comments_albums') . '" class="pwg-state-default pwg-button">41 <span class="pwg-icon pwg-icon-comments-albums"> </span><span class="pwg-button-text">' . l10n('COA_comments_albums') . '</span>42 </a></li>';43 44 return str_replace($search, $replacement, $content);45 }46 47 48 // +-----------------------------------------------------------------------+ 49 // Second page (comments on albums)39 <ul class="categoryActions"> 40 <li><a href="comments.php?display_mode=albums" title="' . l10n('COA_comments_albums') . '" class="pwg-state-default pwg-button"> 41 <span class="pwg-icon pwg-icon-comments-albums"> </span><span class="pwg-button-text">' . l10n('COA_comments_albums') . '</span> 42 </a></li>'; 43 44 return str_replace($search, $replacement, $content); 45 } 46 47 48 // +-----------------------------------------------------------------------+ 49 // Second page (comments on albums) 50 50 // +-----------------------------------------------------------------------+ 51 51 52 52 } else if ($_GET['display_mode'] == 'albums') { 53 // reset some template vars54 $template->clear_assign(array('comments', 'navbar', 'sort_by_options'));55 56 // sort_by : database fields proposed for sorting comments list57 $sort_by = array(58 'date' => l10n('comment date'),59 'category_id' => l10n('album')60 );61 $template->assign('sort_by_options', $sort_by);62 63 // +-----------------------------------------------------------------------+64 // | comments management |65 // +-----------------------------------------------------------------------+66 $comment_id = null;67 $action = null;68 69 $actions = array('delete_albums', 'validate_albums', 'edit_albums'); // different indexes to not interfer with the main process70 foreach ($actions as $loop_action) {71 if (isset($_GET[$loop_action])) {72 $action = $loop_action;73 check_input_parameter($action, $_GET, false, PATTERN_ID);74 $comment_id = $_GET[$action];75 break;76 }77 }78 79 if (isset($action)) {80 include_once(COA_PATH.'include/functions_comment.inc.php');81 check_pwg_token();82 $comment_author_id = get_comment_author_id_albums($comment_id);83 $true_action = str_replace('_albums', null, $action); // but we must check true action names84 85 if (can_manage_comment($true_action, $comment_author_id)) {86 $perform_redirect = false;87 88 if ('delete_albums' == $action) {89 delete_user_comment_albums($comment_id);90 $perform_redirect = true;91 }92 if ('validate_albums' == $action) {93 validate_user_comment_albums($comment_id);94 $perform_redirect = true;95 }96 if ('edit_albums' == $action) {97 if (!empty($_POST['content'])) {98 update_user_comment_albums(array(99 'comment_id' => $_GET['edit_albums'],100 'image_id' => $_POST['image_id'],101 'content' => $_POST['content']102 ), $_POST['key']103 );104 $perform_redirect = true;105 } else {106 $edit_comment = $_GET['edit_albums'];107 }108 }109 if ($perform_redirect) {110 $redirect_url = PHPWG_ROOT_PATH.'comments.php'.get_query_string_diff(array('delete_albums','validate_albums','edit_albums','pwg_token'));111 redirect($redirect_url);112 }113 }114 }115 116 // +-----------------------------------------------------------------------+117 // | navigation bar |118 // +-----------------------------------------------------------------------+119 if (isset($_GET['start']) and is_numeric($_GET['start'])) {120 $start = $_GET['start'];121 } else {122 $start = 0;123 }124 125 $query = 'SELECT COUNT(DISTINCT(com.id))126 FROM '.COA_TABLE.' AS com127 LEFT JOIN '.USERS_TABLE.' As u128 ON u.'.$conf['user_fields']['id'].' = com.author_id129 WHERE '.implode('130 AND ', $page['where_clauses']).'131 ;';132 list($counter) = pwg_db_fetch_row(pwg_query($query));133 134 $url = PHPWG_ROOT_PATH . 'comments.php' . get_query_string_diff(array('start','delete_albums','validate_albums','edit_albums','pwg_token'));135 $navbar = create_navigation_bar($url, $counter, $start, $page['items_number'], '');136 $template->assign('navbar', $navbar);137 138 // +-----------------------------------------------------------------------+139 // | last comments display |140 // +-----------------------------------------------------------------------+141 $comments = array();142 $element_ids = array();143 $category_ids = array();144 145 $query = 'SELECT146 com.id AS comment_id,147 com.category_id,148 com.author,149 com.author_id,150 '.$conf['user_fields']['username'].' AS username,151 com.date,152 com.content,153 com.validated154 FROM '.COA_TABLE.' AS com155 LEFT JOIN '.USERS_TABLE.' As u156 ON u.'.$conf['user_fields']['id'].' = com.author_id157 WHERE '.implode('158 AND ', $page['where_clauses']).'159 GROUP BY160 comment_id,161 com.category_id,162 com.author,163 com.author_id,164 com.date,165 com.content,166 com.validated167 ORDER BY '.$page['sort_by'].' '.$page['sort_order'];168 if ('all' != $page['items_number']) {169 $query.= '170 LIMIT '.$page['items_number'].' OFFSET '.$start;171 }172 $query.= '173 ;';174 $result = pwg_query($query);175 176 while ($row = pwg_db_fetch_assoc($result)) {177 array_push($comments, $row);178 array_push($element_ids, $row['category_id']);179 }180 181 if (count($comments) > 0) {182 // retrieving category informations183 $query = 'SELECT184 cat.id,185 cat.name,186 cat.permalink,187 cat.uppercats,188 com.id as comment_id189 FROM '.CATEGORIES_TABLE.' AS cat190 LEFT JOIN '.COA_TABLE.' AS com191 ON cat.id=com.category_id192 '.get_sql_condition_FandF(array(193 'forbidden_categories' => 'cat.id',194 'visible_categories' => 'cat.id'195 ), 'WHERE').'196 AND cat.id IN ('.implode(',', $element_ids).')197 ;';198 $categories = hash_from_query($query, 'comment_id');199 200 foreach ($comments as $comment) {201 // category202 $name = $categories[$comment['comment_id']]['name'];203 $url = duplicate_index_url(array(204 'category' => array(205 'id' => $categories[$comment['comment_id']]['id'],206 'name' => $categories[$comment['comment_id']]['name'],207 'permalink' => $categories[$comment['comment_id']]['permalink'],208 ),array('start')209 ));210 211 // comment content212 $tpl_comment = array(213 'CAT_URL' => $url,214 'CAT_NAME' => $name,215 'AUTHOR' => trigger_event('render_comment_author', $comment['author']),216 'DATE' => format_date($comment['date'], true),217 'CONTENT' => trigger_event('render_comment_content',$comment['content']),218 );219 220 // rights221 if (can_manage_comment('delete', $comment['author_id'])) {222 $url = get_root_url().'comments.php'.get_query_string_diff(array('delete','validate','edit', 'pwg_token'));223 224 $tpl_comment['U_DELETE'] = add_url_params($url, array(225 'delete_albums' => $comment['comment_id'],226 'pwg_token' => get_pwg_token(),227 ));228 }229 if (can_manage_comment('edit', $comment['author_id'])) {230 $url = get_root_url().'comments.php'.get_query_string_diff(array('edit', 'delete','validate', 'pwg_token'));231 232 $tpl_comment['U_EDIT'] = add_url_params($url, array(233 'edit_albums' => $comment['comment_id'],234 'pwg_token' => get_pwg_token(),235 ));236 237 if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) {238 $key = get_ephemeral_key(2, $comment['category_id']);239 $tpl_comment['IN_EDIT'] = true;240 $tpl_comment['KEY'] = $key;241 $tpl_comment['IMAGE_ID'] = $comment['category_id'];242 $tpl_comment['CONTENT'] = $comment['content'];243 }244 }245 if (can_manage_comment('validate', $comment['author_id'])) {246 if ('true' != $comment['validated']) {247 $tpl_comment['U_VALIDATE'] = add_url_params($url, array(248 'validate_albums'=> $comment['comment_id'],249 'pwg_token' => get_pwg_token(),250 ));251 }252 }253 254 $template->append('comments', $tpl_comment);255 }256 }257 258 // +-----------------------------------------------------------------------+259 // | template |260 // +-----------------------------------------------------------------------+261 $template->set_filenames(array('comments'=> dirname(__FILE__).'/../template/coa_comments_page.tpl'));262 263 // add a layer for display category name264 $template->set_prefilter('comments', 'coa_change_comments_list');265 function coa_change_comments_list($content, &$smarty) {266 $search = '<div class="description"{if isset($comment.IN_EDIT)} style="height:200px"{/if}>';53 // reset some template vars 54 $template->clear_assign(array('comments', 'navbar', 'sort_by_options')); 55 56 // sort_by : database fields proposed for sorting comments list 57 $sort_by = array( 58 'date' => l10n('comment date'), 59 'category_id' => l10n('album') 60 ); 61 $template->assign('sort_by_options', $sort_by); 62 63 // +-----------------------------------------------------------------------+ 64 // | comments management | 65 // +-----------------------------------------------------------------------+ 66 $comment_id = null; 67 $action = null; 68 69 $actions = array('delete_albums', 'validate_albums', 'edit_albums'); // different indexes to not interfer with the main process 70 foreach ($actions as $loop_action) { 71 if (isset($_GET[$loop_action])) { 72 $action = $loop_action; 73 check_input_parameter($action, $_GET, false, PATTERN_ID); 74 $comment_id = $_GET[$action]; 75 break; 76 } 77 } 78 79 if (isset($action)) { 80 include_once(COA_PATH.'include/functions_comment.inc.php'); 81 check_pwg_token(); 82 $comment_author_id = get_comment_author_id_albums($comment_id); 83 $true_action = str_replace('_albums', null, $action); // but we must check true action names 84 85 if (can_manage_comment($true_action, $comment_author_id)) { 86 $perform_redirect = false; 87 88 if ('delete_albums' == $action) { 89 delete_user_comment_albums($comment_id); 90 $perform_redirect = true; 91 } 92 if ('validate_albums' == $action) { 93 validate_user_comment_albums($comment_id); 94 $perform_redirect = true; 95 } 96 if ('edit_albums' == $action) { 97 if (!empty($_POST['content'])) { 98 update_user_comment_albums(array( 99 'comment_id' => $_GET['edit_albums'], 100 'image_id' => $_POST['image_id'], 101 'content' => $_POST['content'] 102 ), $_POST['key'] 103 ); 104 $perform_redirect = true; 105 } else { 106 $edit_comment = $_GET['edit_albums']; 107 } 108 } 109 if ($perform_redirect) { 110 $redirect_url = PHPWG_ROOT_PATH.'comments.php'.get_query_string_diff(array('delete_albums','validate_albums','edit_albums','pwg_token')); 111 redirect($redirect_url); 112 } 113 } 114 } 115 116 // +-----------------------------------------------------------------------+ 117 // | navigation bar | 118 // +-----------------------------------------------------------------------+ 119 if (isset($_GET['start']) and is_numeric($_GET['start'])) { 120 $start = $_GET['start']; 121 } else { 122 $start = 0; 123 } 124 125 $query = 'SELECT COUNT(DISTINCT(com.id)) 126 FROM '.COA_TABLE.' AS com 127 LEFT JOIN '.USERS_TABLE.' As u 128 ON u.'.$conf['user_fields']['id'].' = com.author_id 129 WHERE '.implode(' 130 AND ', $page['where_clauses']).' 131 ;'; 132 list($counter) = pwg_db_fetch_row(pwg_query($query)); 133 134 $url = PHPWG_ROOT_PATH . 'comments.php' . get_query_string_diff(array('start','delete_albums','validate_albums','edit_albums','pwg_token')); 135 $navbar = create_navigation_bar($url, $counter, $start, $page['items_number'], ''); 136 $template->assign('navbar', $navbar); 137 138 // +-----------------------------------------------------------------------+ 139 // | last comments display | 140 // +-----------------------------------------------------------------------+ 141 $comments = array(); 142 $element_ids = array(); 143 $category_ids = array(); 144 145 $query = 'SELECT 146 com.id AS comment_id, 147 com.category_id, 148 com.author, 149 com.author_id, 150 '.$conf['user_fields']['username'].' AS username, 151 com.date, 152 com.content, 153 com.validated 154 FROM '.COA_TABLE.' AS com 155 LEFT JOIN '.USERS_TABLE.' As u 156 ON u.'.$conf['user_fields']['id'].' = com.author_id 157 WHERE '.implode(' 158 AND ', $page['where_clauses']).' 159 GROUP BY 160 comment_id, 161 com.category_id, 162 com.author, 163 com.author_id, 164 com.date, 165 com.content, 166 com.validated 167 ORDER BY '.$page['sort_by'].' '.$page['sort_order']; 168 if ('all' != $page['items_number']) { 169 $query.= ' 170 LIMIT '.$page['items_number'].' OFFSET '.$start; 171 } 172 $query.= ' 173 ;'; 174 $result = pwg_query($query); 175 176 while ($row = pwg_db_fetch_assoc($result)) { 177 array_push($comments, $row); 178 array_push($element_ids, $row['category_id']); 179 } 180 181 if (count($comments) > 0) { 182 // retrieving category informations 183 $query = 'SELECT 184 cat.id, 185 cat.name, 186 cat.permalink, 187 cat.uppercats, 188 com.id as comment_id 189 FROM '.CATEGORIES_TABLE.' AS cat 190 LEFT JOIN '.COA_TABLE.' AS com 191 ON cat.id=com.category_id 192 '.get_sql_condition_FandF(array( 193 'forbidden_categories' => 'cat.id', 194 'visible_categories' => 'cat.id' 195 ), 'WHERE').' 196 AND cat.id IN ('.implode(',', $element_ids).') 197 ;'; 198 $categories = hash_from_query($query, 'comment_id'); 199 200 foreach ($comments as $comment) { 201 // category 202 $name = $categories[$comment['comment_id']]['name']; 203 $url = duplicate_index_url(array( 204 'category' => array( 205 'id' => $categories[$comment['comment_id']]['id'], 206 'name' => $categories[$comment['comment_id']]['name'], 207 'permalink' => $categories[$comment['comment_id']]['permalink'], 208 ),array('start') 209 )); 210 211 // comment content 212 $tpl_comment = array( 213 'CAT_URL' => $url, 214 'CAT_NAME' => $name, 215 'AUTHOR' => trigger_event('render_comment_author', $comment['author']), 216 'DATE' => format_date($comment['date'], true), 217 'CONTENT' => trigger_event('render_comment_content',$comment['content']), 218 ); 219 220 // rights 221 if (can_manage_comment('delete', $comment['author_id'])) { 222 $url = get_root_url().'comments.php'.get_query_string_diff(array('delete','validate','edit', 'pwg_token')); 223 224 $tpl_comment['U_DELETE'] = add_url_params($url, array( 225 'delete_albums' => $comment['comment_id'], 226 'pwg_token' => get_pwg_token(), 227 )); 228 } 229 if (can_manage_comment('edit', $comment['author_id'])) { 230 $url = get_root_url().'comments.php'.get_query_string_diff(array('edit', 'delete','validate', 'pwg_token')); 231 232 $tpl_comment['U_EDIT'] = add_url_params($url, array( 233 'edit_albums' => $comment['comment_id'], 234 'pwg_token' => get_pwg_token(), 235 )); 236 237 if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) { 238 $key = get_ephemeral_key(2, $comment['category_id']); 239 $tpl_comment['IN_EDIT'] = true; 240 $tpl_comment['KEY'] = $key; 241 $tpl_comment['IMAGE_ID'] = $comment['category_id']; 242 $tpl_comment['CONTENT'] = $comment['content']; 243 } 244 } 245 if (can_manage_comment('validate', $comment['author_id'])) { 246 if ('true' != $comment['validated']) { 247 $tpl_comment['U_VALIDATE'] = add_url_params($url, array( 248 'validate_albums'=> $comment['comment_id'], 249 'pwg_token' => get_pwg_token(), 250 )); 251 } 252 } 253 254 $template->append('comments', $tpl_comment); 255 } 256 } 257 258 // +-----------------------------------------------------------------------+ 259 // | template | 260 // +-----------------------------------------------------------------------+ 261 $template->set_filenames(array('comments'=> dirname(__FILE__).'/../template/coa_comments_page.tpl')); 262 263 // add a layer for display category name 264 $template->set_prefilter('comments', 'coa_change_comments_list'); 265 function coa_change_comments_list($content, &$smarty) { 266 $search = '<div class="description"{if isset($comment.IN_EDIT)} style="height:200px"{/if}>'; 267 267 268 268 $replacement = '<div class="category-title"> 269 <a href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a>269 <a href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a> 270 270 </div> 271 271 <div class="description"{if isset($comment.IN_EDIT)} style="height:220px"{/if}>'; 272 272 273 return str_replace($search, $replacement, $content);274 }273 return str_replace($search, $replacement, $content); 274 } 275 275 } 276 276 -
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 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 }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 $comment_action,234 array_merge($comment,235 array('author' => $GLOBALS['user']['username'])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 $GLOBALS['user']['id'].'\'';245 $GLOBALS['user']['id'].'\''; 246 246 } 247 247 … … 293 293 { 294 294 email_admin('edit', array('author' => $GLOBALS['user']['username'], 295 'content' => stripslashes($comment['content'])) );295 'content' => stripslashes($comment['content'])) ); 296 296 } 297 297 } … … 301 301 302 302 if (!function_exists('email_admin')) { 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 else325 {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_content333 );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 -
extensions/Comments_on_Albums/language/de_DE/plugin.lang.php
r10346 r10984 11 11 12 12 $lang['COA_help_icon_pack'] = "Wählen Sie welche Icons auf der Hauptseite der Kommentare verwendet werden sollen.<br> 13 <br>14 Sie können Ihre eigene im folgenden Ordner hinzufügen: <i>plugins/comments_on_pictures/template/s26</i>.";13 <br> 14 Sie können Ihre eigene im folgenden Ordner hinzufügen: <i>plugins/comments_on_pictures/template/s26</i>."; 15 15 $lang['COA_comment_validation_link'] = "Die Validierung der Kommentare (falls aktiviert) zu den Alben ist auf <a href='admin.php?page=comments§ion=albums'>der gleichen Seite</a> wie die Kommentare zu den Fotos."; 16 16 -
extensions/Comments_on_Albums/language/en_UK/plugin.lang.php
r10301 r10984 11 11 12 12 $lang['COA_help_icon_pack'] = "Select which icons must be used on the main Comments page.<br> 13 <br>14 You can add your owns in the folder <i>plugins/comments_on_pictures/template/s26</i>.";13 <br> 14 You can add your owns in the folder <i>plugins/comments_on_pictures/template/s26</i>."; 15 15 $lang['COA_comment_validation_link'] = "Validation (if enabled) of comments on albums is on <a href='admin.php?page=comments§ion=albums'>the same page</a> as the comments on pictures."; 16 16 -
extensions/Comments_on_Albums/language/fr_FR/plugin.lang.php
r10301 r10984 11 11 12 12 $lang['COA_help_icon_pack'] = "Selectionnez les icônes à utiliser sur la page principale des commentaires<br> 13 <br>14 Vous pouvez ajouter les votres dans le dossier <i>plugins/comments_on_pictures/template/s26</i>.";13 <br> 14 Vous pouvez ajouter les votres dans le dossier <i>plugins/comments_on_pictures/template/s26</i>."; 15 15 $lang['COA_comment_validation_link'] = "La validation (si activée) des commentaires sur les albums ce fait <a href='admin.php?page=comments§ion=albums'>sur la même page</a> que pour les commentaires sur les photos."; 16 16 17 17 ?> -
extensions/Comments_on_Albums/language/hu_HU/plugin.lang.php
r10301 r10984 11 11 12 12 $lang['COA_help_icon_pack'] = "Ki kell választani a Hozzászólások fő oldalon megjelenítendő ikonokat.<br> 13 <br>14 Hozzáadhatsz saját mappát a <i>plugins/comments_on_pictures/template/s26</i> könyvtárhoz.";13 <br> 14 Hozzáadhatsz saját mappát a <i>plugins/comments_on_pictures/template/s26</i> könyvtárhoz."; 15 15 $lang['COA_comment_validation_link'] = "Validation (if enabled) of comments on albums is on <a href='admin.php?page=comments§ion=albums'>the same page</a> as the comments on pictures."; 16 16 -
extensions/Comments_on_Albums/language/it_IT/plugin.lang.php
r10374 r10984 11 11 12 12 $lang['COA_help_icon_pack'] = 'Selezionare le icone da usare nella pagina principale dei Commenti<br> 13 <br>14 Potete aggiungere le vostre icone nella cartella <i>plugins/comments_on_pictures/template/s26</i>.';13 <br> 14 Potete aggiungere le vostre icone nella cartella <i>plugins/comments_on_pictures/template/s26</i>.'; 15 15 $lang['COA_comment_validation_link'] = 'La Validazione (se attivata) dei commenti degli album si trova <a href="admin.php?page=comments§ion=albums">sulla stessa pagina</a> dei commenti delle foto.'; 16 16 -
extensions/Comments_on_Albums/main.inc.php
r10213 r10984 2 2 /* 3 3 Plugin Name: Comments on Albums 4 Version: 1.14 Version: auto 5 5 Description: Activate comments on albums pages 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=512 … … 14 14 15 15 // +-----------------------------------------------------------------------+ 16 // Global variables16 // Global variables 17 17 // +-----------------------------------------------------------------------+ 18 define('COA_NAME' , 'Comments on Albums');19 define('COA_VERSION', '1.0');20 18 define('COA_DIR' , basename(dirname(__FILE__))); 21 19 define('COA_PATH' , PHPWG_PLUGINS_PATH . COA_DIR . '/'); … … 25 23 26 24 // +-----------------------------------------------------------------------+ 27 // Triggers25 // Triggers 28 26 // +-----------------------------------------------------------------------+ 29 27 add_event_handler('loc_end_index', 'COA_index'); … … 34 32 35 33 // +-----------------------------------------------------------------------+ 36 // Functions34 // Functions 37 35 // +-----------------------------------------------------------------------+ 38 36 39 37 function COA_index() { 40 global $template, $page, $conf, $pwg_loaded_plugins;41 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 46 if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) set_bbcode_bar();47 else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) set_smiliessupport();48 49 include(COA_PATH . 'include/coa_albums.php');50 }38 global $template, $page, $conf, $pwg_loaded_plugins; 39 40 if ($page['section'] == 'categories' AND isset($page['category']) 41 AND (!isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0)) 42 { 43 44 if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit'])) set_bbcode_bar(); 45 else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit'])) set_smiliessupport(); 46 47 include(COA_PATH . 'include/coa_albums.php'); 48 } 51 49 } 52 50 53 51 function COA_comments_page() { 54 global $template, $page, $conf;55 56 if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') {57 include(COA_PATH . 'include/coa_comments_page.php');58 }52 global $template, $page, $conf; 53 54 if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') { 55 include(COA_PATH . 'include/coa_comments_page.php'); 56 } 59 57 } 60 58 61 59 function COA_admin() { 62 global $template, $page, $conf;63 64 if ($page['page'] == 'comments') { 65 include(COA_PATH . 'include/coa_admin_comments.php');66 } else if ($page['page'] == 'intro') { 67 include(COA_PATH . 'include/coa_admin_intro.php');68 }60 global $template, $page, $conf; 61 62 if ($page['page'] == 'comments') { 63 include(COA_PATH . 'include/coa_admin_comments.php'); 64 } else if ($page['page'] == 'intro') { 65 include(COA_PATH . 'include/coa_admin_intro.php'); 66 } 69 67 } 70 68 71 69 function COA_admin_menu($menu) { 72 array_push($menu, array(73 'NAME' => COA_NAME,74 'URL' => COA_ADMIN75 ));76 return $menu;70 array_push($menu, array( 71 'NAME' => 'Comments on Albums', 72 'URL' => COA_ADMIN 73 )); 74 return $menu; 77 75 } 78 76 -
extensions/Comments_on_Albums/maintain.inc.php
r9766 r10984 4 4 // Default configuration 5 5 define('default_config', serialize(array( 6 'icon_color' => 'outline_ff3363.png',7 'icon_color_over' => 'outline_ff7700.png',6 'icon_color' => 'outline_ff3363.png', 7 'icon_color_over' => 'outline_ff7700.png', 8 8 ))); 9 9 10 10 // Installation 11 11 function plugin_install() { 12 global $prefixeTable;12 global $prefixeTable; 13 13 14 pwg_query("CREATE TABLE `" . $prefixeTable . "comments_categories` (15 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,16 `category_id` mediumint(8) unsigned NOT NULL DEFAULT '0',17 `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',18 `author` varchar(255) DEFAULT NULL,19 `author_id` smallint(5) DEFAULT NULL,20 `content` longtext,21 `validated` enum('true','false') NOT NULL DEFAULT 'false',22 `validation_date` datetime DEFAULT NULL,23 PRIMARY KEY (`id`)24 ) DEFAULT CHARSET=utf8;");25 26 pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('comments_on_albums', '" . default_config . "', 'Parametres du plugin Comments on Albums');");14 pwg_query("CREATE TABLE `" . $prefixeTable . "comments_categories` ( 15 `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 16 `category_id` mediumint(8) unsigned NOT NULL DEFAULT '0', 17 `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', 18 `author` varchar(255) DEFAULT NULL, 19 `author_id` smallint(5) DEFAULT NULL, 20 `content` longtext, 21 `validated` enum('true','false') NOT NULL DEFAULT 'false', 22 `validation_date` datetime DEFAULT NULL, 23 PRIMARY KEY (`id`) 24 ) DEFAULT CHARSET=utf8;"); 25 26 pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('comments_on_albums', '" . default_config . "', 'Parametres du plugin Comments on Albums');"); 27 27 } 28 28 29 29 // Uninstallation 30 30 function plugin_uninstall() { 31 global $prefixeTable;31 global $prefixeTable; 32 32 33 pwg_query("DROP TABLE `" . $prefixeTable . "comments_categories`;");34 pwg_query("DELETE FROM " . CONFIG_TABLE . " WHERE `param` = 'comments_on_albums';");33 pwg_query("DROP TABLE `" . $prefixeTable . "comments_categories`;"); 34 pwg_query("DELETE FROM " . CONFIG_TABLE . " WHERE `param` = 'comments_on_albums';"); 35 35 } 36 36 ?> -
extensions/Comments_on_Albums/template/coa_admin_comments.tpl
r9641 r10984 1 1 {* this is a copy of admin/theme/defaults/template/comments.tpl a bit modified *} 2 2 3 3 {literal} 4 4 <script type="text/javascript"> 5 $(document).ready(function(){6 $(".checkComment").click(function(event) {7 if (event.target.type !== 'checkbox') {8 var checkbox = $(this).children("input[type=checkbox]");9 $(checkbox).attr('checked', !$(checkbox).is(':checked'));10 }11 });12 $("#commentSelectAll").click(function () {13 $(".checkComment input[type=checkbox]").attr('checked', true);14 return false;15 });16 $("#commentSelectNone").click(function () {17 $(".checkComment input[type=checkbox]").attr('checked', false);18 return false;19 });20 $("#commentSelectInvert").click(function () {21 $(".checkComment input[type=checkbox]").each(function() {22 $(this).attr('checked', !$(this).is(':checked'));23 });24 return false;25 });26 });5 $(document).ready(function(){ 6 $(".checkComment").click(function(event) { 7 if (event.target.type !== 'checkbox') { 8 var checkbox = $(this).children("input[type=checkbox]"); 9 $(checkbox).attr('checked', !$(checkbox).is(':checked')); 10 } 11 }); 12 $("#commentSelectAll").click(function () { 13 $(".checkComment input[type=checkbox]").attr('checked', true); 14 return false; 15 }); 16 $("#commentSelectNone").click(function () { 17 $(".checkComment input[type=checkbox]").attr('checked', false); 18 return false; 19 }); 20 $("#commentSelectInvert").click(function () { 21 $(".checkComment input[type=checkbox]").each(function() { 22 $(this).attr('checked', !$(this).is(':checked')); 23 }); 24 return false; 25 }); 26 }); 27 27 </script> 28 28 {/literal} 29 29 30 30 <div class="titrePage"> 31 <h2>{'Waiting'|@translate}</h2>31 <h2>{'Waiting'|@translate}</h2> 32 32 </div> 33 33 … … 37 37 <form method="post" action="{$F_ACTION}"> 38 38 39 <table width="99%">40 {foreach from=$comments item=comment name=comment}41 <tr valign="top" class="{if $smarty.foreach.comment.index is odd}row2{else}row1{/if}">42 <td style="width:50px;" class="checkComment">43 <input type="checkbox" name="comments[]" value="{$comment.ID}">44 </td>45 <td>46 <div class="comment">47 <a class="illustration" href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a>48 <p class="commentHeader"><strong>{$comment.AUTHOR}</strong> - <em>{$comment.DATE}</em></p>49 <blockquote>{$comment.CONTENT}</blockquote>50 </div>51 </td>52 </tr>53 {/foreach}54 </table>39 <table width="99%"> 40 {foreach from=$comments item=comment name=comment} 41 <tr valign="top" class="{if $smarty.foreach.comment.index is odd}row2{else}row1{/if}"> 42 <td style="width:50px;" class="checkComment"> 43 <input type="checkbox" name="comments[]" value="{$comment.ID}"> 44 </td> 45 <td> 46 <div class="comment"> 47 <a class="illustration" href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a> 48 <p class="commentHeader"><strong>{$comment.AUTHOR}</strong> - <em>{$comment.DATE}</em></p> 49 <blockquote>{$comment.CONTENT}</blockquote> 50 </div> 51 </td> 52 </tr> 53 {/foreach} 54 </table> 55 55 56 <p class="checkActions">57 {'Select:'|@translate}58 <a href="#" id="commentSelectAll">{'All'|@translate}</a>,59 <a href="#" id="commentSelectNone">{'None'|@translate}</a>,60 <a href="#" id="commentSelectInvert">{'Invert'|@translate}</a>61 </p>56 <p class="checkActions"> 57 {'Select:'|@translate} 58 <a href="#" id="commentSelectAll">{'All'|@translate}</a>, 59 <a href="#" id="commentSelectNone">{'None'|@translate}</a>, 60 <a href="#" id="commentSelectInvert">{'Invert'|@translate}</a> 61 </p> 62 62 63 <p class="bottomButtons">64 <input class="submit" type="submit" name="validate_albums" value="{'Validate'|@translate}">65 <input class="submit" type="submit" name="reject_albums" value="{'Reject'|@translate}">66 </p>63 <p class="bottomButtons"> 64 <input class="submit" type="submit" name="validate_albums" value="{'Validate'|@translate}"> 65 <input class="submit" type="submit" name="reject_albums" value="{'Reject'|@translate}"> 66 </p> 67 67 68 68 </form> -
extensions/Comments_on_Albums/template/coa_admin_intro.tpl
r9968 r10984 2 2 3 3 {footer_script require='jquery'} 4 jQuery('dl[style="padding-top: 30px;"] dd:last-child ul li:last-child').append('[{'Photos'|@translate}]');5 jQuery('<li>'+6 '{$DB_COMMENTS_ALBUMS}'+7 {if isset($unvalidated_albums)}8 ' (<a href="{$unvalidated_albums.URL}">{$unvalidated_albums.INFO}</a>)'+9 {/if}10 ' [{'Albums'|@translate}]'+11 '</li>')12 .appendTo('dl[style="padding-top: 30px;"] dd:last-child ul');4 jQuery('dl[style="padding-top: 30px;"] dd:last-child ul li:last-child').append('[{'Photos'|@translate}]'); 5 jQuery('<li>'+ 6 '{$DB_COMMENTS_ALBUMS}'+ 7 {if isset($unvalidated_albums)} 8 ' (<a href="{$unvalidated_albums.URL}">{$unvalidated_albums.INFO}</a>)'+ 9 {/if} 10 ' [{'Albums'|@translate}]'+ 11 '</li>') 12 .appendTo('dl[style="padding-top: 30px;"] dd:last-child ul'); 13 13 {/footer_script} -
extensions/Comments_on_Albums/template/coa_albums.tpl
r10301 r10984 1 1 {* this is inspired by theme/defaults/template/picture.tpl *} 2 2 3 3 {combine_css path=$COA_PATH|@cat:'template/style_albums.css'} 4 4 {if $themeconf.name == 'Sylvia'}{combine_css path=$COA_PATH|@cat:'template/style_albums_sylvia.css'}{/if} … … 7 7 {if isset($COMMENT_COUNT)} 8 8 <div id="comments"> 9 {if $COMMENT_COUNT > 0}10 <h3>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3>11 {/if}9 {if $COMMENT_COUNT > 0} 10 <h3>{$pwg->l10n_dec('%d comment', '%d comments',$COMMENT_COUNT)}</h3> 11 {/if} 12 12 13 {if isset($comments)}14 {include file='comment_list.tpl'}15 {/if}16 17 {if !empty($comment_navbar)}{include file=$COA_ABSOLUTE_PATH|@cat:'template/navigation_bar.tpl'}{/if}13 {if isset($comments)} 14 {include file='comment_list.tpl'} 15 {/if} 16 17 {if !empty($comment_navbar)}{include file=$COA_ABSOLUTE_PATH|@cat:'template/navigation_bar.tpl'}{/if} 18 18 19 {if isset($comment_add)}20 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="addComment">21 <fieldset>22 <legend>{'Add a comment'|@translate}</legend>23 {if $comment_add.SHOW_AUTHOR}24 <label>{'Author'|@translate}<input type="text" name="author"></label>25 {/if}26 <label>{'Comment'|@translate}<textarea name="content" id="contentid" rows="5" cols="80">{$comment_add.CONTENT}</textarea></label>27 <input type="hidden" name="key" value="{$comment_add.KEY}">28 <input type="submit" value="{'Submit'|@translate}">29 </fieldset>30 </form>31 {/if}19 {if isset($comment_add)} 20 <form method="post" action="{$comment_add.F_ACTION}" class="filter" id="addComment"> 21 <fieldset> 22 <legend>{'Add a comment'|@translate}</legend> 23 {if $comment_add.SHOW_AUTHOR} 24 <label>{'Author'|@translate}<input type="text" name="author"></label> 25 {/if} 26 <label>{'Comment'|@translate}<textarea name="content" id="contentid" rows="5" cols="80">{$comment_add.CONTENT}</textarea></label> 27 <input type="hidden" name="key" value="{$comment_add.KEY}"> 28 <input type="submit" value="{'Submit'|@translate}"> 29 </fieldset> 30 </form> 31 {/if} 32 32 </div> 33 33 {/if}{*comments*} -
extensions/Comments_on_Albums/template/coa_comments_page.tpl
r9766 r10984 1 1 {* this is a copy of theme/defaults/template/comments.tpl a bit modified *} 2 3 {combine_css path=$COA_PATH|@cat:'template/style_comments.css'} 4 2 5 3 {html_head} 6 <style type="text/css"> 7 .pwg-icon-comments-images {ldelim} 8 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR}); 9 background-position: 0 0; 10 } 11 a:hover .pwg-icon-comments-images {ldelim} 12 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR_OVER}); 13 background-position: 0 0; 14 } 15 </style> 4 <style type="text/css"> 5 .thumbnailCategory .category-title {ldelim} 6 font-size:1.1em; 7 font-weight:bold; 8 } 9 .pwg-icon-comments-images {ldelim} 10 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR}); 11 background-position: 0 0; 12 } 13 a:hover .pwg-icon-comments-images {ldelim} 14 background-image: url({$COA_PATH}template/s26/{$ICON_COLOR_OVER}); 15 background-position: 0 0; 16 } 17 </style> 16 18 {/html_head} 17 19 … … 19 21 20 22 <div class="titrePage"> 21 <ul class="categoryActions">22 <li><a href="comments.php" title="{'COA_comments_photos'|@translate}" class="pwg-state-default pwg-button">23 <span class="pwg-icon pwg-icon-comments-images"> </span><span class="pwg-button-text">{'COA_comments_photos'|@translate}</span>24 </a></li>25 <li><a href="{$U_HOME}" title="{'Home'|@translate}" class="pwg-state-default pwg-button">26 <span class="pwg-icon pwg-icon-home"> </span><span class="pwg-button-text">{'Home'|@translate}</span>27 </a></li>28 </ul>29 <h2>{'User comments'|@translate}</h2>23 <ul class="categoryActions"> 24 <li><a href="comments.php" title="{'COA_comments_photos'|@translate}" class="pwg-state-default pwg-button"> 25 <span class="pwg-icon pwg-icon-comments-images"> </span><span class="pwg-button-text">{'COA_comments_photos'|@translate}</span> 26 </a></li> 27 <li><a href="{$U_HOME}" title="{'Home'|@translate}" class="pwg-state-default pwg-button"> 28 <span class="pwg-icon pwg-icon-home"> </span><span class="pwg-button-text">{'Home'|@translate}</span> 29 </a></li> 30 </ul> 31 <h2>{'User comments'|@translate}</h2> 30 32 </div> 31 33 … … 92 94 {if isset($comments)} 93 95 <div id="comments"> 94 {include file='comment_list.tpl'}96 {include file='comment_list.tpl'} 95 97 </div> 96 98 {/if} -
extensions/Comments_on_Albums/template/coa_messages.tpl
r9624 r10984 1 1 {if isset($errors)} 2 2 <div class="errors"> 3 <ul>4 {foreach from=$errors item=error}5 <li>{$error}</li>6 {/foreach}7 </ul>3 <ul> 4 {foreach from=$errors item=error} 5 <li>{$error}</li> 6 {/foreach} 7 </ul> 8 8 </div> 9 9 {/if} 10 10 {if isset($infos)} 11 11 <div class="infos"> 12 <ul>13 {foreach from=$infos item=info}14 <li>{$info}</li>15 {/foreach}16 </ul>12 <ul> 13 {foreach from=$infos item=info} 14 <li>{$info}</li> 15 {/foreach} 16 </ul> 17 17 </div> 18 18 {/if} -
extensions/Comments_on_Albums/template/navigation_bar.tpl
r9641 r10984 1 1 {* this is a copy of theme/defaults/template/navigation_bar.tpl 2 but with other variables to not interfer with the thumbnails' navigation bar *}3 2 but with other variables to not interfer with the thumbnails' navigation bar *} 3 4 4 <div class="navigationBar"> 5 {if isset($comment_navbar.URL_FIRST)}6 <a href="{$comment_navbar.URL_FIRST}#comments" rel="first">{'First'|@translate}</a> |7 <a href="{$comment_navbar.URL_PREV}#comments" rel="prev">{'Previous'|@translate}</a> |8 {else}9 {'First'|@translate} |10 {'Previous'|@translate} |11 {/if}5 {if isset($comment_navbar.URL_FIRST)} 6 <a href="{$comment_navbar.URL_FIRST}#comments" rel="first">{'First'|@translate}</a> | 7 <a href="{$comment_navbar.URL_PREV}#comments" rel="prev">{'Previous'|@translate}</a> | 8 {else} 9 {'First'|@translate} | 10 {'Previous'|@translate} | 11 {/if} 12 12 13 {assign var='prev_page' value=0}14 {foreach from=$comment_navbar.pages key=page item=url}15 {if $page > $prev_page+1}...{/if}16 {if $page == $comment_navbar.CURRENT_PAGE}17 <span class="pageNumberSelected">{$page}</span>18 {else}19 <a href="{$url}#comments">{$page}</a>20 {/if}21 {assign var='prev_page' value=$page}22 {/foreach}13 {assign var='prev_page' value=0} 14 {foreach from=$comment_navbar.pages key=page item=url} 15 {if $page > $prev_page+1}...{/if} 16 {if $page == $comment_navbar.CURRENT_PAGE} 17 <span class="pageNumberSelected">{$page}</span> 18 {else} 19 <a href="{$url}#comments">{$page}</a> 20 {/if} 21 {assign var='prev_page' value=$page} 22 {/foreach} 23 23 24 {if isset($comment_navbar.URL_NEXT)}25 | <a href="{$comment_navbar.URL_NEXT}#comments" rel="next">{'Next'|@translate}</a>26 | <a href="{$comment_navbar.URL_LAST}#comments" rel="last">{'Last'|@translate}</a>27 {else}28 | {'Next'|@translate}29 | {'Last'|@translate}30 {/if}24 {if isset($comment_navbar.URL_NEXT)} 25 | <a href="{$comment_navbar.URL_NEXT}#comments" rel="next">{'Next'|@translate}</a> 26 | <a href="{$comment_navbar.URL_LAST}#comments" rel="last">{'Last'|@translate}</a> 27 {else} 28 | {'Next'|@translate} 29 | {'Last'|@translate} 30 {/if} 31 31 </div> -
extensions/Comments_on_Albums/template/style_albums.css
r9766 r10984 3 3 #comments .thumbnailCategory .description, 4 4 #comments .thumbnailCategory div.illustration { 5 background-image:none;6 height:auto !important;5 background-image:none; 6 height:auto !important; 7 7 } 8 8 9 9 #comments .thumbnailCategories { 10 margin-left:5px;10 margin-left:5px; 11 11 } 12 12 #comments .thumbnailCategory { 13 margin:2px 0;13 margin:2px 0; 14 14 } 15 15 16 16 #comments .thumbnailCategory .date, #comments .thumbnailCategory .author { 17 font-weight:bold;17 font-weight:bold; 18 18 } 19 19 20 20 #comments { 21 padding:0;21 padding:0; 22 22 } 23 23 #comments h3 { 24 padding-left:10px;24 padding-left:10px; 25 25 } 26 26 27 27 .errors, .infos { 28 padding-left:20em;28 padding-left:20em; 29 29 } -
extensions/Comments_on_Albums/template/style_albums_sylvia.css
r9766 r10984 1 1 #comments .thumbnailCategory { 2 padding-left:10px;3 border: 1px solid #666;2 padding-left:10px; 3 border: 1px solid #666; 4 4 } 5 5 #comments .thumbnailCategory.odd { 6 background-color: #222;6 background-color: #222; 7 7 } 8 8 #comments .thumbnailCategory.even { 9 background-color: #111;9 background-color: #111; 10 10 } 11 11 #comments .thumbnailCategories li:hover { 12 background-color: transparent;12 background-color: transparent; 13 13 }
![(please configure the [header_logo] section in trac.ini)](http://piwigo.org/screenshots/piwigo_logo_on_white.png)