Changeset 3443
- Timestamp:
- Jun 23, 2009, 12:22:43 AM (15 years ago)
- Location:
- extensions/CommentEditor
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/CommentEditor/classes/ce_plugin.class.php
r3439 r3443 1 1 <?php 2 /* $Id: ce_plugin.class.php,v 1. 7 2009/06/22 12:25:04 Criss Exp $ */2 /* $Id: ce_plugin.class.php,v 1.8 2009/06/22 22:18:14 Criss Exp $ */ 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 … … 11 11 12 12 var $comments_ids; 13 private static $url_prefix = null;14 15 16 function CE_Plugin() {17 if (null == self::$url_prefix) {18 self::$url_prefix = get_root_url() . 'index.php?' . CE_ACTION . '=';19 }20 }21 13 22 14 /* ************************ */ … … 68 60 if (isset($this->comments_ids[$key])) { 69 61 // User allowed to have edit link 70 $comments[$key]['U_ID'] = $this->comments_ids[$key]; 71 $comments[$key]['DATE'] .= ' - <a href="' . $this->getEditUrlPrefix(); 72 $comments[$key]['DATE'] .= $comments[$key]['U_ID'] . '">'; 62 $current_id = $this->comments_ids[$key]; 63 $comments[$key]['U_ID'] = $current_id; 64 $comments[$key]['DATE'] .= ' - <a href="'; 65 $comments[$key]['DATE'] .= $this->getEditUrl($current_id); 66 $comments[$key]['DATE'] .= '">'; 73 67 $comments[$key]['DATE'] .= 'Edit'; 74 68 $comments[$key]['DATE'] .= '</a>'; … … 81 75 * Check whether a comment edit or update is requested. 82 76 */ 83 function loc_ end_index() {77 function loc_begin_index() { 84 78 $comment_id = ""; 85 79 $action = $this->isCommentEdit($_SERVER['QUERY_STRING'], $comment_id); … … 146 140 return false; 147 141 } 148 if (is_admin() ) {142 if (is_admin() and !is_adviser()) { 149 143 return true; 150 144 } … … 213 207 'comment_id' => $comment->getInfo('comment_id'), 214 208 ); 209 210 // Deactivate anti-flood system 211 global $conf; 212 $old_anti_flood = $conf['anti-flood_time']; 213 $conf['anti-flood_time'] = 0; 214 215 215 $comment_action = update_user_comment($comment_array, @$_POST['key'], $infos ); 216 217 // Reactivate anti-flood system 218 $conf['anti-flood_time'] = $old_anti_flood; 216 219 217 220 switch ($comment_action) { … … 284 287 285 288 global $template; 289 if ("" == $template->get_template_vars('U_HOME')) { 290 $template->assign('U_HOME', make_index_url()); 291 } 286 292 $template->set_filenames(array('ce_message'=>$this->getTemplate('message.tpl'))); 287 293 $template->block_html_head( '', … … 297 303 function displayComment($p_comment) { 298 304 global $template; 299 300 305 $template->set_filenames(array('ce_edit'=>$this->getTemplate())); 301 306 $template->block_html_head( '', … … 306 311 $template->assign($begin, null); 307 312 $template->assign($end, null); 308 $tpl Comment = array(313 $tpl_comment = array( 309 314 'CONTENT' => $p_comment->getInfo('content'), 310 315 'KEY' => $p_comment->getInfo('comment_id'), … … 313 318 'DISABLED' => !is_admin(), 314 319 'USERS' => CE_Comment::getUsers(), 315 'F_ACTION' => $this->getUpdateUrl Prefix(),320 'F_ACTION' => $this->getUpdateUrl(), 316 321 'FREEAUTHOR'=> ($p_comment->isKnownAuthor())?'':'checked="checked"' 317 322 ); 318 $template->assign('comment', $tplComment); 323 if ("" == $template->get_template_vars('U_HOME')) { 324 $template->assign('U_HOME', make_index_url()); 325 } 326 $template->assign('comment', $tpl_comment); 319 327 $template->concat($begin, $template->parse('ce_edit', true)); 320 } 321 322 function getEditUrlPrefix() { 323 return self::$url_prefix . CE_ACTION_EDIT . '&' . CE_ID . '='; 324 } 325 326 function getUpdateUrlPrefix() { 327 return self::$url_prefix . CE_ACTION_UPDATE; 328 329 } 330 331 function getScriptName() { 332 // By now, still in index page 333 // return script_basename(); 334 return 'index'; 335 } 336 337 function getEditUrl($comment_id) { 338 $url = get_root_url() . $this->getScriptName() . '.php'; 339 // By now, still in index pages without params 340 // $url .= get_query_string_diff(array(CE_ACTION, CE_ID)); 341 $url = add_url_params( $url, 342 array( 343 CE_ACTION => CE_ACTION_EDIT, 344 CE_ID=>$comment_id 345 ) 346 ); 347 return $url; 348 } 349 350 function getUpdateUrl() { 351 $url = get_root_url() . script_basename() .'.php'; 352 // By now, still in index pages without params 353 // $url .= get_query_string_diff(array(CE_ACTION, CE_ID)); 354 $url = add_url_params( $url, 355 array( 356 CE_ACTION => CE_ACTION_UPDATE 357 ) 358 ); 359 return $url; 328 360 } 329 361 -
extensions/CommentEditor/include/ce_common.inc.php
r3439 r3443 1 1 <?php 2 /* $Id: ce_common.inc.php,v 1. 5 2009/06/18 21:02:12Criss Exp $ */2 /* $Id: ce_common.inc.php,v 1.8 2009/06/22 22:18:13 Criss Exp $ */ 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 5 define('CE_VERSION', '1.0.f');6 5 define('CE_INCLUDE_DIR', 'include/'); 7 6 define('CE_CLASSES_DIR', 'classes/'); -
extensions/CommentEditor/language/fr_FR/plugin.lang.php
r3428 r3443 1 1 <?php 2 /* $Id: plugin.lang.php,v 1. 3 2009/06/17 19:08:24Criss Exp $ */2 /* $Id: plugin.lang.php,v 1.4 2009/06/22 22:18:12 Criss Exp $ */ 3 3 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 4 4 global $lang; 5 5 6 6 7 $lang['comment_edit'] = 'Edition de commentaire'; … … 11 12 $lang[CE_TYPE_INFO] = 'Information'; 12 13 $lang[CE_TYPE_ERROR] = 'Erreur'; 13 $lang['comment_edit_forbidden'] = 'Vous n\' êtes pas autorisé à éditer ce commentaire';14 $lang['comment_access_invalid'] = 'Acc ès invalide';14 $lang['comment_edit_forbidden'] = 'Vous n\'êtes pas autorisé à éditer ce commentaire'; 15 $lang['comment_access_invalid'] = 'Accès invalide'; 15 16 ?> -
extensions/CommentEditor/main.inc.php
r3439 r3443 1 1 <?php 2 /* $Id: main.inc.php,v 1. 8 2009/06/22 12:25:04 Criss Exp $ */2 /* $Id: main.inc.php,v 1.9 2009/06/22 22:18:14 Criss Exp $ */ 3 3 /* 4 4 Plugin Name: Comment Editor 5 Version: 1.0. f5 Version: 1.0.g 6 6 Description: Allow to edit comment 7 7 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=296 … … 11 11 12 12 /** History ** 13 14 2009-06-22 1.0.g 15 Deactivate anti-flood on update 16 Adviser can edit only its comments 17 Language file converted in UTF-8 18 Add home link in edit and message block title bar 13 19 14 20 2009-06-22 1.0.f … … 34 40 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 35 41 42 define('CE_VERSION', '1.0.g'); 36 43 define('CE_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); 37 44 define('CE_ROOT', dirname(__FILE__).'/'); … … 45 52 array(&$ce_plugin, 'loc_begin_page_header')); 46 53 add_event_handler( 'loc_begin_index', 47 array(&$ce_plugin, 'loc_ end_index'), 1);54 array(&$ce_plugin, 'loc_begin_index'), 1); 48 55 49 56 set_plugin_data($plugin['id'], $ce_plugin); -
extensions/CommentEditor/template/edit.tpl
r3426 r3443 1 {* $Id: edit.tpl,v 1. 3 2009/06/17 19:08:24Criss Exp $ *}1 {* $Id: edit.tpl,v 1.4 2009/06/22 22:18:13 Criss Exp $ *} 2 2 {if !$comment.DISABLED} 3 3 <script type="text/javascript"> … … 13 13 <div id="content" class="content"> 14 14 <div class="titrePage"> 15 <ul class="categoryActions"> 16 <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li> 17 </ul> 15 18 <h2>{'comment_edit'|@translate}</h2> 16 19 </div> -
extensions/CommentEditor/template/message.tpl
r3426 r3443 1 {* $Id: message.tpl,v 1. 3 2009/06/17 19:08:24Criss Exp $ *}1 {* $Id: message.tpl,v 1.4 2009/06/22 22:18:13 Criss Exp $ *} 2 2 <div class="content" id="message-block"> 3 3 <div class="titrePage"> 4 <ul class="categoryActions"> 5 <li><a href="{$U_HOME}" title="{'return to homepage'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'home'|@translate}"/></a></li> 6 </ul> 4 7 <h2 id="message-header">{'CommentEditor'|@translate} - {$message.TITLE}</h2> 5 8 </div>
Note: See TracChangeset
for help on using the changeset viewer.