示例#1
0
 /**
  * @brief 설치가 이상이 없는지 체크하는 method
  **/
 function checkUpdate()
 {
     $db_info = Context::getDbInfo();
     // 카운터에 site_srl추가
     $oDB =& DB::getInstance();
     if (!$oDB->isColumnExists('counter_log', 'site_srl')) {
         return true;
     }
     if ($db_info->db_type == 'cubrid') {
         if (!$oDB->isIndexExists('counter_log', $oDB->prefix . 'counter_log_idx_site_counter_log')) {
             return true;
         }
     } else {
         if (!$oDB->isIndexExists('counter_log', 'idx_site_counter_log')) {
             return true;
         }
     }
     return false;
 }
 /**
  * @brief config 파일을 생성
  * 모든 설정이 이상없이 끝난 후에 config파일 생성
  **/
 function makeConfigFile()
 {
     $config_file = Context::getConfigFile();
     //if(file_exists($config_file)) return;
     $db_info = Context::getDbInfo();
     if (!$db_info) {
         return;
     }
     $buff = '<?php if(!defined("__ZBXE__")) exit();' . "\n";
     foreach ($db_info as $key => $val) {
         $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
     }
     $buff .= "?>";
     FileHandler::writeFile($config_file, $buff);
     if (@file_exists($config_file)) {
         return true;
     }
     return false;
 }
 /**
  * @brief Create config file
  * Create the config file when all settings are completed
  */
 function makeConfigFile()
 {
     try {
         $config_file = Context::getConfigFile();
         //if(file_exists($config_file)) return;
         $db_info = Context::getDbInfo();
         if (!$db_info) {
             return;
         }
         $buff = $this->_getDBConfigFileContents($db_info);
         FileHandler::writeFile($config_file, $buff);
         if (@file_exists($config_file)) {
             FileHandler::removeFile($this->db_tmp_config_file);
             FileHandler::removeFile($this->etc_tmp_config_file);
             return true;
         }
         return false;
     } catch (Exception $e) {
         return false;
     }
 }
示例#4
0
 function procAdminUpdateEmbedWhitelist()
 {
     $vars = Context::getRequestVars();
     $db_info = Context::getDbInfo();
     $white_object = $vars->embed_white_object;
     $white_object = preg_replace("/[\r\n|\r|\n]+/", '|@|', $white_object);
     $white_object = preg_replace("/[\\s\\'\"]+/", '', $white_object);
     $white_object = explode('|@|', $white_object);
     $white_object = array_unique($white_object);
     $white_iframe = $vars->embed_white_iframe;
     $white_iframe = preg_replace("/[\r\n|\r|\n]+/", '|@|', $white_iframe);
     $white_iframe = preg_replace("/[\\s\\'\"]+/", '', $white_iframe);
     $white_iframe = explode('|@|', $white_iframe);
     $white_iframe = array_unique($white_iframe);
     $whitelist = new stdClass();
     $whitelist->object = $white_object;
     $whitelist->iframe = $white_iframe;
     $db_info->embed_white_object = $white_object;
     $db_info->embed_white_iframe = $white_iframe;
     $oInstallController = getController('install');
     if (!$oInstallController->makeConfigFile()) {
         return new Object(-1, 'msg_invalid_request');
     }
     require_once _XE_PATH_ . 'classes/security/EmbedFilter.class.php';
     $oEmbedFilter = EmbedFilter::getInstance();
     $oEmbedFilter->_makeWhiteDomainList($whitelist);
     if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
         $returnUrl = Context::get('success_return_url');
         if (!$returnUrl) {
             $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
         }
         header('location:' . $returnUrl);
         return;
     }
 }
示例#5
0
 /**
  * @brief Get the secret key for this site
  * @return bool
  */
 public static function getSecretKey()
 {
     // If the secret key does not exist, the config file needs to be updated
     $db_info = Context::getDbInfo();
     if (!isset($db_info->secret_key)) {
         $db_info->secret_key = self::createSecureSalt(48, 'alnum');
         Context::setDBInfo($db_info);
         getController('install')->makeConfigFile();
     }
     return $db_info->secret_key;
 }