Remove trailing whitespace in admin module

This commit is contained in:
Kijin Sung 2023-01-17 20:59:21 +09:00
parent a9f72a5cd2
commit 1dca4adf42
21 changed files with 230 additions and 230 deletions

View file

@ -2,7 +2,7 @@
/**
* Preserved for backward compatibility
*
*
* @deprecated
*/
class AdminAdminController extends Admin
@ -20,7 +20,7 @@ class AdminAdminController extends Admin
/**
* Remove an icon.
*
*
* @deprecated
*/
public function procAdminRemoveIcons()
@ -39,7 +39,7 @@ class AdminAdminController extends Admin
/**
* Delete the admin logo.
*
*
* @deprecated
*/
public function procAdminDeleteLogo()
@ -82,7 +82,7 @@ class AdminAdminController extends Admin
{
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
}
public function procAdminRemoveFTPInfo()
{
throw new Rhymix\Framework\Exceptions\FeatureDisabled;

View file

@ -2,7 +2,7 @@
/**
* Preserved for backward compatibility
*
*
* @deprecated
*/
class AdminAdminModel extends Admin
@ -200,6 +200,6 @@ class AdminAdminModel extends Admin
public static function getThemeInfo($theme_name, $layout_list = [])
{
}
}

View file

@ -2,24 +2,24 @@
/**
* Preserved for backward compatibility
*
*
* @deprecated
*/
class AdminAdminView extends Admin
{
/**
* Make the admin menu.
*
*
* @deprecated
*/
public function makeGnbUrl($module = 'admin')
{
Rhymix\Modules\Admin\Controllers\Base::getInstance()->loadAdminMenu($module);
}
/**
* Display FTP Configuration(settings) page
*
*
* @deprecated
*/
public function dispAdminConfigFtp()

View file

@ -22,7 +22,7 @@ class AdminMenu extends Base
Context::set('menu_srl', $output->menu_srl);
Context::set('menu_title', $output->title);
$this->setTemplateFile('admin_setup');
}

View file

@ -14,7 +14,7 @@ class Base extends \ModuleObject
{
/**
* Initilization
*
*
* @return void
*/
public function init()
@ -39,16 +39,16 @@ class Base extends \ModuleObject
// Load the admin menu.
$this->loadAdminMenu();
}
/**
* check system configuration.
*
*
* @return void
*/
public function checkSystemConfiguration()
{
$changed = false;
// Check encryption keys.
if (config('crypto.encryption_key') === null)
{
@ -70,17 +70,17 @@ class Base extends \ModuleObject
config('file.folder_structure', 1);
$changed = true;
}
// Save new configuration.
if ($changed)
{
Config::save();
}
}
/**
* Load the admin menu.
*
*
* @return void
*/
public function loadAdminMenu($module = 'admin')
@ -113,7 +113,7 @@ class Base extends \ModuleObject
break;
}
}
// get current menu's srl(=parentSrl)
$parentSrl = 0;
foreach ((array)$menu->list as $parentKey => $parentMenu)
@ -140,27 +140,27 @@ class Base extends \ModuleObject
// Get list of favorite
$output = FavoriteModel::getFavorites(true);
Context::set('favorite_list', $output->get('favoriteList'));
Context::set('subMenuTitle', $subMenuTitle);
Context::set('gnbUrlList', $menu->list);
Context::set('parentSrl', $parentSrl);
Context::set('gnb_title_info', $gnbTitleInfo ?? null);
Context::addBrowserTitle($subMenuTitle ? $subMenuTitle : 'Dashboard');
}
/**
* Alias for backward compatibility.
*
*
* @deprecated
*/
public static function getAdminMenuName()
{
return AdminMenuModel::getAdminMenuName();
}
/**
* Alias for backward compatibility.
*
*
* @deprecated
*/
public static function getAdminMenuLang()

View file

@ -109,7 +109,7 @@ class Dashboard extends Base
}
}
}
// Retrieve the list of installed modules
$this->checkEasyInstall();
@ -117,7 +117,7 @@ class Dashboard extends Base
//$oAutoinstallAdminModel = getAdminModel('autoinstall');
//$needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList();
$needUpdateList = array();
// Check counter addon
$oAddonAdminModel = AddonAdminModel::getInstance();
$counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter');
@ -131,7 +131,7 @@ class Dashboard extends Base
Context::set('latestMemberList', $output->data);
unset($args, $output, $columnList);
}
// Check unnecessary files
$cleanup_list = Maintenance\Cleanup::getInstance()->checkFiles();
@ -159,10 +159,10 @@ class Dashboard extends Base
MemberController::getInstance()->procMemberLogout();
header('Location: ' . getNotEncodedUrl(''));
}
/**
* Check easy install.
*
*
* @return void
*/
public function checkEasyInstall()
@ -202,7 +202,7 @@ class Dashboard extends Base
/**
* Update the easy install flag file.
*
*
* @return void
*/
protected function _updateEasyInstallFlagFile()

View file

