| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- global $app;
- helper::import($app->getModulePath('', 'common') . 'model.php');
- class extcommonModel extends commonModel
- {
- public static function getLicensePropertyValue($propertyName)
- {
- return (new self)->loadExtension('xuanxuan')->getLicensePropertyValue($propertyName);
- }
- public static function ilMethod($module, $method, $extra = '')
- {
- return (new self)->loadExtension('xuanxuan')->ilMethod($module, $method, $extra);
- }
- public function isOpenMethod($module, $method)
- {
- if(defined('RUN_MODE') && RUN_MODE == 'xuanxuan' && !empty($this->config->xuanxuan->enabledMethods[$module][$method])) return true;
- if($module == 'entry' and $method == 'visit') return true;
- if($module == 'integration' and $method == 'wopi') return true;
- if($module == 'im' and $method == 'authorize') return true;
- if(in_array("$module.$method", $this->config->openMethods)) return true;
- if($this->loadModel('user')->isLogon() or ($this->app->company->guest and $this->app->user->account == 'guest'))
- {
- if(in_array("$module.$method", $this->config->logonMethods)) return true;
- if(stripos($method, 'ajax') !== false) return true;
- if($module == 'block' && stripos(',dashboard,printblock,create,edit,delete,close,reset,layout,', ",{$method},") !== false) return true;
- if($module == 'index' and $method == 'app') return true;
- if($module == 'my' and $method == 'guidechangetheme') return true;
- if($module == 'product' and $method == 'showerrornone') return true;
- if($module == 'misc' and in_array($method, array('downloadclient', 'changelog'))) return true;
- if($module == 'tutorial' and in_array($method, array('start', 'index', 'quit', 'wizard'))) return true;
- }
- return false;
- }
- public function loadConfigFromDB()
- {
- if($this->app->isServing() || (defined('RUN_MODE') && RUN_MODE == 'api'))
- {
- $this->loadModel('setting');
- $xxItems = $this->setting->getItems('owner=system&module=common§ion=xuanxuan');
- $xxConfig = array();
- foreach($xxItems as $xxItem) $xxConfig[$xxItem->key] = $xxItem->value;
- if(empty($xxConfig['key']))
- {
- $this->setting->setItem('system.common.xuanxuan.turnon', '0');
- $this->setting->setItem('system.common.xuanxuan.key', $this->setting->computeSN());
- }
- if(!isset($xxConfig['chatPort'])) $this->setting->setItem('system.common.xuanxuan.chatPort', '11444');
- if(!isset($xxConfig['commonPort'])) $this->setting->setItem('system.common.xuanxuan.commonPort', '11443');
- if(!isset($xxConfig['ip'])) $this->setting->setItem('system.common.xuanxuan.ip', '0.0.0.0');
- if(!isset($xxConfig['uploadFileSize'])) $this->setting->setItem('system.common.xuanxuan.uploadFileSize', '20');
- if(!isset($xxConfig['https']) and !isset($xxConfig['isHttps'])) $this->setting->setItem('system.common.xuanxuan.https', 'off');
- }
- /* Get configs of system and current user. */
- $account = isset($this->app->user->account) ? $this->app->user->account : '';
- if($this->config->db->name) $config = $this->loadModel('setting')->getSysAndPersonalConfig($account);
- $this->config->systemDB = isset($config['system']) ? $config['system'] : array();
- $this->config->personalDB = isset($config[$account]) ? $config[$account] : array();
- /* Web root cannot be changed by api request. */
- if(!$this->app->apiVersion)
- {
- $this->commonTao->updateDBWebRoot($this->config->systemDB);
- }
- /* Override the items defined in config/config.php and config/my.php. */
- if(isset($this->config->systemDB->common)) $this->app->mergeConfig($this->config->systemDB->common, 'common');
- if(isset($this->config->personalDB->common)) $this->app->mergeConfig($this->config->personalDB->common, 'common');
- $this->config->disabledFeatures = $this->config->disabledFeatures . ',' . $this->config->closedFeatures;
- /* Sanplex hide features. */
- $this->app->loadConfig('common');
- if(!empty($this->config->hiddenFeature)) $this->config->disabledFeatures .= ',' . implode(',', $this->config->hiddenFeature);
- }
- //**//
- }
|