Ticket #2560: notransfer.patch

File notransfer.patch, 2.3 kB (added by p_lindheimer, 4 years ago)

convert notransfer to transfer - alternative

  • functions.inc.php

    old new  
    218218    $additional = ""; 
    219219    $output = ""; 
    220220 
     221    $ver12 = version_compare($ast_version, '1.4', 'lt'); 
     222 
    221223    $sql = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1"; 
    222224    $results = $db->getAll($sql, DB_FETCHMODE_ASSOC); 
    223225    if(DB::IsError($results)) { 
    224226      die($results->getMessage()); 
    225227    } 
    226228    foreach ($results as $result) { 
    227       $additional .= $result['keyword']."=".$result['data']."\n"; 
     229      if ($ver12) { 
     230        $additional .= $result['keyword']."=".$result['data']."\n"; 
     231      } else { 
     232        $option = $result['data']; 
     233        switch ($result['keyword']) { 
     234          case 'notransfer': 
     235            if (strtolower($option) == 'yes') { 
     236              $additional .= "transfer=no\n"; 
     237            } else if (strtolower($option) == 'no') { 
     238              $additional .= "transfer=yes\n"; 
     239            } else if (strtolower($option) == 'mediaonly') { 
     240              $additional .= "transfer=mediaonly\n"; 
     241            } else { 
     242              $additional .= $result['keyword']."=$option\n"; 
     243            } 
     244            break; 
     245          default: 
     246            $additional .= $result['keyword']."=$option\n"; 
     247        } 
     248      } 
    228249    } 
    229250 
    230251    $sql = "SELECT data,id from $table_name where keyword='account' and flags <> 1 group by data"; 
     
    245266      } 
    246267      foreach ($results2 as $result2) { 
    247268        $options = explode("&", $result2['data']); 
    248         foreach ($options as $option) { 
    249           $output .= $result2['keyword']."=$option\n"; 
     269        if ($ver12) { 
     270          foreach ($options as $option) { 
     271            $output .= $result2['keyword']."=$option\n"; 
     272          } 
     273        } else { 
     274          foreach ($options as $option) { 
     275            switch ($result2['keyword']) { 
     276              case 'notransfer': 
     277                if (strtolower($option) == 'yes') { 
     278                  $output .= "transfer=no\n"; 
     279                } else if (strtolower($option) == 'no') { 
     280                  $output .= "transfer=yes\n"; 
     281                } else if (strtolower($option) == 'mediaonly') { 
     282                  $output .= "transfer=mediaonly\n"; 
     283                } else { 
     284                  $output .= $result2['keyword']."=$option\n"; 
     285                } 
     286                break; 
     287              default: 
     288                $output .= $result2['keyword']."=$option\n"; 
     289            } 
     290          } 
    250291        } 
    251292      } 
    252293      $output .= $additional."\n";