Bug 1733 fixed : merge from trunk

single quotes in queries

git-svn-id: http://piwigo.org/svn/branches/2.1@6551 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
nikrou 2010-06-17 18:11:11 +00:00
parent 5baa3409e5
commit dbe75d113b
9 changed files with 36 additions and 36 deletions

View file

@ -92,8 +92,8 @@ if (isset($_POST['submit']))
if (isset($_POST['image_order_subcats'])) if (isset($_POST['image_order_subcats']))
{ {
$query = ' $query = '
UPDATE '.CATEGORIES_TABLE.' SET image_order='.(isset($image_order) ? 'NULL':"'$image_order'").' UPDATE '.CATEGORIES_TABLE.' SET image_order='.(isset($image_order) ? 'NULL':'\''.$image_order.'\'').'
WHERE uppercats LIKE "'.$cat_info['uppercats'].',%"'; WHERE uppercats LIKE \''.$cat_info['uppercats'].',%\'';
pwg_query($query); pwg_query($query);
} }

View file

@ -139,10 +139,10 @@ if (isset($_POST['submit']) and !is_adviser())
$conf['extents_for_templates'] = serialize($replacements); $conf['extents_for_templates'] = serialize($replacements);
$tpl_extension = $replacements; $tpl_extension = $replacements;
/* ecrire la nouvelle conf */ /* ecrire la nouvelle conf */
$query = " $query = '
UPDATE ".CONFIG_TABLE." UPDATE '.CONFIG_TABLE.'
SET value = '". $conf['extents_for_templates'] ."' SET value = \''. $conf['extents_for_templates'] .'\'
WHERE param = 'extents_for_templates';"; WHERE param = \'extents_for_templates\';';
if (pwg_query($query)) if (pwg_query($query))
{ {
array_push($page['infos'], array_push($page['infos'],

View file

@ -28,7 +28,7 @@ function get_cat_id_from_permalink( $permalink )
{ {
$query =' $query ='
SELECT id FROM '.CATEGORIES_TABLE.' SELECT id FROM '.CATEGORIES_TABLE.'
WHERE permalink="'.$permalink.'"'; WHERE permalink=\''.$permalink.'\'';
$ids = array_from_query($query, 'id'); $ids = array_from_query($query, 'id');
if (!empty($ids)) if (!empty($ids))
{ {
@ -69,7 +69,7 @@ function delete_cat_permalink( $cat_id, $save )
$query = ' $query = '
SELECT permalink SELECT permalink
FROM '.CATEGORIES_TABLE.' FROM '.CATEGORIES_TABLE.'
WHERE id="'.$cat_id.'" WHERE id=\''.$cat_id.'\'
;'; ;';
$result = pwg_query($query); $result = pwg_query($query);
if ( pwg_db_num_rows($result) ) if ( pwg_db_num_rows($result) )
@ -108,7 +108,7 @@ UPDATE '.CATEGORIES_TABLE.'
$query = ' $query = '
UPDATE '.OLD_PERMALINKS_TABLE.' UPDATE '.OLD_PERMALINKS_TABLE.'
SET date_deleted=NOW() SET date_deleted=NOW()
WHERE cat_id='.$cat_id.' AND permalink="'.$permalink.'"'; WHERE cat_id='.$cat_id.' AND permalink=\''.$permalink.'\'';
} }
else else
{ {
@ -116,7 +116,7 @@ UPDATE '.OLD_PERMALINKS_TABLE.'
INSERT INTO '.OLD_PERMALINKS_TABLE.' INSERT INTO '.OLD_PERMALINKS_TABLE.'
(permalink, cat_id, date_deleted) (permalink, cat_id, date_deleted)
VALUES VALUES
( "'.$permalink.'",'.$cat_id.',NOW() )'; ( \''.$permalink.'\','.$cat_id.',NOW() )';
} }
pwg_query( $query ); pwg_query( $query );
} }
@ -185,13 +185,13 @@ function set_cat_permalink( $cat_id, $permalink, $save )
assert( $old_cat_id==$cat_id ); assert( $old_cat_id==$cat_id );
$query = ' $query = '
DELETE FROM '.OLD_PERMALINKS_TABLE.' DELETE FROM '.OLD_PERMALINKS_TABLE.'
WHERE cat_id='.$old_cat_id.' AND permalink="'.$permalink.'"'; WHERE cat_id='.$old_cat_id.' AND permalink=\''.$permalink.'\'';
pwg_query($query); pwg_query($query);
} }
$query = ' $query = '
UPDATE '.CATEGORIES_TABLE.' UPDATE '.CATEGORIES_TABLE.'
SET permalink="'.$permalink.'" SET permalink=\''.$permalink.'\'
WHERE id='.$cat_id; WHERE id='.$cat_id;
// LIMIT 1'; // LIMIT 1';
pwg_query($query); pwg_query($query);

View file

@ -87,7 +87,7 @@ function deactivate_non_standard_plugins()
SELECT id SELECT id
FROM '.PREFIX_TABLE.'plugins FROM '.PREFIX_TABLE.'plugins
WHERE state = "active" WHERE state = "active"
AND id NOT IN ("' . implode('","', $standard_plugins) . '") AND id NOT IN (\'' . implode('\',\'', $standard_plugins) . '\')
;'; ;';
$result = pwg_query($query); $result = pwg_query($query);
@ -102,7 +102,7 @@ AND id NOT IN ("' . implode('","', $standard_plugins) . '")
$query = ' $query = '
UPDATE '.PREFIX_TABLE.'plugins UPDATE '.PREFIX_TABLE.'plugins
SET state="inactive" SET state="inactive"
WHERE id IN ("' . implode('","', $plugins) . '") WHERE id IN (\'' . implode('\',\'', $plugins) . '\')
;'; ;';
pwg_query($query); pwg_query($query);
@ -162,7 +162,7 @@ SELECT status
$query = ' $query = '
SELECT password, status SELECT password, status
FROM '.USERS_TABLE.' FROM '.USERS_TABLE.'
WHERE username = "'.$username.'" WHERE username = \''.$username.'\'
;'; ;';
} }
else else
@ -172,7 +172,7 @@ SELECT u.password, ui.status
FROM '.USERS_TABLE.' AS u FROM '.USERS_TABLE.' AS u
INNER JOIN '.USER_INFOS_TABLE.' AS ui INNER JOIN '.USER_INFOS_TABLE.' AS ui
ON u.'.$conf['user_fields']['id'].'=ui.user_id ON u.'.$conf['user_fields']['id'].'=ui.user_id
WHERE '.$conf['user_fields']['username'].'="'.$username.'" WHERE '.$conf['user_fields']['username'].'=\''.$username.'\'
;'; ;';
} }
$row = pwg_db_fetch_assoc(pwg_query($query)); $row = pwg_db_fetch_assoc(pwg_query($query));

