Ignore:
Timestamp:
01/29/10 00:28:14 (10 years ago)
Author:
plg
Message:

feature 1405 added: explicit errors when the "upload" directory is missing or
not writable.

Location:
extensions/upload_form
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/upload_form/language/en_UK/plugin.lang.php

    r4740 r4789  
    2525$lang['+ Add an upload box'] = '+ Add an upload box'; 
    2626$lang['Upload'] = 'Upload'; 
     27$lang['Create the "%s" directory at the root of your Piwigo installation'] = 'Create the "%s" directory at the root of your Piwigo installation'; 
     28$lang['Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'] = 'Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'; 
    2729?> 
  • extensions/upload_form/language/fr_FR/plugin.lang.php

    r4740 r4789  
    2525$lang['+ Add an upload box'] = '+ Ajouter une autre boîte de transfert'; 
    2626$lang['Upload'] = 'Transférer'; 
     27$lang['Create the "%s" directory at the root of your Piwigo installation'] = 'Créez le répertoire "%s" à la racine de votre installation Piwigo'; 
     28$lang['Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'] = 'Donnez les droits en écriture (chmod 777) sur le répertoire "%s" à la racine de votre installation Piwigo'; 
    2729?> 
  • extensions/upload_form/upload.php

    r4783 r4789  
    9090 
    9191// +-----------------------------------------------------------------------+ 
     92// |                             setup errors                              | 
     93// +-----------------------------------------------------------------------+ 
     94 
     95$setup_errors = array(); 
     96 
     97$upload_base_dir = 'upload'; 
     98$upload_dir = PHPWG_ROOT_PATH.$upload_base_dir; 
     99 
     100if (!is_dir($upload_dir)) 
     101{ 
     102  if (!is_writable(PHPWG_ROOT_PATH)) 
     103  { 
     104    array_push( 
     105      $setup_errors, 
     106      sprintf( 
     107        l10n('Create the "%s" directory at the root of your Piwigo installation'), 
     108        $upload_base_dir 
     109        ) 
     110      ); 
     111  } 
     112} 
     113else 
     114{ 
     115  if (!is_writable($upload_dir)) 
     116  { 
     117    @chmod($upload_dir, 0777); 
     118 
     119    if (!is_writable($upload_dir)) 
     120    { 
     121      array_push( 
     122        $setup_errors, 
     123        sprintf( 
     124          l10n('Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'), 
     125          $upload_base_dir 
     126          ) 
     127        ); 
     128    } 
     129  } 
     130} 
     131 
     132$template->assign( 
     133    array( 
     134      'setup_errors'=> $setup_errors, 
     135    ) 
     136  ); 
     137 
     138// +-----------------------------------------------------------------------+ 
    92139// |                           sending html code                           | 
    93140// +-----------------------------------------------------------------------+ 
  • extensions/upload_form/upload.tpl

    r4740 r4789  
    1515</div> 
    1616 
     17{if count($setup_errors) > 0} 
     18<div class="errors"> 
     19  <ul> 
     20  {foreach from=$setup_errors item=error} 
     21    <li>{$error}</li> 
     22  {/foreach} 
     23  </ul> 
     24</div> 
     25{else} 
    1726<form enctype="multipart/form-data" method="post" action="{$F_ACTION}" class="properties"> 
    1827  <fieldset> 
     
    4857  </fieldset> 
    4958</form> 
     59{/if} 
Note: See TracChangeset for help on using the changeset viewer.