@ -20,14 +20,14 @@ class Design extends Base
/**
* Subroutine for the above.
*
*
* @param object $vars
* @return void
*/
public function updateDefaultDesignInfo(object $vars): void
{
$vars->module_skin = json_decode($vars->module_skin);
$siteDesignPath = \RX_BASEDIR . 'files/site_design/';
if (!is_dir($siteDesignPath))
{
@ -77,7 +77,7 @@ class Design extends Base
/**
* Subroutine for the above;
*
*
* @param object $designInfo
* @return void
*/

View file

@ -9,17 +9,17 @@ class Install extends Base
{
/**
* Install module
*
*
* @return void
*/
public function moduleInstall()
{
}
/**
* Check if update is necessary
*
*
* @return bool
*/
public function checkUpdate()
@ -35,7 +35,7 @@ class Install extends Base
/**
* Update module
*
*
* @return void
*/
public function moduleUpdate()

View file

@ -26,7 +26,7 @@ class ServerEnv extends Base
'widget' => array('content', 'counter_status', 'language_select', 'login_info', 'mcontent', 'pollWidget'),
'widgetstyle' => array('simple'),
);
// Basic environment
$info[] = '[Basic Information]';
$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[] = '';
// System settings
$info[] = '[System Settings]';
$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['use_sso'] = config('use_sso') ? 'true' : 'false';
$info[] = '';
// PHP settings
$ini_info = ini_get_all();
$info[] = '[PHP Settings]';
@ -104,7 +104,7 @@ class ServerEnv extends Base
}
natcasesort($info['extensions']);
$info[] = '';
// Modules
$info[] = '[Modules]';
$info['module'] = array();
@ -126,7 +126,7 @@ class ServerEnv extends Base
}
natcasesort($info['module']);
$info[] = '';
// Addons
$info[] = '[Addons]';
$info['addon'] = array();
@ -149,7 +149,7 @@ class ServerEnv extends Base
}
natcasesort($info['addon']);
$info[] = '';
// Layouts
$info[] = '[Layouts]';
$info['layout'] = array();
@ -172,7 +172,7 @@ class ServerEnv extends Base
}
natcasesort($info['layout']);
$info[] = '';
// Widgets
$info[] = '[Widgets]';
$info['widget'] = array();
@ -195,7 +195,7 @@ class ServerEnv extends Base
}
natcasesort($info['widget']);
$info[] = '';
// Widgetstyles
$info[] = '[Widgetstyles]';
$info['widgetstyle'] = array();
@ -219,7 +219,7 @@ class ServerEnv extends Base
natcasesort($info['widgetstyle']);
$info[] = '';
$str_info = '';
// Convert to string.
foreach ($info as $key => $value)
{
@ -227,7 +227,7 @@ class ServerEnv extends Base
{
$value = implode(', ', $value) ?: "no additional {$key}s";
}
if (is_int($key) || ctype_digit($key))
{
$str_info .= "$value\n";
@ -241,7 +241,7 @@ class ServerEnv extends Base
Context::set('str_info', $str_info);
$this->setTemplateFile('server_env.html');
}
/**
* Method to test if URL rewriting is properly configured in the web server.
*/
@ -251,7 +251,7 @@ class ServerEnv extends Base
Context::setResponseMethod('JSON');
$this->add('result', $test * 42);
}
/**
* Clear APCU cache.
*/
@ -266,7 +266,7 @@ class ServerEnv extends Base
return new BaseObject(-1, 'apcu_clear_cache_function_not_found');
}
}
/**
* Clear opcache.
*/

View file

@ -79,7 +79,7 @@ class CacheReset extends Base
$tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
$tmp_cache_prefix = \RX_BASEDIR . 'files/';
}
if($tmp_cache_list)
{
foreach($tmp_cache_list as $tmp_dir)
@ -91,7 +91,7 @@ class CacheReset extends Base
{
continue;
}
// If possible, use system command to speed up recursive deletion
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));
}
}
// If the directory still exists, delete using PHP.
Storage::deleteDirectory($tmp_dir);
}

View file

