Ignore:
Timestamp:
Nov 20, 2009, 10:56:32 PM (15 years ago)
Author:
LucMorizur
Message:

[Event Cats] Finish duplication management, configuration management, code cleaning

File:
1 edited

Legend:

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

    r4282 r4329  
    180180 */
    181181function build_ec_addp() {
    182   global $ec_lists, $ec_ap_ok;
    183   if ($ec_ap_ok) {
     182  global $ec_lists;
     183  if (EC_AP_OK) {
    184184    $res = pwg_query("SELECT `id`, `title` FROM `".ADD_PAGES_TABLE."`");
    185185    while ($r = mysql_fetch_assoc($res)) {
     
    244244 */
    245245function build_ec_table() {
    246   global $ec_lists, $ec_ap_ok;
     246  global $ec_lists;
    247247 
    248248  $q = pwg_query("
     
    287287      case 2: // Additional Page
    288288        if (
    289           $ec_ap_ok and (
     289          EC_AP_OK and (
    290290            is_in($ec_entry['action'], 'ec_ok') or
    291291            $ec_entry['action'] == 'ec_nok'
     
    322322function build_ec_lists() {
    323323 
    324   global $ec_ap_ok, $template, $ec_lists, $conf;
    325  
    326324  // Construction of $ec_lists['add_pages'] array var
    327325  build_ec_addp();
     
    373371        FROM ".EVNTCATS_TABLE."
    374372        WHERE `code` IS NULL
    375           AND `arg1` = '1'
     373          AND `arg1` = 1
    376374          AND `arg2` IS NOT NULL
    377375      ;",
     
    385383    array_from_query("
    386384      SELECT `arg2`
    387         FROM ".EVNTCATS_TABLE."
     385        FROM `".EVNTCATS_TABLE."`
    388386        WHERE `code` IS NULL
    389           AND `arg1` = '2'
     387          AND `arg1` = 2
    390388          AND `arg2` IS NOT NULL
    391389      ;",
     
    400398  $users_granted_ids = array();
    401399 
     400  $c = (count($t = mysql_fetch_row(pwg_query("
     401    SELECT `arg2`
     402    FROM `".EVNTCATS_TABLE."`
     403    WHERE `code` IS NULL
     404      AND `arg1` = 3
     405      AND `arg2` IS NOT NULL
     406    LIMIT 1;
     407  "))) == 0) ? 0 : intval($t[0]);
     408 
    402409  $users_granted_thks_gen_ids = array();
    403   if ($ec_gen_granted = (read_ec_conf('duplic_gen') != '0')) {
     410  if ($ec_gen_granted = (($c & 8) != 0)) {
    404411    $users_granted_thks_gen_ids = order_by_name(
    405412      array_diff(
     
    425432  $types_granted_ids = array();
    426433  $users_granted_thks_types_ids = array();
    427   $c = intval(read_ec_conf('duplic_type'));
    428   if ($c != 0) {
     434  if (($c & 7) != 0) {
    429435    if (($c & 1) != 0) $types_granted_ids[] = '1';
    430436    if (($c & 2) != 0) $types_granted_ids[] = '2';
     
    547553  // Returns an array which values are all the user_ids allowed to display a
    548554  // "duplicate" link. The keys of this array are strange (for direct allowed
    549   // users, keys are usernames), but normally not used
     555  // users, keys are usernames), but should not used
    550556  return $users_granted_ids;
    551557}
     
    561567 */
    562568function dup_allowed($user_id) {
    563   return true;
     569  return in_array($user_id, build_dup_arrays());
    564570}
    565571
Note: See TracChangeset for help on using the changeset viewer.