aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-11-01 15:01:28 +0000
committerz0rglub <z0rglub@piwigo.org>2004-11-01 15:01:28 +0000
commitb1db5e55ae77c1ce386b25f8083a8bdd88607a96 (patch)
tree1d49d20a6cd52a82b1373c4e7784e931fd563eb0 /include
parentfa9a5cd07bc9931d1dffb9c54ab93ce3736ac506 (diff)
- synchronization interface redesigned : a form lets user choose option of
dirs/files/metadata sync on all categories or a defined one (including subcategories) - database sync is only available through update.php git-svn-id: http://piwigo.org/svn/trunk@589 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/constants.php5
-rw-r--r--include/functions_category.inc.php82
-rw-r--r--include/page_tail.php3
-rw-r--r--include/template.php2
4 files changed, 67 insertions, 25 deletions
diff --git a/include/constants.php b/include/constants.php
index f9b9044fe..c44a5cc65 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -31,9 +31,8 @@ define('PHPWG_VERSION', 'BSF');
define('PHPWG_URL', 'http://www.phpwebgallery.net');
define('PHPWG_FORUM_URL', 'http://forum.phpwebgallery.net');
-// Debug Level
-//define('DEBUG', 1); // Debugging on
-define('DEBUG', 0); // Debugging off
+// Debug Level : 1 = on, 0 = off
+define('DEBUG', 0);
// User level
define('ANONYMOUS', 2);
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index f924d5c83..9253a24d8 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -115,49 +115,59 @@ function get_user_plain_structure()
{
global $page,$user;
- $infos = array( 'name','id','date_last','nb_images','dir','id_uppercat',
+ $infos = array('name','id','date_last','nb_images','dir','id_uppercat',
'rank','site_id','uppercats');
- $query = 'SELECT '.implode( ',', $infos );
- $query.= ' FROM '.CATEGORIES_TABLE;
- $query.= ' WHERE 1 = 1'; // stupid but permit using AND after it !
- if ( !$user['expand'] )
+ $query = '
+SELECT '.implode(',', $infos).'
+ FROM '.CATEGORIES_TABLE.'
+ WHERE 1 = 1'; // stupid but permit using AND after it !
+ if (!$user['expand'])
{
- $query.= ' AND (id_uppercat is NULL';
- if ( isset ($page['tab_expand']) && count( $page['tab_expand'] ) > 0 )
+ $query.= '
+ AND (id_uppercat is NULL';
+ if (isset ($page['tab_expand']) and count($page['tab_expand']) > 0)
{
$query.= ' OR id_uppercat IN ('.implode(',',$page['tab_expand']).')';
}
$query.= ')';
}
- if ( $user['forbidden_categories'] != '' )
+ if ($user['forbidden_categories'] != '')
{
- $query.= ' AND id NOT IN ';
- $query.= '('.$user['forbidden_categories'].')';
+ $query.= '
+ AND id NOT IN ('.$user['forbidden_categories'].')';
}
- $query.= ' ORDER BY id_uppercat ASC, rank ASC';
- $query.= ';';
+ $query.= '
+ ORDER BY id_uppercat ASC, rank ASC
+;';
$plain_structure = array();
- $result = pwg_query( $query );
- while ( $row = mysql_fetch_array( $result ) )
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_array($result))
{
$category = array();
- foreach ( $infos as $info ) {
- if ( $info == 'uc.date_last')
+ foreach ($infos as $info)
+ {
+ if ($info == 'uc.date_last')
{
- if ( empty( $row['date_last'] ) )
+ if (empty($row['date_last']))
{
$category['date_last'] = 0;
}
else
{
- list($year,$month,$day) = explode( '-', $row['date_last'] );
+ list($year,$month,$day) = explode('-', $row['date_last']);
$category['date_last'] = mktime(0,0,0,$month,$day,$year);
}
}
- else if ( isset( $row[$info] ) ) $category[$info] = $row[$info];
- else $category[$info] = '';
+ else if (isset($row[$info]))
+ {
+ $category[$info] = $row[$info];
+ }
+ else
+ {
+ $category[$info] = '';
+ }
}
$plain_structure[$row['id']] = $category;
}
@@ -897,4 +907,36 @@ function get_first_non_empty_cat_id( $id_uppercat )
}
return false;
}
+
+function display_select_categories($categories,
+ $indent,
+ $selecteds,
+ $blockname)
+{
+ global $template,$user;
+
+ foreach ($categories as $category)
+ {
+ if (!in_array($category['id'], $user['restrictions']))
+ {
+ $selected = '';
+ if (in_array($category['id'], $selecteds))
+ {
+ $selected = ' selected="selected"';
+ }
+
+ $template->assign_block_vars(
+ $blockname,
+ array('SELECTED'=>$selected,
+ 'VALUE'=>$category['id'],
+ 'OPTION'=>$indent.'- '.$category['name']
+ ));
+
+ display_select_categories($category['subcats'],
+ $indent.str_repeat('&nbsp;',3),
+ $selecteds,
+ $blockname);
+ }
+ }
+}
?>
diff --git a/include/page_tail.php b/include/page_tail.php
index bd8b726bf..c8193d813 100644
--- a/include/page_tail.php
+++ b/include/page_tail.php
@@ -43,7 +43,8 @@ $template->assign_vars(
));
-if (DEBUG)
+//if (DEBUG)
+if (true)
{
$template->assign_block_vars('debug', array());
}
diff --git a/include/template.php b/include/template.php
index 565197ff2..108beba58 100644
--- a/include/template.php
+++ b/include/template.php
@@ -242,7 +242,7 @@ class Template {
{
die("Template->make_filename(): Error - file $filename does not exist");
}
-
+
return $filename;
}