Changeset 4218


Ignore:
Timestamp:
Nov 6, 2009, 2:37:20 AM (14 years ago)
Author:
LucMorizur
Message:

[Event Cats] Modify entry in DB should be OK (not tested).

Location:
extensions/event_cats
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/admin/evntcats_admin.php

    r4171 r4218  
    112112   $page['tab'] = 'autolog_modif';
    113113  elseif ($_POST['ec_act1'] == 'create')
    114    $page['tab'] = (ec_create_entry_OK()) ? 'autolog_entries' : 'autolog_new';
    115   elseif (isset($_POST['ec_entry_sel']) and is_numeric($_POST['ec_entry_sel'])) {
    116     if ($_POST['ec_act1'] == 'duplicate_entry_submit') $page['tab'] =
    117      (ec_duplicate_entry_OK()) ? 'autolog_entries' : 'autolog_new';
    118     elseif ($_POST['ec_act1'] == 'modify_entry_submit') $page['tab'] =
    119      (ec_modify_entry_OK()) ? 'autolog_entries' : 'autolog_modif';
     114   $page['tab'] = (ec_create_modify_entry_OK()) ?
     115    'autolog_entries' : 'autolog_new';
     116  elseif (
     117    isset($_POST['ec_entry_sel']) and
     118    is_numeric($_POST['ec_entry_sel'])
     119  ) {
     120    if (
     121      $_POST['ec_act1'] == 'duplicate_entry_submit' or
     122      $_POST['ec_act1'] == 'modify_entry_submit'
     123    ) $page['tab'] = (ec_create_modify_entry_OK()) ?
     124     'autolog_entries' : 'autolog_modif';
    120125    else {
    121126      $page['tab'] = 'autolog_entries';
    122       if ($_POST['ec_act1'] == 'delete') ec_delete_entry();
     127      if ($_POST['ec_act1'] == 'delete') {
     128        if (isset($_POST['ec_entry_sel'])) {
     129          ec_delete_entry_OK($_POST['ec_entry_sel']);
     130          build_ec_table();
     131        }
     132        else ec_end1('ec_entry_sel', 'ec_bad_argument1');
     133      }
    123134      elseif ($_POST['ec_act1'] == 'toggle_forced') ec_toggle_forced_entry();
    124135    }
  • extensions/event_cats/admin/template/autolog_new.js

    r4181 r4218  
    798798    }
    799799    else {                                          // Outdate entry
     800      ec_selected_user                            = 'ec_sel_user_none';
    800801      de('ec_in_up_entry_list_id').disabled       = 'disabled';
    801802      de('ec_sel_user_none').disabled             = 'disabled';
  • extensions/event_cats/include/evntcats_admin_funcs.inc.php

    r4181 r4218  
    6565 * ec_create_user_OK()
    6666 * Creates new generic user and eventually new group as described in $_POST.
     67 * Assumes that the validity of the different indexes of $_POST it uses, have
     68 * already been checked.
    6769 *
    6870 * @param
     
    7476  global $page;
    7577 
    76   // This function assumes that the validity of the different indexes it uses,
    77   // have been checked before it is used.
     78  // This function assumes that the validity of the different indexes of
     79  // $_POST it uses, have already been checked.
    7880 
    7981  // User creation, as generic
     
    189191
    190192/*
    191  * ec_create_entry_OK()
     193 * ec_create_modify_entry_OK()
    192194 * returns true or false whether the creation of a new entry described by
    193195 * $_POST was OK or not.
     
    198200 *   true if creation was OK ; false if not
    199201 */
    200 function ec_create_entry_OK() {
     202function ec_create_modify_entry_OK() {
    201203  global $page, $ec_lists;
    202204 
    203   // $_POST validity checks : creation prevented in case of bad arguments
    204   if (
    205     !isset($_POST['ec_in_up_code']) or
    206     !ereg('^[a-zA-Z0-9_-]{4,32}$', $_POST['ec_in_up_code'])
    207   ) return ec_end1('ec_in_up_code', 'ec_bad_argument7');
    208  
    209   foreach ($ec_lists['ec_table'] as $ec_entry)
    210    if ($_POST['ec_in_up_code'] == $ec_entry['code'])
    211     return ec_end1('ec_in_up_code', 'ec_bad_argument2');
    212  
    213   if (
    214     !isset($_POST['ec_sel_user']) or (
    215       $_POST['ec_sel_user'] != 'new' and
    216       $_POST['ec_sel_user'] != 'old'
    217     )
    218   ) return ec_end1('ec_sel_user', 'ec_bad_argument1');
    219  
    220   if ($_POST['ec_sel_user'] == 'new') {
    221     if (
    222       !isset($_POST['login']) or
    223       $_POST['login'] == ''
    224     ) return ec_end1('login', 'ec_bad_argument1');
    225     if (in_array($_POST['login'], $ec_lists['user_ids']))
    226      return ec_end1('login', 'ec_bad_argument3');
    227   }
    228   else {
    229     if (!isset($_POST['ec_in_up_usr_list']))
    230      return ec_end1('login', 'ec_bad_argument1');
    231     $ec_user_id = $_POST['ec_in_up_usr_list'];
    232     if (!array_key_exists($ec_user_id, $ec_lists['user_ids']))
    233      return ec_end1('ec_in_up_usr_list', 'ec_bad_argument6');
    234   }
    235  
    236   // code and user_id (if needed) are OK, creation can be done
    237  
    238   // User and eventually group creation, if needed
    239   if ($_POST['ec_sel_user'] == 'new')
    240    if (!($ec_user_id = ec_create_user_OK())) return false;
     205  // $_POST validity checks : action prevented in case of bad arguments
     206 
     207  if (!isset($_POST['ec_act1']))
     208   return ec_end1('ec_act1', 'ec_bad_argument1');
     209 
     210  if (!isset($_POST['ec_input_action']))
     211   return ec_end1('ec_input_action', 'ec_bad_argument1');
     212 
     213  $is_creation = true;
     214  $action = 'ec_ok';
     215  $arg1 = '';
     216  $arg2 = '';
     217  switch ($_POST['ec_act1']) {
     218   
     219    case 'create':
     220     
     221      if (
     222        !isset($_POST['ec_in_up_code']) or
     223        !ereg('^[a-zA-Z0-9_-]{4,32}$', $_POST['ec_in_up_code'])
     224      ) return ec_end1('ec_in_up_code', 'ec_bad_argument7');
     225      else $ec_code = $_POST['ec_in_up_code'];
     226     
     227      foreach ($ec_lists['ec_table'] as $ec_entry)
     228       if ($ec_code == $ec_entry['code'])
     229        return ec_end1('ec_in_up_code', 'ec_bad_argument2');
     230     
     231      if (
     232        !isset($_POST['ec_sel_user']) or (
     233          $_POST['ec_sel_user'] != 'new' and
     234          $_POST['ec_sel_user'] != 'old'
     235        )
     236      ) return ec_end1('ec_sel_user', 'ec_bad_argument1');
     237   
     238    case 'modify_entry_submit':
     239     
     240      $ec_user_id = '';
     241      if (isset($_POST['ec_sel_user'])) {
     242        if ($_POST['ec_sel_user'] == 'new') {
     243          if (
     244            !isset($_POST['login']) or
     245            $_POST['login'] == ''
     246          ) return ec_end1('login', 'ec_bad_argument1');
     247          if (in_array($_POST['login'], $ec_lists['user_ids']))
     248           return ec_end1('login', 'ec_bad_argument3');
     249        }
     250        elseif ($_POST['ec_sel_user'] == 'old') {
     251          if (!isset($_POST['ec_in_up_usr_list']))
     252           return ec_end1('login', 'ec_bad_argument1');
     253          $ec_user_id = $_POST['ec_in_up_usr_list'];
     254          if (!array_key_exists($ec_user_id, $ec_lists['user_ids']))
     255           return ec_end1('ec_in_up_usr_list', 'ec_bad_argument6');
     256        }
     257        else $action = 'ec_nok';
     258      }
     259      else $action = 'ec_nok';
     260     
     261     if ($_POST['ec_act1'] == 'create') break;
     262     
     263      $is_creation = false;
     264     
     265    case 'duplicate_entry_submit':
     266     
     267      if (
     268        !isset($_POST['ec_entry_sel']) or
     269        !array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table'])
     270      ) return ec_end1('ec_entry_sel', 'ec_bad_argument5');
     271     
     272     if ($_POST['ec_act1'] == 'modify_entry_submit') break;
     273     
     274      build_ec_duplicable_codes();
     275      if (!array_key_exists($_POST['ec_entry_sel'],
     276       $ec_lists['duplicable_codes']['ids'])
     277      ) return ec_end1('ec_entry_sel', 'ec_bad_argument5');
     278      $ec_code    = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['code'];
     279      $ec_user_id = $ec_lists['ec_table'][$_POST['ec_entry_sel']]['user_id'];
     280     
     281    break;
     282    default: ec_end1('ec_act1', 'ec_bad_argument1');
     283  }
    241284 
    242285  // Preparation of $arg1, $arg2 and $forced
    243   $arg1 = ''; $arg2 = '';
    244   if (isset($_POST['ec_input_action'])) switch ($_POST['ec_input_action']) {
     286  switch ($_POST['ec_input_action']) {
    245287    // case 'home':  // Home : nothing to do : "arg"s are ''
     288    // case 'refused': $_POST['ec_sel_user'] unset, nothing to do
    246289    case 'add_p': // Additional Page
    247290      if (isset($_POST['ec_in_up_aps'])) $arg2 = $_POST['ec_in_up_aps'];
     
    261304    default: ec_end1('ec_input_action', 'ec_bad_argument1');
    262305  }
    263   else ec_end1('ec_input_action', 'ec_bad_argument1');
    264   $forced = (isset($_POST['ec_in_up_forced'])) ? 'true' : 'false';
    265  
    266   // Now we have the code, the user_id, arg1, arg2, and forced arguments
    267   if (
    268     pwg_query("
    269       INSERT INTO `".EVNTCATS_TABLE."` (
    270         `code`,
    271         `user_id`,
    272         `action`,
    273         `arg1`, `arg2`, `forced`
    274       )
    275       VALUES (
    276         '".$_POST['ec_in_up_code']."',
    277         '".$ec_user_id."',
    278         'ec_ok',
    279         '".$arg1."', '".$arg2."', '".$forced."'
    280       );
    281     ") === false
    282   ) {
    283     $page['errors'][] =
    284      l10n('ec_entry_create_pb').
    285      'MySQL error '.mysql_errno().', "'.mysql_error().'"'
    286     ;
    287     return false;
    288   }
    289   else {
    290     build_ec_lists();
    291     $forced = ($forced == 'false') ? '' : l10n('ec_cnfrm_forced');
    292     $page['infos'][] =
    293      l10n('ec_entry_create_OK').mysql_insert_id().' : '.
    294      $_POST['ec_in_up_code'].' => '.
    295      $ec_lists['user_ids'][$ec_user_id].$forced
    296     ;
    297     return true;
    298   }
    299 }
    300 
    301 /*
    302  * ec_duplicate_entry_OK()
    303  * returns true or false whether the duplication of an existing entry which #
    304  * is given by $_POST['ec_entry_sel'] was OK or not.
    305  *
    306  * @param
    307  *   no param
    308  * @return
    309  *   true if creation was OK ; false if not
    310  */
    311 function ec_duplicate_entry_OK() {
    312   global $page, $ec_lists;
    313  
    314   build_ec_duplicable_codes();
    315   if (array_key_exists($_POST['ec_entry_sel'],
    316    $ec_lists['duplicable_codes']['ids'])) {
    317     $arg1 = ''; $arg2 = '';
    318     switch ($_POST['ec_input_action']) {
    319       // case 'home':  // Home : nothing to do : "arg"s are ''
    320       case 'add_p':
    321         if (array_key_exists($_POST['ec_in_up_aps'],$ec_lists['add_pages'])) {
    322          $arg2 = $_POST['ec_in_up_aps']; }
    323         else return ec_end1('ec_in_up_aps', 'ec_bad_argument4');
    324       case 'img':
    325       case 'cat':
    326         if (array_key_exists($_POST['ec_in_up_cat'],
    327          $ec_lists['categories'])) {
    328           if ($_POST['ec_input_action'] == 'img') {
    329             if (
    330              ec_image_exists($_POST['ec_in_up_cat'], $_POST['ec_in_up_img'])
    331             ) $arg2 = $_POST['ec_in_up_img'];
    332             else return ec_end1('ec_in_up_img', 'ec_bad_argument4');
    333           }
    334           $arg1 = $_POST['ec_in_up_cat'];
    335         }
    336         else return ec_end1('ec_in_up_cat', 'ec_bad_argument4');
    337       break;
    338       default: return ec_end1('ec_input_action', 'ec_bad_argument1');
    339     }
     306 
     307  if (isset($_POST['ec_in_up_forced'])) {
     308    if ($_POST['ec_act1'] == 'duplicate_entry_submit')
     309     ec_end1('ec_in_up_forced', 'ec_bad_argument1');
     310    if (!$is_creation) {
     311      if (
     312        $t1 = mysql_fetch_row(pwg_query("
     313          SELECT `code`
     314          FROM `".EVNTCATS_TABLE."`
     315          WHERE `id` = '".$_POST['ec_entry_sel']."'
     316        ")) === false
     317      ) die('Code not found in DB ?!');
     318      $r = pwg_query("
     319        SELECT `id`
     320        FROM `".EVNTCATS_TABLE."`
     321        WHERE `code` = '".$t1[0]."'
     322         AND `id` <> '".$_POST['ec_entry_sel']."'
     323      ");
     324      while ($t2 = mysql_fetch_row($r)) if (!ec_delete_entry_OK($t2[0]))
     325       return false;
     326    }
     327    $forced = 'true';
     328  }
     329  else $forced = 'false';
     330 
     331  // User and eventually group creation, if needed
     332  if ($_POST['ec_act1'] != 'duplicate_entry_submit')
     333   if ($_POST['ec_sel_user'] == 'new')
     334    if (!($ec_user_id = ec_create_user_OK())) return false;
     335 
     336  // Now we have all infos
     337  if ($is_creation) {
    340338    if (
    341339      pwg_query("
    342         INSERT INTO `".EVNTCATS_TABLE."`
    343          (`code`, `user_id`, `action`, `arg1`, `arg2`)
     340        INSERT INTO `".EVNTCATS_TABLE."` (
     341          `code`,
     342          `user_id`,
     343          `action`,
     344          `arg1`, `arg2`, `forced`
     345        )
    344346        VALUES (
    345           '".$ec_lists['ec_table'][$_POST['ec_entry_sel']]['code']."',
    346           '".$ec_lists['ec_table'][$_POST['ec_entry_sel']]['user_id']."',
    347           'ec_ok',
    348           '".$arg1."',
    349           '".$arg2."'
     347          '".$ec_code."',
     348          '".$ec_user_id."',
     349          '".$action."',
     350          '".$arg1."', '".$arg2."', '".$forced."'
    350351        );
    351352      ") === false
    352353    ) {
    353354      $page['errors'][] =
    354        l10n('ec_entry_dup_nok_pre1').
    355        $_POST['ec_entry_sel'].
    356        l10n('ec_entry_dup_nok_end1').
     355       l10n('ec_entry_create_pb').
    357356       'MySQL error '.mysql_errno().', "'.mysql_error().'"'
    358357      ;
     
    360359    }
    361360    else {
     361      build_ec_lists();
     362      $forced = ($forced == 'false') ? '' : l10n('ec_cnfrm_forced');
    362363      $page['infos'][] =
    363        l10n('ec_entry_dup_ok_pre').
    364        $_POST['ec_entry_sel'].' ('.
    365        $ec_lists['ec_table'][$_POST['ec_entry_sel']]['code'].')'.
    366        l10n('ec_entry_dup_ok_end')
     364       l10n('ec_entry_create_OK').mysql_insert_id().' : '.
     365       $_POST['ec_in_up_code'].' => '.
     366       $ec_lists['user_ids'][$ec_user_id].$forced
    367367      ;
    368       build_ec_table();
    369       return true;
    370     }
    371   }
    372   else return ec_end1('ec_entry_sel', 'ec_bad_argument5');
    373 }
    374 
    375 /*
    376  * ec_modify_entry_OK()
    377  * returns true or false whether the modification of an existing entry which #
    378  * is given by $_POST['ec_entry_sel'] was OK or not.
    379  *
    380  * @param
    381  *   no param
    382  * @return
    383  *   true if modification was OK ; false if not
    384  */
    385 function ec_modify_entry_OK() {
    386   global $page;
    387   $page['errors'][] = 'Y\'a pas eu une erreur ?...';
    388   return false;
     368    }
     369  }
     370  else {
     371    if (
     372      pwg_query("
     373        UPDATE `".EVNTCATS_TABLE."`
     374        SET
     375          `user_id` = '".$ec_user_id."',
     376          `action`  = '".$action."',
     377          `arg1`    = '".$arg1."',
     378          `arg2`    = '".$arg2."',
     379          `forced`  = '".$forced."'
     380        WHERE `id`  = '".$_POST['ec_entry_sel']."'
     381      ") === false
     382    ) {
     383      $page['errors'][] =
     384       l10n('ec_entry_create_pb').
     385       'MySQL error '.mysql_errno().', "'.mysql_error().'"'
     386      ;
     387      return false;
     388    }
     389    else {
     390      $page['infos'][] = l10n('ec_entry_modify_OK').$_POST['ec_entry_sel'];
     391      build_ec_lists();
     392    }
     393  }
     394  return true;
    389395}
    390396
     
    405411
    406412/*
    407  * ec_delete_entry()
    408  * tries to delete an existing entry which # is given by
    409  * $_POST['ec_entry_sel'].
    410  *
    411  * @param
    412  *   no param
    413  * @return
    414  *   no return value : modifies $page['errors'] or $page['infos']
    415  */
    416 function ec_delete_entry() {
    417   global $page, $ec_lists;
    418   if (array_key_exists($_POST['ec_entry_sel'], $ec_lists['ec_table'])) {
    419     if (!pwg_query('
    420       DELETE FROM `'.EVNTCATS_TABLE.'`
    421       WHERE `id` = '.$_POST['ec_entry_sel']
    422     )) {
    423       $page['errors'][] =
    424         l10n('ec_entry_del_nok_pre').
    425         $_POST['ec_entry_sel'].
    426         l10n('ec_entry_del_nok_end').
    427         'MySQL error '.mysql_errno().', "'.mysql_error().'"'
    428       ;
    429     }
    430     else {
    431       $page['infos'][] =
    432         l10n('ec_entry_del_ok_pre').
    433         $_POST['ec_entry_sel'].
    434         l10n('ec_entry_del_ok_end');
    435       build_ec_table();
    436     }
    437   }
    438   else ec_end1('ec_entry_sel', 'ec_bad_argument1');
     413 * ec_delete_entry_OK($ec_id)
     414 * tries to delete an existing entry.
     415 *
     416 * @param
     417 *   $ec_id : the entry to be deleted
     418 * @return
     419 *   true or false whether deleting succeeded.
     420 */
     421function ec_delete_entry_OK($ec_id) {
     422  global $page;
     423  if (!pwg_query("
     424    DELETE FROM `".EVNTCATS_TABLE."`
     425    WHERE `id` = ".$ec_id
     426  )) {
     427    $page['errors'][] =
     428     l10n('ec_entry_del_nok_pre').
     429     $ec_id.
     430     l10n('ec_entry_del_nok_end').
     431     'MySQL error '.mysql_errno().', "'.mysql_error().'"';
     432    return false;
     433  }
     434  else $page['infos'][] =
     435   l10n('ec_entry_del_ok_pre').
     436   $ec_id.
     437   l10n('ec_entry_del_ok_end');
     438  return true;
    439439}
    440440
  • extensions/event_cats/include/evntcats_main_funcs.inc.php

    r4179 r4218  
    6565 */
    6666function ec_image_exists($cat, $img) {
    67   return (mysql_fetch_row(pwg_query('
    68    SELECT *
    69    FROM `'.IMAGE_CATEGORY_TABLE.'`
    70    WHERE `category_id` = '.$cat.'
    71     AND `image_id` = '.$img
    72   )) !== false);
     67  return (mysql_fetch_row(pwg_query("
     68    SELECT *
     69    FROM `".IMAGE_CATEGORY_TABLE."`
     70    WHERE `category_id` = ".$cat."
     71     AND `image_id` = ".$img."`
     72  ")) !== false);
    7373}
    7474
     
    8686 */
    8787function str_from_var($var) {
    88   return '<p align="left">'.str_replace(chr(10),'<br>',str_replace(' ','&nbsp;', print_r /* var_dump */ ($var,true))).'</p>';
     88  return
     89   '<p align="left">'.
     90   str_replace(
     91    chr(10),'<br>',
     92    str_replace(' ','&nbsp;', print_r /* var_dump */ ($var,true))
     93   ).
     94   '</p>';
    8995}
    9096
     
    120126  */
    121127 
    122   foreach ($ec_lists['ec_table'] as &$ec_entry) { // & is not really needed
     128  foreach ($ec_lists['ec_table'] as $ec_entry) {
    123129    $ec_current_code = $ec_entry['code'];
    124130    if (
     
    133139         $first[$ec_current_code] != $ec_entry[$checked_item] or
    134140         ($new_action == '' and $ec_entry[$checked_item] == 'true')
    135         ) {
    136           $to_correct[$ec_current_code] = true; // value not used in fact
    137         } // but using $ec_current_code as a key makes a smaller table
     141        ) $to_correct[$ec_current_code] = true; // value not used in fact
     142        // but using $ec_current_code as a key makes a smaller table
    138143      } // if the error comes back several times
    139       else {
    140         $first[$ec_current_code] = $ec_entry[$checked_item];
    141       }
     144      else $first[$ec_current_code] = $ec_entry[$checked_item];
    142145    }
    143146  }
     
    145148    if (isset($to_correct[$ec_entry['code']])) {
    146149      if ($new_action == '') {
    147         if (!pwg_query('
    148           UPDATE `'.EVNTCATS_TABLE.'`
    149           SET `forced` = "false"
    150           WHERE `id` = '.$ec_entry['id']
     150        if (!pwg_query("
     151          UPDATE `".EVNTCATS_TABLE."`
     152          SET `forced` = 'false'
     153          WHERE `id` = ".$ec_entry['id']
    151154        )) die('Could not fix a "_f_pb"');
    152155        $ec_entry['forced'] = 'false';
     
    174177  global $template, $ec_lists;
    175178  $c = array();
    176   display_select_cat_wrapper('
    177      SELECT id,name,uppercats,global_rank
    178      FROM '.CATEGORIES_TABLE,
    179    $c, 'category_options', $dsp);
     179  display_select_cat_wrapper("
     180     SELECT `id`, `name`, `uppercats`, `global_rank`
     181     FROM `".CATEGORIES_TABLE."`
     182   ", $c, 'category_options', $dsp);
    180183  $ec_lists['categories'] = $template->smarty->_tpl_vars['category_options'];
    181184}
     
    197200  $ec_lists['ec_table'] = array();
    198201 
    199   if (isset($conf['auto_log'])) {
    200     // For tests purpose : table not in MySQL, but in $conf['xxx'] vars in
    201     // config_local.inc.php
    202    
    203     foreach ($conf['auto_log'] as $ec_current_code => $ec_entry) {
    204       $ec_current_entry = array_push($ec_lists['ec_table'], array(
    205        'code'    => $ec_current_code,
    206        'user_id' => get_userid($ec_entry[$ec_current_code]),
    207        'action'  => 'ec_ok',
    208        'arg1'    => NULL,
    209        'arg2'    => NULL,
    210        'forced'  => 'false',
    211       )) - 1;
    212       $ec_lists['ec_table'][$ec_current_entry]['id'] = $ec_current_entry;
    213       if (isset($conf['prior_page']))
    214        if (array_key_exists($ec_current_code, $conf['prior_page'])) {
    215          $ec_lists['ec_table'][$ec_current_entry]['arg2'] =
    216           $conf['prior_page'][$ec_current_code];
    217          $ec_lists['ec_table'][$ec_current_entry]['forced'] = 'true';
    218        }
    219       if (isset($conf['outdated_page']))
    220        if (array_key_exists($ec_current_code, $conf['outdated_page'])) {
    221          $ec_lists['ec_table'][$ec_current_entry]['action'] = 'ec_nok';
    222          $ec_lists['ec_table'][$ec_current_entry]['arg2'] =
    223           $conf['outdated_page'][$ec_current_code];
    224          $ec_lists['ec_table'][$ec_current_entry]['forced'] = 'true';
    225        }
    226     }
    227    
    228     // Inspection of $conf['outdated_page']
    229     if (isset($conf['outdated_page']))
    230      foreach ($conf['outdated_page'] as $ec_current_code => $ec_current_AP)
    231       if (!array_key_exists($ec_current_code, $conf['auto_log'])) {
    232         $ec_current_entry = array_push($ec_lists['ec_table'], array(
    233          'code'    => $ec_current_code,
    234          'user_id' => '',
    235          'action'  => 'ec_nok',
    236          'arg1'    => NULL,
    237          'arg2'    => $ec_current_AP,
    238          'forced'  => 'true',
    239         )) - 1;
    240         $ec_lists['ec_table'][$ec_current_entry]['id'] = $ec_current_entry;
    241       }
    242    
    243   }
    244   else { // in "normal" use ($conf['auto_log'] NOT set), $ec_lists['ec_table']
    245          // is built thanks to below code only. A little bit more simple...
    246     $q = pwg_query("
    247      SELECT * FROM `".EVNTCATS_TABLE."`
    248      WHERE `code` IS NOT NULL
    249      ORDER BY `id`
    250     ");
    251     while ($r = mysql_fetch_assoc($q))
    252      $ec_lists['ec_table'][intval($r['id'])] = $r;
    253   }
     202  $q = pwg_query("
     203    SELECT * FROM `".EVNTCATS_TABLE."`
     204    WHERE `code` IS NOT NULL
     205    ORDER BY `id`
     206  ");
     207  while ($r = mysql_fetch_assoc($q))
     208   $ec_lists['ec_table'][intval($r['id'])] = $r;
    254209 
    255210  // Construction of behaviour
     
    275230    // Check if associated displayed page exists
    276231    $a = 0;
    277     if (!empty($ec_entry['arg1']) and
    278      is_in($ec_entry['action'], 'ec_ok')) $a++; // Only arg2
    279     // is significant if action is ec_nok[_xxx] .
     232    if (
     233      !empty($ec_entry['arg1']) and
     234      // (Only arg2 is significant if action is ec_nok[_xxx] .)
     235      is_in($ec_entry['action'], 'ec_ok')
     236    ) $a++;
    280237    if (!empty($ec_entry['arg2'])) $a+= 2;
    281238    switch ($a) {
     
    296253        if (is_in($ec_entry['action'], 'ec_ok')) {
    297254          if (array_key_exists($ec_entry['arg1'], $ec_lists['categories'])) {
    298             if ($a == 3) { // case 3: // Image
    299               if (!ec_image_exists($ec_entry['arg1'], $ec_entry['arg2'])) {
    300                 $ec_entry['action'].= '_img_pb';
    301               }
    302             }
     255           if ($a == 3) // case 3: // Image
     256            if (!ec_image_exists($ec_entry['arg1'], $ec_entry['arg2']))
     257             $ec_entry['action'].= '_img_pb';
    303258          }
    304259          else $ec_entry['action'].= '_cat_pb';
     
    328283  $ec_lists['add_pages'] = array();
    329284  if ($ec_ap_ok) {
    330     $res = pwg_query('SELECT id,title FROM '.ADD_PAGES_TABLE);
     285    $res = pwg_query("SELECT `id`, `title` FROM `".ADD_PAGES_TABLE."`");
    331286    while ($r = mysql_fetch_assoc($res)) {
    332287      $c = (is_in($r['title'], '/user_id=')) ? '/user_id=' : '/group_id=';
     
    341296  // Construction of $ec_lists['user_ids'] array var
    342297  $ec_lists['user_ids'] = array();
    343   $q = pwg_query('SELECT id,username FROM '.USERS_TABLE. ' WHERE id > 2');
    344   while ($r = mysql_fetch_assoc($q)) {
    345     $ec_lists['user_ids'][$r['id']] = $r['username'];
    346   }
     298  $q = pwg_query("
     299    SELECT `id`,`username`
     300    FROM `".USERS_TABLE."`
     301    WHERE `id` > 2
     302  ");
     303  while ($r = mysql_fetch_assoc($q))
     304   $ec_lists['user_ids'][$r['id']] = $r['username'];
    347305 
    348306  // Construction of $ec_lists['ec_table'] array var
  • extensions/event_cats/language/fr_FR/plugin.lang.php

    r4181 r4218  
    123123$lang['ec_entry_create_pb']       = 'Création nouvelle entrée impossible : ';
    124124$lang['ec_cnfrm_forced']          = ' (affichage forcé)';
     125$lang['ec_entry_modify_OK']       = 'Modification entrée ';
    125126$lang['ec_bad_argument1']         = 'Mauvais argument : ';
    126127$lang['ec_bad_argument2']         = 'Code déjà existant : ';
Note: See TracChangeset for help on using the changeset viewer.