Changeset 11267


Ignore:
Timestamp:
Jun 7, 2011, 9:44:37 PM (13 years ago)
Author:
mistic100
Message:

big code cleaning

Location:
extensions/Comments_on_Albums
Files:
3 deleted
8 edited
2 copied
3 moved

Legend:

Unmodified
Added
Removed
  • extensions/Comments_on_Albums/admin.php

    r10984 r11267  
    66
    77// +-----------------------------------------------------------------------+
    8 //        Tabsheet
     8//                         Save configuration                              |
    99// +-----------------------------------------------------------------------+
    10 include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
    11 $page['tab'] = (isset($_GET['tab'])) ? $_GET['tab'] : $page['tab'] = 'config';
     10if (isset($_POST['config_submit']))
     11{
     12  $conf['comments_on_albums'] = array(
     13    'icon_color' => $_POST['icon_color'],
     14    'icon_color_over' => $_POST['icon_color_over'],
     15    );
    1216 
    13 $tabsheet = new tabsheet();
    14 $tabsheet->add('config', l10n('Configuration'), COA_ADMIN . '-config');   // Configuration
    15 $tabsheet->select($page['tab']);
    16 $tabsheet->assign();
     17  conf_update_param('comments_on_albums', serialize($conf['comments_on_albums']));
     18  array_push($page['infos'], l10n('Information data registered in database'));
     19
     20
    1721
    1822// +-----------------------------------------------------------------------+
    19 //        Template
     23//                               Template                                  |
    2024// +-----------------------------------------------------------------------+
    21 $template->assign(array(
    22   'COA_PATH' => COA_PATH,
    23   'COA_ADMIN' => COA_ADMIN,
    24 ));
    2525
    26 include(COA_PATH.'admin/' . $page['tab'] . '.php');
     26// available icons
     27$dh = opendir(COA_PATH . 'template/s26');
     28while (($file = readdir($dh)) !== false )
     29{
     30  if ($file !== '.' AND $file !== '..' AND in_array(strtolower(get_extension($file)), array('jpg', 'png', 'gif')))
     31  {
     32    $template->append('COLORS', $file);
     33  }
     34}
     35closedir($dh);
     36 
     37$template->assign(
     38  array(
     39    'COA_PATH' => COA_PATH,
     40    'ICON_COLOR' => $conf['comments_on_albums']['icon_color'],
     41    'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'],
     42    )
     43  );
     44
     45$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__).'/template/config.tpl'));
     46$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
     47
    2748?>
  • extensions/Comments_on_Albums/include/coa_admin_comments.php

    r10984 r11267  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
     5global $template, $conf;
    56load_language('plugin.lang', COA_PATH);
    67
    78// +-----------------------------------------------------------------------+
    8 //        Tabsheet
     9// |                               tabsheet                                |
    910// +-----------------------------------------------------------------------+
    1011include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
     
    1415    'code' => 'pictures',
    1516    'label' => l10n('COA_comments_photos'),
    16   ),
     17    ),
    1718  array(
    1819    'code' => 'albums',
    1920    'label' => l10n('COA_comments_albums'),
    20   ),
    21 );
     21    ),
     22  );
    2223
    2324$tab_codes = array_map(create_function('$a', 'return $a["code"];'), $tabs);
    2425
    25 if (isset($_GET['section']) and in_array($_GET['section'], $tab_codes)) {
     26if (isset($_GET['section']) and in_array($_GET['section'], $tab_codes))
     27{
    2628  $page['tab'] = $_GET['section'];
    27 } else {
     29}
     30else
     31{
    2832  $page['tab'] = $tabs[0]['code'];
    2933}
    3034
    3135$tabsheet = new tabsheet();
    32 foreach ($tabs as $tab) {
     36foreach ($tabs as $tab)
     37{
    3338  $tabsheet->add(
    3439    $tab['code'],
    3540    $tab['label'],
    3641    get_root_url().'admin.php?page=comments&section='.$tab['code']
    37   );
     42    );
    3843}
    3944$tabsheet->select($page['tab']);
     
    4146
    4247
    43 if ($page['tab'] == 'albums') {
     48if ($page['tab'] == 'albums')
     49{
     50  // clear template sended by original page
    4451  $template->clear_assign(array('ADMIN_CONTENT', 'comments', 'LIST', 'F_ACTION'));
    4552
    4653  // +-----------------------------------------------------------------------+
    47   //        Actions
     54  // |                                actions                                |
    4855  // +-----------------------------------------------------------------------+
    49   if (!empty($_POST)) {
    50     if (!empty($_POST['comments'])) {
     56  if (!empty($_POST))
     57  {
     58    if (empty($_POST['comments']))
     59    {
     60      array_push(
     61        $page['errors'],
     62        l10n('Select at least one comment')
     63        );
     64    }
     65    else
     66    {
    5167      check_input_parameter('comments', $_POST, true, PATTERN_ID);
    5268
    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         ;';
     69      if (isset($_POST['validate_albums']))
     70      {
     71        $query = '
     72UPDATE '.COA_TABLE.'
     73  SET validated = \'true\',
     74      validation_date = NOW()
     75  WHERE id IN ('.implode(',', $_POST['comments']).')
     76;';
    5977        pwg_query($query);
    6078
    61         array_push($page['infos'], l10n_dec(
    62           '%d user comment validated', '%d user comments validated',
    63           count($_POST['comments'])
    64         ));
     79        array_push(
     80          $page['infos'],
     81          l10n_dec(
     82            '%d user comment validated', '%d user comments validated',
     83            count($_POST['comments'])
     84            )
     85          );
    6586      }
    6687
    67       if (isset($_POST['reject_albums'])) {
    68         $query = 'DELETE FROM '.COA_TABLE.'
    69           WHERE id IN ('.implode(',', $_POST['comments']).')
    70         ;';
     88      if (isset($_POST['reject_albums']))
     89      {
     90        $query = '
     91DELETE
     92  FROM '.COA_TABLE.'
     93  WHERE id IN ('.implode(',', $_POST['comments']).')
     94;';
    7195        pwg_query($query);
    7296
    73         array_push($page['infos'], l10n_dec(
    74           '%d user comment rejected', '%d user comments rejected',
    75           count($_POST['comments'])
    76         ));
     97        array_push(
     98          $page['infos'],
     99          l10n_dec(
     100            '%d user comment rejected', '%d user comments rejected',
     101            count($_POST['comments'])
     102            )
     103          );
    77104      }
    78105    }
     
    80107
    81108  // +-----------------------------------------------------------------------+
    82   //        Infos (re-assignation needed)
     109  // |                             template init                             |
    83110  // +-----------------------------------------------------------------------+
    84   if (count($page['infos']) != 0) {
     111
     112  $template->set_filename('comments', dirname(__FILE__) .'/../template/admin_comments.tpl');
     113
     114  $template->assign(
     115    array(
     116      'F_ACTION' => get_root_url().'admin.php?page=comments&section=albums'
     117      )
     118    );
     119   
     120  if (count($page['infos']) != 0)
     121  {
    85122    $template->assign('infos', $page['infos']);
    86123  }
    87124
    88125  // +-----------------------------------------------------------------------+
    89   //        Comments display
     126  // |                           comments display                            |
    90127  // +-----------------------------------------------------------------------+
    91128  $list = array();
    92129
    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
     130  $query = '
     131SELECT
     132    com.id,
     133    com.category_id,
     134    com.date,
     135    com.author,
     136    '.$conf['user_fields']['username'].' AS username,
     137    com.content,
     138    cat.name
     139  FROM '.COA_TABLE.' AS com
    102140    INNER JOIN '.CATEGORIES_TABLE.' AS cat
    103     ON cat.id = com.category_id
     141      ON cat.id = com.category_id
    104142    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   ;';
     143      ON u.'.$conf['user_fields']['id'].' = com.author_id
     144  WHERE validated = \'false\'
     145  ORDER BY com.date DESC
     146;';
    109147  $result = pwg_query($query);
    110148
    111   while ($row = pwg_db_fetch_assoc($result)) {
     149  while ($row = pwg_db_fetch_assoc($result))
     150  {
    112151    // author
    113     if (empty($row['author_id'])) {
     152    if (empty($row['author_id']))
     153    {
    114154      $author_name = $row['author'];
    115     } else {
     155    }
     156    else
     157    {
    116158      $author_name = stripslashes($row['username']);
    117159    }
    118160   
    119161    // 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     ));
     162    $template->append(
     163      'comments',
     164      array(
     165        'CAT_URL' => PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id='.$row['category_id'],
     166        'CAT_NAME' => $row['name'],
     167        'ID' => $row['id'],
     168        'AUTHOR' => trigger_event('render_comment_author', $author_name),
     169        'DATE' => format_date($row['date'], true),
     170        'CONTENT' => trigger_event('render_comment_content',$row['content']),
     171        )
     172      );
    128173
    129174    array_push($list, $row['id']);
    130175  }
    131176
    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   ));
     177  $template->assign('LIST', implode(',', $list));
     178
     179  // +-----------------------------------------------------------------------+
     180  // |                           sending html code                           |
     181  // +-----------------------------------------------------------------------+
     182
    138183  $template->assign_var_from_handle('ADMIN_CONTENT', 'comments');
     184
    139185}
    140186
  • extensions/Comments_on_Albums/include/coa_admin_intro.php

    r10984 r11267  
    22/* adds info about comments count on main admin page, uses javascript */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     4
     5global $template;
    46
    57// comments count
     
    1012list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
    1113
    12 $template->assign('DB_COMMENTS_ALBUMS', l10n_dec('%d comment', '%d comments', $nb_comments));
     14$template->assign(
     15  'DB_COMMENTS_ALBUMS',
     16  l10n_dec('%d comment', '%d comments', $nb_comments)
     17  );
    1318
    1419// unvalidated comments
     
    2025list($nb_comments) = pwg_db_fetch_row(pwg_query($query));
    2126
    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   ));
     27if ($nb_comments > 0)
     28{
     29  $template->assign(
     30    'unvalidated_albums',
     31    array(
     32      'URL' => PHPWG_ROOT_PATH.'admin.php?page=comments&section=albums',
     33      'INFO' => sprintf(l10n('%d waiting for validation'), $nb_comments)
     34      )
     35    );
    2736}
    2837
    29 // template
    30 $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/coa_admin_intro.tpl');
    31 $template->concat('ADMIN_CONTENT', $template->parse('comments_on_albums', true));
     38$template->set_prefilter('intro', 'coa_admin_intro_prefilter');
     39
     40function coa_admin_intro_prefilter($content, &$smarty)
     41{
     42  $search = '(<a href="{$unvalidated.URL}">{$unvalidated.INFO}</a>)';
     43       
     44  $replace = $search.'
     45        {/if}
     46        [{\'Photos\'|@translate}]
     47      </li>
     48      <li>
     49        {$DB_COMMENTS_ALBUMS}
     50        {if isset($unvalidated_albums)}
     51        (<a href="{$unvalidated_albums.URL}">{$unvalidated_albums.INFO}</a>)
     52        {/if}
     53        [{\'Albums\'|@translate}]
     54      {if true}';
     55
     56  return str_replace($search, $replace, $content);
     57}
    3258
    3359?>
  • extensions/Comments_on_Albums/include/coa_albums.php

    r11251 r11267  
    44
    55// +-----------------------------------------------------------------------+
    6 //        Category's infos
     6// |                            category infos                             |
    77// +-----------------------------------------------------------------------+
    88$category = $page['category'];
     
    1010$url_self = duplicate_index_url(array(
    1111  'category' => array(
    12     'id'=>$category['id'],
    13     'name'=>$category['name'],
    14     'permalink'=>$category['permalink']
    15   ),
     12    'id' => $category['id'],
     13    'name' => $category['name'],
     14    'permalink' => $category['permalink']
     15    ),
    1616  array('start')
    17 ));
    18 
    19 
    20 // +-----------------------------------------------------------------------+
    21 //        Actions
    22 // +-----------------------------------------------------------------------+
    23 if (isset($_GET['action'])) {
    24   switch ($_GET['action']) {
    25     case 'edit_comment' : {
     17  ));
     18
     19
     20// +-----------------------------------------------------------------------+
     21// |                                actions                                |
     22// +-----------------------------------------------------------------------+
     23if (isset($_GET['action']))
     24{
     25  switch ($_GET['action'])
     26  {
     27    case 'edit_comment' :
     28    {
    2629      check_pwg_token();
     30     
    2731      include_once(COA_PATH.'include/functions_comment.inc.php'); // custom fonctions
     32     
    2833      check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID);
     34     
    2935      $author_id = get_comment_author_id_albums($_GET['comment_to_edit']);
    3036
    31       if (can_manage_comment('edit', $author_id)) {
    32         if (!empty($_POST['content'])) {
     37      if (can_manage_comment('edit', $author_id))
     38      {
     39        if (!empty($_POST['content']))
     40        {
    3341          $comment_action = update_user_comment_albums(
    3442            array(
     
    3644              'image_id' => $category['id'],
    3745              'content' => $_POST['content']
    38             ),
     46              ),
    3947            $_POST['key']
    40           );
     48            );
    4149         
    4250          $infos = array();
     
    5866
    5967          $template->assign(
    60             ($comment_action=='reject') ? 'errors' : 'infos',
    61             $infos
    62           );
     68              ($comment_action=='reject') ? 'errors' : 'infos',
     69              $infos
     70            );
    6371
    6472          unset($_POST['content']);
    6573          break;
    66         } else {
     74        }
     75        else
     76        {
    6777          $edit_comment = $_GET['comment_to_edit'];
    6878          break;
     
    7080      }
    7181    }
    72     case 'delete_comment' : {
     82    case 'delete_comment' :
     83    {
    7384      check_pwg_token();
     85     
    7486      include_once(COA_PATH.'include/functions_comment.inc.php');
     87     
    7588      check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID);
     89     
    7690      $author_id = get_comment_author_id_albums($_GET['comment_to_delete']);
    7791
    78       if (can_manage_comment('delete', $author_id)) {
     92      if (can_manage_comment('delete', $author_id))
     93      {
    7994        delete_user_comment_albums($_GET['comment_to_delete']);
    8095      }
     
    8297      redirect($url_self);
    8398    }
    84     case 'validate_comment' : {
     99    case 'validate_comment' :
     100    {
    85101      check_pwg_token();
     102     
    86103      include_once(COA_PATH.'include/functions_comment.inc.php');
     104     
    87105      check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID);
     106     
    88107      $author_id = get_comment_author_id_albums($_GET['comment_to_validate']);
    89108
    90       if (can_manage_comment('validate', $author_id)) {
     109      if (can_manage_comment('validate', $author_id))
     110      {
    91111        validate_user_comment_albums($_GET['comment_to_validate']);
    92112      }
     
    97117}
    98118
    99 
    100 // +-----------------------------------------------------------------------+
    101 //        Insert comment
    102 // +-----------------------------------------------------------------------+
    103 if ($category['commentable'] and isset($_POST['content'])) {
    104   if (is_a_guest() and !$conf['comments_forall']) {
     119// +-----------------------------------------------------------------------+
     120// |                            insert comment                             |
     121// +-----------------------------------------------------------------------+
     122if ($category['commentable'] and isset($_POST['content']))
     123{
     124  if (is_a_guest() and !$conf['comments_forall'])
     125  {
    105126    die('Session expired');
    106127  }
     
    113134
    114135  include_once(COA_PATH.'include/functions_comment.inc.php');
     136 
    115137  $comment_action = insert_user_comment_albums($comm, @$_POST['key'], $infos);
    116138
    117   switch ($comment_action) {
     139  switch ($comment_action)
     140  {
    118141    case 'moderate':
    119142      array_push($infos, l10n('An administrator must authorize your comment before it is visible.'));
     
    129152  }
    130153
    131   $template->assign(($comment_action=='reject') ? 'errors' : 'infos', $infos);
    132   trigger_action('user_comment_insertion', array_merge($comm, array('action'=>$comment_action)));
    133  
    134 } elseif (isset($_POST['content'])) {
     154  $template->assign(
     155      ($comment_action=='reject') ? 'errors' : 'infos',
     156      $infos
     157    );
     158   
     159  // allow plugins to notify what's going on
     160  trigger_action( 'user_comment_insertion',
     161      array_merge($comm, array('action'=>$comment_action) )
     162    );
     163 
     164}
     165else if (isset($_POST['content']))
     166{
    135167  set_status_header(403);
    136168  die('ugly spammer');
     
    139171
    140172// +-----------------------------------------------------------------------+
    141 //        Display comments
    142 // +-----------------------------------------------------------------------+
    143 if ($category['commentable']) {
    144   if (!is_admin()) {
     173// |                           display comments                            |
     174// +-----------------------------------------------------------------------+
     175if ($category['commentable'])
     176{
     177  if (!is_admin())
     178  {
    145179    $validated_clause = " AND validated = 'true'";
    146   } else {
     180  }
     181  else
     182  {
    147183    $validated_clause = null;
    148184  }
    149185
    150186  // 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   ;';
     187  $query = '
     188SELECT
     189    COUNT(*) AS nb_comments
     190  FROM '.COA_TABLE.'
     191  WHERE category_id = '.$category['id']
     192  .$validated_clause.'
     193;';
    156194  $row = pwg_db_fetch_assoc(pwg_query($query));
    157195
    158196  // navigation bar creation, custom again
    159   if (isset($_GET['start_comments'])) {
     197  if (isset($_GET['start_comments']))
     198  {
    160199    $page['start_comments'] = $_GET['start_comments'];
    161   } else {
     200  }
     201  else
     202  {
    162203    $page['start_comments'] = 0;
    163204  }
     
    169210    $page['start_comments'],
    170211    $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) {
     212    );
     213
     214  $template->assign(
     215    array(
     216      'COMMENT_COUNT' => $row['nb_comments'],
     217      'comment_navbar' => $navigation_bar,
     218      )
     219    );
     220
     221  if ($row['nb_comments'] > 0)
     222  {
    179223    // 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     ;';
     224    $query = '
     225SELECT
     226    com.id,
     227    com.author,
     228    com.author_id,
     229    '.$conf['user_fields']['username'].' AS username,
     230    com.date,
     231    com.category_id,
     232    com.content,
     233    com.validated
     234  FROM '.COA_TABLE.' AS com
     235  LEFT JOIN '.USERS_TABLE.' AS u
     236    ON u.'.$conf['user_fields']['id'].' = author_id
     237  WHERE category_id = '.$category['id'].'
     238    '.$validated_clause.'
     239  ORDER BY date ASC
     240  LIMIT '.$conf['nb_comment_page'].' OFFSET '.$page['start_comments'].'
     241;';
    197242    $result = pwg_query($query);
    198243
    199     while ($row = pwg_db_fetch_assoc($result)) {
     244    while ($row = pwg_db_fetch_assoc($result))
     245    {
    200246      // author
    201       if (!empty($row['author'])) {
     247      if (!empty($row['author']))
     248      {
    202249        $author = $row['author'];
    203         if ($author == 'guest') {
     250        if ($author == 'guest')
     251        {
    204252          $author = l10n('guest');
    205253        }
    206       } else {
     254      }
     255      else
     256      {
    207257        $author = stripslashes($row['username']);
    208258      }
     
    214264        'DATE' => format_date($row['date'], true),
    215265        'CONTENT' => trigger_event('render_comment_content', $row['content']),
    216       );
     266        );
    217267     
    218268      // rights
    219       if (can_manage_comment('delete', $row['author_id'])) {
    220         $tpl_comment['U_DELETE'] = add_url_params($url_self, array(
    221           'action' => 'delete_comment',
    222           'comment_to_delete' => $row['id'],
    223           'pwg_token' => get_pwg_token(),
    224         ));
    225       }
    226       if (can_manage_comment('edit', $row['author_id'])) {
    227         $tpl_comment['U_EDIT'] = add_url_params($url_self, array(
    228           'action' => 'edit_comment',
    229           'comment_to_edit' => $row['id'],
    230           'pwg_token' => get_pwg_token(),
    231         ));
    232         if (isset($edit_comment) and ($row['id'] == $edit_comment)) {
     269      if (can_manage_comment('delete', $row['author_id']))
     270      {
     271        $tpl_comment['U_DELETE'] = add_url_params(
     272          $url_self,
     273          array(
     274            'action' => 'delete_comment',
     275            'comment_to_delete' => $row['id'],
     276            'pwg_token' => get_pwg_token(),
     277            )
     278          );
     279      }
     280      if (can_manage_comment('edit', $row['author_id']))
     281      {
     282        $tpl_comment['U_EDIT'] = add_url_params(
     283          $url_self,
     284          array(
     285            'action' => 'edit_comment',
     286            'comment_to_edit' => $row['id'],
     287            'pwg_token' => get_pwg_token(),
     288            )
     289          );
     290        if (isset($edit_comment) and ($row['id'] == $edit_comment))
     291        {
    233292          $key = get_ephemeral_key(2, $category['id']);
    234293          $tpl_comment['IN_EDIT'] = true;
     
    237296        }
    238297      }
    239       if (is_admin() AND $row['validated'] != 'true') {
    240         $tpl_comment['U_VALIDATE'] = add_url_params($url_self, array(
    241           'action' => 'validate_comment',
    242           'comment_to_validate' => $row['id'],
    243           'pwg_token' => get_pwg_token(),
    244         ));
    245       }
    246      
    247       // template
     298      if (is_admin() AND $row['validated'] != 'true')
     299      {
     300        $tpl_comment['U_VALIDATE'] = add_url_params(
     301          $url_self,
     302          array(
     303            'action' => 'validate_comment',
     304            'comment_to_validate' => $row['id'],
     305            'pwg_token' => get_pwg_token(),
     306            )
     307          );
     308      }
     309     
    248310      $template->append('comments', $tpl_comment);
    249311    }
     
    252314  // comment form
    253315  $show_add_comment_form = true;
    254   if (isset($edit_comment)) {
     316  if (isset($edit_comment))
     317  {
    255318    $show_add_comment_form = false;
    256319  }
    257   if (is_a_guest() and !$conf['comments_forall']) {
     320  if (is_a_guest() and !$conf['comments_forall'])
     321  {
    258322    $show_add_comment_form = false;
    259323  }
    260324
    261   if ($show_add_comment_form) {
     325  if ($show_add_comment_form)
     326  {
    262327    $key = get_ephemeral_key(3, $category['id']);
    263328    $content = null;
    264     if ('reject'===@$comment_action) {
     329    if ('reject'===@$comment_action)
     330    {
    265331      $content = htmlspecialchars(stripslashes($comm['content']));
    266332    }
    267     $template->assign('comment_add', array(
    268       'F_ACTION' => $url_self,
    269       'KEY' => $key,
    270       'CONTENT' => $content,
    271       'SHOW_AUTHOR' => !is_classic_user(),
    272     ));
     333    $template->assign(
     334      'comment_add',
     335      array(
     336        'F_ACTION' => $url_self,
     337        'KEY' => $key,
     338        'CONTENT' => $content,
     339        'SHOW_AUTHOR' => !is_classic_user(),
     340        )
     341      );
    273342  }
    274343 
    275344  // template
    276   $template->assign(array(
    277     'COA_PATH' => COA_PATH, // for css
    278     'COA_ABSOLUTE_PATH' => dirname(__FILE__) .'/../', // for template
    279   ));
    280  
    281   $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/coa_albums.tpl');
     345  $template->assign(
     346    array(
     347      'COA_PATH' => COA_PATH, // for css
     348      'COA_ABSOLUTE_PATH' => dirname(__FILE__) .'/../', // for template
     349      )
     350    );
     351 
     352  $template->set_filename('comments_on_albums', dirname(__FILE__) .'/../template/albums.tpl');
    282353  $template->concat('PLUGIN_INDEX_CONTENT_END', $template->parse('comments_on_albums', true));
    283354 
    284   $template->set_filename('comments_on_albums_messages', dirname(__FILE__) .'/../template/coa_messages.tpl');
    285   $template->concat('PLUGIN_INDEX_CONTENT_BEFORE', $template->parse('comments_on_albums_messages', true));
     355  if (isset($infos))
     356  {
     357    $template->set_prefilter('index', 'coa_messages');
     358   
     359    function coa_messages($content, &$smarty)
     360    {
     361      $search = '{if !empty($PLUGIN_INDEX_CONTENT_BEFORE)}{$PLUGIN_INDEX_CONTENT_BEFORE}{/if}';
     362
     363  $replacement = $search.'
     364{if isset($errors)}
     365<div class="errors">
     366  <ul>
     367    {foreach from=$errors item=error}
     368    <li>{$error}</li>
     369    {/foreach}
     370  </ul>
     371</div>
     372{/if}
     373{if isset($infos)}
     374<div class="infos">
     375  <ul>
     376    {foreach from=$infos item=info}
     377    <li>{$info}</li>
     378    {/foreach}
     379  </ul>
     380</div>
     381{/if}';
     382
     383      return str_replace($search, $replacement, $content);
     384    }
     385  }
    286386}
    287387
  • extensions/Comments_on_Albums/include/coa_comments_page.php

    r11251 r11267  
    11<?php
    2 /* inspired by include/comments.php */
     2/* inspired by comments.php */
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
     
    66$conf['comments_on_albums'] = unserialize($conf['comments_on_albums']);
    77
    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'],
    12 ));
     8$template->assign(
     9  array(
     10    'COA_PATH' => COA_PATH,
     11    'ICON_COLOR' => $conf['comments_on_albums']['icon_color'],
     12    'ICON_COLOR_OVER' => $conf['comments_on_albums']['icon_color_over'],
     13    )
     14  );
    1315
    1416
    1517// +-----------------------------------------------------------------------+
    16 //        Main page (comments on photos)
     18// |                             main page                                 |
    1719// +-----------------------------------------------------------------------+
    1820
    19 if (!isset($_GET['display_mode'])) { 
     21if (!isset($_GET['display_mode']))
     22
    2023  // adds a button for switch page
    2124  $template->set_prefilter('comments', 'coa_add_button');
    22   function coa_add_button($content, &$smarty) {
     25 
     26  function coa_add_button($content, &$smarty)
     27  {
    2328    $search = '<ul class="categoryActions">';
    2429
     
    3742{/html_head}
    3843
    39   <ul class="categoryActions">
     44  '.$search.'
    4045    <li><a href="comments.php?display_mode=albums" title="' . l10n('COA_comments_albums') . '" class="pwg-state-default pwg-button">
    4146      <span class="pwg-icon pwg-icon-comments-albums">&nbsp;</span><span class="pwg-button-text">' . l10n('COA_comments_albums') . '</span>
     
    4752 
    4853// +-----------------------------------------------------------------------+
    49 //        Second page (comments on albums)
     54//                        comments on albums page                          |
    5055// +-----------------------------------------------------------------------+
    5156
    52 } else if ($_GET['display_mode'] == 'albums') {
     57}
     58else if ($_GET['display_mode'] == 'albums')
     59{
    5360  // reset some template vars
    5461  $template->clear_assign(array('comments', 'navbar', 'sort_by_options'));
     
    5865    'date' => l10n('comment date'),
    5966    'category_id' => l10n('album')
    60   );
     67    );
    6168  $template->assign('sort_by_options', $sort_by);
    6269
     
    6875
    6976  $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])) {
     77  foreach ($actions as $loop_action)
     78  {
     79    if (isset($_GET[$loop_action]))
     80    {
    7281      $action = $loop_action;
    7382      check_input_parameter($action, $_GET, false, PATTERN_ID);
     
    7786  }
    7887
    79   if (isset($action)) {
     88  if (isset($action))
     89  {
    8090    include_once(COA_PATH.'include/functions_comment.inc.php');
     91   
    8192    check_pwg_token();
     93   
    8294    $comment_author_id = get_comment_author_id_albums($comment_id);
     95   
    8396    $true_action = str_replace('_albums', null, $action); // but we must check true action names
    8497
    85     if (can_manage_comment($true_action, $comment_author_id)) {
     98    if (can_manage_comment($true_action, $comment_author_id))
     99    {
    86100      $perform_redirect = false;
    87101
    88       if ('delete_albums' == $action) {
     102      if ('delete_albums' == $action)
     103      {
    89104        delete_user_comment_albums($comment_id);
    90105        $perform_redirect = true;
    91106      }
    92       if ('validate_albums' == $action) {
     107      if ('validate_albums' == $action)
     108      {
    93109        validate_user_comment_albums($comment_id);
    94110        $perform_redirect = true;
    95111      }
    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 {
     112      if ('edit_albums' == $action)
     113      {
     114        if (!empty($_POST['content']))
     115        {
     116          update_user_comment_albums(
     117            array(
     118              'comment_id' => $_GET['edit_albums'],
     119              'image_id' => $_POST['image_id'],
     120              'content' => $_POST['content']
     121              ),
     122            $_POST['key']
     123            );
     124          //$perform_redirect = true;
     125          $edit_comment = null;
     126        }
     127        else
     128        {
    106129          $edit_comment = $_GET['edit_albums'];
    107130        }
    108131      }
    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'));
     132      if ($perform_redirect)
     133      {
     134        $redirect_url =
     135          PHPWG_ROOT_PATH
     136          .'comments.php'
     137          .get_query_string_diff(array('delete_albums','validate_albums','edit_albums','pwg_token'));
     138       
    111139        redirect($redirect_url);
    112140      }
     
    117145  // |                            navigation bar                             |
    118146  // +-----------------------------------------------------------------------+
    119   if (isset($_GET['start']) and is_numeric($_GET['start'])) {
     147  if (isset($_GET['start']) and is_numeric($_GET['start']))
     148  {
    120149    $start = $_GET['start'];
    121   } else {
     150  }
     151  else
     152  {
    122153    $start = 0;
    123154  }
    124155
    125   $query = 'SELECT COUNT(DISTINCT(com.id))
    126     FROM '.COA_TABLE.' AS com
    127     LEFT JOIN '.USERS_TABLE.' As u
     156  $query = '
     157SELECT
     158    COUNT(DISTINCT(com.id))
     159  FROM '.COA_TABLE.' AS com
     160  LEFT JOIN '.USERS_TABLE.' As u
    128161    ON u.'.$conf['user_fields']['id'].' = com.author_id
    129     WHERE '.implode('
     162  WHERE '.implode('
    130163    AND ', $page['where_clauses']).'
    131   ;';
     164;';
    132165  list($counter) = pwg_db_fetch_row(pwg_query($query));
    133166
    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'], '');
     167  $url =
     168    PHPWG_ROOT_PATH
     169    .'comments.php'
     170    .get_query_string_diff(array('start','delete_albums','validate_albums','edit_albums','pwg_token'));
     171   
     172  $navbar = create_navigation_bar(
     173    $url,
     174    $counter,
     175    $start,
     176    $page['items_number'],
     177    ''
     178    );
    136179  $template->assign('navbar', $navbar);
    137180
     
    143186  $category_ids = array();
    144187
    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
     188  $query = '
     189SELECT
     190    com.id AS comment_id,
     191    com.category_id,
     192    com.author,
     193    com.author_id,
     194    '.$conf['user_fields']['username'].' AS username,
     195    com.date,
     196    com.content,
     197    com.validated
     198  FROM '.COA_TABLE.' AS com
     199  LEFT JOIN '.USERS_TABLE.' As u
    156200    ON u.'.$conf['user_fields']['id'].' = com.author_id
    157     WHERE '.implode('
     201  WHERE '.implode('
    158202    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     }
     203  GROUP BY
     204    comment_id,
     205    com.category_id,
     206    com.author,
     207    com.author_id,
     208    com.date,
     209    com.content,
     210    com.validated
     211  ORDER BY '.$page['sort_by'].' '.$page['sort_order'];
     212  if ('all' != $page['items_number'])
     213  {
    172214    $query.= '
    173   ;';
     215  LIMIT '.$page['items_number'].' OFFSET '.$start;
     216  }
     217  $query.= '
     218;';
    174219  $result = pwg_query($query);
    175220
    176   while ($row = pwg_db_fetch_assoc($result)) {
     221  while ($row = pwg_db_fetch_assoc($result))
     222  {
    177223    array_push($comments, $row);
    178224    array_push($element_ids, $row['category_id']);
    179225  }
    180226
    181   if (count($comments) > 0) {
     227  if (count($comments) > 0)
     228  {
    182229    // 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     ;';
     230    $query = '
     231SELECT
     232    cat.id,
     233    cat.name,
     234    cat.permalink,
     235    cat.uppercats,
     236    com.id as comment_id
     237  FROM '.CATEGORIES_TABLE.' AS cat
     238  LEFT JOIN '.COA_TABLE.' AS com
     239    ON cat.id=com.category_id
     240  '.get_sql_condition_FandF(
     241    array(
     242      'forbidden_categories' => 'cat.id',
     243      'visible_categories' => 'cat.id'
     244      ),
     245    'WHERE'
     246    ).'
     247    AND cat.id IN ('.implode(',', $element_ids).')
     248;';
    198249    $categories = hash_from_query($query, 'comment_id');
    199250
    200     foreach ($comments as $comment) {
     251    foreach ($comments as $comment)
     252    {
    201253      // category
    202254      $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       ));
     255      $url = duplicate_index_url(
     256        array(
     257          'category' => array(
     258            'id' => $categories[$comment['comment_id']]['id'],
     259            'name' => $categories[$comment['comment_id']]['name'],
     260            'permalink' => $categories[$comment['comment_id']]['permalink'],
     261            ),
     262          array('start')
     263          )
     264        );
    210265     
    211266      // comment content
     
    217272        'DATE' => format_date($comment['date'], true),
    218273        'CONTENT' => trigger_event('render_comment_content',$comment['content']),
    219       );
     274        );
    220275
    221276      // rights
    222       if (can_manage_comment('delete', $comment['author_id'])) {
    223         $url = get_root_url().'comments.php'.get_query_string_diff(array('delete','validate','edit', 'pwg_token'));
    224 
    225         $tpl_comment['U_DELETE'] = add_url_params($url, array(
    226           'delete_albums' => $comment['comment_id'],
    227           'pwg_token' => get_pwg_token(),
    228         ));
    229       }
    230       if (can_manage_comment('edit', $comment['author_id'])) {
    231         $url = get_root_url().'comments.php'.get_query_string_diff(array('edit', 'delete','validate', 'pwg_token'));
    232 
    233         $tpl_comment['U_EDIT'] = add_url_params($url, array(
    234           'edit_albums' => $comment['comment_id'],
    235           'pwg_token' => get_pwg_token(),
    236         ));
    237 
    238         if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment)) {
     277      if (can_manage_comment('delete', $comment['author_id']))
     278      {
     279        $url =
     280          get_root_url()
     281          .'comments.php'
     282          .get_query_string_diff(array('delete','validate','edit', 'pwg_token'));
     283
     284        $tpl_comment['U_DELETE'] = add_url_params(
     285          $url,
     286          array(
     287            'delete_albums' => $comment['comment_id'],
     288            'pwg_token' => get_pwg_token(),
     289            )
     290          );
     291      }
     292      if (can_manage_comment('edit', $comment['author_id']))
     293      {
     294        $url =
     295          get_root_url()
     296          .'comments.php'
     297          .get_query_string_diff(array('edit', 'delete','validate', 'pwg_token'));
     298
     299        $tpl_comment['U_EDIT'] = add_url_params(
     300          $url,
     301          array(
     302            'edit_albums' => $comment['comment_id'],
     303            'pwg_token' => get_pwg_token(),
     304            )
     305          );
     306
     307        if (isset($edit_comment) and ($comment['comment_id'] == $edit_comment))
     308        {
    239309          $key = get_ephemeral_key(2, $comment['category_id']);
    240310          $tpl_comment['IN_EDIT'] = true;
     
    244314        }
    245315      }
    246       if (can_manage_comment('validate', $comment['author_id'])) {
    247         if ('true' != $comment['validated']) {
    248           $tpl_comment['U_VALIDATE'] = add_url_params($url, array(
    249             'validate_albums'=> $comment['comment_id'],
    250             'pwg_token' => get_pwg_token(),
    251           ));
     316      if (can_manage_comment('validate', $comment['author_id']))
     317      {
     318        if ('true' != $comment['validated'])
     319        {
     320          $tpl_comment['U_VALIDATE'] = add_url_params(
     321            $url,
     322            array(
     323              'validate_albums'=> $comment['comment_id'],
     324              'pwg_token' => get_pwg_token(),
     325              )
     326            );
    252327        }
    253328      }
     
    258333
    259334  // +-----------------------------------------------------------------------+
    260   // |                        template                                       |
    261   // +-----------------------------------------------------------------------+
    262   $template->set_filenames(array('comments'=> dirname(__FILE__).'/../template/coa_comments_page.tpl'));
    263  
    264   // add a layer for display category name
     335  // |                            template                                   |
     336  // +-----------------------------------------------------------------------+
     337  $template->set_filenames(array('comments'=> dirname(__FILE__).'/../template/comments_page.tpl'));
     338 
     339  // add a line to display category name
    265340  $template->set_prefilter('comments', 'coa_change_comments_list');
     341 
    266342  function coa_change_comments_list($content, &$smarty) {
    267343    $search = '<div class="description"{if isset($comment.IN_EDIT)} style="height:200px"{/if}>';
    268344
    269 $replacement = '<div class="category-title">
     345    $replacement = '<div class="category-title">
    270346  <a href="{$comment.CAT_URL}">{$comment.CAT_NAME}</a>
    271347</div>
    272 <div class="description"{if isset($comment.IN_EDIT)} style="height:220px"{/if}>';
     348'.$search;
    273349
    274350    return str_replace($search, $replacement, $content);
  • extensions/Comments_on_Albums/include/functions_comment.inc.php

    r10984 r11267  
    33
    44//returns string action to perform on a new comment: validate, moderate, reject
    5 if (!function_exists('user_comment_check')) {
     5if (!function_exists('user_comment_check'))
     6{
    67  function user_comment_check($action, $comment)
    78  {
     
    187188 * @param comment_id
    188189 */
    189 function delete_user_comment_albums($comment_id) {
     190function delete_user_comment_albums($comment_id)
     191{
    190192  $user_where_clause = '';
    191193  if (!is_admin())
     
    300302}
    301303
    302 if (!function_exists('email_admin')) {
     304if (!function_exists('email_admin'))
     305{
    303306  function email_admin($action, $comment)
    304307  {
  • extensions/Comments_on_Albums/main.inc.php

    r10984 r11267  
    2525//          Triggers
    2626// +-----------------------------------------------------------------------+
    27 add_event_handler('loc_end_index', 'COA_index');
     27add_event_handler('loc_end_index', 'COA_albums');
    2828add_event_handler('loc_after_page_header', 'COA_comments_page');
    29 add_event_handler('loc_end_admin', 'COA_admin');
     29add_event_handler('loc_begin_admin_page', 'COA_admin_intro');
     30add_event_handler('loc_end_admin', 'COA_admin_comments');
    3031add_event_handler('get_admin_plugin_menu_links', 'COA_admin_menu');
    3132
     
    3536// +-----------------------------------------------------------------------+
    3637
    37 function COA_index() {
     38function COA_albums()
     39{
    3840  global $template, $page, $conf, $pwg_loaded_plugins;
    3941 
    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();
     42  if (
     43    $page['section'] == 'categories' AND isset($page['category']) AND
     44    ( !isset($pwg_loaded_plugins['rv_tscroller']) OR count($page['navigation_bar']) == 0 )
     45    )
     46  {   
     47    if (isset($pwg_loaded_plugins['bbcode_bar']) AND !isset($_GET['comment_to_edit']))
     48    {
     49      set_bbcode_bar();
     50    }
     51    else if (isset($pwg_loaded_plugins['SmiliesSupport']) AND !isset($_GET['comment_to_edit']))
     52    {
     53      set_smiliessupport();
     54    }
    4655   
    4756    include(COA_PATH . 'include/coa_albums.php');
     
    4958}
    5059
    51 function COA_comments_page() {
     60function COA_comments_page()
     61{
    5262  global $template, $page, $conf;
    5363 
    54   if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') {
     64  if (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')
     65  {
    5566    include(COA_PATH . 'include/coa_comments_page.php');
    5667  }
    5768}
    5869
    59 function COA_admin() {
    60   global $template, $page, $conf;
     70function COA_admin_intro()
     71{
     72  global $page;
    6173 
    62   if ($page['page'] == 'comments') { 
    63     include(COA_PATH . 'include/coa_admin_comments.php');
    64   } else if ($page['page'] == 'intro') { 
     74  if ($page['page'] == 'intro')
     75  { 
    6576    include(COA_PATH . 'include/coa_admin_intro.php');
    6677  }
    6778}
    6879
    69 function COA_admin_menu($menu) {
     80function COA_admin_comments()
     81{
     82  global $page;
     83 
     84  if ($page['page'] == 'comments')
     85  { 
     86    include(COA_PATH . 'include/coa_admin_comments.php');
     87  }
     88}
     89
     90function COA_admin_menu($menu)
     91{
    7092  array_push($menu, array(
    7193    'NAME' => 'Comments on Albums',
  • extensions/Comments_on_Albums/maintain.inc.php

    r10984 r11267  
    33
    44// Default configuration
    5 define('default_config', serialize(array(
    6   'icon_color' => 'outline_ff3363.png',
    7   'icon_color_over' => 'outline_ff7700.png',
    8 )));
     5define(
     6  'default_config',
     7  serialize(array(
     8    'icon_color' => 'outline_ff3363.png',
     9    'icon_color_over' => 'outline_ff7700.png',
     10    ))
     11  );
    912
    1013// Installation
    11 function plugin_install() {
     14function plugin_install()
     15{
    1216  global $prefixeTable;
    1317
    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;");
     18  pwg_query("
     19CREATE TABLE `" . $prefixeTable . "comments_categories` (
     20  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
     21  `category_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
     22  `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
     23  `author` varchar(255) DEFAULT NULL,
     24  `author_id` smallint(5) DEFAULT NULL,
     25  `content` longtext,
     26  `validated` enum('true','false') NOT NULL DEFAULT 'false',
     27  `validation_date` datetime DEFAULT NULL,
     28  PRIMARY KEY (`id`)
     29) DEFAULT CHARSET=utf8
     30;");
    2531 
    26   pwg_query("INSERT INTO " . CONFIG_TABLE . "(param,value,comment) VALUES('comments_on_albums', '" . default_config . "', 'Parametres du plugin Comments on Albums');");
     32  pwg_query("
     33INSERT INTO " . CONFIG_TABLE . "(param,value,comment)
     34VALUES(
     35  'comments_on_albums',
     36  '" . default_config . "',
     37  'Comments on Albums plugin'
     38)
     39;");
    2740}
    2841
    2942// Uninstallation
    30 function plugin_uninstall() {
     43function plugin_uninstall()
     44{
    3145  global $prefixeTable;
    3246
  • extensions/Comments_on_Albums/template/config.tpl

    r11249 r11267  
    11{combine_script id='jquery.cluetip' require='jquery' path='themes/default/js/plugins/jquery.cluetip.js'}
    2 {combine_css path=$COA_PATH|@cat:'admin/template/style.css'}
     2{combine_css path=$COA_PATH|@cat:'template/style_admin.css'}
    33
    44{footer_script require='jquery'}
     
    2525{/html_head}
    2626
    27 <h2 class="version_title">Comments on Albums</h2>
    28 
    2927<div class="titrePage">
    30   <h2>{'Configuration'|@translate}</h2>
     28  <h2>Comments on Albums</h2>
    3129</div>
    3230
  • extensions/Comments_on_Albums/template/style_admin.css

    r11249 r11267  
    2424  margin:-5px 0;
    2525}
    26 
    27 .version_title {
    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;
    35 }
Note: See TracChangeset for help on using the changeset viewer.