aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--admin/configuration.php43
-rw-r--r--admin/include/functions.php16
-rw-r--r--identification.php2
-rw-r--r--include/constants.php3
-rw-r--r--include/functions_category.inc.php55
-rw-r--r--include/functions_user.inc.php6
-rw-r--r--include/menubar.inc.php8
-rw-r--r--include/upload.class.php41
-rw-r--r--install/config.sql2
-rw-r--r--install/db/70-database.php53
-rw-r--r--language/en_UK/admin.lang.php12
-rw-r--r--language/en_UK/common.lang.php3
-rw-r--r--language/en_UK/help/configuration.html9
-rw-r--r--language/es_ES/admin.lang.php12
-rw-r--r--language/es_ES/common.lang.php3
-rw-r--r--language/es_ES/help/configuration.html9
-rw-r--r--language/fr_FR/admin.lang.php10
-rw-r--r--language/fr_FR/common.lang.php3
-rw-r--r--language/fr_FR/help/configuration.html9
-rw-r--r--language/nl_NL/admin.lang.php10
-rw-r--r--language/nl_NL/common.lang.php3
-rw-r--r--language/nl_NL/help/configuration.html9
-rw-r--r--nbm.php2
-rw-r--r--password.php2
-rw-r--r--register.php2
-rw-r--r--search_rules.php2
-rw-r--r--template/yoga/admin/configuration.tpl28
-rw-r--r--template/yoga/admin/default-layout.css16
-rw-r--r--template/yoga/admin/picture_modify.tpl16
-rw-r--r--template/yoga/menubar.tpl232
-rw-r--r--template/yoga/upload.tpl45
-rw-r--r--upload.php86
-rw-r--r--ws.php2
33 files changed, 548 insertions, 206 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 0a89f6e4b..8e69d9c16 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -51,7 +51,6 @@ $main_checkboxes = array(
'rate',
'rate_anonymous',
'email_admin_on_new_user',
- 'email_admin_on_picture_uploaded',
);
$history_checkboxes = array(
@@ -60,6 +59,11 @@ $history_checkboxes = array(
'history_guest'
);
+$upload_checkboxes = array(
+ 'upload_link_everytime',
+ 'email_admin_on_picture_uploaded',
+ );
+
$comments_checkboxes = array(
'comments_forall',
'comments_validation',
@@ -110,6 +114,14 @@ if (isset($_POST['submit']) and !is_adviser())
}
break;
}
+ case 'upload' :
+ {
+ foreach( $upload_checkboxes as $checkbox)
+ {
+ $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
+ }
+ break;
+ }
case 'default' :
{
// Never go here
@@ -160,6 +172,7 @@ $tabsheet = new tabsheet();
$tabsheet->add('main', l10n('conf_main_title'), $conf_link.'main');
$tabsheet->add('history', l10n('conf_history_title'), $conf_link.'history');
$tabsheet->add('comments', l10n('conf_comments_title'), $conf_link.'comments');
+$tabsheet->add('upload', l10n('conf_upload_title'), $conf_link.'upload');
$tabsheet->add('default', l10n('conf_display'), $conf_link.'default');
// TabSheet selection
$tabsheet->select($page['section']);
@@ -187,7 +200,7 @@ switch ($page['section'])
'CONF_GALLERY_URL' => $conf['gallery_url'],
));
- foreach( $main_checkboxes as $checkbox)
+ foreach ($main_checkboxes as $checkbox)
{
$template->append(
'main',
@@ -202,7 +215,7 @@ switch ($page['section'])
case 'history' :
{
//Necessary for merge_block_vars
- foreach( $history_checkboxes as $checkbox)
+ foreach ($history_checkboxes as $checkbox)
{
$template->append(
'history',
@@ -222,7 +235,7 @@ switch ($page['section'])
'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
));
- foreach( $comments_checkboxes as $checkbox)
+ foreach ($comments_checkboxes as $checkbox)
{
$template->append(
'comments',
@@ -234,6 +247,28 @@ switch ($page['section'])
}
break;
}
+ case 'upload' :
+ {
+ $template->assign(
+ 'upload',
+ array(
+ 'upload_user_access_options'=> get_user_access_level_html_options(ACCESS_GUEST),
+ 'upload_user_access_options_selected' => array($conf['upload_user_access'])
+ )
+ );
+ //Necessary for merge_block_vars
+ foreach ($upload_checkboxes as $checkbox)
+ {
+ $template->append(
+ 'upload',
+ array(
+ $checkbox => $conf[$checkbox]
+ ),
+ true
+ );
+ }
+ break;
+ }
case 'default' :
{
$edit_user = build_user($conf['default_user_id'], false);
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 94ac4c962..5cb81e9cb 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1837,4 +1837,20 @@ function create_table_add_character_set($query)
}
return $query;
}
+
+/**
+ * Returns array use on template with html_options method
+ * @param Min and Max access to use
+ * @return array of user access level
+ */
+function get_user_access_level_html_options($MinLevelAccess = ACCESS_FREE, $MaxLevelAccess = ACCESS_CLOSED)
+{
+ $tpl_options = array();
+ for ($level = $MinLevelAccess; $level <= $MaxLevelAccess; $level++)
+ {
+ $tpl_options[$level] = l10n(sprintf('ACCESS_%d', $level));
+ }
+ return $tpl_options;
+}
+
?> \ No newline at end of file
diff --git a/identification.php b/identification.php
index 7e9585eab..877e51a65 100644
--- a/identification.php
+++ b/identification.php
@@ -28,7 +28,7 @@ include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
// +-----------------------------------------------------------------------+
-check_status(ACCESS_NONE);
+check_status(ACCESS_FREE);
//-------------------------------------------------------------- identification
$errors = array();
diff --git a/include/constants.php b/include/constants.php
index 814d18f3e..6b05d683a 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -36,11 +36,12 @@ define('CRITICAL_MESSAGE', 203);
define('CRITICAL_ERROR', 204);
// Access codes
-define('ACCESS_NONE', 0);
+define('ACCESS_FREE', 0);
define('ACCESS_GUEST', 1);
define('ACCESS_CLASSIC', 2);
define('ACCESS_ADMINISTRATOR', 3);
define('ACCESS_WEBMASTER', 4);
+define('ACCESS_CLOSED', 5);
// Table names
if (!defined('CATEGORIES_TABLE'))
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;
+ }
+}
+
?>
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 6630e2dae..d2c9530e2 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -1088,7 +1088,7 @@ function get_user_status($user_status)
}
/*
- * Return access_type definition of uuser
+ * Return access_type definition of user
* Test does with user status
* @return bool
*/
@@ -1101,7 +1101,7 @@ function get_access_type_status($user_status='')
case 'guest':
{
$access_type_status =
- ($conf['guest_access'] ? ACCESS_GUEST : ACCESS_NONE);
+ ($conf['guest_access'] ? ACCESS_GUEST : ACCESS_FREE);
break;
}
case 'generic':
@@ -1126,7 +1126,7 @@ function get_access_type_status($user_status='')
}
default:
{
- $access_type_status = ACCESS_NONE;
+ $access_type_status = ACCESS_FREE;
break;
}
}
diff --git a/include/menubar.inc.php b/include/menubar.inc.php
index 4f7b5fe61..03e941226 100644
--- a/include/menubar.inc.php
+++ b/include/menubar.inc.php
@@ -39,6 +39,7 @@ $template->assign(
'MENU_CATEGORIES_CONTENT' => get_categories_menu(),
'U_CATEGORIES' => make_index_url(array('section' => 'categories')),
'U_LOST_PASSWORD' => get_root_url().'password.php',
+ 'U_UPLOAD' => get_upload_menu_link()
)
);
@@ -304,12 +305,7 @@ $template->append(
)
);
-if (isset($page['category']) and $page['category']['uploadable'] )
-{ // upload a picture in the category
- $url = get_root_url().'upload.php?cat='.$page['category']['id'];
- $template->assign('U_UPLOAD', $url);
-}
-
trigger_action('loc_end_menubar');
$template->assign_var_from_handle('MENUBAR', 'menubar');
+
?>
diff --git a/include/upload.class.php b/include/upload.class.php
new file mode 100644
index 000000000..f9587ddb8
--- /dev/null
+++ b/include/upload.class.php
@@ -0,0 +1,41 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+class Upload
+{
+ function Upload()
+ {
+ }
+
+ /**
+ * Return list of Uploadable categories
+ *
+ * @param void
+ * @return array
+ */
+ function get_cat()
+ {
+ }
+}
+
+?>
diff --git a/install/config.sql b/install/config.sql
index 01793eb94..bf7dd0d6b 100644
--- a/install/config.sql
+++ b/install/config.sql
@@ -25,3 +25,5 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_c
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('obligatory_user_mail_address','false','Mail address is obligatory for users');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('c13y_ignore',null,'List of ignored anomalies');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_link_everytime','false','Show upload link every time');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_user_access',2 /*ACCESS_CLASSIC*/,'User access level to upload');
diff --git a/install/db/70-database.php b/install/db/70-database.php
new file mode 100644
index 000000000..50dfc161b
--- /dev/null
+++ b/install/db/70-database.php
@@ -0,0 +1,53 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based picture gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add upload config';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+replace into ".CONFIG_TABLE."
+ (param, value, comment)
+values
+('upload_link_everytime','false','Show Upload link every time'),
+('upload_user_access',".ACCESS_CLASSIC.",'Minimal user status allowed to upload pictures')
+;";
+
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index c9b2abe13..d231d2798 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -634,5 +634,15 @@ $lang['plugins_check_chmod'] = 'Please check "plugins" folder and sub-folders pe
$lang['plugins_server_error'] = 'Can\'t connect to server.';
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
$lang['Purge compiled templates'] = 'Purge compiled templates';
-/* TODO */ $lang['Caddie is currently empty'] = 'Caddie is currently empty';
+$lang['Caddie is currently empty'] = 'Caddie is currently empty';
+$lang['conf_upload_title'] = 'Upload';
+$lang['Show upload link every time'] = 'Show upload link every time';
+$lang['User access level to upload'] = 'User access level to upload';
+$lang['ACCESS_0'] = 'Free access';
+$lang['ACCESS_1'] = 'Access to all';
+$lang['ACCESS_2'] = 'Access to subscribed';
+$lang['ACCESS_3'] = 'Access to administrators';
+$lang['ACCESS_4'] = 'Access to webmasters';
+$lang['ACCESS_5'] = 'No access';
+
?>
diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php
index 43c78de97..e8abb3d3a 100644
--- a/language/en_UK/common.lang.php
+++ b/language/en_UK/common.lang.php
@@ -306,7 +306,6 @@ $lang['title_send_mail'] = 'A comment on your site';
$lang['today'] = 'today';
$lang['update_rate'] = 'Update your rating';
$lang['update_wrong_dirname'] = 'wrong filename';
-$lang['upload_advise'] = 'Choose an image to place in the category : ';
$lang['upload_advise_filesize'] = 'the filesize of the picture must not exceed : ';
$lang['upload_advise_filetype'] = 'the picture must be to the fileformat jpg, gif or png';
$lang['upload_advise_height'] = 'the height of the picture must not exceed : ';
@@ -364,4 +363,6 @@ $lang['%d element are also linked to current tags'] = '%d image is also linked t
$lang['%d elements are also linked to current tags'] = '%d images are also linked to current tags';
$lang['See elements linked to this tag only'] = 'See images linked to this tag only';
$lang['elements posted during the last %d days'] = 'images posted during the last %d days';
+$lang['Choose an image'] = 'Choose an image';
+
?>
diff --git a/language/en_UK/help/configuration.html b/language/en_UK/help/configuration.html
index c722be2e4..cb9f1f7c0 100644
--- a/language/en_UK/help/configuration.html
+++ b/language/en_UK/help/configuration.html
@@ -34,8 +34,6 @@ page.</li>
<li><strong>Email admins when a new user registers</strong>: Administrators will be received mail for each registration.</li>
- <li><strong>Email adminis when a picture is uploaded</strong>: Administrators will be received mail for each picture uploaded by a user.</li>
-
</ul>
<h3>History</h3>
@@ -78,6 +76,13 @@ User comments validation takes place in the screen <span class="pwgScreen">Admin
</ul>
+<!--TODO --><h3>Upload</h3>
+<ul>
+<!--TODO --> <li><strong>Show upload link every time</strong>: If exists uploadeable categories, add link will be show for each categoy.</li>
+<!--TODO --> <li><strong>User access level to upload</strong>: Allows to restrict upload by users</li>
+ <li><strong>Email adminis when a picture is uploaded</strong>: Administrators will be received mail for each picture uploaded by a user.</li>
+</ul>
+
<h3>Default display</h3>
<p>Here you can change display options used by default, when guest is not
diff --git a/language/es_ES/admin.lang.php b/language/es_ES/admin.lang.php
index acee9a7bf..fadce5427 100644
--- a/language/es_ES/admin.lang.php
+++ b/language/es_ES/admin.lang.php
@@ -639,5 +639,15 @@ $lang['plugins_check_chmod'] = 'Verifique los autorizaciones del expediente " pl
$lang['plugins_server_error'] = 'Imposible conectarse al servidor.';
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
$lang['Purge compiled templates'] = 'Purgar el templates compilado';
-$lang['Caddie is currently empty'] = 'Caddie is currently empty';
+/* TODO */ $lang['Caddie is currently empty'] = 'Caddie is currently empty';
+/* TODO */ $lang['conf_upload_title'] = 'Upload';
+/* TODO */ $lang['Show upload link every time'] = 'Show upload link every time';
+/* TODO */ $lang['User access level to upload'] = 'User access level to upload';
+/* TODO */ $lang['ACCESS_0'] = 'Free access';
+/* TODO */ $lang['ACCESS_1'] = 'Access to all';
+/* TODO */ $lang['ACCESS_2'] = 'Access to subscribed';
+/* TODO */ $lang['ACCESS_3'] = 'Access to administrators';
+/* TODO */ $lang['ACCESS_4'] = 'Access to webmasters';
+/* TODO */ $lang['ACCESS_5'] = 'No access';
+
?>
diff --git a/language/es_ES/common.lang.php b/language/es_ES/common.lang.php
index 99d1ac42d..96d4a8a5f 100644
--- a/language/es_ES/common.lang.php
+++ b/language/es_ES/common.lang.php
@@ -306,7 +306,6 @@ $lang['title_send_mail'] = 'Una opinión sobre esta pagina';
$lang['today'] = 'hoy';
$lang['update_rate'] = 'Actualizar nota';
$lang['update_wrong_dirname'] = 'Mal nombre de repertorio';
-$lang['upload_advise'] = 'Elegir una imagen para agregar en esta categoría : ';
$lang['upload_advise_filesize'] = 'El peso de la imagen debe sobrepasar : ';
$lang['upload_advise_filetype'] = 'El tamaño de la imagen debe ser jpg, png ou gif';
$lang['upload_advise_height'] = 'La altura de la imagen no debe sobrepasar : ';
@@ -364,4 +363,6 @@ $lang['%d element are also linked to current tags'] = '%d imagen es también vin
$lang['%d elements are also linked to current tags'] = '%d imagenes son igualmente vinculadas a los tags corrientes';
$lang['See elements linked to this tag only'] = 'Ver las imágenes relacionadas únicamente a este tag';
$lang['elements posted during the last %d days'] = 'esta imagen tiene menos de %d dias';
+$lang['Choose an image'] = 'Elegir una imagen';
+
?>
diff --git a/language/es_ES/help/configuration.html b/language/es_ES/help/configuration.html
index 1623b3365..f2aa3d1fe 100644
--- a/language/es_ES/help/configuration.html
+++ b/language/es_ES/help/configuration.html
@@ -24,8 +24,6 @@ cass="filename">include/config_default.inc.php</span></p>
<li><strong>Permitir el registro de los utilizadores</strong>: La inscripción es libre para ellos todos.</li>
- <li><strong>Notificar a los administradores cuando una imagen es cargada</strong>: Los administradores recibirán un courriel a cada imagen puesto en disposición por un utilizador.</li>
-
</ul>
<h3>Reseña histórica</h3>
@@ -62,6 +60,13 @@ La validación de los comentarios utilizadores se efectua en la pantalla <span c
</ul>
+<!--TODO --><h3>Upload</h3>
+<ul>
+<!--TODO --> <li><strong>Show upload link every time</strong>: If exists uploadeable categories, add link will be show for each categoy.</li>
+<!--TODO --> <li><strong>User access level to upload</strong>: Allows to restrict upload by users</li>
+ <li><strong>Notificar a los administradores cuando una imagen es cargada</strong>: Los administradores recibirán un courriel a cada imagen puesto en disposición por un utilizador.</li>
+</ul>
+
<h3>Fijación por defecto</h3>
<p>Modificar las opciones de fijación por defecto: para los visitadores no conectados. Una vez conectado, estas opciones son sobrecargadas por las del utilizador, a las que puede modificar en la pantalla <span
class="pwgScreen">perfila</span>.</p>
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index b13c81b10..76f241bee 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -635,4 +635,14 @@ $lang['plugins_server_error'] = 'Impossible de se connecter au serveur.';
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
$lang['Purge compiled templates'] = 'Purger les templates compilés';
$lang['Caddie is currently empty'] = 'Le panier est actuellement vide.';
+$lang['conf_upload_title'] = 'Téléchargement';
+$lang['Show upload link every time'] = 'Afficher le lien d\'ajout d\'image tout le temps';
+$lang['User access level to upload'] = 'Niveau d\'accès utilisateur pour télécharger';
+$lang['ACCESS_0'] = 'Accès libre';
+$lang['ACCESS_1'] = 'Accès à tous';
+$lang['ACCESS_2'] = 'Accès aux inscrits';
+$lang['ACCESS_3'] = 'Accès aux administrateurs';
+$lang['ACCESS_4'] = 'Accès aux webmestres';
+$lang['ACCESS_5'] = 'Pas d\'accès';
+
?>
diff --git a/language/fr_FR/common.lang.php b/language/fr_FR/common.lang.php
index 06af0ee76..af5aed3d5 100644
--- a/language/fr_FR/common.lang.php
+++ b/language/fr_FR/common.lang.php
@@ -306,7 +306,6 @@ $lang['title_send_mail'] = 'Un commentaire sur le site';
$lang['today'] = 'aujourd\'hui';
$lang['update_rate'] = 'Mettre à jour votre note';
$lang['update_wrong_dirname'] = 'mauvais nom de répertoire';
-$lang['upload_advise'] = 'Choisir une image à ajouter dans cette catégorie : ';
$lang['upload_advise_filesize'] = 'le poids de l\'image ne doit dépasser : ';
$lang['upload_advise_filetype'] = 'le format de l\'image doit être jpg, png ou gif';
$lang['upload_advise_height'] = 'la hauteur de l\'image ne doit pas dépasser : ';
@@ -364,4 +363,6 @@ $lang['%d element are also linked to current tags'] = '%d image est également l
$lang['%d elements are also linked to current tags'] = '%d images sont également liées aux tags courants';
$lang['See elements linked to this tag only'] = 'Voir les images liées uniquement à ce tag';
$lang['elements posted during the last %d days'] = 'images ajoutées au cours de %d derniers jours';
+$lang['Choose an image'] = 'Choisir une image à ajouter';
+
?>
diff --git a/language/fr_FR/help/configuration.html b/language/fr_FR/help/configuration.html
index 4f2a9f3d7..086b78e40 100644
--- a/language/fr_FR/help/configuration.html
+++ b/language/fr_FR/help/configuration.html
@@ -34,8 +34,6 @@ galerie.</li>
<li><strong>Notifier les administrateurs lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li>
- <li><strong>Notifier les administrateurs quand une image est téléchargée</strong>: Les administrateurs recevront un courriel à chaque image mis à disposition par un utilisateur.</li>
-
</ul>
<h3>Historique</h3>
@@ -78,6 +76,13 @@ La validation des commentaires utilisateurs a lieu dans l'écran <span class="pw
</ul>
+<h3>Téléchargement</h3>
+<ul>
+ <li><strong>Afficher le lien d'ajout d'image tout le temps</strong>: S'il existe des catégories permettant le téléchargement, le lien d'ajout d'image sera affiché quelque soit la catégorie.</li>
+ <li><strong>Niveau d'accès utilisateur pour télécharger</strong>: Permet de restreindre l'ajout à certains utilisateurs</li>
+ <li><strong>Notifier les administrateurs quand une image est téléchargée</strong>: Les administrateurs recevront un courriel à chaque image mis à disposition par un utilisateur.</li>
+</ul>
+
<h3>Affichage par défaut</h3>
<p>Modifier les options d'affichage par défaut: pour les visiteurs non
connectés. Une fois connecté, ces options sont surchargées par celles de
diff --git a/language/nl_NL/admin.lang.php b/language/nl_NL/admin.lang.php
index cc05317a8..02bb2c522 100644
--- a/language/nl_NL/admin.lang.php
+++ b/language/nl_NL/admin.lang.php
@@ -643,4 +643,14 @@ $lang['c13y_submit_correction'] = 'Pas geselecteerde correcties toe';
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
/* TODO */ $lang['Purge compiled templates'] = 'Purge compiled templates';
/* TODO */ $lang['Caddie is currently empty'] = 'Caddie is currently empty';
+/* TODO */ $lang['conf_upload_title'] = 'Upload';
+/* TODO */ $lang['Show upload link every time'] = 'Show upload link every time';
+/* TODO */ $lang['User access level to upload'] = 'User access level to upload';
+/* TODO */ $lang['ACCESS_0'] = 'Free access';
+/* TODO */ $lang['ACCESS_1'] = 'Access to all';
+/* TODO */ $lang['ACCESS_2'] = 'Access to subscribed';
+/* TODO */ $lang['ACCESS_3'] = 'Access to administrators';
+/* TODO */ $lang['ACCESS_4'] = 'Access to webmasters';
+/* TODO */ $lang['ACCESS_5'] = 'No access';
+
?>
diff --git a/language/nl_NL/common.lang.php b/language/nl_NL/common.lang.php
index 40c338d9a..4f20be252 100644
--- a/language/nl_NL/common.lang.php
+++ b/language/nl_NL/common.lang.php
@@ -306,7 +306,6 @@ $lang['title_send_mail'] = 'commentaar op je site';
$lang['today'] = 'vandaag';
$lang['update_rate'] = 'Werk je beoordeling bij';
$lang['update_wrong_dirname'] = 'verkeerde bestandsnaam';
-$lang['upload_advise'] = 'Kies een afbeelding om in een categorie te plaatsen : ';
$lang['upload_advise_filesize'] = 'het bestandsformaat mag niet te groot zijn : ';
$lang['upload_advise_filetype'] = 'de afbeelding moet een extensie hebbben die eindigt op jpg, gif of png';
$lang['upload_advise_height'] = 'de hoogte van de afbeelding mag niet te groot zijn : ';
@@ -364,4 +363,6 @@ $lang['%d element are also linked to current tags'] = '%d image are also linked
$lang['%d elements are also linked to current tags'] = '%d images are also linked to current tags';
$lang['See elements linked to this tag only'] = 'Toon afbeelding gelinkt met deze tag';
$lang['elements posted during the last %d days'] = 'afbeelding binnen de %d dagen';
+$lang['Choose an image'] = 'Kies een afbeelding om';
+
?>
diff --git a/language/nl_NL/help/configuration.html b/language/nl_NL/help/configuration.html
index 86ab7e6ec..78cd24169 100644
--- a/language/nl_NL/help/configuration.html
+++ b/language/nl_NL/help/configuration.html
@@ -27,8 +27,6 @@ configuratieparameters die zouden moeten zijn genoeg voor de overgrote meerderhe
<li><strong>Email admins wanneer een nieuwe gebruiker zich registreerd</strong>: Administrators ontvangen een mailtje bij elke registratie.</li>
- <li><strong>Email admins wanneer een afbeelding is ge-upload</strong>: Administrators ontvangen een mailtje voor elke ge-uploade bestand door gebruikers.</li>
-
</ul>
<h3>Geschiedenis</h3>
@@ -64,6 +62,13 @@ Gebruikers commentaar valideren gaat via het scherm <span class="pwgScreen">Admi
</ul>
+<!--TODO --><h3>Upload</h3>
+<ul>
+<!--TODO --> <li><strong>Show upload link every time</strong>: If exists uploadeable categories, add link will be show for each categoy.</li>
+<!--TODO --> <li><strong>User access level to upload</strong>: Allows to restrict upload by users</li>
+ <li><strong>Email admins wanneer een afbeelding is ge-upload</strong>: Administrators ontvangen een mailtje voor elke ge-uploade bestand door gebruikers.</li>
+</ul>
+
<h3>Standaard weergave</h3>
<p>Hier kan je de weergave aan passen die als standaard worden ingesteld, die je gast ziet als hij zich niet heeft aangemeld. Eenmaal aangemeld worden deze
diff --git a/nbm.php b/nbm.php
index 1fcb31403..b183bcb20 100644
--- a/nbm.php
+++ b/nbm.php
@@ -25,7 +25,7 @@
//--------------------------------------------------------------------- include
define('PHPWG_ROOT_PATH','./');
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
-check_status(ACCESS_NONE);
+check_status(ACCESS_FREE);
include_once(PHPWG_ROOT_PATH.'include/functions_notification.inc.php');
include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
diff --git a/password.php b/password.php
index da2f4dcae..2161188b7 100644
--- a/password.php
+++ b/password.php
@@ -32,7 +32,7 @@ include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
// +-----------------------------------------------------------------------+
-check_status(ACCESS_NONE);
+check_status(ACCESS_FREE);
// +-----------------------------------------------------------------------+
// | send a new password |
diff --git a/register.php b/register.php
index ec3c7969b..7ce5f5207 100644
--- a/register.php
+++ b/register.php
@@ -28,7 +28,7 @@ include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
// +-----------------------------------------------------------------------+
-check_status(ACCESS_NONE);
+check_status(ACCESS_FREE);
//----------------------------------------------------------- user registration
diff --git a/search_rules.php b/search_rules.php
index d0a4fa5e5..436651844 100644
--- a/search_rules.php
+++ b/search_rules.php
@@ -39,7 +39,7 @@ function inc_exc_str($is_included)
define('PHPWG_ROOT_PATH','./');
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
-check_status(ACCESS_NONE);
+check_status(ACCESS_FREE);
include_once( PHPWG_ROOT_PATH.'include/functions_search.inc.php' );
$page['body_id'] = 'thePopuphelpPage';
diff --git a/template/yoga/admin/configuration.tpl b/template/yoga/admin/configuration.tpl
index cccb879af..04d8c7855 100644
--- a/template/yoga/admin/configuration.tpl
+++ b/template/yoga/admin/configuration.tpl
@@ -79,13 +79,6 @@
<input type="checkbox" name="email_admin_on_new_user" {if ($main.email_admin_on_new_user)}checked="checked"{/if} />
</label>
</li>
-
- <li>
- <label>
- <span class="property">{'Email administrators when a picture is uploaded'|@translate}</span>
- <input type="checkbox" name="email_admin_on_picture_uploaded" {if ($main.email_admin_on_picture_uploaded)}checked="checked"{/if} />
- </label>
- </li>
</ul>
</fieldset>
{/if}
@@ -152,6 +145,27 @@
</fieldset>
{/if}
+{if isset($upload)}
+<fieldset id="uploadConf">
+ <ul>
+ <li>
+ <label><span class="property">{'Show upload link every time'|@translate}</span>
+ <input type="checkbox" name="upload_link_everytime" {if ($upload.upload_link_everytime)}checked="checked"{/if} /></label>
+ </li>
+ <li>
+ <label><span class="property">{'User access level to upload'|@translate}</span>
+ {html_options name="upload_user_access" options=$upload.upload_user_access_options selected=$upload.upload_user_access_options_selected}
+ </li>
+ <li>
+ <label>
+ <span class="property">{'Email administrators when a picture is uploaded'|@translate}</span>
+ <input type="checkbox" name="email_admin_on_picture_uploaded" {if ($upload.email_admin_on_picture_uploaded)}checked="checked"{/if} />
+ </label>
+ </li>
+ </ul>
+</fieldset>
+{/if}
+
{if isset($default)}
{$PROFILE_CONTENT}
{/if}
diff --git a/template/yoga/admin/default-layout.css b/template/yoga/admin/default-layout.css
index b458b72f4..45e352606 100644
--- a/template/yoga/admin/default-layout.css
+++ b/template/yoga/admin/default-layout.css
@@ -99,13 +99,15 @@ FORM#categoryPermissions LI {
FIELDSET#mainConfCheck SPAN.property,
FIELDSET#historyConf SPAN.property,
-FIELDSET#commentsConf SPAN.property {
+FIELDSET#commentsConf SPAN.property,
+FIELDSET#uploadConf SPAN.property {
float: right;
text-align: left;
}
FIELDSET#mainConfCheck INPUT,
FIELDSET#historyConf INPUT,
-FIELDSET#commentsConf INPUT {
+FIELDSET#commentsConf INPUT,
+FIELDSET#uploadConf INPUT {
float: none;
}
@@ -121,15 +123,19 @@ FIELDSET#historyConf SPAN.property {
width: 90%;
}
FIELDSET#mainConfCheck INPUT,
-FIELDSET#historyConf INPUT {
+FIELDSET#historyConf INPUT,
+FIELDSET#commentsConf INPUT,
+FIELDSET#uploadConf SELECT,
+FIELDSET#uploadConf INPUT {
margin-left: 5%;
}
FIELDSET#commentsConf SPAN.property {
width: 85%;
}
-FIELDSET#commentsConf INPUT {
- margin-left: 5%;
+
+FIELDSET#uploadConf SPAN.property {
+ width: 75%;
}
/* PWG Links Menu is fixed Graphic charts */
diff --git a/template/yoga/admin/picture_modify.tpl b/template/yoga/admin/picture_modify.tpl
index a48773e35..f6243acb9 100644
--- a/template/yoga/admin/picture_modify.tpl
+++ b/template/yoga/admin/picture_modify.tpl
@@ -115,14 +115,14 @@
<td><textarea name="description" class="description">{$DESCRIPTION}</textarea></td>
</tr>
- <tr>
- <td><strong>{'Minimum privacy level'|@translate}</strong></td>
- <td>
- <select name="level" size="1">
- {html_options options=$level_options selected=$level_options_selected}
- </select>
- </td>
- </tr>
+ <tr>
+ <td><strong>{'Minimum privacy level'|@translate}</strong></td>
+ <td>
+ <select name="level" size="1">
+ {html_options options=$level_options selected=$level_options_selected}
+ </select>
+ </td>
+ </tr>
</table>
diff --git a/template/yoga/menubar.tpl b/template/yoga/menubar.tpl
index b53af4b1e..fda136c29 100644
--- a/template/yoga/menubar.tpl
+++ b/template/yoga/menubar.tpl
@@ -3,20 +3,20 @@
<div id="menubar">
{if not empty($links)}
<dl id="mbLinks">
- <dt>{'Links'|@translate}</dt>
- <dd>
- <ul>
- {foreach from=$links item=link}
- <li>
- <a href="{$link.URL}"
- {if isset($link.new_window) }onclick="window.open(this.href, '{$link.new_window.NAME|@escape:'javascript'}','{$link.new_window.FEATURES|@escape:'javascript'}'); return false;"{/if}
- >
- {$link.LABEL}
- </a>
- </li>
- {/foreach}{*links*}
- </ul>
- </dd>
+ <dt>{'Links'|@translate}</dt>
+ <dd>
+ <ul>
+ {foreach from=$links item=link}
+ <li>
+ <a href="{$link.URL}"
+ {if isset($link.new_window) }onclick="window.open(this.href, '{$link.new_window.NAME|@escape:'javascript'}','{$link.new_window.FEATURES|@escape:'javascript'}'); return false;"{/if}
+ >
+ {$link.LABEL}
+ </a>
+ </li>
+ {/foreach}{*links*}
+ </ul>
+ </dd>
</dl>
{/if}{*links*}
@@ -28,136 +28,136 @@
{/if}
<dl id="mbCategories">
- <dt><a href="{$U_CATEGORIES}">{'Categories'|@translate}</a></dt>
- <dd>
- {$MENU_CATEGORIES_CONTENT}
+ <dt><a href="{$U_CATEGORIES}">{'Categories'|@translate}</a></dt>
+ <dd>
+ {$MENU_CATEGORIES_CONTENT}
{if isset($U_UPLOAD)}
<ul><li>
<a href="{$U_UPLOAD}">{'upload_picture'|@translate}</a>
</li></ul>
{/if}
- <p class="totalImages">{$pwg->l10n_dec('%d element', '%d elements', $NB_PICTURE)}</p>
+ <p class="totalImages">{$pwg->l10n_dec('%d element', '%d elements', $NB_PICTURE)}</p>
</dd>
</dl>
{if not empty($related_tags)}
<dl id="mbTags">
- <dt>{'Related tags'|@translate}</dt>
- <dd>
- <ul id="menuTagCloud">
- {foreach from=$related_tags item=tag}
- <li>
- {if !empty($tag.add) }
- <a href="{$tag.add.URL}"
- title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.add.COUNTER)}"
- rel="nofollow">
- <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" />
- </a>
- {/if}
- <a href="{$tag.U_TAG}" class="{$tag.CLASS}" title="{'See elements linked to this tag only'|@translate}">{$tag.NAME}</a>
- </li>
- {/foreach}
- </ul>
- </dd>
+ <dt>{'Related tags'|@translate}</dt>
+ <dd>
+ <ul id="menuTagCloud">
+ {foreach from=$related_tags item=tag}
+ <li>
+ {if !empty($tag.add) }
+ <a href="{$tag.add.URL}"
+ title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.add.COUNTER)}"
+ rel="nofollow">
+ <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" />
+ </a>
+ {/if}
+ <a href="{$tag.U_TAG}" class="{$tag.CLASS}" title="{'See elements linked to this tag only'|@translate}">{$tag.NAME}</a>
+ </li>
+ {/foreach}
+ </ul>
+ </dd>
</dl>
{/if}
<dl id="mbSpecial">
- <dt>{'special_categories'|@translate}</dt>
- <dd>
- <ul>
- {foreach from=$special_categories item=cat}
- <li><a href="{$cat.URL}" title="{$cat.TITLE}" {if isset($cat.REL)}{$cat.REL}{/if}>{$cat.NAME}</a></li>
- {/foreach}
- </ul>
- </dd>
+ <dt>{'special_categories'|@translate}</dt>
+ <dd>
+ <ul>
+ {foreach from=$special_categories item=cat}
+ <li><a href="{$cat.URL}" title="{$cat.TITLE}" {if isset($cat.REL)}{$cat.REL}{/if}>{$cat.NAME}</a></li>
+ {/foreach}
+ </ul>
+ </dd>
</dl>
<dl id="mbMenu">
- <dt>{'title_menu'|@translate}</dt>
- <dd>
- <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
- <p>
- <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
- </p>
- </form>
- <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
-
- <ul>
- {foreach from=$summaries item=sum}
- <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
- {/foreach}
- </ul>
- </dd>
+ <dt>{'title_menu'|@translate}</dt>
+ <dd>
+ <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
+ <p>
+ <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
+ </p>
+ </form>
+ <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
+
+ <ul>
+ {foreach from=$summaries item=sum}
+ <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
+ {/foreach}
+ </ul>
+ </dd>
</dl>
<dl id="mbIdentification">
- <dt>{'identification'|@translate}</dt>
- <dd>
+ <dt>{'identification'|@translate}</dt>
+ <dd>
{if isset($USERNAME)}
<p>{'hello'|@translate}&nbsp;{$USERNAME}&nbsp;!</p>
{/if}
- <ul>
- {if isset($U_REGISTER)}
- <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
- {/if}
-
- {if isset($U_IDENTIFY)}
- <li><a href="{$U_IDENTIFY}" rel="nofollow">{'Connection'|@translate}</a></li>
- {/if}
-
- {if isset($U_LOGOUT)}
- <li><a href="{$U_LOGOUT}">{'logout'|@translate}</a></li>
- {/if}
-
- {if isset($U_PROFILE)}
- <li><a href="{$U_PROFILE}" title="{'hint_customize'|@translate}">{'customize'|@translate}</a></li>
- {/if}
-
- {if isset($U_ADMIN)}
- <li><a href="{$U_ADMIN}" title="{'hint_admin'|@translate}">{'admin'|@translate}</a></li>
- {/if}
- </ul>
-
- {if isset($U_IDENTIFY)}
- <form method="post" action="{$U_IDENTIFY}" class="filter" id="quickconnect">
- <fieldset>
- <legend>{'Quick connect'|@translate}</legend>
-
- <label>
- {'Username'|@translate}
- <input type="text" name="username" size="15" value="">
- </label>
-
- <label>
- {'Password'|@translate}
- <input type="password" name="password" size="15">
- </label>
-
- {if $AUTHORIZE_REMEMBERING}
- <label>
- {'remember_me'|@translate}
- <input type="checkbox" name="remember_me" value="1">
- </label>
- {/if}
- <p>
- <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
- </p>
-
- <ul class="actions">
- <li><a href="{$U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/lost_password.png" class="button" alt="{'Forgot your password?'|@translate}"></a></li>
- {if isset($U_REGISTER)}
- <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/register.png" class="button" alt="{'Register'|@translate}"/></a></li>
- {/if}
- </ul>
-
- </fieldset>
- </form>
+ <ul>
+ {if isset($U_REGISTER)}
+ <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_IDENTIFY)}
+ <li><a href="{$U_IDENTIFY}" rel="nofollow">{'Connection'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_LOGOUT)}
+ <li><a href="{$U_LOGOUT}">{'logout'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_PROFILE)}
+ <li><a href="{$U_PROFILE}" title="{'hint_customize'|@translate}">{'customize'|@translate}</a></li>
+ {/if}
+
+ {if isset($U_ADMIN)}
+ <li><a href="{$U_ADMIN}" title="{'hint_admin'|@translate}">{'admin'|@translate}</a></li>
+ {/if}
+ </ul>
+
+ {if isset($U_IDENTIFY)}
+ <form method="post" action="{$U_IDENTIFY}" class="filter" id="quickconnect">
+ <fieldset>
+ <legend>{'Quick connect'|@translate}</legend>
+
+ <label>
+ {'Username'|@translate}
+ <input type="text" name="username" size="15" value="">
+ </label>
+
+ <label>
+ {'Password'|@translate}
+ <input type="password" name="password" size="15">
+ </label>
+
+ {if $AUTHORIZE_REMEMBERING}
+ <label>
+ {'remember_me'|@translate}
+ <input type="checkbox" name="remember_me" value="1">
+ </label>
+ {/if}
+ <p>
+ <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
+ </p>
+
+ <ul class="actions">
+ <li><a href="{$U_LOST_PASSWORD}" title="{'Forgot your password?'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/lost_password.png" class="button" alt="{'Forgot your password?'|@translate}"></a></li>
+ {if isset($U_REGISTER)}
+ <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow"><img src="{$ROOT_URL}{$themeconf.icon_dir}/register.png" class="button" alt="{'Register'|@translate}"/></a></li>
+ {/if}
+ </ul>
+
+ </fieldset>
+ </form>
{/if}
</dd>
diff --git a/template/yoga/upload.tpl b/template/yoga/upload.tpl
index 1aad667e3..78ef36585 100644
--- a/template/yoga/upload.tpl
+++ b/template/yoga/upload.tpl
@@ -35,50 +35,57 @@
</td>
</tr>
<tr>
- <td colspan="2" align="center" style="padding:10px;">
+ <td colspan="2" align="center">
<input name="picture" type="file" value="" />
</td>
</tr>
{if isset($SHOW_FORM_FIELDS) and $SHOW_FORM_FIELDS}
- <!-- username -->
+ <!-- category -->
+ <tr>
+ <td>{'Category'|@translate}</td>
+ <td>
+ {html_options name="category" options=$categories selected=$categories_selected}
+ </td>
+ </tr>
+ <!-- username -->
<tr>
- <td class="menu">{'Username'|@translate} <span style="color:red;">*</span></td>
- <td align="left" style="padding:10px;">
+ <td>{'Username'|@translate} <span style="color:red;">*</span></td>
+ <td>
<input name="username" type="text" value="{$NAME}" />
</td>
</tr>
- <!-- mail address -->
+ <!-- mail address -->
<tr>
- <td class="menu">{'mail_address'|@translate} <span style="color:red;">*</span></td>
- <td align="left" style="padding:10px;">
+ <td>{'mail_address'|@translate} <span style="color:red;">*</span></td>
+ <td>
<input name="mail_address" type="text" value="{$EMAIL}" />
</td>
</tr>
- <!-- name of the picture -->
+ <!-- name of the picture -->
<tr>
- <td class="menu">{'upload_name'|@translate}</td>
- <td align="left" style="padding:10px;">
+ <td>{'upload_name'|@translate}</td>
+ <td>
<input name="name" type="text" value="{$NAME_IMG}" />
</td>
</tr>
- <!-- author -->
+ <!-- author -->
<tr>
- <td class="menu">{'upload_author'|@translate}</td>
- <td align="left" style="padding:10px;">
+ <td>{'upload_author'|@translate}</td>
+ <td>
<input name="author" type="text" value="{$AUTHOR_IMG}" />
</td>
</tr>
- <!-- date of creation -->
+ <!-- date of creation -->
<tr>
- <td class="menu">{'Creation date'|@translate} (DD/MM/YYYY)</td>
- <td align="left" style="padding:10px;">
+ <td>{'Creation date'|@translate} (DD/MM/YYYY)</td>
+ <td>
<input name="date_creation" type="text" value="{$DATE_IMG}" />
</td>
</tr>
- <!-- comment -->
+ <!-- comment -->
<tr>
- <td class="menu">{'comment'|@translate}</td>
- <td align="left" style="padding:10px;">
+ <td>{'comment'|@translate}</td>
+ <td>
<textarea name="comment" rows="3" cols="40" style="overflow:auto">{$COMMENT_IMG}</textarea>
</td>
</tr>
diff --git a/upload.php b/upload.php
index 97b1f99af..83131c80d 100644
--- a/upload.php
+++ b/upload.php
@@ -20,17 +20,32 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
+
define('PHPWG_ROOT_PATH','./');
-include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
-check_status(ACCESS_GUEST);
+// +-----------------------------------------------------------------------+
+// | Includes |
+// +-----------------------------------------------------------------------+
+include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
+include_once(PHPWG_ROOT_PATH.'include/upload.class.php');
-$username = !empty($_POST['username'])?$_POST['username']:$user['username'];
-$mail_address = !empty($_POST['mail_address'])?$_POST['mail_address']:@$user['mail_address'];
-$name = !empty($_POST['name'])?$_POST['name']:'';
-$author = !empty($_POST['author'])?$_POST['author']:'';
-$date_creation = !empty($_POST['date_creation'])?$_POST['date_creation']:'';
-$comment = !empty($_POST['comment'])?$_POST['comment']:'';
+// +-----------------------------------------------------------------------+
+// | Check Access and exit when user status is not ok |
+// +-----------------------------------------------------------------------+
+check_status($conf['upload_user_access']);
+
+// +-----------------------------------------------------------------------+
+// | Create upload object |
+// +-----------------------------------------------------------------------+
+$upload = new Upload();
+
+
+$username = !empty($_POST['username']) ? $_POST['username']:(is_classic_user() ? $user['username'] : '');
+$mail_address = !empty($_POST['mail_address']) ? $_POST['mail_address'] : (is_classic_user() ? $user['email'] : '');
+$name = !empty($_POST['name']) ? $_POST['name'] : '';
+$author = !empty($_POST['author']) ? $_POST['author'] : (is_classic_user() ? $user['username'] : '');
+$date_creation = !empty($_POST['date_creation']) ? $_POST['date_creation'] : '';
+$comment = !empty($_POST['comment']) ? $_POST['comment'] : '';
//------------------------------------------------------------------- functions
// The validate_upload function checks if the image of the given path is valid.
@@ -121,24 +136,42 @@ function validate_upload( $temp_name, $my_max_file_size,
}
//-------------------------------------------------- access authorization check
+if (isset($_POST['category']) and is_numeric($_POST['category']))
+{
+ $page['category'] = $_POST['category'];
+}
+else
if (isset($_GET['cat']) and is_numeric($_GET['cat']))
{
$page['category'] = $_GET['cat'];
}
+else
+{
+ $page['category'] = null;
+}
-if (isset($page['category']))
+if (! empty($page['category']))
{
- check_restrictions( $page['category'] );
- $category = get_cat_info( $page['category'] );
- $category['cat_dir'] = get_complete_dir( $page['category'] );
+ check_restrictions($page['category']);
+ $category = get_cat_info($page['category']);
+ $category['cat_dir'] = get_complete_dir($page['category']);
if (url_is_remote($category['cat_dir']) or !$category['uploadable'])
{
page_forbidden('upload not allowed');
}
}
-else { // $page['category'] may be set by a futur plugin but without it
- bad_request('invalid parameters');
+else
+{
+ if (isset($_POST['submit']))
+ {
+ // $page['category'] may be set by a futur plugin but without it
+ bad_request('invalid parameters');
+ }
+ else
+ {
+ $category = null;
+ }
}
$error = array();
@@ -147,6 +180,7 @@ if ( isset( $_GET['waiting_id'] ) )
{
$page['waiting_id'] = $_GET['waiting_id'];
}
+
//-------------------------------------------------------------- picture upload
// verfying fields
if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
@@ -296,6 +330,25 @@ $page['body_id'] = 'theUploadPage';
include(PHPWG_ROOT_PATH.'include/page_header.php');
$template->set_filenames(array('upload'=>'upload.tpl'));
+// Load category list
+$query = '
+SELECT
+ id, name, uppercats, global_rank
+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'
+ ).'
+;';
+display_select_cat_wrapper($query, array($page['category']), 'categories');
+
$u_form = PHPWG_ROOT_PATH.'upload.php?cat='.$page['category'];
if ( isset( $page['waiting_id'] ) )
{
@@ -304,12 +357,11 @@ $u_form.= '&amp;waiting_id='.$page['waiting_id'];
if ( isset( $page['waiting_id'] ) )
{
- $advise_title=l10n('upload_advise_thumbnail').$_FILES['picture']['name'];
+ $advise_title = l10n('upload_advise_thumbnail').$_FILES['picture']['name'];
}
else
{
- $advise_title = l10n('upload_advise');
- $advise_title.= get_cat_display_name($category['upper_names']);
+ $advise_title = l10n('Choose an image');
}
$template->assign(
diff --git a/ws.php b/ws.php
index f73c44e50..80f543f06 100644
--- a/ws.php
+++ b/ws.php
@@ -24,7 +24,7 @@
define ('PHPWG_ROOT_PATH', './');
include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
-check_status(ACCESS_NONE);
+check_status(ACCESS_FREE);
include_once(PHPWG_ROOT_PATH.'include/ws_core.inc.php');
if ( !$conf['allow_web_services'] )