@ -19,11 +19,11 @@ class Cleanup extends Base
// Get the list of files to clean up.
$cleanup_list = $this->checkFiles();
Context::set('cleanup_list', $cleanup_list);
// Check previous errors.
Context::set('cleanup_errors', $_SESSION['admin_cleanup_errors'] ?? []);
unset($_SESSION['admin_cleanup_errors']);
// Set the template file.
$this->setTemplateFile('cleanup');
}
@ -39,7 +39,7 @@ class Cleanup extends Base
{
$this->setMessage('success_deleted');
}
// If there were errors, set information in session.
else
{
@ -47,14 +47,14 @@ class Cleanup extends Base
$this->setMessage('msg_cleanup_manually');
$_SESSION['admin_cleanup_errors'] = $result;
}
// Redirect to the list screen.
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminCleanupList'));
}
/**
* Check for files to clean up.
*
*
* @return array
*/
public function checkFiles(): array
@ -71,7 +71,7 @@ class Cleanup extends Base
{
continue;
}
// Check for case difference and moved target.
if ($reason === 'case')
{
@ -92,17 +92,17 @@ class Cleanup extends Base
$result[$name] = $reason;
}
}
ksort($result);
return $result;
}
/**
* Check if the filesystem is case-sensitive.
*
*
* 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.
*
*
* @return bool
*/
public function checkCaseSensitiveFilesystem(): bool
@ -113,7 +113,7 @@ class Cleanup extends Base
{
return $cache;
}
// Return default values for most common operating systems.
if (preg_match('/Linux/', \PHP_OS))
{
@ -123,29 +123,29 @@ class Cleanup extends Base
{
return $cache = false;
}
// Create two files that differ only in case, and check if they overwrite each other.
$file1 = \RX_BASEDIR . 'files/cache/caseTest.php';
$file2 = \RX_BASEDIR . 'files/cache/caseTEST.php';
Storage::write($file1, '#1:' . Security::getRandom(36) . \PHP_EOL);
Storage::write($file2, '#2:' . Security::getRandom(36) . \PHP_EOL);
$cache = (Storage::read($file1) !== Storage::read($file2));
// Clean up test files and return the result.
Storage::delete($file1);
Storage::delete($file2);
return $cache;
}
/**
* Delete files.
*
*
* If a name is given, only that file or directory 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,
* with reasons for each file.
*
*
* @param ?string $name
* @return array
*/
@ -168,12 +168,12 @@ class Cleanup extends Base
{
$list = $this->checkFiles();
}
if (!count($list))
{
throw new TargetNotFound('msg_cleanup_list_empty');
}
// Delete each file or directory.
$result = [];
foreach ($list as $name => $reason)
@ -187,7 +187,7 @@ class Cleanup extends Base
{
$success = Storage::delete($normalized_path);
}
if (!$success && Storage::exists($normalized_path))
{
if (!Storage::isWritable($normalized_path) || !Storage::isWritable(dirname($normalized_path)))
@ -204,15 +204,15 @@ class Cleanup extends Base
}
}
}
return $result;
}
/**
* List of files and directories to clean up.
*/
public const CLEANUP_LIST = [
// Unnecessary files in the root directory
'composer.json' => 'moved:common/composer.json',
'composer.lock' => 'moved:common/composer.lock',
@ -278,7 +278,7 @@ class Cleanup extends Base
'modules/spamfilter/ruleset/' => 'deleted',
'phpDoc/' => 'deleted:xe',
'tools/' => 'deleted:xe',
// Deleted lang.xml
'common/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/table.php' => 'case',
'modules/member/controllers/device.php' => 'case',
// Vendor directory
'vendor/' => 'moved:common/vendor/',
];

View file

@ -41,11 +41,11 @@ class Advanced extends Base
$cache_default_ttl = 86400;
$cache_servers = Config::get('cache');
}
Context::set('object_cache_types', $object_cache_types);
Context::set('object_cache_type', $object_cache_type);
Context::set('cache_default_ttl', $cache_default_ttl);
if ($cache_servers)
{
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('cache_truncate_method', Config::get('cache.truncate_method'));
// Thumbnail settings
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
@ -83,17 +83,17 @@ class Advanced extends Base
Context::set('thumbnail_target', 'none');
Context::set('thumbnail_type', 'fill');
}
// Default and enabled languages
Context::set('supported_lang', Lang::getSupportedList());
Context::set('default_lang', Config::get('locale.default_lang'));
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
Context::set('auto_select_lang', Config::get('locale.auto_select_lang'));
// Default time zone
Context::set('timezones', DateTime::getTimezoneList());
Context::set('selected_timezone', Config::get('locale.default_timezone'));
// Other settings
Context::set('use_rewrite', Router::getRewriteLevel());
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('use_server_push', Config::get('view.server_push'));
Context::set('use_gzip', Config::get('view.use_gzip'));
$this->setTemplateFile('config_advanced');
}
/**
* Update advanced configuration.
*/
public function procAdminUpdateAdvanced()
{
$vars = Context::getRequestVars();
// Object cache
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));
}
if ($vars->object_cache_type === 'redis')
{
$cache_servers[0] .= '#' . intval($vars->object_cache_dbnum);
@ -168,13 +168,13 @@ class Advanced extends Base
{
Config::set('cache', array());
}
// Cache truncate method
if (in_array($vars->cache_truncate_method, array('delete', 'empty')))
{
Config::set('cache.truncate_method', $vars->cache_truncate_method);
}
// Thumbnail settings
$oDocumentModel = getModel('document');
$document_config = $oDocumentModel->getDocumentConfig();
@ -183,7 +183,7 @@ class Advanced extends Base
$document_config->thumbnail_quality = intval($vars->thumbnail_quality) ?: 75;
$oModuleController = getController('module');
$oModuleController->insertModuleConfig('document', $document_config);
// Mobile view
Config::set('mobile.enabled', $vars->use_mobile_view === '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');
}
// Languages and time zone
$enabled_lang = $vars->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.auto_select_lang', $vars->auto_select_lang === 'Y');
Config::set('locale.default_timezone', $vars->default_timezone);
// Other settings
Config::set('url.rewrite', intval($vars->use_rewrite));
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.server_push', $vars->use_server_push === 'Y');
Config::set('view.use_gzip', $vars->use_gzip === 'Y');
// Save
if (!Config::save())
{
throw new Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigAdvanced'));
}

