Ignore:
Timestamp:
Nov 26, 2009, 11:08:34 PM (14 years ago)
Author:
LucMorizur
Message:

[Event Cats] Replace table by fieldsets in autolog_new.tpl ; begin help

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/main.inc.php

    r4342 r4371  
    8484function ec_popup_help_content($popup_help_content, $page) {
    8585  return (
    86    $help_content = (is_admin() and in_array($page, array(
    87     'ec_help_new', 'ec_help_mod', 'ec_help_ent', 'ec_help_cfg', 'ec_help_dup'
    88    ))) ?
     86   $help_content = (is_admin() and $page = '') ?
    8987    load_language($page.'.html', EVNTCATS_PATH, array('return' => true)) : false
    9088  ) ? $popup_help_content.$help_content : $popup_help_content;
     
    178176    else {
    179177      if (
    180        read_ec_conf('unknown_code') == 2 and
     178       read_ec_conf('unknown_code') == '2' and
    181179        array_key_exists(
    182180         read_ec_conf('unknown_code_ap_id'), $ec_lists['add_pages']
     
    188186        );
    189187      }
    190       elseif (read_ec_conf('unknown_code') == 1 or
    191        read_ec_conf('unknown_code') == 2) {
     188      elseif (read_ec_conf('unknown_code') == '1' or
     189       read_ec_conf('unknown_code') == '2') {
    192190        access_denied();
    193191      }
     
    211209add_event_handler('register_user', 'assign_perm_for_new_user');
    212210
    213 function assign_perm_for_new_user($new_user)
    214 {
     211function assign_perm_for_new_user($new_user) {
    215212  global $user;
    216213
    217   if (!is_a_guest() and !is_admin())
    218   {
     214  if (!is_a_guest() and !is_admin()) if (
     215    read_ec_conf('dup_allow') == '1' or (
     216      read_ec_conf('dup_allow') == '2' and
     217      dup_allowed($user['id'])
     218    )
     219  ) {
    219220    // User access
    220     $query = 'SELECT cat_id FROM '.USER_ACCESS_TABLE.' WHERE user_id = '.$user['id'].';';
    221     $result = pwg_query($query);
     221    $result = pwg_query("
     222      SELECT `cat_id`
     223      FROM `".USER_ACCESS_TABLE."`
     224      WHERE `user_id` = ".$user['id'].";
     225    ");
    222226    $insert = array();
    223227    while ($row = mysql_fetch_assoc($result))
    224     {
    225       $insert[] = '('.$new_user['id'].','.$row['cat_id'].')';
    226     }
    227     if (!empty($insert))
    228     {
    229       pwg_query('INSERT INTO '.USER_ACCESS_TABLE.' VALUES '.implode(',', $insert).';');
    230     }
     228     $insert[] = "(".$new_user['id'].",".$row['cat_id'].")";
     229    if (!empty($insert)) pwg_query("
     230      INSERT INTO `".USER_ACCESS_TABLE."`
     231      VALUES ".implode(',', $insert).";
     232    ");
    231233
    232234    // User groups
    233     $query = 'SELECT group_id FROM '.USER_GROUP_TABLE.' WHERE user_id = '.$user['id'].';';
    234     $result = pwg_query($query);
     235    $result = pwg_query("
     236      SELECT `group_id`
     237      FROM `".USER_GROUP_TABLE."`
     238      WHERE `user_id` = ".$user['id'].";
     239    ");
    235240    $insert = array();
    236241    while ($row = mysql_fetch_assoc($result))
    237     {
    238       $insert[] = '('.$new_user['id'].','.$row['group_id'].')';
    239     }
    240     if (!empty($insert))
    241     {
    242       pwg_query('INSERT INTO '.USER_GROUP_TABLE.' VALUES '.implode(',', $insert).';');
    243     }
     242     $insert[] = "(".$new_user['id'].",".$row['group_id'].")";
     243    if (!empty($insert)) pwg_query("
     244      INSERT INTO `".USER_GROUP_TABLE."`
     245      VALUES ".implode(',', $insert).";
     246    ");
    244247
    245248    // User infos
    246     $query = 'SELECT level FROM '.USER_INFOS_TABLE.' WHERE user_id = '.$user['id'].';';
    247     $result = pwg_query($query);
     249    $result = pwg_query("
     250      SELECT `level`
     251      FROM `".USER_INFOS_TABLE."`
     252      WHERE `user_id` = ".$user['id'].";
     253    ");
    248254    $insert = array();
    249255    while ($row = mysql_fetch_assoc($result))
    250     {
    251       $insert[] = '('.$new_user['id'].','.$row['level'].')';
    252     }
    253     if (!empty($insert))
    254     {
    255       $query = 'UPDATE '.USER_INFOS_TABLE.' SET level = '.$user['level'].' WHERE user_id = '.$new_user['id'].';';
    256       pwg_query($query);
    257     }
     256     $insert[] = "(".$new_user['id'].",".$row['level'].")";
     257    if (!empty($insert)) pwg_query("
     258      UPDATE `".USER_INFOS_TABLE."`
     259      SET `level` = ".$user['level']."
     260      WHERE `user_id` = ".$new_user['id'].";
     261    ");
    258262  }
    259263}
Note: See TracChangeset for help on using the changeset viewer.