mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-04-30 10:34:58 +02:00
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
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user