View Single Post
Old 03-26-2017, 08:39 AM  
sarettah
l8r
 
Industry Role:
Join Date: Oct 2002
Posts: 13,501
I have checked all sorts of stuff and even re-written the sort to hanlde everything as xml object rather than an array but no luck. The test stuff you sent me still comes out wrong.

Here is a fix, it is not elegant at all. It addresses the issue you have explicitly and hopefully will work until we figure out wtf is happening:

Replace the hd_iterate_xml function with this:

Code:
  private function hd_iterate_xml($inrec, $outrec='')
  {
    foreach($inrec as $key=>$value)
    {
      $key=str_replace("\n","",$key);
      if(count($value)>0)
      {
        $workrec='';
        $workrec .=$this->hd_iterate_xml($value, $workrec);
        $outrec .="<" . $key . ">" . $workrec . "</" . $key . ">\n";;
      }
      else
      {
        // workaround for k33n issue
        if(trim($key)=='chatRoomUrl')
        {
          $value=htmlspecialchars($value);
        }
        $outrec .="<" . $key . ">" .  trim($value) . "</" . $key . ">\n";
        $cntr=0;
        foreach($this->sortfields as $field)
        {
          if($field['type']=='s')
          {
            $val2use='';
          }
          else
          {
            $val2use='0';
          }
          //echo "field name=" . $field['name'] . " key=" . $key . "<br>\n";
          if($key==$field['name'])
          {        
            if($field['type']=='s')
            {
              $val2use=trim($value);
            }
            else
            {
              $val2use=trim(strval($value));
            }            
            $this->sortvals[$cntr]=$val2use;
          }
          $cntr++;
        }
      }
    }
    return $outrec;
  }
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote