当前位置: 首页>>代码示例>>PHP>>正文


PHP Context::setDBInfo方法代码示例

本文整理汇总了PHP中Context::setDBInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::setDBInfo方法的具体用法?PHP Context::setDBInfo怎么用?PHP Context::setDBInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Context的用法示例。


在下文中一共展示了Context::setDBInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: procInstall

 /**
  * @brief 입력받은 정보로 설치를 함
  **/
 function procInstall()
 {
     // 설치가 되어 있는지에 대한 체크
     if (Context::isInstalled()) {
         return new Object(-1, 'msg_already_installed');
     }
     // 설치시 임시로 최고관리자로 지정
     $logged_info->is_admin = 'Y';
     $_SESSION['logged_info'] = $logged_info;
     Context::set('logged_info', $logged_info);
     // DB와 관련된 변수를 받음
     $db_info = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix', 'time_zone', 'use_rewrite');
     if ($db_info->use_rewrite != 'Y') {
         $db_info->use_rewrite = 'N';
     }
     if (!$db_info->default_url) {
         $db_info->default_url = Context::getRequestUri();
     }
     $db_info->lang_type = Context::getLangType();
     // DB의 타입과 정보를 등록
     Context::setDBInfo($db_info);
     // DB Instance 생성
     $oDB =& DB::getInstance();
     // DB접속이 가능한지 체크
     $output = $oDB->getError();
     if (!$oDB->isConnected()) {
         return $oDB->getError();
     }
     // firebird는 설치시에 트랜젝션을 사용하지 않음
     if ($db_info->db_type != "firebird") {
         $oDB->begin();
     }
     // 모든 모듈의 설치
     $this->installDownloadedModule();
     if ($db_info->db_type != "firebird") {
         $oDB->commit();
     }
     // config 파일 생성
     if (!$this->makeConfigFile()) {
         return new Object(-1, 'msg_install_failed');
     }
     // 설치 완료 메세지 출력
     $this->setMessage('msg_install_completed');
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:47,代码来源:install.controller.php

示例2: procInstallAdminSaveTimeZone

 /**
  * @brief Change settings
  **/
 function procInstallAdminSaveTimeZone()
 {
     $use_rewrite = Context::get('use_rewrite');
     if ($use_rewrite != 'Y') {
         $use_rewrite = 'N';
     }
     $use_sso = Context::get('use_sso');
     if ($use_sso != 'Y') {
         $use_sso = 'N';
     }
     $use_cdn = Context::get('use_cdn');
     if ($use_cdn != 'Y') {
         $use_cdn = 'N';
     }
     $time_zone = Context::get('time_zone');
     $qmail_compatibility = Context::get('qmail_compatibility');
     if ($qmail_compatibility != 'Y') {
         $qmail_compatibility = 'N';
     }
     $use_db_session = Context::get('use_db_session');
     if ($use_db_session != 'Y') {
         $use_db_session = 'N';
     }
     $use_ssl = Context::get('use_ssl');
     if (!$use_ssl) {
         $use_ssl = 'none';
     }
     $use_html5 = Context::get('use_html5');
     if (!$use_html5) {
         $use_html5 = 'N';
     }
     $http_port = Context::get('http_port');
     $https_port = Context::get('https_port');
     $use_mobile_view = Context::get('use_mobile_view');
     if ($use_mobile_view != 'Y') {
         $use_mobile_view = 'N';
     }
     $admin_ip_list = Context::get('admin_ip_list');
     $admin_ip_list = preg_replace("/[\r|\n|\r\n]+/", ",", $admin_ip_list);
     $admin_ip_list = preg_replace("/\\s+/", "", $admin_ip_list);
     if (preg_match('/(<\\?|<\\?php|\\?>)/xsm', $admin_ip_list)) {
         $admin_ip_list = '';
     }
     $db_info = Context::getDBInfo();
     $db_info->default_url = Context::get('default_url');
     if ($db_info->default_url && !preg_match('/^(http|https):\\/\\//i', $db_info->default_url)) {
         $db_info->default_url = 'http://' . $db_info->default_url;
     }
     $db_info->time_zone = $time_zone;
     $db_info->qmail_compatibility = $qmail_compatibility;
     $db_info->use_db_session = $use_db_session;
     $db_info->use_rewrite = $use_rewrite;
     $db_info->use_sso = $use_sso;
     $db_info->use_ssl = $use_ssl;
     $db_info->use_cdn = $use_cdn;
     $db_info->use_html5 = $use_html5;
     $db_info->use_mobile_view = $use_mobile_view;
     $db_info->admin_ip_list = $admin_ip_list;
     if ($http_port) {
         $db_info->http_port = (int) $http_port;
     } else {
         if ($db_info->http_port) {
             unset($db_info->http_port);
         }
     }
     if ($https_port) {
         $db_info->https_port = (int) $https_port;
     } else {
         if ($db_info->https_port) {
             unset($db_info->https_port);
         }
     }
     unset($db_info->lang_type);
     Context::setDBInfo($db_info);
     $oInstallController =& getController('install');
     $oInstallController->makeConfigFile();
     $site_args->site_srl = 0;
     $site_args->index_module_srl = Context::get('index_module_srl');
     $site_args->default_language = Context::get('change_lang_type');
     $site_args->domain = $db_info->default_url;
     $oModuleController =& getController('module');
     $oModuleController->updateSite($site_args);
     $this->setMessage('success_updated');
 }
开发者ID:relip,项目名称:xe-core,代码行数:87,代码来源:install.admin.controller.php

示例3: procInstall

 /**
  * @brief Install with received information
  */
 function procInstall()
 {
     // Check if it is already installed
     if (Context::isInstalled()) {
         return new Object(-1, 'msg_already_installed');
     }
     // Assign a temporary administrator when installing
     $logged_info = new stdClass();
     $logged_info->is_admin = 'Y';
     Context::set('logged_info', $logged_info);
     // check install config
     if (Context::get('install_config')) {
         $db_info = $this->_makeDbInfoByInstallConfig();
     } else {
         if (FileHandler::exists($this->db_tmp_config_file)) {
             include $this->db_tmp_config_file;
         }
         if (FileHandler::exists($this->etc_tmp_config_file)) {
             include $this->etc_tmp_config_file;
         }
     }
     // Set DB type and information
     Context::setDBInfo($db_info);
     // Create DB Instance
     $oDB =& DB::getInstance();
     // Check if available to connect to the DB
     if (!$oDB->isConnected()) {
         return $oDB->getError();
     }
     // Install all the modules
     try {
         $oDB->begin();
         $this->installDownloadedModule();
         $oDB->commit();
     } catch (Exception $e) {
         $oDB->rollback();
         return new Object(-1, $e->getMessage());
     }
     // Create a config file
     if (!$this->makeConfigFile()) {
         return new Object(-1, 'msg_install_failed');
     }
     // load script
     $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\\.php)$/');
     if (count($scripts) > 0) {
         sort($scripts);
         foreach ($scripts as $script) {
             $script_path = FileHandler::getRealPath('./modules/install/script/');
             $output = (include $script_path . $script);
         }
     }
     // save selected lang info
     $oInstallAdminController = getAdminController('install');
     $oInstallAdminController->saveLangSelected(array(Context::getLangType()));
     // Display a message that installation is completed
     $this->setMessage('msg_install_completed');
     unset($_SESSION['use_rewrite']);
     if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
         $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('');
         header('location:' . $returnUrl);
         return new Object();
     }
 }
开发者ID:rubythonode,项目名称:xe-core,代码行数:66,代码来源:install.controller.php

示例4: procInstallAdminSaveTimeZone

 /**
  * @brief 설정 변경
  **/
 function procInstallAdminSaveTimeZone()
 {
     $use_rewrite = Context::get('use_rewrite');
     if ($use_rewrite != 'Y') {
         $use_rewrite = 'N';
     }
     $use_optimizer = Context::get('use_optimizer');
     if ($use_optimizer != 'Y') {
         $use_optimizer = 'N';
     }
     $time_zone = Context::get('time_zone');
     $qmail_compatibility = Context::get('qmail_compatibility');
     if ($qmail_compatibility != 'Y') {
         $qmail_compatibility = 'N';
     }
     $use_db_session = Context::get('use_db_session');
     if ($use_db_session != 'Y') {
         $use_db_session = 'N';
     }
     $use_ssl = Context::get('use_ssl');
     if (!$use_ssl) {
         $use_ssl = 'none';
     }
     $http_port = Context::get('http_port');
     $https_port = Context::get('https_port');
     $db_info = Context::getDBInfo();
     $db_info->default_url = Context::get('default_url');
     if ($db_info->default_url && !preg_match('/^(http|https):\\/\\//i', $db_info->default_url)) {
         $db_info->default_url = 'http://' . $db_info->default_url;
     }
     $db_info->time_zone = $time_zone;
     $db_info->qmail_compatibility = $qmail_compatibility;
     $db_info->use_db_session = $use_db_session;
     $db_info->use_rewrite = $use_rewrite;
     $db_info->use_optimizer = $use_optimizer;
     $db_info->use_ssl = $use_ssl;
     if ($http_port) {
         $db_info->http_port = (int) $http_port;
     } else {
         if ($db_info->http_port) {
             unset($db_info->http_port);
         }
     }
     if ($https_port) {
         $db_info->https_port = (int) $https_port;
     } else {
         if ($db_info->https_port) {
             unset($db_info->https_port);
         }
     }
     unset($db_info->lang_type);
     Context::setDBInfo($db_info);
     $oInstallController =& getController('install');
     $oInstallController->makeConfigFile();
     $site_args->site_srl = 0;
     $site_args->index_module_srl = Context::get('index_module_srl');
     $site_args->default_language = Context::get('change_lang_type');
     $site_args->domain = $db_info->default_url;
     $oModuleController =& getController('module');
     $oModuleController->updateSite($site_args);
     $this->setMessage('success_updated');
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:65,代码来源:install.admin.controller.php

示例5: procInstallAdminConfig

 function procInstallAdminConfig()
 {
     $use_mobile_view = Context::get('use_mobile_view');
     if ($use_mobile_view != 'Y') {
         $use_mobile_view = 'N';
     }
     $time_zone = Context::get('time_zone');
     $db_info = Context::getDBInfo();
     $db_info->use_mobile_view = $use_mobile_view;
     $db_info->time_zone = $time_zone;
     unset($db_info->lang_type);
     Context::setDBInfo($db_info);
     $oInstallController = getController('install');
     if (!$oInstallController->makeConfigFile()) {
         return new Object(-1, 'msg_invalid_request');
     }
     $site_args = new stdClass();
     $site_args->site_srl = 0;
     $site_args->index_module_srl = Context::get('index_module_srl');
     //
     $site_args->default_language = Context::get('change_lang_type');
     //
     $oModuleController = getController('module');
     $oModuleController->updateSite($site_args);
     //언어 선택
     $selected_lang = Context::get('selected_lang');
     $this->saveLangSelected($selected_lang);
     //save icon images
     $deleteFavicon = Context::get('is_delete_favicon');
     $deleteMobicon = Context::get('is_delete_mobicon');
     $this->updateIcon('favicon.ico', $deleteFavicon);
     $this->updateIcon('mobicon.png', $deleteMobicon);
     //모듈 설정 저장(썸네일, 풋터스크립트)
     $config = new stdClass();
     $config->thumbnail_type = Context::get('thumbnail_type');
     $config->htmlFooter = Context::get('htmlFooter');
     $config->siteTitle = Context::get('site_title');
     $this->setModulesConfig($config);
     $this->setRedirectUrl(Context::get('error_return_url'));
 }
开发者ID:umjinsun12,项目名称:dngshin,代码行数:40,代码来源:install.admin.controller.php

示例6: getSecretKey

 /**
  * @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;
 }
开发者ID:ned3y2k,项目名称:xe-core,代码行数:15,代码来源:Password.class.php


注:本文中的Context::setDBInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。