Ignore:
Timestamp:
Nov 2, 2009, 10:46:10 PM (15 years ago)
Author:
LucMorizur
Message:

[Event Cats] Continue entry creation in DB

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/include/ec_conf.inc.php

    r4171 r4173  
    3333 _ the number of digits when creating a new code automatically
    3434   ($ec_conf[2] <=> read_ec_conf('auto_code_dg_nb')) ;
    35  _ whether categories are displayed "cat / under_cat / ..." or
    36    "cat <CR LF> - under_cat <CR LF> - ..." ($ec_conf[3] <=>
    37    read_ec_conf('cat_display')) ;
     35 _ -----------------------------------------------------------
     36   --------------------------------------- ( $ec_conf[3] <=>
     37   read_ec_conf('') ) ;
    3838 _ whether the "how to" banner has already been displayed or not
    3939   ($ec_conf[4] <=> read_ec_conf('howto')) ;
     
    4747*****************************************************************************/
    4848
    49 global $ec_conf;
     49global $ec_conf, $page;
    5050
    5151// $ec_conf initalization / check
     
    5454 FROM `".CONFIG_TABLE."`
    5555 WHERE `param` = 'event_cats';
    56 "))) {
    57   $ec_conf = explode(',' , $t[0]);
    58 }
     56"))) $ec_conf = explode(',' , $t[0]);
    5957else {
    6058  $ec_conf = explode(',' , '0,1,10,0,0,0,0');
    61   change_ec_conf('activated', 0);
     59  if (!change_ec_conf('activated', 0))
     60   $page['errors'][] = 'Error updating $ec_conf';
    6261}
    6362
     
    7473 */
    7574function change_ec_conf($c, $v) {
    76   global $ec_conf;
     75  global $ec_conf, $page;
    7776  switch ($c) {
    7877    case 'activated':
     
    8483    case 'auto_code_dg_nb':
    8584      $ec_conf[2] = $v;
    86     break;
     85    break;                  /*
    8786    case 'cat_display':
    8887      $ec_conf[3] = $v;
    89     break;
     88    break;                  */
    9089    case 'howto':
    9190      $ec_conf[4] = $v;
     
    9796      $ec_conf[6] = $v;
    9897    break;
    99     default: return false;
     98    default:
     99      $page['errors'][] = 'Bad change_ec_conf argument';
     100    return false;
    100101  }
    101   return pwg_query("
     102  return (pwg_query("
    102103   UPDATE `".CONFIG_TABLE."`
    103104   SET `value` = '".implode(',', $ec_conf)."'
    104105   WHERE `param` = 'event_cats';
    105   ");
     106  ") !== false);
    106107}
    107108
     
    116117 */
    117118function read_ec_conf($c) {
    118   global $ec_conf;
     119  global $ec_conf, $page;
    119120  switch ($c) {
    120121    case 'activated'         : return $ec_conf[0];
    121122    case 'dup_allow'         : return $ec_conf[1];
    122     case 'auto_code_dg_nb'   : return $ec_conf[2];
    123     case 'cat_display'       : return $ec_conf[3];
     123    case 'auto_code_dg_nb'   : return $ec_conf[2]; /*
     124    case 'cat_display'       : return $ec_conf[3]; */
    124125    case 'howto'             : return $ec_conf[4];
    125126    case 'unknown_code'      : return $ec_conf[5];
    126127    case 'unknown_code_ap_id': return $ec_conf[6];
    127     default                  : return false;
     128    default:
     129      $page['errors'][] = 'Bad read_ec_conf argument';
     130    return false;
    128131  }
    129132}
Note: See TracChangeset for help on using the changeset viewer.