Move some cPanel code to /usr/local/cpanel/base/3rdparty/snappymail/include.php #697

This commit is contained in:
the-djmaze 2022-11-25 11:00:20 +01:00
parent ce7bcbcaf5
commit 21c0c1ed5d
5 changed files with 41 additions and 11 deletions

View file

@ -21,9 +21,8 @@ foreach ($files as $file) {
}
$cpanel_tar->addFile('.htaccess', "{$cpanel_path}.htaccess");
//$cpanel_tar->addFile('_include.php', 'snappymail/app/_include.php');
$cpanel_tar->addFile('README.md', "{$cpanel_path}README.md");
$cpanel_tar->addFromString('VERSION', $package->version);
$cpanel_tar->addFromString("{$cpanel_path}VERSION", $package->version);
$index = file_get_contents('index.php');
$index = str_replace('0.0.0', $package->version, $index);

View file

@ -0,0 +1,37 @@
<?php
//header('Strict-Transport-Security: max-age=31536000');
/**
* Uncomment to use gzip compressed output
*/
//define('USE_GZIP', 1);
/**
* Uncomment to use brotli compressed output
*/
//define('USE_BROTLI', 1);
/**
* Uncomment to enable multiple domain installation.
*/
//define('MULTIDOMAIN', 1);
/**
* Uncomment to disable APCU.
*/
//define('APP_USE_APCU_CACHE', false);
/**
* Custom 'data' folder path
*/
if (!empty($_ENV['CPANEL']) && isset($_ENV['HOME'])) {
define('APP_DATA_FOLDER_PATH', $_ENV['HOME'] . '/var/snappymail/');
} else {
exit('Not in cPanel');
}
/**
* Additional configuration file name
*/
//define('APP_CONFIGURATION_NAME', $_SERVER['HTTP_HOST'].'.ini');

View file

@ -6,7 +6,7 @@ class LoginRemotePlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Login Remote',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.1',
VERSION = '1.2',
RELEASE = '2022-11-24',
REQUIRED = '2.21.0',
CATEGORY = 'Login',

View file

@ -14,7 +14,7 @@ if (defined('APP_PLUGINS_PATH') && !empty($_ENV['CPANEL']) && !is_dir(APP_PLUGIN
$oConfig->Set('plugins', 'enabled_list', \implode(',', \array_unique($aList)));
$oConfig->Set('login', 'default_domain', 'cpanel');
$oConfig->Set('logs', 'path', $_ENV['HOME'] . '/logs/snappymail');
$oConfig->Set('cache', 'path', $_ENV['HOME'] . '/tmp/snappymail');
$oConfig->Set('cache', 'path', $_ENV['TMPDIR'] . '/snappymail');
$oConfig->Save();
$sFile = APP_PRIVATE_DATA.'domains/cpanel.json';

View file

@ -70,13 +70,7 @@ define('APP_PRIVATE_DATA_NAME', $sPrivateDataFolderInternalName ?: '_default_');
unset($sPrivateDataFolderInternalName);
if (!defined('APP_DATA_FOLDER_PATH')) {
// cPanel https://github.com/the-djmaze/snappymail/issues/697
if (!empty($_ENV['CPANEL']) && isset($_ENV['HOME'])) {
$sCustomDataPath = $_ENV['HOME'] . '/var/snappymail';
// $sCustomDataPath = $_ENV['TMPDIR'] . '/snappymail';
} else {
$sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : $sCustomDataPath;
}
$sCustomDataPath = rtrim(trim(function_exists('__get_custom_data_full_path') ? __get_custom_data_full_path() : $sCustomDataPath), '\\/');
define('APP_DATA_FOLDER_PATH', strlen($sCustomDataPath) ? $sCustomDataPath.'/' : APP_INDEX_ROOT_PATH.'data/');
}
unset($sCustomDataPath);