Plugin Directory

Changeset 1223910


Ignore:
Timestamp:
08/18/2015 05:34:33 PM (11 years ago)
Author:
john ackers
Message:

fix spurious E_NOTICE messages and replace deprecated split()

Location:
ecampaign/branches/maintenance
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • ecampaign/branches/maintenance/Ecampaign.class.php

    r478589 r1223910  
    173173      $efield->name = $noun ;
    174174
    175       $knownField = $this->cannedFields[$noun];
     175      $knownField = @$this->cannedFields[$noun];
    176176
    177177      if (!isset($knownField))
     
    181181      }
    182182      // attributes in template or form are allowed to overwrite canned attributes
    183       $attributeMap = EcampaignField::parseAttributes($knownField[1]." ".$parsedFields[3][$i]);
     183      $attributeMap = EcampaignField::parseAttributes(@$knownField[1]." ".$parsedFields[3][$i]);
    184184
    185185      $efield->label = isset($attributeMap['label']) ? $attributeMap['label'] : $knownField[0];
    186186      $attributeMap['label'] = null ;  // remove label attribute from HTML
    187187
    188       $efield->save = $attributeMap['save'];  $attributeMap['save'] = null;
    189       $efield->type = $attributeMap['type'];
     188      $efield->save =@ $attributeMap['save'];  $attributeMap['save'] = null;
     189      $efield->type = @$attributeMap['type'];
    190190      $efield->attributes = EcampaignField::serializeAttributes($attributeMap);
    191191      $efield->mandatory = $parsedFields[2][$i] == "*";
    192192      $efield->value = $value = trim($parsedFields[4][$i]);
    193       $efield->validator = $knownField[2];
     193      $efield->validator = @$knownField[2];
    194194
    195195      if (!empty($value))
     
    201201      if (empty($efield->value))
    202202      {
    203         $efield->value = $pageAttributes->$noun ;
     203        $efield->value = @$pageAttributes->$noun ;
    204204      }
    205205
     
    226226    $nonce = wp_create_nonce('ecampaign');
    227227    $postID = get_the_ID();
     228    $referer = @$_SERVER["HTTP_REFERER"];
    228229    $hiddenFields =
    229230     "<input type='hidden' name='_ajax_nonce'  value='{$nonce}' />
    230       <input type='hidden' name='referer'  value='{$_SERVER["HTTP_REFERER"]}'/>
     231      <input type='hidden' name='referer'  value='{$referer}'/>
    231232      <input type='hidden' name='postID'  value='{$postID}'/>";
    232233
     
    392393      $formList = unserialize($formListSerialized);
    393394    }
    394     $oldFormSerialized = $formList[$formID];
     395    $oldFormSerialized = @$formList[$formID];
    395396    if (!empty($oldFormSerialized))
    396397    {
     
    592593      case self::sCampaignEmail :
    593594        $efield->isCustom =false ;
    594         $html = $efield->definition ? "" : self::breakupEmail($efield->value);
     595        $html = @$efield->definition ? "" : self::breakupEmail($efield->value);
    595596        break ;
    596597
  • ecampaign/branches/maintenance/EcampaignField.class.php

    r477036 r1223910  
    182182//    if (preg_match("/[\\000-\\037<>]/", $target))  // probably inadequate
    183183//      throw new Exception(__("unexpected character in"). " $fieldName: ". $target);
    184     return ($field);
     184    return (@$field);
    185185  }
    186186
  • ecampaign/branches/maintenance/EcampaignLog.class.php

    r478617 r1223910  
    8989    $wpdb->insert(self::$tableName, array(
    9090            'state' => $state,
    91             'visitorName' =>  self::ensureSet($field->visitorName),
    92             'visitorEmail' => self::ensureSet($field->visitorEmail),
     91            'visitorName' =>  self::ensureSet(@$field->visitorName),
     92            'visitorEmail' => self::ensureSet(@$field->visitorEmail),
    9393            'address' => isset($field->postalAddress) ? $field->postalAddress->toString() : "",
    94             'checkbox1' => $field->checkbox1 ? 1 : 0, //very nasty
    95             'checkbox2' => $field->checkbox2 ? 1 : 0,
    96             'target' =>  self::ensureSet($field->target),
     94            'checkbox1' => @$field->checkbox1 ? 1 : 0, //very nasty
     95            'checkbox2' => @$field->checkbox2 ? 1 : 0,
     96            'target' =>  self::ensureSet(@$field->target),
    9797            'info' =>  isset($infoString) ? $infoString : $field->subject,
    98             'postID' => (int) self::ensureSet($field->postID)  ));
     98            'postID' => (int) self::ensureSet(@$field->postID)  ));
    9999  }
    100100
     
    280280  {
    281281    $query = EcampaignTableView::createQuery(array("visitorEmail"=>$visitor,"offset"=>null));
    282     $uri = $_SERVER['SCRIPT_URL'] . "?$query" ;
     282    $uri = @$_SERVER['SCRIPT_URL'] . "?$query" ;
    283283    return "<a title='show all records that match $visitor' href='$uri'>$visitor</a>";
    284284  }
  • ecampaign/branches/maintenance/EcampaignTableView.class.php

    r477215 r1223910  
    1919    $viewControl->wrap("span", "class='ecinline'");
    2020
    21     $this->where = $this->visibleColumnSet['_where'];  unset($this->visibleColumnSet['_where']);
    22     $this->from = $this->visibleColumnSet['_from'];  unset($this->visibleColumnSet['_from']);
    23     $this->note = $this->visibleColumnSet['_note'];  unset($this->visibleColumnSet['_note']);
     21    $this->where = @$this->visibleColumnSet['_where'];  unset($this->visibleColumnSet['_where']);
     22    $this->from = @$this->visibleColumnSet['_from'];  unset($this->visibleColumnSet['_from']);
     23    $this->note = @$this->visibleColumnSet['_note'];  unset($this->visibleColumnSet['_note']);
    2424
    2525    $visibleColumnNames = new EcampaignString(array_keys($this->visibleColumnSet));
     
    3131    }
    3232
    33     $this->header = $header ;
     33    $this->header = @$header ;
    3434
    3535    $filterControls = new EcampaignString();
     
    4040      {
    4141        case 'select' :
    42           $this->addSelectFilterControl($filterControls, $columnSet, $field, $fieldPresentations[$field]);
     42          $this->addSelectFilterControl($filterControls, $columnSet, $field, @$fieldPresentations[$field]);
    4343          break ;
    4444
     
    132132  function addHiddenFilter($columnName)
    133133  {
    134     $filterValue = urldecode($_GET[$columnName]);
     134    $filterValue = urldecode(@$_GET[$columnName]);
    135135    $this->where .= empty($filterValue) ?  "" : " and $columnName = '$filterValue' " ;
    136136  }
     
    159159    $s->wrap("select", "name='$columnName'");
    160160    $s->addTo($sb);
    161 
    162     $this->where .= $selected == $all ? "" : " and $columnName = '$selected' " ;
     161    $this->where .= empty($selected) ? "" : " and $columnName = '$selected' " ;
    163162  }
    164163
    165164  function addSearchBox($sb)
    166165  {
    167     $search =  urldecode($_GET['search']);
     166    $search =  urldecode(@$_GET['search']);
    168167    $sb->add("<label class=ecsearch for=s1>Search</label><input id=s1 class=ecsearch name=search type='text' value='$search' />");    // render search box
    169168    if (empty($search)) return ;
     169    $where = '' ;
    170170    foreach ($this->visibleColumnSet as $column => $name)
    171171    {
    172       $colWords = split("as", $column);
    173       $where .= " or $colWords[0] LIKE '%".mysql_real_escape_string($search)."%' ";
     172      $colWords = explode("as", $column);
     173      $where .= " or $colWords[0] LIKE '%".esc_sql($search)."%' ";
    174174    }
    175175    $this->where .= " and (false $where)" ;
     
    241241  function addDeleteControl($sb, $totalRows)
    242242  {
    243     $tables = split(" ", $this->from);  // cannot delete rows selected in a multi table join
     243    $tables = explode(" ", $this->from);  // cannot delete rows selected in a multi table join
    244244    if (count($tables) > 1) return ;
    245245
    246246    $q = $this->createQuery(array());
    247247
    248     if ($_POST['delete'] == 'yes')
     248    if (@$_POST['delete'] == 'yes')
    249249    {
    250250      global $wpdb ;
     
    350350  function getTotalRows()
    351351  {
    352     $totalRows = $_GET['totalRows'] ;
     352    $totalRows = @$_GET['totalRows'] ;
    353353    if (!is_numeric($totalRows))
    354354    {
  • ecampaign/branches/maintenance/ecampaign.php

    r473668 r1223910  
    9393    {
    9494      $log = new EcampaignLog();
    95       $log->write("exception", $ecampaign->field, $e->getMessage());
     95      $log->write("exception", @$ecampaign->field, $e->getMessage());
    9696      $response = array("success" => false, "_ajax_nonce" => wp_create_nonce('ecampaign'),
    9797      "msg" => "Error: " . $e->getMessage() . ". " . __("This error has been logged! Sorry.")) ;
     
    110110    throw new Exception (__("Cannot open:$classFile"));
    111111  include_once $classFile ;
    112   $classPath = split('/',$classPath); // loose the directory
     112  $classPath = explode('/',$classPath); // loose the directory
    113113  $class = $classPath[count($classPath)-1] ;
    114114  return new $class ;
  • ecampaign/branches/maintenance/readme.txt

    r478626 r1223910  
    7979or testing, directly in the top of wp-includes/class-phpmailer.php.
    8080
     81= Upgrading from 0.83 =
     82Very minor upgrade. 
     83
    8184= Upgrading from 0.82 =
    8285Minor upgrade.
     
    141144
    142145== Changelog ==
     146= 0.84 =
     147* Suppress some E_NOTICE messages
     148* Change UK/MP lookup mechanism.
    143149
    144150= 0.83 =
  • ecampaign/branches/maintenance/uk/MP.class.php

    r1223820 r1223910  
    8585    $target['email'] = $this->testMode->isDiverted() ? $this->fieldSet->campaignEmail : $memberEmail;
    8686
    87     $this->log->write("lookup", $this->fieldSet, "$memberName\r\n$constituencyName\r\nsource:".$source);
     87    $this->log->write("lookup", $this->fieldSet, "$memberName\r\n$constituencyName\r\nsource:".$biography['source']);
    8888    $response = array("target" => array($target),
    8989                 "constituency" => $constituencyName,
     
    161161    try {     
    162162      $biography = self::matchChain($regexBio, $page['body'], 'mixs');
     163      $biography['source'] = "[]" ;
    163164    }
    164165    catch (ErrorException $e)
Note: See TracChangeset for help on using the changeset viewer.