View file

@ -29,27 +29,27 @@ class Debug extends Base
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_write_error_log', Config::get('debug.write_error_log'));
// IP access control
$allowed_ip = Config::get('debug.allow');
Context::set('debug_allowed_ip', implode(PHP_EOL, $allowed_ip));
Context::set('remote_addr', RX_CLIENT_IP);
$this->setTemplateFile('config_debug');
}
/**
* Update debug configuration.
*/
public function procAdminUpdateDebug()
{
$vars = Context::getRequestVars();
// Save display type settings
$display_type = array_values(array_filter($vars->debug_display_type ?: [], function($str) {
return in_array($str, ['panel', 'comment', 'file']);
}));
// Debug settings
Config::set('debug.enabled', $vars->debug_enabled === 'Y');
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_full_stack', $vars->debug_query_full_stack === 'Y');
Config::set('debug.write_error_log', strval($vars->debug_write_error_log) ?: 'fatal');
// Debug content
$debug_content = array_values($vars->debug_display_content ?: array());
Config::set('debug.display_content', $debug_content);
// Log filename
$log_filename = strval($vars->debug_log_filename);
$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');
}
Config::set('debug.log_filename', $log_filename);
// IP access control
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->debug_allowed_ip));
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
@ -97,13 +97,13 @@ class Debug extends Base
throw new Exception('msg_invalid_ip');
}
Config::set('debug.allow', array_values($allowed_ip));
// Save
if (!Config::save())
{
throw new Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigDebug'));
}

View file

