Changeset 4385 for trunk


Ignore:
Timestamp:
Nov 29, 2009, 1:35:19 PM (15 years ago)
Author:
nikrou
Message:

Feature_1255 :

  • single quotes in queries
  • start using $confdblayer
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_modify.php

    r4367 r4385  
    243243
    244244    'CAT_STATUS'        => $category['status'],
    245     'CAT_VISIBLE'       => $category['visible'],
    246     'CAT_COMMENTABLE'   => $category['commentable'],
    247     'CAT_UPLOADABLE'    => $category['uploadable'],
     245    'CAT_VISIBLE'       => boolean_to_string($category['visible']),
     246    'CAT_COMMENTABLE'   => boolean_to_string($category['commentable']),
     247    'CAT_UPLOADABLE'    => boolean_to_string($category['uploadable']),
    248248
    249249    'IMG_ORDER_DEFAULT'  => empty($category['image_order']) ?
  • trunk/admin/include/c13y_internal.class.php

    r4325 r4385  
    3939  function c13y_version($c13y)
    4040  {
     41    global $conf;
     42
    4143    $check_list = array();
    4244
     
    4446
    4547    $db_version = pwg_get_db_version();
    46     $check_list[] = array('type' => 'MySQL', 'current' => $db_version, 'required' => REQUIRED_MYSQL_VERSION);
     48    $check_list[] = array('type' => $conf['dblayer'],
     49                          'current' => $db_version,
     50                          'required' => constant('REQUIRED_'.strtoupper($conf['dblayer']).'_VERSION')
     51                          );
    4752
    4853    foreach ($check_list as $elem)
  • trunk/admin/include/functions.php

    r4334 r4385  
    417417{
    418418  $query = '
    419 SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat, uppercats, rank, global_rank
     419SELECT id, id_uppercat, uppercats, rank, global_rank
    420420  FROM '.CATEGORIES_TABLE.'
    421421  ORDER BY id_uppercat,rank,name';
  • trunk/admin/include/plugins.class.php

    r4034 r4385  
    8181        {
    8282          $query = '
    83 INSERT INTO ' . PLUGINS_TABLE . ' (id,version) VALUES ("'
    84 . $plugin_id . '","' . $this->fs_plugins[$plugin_id]['version'] . '"
     83INSERT INTO ' . PLUGINS_TABLE . ' (id,version) VALUES (\''
     84. $plugin_id . '\',\'' . $this->fs_plugins[$plugin_id]['version'] . '\'
    8585)';
    8686          pwg_query($query);
     
    111111          $query = '
    112112UPDATE ' . PLUGINS_TABLE . '
    113 SET state="active", version="'.$this->fs_plugins[$plugin_id]['version'].'"
    114 WHERE id="' . $plugin_id . '"';
     113SET state=\'active\', version=\''.$this->fs_plugins[$plugin_id]['version'].'\'
     114WHERE id=\'' . $plugin_id . '\'';
    115115          pwg_query($query);
    116116        }
     
    127127        }
    128128        $query = '
    129 UPDATE ' . PLUGINS_TABLE . ' SET state="inactive" WHERE id="' . $plugin_id . '"';
     129UPDATE ' . PLUGINS_TABLE . ' SET state=\'inactive\' WHERE id=\'' . $plugin_id . '\'';
    130130        pwg_query($query);
    131131        if (file_exists($file_to_include))
     
    145145        }
    146146        $query = '
    147 DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"';
     147DELETE FROM ' . PLUGINS_TABLE . ' WHERE id=\'' . $plugin_id . '\'';
    148148        pwg_query($query);
    149149        if (file_exists($file_to_include))
  • trunk/admin/intro.php

    r4325 r4385  
    197197    'OS' => PHP_OS,
    198198    'PHP_VERSION' => phpversion(),
    199     'DB_ENGINE' => 'MySQL',
     199    'DB_ENGINE' => $conf['dblayer'],
    200200    'DB_VERSION' => $db_version,
    201201    'DB_ELEMENTS' => l10n_dec('%d element', '%d elements', $nb_elements),
  • trunk/comments.php

    r4367 r4385  
    322322  WHERE '.implode('
    323323    AND ', $page['where_clauses']).'
    324   GROUP BY comment_id
     324  GROUP BY comment_id, com.image_id, ic.category_id, com.author,
     325           com.author_id, com.date, com.content, com.validated
    325326  ORDER BY '.$page['sort_by'].' '.$page['sort_order'];
    326327if ('all' != $page['items_number'])
  • trunk/include/common.inc.php

    r4325 r4385  
    9393include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
    9494@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
    95 include(PHPWG_ROOT_PATH .'include/dblayer/functions_mysql.inc.php');
     95include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
    9696
    9797if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors']))
  • trunk/include/dblayer/functions_mysql.inc.php

    r4367 r4385  
    539539}
    540540
     541/**
     542 *
     543 * interval and date functions
     544 *
     545 */
     546
     547
     548function pwg_db_get_recent_period_expression($period, $date='CURRENT_DATE')
     549{
     550  if ($date!='CURRENT_DATE')
     551  {
     552    $date = '\''.$date.'\'';
     553  }
     554
     555  return 'SUBDATE('.$date.',INTERVAL '.$period.' DAY)';
     556}
     557
     558function pwg_db_get_recent_period($period, $date='CURRENT_DATE')
     559{
     560  $query = '
     561SELECT '.pwg_db_get_recent_period_expression($period);
     562  list($d) = pwg_db_fetch_row(pwg_query($query));
     563
     564  return $d;
     565}
     566
     567function pwg_db_get_date_YYYYMM($date)
     568{
     569  return 'DATE_FORMAT('.$date.', \'%Y%m\')';
     570}
     571
     572function pwg_db_get_date_MMDD($date)
     573{
     574  return 'DATE_FORMAT('.$date.', \'%m%d\')';
     575}
     576
     577function pwg_db_get_year($date)
     578{
     579  return 'YEAR('.$date.')';
     580}
     581
     582function pwg_db_get_month($date)
     583{
     584  return 'MONTH('.$date.')';
     585}
     586
     587function pwg_db_get_week($date, $mode=null)
     588{
     589  if ($mode)
     590  {
     591    return 'WEEK('.$date.', '.$mode.')';
     592  }
     593  else
     594  {
     595    return 'WEEK('.$date.')';
     596  }
     597}
     598
     599function pwg_db_get_dayofmonth($date)
     600{
     601  return 'DAYOFMONTH('.$date.')';
     602}
     603
     604function pwg_db_get_dayofweek($date)
     605{
     606  return 'DAYOFWEEK('.$date.')';
     607}
     608
     609function pwg_db_get_weekday($date)
     610{
     611  return 'WEEKDAY('.$date.')';
     612}
     613
    541614// my_error returns (or send to standard output) the message concerning the
    542615// error occured for the last mysql query.
  • trunk/include/functions_calendar.inc.php

    r3282 r4385  
    259259  if ($must_show_list)
    260260  {
    261     $query = 'SELECT DISTINCT(id)';
     261    $query = 'SELECT id';
    262262    $query .= $calendar->inner_sql.'
    263263  '.$calendar->get_date_where();
     
    285285  '.$order_by;
    286286    }
    287     $page['items']              = array_from_query($query, 'id');
     287    $page['items'] = array_from_query($query, 'id');
    288288  }
    289289  pwg_debug('end initialize_calendar');
    290290}
    291 
    292291?>
  • trunk/include/functions_user.inc.php

    r4367 r4385  
    643643
    644644  $query.= '
    645   GROUP BY c.id';
     645  GROUP BY c.id, c.global_rank';
    646646
    647647  $result = pwg_query($query);
  • trunk/include/section_init.inc.php

    r4367 r4385  
    123123
    124124$page = array_merge( $page, parse_section_url( $tokens, $next_token) );
     125
    125126if ( !isset($page['section']) )
    126127{
     
    157158}
    158159
    159 
    160160$page = array_merge( $page, parse_well_known_params_url( $tokens, $next_token) );
    161 
    162 
    163161if ( script_basename()=='picture' and 'categories'==$page['section'] and
    164162      !isset($page['category']) and !isset($page['chronology_field']) )
  • trunk/install.php

    r4326 r4385  
    293293    $step = 2;
    294294    $file_content = '<?php
     295$conf[\'dblayer\'] = \'mysql\';
    295296$conf[\'db_base\'] = \''.$dbname.'\';
    296297$conf[\'db_user\'] = \''.$dbuser.'\';
  • trunk/random.php

    r4367 r4385  
    3939
    4040$query = '
    41 SELECT DISTINCT(id)
     41SELECT id
    4242  FROM '.IMAGES_TABLE.'
    4343    INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
  • trunk/upgrade.php

    r4325 r4385  
    4444include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
    4545@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
    46 include(PHPWG_ROOT_PATH .'include/dblayer/functions_mysql.inc.php');
     46include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
    4747
    4848prepare_conf_upgrade();
  • trunk/upgrade_feed.php

    r4325 r4385  
    3636include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
    3737@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
    38 include(PHPWG_ROOT_PATH .'include/dblayer/functions_mysql.inc.php');
     38include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
    3939
    4040// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.