Ignore:
Timestamp:
Jan 29, 2010, 12:28:14 AM (14 years ago)
Author:
plg
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.