diff options
author | z0rglub <z0rglub@piwigo.org> | 2003-09-16 21:32:30 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2003-09-16 21:32:30 +0000 |
commit | 0245e00a7670a0c76962a95d2152c0962634bef1 (patch) | |
tree | dd7a313c889688283773c827e634ce306ac11213 /admin/update.php | |
parent | 64fd038b76391ef09e6b56013f328e387223f4a0 (diff) |
Adding the name when inserting a remote category in the database. $name
becomes $dir (even if named "name" in the XML file)
git-svn-id: http://piwigo.org/svn/trunk@126 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/update.php')
-rw-r--r-- | admin/update.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/admin/update.php b/admin/update.php index 493b9d563..a808af9a2 100644 --- a/admin/update.php +++ b/admin/update.php @@ -355,18 +355,18 @@ function insert_remote_category( $xml_dir, $site_id, $id_uppercat, $level ) { // is the category already existing ? $category_id = ''; - $name = getAttribute( $list_dirs[$i], 'name' ); - $categories[$i] = $name; + $dir = getAttribute( $list_dirs[$i], 'name' ); + $categories[$i] = $dir; $src = '../template/'.$user['template'].'/admin/images/puce.gif'; $output.= '<img src="'.$src.'" alt=">" />'; - $output.= '<span style="font-weight:bold;">'.$name.'</span>'; + $output.= '<span style="font-weight:bold;">'.$dir.'</span>'; $output.= '<div class="retrait">'; $query = 'SELECT id'; $query.= ' FROM '.PREFIX_TABLE.'categories'; $query.= ' WHERE site_id = '.$site_id; - $query.= " AND dir = '".$name."'"; + $query.= " AND dir = '".$dir."'"; if ( $id_uppercat == 'NULL' ) { $query.= ' AND id_uppercat IS NULL'; @@ -379,9 +379,11 @@ function insert_remote_category( $xml_dir, $site_id, $id_uppercat, $level ) $result = mysql_query( $query ); if ( mysql_num_rows( $result ) == 0 ) { + $name = str_replace( '_', ' ', $dir ); // we have to create the category $query = 'INSERT INTO '.PREFIX_TABLE.'categories'; - $query.= " (dir,site_id,id_uppercat) VALUES ('".$name."',".$site_id; + $query.= ' (name,dir,site_id,id_uppercat) VALUES '; + $query.= "('".$name."','".$dir."',".$site_id; if ( !is_numeric( $id_uppercat ) ) { $query.= ',NULL'; |