Ignore:
Timestamp:
Oct 7, 2009, 9:31:04 AM (15 years ago)
Author:
LucMorizur
Message:

[Event Cats] Form submit beginning, "forced problem" improvement

File:
1 edited

Legend:

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

    r3971 r3985  
    183183    foreach ($ec_lists['ec_table'] as &$ec_entry) { // & is needed here
    184184      if (isset($to_correct[$ec_entry['code']])) {
    185         $ec_entry['action'] = $new_action;
     185        $ec_entry['action'] = ($check_forced) ?
     186         $ec_entry['action'].$new_action : $new_action;
    186187      }
    187188    }
     
    195196 
    196197  // Multiple "forced" params for a single code check
    197   ec_inpect('forced', 'ec_ok_forced_pb', true, true);
     198  ec_inpect('forced', '_f_pb', true, true);
    198199 
    199200  // User id and associated page validities checks
     
    202203    // Check if associated user_id exists
    203204    if (
    204      $ec_entry['action'] == 'ec_ok' and
     205     is_in($ec_entry['action'], 'ec_ok') and
    205206     !array_key_exists($ec_entry['user_id'], $ec_lists['user_ids'])
    206207    ) {
     
    211212    $a = 0;
    212213    if (!empty($ec_entry['arg1']) and
    213      (strpos($ec_entry['action'], 'ec_ok') !== false)) $a++; // Only arg2
     214     is_in($ec_entry['action'], 'ec_ok')) $a++; // Only arg2
    214215    // is significant if action is ec_nok[_xxx] .
    215216    if (!empty($ec_entry['arg2'])) $a+= 2;
     
    220221        if (
    221222          $ec_ap_ok and (
    222             $ec_entry['action'] == 'ec_ok' or
     223            is_in($ec_entry['action'], 'ec_ok') or
    223224            $ec_entry['action'] == 'ec_nok'
    224225          ) and
     
    231232      case 1: // Category
    232233      case 3: // Image
    233         if ($ec_entry['action'] == 'ec_ok') {
     234        if (is_in($ec_entry['action'], 'ec_ok')) {
    234235          if (array_key_exists($ec_entry['arg1'], $ec_lists['categories'])) {
    235236            if ($a == 3) { // case 3: // Image
     
    274275    $res = pwg_query('SELECT id,title FROM '.ADD_PAGES_TABLE);
    275276    while ($r = mysql_fetch_assoc($res)) {
    276       $c = (strpos($r['title'], '/user_id=')) ? '/user_id=' : '/group_id=';
     277      $c = (is_in($r['title'], '/user_id=')) ? '/user_id=' : '/group_id=';
    277278      $a = explode($c ,$r['title']);
    278279      $ec_lists['add_pages'][$r['id']] = $a[0];
     
    297298  // Construction of $ec_lists['ec_table'] array var
    298299  build_ec_table();
     300}
     301
     302/*
     303 * is_in($haystack, $needle)
     304 * returns true or false whether $needle is a string found in string $haystack
     305 *
     306 * @param
     307 *   $haystack : the string in which to search
     308 *   $needle   : the string looked for
     309 * @return
     310 *   true if $needle is found in $haystack ; false if not
     311 */
     312function is_in($haystack, $needle) {
     313  return (strpos($haystack, $needle) !== false);
    299314}
    300315
Note: See TracChangeset for help on using the changeset viewer.