Changeset 4325 for trunk/include
- Timestamp:
- Nov 20, 2009, 3:17:04 PM (14 years ago)
- Location:
- trunk/include
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/calendar_monthly.class.php
r4265 r4325 232 232 $result = pwg_query($query); 233 233 $items=array(); 234 while ($row = mysql_fetch_assoc($result))234 while ($row = pwg_db_fetch_assoc($result)) 235 235 { 236 236 $y = substr($row['period'], 0, 4); … … 284 284 $result = pwg_query($query); 285 285 $items=array(); 286 while ($row = mysql_fetch_assoc($result))286 while ($row = pwg_db_fetch_assoc($result)) 287 287 { 288 288 $m = (int)substr($row['period'], 0, 2); … … 334 334 $items=array(); 335 335 $result = pwg_query($query); 336 while ($row = mysql_fetch_assoc($result))336 while ($row = pwg_db_fetch_assoc($result)) 337 337 { 338 338 $d = (int)$row['period']; … … 352 352 unset ( $page['chronology_date'][CDAY] ); 353 353 354 $row = mysql_fetch_assoc(pwg_query($query));354 $row = pwg_db_fetch_assoc(pwg_query($query)); 355 355 $items[$day]['tn_url'] = get_thumbnail_url($row); 356 356 $items[$day]['file'] = $row['file']; -
trunk/include/category_cats.inc.php
r4265 r4325 76 76 $image_ids = array(); 77 77 78 while ($row = mysql_fetch_assoc($result))78 while ($row = pwg_db_fetch_assoc($result)) 79 79 { 80 80 $row['is_child_date_last'] = @$row['max_date_last']>@$row['date_last']; … … 109 109 ;'; 110 110 $subresult = pwg_query($query); 111 if ( mysql_num_rows($subresult) > 0)111 if (pwg_db_num_rows($subresult) > 0) 112 112 { 113 list($image_id) = mysql_fetch_row($subresult);113 list($image_id) = pwg_db_fetch_row($subresult); 114 114 } 115 115 } … … 137 137 ;'; 138 138 $subresult = pwg_query($query); 139 if ( mysql_num_rows($subresult) > 0)139 if (pwg_db_num_rows($subresult) > 0) 140 140 { 141 list($image_id) = mysql_fetch_row($subresult);141 list($image_id) = pwg_db_fetch_row($subresult); 142 142 } 143 143 } … … 179 179 ;'; 180 180 $result = pwg_query($query); 181 while ($row = mysql_fetch_assoc($result))181 while ($row = pwg_db_fetch_assoc($result)) 182 182 { 183 183 $dates_of_category[ $row['category_id'] ] = array( … … 203 203 ;'; 204 204 $result = pwg_query($query); 205 while ($row = mysql_fetch_assoc($result))205 while ($row = pwg_db_fetch_assoc($result)) 206 206 { 207 207 $thumbnail_src_of[$row['id']] = get_thumbnail_url($row); -
trunk/include/category_default.inc.php
r3491 r4325 46 46 ;'; 47 47 $result = pwg_query($query); 48 while ($row = mysql_fetch_assoc($result))48 while ($row = pwg_db_fetch_assoc($result)) 49 49 { 50 50 $row['rank'] = $rank_of[ $row['id'] ]; -
trunk/include/common.inc.php
r4280 r4325 93 93 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); 94 94 @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); 95 include(PHPWG_ROOT_PATH .'include/dblayer/functions_mysql.inc.php'); 95 96 96 97 if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors'])) … … 105 106 106 107 // Database connection 107 @mysql_connect( $conf['db_host'], $conf['db_user'], $conf['db_password'] ) or my_error( 'mysql_connect', true ); 108 @mysql_select_db( $conf['db_base'] ) or my_error( 'mysql_select_db', true ); 109 110 defined('PWG_CHARSET') and defined('DB_CHARSET') 111 or fatal_error('PWG_CHARSET and/or DB_CHARSET is not defined'); 112 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') ) 113 { 114 if (DB_CHARSET!='') 115 { 116 pwg_query('SET NAMES "'.DB_CHARSET.'"'); 117 } 118 } 119 elseif ( strtolower(PWG_CHARSET)!='iso-8859-1' ) 120 { 121 fatal_error('PWG supports only iso-8859-1 charset on MySql version '.mysql_get_server_info()); 122 } 108 $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], 109 $conf['db_password'], $conf['db_base']) 110 or my_error('pwg_db_connect', true); 111 112 pwg_db_check_charset(); 123 113 124 114 load_conf_from_db(); -
trunk/include/functions.inc.php
r4265 r4325 45 45 // columns are 'Field', 'Type' 46 46 $result = pwg_query('desc '.$table); 47 while ($row = mysql_fetch_assoc($result))47 while ($row = pwg_db_fetch_assoc($result)) 48 48 { 49 49 // we are only interested in the the field given in parameter for the … … 60 60 } 61 61 } 62 mysql_free_result($result);62 pwg_db_free_result($result); 63 63 return $options; 64 64 } … … 597 597 } 598 598 599 function pwg_query($query)600 {601 global $conf,$page,$debug,$t2;602 603 $start = get_moment();604 ($result = mysql_query($query)) or my_error($query, $conf['die_on_sql_error']);605 606 $time = get_moment() - $start;607 608 if (!isset($page['count_queries']))609 {610 $page['count_queries'] = 0;611 $page['queries_time'] = 0;612 }613 614 $page['count_queries']++;615 $page['queries_time']+= $time;616 617 if ($conf['show_queries'])618 {619 $output = '';620 $output.= '<pre>['.$page['count_queries'].'] ';621 $output.= "\n".$query;622 $output.= "\n".'(this query time : ';623 $output.= '<b>'.number_format($time, 3, '.', ' ').' s)</b>';624 $output.= "\n".'(total SQL time : ';625 $output.= number_format($page['queries_time'], 3, '.', ' ').' s)';626 $output.= "\n".'(total time : ';627 $output.= number_format( ($time+$start-$t2), 3, '.', ' ').' s)';628 if ( $result!=null and preg_match('/\s*SELECT\s+/i',$query) )629 {630 $output.= "\n".'(num rows : ';631 $output.= mysql_num_rows($result).' )';632 }633 elseif ( $result!=null634 and preg_match('/\s*INSERT|UPDATE|REPLACE|DELETE\s+/i',$query) )635 {636 $output.= "\n".'(affected rows : ';637 $output.= mysql_affected_rows().' )';638 }639 $output.= "</pre>\n";640 641 $debug .= $output;642 }643 644 return $result;645 }646 647 599 function pwg_debug( $string ) 648 600 { … … 904 856 905 857 return $thumbnail_title; 906 }907 908 // my_error returns (or send to standard output) the message concerning the909 // error occured for the last mysql query.910 function my_error($header, $die)911 {912 $error = "[mysql error ".mysql_errno().'] '.mysql_error()."\n";913 $error .= $header;914 915 if ($die)916 {917 fatal_error($error);918 }919 echo("<pre>");920 trigger_error($error, E_USER_WARNING);921 echo("</pre>");922 }923 924 925 /**926 * creates an array based on a query, this function is a very common pattern927 * used here928 *929 * @param string $query930 * @param string $fieldname931 * @return array932 */933 function array_from_query($query, $fieldname)934 {935 $array = array();936 937 $result = pwg_query($query);938 while ($row = mysql_fetch_assoc($result))939 {940 array_push($array, $row[$fieldname]);941 }942 943 return $array;944 858 } 945 859 … … 1122 1036 WHERE '.$conf['user_fields']['id'].' = '.$conf['webmaster_id'].' 1123 1037 ;'; 1124 list($email) = mysql_fetch_row(pwg_query($query));1038 list($email) = pwg_db_fetch_row(pwg_query($query)); 1125 1039 1126 1040 return $email; … … 1143 1057 $result = pwg_query($query); 1144 1058 1145 if (( mysql_num_rows($result) == 0) and !empty($condition))1059 if ((pwg_db_num_rows($result) == 0) and !empty($condition)) 1146 1060 { 1147 1061 fatal_error('No configuration data'); 1148 1062 } 1149 1063 1150 while ($row = mysql_fetch_assoc($result))1064 while ($row = pwg_db_fetch_assoc($result)) 1151 1065 { 1152 1066 $conf[ $row['param'] ] = isset($row['value']) ? $row['value'] : ''; … … 1193 1107 1194 1108 $result = pwg_query($query); 1195 while ($row = mysql_fetch_assoc($result))1109 while ($row = pwg_db_fetch_assoc($result)) 1196 1110 { 1197 1111 $array[ $row[$keyname] ] = $row[$valuename]; … … 1214 1128 $array = array(); 1215 1129 $result = pwg_query($query); 1216 while ($row = mysql_fetch_assoc($result))1130 while ($row = pwg_db_fetch_assoc($result)) 1217 1131 { 1218 1132 $array[ $row[$keyname] ] = $row; … … 1585 1499 // Use MySql date in order to standardize all recent "actions/queries" 1586 1500 list($cache['get_icon']['sql_recent_date']) = 1587 mysql_fetch_row(pwg_query('select SUBDATE(1501 pwg_db_fetch_row(pwg_query('select SUBDATE( 1588 1502 CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)')); 1589 1503 } -
trunk/include/functions_category.inc.php
r4265 r4325 102 102 $cats = array(); 103 103 $selected_category = isset($page['category']) ? $page['category'] : null; 104 while ($row = mysql_fetch_assoc($result))104 while ($row = pwg_db_fetch_assoc($result)) 105 105 { 106 106 $child_date_last = @$row['max_date_last']> @$row['date_last']; … … 166 166 WHERE id = '.$id.' 167 167 ;'; 168 $cat = mysql_fetch_assoc(pwg_query($query));168 $cat = pwg_db_fetch_assoc(pwg_query($query)); 169 169 if (empty($cat)) 170 170 return null; … … 241 241 $query.= ' FROM '.CATEGORIES_TABLE.' WHERE id = '.$category_id; 242 242 $query.= ';'; 243 $row = mysql_fetch_assoc( pwg_query( $query ) );243 $row = pwg_db_fetch_assoc( pwg_query( $query ) ); 244 244 $uppercats = $row['uppercats']; 245 245 } … … 252 252 $query.= ';'; 253 253 $result = pwg_query( $query ); 254 while( $row = mysql_fetch_assoc( $result ) )254 while( $row = pwg_db_fetch_assoc( $result ) ) 255 255 { 256 256 $database_dirs[$row['id']] = $row['dir']; … … 276 276 AND c.id = '.$category_id.' 277 277 ;'; 278 $row = mysql_fetch_assoc(pwg_query($query));278 $row = pwg_db_fetch_assoc(pwg_query($query)); 279 279 return $row['galleries_url']; 280 280 } … … 345 345 if (!empty($result)) 346 346 { 347 while ($row = mysql_fetch_assoc($result))347 while ($row = pwg_db_fetch_assoc($result)) 348 348 { 349 349 array_push($categories, $row); … … 385 385 386 386 $subcats = array(); 387 while ($row = mysql_fetch_assoc($result))387 while ($row = pwg_db_fetch_assoc($result)) 388 388 { 389 389 array_push($subcats, $row['id']); … … 534 534 LIMIT 1'; 535 535 536 $show_link = mysql_num_rows(pwg_query($query)) <> 0;536 $show_link = pwg_db_num_rows(pwg_query($query)) <> 0; 537 537 } 538 538 } -
trunk/include/functions_comment.inc.php
r4306 r4325 101 101 FROM '.USERS_TABLE.' 102 102 WHERE '.$conf['user_fields']['username']." = '".addslashes($comm['author'])."'"; 103 $row = mysql_fetch_assoc( pwg_query( $query ) );103 $row = pwg_db_fetch_assoc( pwg_query( $query ) ); 104 104 if ( $row['user_exists'] == 1 ) 105 105 { … … 139 139 WHERE date > FROM_UNIXTIME('.$reference_date.') 140 140 AND author_id = '.$comm['author_id']; 141 if ( mysql_num_rows( pwg_query( $query ) ) > 0 )141 if ( pwg_db_num_rows( pwg_query( $query ) ) > 0 ) 142 142 { 143 143 array_push( $infos, l10n('comment_anti-flood') ); … … 169 169 pwg_query($query); 170 170 171 $comm['id'] = mysql_insert_id();171 $comm['id'] = pwg_db_insert_id(); 172 172 173 173 if (($comment_action=='validate' and $conf['email_admin_on_comment']) or … … 267 267 WHERE date > FROM_UNIXTIME('.$reference_date.') 268 268 AND author_id = '.$comm['author_id']; 269 if ( mysql_num_rows( pwg_query( $query ) ) > 0 )269 if ( pwg_db_num_rows( pwg_query( $query ) ) > 0 ) 270 270 { 271 271 //?? array_push( $infos, l10n('comment_anti-flood') ); -
trunk/include/functions_mail.inc.php
r4304 r4325 352 352 if (!empty($datas)) 353 353 { 354 while ($admin = mysql_fetch_assoc($datas))354 while ($admin = pwg_db_fetch_assoc($datas)) 355 355 { 356 356 if (!empty($admin['mail_address'])) … … 448 448 $result = pwg_query($query); 449 449 450 if ( mysql_num_rows($result) > 0)450 if (pwg_db_num_rows($result) > 0) 451 451 { 452 452 $list = array(); 453 while ($row = mysql_fetch_assoc($result))453 while ($row = pwg_db_fetch_assoc($result)) 454 454 { 455 455 $row['template_theme'] = $row['template']; … … 477 477 $result = pwg_query($query); 478 478 479 if ( mysql_num_rows($result) > 0)479 if (pwg_db_num_rows($result) > 0) 480 480 { 481 481 $Bcc = array(); 482 while ($row = mysql_fetch_assoc($result))482 while ($row = pwg_db_fetch_assoc($result)) 483 483 { 484 484 if (!empty($row['mail_address'])) -
trunk/include/functions_notification.inc.php
r4265 r4325 146 146 $query = 'SELECT count(distinct '.$field_id.') as CountId 147 147 '.$query; 148 list($count) = mysql_fetch_row(pwg_query($query));148 list($count) = pwg_db_fetch_row(pwg_query($query)); 149 149 return $count; 150 150 … … 179 179 $infos = array(); 180 180 181 while ($row = mysql_fetch_assoc($result))181 while ($row = pwg_db_fetch_assoc($result)) 182 182 { 183 183 array_push($infos, $row); … … 449 449 $result = pwg_query($query); 450 450 $dates = array(); 451 while ($row = mysql_fetch_assoc($result))451 while ($row = pwg_db_fetch_assoc($result)) 452 452 { 453 453 array_push($dates, $row); … … 469 469 $dates[$i]['elements'] = array(); 470 470 $result = pwg_query($query); 471 while ($row = mysql_fetch_assoc($result))471 while ($row = pwg_db_fetch_assoc($result)) 472 472 { 473 473 array_push($dates[$i]['elements'], $row); … … 489 489 $dates[$i]['categories'] = array(); 490 490 $result = pwg_query($query); 491 while ($row = mysql_fetch_assoc($result))491 while ($row = pwg_db_fetch_assoc($result)) 492 492 { 493 493 array_push($dates[$i]['categories'], $row); -
trunk/include/functions_plugins.inc.php
r4265 r4325 239 239 $result = pwg_query($query); 240 240 $plugins = array(); 241 while ($row = mysql_fetch_assoc($result))241 while ($row = pwg_db_fetch_assoc($result)) 242 242 { 243 243 array_push($plugins, $row); -
trunk/include/functions_rate.inc.php
r3282 r4325 125 125 WHERE element_id = '.$image_id.' 126 126 ;'; 127 $row = mysql_fetch_assoc(pwg_query($query));127 $row = pwg_db_fetch_assoc(pwg_query($query)); 128 128 $query = ' 129 129 UPDATE '.IMAGES_TABLE.' -
trunk/include/functions_search.inc.php
r4265 r4325 42 42 WHERE id = '.$search_id.' 43 43 ;'; 44 list($serialized_rules) = mysql_fetch_row(pwg_query($query));44 list($serialized_rules) = pwg_db_fetch_row(pwg_query($query)); 45 45 46 46 return unserialize($serialized_rules); … … 459 459 $by_weights=array(); 460 460 $result = pwg_query($query); 461 while ($row = mysql_fetch_assoc($result))461 while ($row = pwg_db_fetch_assoc($result)) 462 462 { // weight is important when sorting images by relevance 463 463 if ($row['weight']) … … 490 490 GROUP BY image_id'; 491 491 $result = pwg_query($query); 492 while ($row = mysql_fetch_assoc($result))492 while ($row = pwg_db_fetch_assoc($result)) 493 493 { // weight is important when sorting images by relevance 494 494 $image_id=(int)$row['image_id']; … … 511 511 ); 512 512 $result = pwg_query($query); 513 while ($row = mysql_fetch_assoc($result))513 while ($row = pwg_db_fetch_assoc($result)) 514 514 { // weight is important when sorting images by relevance 515 515 if ($row['nb_images']==0) -
trunk/include/functions_session.inc.php
r3282 r4325 122 122 if ($result) 123 123 { 124 $row = mysql_fetch_assoc($result);124 $row = pwg_db_fetch_assoc($result); 125 125 return $row['data']; 126 126 } -
trunk/include/functions_tag.inc.php
r3282 r4325 64 64 $result = pwg_query($query); 65 65 $tags = array(); 66 while ($row = mysql_fetch_assoc($result))66 while ($row = pwg_db_fetch_assoc($result)) 67 67 { 68 68 $counter = @$tag_counters[ $row['id'] ]; … … 89 89 $result = pwg_query($query); 90 90 $tags = array(); 91 while ($row = mysql_fetch_assoc($result))91 while ($row = pwg_db_fetch_assoc($result)) 92 92 { 93 93 array_push($tags, $row); … … 250 250 $result = pwg_query($query); 251 251 $tags = array(); 252 while($row = mysql_fetch_assoc($result))252 while($row = pwg_db_fetch_assoc($result)) 253 253 { 254 254 array_push($tags, $row); … … 312 312 $result = pwg_query($query); 313 313 $tags = array(); 314 while ($row = mysql_fetch_assoc($result))314 while ($row = pwg_db_fetch_assoc($result)) 315 315 { 316 316 array_push($tags, $row); -
trunk/include/functions_user.inc.php
r4304 r4325 59 59 '.(is_numeric($user_id) ? 'and '.$conf['user_fields']['id'].' != \''.$user_id.'\'' : '').' 60 60 ;'; 61 list($count) = mysql_fetch_row(pwg_query($query));61 list($count) = pwg_db_fetch_row(pwg_query($query)); 62 62 if ($count != 0) 63 63 { … … 111 111 FROM '.USERS_TABLE.' 112 112 ;'; 113 list($next_id) = mysql_fetch_row(pwg_query($query));113 list($next_id) = pwg_db_fetch_row(pwg_query($query)); 114 114 115 115 $insert = 116 116 array( 117 117 $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), 119 119 $conf['user_fields']['password'] => $conf['pass_convert']($password), 120 120 $conf['user_fields']['email'] => $mail_address … … 135 135 136 136 $inserts = array(); 137 while ($row = mysql_fetch_assoc($result))137 while ($row = pwg_db_fetch_assoc($result)) 138 138 { 139 139 array_push … … 250 250 WHERE '.$conf['user_fields']['id'].' = \''.$user_id.'\''; 251 251 252 $row = mysql_fetch_assoc(pwg_query($query));252 $row = pwg_db_fetch_assoc(pwg_query($query)); 253 253 254 254 while (true) … … 260 260 WHERE ui.user_id = \''.$user_id.'\''; 261 261 $result = pwg_query($query); 262 if ( mysql_num_rows($result) > 0)262 if (pwg_db_num_rows($result) > 0) 263 263 { 264 264 break; … … 270 270 } 271 271 272 $row = array_merge($row, mysql_fetch_assoc($result));272 $row = array_merge($row, pwg_db_fetch_assoc($result)); 273 273 274 274 foreach ($row as $key => $value) … … 325 325 WHERE category_id NOT IN ('.$userdata['forbidden_categories'].') 326 326 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)); 328 328 329 329 … … 429 429 $result = pwg_query($query); 430 430 $authorizeds = array(); 431 while ($row = mysql_fetch_assoc($result))431 while ($row = pwg_db_fetch_assoc($result)) 432 432 { 433 433 array_push($authorizeds, $row['image_id']); … … 441 441 $result = pwg_query($query); 442 442 $favorites = array(); 443 while ($row = mysql_fetch_assoc($result))443 while ($row = pwg_db_fetch_assoc($result)) 444 444 { 445 445 array_push($favorites, $row['image_id']); … … 482 482 ;'; 483 483 $result = pwg_query($query); 484 while ($row = mysql_fetch_assoc($result))484 while ($row = pwg_db_fetch_assoc($result)) 485 485 { 486 486 array_push($private_array, $row['id']); … … 524 524 ;'; 525 525 $result = pwg_query($query); 526 while ($row = mysql_fetch_assoc($result))526 while ($row = pwg_db_fetch_assoc($result)) 527 527 { 528 528 array_push($forbidden_array, $row['id']); … … 648 648 649 649 $cats = array(); 650 while ($row = mysql_fetch_assoc($result))650 while ($row = pwg_db_fetch_assoc($result)) 651 651 { 652 652 $row['user_id'] = $userdata['id']; … … 693 693 global $conf; 694 694 695 $username = mysql_real_escape_string($username);695 $username = pwg_db_real_escape_string($username); 696 696 697 697 $query = ' … … 702 702 $result = pwg_query($query); 703 703 704 if ( mysql_num_rows($result) == 0)704 if (pwg_db_num_rows($result) == 0) 705 705 { 706 706 return false; … … 708 708 else 709 709 { 710 list($user_id) = mysql_fetch_row($result);710 list($user_id) = pwg_db_fetch_row($result); 711 711 return $user_id; 712 712 } … … 728 728 WHERE id = \''.$key.'\' 729 729 ;'; 730 list($count) = mysql_fetch_row(pwg_query($query));730 list($count) = pwg_db_fetch_row(pwg_query($query)); 731 731 if (0 == $count) 732 732 { … … 751 751 752 752 $result = pwg_query($query); 753 $cache['default_user'] = mysql_fetch_assoc($result);753 $cache['default_user'] = pwg_db_fetch_assoc($result); 754 754 755 755 if ($cache['default_user'] !== false) … … 866 866 { 867 867 $inserts = array(); 868 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));868 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 869 869 870 870 $default_user = get_default_user_info(false); … … 931 931 WHERE '.$conf['user_fields']['id'].' = '.$user_id; 932 932 $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); 936 936 $username = stripslashes($row['username']); 937 937 $data = $time.stripslashes($row['username']).$row['password']; … … 1042 1042 WHERE '.$conf['user_fields']['username'].' = \''.mysql_real_escape_string($username).'\' 1043 1043 ;'; 1044 $row = mysql_fetch_assoc(pwg_query($query));1044 $row = pwg_db_fetch_assoc(pwg_query($query)); 1045 1045 if ($row['password'] == $conf['pass_convert']($password)) 1046 1046 { -
trunk/include/picture_comment.inc.php
r4304 r4325 94 94 FROM '.COMMENTS_TABLE.' 95 95 WHERE image_id='.$page['image_id']." AND validated = 'true'"; 96 $row = mysql_fetch_assoc( pwg_query( $query ) );96 $row = pwg_db_fetch_assoc( pwg_query( $query ) ); 97 97 98 98 // navigation bar creation … … 141 141 $result = pwg_query( $query ); 142 142 143 while ($row = mysql_fetch_assoc($result))143 while ($row = pwg_db_fetch_assoc($result)) 144 144 { 145 145 if (!empty($row['author'])) -
trunk/include/picture_rate.inc.php
r4265 r4325 38 38 WHERE element_id = '.$picture['current']['id'].' 39 39 ;'; 40 $row = mysql_fetch_assoc(pwg_query($query));40 $row = pwg_db_fetch_assoc(pwg_query($query)); 41 41 } 42 42 else … … 68 68 69 69 $result = pwg_query($query); 70 if ( mysql_num_rows($result) > 0)70 if (pwg_db_num_rows($result) > 0) 71 71 { 72 $row = mysql_fetch_assoc($result);72 $row = pwg_db_fetch_assoc($result); 73 73 $user_rate = $row['rate']; 74 74 } -
trunk/include/ws_functions.inc.php
r4304 r4325 257 257 $result = pwg_query($query); 258 258 $cats = array(); 259 while ($row = mysql_fetch_assoc($result))259 while ($row = pwg_db_fetch_assoc($result)) 260 260 { 261 261 $row['id'] = (int)$row['id']; … … 296 296 297 297 $result = pwg_query($query); 298 while ($row = mysql_fetch_assoc($result))298 while ($row = pwg_db_fetch_assoc($result)) 299 299 { 300 300 $image = array(); … … 406 406 407 407 $cats = array(); 408 while ($row = mysql_fetch_assoc($result))408 while ($row = pwg_db_fetch_assoc($result)) 409 409 { 410 410 $row['url'] = make_index_url( … … 472 472 $cats = array(); 473 473 474 while ($row = mysql_fetch_assoc($result))474 while ($row = pwg_db_fetch_assoc($result)) 475 475 { 476 476 $id = $row['id']; … … 518 518 ' AND' 519 519 ); 520 if ( ! mysql_num_rows( pwg_query( $query ) ) )520 if ( !pwg_db_num_rows( pwg_query( $query ) ) ) 521 521 { 522 522 return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id"); … … 578 578 LIMIT 1'; 579 579 580 $image_row = mysql_fetch_assoc(pwg_query($query));580 $image_row = pwg_db_fetch_assoc(pwg_query($query)); 581 581 if ($image_row==null) 582 582 { … … 599 599 $is_commentable = false; 600 600 $related_categories = array(); 601 while ($row = mysql_fetch_assoc($result))601 while ($row = pwg_db_fetch_assoc($result)) 602 602 { 603 603 if ($row['commentable']=='true') … … 656 656 WHERE element_id = '.$image_row['id'].' 657 657 ;'; 658 $rating = mysql_fetch_assoc(pwg_query($query));658 $rating = pwg_db_fetch_assoc(pwg_query($query)); 659 659 $rating['count'] = (int)$rating['count']; 660 660 … … 687 687 688 688 $result = pwg_query($query); 689 while ($row = mysql_fetch_assoc($result))689 while ($row = pwg_db_fetch_assoc($result)) 690 690 { 691 691 $row['id']=(int)$row['id']; … … 758 758 ).' 759 759 LIMIT 1'; 760 if ( mysql_num_rows( pwg_query($query) )==0 )760 if ( pwg_db_num_rows( pwg_query($query) )==0 ) 761 761 { 762 762 return new PwgError(404, "Invalid image_id or access denied" ); … … 814 814 $image_ids = array_flip($image_ids); 815 815 $result = pwg_query($query); 816 while ($row = mysql_fetch_assoc($result))816 while ($row = pwg_db_fetch_assoc($result)) 817 817 { 818 818 $image = array(); … … 871 871 WHERE id IN ('.implode(',',$params['image_id']).')'; 872 872 $result = pwg_query($query); 873 $affected_rows = mysql_affected_rows();873 $affected_rows = pwg_db_affected_rows(); 874 874 if ($affected_rows) 875 875 { … … 1008 1008 WHERE md5sum = \''.$params['original_sum'].'\' 1009 1009 ;'; 1010 list($counter) = mysql_fetch_row(pwg_query($query));1010 list($counter) = pwg_db_fetch_row(pwg_query($query)); 1011 1011 if ($counter != 0) { 1012 1012 return new PwgError(500, 'file already exists'); … … 1014 1014 1015 1015 // current date 1016 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));1016 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 1017 1017 list($year, $month, $day) = preg_split('/[^\d]/', $dbnow, 4); 1018 1018 … … 1200 1200 ); 1201 1201 1202 $image_id = mysql_insert_id();1202 $image_id = pwg_db_insert_id(); 1203 1203 1204 1204 // let's add links between the image and the categories … … 1359 1359 GROUP BY image_id'; 1360 1360 $result = pwg_query($query); 1361 while ( $row= mysql_fetch_assoc($result) )1361 while ( $row=pwg_db_fetch_assoc($result) ) 1362 1362 { 1363 1363 $row['image_id'] = (int)$row['image_id']; … … 1402 1402 1403 1403 $result = pwg_query($query); 1404 while ($row = mysql_fetch_assoc($result))1404 while ($row = pwg_db_fetch_assoc($result)) 1405 1405 { 1406 1406 $image = array(); … … 1573 1573 ;'; 1574 1574 1575 $image_row = mysql_fetch_assoc(pwg_query($query));1575 $image_row = pwg_db_fetch_assoc(pwg_query($query)); 1576 1576 if ($image_row == null) 1577 1577 {
Note: See TracChangeset
for help on using the changeset viewer.