aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin.php6
-rw-r--r--admin/admin_upload.php4
-rw-r--r--admin/cat_list.php28
-rw-r--r--admin/cat_modify.php14
-rw-r--r--admin/cat_perm.php20
-rw-r--r--admin/configuration.php6
-rw-r--r--admin/group_list.php10
-rw-r--r--admin/group_perm.php10
-rw-r--r--admin/images/global_stats.img.php2
-rw-r--r--admin/include/functions.php74
-rw-r--r--admin/include/functions_metadata.php20
-rw-r--r--admin/infos_images.php24
-rw-r--r--admin/picture_modify.php22
-rw-r--r--admin/remote_site.php32
-rw-r--r--admin/search.php2
-rw-r--r--admin/stats.php8
-rw-r--r--admin/update.php32
-rw-r--r--admin/user_list.php8
-rw-r--r--admin/user_modify.php12
-rw-r--r--admin/user_perm.php14
-rw-r--r--admin/user_search.php8
-rw-r--r--admin/waiting.php8
-rw-r--r--comments.php10
-rw-r--r--identification.php2
-rw-r--r--include/category_calendar.inc.php16
-rw-r--r--include/category_default.inc.php4
-rw-r--r--include/category_recent_cats.inc.php4
-rw-r--r--include/category_subcats.inc.php6
-rw-r--r--include/common.inc.php2
-rw-r--r--include/config.inc.php2
-rw-r--r--include/constants.php4
-rw-r--r--include/functions.inc.php40
-rw-r--r--include/functions_category.inc.php38
-rw-r--r--include/functions_group.inc.php6
-rw-r--r--include/functions_session.inc.php4
-rw-r--r--include/functions_user.inc.php20
-rw-r--r--include/user.inc.php6
-rw-r--r--picture.php46
-rw-r--r--profile.php6
-rw-r--r--upload.php8
40 files changed, 299 insertions, 289 deletions
diff --git a/admin.php b/admin.php
index f302dab33..a7d9041f9 100644
--- a/admin.php
+++ b/admin.php
@@ -53,7 +53,7 @@ switch ( $_GET['page'] )
$query = 'SELECT name FROM '.GROUPS_TABLE;
$query.= ' WHERE id = '.$_GET['group_id'];
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
if ( mysql_num_rows( $result ) > 0 )
{
$row = mysql_fetch_array( $result );
@@ -141,7 +141,7 @@ if ( $title == '' ) $title = $lang['title_default'];
$query = 'SELECT id FROM '.WAITING_TABLE;
$query.= " WHERE validated='false'";
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$nb_waiting = '';
if ( mysql_num_rows( $result ) > 0 )
{
@@ -151,7 +151,7 @@ if ( mysql_num_rows( $result ) > 0 )
$query = 'SELECT id FROM '.COMMENTS_TABLE;
$query.= " WHERE validated='false'";
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$nb_comments = '';
if ( mysql_num_rows( $result ) > 0 )
{
diff --git a/admin/admin_upload.php b/admin/admin_upload.php
index 28f210989..757f00abe 100644
--- a/admin/admin_upload.php
+++ b/admin/admin_upload.php
@@ -50,7 +50,7 @@ if (isset($_POST['submit']) || isset($_POST['delete']))
if ($i+1<$nb) $query.=',';
}
$query.=');';
- mysql_query ($query);
+ pwg_query ($query);
}
// Cache management
@@ -58,7 +58,7 @@ $query = 'SELECT id, name, uploadable FROM '.CATEGORIES_TABLE;
$query.= ' WHERE dir IS NOT NULL';
$query.= ' ORDER BY name ASC';
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
while ( $row = mysql_fetch_assoc( $result ) )
{
if ($row['uploadable'] == 'false')
diff --git a/admin/cat_list.php b/admin/cat_list.php
index 7ed0e4ca9..dc69a5179 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -69,7 +69,7 @@ SELECT uppercats
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$parent_id.'
;';
- $parent_uppercats = array_pop(mysql_fetch_array(mysql_query($query)));
+ $parent_uppercats = array_pop(mysql_fetch_array(pwg_query($query)));
}
// we have then to add the virtual category
@@ -79,14 +79,14 @@ INSERT INTO '.CATEGORIES_TABLE.'
VALUES
(\''.$_POST['virtual_name'].'\','.$parent_id.','.$_POST['rank'].')
;';
- mysql_query($query);
+ pwg_query($query);
// And last we update the uppercats
$query = '
SELECT MAX(id)
FROM '.CATEGORIES_TABLE.'
;';
- $my_id = array_pop(mysql_fetch_array(mysql_query($query)));
+ $my_id = array_pop(mysql_fetch_array(pwg_query($query)));
$query = '
UPDATE '.CATEGORIES_TABLE.'
@@ -99,7 +99,7 @@ UPDATE '.CATEGORIES_TABLE.'
$query.= '\'
WHERE id = '.$my_id.'
;';
- mysql_query($query);
+ pwg_query($query);
array_push($infos, $lang['cat_list_virtual_category_added']);
}
}
@@ -122,7 +122,7 @@ else
$query.= '
ORDER BY rank ASC
;';
-$result = mysql_query($query);
+$result = pwg_query($query);
while ($row = mysql_fetch_assoc($result))
{
$categories[$row['rank']] = $row;
@@ -169,13 +169,13 @@ UPDATE '.CATEGORIES_TABLE.'
SET rank = '.($current_rank-1).'
WHERE id = '.$_GET['up'].'
;';
- mysql_query($query);
+ pwg_query($query);
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET rank = '.$current_rank.'
WHERE id = '.$categories[($current_rank-1)]['id'].'
;';
- mysql_query($query);
+ pwg_query($query);
// 3. Updating the cache array
$categories[$current_rank] = $categories[($current_rank-1)];
$categories[($current_rank-1)] = $current;
@@ -188,7 +188,7 @@ UPDATE '.CATEGORIES_TABLE.'
SET rank = '.(count($categories) + 1).'
WHERE id = '.$_GET['up'].'
;';
- mysql_query($query);
+ pwg_query($query);
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET rank = rank-1
@@ -203,7 +203,7 @@ UPDATE '.CATEGORIES_TABLE.'
}
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
// 3. Updating the cache array
array_push($categories, $current);
array_shift($categories);
@@ -228,13 +228,13 @@ UPDATE '.CATEGORIES_TABLE.'
SET rank = '.($current_rank+1).'
WHERE id = '.$_GET['down'].'
;';
- mysql_query($query);
+ pwg_query($query);
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET rank = '.$current_rank.'
WHERE id = '.$categories[($current_rank+1)]['id'].'
;';
- mysql_query($query);
+ pwg_query($query);
// 3. Updating the cache array
$categories[$current_rank]=$categories[($current_rank+1)];
$categories[($current_rank+1)] = $current;
@@ -247,7 +247,7 @@ UPDATE '.CATEGORIES_TABLE.'
SET rank = 0
WHERE id = '.$_GET['down'].'
;';
- mysql_query($query);
+ pwg_query($query);
$query = '
UPDATE '.CATEGORIES_TABLE.'
SET rank = rank+1
@@ -262,7 +262,7 @@ UPDATE '.CATEGORIES_TABLE.'
}
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
// 3. Updating the cache array
array_unshift($categories, $current);
array_pop($categories);
@@ -350,7 +350,7 @@ SELECT COUNT(id) AS nb_sub_cats
FROM '. CATEGORIES_TABLE.'
WHERE id_uppercat = '.$category['id'].'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
if ($row['nb_sub_cats'] > 0)
{
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index c6937c4c4..1adad78aa 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -48,7 +48,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$_GET['cat_id'];
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
$query = 'UPDATE '.CATEGORIES_TABLE;
$query.= ' SET name = ';
@@ -78,7 +78,7 @@ if ( isset( $_POST['submit'] ) )
}
$query.= ' WHERE id = '.$_GET['cat_id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
if ( $_POST['status'] != $row['status'] )
{
@@ -86,19 +86,19 @@ if ( isset( $_POST['submit'] ) )
$query = 'DELETE';
$query.= ' FROM '.GROUP_ACCESS_TABLE;
$query.= ' WHERE cat_id = '.$_GET['cat_id'];
- mysql_query( $query );
+ pwg_query( $query );
// deletion of all access for users concerning this category
$query = 'DELETE';
$query.= ' FROM '.USER_ACCESS_TABLE;
$query.= ' WHERE cat_id = '.$_GET['cat_id'];
- mysql_query( $query );
+ pwg_query( $query );
}
// checking users favorites
$query = 'SELECT id';
$query.= ' FROM '.USERS_TABLE;
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
check_favorites( $row['id'] );
@@ -111,7 +111,7 @@ $query.= ' FROM '.CATEGORIES_TABLE.' as a, '.SITES_TABLE.' as b';
$query.= ' WHERE a.id = '.$_GET['cat_id'];
$query.= ' AND a.site_id = b.id';
$query.= ';';
-$category = mysql_fetch_array( mysql_query( $query ) );
+$category = mysql_fetch_array( pwg_query( $query ) );
// nullable fields
foreach (array('comment','dir') as $nullable)
{
@@ -180,7 +180,7 @@ if ( $row['dir'] == '' )
$query = 'SELECT COUNT(id) AS nb_total_categories';
$query.= ' FROM '.CATEGORIES_TABLE;
$query.= ';';
- $countrow = mysql_fetch_array( mysql_query( $query ) );
+ $countrow = mysql_fetch_array( pwg_query( $query ) );
if ( $countrow['nb_total_categories'] < $conf['max_LOV_categories'] )
{
$vtp->addSession( $sub, 'associate_LOV' );
diff --git a/admin/cat_perm.php b/admin/cat_perm.php
index b571caeab..d18a5f3b4 100644
--- a/admin/cat_perm.php
+++ b/admin/cat_perm.php
@@ -51,11 +51,11 @@ if ( isset( $_POST['submit'] ) )
$query.= ' FROM '.PREFIX_TABLE.'group_access';
$query.= ' WHERE cat_id = '.$page['cat'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
$query = 'SELECT id';
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$radioname = 'groupaccess-'.$row['id'];
@@ -65,7 +65,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' (cat_id,group_id) VALUES';
$query.= ' ('.$page['cat'].','.$row['id'].')';
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
}
// users access update
@@ -73,11 +73,11 @@ if ( isset( $_POST['submit'] ) )
$query.= ' FROM '.PREFIX_TABLE.'user_access';
$query.= ' WHERE cat_id = '.$page['cat'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
$query = 'SELECT id';
$query.= ' FROM '.USERS_TABLE;
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$radioname = 'useraccess-'.$row['id'];
@@ -87,7 +87,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' (cat_id,user_id) VALUES';
$query.= ' ('.$page['cat'].','.$row['id'].')';
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
check_favorites( $row['id'] );
}
@@ -98,7 +98,7 @@ if ( isset( $_POST['submit'] ) )
$query = 'SELECT id,name';
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query. ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
if ( mysql_num_rows( $result ) > 0 )
{
$vtp->addSession( $sub, 'groups' );
@@ -107,7 +107,7 @@ if ( mysql_num_rows( $result ) > 0 )
$query.= ' FROM '.PREFIX_TABLE.'group_access';
$query.= ' WHERE cat_id = '.$_GET['cat_id'];
$query.= ';';
- $subresult = mysql_query( $query );
+ $subresult = pwg_query( $query );
$authorized_groups = array();
while ( $subrow = mysql_fetch_array( $subresult ) )
{
@@ -144,7 +144,7 @@ if ( $user['username'] != $conf['webmaster'] )
$query.= " WHERE username != '".$conf['webmaster']."'";
}
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$vtp->addSession( $sub, 'user' );
@@ -195,7 +195,7 @@ while ( $row = mysql_fetch_array( $result ) )
$query.= ' WHERE ug.group_id = g.id';
$query.= ' AND ug.user_id = '.$row['id'];
$query.= ';';
- $subresult = mysql_query( $query );
+ $subresult = pwg_query( $query );
if ( mysql_num_rows( $subresult ) > 0 )
{
$vtp->addSession( $sub, 'usergroups' );
diff --git a/admin/configuration.php b/admin/configuration.php
index 36e52c500..a64c6a3e8 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -41,7 +41,7 @@ else
$page['section'] = $_GET['section'];
}
//------------------------------------------------------ $conf reinitialization
-$result = mysql_query('SELECT param,value FROM '.CONFIG_TABLE);
+$result = pwg_query('SELECT param,value FROM '.CONFIG_TABLE);
while ($row = mysql_fetch_array($result))
{
$conf[$row['param']] = $row['value'];
@@ -125,7 +125,7 @@ if (isset($_POST['submit']))
// updating configuration if no error found
if (count($errors) == 0)
{
- $result = mysql_query('SELECT * FROM '.CONFIG_TABLE);
+ $result = pwg_query('SELECT * FROM '.CONFIG_TABLE);
while ($row = mysql_fetch_array($result))
{
if (isset($_POST[$row['param']]))
@@ -135,7 +135,7 @@ UPDATE '.CONFIG_TABLE.'
SET value = \''. str_replace("\'", "''", $_POST[$row['param']]).'\'
WHERE param = \''.$row['param'].'\'
;';
- mysql_query($query);
+ pwg_query($query);
}
}
}
diff --git a/admin/group_list.php b/admin/group_list.php
index a0f4e9d24..20a9788c2 100644
--- a/admin/group_list.php
+++ b/admin/group_list.php
@@ -39,7 +39,7 @@ if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= ' WHERE id = '.$_GET['delete'];
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
// confirm group deletion ?
if ( !isset( $_GET['confirm'] ) or $_GET['confirm'] != 1 )
{
@@ -60,7 +60,7 @@ if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= ' WHERE id = '.$_GET['delete'];
$query.= ';';
- $row2 = mysql_fetch_array( mysql_query( $query ) );
+ $row2 = mysql_fetch_array( pwg_query( $query ) );
if ( $row2['nb_result'] > 0 )
{
delete_group( $_GET['delete'] );
@@ -91,7 +91,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= " WHERE name = '".$_POST['name']."'";
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
if ( mysql_num_rows( $result ) > 0 )
{
array_push( $error, $lang['group_add_error2'] );
@@ -103,7 +103,7 @@ if ( isset( $_POST['submit'] ) )
$query = ' INSERT INTO '.PREFIX_TABLE.'groups';
$query.= " (name) VALUES ('".$_POST['name']."')";
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
}
//-------------------------------------------------------------- errors display
@@ -125,7 +125,7 @@ $query = 'SELECT id,name';
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= ' ORDER BY id ASC';
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$vtp->addSession( $sub, 'group' );
diff --git a/admin/group_perm.php b/admin/group_perm.php
index 37deb5984..6749b21b6 100644
--- a/admin/group_perm.php
+++ b/admin/group_perm.php
@@ -40,13 +40,13 @@ if ( isset( $_POST['submit'] ) )
$query = 'DELETE FROM '.PREFIX_TABLE.'group_access';
$query.= ' WHERE group_id = '.$_GET['group_id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// selecting all private categories
$query = 'SELECT id';
$query.= ' FROM '.PREFIX_TABLE.'categories';
$query.= " WHERE status = 'private'";
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$radioname = 'access-'.$row['id'];
@@ -56,14 +56,14 @@ if ( isset( $_POST['submit'] ) )
$query.= ' (group_id,cat_id) VALUES';
$query.= ' ('.$_GET['group_id'].','.$row['id'].')';
$query.= ';';
- mysql_query ( $query );
+ pwg_query ( $query );
}
}
// checking users favorites
$query = 'SELECT id';
$query.= ' FROM '.USERS_TABLE;
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
check_favorites( $row['id'] );
@@ -85,7 +85,7 @@ $query = 'SELECT id';
$query.= ' FROM '.PREFIX_TABLE.'categories';
$query.= " WHERE status = 'private'";
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$vtp->addSession( $sub, 'category' );
diff --git a/admin/images/global_stats.img.php b/admin/images/global_stats.img.php
index 91062ef05..d70dff85d 100644
--- a/admin/images/global_stats.img.php
+++ b/admin/images/global_stats.img.php
@@ -72,7 +72,7 @@ $myBarGraph->SetBarSpacing(5); // The default is 10. This changes the space
// Add Values to the bargraph..
-$result = mysql_query($sql)
+$result = pwg_query($sql)
or die(mysql_errno().": ".mysql_error()."<BR>".$sql);
//$monthes =array_fill(1,12,0);
diff --git a/admin/include/functions.php b/admin/include/functions.php
index b17a52f99..900b7e037 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -167,7 +167,7 @@ SELECT id
FROM '.CATEGORIES_TABLE.'
WHERE site_id = '.$id.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$category_ids = array();
while ($row = mysql_fetch_array($result))
{
@@ -180,7 +180,7 @@ SELECT id
DELETE FROM '.SITES_TABLE.'
WHERE id = '.$id.'
;';
- mysql_query($query);
+ pwg_query($query);
}
@@ -205,7 +205,7 @@ SELECT id
FROM '.IMAGES_TABLE.'
WHERE storage_category_id IN ('.implode(',', $ids).')
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$element_ids = array();
while ($row = mysql_fetch_array($result))
{
@@ -218,19 +218,19 @@ SELECT id
DELETE FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id IN ('.implode(',', $ids).')
;';
- mysql_query($query);
+ pwg_query($query);
// destruction of the access linked to the category
$query = '
DELETE FROM '.USER_ACCESS_TABLE.'
WHERE cat_id IN ('.implode(',', $ids).')
;';
- mysql_query($query);
+ pwg_query($query);
$query = '
DELETE FROM '.GROUP_ACCESS_TABLE.'
WHERE cat_id IN ('.implode(',', $ids).')
;';
- mysql_query($query);
+ pwg_query($query);
// destruction of the sub-categories
$query = '
@@ -238,7 +238,7 @@ SELECT id
FROM '.CATEGORIES_TABLE.'
WHERE id_uppercat IN ('.implode(',', $ids).')
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$subcat_ids = array();
while($row = mysql_fetch_array($result))
{
@@ -254,7 +254,7 @@ SELECT id
DELETE FROM '.CATEGORIES_TABLE.'
WHERE id IN ('.implode(',', $ids).')
;';
- mysql_query($query);
+ pwg_query($query);
if (isset($counts['del_categories']))
{
@@ -282,7 +282,7 @@ DELETE FROM '.COMMENTS_TABLE.'
WHERE image_id IN (
'.wordwrap(implode(', ', $ids), 80, "\n").')
;';
- mysql_query($query);
+ pwg_query($query);
// destruction of the links between images and this category
$query = '
@@ -290,7 +290,7 @@ DELETE FROM '.IMAGE_CATEGORY_TABLE.'
WHERE image_id IN (
'.wordwrap(implode(', ', $ids), 80, "\n").')
;';
- mysql_query($query);
+ pwg_query($query);
// destruction of the favorites associated with the picture
$query = '
@@ -298,7 +298,7 @@ DELETE FROM '.FAVORITES_TABLE.'
WHERE image_id IN (
'.wordwrap(implode(', ', $ids), 80, "\n").')
;';
- mysql_query($query);
+ pwg_query($query);
// destruction of the rates associated to this element
$query = '
@@ -306,7 +306,7 @@ DELETE FROM '.RATE_TABLE.'
WHERE element_id IN (
'.wordwrap(implode(', ', $ids), 80, "\n").')
;';
- mysql_query($query);
+ pwg_query($query);
// destruction of the image
$query = '
@@ -314,7 +314,7 @@ DELETE FROM '.IMAGES_TABLE.'
WHERE id IN (
'.wordwrap(implode(', ', $ids), 80, "\n").')
;';
- mysql_query($query);
+ pwg_query($query);
if (isset($counts['del_elements']))
{
@@ -335,31 +335,31 @@ function delete_user( $user_id )
$query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// destruction of the group links for this user
$query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// destruction of the favorites associated with the user
$query = 'DELETE FROM '.PREFIX_TABLE.'favorites';
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// destruction of the sessions linked with the user
$query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// destruction of the user
$query = 'DELETE FROM '.USERS_TABLE;
$query.= ' WHERE id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
// delete_group deletes a group identified by its $group_id.
@@ -372,7 +372,7 @@ function delete_group( $group_id )
$query = 'DELETE FROM '.PREFIX_TABLE.'group_access';
$query.= ' WHERE group_id = '.$group_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// synchronize all users linked to the group
synchronize_group( $group_id );
@@ -381,13 +381,13 @@ function delete_group( $group_id )
$query = 'DELETE FROM '.PREFIX_TABLE.'user_group';
$query.= ' WHERE group_id = '.$group_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// destruction of the group
$query = 'DELETE FROM '.PREFIX_TABLE.'groups';
$query.= ' WHERE id = '.$group_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
// The check_favorites function deletes all the favorites of a user if he is
@@ -399,7 +399,7 @@ function check_favorites( $user_id )
$query.= ' FROM '.USERS_TABLE;
$query.= ' WHERE id = '.$user_id;
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
$status = $row['status'];
// retrieving all the restricted categories for this user
if ( isset( $row['forbidden_categories'] ) )
@@ -412,7 +412,7 @@ function check_favorites( $user_id )
$query.= ' FROM '.PREFIX_TABLE.'favorites';
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
- $result = mysql_query ( $query );
+ $result = pwg_query ( $query );
while ( $row = mysql_fetch_array( $result ) )
{
// for each picture, we have to check all the categories it belongs
@@ -423,7 +423,7 @@ function check_favorites( $user_id )
$query.= ' FROM '.PREFIX_TABLE.'image_category';
$query.= ' WHERE image_id = '.$row['image_id'];
$query.= ';';
- $picture_result = mysql_query( $query );
+ $picture_result = pwg_query( $query );
$picture_cat = array();
while ( $picture_row = mysql_fetch_array( $picture_result ) )
{
@@ -435,7 +435,7 @@ function check_favorites( $user_id )
$query.= ' WHERE image_id = '.$row['image_id'];
$query.= ' AND user_id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
}
}
@@ -464,7 +464,7 @@ SELECT category_id, COUNT(image_id) AS count, max(date_available) AS date_last
$query.= '
GROUP BY category_id
;';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
array_push($cat_ids, $row['category_id']);
@@ -474,7 +474,7 @@ UPDATE '.CATEGORIES_TABLE.'
, nb_images = '.$row['count'].'
WHERE id = '.$row['category_id'].'
;';
- mysql_query($query);
+ pwg_query($query);
}
if (count($cat_ids) > 0)
@@ -485,7 +485,7 @@ SELECT id, representative_picture_id
WHERE representative_picture_id IS NOT NULL
AND id IN ('.implode(',', $cat_ids).')
;';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$query = '
@@ -494,7 +494,7 @@ SELECT image_id
WHERE category_id = '.$row['id'].'
AND image_id = '.$row['representative_picture_id'].'
;';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
if (mysql_num_rows($result) == 0)
{
$query = '
@@ -502,7 +502,7 @@ UPDATE '.CATEGORIES_TABLE.'
SET representative_picture_id = NULL
WHERE id = '.$row['id'].'
;';
- mysql_query( $query );
+ pwg_query( $query );
}
}
}
@@ -598,7 +598,7 @@ function get_user_restrictions( $user_id, $user_status,
$query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= " WHERE status = 'private'";
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
$privates = array();
while ( $row = mysql_fetch_array( $result ) )
{
@@ -611,7 +611,7 @@ function get_user_restrictions( $user_id, $user_status,
$query = 'SELECT cat_id FROM '.USER_ACCESS_TABLE;
$query.= ' WHERE user_id = '.$user_id;
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
array_push( $authorized, $row['cat_id'] );
@@ -626,7 +626,7 @@ function get_user_restrictions( $user_id, $user_status,
$query.= ' WHERE ug.group_id = ga.group_id';
$query.= ' AND ug.user_id = '.$user_id;
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
array_push( $authorized, $row['cat_id'] );
@@ -649,7 +649,7 @@ function get_user_restrictions( $user_id, $user_status,
{
$query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= " WHERE visible = 'false';";
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
array_push( $forbidden, $row['id'] );
@@ -679,7 +679,7 @@ function update_user_restrictions( $user_id )
$query.= 'NULL';
$query .= ' WHERE id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
return $restrictions;
}
@@ -698,7 +698,7 @@ function get_user_all_restrictions( $user_id )
$query.= ' FROM '.USERS_TABLE;
$query.= ' WHERE id = '.$user_id;
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
$base_restrictions=get_user_restrictions($user_id,$row['status'],true,true);
@@ -727,7 +727,7 @@ function is_user_allowed( $category_id, $restrictions )
$query.= ' FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$category_id;
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
$uppercats = explode( ',', $row['uppercats'] );
foreach ( $uppercats as $category_id ) {
if ( in_array( $category_id, $restrictions ) ) return 2;
diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php
index 60a826774..42f34c4ff 100644
--- a/admin/include/functions_metadata.php
+++ b/admin/include/functions_metadata.php
@@ -128,7 +128,7 @@ function update_metadata($files)
// depending on the MySQL version, we use the multi table update or N
// update queries
$query = 'SELECT VERSION() AS version;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
if (version_compare($row['version'],'4.0.4') < 0)
{
// MySQL is prior to version 4.0.4, multi table update feature is not
@@ -151,7 +151,7 @@ UPDATE '.IMAGES_TABLE.'
WHERE id = '.$insert['id'].'
;';
// echo '<pre>'.$query.'</pre>';
- mysql_query($query);
+ pwg_query($query);
}
}
else
@@ -160,7 +160,7 @@ UPDATE '.IMAGES_TABLE.'
$query = '
DESCRIBE '.IMAGES_TABLE.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$columns = array();
while ($row = mysql_fetch_array($result))
{
@@ -187,7 +187,7 @@ PRIMARY KEY (id)
)
;';
// echo '<pre>'.$query.'</pre>';
- mysql_query($query);
+ pwg_query($query);
// inserts all found pictures
$query = '
INSERT INTO '.IMAGE_METADATA_TABLE.'
@@ -224,7 +224,7 @@ INSERT INTO '.IMAGE_METADATA_TABLE.'
$query.= '
;';
// echo '<pre>'.$query.'</pre>';
- mysql_query($query);
+ pwg_query($query);
// update of images table by joining with temporary table
$query = '
UPDATE '.IMAGES_TABLE.' AS images, '.IMAGE_METADATA_TABLE.' as metadata
@@ -235,7 +235,7 @@ UPDATE '.IMAGES_TABLE.' AS images, '.IMAGE_METADATA_TABLE.' as metadata
WHERE images.id = metadata.id
;';
echo '<pre>'.$query.'</pre>';
- mysql_query($query);
+ pwg_query($query);
}
}
}
@@ -258,7 +258,7 @@ SELECT id, dir
FROM '.CATEGORIES_TABLE.'
WHERE dir IS NOT NULL
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$cat_dirs = array();
while ($row = mysql_fetch_array($result))
{
@@ -291,7 +291,7 @@ SELECT id, uppercats
}
$query.= '
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$uppercats_array[$row['id']] = $row['uppercats'];
@@ -302,7 +302,7 @@ SELECT galleries_url
FROM '.SITES_TABLE.'
WHERE id = 1
';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$basedir = $row['galleries_url'];
// filling $cat_fulldirs
@@ -328,7 +328,7 @@ SELECT id, file, storage_category_id
}
$query.= '
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$files[$row['id']]
diff --git a/admin/infos_images.php b/admin/infos_images.php
index 0c95bdf5b..29983e327 100644
--- a/admin/infos_images.php
+++ b/admin/infos_images.php
@@ -55,7 +55,7 @@ if (isset($page['cat']))
$query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$_POST['associate'];
$query.= ';';
- if (mysql_num_rows(mysql_query($query)) == 0)
+ if (mysql_num_rows(pwg_query($query)) == 0)
array_push($errors, $lang['cat_unknown_id']);
}
}
@@ -66,7 +66,7 @@ if (isset($page['cat']))
$query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
$query.= ' WHERE category_id = '.$page['cat'];
$query.= ';';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$name = 'name-'.$row['id'];
@@ -108,7 +108,7 @@ if (isset($page['cat']))
$query.= ' WHERE id = '.$row['id'];
$query.= ';';
- mysql_query($query);
+ pwg_query($query);
}
// add link to another category
if (isset($_POST['check-'.$row['id']]) and count($errors) == 0)
@@ -117,7 +117,7 @@ if (isset($page['cat']))
$query.= ' (image_id,category_id) VALUES';
$query.= ' ('.$row['id'].','.$_POST['associate'].')';
$query.= ';';
- mysql_query($query);
+ pwg_query($query);
$associate = true;
}
}
@@ -130,7 +130,7 @@ if (isset($page['cat']))
{
$query = 'SELECT image_id FROM '.IMAGE_CATEGORY_TABLE;
$query.= ' WHERE category_id = '.$page['cat'];
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$query = 'UPDATE '.IMAGES_TABLE;
@@ -145,7 +145,7 @@ if (isset($page['cat']))
}
$query.= ' WHERE id = '.$row['image_id'];
$query.= ';';
- mysql_query($query);
+ pwg_query($query);
}
}
if (isset($_POST['use_common_date_creation']))
@@ -155,7 +155,7 @@ if (isset($page['cat']))
$date = date_convert($_POST['date_creation_cat']);
$query = 'SELECT image_id FROM '.IMAGE_CATEGORY_TABLE;
$query.= ' WHERE category_id = '.$page['cat'];
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$query = 'UPDATE '.IMAGES_TABLE;
@@ -169,7 +169,7 @@ if (isset($page['cat']))
}
$query.= ' WHERE id = '.$row['image_id'];
$query.= ';';
- mysql_query($query);
+ pwg_query($query);
}
}
else
@@ -183,7 +183,7 @@ if (isset($page['cat']))
$query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
$query.= ' WHERE category_id = '.$page['cat'];
$query.= ';';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
if (!isset($row['keywords'])) $specific_keywords = array();
@@ -222,7 +222,7 @@ if (isset($page['cat']))
}
$query.= ' WHERE id = '.$row['id'];
$query.= ';';
- mysql_query($query);
+ pwg_query($query);
}
}
}
@@ -316,7 +316,7 @@ SELECT *
'.$conf['order_by'].'
LIMIT '.$page['start'].','.$conf['info_nb_elements_page'].'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$thumbnail_url = get_thumbnail_src($row['file'],
@@ -345,7 +345,7 @@ SELECT *
// $conf['max_LOV_categories']
$query = 'SELECT COUNT(id) AS nb_total_categories';
$query.= ' FROM '.CATEGORIES_TABLE.';';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
if ($row['nb_total_categories'] < $conf['max_LOV_categories'])
{
/*$vtp->addSession($sub, 'associate_LOV');
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 1e0e7ce31..c70a4d250 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -82,7 +82,7 @@ if (isset($_POST['submit']))
$query.= ' WHERE id = '.$_GET['image_id'];
$query.= ';';
- mysql_query($query);
+ pwg_query($query);
// make the picture representative of a category ?
$query = '
SELECT DISTINCT(category_id) as category_id,representative_picture_id
@@ -90,7 +90,7 @@ SELECT DISTINCT(category_id) as category_id,representative_picture_id
WHERE c.id = ic.category_id
AND image_id = '.$_GET['image_id'].'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
// if the user ask the picture to be the representative picture of its
@@ -102,7 +102,7 @@ SELECT DISTINCT(category_id) as category_id,representative_picture_id
$query.= ' SET representative_picture_id = '.$_GET['image_id'];
$query.= ' WHERE id = '.$row['category_id'];
$query.= ';';
- mysql_query($query);
+ pwg_query($query);
}
// if the user ask this picture to be not any more the representative,
// we have to set the representative_picture_id of this category to NULL
@@ -114,7 +114,7 @@ UPDATE '.CATEGORIES_TABLE.'
SET representative_picture_id = NULL
WHERE id = '.$row['category_id'].'
;';
- mysql_query($query);
+ pwg_query($query);
}
}
$associate_or_dissociate = false;
@@ -133,7 +133,7 @@ SELECT id
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$_POST['associate'].'
;';
- if (mysql_num_rows(mysql_query($query)) == 0)
+ if (mysql_num_rows(pwg_query($query)) == 0)
array_push($errors, $lang['cat_unknown_id']);
}
}
@@ -147,7 +147,7 @@ INSERT INTO '.IMAGE_CATEGORY_TABLE.'
VALUES
('.$_POST['associate'].','.$_GET['image_id'].')
;';
- mysql_query($query);
+ pwg_query($query);
$associate_or_dissociate = true;
update_category($_POST['associate']);
}
@@ -158,7 +158,7 @@ SELECT DISTINCT(category_id) as category_id
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE image_id = '.$_GET['image_id'].'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
if (isset($_POST['dissociate-'.$row['category_id']]))
@@ -168,7 +168,7 @@ DELETE FROM '.IMAGE_CATEGORY_TABLE.'
WHERE image_id = '.$_GET['image_id'].'
AND category_id = '.$row['category_id'].'
;';
- mysql_query($query);
+ pwg_query($query);
$associate_or_dissociate = true;
update_category($row['category_id']);
}
@@ -185,7 +185,7 @@ SELECT *
FROM '.IMAGES_TABLE.'
WHERE id = '.$_GET['image_id'].'
;';
-$row = mysql_fetch_array(mysql_query($query));
+$row = mysql_fetch_array(pwg_query($query));
if (empty($row['name']))
{
@@ -216,7 +216,7 @@ SELECT DISTINCT(category_id) AS category_id,status,visible
WHERE image_id = '.$_GET['image_id'].'
AND category_id = id
;';
-$result = mysql_query($query);
+$result = pwg_query($query);
$categories = '';
while ($cat_row = mysql_fetch_array($result))
{
@@ -286,7 +286,7 @@ if (mysql_num_rows($result) > 0)
// $conf['max_LOV_categories']
$query = 'SELECT COUNT(id) AS nb_total_categories';
$query.= ' FROM '.CATEGORIES_TABLE.';';
-$row = mysql_fetch_array(mysql_query($query));
+$row = mysql_fetch_array(pwg_query($query));
if ($row['nb_total_categories'] < $conf['max_LOV_categories'])
{
$template->assign_block_vars('associate_LOV',array());
diff --git a/admin/remote_site.php b/admin/remote_site.php
index cd19e1b48..6c1b9720e 100644
--- a/admin/remote_site.php
+++ b/admin/remote_site.php
@@ -102,7 +102,7 @@ SELECT id,dir
$query.= '
AND dir IS NOT NULL
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$database_dirs[$row['id']] = $row['dir'];
@@ -155,7 +155,7 @@ INSERT INTO '.$table_name.'
}
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
}
/**
@@ -233,7 +233,7 @@ SELECT name,uppercats,dir
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$id_uppercat.'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$uppercats = $row['uppercats'];
$name = $row['name'];
@@ -324,7 +324,7 @@ UPDATE '.CATEGORIES_TABLE.'
}
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
}
// Recursive call on the sub-categories (not virtual ones)
@@ -367,7 +367,7 @@ SELECT id,file
FROM '.IMAGES_TABLE.'
WHERE storage_category_id = '.$category_id.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$to_delete = array();
while ($row = mysql_fetch_array($result))
{
@@ -390,7 +390,7 @@ SELECT file
FROM '.IMAGES_TABLE.'
WHERE storage_category_id = '.$category_id.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
array_push($database_elements, $row['file']);
@@ -446,7 +446,7 @@ SELECT id
FROM '.IMAGES_TABLE.'
WHERE storage_category_id = '.$category_id.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
array_push($ids, $row['id']);
@@ -459,7 +459,7 @@ DELETE FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id = '.$category_id.'
AND image_id IN ('.implode(',', $ids).')
;';
- mysql_query($query);
+ pwg_query($query);
$query = '
INSERT INTO '.IMAGE_CATEGORY_TABLE.'
@@ -477,7 +477,7 @@ INSERT INTO '.IMAGE_CATEGORY_TABLE.'
}
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
}
}
// +-----------------------------------------------------------------------+
@@ -536,7 +536,7 @@ SELECT COUNT(id) AS count
FROM '.SITES_TABLE.'
WHERE galleries_url = \''.$page['galleries_url'].'\'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
if ($row['count'] > 0)
{
array_push($errors, $lang['remote_site_already_exists']);
@@ -570,7 +570,7 @@ INSERT INTO '.SITES_TABLE.'
VALUES
(\''.$page['galleries_url'].'\')
;';
- mysql_query($query);
+ pwg_query($query);
$template->assign_block_vars(
'confirmation',
@@ -596,7 +596,7 @@ SELECT galleries_url
FROM '.SITES_TABLE.'
WHERE id = '.$page['site'].'
;';
- list($galleries_url) = mysql_fetch_array(mysql_query($query));
+ list($galleries_url) = mysql_fetch_array(pwg_query($query));
}
switch($_GET['action'])
@@ -646,7 +646,7 @@ SELECT id
FROM '.SITES_TABLE.'
WHERE galleries_url = \''.addslashes($url).'\'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
if (mysql_num_rows($result) == 0)
{
// we have to register this site in the database
@@ -656,7 +656,7 @@ INSERT INTO '.SITES_TABLE.'
VALUES
(\''.$url.'\')
;';
- mysql_query($query);
+ pwg_query($query);
$site_id = mysql_insert_id();
}
else
@@ -698,7 +698,7 @@ SELECT COUNT(*)
FROM '.SITES_TABLE.'
WHERE galleries_url = \''.addslashes($url).'\'
;';
- list($count) = mysql_fetch_array(mysql_query($query));
+ list($count) = mysql_fetch_array(pwg_query($query));
if ($count == 0)
{
$template->assign_block_vars('local.new_site', array());
@@ -715,7 +715,7 @@ SELECT id, galleries_url
FROM '.SITES_TABLE.'
WHERE id != 1
;';
-$result = mysql_query($query);
+$result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$base_url = PHPWG_ROOT_PATH.'admin.php';
diff --git a/admin/search.php b/admin/search.php
index 4bfae3039..9a5b27ef4 100644
--- a/admin/search.php
+++ b/admin/search.php
@@ -74,7 +74,7 @@ if ( !empty($search_match) )
FROM " . USERS_TABLE . "
WHERE username LIKE '" . str_replace("\'", "''", $username_search) . "'
ORDER BY username";
- if ( !($result = mysql_query($sql)) )
+ if ( !($result = pwg_query($sql)) )
{
die('Could not obtain search results');
}
diff --git a/admin/stats.php b/admin/stats.php
index 4d916009a..6a2dae892 100644
--- a/admin/stats.php
+++ b/admin/stats.php
@@ -52,7 +52,7 @@ $query = "SELECT DISTINCT COUNT(*) as p,
YEAR(date) as y
FROM phpwg_history
GROUP BY DATE_FORMAT(date,'%Y-%m') DESC;";
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$i=0;
while ( $row = mysql_fetch_array( $result ) )
{
@@ -66,14 +66,14 @@ while ( $row = mysql_fetch_array( $result ) )
WHERE DATE_FORMAT(date,'%Y-%m') = '$current_month'
AND FILE = 'picture'
GROUP BY FILE;";
- $pictures = mysql_fetch_array(mysql_query( $query ));
+ $pictures = mysql_fetch_array(pwg_query( $query ));
// Number of different visitors
$query = "SELECT COUNT(*) as p, login
FROM phpwg_history
WHERE DATE_FORMAT(date,'%Y-%m') = '$current_month'
GROUP BY login, IP;";
- $user_results = mysql_query( $query );
+ $user_results = pwg_query( $query );
$nb_visitors = 0;
$auth_users = array();
while ( $user_array = mysql_fetch_array( $user_results ) )
@@ -112,7 +112,7 @@ $endtime = mktime( 23,59,59,date('n'),date('j'),date('Y') );
$query.= ' AND date < '.$endtime;
$query.= ' ORDER BY date DESC';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
$nb_pages_seen = mysql_num_rows( $result );
$day['nb_pages_seen'] = $nb_pages_seen;
if ( $nb_pages_seen > $max_pages_seen ) $max_pages_seen = $nb_pages_seen;
diff --git a/admin/update.php b/admin/update.php
index 541c2cb01..10e1af8b3 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -53,7 +53,7 @@ SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat
FROM '.CATEGORIES_TABLE.'
ORDER BY id_uppercat,rank,name
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
if ($row['id_uppercat'] != $current_uppercat)
@@ -66,7 +66,7 @@ UPDATE '.CATEGORIES_TABLE.'
SET rank = '.++$current_rank.'
WHERE id = '.$row['id'].'
;';
- mysql_query($query);
+ pwg_query($query);
}
}
@@ -84,7 +84,7 @@ function insert_local_category($id_uppercat)
$query = 'SELECT name,uppercats,dir FROM '.CATEGORIES_TABLE;
$query.= ' WHERE id = '.$id_uppercat;
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query));
+ $row = mysql_fetch_array( pwg_query( $query));
$uppercats = $row['uppercats'];
$name = $row['name'];
$dir = $row['dir'];
@@ -98,7 +98,7 @@ function insert_local_category($id_uppercat)
SELECT id,dir FROM '.CATEGORIES_TABLE.'
WHERE id IN ('.$uppercats.')
;';
- $result = mysql_query( $query);
+ $result = pwg_query( $query);
while ($row = mysql_fetch_array($result))
{
$database_dirs[$row['id']] = $row['dir'];
@@ -143,7 +143,7 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
AND dir IS NOT NULL'; // virtual categories not taken
$query.= '
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$sub_category_dirs[$row['id']] = $row['dir'];
@@ -208,7 +208,7 @@ INSERT INTO '.CATEGORIES_TABLE.'
$query.= implode(',', $inserts);
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
$counts['new_categories']+= count($inserts);
// updating uppercats field
@@ -235,7 +235,7 @@ UPDATE '.CATEGORIES_TABLE.'
}
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
}
// Recursive call on the sub-categories (not virtual ones)
@@ -256,7 +256,7 @@ SELECT id
AND dir IS NOT NULL'; // virtual categories not taken
$query.= '
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$output.= insert_local_category($row['id']);
@@ -291,7 +291,7 @@ SELECT id,file
FROM '.IMAGES_TABLE.'
WHERE storage_category_id = '.$category_id.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
if (!in_array($row['file'], $fs_files))
@@ -313,7 +313,7 @@ SELECT id,file,tn_ext
create_function('$s', 'return "file LIKE \'%".$s."\'";')
, $conf['picture_ext'])).')
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$thumbnail = $conf['prefix_thumbnail'];
@@ -339,7 +339,7 @@ SELECT id,file,tn_ext
SELECT file FROM '.IMAGES_TABLE.'
WHERE storage_category_id = '.$category_id.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
array_push($registered_elements, $row['file']);
@@ -355,7 +355,7 @@ SELECT file
WHERE storage_category_id = '.$category_id.'
AND validated = \'false\'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
array_push($unvalidated_pictures, $row['file']);
@@ -504,7 +504,7 @@ INSERT INTO '.IMAGES_TABLE.'
$query.= '
;';
- mysql_query($query);
+ pwg_query($query);
// what are the ids of the pictures in the $category_id ?
$ids = array();
@@ -514,7 +514,7 @@ SELECT id
FROM '.IMAGES_TABLE.'
WHERE storage_category_id = '.$category_id.'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
array_push($ids, $row['id']);
@@ -527,7 +527,7 @@ DELETE FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id = '.$category_id.'
AND image_id IN ('.implode(',', $ids).')
;';
- mysql_query($query);
+ pwg_query($query);
foreach ($ids as $num => $image_id)
{
@@ -538,7 +538,7 @@ INSERT INTO '.IMAGE_CATEGORY_TABLE.'
(category_id,image_id) VALUES
'.implode(',', $ids).'
;';
- mysql_query($query);
+ pwg_query($query);
}
return $output;
}
diff --git a/admin/user_list.php b/admin/user_list.php
index 09ec07d3c..5815a4dce 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -67,7 +67,7 @@ if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
$query.= ' FROM '.USERS_TABLE;
$query.= ' WHERE id = '.$_GET['delete'];
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
// confirm user deletion ?
if ( !isset( $_GET['confirm'] ) )
{
@@ -91,7 +91,7 @@ if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
$query.= ' FROM '.USERS_TABLE;
$query.= ' WHERE id = '.$_GET['delete'];
$query.= ';';
- $row2 = mysql_fetch_array( mysql_query( $query ) );
+ $row2 = mysql_fetch_array( pwg_query( $query ) );
if ( $row2['nb_result'] > 0 )
{
delete_user( $_GET['delete'] );
@@ -137,7 +137,7 @@ else
$query.= ' FROM '.USERS_TABLE;
$query.= ' ORDER BY status ASC, username ASC';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
$current_status = '';
while ( $row = mysql_fetch_array( $result ) )
@@ -238,7 +238,7 @@ else
$query = 'SELECT id,mail_address';
$query.= ' FROM '.USERS_TABLE;
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
if ( isset( $_POST['mail-'.$row['id']] ) )
diff --git a/admin/user_modify.php b/admin/user_modify.php
index f55a041a8..38614b62e 100644
--- a/admin/user_modify.php
+++ b/admin/user_modify.php
@@ -44,7 +44,7 @@ $query.= ' username,status,mail_address';
$query.= ' from '.USERS_TABLE;
$query.= ' where id = '.$_GET['user_id'];
$query.= ';';
-$row = mysql_fetch_array( mysql_query( $query ) );
+$row = mysql_fetch_array( pwg_query( $query ) );
$page['username'] = $row['username'];
$page['status'] = $row['status'];
if ( !isset( $row['mail_address'] ) ) $row['mail_address'] = '';
@@ -90,7 +90,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= ' ORDER BY id ASC';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$dissociate = 'dissociate-'.$row['id'];
@@ -100,7 +100,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' WHERE user_id = '.$_GET['user_id'];
$query.= ' AND group_id ='.$row['id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
}
// create a new association between the user and a group
@@ -108,7 +108,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' (user_id,group_id) VALUES';
$query.= ' ('.$_GET['user_id'].','.$_POST['associate'].')';
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// synchronize category informations for this user
synchronize_user( $_GET['user_id'] );
}
@@ -179,7 +179,7 @@ if ( $display_form )
$query.= ' WHERE group_id = id';
$query.= ' AND user_id = '.$_GET['user_id'];
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
$user_groups = array();
if ( mysql_num_rows( $result ) > 0 )
{
@@ -204,7 +204,7 @@ if ( $display_form )
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= ' ORDER BY id ASC';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
if ( !in_array( $row['id'], $user_groups ) )
diff --git a/admin/user_perm.php b/admin/user_perm.php
index 424f85021..24dd22019 100644
--- a/admin/user_perm.php
+++ b/admin/user_perm.php
@@ -121,13 +121,13 @@ if ( isset( $_POST['submit'] ) )
$query = 'DELETE FROM '.PREFIX_TABLE.'user_access';
$query.= ' WHERE user_id = '.$_GET['user_id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// selecting all private categories
$query = 'SELECT id';
$query.= ' FROM '.PREFIX_TABLE.'categories';
$query.= " WHERE status = 'private'";
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$radioname = 'access-'.$row['id'];
@@ -137,7 +137,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' (user_id,cat_id) VALUES';
$query.= ' ('.$_GET['user_id'].','.$row['id'].')';
$query.= ';';
- mysql_query ( $query );
+ pwg_query ( $query );
}
}
check_favorites( $_GET['user_id'] );
@@ -157,7 +157,7 @@ $vtp->setVar( $sub, 'action', add_session_id( $action ) );
$query = 'SELECT id,name';
$query.= ' FROM '.PREFIX_TABLE.'groups';
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$groups = array();
while ( $row = mysql_fetch_array( $result ) )
{
@@ -168,7 +168,7 @@ $query = 'SELECT ug.group_id as groupid';
$query.= ' FROM '.PREFIX_TABLE.'user_group as ug';
$query.= ' WHERE user_id = '.$_GET['user_id'];
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$usergroups = array();
while ( $row = mysql_fetch_array( $result ) )
{
@@ -179,7 +179,7 @@ $query = 'SELECT id';
$query.= ' FROM '.PREFIX_TABLE.'categories';
$query.= " WHERE status = 'private'";
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$vtp->addSession( $sub, 'category' );
@@ -197,7 +197,7 @@ while ( $row = mysql_fetch_array( $result ) )
$query.= ' AND ug.user_id = '.$_GET['user_id'];
$query.= ' AND cat_id = '.$row['id'];
$query.= ';';
- $subresult = mysql_query( $query );
+ $subresult = pwg_query( $query );
$authorized_groups = array();
while ( $subrow = mysql_fetch_array( $subresult ) )
{
diff --git a/admin/user_search.php b/admin/user_search.php
index 9c8189443..fabb68e02 100644
--- a/admin/user_search.php
+++ b/admin/user_search.php
@@ -45,12 +45,12 @@ if ( isset( $_POST['submit'] ) )
$query = 'DELETE FROM '.USER_ACCESS_TABLE;
$query.= ' WHERE user_id = '.$_GET['user_id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// selecting all private categories
$query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= " WHERE status = 'private'";
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$radioname = $row['id'];
@@ -60,7 +60,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' (user_id,cat_id) VALUES';
$query.= ' ('.$_GET['user_id'].','.$row['id'].')';
$query.= ';';
- mysql_query ( $query );
+ pwg_query ( $query );
}
}
check_favorites( $_GET['user_id'] );
@@ -96,7 +96,7 @@ else
// only private categories are listed
$query = 'SELECT id FROM '.CATEGORIES_TABLE;
$query.= " WHERE status = 'private';";
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$is_user_allowed = is_user_allowed( $row['id'], $restrictions );
diff --git a/admin/waiting.php b/admin/waiting.php
index ebced6120..e49505e82 100644
--- a/admin/waiting.php
+++ b/admin/waiting.php
@@ -34,7 +34,7 @@ if ( isset( $_POST['submit'] ) )
{
$query = 'SELECT * FROM '.WAITING_TABLE;
$query.= " WHERE validated = 'false';";
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$key = 'validate-'.$row['id'];
@@ -48,7 +48,7 @@ if ( isset( $_POST['submit'] ) )
$query.= " SET validated = 'true'";
$query.= ' WHERE id = '.$row['id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// linking logically the picture to its storage category
$query = 'INSERT INTO';
}
@@ -59,7 +59,7 @@ if ( isset( $_POST['submit'] ) )
$query = 'DELETE FROM '.WAITING_TABLE;
$query.= ' WHERE id = '.$row['id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
// deletion of the associated files
$dir = get_complete_dir( $row['storage_category_id'] );
unlink( '.'.$dir.$row['file'] );
@@ -102,7 +102,7 @@ $query = 'SELECT * FROM '.WAITING_TABLE;
$query.= " WHERE validated = 'false'";
$query.= ' ORDER BY storage_category_id';
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$i = 0;
while ( $row = mysql_fetch_array( $result ) )
{
diff --git a/comments.php b/comments.php
index e39bb0693..100ac807b 100644
--- a/comments.php
+++ b/comments.php
@@ -53,7 +53,7 @@ if (isset($_POST['delete']) and count($_POST['comment_id']) > 0)
DELETE FROM '.COMMENTS_TABLE.'
WHERE id IN ('.implode(',', $_POST['comment_id']).')
;';
- mysql_query($query);
+ pwg_query($query);
}
// comments validation
if (isset($_POST['validate']) and count($_POST['comment_id']) > 0)
@@ -63,7 +63,7 @@ UPDATE '.COMMENTS_TABLE.'
SET validated = \'true\'
WHERE id IN ('.implode(',', $_POST['comment_id']).')
;';
- mysql_query($query);
+ pwg_query($query);
}
// +-----------------------------------------------------------------------+
// | page header and options |
@@ -128,7 +128,7 @@ if ($user['status'] != 'admin')
$query.= '
ORDER BY ic.image_id DESC
;';
-$result = mysql_query($query);
+$result = pwg_query($query);
if ($user['status'] == 'admin')
{
$template->assign_block_vars('validation', array());
@@ -144,7 +144,7 @@ SELECT name,file,storage_category_id as cat_id,tn_ext
FROM '.IMAGES_TABLE.'
WHERE id = '.$row['image_id'].'
;';
- $subresult = mysql_query($query);
+ $subresult = pwg_query($query);
$subrow = mysql_fetch_array($subresult);
if (!isset($array_cat_names[$subrow['cat_id']]))
@@ -195,7 +195,7 @@ SELECT *
$query.= '
ORDER BY date DESC
;';
- $handleresult = mysql_query($query);
+ $handleresult = pwg_query($query);
while ($subrow = mysql_fetch_array($handleresult))
{
$author = $subrow['author'];
diff --git a/identification.php b/identification.php
index 336879fe4..89698bee7 100644
--- a/identification.php
+++ b/identification.php
@@ -39,7 +39,7 @@ SELECT id, password
FROM '.USERS_TABLE.'
WHERE username = \''.$_POST['username'].'\'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
if ($row['password'] == md5($_POST['password']))
{
$session_length = $conf['session_length'];
diff --git a/include/category_calendar.inc.php b/include/category_calendar.inc.php
index fddf1b2cf..60851e692 100644
--- a/include/category_calendar.inc.php
+++ b/include/category_calendar.inc.php
@@ -39,7 +39,7 @@ SELECT YEAR('.$conf['calendar_datefield'].') AS year, COUNT(id) AS count
AND id = image_id
GROUP BY year
;';
-$result = mysql_query($query);
+$result = pwg_query($query);
$calendar_years = array();
while ($row = mysql_fetch_array($result))
{
@@ -92,7 +92,7 @@ SELECT DISTINCT(MONTH('.$conf['calendar_datefield'].')) AS month
AND YEAR('.$conf['calendar_datefield'].') = '.$page['calendar_year'].'
GROUP BY MONTH('.$conf['calendar_datefield'].')
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$calendar_months = array();
while ($row = mysql_fetch_array($result))
{
@@ -164,7 +164,7 @@ SELECT DISTINCT('.$conf['calendar_datefield'].') AS day, COUNT(id) AS count
AND MONTH('.$conf['calendar_datefield'].') = '.$page['calendar_month'].'
GROUP BY day
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$calendar_days = array();
while ($row = mysql_fetch_array($result))
{
@@ -188,7 +188,7 @@ SELECT category_id AS category, COUNT(id) AS count
AND id = image_id
GROUP BY category_id
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$calendar_categories = array();
// special category 0 : gathering all available categories (0 cannot be a
// oregular category identifier)
@@ -227,7 +227,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
ORDER BY RAND()
LIMIT 0,1
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$thumbnail_src = get_thumbnail_src($row['file'],
$row['storage_category_id'],
@@ -275,7 +275,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
ORDER BY RAND()
LIMIT 0,1
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$thumbnail_src = get_thumbnail_src($row['file'],
$row['storage_category_id'],
@@ -330,7 +330,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
ORDER BY RAND()
LIMIT 0,1
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$thumbnail_src = get_thumbnail_src($row['file'],
$row['storage_category_id'],
@@ -399,7 +399,7 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
ORDER BY RAND()
LIMIT 0,1
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$thumbnail_src = get_thumbnail_src($row['file'],
$row['storage_category_id'],
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index 0bed31a36..58ec78dde 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -47,7 +47,7 @@ SELECT DISTINCT(id),file,date_available,category_id
LIMIT '.$page['start'].','.$page['nb_image_page'].'
;';
// echo '<pre>'.$query.'</pre>';
-$result = mysql_query($query);
+$result = pwg_query($query);
// template thumbnail initialization
if ( mysql_num_rows($result) > 0 )
@@ -128,7 +128,7 @@ SELECT COUNT(*) AS nb_comments
WHERE image_id = '.$row['id'].'
AND validated = \'true\'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$template->assign_block_vars(
'thumbnails.line.thumbnail.nb_comments',
array('NB_COMMENTS'=>$row['nb_comments']));
diff --git a/include/category_recent_cats.inc.php b/include/category_recent_cats.inc.php
index a71148353..3f11f81c1 100644
--- a/include/category_recent_cats.inc.php
+++ b/include/category_recent_cats.inc.php
@@ -46,7 +46,7 @@ if ( $user['forbidden_categories'] != '' )
}
$query.= '
;';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
// template thumbnail initialization
if (mysql_num_rows($result) > 0)
@@ -75,7 +75,7 @@ SELECT id,file,tn_ext,storage_category_id
ORDER BY RAND()
LIMIT 0,1
;';
- $subrow = mysql_fetch_array( mysql_query( $query ) );
+ $subrow = mysql_fetch_array( pwg_query( $query ) );
$thumbnail_src = get_thumbnail_src($subrow['file'],
$subrow['storage_category_id'],
diff --git a/include/category_subcats.inc.php b/include/category_subcats.inc.php
index 6758f9e9a..34e86a93d 100644
--- a/include/category_subcats.inc.php
+++ b/include/category_subcats.inc.php
@@ -50,7 +50,7 @@ if (count($subcats) > 0)
// current row displayed
$row_number = 0;
}
-
+
foreach ($subcats as $subcat_id => $non_empty_id)
{
$name = $page['plain_structure'][$subcat_id]['name'];
@@ -61,7 +61,7 @@ SELECT representative_picture_id
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$non_empty_id.'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$query = '
SELECT file,tn_ext,storage_category_id
@@ -83,7 +83,7 @@ SELECT file,tn_ext,storage_category_id
}
$query.= '
;';
- $image_result = mysql_query($query);
+ $image_result = pwg_query($query);
$image_row = mysql_fetch_array($image_result);
$thumbnail_link = get_thumbnail_src($image_row['file'],
diff --git a/include/common.inc.php b/include/common.inc.php
index 8853e67f1..76c983134 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -171,7 +171,7 @@ $query = '
SELECT param,value
FROM '.CONFIG_TABLE.'
;';
-if( !( $result = mysql_query( $query ) ) )
+if( !( $result = pwg_query( $query ) ) )
{
die("Could not query config information");
}
diff --git a/include/config.inc.php b/include/config.inc.php
index baf2ef2db..e1a9acfa2 100644
--- a/include/config.inc.php
+++ b/include/config.inc.php
@@ -121,7 +121,7 @@ $conf['show_exif_fields'] = array('Make',
// calendar_datefield : date field of table "images" used for calendar
// catgory
-$conf['calendar_datefield'] = 'date_available';
+$conf['calendar_datefield'] = 'date_creation';
// rate : enable feature for rating elements
$conf['rate'] = true;
diff --git a/include/constants.php b/include/constants.php
index be641fd10..f9b9044fe 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -32,8 +32,8 @@ define('PHPWG_URL', 'http://www.phpwebgallery.net');
define('PHPWG_FORUM_URL', 'http://forum.phpwebgallery.net');
// Debug Level
-define('DEBUG', 1); // Debugging on
-//define('DEBUG', 0); // Debugging off
+//define('DEBUG', 1); // Debugging on
+define('DEBUG', 0); // Debugging off
// User level
define('ANONYMOUS', 2);
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 82577b66e..af2c6d6b3 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -51,7 +51,7 @@ function get_enums( $table, $field )
{
// retrieving the properties of the table. Each line represents a field :
// columns are 'Field', 'Type'
- $result=mysql_query("desc $table");
+ $result=pwg_query("desc $table");
while ( $row = mysql_fetch_array( $result ) )
{
// we are only interested in the the field given in parameter for the
@@ -350,7 +350,7 @@ function pwg_log( $file, $category, $picture = '' )
$query.= " (NOW(), '".$user['username']."'";
$query.= ",'".$_SERVER['REMOTE_ADDR']."'";
$query.= ",'".$file."','".$category."','".$picture."');";
- mysql_query( $query );
+ pwg_query( $query );
}
}
@@ -408,7 +408,7 @@ function notify( $type, $infos = '' )
$query.= " WHERE status = 'admin'";
$query.= ' AND mail_address IS NOT NULL';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$to = $row['mail_address'];
@@ -444,22 +444,26 @@ function pwg_write_debug()
fclose( $fp );
}
-function pwg_query( $query )
+function pwg_query($query)
{
- global $count_queries,$queries_time;
-
$start = get_moment();
- $output = '';
-
- $count_queries++;
- $output.= '<br /><br />['.$count_queries.'] '.$query;
- $result = mysql_query( $query );
- $time = get_moment() - $start;
- $queries_time+= $time;
- $output.= '<b>('.number_format( $time, 3, '.', ' ').' s)</b>';
- $output.= '('.number_format( $queries_time, 3, '.', ' ').' s)';
-
- // echo $output;
+ $result = mysql_query($query);
+
+ if (DEBUG)
+ {
+ global $count_queries,$queries_time;
+
+ $time = get_moment() - $start;
+ $count_queries++;
+
+ $output = '';
+ $output.= '<pre>['.$count_queries.'] '."\n".$query;
+ $queries_time+= $time;
+ $output.= "\n".'(this query time : '.number_format( $time, 3, '.', ' ').' s)</b>';
+ $output.= "\n".'(total SQL time : '.number_format( $queries_time, 3, '.', ' ').' s)';
+ $output.= '</pre>';
+ echo $output;
+ }
return $result;
}
@@ -594,4 +598,4 @@ function get_thumbnail_src($file, $storage_category_id, $tn_ext = '')
return $src;
}
-?> \ No newline at end of file
+?>
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 6171b562c..f924d5c83 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -88,7 +88,7 @@ function check_cat_id( $cat )
{
$query = 'SELECT id';
$query.= ' FROM '.CATEGORIES_TABLE.' WHERE id = '.$cat.';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
if ( mysql_num_rows( $result ) != 0 )
{
$page['cat'] = $cat;
@@ -139,7 +139,7 @@ function get_user_plain_structure()
$query.= ';';
$plain_structure = array();
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
$category = array();
@@ -270,7 +270,7 @@ function count_user_total_images()
// $query = '
// ;';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
if ( !isset( $row['total'] ) ) $row['total'] = 0;
@@ -306,7 +306,7 @@ function get_cat_info( $id )
$query.= ' WHERE a.id = '.$id;
$query.= ' AND a.site_id = b.id';
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
$cat = array();
// affectation of each field of the table "config" to an information of the
@@ -329,7 +329,7 @@ function get_cat_info( $id )
$query.= ' WHERE id IN ('.$cat['uppercats'].')';
$query.= ' ORDER BY id ASC';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while( $row = mysql_fetch_array( $result ) )
{
$cat['name'][$row['id']] = $row['name'];
@@ -368,7 +368,7 @@ function get_local_dir( $category_id )
$query = 'SELECT uppercats';
$query.= ' FROM '.CATEGORIES_TABLE.' WHERE id = '.$category_id;
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
$uppercats = $row['uppercats'];
}
@@ -378,7 +378,7 @@ function get_local_dir( $category_id )
$query = 'SELECT id,dir';
$query.= ' FROM '.CATEGORIES_TABLE.' WHERE id IN ('.$uppercats.')';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while( $row = mysql_fetch_array( $result ) )
{
$database_dirs[$row['id']] = $row['dir'];
@@ -403,7 +403,7 @@ SELECT galleries_url
WHERE s.id = c.site_id
AND c.id = '.$category_id.'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
return $row['galleries_url'];
}
@@ -593,7 +593,7 @@ SELECT DISTINCT(id) AS id
FROM '.CATEGORIES_TABLE.'
WHERE '.implode(' OR ', $search_cat_clauses).'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
$cat_ids = array();
while ($row = mysql_fetch_array($result))
{
@@ -668,9 +668,13 @@ SELECT COUNT(DISTINCT(id)) AS nb_total_images
else if ( $page['cat'] == 'most_visited' )
{
$page['title'] = $conf['top_number'].' '.$lang['most_visited_cat'];
-
- if ( isset( $forbidden ) ) $page['where'] = ' WHERE '.$forbidden;
- else $page['where'] = '';
+
+ $page['where'] = 'WHERE hit > 0';
+ if (isset($forbidden))
+ {
+ $page['where'] = "\n".' AND '.$forbidden;
+ }
+
$conf['order_by'] = ' ORDER BY hit DESC, file ASC';
$page['cat_nb_images'] = $conf['top_number'];
if ( isset( $page['start'] )
@@ -749,7 +753,7 @@ SELECT COUNT(1) AS count
FROM '.IMAGES_TABLE.'
'.$page['where'].'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
if ($row['count'] < $conf['top_number'])
{
$page['cat_nb_images'] = $row['count'];
@@ -788,7 +792,7 @@ SELECT COUNT(1) AS count
if (isset($query))
{
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
$row = mysql_fetch_array( $result );
$page['cat_nb_images'] = $row['nb_total_images'];
}
@@ -843,7 +847,7 @@ function get_non_empty_subcat_ids( $id_uppercat )
$query.= ' ORDER BY rank';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
// only categories with findable picture in any of its subcats is
@@ -874,7 +878,7 @@ function get_first_non_empty_cat_id( $id_uppercat )
}
$query.= ' ORDER BY RAND()';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
if ( $row['nb_images'] > 0 )
@@ -882,7 +886,7 @@ function get_first_non_empty_cat_id( $id_uppercat )
return $row['id'];
}
}
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
// recursive call
diff --git a/include/functions_group.inc.php b/include/functions_group.inc.php
index 12e85bd49..0a4356e3a 100644
--- a/include/functions_group.inc.php
+++ b/include/functions_group.inc.php
@@ -34,7 +34,7 @@ function get_group_restrictions( $group_id )
$query.= ' FROM '.PREFIX_TABLE.'categories';
$query.= " WHERE status = 'private'";
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
$privates = array();
while ( $row = mysql_fetch_array( $result ) )
{
@@ -46,7 +46,7 @@ function get_group_restrictions( $group_id )
$query.= ' FROM '.PREFIX_TABLE.'group_access';
$query.= ' WHERE group_id = '.$group_id;
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
array_push( $authorized, $row['cat_id'] );
@@ -92,7 +92,7 @@ function is_group_allowed( $category_id, $restrictions )
$query.= ' FROM '.PREFIX_TABLE.'categories';
$query.= ' WHERE id = '.$category_id;
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
if ( !isset( $row['id_uppercat'] ) ) $row['id_uppercat'] = '';
if ( $row['id_uppercat'] == '' ) $is_root = true;
$category_id = $row['id_uppercat'];
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php
index bb0fca11c..f67c60116 100644
--- a/include/functions_session.inc.php
+++ b/include/functions_session.inc.php
@@ -79,7 +79,7 @@ SELECT id
FROM '.SESSIONS_TABLE.'
WHERE id = \''.$generated_id.'\'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
if (mysql_num_rows($result) == 0)
{
$id_found = true;
@@ -94,7 +94,7 @@ INSERT INTO '.SESSIONS_TABLE.'
(\''.$generated_id.'\','.$userid.','.$expiration.',
\''.$_SERVER['REMOTE_ADDR'].'\')
;';
- mysql_query($query);
+ pwg_query($query);
setcookie('id', $generated_id, $expiration, cookie_path());
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index e14d0c627..0d4a5f1a6 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -69,7 +69,7 @@ function register_user( $login, $password, $password_conf,
$query.= ' FROM '.USERS_TABLE;
$query.= " WHERE username = '".$login."'";
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
if ( mysql_num_rows($result) > 0 ) $error[$i++] = $lang['reg_err_login5'];
}
// given password must be the same as the confirmation
@@ -94,7 +94,7 @@ function register_user( $login, $password, $password_conf,
$query.= ' FROM '.USERS_TABLE;
$query.= " WHERE username = 'guest'";
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
// 2. adding new user
$query = 'INSERT INTO '.USERS_TABLE;
$query.= ' (';
@@ -115,12 +115,12 @@ function register_user( $login, $password, $password_conf,
else $query.= "'".$row[$info]."'";
}
$query.= ');';
- mysql_query( $query );
+ pwg_query( $query );
// 3. retrieving the id of the newly created user
$query = 'SELECT id';
$query.= ' FROM '.USERS_TABLE;
$query.= " WHERE username = '".$login."';";
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
$user_id = $row['id'];
// 4. adding access to the new user, the same as the user "guest"
$query = 'SELECT cat_id';
@@ -128,13 +128,13 @@ function register_user( $login, $password, $password_conf,
$query.= ','.PREFIX_TABLE.'users as u ';
$query.= ' where u.id = ua.user_id';
$query.= " and u.username = 'guest';";
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while( $row = mysql_fetch_array( $result ) )
{
$query = 'INSERT INTO '.PREFIX_TABLE.'user_access';
$query.= ' (user_id,cat_id) VALUES';
$query.= ' ('.$user_id.','.$row['cat_id'].');';
- mysql_query ( $query );
+ pwg_query ( $query );
}
// 5. associate new user to the same groups that the guest
$query = 'SELECT group_id';
@@ -143,14 +143,14 @@ function register_user( $login, $password, $password_conf,
$query.= " WHERE u.username = 'guest'";
$query.= ' AND ug.user_id = u.id';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while( $row = mysql_fetch_array( $result ) )
{
$query = 'INSERT INTO '.PREFIX_TABLE.'user_group';
$query.= ' (user_id,group_id) VALUES';
$query.= ' ('.$user_id.','.$row['group_id'].')';
$query.= ';';
- mysql_query ( $query );
+ pwg_query ( $query );
}
}
return $error;
@@ -187,7 +187,7 @@ function update_user( $user_id, $mail_address, $status,
}
$query.= ' WHERE id = '.$user_id;
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
return $error;
}
@@ -270,7 +270,7 @@ function getuserdata($user)
$sql = "SELECT * FROM " . USERS_TABLE;
$sql.= " WHERE ";
$sql .= ( ( is_integer($user) ) ? "id = $user" : "username = '" . str_replace("\'", "''", $user) . "'" ) . " AND id <> " . ANONYMOUS;
- $result = mysql_query($sql);
+ $result = pwg_query($sql);
return ( $row = mysql_fetch_array($result) ) ? $row : false;
}
?>
diff --git a/include/user.inc.php b/include/user.inc.php
index a39441bb2..039b7a448 100644
--- a/include/user.inc.php
+++ b/include/user.inc.php
@@ -63,7 +63,7 @@ SELECT user_id,expiration,ip
FROM '.SESSIONS_TABLE.'
WHERE id = \''.$page['session_id'].'\'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
if (mysql_num_rows($result) > 0)
{
$row = mysql_fetch_array($result);
@@ -76,7 +76,7 @@ SELECT user_id,expiration,ip
$delete_query = 'DELETE FROM '.SESSIONS_TABLE;
$delete_query.= " WHERE id = '".$page['session_id']."'";
$delete_query.= ';';
- mysql_query($delete_query);
+ pwg_query($delete_query);
}
else if ($_SERVER['REMOTE_ADDR'] == $row['ip'])
{
@@ -97,7 +97,7 @@ if (!$query_done)
$user['is_the_guest'] = true;
}
$query_user .= ';';
-$row = mysql_fetch_array(mysql_query($query_user));
+$row = mysql_fetch_array(pwg_query($query_user));
// affectation of each value retrieved in the users table into a variable
// of the array $user.
diff --git a/picture.php b/picture.php
index 1ef71bea5..7c5aa42fa 100644
--- a/picture.php
+++ b/picture.php
@@ -37,10 +37,12 @@ if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
check_restrictions( $page['cat'] );
}
//---------------------------------------- incrementation of the number of hits
-$query = 'UPDATE '.IMAGES_TABLE.' SET hit=hit+1';
-$query.= ' WHERE id='.$_GET['image_id'];
-$query.= ';';
-@mysql_query( $query );
+$query = '
+UPDATE '.IMAGES_TABLE.'
+ SET hit = hit+1
+ WHERE id = '.$_GET['image_id'].'
+;';
+@pwg_query( $query );
//-------------------------------------------------------------- initialization
initialize_category( 'picture' );
// retrieving the number of the picture in its category (in order)
@@ -51,7 +53,7 @@ SELECT DISTINCT(id)
'.$page['where'].'
'.$conf['order_by'].'
;';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$page['num'] = 0;
$belongs = false;
while ($row = mysql_fetch_array($result))
@@ -111,7 +113,7 @@ else
}
$query.= ';';
-$result = mysql_query( $query );
+$result = pwg_query( $query );
$indexes = array('prev', 'current', 'next');
foreach (array('prev', 'current', 'next') as $i)
@@ -225,14 +227,14 @@ DELETE
WHERE user_id = '.$user['id'].'
AND element_id = '.$_GET['image_id'].'
;';
- mysql_query($query);
+ pwg_query($query);
$query = '
INSERT INTO '.RATE_TABLE.'
(user_id,element_id,rate)
VALUES
('.$user['id'].','.$_GET['image_id'].','.$_GET['rate'].')
;';
- mysql_query($query);
+ pwg_query($query);
// update of images.average_rate field
$query = '
@@ -240,13 +242,13 @@ SELECT ROUND(AVG(rate),2) AS average_rate
FROM '.RATE_TABLE.'
WHERE element_id = '.$_GET['image_id'].'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
$query = '
UPDATE '.IMAGES_TABLE.'
SET average_rate = '.$row['average_rate'].'
WHERE id = '.$_GET['image_id'].'
;';
- mysql_query($query);
+ pwg_query($query);
}
//--------------------------------------------------------- favorite management
if ( isset( $_GET['add_fav'] ) )
@@ -255,7 +257,7 @@ if ( isset( $_GET['add_fav'] ) )
$query.= ' WHERE user_id = '.$user['id'];
$query.= ' AND image_id = '.$picture['current']['id'];
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
if ( $_GET['add_fav'] == 1 )
{
@@ -263,7 +265,7 @@ if ( isset( $_GET['add_fav'] ) )
$query.= ' (image_id,user_id) VALUES';
$query.= ' ('.$picture['current']['id'].','.$user['id'].')';
$query.= ';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
}
if ( !$_GET['add_fav'] and $page['cat'] == 'fav' )
{
@@ -301,7 +303,7 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
$query.= ' FROM '.USERS_TABLE;
$query.= " WHERE username = '".$author."'";
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
if ( $row['user_exists'] == 1 )
{
$template->assign_block_vars(
@@ -319,7 +321,7 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
$query.= ' WHERE date > FROM_UNIXTIME('.$reference_date.')';
$query.= " AND author = '".$author."'";
$query.= ';';
- if ( mysql_num_rows( mysql_query( $query ) ) == 0
+ if ( mysql_num_rows( pwg_query( $query ) ) == 0
or $conf['anti-flood_time'] == 0 )
{
$query = 'INSERT INTO '.COMMENTS_TABLE;
@@ -336,7 +338,7 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
$query.= ",'false'";
}
$query.= ');';
- mysql_query( $query );
+ pwg_query( $query );
// information message
$message = $lang['comment_added'];
if ( $conf['comments_validation'] and $user['status'] != 'admin' )
@@ -370,7 +372,7 @@ if ( isset( $_GET['del'] )
$query = 'DELETE FROM '.COMMENTS_TABLE;
$query.= ' WHERE id = '.$_GET['del'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
//
@@ -502,7 +504,7 @@ if ( !$user['is_the_guest'] )
$query = 'SELECT COUNT(*) AS nb_fav';
$query.= ' FROM '.FAVORITES_TABLE.' WHERE image_id = '.$_GET['image_id'];
$query.= ' AND user_id = '.$user['id'].';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
$row = mysql_fetch_array( $result );
if (!$row['nb_fav'])
{
@@ -712,7 +714,7 @@ SELECT COUNT(rate) AS count
FROM '.RATE_TABLE.'
WHERE element_id = '.$picture['current']['id'].'
;';
- $row = mysql_fetch_array(mysql_query($query));
+ $row = mysql_fetch_array(pwg_query($query));
if ($row['count'] == 0)
{
$value = $lang['no_rate'];
@@ -745,7 +747,7 @@ if ($user['forbidden_categories'] != '')
}
$query.= '
;';
-$result = mysql_query($query);
+$result = pwg_query($query);
$categories = '';
while ($row = mysql_fetch_array($result))
{
@@ -870,7 +872,7 @@ SELECT rate
WHERE user_id = '.$user['id'].'
AND element_id = '.$_GET['image_id'].'
;';
- $result = mysql_query($query);
+ $result = pwg_query($query);
if (mysql_num_rows($result) > 0)
{
$row = mysql_fetch_array($result);
@@ -921,7 +923,7 @@ if ( $conf['show_comments'] )
$query.= ' FROM '.COMMENTS_TABLE.' WHERE image_id = '.$_GET['image_id'];
$query.= " AND validated = 'true'";
$query.= ';';
- $row = mysql_fetch_array( mysql_query( $query ) );
+ $row = mysql_fetch_array( pwg_query( $query ) );
// navigation bar creation
$url = PHPWG_ROOT_PATH.'picture.php';
@@ -950,7 +952,7 @@ if ( $conf['show_comments'] )
$query.= " AND validated = 'true'";
$query.= ' ORDER BY date ASC';
$query.= ' LIMIT '.$page['start'].', '.$conf['nb_comment_page'].';';
- $result = mysql_query( $query );
+ $result = pwg_query( $query );
while ( $row = mysql_fetch_array( $result ) )
{
diff --git a/profile.php b/profile.php
index 8eb2ee0b8..4aa34adeb 100644
--- a/profile.php
+++ b/profile.php
@@ -87,7 +87,7 @@ if ( isset( $_POST['submit'] ) )
}
$query.= ' WHERE id = '.$user['id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
if ( isset( $_POST['use_new_pwd'] ) )
{
@@ -95,7 +95,7 @@ if ( isset( $_POST['submit'] ) )
$query.= " SET password = '".md5( $_POST['password'] )."'";
$query.= ' WHERE id = '.$user['id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
if ( isset( $_POST['create_cookie'] ) )
{
@@ -106,7 +106,7 @@ if ( isset( $_POST['submit'] ) )
$query.= ' SET expiration = '.$_POST['cookie_expiration'];
$query.= " WHERE id = '".$page['session_id']."'";
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
}
// redirection
$url = 'category.php';
diff --git a/upload.php b/upload.php
index 61081777c..bea65f4e6 100644
--- a/upload.php
+++ b/upload.php
@@ -106,7 +106,7 @@ function validate_upload( $temp_name, $my_max_file_size,
}
else
{
- @chmod( $temp_name, 0644);
+ @chmod( $temp_name, 0644);
}
return $result;
}
@@ -212,7 +212,7 @@ if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
$query.= ",'".htmlspecialchars( $_POST['username'], ENT_QUOTES)."'";
$query.= ",'".$_POST['mail_address']."',".time().",'".$xml_infos."')";
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
$page['waiting_id'] = mysql_insert_id();
// mail notification for administrators
if ( $conf['mail_notification'] )
@@ -230,7 +230,7 @@ if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
$query.= ' from '.WAITING_TABLE;
$query.= ' where id = '.$_GET['waiting_id'];
$query.= ';';
- $result= mysql_query( $query );
+ $result= pwg_query( $query );
$row = mysql_fetch_array( $result );
$file = substr ( $row['file'], 0, strrpos ( $row['file'], ".") );
$extension = get_extension( $_FILES['picture']['name'] );
@@ -249,7 +249,7 @@ if ( isset( $_POST['submit'] ) and isset( $_GET['waiting_id'] ) )
$query.= " set tn_ext = '".$extension."'";
$query.= ' where id = '.$_GET['waiting_id'];
$query.= ';';
- mysql_query( $query );
+ pwg_query( $query );
$page['upload_successful'] = true;
}
}