aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.inc.php2
-rw-r--r--include/config_default.inc.php10
-rw-r--r--include/constants.php4
-rw-r--r--include/dblayer/functions_pdo-sqlite.inc.php2
-rw-r--r--include/dblayer/functions_sqlite.inc.php2
-rw-r--r--include/functions_mail.inc.php2
-rw-r--r--include/template.class.php27
7 files changed, 26 insertions, 23 deletions
diff --git a/include/common.inc.php b/include/common.inc.php
index 5cc3317e7..093aca08a 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -88,6 +88,8 @@ foreach( array(
include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
@include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
+if (!isset($conf['local_data_dir'])) $conf['local_data_dir'] = realpath(PHPWG_ROOT_PATH.$conf['data_location']); // temp 2.4 for backward compatibility
+
defined('PWG_LOCAL_DIR') or define('PWG_LOCAL_DIR', 'local/');
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index e01f3a7c8..c1329b96f 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -719,9 +719,10 @@ $conf['slideshow_repeat'] = true;
// Every plugin from 1.7 would be design to manage light_slideshow case.
$conf['light_slideshow'] = true;
-// the local data directory is used to store data such as compiled templates
-// or other plugin variables etc
-$conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data';
+// the local data directory is used to store data such as compiled templates,
+// plugin variables, combined css/javascript or resized images. Beware of
+// mandatory trailing slash.
+$conf['data_location'] = '_data/';
// where should the API/UploadForm add photos? This path must be relative to
// the Piwigo installation directory (but can be outside, as long as it's
@@ -756,6 +757,5 @@ $conf['upload_form_automatic_rotation'] = true;
// 0-'auto', 1-'derivative' 2-'script'
$conf['derivative_url_style']=0;
-$conf['chmod_value']=0777;
-
+$conf['chmod_value']= substr_compare(PHP_SAPI, 'apa', 0, 3)==0 ? 0777 : 0755;
?> \ No newline at end of file
diff --git a/include/constants.php b/include/constants.php
index f77bd739e..d116d652c 100644
--- a/include/constants.php
+++ b/include/constants.php
@@ -27,8 +27,8 @@ define('PHPWG_DEFAULT_LANGUAGE', 'en_UK');
define('PHPWG_DEFAULT_TEMPLATE', 'Sylvia');
define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/');
-defined('PWG_COMBINED_DIR') or define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/');
-defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', PWG_LOCAL_DIR.'i/');
+defined('PWG_COMBINED_DIR') or define('PWG_COMBINED_DIR', $conf['data_location'].'combined/');
+defined('PWG_DERIVATIVE_DIR') or define('PWG_DERIVATIVE_DIR', $conf['data_location'].'i/');
// Required versions
define('REQUIRED_PHP_VERSION', '5.0.0');
diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php
index a5b4af600..12348fd5c 100644
--- a/include/dblayer/functions_pdo-sqlite.inc.php
+++ b/include/dblayer/functions_pdo-sqlite.inc.php
@@ -37,7 +37,7 @@ function pwg_db_connect($host, $user, $password, $database)
{
global $conf;
- $db_file = sprintf('sqlite:%s/%s.db', $conf['local_data_dir'], $database);
+ $db_file = sprintf('sqlite:%s/%s.db', PHPWG_ROOT_PATH.$conf['data_location'], $database);
$link = new PDO($db_file);
if (!$link)
diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php
index b260e7ada..c93923a3e 100644
--- a/include/dblayer/functions_sqlite.inc.php
+++ b/include/dblayer/functions_sqlite.inc.php
@@ -37,7 +37,7 @@ function pwg_db_connect($host, $user, $password, $database)
{
global $conf;
- $db_file = sprintf('%s/%s.db', $conf['local_data_dir'], $database);
+ $db_file = sprintf('%s/%s.db', PHPWG_ROOT_PATH.$conf['data_location'], $database);
if (script_basename()=='install')
{
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index 76567ce40..383fab61e 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -791,7 +791,7 @@ function move_ccs_rules_to_body($content)
function pwg_send_mail_test($result, $to, $subject, $content, $headers, $args)
{
global $conf, $user, $lang_info;
- $dir = $conf['local_data_dir'].'/tmp';
+ $dir = PHPWG_ROOT_PATH.$conf['data_location'].'tmp';
if ( mkgetdir( $dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) )
{
$filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['theme'].'-'.date('YmdHis');
diff --git a/include/template.class.php b/include/template.class.php
index 3542d8b58..a7a7d9124 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -59,30 +59,32 @@ class Template {
$this->smarty->compile_check = $conf['template_compile_check'];
$this->smarty->force_compile = $conf['template_force_compile'];
- if (!isset($conf['local_data_dir_checked']))
+ if (!isset($conf['data_dir_checked']))
{
- mkgetdir($conf['local_data_dir'], MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
- if (!is_writable($conf['local_data_dir']))
+ $dir = PHPWG_ROOT_PATH.$conf['data_location'];
+ mkgetdir($dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
+ if (!is_writable($dir))
{
load_language('admin.lang');
fatal_error(
sprintf(
l10n('Give write access (chmod 777) to "%s" directory at the root of your Piwigo installation'),
- basename($conf['local_data_dir'])
+ $conf['data_location']
),
l10n('an error happened'),
false // show trace
);
}
if (function_exists('pwg_query')) {
- conf_update_param('local_data_dir_checked', 'true');
+ conf_update_param('data_dir_checked', 1);
}
}
if (!isset($conf['combined_dir_checked']))
{
- mkgetdir(PWG_COMBINED_DIR, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
- if (!is_writable(PWG_COMBINED_DIR))
+ $dir = PHPWG_ROOT_PATH.PWG_COMBINED_DIR;
+ mkgetdir($dir, MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR);
+ if (!is_writable($dir))
{
load_language('admin.lang');
fatal_error(
@@ -95,12 +97,12 @@ class Template {
);
}
if (function_exists('pwg_query')) {
- conf_update_param('combined_dir_checked', 'true');
+ conf_update_param('combined_dir_checked', 1);
}
}
- $compile_dir = $conf['local_data_dir'].'/templates_c';
+ $compile_dir = PHPWG_ROOT_PATH.$conf['data_location'].'templates_c';
mkgetdir( $compile_dir );
$this->smarty->compile_dir = $compile_dir;
@@ -1181,7 +1183,6 @@ class ScriptLoader
/*Allows merging of javascript and css files into a single one.*/
final class FileCombiner
{
- const OUT_SUB_DIR = PWG_COMBINED_DIR;
private $type; // js or css
private $files = array();
private $versions = array();
@@ -1193,11 +1194,11 @@ final class FileCombiner
static function clear_combined_files()
{
- $dir = opendir(PHPWG_ROOT_PATH.self::OUT_SUB_DIR);
+ $dir = opendir(PHPWG_ROOT_PATH.PWG_COMBINED_DIR);
while ($file = readdir($dir))
{
if ( get_extension($file)=='js' || get_extension($file)=='css')
- unlink(PHPWG_ROOT_PATH.self::OUT_SUB_DIR.$file);
+ unlink(PHPWG_ROOT_PATH.PWG_COMBINED_DIR.$file);
}
closedir($dir);
}
@@ -1242,7 +1243,7 @@ final class FileCombiner
$key = join('>', $key);
$file = base_convert(crc32($key),10,36);
- $file = self::OUT_SUB_DIR . $file . '.' . $this->type;
+ $file = PWG_COMBINED_DIR . $file . '.' . $this->type;
$exists = file_exists( PHPWG_ROOT_PATH . $file );
if ($exists)