function getSettings() { if (!is_array($this->config) || empty($this->config)) { if ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php')) { $included = (include_once MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'); } if (!$included || !is_array($this->config) || empty($this->config)) { include_once MODX_BASE_PATH . "/manager/processors/cache_sync.class.processor.php"; $cache = new synccache(); $cache->setCachepath(MODX_BASE_PATH . "/assets/cache/"); $cache->setReport(false); $rebuilt = $cache->buildCache($this); $included = false; if ($rebuilt && ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'))) { $included = (include MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'); } if (!$included) { $result = $this->db->query('SELECT setting_name, setting_value FROM ' . $this->getFullTableName('system_settings')); while ($row = $this->db->getRow($result, 'both')) { $this->config[$row[0]] = $row[1]; } } } // added for backwards compatibility - garry FS#104 $this->config['etomite_charset'] =& $this->config['modx_charset']; // store base_url and base_path inside config array $this->config['base_url'] = MODX_BASE_URL; $this->config['base_path'] = MODX_BASE_PATH; $this->config['site_url'] = MODX_SITE_URL; // load user setting if user is logged in $usrSettings = array(); if ($id = $this->getLoginUserID()) { $usrType = $this->getLoginUserType(); if (isset($usrType) && $usrType == 'manager') { $usrType = 'mgr'; } if ($usrType == 'mgr' && $this->isBackend()) { // invoke the OnBeforeManagerPageInit event, only if in backend $this->invokeEvent("OnBeforeManagerPageInit"); } if (isset($_SESSION[$usrType . 'UsrConfigSet'])) { $usrSettings =& $_SESSION[$usrType . 'UsrConfigSet']; } else { if ($usrType == 'web') { $query = $this->getFullTableName('web_user_settings') . ' WHERE webuser=\'' . $id . '\''; } else { $query = $this->getFullTableName('user_settings') . ' WHERE user=\'' . $id . '\''; } $result = $this->db->query('SELECT setting_name, setting_value FROM ' . $query); while ($row = $this->db->getRow($result, 'both')) { $usrSettings[$row[0]] = $row[1]; } if (isset($usrType)) { $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; } // store user settings in session } } if ($this->isFrontend() && ($mgrid = $this->getLoginUserID('mgr'))) { $musrSettings = array(); if (isset($_SESSION['mgrUsrConfigSet'])) { $musrSettings =& $_SESSION['mgrUsrConfigSet']; } else { $query = $this->getFullTableName('user_settings') . ' WHERE user=\'' . $mgrid . '\''; if ($result = $this->db->query('SELECT setting_name, setting_value FROM ' . $query)) { while ($row = $this->db->getRow($result, 'both')) { $usrSettings[$row[0]] = $row[1]; } $_SESSION['mgrUsrConfigSet'] = $musrSettings; // store user settings in session } } if (!empty($musrSettings)) { $usrSettings = array_merge($musrSettings, $usrSettings); } } $this->config = array_merge($this->config, $usrSettings); } }
/** * Get MODX settings including, but not limited to, the system_settings table */ function getSettings() { $tbl_system_settings = $this->getFullTableName('system_settings'); $tbl_web_user_settings = $this->getFullTableName('web_user_settings'); $tbl_user_settings = $this->getFullTableName('user_settings'); if (!is_array($this->config) || empty($this->config)) { if ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php')) { $included = (include_once MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'); } if (!$included || !is_array($this->config) || empty($this->config)) { include_once MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'; $cache = new synccache(); $cache->setCachepath(MODX_BASE_PATH . "assets/cache/"); $cache->setReport(false); $rebuilt = $cache->buildCache($this); $included = false; if ($rebuilt && ($included = file_exists(MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'))) { $included = (include MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'); } if (!$included) { $result = $this->db->select('setting_name, setting_value', $tbl_system_settings); while ($row = $this->db->getRow($result)) { $this->config[$row['setting_name']] = $row['setting_value']; } } } // added for backwards compatibility - garry FS#104 $this->config['etomite_charset'] =& $this->config['modx_charset']; // store base_url and base_path inside config array $this->config['base_url'] = MODX_BASE_URL; $this->config['base_path'] = MODX_BASE_PATH; $this->config['site_url'] = MODX_SITE_URL; $this->config['valid_hostnames'] = MODX_SITE_HOSTNAMES; $this->config['site_manager_url'] = MODX_MANAGER_URL; $this->config['site_manager_path'] = MODX_MANAGER_PATH; // load user setting if user is logged in $usrSettings = array(); if ($id = $this->getLoginUserID()) { $usrType = $this->getLoginUserType(); if (isset($usrType) && $usrType == 'manager') { $usrType = 'mgr'; } if ($usrType == 'mgr' && $this->isBackend()) { // invoke the OnBeforeManagerPageInit event, only if in backend $this->invokeEvent("OnBeforeManagerPageInit"); } if (isset($_SESSION[$usrType . 'UsrConfigSet'])) { $usrSettings =& $_SESSION[$usrType . 'UsrConfigSet']; } else { if ($usrType == 'web') { $from = $tbl_web_user_settings; $where = "webuser='******'"; } else { $from = $tbl_user_settings; $where = "user='******'"; } $result = $this->db->select('setting_name, setting_value', $from, $where); while ($row = $this->db->getRow($result)) { $usrSettings[$row['setting_name']] = $row['setting_value']; } if (isset($usrType)) { $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings; } // store user settings in session } } if ($this->isFrontend() && ($mgrid = $this->getLoginUserID('mgr'))) { $musrSettings = array(); if (isset($_SESSION['mgrUsrConfigSet'])) { $musrSettings =& $_SESSION['mgrUsrConfigSet']; } else { if ($result = $this->db->select('setting_name, setting_value', $tbl_user_settings, "user='******'")) { while ($row = $this->db->getRow($result)) { $musrSettings[$row['setting_name']] = $row['setting_value']; } $_SESSION['mgrUsrConfigSet'] = $musrSettings; // store user settings in session } } if (!empty($musrSettings)) { $usrSettings = array_merge($musrSettings, $usrSettings); } } $this->error_reporting = $this->config['error_reporting']; $this->config = array_merge($this->config, $usrSettings); $this->config['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $this->config['filemanager_path']); $this->config['rb_base_dir'] = str_replace('[(base_path)]', MODX_BASE_PATH, $this->config['rb_base_dir']); } }
function getSiteCache() { $cpath = MODX_BASE_PATH . 'assets/cache/siteCache.idx.php'; if (is_file($cpath)) { $included = (include_once $cpath); } if (!isset($included) || !$included) { include_once MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php'; $cache = new synccache(); $cache->setCachepath(MODX_BASE_PATH . 'assets/cache/'); $cache->setReport(false); $rebuilt = $cache->buildCache($this); if ($rebuilt && is_file($cpath)) { include_once $cpath; } } }