View file

@ -99,11 +99,11 @@ INSERT INTO '.LANGUAGES_TABLE.'
break; break;
} }
$query = " $query = '
DELETE DELETE
FROM ".LANGUAGES_TABLE." FROM '.LANGUAGES_TABLE.'
WHERE id= '".$language_id."' WHERE id= \''.$language_id.'\'
;"; ;';
pwg_query($query); pwg_query($query);
break; break;
@ -122,8 +122,8 @@ DELETE
// Set default language to user who are using this language // Set default language to user who are using this language
$query = ' $query = '
UPDATE '.USER_INFOS_TABLE.' UPDATE '.USER_INFOS_TABLE.'
SET language = "'.get_default_language().'" SET language = \''.get_default_language().'\'
WHERE language = "'.$language_id.'" WHERE language = \''.$language_id.'\'
;'; ;';
pwg_query($query); pwg_query($query);
@ -136,7 +136,7 @@ UPDATE '.USER_INFOS_TABLE.'
case 'set_default': case 'set_default':
$query = ' $query = '
UPDATE '.USER_INFOS_TABLE.' UPDATE '.USER_INFOS_TABLE.'
SET language = "'.$language_id.'" SET language = \''.$language_id.'\'
WHERE user_id = '.$conf['default_user_id'].' WHERE user_id = '.$conf['default_user_id'].'
;'; ;';
pwg_query($query); pwg_query($query);

View file

@ -175,11 +175,11 @@ SELECT
} }
} }
$query = " $query = '
DELETE DELETE
FROM ".THEMES_TABLE." FROM '.THEMES_TABLE.'
WHERE id= '".$theme_id."' WHERE id= \''.$theme_id.'\'
;"; ;';
pwg_query($query); pwg_query($query);
break; break;
@ -300,7 +300,7 @@ SELECT
$clauses = array(); $clauses = array();
if (!empty($id)) if (!empty($id))
{ {
$clauses[] = "id = '".$id."'"; $clauses[] = 'id = \''.$id.'\'';
} }
if (count($clauses) > 0) if (count($clauses) > 0)
{ {

View file

@ -114,16 +114,16 @@ foreach($missing_language_ids as $language_id)
{ {
$query = ' $query = '
UPDATE '.USER_INFOS_TABLE.' UPDATE '.USER_INFOS_TABLE.'
SET language = "'.get_default_language().'" SET language = \''.get_default_language().'\'
WHERE language = "'.$language_id.'" WHERE language = \''.$language_id.'\'
;'; ;';
pwg_query($query); pwg_query($query);
$query = " $query = '
DELETE DELETE
FROM ".LANGUAGES_TABLE." FROM '.LANGUAGES_TABLE.'
WHERE id= '".$language_id."' WHERE id= \''.$language_id.'\'
;"; ;';
pwg_query($query); pwg_query($query);
} }

View file

@ -96,7 +96,7 @@ elseif ( isset($_GET['delete_permanent']) and !is_adviser() )
{ {
$query = ' $query = '
DELETE FROM '.OLD_PERMALINKS_TABLE.' DELETE FROM '.OLD_PERMALINKS_TABLE.'
WHERE permalink="'.$_GET['delete_permanent'].'" WHERE permalink=\''.$_GET['delete_permanent'].'\'
LIMIT 1'; LIMIT 1';
$result = pwg_query($query); $result = pwg_query($query);
if (pwg_db_changes($result)==0) if (pwg_db_changes($result)==0)

View file

@ -183,7 +183,7 @@ $thumbnalized = array();
// what is the directory to search in ? // what is the directory to search in ?
$query = ' $query = '
SELECT galleries_url FROM '.SITES_TABLE.' SELECT galleries_url FROM '.SITES_TABLE.'
WHERE galleries_url NOT LIKE "http://%" WHERE galleries_url NOT LIKE \'http://%\'
;'; ;';
$result = pwg_query($query); $result = pwg_query($query);
while ( $row=pwg_db_fetch_assoc($result) ) while ( $row=pwg_db_fetch_assoc($result) )