Ignore:
Timestamp:
Jun 26, 2009, 11:52:25 AM (15 years ago)
Author:
Criss
Message:

Display edit block on picture page if request comes from this page
Add simple administration configuration management
Add and remove default configuration from databaseon plugin install / uninstall

Location:
extensions/CommentEditor
Files:
10 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • extensions/CommentEditor/classes/ce_comment.class.php

    r3432 r3462  
    11<?php
    2 /* $Id: ce_comment.class.php,v 1.5 2009/06/18 14:48:19 Criss Exp $ */
     2/* $Id: ce_comment.class.php,v 1.6 2009/06/26 08:56:33 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
     
    77 */
    88class CE_Comment {
    9     var $id;
    10     var $infos = array();
    11     var $query;
    12     private static $s_user_list = null;
     9  var $id;
     10  var $infos = array();
     11  var $query;
     12  private static $s_user_list = null;
    1313
    14     private static function updateUsers() {
    15         $users = array();
    16         $query = '
    17             SELECT username
    18             FROM '. USERS_TABLE .'
    19             ORDER BY username';
    20         $result = pwg_query( $query );
    21         while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
    22             $users = array_merge($users, array($row['username'] => $row['username']));
     14  private static function updateUsers() {
     15    $users = array();
     16    $query = '
     17      SELECT username
     18      FROM '. USERS_TABLE .'
     19      ORDER BY username';
     20    $result = pwg_query( $query );
     21    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
     22      $users = array_merge($users, array($row['username'] => $row['username']));
     23    }
     24    return $users;
     25  }
     26
     27  static function getUsers() {
     28    if (null == self::$s_user_list) {
     29      // Init user list
     30      self::$s_user_list = self::updateUsers();
     31    }
     32    return self::$s_user_list;
     33  }
     34
     35  function CE_Comment($comment_id) {
     36    $this->id = $comment_id;
     37    $this->query = '
     38      SELECT com.id AS comment_id
     39         , com.image_id
     40         , com.author
     41         , com.date
     42         , com.content
     43         , com.validated
     44        FROM '.COMMENTS_TABLE.' AS com
     45        WHERE com.id = ' . $comment_id;
     46    $result = pwg_query($this->query);
     47    $this->infos = mysql_fetch_array($result, MYSQL_ASSOC);
     48  }
     49
     50  function validateAuthor($author) {
     51    $user_list = self::getUsers();
     52    if (array_key_exists( strtolower($author),
     53                          array_change_key_case($user_list, CASE_LOWER))) {
     54      // Look in user list to have right case !
     55      foreach ($user_list as $user) {
     56        if (0 == strcasecmp($author, $user)) {
     57          return $user;
    2358        }
    24         return $users;
     59      }
    2560    }
     61    return $author;
     62  }
    2663
    27     static function getUsers() {
    28         if (null == self::$s_user_list) {
    29             // Init user list
    30             self::$s_user_list = self::updateUsers();
    31         }
    32         return self::$s_user_list;
     64  function isKnownAuthor() {
     65    if (in_array($this->infos['author'], self::getUsers())) {
     66      return true;
    3367    }
     68    return false;
     69  }
    3470
    35     function CE_Comment($comment_id) {
    36         $this->id = $comment_id;
    37         $this->query = '
    38             SELECT com.id AS comment_id
    39                  , com.image_id
    40                  , com.author
    41                  , com.date
    42                  , com.content
    43                  , com.validated
    44               FROM '.COMMENTS_TABLE.' AS com
    45               WHERE com.id = ' . $comment_id;
    46         $result = pwg_query($this->query);
    47         $this->infos = mysql_fetch_array($result, MYSQL_ASSOC);
     71  function setInfo($key, $value) {
     72    if (null == $key) {
     73      return;
    4874    }
     75    $this->infos[$key] = $value;
     76  }
    4977
    50     function validateAuthor($author) {
    51         $user_list = self::getUsers();
    52         if (array_key_exists(   strtolower($author),
    53                                 array_change_key_case($user_list, CASE_LOWER))) {
    54             // Look in user list to have right case !
    55             foreach ($user_list as $user) {
    56                 if (0 == strcasecmp($author, $user)) {
    57                     return $user;
    58                 }
    59             }
    60         }
    61         return $author;
     78  function getInfo($key = null) {
     79    if (null == $key) {
     80      return $this->infos;
    6281    }
     82    return $this->infos[$key];
     83  }
    6384
    64     function isKnownAuthor() {
    65         if (in_array($this->infos['author'], self::getUsers())) {
    66             return true;
    67         }
    68         return false;
     85  function isAuthor($user) {
     86    if (!isset ($this->infos['author'])) {
     87      return false;
    6988    }
     89    return (0 == strcmp($this->infos['author'], $user))?true:false;
     90  }
    7091
    71     function setInfo($key, $value) {
    72         if (null == $key) {
    73             return;
    74         }
    75         $this->infos[$key] = $value;
    76     }
    77 
    78     function getInfo($key = null) {
    79         if (null == $key) {
    80             return $this->infos;
    81         }
    82         return $this->infos[$key];
    83     }
    84 
    85     function isAuthor($user) {
    86         if (!isset ($this->infos['author'])) {
    87             return false;
    88         }
    89         return (0 == strcmp($this->infos['author'], $user))?true:false;
    90     }
    91 
    92     function __toString() {
    93         return print_r($this->infos, true);
    94     }
     92  function __toString() {
     93    return print_r($this->infos, true);
     94  }
    9595}
    9696?>
  • extensions/CommentEditor/classes/ce_plugin.class.php

    r3443 r3462  
    11<?php
    2 /* $Id: ce_plugin.class.php,v 1.8 2009/06/22 22:18:14 Criss Exp $ */
     2/* $Id: ce_plugin.class.php,v 1.11 2009/06/26 09:17:01 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4 
    5 ce_require_class("CE_Comment");
    64
    75/**
     
    108class CE_Plugin {
    119
    12     var $comments_ids;
    13 
    14     /* ************************ */
    15     /* ** Trigger management ** */
    16     /* ************************ */
    17 
    18     /**
    19      * Update comment ID array
    20      */
    21     function render_comment_content($content) {
    22         $author = null;
    23         $id = null;
    24         switch (script_basename()) {
    25             case "comments":
    26                 global $comment;
    27                 $author = $comment['author'];
    28                 $id = $comment['comment_id'];
    29                 break;
    30             case "picture":
    31                 global $row;
    32                 $author = $row['author'];
    33                 $id = $row['id'];
    34                 break;
    35             default:
    36                 // Not in right script
    37                 return $content;
    38         }
    39         global $template, $user;
    40         if ((!is_a_guest() and ($user['username'] == $author))
    41             or is_admin()) {
    42             $key = count($template->get_template_vars('comments'));
    43             $this->comments_ids[$key] = $id;
    44         }
     10  var $comments_ids;
     11  var $config;
     12  var $plugin_id;
     13
     14  /* ************************ */
     15  /* ** Constructor        ** */
     16  /* ************************ */
     17
     18  function CE_Plugin($plugin_id, $config = null) {
     19    $this->plugin_id = $plugin_id;
     20    $this->config = $config;
     21    if (null != $this->config) {
     22      $this->config->loadConfig();
     23    }
     24  }
     25
     26  function getConfig() {
     27    return $this->config;
     28  }
     29
     30  /* ************************ */
     31  /* ** Trigger management ** */
     32  /* ************************ */
     33
     34  function get_admin_plugin_menu_links($menu) {
     35    array_push(
     36        $menu,
     37        array(
     38            'NAME' => $this->plugin_id,
     39            'URL' => $this->get_plugin_admin_url()
     40        )
     41    );
     42    return $menu;
     43  }
     44
     45  /**
     46   * Update comment ID array
     47   */
     48  function render_comment_content($content) {
     49    $author = null;
     50    $id = null;
     51    switch (script_basename()) {
     52      case "comments":
     53        global $comment;
     54        $author = $comment['author'];
     55        $id = $comment['comment_id'];
     56        break;
     57      case "picture":
     58        global $row;
     59        $author = $row['author'];
     60        $id = $row['id'];
     61        break;
     62      default:
     63        // Not in right script
    4564        return $content;
    4665    }
    47 
    48     /**
    49      * Check whether the page contains comments.
    50      * Add an edit link if user is allowed to edit comment
    51      */
    52     function loc_begin_page_header() {
    53         global $template;
    54         $comments = $template->get_template_vars('comments');
    55         if (!isset($comments) or (null == $comments)) {
    56             // No comment...
    57             return;
    58         }
    59         foreach ($comments as $key => $value) {
    60             if (isset($this->comments_ids[$key])) {
    61                 // User allowed to have edit link
    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'] .= '">';
    67                 $comments[$key]['DATE'] .= 'Edit';
    68                 $comments[$key]['DATE'] .= '</a>';
    69             }
    70         }
    71         $template->assign('comments', $comments);
    72     }
    73 
    74     /**
    75      * Check whether a comment edit or update is requested.
    76      */
    77     function loc_begin_index() {
    78         $comment_id = "";
    79         $action = $this->isCommentEdit($_SERVER['QUERY_STRING'], $comment_id);
    80         switch ($action) {
     66    global $template, $conf, $user;
     67    if ((!is_a_guest() and ($user[$conf['user_fields']['username']] == $author))
     68        or is_admin()) {
     69      $key = count($template->get_template_vars('comments'));
     70      $this->comments_ids[$key] = $id;
     71    }
     72    return $content;
     73  }
     74
     75  /**
     76   * Check whether the page contains comments.
     77   * Add an edit link if user is allowed to edit comment
     78   */
     79  function loc_begin_page_header() {
     80    global $template;
     81    $comments = $template->get_template_vars('comments');
     82    if (!isset($comments) or (null == $comments)) {
     83      // No comment...
     84      return;
     85    }
     86    // Include language advices
     87    load_language('plugin.lang', CE_PATH);
     88    foreach ($comments as $key => $value) {
     89      if (isset($this->comments_ids[$key])) {
     90        // User allowed to have edit link
     91        $current_id = $this->comments_ids[$key];
     92        $comments[$key]['U_ID'] =  $current_id;
     93        $comments[$key]['DATE'] .= ' - <a href="';
     94        $comments[$key]['DATE'] .= $this->getEditUrl($current_id);
     95        $comments[$key]['DATE'] .= '">';
     96        $comments[$key]['DATE'] .= l10n('comment_edit_tool');
     97        $comments[$key]['DATE'] .= '</a>';
     98      }
     99    }
     100    $template->assign('comments', $comments);
     101  }
     102
     103  /**
     104   * Check whether a comment edit or update is requested.
     105   */
     106  function loc_begin_index() {
     107    $this->doAction();
     108  }
     109
     110  function loc_begin_picture() {
     111    $this->doAction();
     112  }
     113
     114  /* ************************ */
     115  /* ** Private functions  ** */
     116  /* ************************ */
     117
     118  function doAction() {
     119    $comment_id = "";
     120    $action = $this->isCommentEdit($_SERVER['QUERY_STRING'], $comment_id);
     121    switch ($action) {
     122      case CE_ACTION_EDIT:
     123        // Edit
     124        $this->editComment($comment_id);
     125        break;
     126      case CE_ACTION_UPDATE:
     127        $this->updateComment();
     128        break;
     129      case CE_ACTION_ERROR:
     130        $infos = array('comment_edit_forbidden');
     131        $this->displayError($infos);
     132        break;
     133      case CE_ACTION_NONE:
     134        // Not an edit mode
     135        break;
     136    }
     137  }
     138
     139  function getTemplate($p_template = 'edit.tpl') {
     140    return realpath(CE_TEMPLATE . $p_template);
     141  }
     142
     143  function isCommentEdit($p_query_string, &$p_comment_id) {
     144    $params = split('\&', $p_query_string);
     145    $action = CE_ACTION_NONE;
     146    $comment_id = "";
     147    foreach ($params as $current_param) {
     148      $key_value = split('=', $current_param);
     149      if (isset($key_value[1])) {
     150        if (CE_ACTION == $key_value[0] && CE_ACTION_NONE == $action) {
     151          switch ($key_value[1]) {
    81152            case CE_ACTION_EDIT:
    82                 // Edit
    83                 $this->editComment($comment_id);
    84                 break;
    85153            case CE_ACTION_UPDATE:
    86                 $this->updateComment();
    87                 break;
    88             case CE_ACTION_ERROR:
    89                 $infos = array('comment_edit_forbidden');
    90                 $this->displayError($infos);
    91                 break;
    92             case CE_ACTION_NONE:
    93                 // Not an edit mode
    94                 break;
    95         }
    96     }
    97 
    98     /* ************************ */
    99     /* ** Private functions  ** */
    100     /* ************************ */
    101 
    102     function getTemplate($p_template = 'edit.tpl') {
    103         return realpath(CE_TEMPLATE . $p_template);
    104     }
    105 
    106     function isCommentEdit($p_query_string, &$p_comment_id) {
    107         $params = split('\&', $p_query_string);
    108         $action = CE_ACTION_NONE;
    109         $comment_id = "";
    110         foreach ($params as $current_param) {
    111             $key_value = split('=', $current_param);
    112             if (isset($key_value[1])) {
    113                 if (CE_ACTION == $key_value[0] && CE_ACTION_NONE == $action) {
    114                     //CE_ACTION_EDIT == $lKeyVal[1]
    115                     switch ($key_value[1]) {
    116                         case CE_ACTION_EDIT:
    117                         case CE_ACTION_UPDATE:
    118                             $action = $key_value[1];
    119                             break;
    120                     }
    121                 }
    122                 if (CE_ID == $key_value[0]) {
    123                     $comment_id = $key_value[1];
    124                 }
    125             }
    126         }
    127         if (CE_ACTION_EDIT == $action) {
    128             if (is_numeric($comment_id)) {
    129                 $p_comment_id = intval($comment_id);
    130             } else {
    131                 $action = CE_ACTION_ERROR;
    132             }
    133         }
    134         return $action;
    135     }
    136 
    137     function isEditAllowed($p_comment) {
    138         if ((FALSE == $p_comment->getInfo()) or
    139              is_a_guest()) {
    140             return false;
    141         }
    142         if (is_admin() and !is_adviser()) {
    143             return true;
    144         }
    145         global $user;
    146         return $p_comment->isAuthor($user['username']);
    147     }
    148 
    149     function editComment($p_comment_id) {
    150         //  Include language advices
    151         load_language('plugin.lang', CE_PATH);
    152 
    153         $comment = new CE_Comment($p_comment_id);
    154         $infos = array();
    155         if (!$this->isEditAllowed($comment)) {
    156             // Not allowed
    157             array_push($infos, 'comment_edit_forbidden');
    158             $this->displayError($infos);
    159             return;
    160         }
    161         $this->displayComment($comment);
    162     }
    163 
    164     function updateComment() {
    165         //  Include language advices
    166         load_language('plugin.lang', CE_PATH);
    167 
    168         $infos = array();
    169         if ((!isset($_POST['commentid'])) or
    170             (!isset($_POST['imageid']))) {
    171             array_push($infos, 'comment_access_invalid');
    172             $this->displayError($infos);
    173             return;
    174         }
    175         if (!is_numeric($_POST['imageid'])) {
    176             array_push($infos, 'comment_access_invalid');
    177             $this->displayError($infos);
    178             return;
    179         }
    180         $comment = new CE_Comment($_POST['commentid']);
    181 
    182         if (!$this->isEditAllowed($comment)) {
    183             array_push($infos, 'comment_edit_forbidden');
    184             $this->displayError($infos);
    185             return;
    186         }
    187         $image_id = $comment->getInfo('image_id');
    188         if (intval($_POST['imageid']) != intval($image_id)) {
    189             array_push($infos, 'comment_access_invalid');
    190             $this->displayError($infos);
    191             return;
    192         }
    193         if (isset($_POST['author'])) {
    194             $comment->setInfo('author', $_POST['author']);
    195         } else if ((isset($_POST['freeauthorck'])) and
    196                    (isset($_POST['freeauthor']))) {
    197             // Free author
    198             $new_author = trim(stripslashes($_POST['freeauthor']));
    199             $new_author = $comment->validateAuthor($new_author);
    200             $comment->setInfo('author', $new_author);
    201         }
    202 
    203         $comment_array = array(
    204             'author'        => trim( stripslashes($comment->getInfo('author')) ),
    205             'content'       => trim( stripslashes($_POST['content']) ),
    206             'image_id'      => $image_id,
    207             'comment_id'    => $comment->getInfo('comment_id'),
    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         $comment_action = update_user_comment($comment_array, @$_POST['key'], $infos );
    216 
    217         // Reactivate anti-flood system
    218         $conf['anti-flood_time'] = $old_anti_flood;
    219 
    220         switch ($comment_action) {
    221             case 'moderate':
    222               array_push( $infos, 'comment_to_validate' );
    223             case 'validate':
    224               array_push( $infos, 'comment_added');
    225               break;
    226             case 'reject':
    227               set_status_header(403);
    228               array_push($infos, 'comment_not_added' );
     154              $action = $key_value[1];
    229155              break;
    230156            default:
    231               trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
     157          }
    232158        }
    233         // allow plugins to notify what's going on
    234         trigger_action( 'user_comment_insertion',
    235                         array_merge($comment_array, array('action'=>$comment_action)));
    236         if ($comment_action=='reject') {
    237             $this->displayError($infos);
    238         } else {
    239             $this->displayInfo($infos);
     159        if (CE_ID == $key_value[0]) {
     160          $comment_id = $key_value[1];
    240161        }
    241     }
    242 
    243     function getCommentId($p_string_delete) {
    244         $comment_id = "";
    245         $elements = split('\?', $p_string_delete);
    246         if (count($elements) > 1) {
    247             $elem_var = split('\&amp;', $elements[1]);
    248             foreach ($elem_var as $var) {
    249                 $key_value = split('=', $var);
    250                 if (count($key_value) > 1) {
    251                     switch ($key_value[0]) {
    252                         case 'comment_to_delete':
    253                         case 'delete':
    254                             $comment_id = $key_value[1];
    255                             break;
    256                         default:
    257                             // No ID
    258                     }
    259                 }
    260             }
     162      }
     163    }
     164    if (CE_ACTION_EDIT == $action) {
     165      if (is_numeric($comment_id)) {
     166        $p_comment_id = intval($comment_id);
     167      } else {
     168        $action = CE_ACTION_ERROR;
     169      }
     170    }
     171    return $action;
     172  }
     173
     174  function isEditAllowed($p_comment) {
     175    if ((FALSE == $p_comment->getInfo()) or
     176        is_a_guest()) {
     177      return false;
     178    }
     179    if (is_admin() and !is_adviser()) {
     180      return true;
     181    }
     182    global $conf, $user;
     183    return $p_comment->isAuthor($user[$conf['user_fields']['username']]);
     184  }
     185
     186  function editComment($p_comment_id) {
     187    $comment = new CE_Comment($p_comment_id);
     188    $infos = array();
     189    if (!$this->isEditAllowed($comment)) {
     190      // Not allowed
     191      array_push($infos, 'comment_edit_forbidden');
     192      $this->displayError($infos);
     193      return;
     194    }
     195    $this->displayComment($comment);
     196  }
     197
     198  function updateComment() {
     199    $infos = array();
     200    if ((!isset($_POST['ce_commentid'])) or
     201        (!isset($_POST['ce_imageid']))) {
     202      array_push($infos, 'comment_access_invalid');
     203      $this->displayError($infos);
     204      return;
     205    }
     206    if (!is_numeric($_POST['ce_imageid'])) {
     207      array_push($infos, 'comment_access_invalid');
     208      $this->displayError($infos);
     209      return;
     210    }
     211    $comment = new CE_Comment($_POST['ce_commentid']);
     212
     213    if (!$this->isEditAllowed($comment)) {
     214      array_push($infos, 'comment_edit_forbidden');
     215      $this->displayError($infos);
     216      return;
     217    }
     218    $image_id = $comment->getInfo('image_id');
     219    if (intval($_POST['ce_imageid']) != intval($image_id)) {
     220      array_push($infos, 'comment_access_invalid');
     221      $this->displayError($infos);
     222      return;
     223    }
     224    if (isset($_POST['ce_author'])) {
     225      $comment->setInfo('author', $_POST['ce_author']);
     226    } else if ((isset($_POST['ce_freeauthorck'])) and
     227               (isset($_POST['ce_freeauthor']))) {
     228      // Free author
     229      $new_author = trim(stripslashes($_POST['ce_freeauthor']));
     230      $new_author = $comment->validateAuthor($new_author);
     231      $comment->setInfo('author', $new_author);
     232    }
     233
     234    $comment_array = array(
     235      'author'      => trim( stripslashes($comment->getInfo('author')) ),
     236      'content'     => trim( stripslashes($_POST['ce_content']) ),
     237      'image_id'    => $image_id,
     238      'comment_id'  => $comment->getInfo('comment_id'),
     239    );
     240
     241    // Deactivate anti-flood system
     242    global $conf;
     243    $old_anti_flood = $conf['anti-flood_time'];
     244    $conf['anti-flood_time'] = 0;
     245
     246    $comment_action = update_user_comment($comment_array, @$_POST['key'], $infos );
     247
     248    // Reactivate anti-flood system
     249    $conf['anti-flood_time'] = $old_anti_flood;
     250
     251    switch ($comment_action) {
     252      case 'moderate':
     253        array_push( $infos, 'comment_to_validate' );
     254      case 'validate':
     255        array_push( $infos, 'comment_added');
     256        break;
     257      case 'reject':
     258        set_status_header(403);
     259        array_push($infos, 'comment_not_added' );
     260        break;
     261      default:
     262        trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
     263    }
     264
     265    // allow plugins to notify what's going on
     266    trigger_action( 'user_comment_insertion',
     267                    array_merge($comment_array, array('action'=>$comment_action)));
     268    if ($comment_action=='reject') {
     269      $this->displayError($infos);
     270    } else {
     271      $this->displayInfo($infos);
     272    }
     273  }
     274
     275  function getCommentId($p_string_delete) {
     276    $comment_id = "";
     277    $elements = split('\?', $p_string_delete);
     278    if (count($elements) > 1) {
     279      $elem_var = split('\&amp;', $elements[1]);
     280      foreach ($elem_var as $var) {
     281        $key_value = split('=', $var);
     282        if (count($key_value) > 1) {
     283          switch ($key_value[0]) {
     284            case 'comment_to_delete':
     285            case 'delete':
     286              $comment_id = $key_value[1];
     287              break;
     288            default:
     289              // No ID
     290          }
    261291        }
    262         return $comment_id;
    263     }
    264 
    265     function displayError($p_error) {
     292      }
     293    }
     294    return $comment_id;
     295  }
     296
     297  function displayError($p_error) {
     298    if ($this->config->getValue(CE_CFG_DISPLAY_ERROR)) {
    266299        $this->displayMessage($p_error, CE_TYPE_ERROR, CE_ERRORS);
    267300    }
    268 
    269     function displayInfo($p_info) {
    270         $this->displayMessage($p_info, CE_TYPE_INFO, CE_INFOS);
    271     }
    272 
    273     function displayMessage($p_message, $p_type, $p_image) {
    274         //  Include language advices
    275         load_language('plugin.lang', CE_PATH);
    276 
    277         $messages = array();
    278         foreach ($p_message as $message) {
    279             array_push($messages, l10n($message));
    280         }
    281         $message_array = array(
    282             'TYPE'  => $p_type,
    283             'IMG'   => $p_image,
    284             'TITLE' => l10n($p_type),
    285             'MSG'   => $messages
    286         );
    287 
    288         global $template;
    289         if ("" == $template->get_template_vars('U_HOME')) {
    290             $template->assign('U_HOME', make_index_url());
    291         }
    292         $template->set_filenames(array('ce_message'=>$this->getTemplate('message.tpl')));
    293         $template->block_html_head( '',
    294                                     '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">',
    295                                     $smarty, $repeat);
    296         $begin = 'PLUGIN_INDEX_CONTENT_BEFORE';
    297         $template->assign('message', $message_array);
    298         $old_begin = $template->get_template_vars($begin);
    299         $template->assign($begin, $template->parse('ce_message', true));
    300         $template->concat($begin, $old_begin);
    301     }
    302 
    303     function displayComment($p_comment) {
    304         global $template;
    305         $template->set_filenames(array('ce_edit'=>$this->getTemplate()));
    306         $template->block_html_head( '',
    307                                     '<link rel="stylesheet" type="text/css" href="'.CE_STYLE.'">',
    308                                     $smarty, $repeat);
     301  }
     302
     303  function displayInfo($p_info) {
     304    if ($this->config->getValue(CE_CFG_DISPLAY_INFO)) {
     305      $this->displayMessage($p_info, CE_TYPE_INFO, CE_INFOS);
     306    }
     307  }
     308
     309  function displayMessage($p_message, $p_type, $p_image) {
     310    // Include language advices
     311    load_language('plugin.lang', CE_PATH);
     312
     313    $messages = array();
     314    foreach ($p_message as $message) {
     315      array_push($messages, l10n($message));
     316    }
     317    $message_array = array(
     318      'TYPE'  => $p_type,
     319      'IMG'   => $p_image,
     320      'TITLE' => l10n($p_type),
     321      'MSG'   => $messages
     322    );
     323
     324    global $template;
     325    if ("" == $template->get_template_vars('U_HOME')) {
     326      $template->assign('U_HOME', make_index_url());
     327    }
     328    $template->set_filenames(array('ce_message'=>$this->getTemplate('message.tpl')));
     329    $template->block_html_head( '',
     330                  '<link rel="stylesheet" type="text/css" href="'
     331                  .CE_INCLUDE . $this->getScriptName() . '.css'
     332                  .'">',
     333    $smarty, $repeat);
     334    if (!$this->setBeginEndFields($begin, $end)) {
     335      return;
     336    }
     337
     338    $template->assign('message', $message_array);
     339    $old_begin = $template->get_template_vars($begin);
     340    $template->assign($begin, $template->parse('ce_message', true));
     341    $template->concat($begin, $old_begin);
     342  }
     343
     344  function displayComment($p_comment) {
     345    // Include language advices
     346    load_language('plugin.lang', CE_PATH);
     347
     348    global $template;
     349    $template->set_filenames(array('ce_edit'=>$this->getTemplate()));
     350    $template->block_html_head( '',
     351                  '<link rel="stylesheet" type="text/css" href="'
     352                  .CE_INCLUDE . $this->getScriptName() . '.css'
     353                  .'">',
     354    $smarty, $repeat);
     355
     356    if (!$this->setBeginEndFields($begin, $end)) {
     357      return;
     358    }
     359
     360    $tpl_comment = array(
     361      'CONTENT'   => $p_comment->getInfo('content'),
     362      'KEY'       => $p_comment->getInfo('comment_id'),
     363      'AUTHOR'    => $p_comment->getInfo('author'),
     364      'IMAGE'     => $p_comment->getInfo('image_id'),
     365      'DISABLED'  => !is_admin(),
     366      'USERS'     => CE_Comment::getUsers(),
     367      'F_ACTION'  => $this->getUpdateUrl(),
     368      'FREEAUTHOR'=> ($p_comment->isKnownAuthor())?'':'checked="checked"'
     369      );
     370      if ("" == $template->get_template_vars('U_HOME')) {
     371        $template->assign('U_HOME', make_index_url());
     372      }
     373      $template->assign('comment', $tpl_comment);
     374      $old_begin = $template->get_template_vars($begin);
     375      $template->assign($begin, $template->parse('ce_edit', true));
     376      $template->concat($begin, $old_begin);
     377  }
     378
     379  function setBeginEndFields(&$begin, &$end) {
     380    switch (script_basename()) {
     381      case 'index':
    309382        $begin = 'PLUGIN_INDEX_CONTENT_BEFORE';
    310383        $end = 'PLUGIN_INDEX_CONTENT_AFTER';
    311         $template->assign($begin, null);
    312         $template->assign($end, null);
    313         $tpl_comment = array(
    314             'CONTENT'   => $p_comment->getInfo('content'),
    315             'KEY'       => $p_comment->getInfo('comment_id'),
    316             'AUTHOR'    => $p_comment->getInfo('author'),
    317             'IMAGE'     => $p_comment->getInfo('image_id'),
    318             'DISABLED'  => !is_admin(),
    319             'USERS'     => CE_Comment::getUsers(),
    320             'F_ACTION'  => $this->getUpdateUrl(),
    321             'FREEAUTHOR'=> ($p_comment->isKnownAuthor())?'':'checked="checked"'
    322         );
    323         if ("" == $template->get_template_vars('U_HOME')) {
    324             $template->assign('U_HOME', make_index_url());
    325         }
    326         $template->assign('comment', $tpl_comment);
    327         $template->concat($begin, $template->parse('ce_edit', true));
    328 
    329     }
    330 
    331     function getScriptName() {
    332         // By now, still in index page
    333         // return script_basename();
     384        break;
     385      case 'picture':
     386        $begin = 'PLUGIN_PICTURE_BEFORE';
     387        $end = 'PLUGIN_PICTURE_AFTER';
     388        break;
     389      default:
     390        return FALSE;
     391    }
     392    return TRUE;
     393  }
     394
     395  function getScriptName() {
     396    switch (script_basename()) {
     397      case 'index':
     398      case 'picture':
     399        return script_basename();
     400      default:
    334401        return 'index';
    335402    }
    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;
    360     }
     403  }
     404
     405  function getEditUrl($comment_id) {
     406    $url  = get_root_url() . $this->getScriptName() . '.php';
     407    $url .= get_query_string_diff(array(CE_ACTION, CE_ID));
     408    $url = add_url_params($url,
     409                          array(
     410                            CE_ACTION => CE_ACTION_EDIT,
     411                            CE_ID=>$comment_id
     412                          )
     413            );
     414    return $url;
     415  }
     416
     417  function getUpdateUrl() {
     418    $url  = get_root_url() . $this->getScriptName() .'.php';
     419    $url .= get_query_string_diff(array(CE_ACTION, CE_ID));
     420    $url = add_url_params($url,
     421                          array(
     422                            CE_ACTION => CE_ACTION_UPDATE
     423                          )
     424            );
     425    return $url;
     426  }
     427
     428  function get_plugin_admin_url() {
     429    return get_admin_plugin_menu_link(CE_PATH . 'administration.php');
     430  }
    361431
    362432}
  • extensions/CommentEditor/include/ce_common.inc.php

    r3443 r3462  
    11<?php
    2 /* $Id: ce_common.inc.php,v 1.8 2009/06/22 22:18:13 Criss Exp $ */
     2/* $Id: ce_common.inc.php,v 1.11 2009/06/26 09:49:27 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
     5// Define constants
    56define('CE_INCLUDE_DIR',   'include/');
    67define('CE_CLASSES_DIR',   'classes/');
    78define('CE_IMAGES_DIR',    'images/');
    89define('CE_TEMPLATE_DIR',  'template/');
     10define('CE_ADMIN_DIR',     'admin/');
     11
    912define('CE_CLASSES',       CE_PATH.CE_CLASSES_DIR);
    1013define('CE_INCLUDE',       CE_PATH.CE_INCLUDE_DIR);
    1114define('CE_TEMPLATE',      CE_PATH.CE_TEMPLATE_DIR);
    12 define('CE_STYLE',         CE_INCLUDE.'edit.css');
     15define('CE_ADMIN',         CE_PATH.CE_ADMIN_DIR);
     16define('CE_AMDIN_TPL',     CE_ROOT.CE_ADMIN_DIR.CE_TEMPLATE_DIR);
     17
    1318define('CE_ERRORS',        CE_INCLUDE.'errors.png');
    1419define('CE_INFOS',         CE_INCLUDE.'infos.png');
     
    2732@include_once(CE_INCLUDE.'ce_functions.inc.php');
    2833
    29 // Load class file
     34// Load class files
     35ce_require_class("CE_Config");
     36ce_require_class("CE_Comment");
    3037ce_require_class("CE_Plugin");
    3138
     39// Config keys
     40if (isset($plugin)) {
     41  define('CE_CFG_DB_KEY',     $plugin['id']);
     42  define('CE_CFG_DB_COMMENT', 'Configuration of plugin ' . $plugin['id']);
     43}
     44define('CE_CFG_DISPLAY_ERROR',  'display_error');
     45define('CE_CFG_DISPLAY_INFO',   'display_info');
     46
     47// Config default values
     48$ce_config_default[CE_CFG_DISPLAY_ERROR]  = true;
     49$ce_config_default[CE_CFG_DISPLAY_INFO]   = true;
     50
     51// Templates usage
     52define('CE_CHECKED',  'checked="checked"')
    3253?>
  • extensions/CommentEditor/include/ce_functions.inc.php

    r3435 r3462  
    11<?php
    2 /* $Id: ce_functions.inc.php,v 1.3 2009/06/17 19:08:23 Criss Exp $ */
     2/* $Id: ce_functions.inc.php,v 1.6 2009/06/26 08:56:32 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
     
    99 */
    1010function ce_require_class($aClassName) {
    11     require_once CE_CLASSES .strtolower($aClassName) . '.class.php';
     11  require_once CE_CLASSES .strtolower($aClassName) . '.class.php';
    1212}
    1313
     
    7272  {
    7373    if ( empty($comm['author'])) {
    74         $comm['author'] = $user['username'];
     74        $comm['author'] = $user[$conf['user_fields']['username']];
    7575    }
    7676  }
  • extensions/CommentEditor/language/en_UK/plugin.lang.php

    r3427 r3462  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.3 2009/06/17 19:08:25 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.4 2009/06/26 08:56:33 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
    55
     6// ==================================================================
     7// Edit block
    68$lang['comment_edit'] = 'Comment edition';
    79$lang['comment_author'] = 'Author';
    810$lang['comment_author_free'] = 'Free choice of the author';
    911$lang['comment_content'] = 'Comment';
     12$lang['comment_edit_tool'] = 'Edit';
    1013
     14
     15// ==================================================================
     16// Message block
    1117$lang[CE_TYPE_INFO] = 'Information';
    1218$lang[CE_TYPE_ERROR] = 'Error';
    1319$lang['comment_edit_forbidden'] = 'You are not allowed to edit this comment';
    1420$lang['comment_access_invalid'] = 'Invalid access';
     21
     22// ==================================================================
     23// Config
     24$lang['ce_config_saved'] = 'Configuration successfully saved';
     25$lang['ce_config_saved_with_errors'] = 'Configuration saved with errors';
     26
     27// ==================================================================
     28// Config tab
     29$lang['ce_tab_config'] = 'Configuration';
     30$lang['ce_config_desc'] = 'Plugin main configuration';
     31$lang['ce_label_config'] = 'General configuration';
     32$lang['ce_label_display_info'] = 'Display informative messages';
     33$lang['ce_label_display_error'] = 'Display error messages';
     34
    1535?>
  • extensions/CommentEditor/language/fr_FR/plugin.lang.php

    r3443 r3462  
    11<?php
    2 /* $Id: plugin.lang.php,v 1.4 2009/06/22 22:18:12 Criss Exp $ */
     2/* $Id: plugin.lang.php,v 1.5 2009/06/26 08:56:33 Criss Exp $ */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44global $lang;
    55
    6 
     6// ==================================================================
     7// Edit block
    78$lang['comment_edit'] = 'Edition de commentaire';
    89$lang['comment_author'] = 'Auteur';
    910$lang['comment_author_free'] = 'Choix libre de l\'auteur';
    1011$lang['comment_content'] = 'Commentaire';
     12$lang['comment_edit_tool'] = 'Editer';
    1113
     14// ==================================================================
     15// Message block
    1216$lang[CE_TYPE_INFO] = 'Information';
    1317$lang[CE_TYPE_ERROR] = 'Erreur';
    14 $lang['comment_edit_forbidden'] = 'Vous n\'êtes pas autorisé à éditer ce commentaire';
     18$lang['comment_edit_forbidden'] = 'Vous n\'êtes pas autorisé à  éditer ce commentaire';
    1519$lang['comment_access_invalid'] = 'Accès invalide';
     20
     21// ==================================================================
     22// Config
     23$lang['ce_config_saved'] = 'Configuration sauvée avec succès';
     24$lang['ce_config_saved_with_errors'] = 'Configuration sauvée mais avec des erreurs';
     25
     26// ==================================================================
     27// Config tab
     28$lang['ce_tab_config'] = 'Configuration';
     29$lang['ce_config_desc'] = 'Configuration principale du plugin';
     30$lang['ce_label_config'] = 'Configuration générale';
     31$lang['ce_label_display_info'] = 'Afficher les messages informatifs';
     32$lang['ce_label_display_error'] = 'Afficher les messages d\'erreurs';
    1633?>
  • extensions/CommentEditor/main.inc.php

    r3443 r3462  
    11<?php
    2 /* $Id: main.inc.php,v 1.9 2009/06/22 22:18:14 Criss Exp $ */
     2/* $Id: main.inc.php,v 1.13 2009/06/26 09:49:12 Criss Exp $ */
    33/*
    44 Plugin Name: Comment Editor
    5  Version: 1.0.g
     5 Version: 1.0.h
    66 Description: Allow to edit comment
    77 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=296
     
    1212/** History **
    1313
    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
     14  2009-06-?? 1.0.h
     15                    Display edit block on picture page if request comes
     16                    from this page
     17                    Add simple administration configuration management
     18                    Add and remove default configuration from database
     19                    on plugin install / uninstall
    1920
    20     2009-06-22 1.0.f
    21                         Add edit link for author even if he's not an admin
    22                         Code cleanup
     21  2009-06-22 1.0.g
     22                    Deactivate anti-flood on update
     23                    Adviser can edit only its comments
     24                    Language file converted in UTF-8
     25                    Add home link in edit and message block title bar
    2326
    24     2009-06-18 1.0.e
    25                         Check existence of function update_user_comment()
     27  2009-06-22 1.0.f
     28                    Add edit link for author even if he's not an admin
     29                    Code cleanup
    2630
    27     2009-06-18 1.0.d
    28                         Improve sanity checking
     31  2009-06-18 1.0.e
     32                    Check existence of function update_user_comment()
    2933
    30     2009-06-18 1.0.c
    31                         Add maintain.inc.php file
    32                         Fix bug in CE_Comment::validateAuthor()
     34  2009-06-18 1.0.d
     35                    Improve sanity checking
    3336
    34     2009-06-18 1.0.b
    35                         Fix plugin URI to be available in plugin update
    36                         check page.
    37                         Reduce code line size.
     37  2009-06-18 1.0.c
     38                    Add maintain.inc.php file
     39                    Fix bug in CE_Comment::validateAuthor()
     40
     41  2009-06-18 1.0.b
     42                    Fix plugin URI to be available in plugin update
     43                    check page.
     44                    Reduce code line size.
    3845
    3946*/
    4047if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    4148
    42 define('CE_VERSION',       '1.0.g');
    43 define('CE_PATH', PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
    44 define('CE_ROOT', dirname(__FILE__).'/');
     49define('CE_VERSION',  '1.0.h');
     50define('CE_PATH',     PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
     51define('CE_ROOT',     dirname(__FILE__).'/');
    4552include_once(CE_PATH . 'include/ce_common.inc.php');
    4653
     54$ce_config = new CE_Config($ce_config_default);
     55$ce_plugin = new CE_Plugin($plugin['id'], $ce_config);
    4756
    48 $ce_plugin = new CE_Plugin();
    49 add_event_handler(  'render_comment_content',
    50                     array(&$ce_plugin, 'render_comment_content'));
    51 add_event_handler(  'loc_begin_page_header',
    52                     array(&$ce_plugin, 'loc_begin_page_header'));
    53 add_event_handler(  'loc_begin_index',
    54                     array(&$ce_plugin, 'loc_begin_index'), 1);
    55 
     57add_event_handler('get_admin_plugin_menu_links',
     58                  array(&$ce_plugin, 'get_admin_plugin_menu_links'));
     59add_event_handler('render_comment_content',
     60                  array(&$ce_plugin, 'render_comment_content'));
     61add_event_handler('loc_begin_page_header',
     62                  array(&$ce_plugin, 'loc_begin_page_header'));
     63switch (script_basename()) {
     64  case 'index':
     65    add_event_handler('loc_begin_index',
     66                      array(&$ce_plugin, 'loc_begin_index'), 1);
     67    break;
     68  case 'picture':
     69    add_event_handler('loc_begin_picture',
     70                      array(&$ce_plugin, 'loc_begin_picture'), 1);
     71    break;
     72  default:
     73}
    5674set_plugin_data($plugin['id'], $ce_plugin);
    5775
  • extensions/CommentEditor/maintain.inc.php

    r3432 r3462  
    11<?php
    22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     3if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
    34
    4 function plugin_install() {
    5     // Nothing special
     5if (!defined('CE_PATH')) {
     6  define('CE_PATH',     PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
     7}
     8if (!defined('CE_ROOT')) {
     9  define('CE_ROOT',     dirname(__FILE__).'/');
    610}
    711
    8 function plugin_activate() {
    9     // Nothing special
     12function plugin_install($plugin_id) {
     13  include_once(CE_PATH . 'include/ce_common.inc.php');
     14  $install = CE_Config::install($plugin_id, $ce_config_default);
     15}
     16
     17function plugin_activate($plugin_id) {
     18  // Nothing special
    1019}
    1120
    1221function plugin_uninstall($plugin_id) {
    13     // Nothing special
     22  include_once(CE_PATH . 'include/ce_common.inc.php');
     23  $uninstall = CE_Config::uninstall($plugin_id);
    1424}
    1525?>
  • extensions/CommentEditor/template/edit.tpl

    r3443 r3462  
    1 {* $Id: edit.tpl,v 1.4 2009/06/22 22:18:13 Criss Exp $ *}
     1{* $Id: edit.tpl,v 1.7 2009/06/26 09:17:01 Criss Exp $ *}
    22{if !$comment.DISABLED}
    33<script type="text/javascript">
    44function toggleDisabled(aToggle, aList1, aList2) {ldelim}
    5     var lCheckBox = document.getElementById(aToggle);
    6     var lList1 = document.getElementById(aList1);
    7     var lList2 = document.getElementById(aList2);
    8     lList1.disabled = lCheckBox.checked;
    9     lList2.disabled = !lCheckBox.checked;
     5  var lCheckBox = document.getElementById(aToggle);
     6  var lList1 = document.getElementById(aList1);
     7  var lList2 = document.getElementById(aList2);
     8  lList1.disabled = lCheckBox.checked;
     9  lList2.disabled = !lCheckBox.checked;
    1010}
    1111</script>
    1212{/if}       
    13 <div id="content" class="content">
    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>
    18         <h2>{'comment_edit'|@translate}</h2>
    19     </div>
    20     <div id="comments">
    21         <form  method="post" action="{$comment.F_ACTION}" class="filter" id="editComment">
    22         <table>
    23         <tr>
    24             <td>{'comment_author'|@translate}</td>
    25             {if $comment.DISABLED}
    26             <td colspan="3">
    27                 <input type="text" name="author" disabled="disabled" value="{$comment.AUTHOR}">
    28             {else}
    29             <td>
    30                 {html_options name=author id=authorlist options=$comment.USERS selected=$comment.AUTHOR}
    31             </td>
    32             <td align="right">
    33                 <input type="checkbox" name="freeauthorck" id="freeauthorck" value="1" onchange="toggleDisabled('freeauthorck', 'authorlist', 'freeauthorfield');" {$comment.FREEAUTHOR}> {'comment_author_free'|@translate}
    34             </td>
    35             <td align="right">
    36                 <input type="text" name="freeauthor" id="freeauthorfield" value="{$comment.AUTHOR}" >
    37                 <script type="text/javascript">toggleDisabled('freeauthorck', 'authorlist', 'freeauthorfield');</script>
    38             {/if}
    39             </td>
    40         </tr>
    41         <tr>
    42             <td>{'comment_content'|@translate}</td>
    43             <td colspan="3">
    44                 <textarea name="content" id="contentid" rows="5" cols="80">{$comment.CONTENT}</textarea>
    45             </td>
    46         </tr>
    47         <tr>
    48             <td colspan="4" align="center">
    49                 <input type="hidden" name="imageid" value="{$comment.IMAGE}" />
    50                 <input type="hidden" name="commentid" value="{$comment.KEY}" />
    51                 <input class="submit" type="submit" value="{'Submit'|@translate}">
    52             </td>
    53         </tr>
    54         </table>
    55         </form>
    56     </div>
     13<div id="ce-content" class="content">
     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>
     18  <h2>{'comment_edit'|@translate}</h2>
     19  </div>
     20  <div id="ce-comments">
     21    <form  method="post" action="{$comment.F_ACTION}" class="filter" id="editComment">
     22    <table>
     23    <tr>
     24      <td>{'comment_author'|@translate}</td>
     25      {if $comment.DISABLED}
     26      <td colspan="3">
     27        <input type="text" name="ce_author" disabled="disabled" value="{$comment.AUTHOR}">
     28      {else}
     29      <td>
     30        {html_options name=ce_author id=ce_authorlist options=$comment.USERS selected=$comment.AUTHOR}
     31      </td>
     32      <td align="right">
     33        <input type="checkbox" name="ce_freeauthorck" id="ce_freeauthorck" value="1" onchange="toggleDisabled('ce_freeauthorck', 'ce_authorlist', 'ce_freeauthorfield');" {$comment.FREEAUTHOR}> {'comment_author_free'|@translate}
     34      </td>
     35      <td align="right">
     36        <input type="text" name="ce_freeauthor" id="ce_freeauthorfield" value="{$comment.AUTHOR}" >
     37        <script type="text/javascript">toggleDisabled('ce_freeauthorck', 'ce_authorlist', 'ce_freeauthorfield');</script>
     38      {/if}
     39      </td>
     40    </tr>
     41    <tr>
     42      <td>{'comment_content'|@translate}</td>
     43      <td colspan="3">
     44        <textarea name="ce_content" id="ce_contentid" rows="5" cols="80">{$comment.CONTENT}</textarea>
     45      </td>
     46    </tr>
     47    <tr>
     48      <td colspan="4" align="center">
     49        <input type="hidden" name="ce_imageid" value="{$comment.IMAGE}" />
     50        <input type="hidden" name="ce_commentid" value="{$comment.KEY}" />
     51        <input class="submit" type="submit" value="{'Submit'|@translate}">
     52      </td>
     53    </tr>
     54    </table>
     55    </form>
     56  </div>
    5757</div>
  • extensions/CommentEditor/template/message.tpl

    r3443 r3462  
    1 {* $Id: message.tpl,v 1.4 2009/06/22 22:18:13 Criss Exp $ *}
    2 <div class="content" id="message-block">
    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>
    7         <h2 id="message-header">{'CommentEditor'|@translate} - {$message.TITLE}</h2>
     1{* $Id: message.tpl,v 1.6 2009/06/26 09:17:01 Criss Exp $ *}
     2<div class="content" id="ce-message-block">
     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>
     7    <h2 id="ce-message-header">{'CommentEditor'|@translate} - {$message.TITLE}</h2>
     8  </div>
     9  <div class="ce-message-{$message.TYPE}">
     10    <div class="ce-message-img">
     11      <img src="{$message.IMG}" alt="{$message.TITLE}" title="{$message.TITLE}" class="button">
    812    </div>
    9     <div class="message-{$message.TYPE}">
    10         <div class="message-img">
    11             <img src="{$message.IMG}" alt="{$message.TITLE}" title="{$message.TITLE}" class="button">
    12         </div>
    13         <div class="message-list">
    14             <ul class="message-list">
    15                 {foreach from=$message.MSG item=msg}
    16                 <li>{$msg}</li>
    17                 {/foreach}
    18             </ul>
    19         </div>
     13    <div class="ce-message-list">
     14      <ul class="ce-message-list">
     15        {foreach from=$message.MSG item=msg}
     16        <li>{$msg}</li>
     17        {/foreach}
     18      </ul>
    2019    </div>
     20  </div>
    2121</div>
Note: See TracChangeset for help on using the changeset viewer.