mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Remove trailing whitespace in admin module
This commit is contained in:
parent
a9f72a5cd2
commit
1dca4adf42
21 changed files with 230 additions and 230 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preserved for backward compatibility
|
* Preserved for backward compatibility
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
class AdminAdminController extends Admin
|
class AdminAdminController extends Admin
|
||||||
|
|
@ -20,7 +20,7 @@ class AdminAdminController extends Admin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an icon.
|
* Remove an icon.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function procAdminRemoveIcons()
|
public function procAdminRemoveIcons()
|
||||||
|
|
@ -39,7 +39,7 @@ class AdminAdminController extends Admin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the admin logo.
|
* Delete the admin logo.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function procAdminDeleteLogo()
|
public function procAdminDeleteLogo()
|
||||||
|
|
@ -82,7 +82,7 @@ class AdminAdminController extends Admin
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
|
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function procAdminRemoveFTPInfo()
|
public function procAdminRemoveFTPInfo()
|
||||||
{
|
{
|
||||||
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
|
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preserved for backward compatibility
|
* Preserved for backward compatibility
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
class AdminAdminModel extends Admin
|
class AdminAdminModel extends Admin
|
||||||
|
|
@ -200,6 +200,6 @@ class AdminAdminModel extends Admin
|
||||||
|
|
||||||
public static function getThemeInfo($theme_name, $layout_list = [])
|
public static function getThemeInfo($theme_name, $layout_list = [])
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,24 +2,24 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preserved for backward compatibility
|
* Preserved for backward compatibility
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
class AdminAdminView extends Admin
|
class AdminAdminView extends Admin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Make the admin menu.
|
* Make the admin menu.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function makeGnbUrl($module = 'admin')
|
public function makeGnbUrl($module = 'admin')
|
||||||
{
|
{
|
||||||
Rhymix\Modules\Admin\Controllers\Base::getInstance()->loadAdminMenu($module);
|
Rhymix\Modules\Admin\Controllers\Base::getInstance()->loadAdminMenu($module);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display FTP Configuration(settings) page
|
* Display FTP Configuration(settings) page
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function dispAdminConfigFtp()
|
public function dispAdminConfigFtp()
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class AdminMenu extends Base
|
||||||
|
|
||||||
Context::set('menu_srl', $output->menu_srl);
|
Context::set('menu_srl', $output->menu_srl);
|
||||||
Context::set('menu_title', $output->title);
|
Context::set('menu_title', $output->title);
|
||||||
|
|
||||||
$this->setTemplateFile('admin_setup');
|
$this->setTemplateFile('admin_setup');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class Base extends \ModuleObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Initilization
|
* Initilization
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
|
|
@ -39,16 +39,16 @@ class Base extends \ModuleObject
|
||||||
// Load the admin menu.
|
// Load the admin menu.
|
||||||
$this->loadAdminMenu();
|
$this->loadAdminMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check system configuration.
|
* check system configuration.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function checkSystemConfiguration()
|
public function checkSystemConfiguration()
|
||||||
{
|
{
|
||||||
$changed = false;
|
$changed = false;
|
||||||
|
|
||||||
// Check encryption keys.
|
// Check encryption keys.
|
||||||
if (config('crypto.encryption_key') === null)
|
if (config('crypto.encryption_key') === null)
|
||||||
{
|
{
|
||||||
|
|
@ -70,17 +70,17 @@ class Base extends \ModuleObject
|
||||||
config('file.folder_structure', 1);
|
config('file.folder_structure', 1);
|
||||||
$changed = true;
|
$changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save new configuration.
|
// Save new configuration.
|
||||||
if ($changed)
|
if ($changed)
|
||||||
{
|
{
|
||||||
Config::save();
|
Config::save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the admin menu.
|
* Load the admin menu.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function loadAdminMenu($module = 'admin')
|
public function loadAdminMenu($module = 'admin')
|
||||||
|
|
@ -113,7 +113,7 @@ class Base extends \ModuleObject
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get current menu's srl(=parentSrl)
|
// get current menu's srl(=parentSrl)
|
||||||
$parentSrl = 0;
|
$parentSrl = 0;
|
||||||
foreach ((array)$menu->list as $parentKey => $parentMenu)
|
foreach ((array)$menu->list as $parentKey => $parentMenu)
|
||||||
|
|
@ -140,27 +140,27 @@ class Base extends \ModuleObject
|
||||||
// Get list of favorite
|
// Get list of favorite
|
||||||
$output = FavoriteModel::getFavorites(true);
|
$output = FavoriteModel::getFavorites(true);
|
||||||
Context::set('favorite_list', $output->get('favoriteList'));
|
Context::set('favorite_list', $output->get('favoriteList'));
|
||||||
|
|
||||||
Context::set('subMenuTitle', $subMenuTitle);
|
Context::set('subMenuTitle', $subMenuTitle);
|
||||||
Context::set('gnbUrlList', $menu->list);
|
Context::set('gnbUrlList', $menu->list);
|
||||||
Context::set('parentSrl', $parentSrl);
|
Context::set('parentSrl', $parentSrl);
|
||||||
Context::set('gnb_title_info', $gnbTitleInfo ?? null);
|
Context::set('gnb_title_info', $gnbTitleInfo ?? null);
|
||||||
Context::addBrowserTitle($subMenuTitle ? $subMenuTitle : 'Dashboard');
|
Context::addBrowserTitle($subMenuTitle ? $subMenuTitle : 'Dashboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for backward compatibility.
|
* Alias for backward compatibility.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public static function getAdminMenuName()
|
public static function getAdminMenuName()
|
||||||
{
|
{
|
||||||
return AdminMenuModel::getAdminMenuName();
|
return AdminMenuModel::getAdminMenuName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias for backward compatibility.
|
* Alias for backward compatibility.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public static function getAdminMenuLang()
|
public static function getAdminMenuLang()
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ class Dashboard extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the list of installed modules
|
// Retrieve the list of installed modules
|
||||||
$this->checkEasyInstall();
|
$this->checkEasyInstall();
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ class Dashboard extends Base
|
||||||
//$oAutoinstallAdminModel = getAdminModel('autoinstall');
|
//$oAutoinstallAdminModel = getAdminModel('autoinstall');
|
||||||
//$needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList();
|
//$needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList();
|
||||||
$needUpdateList = array();
|
$needUpdateList = array();
|
||||||
|
|
||||||
// Check counter addon
|
// Check counter addon
|
||||||
$oAddonAdminModel = AddonAdminModel::getInstance();
|
$oAddonAdminModel = AddonAdminModel::getInstance();
|
||||||
$counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter');
|
$counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter');
|
||||||
|
|
@ -131,7 +131,7 @@ class Dashboard extends Base
|
||||||
Context::set('latestMemberList', $output->data);
|
Context::set('latestMemberList', $output->data);
|
||||||
unset($args, $output, $columnList);
|
unset($args, $output, $columnList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check unnecessary files
|
// Check unnecessary files
|
||||||
$cleanup_list = Maintenance\Cleanup::getInstance()->checkFiles();
|
$cleanup_list = Maintenance\Cleanup::getInstance()->checkFiles();
|
||||||
|
|
||||||
|
|
@ -159,10 +159,10 @@ class Dashboard extends Base
|
||||||
MemberController::getInstance()->procMemberLogout();
|
MemberController::getInstance()->procMemberLogout();
|
||||||
header('Location: ' . getNotEncodedUrl(''));
|
header('Location: ' . getNotEncodedUrl(''));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check easy install.
|
* Check easy install.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function checkEasyInstall()
|
public function checkEasyInstall()
|
||||||
|
|
@ -202,7 +202,7 @@ class Dashboard extends Base
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the easy install flag file.
|
* Update the easy install flag file.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _updateEasyInstallFlagFile()
|
protected function _updateEasyInstallFlagFile()
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,14 @@ class Design extends Base
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subroutine for the above.
|
* Subroutine for the above.
|
||||||
*
|
*
|
||||||
* @param object $vars
|
* @param object $vars
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function updateDefaultDesignInfo(object $vars): void
|
public function updateDefaultDesignInfo(object $vars): void
|
||||||
{
|
{
|
||||||
$vars->module_skin = json_decode($vars->module_skin);
|
$vars->module_skin = json_decode($vars->module_skin);
|
||||||
|
|
||||||
$siteDesignPath = \RX_BASEDIR . 'files/site_design/';
|
$siteDesignPath = \RX_BASEDIR . 'files/site_design/';
|
||||||
if (!is_dir($siteDesignPath))
|
if (!is_dir($siteDesignPath))
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +77,7 @@ class Design extends Base
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subroutine for the above;
|
* Subroutine for the above;
|
||||||
*
|
*
|
||||||
* @param object $designInfo
|
* @param object $designInfo
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,17 @@ class Install extends Base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Install module
|
* Install module
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function moduleInstall()
|
public function moduleInstall()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if update is necessary
|
* Check if update is necessary
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkUpdate()
|
public function checkUpdate()
|
||||||
|
|
@ -35,7 +35,7 @@ class Install extends Base
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update module
|
* Update module
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function moduleUpdate()
|
public function moduleUpdate()
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class ServerEnv extends Base
|
||||||
'widget' => array('content', 'counter_status', 'language_select', 'login_info', 'mcontent', 'pollWidget'),
|
'widget' => array('content', 'counter_status', 'language_select', 'login_info', 'mcontent', 'pollWidget'),
|
||||||
'widgetstyle' => array('simple'),
|
'widgetstyle' => array('simple'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Basic environment
|
// Basic environment
|
||||||
$info[] = '[Basic Information]';
|
$info[] = '[Basic Information]';
|
||||||
$info['rhymix_version'] = RX_VERSION;
|
$info['rhymix_version'] = RX_VERSION;
|
||||||
|
|
@ -48,7 +48,7 @@ class ServerEnv extends Base
|
||||||
}
|
}
|
||||||
$info['ssl'] = Context::get('site_module_info')->security ?: Context::getDbInfo()->use_ssl;
|
$info['ssl'] = Context::get('site_module_info')->security ?: Context::getDbInfo()->use_ssl;
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
|
|
||||||
// System settings
|
// System settings
|
||||||
$info[] = '[System Settings]';
|
$info[] = '[System Settings]';
|
||||||
$info['db.type'] = preg_replace('/^mysql.+/', 'mysql', config('db.master.type'));
|
$info['db.type'] = preg_replace('/^mysql.+/', 'mysql', config('db.master.type'));
|
||||||
|
|
@ -82,7 +82,7 @@ class ServerEnv extends Base
|
||||||
$info['view.minify_scripts'] = config('view.minify_scripts');
|
$info['view.minify_scripts'] = config('view.minify_scripts');
|
||||||
$info['use_sso'] = config('use_sso') ? 'true' : 'false';
|
$info['use_sso'] = config('use_sso') ? 'true' : 'false';
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
|
|
||||||
// PHP settings
|
// PHP settings
|
||||||
$ini_info = ini_get_all();
|
$ini_info = ini_get_all();
|
||||||
$info[] = '[PHP Settings]';
|
$info[] = '[PHP Settings]';
|
||||||
|
|
@ -104,7 +104,7 @@ class ServerEnv extends Base
|
||||||
}
|
}
|
||||||
natcasesort($info['extensions']);
|
natcasesort($info['extensions']);
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
$info[] = '[Modules]';
|
$info[] = '[Modules]';
|
||||||
$info['module'] = array();
|
$info['module'] = array();
|
||||||
|
|
@ -126,7 +126,7 @@ class ServerEnv extends Base
|
||||||
}
|
}
|
||||||
natcasesort($info['module']);
|
natcasesort($info['module']);
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
|
|
||||||
// Addons
|
// Addons
|
||||||
$info[] = '[Addons]';
|
$info[] = '[Addons]';
|
||||||
$info['addon'] = array();
|
$info['addon'] = array();
|
||||||
|
|
@ -149,7 +149,7 @@ class ServerEnv extends Base
|
||||||
}
|
}
|
||||||
natcasesort($info['addon']);
|
natcasesort($info['addon']);
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
|
|
||||||
// Layouts
|
// Layouts
|
||||||
$info[] = '[Layouts]';
|
$info[] = '[Layouts]';
|
||||||
$info['layout'] = array();
|
$info['layout'] = array();
|
||||||
|
|
@ -172,7 +172,7 @@ class ServerEnv extends Base
|
||||||
}
|
}
|
||||||
natcasesort($info['layout']);
|
natcasesort($info['layout']);
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
|
|
||||||
// Widgets
|
// Widgets
|
||||||
$info[] = '[Widgets]';
|
$info[] = '[Widgets]';
|
||||||
$info['widget'] = array();
|
$info['widget'] = array();
|
||||||
|
|
@ -195,7 +195,7 @@ class ServerEnv extends Base
|
||||||
}
|
}
|
||||||
natcasesort($info['widget']);
|
natcasesort($info['widget']);
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
|
|
||||||
// Widgetstyles
|
// Widgetstyles
|
||||||
$info[] = '[Widgetstyles]';
|
$info[] = '[Widgetstyles]';
|
||||||
$info['widgetstyle'] = array();
|
$info['widgetstyle'] = array();
|
||||||
|
|
@ -219,7 +219,7 @@ class ServerEnv extends Base
|
||||||
natcasesort($info['widgetstyle']);
|
natcasesort($info['widgetstyle']);
|
||||||
$info[] = '';
|
$info[] = '';
|
||||||
$str_info = '';
|
$str_info = '';
|
||||||
|
|
||||||
// Convert to string.
|
// Convert to string.
|
||||||
foreach ($info as $key => $value)
|
foreach ($info as $key => $value)
|
||||||
{
|
{
|
||||||
|
|
@ -227,7 +227,7 @@ class ServerEnv extends Base
|
||||||
{
|
{
|
||||||
$value = implode(', ', $value) ?: "no additional {$key}s";
|
$value = implode(', ', $value) ?: "no additional {$key}s";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_int($key) || ctype_digit($key))
|
if (is_int($key) || ctype_digit($key))
|
||||||
{
|
{
|
||||||
$str_info .= "$value\n";
|
$str_info .= "$value\n";
|
||||||
|
|
@ -241,7 +241,7 @@ class ServerEnv extends Base
|
||||||
Context::set('str_info', $str_info);
|
Context::set('str_info', $str_info);
|
||||||
$this->setTemplateFile('server_env.html');
|
$this->setTemplateFile('server_env.html');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to test if URL rewriting is properly configured in the web server.
|
* Method to test if URL rewriting is properly configured in the web server.
|
||||||
*/
|
*/
|
||||||
|
|
@ -251,7 +251,7 @@ class ServerEnv extends Base
|
||||||
Context::setResponseMethod('JSON');
|
Context::setResponseMethod('JSON');
|
||||||
$this->add('result', $test * 42);
|
$this->add('result', $test * 42);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear APCU cache.
|
* Clear APCU cache.
|
||||||
*/
|
*/
|
||||||
|
|
@ -266,7 +266,7 @@ class ServerEnv extends Base
|
||||||
return new BaseObject(-1, 'apcu_clear_cache_function_not_found');
|
return new BaseObject(-1, 'apcu_clear_cache_function_not_found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear opcache.
|
* Clear opcache.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ class CacheReset extends Base
|
||||||
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
|
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
|
||||||
$tmp_cache_prefix = \RX_BASEDIR . 'files/';
|
$tmp_cache_prefix = \RX_BASEDIR . 'files/';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($tmp_cache_list)
|
if($tmp_cache_list)
|
||||||
{
|
{
|
||||||
foreach($tmp_cache_list as $tmp_dir)
|
foreach($tmp_cache_list as $tmp_dir)
|
||||||
|
|
@ -91,7 +91,7 @@ class CacheReset extends Base
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If possible, use system command to speed up recursive deletion
|
// If possible, use system command to speed up recursive deletion
|
||||||
if (function_exists('exec') && !preg_match('/(?<!_)exec/', ini_get('disable_functions')))
|
if (function_exists('exec') && !preg_match('/(?<!_)exec/', ini_get('disable_functions')))
|
||||||
{
|
{
|
||||||
|
|
@ -104,7 +104,7 @@ class CacheReset extends Base
|
||||||
@exec('rm -rf ' . escapeshellarg($tmp_dir));
|
@exec('rm -rf ' . escapeshellarg($tmp_dir));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the directory still exists, delete using PHP.
|
// If the directory still exists, delete using PHP.
|
||||||
Storage::deleteDirectory($tmp_dir);
|
Storage::deleteDirectory($tmp_dir);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@ class Cleanup extends Base
|
||||||
// Get the list of files to clean up.
|
// Get the list of files to clean up.
|
||||||
$cleanup_list = $this->checkFiles();
|
$cleanup_list = $this->checkFiles();
|
||||||
Context::set('cleanup_list', $cleanup_list);
|
Context::set('cleanup_list', $cleanup_list);
|
||||||
|
|
||||||
// Check previous errors.
|
// Check previous errors.
|
||||||
Context::set('cleanup_errors', $_SESSION['admin_cleanup_errors'] ?? []);
|
Context::set('cleanup_errors', $_SESSION['admin_cleanup_errors'] ?? []);
|
||||||
unset($_SESSION['admin_cleanup_errors']);
|
unset($_SESSION['admin_cleanup_errors']);
|
||||||
|
|
||||||
// Set the template file.
|
// Set the template file.
|
||||||
$this->setTemplateFile('cleanup');
|
$this->setTemplateFile('cleanup');
|
||||||
}
|
}
|
||||||
|
|
@ -39,7 +39,7 @@ class Cleanup extends Base
|
||||||
{
|
{
|
||||||
$this->setMessage('success_deleted');
|
$this->setMessage('success_deleted');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there were errors, set information in session.
|
// If there were errors, set information in session.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -47,14 +47,14 @@ class Cleanup extends Base
|
||||||
$this->setMessage('msg_cleanup_manually');
|
$this->setMessage('msg_cleanup_manually');
|
||||||
$_SESSION['admin_cleanup_errors'] = $result;
|
$_SESSION['admin_cleanup_errors'] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to the list screen.
|
// Redirect to the list screen.
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminCleanupList'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminCleanupList'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for files to clean up.
|
* Check for files to clean up.
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function checkFiles(): array
|
public function checkFiles(): array
|
||||||
|
|
@ -71,7 +71,7 @@ class Cleanup extends Base
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for case difference and moved target.
|
// Check for case difference and moved target.
|
||||||
if ($reason === 'case')
|
if ($reason === 'case')
|
||||||
{
|
{
|
||||||
|
|
@ -92,17 +92,17 @@ class Cleanup extends Base
|
||||||
$result[$name] = $reason;
|
$result[$name] = $reason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ksort($result);
|
ksort($result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the filesystem is case-sensitive.
|
* Check if the filesystem is case-sensitive.
|
||||||
*
|
*
|
||||||
* This method generally returns true on Linux, and false on Windows and Mac OS,
|
* This method generally returns true on Linux, and false on Windows and Mac OS,
|
||||||
* but the result may differ if tested on an unusual filesystem.
|
* but the result may differ if tested on an unusual filesystem.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function checkCaseSensitiveFilesystem(): bool
|
public function checkCaseSensitiveFilesystem(): bool
|
||||||
|
|
@ -113,7 +113,7 @@ class Cleanup extends Base
|
||||||
{
|
{
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return default values for most common operating systems.
|
// Return default values for most common operating systems.
|
||||||
if (preg_match('/Linux/', \PHP_OS))
|
if (preg_match('/Linux/', \PHP_OS))
|
||||||
{
|
{
|
||||||
|
|
@ -123,29 +123,29 @@ class Cleanup extends Base
|
||||||
{
|
{
|
||||||
return $cache = false;
|
return $cache = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create two files that differ only in case, and check if they overwrite each other.
|
// Create two files that differ only in case, and check if they overwrite each other.
|
||||||
$file1 = \RX_BASEDIR . 'files/cache/caseTest.php';
|
$file1 = \RX_BASEDIR . 'files/cache/caseTest.php';
|
||||||
$file2 = \RX_BASEDIR . 'files/cache/caseTEST.php';
|
$file2 = \RX_BASEDIR . 'files/cache/caseTEST.php';
|
||||||
Storage::write($file1, '#1:' . Security::getRandom(36) . \PHP_EOL);
|
Storage::write($file1, '#1:' . Security::getRandom(36) . \PHP_EOL);
|
||||||
Storage::write($file2, '#2:' . Security::getRandom(36) . \PHP_EOL);
|
Storage::write($file2, '#2:' . Security::getRandom(36) . \PHP_EOL);
|
||||||
$cache = (Storage::read($file1) !== Storage::read($file2));
|
$cache = (Storage::read($file1) !== Storage::read($file2));
|
||||||
|
|
||||||
// Clean up test files and return the result.
|
// Clean up test files and return the result.
|
||||||
Storage::delete($file1);
|
Storage::delete($file1);
|
||||||
Storage::delete($file2);
|
Storage::delete($file2);
|
||||||
return $cache;
|
return $cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete files.
|
* Delete files.
|
||||||
*
|
*
|
||||||
* If a name is given, only that file or directory will be deleted.
|
* If a name is given, only that file or directory will be deleted.
|
||||||
* Otherwise, all files in the cleanup list will be deleted.
|
* Otherwise, all files in the cleanup list will be deleted.
|
||||||
*
|
*
|
||||||
* This method returns the list of files that could not be deleted,
|
* This method returns the list of files that could not be deleted,
|
||||||
* with reasons for each file.
|
* with reasons for each file.
|
||||||
*
|
*
|
||||||
* @param ?string $name
|
* @param ?string $name
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|
@ -168,12 +168,12 @@ class Cleanup extends Base
|
||||||
{
|
{
|
||||||
$list = $this->checkFiles();
|
$list = $this->checkFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!count($list))
|
if (!count($list))
|
||||||
{
|
{
|
||||||
throw new TargetNotFound('msg_cleanup_list_empty');
|
throw new TargetNotFound('msg_cleanup_list_empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete each file or directory.
|
// Delete each file or directory.
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($list as $name => $reason)
|
foreach ($list as $name => $reason)
|
||||||
|
|
@ -187,7 +187,7 @@ class Cleanup extends Base
|
||||||
{
|
{
|
||||||
$success = Storage::delete($normalized_path);
|
$success = Storage::delete($normalized_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$success && Storage::exists($normalized_path))
|
if (!$success && Storage::exists($normalized_path))
|
||||||
{
|
{
|
||||||
if (!Storage::isWritable($normalized_path) || !Storage::isWritable(dirname($normalized_path)))
|
if (!Storage::isWritable($normalized_path) || !Storage::isWritable(dirname($normalized_path)))
|
||||||
|
|
@ -204,15 +204,15 @@ class Cleanup extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of files and directories to clean up.
|
* List of files and directories to clean up.
|
||||||
*/
|
*/
|
||||||
public const CLEANUP_LIST = [
|
public const CLEANUP_LIST = [
|
||||||
|
|
||||||
// Unnecessary files in the root directory
|
// Unnecessary files in the root directory
|
||||||
'composer.json' => 'moved:common/composer.json',
|
'composer.json' => 'moved:common/composer.json',
|
||||||
'composer.lock' => 'moved:common/composer.lock',
|
'composer.lock' => 'moved:common/composer.lock',
|
||||||
|
|
@ -278,7 +278,7 @@ class Cleanup extends Base
|
||||||
'modules/spamfilter/ruleset/' => 'deleted',
|
'modules/spamfilter/ruleset/' => 'deleted',
|
||||||
'phpDoc/' => 'deleted:xe',
|
'phpDoc/' => 'deleted:xe',
|
||||||
'tools/' => 'deleted:xe',
|
'tools/' => 'deleted:xe',
|
||||||
|
|
||||||
// Deleted lang.xml
|
// Deleted lang.xml
|
||||||
'common/lang/lang.xml' => 'deleted:xmllang',
|
'common/lang/lang.xml' => 'deleted:xmllang',
|
||||||
'layouts/xedition/lang/lang.xml' => 'deleted:xmllang',
|
'layouts/xedition/lang/lang.xml' => 'deleted:xmllang',
|
||||||
|
|
@ -388,7 +388,7 @@ class Cleanup extends Base
|
||||||
'common/framework/parsers/dbtable/index.php' => 'case',
|
'common/framework/parsers/dbtable/index.php' => 'case',
|
||||||
'common/framework/parsers/dbtable/table.php' => 'case',
|
'common/framework/parsers/dbtable/table.php' => 'case',
|
||||||
'modules/member/controllers/device.php' => 'case',
|
'modules/member/controllers/device.php' => 'case',
|
||||||
|
|
||||||
// Vendor directory
|
// Vendor directory
|
||||||
'vendor/' => 'moved:common/vendor/',
|
'vendor/' => 'moved:common/vendor/',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@ class Advanced extends Base
|
||||||
$cache_default_ttl = 86400;
|
$cache_default_ttl = 86400;
|
||||||
$cache_servers = Config::get('cache');
|
$cache_servers = Config::get('cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('object_cache_types', $object_cache_types);
|
Context::set('object_cache_types', $object_cache_types);
|
||||||
Context::set('object_cache_type', $object_cache_type);
|
Context::set('object_cache_type', $object_cache_type);
|
||||||
Context::set('cache_default_ttl', $cache_default_ttl);
|
Context::set('cache_default_ttl', $cache_default_ttl);
|
||||||
|
|
||||||
if ($cache_servers)
|
if ($cache_servers)
|
||||||
{
|
{
|
||||||
if (preg_match('!^(/.+)(#[0-9]+)?$!', array_first($cache_servers), $matches))
|
if (preg_match('!^(/.+)(#[0-9]+)?$!', array_first($cache_servers), $matches))
|
||||||
|
|
@ -71,7 +71,7 @@ class Advanced extends Base
|
||||||
Context::set('object_cache_dbnum', 1);
|
Context::set('object_cache_dbnum', 1);
|
||||||
}
|
}
|
||||||
Context::set('cache_truncate_method', Config::get('cache.truncate_method'));
|
Context::set('cache_truncate_method', Config::get('cache.truncate_method'));
|
||||||
|
|
||||||
// Thumbnail settings
|
// Thumbnail settings
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$config = $oDocumentModel->getDocumentConfig();
|
$config = $oDocumentModel->getDocumentConfig();
|
||||||
|
|
@ -83,17 +83,17 @@ class Advanced extends Base
|
||||||
Context::set('thumbnail_target', 'none');
|
Context::set('thumbnail_target', 'none');
|
||||||
Context::set('thumbnail_type', 'fill');
|
Context::set('thumbnail_type', 'fill');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default and enabled languages
|
// Default and enabled languages
|
||||||
Context::set('supported_lang', Lang::getSupportedList());
|
Context::set('supported_lang', Lang::getSupportedList());
|
||||||
Context::set('default_lang', Config::get('locale.default_lang'));
|
Context::set('default_lang', Config::get('locale.default_lang'));
|
||||||
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
||||||
Context::set('auto_select_lang', Config::get('locale.auto_select_lang'));
|
Context::set('auto_select_lang', Config::get('locale.auto_select_lang'));
|
||||||
|
|
||||||
// Default time zone
|
// Default time zone
|
||||||
Context::set('timezones', DateTime::getTimezoneList());
|
Context::set('timezones', DateTime::getTimezoneList());
|
||||||
Context::set('selected_timezone', Config::get('locale.default_timezone'));
|
Context::set('selected_timezone', Config::get('locale.default_timezone'));
|
||||||
|
|
||||||
// Other settings
|
// Other settings
|
||||||
Context::set('use_rewrite', Router::getRewriteLevel());
|
Context::set('use_rewrite', Router::getRewriteLevel());
|
||||||
Context::set('use_mobile_view', (config('mobile.enabled') !== null ? config('mobile.enabled') : config('use_mobile_view')) ? true : false);
|
Context::set('use_mobile_view', (config('mobile.enabled') !== null ? config('mobile.enabled') : config('use_mobile_view')) ? true : false);
|
||||||
|
|
@ -108,17 +108,17 @@ class Advanced extends Base
|
||||||
Context::set('jquery_version', Config::get('view.jquery_version'));
|
Context::set('jquery_version', Config::get('view.jquery_version'));
|
||||||
Context::set('use_server_push', Config::get('view.server_push'));
|
Context::set('use_server_push', Config::get('view.server_push'));
|
||||||
Context::set('use_gzip', Config::get('view.use_gzip'));
|
Context::set('use_gzip', Config::get('view.use_gzip'));
|
||||||
|
|
||||||
$this->setTemplateFile('config_advanced');
|
$this->setTemplateFile('config_advanced');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update advanced configuration.
|
* Update advanced configuration.
|
||||||
*/
|
*/
|
||||||
public function procAdminUpdateAdvanced()
|
public function procAdminUpdateAdvanced()
|
||||||
{
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
||||||
// Object cache
|
// Object cache
|
||||||
if ($vars->object_cache_type)
|
if ($vars->object_cache_type)
|
||||||
{
|
{
|
||||||
|
|
@ -144,7 +144,7 @@ class Advanced extends Base
|
||||||
}
|
}
|
||||||
$cache_servers = array($vars->object_cache_type . '://' . $auth . $vars->object_cache_host . ':' . intval($vars->object_cache_port));
|
$cache_servers = array($vars->object_cache_type . '://' . $auth . $vars->object_cache_host . ':' . intval($vars->object_cache_port));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($vars->object_cache_type === 'redis')
|
if ($vars->object_cache_type === 'redis')
|
||||||
{
|
{
|
||||||
$cache_servers[0] .= '#' . intval($vars->object_cache_dbnum);
|
$cache_servers[0] .= '#' . intval($vars->object_cache_dbnum);
|
||||||
|
|
@ -168,13 +168,13 @@ class Advanced extends Base
|
||||||
{
|
{
|
||||||
Config::set('cache', array());
|
Config::set('cache', array());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache truncate method
|
// Cache truncate method
|
||||||
if (in_array($vars->cache_truncate_method, array('delete', 'empty')))
|
if (in_array($vars->cache_truncate_method, array('delete', 'empty')))
|
||||||
{
|
{
|
||||||
Config::set('cache.truncate_method', $vars->cache_truncate_method);
|
Config::set('cache.truncate_method', $vars->cache_truncate_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thumbnail settings
|
// Thumbnail settings
|
||||||
$oDocumentModel = getModel('document');
|
$oDocumentModel = getModel('document');
|
||||||
$document_config = $oDocumentModel->getDocumentConfig();
|
$document_config = $oDocumentModel->getDocumentConfig();
|
||||||
|
|
@ -183,7 +183,7 @@ class Advanced extends Base
|
||||||
$document_config->thumbnail_quality = intval($vars->thumbnail_quality) ?: 75;
|
$document_config->thumbnail_quality = intval($vars->thumbnail_quality) ?: 75;
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
$oModuleController->insertModuleConfig('document', $document_config);
|
$oModuleController->insertModuleConfig('document', $document_config);
|
||||||
|
|
||||||
// Mobile view
|
// Mobile view
|
||||||
Config::set('mobile.enabled', $vars->use_mobile_view === 'Y');
|
Config::set('mobile.enabled', $vars->use_mobile_view === 'Y');
|
||||||
Config::set('mobile.tablets', $vars->tablets_as_mobile === 'Y');
|
Config::set('mobile.tablets', $vars->tablets_as_mobile === 'Y');
|
||||||
|
|
@ -192,7 +192,7 @@ class Advanced extends Base
|
||||||
{
|
{
|
||||||
Config::set('use_mobile_view', $vars->use_mobile_view === 'Y');
|
Config::set('use_mobile_view', $vars->use_mobile_view === 'Y');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Languages and time zone
|
// Languages and time zone
|
||||||
$enabled_lang = $vars->enabled_lang;
|
$enabled_lang = $vars->enabled_lang;
|
||||||
if (!in_array($vars->default_lang, $enabled_lang ?: []))
|
if (!in_array($vars->default_lang, $enabled_lang ?: []))
|
||||||
|
|
@ -203,7 +203,7 @@ class Advanced extends Base
|
||||||
Config::set('locale.enabled_lang', array_values($enabled_lang));
|
Config::set('locale.enabled_lang', array_values($enabled_lang));
|
||||||
Config::set('locale.auto_select_lang', $vars->auto_select_lang === 'Y');
|
Config::set('locale.auto_select_lang', $vars->auto_select_lang === 'Y');
|
||||||
Config::set('locale.default_timezone', $vars->default_timezone);
|
Config::set('locale.default_timezone', $vars->default_timezone);
|
||||||
|
|
||||||
// Other settings
|
// Other settings
|
||||||
Config::set('url.rewrite', intval($vars->use_rewrite));
|
Config::set('url.rewrite', intval($vars->use_rewrite));
|
||||||
Config::set('use_rewrite', $vars->use_rewrite > 0);
|
Config::set('use_rewrite', $vars->use_rewrite > 0);
|
||||||
|
|
@ -215,13 +215,13 @@ class Advanced extends Base
|
||||||
Config::set('view.jquery_version', $vars->jquery_version == 3 ? 3 : 2);
|
Config::set('view.jquery_version', $vars->jquery_version == 3 ? 3 : 2);
|
||||||
Config::set('view.server_push', $vars->use_server_push === 'Y');
|
Config::set('view.server_push', $vars->use_server_push === 'Y');
|
||||||
Config::set('view.use_gzip', $vars->use_gzip === 'Y');
|
Config::set('view.use_gzip', $vars->use_gzip === 'Y');
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
if (!Config::save())
|
if (!Config::save())
|
||||||
{
|
{
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigAdvanced'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigAdvanced'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,27 +29,27 @@ class Debug extends Base
|
||||||
Context::set('debug_query_comment', Config::get('debug.query_comment'));
|
Context::set('debug_query_comment', Config::get('debug.query_comment'));
|
||||||
Context::set('debug_query_full_stack', Config::get('debug.query_full_stack'));
|
Context::set('debug_query_full_stack', Config::get('debug.query_full_stack'));
|
||||||
Context::set('debug_write_error_log', Config::get('debug.write_error_log'));
|
Context::set('debug_write_error_log', Config::get('debug.write_error_log'));
|
||||||
|
|
||||||
// IP access control
|
// IP access control
|
||||||
$allowed_ip = Config::get('debug.allow');
|
$allowed_ip = Config::get('debug.allow');
|
||||||
Context::set('debug_allowed_ip', implode(PHP_EOL, $allowed_ip));
|
Context::set('debug_allowed_ip', implode(PHP_EOL, $allowed_ip));
|
||||||
Context::set('remote_addr', RX_CLIENT_IP);
|
Context::set('remote_addr', RX_CLIENT_IP);
|
||||||
|
|
||||||
$this->setTemplateFile('config_debug');
|
$this->setTemplateFile('config_debug');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update debug configuration.
|
* Update debug configuration.
|
||||||
*/
|
*/
|
||||||
public function procAdminUpdateDebug()
|
public function procAdminUpdateDebug()
|
||||||
{
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
||||||
// Save display type settings
|
// Save display type settings
|
||||||
$display_type = array_values(array_filter($vars->debug_display_type ?: [], function($str) {
|
$display_type = array_values(array_filter($vars->debug_display_type ?: [], function($str) {
|
||||||
return in_array($str, ['panel', 'comment', 'file']);
|
return in_array($str, ['panel', 'comment', 'file']);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Debug settings
|
// Debug settings
|
||||||
Config::set('debug.enabled', $vars->debug_enabled === 'Y');
|
Config::set('debug.enabled', $vars->debug_enabled === 'Y');
|
||||||
Config::set('debug.log_slow_queries', max(0, floatval($vars->debug_log_slow_queries)));
|
Config::set('debug.log_slow_queries', max(0, floatval($vars->debug_log_slow_queries)));
|
||||||
|
|
@ -61,11 +61,11 @@ class Debug extends Base
|
||||||
Config::set('debug.query_comment', $vars->debug_query_comment === 'Y');
|
Config::set('debug.query_comment', $vars->debug_query_comment === 'Y');
|
||||||
Config::set('debug.query_full_stack', $vars->debug_query_full_stack === 'Y');
|
Config::set('debug.query_full_stack', $vars->debug_query_full_stack === 'Y');
|
||||||
Config::set('debug.write_error_log', strval($vars->debug_write_error_log) ?: 'fatal');
|
Config::set('debug.write_error_log', strval($vars->debug_write_error_log) ?: 'fatal');
|
||||||
|
|
||||||
// Debug content
|
// Debug content
|
||||||
$debug_content = array_values($vars->debug_display_content ?: array());
|
$debug_content = array_values($vars->debug_display_content ?: array());
|
||||||
Config::set('debug.display_content', $debug_content);
|
Config::set('debug.display_content', $debug_content);
|
||||||
|
|
||||||
// Log filename
|
// Log filename
|
||||||
$log_filename = strval($vars->debug_log_filename);
|
$log_filename = strval($vars->debug_log_filename);
|
||||||
$log_filename_today = str_replace(array('YYYY', 'YY', 'MM', 'DD'), array(
|
$log_filename_today = str_replace(array('YYYY', 'YY', 'MM', 'DD'), array(
|
||||||
|
|
@ -87,7 +87,7 @@ class Debug extends Base
|
||||||
throw new Exception('msg_debug_log_filename_not_writable');
|
throw new Exception('msg_debug_log_filename_not_writable');
|
||||||
}
|
}
|
||||||
Config::set('debug.log_filename', $log_filename);
|
Config::set('debug.log_filename', $log_filename);
|
||||||
|
|
||||||
// IP access control
|
// IP access control
|
||||||
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->debug_allowed_ip));
|
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->debug_allowed_ip));
|
||||||
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
|
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
|
||||||
|
|
@ -97,13 +97,13 @@ class Debug extends Base
|
||||||
throw new Exception('msg_invalid_ip');
|
throw new Exception('msg_invalid_ip');
|
||||||
}
|
}
|
||||||
Config::set('debug.allow', array_values($allowed_ip));
|
Config::set('debug.allow', array_values($allowed_ip));
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
if (!Config::save())
|
if (!Config::save())
|
||||||
{
|
{
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigDebug'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigDebug'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class Domains extends Base
|
||||||
Context::set('domain_list', $domain_list);
|
Context::set('domain_list', $domain_list);
|
||||||
Context::set('page_navigation', $domain_list->page_navigation);
|
Context::set('page_navigation', $domain_list->page_navigation);
|
||||||
Context::set('page', $page);
|
Context::set('page', $page);
|
||||||
|
|
||||||
// Get index module info.
|
// Get index module info.
|
||||||
$module_list = array();
|
$module_list = array();
|
||||||
$oModuleModel = getModel('module');
|
$oModuleModel = getModel('module');
|
||||||
|
|
@ -41,13 +41,13 @@ class Domains extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context::set('module_list', $module_list);
|
Context::set('module_list', $module_list);
|
||||||
|
|
||||||
// Get language list.
|
// Get language list.
|
||||||
Context::set('supported_lang', Lang::getSupportedList());
|
Context::set('supported_lang', Lang::getSupportedList());
|
||||||
|
|
||||||
$this->setTemplateFile('config_domains');
|
$this->setTemplateFile('config_domains');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display domain edit screen
|
* Display domain edit screen
|
||||||
*/
|
*/
|
||||||
|
|
@ -66,7 +66,7 @@ class Domains extends Base
|
||||||
}
|
}
|
||||||
Context::set('domain_info', $domain_info);
|
Context::set('domain_info', $domain_info);
|
||||||
Context::set('domain_copy', false);
|
Context::set('domain_copy', false);
|
||||||
|
|
||||||
// Get modules.
|
// Get modules.
|
||||||
if ($domain_info && $domain_info->index_module_srl)
|
if ($domain_info && $domain_info->index_module_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -77,7 +77,7 @@ class Domains extends Base
|
||||||
$index_module_srl = '';
|
$index_module_srl = '';
|
||||||
}
|
}
|
||||||
Context::set('index_module_srl', $index_module_srl);
|
Context::set('index_module_srl', $index_module_srl);
|
||||||
|
|
||||||
// Get language list.
|
// Get language list.
|
||||||
Context::set('supported_lang', Lang::getSupportedList());
|
Context::set('supported_lang', Lang::getSupportedList());
|
||||||
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
||||||
|
|
@ -90,7 +90,7 @@ class Domains extends Base
|
||||||
$domain_lang = 'default';
|
$domain_lang = 'default';
|
||||||
}
|
}
|
||||||
Context::set('domain_lang', $domain_lang);
|
Context::set('domain_lang', $domain_lang);
|
||||||
|
|
||||||
// Get timezone list.
|
// Get timezone list.
|
||||||
Context::set('timezones', DateTime::getTimezoneList());
|
Context::set('timezones', DateTime::getTimezoneList());
|
||||||
if ($domain_info && $domain_info->settings->timezone)
|
if ($domain_info && $domain_info->settings->timezone)
|
||||||
|
|
@ -102,7 +102,7 @@ class Domains extends Base
|
||||||
$domain_timezone = Config::get('locale.default_timezone');
|
$domain_timezone = Config::get('locale.default_timezone');
|
||||||
}
|
}
|
||||||
Context::set('domain_timezone', $domain_timezone);
|
Context::set('domain_timezone', $domain_timezone);
|
||||||
|
|
||||||
// Get favicon and images.
|
// Get favicon and images.
|
||||||
if ($domain_info)
|
if ($domain_info)
|
||||||
{
|
{
|
||||||
|
|
@ -111,10 +111,10 @@ class Domains extends Base
|
||||||
Context::set('default_image_url', IconModel::getDefaultImageUrl($domain_info->domain_srl));
|
Context::set('default_image_url', IconModel::getDefaultImageUrl($domain_info->domain_srl));
|
||||||
Context::set('color_scheme', $domain_info->settings->color_scheme ?? 'auto');
|
Context::set('color_scheme', $domain_info->settings->color_scheme ?? 'auto');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setTemplateFile('config_domains_edit');
|
$this->setTemplateFile('config_domains_edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display domain copy screen
|
* Display domain copy screen
|
||||||
*/
|
*/
|
||||||
|
|
@ -127,13 +127,13 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_domain_not_found');
|
throw new Exception('msg_domain_not_found');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust some properties for copying.
|
// Adjust some properties for copying.
|
||||||
$domain_info->domain_srl = null;
|
$domain_info->domain_srl = null;
|
||||||
$domain_info->is_default_domain = 'N';
|
$domain_info->is_default_domain = 'N';
|
||||||
Context::set('domain_info', $domain_info);
|
Context::set('domain_info', $domain_info);
|
||||||
Context::set('domain_copy', true);
|
Context::set('domain_copy', true);
|
||||||
|
|
||||||
// Get modules.
|
// Get modules.
|
||||||
if ($domain_info && $domain_info->index_module_srl)
|
if ($domain_info && $domain_info->index_module_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -144,7 +144,7 @@ class Domains extends Base
|
||||||
$index_module_srl = '';
|
$index_module_srl = '';
|
||||||
}
|
}
|
||||||
Context::set('index_module_srl', $index_module_srl);
|
Context::set('index_module_srl', $index_module_srl);
|
||||||
|
|
||||||
// Get language list.
|
// Get language list.
|
||||||
Context::set('supported_lang', Lang::getSupportedList());
|
Context::set('supported_lang', Lang::getSupportedList());
|
||||||
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
|
||||||
|
|
@ -157,7 +157,7 @@ class Domains extends Base
|
||||||
$domain_lang = 'default';
|
$domain_lang = 'default';
|
||||||
}
|
}
|
||||||
Context::set('domain_lang', $domain_lang);
|
Context::set('domain_lang', $domain_lang);
|
||||||
|
|
||||||
// Get timezone list.
|
// Get timezone list.
|
||||||
Context::set('timezones', DateTime::getTimezoneList());
|
Context::set('timezones', DateTime::getTimezoneList());
|
||||||
if ($domain_info && $domain_info->settings->timezone)
|
if ($domain_info && $domain_info->settings->timezone)
|
||||||
|
|
@ -169,7 +169,7 @@ class Domains extends Base
|
||||||
$domain_timezone = Config::get('locale.default_timezone');
|
$domain_timezone = Config::get('locale.default_timezone');
|
||||||
}
|
}
|
||||||
Context::set('domain_timezone', $domain_timezone);
|
Context::set('domain_timezone', $domain_timezone);
|
||||||
|
|
||||||
// Get favicon and images.
|
// Get favicon and images.
|
||||||
if ($domain_info)
|
if ($domain_info)
|
||||||
{
|
{
|
||||||
|
|
@ -178,24 +178,24 @@ class Domains extends Base
|
||||||
Context::set('default_image_url', IconModel::getDefaultImageUrl($domain_info->domain_srl));
|
Context::set('default_image_url', IconModel::getDefaultImageUrl($domain_info->domain_srl));
|
||||||
Context::set('color_scheme', $domain_info->settings->color_scheme ?? 'auto');
|
Context::set('color_scheme', $domain_info->settings->color_scheme ?? 'auto');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setTemplateFile('config_domains_edit');
|
$this->setTemplateFile('config_domains_edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update domains configuration.
|
* Update domains configuration.
|
||||||
*/
|
*/
|
||||||
public function procAdminUpdateDomainConfig()
|
public function procAdminUpdateDomainConfig()
|
||||||
{
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
||||||
// Validate the unregistered domain action.
|
// Validate the unregistered domain action.
|
||||||
$valid_actions = array('redirect_301', 'redirect_302', 'display', 'block');
|
$valid_actions = array('redirect_301', 'redirect_302', 'display', 'block');
|
||||||
if (!in_array($vars->unregistered_domain_action, $valid_actions))
|
if (!in_array($vars->unregistered_domain_action, $valid_actions))
|
||||||
{
|
{
|
||||||
$vars->unregistered_domain_action = 'redirect_301';
|
$vars->unregistered_domain_action = 'redirect_301';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save system config.
|
// Save system config.
|
||||||
Config::set('url.unregistered_domain_action', $vars->unregistered_domain_action);
|
Config::set('url.unregistered_domain_action', $vars->unregistered_domain_action);
|
||||||
Config::set('use_sso', $vars->use_sso === 'Y');
|
Config::set('use_sso', $vars->use_sso === 'Y');
|
||||||
|
|
@ -203,11 +203,11 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert or update domain info.
|
* Insert or update domain info.
|
||||||
*/
|
*/
|
||||||
|
|
@ -224,7 +224,7 @@ class Domains extends Base
|
||||||
throw new Exception('msg_domain_not_found');
|
throw new Exception('msg_domain_not_found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copying?
|
// Copying?
|
||||||
$copy_domain_srl = intval($vars->copy_domain_srl);
|
$copy_domain_srl = intval($vars->copy_domain_srl);
|
||||||
if (!$domain_info && $copy_domain_srl > -1)
|
if (!$domain_info && $copy_domain_srl > -1)
|
||||||
|
|
@ -239,7 +239,7 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
$copy_domain_info = null;
|
$copy_domain_info = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the title and subtitle.
|
// Validate the title and subtitle.
|
||||||
$vars->title = utf8_trim($vars->title);
|
$vars->title = utf8_trim($vars->title);
|
||||||
$vars->subtitle = utf8_trim($vars->subtitle);
|
$vars->subtitle = utf8_trim($vars->subtitle);
|
||||||
|
|
@ -247,7 +247,7 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_site_title_is_empty');
|
throw new Exception('msg_site_title_is_empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the domain.
|
// Validate the domain.
|
||||||
if (!preg_match('@^https?://@', $vars->domain))
|
if (!preg_match('@^https?://@', $vars->domain))
|
||||||
{
|
{
|
||||||
|
|
@ -270,7 +270,7 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_domain_already_exists');
|
throw new Exception('msg_domain_already_exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the ports.
|
// Validate the ports.
|
||||||
if ($vars->http_port == 80 || !$vars->http_port)
|
if ($vars->http_port == 80 || !$vars->http_port)
|
||||||
{
|
{
|
||||||
|
|
@ -288,21 +288,21 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_invalid_https_port');
|
throw new Exception('msg_invalid_https_port');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the security setting.
|
// Validate the security setting.
|
||||||
$valid_security_options = array('none', 'optional', 'always');
|
$valid_security_options = array('none', 'optional', 'always');
|
||||||
if (!in_array($vars->domain_security, $valid_security_options))
|
if (!in_array($vars->domain_security, $valid_security_options))
|
||||||
{
|
{
|
||||||
$vars->domain_security = 'none';
|
$vars->domain_security = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the index module setting.
|
// Validate the index module setting.
|
||||||
$module_info = getModel('module')->getModuleInfoByModuleSrl(intval($vars->index_module_srl));
|
$module_info = getModel('module')->getModuleInfoByModuleSrl(intval($vars->index_module_srl));
|
||||||
if (!$module_info || $module_info->module_srl != $vars->index_module_srl)
|
if (!$module_info || $module_info->module_srl != $vars->index_module_srl)
|
||||||
{
|
{
|
||||||
throw new Exception('msg_invalid_index_module_srl');
|
throw new Exception('msg_invalid_index_module_srl');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the index document setting.
|
// Validate the index document setting.
|
||||||
if ($vars->index_document_srl)
|
if ($vars->index_document_srl)
|
||||||
{
|
{
|
||||||
|
|
@ -320,36 +320,36 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
$vars->index_document_srl = 0;
|
$vars->index_document_srl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the default language.
|
// Validate the default language.
|
||||||
$enabled_lang = Config::get('locale.enabled_lang');
|
$enabled_lang = Config::get('locale.enabled_lang');
|
||||||
if ($vars->default_lang !== 'default' && !in_array($vars->default_lang, $enabled_lang))
|
if ($vars->default_lang !== 'default' && !in_array($vars->default_lang, $enabled_lang))
|
||||||
{
|
{
|
||||||
throw new Exception('msg_lang_is_not_enabled');
|
throw new Exception('msg_lang_is_not_enabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the default time zone.
|
// Validate the default time zone.
|
||||||
$timezone_list = DateTime::getTimezoneList();
|
$timezone_list = DateTime::getTimezoneList();
|
||||||
if ($vars->default_timezone !== 'default' && !isset($timezone_list[$vars->default_timezone]))
|
if ($vars->default_timezone !== 'default' && !isset($timezone_list[$vars->default_timezone]))
|
||||||
{
|
{
|
||||||
throw new Exception('msg_invalid_timezone');
|
throw new Exception('msg_invalid_timezone');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up the meta keywords and description.
|
// Clean up the meta keywords and description.
|
||||||
$vars->meta_keywords = utf8_trim($vars->meta_keywords);
|
$vars->meta_keywords = utf8_trim($vars->meta_keywords);
|
||||||
$vars->meta_description = utf8_trim($vars->meta_description);
|
$vars->meta_description = utf8_trim($vars->meta_description);
|
||||||
|
|
||||||
// Clean up the header and footer scripts.
|
// Clean up the header and footer scripts.
|
||||||
$vars->html_header = utf8_trim($vars->html_header);
|
$vars->html_header = utf8_trim($vars->html_header);
|
||||||
$vars->html_footer = utf8_trim($vars->html_footer);
|
$vars->html_footer = utf8_trim($vars->html_footer);
|
||||||
|
|
||||||
// Validate the color scheme setting.
|
// Validate the color scheme setting.
|
||||||
$valid_color_scheme_options = array('auto', 'light', 'dark');
|
$valid_color_scheme_options = array('auto', 'light', 'dark');
|
||||||
if (!in_array($vars->color_scheme, $valid_color_scheme_options))
|
if (!in_array($vars->color_scheme, $valid_color_scheme_options))
|
||||||
{
|
{
|
||||||
$vars->color_scheme = 'auto';
|
$vars->color_scheme = 'auto';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge all settings into an array.
|
// Merge all settings into an array.
|
||||||
$settings = array(
|
$settings = array(
|
||||||
'title' => $vars->title,
|
'title' => $vars->title,
|
||||||
|
|
@ -362,11 +362,11 @@ class Domains extends Base
|
||||||
'html_footer' => $vars->html_footer,
|
'html_footer' => $vars->html_footer,
|
||||||
'color_scheme' => $vars->color_scheme
|
'color_scheme' => $vars->color_scheme
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get the DB object and begin a transaction.
|
// Get the DB object and begin a transaction.
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
|
||||||
// Insert or update the domain.
|
// Insert or update the domain.
|
||||||
if (!$domain_info)
|
if (!$domain_info)
|
||||||
{
|
{
|
||||||
|
|
@ -408,7 +408,7 @@ class Domains extends Base
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If changing the default domain, set all other domains as non-default.
|
// If changing the default domain, set all other domains as non-default.
|
||||||
if ($vars->is_default_domain === 'Y')
|
if ($vars->is_default_domain === 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -420,7 +420,7 @@ class Domains extends Base
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save or copy the favicon.
|
// Save or copy the favicon.
|
||||||
if ($vars->delete_favicon)
|
if ($vars->delete_favicon)
|
||||||
{
|
{
|
||||||
|
|
@ -436,7 +436,7 @@ class Domains extends Base
|
||||||
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'favicon.ico';
|
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'favicon.ico';
|
||||||
Storage::copy($source_filename, $target_filename);
|
Storage::copy($source_filename, $target_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save or copy the mobile icon.
|
// Save or copy the mobile icon.
|
||||||
if ($vars->delete_mobicon)
|
if ($vars->delete_mobicon)
|
||||||
{
|
{
|
||||||
|
|
@ -452,7 +452,7 @@ class Domains extends Base
|
||||||
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'mobicon.png';
|
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'mobicon.png';
|
||||||
Storage::copy($source_filename, $target_filename);
|
Storage::copy($source_filename, $target_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save or copy the site default image.
|
// Save or copy the site default image.
|
||||||
if ($vars->delete_default_image)
|
if ($vars->delete_default_image)
|
||||||
{
|
{
|
||||||
|
|
@ -485,7 +485,7 @@ class Domains extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update system configuration to match the default domain.
|
// Update system configuration to match the default domain.
|
||||||
if ($domain_info && $domain_info->is_default_domain === 'Y')
|
if ($domain_info && $domain_info->is_default_domain === 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -502,17 +502,17 @@ class Domains extends Base
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit.
|
// Commit.
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
// Clear cache.
|
// Clear cache.
|
||||||
Cache::clearGroup('site_and_module');
|
Cache::clearGroup('site_and_module');
|
||||||
|
|
||||||
// Redirect to the domain list.
|
// Redirect to the domain list.
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a domain.
|
* Delete a domain.
|
||||||
*/
|
*/
|
||||||
|
|
@ -533,7 +533,7 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_cannot_delete_default_domain');
|
throw new Exception('msg_cannot_delete_default_domain');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the domain.
|
// Delete the domain.
|
||||||
$args = new \stdClass;
|
$args = new \stdClass;
|
||||||
$args->domain_srl = $domain_srl;
|
$args->domain_srl = $domain_srl;
|
||||||
|
|
@ -542,12 +542,12 @@ class Domains extends Base
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete icons and default image for the domain.
|
// Delete icons and default image for the domain.
|
||||||
IconModel::deleteIcon($domain_srl, 'favicon.ico');
|
IconModel::deleteIcon($domain_srl, 'favicon.ico');
|
||||||
IconModel::deleteIcon($domain_srl, 'mobicon.png');
|
IconModel::deleteIcon($domain_srl, 'mobicon.png');
|
||||||
IconModel::deleteDefaultImage($domain_srl);
|
IconModel::deleteDefaultImage($domain_srl);
|
||||||
|
|
||||||
// Clear cache.
|
// Clear cache.
|
||||||
Cache::clearGroup('site_and_module');
|
Cache::clearGroup('site_and_module');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,21 +21,21 @@ class Notification extends Base
|
||||||
{
|
{
|
||||||
// Load advanced mailer module (for lang).
|
// Load advanced mailer module (for lang).
|
||||||
$oAdvancedMailerAdminView = \Advanced_mailerAdminView::getInstance();
|
$oAdvancedMailerAdminView = \Advanced_mailerAdminView::getInstance();
|
||||||
|
|
||||||
// Load advanced mailer config.
|
// Load advanced mailer config.
|
||||||
$advanced_mailer_config = $oAdvancedMailerAdminView->getConfig();
|
$advanced_mailer_config = $oAdvancedMailerAdminView->getConfig();
|
||||||
Context::set('advanced_mailer_config', $advanced_mailer_config);
|
Context::set('advanced_mailer_config', $advanced_mailer_config);
|
||||||
|
|
||||||
// Load member config.
|
// Load member config.
|
||||||
$member_config = ModuleModel::getModuleConfig('member');
|
$member_config = ModuleModel::getModuleConfig('member');
|
||||||
Context::set('member_config', $member_config);
|
Context::set('member_config', $member_config);
|
||||||
Context::set('webmaster_name', !empty($member_config->webmaster_name) ? $member_config->webmaster_name : 'webmaster');
|
Context::set('webmaster_name', !empty($member_config->webmaster_name) ? $member_config->webmaster_name : 'webmaster');
|
||||||
Context::set('webmaster_email', $member_config->webmaster_email ?? '');
|
Context::set('webmaster_email', $member_config->webmaster_email ?? '');
|
||||||
|
|
||||||
// Load module config.
|
// Load module config.
|
||||||
$module_config = ModuleModel::getModuleConfig('module');
|
$module_config = ModuleModel::getModuleConfig('module');
|
||||||
Context::set('module_config', $module_config);
|
Context::set('module_config', $module_config);
|
||||||
|
|
||||||
// Load mail drivers.
|
// Load mail drivers.
|
||||||
$mail_drivers = Mail::getSupportedDrivers();
|
$mail_drivers = Mail::getSupportedDrivers();
|
||||||
uasort($mail_drivers, function($a, $b) {
|
uasort($mail_drivers, function($a, $b) {
|
||||||
|
|
@ -45,7 +45,7 @@ class Notification extends Base
|
||||||
});
|
});
|
||||||
Context::set('mail_drivers', $mail_drivers);
|
Context::set('mail_drivers', $mail_drivers);
|
||||||
Context::set('mail_driver', config('mail.type') ?: 'mailfunction');
|
Context::set('mail_driver', config('mail.type') ?: 'mailfunction');
|
||||||
|
|
||||||
// Load SMS drivers.
|
// Load SMS drivers.
|
||||||
$sms_drivers = SMS::getSupportedDrivers();
|
$sms_drivers = SMS::getSupportedDrivers();
|
||||||
uasort($sms_drivers, function($a, $b) {
|
uasort($sms_drivers, function($a, $b) {
|
||||||
|
|
@ -55,7 +55,7 @@ class Notification extends Base
|
||||||
});
|
});
|
||||||
Context::set('sms_drivers', $sms_drivers);
|
Context::set('sms_drivers', $sms_drivers);
|
||||||
Context::set('sms_driver', config('sms.type') ?: 'dummy');
|
Context::set('sms_driver', config('sms.type') ?: 'dummy');
|
||||||
|
|
||||||
// Load Push drivers.
|
// Load Push drivers.
|
||||||
$push_drivers = Push::getSupportedDrivers();
|
$push_drivers = Push::getSupportedDrivers();
|
||||||
uasort($push_drivers, function($a, $b) { return strcmp($a['name'], $b['name']); });
|
uasort($push_drivers, function($a, $b) { return strcmp($a['name'], $b['name']); });
|
||||||
|
|
@ -67,24 +67,24 @@ class Notification extends Base
|
||||||
$apns_certificate = Storage::read($apns_certificate_filename);
|
$apns_certificate = Storage::read($apns_certificate_filename);
|
||||||
}
|
}
|
||||||
Context::set('apns_certificate', $apns_certificate);
|
Context::set('apns_certificate', $apns_certificate);
|
||||||
|
|
||||||
// Workaround for compatibility with older version of Amazon SES driver.
|
// Workaround for compatibility with older version of Amazon SES driver.
|
||||||
config('mail.ses.api_key', config('mail.ses.api_user'));
|
config('mail.ses.api_key', config('mail.ses.api_user'));
|
||||||
config('mail.ses.api_secret', config('mail.ses.api_pass'));
|
config('mail.ses.api_secret', config('mail.ses.api_pass'));
|
||||||
|
|
||||||
$this->setTemplateFile('config_notification');
|
$this->setTemplateFile('config_notification');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update notification configuration.
|
* Update notification configuration.
|
||||||
*/
|
*/
|
||||||
public function procAdminUpdateNotification()
|
public function procAdminUpdateNotification()
|
||||||
{
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
||||||
// Load advanced mailer module (for lang).
|
// Load advanced mailer module (for lang).
|
||||||
$oAdvancedMailerAdminView = \Advanced_mailerAdminView::getInstance();
|
$oAdvancedMailerAdminView = \Advanced_mailerAdminView::getInstance();
|
||||||
|
|
||||||
// Validate the mail sender's information.
|
// Validate the mail sender's information.
|
||||||
if (!$vars->mail_default_name)
|
if (!$vars->mail_default_name)
|
||||||
{
|
{
|
||||||
|
|
@ -102,7 +102,7 @@ class Notification extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_advanced_mailer_reply_to_is_invalid');
|
throw new Exception('msg_advanced_mailer_reply_to_is_invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the mail driver.
|
// Validate the mail driver.
|
||||||
$mail_drivers = Mail::getSupportedDrivers();
|
$mail_drivers = Mail::getSupportedDrivers();
|
||||||
$mail_driver = $vars->mail_driver;
|
$mail_driver = $vars->mail_driver;
|
||||||
|
|
@ -110,7 +110,7 @@ class Notification extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
|
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the mail driver settings.
|
// Validate the mail driver settings.
|
||||||
$mail_driver_config = array();
|
$mail_driver_config = array();
|
||||||
foreach ($mail_drivers[$mail_driver]['required'] as $conf_name)
|
foreach ($mail_drivers[$mail_driver]['required'] as $conf_name)
|
||||||
|
|
@ -122,7 +122,7 @@ class Notification extends Base
|
||||||
}
|
}
|
||||||
$mail_driver_config[$conf_name] = $conf_value;
|
$mail_driver_config[$conf_name] = $conf_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the SMS driver.
|
// Validate the SMS driver.
|
||||||
$sms_drivers = SMS::getSupportedDrivers();
|
$sms_drivers = SMS::getSupportedDrivers();
|
||||||
$sms_driver = $vars->sms_driver;
|
$sms_driver = $vars->sms_driver;
|
||||||
|
|
@ -130,7 +130,7 @@ class Notification extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
|
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the SMS driver settings.
|
// Validate the SMS driver settings.
|
||||||
$sms_driver_config = array();
|
$sms_driver_config = array();
|
||||||
foreach ($sms_drivers[$sms_driver]['required'] as $conf_name)
|
foreach ($sms_drivers[$sms_driver]['required'] as $conf_name)
|
||||||
|
|
@ -147,7 +147,7 @@ class Notification extends Base
|
||||||
$conf_value = $vars->{'sms_' . $sms_driver . '_' . $conf_name} ?: null;
|
$conf_value = $vars->{'sms_' . $sms_driver . '_' . $conf_name} ?: null;
|
||||||
$sms_driver_config[$conf_name] = $conf_value;
|
$sms_driver_config[$conf_name] = $conf_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the selected Push drivers.
|
// Validate the selected Push drivers.
|
||||||
$push_config = array('types' => array());
|
$push_config = array('types' => array());
|
||||||
$push_config['allow_guest_device'] = $vars->allow_guest_device === 'Y' ? true : false;
|
$push_config['allow_guest_device'] = $vars->allow_guest_device === 'Y' ? true : false;
|
||||||
|
|
@ -164,7 +164,7 @@ class Notification extends Base
|
||||||
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
|
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate the Push driver settings.
|
// Validate the Push driver settings.
|
||||||
foreach ($push_drivers as $driver_name => $driver_definition)
|
foreach ($push_drivers as $driver_name => $driver_definition)
|
||||||
{
|
{
|
||||||
|
|
@ -176,7 +176,7 @@ class Notification extends Base
|
||||||
throw new Exception('msg_advanced_mailer_push_config_invalid');
|
throw new Exception('msg_advanced_mailer_push_config_invalid');
|
||||||
}
|
}
|
||||||
$push_config[$driver_name][$conf_name] = $conf_value;
|
$push_config[$driver_name][$conf_name] = $conf_value;
|
||||||
|
|
||||||
// Save certificates in a separate file and only store the filename in config.php.
|
// Save certificates in a separate file and only store the filename in config.php.
|
||||||
if ($conf_name === 'certificate')
|
if ($conf_name === 'certificate')
|
||||||
{
|
{
|
||||||
|
|
@ -185,7 +185,7 @@ class Notification extends Base
|
||||||
{
|
{
|
||||||
$filename = './files/config/' . $driver_name . '/cert-' . \Rhymix\Framework\Security::getRandom(32) . '.pem';
|
$filename = './files/config/' . $driver_name . '/cert-' . \Rhymix\Framework\Security::getRandom(32) . '.pem';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf_value !== null)
|
if ($conf_value !== null)
|
||||||
{
|
{
|
||||||
Storage::write($filename, $conf_value);
|
Storage::write($filename, $conf_value);
|
||||||
|
|
@ -203,7 +203,7 @@ class Notification extends Base
|
||||||
$push_config[$driver_name][$conf_name] = $conf_value;
|
$push_config[$driver_name][$conf_name] = $conf_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save advanced mailer config.
|
// Save advanced mailer config.
|
||||||
getController('module')->updateModuleConfig('advanced_mailer', (object)array(
|
getController('module')->updateModuleConfig('advanced_mailer', (object)array(
|
||||||
'sender_name' => trim($vars->mail_default_name),
|
'sender_name' => trim($vars->mail_default_name),
|
||||||
|
|
@ -211,13 +211,13 @@ class Notification extends Base
|
||||||
'force_sender' => toBool($vars->mail_force_default_sender),
|
'force_sender' => toBool($vars->mail_force_default_sender),
|
||||||
'reply_to' => trim($vars->mail_default_reply_to),
|
'reply_to' => trim($vars->mail_default_reply_to),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Save member config.
|
// Save member config.
|
||||||
getController('module')->updateModuleConfig('member', (object)array(
|
getController('module')->updateModuleConfig('member', (object)array(
|
||||||
'webmaster_name' => trim($vars->mail_default_name),
|
'webmaster_name' => trim($vars->mail_default_name),
|
||||||
'webmaster_email' => trim($vars->mail_default_from),
|
'webmaster_email' => trim($vars->mail_default_from),
|
||||||
));
|
));
|
||||||
|
|
||||||
// Save system config.
|
// Save system config.
|
||||||
Config::set("mail.default_name", trim($vars->mail_default_name));
|
Config::set("mail.default_name", trim($vars->mail_default_name));
|
||||||
Config::set("mail.default_from", trim($vars->mail_default_from));
|
Config::set("mail.default_from", trim($vars->mail_default_from));
|
||||||
|
|
@ -236,7 +236,7 @@ class Notification extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigNotification'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigNotification'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ class SEO extends Base
|
||||||
$config = ModuleModel::getModuleConfig('module');
|
$config = ModuleModel::getModuleConfig('module');
|
||||||
Context::set('site_meta_keywords', escape($config->meta_keywords ?? ''));
|
Context::set('site_meta_keywords', escape($config->meta_keywords ?? ''));
|
||||||
Context::set('site_meta_description', escape($config->meta_description ?? ''));
|
Context::set('site_meta_description', escape($config->meta_description ?? ''));
|
||||||
|
|
||||||
// Titles
|
// Titles
|
||||||
Context::set('seo_main_title', escape(Config::get('seo.main_title') ?: '$SITE_TITLE - $SITE_SUBTITLE'));
|
Context::set('seo_main_title', escape(Config::get('seo.main_title') ?: '$SITE_TITLE - $SITE_SUBTITLE'));
|
||||||
Context::set('seo_subpage_title', escape(Config::get('seo.subpage_title') ?: '$SITE_TITLE - $SUBPAGE_TITLE'));
|
Context::set('seo_subpage_title', escape(Config::get('seo.subpage_title') ?: '$SITE_TITLE - $SUBPAGE_TITLE'));
|
||||||
Context::set('seo_document_title', escape(Config::get('seo.document_title') ?: '$SITE_TITLE - $DOCUMENT_TITLE'));
|
Context::set('seo_document_title', escape(Config::get('seo.document_title') ?: '$SITE_TITLE - $DOCUMENT_TITLE'));
|
||||||
|
|
||||||
// OpenGraph metadata
|
// OpenGraph metadata
|
||||||
Context::set('og_enabled', Config::get('seo.og_enabled'));
|
Context::set('og_enabled', Config::get('seo.og_enabled'));
|
||||||
Context::set('og_extract_description', Config::get('seo.og_extract_description'));
|
Context::set('og_extract_description', Config::get('seo.og_extract_description'));
|
||||||
|
|
@ -34,7 +34,7 @@ class SEO extends Base
|
||||||
Context::set('og_use_nick_name', Config::get('seo.og_use_nick_name'));
|
Context::set('og_use_nick_name', Config::get('seo.og_use_nick_name'));
|
||||||
Context::set('og_use_timestamps', Config::get('seo.og_use_timestamps'));
|
Context::set('og_use_timestamps', Config::get('seo.og_use_timestamps'));
|
||||||
Context::set('twitter_enabled', Config::get('seo.twitter_enabled'));
|
Context::set('twitter_enabled', Config::get('seo.twitter_enabled'));
|
||||||
|
|
||||||
$this->setTemplateFile('config_seo');
|
$this->setTemplateFile('config_seo');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,17 +44,17 @@ class SEO extends Base
|
||||||
public function procAdminUpdateSEO()
|
public function procAdminUpdateSEO()
|
||||||
{
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
||||||
$args = new \stdClass;
|
$args = new \stdClass;
|
||||||
$args->meta_keywords = $vars->site_meta_keywords ? implode(', ', array_map('trim', explode(',', $vars->site_meta_keywords))) : '';
|
$args->meta_keywords = $vars->site_meta_keywords ? implode(', ', array_map('trim', explode(',', $vars->site_meta_keywords))) : '';
|
||||||
$args->meta_description = trim(utf8_normalize_spaces($vars->site_meta_description));
|
$args->meta_description = trim(utf8_normalize_spaces($vars->site_meta_description));
|
||||||
$oModuleController = ModuleController::getInstance();
|
$oModuleController = ModuleController::getInstance();
|
||||||
$oModuleController->updateModuleConfig('module', $args);
|
$oModuleController->updateModuleConfig('module', $args);
|
||||||
|
|
||||||
Config::set('seo.main_title', trim(utf8_normalize_spaces($vars->seo_main_title)));
|
Config::set('seo.main_title', trim(utf8_normalize_spaces($vars->seo_main_title)));
|
||||||
Config::set('seo.subpage_title', trim(utf8_normalize_spaces($vars->seo_subpage_title)));
|
Config::set('seo.subpage_title', trim(utf8_normalize_spaces($vars->seo_subpage_title)));
|
||||||
Config::set('seo.document_title', trim(utf8_normalize_spaces($vars->seo_document_title)));
|
Config::set('seo.document_title', trim(utf8_normalize_spaces($vars->seo_document_title)));
|
||||||
|
|
||||||
Config::set('seo.og_enabled', $vars->og_enabled === 'Y');
|
Config::set('seo.og_enabled', $vars->og_enabled === 'Y');
|
||||||
Config::set('seo.og_extract_description', $vars->og_extract_description === 'Y');
|
Config::set('seo.og_extract_description', $vars->og_extract_description === 'Y');
|
||||||
Config::set('seo.og_extract_images', $vars->og_extract_images === 'Y');
|
Config::set('seo.og_extract_images', $vars->og_extract_images === 'Y');
|
||||||
|
|
@ -62,13 +62,13 @@ class SEO extends Base
|
||||||
Config::set('seo.og_use_nick_name', $vars->og_use_nick_name === 'Y');
|
Config::set('seo.og_use_nick_name', $vars->og_use_nick_name === 'Y');
|
||||||
Config::set('seo.og_use_timestamps', $vars->og_use_timestamps === 'Y');
|
Config::set('seo.og_use_timestamps', $vars->og_use_timestamps === 'Y');
|
||||||
Config::set('seo.twitter_enabled', $vars->twitter_enabled === 'Y');
|
Config::set('seo.twitter_enabled', $vars->twitter_enabled === 'Y');
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
if (!Config::save())
|
if (!Config::save())
|
||||||
{
|
{
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSEO'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSEO'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,18 @@ class Security extends Base
|
||||||
// Load embed filter.
|
// Load embed filter.
|
||||||
context::set('mediafilter_whitelist', implode(PHP_EOL, MediaFilter::getWhitelist()));
|
context::set('mediafilter_whitelist', implode(PHP_EOL, MediaFilter::getWhitelist()));
|
||||||
context::set('mediafilter_classes', implode(PHP_EOL, Config::get('mediafilter.classes') ?: array()));
|
context::set('mediafilter_classes', implode(PHP_EOL, Config::get('mediafilter.classes') ?: array()));
|
||||||
|
|
||||||
// Load robot user agents.
|
// Load robot user agents.
|
||||||
$robot_user_agents = Config::get('security.robot_user_agents') ?: array();
|
$robot_user_agents = Config::get('security.robot_user_agents') ?: array();
|
||||||
Context::set('robot_user_agents', implode(PHP_EOL, $robot_user_agents));
|
Context::set('robot_user_agents', implode(PHP_EOL, $robot_user_agents));
|
||||||
|
|
||||||
// Admin IP access control
|
// Admin IP access control
|
||||||
$allowed_ip = Config::get('admin.allow');
|
$allowed_ip = Config::get('admin.allow');
|
||||||
Context::set('admin_allowed_ip', implode(PHP_EOL, $allowed_ip));
|
Context::set('admin_allowed_ip', implode(PHP_EOL, $allowed_ip));
|
||||||
$denied_ip = Config::get('admin.deny');
|
$denied_ip = Config::get('admin.deny');
|
||||||
Context::set('admin_denied_ip', implode(PHP_EOL, $denied_ip));
|
Context::set('admin_denied_ip', implode(PHP_EOL, $denied_ip));
|
||||||
Context::set('remote_addr', RX_CLIENT_IP);
|
Context::set('remote_addr', RX_CLIENT_IP);
|
||||||
|
|
||||||
// Session and cookie security settings
|
// Session and cookie security settings
|
||||||
Context::set('use_samesite', Config::get('session.samesite'));
|
Context::set('use_samesite', Config::get('session.samesite'));
|
||||||
Context::set('use_session_keys', Config::get('session.use_keys'));
|
Context::set('use_session_keys', Config::get('session.use_keys'));
|
||||||
|
|
@ -38,17 +38,17 @@ class Security extends Base
|
||||||
Context::set('use_cookies_ssl', Config::get('session.use_ssl_cookies'));
|
Context::set('use_cookies_ssl', Config::get('session.use_ssl_cookies'));
|
||||||
Context::set('check_csrf_token', Config::get('security.check_csrf_token'));
|
Context::set('check_csrf_token', Config::get('security.check_csrf_token'));
|
||||||
Context::set('use_nofollow', Config::get('security.nofollow'));
|
Context::set('use_nofollow', Config::get('security.nofollow'));
|
||||||
|
|
||||||
$this->setTemplateFile('config_security');
|
$this->setTemplateFile('config_security');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update security configuration.
|
* Update security configuration.
|
||||||
*/
|
*/
|
||||||
public function procAdminUpdateSecurity()
|
public function procAdminUpdateSecurity()
|
||||||
{
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
||||||
// Media Filter iframe/embed whitelist
|
// Media Filter iframe/embed whitelist
|
||||||
$whitelist = $vars->mediafilter_whitelist;
|
$whitelist = $vars->mediafilter_whitelist;
|
||||||
$whitelist = array_filter(array_map('trim', preg_split('/[\r\n]/', $whitelist)), function($item) {
|
$whitelist = array_filter(array_map('trim', preg_split('/[\r\n]/', $whitelist)), function($item) {
|
||||||
|
|
@ -61,7 +61,7 @@ class Security extends Base
|
||||||
Config::set('mediafilter.whitelist', array_values($whitelist));
|
Config::set('mediafilter.whitelist', array_values($whitelist));
|
||||||
Config::set('mediafilter.iframe', []);
|
Config::set('mediafilter.iframe', []);
|
||||||
Config::set('mediafilter.object', []);
|
Config::set('mediafilter.object', []);
|
||||||
|
|
||||||
// HTML classes
|
// HTML classes
|
||||||
$classes = $vars->mediafilter_classes;
|
$classes = $vars->mediafilter_classes;
|
||||||
$classes = array_filter(array_map('trim', preg_split('/[\r\n]/', $classes)), function($item) {
|
$classes = array_filter(array_map('trim', preg_split('/[\r\n]/', $classes)), function($item) {
|
||||||
|
|
@ -69,19 +69,19 @@ class Security extends Base
|
||||||
});
|
});
|
||||||
natcasesort($classes);
|
natcasesort($classes);
|
||||||
Config::set('mediafilter.classes', array_values($classes));
|
Config::set('mediafilter.classes', array_values($classes));
|
||||||
|
|
||||||
// Robot user agents
|
// Robot user agents
|
||||||
$robot_user_agents = $vars->robot_user_agents;
|
$robot_user_agents = $vars->robot_user_agents;
|
||||||
$robot_user_agents = array_filter(array_map('trim', preg_split('/[\r\n]/', $robot_user_agents)), function($item) {
|
$robot_user_agents = array_filter(array_map('trim', preg_split('/[\r\n]/', $robot_user_agents)), function($item) {
|
||||||
return $item !== '';
|
return $item !== '';
|
||||||
});
|
});
|
||||||
Config::set('security.robot_user_agents', array_values($robot_user_agents));
|
Config::set('security.robot_user_agents', array_values($robot_user_agents));
|
||||||
|
|
||||||
// Remove old embed filter
|
// Remove old embed filter
|
||||||
$config = Config::getAll();
|
$config = Config::getAll();
|
||||||
unset($config['embedfilter']);
|
unset($config['embedfilter']);
|
||||||
Config::setAll($config);
|
Config::setAll($config);
|
||||||
|
|
||||||
// Admin IP access control
|
// Admin IP access control
|
||||||
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_allowed_ip));
|
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_allowed_ip));
|
||||||
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
|
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
|
||||||
|
|
@ -90,7 +90,7 @@ class Security extends Base
|
||||||
if (!IpFilter::validateRanges($allowed_ip)) {
|
if (!IpFilter::validateRanges($allowed_ip)) {
|
||||||
throw new Exception('msg_invalid_ip');
|
throw new Exception('msg_invalid_ip');
|
||||||
}
|
}
|
||||||
|
|
||||||
$denied_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_denied_ip));
|
$denied_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_denied_ip));
|
||||||
$denied_ip = array_unique(array_filter($denied_ip, function($item) {
|
$denied_ip = array_unique(array_filter($denied_ip, function($item) {
|
||||||
return $item !== '';
|
return $item !== '';
|
||||||
|
|
@ -98,20 +98,20 @@ class Security extends Base
|
||||||
if (!IpFilter::validateRanges($denied_ip)) {
|
if (!IpFilter::validateRanges($denied_ip)) {
|
||||||
throw new Exception('msg_invalid_ip');
|
throw new Exception('msg_invalid_ip');
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMemberAdminModel = getAdminModel('member');
|
$oMemberAdminModel = getAdminModel('member');
|
||||||
if (!$oMemberAdminModel->getMemberAdminIPCheck($allowed_ip, $denied_ip))
|
if (!$oMemberAdminModel->getMemberAdminIPCheck($allowed_ip, $denied_ip))
|
||||||
{
|
{
|
||||||
throw new Exception('msg_current_ip_will_be_denied');
|
throw new Exception('msg_current_ip_will_be_denied');
|
||||||
}
|
}
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$vars->use_samesite = preg_replace('/[^a-zA-Z]/', '', $vars->use_samesite);
|
$vars->use_samesite = preg_replace('/[^a-zA-Z]/', '', $vars->use_samesite);
|
||||||
if ($vars->use_samesite === 'None' && ($vars->use_session_ssl !== 'Y' || $site_module_info->security !== 'always'))
|
if ($vars->use_samesite === 'None' && ($vars->use_session_ssl !== 'Y' || $site_module_info->security !== 'always'))
|
||||||
{
|
{
|
||||||
$vars->use_samesite = '';
|
$vars->use_samesite = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::set('admin.allow', array_values($allowed_ip));
|
Config::set('admin.allow', array_values($allowed_ip));
|
||||||
Config::set('admin.deny', array_values($denied_ip));
|
Config::set('admin.deny', array_values($denied_ip));
|
||||||
Config::set('session.samesite', $vars->use_samesite);
|
Config::set('session.samesite', $vars->use_samesite);
|
||||||
|
|
@ -120,13 +120,13 @@ class Security extends Base
|
||||||
Config::set('session.use_ssl_cookies', $vars->use_cookies_ssl === 'Y');
|
Config::set('session.use_ssl_cookies', $vars->use_cookies_ssl === 'Y');
|
||||||
Config::set('security.check_csrf_token', $vars->check_csrf_token === 'Y');
|
Config::set('security.check_csrf_token', $vars->check_csrf_token === 'Y');
|
||||||
Config::set('security.nofollow', $vars->use_nofollow === 'Y');
|
Config::set('security.nofollow', $vars->use_nofollow === 'Y');
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
if (!Config::save())
|
if (!Config::save())
|
||||||
{
|
{
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSecurity'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSecurity'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,31 +18,31 @@ class SiteLock extends Base
|
||||||
Context::set('sitelock_locked', Config::get('lock.locked'));
|
Context::set('sitelock_locked', Config::get('lock.locked'));
|
||||||
Context::set('sitelock_title', escape(Config::get('lock.title')));
|
Context::set('sitelock_title', escape(Config::get('lock.title')));
|
||||||
Context::set('sitelock_message', escape(Config::get('lock.message')));
|
Context::set('sitelock_message', escape(Config::get('lock.message')));
|
||||||
|
|
||||||
$allowed_ip = Config::get('lock.allow') ?: array();
|
$allowed_ip = Config::get('lock.allow') ?: array();
|
||||||
Context::set('sitelock_allowed_ip', implode(\PHP_EOL, $allowed_ip));
|
Context::set('sitelock_allowed_ip', implode(\PHP_EOL, $allowed_ip));
|
||||||
Context::set('remote_addr', \RX_CLIENT_IP);
|
Context::set('remote_addr', \RX_CLIENT_IP);
|
||||||
|
|
||||||
$this->setTemplateFile('config_sitelock');
|
$this->setTemplateFile('config_sitelock');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update sitelock configuration.
|
* Update sitelock configuration.
|
||||||
*/
|
*/
|
||||||
public function procAdminUpdateSitelock()
|
public function procAdminUpdateSitelock()
|
||||||
{
|
{
|
||||||
$vars = Context::gets('sitelock_locked', 'sitelock_allowed_ip', 'sitelock_title', 'sitelock_message');
|
$vars = Context::gets('sitelock_locked', 'sitelock_allowed_ip', 'sitelock_title', 'sitelock_message');
|
||||||
|
|
||||||
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->sitelock_allowed_ip));
|
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->sitelock_allowed_ip));
|
||||||
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
|
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
|
||||||
return $item !== '';
|
return $item !== '';
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (!IpFilter::validateRanges($allowed_ip))
|
if (!IpFilter::validateRanges($allowed_ip))
|
||||||
{
|
{
|
||||||
throw new Exception('msg_invalid_ip');
|
throw new Exception('msg_invalid_ip');
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::set('lock.locked', $vars->sitelock_locked === 'Y');
|
Config::set('lock.locked', $vars->sitelock_locked === 'Y');
|
||||||
Config::set('lock.title', trim($vars->sitelock_title));
|
Config::set('lock.title', trim($vars->sitelock_title));
|
||||||
Config::set('lock.message', trim($vars->sitelock_message));
|
Config::set('lock.message', trim($vars->sitelock_message));
|
||||||
|
|
@ -51,7 +51,7 @@ class SiteLock extends Base
|
||||||
{
|
{
|
||||||
throw new Exception('msg_failed_to_save_config');
|
throw new Exception('msg_failed_to_save_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSitelock'));
|
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSitelock'));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use ModuleModel;
|
||||||
class AdminMenu
|
class AdminMenu
|
||||||
{
|
{
|
||||||
public const ADMIN_MENU_NAME = '__ADMINMENU_V17__';
|
public const ADMIN_MENU_NAME = '__ADMINMENU_V17__';
|
||||||
|
|
||||||
public const DEFAULT_MENU_STRUCTURE = [
|
public const DEFAULT_MENU_STRUCTURE = [
|
||||||
'dashboard' => [],
|
'dashboard' => [],
|
||||||
'menu' => [
|
'menu' => [
|
||||||
|
|
@ -56,16 +56,16 @@ class AdminMenu
|
||||||
{
|
{
|
||||||
return self::ADMIN_MENU_NAME;
|
return self::ADMIN_MENU_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAdminMenuLang()
|
public static function getAdminMenuLang()
|
||||||
{
|
{
|
||||||
static $lang = null;
|
static $lang = null;
|
||||||
|
|
||||||
if ($lang === null)
|
if ($lang === null)
|
||||||
{
|
{
|
||||||
$lang = \Rhymix\Framework\Cache::get('admin_menu_langs:' . Context::getLangType());
|
$lang = \Rhymix\Framework\Cache::get('admin_menu_langs:' . Context::getLangType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($lang === null)
|
if ($lang === null)
|
||||||
{
|
{
|
||||||
$lang = [];
|
$lang = [];
|
||||||
|
|
@ -81,7 +81,7 @@ class AdminMenu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
\Rhymix\Framework\Cache::set('admin_menu_langs:' . Context::getLangType(), $lang, 0, true);
|
\Rhymix\Framework\Cache::set('admin_menu_langs:' . Context::getLangType(), $lang, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +94,7 @@ class AdminMenu
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMenuAdminModel = MenuAdminModel::getInstance();
|
$oMenuAdminModel = MenuAdminModel::getInstance();
|
||||||
$output = $oMenuAdminModel->getMenuByTitle(self::ADMIN_MENU_NAME);
|
$output = $oMenuAdminModel->getMenuByTitle(self::ADMIN_MENU_NAME);
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ class AdminMenu
|
||||||
$args->hover_btn = '';
|
$args->hover_btn = '';
|
||||||
$args->active_btn = '';
|
$args->active_btn = '';
|
||||||
$args->group_srls = $admin_group_srl;
|
$args->group_srls = $admin_group_srl;
|
||||||
|
|
||||||
$moduleActionInfo = array();
|
$moduleActionInfo = array();
|
||||||
foreach (self::DEFAULT_MENU_STRUCTURE as $key => $items)
|
foreach (self::DEFAULT_MENU_STRUCTURE as $key => $items)
|
||||||
{
|
{
|
||||||
|
|
@ -188,7 +188,7 @@ class AdminMenu
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($items as $item)
|
foreach ($items as $item)
|
||||||
{
|
{
|
||||||
list($module_name, $menu_name) = explode('.', $item);
|
list($module_name, $menu_name) = explode('.', $item);
|
||||||
|
|
@ -196,7 +196,7 @@ class AdminMenu
|
||||||
{
|
{
|
||||||
$moduleActionInfo[$module_name] = ModuleModel::getModuleActionXml($module_name);
|
$moduleActionInfo[$module_name] = ModuleModel::getModuleActionXml($module_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$args->menu_item_srl = getNextSequence();
|
$args->menu_item_srl = getNextSequence();
|
||||||
$args->parent_srl = $gnbDBList["'" . $key . "'"];
|
$args->parent_srl = $gnbDBList["'" . $key . "'"];
|
||||||
$args->name = '{$lang->menu_gnb_sub[\'' . $menu_name . '\']}';
|
$args->name = '{$lang->menu_gnb_sub[\'' . $menu_name . '\']}';
|
||||||
|
|
@ -216,7 +216,7 @@ class AdminMenu
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return parent old menu key by child menu
|
* Return parent old menu key by child menu
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected static function _getOldGnbKey($menuName)
|
protected static function _getOldGnbKey($menuName)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ class Favorite
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get admin favorite list
|
* Get admin favorite list
|
||||||
*
|
*
|
||||||
* @param bool $add_module_info
|
* @param bool $add_module_info
|
||||||
* @return BaseObject
|
* @return BaseObject
|
||||||
*/
|
*/
|
||||||
|
|
@ -44,7 +44,7 @@ class Favorite
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a module is already favorite
|
* Check if a module is already favorite
|
||||||
*
|
*
|
||||||
* @param string $module
|
* @param string $module
|
||||||
* @return BaseObject
|
* @return BaseObject
|
||||||
*/
|
*/
|
||||||
|
|
@ -71,7 +71,7 @@ class Favorite
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a favorite.
|
* Insert a favorite.
|
||||||
*
|
*
|
||||||
* @param string $module
|
* @param string $module
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return DBResultHelper
|
* @return DBResultHelper
|
||||||
|
|
@ -88,7 +88,7 @@ class Favorite
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a favorite.
|
* Delete a favorite.
|
||||||
*
|
*
|
||||||
* @param int $favorite_srl
|
* @param int $favorite_srl
|
||||||
* @return DBResultHelper
|
* @return DBResultHelper
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,7 +102,7 @@ class Favorite
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all favorites.
|
* Delete all favorites.
|
||||||
*
|
*
|
||||||
* @return DBResultHelper
|
* @return DBResultHelper
|
||||||
*/
|
*/
|
||||||
public static function deleteAllFavorites(): DBResultHelper
|
public static function deleteAllFavorites(): DBResultHelper
|
||||||
|
|
@ -114,7 +114,7 @@ class Favorite
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete all favorites that don't point to an existing module.
|
* Delete all favorites that don't point to an existing module.
|
||||||
*
|
*
|
||||||
* @return BaseObject
|
* @return BaseObject
|
||||||
*/
|
*/
|
||||||
public static function deleteInvalidFavorites(): BaseObject
|
public static function deleteInvalidFavorites(): BaseObject
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class Icon
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get favicon URL for a domain.
|
* Get favicon URL for a domain.
|
||||||
*
|
*
|
||||||
* @param int $domain_srl
|
* @param int $domain_srl
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
@ -19,7 +19,7 @@ class Icon
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get mobile icon URL for a domain.
|
* Get mobile icon URL for a domain.
|
||||||
*
|
*
|
||||||
* @param int $domain_srl
|
* @param int $domain_srl
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
@ -30,7 +30,7 @@ class Icon
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if an icon file exists, and if so, return its URL.
|
* Check if an icon file exists, and if so, return its URL.
|
||||||
*
|
*
|
||||||
* @param int $domain_srl
|
* @param int $domain_srl
|
||||||
* @param string $icon_name
|
* @param string $icon_name
|
||||||
* @return string
|
* @return string
|
||||||
|
|
@ -50,7 +50,7 @@ class Icon
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default image for a domain.
|
* Get the default image for a domain.
|
||||||
*
|
*
|
||||||
* @param int $domain_srl
|
* @param int $domain_srl
|
||||||
* @param int &$width
|
* @param int &$width
|
||||||
* @param int &$height
|
* @param int &$height
|
||||||
|
|
@ -74,7 +74,7 @@ class Icon
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save an icon for a domain.
|
* Save an icon for a domain.
|
||||||
*
|
*
|
||||||
* @param int $domain_srl
|
* @param int $domain_srl
|
||||||
* @param string $icon_name
|
* @param string $icon_name
|
||||||
* @param array $fileinfo
|
* @param array $fileinfo
|
||||||
|
|
@ -115,7 +115,7 @@ class Icon
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the default image for a domain.
|
* Save the default image for a domain.
|
||||||
*
|
*
|
||||||
* @param int $domain_srl
|
* @param int $domain_srl
|
||||||
* @param array $file_info
|
* @param array $file_info
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue