Changeset 4325
- Timestamp:
- Nov 20, 2009, 3:17:04 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 77 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r3282 r4325 72 72 73 73 $result = pwg_query($query); 74 $element_info = mysql_fetch_assoc($result);74 $element_info = pwg_db_fetch_assoc($result); 75 75 if ( empty($element_info) ) 76 76 { … … 94 94 LIMIT 1 95 95 ;'; 96 if ( mysql_num_rows(pwg_query($query))<1 )96 if ( pwg_db_num_rows(pwg_query($query))<1 ) 97 97 { 98 98 do_error(401, 'Access denied'); -
trunk/admin/cat_list.php
r3282 r4325 120 120 ;'; 121 121 $result = pwg_query($query); 122 while ($row = mysql_fetch_assoc($result))122 while ($row = pwg_db_fetch_assoc($result)) 123 123 { 124 124 $categories[ $row['id'] ] = strtolower($row['name']); -
trunk/admin/cat_modify.php
r4265 r4325 194 194 WHERE id = '.$_GET['cat_id'].' 195 195 ;'; 196 $category = mysql_fetch_assoc( pwg_query( $query ) );196 $category = pwg_db_fetch_assoc( pwg_query( $query ) ); 197 197 // nullable fields 198 198 foreach (array('comment','dir','site_id', 'id_uppercat') as $nullable) … … 211 211 LIMIT 1'; 212 212 $result = pwg_query($query); 213 $category['has_images'] = mysql_num_rows($result)>0 ? true : false;213 $category['has_images'] = pwg_db_num_rows($result)>0 ? true : false; 214 214 215 215 // Navigation path … … 374 374 WHERE id = '.$category['representative_picture_id'].' 375 375 ;'; 376 $row = mysql_fetch_assoc(pwg_query($query));376 $row = pwg_db_fetch_assoc(pwg_query($query)); 377 377 $src = get_thumbnail_url($row); 378 378 $url = get_root_url().'admin.php?page=picture_modify'; … … 462 462 463 463 $result = pwg_query($query); 464 if ( mysql_num_rows($result) > 0)464 if (pwg_db_num_rows($result) > 0) 465 465 { 466 $element = mysql_fetch_assoc($result);466 $element = pwg_db_fetch_assoc($result); 467 467 468 468 $img_url = '<a href="'. … … 512 512 WHERE id = '.$_POST['group'].' 513 513 ;'; 514 list($group_name) = mysql_fetch_row(pwg_query($query));514 list($group_name) = pwg_db_fetch_row(pwg_query($query)); 515 515 516 516 array_push( -
trunk/admin/cat_perm.php
r4265 r4325 46 46 WHERE id = '.$_GET['cat'].' 47 47 ;'; 48 list($status) = mysql_fetch_row(pwg_query($query));48 list($status) = pwg_db_fetch_row(pwg_query($query)); 49 49 50 50 if ('private' == $status) … … 63 63 ;'; 64 64 65 list($page['cat']) = mysql_fetch_row(pwg_query($query));65 list($page['cat']) = pwg_db_fetch_row(pwg_query($query)); 66 66 } 67 67 … … 111 111 ;'; 112 112 $result = pwg_query($query); 113 while ($row = mysql_fetch_assoc($result))113 while ($row = pwg_db_fetch_assoc($result)) 114 114 { 115 115 array_push($granteds[$row['cat_id']], $row['group_id']); … … 170 170 ;'; 171 171 $result = pwg_query($query); 172 while ($row = mysql_fetch_assoc($result))172 while ($row = pwg_db_fetch_assoc($result)) 173 173 { 174 174 array_push($granteds[$row['cat_id']], $row['user_id']); … … 275 275 '; 276 276 $result = pwg_query($query); 277 while ($row = mysql_fetch_assoc($result))277 while ($row = pwg_db_fetch_assoc($result)) 278 278 { 279 279 if (!isset($granted_groups[$row['group_id']])) -
trunk/admin/comments.php
r4304 r4325 146 146 ;'; 147 147 $result = pwg_query($query); 148 while ($row = mysql_fetch_assoc($result))148 while ($row = pwg_db_fetch_assoc($result)) 149 149 { 150 150 $thumb = get_thumbnail_url( -
trunk/admin/configuration.php
r4265 r4325 139 139 //echo '<pre>'; print_r($_POST); echo '</pre>'; 140 140 $result = pwg_query('SELECT param FROM '.CONFIG_TABLE); 141 while ($row = mysql_fetch_assoc($result))141 while ($row = pwg_db_fetch_assoc($result)) 142 142 { 143 143 if (isset($_POST[$row['param']])) -
trunk/admin/element_set.php
r4265 r4325 193 193 $query = 'SELECT MAX(date_available) AS date 194 194 FROM '.IMAGES_TABLE; 195 if ($row = mysql_fetch_assoc( pwg_query($query) ) )195 if ($row = pwg_db_fetch_assoc( pwg_query($query) ) ) 196 196 { 197 197 $query = 'SELECT id -
trunk/admin/element_set_global.php
r4265 r4325 246 246 $result = pwg_query($query); 247 247 248 while ($row = mysql_fetch_assoc($result))248 while ($row = pwg_db_fetch_assoc($result)) 249 249 { 250 250 $data = array(); … … 338 338 AND storage_category_id IS NULL 339 339 ;'; 340 list($counter) = mysql_fetch_row(pwg_query($query));340 list($counter) = pwg_db_fetch_row(pwg_query($query)); 341 341 342 342 if ($counter > 0) … … 482 482 // template thumbnail initialization 483 483 484 while ($row = mysql_fetch_assoc($result))484 while ($row = pwg_db_fetch_assoc($result)) 485 485 { 486 486 $src = get_thumbnail_url($row); -
trunk/admin/element_set_ranks.php
r4265 r4325 116 116 WHERE id = '.$page['category_id'].' 117 117 ;'; 118 $category = mysql_fetch_assoc(pwg_query($query));118 $category = pwg_db_fetch_assoc(pwg_query($query)); 119 119 120 120 // Navigation path … … 151 151 $current_rank = 1; 152 152 153 while ($row = mysql_fetch_assoc($result))153 while ($row = pwg_db_fetch_assoc($result)) 154 154 { 155 155 $src = get_thumbnail_url($row); -
trunk/admin/element_set_unit.php
r4265 r4325 57 57 $result = pwg_query($query); 58 58 59 while ($row = mysql_fetch_assoc($result))59 while ($row = pwg_db_fetch_assoc($result)) 60 60 { 61 61 $data = array(); … … 201 201 $result = pwg_query($query); 202 202 203 while ($row = mysql_fetch_assoc($result))203 while ($row = pwg_db_fetch_assoc($result)) 204 204 { 205 205 // echo '<pre>'; print_r($row); echo '</pre>'; -
trunk/admin/group_list.php
r4265 r4325 61 61 WHERE id = '.$_GET['delete'].' 62 62 ;'; 63 list($groupname) = mysql_fetch_row(pwg_query($query));63 list($groupname) = pwg_db_fetch_row(pwg_query($query)); 64 64 65 65 // destruction of the group … … 95 95 WHERE name = \''.$_POST['groupname'].'\' 96 96 ;'; 97 list($count) = mysql_fetch_row(pwg_query($query));97 list($count) = pwg_db_fetch_row(pwg_query($query)); 98 98 if ($count != 0) 99 99 { … … 108 108 (name) 109 109 VALUES 110 (\''. mysql_real_escape_string($_POST['groupname']).'\')110 (\''.pwg_db_real_escape_string($_POST['groupname']).'\') 111 111 ;'; 112 112 pwg_query($query); … … 130 130 WHERE id = '.$_GET['toggle_is_default'].' 131 131 ;'; 132 list($groupname, $is_default) = mysql_fetch_row(pwg_query($query));132 list($groupname, $is_default) = pwg_db_fetch_row(pwg_query($query)); 133 133 134 134 // update of the group … … 176 176 $toggle_is_default_url = $admin_url.'group_list&toggle_is_default='; 177 177 178 while ($row = mysql_fetch_assoc($result))178 while ($row = pwg_db_fetch_assoc($result)) 179 179 { 180 180 $query = ' … … 183 183 WHERE group_id = '.$row['id'].' 184 184 ;'; 185 list($counter) = mysql_fetch_row(pwg_query($query));185 list($counter) = pwg_db_fetch_row(pwg_query($query)); 186 186 187 187 $template->append( -
trunk/admin/group_perm.php
r4265 r4325 80 80 ;'; 81 81 $result = pwg_query($query); 82 while ($row = mysql_fetch_assoc($result))82 while ($row = pwg_db_fetch_assoc($result)) 83 83 { 84 84 array_push($private_uppercats, $row['id']); … … 97 97 $result = pwg_query($query); 98 98 99 while ($row = mysql_fetch_assoc($result))99 while ($row = pwg_db_fetch_assoc($result)) 100 100 { 101 101 array_push($authorized_ids, $row['cat_id']); … … 158 158 $result = pwg_query($query_true); 159 159 $authorized_ids = array(); 160 while ($row = mysql_fetch_assoc($result))160 while ($row = pwg_db_fetch_assoc($result)) 161 161 { 162 162 array_push($authorized_ids, $row['id']); -
trunk/admin/history.php
r4304 r4325 111 111 '*', 112 112 '%', 113 mysql_real_escape_string($_POST['filename'])113 pwg_db_real_escape_string($_POST['filename']) 114 114 ); 115 115 } … … 137 137 pwg_query($query); 138 138 139 $search_id = mysql_insert_id();139 $search_id = pwg_db_insert_id(); 140 140 141 141 redirect( … … 178 178 WHERE id = '.$page['search_id'].' 179 179 ;'; 180 list($serialized_rules) = mysql_fetch_row(pwg_query($query));180 list($serialized_rules) = pwg_db_fetch_row(pwg_query($query)); 181 181 182 182 $page['search'] = unserialize($serialized_rules); … … 199 199 pwg_query($query); 200 200 201 $search_id = mysql_insert_id();201 $search_id = pwg_db_insert_id(); 202 202 203 203 redirect( … … 258 258 259 259 $username_of = array(); 260 while ($row = mysql_fetch_assoc($result))260 while ($row = pwg_db_fetch_assoc($result)) 261 261 { 262 262 $username_of[$row['id']] = stripslashes($row['username']); … … 306 306 307 307 $result = pwg_query($query); 308 while ($row = mysql_fetch_assoc($result))308 while ($row = pwg_db_fetch_assoc($result)) 309 309 { 310 310 $label_of_image[ $row['id'] ] = $row['label']; … … 342 342 343 343 $result = pwg_query($query); 344 while ($row = mysql_fetch_assoc($result))344 while ($row = pwg_db_fetch_assoc($result)) 345 345 { 346 346 $name_of_tag[ $row['id'] ] = $row['name']; -
trunk/admin/include/c13y_internal.class.php
r4304 r4325 43 43 $check_list[] = array('type' => 'PHP', 'current' => phpversion(), 'required' => REQUIRED_PHP_VERSION); 44 44 45 list($mysql_version) = mysql_fetch_row(pwg_query('SELECT VERSION();'));46 $check_list[] = array('type' => 'MySQL', 'current' => $ mysql_version, 'required' => REQUIRED_MYSQL_VERSION);45 $db_version = pwg_get_db_version(); 46 $check_list[] = array('type' => 'MySQL', 'current' => $db_version, 'required' => REQUIRED_MYSQL_VERSION); 47 47 48 48 foreach ($check_list as $elem) … … 127 127 128 128 $result = pwg_query($query); 129 while ($row = mysql_fetch_assoc($result))129 while ($row = pwg_db_fetch_assoc($result)) 130 130 { 131 131 $status[$row['id']] = $row['status']; -
trunk/admin/include/functions.php
r4304 r4325 37 37 $result = pwg_query($query); 38 38 $category_ids = array(); 39 while ($row = mysql_fetch_assoc($result))39 while ($row = pwg_db_fetch_assoc($result)) 40 40 { 41 41 array_push($category_ids, $row['id']); … … 78 78 $result = pwg_query($query); 79 79 $element_ids = array(); 80 while ($row = mysql_fetch_assoc($result))80 while ($row = pwg_db_fetch_assoc($result)) 81 81 { 82 82 array_push($element_ids, $row['id']); … … 160 160 ;'; 161 161 $result = pwg_query($query); 162 while ($row = mysql_fetch_assoc($result))162 while ($row = pwg_db_fetch_assoc($result)) 163 163 { 164 164 $file_path = $row['path']; … … 410 410 411 411 /** 412 * inserts multiple lines in a table413 *414 * @param string table_name415 * @param array dbfields416 * @param array inserts417 * @return void418 */419 function mass_inserts($table_name, $dbfields, $datas)420 {421 if (count($datas) != 0)422 {423 $first = true;424 425 $query = 'SHOW VARIABLES LIKE \'max_allowed_packet\'';426 list(, $packet_size) = mysql_fetch_row(pwg_query($query));427 $packet_size = $packet_size - 2000; // The last list of values MUST not exceed 2000 character*/428 $query = '';429 430 foreach ($datas as $insert)431 {432 if (strlen($query) >= $packet_size)433 {434 pwg_query($query);435 $first = true;436 }437 438 if ($first)439 {440 $query = '441 INSERT INTO '.$table_name.'442 ('.implode(',', $dbfields).')443 VALUES';444 $first = false;445 }446 else447 {448 $query .= '449 , ';450 }451 452 $query .= '(';453 foreach ($dbfields as $field_id => $dbfield)454 {455 if ($field_id > 0)456 {457 $query .= ',';458 }459 460 if (!isset($insert[$dbfield]) or $insert[$dbfield] === '')461 {462 $query .= 'NULL';463 }464 else465 {466 $query .= "'".$insert[$dbfield]."'";467 }468 }469 $query .= ')';470 }471 pwg_query($query);472 }473 }474 475 define('MASS_UPDATES_SKIP_EMPTY', 1);476 /**477 * updates multiple lines in a table478 *479 * @param string table_name480 * @param array dbfields481 * @param array datas482 * @param int flags - if MASS_UPDATES_SKIP_EMPTY - empty values do not overwrite existing ones483 * @return void484 */485 function mass_updates($tablename, $dbfields, $datas, $flags=0)486 {487 if (count($datas) == 0)488 return;489 // depending on the MySQL version, we use the multi table update or N update queries490 if (count($datas) < 10 or version_compare(mysql_get_server_info(), '4.0.4') < 0)491 { // MySQL is prior to version 4.0.4, multi table update feature is not available492 foreach ($datas as $data)493 {494 $query = '495 UPDATE '.$tablename.'496 SET ';497 $is_first = true;498 foreach ($dbfields['update'] as $key)499 {500 $separator = $is_first ? '' : ",\n ";501 502 if (isset($data[$key]) and $data[$key] != '')503 {504 $query.= $separator.$key.' = \''.$data[$key].'\'';505 }506 else507 {508 if ($flags & MASS_UPDATES_SKIP_EMPTY )509 continue; // next field510 $query.= "$separator$key = NULL";511 }512 $is_first = false;513 }514 if (!$is_first)515 {// only if one field at least updated516 $query.= '517 WHERE ';518 $is_first = true;519 foreach ($dbfields['primary'] as $key)520 {521 if (!$is_first)522 {523 $query.= ' AND ';524 }525 if ( isset($data[$key]) )526 {527 $query.= $key.' = \''.$data[$key].'\'';528 }529 else530 {531 $query.= $key.' IS NULL';532 }533 $is_first = false;534 }535 pwg_query($query);536 }537 } // foreach update538 } // if mysql_ver or count<X539 else540 {541 // creation of the temporary table542 $query = '543 SHOW FULL COLUMNS FROM '.$tablename;544 $result = pwg_query($query);545 $columns = array();546 $all_fields = array_merge($dbfields['primary'], $dbfields['update']);547 while ($row = mysql_fetch_assoc($result))548 {549 if (in_array($row['Field'], $all_fields))550 {551 $column = $row['Field'];552 $column.= ' '.$row['Type'];553 554 $nullable = true;555 if (!isset($row['Null']) or $row['Null'] == '' or $row['Null']=='NO')556 {557 $column.= ' NOT NULL';558 $nullable = false;559 }560 if (isset($row['Default']))561 {562 $column.= " default '".$row['Default']."'";563 }564 elseif ($nullable)565 {566 $column.= " default NULL";567 }568 if (isset($row['Collation']) and $row['Collation'] != 'NULL')569 {570 $column.= " collate '".$row['Collation']."'";571 }572 array_push($columns, $column);573 }574 }575 576 $temporary_tablename = $tablename.'_'.micro_seconds();577 578 $query = '579 CREATE TABLE '.$temporary_tablename.'580 (581 '.implode(",\n ", $columns).',582 UNIQUE KEY the_key ('.implode(',', $dbfields['primary']).')583 )';584 585 pwg_query($query);586 mass_inserts($temporary_tablename, $all_fields, $datas);587 if ( $flags & MASS_UPDATES_SKIP_EMPTY )588 $func_set = create_function('$s', 'return "t1.$s = IFNULL(t2.$s, t1.$s)";');589 else590 $func_set = create_function('$s', 'return "t1.$s = t2.$s";');591 592 // update of images table by joining with temporary table593 $query = '594 UPDATE '.$tablename.' AS t1, '.$temporary_tablename.' AS t2595 SET '.596 implode(597 "\n , ",598 array_map($func_set,$dbfields['update'])599 ).'600 WHERE '.601 implode(602 "\n AND ",603 array_map(604 create_function('$s', 'return "t1.$s = t2.$s";'),605 $dbfields['primary']606 )607 );608 pwg_query($query);609 $query = '610 DROP TABLE '.$temporary_tablename;611 pwg_query($query);612 }613 }614 615 /**616 412 * order categories (update categories.rank and global_rank database fields) 617 413 * so that rank field are consecutive integers starting at 1 for each child … … 631 427 632 428 $result = pwg_query($query); 633 while ($row = mysql_fetch_assoc($result))429 while ($row = pwg_db_fetch_assoc($result)) 634 430 { 635 431 if ($row['id_uppercat'] != $current_uppercat) … … 777 573 ;'; 778 574 $result = pwg_query($query); 779 while ($row = mysql_fetch_assoc($result))575 while ($row = pwg_db_fetch_assoc($result)) 780 576 { 781 577 $uppercats = array_merge($uppercats, … … 804 600 LIMIT 0,1 805 601 ;'; 806 list($representative) = mysql_fetch_row(pwg_query($query));602 list($representative) = pwg_db_fetch_row(pwg_query($query)); 807 603 808 604 array_push( … … 864 660 ;'; 865 661 $result = pwg_query($query); 866 while ($row = mysql_fetch_assoc($result))662 while ($row = pwg_db_fetch_assoc($result)) 867 663 { 868 664 array_push($categories, $row); … … 1140 936 $datas = array(); 1141 937 1142 while ($row = mysql_fetch_assoc($result))938 while ($row = pwg_db_fetch_assoc($result)) 1143 939 { 1144 940 array_push( … … 1207 1003 ;'; 1208 1004 $result = pwg_query($query); 1209 while ($row = mysql_fetch_assoc($result))1005 while ($row = pwg_db_fetch_assoc($result)) 1210 1006 { 1211 1007 $categories[$row['id']] = … … 1226 1022 WHERE id = '.$new_parent.' 1227 1023 ;'; 1228 list($new_parent_uppercats) = mysql_fetch_row(pwg_query($query));1024 list($new_parent_uppercats) = pwg_db_fetch_row(pwg_query($query)); 1229 1025 1230 1026 foreach ($categories as $category) … … 1271 1067 WHERE id = '.$new_parent.' 1272 1068 ;'; 1273 list($parent_status) = mysql_fetch_row(pwg_query($query));1069 list($parent_status) = pwg_db_fetch_row(pwg_query($query)); 1274 1070 } 1275 1071 … … 1356 1152 WHERE id_uppercat '.(is_numeric($parent_id) ? '= '.$parent_id : 'IS NULL').' 1357 1153 ;'; 1358 list($current_rank) = mysql_fetch_row(pwg_query($query));1154 list($current_rank) = pwg_db_fetch_row(pwg_query($query)); 1359 1155 1360 1156 $insert = array( … … 1372 1168 WHERE id = '.$parent_id.' 1373 1169 ;'; 1374 $parent = mysql_fetch_assoc(pwg_query($query));1170 $parent = pwg_db_fetch_assoc(pwg_query($query)); 1375 1171 1376 1172 $insert['id_uppercat'] = $parent['id']; … … 1418 1214 ); 1419 1215 1420 $inserted_id = mysql_insert_id();1216 $inserted_id = pwg_db_insert_id(); 1421 1217 1422 1218 $query = ' … … 1551 1347 ); 1552 1348 1553 $page['tag_id_from_tag_name_cache'][$tag_name] = mysql_insert_id();1349 $page['tag_id_from_tag_name_cache'][$tag_name] = pwg_db_insert_id(); 1554 1350 } 1555 1351 else … … 1593 1389 $inserts 1594 1390 ); 1595 }1596 }1597 1598 /**1599 * Do maintenance on all PWG tables1600 *1601 * @return none1602 */1603 function do_maintenance_all_tables()1604 {1605 global $prefixeTable, $page;1606 1607 $all_tables = array();1608 1609 // List all tables1610 $query = 'SHOW TABLES LIKE \''.$prefixeTable.'%\'';1611 $result = pwg_query($query);1612 while ($row = mysql_fetch_assoc($result))1613 {1614 array_push($all_tables, $row[0]);1615 }1616 1617 // Repair all tables1618 $query = 'REPAIR TABLE '.implode(', ', $all_tables);1619 $mysql_rc = pwg_query($query);1620 1621 // Re-Order all tables1622 foreach ($all_tables as $table_name)1623 {1624 $all_primary_key = array();1625 1626 $query = 'DESC '.$table_name.';';1627 $result = pwg_query($query);1628 while ($row = mysql_fetch_assoc($result))1629 {1630 if ($row['Key'] == 'PRI')1631 {1632 array_push($all_primary_key, $row['Field']);1633 }1634 }1635 1636 if (count($all_primary_key) != 0)1637 {1638 $query = 'ALTER TABLE '.$table_name.' ORDER BY '.implode(', ', $all_primary_key).';';1639 $mysql_rc = $mysql_rc && pwg_query($query);1640 }1641 }1642 1643 // Optimize all tables1644 $query = 'OPTIMIZE TABLE '.implode(', ', $all_tables);1645 $mysql_rc = $mysql_rc && pwg_query($query);1646 if ($mysql_rc)1647 {1648 array_push(1649 $page['infos'],1650 l10n('Optimizations completed')1651 );1652 }1653 else1654 {1655 array_push(1656 $page['errors'],1657 l10n('Optimizations errors')1658 );1659 1391 } 1660 1392 } … … 1890 1622 ); 1891 1623 1892 $inserted_id = mysql_insert_id();1624 $inserted_id = pwg_db_insert_id(); 1893 1625 1894 1626 return array( … … 2076 1808 ;'; 2077 1809 $result = pwg_query($query); 2078 if ( mysql_num_rows($result) > 0)2079 { 2080 list($groupname) = mysql_fetch_row($result);1810 if (pwg_db_num_rows($result) > 0) 1811 { 1812 list($groupname) = pwg_db_fetch_row($result); 2081 1813 } 2082 1814 else … … 2104 1836 ;'; 2105 1837 $result = pwg_query($query); 2106 if ( mysql_num_rows($result) > 0)2107 { 2108 list($username) = mysql_fetch_row($result);1838 if (pwg_db_num_rows($result) > 0) 1839 { 1840 list($username) = pwg_db_fetch_row($result); 2109 1841 } 2110 1842 else -
trunk/admin/include/functions_history.inc.php
r3282 r4325 166 166 $result = pwg_query($query); 167 167 168 while ($row = mysql_fetch_assoc($result))168 while ($row = pwg_db_fetch_assoc($result)) 169 169 { 170 170 array_push($data, $row); -
trunk/admin/include/functions_metadata.php
r4265 r4325 260 260 ;'; 261 261 $result = pwg_query($query); 262 while ($row = mysql_fetch_assoc($result))262 while ($row = pwg_db_fetch_assoc($result)) 263 263 { 264 264 array_push($cat_ids, $row['id']); … … 285 285 ;'; 286 286 $result = pwg_query($query); 287 while ($row = mysql_fetch_assoc($result))287 while ($row = pwg_db_fetch_assoc($result)) 288 288 { 289 289 $files[$row['id']] = $row['path']; -
trunk/admin/include/functions_notification_by_mail.inc.php
r4304 r4325 60 60 check_key = \''.$key.'\';'; 61 61 62 list($count) = mysql_fetch_row(pwg_query($query));62 list($count) = pwg_db_fetch_row(pwg_query($query)); 63 63 if ($count == 0) 64 64 { … … 168 168 if (!empty($result)) 169 169 { 170 while ($nbm_user = mysql_fetch_assoc($result))170 while ($nbm_user = pwg_db_fetch_assoc($result)) 171 171 { 172 172 array_push($data_users, $nbm_user); -
trunk/admin/include/functions_permalinks.php
r4265 r4325 52 52 $result = pwg_query($query); 53 53 $cat_id = null; 54 if ( mysql_num_rows($result) )55 list( $cat_id ) = mysql_fetch_row($result);54 if ( pwg_db_num_rows($result) ) 55 list( $cat_id ) = pwg_db_fetch_row($result); 56 56 return $cat_id; 57 57 } … … 73 73 ;'; 74 74 $result = pwg_query($query); 75 if ( mysql_num_rows($result) )76 { 77 list($permalink) = mysql_fetch_row($result);75 if ( pwg_db_num_rows($result) ) 76 { 77 list($permalink) = pwg_db_fetch_row($result); 78 78 } 79 79 if ( !isset($permalink) ) -
trunk/admin/include/functions_upgrade.php
r4280 r4325 113 113 $result = pwg_query($query); 114 114 $plugins = array(); 115 while ($row = mysql_fetch_assoc($result))115 while ($row = pwg_db_fetch_assoc($result)) 116 116 { 117 117 array_push($plugins, $row['id']); … … 139 139 if(!@get_magic_quotes_gpc()) 140 140 { 141 $username = mysql_real_escape_string($username);141 $username = pwg_db_real_escape_string($username); 142 142 } 143 143 … … 166 166 ;'; 167 167 } 168 $row = mysql_fetch_assoc(pwg_query($query));168 $row = pwg_db_fetch_assoc(pwg_query($query)); 169 169 170 170 if (!isset($conf['pass_convert'])) -
trunk/admin/intro.php
r3382 r4325 54 54 // if the current version is a BSF (development branch) build, we check 55 55 // the first line, for stable versions, we check the second line 56 if (preg_match('/^BSF/', $versions {'current'}))57 { 58 $versions {'latest'}= trim($lines[0]);56 if (preg_match('/^BSF/', $versions['current'])) 57 { 58 $versions['latest'] = trim($lines[0]); 59 59 60 60 // because integer are limited to 4,294,967,296 we need to split BSF … … 62 62 foreach ($versions as $key => $value) 63 63 { 64 $versions {$key}=64 $versions[$key] = 65 65 preg_replace('/BSF_(\d{8})(\d{4})/', '$1.$2', $value); 66 66 } … … 68 68 else 69 69 { 70 $versions {'latest'}= trim($lines[1]);71 } 72 73 if ('' == $versions {'latest'})70 $versions['latest'] = trim($lines[1]); 71 } 72 73 if ('' == $versions['latest']) 74 74 { 75 75 array_push( … … 80 80 // concatenation needed to avoid automatic transformation by release 81 81 // script generator 82 else if ('%'.'PWGVERSION'.'%' == $versions {'current'})82 else if ('%'.'PWGVERSION'.'%' == $versions['current']) 83 83 { 84 84 array_push( … … 87 87 ); 88 88 } 89 else if (version_compare($versions {'current'}, $versions{'latest'}) < 0)89 else if (version_compare($versions['current'], $versions['latest']) < 0) 90 90 { 91 91 array_push( … … 126 126 127 127 $php_current_timestamp = date("Y-m-d H:i:s"); 128 list($mysql_version, $db_current_timestamp) = mysql_fetch_row(pwg_query('SELECT VERSION(), CURRENT_TIMESTAMP;')); 128 $db_version = pwg_get_db_version(); 129 list($db_current_timestamp) = pwg_db_fetch_row(pwg_query('SELECT CURRENT_TIMESTAMP;')); 129 130 130 131 $query = ' … … 132 133 FROM '.IMAGES_TABLE.' 133 134 ;'; 134 list($nb_elements) = mysql_fetch_row(pwg_query($query));135 list($nb_elements) = pwg_db_fetch_row(pwg_query($query)); 135 136 136 137 $query = ' … … 138 139 FROM '.CATEGORIES_TABLE.' 139 140 ;'; 140 list($nb_categories) = mysql_fetch_row(pwg_query($query));141 list($nb_categories) = pwg_db_fetch_row(pwg_query($query)); 141 142 142 143 $query = ' … … 145 146 WHERE dir IS NULL 146 147 ;'; 147 list($nb_virtual) = mysql_fetch_row(pwg_query($query));148 list($nb_virtual) = pwg_db_fetch_row(pwg_query($query)); 148 149 149 150 $query = ' … … 152 153 WHERE dir IS NOT NULL 153 154 ;'; 154 list($nb_physical) = mysql_fetch_row(pwg_query($query));155 list($nb_physical) = pwg_db_fetch_row(pwg_query($query)); 155 156 156 157 $query = ' … … 158 159 FROM '.IMAGE_CATEGORY_TABLE.' 159 160 ;'; 160 list($nb_image_category) = mysql_fetch_row(pwg_query($query));161 list($nb_image_category) = pwg_db_fetch_row(pwg_query($query)); 161 162 162 163 $query = ' … … 164 165 FROM '.TAGS_TABLE.' 165 166 ;'; 166 list($nb_tags) = mysql_fetch_row(pwg_query($query));167 list($nb_tags) = pwg_db_fetch_row(pwg_query($query)); 167 168 168 169 $query = ' … … 170 171 FROM '.IMAGE_TAG_TABLE.' 171 172 ;'; 172 list($nb_image_tag) = mysql_fetch_row(pwg_query($query));173 list($nb_image_tag) = pwg_db_fetch_row(pwg_query($query)); 173 174 174 175 $query = ' … … 176 177 FROM '.USERS_TABLE.' 177 178 ;'; 178 list($nb_users) = mysql_fetch_row(pwg_query($query));179 list($nb_users) = pwg_db_fetch_row(pwg_query($query)); 179 180 180 181 $query = ' … … 182 183 FROM '.GROUPS_TABLE.' 183 184 ;'; 184 list($nb_groups) = mysql_fetch_row(pwg_query($query));185 list($nb_groups) = pwg_db_fetch_row(pwg_query($query)); 185 186 186 187 $query = ' … … 188 189 FROM '.COMMENTS_TABLE.' 189 190 ;'; 190 list($nb_comments) = mysql_fetch_row(pwg_query($query));191 list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); 191 192 192 193 $template->assign( … … 196 197 'OS' => PHP_OS, 197 198 'PHP_VERSION' => phpversion(), 198 'MYSQL_VERSION' => $mysql_version, 199 'DB_ENGINE' => 'MySQL', 200 'DB_VERSION' => $db_version, 199 201 'DB_ELEMENTS' => l10n_dec('%d element', '%d elements', $nb_elements), 200 202 'DB_CATEGORIES' => … … 224 226 FROM '.IMAGES_TABLE.' 225 227 ;'; 226 list($first_date) = mysql_fetch_row(pwg_query($query));228 list($first_date) = pwg_db_fetch_row(pwg_query($query)); 227 229 228 230 $template->assign( … … 244 246 WHERE validated=\'false\' 245 247 ;'; 246 list($nb_waiting) = mysql_fetch_row(pwg_query($query));248 list($nb_waiting) = pwg_db_fetch_row(pwg_query($query)); 247 249 248 250 if ($nb_waiting > 0) … … 263 265 WHERE validated=\'false\' 264 266 ;'; 265 list($nb_comments) = mysql_fetch_row(pwg_query($query));267 list($nb_comments) = pwg_db_fetch_row(pwg_query($query)); 266 268 267 269 if ($nb_comments > 0) -
trunk/admin/notification_by_mail.php
r4304 r4325 146 146 $result = pwg_query($query); 147 147 148 if ( mysql_num_rows($result) > 0)148 if (pwg_db_num_rows($result) > 0) 149 149 { 150 150 $inserts = array(); 151 151 $check_key_list = array(); 152 152 153 while ($nbm_user = mysql_fetch_assoc($result))153 while ($nbm_user = pwg_db_fetch_assoc($result)) 154 154 { 155 155 // Calculate key … … 239 239 if (in_array($action, array('list_to_send', 'send'))) 240 240 { 241 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));241 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 242 242 243 243 $is_action_send = ($action == 'send'); … … 513 513 // Update param 514 514 $result = pwg_query('select param, value from '.CONFIG_TABLE.' where param like \'nbm\\_%\''); 515 while ($nbm_user = mysql_fetch_assoc($result))515 while ($nbm_user = pwg_db_fetch_assoc($result)) 516 516 { 517 517 if (isset($_POST[$nbm_user['param']])) -
trunk/admin/permalinks.php
r3282 r4325 100 100 LIMIT 1'; 101 101 pwg_query($query); 102 if ( mysql_affected_rows()==0)102 if (pwg_db_affected_rows()==0) 103 103 array_push($page['errors'], 'Cannot delete the old permalink !'); 104 104 } … … 135 135 $categories=array(); 136 136 $result=pwg_query($query); 137 while ( $row =mysql_fetch_assoc($result) )137 while ( $row = pwg_db_fetch_assoc($result) ) 138 138 { 139 139 $row['name'] = get_cat_display_name_cache( $row['uppercats'] ); … … 163 163 $result = pwg_query($query); 164 164 $deleted_permalinks=array(); 165 while ( $row =mysql_fetch_assoc($result) )165 while ( $row = pwg_db_fetch_assoc($result) ) 166 166 { 167 167 $row['name'] = get_cat_display_name_cache($row['cat_id']); -
trunk/admin/picture_modify.php
r4265 r4325 45 45 WHERE id = '.$_GET['image_id'].' 46 46 ;'; 47 list($path) = mysql_fetch_row(pwg_query($query));47 list($path) = pwg_db_fetch_row(pwg_query($query)); 48 48 update_metadata(array($_GET['image_id'] => $path)); 49 49 … … 176 176 WHERE id = '.$_GET['image_id'].' 177 177 ;'; 178 $row = mysql_fetch_assoc(pwg_query($query));178 $row = pwg_db_fetch_assoc(pwg_query($query)); 179 179 180 180 $storage_category_id = null; … … 325 325 $result = pwg_query($query); 326 326 327 while ($row = mysql_fetch_assoc($result))327 while ($row = pwg_db_fetch_assoc($result)) 328 328 { 329 329 $name = … … 418 418 array_push($associateds, $storage_category_id); 419 419 } 420 while ($row = mysql_fetch_assoc($result))420 while ($row = pwg_db_fetch_assoc($result)) 421 421 { 422 422 array_push($associateds, $row['id']); -
trunk/admin/rating.php
r4304 r4325 95 95 ;'; 96 96 $result = pwg_query($query); 97 while ($row = mysql_fetch_assoc($result))97 while ($row = pwg_db_fetch_assoc($result)) 98 98 { 99 99 $users[$row['id']]=stripslashes($row['username']); … … 105 105 WHERE r.element_id=i.id'. $page['user_filter'] . 106 106 ';'; 107 list($nb_images) = mysql_fetch_row(pwg_query($query));107 list($nb_images) = pwg_db_fetch_row(pwg_query($query)); 108 108 109 109 … … 182 182 $images = array(); 183 183 $result = pwg_query($query); 184 while ($row = mysql_fetch_assoc($result))184 while ($row = pwg_db_fetch_assoc($result)) 185 185 { 186 186 array_push($images, $row); … … 200 200 ORDER BY date DESC;'; 201 201 $result = pwg_query($query); 202 $nb_rates = mysql_num_rows($result);202 $nb_rates = pwg_db_num_rows($result); 203 203 204 204 $tpl_image = … … 215 215 ); 216 216 217 while ($row = mysql_fetch_assoc($result))217 while ($row = pwg_db_fetch_assoc($result)) 218 218 { 219 219 -
trunk/admin/site_manager.php
r4265 r4325 99 99 WHERE galleries_url = \''.$url.'\' 100 100 ;'; 101 $row = mysql_fetch_assoc(pwg_query($query));101 $row = pwg_db_fetch_assoc(pwg_query($query)); 102 102 if ($row['count'] > 0) 103 103 { … … 168 168 WHERE id = '.$page['site'].' 169 169 ;'; 170 list($galleries_url) = mysql_fetch_row(pwg_query($query));170 list($galleries_url) = pwg_db_fetch_row(pwg_query($query)); 171 171 switch($_GET['action']) 172 172 { … … 237 237 $result = pwg_query($query); 238 238 239 while ($row = mysql_fetch_assoc($result))239 while ($row = pwg_db_fetch_assoc($result)) 240 240 { 241 241 $is_remote = url_is_remote($row['galleries_url']); -
trunk/admin/site_update.php
r4265 r4325 44 44 FROM '.SITES_TABLE.' 45 45 WHERE id = '.$site_id; 46 list($site_url) = mysql_fetch_row(pwg_query($query));46 list($site_url) = pwg_db_fetch_row(pwg_query($query)); 47 47 if (!isset($site_url)) 48 48 { … … 51 51 $site_is_remote = url_is_remote($site_url); 52 52 53 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));53 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 54 54 define('CURRENT_DATE', $dbnow); 55 55 … … 186 186 FROM '.CATEGORIES_TABLE; 187 187 $result = pwg_query($query); 188 while ($row = mysql_fetch_assoc($result))188 while ($row = pwg_db_fetch_assoc($result)) 189 189 { 190 190 $next_rank[$row['id']] = 1; … … 197 197 GROUP BY id_uppercat'; 198 198 $result = pwg_query($query); 199 while ($row = mysql_fetch_assoc($result))199 while ($row = pwg_db_fetch_assoc($result)) 200 200 { 201 201 // for the id_uppercat NULL, we write 'NULL' and not the empty string … … 211 211 SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id 212 212 FROM '.CATEGORIES_TABLE; 213 list($next_id) = mysql_fetch_row(pwg_query($query));213 list($next_id) = pwg_db_fetch_row(pwg_query($query)); 214 214 215 215 // retrieve sub-directories fulldirs from the site reader … … 247 247 ? 'false' 248 248 : boolean_to_string($conf['newcat_default_uploadable']), 249 'status' => $conf {'newcat_default_status'},250 'visible' => boolean_to_string($conf {'newcat_default_visible'}),249 'status' => $conf['newcat_default_status'], 250 'visible' => boolean_to_string($conf['newcat_default_visible']), 251 251 ); 252 252 … … 255 255 $parent = $db_fulldirs[dirname($fulldir)]; 256 256 257 $insert {'id_uppercat'}= $parent;258 $insert {'uppercats'}=259 $db_categories[$parent]['uppercats'].','.$insert {'id'};260 $insert {'rank'}= $next_rank[$parent]++;261 $insert {'global_rank'}=262 $db_categories[$parent]['global_rank'].'.'.$insert {'rank'};257 $insert['id_uppercat'] = $parent; 258 $insert['uppercats'] = 259 $db_categories[$parent]['uppercats'].','.$insert['id']; 260 $insert['rank'] = $next_rank[$parent]++; 261 $insert['global_rank'] = 262 $db_categories[$parent]['global_rank'].'.'.$insert['rank']; 263 263 if ('private' == $db_categories[$parent]['status']) 264 264 { 265 $insert {'status'}= 'private';265 $insert['status'] = 'private'; 266 266 } 267 267 if ('false' == $db_categories[$parent]['visible']) 268 268 { 269 $insert {'visible'}= 'false';269 $insert['visible'] = 'false'; 270 270 } 271 271 } 272 272 else 273 273 { 274 $insert {'uppercats'} = $insert{'id'};274 $insert['uppercats'] = $insert['id']; 275 275 $insert{'rank'} = $next_rank['NULL']++; 276 $insert {'global_rank'} = $insert{'rank'};276 $insert['global_rank'] = $insert['rank']; 277 277 } 278 278 … … 289 289 $db_categories[$insert{'id'}] = 290 290 array( 291 'id' => $insert {'id'},292 'status' => $insert {'status'},293 'visible' => $insert {'visible'},294 'uppercats' => $insert {'uppercats'},295 'global_rank' => $insert {'global_rank'}291 'id' => $insert['id'], 292 'status' => $insert['status'], 293 'visible' => $insert['visible'], 294 'uppercats' => $insert['uppercats'], 295 'global_rank' => $insert['global_rank'] 296 296 ); 297 $db_fulldirs[$fulldir] = $insert {'id'};297 $db_fulldirs[$fulldir] = $insert['id']; 298 298 $next_rank[$insert{'id'}] = 1; 299 299 } … … 387 387 AND validated = \'false\''; 388 388 $result = pwg_query($query); 389 while ($row = mysql_fetch_assoc($result))389 while ($row = pwg_db_fetch_assoc($result)) 390 390 { 391 391 array_push( … … 403 403 SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id 404 404 FROM '.IMAGES_TABLE; 405 list($next_element_id) = mysql_fetch_row(pwg_query($query));405 list($next_element_id) = pwg_db_fetch_row(pwg_query($query)); 406 406 407 407 $start = get_moment(); … … 471 471 $insert_links, 472 472 array( 473 'image_id' => $insert {'id'},473 'image_id' => $insert['id'], 474 474 'category_id' => $insert['storage_category_id'], 475 475 ) … … 479 479 $infos, 480 480 array( 481 'path' => $insert {'path'},481 'path' => $insert['path'], 482 482 'info' => l10n('update_research_added') 483 483 ) … … 556 556 $waiting_to_delete = array(); 557 557 558 while ($row = mysql_fetch_assoc($result))558 while ($row = pwg_db_fetch_assoc($result)) 559 559 { 560 560 $data = array(); … … 565 565 WHERE storage_category_id = '.$row['storage_category_id'].' 566 566 AND file = \''.$row['file'].'\''; 567 list($data['id']) = mysql_fetch_row(pwg_query($query));567 list($data['id']) = pwg_db_fetch_row(pwg_query($query)); 568 568 569 569 foreach ($fields['update'] as $field) -
trunk/admin/stats.php
r4265 r4325 96 96 97 97 $output = array(); 98 while ($row = mysql_fetch_assoc($result))98 while ($row = pwg_db_fetch_assoc($result)) 99 99 { 100 100 array_push($output, $row); … … 134 134 $first_time_key = null; 135 135 136 while ($row = mysql_fetch_assoc($result))136 while ($row = pwg_db_fetch_assoc($result)) 137 137 { 138 138 $time_keys = array( … … 205 205 ;'; 206 206 $result = pwg_query($query); 207 while ($row = mysql_fetch_assoc($result))207 while ($row = pwg_db_fetch_assoc($result)) 208 208 { 209 209 $key = sprintf('%4u', $row['year']); -
trunk/admin/tags.php
r4265 r4325 50 50 ;'; 51 51 $result = pwg_query($query); 52 while ($row = mysql_fetch_assoc($result))52 while ($row = pwg_db_fetch_assoc($result)) 53 53 { 54 54 $current_name_of[ $row['id'] ] = $row['name']; … … 221 221 ;'; 222 222 $result = pwg_query($query); 223 while ($row = mysql_fetch_assoc($result))223 while ($row = pwg_db_fetch_assoc($result)) 224 224 { 225 225 $name_of[ $row['id'] ] = $row['name']; -
trunk/admin/template/goto/intro.tpl
r3722 r4325 31 31 <li>PHP: {$PHP_VERSION} (<a href="{$U_PHPINFO}" onclick="window.open(this.href, ''); 32 32 return false;">{'Show info'|@translate}</a>) [{$PHP_DATATIME}]</li> 33 <li> MySQL: {$MYSQL_VERSION} [{$DB_DATATIME}]</li>33 <li>{$DB_ENGINE}: {$DB_VERSION} [{$DB_DATATIME}]</li> 34 34 </ul> 35 35 </dd> -
trunk/admin/thumbnail.php
r3747 r4325 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 $basedir = preg_replace('#/*$#', '', $row['galleries_url']); -
trunk/admin/upload.php
r4304 r4325 101 101 ;'; 102 102 $result = pwg_query($query); 103 while($row = mysql_fetch_assoc($result))103 while($row = pwg_db_fetch_assoc($result)) 104 104 { 105 105 $dir = get_complete_dir($row['storage_category_id']); … … 154 154 $query.= ';'; 155 155 $result = pwg_query( $query ); 156 while ( $row = mysql_fetch_assoc( $result ) )156 while ( $row = pwg_db_fetch_assoc( $result ) ) 157 157 { 158 158 if ( !isset( $cat_names[$row['storage_category_id']] ) ) -
trunk/admin/user_list.php
r4304 r4325 50 50 { 51 51 $username = str_replace('*', '%', $_GET['username']); 52 $filter['username'] = mysql_real_escape_string($username);52 $filter['username'] = pwg_db_real_escape_string($username); 53 53 } 54 54 … … 116 116 117 117 $result = pwg_query($query); 118 while ($row = mysql_fetch_assoc($result))118 while ($row = pwg_db_fetch_assoc($result)) 119 119 { 120 120 $user = $row; … … 140 140 ;'; 141 141 $result = pwg_query($query); 142 while ($row = mysql_fetch_assoc($result))142 while ($row = pwg_db_fetch_assoc($result)) 143 143 { 144 144 array_push( … … 493 493 $result = pwg_query($query); 494 494 495 while ($row = mysql_fetch_assoc($result))495 while ($row = pwg_db_fetch_assoc($result)) 496 496 { 497 497 $groups[$row['id']] = $row['name']; -
trunk/admin/user_perm.php
r4265 r4325 79 79 ;'; 80 80 $result = pwg_query($query); 81 while ($row = mysql_fetch_assoc($result))81 while ($row = pwg_db_fetch_assoc($result)) 82 82 { 83 83 array_push($private_uppercats, $row['id']); … … 96 96 $result = pwg_query($query); 97 97 98 while ($row = mysql_fetch_assoc($result))98 while ($row = pwg_db_fetch_assoc($result)) 99 99 { 100 100 array_push($authorized_ids, $row['cat_id']); … … 156 156 $result = pwg_query($query); 157 157 158 if ( mysql_num_rows($result) > 0)158 if (pwg_db_num_rows($result) > 0) 159 159 { 160 160 $cats = array(); 161 while ($row = mysql_fetch_assoc($result))161 while ($row = pwg_db_fetch_assoc($result)) 162 162 { 163 163 array_push($cats, $row); … … 192 192 $result = pwg_query($query_true); 193 193 $authorized_ids = array(); 194 while ($row = mysql_fetch_assoc($result))194 while ($row = pwg_db_fetch_assoc($result)) 195 195 { 196 196 array_push($authorized_ids, $row['id']); -
trunk/comments.php
r4182 r4325 284 284 AND ', $page['where_clauses']).' 285 285 ;'; 286 list($counter) = mysql_fetch_row(pwg_query($query));286 list($counter) = pwg_db_fetch_row(pwg_query($query)); 287 287 288 288 $url = PHPWG_ROOT_PATH … … 332 332 ;'; 333 333 $result = pwg_query($query); 334 while ($row = mysql_fetch_assoc($result))334 while ($row = pwg_db_fetch_assoc($result)) 335 335 { 336 336 array_push($comments, $row); … … 349 349 ;'; 350 350 $result = pwg_query($query); 351 while ($row = mysql_fetch_assoc($result))351 while ($row = pwg_db_fetch_assoc($result)) 352 352 { 353 353 $elements[$row['id']] = $row; -
trunk/feed.php
r4304 r4325 76 76 WHERE id = \''.$feed_id.'\' 77 77 ;'; 78 $feed_row = mysql_fetch_assoc(pwg_query($query));78 $feed_row = pwg_db_fetch_assoc(pwg_query($query)); 79 79 if ( empty($feed_row) ) 80 80 { … … 98 98 check_status(ACCESS_GUEST); 99 99 100 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));100 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 101 101 102 102 include_once(PHPWG_ROOT_PATH.'include/feedcreator.class.php'); -
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 { -
trunk/install.php
r4280 r4325 365 365 // make PWG avoid upgrading, we must tell it upgrades have already been 366 366 // made. 367 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));367 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 368 368 define('CURRENT_DATE', $dbnow); 369 369 $datas = array(); -
trunk/install/db/1-database.php
r3282 r4325 33 33 // +-----------------------------------------------------------------------+ 34 34 35 list($now) = mysql_fetch_row(pwg_query('SELECT NOW()'));35 list($now) = pwg_db_fetch_row(pwg_query('SELECT NOW()')); 36 36 echo 37 37 $now -
trunk/install/db/12-database.php
r4265 r4325 67 67 $datas = array(); 68 68 69 while ($row = mysql_fetch_assoc($result))69 while ($row = pwg_db_fetch_assoc($result)) 70 70 { 71 71 array_push( -
trunk/install/db/18-database.php
r4265 r4325 48 48 $datas = array(); 49 49 50 while ($row = mysql_fetch_assoc($result))50 while ($row = pwg_db_fetch_assoc($result)) 51 51 { 52 52 array_push( -
trunk/install/db/19-database.php
r4265 r4325 69 69 ;'; 70 70 $result = pwg_query($query); 71 while ($row = mysql_fetch_assoc($result))71 while ($row = pwg_db_fetch_assoc($result)) 72 72 { 73 73 foreach(preg_split('/[,]+/', $row['keywords']) as $keyword) -
trunk/install/db/20-database.php
r4265 r4325 48 48 49 49 $datas = array(); 50 while ($row = mysql_fetch_assoc($result))50 while ($row = pwg_db_fetch_assoc($result)) 51 51 { 52 52 array_push( -
trunk/install/db/65-database.php
r4280 r4325 109 109 GROUP BY language'; 110 110 $result = pwg_query($query); 111 while ( $row= mysql_fetch_assoc($result) )111 while ( $row=pwg_db_fetch_assoc($result) ) 112 112 { 113 113 $language = $row["language"]; … … 142 142 WHERE user_id='.$conf['webmaster_id']; 143 143 $result = pwg_query($query); 144 if ( mysql_num_rows($result)==0)144 if (pwg_db_num_rows($result)==0) 145 145 { 146 146 $query=' … … 151 151 } 152 152 153 if ( $row= mysql_fetch_assoc($result) )153 if ( $row=pwg_db_fetch_assoc($result) ) 154 154 { 155 155 $admin_charset = $all_langs[$row['language']]['charset']; … … 166 166 $query = 'SHOW TABLES LIKE "'.$prefixeTable.'%"'; 167 167 $result = pwg_query($query); 168 while ( $row= mysql_fetch_assoc($result) )168 while ( $row=pwg_db_fetch_assoc($result) ) 169 169 { 170 170 array_push($all_tables, $row[0]); … … 177 177 $result = pwg_query($query); 178 178 $field_definitions=array(); 179 while ( $row= mysql_fetch_assoc($result) )179 while ( $row=pwg_db_fetch_assoc($result) ) 180 180 { 181 181 if ( !isset($row['Collation']) or $row['Collation']=='NULL' ) -
trunk/install/db/8-database.php
r4265 r4325 61 61 $query = 'SELECT param FROM '.PREFIX_TABLE.'config'; 62 62 $result = pwg_query($query); 63 while ($row = mysql_fetch_assoc($result))63 while ($row = pwg_db_fetch_assoc($result)) 64 64 { 65 65 unset( $params[ $row['param'] ] ); -
trunk/install/db/9-database.php
r4265 r4325 48 48 $datas = array(); 49 49 50 while ($row = mysql_fetch_assoc($result))50 while ($row = pwg_db_fetch_assoc($result)) 51 51 { 52 52 array_push( -
trunk/install/upgrade_1.3.0.php
r4265 r4325 85 85 ;'; 86 86 $result = pwg_query($query); 87 while ($row = mysql_fetch_assoc($result))87 while ($row = pwg_db_fetch_assoc($result)) 88 88 { 89 89 if (!isset($row['id_uppercat']) or $row['id_uppercat'] == '') -
trunk/install/upgrade_1.3.1.php
r4280 r4325 43 43 FROM '.PREFIX_TABLE.'config 44 44 ;'; 45 $save = mysql_fetch_assoc(pwg_query($query));45 $save = pwg_db_fetch_assoc(pwg_query($query)); 46 46 47 47 $queries = array( … … 345 345 ;'; 346 346 $result = pwg_query($query); 347 while ($row = mysql_fetch_assoc($result))347 while ($row = pwg_db_fetch_assoc($result)) 348 348 { 349 349 if ($row['Key_name'] != 'PRIMARY') … … 537 537 ;'; 538 538 $result = pwg_query($query); 539 while ($row = mysql_fetch_assoc($result))539 while ($row = pwg_db_fetch_assoc($result)) 540 540 { 541 541 array_push($cat_ids, $row['unique_storage_category_id']); … … 562 562 ;'; 563 563 $result = pwg_query($query); 564 while ($row = mysql_fetch_assoc($result))564 while ($row = pwg_db_fetch_assoc($result)) 565 565 { 566 566 array_push($cat_ids, $row['id']); -
trunk/install/upgrade_1.4.0.php
r4265 r4325 43 43 WHERE param = \'prefix_thumbnail\' 44 44 ;'; 45 list($prefix_thumbnail) = mysql_fetch_row(pwg_query($query));45 list($prefix_thumbnail) = pwg_db_fetch_row(pwg_query($query)); 46 46 47 47 // delete obsolete configuration … … 192 192 193 193 $datas = array(); 194 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));194 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 195 195 196 196 $result = pwg_query($query); 197 while ($row = mysql_fetch_assoc($result))197 while ($row = pwg_db_fetch_assoc($result)) 198 198 { 199 199 $row['user_id'] = $row['id']; -
trunk/install/upgrade_1.5.0.php
r4265 r4325 80 80 ;'; 81 81 $result = pwg_query($query); 82 while ($row = mysql_fetch_assoc($result))82 while ($row = pwg_db_fetch_assoc($result)) 83 83 { 84 84 foreach(preg_split('/[,]+/', $row['keywords']) as $keyword) … … 352 352 $query = 'SELECT param FROM '.PREFIX_TABLE.'config'; 353 353 $result = pwg_query($query); 354 while ($row = mysql_fetch_assoc($result))354 while ($row = pwg_db_fetch_assoc($result)) 355 355 { 356 356 unset( $params[ $row['param'] ] ); … … 453 453 $result = pwg_query($query); 454 454 455 while ($row = mysql_fetch_assoc($result))455 while ($row = pwg_db_fetch_assoc($result)) 456 456 { 457 457 if (!in_array($row['Field'], $to_keep)) -
trunk/install/upgrade_1.7.0.php
r3282 r4325 36 36 define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db'); 37 37 38 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));38 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 39 39 define('CURRENT_DATE', $dbnow); 40 40 -
trunk/password.php
r4304 r4325 57 57 else if (isset($_POST['mail_address']) and !empty($_POST['mail_address'])) 58 58 { 59 $mail_address = mysql_real_escape_string($_POST['mail_address']);59 $mail_address = pwg_db_real_escape_string($_POST['mail_address']); 60 60 61 61 $query = ' … … 75 75 $result = pwg_query($query); 76 76 77 if ( mysql_num_rows($result) > 0)77 if (pwg_db_num_rows($result) > 0) 78 78 { 79 79 $error_on_mail = false; 80 80 $datas = array(); 81 81 82 while ($row = mysql_fetch_assoc($result))82 while ($row = pwg_db_fetch_assoc($result)) 83 83 { 84 84 $new_password = generate_key(6); -
trunk/picture.php
r4265 r4325 58 58 '.%" ESCAPE "/" LIMIT 1'; 59 59 } 60 if ( ! ( $row = mysql_fetch_assoc(pwg_query($query)) ) )60 if ( ! ( $row = pwg_db_fetch_assoc(pwg_query($query)) ) ) 61 61 {// element does not exist 62 62 page_not_found( 'The requested image does not exist', … … 94 94 ).' 95 95 LIMIT 1'; 96 if ( mysql_num_rows( pwg_query($query) ) == 0 )96 if ( pwg_db_num_rows( pwg_query($query) ) == 0 ) 97 97 { 98 98 access_denied(); … … 388 388 $result = pwg_query($query); 389 389 $related_categories = array(); 390 while ($row = mysql_fetch_assoc($result))390 while ($row = pwg_db_fetch_assoc($result)) 391 391 { 392 392 array_push($related_categories, $row); … … 416 416 $result = pwg_query($query); 417 417 418 while ($row = mysql_fetch_assoc($result))418 while ($row = pwg_db_fetch_assoc($result)) 419 419 { 420 420 if (isset($page['previous_item']) and $row['id'] == $page['previous_item']) … … 768 768 ;'; 769 769 $result = pwg_query($query); 770 $row = mysql_fetch_assoc($result);770 $row = pwg_db_fetch_assoc($result); 771 771 772 772 if ($row['nb_fav'] == 0) -
trunk/profile.php
r4304 r4325 56 56 ;'; 57 57 $result = pwg_query($query); 58 $default_user = mysql_fetch_assoc($result);58 $default_user = pwg_db_fetch_assoc($result); 59 59 $userdata = array_merge($userdata, $default_user); 60 60 } … … 163 163 WHERE '.$conf['user_fields']['id'].' = \''.$userdata['id'].'\' 164 164 ;'; 165 list($current_password) = mysql_fetch_row(pwg_query($query));165 list($current_password) = pwg_db_fetch_row(pwg_query($query)); 166 166 167 167 if ($conf['pass_convert']($_POST['password']) != $current_password) -
trunk/qsearch.php
r3282 r4325 61 61 ;'; 62 62 pwg_query($query); 63 $search_id = mysql_insert_id();63 $search_id = pwg_db_insert_id(); 64 64 } 65 65 -
trunk/search.php
r3282 r4325 137 137 pwg_query($query); 138 138 139 $search_id = mysql_insert_id();139 $search_id = pwg_db_insert_id(); 140 140 } 141 141 else -
trunk/search_rules.php
r4265 r4325 136 136 if (!empty($result)) 137 137 { 138 while ($row = mysql_fetch_assoc($result))138 while ($row = pwg_db_fetch_assoc($result)) 139 139 { 140 140 array_push($categories, $row); -
trunk/upgrade.php
r4280 r4325 44 44 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); 45 45 @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); 46 include(PHPWG_ROOT_PATH .'include/dblayer/functions_mysql.inc.php'); 46 47 47 48 prepare_conf_upgrade(); … … 51 52 52 53 // Database connection 53 mysql_connect( $conf['db_host'], $conf['db_user'], $conf['db_password'] ) or die ( "Could not connect to database server" ); 54 mysql_select_db( $conf['db_base'] ) or die ( "Could not connect to database" ); 55 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') 56 and defined('DB_CHARSET') and DB_CHARSET!='' ) 57 { 58 pwg_query('SET NAMES "'.DB_CHARSET.'"'); 59 } 54 $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], 55 $conf['db_password'], $conf['db_base']) 56 or my_error('pwg_db_connect', true); 57 58 pwg_db_check_charset(); 60 59 61 60 // +-----------------------------------------------------------------------+ … … 77 76 $result = pwg_query($query); 78 77 79 while ($row = mysql_fetch_row($result))78 while ($row = pwg_db_fetch_row($result)) 80 79 { 81 80 if (preg_match('/^'.PREFIX_TABLE.'/', $row[0])) … … 106 105 $columns_of[$table] = array(); 107 106 108 while ($row = mysql_fetch_row($result))107 while ($row = pwg_db_fetch_row($result)) 109 108 { 110 109 array_push($columns_of[$table], $row[0]); -
trunk/upgrade_feed.php
r4280 r4325 36 36 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); 37 37 @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); 38 include(PHPWG_ROOT_PATH .'include/dblayer/functions_mysql.inc.php'); 38 39 39 40 // +-----------------------------------------------------------------------+ … … 55 56 // +-----------------------------------------------------------------------+ 56 57 57 mysql_connect($conf['db_host'], $conf['db_user'], $conf['db_password']) or die("Could not connect to database server"); 58 mysql_select_db($conf['db_base']) or die("Could not connect to database"); 59 if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') 60 and defined('DB_CHARSET') and DB_CHARSET!='' ) 61 { 62 pwg_query('SET NAMES "'.DB_CHARSET.'"'); 63 } 58 $pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], 59 $conf['db_password'], $conf['db_base']) 60 or my_error('pwg_db_connect', true); 64 61 62 pwg_db_check_charset(); 65 63 66 64 // +-----------------------------------------------------------------------+ -
trunk/upload.php
r4304 r4325 249 249 $query.= ';'; 250 250 pwg_query( $query ); 251 $page['waiting_id'] = mysql_insert_id();251 $page['waiting_id'] = pwg_db_insert_id(); 252 252 253 253 if ($conf['email_admin_on_picture_uploaded']) … … 289 289 $query.= ';'; 290 290 $result= pwg_query( $query ); 291 $row = mysql_fetch_assoc( $result );291 $row = pwg_db_fetch_assoc( $result ); 292 292 $file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") ); 293 293 $extension = get_extension( $_FILES['picture']['name'] );
Note: See TracChangeset
for help on using the changeset viewer.