@ -29,7 +29,7 @@ class Domains extends Base
Context::set('domain_list', $domain_list);
Context::set('page_navigation', $domain_list->page_navigation);
Context::set('page', $page);
// Get index module info.
$module_list = array();
$oModuleModel = getModel('module');
@ -41,13 +41,13 @@ class Domains extends Base
}
}
Context::set('module_list', $module_list);
// Get language list.
Context::set('supported_lang', Lang::getSupportedList());
$this->setTemplateFile('config_domains');
}
/**
* Display domain edit screen
*/
@ -66,7 +66,7 @@ class Domains extends Base
}
Context::set('domain_info', $domain_info);
Context::set('domain_copy', false);
// Get modules.
if ($domain_info && $domain_info->index_module_srl)
{
@ -77,7 +77,7 @@ class Domains extends Base
$index_module_srl = '';
}
Context::set('index_module_srl', $index_module_srl);
// Get language list.
Context::set('supported_lang', Lang::getSupportedList());
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
@ -90,7 +90,7 @@ class Domains extends Base
$domain_lang = 'default';
}
Context::set('domain_lang', $domain_lang);
// Get timezone list.
Context::set('timezones', DateTime::getTimezoneList());
if ($domain_info && $domain_info->settings->timezone)
@ -102,7 +102,7 @@ class Domains extends Base
$domain_timezone = Config::get('locale.default_timezone');
}
Context::set('domain_timezone', $domain_timezone);
// Get favicon and images.
if ($domain_info)
{
@ -111,10 +111,10 @@ class Domains extends Base
Context::set('default_image_url', IconModel::getDefaultImageUrl($domain_info->domain_srl));
Context::set('color_scheme', $domain_info->settings->color_scheme ?? 'auto');
}
$this->setTemplateFile('config_domains_edit');
}
/**
* Display domain copy screen
*/
@ -127,13 +127,13 @@ class Domains extends Base
{
throw new Exception('msg_domain_not_found');
}
// Adjust some properties for copying.
$domain_info->domain_srl = null;
$domain_info->is_default_domain = 'N';
Context::set('domain_info', $domain_info);
Context::set('domain_copy', true);
// Get modules.
if ($domain_info && $domain_info->index_module_srl)
{
@ -144,7 +144,7 @@ class Domains extends Base
$index_module_srl = '';
}
Context::set('index_module_srl', $index_module_srl);
// Get language list.
Context::set('supported_lang', Lang::getSupportedList());
Context::set('enabled_lang', Config::get('locale.enabled_lang'));
@ -157,7 +157,7 @@ class Domains extends Base
$domain_lang = 'default';
}
Context::set('domain_lang', $domain_lang);
// Get timezone list.
Context::set('timezones', DateTime::getTimezoneList());
if ($domain_info && $domain_info->settings->timezone)
@ -169,7 +169,7 @@ class Domains extends Base
$domain_timezone = Config::get('locale.default_timezone');
}
Context::set('domain_timezone', $domain_timezone);
// Get favicon and images.
if ($domain_info)
{
@ -178,24 +178,24 @@ class Domains extends Base
Context::set('default_image_url', IconModel::getDefaultImageUrl($domain_info->domain_srl));
Context::set('color_scheme', $domain_info->settings->color_scheme ?? 'auto');
}
$this->setTemplateFile('config_domains_edit');
}
/**
* Update domains configuration.
*/
public function procAdminUpdateDomainConfig()
{
$vars = Context::getRequestVars();
// Validate the unregistered domain action.
$valid_actions = array('redirect_301', 'redirect_302', 'display', 'block');
if (!in_array($vars->unregistered_domain_action, $valid_actions))
{
$vars->unregistered_domain_action = 'redirect_301';
}
// Save system config.
Config::set('url.unregistered_domain_action', $vars->unregistered_domain_action);
Config::set('use_sso', $vars->use_sso === 'Y');
@ -203,11 +203,11 @@ class Domains extends Base
{
throw new Exception('msg_failed_to_save_config');
}
$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.
*/
@ -224,7 +224,7 @@ class Domains extends Base
throw new Exception('msg_domain_not_found');
}
}
// Copying?
$copy_domain_srl = intval($vars->copy_domain_srl);
if (!$domain_info && $copy_domain_srl > -1)
@ -239,7 +239,7 @@ class Domains extends Base
{
$copy_domain_info = null;
}
// Validate the title and subtitle.
$vars->title = utf8_trim($vars->title);
$vars->subtitle = utf8_trim($vars->subtitle);
@ -247,7 +247,7 @@ class Domains extends Base
{
throw new Exception('msg_site_title_is_empty');
}
// Validate the domain.
if (!preg_match('@^https?://@', $vars->domain))
{
@ -270,7 +270,7 @@ class Domains extends Base
{
throw new Exception('msg_domain_already_exists');
}
// Validate the ports.
if ($vars->http_port == 80 || !$vars->http_port)
{
@ -288,21 +288,21 @@ class Domains extends Base
{
throw new Exception('msg_invalid_https_port');
}
// Validate the security setting.
$valid_security_options = array('none', 'optional', 'always');
if (!in_array($vars->domain_security, $valid_security_options))
{
$vars->domain_security = 'none';
}
// Validate the index module setting.
$module_info = getModel('module')->getModuleInfoByModuleSrl(intval($vars->index_module_srl));
if (!$module_info || $module_info->module_srl != $vars->index_module_srl)
{
throw new Exception('msg_invalid_index_module_srl');
}
// Validate the index document setting.
if ($vars->index_document_srl)
{
@ -320,36 +320,36 @@ class Domains extends Base
{
$vars->index_document_srl = 0;
}
// Validate the default language.
$enabled_lang = Config::get('locale.enabled_lang');
if ($vars->default_lang !== 'default' && !in_array($vars->default_lang, $enabled_lang))
{
throw new Exception('msg_lang_is_not_enabled');
}
// Validate the default time zone.
$timezone_list = DateTime::getTimezoneList();
if ($vars->default_timezone !== 'default' && !isset($timezone_list[$vars->default_timezone]))
{
throw new Exception('msg_invalid_timezone');
}
// Clean up the meta keywords and description.
$vars->meta_keywords = utf8_trim($vars->meta_keywords);
$vars->meta_description = utf8_trim($vars->meta_description);
// Clean up the header and footer scripts.
$vars->html_header = utf8_trim($vars->html_header);
$vars->html_footer = utf8_trim($vars->html_footer);
// Validate the color scheme setting.
$valid_color_scheme_options = array('auto', 'light', 'dark');
if (!in_array($vars->color_scheme, $valid_color_scheme_options))
{
$vars->color_scheme = 'auto';
}
// Merge all settings into an array.
$settings = array(
'title' => $vars->title,
@ -362,11 +362,11 @@ class Domains extends Base
'html_footer' => $vars->html_footer,
'color_scheme' => $vars->color_scheme
);
// Get the DB object and begin a transaction.
$oDB = DB::getInstance();
$oDB->begin();
// Insert or update the domain.
if (!$domain_info)
{
@ -408,7 +408,7 @@ class Domains extends Base
return $output;
}
}
// If changing the default domain, set all other domains as non-default.
if ($vars->is_default_domain === 'Y')
{
@ -420,7 +420,7 @@ class Domains extends Base
return $output;
}
}
// Save or copy the favicon.
if ($vars->delete_favicon)
{
@ -436,7 +436,7 @@ class Domains extends Base
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'favicon.ico';
Storage::copy($source_filename, $target_filename);
}
// Save or copy the mobile icon.
if ($vars->delete_mobicon)
{
@ -452,7 +452,7 @@ class Domains extends Base
$target_filename = \RX_BASEDIR . 'files/attach/xeicon/' . $domain_srl . '/' . 'mobicon.png';
Storage::copy($source_filename, $target_filename);
}
// Save or copy the site default image.
if ($vars->delete_default_image)
{
@ -485,7 +485,7 @@ class Domains extends Base
}
}
}
// Update system configuration to match the default domain.
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');
}
}
// Commit.
$oDB->commit();
// Clear cache.
Cache::clearGroup('site_and_module');
// Redirect to the domain list.
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigGeneral'));
}
/**
* Delete a domain.
*/
@ -533,7 +533,7 @@ class Domains extends Base
{
throw new Exception('msg_cannot_delete_default_domain');
}
// Delete the domain.
$args = new \stdClass;
$args->domain_srl = $domain_srl;
@ -542,12 +542,12 @@ class Domains extends Base
{
return $output;
}
// Delete icons and default image for the domain.
IconModel::deleteIcon($domain_srl, 'favicon.ico');
IconModel::deleteIcon($domain_srl, 'mobicon.png');
IconModel::deleteDefaultImage($domain_srl);
// Clear cache.
Cache::clearGroup('site_and_module');
}

