Changeset 6669


Ignore:
Timestamp:
Jul 6, 2010, 10:11:06 PM (14 years ago)
Author:
rvelices
Message:

merge r6668 from trunk

  • removed function get_extra_fields and its usage (unnecessary + perf issue when retrieving many image ids in a section)
  • 2 fixes recent feed.php commit
    • month names were decalated by one
    • strptime function is not implemented under Windows in php
  • added somme missing $ROOT_URL in templates
Location:
branches/2.1
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/include/functions.inc.php

    r6384 r6669  
    3333
    3434//----------------------------------------------------------- generic functions
    35 function get_extra_fields($order_by_fields)
    36 {
    37   $fields = str_ireplace(array(' order by ', ' desc', ' asc'),
    38                          array('', '', ''),
    39                          $order_by_fields
    40                          );
    41   if (!empty($fields))
    42   {
    43     $fields = ','.$fields;
    44   }
    45   return $fields;
    46 }
    4735
    4836// The function get_moment returns a float value coresponding to the number
     
    584572  global $user, $template, $lang_info, $conf, $lang, $t2, $page, $debug;
    585573
    586   if (!isset($lang_info))
     574  if (!isset($lang_info) || !isset($template) )
    587575  {
    588576    $user = build_user( $conf['guest_id'], true);
     
    591579    load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
    592580    $template = new Template(PHPWG_ROOT_PATH.'themes', get_default_theme());
    593   }
    594   else
    595   {
    596     $template = new Template(PHPWG_ROOT_PATH.'themes', $user['theme']);
    597581  }
    598582
  • branches/2.1/include/functions_calendar.inc.php

    r6364 r6669  
    259259  if ($must_show_list)
    260260  {
    261     $query = 'SELECT DISTINCT id '.get_extra_fields($conf['order_by']);
     261    $query = 'SELECT DISTINCT id ';
    262262    $query .= ','.$calendar->date_field;
    263263    $query .= $calendar->inner_sql.'
  • branches/2.1/include/functions_notification.inc.php

    r6663 r6669  
    8080      if (!empty($end))
    8181      {
    82         $query .= '     
     82        $query .= '
    8383    AND c.validation_date <= \''.$end.'\'';
    8484      }
     
    9595      }
    9696      if (!empty($end))
    97       {     
     97      {
    9898        $query .= ' AND date <= \''.$end.'\'';
    9999      }
     
    620620
    621621  $title = l10n_dec('%d new image', '%d new images', $date_detail['nb_elements']);
    622   $title .= ' ('.$lang['month'][(int)$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')';
     622  $title .= ' ('.$lang['month'][1+$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')';
    623623
    624624  return $title;
    625625}
    626626
     627if(!function_exists("strptime"))
     628{
     629                function strptime($date, $fmt)
     630                {
     631                        if ($fmt != '%Y-%m-%d %H:%M:%S')
     632                                die('Invalid strptime format '.$fmt);
     633                        list($y,$m,$d,$H,$M,$S) = preg_split('/[-: ]/', $date);
     634                        $res = localtime( mktime($H,$M,$S,$m,$d,$y), true );
     635                        return $res;
     636                }
     637 }
    627638?>
  • branches/2.1/include/section_init.inc.php

    r6665 r6669  
    290290    // Main query
    291291    $query = '
    292 SELECT DISTINCT(image_id)'.get_extra_fields($conf['order_by']).'
     292SELECT DISTINCT(image_id)
    293293  FROM '.IMAGE_CATEGORY_TABLE.'
    294294    INNER JOIN '.IMAGES_TABLE.' ON id = image_id
     
    324324    {
    325325      $query = '
    326 SELECT DISTINCT image_id'.get_extra_fields($conf['order_by']).'
     326SELECT DISTINCT image_id
    327327  FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id
    328328  WHERE image_id IN ('.implode(',', $items).')
     
    441441
    442442    $query = '
    443 SELECT DISTINCT(id)'.get_extra_fields($conf['order_by']).'
     443SELECT DISTINCT(id)
    444444  FROM '.IMAGES_TABLE.'
    445445    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
     
    529529  {
    530530    $query ='
    531 SELECT DISTINCT(id)'.get_extra_fields($conf['order_by']).'
     531SELECT DISTINCT(id)
    532532  FROM '.IMAGES_TABLE.'
    533533    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
  • branches/2.1/themes/default/template/comments.tpl

    r5164 r6669  
    33  <div class="titrePage">
    44    <ul class="categoryActions">
    5       <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
     5      <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
    66    </ul>
    77    <h2>{'User comments'|@translate}</h2>
  • branches/2.1/themes/default/template/notification.tpl

    r5164 r6669  
    77  <div class="titrePage">
    88    <ul class="categoryActions">
    9       <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
     9      <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
    1010    </ul>
    1111    <h2>{'Notification'|@translate}</h2>
  • branches/2.1/themes/default/template/password.tpl

    r5559 r6669  
    33  <div class="titrePage">
    44    <ul class="categoryActions">
    5       <li><a href="{$U_HOME}" title="{'Go through the gallery as a visitor'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
     5      <li><a href="{$U_HOME}" title="{'Go through the gallery as a visitor'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
    66    </ul>
    77    <h2>{'Password forgotten'|@translate}</h2>
  • branches/2.1/themes/default/template/tags.tpl

    r5709 r6669  
    44                <ul class="categoryActions">
    55                {if $display_mode == 'letters'}
    6                         <li><a href="{$U_CLOUD}" title="{'show tag cloud'|@translate}" rel="nofollow"><img src="{$themeconf.icon_dir}/tag_cloud.png" class="button" alt="{'cloud'|@translate}"></a></li>
     6                        <li><a href="{$U_CLOUD}" title="{'show tag cloud'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/tag_cloud.png" class="button" alt="{'cloud'|@translate}"></a></li>
    77                {/if}
    88
    99                {if $display_mode == 'cloud'}
    10                         <li><a href="{$U_LETTERS}" title="{'group by letters'|@translate}" rel="nofollow"><img src="{$themeconf.icon_dir}/tag_letters.png" class="button" alt="{'letters'|@translate}"></a></li>
     10                        <li><a href="{$U_LETTERS}" title="{'group by letters'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/tag_letters.png" class="button" alt="{'letters'|@translate}"></a></li>
    1111                {/if}
    1212
    13                         <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
     13                        <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
    1414                </ul>
    1515                <h2>{'Tags'|@translate}</h2>
  • branches/2.1/themes/default/template/upload.tpl

    r5164 r6669  
    99  <div class="titrePage">
    1010    <ul class="categoryActions">
    11       <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
     11      <li><a href="{$U_HOME}" title="{'Home'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/home.png" class="button" alt="{'Home'|@translate}"></a></li>
    1212    </ul>
    1313    <h2>{'Upload a picture'|@translate}</h2>
Note: See TracChangeset for help on using the changeset viewer.