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 @@ + 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 @@ + 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.
  • Email admins when a new user registers: Administrators will be received mail for each registration.
  • -
  • Email adminis when a picture is uploaded: Administrators will be received mail for each picture uploaded by a user.
  • -

    History

    @@ -78,6 +76,13 @@ User comments validation takes place in the screen Admin +

    Upload

    + +

    Default display

    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

  • Permitir el registro de los utilizadores: La inscripción es libre para ellos todos.
  • -
  • Notificar a los administradores cuando una imagen es cargada: Los administradores recibirán un courriel a cada imagen puesto en disposición por un utilizador.
  • -

    Reseña histórica

    @@ -62,6 +60,13 @@ La validación de los comentarios utilizadores se efectua en la pantalla +

    Upload

    + +

    Fijación por defecto

    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 perfila.

    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.
  • Notifier les administrateurs lors de l'inscription d'un utilisateur: Les administrateurs recevront un courriel à chaque inscription.
  • -
  • Notifier les administrateurs quand une image est téléchargée: Les administrateurs recevront un courriel à chaque image mis à disposition par un utilisateur.
  • -

    Historique

    @@ -78,6 +76,13 @@ La validation des commentaires utilisateurs a lieu dans l'écran Admi +

    Upload

    +
      +
    • Show upload link every time: If exists uploadeable categories, add link will be show for each categoy.
    • +
    • User access level to upload: Allows to restrict upload by users
    • +
    • Email admins wanneer een afbeelding is ge-upload: Administrators ontvangen een mailtje voor elke ge-uploade bestand door gebruikers.
    • +
    +

    Standaard weergave

    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 @@ - -

  • - -
  • {/if} @@ -152,6 +145,27 @@ {/if} +{if isset($upload)} +
    +
      +
    • + +
    • +
    • +
    • +
    • + +
    • +
    +
    +{/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 @@ - - {'Minimum privacy level'|@translate} - - - - + + {'Minimum privacy level'|@translate} + + + + 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 @@