Changeset 4282


Ignore:
Timestamp:
11/16/09 23:06:18 (10 years ago)
Author:
LucMorizur
Message:

[Event Cats] Duplication management : found last problem :-) !

Location:
extensions/event_cats
Files:
1 added
5 edited

Legend:

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

    r4276 r4282  
    9090// If no entry exist, default page is 'autolog_new'. 
    9191$page['tab'] = (!($ec_exist_entries = (mysql_num_rows(pwg_query(" 
    92   SELECT * FROM `".EVNTCATS_AUTOLOG_TABLE."` 
     92  SELECT * FROM `".EVNTCATS_TABLE."` 
    9393  WHERE `code` IS NOT NULL ; 
    9494")) != 0))) ? 'autolog_new' : 'autolog_entries'; 
    9595 
    9696$ec_exist_duplic = ((mysql_num_rows(pwg_query(" 
    97     SELECT * FROM `".EVNTCATS_DUPLIC_TABLE."` ; 
     97  SELECT * FROM `".EVNTCATS_TABLE."` 
     98  WHERE `code` IS NULL 
     99  AND `arg1` IS NOT NULL 
     100  AND `arg2` IS NOT NULL ; 
    98101  ")) != 0) or 
    99102  (read_ec_conf('duplic_gen') != 0) or 
     
    204207 
    205208$ec_exist_entries = (mysql_num_rows(pwg_query(" 
    206   SELECT * FROM `".EVNTCATS_AUTOLOG_TABLE."` 
     209  SELECT * FROM `".EVNTCATS_TABLE."` 
    207210  WHERE `code` IS NOT NULL 
    208211")) != 0); 
    209212 
    210213$ec_exist_duplic = ((mysql_num_rows(pwg_query(" 
    211     SELECT * FROM `".EVNTCATS_DUPLIC_TABLE."` ; 
     214  SELECT * FROM `".EVNTCATS_TABLE."` 
     215  WHERE `code` IS NULL 
     216  AND `arg1` IS NOT NULL 
     217  AND `arg2` IS NOT NULL ; 
    212218  ")) != 0) or 
    213219  (read_ec_conf('duplic_gen') != 0) or 
  • extensions/event_cats/include/evntcats_admin_funcs.inc.php

    r4276 r4282  
    376376  " 
    377377    SELECT `id` 
    378     FROM `".EVNTCATS_AUTOLOG_TABLE."` 
     378    FROM `".EVNTCATS_TABLE."` 
    379379    WHERE `code`    = '".$ec_code."' 
    380380      AND `user_id`    ".$ec_user_idp." 
     
    393393      $t1 = mysql_fetch_row(pwg_query(" 
    394394        SELECT `code` 
    395         FROM `".EVNTCATS_AUTOLOG_TABLE."` 
     395        FROM `".EVNTCATS_TABLE."` 
    396396        WHERE `id` = ".$_POST['ec_entry_sel'] 
    397397      ))) === false 
     
    399399    $r = pwg_query(" 
    400400      SELECT `id` 
    401       FROM `".EVNTCATS_AUTOLOG_TABLE."` 
     401      FROM `".EVNTCATS_TABLE."` 
    402402      WHERE `code` = '".$t1[0]."' 
    403403       AND `id` <> ".$_POST['ec_entry_sel'] 
     
    425425    if ( 
    426426      pwg_query(" 
    427         INSERT INTO `".EVNTCATS_AUTOLOG_TABLE."` ( 
     427        INSERT INTO `".EVNTCATS_TABLE."` ( 
    428428          `code`, 
    429429          `user_id`, 
     
    459459    if ( 
    460460      pwg_query(" 
    461         UPDATE `".EVNTCATS_AUTOLOG_TABLE."` 
     461        UPDATE `".EVNTCATS_TABLE."` 
    462462        SET 
    463463          `user_id` =  ".$ec_user_id.", 
     
    493493  global $page; 
    494494  if (!pwg_query(" 
    495     DELETE FROM `".EVNTCATS_AUTOLOG_TABLE."` 
     495    DELETE FROM `".EVNTCATS_TABLE."` 
    496496    WHERE `id` = ".$ec_id 
    497497  )) { 
  • extensions/event_cats/include/evntcats_main_funcs.inc.php

    r4276 r4282  
    155155      if ($new_action == '') { 
    156156        if (!pwg_query(" 
    157           UPDATE `".EVNTCATS_AUTOLOG_TABLE."` 
     157          UPDATE `".EVNTCATS_TABLE."` 
    158158          SET `forced` = 'false' 
    159159          WHERE `id` = ".$ec_entry['id'] 
     
    247247   
    248248  $q = pwg_query(" 
    249     SELECT * FROM `".EVNTCATS_AUTOLOG_TABLE."` 
     249    SELECT * FROM `".EVNTCATS_TABLE."` 
    250250    WHERE `code` IS NOT NULL 
    251251    ORDER BY `id` 
     
    370370  $groups_granted_ids = order_by_name( 
    371371    array_from_query(" 
    372       SELECT `val` 
    373         FROM ".EVNTCATS_DUPLIC_TABLE." 
    374         WHERE `item` = 'grp' 
     372      SELECT `arg2` 
     373        FROM ".EVNTCATS_TABLE." 
     374        WHERE `code` IS NULL 
     375          AND `arg1` = '1' 
     376          AND `arg2` IS NOT NULL 
    375377      ;", 
    376       'val' 
     378      'arg2' 
    377379    ), 
    378380    $groups 
     
    382384  $users_granted_direct_ids = order_by_name( 
    383385    array_from_query(" 
    384       SELECT `val` 
    385         FROM ".EVNTCATS_DUPLIC_TABLE." 
    386         WHERE `item` = 'usr' 
     386      SELECT `arg2` 
     387        FROM ".EVNTCATS_TABLE." 
     388        WHERE `code` IS NULL 
     389          AND `arg1` = '2' 
     390          AND `arg2` IS NOT NULL 
    387391      ;", 
    388       'val' 
     392      'arg2' 
    389393    ), 
    390394    $ec_lists['user_ids'] 
  • extensions/event_cats/main.inc.php

    r4276 r4282  
    4343define('EVNTCATS_INFO_VERSION','1.0.0'); 
    4444define('EVNTCATS_PATH',PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)). '/'); 
    45 define('EVNTCATS_AUTOLOG_TABLE', $prefixeTable.'event_cats_autolog'); 
    46 define('EVNTCATS_DUPLIC_TABLE', $prefixeTable.'event_cats_duplic'); 
     45define('EVNTCATS_TABLE', $prefixeTable.'event_cats'); 
    4746define('ROOT_URL',get_absolute_root_url()); 
    4847 
     
    6766$obj = new event_cats(); 
    6867 
     68// Adds the translation of "duplicate" link 
     69add_event_handler('loading_lang', 'ec_load_duplic_lang' ); 
     70 
     71function ec_load_duplic_lang() { 
     72  load_language('duplic.lang', EVNTCATS_PATH); 
     73} 
     74 
    6975// Admin help management 
    7076add_event_handler('get_popup_help_content', 'ec_popup_help_content', 
     
    268274    if (isset($lang['Duplicate account'])) 
    269275     $lang['Create a new account'] = l10n('Duplicate account'); 
    270     if (isset($lang['Register'])) 
     276    if (isset($lang['Duplicate'])) 
    271277     $lang['Register'] = l10n('Duplicate'); 
    272278  } 
  • extensions/event_cats/maintain.inc.php

    r4276 r4282  
    4141 
    4242        pwg_query("DELETE FROM `".CONFIG_TABLE."` WHERE `param` = 'event_cats' LIMIT 1;"); 
    43         pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'event_cats_duplic`;'); 
    44         return pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'event_cats_autolog`;'); 
     43        return pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'event_cats`;'); 
    4544} 
    4645 
     
    5352  // create table for plugin, if it doesn't exist yet 
    5453  $r = (pwg_query(" 
    55     CREATE TABLE `".$prefixeTable."event_cats_autolog` ( 
     54    CREATE TABLE `".$prefixeTable."event_cats` ( 
    5655      `id`      SMALLINT(5)             UNSIGNED NOT NULL     AUTO_INCREMENT , 
    5756      `code`    VARCHAR(32)                               DEFAULT NULL , 
     
    136135   
    137136  if ($r) $r = (pwg_query(" 
    138     CREATE TABLE `".$prefixeTable."event_cats_duplic` ( 
    139       `item`  VARCHAR(5) NOT NULL , 
    140       `val` VARCHAR(32) NOT NULL , 
    141       KEY `item` (`item`), 
    142       KEY `val` (`val`) 
    143     ) 
    144     DEFAULT CHARACTER SET utf8; 
    145   ") !== false); 
    146  
    147 /* 
    148 Explanations on table structure : 
    149  
    150 item  : the code used as "autolog" argument. If thie code provided by the 
    151           visitor does not exist in the table, the administrator can choose 
    152           whether the visitor is redirected to the home page (nothing 
    153           happens) or to the "access denied" page ; 
    154 value : the account concerned in following values ; 
    155  
    156 */ 
    157    
    158   if ($r) $r = (pwg_query(" 
    159137    INSERT INTO `".CONFIG_TABLE."` (`param`,`value`,`comment`) 
    160138    VALUES ('event_cats','0','Paramètres du plugin Event Cats'); 
Note: See TracChangeset for help on using the changeset viewer.