Changeset 2325


Ignore:
Timestamp:
May 2, 2008, 11:56:21 PM (16 years ago)
Author:
rub
Message:

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

Location:
trunk
Files:
2 added
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/configuration.php

    r2299 r2325  
    5252    'rate_anonymous',
    5353    'email_admin_on_new_user',
    54     'email_admin_on_picture_uploaded',
    5554   );
    5655
     
    5958    'history_admin',
    6059    'history_guest'
     60   );
     61
     62$upload_checkboxes = array(
     63    'upload_link_everytime',
     64    'email_admin_on_picture_uploaded',
    6165   );
    6266
     
    106110      }
    107111      foreach( $comments_checkboxes as $checkbox)
     112      {
     113        $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
     114      }
     115      break;
     116    }
     117    case 'upload' :
     118    {
     119      foreach( $upload_checkboxes as $checkbox)
    108120      {
    109121        $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
     
    161173$tabsheet->add('history', l10n('conf_history_title'), $conf_link.'history');
    162174$tabsheet->add('comments', l10n('conf_comments_title'), $conf_link.'comments');
     175$tabsheet->add('upload', l10n('conf_upload_title'), $conf_link.'upload');
    163176$tabsheet->add('default', l10n('conf_display'), $conf_link.'default');
    164177// TabSheet selection
     
    188201        ));
    189202
    190     foreach( $main_checkboxes as $checkbox)
     203    foreach ($main_checkboxes as $checkbox)
    191204    {
    192205      $template->append(
     
    203216  {
    204217    //Necessary for merge_block_vars
    205     foreach( $history_checkboxes as $checkbox)
     218    foreach ($history_checkboxes as $checkbox)
    206219    {
    207220      $template->append(
     
    223236        ));
    224237
    225     foreach( $comments_checkboxes as $checkbox)
     238    foreach ($comments_checkboxes as $checkbox)
    226239    {
    227240      $template->append(
     
    235248    break;
    236249  }
     250  case 'upload' :
     251  {
     252    $template->assign(
     253      'upload',
     254      array(
     255        'upload_user_access_options'=> get_user_access_level_html_options(ACCESS_GUEST),
     256        'upload_user_access_options_selected' => array($conf['upload_user_access'])
     257        )
     258      );
     259    //Necessary for merge_block_vars
     260    foreach ($upload_checkboxes as $checkbox)
     261    {
     262      $template->append(
     263          'upload',
     264          array(
     265            $checkbox => $conf[$checkbox]
     266            ),
     267          true
     268        );
     269    }
     270    break;
     271  }
    237272  case 'default' :
    238273  {
  • trunk/admin/include/functions.php

    r2324 r2325  
    18381838  return $query;
    18391839}
     1840
     1841/**
     1842 * Returns array use on template with html_options method
     1843 * @param Min and Max access to use
     1844 * @return array of user access level
     1845 */
     1846function get_user_access_level_html_options($MinLevelAccess = ACCESS_FREE, $MaxLevelAccess = ACCESS_CLOSED)
     1847{
     1848  $tpl_options = array();
     1849  for ($level = $MinLevelAccess; $level <= $MaxLevelAccess; $level++)
     1850  {
     1851    $tpl_options[$level] = l10n(sprintf('ACCESS_%d', $level));
     1852  }
     1853  return $tpl_options;
     1854}
     1855
    18401856?>
  • trunk/identification.php

    r2299 r2325  
    2929// | Check Access and exit when user status is not ok                      |
    3030// +-----------------------------------------------------------------------+
    31 check_status(ACCESS_NONE);
     31check_status(ACCESS_FREE);
    3232
    3333//-------------------------------------------------------------- identification
  • trunk/include/constants.php

    r2299 r2325  
    3737
    3838// Access codes
    39 define('ACCESS_NONE', 0);
     39define('ACCESS_FREE', 0);
    4040define('ACCESS_GUEST', 1);
    4141define('ACCESS_CLASSIC', 2);
    4242define('ACCESS_ADMINISTRATOR', 3);
    4343define('ACCESS_WEBMASTER', 4);
     44define('ACCESS_CLOSED', 5);
    4445
    4546// Table names
  • trunk/include/functions_category.inc.php

    r2299 r2325  
    453453}
    454454
     455/**
     456 * returns the link of upload menu
     457 *
     458 * @param null
     459 * @return string or null
     460 */
     461function get_upload_menu_link()
     462{
     463  global $conf, $page, $user;
     464
     465  $show_link = false;
     466  $arg_link = null;
     467
     468  if (is_autorize_status($conf['upload_user_access']))
     469  {
     470    if (isset($page['category']) and $page['category']['uploadable'] )
     471    {
     472      // upload a picture in the category
     473      $show_link = true;
     474      $arg_link = 'cat='.$page['category']['id'];
     475    }
     476    else
     477    if ($conf['upload_link_everytime'])
     478    {
     479      // upload a picture in the category
     480      $query = '
     481SELECT
     482  1
     483FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
     484  ON id = cat_id and user_id = '.$user['id'].'
     485WHERE
     486  uploadable = \'true\'
     487  '.get_sql_condition_FandF
     488    (
     489      array
     490        (
     491          'visible_categories' => 'id',
     492        ),
     493      'AND'
     494    ).'
     495LIMIT 1';
     496
     497      $show_link = mysql_num_rows(pwg_query($query)) <> 0;
     498    }
     499  }
     500  if ($show_link)
     501  {
     502    return get_root_url().'upload.php'.(empty($arg_link) ? '' : '?'.$arg_link);
     503  }
     504  else
     505  {
     506    return;
     507  }
     508}
     509
    455510?>
  • trunk/include/functions_user.inc.php

    r2324 r2325  
    10891089
    10901090/*
    1091  * Return access_type definition of uuser
     1091 * Return access_type definition of user
    10921092 * Test does with user status
    10931093 * @return bool
     
    11021102    {
    11031103      $access_type_status =
    1104         ($conf['guest_access'] ? ACCESS_GUEST : ACCESS_NONE);
     1104        ($conf['guest_access'] ? ACCESS_GUEST : ACCESS_FREE);
    11051105      break;
    11061106    }
     
    11271127    default:
    11281128    {
    1129       $access_type_status = ACCESS_NONE;
     1129      $access_type_status = ACCESS_FREE;
    11301130      break;
    11311131    }
  • trunk/include/menubar.inc.php

    r2299 r2325  
    4040    'U_CATEGORIES' => make_index_url(array('section' => 'categories')),
    4141    'U_LOST_PASSWORD' => get_root_url().'password.php',
     42    'U_UPLOAD' => get_upload_menu_link()
    4243    )
    4344  );
     
    305306  );
    306307
    307 if (isset($page['category']) and $page['category']['uploadable'] )
    308 { // upload a picture in the category
    309   $url = get_root_url().'upload.php?cat='.$page['category']['id'];
    310   $template->assign('U_UPLOAD', $url);
    311 }
    312 
    313308trigger_action('loc_end_menubar');
    314309$template->assign_var_from_handle('MENUBAR', 'menubar');
     310
    315311?>
  • trunk/install/config.sql

    r2208 r2325  
    2626INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('obligatory_user_mail_address','false','Mail address is obligatory for users');
    2727INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('c13y_ignore',null,'List of ignored anomalies');
     28INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_link_everytime','false','Show upload link every time');
     29INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_user_access',2 /*ACCESS_CLASSIC*/,'User access level to upload');
  • trunk/language/en_UK/admin.lang.php

    r2305 r2325  
    635635// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
    636636$lang['Purge compiled templates'] = 'Purge compiled templates';
    637 /* TODO */ $lang['Caddie is currently empty'] = 'Caddie is currently empty';
     637$lang['Caddie is currently empty'] = 'Caddie is currently empty';
     638$lang['conf_upload_title'] = 'Upload';
     639$lang['Show upload link every time'] = 'Show upload link every time';
     640$lang['User access level to upload'] = 'User access level to upload';
     641$lang['ACCESS_0'] = 'Free access';
     642$lang['ACCESS_1'] = 'Access to all';
     643$lang['ACCESS_2'] = 'Access to subscribed';
     644$lang['ACCESS_3'] = 'Access to administrators';
     645$lang['ACCESS_4'] = 'Access to webmasters';
     646$lang['ACCESS_5'] = 'No access';
     647
    638648?>
  • trunk/language/en_UK/common.lang.php

    r2299 r2325  
    307307$lang['update_rate'] = 'Update your rating';
    308308$lang['update_wrong_dirname'] = 'wrong filename';
    309 $lang['upload_advise'] = 'Choose an image to place in the category : ';
    310309$lang['upload_advise_filesize'] = 'the filesize of the picture must not exceed : ';
    311310$lang['upload_advise_filetype'] = 'the picture must be to the fileformat jpg, gif or png';
     
    365364$lang['See elements linked to this tag only'] = 'See images linked to this tag only';
    366365$lang['elements posted during the last %d days'] = 'images posted during the last %d days';
     366$lang['Choose an image'] = 'Choose an image';
     367
    367368?>
  • trunk/language/en_UK/help/configuration.html

    r2048 r2325  
    3434
    3535  <li><strong>Email admins when a new user registers</strong>: Administrators will be received mail for each registration.</li>
    36 
    37   <li><strong>Email adminis when a picture is uploaded</strong>: Administrators will be received mail for each picture uploaded by a user.</li>
    3836
    3937</ul>
     
    7775User comments validation takes place in the screen <span class="pwgScreen">Administration, Pictures, Comments</span>.</li>
    7876
     77</ul>
     78
     79<!--TODO --><h3>Upload</h3>
     80<ul>
     81<!--TODO -->  <li><strong>Show upload link every time</strong>: If exists uploadeable categories, add link will be show for each categoy.</li>
     82<!--TODO -->  <li><strong>User access level to upload</strong>: Allows to restrict upload by users</li>
     83  <li><strong>Email adminis when a picture is uploaded</strong>: Administrators will be received mail for each picture uploaded by a user.</li>
    7984</ul>
    8085
  • trunk/language/es_ES/admin.lang.php

    r2305 r2325  
    640640// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
    641641$lang['Purge compiled templates'] = 'Purgar el templates compilado';
    642 $lang['Caddie is currently empty'] = 'Caddie is currently empty';
     642/* TODO */ $lang['Caddie is currently empty'] = 'Caddie is currently empty';
     643/* TODO */ $lang['conf_upload_title'] = 'Upload';
     644/* TODO */ $lang['Show upload link every time'] = 'Show upload link every time';
     645/* TODO */ $lang['User access level to upload'] = 'User access level to upload';
     646/* TODO */ $lang['ACCESS_0'] = 'Free access';
     647/* TODO */ $lang['ACCESS_1'] = 'Access to all';
     648/* TODO */ $lang['ACCESS_2'] = 'Access to subscribed';
     649/* TODO */ $lang['ACCESS_3'] = 'Access to administrators';
     650/* TODO */ $lang['ACCESS_4'] = 'Access to webmasters';
     651/* TODO */ $lang['ACCESS_5'] = 'No access';
     652
    643653?>
  • trunk/language/es_ES/common.lang.php

    r2300 r2325  
    307307$lang['update_rate'] = 'Actualizar nota';
    308308$lang['update_wrong_dirname'] = 'Mal nombre de repertorio';
    309 $lang['upload_advise'] = 'Elegir una imagen para agregar en esta categoría : ';
    310309$lang['upload_advise_filesize'] = 'El peso de la imagen debe sobrepasar : ';
    311310$lang['upload_advise_filetype'] = 'El tamaño de la imagen debe ser jpg, png ou gif';
     
    365364$lang['See elements linked to this tag only'] = 'Ver las imágenes relacionadas únicamente a este tag';
    366365$lang['elements posted during the last %d days'] = 'esta imagen tiene menos de %d dias';
     366$lang['Choose an image'] = 'Elegir una imagen';
     367
    367368?>
  • trunk/language/es_ES/help/configuration.html

    r2145 r2325  
    2424
    2525  <li><strong>Permitir el registro de los utilizadores</strong>: La inscripción es libre para ellos todos.</li>
    26 
    27   <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>
    2826
    2927</ul>
     
    6361</ul>
    6462
     63<!--TODO --><h3>Upload</h3>
     64<ul>
     65<!--TODO -->  <li><strong>Show upload link every time</strong>: If exists uploadeable categories, add link will be show for each categoy.</li>
     66<!--TODO -->  <li><strong>User access level to upload</strong>: Allows to restrict upload by users</li>
     67  <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>
     68</ul>
     69
    6570<h3>Fijación por defecto</h3>
    6671<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
  • trunk/language/fr_FR/admin.lang.php

    r2320 r2325  
    636636$lang['Purge compiled templates'] = 'Purger les templates compilés';
    637637$lang['Caddie is currently empty'] = 'Le panier est actuellement vide.';
     638$lang['conf_upload_title'] = 'Téléchargement';
     639$lang['Show upload link every time'] = 'Afficher le lien d\'ajout d\'image tout le temps';
     640$lang['User access level to upload'] = 'Niveau d\'accès utilisateur pour télécharger';
     641$lang['ACCESS_0'] = 'Accès libre';
     642$lang['ACCESS_1'] = 'Accès à tous';
     643$lang['ACCESS_2'] = 'Accès aux inscrits';
     644$lang['ACCESS_3'] = 'Accès aux administrateurs';
     645$lang['ACCESS_4'] = 'Accès aux webmestres';
     646$lang['ACCESS_5'] = 'Pas d\'accès';
     647
    638648?>
  • trunk/language/fr_FR/common.lang.php

    r2299 r2325  
    307307$lang['update_rate'] = 'Mettre à jour votre note';
    308308$lang['update_wrong_dirname'] = 'mauvais nom de répertoire';
    309 $lang['upload_advise'] = 'Choisir une image à ajouter dans cette catégorie : ';
    310309$lang['upload_advise_filesize'] = 'le poids de l\'image ne doit dépasser : ';
    311310$lang['upload_advise_filetype'] = 'le format de l\'image doit être jpg, png ou gif';
     
    365364$lang['See elements linked to this tag only'] = 'Voir les images liées uniquement à ce tag';
    366365$lang['elements posted during the last %d days'] = 'images ajoutées au cours de %d derniers jours';
     366$lang['Choose an image'] = 'Choisir une image à ajouter';
     367
    367368?>
  • trunk/language/fr_FR/help/configuration.html

    r2130 r2325  
    3434
    3535  <li><strong>Notifier les administrateurs lors de l'inscription d'un utilisateur</strong>: Les administrateurs recevront un courriel à chaque inscription.</li>
    36 
    37   <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>
    3836
    3937</ul>
     
    7775La validation des commentaires utilisateurs a lieu dans l'écran <span class="pwgScreen">Administration, Images, Commentaires</span>.</li>
    7876
     77</ul>
     78
     79<h3>Téléchargement</h3>
     80<ul>
     81  <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>
     82  <li><strong>Niveau d'accès utilisateur pour télécharger</strong>: Permet de restreindre l'ajout à certains utilisateurs</li>
     83  <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>
    7984</ul>
    8085
  • trunk/language/nl_NL/admin.lang.php

    r2305 r2325  
    644644/* TODO */ $lang['Purge compiled templates'] = 'Purge compiled templates';
    645645/* TODO */ $lang['Caddie is currently empty'] = 'Caddie is currently empty';
     646/* TODO */ $lang['conf_upload_title'] = 'Upload';
     647/* TODO */ $lang['Show upload link every time'] = 'Show upload link every time';
     648/* TODO */ $lang['User access level to upload'] = 'User access level to upload';
     649/* TODO */ $lang['ACCESS_0'] = 'Free access';
     650/* TODO */ $lang['ACCESS_1'] = 'Access to all';
     651/* TODO */ $lang['ACCESS_2'] = 'Access to subscribed';
     652/* TODO */ $lang['ACCESS_3'] = 'Access to administrators';
     653/* TODO */ $lang['ACCESS_4'] = 'Access to webmasters';
     654/* TODO */ $lang['ACCESS_5'] = 'No access';
     655
    646656?>
  • trunk/language/nl_NL/common.lang.php

    r2299 r2325  
    307307$lang['update_rate'] = 'Werk je beoordeling bij';
    308308$lang['update_wrong_dirname'] = 'verkeerde bestandsnaam';
    309 $lang['upload_advise'] = 'Kies een afbeelding om in een categorie te plaatsen : ';
    310309$lang['upload_advise_filesize'] = 'het bestandsformaat mag niet te groot zijn : ';
    311310$lang['upload_advise_filetype'] = 'de afbeelding moet een extensie hebbben die eindigt op jpg, gif of png';
     
    365364$lang['See elements linked to this tag only'] = 'Toon afbeelding gelinkt met deze tag';
    366365$lang['elements posted during the last %d days'] = 'afbeelding binnen de %d dagen';
     366$lang['Choose an image'] = 'Kies een afbeelding om';
     367
    367368?>
  • trunk/language/nl_NL/help/configuration.html

    r2171 r2325  
    2727
    2828  <li><strong>Email admins wanneer een nieuwe gebruiker zich registreerd</strong>: Administrators ontvangen een mailtje bij elke registratie.</li>
    29 
    30   <li><strong>Email admins wanneer een afbeelding is ge-upload</strong>: Administrators ontvangen een mailtje voor elke ge-uploade bestand door gebruikers.</li>
    3129
    3230</ul>
     
    6563</ul>
    6664
     65<!--TODO --><h3>Upload</h3>
     66<ul>
     67<!--TODO -->  <li><strong>Show upload link every time</strong>: If exists uploadeable categories, add link will be show for each categoy.</li>
     68<!--TODO -->  <li><strong>User access level to upload</strong>: Allows to restrict upload by users</li>
     69  <li><strong>Email admins wanneer een afbeelding is ge-upload</strong>: Administrators ontvangen een mailtje voor elke ge-uploade bestand door gebruikers.</li>
     70</ul>
     71
    6772<h3>Standaard weergave</h3>
    6873
  • trunk/nbm.php

    r2299 r2325  
    2626define('PHPWG_ROOT_PATH','./');
    2727include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
    28 check_status(ACCESS_NONE);
     28check_status(ACCESS_FREE);
    2929include_once(PHPWG_ROOT_PATH.'include/functions_notification.inc.php');
    3030include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
  • trunk/password.php

    r2299 r2325  
    3333// | Check Access and exit when user status is not ok                      |
    3434// +-----------------------------------------------------------------------+
    35 check_status(ACCESS_NONE);
     35check_status(ACCESS_FREE);
    3636
    3737// +-----------------------------------------------------------------------+
  • trunk/register.php

    r2299 r2325  
    2929// | Check Access and exit when user status is not ok                      |
    3030// +-----------------------------------------------------------------------+
    31 check_status(ACCESS_NONE);
     31check_status(ACCESS_FREE);
    3232
    3333//----------------------------------------------------------- user registration
  • trunk/search_rules.php

    r2299 r2325  
    4040define('PHPWG_ROOT_PATH','./');
    4141include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
    42 check_status(ACCESS_NONE);
     42check_status(ACCESS_FREE);
    4343include_once( PHPWG_ROOT_PATH.'include/functions_search.inc.php' );
    4444
  • trunk/template/yoga/admin/configuration.tpl

    r2249 r2325  
    8080      </label>
    8181    </li>
    82 
    83     <li>
    84       <label>
    85         <span class="property">{'Email administrators when a picture is uploaded'|@translate}</span>
    86         <input type="checkbox" name="email_admin_on_picture_uploaded" {if ($main.email_admin_on_picture_uploaded)}checked="checked"{/if} />
    87       </label>
    88     </li>
    8982  </ul>
    9083</fieldset>
     
    153146{/if}
    154147
     148{if isset($upload)}
     149<fieldset id="uploadConf">
     150  <ul>
     151    <li>
     152      <label><span class="property">{'Show upload link every time'|@translate}</span>
     153      <input type="checkbox" name="upload_link_everytime" {if ($upload.upload_link_everytime)}checked="checked"{/if} /></label>
     154    </li>
     155    <li>
     156      <label><span class="property">{'User access level to upload'|@translate}</span>
     157      {html_options name="upload_user_access" options=$upload.upload_user_access_options selected=$upload.upload_user_access_options_selected}
     158    </li>
     159    <li>
     160      <label>
     161        <span class="property">{'Email administrators when a picture is uploaded'|@translate}</span>
     162        <input type="checkbox" name="email_admin_on_picture_uploaded" {if ($upload.email_admin_on_picture_uploaded)}checked="checked"{/if} />
     163      </label>
     164    </li>
     165  </ul>
     166</fieldset>
     167{/if}
     168
    155169{if isset($default)}
    156170{$PROFILE_CONTENT}
  • trunk/template/yoga/admin/default-layout.css

    r2285 r2325  
    100100FIELDSET#mainConfCheck SPAN.property,
    101101FIELDSET#historyConf SPAN.property,
    102 FIELDSET#commentsConf SPAN.property {
     102FIELDSET#commentsConf SPAN.property,
     103FIELDSET#uploadConf SPAN.property {
    103104  float: right;
    104105  text-align: left;
     
    106107FIELDSET#mainConfCheck INPUT,
    107108FIELDSET#historyConf INPUT,
    108 FIELDSET#commentsConf INPUT {
     109FIELDSET#commentsConf INPUT,
     110FIELDSET#uploadConf INPUT {
    109111  float: none;
    110112}
     
    122124}
    123125FIELDSET#mainConfCheck INPUT,
    124 FIELDSET#historyConf INPUT {
     126FIELDSET#historyConf INPUT,
     127FIELDSET#commentsConf INPUT,
     128FIELDSET#uploadConf SELECT,
     129FIELDSET#uploadConf INPUT {
    125130  margin-left: 5%;
    126131}
     
    129134  width: 85%;
    130135}
    131 FIELDSET#commentsConf INPUT {
    132   margin-left: 5%;
     136
     137FIELDSET#uploadConf SPAN.property {
     138  width: 75%;
    133139}
    134140
  • trunk/template/yoga/admin/picture_modify.tpl

    r2294 r2325  
    116116      </tr>
    117117
    118         <tr>
    119                 <td><strong>{'Minimum privacy level'|@translate}</strong></td>
    120                 <td>
    121                         <select name="level" size="1">
    122                         {html_options options=$level_options selected=$level_options_selected}
    123                         </select>
    124           </td>
    125         </tr>
     118  <tr>
     119    <td><strong>{'Minimum privacy level'|@translate}</strong></td>
     120    <td>
     121      <select name="level" size="1">
     122        {html_options options=$level_options selected=$level_options_selected}
     123      </select>
     124    </td>
     125  </tr>
    126126
    127127    </table>
  • trunk/template/yoga/menubar.tpl

    r2288 r2325  
    44{if not empty($links)}
    55<dl id="mbLinks">
    6         <dt>{'Links'|@translate}</dt>
    7         <dd>
    8         <ul>
    9                 {foreach from=$links item=link}
    10                 <li>
    11                 <a href="{$link.URL}"
    12                         {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}
    13                 >
    14                         {$link.LABEL}
    15                 </a>
    16                 </li>
    17                 {/foreach}{*links*}
    18         </ul>
    19         </dd>
     6  <dt>{'Links'|@translate}</dt>
     7  <dd>
     8  <ul>
     9    {foreach from=$links item=link}
     10    <li>
     11    <a href="{$link.URL}"
     12      {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}
     13    >
     14      {$link.LABEL}
     15    </a>
     16    </li>
     17    {/foreach}{*links*}
     18  </ul>
     19  </dd>
    2020</dl>
    2121{/if}{*links*}
     
    2929
    3030<dl id="mbCategories">
    31         <dt><a href="{$U_CATEGORIES}">{'Categories'|@translate}</a></dt>
    32         <dd>
    33                 {$MENU_CATEGORIES_CONTENT}
     31  <dt><a href="{$U_CATEGORIES}">{'Categories'|@translate}</a></dt>
     32  <dd>
     33    {$MENU_CATEGORIES_CONTENT}
    3434  {if isset($U_UPLOAD)}
    3535  <ul><li>
     
    3737  </li></ul>
    3838  {/if}
    39                 <p class="totalImages">{$pwg->l10n_dec('%d element', '%d elements', $NB_PICTURE)}</p>
     39    <p class="totalImages">{$pwg->l10n_dec('%d element', '%d elements', $NB_PICTURE)}</p>
    4040  </dd>
    4141</dl>
     
    4444{if not empty($related_tags)}
    4545<dl id="mbTags">
    46         <dt>{'Related tags'|@translate}</dt>
    47         <dd>
    48                 <ul id="menuTagCloud">
    49                 {foreach from=$related_tags item=tag}
    50                 <li>
    51                 {if !empty($tag.add) }
    52                         <a href="{$tag.add.URL}"
    53                                 title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.add.COUNTER)}"
    54                                 rel="nofollow">
    55                                 <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" />
    56                         </a>
    57                 {/if}
    58                 <a href="{$tag.U_TAG}" class="{$tag.CLASS}" title="{'See elements linked to this tag only'|@translate}">{$tag.NAME}</a>
    59                 </li>
    60                 {/foreach}
    61                 </ul>
    62         </dd>
     46  <dt>{'Related tags'|@translate}</dt>
     47  <dd>
     48    <ul id="menuTagCloud">
     49    {foreach from=$related_tags item=tag}
     50    <li>
     51    {if !empty($tag.add) }
     52      <a href="{$tag.add.URL}"
     53        title="{$pwg->l10n_dec('%d element are also linked to current tags', '%d elements are also linked to current tags', $tag.add.COUNTER)}"
     54        rel="nofollow">
     55        <img src="{$ROOT_URL}{$themeconf.icon_dir}/add_tag.png" alt="+" />
     56      </a>
     57    {/if}
     58    <a href="{$tag.U_TAG}" class="{$tag.CLASS}" title="{'See elements linked to this tag only'|@translate}">{$tag.NAME}</a>
     59    </li>
     60    {/foreach}
     61    </ul>
     62  </dd>
    6363</dl>
    6464{/if}
     
    6666
    6767<dl id="mbSpecial">
    68         <dt>{'special_categories'|@translate}</dt>
    69         <dd>
    70                 <ul>
    71                         {foreach from=$special_categories item=cat}
    72                         <li><a href="{$cat.URL}" title="{$cat.TITLE}" {if isset($cat.REL)}{$cat.REL}{/if}>{$cat.NAME}</a></li>
    73                         {/foreach}
    74                 </ul>
    75         </dd>
     68  <dt>{'special_categories'|@translate}</dt>
     69  <dd>
     70    <ul>
     71      {foreach from=$special_categories item=cat}
     72      <li><a href="{$cat.URL}" title="{$cat.TITLE}" {if isset($cat.REL)}{$cat.REL}{/if}>{$cat.NAME}</a></li>
     73      {/foreach}
     74    </ul>
     75  </dd>
    7676</dl>
    7777
    7878
    7979<dl id="mbMenu">
    80         <dt>{'title_menu'|@translate}</dt>
    81         <dd>
    82                 <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
    83                         <p>
    84                                 <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
    85                         </p>
    86                 </form>
    87                 <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
     80  <dt>{'title_menu'|@translate}</dt>
     81  <dd>
     82    <form action="{$ROOT_URL}qsearch.php" method="get" id="quicksearch">
     83      <p>
     84        <input type="text" name="q" id="qsearchInput" onfocus="if (value==qsearch_prompt) value='';" onblur="if (value=='') value=qsearch_prompt;" />
     85      </p>
     86    </form>
     87    <script type="text/javascript">var qsearch_prompt="{'qsearch'|@translate|@escape:'javascript'}"; document.getElementById('qsearchInput').value=qsearch_prompt;</script>
    8888
    89                 <ul>
    90                 {foreach from=$summaries item=sum}
    91                         <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
    92                 {/foreach}
    93                 </ul>
    94         </dd>
     89    <ul>
     90    {foreach from=$summaries item=sum}
     91      <li><a href="{$sum.U_SUMMARY}" title="{$sum.TITLE}" {if isset($sum.REL)}{$sum.REL}{/if}>{$sum.NAME}</a></li>
     92    {/foreach}
     93    </ul>
     94  </dd>
    9595</dl>
    9696
    9797
    9898<dl id="mbIdentification">
    99         <dt>{'identification'|@translate}</dt>
    100         <dd>
     99  <dt>{'identification'|@translate}</dt>
     100  <dd>
    101101    {if isset($USERNAME)}
    102102    <p>{'hello'|@translate}&nbsp;{$USERNAME}&nbsp;!</p>
    103103    {/if}
    104104   
    105         <ul>
    106                 {if isset($U_REGISTER)}
    107                 <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
    108                 {/if}
     105  <ul>
     106    {if isset($U_REGISTER)}
     107    <li><a href="{$U_REGISTER}" title="{'Create a new account'|@translate}" rel="nofollow">{'Register'|@translate}</a></li>
     108    {/if}
    109109
    110                 {if isset($U_IDENTIFY)}
    111                 <li><a href="{$U_IDENTIFY}" rel="nofollow">{'Connection'|@translate}</a></li>
    112                 {/if}
     110    {if isset($U_IDENTIFY)}
     111    <li><a href="{$U_IDENTIFY}" rel="nofollow">{'Connection'|@translate}</a></li>
     112    {/if}
    113113
    114                 {if isset($U_LOGOUT)}
    115                 <li><a href="{$U_LOGOUT}">{'logout'|@translate}</a></li>
    116                 {/if}
     114    {if isset($U_LOGOUT)}
     115    <li><a href="{$U_LOGOUT}">{'logout'|@translate}</a></li>
     116    {/if}
    117117
    118                 {if isset($U_PROFILE)}
    119                 <li><a href="{$U_PROFILE}" title="{'hint_customize'|@translate}">{'customize'|@translate}</a></li>
    120                 {/if}
     118    {if isset($U_PROFILE)}
     119    <li><a href="{$U_PROFILE}" title="{'hint_customize'|@translate}">{'customize'|@translate}</a></li>
     120    {/if}
    121121
    122                 {if isset($U_ADMIN)}
    123                 <li><a href="{$U_ADMIN}" title="{'hint_admin'|@translate}">{'admin'|@translate}</a></li>
    124                 {/if}
    125         </ul>
    126        
    127         {if isset($U_IDENTIFY)}
    128         <form method="post" action="{$U_IDENTIFY}" class="filter" id="quickconnect">
    129         <fieldset>
    130                 <legend>{'Quick connect'|@translate}</legend>
     122    {if isset($U_ADMIN)}
     123    <li><a href="{$U_ADMIN}" title="{'hint_admin'|@translate}">{'admin'|@translate}</a></li>
     124    {/if}
     125  </ul>
     126 
     127  {if isset($U_IDENTIFY)}
     128  <form method="post" action="{$U_IDENTIFY}" class="filter" id="quickconnect">
     129  <fieldset>
     130    <legend>{'Quick connect'|@translate}</legend>
    131131
    132                 <label>
    133                   {'Username'|@translate}
    134                   <input type="text" name="username" size="15" value="">
    135                 </label>
     132    <label>
     133      {'Username'|@translate}
     134      <input type="text" name="username" size="15" value="">
     135    </label>
    136136
    137                 <label>
    138                   {'Password'|@translate}
    139                   <input type="password" name="password" size="15">
    140                 </label>
     137    <label>
     138      {'Password'|@translate}
     139      <input type="password" name="password" size="15">
     140    </label>
    141141
    142                 {if $AUTHORIZE_REMEMBERING}
    143                 <label>
    144                   {'remember_me'|@translate}
    145                   <input type="checkbox" name="remember_me" value="1">
    146                 </label>
    147                 {/if}
    148                 <p>
    149                 <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
    150                 </p>
    151                
    152                 <ul class="actions">
    153                   <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>
    154                   {if isset($U_REGISTER)}
    155                   <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>
    156                   {/if}
    157                 </ul>
     142    {if $AUTHORIZE_REMEMBERING}
     143    <label>
     144      {'remember_me'|@translate}
     145      <input type="checkbox" name="remember_me" value="1">
     146    </label>
     147    {/if}
     148    <p>
     149    <input class="submit" type="submit" name="login" value="{'Submit'|@translate}">
     150    </p>
     151   
     152    <ul class="actions">
     153      <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>
     154      {if isset($U_REGISTER)}
     155      <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>
     156      {/if}
     157    </ul>
    158158
    159         </fieldset>
    160         </form>
     159  </fieldset>
     160  </form>
    161161    {/if}
    162162
  • trunk/template/yoga/upload.tpl

    r2265 r2325  
    3636    </tr>
    3737    <tr>
    38       <td colspan="2" align="center" style="padding:10px;">
     38      <td colspan="2" align="center">
    3939      <input name="picture" type="file" value="" />
    4040      </td>
    4141    </tr>
    4242    {if isset($SHOW_FORM_FIELDS) and $SHOW_FORM_FIELDS}
    43     <!-- username -->
     43    <!-- category -->
    4444    <tr>
    45       <td class="menu">{'Username'|@translate} <span style="color:red;">*</span></td>
    46       <td align="left" style="padding:10px;">
     45      <td>{'Category'|@translate}</td>
     46      <td>
     47        {html_options name="category" options=$categories selected=$categories_selected}
     48      </td>
     49    </tr>
     50    <!-- username -->
     51    <tr>
     52      <td>{'Username'|@translate} <span style="color:red;">*</span></td>
     53      <td>
    4754      <input name="username" type="text" value="{$NAME}" />
    4855      </td>
    4956    </tr>
    50     <!-- mail address  -->
     57    <!-- mail address -->
    5158    <tr>
    52       <td class="menu">{'mail_address'|@translate} <span style="color:red;">*</span></td>
    53       <td align="left" style="padding:10px;">
     59      <td>{'mail_address'|@translate} <span style="color:red;">*</span></td>
     60      <td>
    5461      <input name="mail_address" type="text" value="{$EMAIL}" />
    5562      </td>
    5663    </tr>
    57     <!-- name of the picture  -->
     64    <!-- name of the picture -->
    5865    <tr>
    59       <td class="menu">{'upload_name'|@translate}</td>
    60       <td align="left" style="padding:10px;">
     66      <td>{'upload_name'|@translate}</td>
     67      <td>
    6168      <input name="name" type="text" value="{$NAME_IMG}" />
    6269      </td>
    6370    </tr>
    64     <!-- author  -->
     71    <!-- author -->
    6572    <tr>
    66       <td class="menu">{'upload_author'|@translate}</td>
    67       <td align="left" style="padding:10px;">
     73      <td>{'upload_author'|@translate}</td>
     74      <td>
    6875      <input name="author" type="text" value="{$AUTHOR_IMG}" />
    6976      </td>
    7077    </tr>
    71     <!-- date of creation  -->
     78    <!-- date of creation -->
    7279    <tr>
    73       <td class="menu">{'Creation date'|@translate} (DD/MM/YYYY)</td>
    74       <td align="left" style="padding:10px;">
     80      <td>{'Creation date'|@translate} (DD/MM/YYYY)</td>
     81      <td>
    7582      <input name="date_creation" type="text" value="{$DATE_IMG}" />
    7683      </td>
    7784    </tr>
    78     <!-- comment  -->
     85    <!-- comment -->
    7986    <tr>
    80       <td class="menu">{'comment'|@translate}</td>
    81       <td align="left" style="padding:10px;">
     87      <td>{'comment'|@translate}</td>
     88      <td>
    8289       <textarea name="comment" rows="3" cols="40" style="overflow:auto">{$COMMENT_IMG}</textarea>
    8390      </td>
  • trunk/upload.php

    r2299 r2325  
    2121// | USA.                                                                  |
    2222// +-----------------------------------------------------------------------+
     23
    2324define('PHPWG_ROOT_PATH','./');
    24 include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
    25 
    26 check_status(ACCESS_GUEST);
    27 
    28 $username = !empty($_POST['username'])?$_POST['username']:$user['username'];
    29 $mail_address = !empty($_POST['mail_address'])?$_POST['mail_address']:@$user['mail_address'];
    30 $name = !empty($_POST['name'])?$_POST['name']:'';
    31 $author = !empty($_POST['author'])?$_POST['author']:'';
    32 $date_creation = !empty($_POST['date_creation'])?$_POST['date_creation']:'';
    33 $comment = !empty($_POST['comment'])?$_POST['comment']:'';
     25
     26// +-----------------------------------------------------------------------+
     27// | Includes                                                              |
     28// +-----------------------------------------------------------------------+
     29include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     30include_once(PHPWG_ROOT_PATH.'include/upload.class.php');
     31
     32// +-----------------------------------------------------------------------+
     33// | Check Access and exit when user status is not ok                      |
     34// +-----------------------------------------------------------------------+
     35check_status($conf['upload_user_access']);
     36
     37// +-----------------------------------------------------------------------+
     38// | Create upload object                                                  |
     39// +-----------------------------------------------------------------------+
     40$upload = new Upload();
     41
     42
     43$username = !empty($_POST['username']) ? $_POST['username']:(is_classic_user() ? $user['username'] : '');
     44$mail_address = !empty($_POST['mail_address']) ? $_POST['mail_address'] : (is_classic_user() ? $user['email'] : '');
     45$name = !empty($_POST['name']) ? $_POST['name'] : '';
     46$author = !empty($_POST['author']) ? $_POST['author'] : (is_classic_user() ? $user['username'] : '');
     47$date_creation = !empty($_POST['date_creation']) ? $_POST['date_creation'] : '';
     48$comment = !empty($_POST['comment']) ? $_POST['comment'] : '';
    3449
    3550//------------------------------------------------------------------- functions
     
    122137
    123138//-------------------------------------------------- access authorization check
     139if (isset($_POST['category']) and is_numeric($_POST['category']))
     140{
     141  $page['category'] = $_POST['category'];
     142}
     143else
    124144if (isset($_GET['cat']) and is_numeric($_GET['cat']))
    125145{
    126146  $page['category'] = $_GET['cat'];
    127147}
    128 
    129 if (isset($page['category']))
    130 {
    131   check_restrictions( $page['category'] );
    132   $category = get_cat_info( $page['category'] );
    133   $category['cat_dir'] = get_complete_dir( $page['category'] );
     148else
     149{
     150  $page['category'] = null;
     151}
     152
     153if (! empty($page['category']))
     154{
     155  check_restrictions($page['category']);
     156  $category = get_cat_info($page['category']);
     157  $category['cat_dir'] = get_complete_dir($page['category']);
    134158
    135159  if (url_is_remote($category['cat_dir']) or !$category['uploadable'])
     
    138162  }
    139163}
    140 else { // $page['category'] may be set by a futur plugin but without it
    141   bad_request('invalid parameters');
     164else
     165{
     166  if (isset($_POST['submit']))
     167  {
     168    // $page['category'] may be set by a futur plugin but without it
     169    bad_request('invalid parameters');
     170  }
     171  else
     172  {
     173    $category = null;
     174  }
    142175}
    143176
     
    148181  $page['waiting_id'] = $_GET['waiting_id'];
    149182}
     183
    150184//-------------------------------------------------------------- picture upload
    151185// verfying fields
     
    297331$template->set_filenames(array('upload'=>'upload.tpl'));
    298332
     333// Load category list
     334$query = '
     335SELECT
     336  id, name, uppercats, global_rank
     337FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
     338  ON id = cat_id and user_id = '.$user['id'].'
     339WHERE
     340  uploadable = \'true\'
     341  '.get_sql_condition_FandF
     342    (
     343      array
     344        (
     345          'visible_categories' => 'id',
     346        ),
     347      'AND'
     348    ).'
     349;';
     350display_select_cat_wrapper($query, array($page['category']), 'categories');
     351
    299352$u_form = PHPWG_ROOT_PATH.'upload.php?cat='.$page['category'];
    300353if ( isset( $page['waiting_id'] ) )
     
    305358if ( isset( $page['waiting_id'] ) )
    306359{
    307   $advise_title=l10n('upload_advise_thumbnail').$_FILES['picture']['name'];
     360  $advise_title = l10n('upload_advise_thumbnail').$_FILES['picture']['name'];
    308361}
    309362else
    310363{
    311   $advise_title = l10n('upload_advise');
    312   $advise_title.= get_cat_display_name($category['upper_names']);
     364  $advise_title = l10n('Choose an image');
    313365}
    314366
  • trunk/ws.php

    r2299 r2325  
    2525
    2626include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
    27 check_status(ACCESS_NONE);
     27check_status(ACCESS_FREE);
    2828include_once(PHPWG_ROOT_PATH.'include/ws_core.inc.php');
    2929
Note: See TracChangeset for help on using the changeset viewer.