View file

@ -21,21 +21,21 @@ class Notification extends Base
{
// Load advanced mailer module (for lang).
$oAdvancedMailerAdminView = \Advanced_mailerAdminView::getInstance();
// Load advanced mailer config.
$advanced_mailer_config = $oAdvancedMailerAdminView->getConfig();
Context::set('advanced_mailer_config', $advanced_mailer_config);
// Load member config.
$member_config = ModuleModel::getModuleConfig('member');
Context::set('member_config', $member_config);
Context::set('webmaster_name', !empty($member_config->webmaster_name) ? $member_config->webmaster_name : 'webmaster');
Context::set('webmaster_email', $member_config->webmaster_email ?? '');
// Load module config.
$module_config = ModuleModel::getModuleConfig('module');
Context::set('module_config', $module_config);
// Load mail drivers.
$mail_drivers = Mail::getSupportedDrivers();
uasort($mail_drivers, function($a, $b) {
@ -45,7 +45,7 @@ class Notification extends Base
});
Context::set('mail_drivers', $mail_drivers);
Context::set('mail_driver', config('mail.type') ?: 'mailfunction');
// Load SMS drivers.
$sms_drivers = SMS::getSupportedDrivers();
uasort($sms_drivers, function($a, $b) {
@ -55,7 +55,7 @@ class Notification extends Base
});
Context::set('sms_drivers', $sms_drivers);
Context::set('sms_driver', config('sms.type') ?: 'dummy');
// Load Push drivers.
$push_drivers = Push::getSupportedDrivers();
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);
}
Context::set('apns_certificate', $apns_certificate);
// Workaround for compatibility with older version of Amazon SES driver.
config('mail.ses.api_key', config('mail.ses.api_user'));
config('mail.ses.api_secret', config('mail.ses.api_pass'));
$this->setTemplateFile('config_notification');
}
/**
* Update notification configuration.
*/
public function procAdminUpdateNotification()
{
$vars = Context::getRequestVars();
// Load advanced mailer module (for lang).
$oAdvancedMailerAdminView = \Advanced_mailerAdminView::getInstance();
// Validate the mail sender's information.
if (!$vars->mail_default_name)
{
@ -102,7 +102,7 @@ class Notification extends Base
{
throw new Exception('msg_advanced_mailer_reply_to_is_invalid');
}
// Validate the mail driver.
$mail_drivers = Mail::getSupportedDrivers();
$mail_driver = $vars->mail_driver;
@ -110,7 +110,7 @@ class Notification extends Base
{
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
}
// Validate the mail driver settings.
$mail_driver_config = array();
foreach ($mail_drivers[$mail_driver]['required'] as $conf_name)
@ -122,7 +122,7 @@ class Notification extends Base
}
$mail_driver_config[$conf_name] = $conf_value;
}
// Validate the SMS driver.
$sms_drivers = SMS::getSupportedDrivers();
$sms_driver = $vars->sms_driver;
@ -130,7 +130,7 @@ class Notification extends Base
{
throw new Exception('msg_advanced_mailer_sending_method_is_invalid');
}
// Validate the SMS driver settings.
$sms_driver_config = array();
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;
$sms_driver_config[$conf_name] = $conf_value;
}
// Validate the selected Push drivers.
$push_config = array('types' => array());
$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');
}
}
// Validate the Push driver settings.
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');
}
$push_config[$driver_name][$conf_name] = $conf_value;
// Save certificates in a separate file and only store the filename in config.php.
if ($conf_name === 'certificate')
{
@ -185,7 +185,7 @@ class Notification extends Base
{
$filename = './files/config/' . $driver_name . '/cert-' . \Rhymix\Framework\Security::getRandom(32) . '.pem';
}
if ($conf_value !== null)
{
Storage::write($filename, $conf_value);
@ -203,7 +203,7 @@ class Notification extends Base
$push_config[$driver_name][$conf_name] = $conf_value;
}
}
// Save advanced mailer config.
getController('module')->updateModuleConfig('advanced_mailer', (object)array(
'sender_name' => trim($vars->mail_default_name),
@ -211,13 +211,13 @@ class Notification extends Base
'force_sender' => toBool($vars->mail_force_default_sender),
'reply_to' => trim($vars->mail_default_reply_to),
));
// Save member config.
getController('module')->updateModuleConfig('member', (object)array(
'webmaster_name' => trim($vars->mail_default_name),
'webmaster_email' => trim($vars->mail_default_from),
));
// Save system config.
Config::set("mail.default_name", trim($vars->mail_default_name));
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');
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigNotification'));
}

