Show
Ignore:
Timestamp:
11/20/09 15:17:04 (4 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 { }.

Files:
1 modified

Legend:

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

    r4304 r4325  
    257257  $result = pwg_query($query); 
    258258  $cats = array(); 
    259   while ($row = mysql_fetch_assoc($result)) 
     259  while ($row = pwg_db_fetch_assoc($result)) 
    260260  { 
    261261    $row['id'] = (int)$row['id']; 
     
    296296 
    297297    $result = pwg_query($query); 
    298     while ($row = mysql_fetch_assoc($result)) 
     298    while ($row = pwg_db_fetch_assoc($result)) 
    299299    { 
    300300      $image = array(); 
     
    406406 
    407407  $cats = array(); 
    408   while ($row = mysql_fetch_assoc($result)) 
     408  while ($row = pwg_db_fetch_assoc($result)) 
    409409  { 
    410410    $row['url'] = make_index_url( 
     
    472472  $cats = array(); 
    473473 
    474   while ($row = mysql_fetch_assoc($result)) 
     474  while ($row = pwg_db_fetch_assoc($result)) 
    475475  { 
    476476    $id = $row['id']; 
     
    518518      ' AND' 
    519519    ); 
    520   if ( !mysql_num_rows( pwg_query( $query ) ) ) 
     520  if ( !pwg_db_num_rows( pwg_query( $query ) ) ) 
    521521  { 
    522522    return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id"); 
     
    578578LIMIT 1'; 
    579579 
    580   $image_row = mysql_fetch_assoc(pwg_query($query)); 
     580  $image_row = pwg_db_fetch_assoc(pwg_query($query)); 
    581581  if ($image_row==null) 
    582582  { 
     
    599599  $is_commentable = false; 
    600600  $related_categories = array(); 
    601   while ($row = mysql_fetch_assoc($result)) 
     601  while ($row = pwg_db_fetch_assoc($result)) 
    602602  { 
    603603    if ($row['commentable']=='true') 
     
    656656  WHERE element_id = '.$image_row['id'].' 
    657657;'; 
    658   $rating = mysql_fetch_assoc(pwg_query($query)); 
     658  $rating = pwg_db_fetch_assoc(pwg_query($query)); 
    659659  $rating['count'] = (int)$rating['count']; 
    660660 
     
    687687 
    688688    $result = pwg_query($query); 
    689     while ($row = mysql_fetch_assoc($result)) 
     689    while ($row = pwg_db_fetch_assoc($result)) 
    690690    { 
    691691      $row['id']=(int)$row['id']; 
     
    758758    ).' 
    759759    LIMIT 1'; 
    760   if ( mysql_num_rows( pwg_query($query) )==0 ) 
     760  if ( pwg_db_num_rows( pwg_query($query) )==0 ) 
    761761  { 
    762762    return new PwgError(404, "Invalid image_id or access denied" ); 
     
    814814    $image_ids = array_flip($image_ids); 
    815815    $result = pwg_query($query); 
    816     while ($row = mysql_fetch_assoc($result)) 
     816    while ($row = pwg_db_fetch_assoc($result)) 
    817817    { 
    818818      $image = array(); 
     
    871871  WHERE id IN ('.implode(',',$params['image_id']).')'; 
    872872  $result = pwg_query($query); 
    873   $affected_rows = mysql_affected_rows(); 
     873  $affected_rows = pwg_db_affected_rows(); 
    874874  if ($affected_rows) 
    875875  { 
     
    10081008  WHERE md5sum = \''.$params['original_sum'].'\' 
    10091009;'; 
    1010   list($counter) = mysql_fetch_row(pwg_query($query)); 
     1010  list($counter) = pwg_db_fetch_row(pwg_query($query)); 
    10111011  if ($counter != 0) { 
    10121012    return new PwgError(500, 'file already exists'); 
     
    10141014 
    10151015  // current date 
    1016   list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); 
     1016  list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 
    10171017  list($year, $month, $day) = preg_split('/[^\d]/', $dbnow, 4); 
    10181018 
     
    12001200    ); 
    12011201 
    1202   $image_id = mysql_insert_id(); 
     1202  $image_id = pwg_db_insert_id(); 
    12031203 
    12041204  // let's add links between the image and the categories 
     
    13591359  GROUP BY image_id'; 
    13601360      $result = pwg_query($query); 
    1361       while ( $row=mysql_fetch_assoc($result) ) 
     1361      while ( $row=pwg_db_fetch_assoc($result) ) 
    13621362      { 
    13631363        $row['image_id'] = (int)$row['image_id']; 
     
    14021402 
    14031403    $result = pwg_query($query); 
    1404     while ($row = mysql_fetch_assoc($result)) 
     1404    while ($row = pwg_db_fetch_assoc($result)) 
    14051405    { 
    14061406      $image = array(); 
     
    15731573;'; 
    15741574 
    1575   $image_row = mysql_fetch_assoc(pwg_query($query)); 
     1575  $image_row = pwg_db_fetch_assoc(pwg_query($query)); 
    15761576  if ($image_row == null) 
    15771577  {