mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-21 00:53:04 +02:00
Merge of the 1.3.1 release
Creation of an unique include file (common.php) Creation of an unique define file (include/constants.php) Modification of the installation procedure git-svn-id: http://piwigo.org/svn/trunk@345 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+51
-22
@@ -40,20 +40,6 @@ if ( isset( $_POST['submit'] ) )
|
||||
$query.= ' WHERE id = '.$_GET['cat'];
|
||||
$query.= ';';
|
||||
$row = mysql_fetch_array( mysql_query( $query ) );
|
||||
|
||||
if ( $_POST['status'] != $row['status'] )
|
||||
{
|
||||
// deletion of all access for groups concerning this category
|
||||
$query = 'DELETE';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'group_access';
|
||||
$query.= ' WHERE cat_id = '.$_GET['cat'];
|
||||
mysql_query( $query );
|
||||
// deletion of all access for users concerning this category
|
||||
$query = 'DELETE';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'user_access';
|
||||
$query.= ' WHERE cat_id = '.$_GET['cat'];
|
||||
mysql_query( $query );
|
||||
}
|
||||
|
||||
$query = 'UPDATE '.PREFIX_TABLE.'categories';
|
||||
|
||||
@@ -78,13 +64,31 @@ if ( isset( $_POST['submit'] ) )
|
||||
if ( isset( $_POST['associate'] ) )
|
||||
{
|
||||
$query.= ', id_uppercat = ';
|
||||
if ( $_POST['associate'] == -1 ) $query.= 'NULL';
|
||||
else $query.= $_POST['associate'];
|
||||
if ( $_POST['associate'] == -1 or $_POST['associate'] == '' )
|
||||
$query.= 'NULL';
|
||||
else
|
||||
$query.= $_POST['associate'];
|
||||
}
|
||||
$query.= ' WHERE id = '.$_GET['cat'];
|
||||
$query.= ';';
|
||||
mysql_query( $query );
|
||||
|
||||
if ( $_POST['status'] != $row['status'] )
|
||||
{
|
||||
// deletion of all access for groups concerning this category
|
||||
$query = 'DELETE';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'group_access';
|
||||
$query.= ' WHERE cat_id = '.$_GET['cat'];
|
||||
mysql_query( $query );
|
||||
// deletion of all access for users concerning this category
|
||||
$query = 'DELETE';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'user_access';
|
||||
$query.= ' WHERE cat_id = '.$_GET['cat'];
|
||||
mysql_query( $query );
|
||||
// resynchronize all users
|
||||
synchronize_all_users();
|
||||
}
|
||||
|
||||
// checking users favorites
|
||||
$query = 'SELECT id';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'users';
|
||||
@@ -111,6 +115,10 @@ $query.= ' WHERE a.id = '.$_GET['cat'];
|
||||
$query.= ' AND a.site_id = b.id';
|
||||
$query.= ';';
|
||||
$row = mysql_fetch_array( mysql_query( $query ) );
|
||||
|
||||
if ( !isset( $row['dir'] ) ) $row['dir'] = '';
|
||||
if ( !isset( $row['id_uppercat'] ) ) $row['id_uppercat'] = '';
|
||||
|
||||
$result = get_cat_info( $row['id'] );
|
||||
// cat name
|
||||
$cat_name = get_cat_display_name( $result['name'], ' - ', '' );
|
||||
@@ -135,6 +143,7 @@ if ( $row['site_id'] != 1 )
|
||||
$vtp->closeSession( $sub, 'server' );
|
||||
}
|
||||
$vtp->setVar( $sub, 'name', $row['name'] );
|
||||
if ( !isset( $row['comment'] ) ) $row['comment'] = '';
|
||||
$vtp->setVar( $sub, 'comment', $row['comment'] );
|
||||
// status : public, private...
|
||||
$options = get_enums( PREFIX_TABLE.'categories', 'status' );
|
||||
@@ -203,12 +212,32 @@ if ( $conf['upload_available'] and $row['dir'] != '' and $row['site_id'] == 1 )
|
||||
if ( $row['dir'] == '' )
|
||||
{
|
||||
$vtp->addSession( $sub, 'parent' );
|
||||
$vtp->addSession( $sub, 'associate_cat' );
|
||||
$vtp->setVar( $sub, 'associate_cat.value', '-1' );
|
||||
$vtp->setVar( $sub, 'associate_cat.content', '' );
|
||||
$vtp->closeSession( $sub, 'associate_cat' );
|
||||
$structure = create_structure( '', array() );
|
||||
display_categories( $structure, ' ', $row['id_uppercat'], $row['id'] );
|
||||
// We only show a List Of Values if the number of categories is less than
|
||||
// $conf['max_LOV_categories']
|
||||
$query = 'SELECT COUNT(id) AS nb_total_categories';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'categories';
|
||||
$query.= ';';
|
||||
$countrow = mysql_fetch_array( mysql_query( $query ) );
|
||||
if ( $countrow['nb_total_categories'] < $conf['max_LOV_categories'] )
|
||||
{
|
||||
$vtp->addSession( $sub, 'associate_LOV' );
|
||||
$vtp->addSession( $sub, 'associate_cat' );
|
||||
$vtp->setVar( $sub, 'associate_cat.value', '-1' );
|
||||
$vtp->setVar( $sub, 'associate_cat.content', '' );
|
||||
$vtp->closeSession( $sub, 'associate_cat' );
|
||||
$page['plain_structure'] = get_plain_structure( true );
|
||||
$structure = create_structure( '', array() );
|
||||
display_categories( $structure, ' ', $row['id_uppercat'],$row['id'] );
|
||||
$vtp->closeSession( $sub, 'associate_LOV' );
|
||||
}
|
||||
// else, we only display a small text field, we suppose the administrator
|
||||
// knows the id of its category
|
||||
else
|
||||
{
|
||||
$vtp->addSession( $sub, 'associate_text' );
|
||||
$vtp->setVar( $sub, 'associate_text.value', $row['id_uppercat'] );
|
||||
$vtp->closeSession( $sub, 'associate_text' );
|
||||
}
|
||||
$vtp->closeSession( $sub, 'parent' );
|
||||
}
|
||||
//----------------------------------------------------------- sending html code
|
||||
|
||||
Reference in New Issue
Block a user