View file

@ -20,12 +20,12 @@ class SEO extends Base
$config = ModuleModel::getModuleConfig('module');
Context::set('site_meta_keywords', escape($config->meta_keywords ?? ''));
Context::set('site_meta_description', escape($config->meta_description ?? ''));
// Titles
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_document_title', escape(Config::get('seo.document_title') ?: '$SITE_TITLE - $DOCUMENT_TITLE'));
// OpenGraph metadata
Context::set('og_enabled', Config::get('seo.og_enabled'));
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_timestamps', Config::get('seo.og_use_timestamps'));
Context::set('twitter_enabled', Config::get('seo.twitter_enabled'));
$this->setTemplateFile('config_seo');
}
@ -44,17 +44,17 @@ class SEO extends Base
public function procAdminUpdateSEO()
{
$vars = Context::getRequestVars();
$args = new \stdClass;
$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));
$oModuleController = ModuleController::getInstance();
$oModuleController->updateModuleConfig('module', $args);
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.document_title', trim(utf8_normalize_spaces($vars->seo_document_title)));
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_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_timestamps', $vars->og_use_timestamps === 'Y');
Config::set('seo.twitter_enabled', $vars->twitter_enabled === 'Y');
// Save
if (!Config::save())
{
throw new Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSEO'));
}

View file

