Changeset 1789 for trunk/admin/include


Ignore:
Timestamp:
Feb 8, 2007, 2:31:05 AM (17 years ago)
Author:
rvelices
Message:
  • correct php warnings (section_init and mass_inserts)
  • flat category view url is now 'flat' instead of 'flat_cat' (it is nicer and shorter)
  • small html validation (double class attribute)
  • removed unnecessary class=""
  • changed 2 times hard coded index.php?recent_pics with make_index_url(...)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r1786 r1789  
    528528    // inserts all found categories
    529529    $query_begin = '
    530   INSERT INTO '.$table_name.'
    531     ('.implode(',', $dbfields).')
    532      VALUES';
     530INSERT INTO '.$table_name.'
     531  ('.implode(',', $dbfields).')
     532  VALUES';
    533533
    534534    $first = true;
    535     $query_value = array();
    536     $query_value_index = 0;
     535    $query_value = '';
    537536
    538537    foreach ($datas as $insert)
    539538    {
    540       $query_value[$query_value_index] .= '
    541     ';
    542539      if ($first)
    543540      {
    544541        $first = false;
    545         if (strlen($query_value[$query_value_index]) > 6)
    546         {
    547           $query_value[$query_value_index] .= ',';
    548         }
    549542      }
    550543      else
    551544      {
    552         if (strlen($query_value[$query_value_index]) >= $conf['max_allowed_packet'])
     545        if (strlen($query_value) >= $conf['max_allowed_packet'])
    553546        {
    554           $query_value_index ++;
    555           $query_value[$query_value_index] .= '
    556     ';
    557           $first = true;
     547          pwg_query( $query_begin.$query_value );
     548          $query_value = '';
    558549        }
    559550        else
    560551        {
    561           $query_value[$query_value_index] .= ',';
     552          $query_value .= ',';
    562553        }
    563554      }
    564       $query_value[$query_value_index] .= '(';
     555
     556      $query_value .= '
     557    (';
     558
    565559      foreach ($dbfields as $field_id => $dbfield)
    566560      {
    567561        if ($field_id > 0)
    568562        {
    569           $query_value[$query_value_index] .= ',';
     563          $query_value .= ',';
    570564        }
    571565
    572566        if (!isset($insert[$dbfield]) or $insert[$dbfield] === '')
    573567        {
    574           $query_value[$query_value_index] .= 'NULL';
     568          $query_value .= 'NULL';
    575569        }
    576570        else
    577571        {
    578           $query_value[$query_value_index] .= "'".$insert[$dbfield]."'";
     572          $query_value .= "'".$insert[$dbfield]."'";
    579573        }
    580574      }
    581       $query_value[$query_value_index] .= ')';
    582     }
    583    
    584     $query_end .= '
    585 ;';
    586     foreach ($query_value as $value)
    587     {
    588       $final_query = $query_begin.$value.$query_end;
    589       pwg_query($final_query);
    590     }
     575      $query_value .= ')';
     576    }
     577    pwg_query($query_begin.$query_value);
    591578  }
    592579}
Note: See TracChangeset for help on using the changeset viewer.