Changeset 3971 for extensions/event_cats


Ignore:
Timestamp:
Oct 2, 2009, 11:26:21 PM (15 years ago)
Author:
LucMorizur
Message:

[Event Cats] Bug-free files... hopefully...

Location:
extensions/event_cats
Files:
5 edited

Legend:

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

    r3970 r3971  
    292292    case 'ec_nok' :
    293293      if (empty($ec_entry['arg2'])) {
    294         $dspl = l10n('ec_dspl_ok_acc_denied');
     294        $dspl = l10n('ec_dspl_nok_acc_denied');
    295295      }
    296296      else {
    297         $url_end = '&ap='.$arg2;
    298297        $dspl = ($ec_ap_ok) ?
    299298         l10n('ec_dspl_ok_ap_pre').
     
    303302         l10n('ec_dspl_ok_ap_end')
    304303        :
    305          l10n('ec_dspl_ok_acc_denied')
     304         l10n('ec_dspl_nok_acc_denied')
    306305        ;
    307306      }
     
    310309    case 'ec_nok_ap_pb' : // No need to check here if Additional Pages is
    311310    case 'ec_ok_ap_pb' :  // active : we can arrive here only when it is.
    312       $url_end = '&ap='.$arg2;
    313311      $page['errors'][] = l10n('ec_add_page_miss');
    314       $dspl = ($ec_entry['action'] == 'ec_ok_ap_pb') ?
    315        l10n('ec_dspl_ok_home') : l10n('ec_dspl_nok_acc_denied');
     312      if ($ec_entry['action'] == 'ec_ok_ap_pb') {
     313        $url_end = '&ap='.$arg2;
     314        $dspl = l10n('ec_dspl_ok_home');
     315      }
     316      else {
     317        $dspl = l10n('ec_dspl_nok_acc_denied');
     318      }
    316319      $dspl.=
    317320       $span_err_pre.
  • extensions/event_cats/include/ec_conf.inc.php

    r3969 r3971  
    104104  switch ($c) {
    105105    case 'activated':
    106       return $d[0];
     106      return $ec_conf[0];
    107107    break;
    108108    case 'dup_allow':
    109       return $d[1];
     109      return $ec_conf[1];
    110110    break;
    111111    case 'unknown_code':
    112       return $d[2];
     112      return $ec_conf[2];
    113113    break;
    114114    case 'unknown_code_ap_id':
    115       return $d[3];
     115      return $ec_conf[3];
    116116    break;
    117117    default: return false;
  • extensions/event_cats/include/evntcats_funcs.inc.php

    r3969 r3971  
    290290  // Construction of $ec_lists['user_ids'] array var
    291291  $ec_lists['user_ids'] = array();
    292   $q = pwg_query('SELECT id,username FROM '.USERS_TABLE. ' WHERE id > 3');
     292  $q = pwg_query('SELECT id,username FROM '.USERS_TABLE. ' WHERE id > 2');
    293293  while ($r = mysql_fetch_assoc($q)) {
    294294    $ec_lists['user_ids'][$r['id']] = $r['username'];
  • extensions/event_cats/main.inc.php

    r3970 r3971  
    3939
    4040global
    41   $conf, $prefixeTable, $ec_conf,
     41  $conf, $prefixeTable,
    4242  $ec_ap_ok;   // whether Additional Pages is installed and activated
    4343
     
    5151if (!isset($ec_lists)) {
    5252  $ec_lists = array();
    53 }
    54 
    55 // $ec_conf initalization / check
    56 if ($t = mysql_fetch_row(pwg_query("
    57  SELECT `value`
    58  FROM `".CONFIG_TABLE."`
    59  WHERE `param` = 'event_cats';
    60 "))) {
    61   $ec_conf = explode(',' , $t[0]);
    62 }
    63 else {
    64   $ec_conf = array();
    6553}
    6654
     
    9381  ) ? $popup_help_content.$help_content : $popup_help_content;
    9482}
    95                                                                                      // Mettre en place l'autoid, qu'on voie si ça marche !
    9683
    9784//----------------------------------
     
    11097
    11198function auto_log_user() {
    112   global $ec_conf, $ec_lists;
     99  global $ec_lists;
    113100
    114101  $ec_ap  = NULL;
     
    116103  $ec_img = NULL;
    117104
    118   if (isset($_GET['autolog']) and ($ec_conf['activated'] == 1)) {
    119     if (!is_a_guest()) logout_user();
     105  if (isset($_GET['autolog']) and (read_ec_conf('activated') == 1)) {
     106    // if (!is_a_guest()) logout_user();
    120107    build_ec_lists();
    121108    foreach ($ec_lists['ec_table'] as $ec_entry) {
     
    123110    }
    124111    if ($code_exists) {
    125       if (isset($_GET['ap'])) $ec_ap = $_GET['ap'];
    126112      if (strpos($ec_entry['action'], 'ec_ok') !== false) {
    127113        log_user($ec_entry['user_id'], false);
     114        if (isset($_GET['ap'])) $ec_ap = $_GET['ap'];
    128115        if (isset($_GET['cat'])) $ec_cat = $_GET['cat'];
    129116        if (isset($_GET['img'])) $ec_img = $_GET['img'];
     
    161148          }
    162149        }
     150        redirect(make_index_url());
     151      }
     152      else {
     153        if (
     154         $ec_entry['action'] == 'ec_nok' or
     155         $ec_entry['action'] == 'ec_nok_ap_pb'
     156        ) {
     157          if ($ec_entry['action'] == 'ec_nok_ap_pb') access_denied();
     158          $ec_ap = $ec_entry['arg2'];
     159          if (array_key_exists($ec_ap, $ec_lists['add_pages'])) {
     160            redirect(
     161             PHPWG_ROOT_PATH.'index.php?/additional_page/'.$ec_ap);
     162          }
     163          access_denied();
     164        }
    163165        else {
    164166          redirect(make_index_url());
    165167        }
    166168      }
    167       else {
    168         if ($ec_entry['action'] == 'ec_nok') {
    169           if (isset($ec_ap)) {
    170             if (array_key_exists($ec_ap,$ec_lists['add_pages'])) {
    171               redirect(
    172                PHPWG_ROOT_PATH.'index.php?/additional_page/'.$ec_ap);
    173             }
    174           }
    175           access_denied();
    176         }
    177         else {
    178           redirect(make_index_url());
    179         }
    180       }
    181169    }
    182170    else {
    183171      if (
    184        $ec_conf['unknown_code'] == 2 and
     172       read_ec_conf('unknown_code') == 2 and
    185173        array_key_exists(
    186          $ec_conf['unknown_code_ap_id'], $ec_lists['add_pages']
     174         read_ec_conf('unknown_code_ap_id'), $ec_lists['add_pages']
    187175        )
    188176       ) {
    189177        redirect(
    190178         PHPWG_ROOT_PATH.
    191          'index.php?/additional_page/'.$ec_conf['unknown_code_ap_id']
     179         'index.php?/additional_page/'.read_ec_conf('unknown_code_ap_id')
    192180        );
    193181      }
    194       elseif ($ec_conf['unknown_code'] == 1 or
    195        $ec_conf['unknown_code'] == 2) {
     182      elseif (read_ec_conf('unknown_code') == 1 or
     183       read_ec_conf('unknown_code') == 2) {
    196184        access_denied();
    197185      }
     
    216204
    217205function assign_perm_for_new_user($new_user)
    218 { /*
     206{
    219207  global $user;
    220208
     
    260248      pwg_query($query);
    261249    }
    262   }  */
     250  }
    263251}
    264252
     
    274262add_event_handler('blockmanager_apply', 'duplicate_account_url');
    275263
    276 function duplicate_account_url()
    277 { /*
    278   global $conf, $lang, $template;
    279 
    280   if ($conf['allow_user_registration'] and !is_admin() and !is_a_guest())
    281     and !is_admin() and !is_a_guest())
    282   {
     264function duplicate_account_url() {
     265  global $lang, $template;
     266
     267  if (!is_admin() and !is_a_guest()) {
    283268    $template->assign( 'U_REGISTER', get_root_url().'register.php');
    284269    $lang['Create a new account'] = l10n('Duplicate account');
    285270    $lang['Register'] = l10n('Duplicate');
    286   } */
    287 }
    288 
    289 // copying/pasting the following lines from same file in plugin LLGBO2,
    290 // because it looks like it's useful :-/ .....   
    291                /*
    292 add_event_handler('render_element_content',
    293   array(&$obj,'MyPictureOptions'),  EVENT_HANDLER_PRIORITY_NEUTRAL-1,  2  );   */
     271  }
     272}
     273
    294274add_event_handler('get_admin_plugin_menu_links', array(&$obj, 'plugin_admin_menu') );
    295275set_plugin_data($plugin['id'], $obj);
  • extensions/event_cats/maintain.inc.php

    r3970 r3971  
    3838function plugin_uninstall() {
    3939
    40   global $prefixeTable, $conf, $ec_conf;
     40  global $prefixeTable, $ec_conf;
    4141
    4242  unset($ec_conf);
Note: See TracChangeset for help on using the changeset viewer.