@ -19,18 +19,18 @@ class Security extends Base
// Load embed filter.
context::set('mediafilter_whitelist', implode(PHP_EOL, MediaFilter::getWhitelist()));
context::set('mediafilter_classes', implode(PHP_EOL, Config::get('mediafilter.classes') ?: array()));
// Load robot user agents.
$robot_user_agents = Config::get('security.robot_user_agents') ?: array();
Context::set('robot_user_agents', implode(PHP_EOL, $robot_user_agents));
// Admin IP access control
$allowed_ip = Config::get('admin.allow');
Context::set('admin_allowed_ip', implode(PHP_EOL, $allowed_ip));
$denied_ip = Config::get('admin.deny');
Context::set('admin_denied_ip', implode(PHP_EOL, $denied_ip));
Context::set('remote_addr', RX_CLIENT_IP);
// Session and cookie security settings
Context::set('use_samesite', Config::get('session.samesite'));
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('check_csrf_token', Config::get('security.check_csrf_token'));
Context::set('use_nofollow', Config::get('security.nofollow'));
$this->setTemplateFile('config_security');
}
/**
* Update security configuration.
*/
public function procAdminUpdateSecurity()
{
$vars = Context::getRequestVars();
// Media Filter iframe/embed whitelist
$whitelist = $vars->mediafilter_whitelist;
$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.iframe', []);
Config::set('mediafilter.object', []);
// HTML classes
$classes = $vars->mediafilter_classes;
$classes = array_filter(array_map('trim', preg_split('/[\r\n]/', $classes)), function($item) {
@ -69,19 +69,19 @@ class Security extends Base
});
natcasesort($classes);
Config::set('mediafilter.classes', array_values($classes));
// 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) {
return $item !== '';
});
Config::set('security.robot_user_agents', array_values($robot_user_agents));
// Remove old embed filter
$config = Config::getAll();
unset($config['embedfilter']);
Config::setAll($config);
// Admin IP access control
$allowed_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_allowed_ip));
$allowed_ip = array_unique(array_filter($allowed_ip, function($item) {
@ -90,7 +90,7 @@ class Security extends Base
if (!IpFilter::validateRanges($allowed_ip)) {
throw new Exception('msg_invalid_ip');
}
$denied_ip = array_map('trim', preg_split('/[\r\n]/', $vars->admin_denied_ip));
$denied_ip = array_unique(array_filter($denied_ip, function($item) {
return $item !== '';
@ -98,20 +98,20 @@ class Security extends Base
if (!IpFilter::validateRanges($denied_ip)) {
throw new Exception('msg_invalid_ip');
}
$oMemberAdminModel = getAdminModel('member');
if (!$oMemberAdminModel->getMemberAdminIPCheck($allowed_ip, $denied_ip))
{
throw new Exception('msg_current_ip_will_be_denied');
}
$site_module_info = Context::get('site_module_info');
$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'))
{
$vars->use_samesite = '';
}
Config::set('admin.allow', array_values($allowed_ip));
Config::set('admin.deny', array_values($denied_ip));
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('security.check_csrf_token', $vars->check_csrf_token === 'Y');
Config::set('security.nofollow', $vars->use_nofollow === 'Y');
// Save
if (!Config::save())
{
throw new Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSecurity'));
}

View file

@ -18,31 +18,31 @@ class SiteLock extends Base
Context::set('sitelock_locked', Config::get('lock.locked'));
Context::set('sitelock_title', escape(Config::get('lock.title')));
Context::set('sitelock_message', escape(Config::get('lock.message')));
$allowed_ip = Config::get('lock.allow') ?: array();
Context::set('sitelock_allowed_ip', implode(\PHP_EOL, $allowed_ip));
Context::set('remote_addr', \RX_CLIENT_IP);
$this->setTemplateFile('config_sitelock');
}
/**
* Update sitelock configuration.
*/
public function procAdminUpdateSitelock()
{
$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_unique(array_filter($allowed_ip, function($item) {
return $item !== '';
}));
if (!IpFilter::validateRanges($allowed_ip))
{
throw new Exception('msg_invalid_ip');
}
Config::set('lock.locked', $vars->sitelock_locked === 'Y');
Config::set('lock.title', trim($vars->sitelock_title));
Config::set('lock.message', trim($vars->sitelock_message));
@ -51,7 +51,7 @@ class SiteLock extends Base
{
throw new Exception('msg_failed_to_save_config');
}
$this->setMessage('success_updated');
$this->setRedirectUrl(Context::get('success_return_url') ?: getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigSitelock'));
}

View file

@ -11,7 +11,7 @@ use ModuleModel;
class AdminMenu
{
public const ADMIN_MENU_NAME = '__ADMINMENU_V17__';
public const DEFAULT_MENU_STRUCTURE = [
'dashboard' => [],
'menu' => [
@ -56,16 +56,16 @@ class AdminMenu
{
return self::ADMIN_MENU_NAME;
}
public static function getAdminMenuLang()
{
static $lang = null;
if ($lang === null)
{
$lang = \Rhymix\Framework\Cache::get('admin_menu_langs:' . Context::getLangType());
}
if ($lang === null)
{
$lang = [];
@ -81,7 +81,7 @@ class AdminMenu
}
}
}
\Rhymix\Framework\Cache::set('admin_menu_langs:' . Context::getLangType(), $lang, 0, true);
}
@ -94,7 +94,7 @@ class AdminMenu
{
return;
}
$oMenuAdminModel = MenuAdminModel::getInstance();
$output = $oMenuAdminModel->getMenuByTitle(self::ADMIN_MENU_NAME);
@ -180,7 +180,7 @@ class AdminMenu
$args->hover_btn = '';
$args->active_btn = '';
$args->group_srls = $admin_group_srl;
$moduleActionInfo = array();
foreach (self::DEFAULT_MENU_STRUCTURE as $key => $items)
{
@ -188,7 +188,7 @@ class AdminMenu
{
continue;
}
foreach ($items as $item)
{
list($module_name, $menu_name) = explode('.', $item);
@ -196,7 +196,7 @@ class AdminMenu
{
$moduleActionInfo[$module_name] = ModuleModel::getModuleActionXml($module_name);
}
$args->menu_item_srl = getNextSequence();
$args->parent_srl = $gnbDBList["'" . $key . "'"];
$args->name = '{$lang->menu_gnb_sub[\'' . $menu_name . '\']}';
@ -216,7 +216,7 @@ class AdminMenu
/**
* Return parent old menu key by child menu
*
*
* @return string
*/
protected static function _getOldGnbKey($menuName)

View file

@ -11,7 +11,7 @@ class Favorite
{
/**
* Get admin favorite list
*
*
* @param bool $add_module_info
* @return BaseObject
*/
@ -44,7 +44,7 @@ class Favorite
/**
* Check if a module is already favorite
*
*
* @param string $module
* @return BaseObject
*/
@ -71,7 +71,7 @@ class Favorite
/**
* Insert a favorite.
*
*
* @param string $module
* @param string $type
* @return DBResultHelper
@ -88,7 +88,7 @@ class Favorite
/**
* Delete a favorite.
*
*
* @param int $favorite_srl
* @return DBResultHelper
*/
@ -102,7 +102,7 @@ class Favorite
/**
* Delete all favorites.
*
*
* @return DBResultHelper
*/
public static function deleteAllFavorites(): DBResultHelper
@ -114,7 +114,7 @@ class Favorite
/**
* Delete all favorites that don't point to an existing module.
*
*
* @return BaseObject
*/
public static function deleteInvalidFavorites(): BaseObject

View file

@ -8,7 +8,7 @@ class Icon
{
/**
* Get favicon URL for a domain.
*
*
* @param int $domain_srl
* @return string
*/
@ -19,7 +19,7 @@ class Icon
/**
* Get mobile icon URL for a domain.
*
*
* @param int $domain_srl
* @return string
*/
@ -30,7 +30,7 @@ class Icon
/**
* Check if an icon file exists, and if so, return its URL.
*
*
* @param int $domain_srl
* @param string $icon_name
* @return string
@ -50,7 +50,7 @@ class Icon
/**
* Get the default image for a domain.
*
*
* @param int $domain_srl
* @param int &$width
* @param int &$height
@ -74,7 +74,7 @@ class Icon
/**
* Save an icon for a domain.
*
*
* @param int $domain_srl
* @param string $icon_name
* @param array $fileinfo
@ -115,7 +115,7 @@ class Icon
/**
* Save the default image for a domain.
*
*
* @param int $domain_srl
* @param array $file_info
* @return bool