aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-10-30 15:42:29 +0000
committerz0rglub <z0rglub@piwigo.org>2004-10-30 15:42:29 +0000
commit7cd9b65e3299fb8bc6a83e65f89fcecca62f3178 (patch)
treee068090892b16db654a2bf0c2886b65eaf44a14f /admin
parent3730c810f254267ab1fb49f4cad55866e780ad6e (diff)
- function mysql_query replaced by pwg_query : the same with debugging
features - by default, DEBUG is set to 0 (off) git-svn-id: http://piwigo.org/svn/trunk@587 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-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
22 files changed, 182 insertions, 182 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 ) )
{