Changeset 1789


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(...)
Location:
trunk
Files:
7 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}
  • trunk/include/functions_html.inc.php

    r1769 r1789  
    287287    elseif ($url == '')
    288288    {
    289       $output.= '<a class=""';
    290       $output.= ' href="'
     289      $output.= '<a href="'
    291290            .make_index_url(
    292291                array(
     
    300299    else
    301300    {
    302       $output.= '<a class=""';
    303       $output.= ' href="'.PHPWG_ROOT_PATH.$url.$id.'">';
     301      $output.= '<a href="'.PHPWG_ROOT_PATH.$url.$id.'">';
    304302      $output.= $name.'</a>';
    305303    }
     
    369367    {
    370368      $output.= '
    371 <a class=""
    372    href="'
     369<a href="'
    373370      .make_index_url(
    374371          array(
     
    382379    {
    383380      $output.= '
    384 <a class=""
    385    href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$name.'</a>';
     381<a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$name.'</a>';
    386382    }
    387383  }
  • trunk/include/functions_notification.inc.php

    • Property svn:eol-style set to native
    • Property svn:keywords set to Author Date Id Revision
    r1784 r1789  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
    9 // | last update   : $Date: 2005-11-26 21:15:50 +0100 (sam., 26 nov. 2005) $
    10 // | last modifier : $Author: plg $
    11 // | revision      : $Revision: 958 $
     8// | file          : $Id$
     9// | last update   : $Date$
     10// | last modifier : $Author$
     11// | revision      : $Revision$
    1212// +-----------------------------------------------------------------------+
    1313// | This program is free software; you can redistribute it and/or modify  |
     
    409409    add_news_line( $news,
    410410      nb_new_elements($start, $end), '%d new element', '%d new elements',
    411       get_root_url().'index.php?/recent_pics', $add_url );
     411      make_index_url(array('section'=>'recent_pics')), $add_url );
    412412  }
    413413
     
    416416    add_news_line( $news,
    417417      nb_updated_categories($start, $end), '%d category updated', '%d categories updated',
    418       get_root_url().'/index.php?/recent_cats', $add_url );
     418      make_index_url(array('section'=>'recent_cats')), $add_url );
    419419  }
    420420
  • trunk/include/functions_url.inc.php

    r1788 r1789  
    22// +-----------------------------------------------------------------------+
    33// | PhpWebGallery - a PHP based picture gallery                           |
    4 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
     4// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    55// +-----------------------------------------------------------------------+
    66// | branch        : BSF (Best So Far)
    7 // | file          : $RCSfile$
     7// | file          : $Id$
    88// | last update   : $Date$
    99// | last modifier : $Author$
     
    272272  if (isset($params['flat_cat']))
    273273  {
    274     $url.= '/flat_cat';
     274    $url.= '/flat';
    275275  }
    276276
  • trunk/include/section_init.inc.php

    r1788 r1789  
    129129}
    130130
    131 if (0 === strpos($tokens[$next_token], 'categor'))
     131if (0 === strpos(@$tokens[$next_token], 'categor'))
    132132{
    133133  $page['section'] = 'categories';
     
    141141  }
    142142}
    143 else if (0 === strpos($tokens[$next_token], 'tag'))
     143else if (0 === strpos(@$tokens[$next_token], 'tag'))
    144144{
    145145  $page['section'] = 'tags';
     
    202202  }
    203203}
    204 else if (0 === strpos($tokens[$next_token], 'fav'))
     204else if (0 === strpos(@$tokens[$next_token], 'fav'))
    205205{
    206206  $page['section'] = 'favorites';
    207207  $next_token++;
    208208}
    209 else if ('most_visited' == $tokens[$next_token])
     209else if ('most_visited' == @$tokens[$next_token])
    210210{
    211211  $page['section'] = 'most_visited';
    212212  $next_token++;
    213213}
    214 else if ('best_rated' == $tokens[$next_token])
     214else if ('best_rated' == @$tokens[$next_token])
    215215{
    216216  $page['section'] = 'best_rated';
    217217  $next_token++;
    218218}
    219 else if ('recent_pics' == $tokens[$next_token])
     219else if ('recent_pics' == @$tokens[$next_token])
    220220{
    221221  $page['section'] = 'recent_pics';
    222222  $next_token++;
    223223}
    224 else if ('recent_cats' == $tokens[$next_token])
     224else if ('recent_cats' == @$tokens[$next_token])
    225225{
    226226  $page['section'] = 'recent_cats';
    227227  $next_token++;
    228228}
    229 else if ('search' == $tokens[$next_token])
     229else if ('search' == @$tokens[$next_token])
    230230{
    231231  $page['section'] = 'search';
     
    240240  $next_token++;
    241241}
    242 else if ('list' == $tokens[$next_token])
     242else if ('list' == @$tokens[$next_token])
    243243{
    244244  $page['section'] = 'list';
     
    269269else
    270270{
    271   if (!empty($conf['random_index_redirect']))
     271  $page['section'] = 'categories';
     272  if (script_basename() == 'picture')
     273  {//access a picture only by id, file or id-file without given section
     274    $page['flat_cat'] = true;
     275  }
     276  elseif (!empty($conf['random_index_redirect']) and empty($tokens[$next_token]) )
    272277  {
    273278    $random_index_redirect = array();
     
    279284      }
    280285    }
    281   }
    282 
    283   if (!empty($random_index_redirect))
    284   {
    285     redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
    286   }
    287   else
    288   {
    289     $page['section'] = 'categories';
     286    if (!empty($random_index_redirect))
     287    {
     288      redirect($random_index_redirect[mt_rand(0, count($random_index_redirect)-1)]);
     289    }
    290290  }
    291291}
     
    301301
    302302  if ('categories' == $page['section'] and
    303       'flat_cat' == $tokens[$i])
     303      'flat' == $tokens[$i])
    304304  {
    305305    // indicate a special list of images
  • trunk/template/yoga/mainpage_categories.tpl

    r1771 r1789  
    77      <div class="illustration">
    88        <a href="{categories.category.URL}">
    9           <img src="{categories.category.SRC}"
    10                alt="{categories.category.ALT}"
    11              title="{categories.category.TITLE}">
     9          <img src="{categories.category.SRC}" alt="{categories.category.ALT}" title="{categories.category.TITLE}">
    1210        </a>
    1311      </div>
     
    1816        </h3>
    1917        <p>{categories.category.CAPTION_NB_IMAGES}</p>
    20         <p>{categories.category.DESCRIPTION}&nbsp;</p> <!-- &nbsp; to avoid a HTML warning -->
     18        <p>{categories.category.DESCRIPTION}&nbsp;</p>
    2119      </div>
    2220    </div>
  • trunk/template/yoga/picture.tpl

    r1787 r1789  
    205205      <label>{lang:comment}<textarea name="content" rows="5" cols="80">{comments.add_comment.CONTENT}</textarea></label>
    206206      <input type="hidden" name="key" value="{comments.add_comment.KEY}" />
    207       <input class="submit" type="submit" class="submit" value="{lang:submit}">
     207      <input class="submit" type="submit" value="{lang:submit}">
    208208    </fieldset>
    209209  </form>
Note: See TracChangeset for help on using the changeset viewer.