aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_category.inc.php
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2008-05-02 21:56:21 +0000
committerrub <rub@piwigo.org>2008-05-02 21:56:21 +0000
commit5436a351ef6dd685483f022af6656bbf8b797cb6 (patch)
tree8d963ace1e57b404726500753111649d144527c6 /include/functions_category.inc.php
parent7942dccf9b682d359a89636528e96af5b38327da (diff)
Resolved issue 0000823: Enhance upload functionalities
First commit, others will be follow. Not hesitate to change my translations. Add upload configuration tabsheet (move and add configuration) Change and add define for access level Can show upload link every time Can restrict access upload.class.php Can choice category on upload page Add upload class not use for the moment Review quickly and temporary style of upload.tpl git-svn-id: http://piwigo.org/svn/trunk@2325 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_category.inc.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 2adbb200a..94b2411d2 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -452,4 +452,59 @@ function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_
return $display_text;
}
+/**
+ * returns the link of upload menu
+ *
+ * @param null
+ * @return string or null
+ */
+function get_upload_menu_link()
+{
+ global $conf, $page, $user;
+
+ $show_link = false;
+ $arg_link = null;
+
+ if (is_autorize_status($conf['upload_user_access']))
+ {
+ if (isset($page['category']) and $page['category']['uploadable'] )
+ {
+ // upload a picture in the category
+ $show_link = true;
+ $arg_link = 'cat='.$page['category']['id'];
+ }
+ else
+ if ($conf['upload_link_everytime'])
+ {
+ // upload a picture in the category
+ $query = '
+SELECT
+ 1
+FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
+ ON id = cat_id and user_id = '.$user['id'].'
+WHERE
+ uploadable = \'true\'
+ '.get_sql_condition_FandF
+ (
+ array
+ (
+ 'visible_categories' => 'id',
+ ),
+ 'AND'
+ ).'
+LIMIT 1';
+
+ $show_link = mysql_num_rows(pwg_query($query)) <> 0;
+ }
+ }
+ if ($show_link)
+ {
+ return get_root_url().'upload.php'.(empty($arg_link) ? '' : '?'.$arg_link);
+ }
+ else
+ {
+ return;
+ }
+}
+
?>