aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin.php5
-rw-r--r--admin/cat_list.php135
-rw-r--r--admin/cat_modify.php3
-rw-r--r--admin/group_perm.php3
-rw-r--r--admin/include/functions.php2
-rw-r--r--admin/infos_images.php4
-rw-r--r--admin/picture_modify.php6
-rw-r--r--admin/remote_site.php80
-rw-r--r--admin/update.php131
-rw-r--r--admin/user_perm.php3
-rw-r--r--admin/user_search.php18
-rw-r--r--admin/waiting.php2
-rw-r--r--comments.php2
-rw-r--r--include/category_calendar.inc.php6
-rw-r--r--include/category_recent_cats.inc.php3
-rw-r--r--include/config.inc.php37
-rw-r--r--include/functions_category.inc.php2
-rw-r--r--include/functions_html.inc.php11
-rw-r--r--include/functions_xml.inc.php1
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php1
-rw-r--r--picture.php16
-rw-r--r--template/default/picture.tpl2
-rw-r--r--tools/create_listing_file.php2
-rw-r--r--upload.php2
24 files changed, 299 insertions, 178 deletions
diff --git a/admin.php b/admin.php
index 3a19def75..ebed49524 100644
--- a/admin.php
+++ b/admin.php
@@ -30,7 +30,6 @@ define('PHPWG_ROOT_PATH','./');
define('IN_ADMIN', true);
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
-
//--------------------------------------- validating page and creation of title
$page_valide = false;
$title = '';
@@ -85,7 +84,7 @@ switch ( $_GET['page'] )
if ( isset( $page['cat'] ) and is_numeric( $page['cat'] ) )
{
$result = get_cat_info( $page['cat'] );
- $name = get_cat_display_name( $result['name'],' > ', '' );
+ $name = get_cat_display_name($result['name'], '');
$title.= ' "'.$name.'"';
}
}
@@ -202,7 +201,7 @@ $template->assign_vars(array(
'L_CAT_UPLOAD'=>$lang['upload'],
'L_CAT_COMMENTS'=>$lang['comments'],
'L_CAT_VISIBLE'=>$lang['lock'],
- 'L_CAT_STATUS'=>$lang['permissions'],
+ 'L_CAT_STATUS'=>$lang['admin_menu_cat_status'],
'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ),
'U_CONFIG_COMMENTS'=>add_session_id($conf_link.'comments' ),
diff --git a/admin/cat_list.php b/admin/cat_list.php
index 72862b484..d92575fe8 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -59,58 +59,88 @@ else if (isset($_POST['submit']))
if (!count($errors))
{
- $parent_id = !empty($_GET['parent_id'])?$_GET['parent_id']:'NULL';
- // As we don't create a virtual category every day, let's do (far) too
- // much queries
-
- // we have then to add the virtual category
- $query = '
-INSERT INTO '.CATEGORIES_TABLE.'
- (name,id_uppercat,rank,site_id)
- VALUES
- (\''.$_POST['virtual_name'].'\','.$parent_id.','.$_POST['rank'].',NULL)
-;';
- pwg_query($query);
-
- // And last we update the uppercats
- $query = '
-SELECT MAX(id)
- FROM '.CATEGORIES_TABLE.'
-;';
- $my_id = array_pop(mysql_fetch_array(pwg_query($query)));
+ $parent_id = !empty($_GET['parent_id'])?$_GET['parent_id']:'NULL';
if ($parent_id != 'NULL')
{
$query = '
-SELECT uppercats, global_rank
+SELECT id,uppercats,global_rank,visible,status
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$parent_id.'
;';
- $result = pwg_query($query);
- $row = mysql_fetch_array($result);
-
- $parent_uppercats = $row['uppercats'];
- $parent_global_rank = $row['global_rank'];
+ $row = mysql_fetch_array(pwg_query($query));
+ $parent = array('id' => $row['id'],
+ 'uppercats' => $row['uppercats'],
+ 'visible' => $row['visible'],
+ 'status' => $row['status'],
+ 'global_rank' => $row['global_rank']);
}
- $query = '
-UPDATE '.CATEGORIES_TABLE.'
-';
- if (!empty($parent_uppercats))
+ $insert = array();
+ $insert{'name'} = $_POST['virtual_name'];
+ $insert{'rank'} = $_POST['rank'];
+ $insert{'commentable'} = $conf['newcat_default_commentable'];
+ $insert{'uploadable'} = $conf['newcat_default_uploadable'];
+
+ if (isset($parent))
{
- $query.= " SET uppercats = CONCAT('".$parent_uppercats."',',',id)";
+ $insert{'id_uppercat'} = $parent{'id'};
+ // at creation, must a category be visible or not ? Warning : if
+ // the parent category is invisible, the category is automatically
+ // create invisible. (invisible = locked)
+ if ('false' == $parent['visible'])
+ {
+ $insert{'visible'} = 'false';
+ }
+ else
+ {
+ $insert{'visible'} = $conf['newcat_default_visible'];
+ }
+ // at creation, must a category be public or private ? Warning :
+ // if the parent category is private, the category is
+ // automatically create private.
+ if ('private' == $parent['status'])
+ {
+ $insert{'status'} = 'private';
+ }
+ else
+ {
+ $insert{'status'} = $conf['newcat_default_status'];
+ }
}
else
{
- $query.= ' SET uppercats = id';
+ $insert{'visible'} = $conf['newcat_default_visible'];
+ $insert{'status'} = $conf['newcat_default_status'];
}
- if (!empty($parent_global_rank))
+
+ $inserts = array($insert);
+
+ // we have then to add the virtual category
+ $dbfields = array('site_id','name','id_uppercat','rank','commentable',
+ 'uploadable','visible','status');
+ mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
+
+ // And last we update the uppercats
+ $query = '
+SELECT MAX(id)
+ FROM '.CATEGORIES_TABLE.'
+;';
+ $my_id = array_pop(mysql_fetch_array(pwg_query($query)));
+
+ $query = '
+UPDATE '.CATEGORIES_TABLE;
+ if (isset($parent))
{
- $query.= " , global_rank = CONCAT('".$parent_global_rank."','.',rank)";
+ $query.= "
+ SET uppercats = CONCAT('".$parent['uppercats']."',',',id)
+ , global_rank = CONCAT('".$parent['global_rank']."','.',rank)";
}
else
{
- $query.= ' , uppercats = id';
+ $query.= '
+ SET uppercats = id
+ , global_rank = id';
}
$query.= '
WHERE id = '.$my_id.'
@@ -142,23 +172,22 @@ $result = pwg_query($query);
while ($row = mysql_fetch_assoc($result))
{
$categories[$row['rank']] = $row;
+ $categories[$row['rank']]['nb_subcats'] = 0;
}
// +-----------------------------------------------------------------------+
// | Navigation path |
// +-----------------------------------------------------------------------+
if (isset($_GET['parent_id']))
{
- $separator = ' <span style="font-size:15px">&rarr;</span> ';
$base_url = PHPWG_ROOT_PATH.'admin.php?page=cat_list';
$navigation = '<a class="" href="'.add_session_id($base_url).'">';
$navigation.= $lang['home'];
$navigation.= '</a>';
- $navigation.= $separator;
+ $navigation.= $conf['level_separator'];
$current_category = get_cat_info($_GET['parent_id']);
$navigation.= get_cat_display_name($current_category['name'],
- $separator,
$base_url.'&amp;parent_id=',
false);
}
@@ -337,7 +366,25 @@ if (count($infos) != 0)
// +-----------------------------------------------------------------------+
// | Categories display |
// +-----------------------------------------------------------------------+
-while (list($id,$category) = each($categories))
+$ranks = array();
+foreach ($categories as $category)
+{
+ $ranks[$category['id']] = $category['rank'];
+}
+
+$query = '
+SELECT id_uppercat, COUNT(*) AS nb_subcats
+ FROM '. CATEGORIES_TABLE.'
+ WHERE id_uppercat IN ('.implode(',', array_keys($ranks)).')
+ GROUP BY id_uppercat
+;';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ $categories[$ranks[$row['id_uppercat']]]['nb_subcats'] = $row['nb_subcats'];
+}
+
+foreach ($categories as $category)
{
$images_folder = PHPWG_ROOT_PATH.'template/';
$images_folder.= $user['template'].'/admin/images';
@@ -356,17 +403,7 @@ while (list($id,$category) = each($categories))
}
else
{
- // (Gweltas) May be should we have to introduce a computed field in the
- // table to avoid this query -> (z0rglub) no because the number of
- // sub-categories depends on permissions
- $query = '
-SELECT COUNT(id) AS nb_sub_cats
- FROM '. CATEGORIES_TABLE.'
- WHERE id_uppercat = '.$category['id'].'
-;';
- $row = mysql_fetch_array(pwg_query($query));
-
- if ($row['nb_sub_cats'] > 0)
+ if ($category['nb_subcats'] > 0)
{
$image_src = $images_folder.'/icon_subfolder.gif';
}
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index c230fcf94..26bd0de50 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -103,11 +103,10 @@ foreach (array('comment','dir','site_id') as $nullable)
// Navigation path
$url = PHPWG_ROOT_PATH.'admin.php?page=cat_list&amp;parent_id=';
$navigation = '<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.'admin.php?page=cat_list').'">';
-$navigation.= $lang['home'].'</a> <span style="font-size:15px">&rarr;</span>';
+$navigation.= $lang['home'].'</a>'.$conf['level_separator'];
$navigation.= get_cat_display_name_cache(
$category['uppercats'],
- ' <span style="font-size:15px">&rarr;</span>',
$url);
$form_action = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&amp;cat_id='.$_GET['cat_id'];
diff --git a/admin/group_perm.php b/admin/group_perm.php
index 9725eafab..c60ed7420 100644
--- a/admin/group_perm.php
+++ b/admin/group_perm.php
@@ -104,8 +104,7 @@ while ( $row = mysql_fetch_array( $result ) )
}
// category name
$cat_infos = get_cat_info( $row['id'] );
- $name = get_cat_display_name( $cat_infos['name'],' &gt; ',
- 'font-weight:bold;' );
+ $name = get_cat_display_name($cat_infos['name']);
$vtp->setVar( $sub, 'category.name', $name );
// any subcat forbidden for this group ?
if ( $is_group_allowed == 2 )
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 467a498f6..1191f1f6f 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -788,7 +788,7 @@ function is_user_allowed( $category_id, $restrictions )
function get_category_directories( $basedir )
{
$sub_dirs = array();
-
+
if ( $opendir = opendir( $basedir ) )
{
while ( $file = readdir( $opendir ) )
diff --git a/admin/infos_images.php b/admin/infos_images.php
index 9c055a830..ef02c91b7 100644
--- a/admin/infos_images.php
+++ b/admin/infos_images.php
@@ -248,9 +248,7 @@ if (isset($page['cat']))
// Navigation path
$current_category = get_cat_info($_GET['cat_id']);
$url = PHPWG_ROOT_PATH.'admin.php?page=infos_images&amp;cat_id=';
- $category_path = get_cat_display_name($current_category['name'],
- '-&gt;',
- $url);
+ $category_path = get_cat_display_name($current_category['name'], $url);
$form_action = PHPWG_ROOT_PATH.'admin.php';
$form_action.= '?page=infos_images&amp;cat_id='.$_GET['cat_id'];
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 647fdede4..7f3677f97 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -162,10 +162,10 @@ $url_img = PHPWG_ROOT_PATH.'picture.php?image_id='.$_GET['image_id'];
$url_img .= '&amp;cat='.$row['storage_category_id'];
$date = isset($_POST['date_creation']) && empty($errors)
?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
-
+
+$url = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&amp;cat_id=';
$storage_category = get_cat_display_name_cache($row['uppercats'],
- ' &rarr; ',
- '',
+ $url,
false);
//----------------------------------------------------- template initialization
$template->set_filenames(array('picture_modify'=>'admin/picture_modify.tpl'));
diff --git a/admin/remote_site.php b/admin/remote_site.php
index 6f0279f21..66d6d6a58 100644
--- a/admin/remote_site.php
+++ b/admin/remote_site.php
@@ -176,7 +176,7 @@ function update_remote_site($listing_file, $site_id)
*/
function insert_remote_category($xml_content, $site_id, $id_uppercat, $level)
{
- global $counts, $removes;
+ global $counts, $removes, $conf;
$uppercats = '';
// 0. retrieving informations on the category to display
@@ -184,15 +184,18 @@ function insert_remote_category($xml_content, $site_id, $id_uppercat, $level)
if (is_numeric($id_uppercat))
{
$query = '
-SELECT name,uppercats,dir
+SELECT id,name,uppercats,dir,status,visible
FROM '.CATEGORIES_TABLE.'
WHERE id = '.$id_uppercat.'
;';
$row = mysql_fetch_array(pwg_query($query));
+ $parent = array('id' => $row['id'],
+ 'name' => $row['name'],
+ 'dir' => $row['dir'],
+ 'uppercats' => $row['uppercats'],
+ 'visible' => $row['visible'],
+ 'status' => $row['status']);
- $uppercats = $row['uppercats'];
- $name = $row['name'];
-
insert_remote_element($xml_content, $id_uppercat);
}
@@ -224,6 +227,39 @@ SELECT name,uppercats,dir
// array of new categories to insert
$inserts = array();
+ // calculate default value at category creation
+ $create_values = array();
+ if (isset($parent))
+ {
+ // at creation, must a category be visible or not ? Warning : if
+ // the parent category is invisible, the category is automatically
+ // create invisible. (invisible = locked)
+ if ('false' == $parent['visible'])
+ {
+ $create_values{'visible'} = 'false';
+ }
+ else
+ {
+ $create_values{'visible'} = $conf['newcat_default_visible'];
+ }
+ // at creation, must a category be public or private ? Warning :
+ // if the parent category is private, the category is
+ // automatically create private.
+ if ('private' == $parent['status'])
+ {
+ $create_values{'status'} = 'private';
+ }
+ else
+ {
+ $create_values{'status'} = $conf['newcat_default_status'];
+ }
+ }
+ else
+ {
+ $create_values{'visible'} = $conf['newcat_default_visible'];
+ $create_values{'status'} = $conf['newcat_default_status'];
+ }
+
foreach ($xml_dirs as $xml_dir)
{
// 5. Is the category already existing ? we create a subcat if not
@@ -239,9 +275,13 @@ SELECT name,uppercats,dir
$insert{'name'} = $name;
$insert{'site_id'} = $site_id;
$insert{'uppercats'} = 'undef';
- if (is_numeric($id_uppercat))
+ $insert{'commentable'} = $conf['newcat_default_commentable'];
+ $insert{'uploadable'} = 'false';
+ $insert{'status'} = $create_values{'status'};
+ $insert{'visible'} = $create_values{'visible'};
+ if (isset($parent))
{
- $insert{'id_uppercat'} = $id_uppercat;
+ $insert{'id_uppercat'} = $parent['id'];
}
array_push($inserts, $insert);
}
@@ -251,31 +291,25 @@ SELECT name,uppercats,dir
if (count($inserts) > 0)
{
// inserts all found categories
- $dbfields = array('dir','name','site_id','uppercats','id_uppercat');
+ $dbfields = array('dir','name','site_id','uppercats','id_uppercat',
+ 'commentable','uploadable','status','visible');
mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
$counts{'new_categories'}+= count($inserts);
// updating uppercats field
$query = '
-UPDATE '.CATEGORIES_TABLE.'
- SET uppercats = ';
- if ($uppercats != '')
- {
- $query.= "CONCAT('".$uppercats."',',',id)";
- }
- else
- {
- $query.= 'id';
- }
- $query.= '
- WHERE id_uppercat ';
- if (!is_numeric($id_uppercat))
+UPDATE '.CATEGORIES_TABLE;
+ if (isset($parent))
{
- $query.= 'IS NULL';
+ $query.= "
+ SET uppercats = CONCAT('".$parent['uppercats']."',',',id)
+ WHERE id_uppercat = ".$id_uppercat;
}
else
{
- $query.= '= '.$id_uppercat;
+ $query.= '
+ SET uppercats = id
+ WHERE id_uppercat IS NULL';
}
$query.= '
;';
diff --git a/admin/update.php b/admin/update.php
index e540065e2..b59f6e7b5 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -47,24 +47,30 @@ function insert_local_category($id_uppercat)
$cat_directory = PHPWG_ROOT_PATH.'galleries';
if (is_numeric($id_uppercat))
{
- $query = 'SELECT name,uppercats,dir FROM '.CATEGORIES_TABLE;
- $query.= ' WHERE id = '.$id_uppercat;
- $query.= ';';
- $row = mysql_fetch_array( pwg_query( $query));
- $uppercats = $row['uppercats'];
- $name = $row['name'];
- $dir = $row['dir'];
+ $query = '
+SELECT id,name,uppercats,dir,visible,status
+ FROM '.CATEGORIES_TABLE.'
+ WHERE id = '.$id_uppercat.'
+;';
+ $row = mysql_fetch_array(pwg_query($query));
+ $parent = array('id' => $row['id'],
+ 'name' => $row['name'],
+ 'dir' => $row['dir'],
+ 'uppercats' => $row['uppercats'],
+ 'visible' => $row['visible'],
+ 'status' => $row['status']);
- $upper_array = explode( ',', $uppercats);
+ $upper_array = explode( ',', $parent['uppercats']);
$local_dir = '';
$database_dirs = array();
$query = '
-SELECT id,dir FROM '.CATEGORIES_TABLE.'
- WHERE id IN ('.$uppercats.')
+SELECT id,dir
+ FROM '.CATEGORIES_TABLE.'
+ WHERE id IN ('.$parent['uppercats'].')
;';
- $result = pwg_query( $query);
+ $result = pwg_query($query);
while ($row = mysql_fetch_array($result))
{
$database_dirs[$row['id']] = $row['dir'];
@@ -78,8 +84,8 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
// 1. display the category name to update
$output = '<ul class="menu">';
- $output.= '<li><strong>'.$name.'</strong>';
- $output.= ' [ '.$dir.' ]';
+ $output.= '<li><strong>'.$parent['name'].'</strong>';
+ $output.= ' [ '.$parent['dir'].' ]';
$output.= '</li>';
// 2. we search pictures of the category only if the update is for all
@@ -94,7 +100,8 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
$sub_category_dirs = array();
$query = '
-SELECT id,dir FROM '.CATEGORIES_TABLE.'
+SELECT id,dir
+ FROM '.CATEGORIES_TABLE.'
WHERE site_id = 1
';
if (!is_numeric($id_uppercat))
@@ -131,6 +138,39 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
// array of new categories to insert
$inserts = array();
+
+ // calculate default value at category creation
+ $create_values = array();
+ if (isset($parent))
+ {
+ // at creation, must a category be visible or not ? Warning : if
+ // the parent category is invisible, the category is automatically
+ // create invisible. (invisible = locked)
+ if ('false' == $parent['visible'])
+ {
+ $create_values{'visible'} = 'false';
+ }
+ else
+ {
+ $create_values{'visible'} = $conf['newcat_default_visible'];
+ }
+ // at creation, must a category be public or private ? Warning :
+ // if the parent category is private, the category is
+ // automatically create private.
+ if ('private' == $parent['status'])
+ {
+ $create_values{'status'} = 'private';
+ }
+ else
+ {
+ $create_values{'status'} = $conf['newcat_default_status'];
+ }
+ }
+ else
+ {
+ $create_values{'visible'} = $conf['newcat_default_visible'];
+ $create_values{'status'} = $conf['newcat_default_status'];
+ }
foreach ($fs_subdirs as $fs_subdir)
{
@@ -139,22 +179,27 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
$category_id = array_search($fs_subdir, $sub_category_dirs);
if (!is_numeric($category_id))
{
+ $insert = array();
+
if (preg_match('/^[a-zA-Z0-9-_.]+$/', $fs_subdir))
{
$name = str_replace('_', ' ', $fs_subdir);
- $value = "('".$fs_subdir."','".$name."',1";
- if (!is_numeric($id_uppercat))
- {
- $value.= ',NULL';
- }
- else
+ $insert{'dir'} = $fs_subdir;
+ $insert{'name'} = $name;
+ $insert{'site_id'} = 1;
+ $insert{'uppercats'} = 'undef';
+ $insert{'commentable'} = $conf['newcat_default_commentable'];
+ $insert{'uploadable'} = $conf['newcat_default_uploadable'];
+ $insert{'status'} = $create_values{'status'};
+ $insert{'visible'} = $create_values{'visible'};
+
+ if (isset($parent))
{
- $value.= ','.$id_uppercat;
+ $insert{'id_uppercat'} = $parent['id'];
}
- $value.= ",'undef'";
- $value.= ')';
- array_push($inserts, $value);
+
+ array_push($inserts, $insert);
}
else
{
@@ -167,37 +212,27 @@ SELECT id,dir FROM '.CATEGORIES_TABLE.'
// we have to create the category
if (count($inserts) > 0)
{
- $query = '
-INSERT INTO '.CATEGORIES_TABLE.'
- (dir,name,site_id,id_uppercat,uppercats) VALUES
-';
- $query.= implode(',', $inserts);
- $query.= '
-;';
- pwg_query($query);
-
+ $dbfields = array(
+ 'dir','name','site_id','id_uppercat','uppercats','commentable',
+ 'uploadable','visible','status'
+ );
+ mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
+
$counts['new_categories']+= count($inserts);
// updating uppercats field
$query = '
-UPDATE '.CATEGORIES_TABLE.'
- SET uppercats = ';
- if ($uppercats != '')
- {
- $query.= "CONCAT('".$uppercats."',',',id)";
- }
- else
- {
- $query.= 'id';
- }
- $query.= '
- WHERE id_uppercat ';
- if (!is_numeric($id_uppercat))
+UPDATE '.CATEGORIES_TABLE;
+ if (isset($parent))
{
- $query.= 'IS NULL';
+ $query.= "
+ SET uppercats = CONCAT('".$parent['uppercats']."',',',id)
+ WHERE id_uppercat = ".$parent['id'];
}
else
{
- $query.= '= '.$id_uppercat;
+ $query.= '
+ SET uppercats = id
+ WHERE id_uppercat IS NULL';
}
$query.= '
;';
diff --git a/admin/user_perm.php b/admin/user_perm.php
index 415a95334..e2fd31d1e 100644
--- a/admin/user_perm.php
+++ b/admin/user_perm.php
@@ -220,8 +220,7 @@ while ( $row = mysql_fetch_array( $result ) )
}
// category name
$cat_infos = get_cat_info( $row['id'] );
- $name = get_cat_display_name( $cat_infos['name'],' &gt; ',
- 'font-weight:bold;' );
+ $name = get_cat_display_name($cat_infos['name']);
$vtp->setVar( $sub, 'category.name', $name );
// usergroups
if ( count( $usergroups ) > 0 )
diff --git a/admin/user_search.php b/admin/user_search.php
index 220928992..8087e31e0 100644
--- a/admin/user_search.php
+++ b/admin/user_search.php
@@ -102,14 +102,16 @@ else
$is_user_allowed = is_user_allowed( $row['id'], $restrictions );
$url = PHPWG_ROOT_PATH.'admin.php?page=cat_perm&amp;cat_id='.$row['id'];
$cat_infos = get_cat_info( $row['id'] );
- $template->assign_block_vars('permission.category',array(
- 'CAT_NAME'=> get_cat_display_name($cat_infos['name'],' &gt; ', 'font-weight:bold;' ),
- 'CAT_ID'=>$row['id'],
- 'AUTH_YES'=>!$is_user_allowed?'checked="checked"':'',
- 'AUTH_NO' =>$is_user_allowed?'checked="checked"':'',
- 'CAT_URL'=>add_session_id($url)
- ));
-
+ $template->assign_block_vars(
+ 'permission.category',
+ array(
+ 'CAT_NAME'=> get_cat_display_name($cat_infos['name']),
+ 'CAT_ID'=>$row['id'],
+ 'AUTH_YES'=>!$is_user_allowed?'checked="checked"':'',
+ 'AUTH_NO' =>$is_user_allowed?'checked="checked"':'',
+ 'CAT_URL'=>add_session_id($url)
+ ));
+
// any subcat forbidden for this user ?
if ( $is_user_allowed == 2 )
{
diff --git a/admin/waiting.php b/admin/waiting.php
index 4607cc002..dadb9052c 100644
--- a/admin/waiting.php
+++ b/admin/waiting.php
@@ -113,7 +113,7 @@ while ( $row = mysql_fetch_array( $result ) )
$cat_names[$row['storage_category_id']]['dir'] =
PHPWG_ROOT_PATH.get_complete_dir( $row['storage_category_id'] );
$cat_names[$row['storage_category_id']]['display_name'] =
- get_cat_display_name( $cat['name'], ' &gt; ', 'font-weight:bold;' );
+ get_cat_display_name($cat['name']);
}
$preview_url = PHPWG_ROOT_PATH.$cat_names[$row['storage_category_id']]['dir'].$row['file'];
$class='row1';
diff --git a/comments.php b/comments.php
index 4f9530eeb..12d42191f 100644
--- a/comments.php
+++ b/comments.php
@@ -152,7 +152,7 @@ SELECT name,file,storage_category_id as cat_id,tn_ext,path
{
$cat_result = get_cat_info($subrow['cat_id']);
$array_cat_names[$subrow['cat_id']] =
- get_cat_display_name($cat_result['name'], ' &gt; ', '');
+ get_cat_display_name($cat_result['name'], '');
}
// name of the picture
diff --git a/include/category_calendar.inc.php b/include/category_calendar.inc.php
index b318c7c25..e718928ce 100644
--- a/include/category_calendar.inc.php
+++ b/include/category_calendar.inc.php
@@ -363,6 +363,8 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
}
elseif (isset($page['calendar_day']))
{
+ $old_level_separator = $conf['level_separator'];
+ $conf['level_separator'] = '<br />';
// for each category of this day, display a random picture
foreach ($calendar_categories as $calendar_category => $nb_pics)
{
@@ -373,7 +375,8 @@ elseif (isset($page['calendar_day']))
else
{
$cat_infos = get_cat_info( $calendar_category );
- $name = get_cat_display_name($cat_infos['name'],'<br />','',false);
+
+ $name = get_cat_display_name($cat_infos['name'],'',false);
$name = '['.$name.']';
}
$name.= ' ('.$nb_pics.')';
@@ -426,5 +429,6 @@ SELECT file,tn_ext,'.$conf['calendar_datefield'].',path
$row_number = 0;
}
}
+ $conf['level_separator'] = $old_level_separator;
}
?> \ No newline at end of file
diff --git a/include/category_recent_cats.inc.php b/include/category_recent_cats.inc.php
index ed193e380..ab4732a81 100644
--- a/include/category_recent_cats.inc.php
+++ b/include/category_recent_cats.inc.php
@@ -59,6 +59,8 @@ if (mysql_num_rows($result) > 0)
$row_number = 0;
}
+$old_level_separator = $conf['level_separator'];
+$conf['level_separator'] = '<br />';
// for each category, we have to search a recent picture to display and
// the name to display
while ( $row = mysql_fetch_array( $result ) )
@@ -90,4 +92,5 @@ while ( $row = mysql_fetch_array( $result ) )
$row_number = 0;
}
}
+$conf['level_separator'] = $old_level_separator;
?> \ No newline at end of file
diff --git a/include/config.inc.php b/include/config.inc.php
index 4d9d0428d..9b6a552ee 100644
--- a/include/config.inc.php
+++ b/include/config.inc.php
@@ -76,7 +76,7 @@ $conf['picture_ext'] = array('jpg','JPG','png','PNG','gif','GIF');
// top_number : number of element to display for "best rated" and "most
// visited" categories
-$conf['top_number'] = 10;
+$conf['top_number'] = 15;
// anti-flood_time : number of seconds between 2 comments : 0 to disable
$conf['anti-flood_time'] = 60;
@@ -168,18 +168,25 @@ $conf['show_queries'] = false;
// show_gt : display generation time at the bottom of each page
$conf['show_gt'] = true;
-// Default options for new categories.
-//
-// Some options for categories (commentable, uploadable, status, visible)
-// must be set directly in the database by changing the corresponding
-// default values of the column. Examples :
-//
-// ALTER TABLE phpwebgallery_categories ALTER visible SET DEFAULT 'true';
-// ALTER TABLE phpwebgallery_categories ALTER status SET DEFAULT 'private';
-// ALTER TABLE phpwebgallery_categories ALTER uploadable SET DEFAULT 'true';
-// ALTER TABLE phpwebgallery_categories ALTER commentable SET DEFAULT 'false';
-//
-// MySQL default values are used when inserting a row and that no value is
-// given for the column. In PhpWebGallery, the above columns are not valued
-// during categories insertion, so default values are important.
+// newcat_default_commentable : at creation, must a category be commentable
+// or not ?
+$conf['newcat_default_commentable'] = 'true';
+
+// newcat_default_uploadable : at creation, must a category be uploadable or
+// not ?
+$conf['newcat_default_uploadable'] = 'true';
+
+// newcat_default_visible : at creation, must a category be visible or not ?
+// Warning : if the parent category is invisible, the category is
+// automatically create invisible. (invisible = locked)
+$conf['newcat_default_visible'] = 'true';
+
+// newcat_default_status : at creation, must a category be public or private
+// ? Warning : if the parent category is private, the category is
+// automatically create private.
+$conf['newcat_default_status'] = 'public';
+
+// level_separator : character string used for separating a category level
+// to the sub level
+$conf['level_separator'] = ' / ';
?>
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 4efbb0d62..2fd502120 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -348,7 +348,6 @@ function initialize_category( $calling_page = 'category' )
$page['uppercats'] = $result['uppercats'];
$page['title'] =
get_cat_display_name($page['cat_name'],
- ' &gt; ',
'category.php?cat=',
false);
$page['where'] = ' WHERE category_id = '.$page['cat'];
@@ -758,7 +757,6 @@ function display_select_categories($categories,
if ($fullname)
{
$option = get_cat_display_name_cache($category['uppercats'],
- ' &rarr; ',
'',
false);
}
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index f1a8610db..2ff918ae4 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -159,10 +159,11 @@ function style_select($default_style, $select_name = "style")
* @return string
*/
function get_cat_display_name($cat_informations,
- $separator,
$url = 'category.php?cat=',
$replace_space = true)
{
+ global $conf;
+
$output = '';
$is_first = true;
foreach ($cat_informations as $id => $name)
@@ -173,7 +174,7 @@ function get_cat_display_name($cat_informations,
}
else
{
- $output.= $separator;
+ $output.= $conf['level_separator'];
}
if ($url == '')
@@ -205,17 +206,15 @@ function get_cat_display_name($cat_informations,
* the categories name without links.
*
* @param string uppercats
- * @param string separator
* @param string url
* @param boolean replace_space
* @return string
*/
function get_cat_display_name_cache($uppercats,
- $separator,
$url = 'category.php?cat=',
$replace_space = true)
{
- global $cat_names;
+ global $cat_names, $conf;
if (!isset($cat_names))
{
@@ -242,7 +241,7 @@ SELECT id,name
}
else
{
- $output.= $separator;
+ $output.= $conf['level_separator'];
}
if ($url == '')
diff --git a/include/functions_xml.inc.php b/include/functions_xml.inc.php
index ca2f1b7e1..903ec02fd 100644
--- a/include/functions_xml.inc.php
+++ b/include/functions_xml.inc.php
@@ -51,6 +51,7 @@ function getContent( $element )
// attribute $attribute for the tag $element.
function getAttribute( $element, $attribute )
{
+// echo htmlentities($element).'<br /><br />';
$regex = '/^<\w+[^>]*'.$attribute.'\s*=\s*"('.VAL_REG.')"/i';
if ( preg_match( $regex, $element, $out ) ) return $out[1];
else return '';
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index 6294e3b24..e8740b170 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -351,4 +351,5 @@ $lang['cat_dissociated'] = 'dissociated from';
$lang['storage_category'] = 'storage category';
$lang['represents'] = 'represents';
$lang['doesnt_represent'] = 'doesn\'t represent';
+$lang['admin_menu_cat_status'] = 'Public / Private';
?> \ No newline at end of file
diff --git a/picture.php b/picture.php
index 570bf6dc4..a85f55b64 100644
--- a/picture.php
+++ b/picture.php
@@ -348,7 +348,12 @@ if ( isset( $_POST['content'] ) && !empty($_POST['content']) )
// notification to the administrators
if ( $conf['mail_notification'] )
{
- $cat_name = get_cat_display_name( $page['cat_name'], ' > ', '' );
+ // locally, we change the $conf['level_separator']
+ $conf_separator = $conf['level_separator'];
+ $conf['level_separator'] = ' > ';
+ $cat_name = get_cat_display_name($page['cat_name'], '');
+ $conf['level_separator'] = $conf_separator;
+
$cat_name = strip_tags( $cat_name );
notify( 'comment', $cat_name.' > '.$picture['current']['name']);
}
@@ -389,7 +394,7 @@ $title_img = $picture['current']['name'];
$title_nb = '';
if (is_numeric( $page['cat'] ))
{
- $title_img = replace_space(get_cat_display_name($page['cat_name'],' &gt; '));
+ $title_img = replace_space(get_cat_display_name($page['cat_name']));
$n = $page['num'] + 1;
$title_nb = $n.'/'.$page['cat_nb_images'];
}
@@ -443,6 +448,8 @@ $template->assign_vars(array(
'WIDTH_IMG' => $picture_size[0],
'HEIGHT_IMG' => $picture_size[1],
+ 'LEVEL_SEPARATOR' => $conf['level_separator'],
+
'L_HOME' => $lang['home'],
'L_SLIDESHOW' => $lang['slideshow'],
'L_STOP_SLIDESHOW' => $lang['slideshow_stop'],
@@ -768,13 +775,12 @@ foreach ($cat_array as $category)
if (count($cat_array) > 3)
{
- $cat_output .= get_cat_display_name_cache($category['uppercats'],
- ' &rarr; ');
+ $cat_output .= get_cat_display_name_cache($category['uppercats']);
}
else
{
$cat_info = get_cat_info($category['category_id']);
- $cat_output .= get_cat_display_name($cat_info['name'], ' &rarr; ');
+ $cat_output .= get_cat_display_name($cat_info['name']);
}
// the picture is commentable if it belongs at least to one category which
// is commentable
diff --git a/template/default/picture.tpl b/template/default/picture.tpl
index c2e5f14ab..fb26af582 100644
--- a/template/default/picture.tpl
+++ b/template/default/picture.tpl
@@ -2,7 +2,7 @@
<div class="information">{information.INFORMATION}</div>
<!-- END information -->
<div class="titrePage">
- <div id="gauche"><a href="{U_HOME}">{L_HOME}</a> &gt; {CATEGORY}</div>
+ <div id="gauche"><a href="{U_HOME}">{L_HOME}</a>{LEVEL_SEPARATOR}{CATEGORY}</div>
<div id="centre" class="nameImage">{TITLE}</div>
<div id="droite">{PHOTO}</div>
</div>
diff --git a/tools/create_listing_file.php b/tools/create_listing_file.php
index c34324048..8194da84f 100644
--- a/tools/create_listing_file.php
+++ b/tools/create_listing_file.php
@@ -132,7 +132,7 @@ function clean_iptc_value($value)
// remove binary nulls
$value = str_replace(chr(0x00), ' ', $value);
- return $value;
+ return htmlentities($value);
}
function get_sync_iptc_data($file)
diff --git a/upload.php b/upload.php
index 4f1ac6c69..286f9e051 100644
--- a/upload.php
+++ b/upload.php
@@ -274,7 +274,7 @@ if ( isset( $page['waiting_id'] ) )
else
{
$advise_title = $lang['upload_advise'];
- $advise_title.= get_cat_display_name( $page['cat_name'], ' - ' );
+ $advise_title.= get_cat_display_name($page['cat_name']);
}
$username = !empty($_POST['username'])?$_POST['username']:$user['username'];