Ignore:
Timestamp:
Nov 20, 2009, 3:17:04 PM (14 years ago)
Author:
nikrou
Message:

Feature 1244 resolved
Replace all mysql functions in core code by ones independant of database engine

Fix small php code synxtax : hash must be accessed with [ ] and not { }.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r4304 r4325  
    5959'.(is_numeric($user_id) ? 'and '.$conf['user_fields']['id'].' != \''.$user_id.'\'' : '').'
    6060;';
    61     list($count) = mysql_fetch_row(pwg_query($query));
     61    list($count) = pwg_db_fetch_row(pwg_query($query));
    6262    if ($count != 0)
    6363    {
     
    111111  FROM '.USERS_TABLE.'
    112112;';
    113     list($next_id) = mysql_fetch_row(pwg_query($query));
     113    list($next_id) = pwg_db_fetch_row(pwg_query($query));
    114114
    115115    $insert =
    116116      array(
    117117        $conf['user_fields']['id'] => $next_id,
    118         $conf['user_fields']['username'] => mysql_real_escape_string($login),
     118        $conf['user_fields']['username'] => pwg_db_real_escape_string($login),
    119119        $conf['user_fields']['password'] => $conf['pass_convert']($password),
    120120        $conf['user_fields']['email'] => $mail_address
     
    135135
    136136      $inserts = array();
    137       while ($row = mysql_fetch_assoc($result))
     137      while ($row = pwg_db_fetch_assoc($result))
    138138      {
    139139        array_push
     
    250250  WHERE '.$conf['user_fields']['id'].' = \''.$user_id.'\'';
    251251
    252   $row = mysql_fetch_assoc(pwg_query($query));
     252  $row = pwg_db_fetch_assoc(pwg_query($query));
    253253
    254254  while (true)
     
    260260  WHERE ui.user_id = \''.$user_id.'\'';
    261261    $result = pwg_query($query);
    262     if (mysql_num_rows($result) > 0)
     262    if (pwg_db_num_rows($result) > 0)
    263263    {
    264264      break;
     
    270270  }
    271271
    272   $row = array_merge($row, mysql_fetch_assoc($result));
     272  $row = array_merge($row, pwg_db_fetch_assoc($result));
    273273
    274274  foreach ($row as $key => $value)
     
    325325  WHERE category_id NOT IN ('.$userdata['forbidden_categories'].')
    326326    AND image_id '.$userdata['image_access_type'].' ('.$userdata['image_access_list'].')';
    327       list($userdata['nb_total_images']) = mysql_fetch_row(pwg_query($query));
     327      list($userdata['nb_total_images']) = pwg_db_fetch_row(pwg_query($query));
    328328
    329329
     
    429429  $result = pwg_query($query);
    430430  $authorizeds = array();
    431   while ($row = mysql_fetch_assoc($result))
     431  while ($row = pwg_db_fetch_assoc($result))
    432432  {
    433433    array_push($authorizeds, $row['image_id']);
     
    441441  $result = pwg_query($query);
    442442  $favorites = array();
    443   while ($row = mysql_fetch_assoc($result))
     443  while ($row = pwg_db_fetch_assoc($result))
    444444  {
    445445    array_push($favorites, $row['image_id']);
     
    482482;';
    483483  $result = pwg_query($query);
    484   while ($row = mysql_fetch_assoc($result))
     484  while ($row = pwg_db_fetch_assoc($result))
    485485  {
    486486    array_push($private_array, $row['id']);
     
    524524;';
    525525    $result = pwg_query($query);
    526     while ($row = mysql_fetch_assoc($result))
     526    while ($row = pwg_db_fetch_assoc($result))
    527527    {
    528528      array_push($forbidden_array, $row['id']);
     
    648648
    649649  $cats = array();
    650   while ($row = mysql_fetch_assoc($result))
     650  while ($row = pwg_db_fetch_assoc($result))
    651651  {
    652652    $row['user_id'] = $userdata['id'];
     
    693693  global $conf;
    694694
    695   $username = mysql_real_escape_string($username);
     695  $username = pwg_db_real_escape_string($username);
    696696
    697697  $query = '
     
    702702  $result = pwg_query($query);
    703703
    704   if (mysql_num_rows($result) == 0)
     704  if (pwg_db_num_rows($result) == 0)
    705705  {
    706706    return false;
     
    708708  else
    709709  {
    710     list($user_id) = mysql_fetch_row($result);
     710    list($user_id) = pwg_db_fetch_row($result);
    711711    return $user_id;
    712712  }
     
    728728  WHERE id = \''.$key.'\'
    729729;';
    730     list($count) = mysql_fetch_row(pwg_query($query));
     730    list($count) = pwg_db_fetch_row(pwg_query($query));
    731731    if (0 == $count)
    732732    {
     
    751751
    752752    $result = pwg_query($query);
    753     $cache['default_user'] = mysql_fetch_assoc($result);
     753    $cache['default_user'] = pwg_db_fetch_assoc($result);
    754754
    755755    if ($cache['default_user'] !== false)
     
    866866  {
    867867    $inserts = array();
    868     list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
     868    list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();'));
    869869
    870870    $default_user = get_default_user_info(false);
     
    931931WHERE '.$conf['user_fields']['id'].' = '.$user_id;
    932932  $result = pwg_query($query);
    933   if (mysql_num_rows($result) > 0)
    934   {
    935     $row = mysql_fetch_assoc($result);
     933  if (pwg_db_num_rows($result) > 0)
     934  {
     935    $row = pwg_db_fetch_assoc($result);
    936936    $username = stripslashes($row['username']);
    937937    $data = $time.stripslashes($row['username']).$row['password'];
     
    10421042  WHERE '.$conf['user_fields']['username'].' = \''.mysql_real_escape_string($username).'\'
    10431043;';
    1044   $row = mysql_fetch_assoc(pwg_query($query));
     1044  $row = pwg_db_fetch_assoc(pwg_query($query));
    10451045  if ($row['password'] == $conf['pass_convert']($password))
    10461046  {
Note: See TracChangeset for help on using the changeset viewer.