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


PHP Context::getDBType方法代码示例

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


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

示例1: getExpression

 /**
  * Return column expression, ex) column = column + 1
  * @return string
  */
 function getExpression()
 {
     $db_type = Context::getDBType();
     if ($db_type == 'cubrid') {
         return "INCR({$this->column_name})";
     } else {
         return "{$this->column_name}";
     }
 }
开发者ID:kimkucheol,项目名称:xe-core,代码行数:13,代码来源:ClickCountExpression.class.php

示例2: getTableString

 function getTableString()
 {
     $dbParser = DB::getParser();
     $dbType = ucfirst(Context::getDBType());
     $result = sprintf('new %sTableWithHint(\'%s\'%s, array(', $dbType == 'Mysqli' ? 'Mysql' : $dbType, $dbParser->escape($this->name), $this->alias ? ', \'' . $dbParser->escape($this->alias) . '\'' : ', null');
     foreach ($this->index as $indx) {
         $result .= "new IndexHint(";
         $result .= '\'' . $dbParser->escape($indx->name) . '\', \'' . $indx->type . '\'' . ') , ';
     }
     $result = substr($result, 0, -2);
     $result .= '))';
     return $result;
 }
开发者ID:item4,项目名称:XE4KAIST,代码行数:13,代码来源:HintTableTag.class.php

示例3: Object

 /**
  * @brief DB를 상속받는 특정 db type의 instance를 생성 후 return
  **/
 function &getInstance($db_type = NULL)
 {
     if (!$db_type) {
         $db_type = Context::getDBType();
     }
     if (!$db_type && Context::isInstalled()) {
         return new Object(-1, 'msg_db_not_setted');
     }
     if (!$GLOBALS['__DB__']) {
         $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1)));
         $class_file = sprintf("%sclasses/db/%s.class.php", _XE_PATH_, $class_name);
         if (!file_exists($class_file)) {
             new Object(-1, 'msg_db_not_setted');
         }
         require_once $class_file;
         $eval_str = sprintf('$GLOBALS[\'__DB__\'][\'' . $db_type . '\'] = new %s();', $class_name);
         eval($eval_str);
     }
     return $GLOBALS['__DB__'][$db_type];
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:23,代码来源:DB.class.php

示例4: array

 function &getInstance()
 {
     $db_type = Context::getDBType();
     if (!isset($GLOBALS['__DB__'])) {
         $GLOBALS['__DB__'] = array();
     }
     if (!isset($GLOBALS['__DB__'][$db_type])) {
         switch ($db_type) {
             case 'mssql':
                 $GLOBALS['__DB__'][$db_type] = new MockDBMssql();
                 break;
             case 'mysql':
                 $GLOBALS['__DB__'][$db_type] = new MockDBMysql();
                 break;
             case 'cubrid':
                 $GLOBALS['__DB__'][$db_type] = new MockDBCubrid();
                 break;
         }
     }
     return $GLOBALS['__DB__'][$db_type];
 }
开发者ID:relip,项目名称:xe-core,代码行数:21,代码来源:MockDb.php

示例5: displayContent

 /**
  * @ 실행된 모듈의 컨텐츠를 출력
  **/
 function displayContent($oModule = NULL)
 {
     // 설정된 모듈이 정상이지 않을 경우 message 모듈 객체 생성
     if (!$oModule || !is_object($oModule)) {
         $this->error = 'msg_module_is_not_exists';
     }
     // install 모듈이 아닐 때 DB 접속에 문제가 있으면 오류
     if ($this->module != 'install' && $GLOBALS['__DB__'][Context::getDBType()]->is_connected == false) {
         $this->error = 'msg_dbconnect_failed';
     }
     // 모듈 동작을 마친 후 trigger call
     $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
     if (!$output->toBool()) {
         $this->error = $output->getMessage();
     }
     // HTML call 이면 message view 객체 이용하도록
     if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
         // 에러가 발생하였을시 처리
         if ($this->error) {
             // message 모듈 객체를 생성해서 컨텐츠 생성
             $oMessageView =& getView('message');
             $oMessageView->setError(-1);
             $oMessageView->setMessage($this->error);
             $oMessageView->dispMessage();
             // 정상적으로 호출된 객체가 있을 경우 해당 객체의 template를 변경
             if ($oModule) {
                 $oModule->setTemplatePath($oMessageView->getTemplatePath());
                 $oModule->setTemplateFile($oMessageView->getTemplateFile());
                 // 그렇지 않으면 message 객체를 호출된 객체로 지정
             } else {
                 $oModule = $oMessageView;
             }
         }
         // 해당 모듈에 layout_srl이 있는지 확인
         if ($oModule->module_info->layout_srl && !$oModule->getLayoutFile()) {
             // layout_srl이 있으면 해당 레이아웃 정보를 가져와 layout_path/ layout_file 위치 변경
             $oLayoutModel =& getModel('layout');
             $layout_info = $oLayoutModel->getLayout($oModule->module_info->layout_srl);
             if ($layout_info) {
                 // 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력
                 if ($layout_info->extra_var_count) {
                     foreach ($layout_info->extra_var as $var_id => $val) {
                         if ($val->type == 'image') {
                             if (preg_match('/^\\.\\/files\\/attach\\/images\\/(.+)/i', $val->value)) {
                                 $val->value = Context::getRequestUri() . substr($val->value, 2);
                             }
                         }
                         $layout_info->{$var_id} = $val->value;
                     }
                 }
                 // 레이아웃 정보중 menu를 Context::set
                 if ($layout_info->menu_count) {
                     foreach ($layout_info->menu as $menu_id => $menu) {
                         if (file_exists($menu->php_file)) {
                             @(include $menu->php_file);
                         }
                         Context::set($menu_id, $menu);
                     }
                 }
                 // 레이아웃 정보를 Context::set
                 Context::set('layout_info', $layout_info);
                 $oModule->setLayoutPath($layout_info->path);
                 $oModule->setLayoutFile('layout');
                 // 레이아웃이 수정되었을 경우 수정본을 지정
                 $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
                 if (file_exists($edited_layout)) {
                     $oModule->setEditedLayoutFile($edited_layout);
                 }
             }
         }
     }
     // 컨텐츠 출력
     $oDisplayHandler = new DisplayHandler();
     $oDisplayHandler->printContent($oModule);
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:78,代码来源:ModuleHandler.class.php

示例6: Object

 /**
  * returns instance of certain db type
  * @param string $db_type type of db
  * @return DB return DB object instance
  */
 function &getInstance($db_type = NULL)
 {
     if (!$db_type) {
         $db_type = Context::getDBType();
     }
     if (!$db_type && Context::isInstalled()) {
         return new Object(-1, 'msg_db_not_setted');
     }
     if (!isset($GLOBALS['__DB__'])) {
         $GLOBALS['__DB__'] = array();
     }
     if (!isset($GLOBALS['__DB__'][$db_type])) {
         $class_name = 'DB' . ucfirst($db_type);
         $class_file = _XE_PATH_ . "classes/db/{$class_name}.class.php";
         if (!file_exists($class_file)) {
             return new Object(-1, 'msg_db_not_setted');
         }
         // get a singletone instance of the database driver class
         require_once $class_file;
         $GLOBALS['__DB__'][$db_type] = call_user_func(array($class_name, 'create'));
         $GLOBALS['__DB__'][$db_type]->db_type = $db_type;
     }
     return $GLOBALS['__DB__'][$db_type];
 }
开发者ID:ned3y2k,项目名称:xe-core,代码行数:29,代码来源:DB.class.php

示例7: procAdminRecompileCacheFile

 /**
  * Regenerate all cache files
  * @return void
  */
 function procAdminRecompileCacheFile()
 {
     // rename cache dir
     $temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
     FileHandler::rename('./files/cache', $temp_cache_dir);
     FileHandler::makeDir('./files/cache');
     // remove debug files
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
     FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
     $oModuleModel = getModel('module');
     $module_list = $oModuleModel->getModuleList();
     // call recompileCache for each module
     foreach ($module_list as $module) {
         $oModule = NULL;
         $oModule = getClass($module->module);
         if (method_exists($oModule, 'recompileCache')) {
             $oModule->recompileCache();
         }
     }
     // remove cache
     $truncated = array();
     $oObjectCacheHandler = CacheHandler::getInstance('object');
     $oTemplateCacheHandler = CacheHandler::getInstance('template');
     if ($oObjectCacheHandler->isSupport()) {
         $truncated[] = $oObjectCacheHandler->truncate();
     }
     if ($oTemplateCacheHandler->isSupport()) {
         $truncated[] = $oTemplateCacheHandler->truncate();
     }
     if (count($truncated) && in_array(FALSE, $truncated)) {
         return new Object(-1, 'msg_self_restart_cache_engine');
     }
     // remove cache dir
     $tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
     if ($tmp_cache_list) {
         foreach ($tmp_cache_list as $tmp_dir) {
             if ($tmp_dir) {
                 FileHandler::removeDir('./files/' . $tmp_dir);
             }
         }
     }
     // remove duplicate indexes (only for CUBRID)
     $db_type = Context::getDBType();
     if ($db_type == 'cubrid') {
         $db = DB::getInstance();
         $db->deleteDuplicateIndexes();
     }
     // check autoinstall packages
     $oAutoinstallAdminController = getAdminController('autoinstall');
     $oAutoinstallAdminController->checkInstalled();
     $this->setMessage('success_updated');
 }
开发者ID:ddmshu,项目名称:xe-core,代码行数:57,代码来源:admin.admin.controller.php

示例8: displayContent

 /**
  * display contents from executed module
  * @param ModuleObject $oModule module instance
  * @return void
  **/
 function displayContent($oModule = NULL)
 {
     // If the module is not set or not an object, set error
     if (!$oModule || !is_object($oModule)) {
         $this->error = 'msg_module_is_not_exists';
         $this->httpStatusCode = '404';
     }
     // If connection to DB has a problem even though it's not install module, set error
     if ($this->module != 'install' && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == false) {
         $this->error = 'msg_dbconnect_failed';
     }
     // Call trigger after moduleHandler proc
     $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
     if (!$output->toBool()) {
         $this->error = $output->getMessage();
     }
     // Use message view object, if HTML call
     $methodList = array('XMLRPC' => 1, 'JSON' => 1);
     if (!isset($methodList[Context::getRequestMethod()])) {
         if ($_SESSION['XE_VALIDATOR_RETURN_URL']) {
             $display_handler = new DisplayHandler();
             $display_handler->_debugOutput();
             header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
             return;
         }
         // If error occurred, handle it
         if ($this->error) {
             // display content with message module instance
             $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
             $oMessageObject =& ModuleHandler::getModuleInstance('message', $type);
             $oMessageObject->setError(-1);
             $oMessageObject->setMessage($this->error);
             $oMessageObject->dispMessage();
             if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') {
                 $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
                 $oMessageObject->setTemplateFile('http_status_code');
             }
             // If module was called normally, change the templates of the module into ones of the message view module
             if ($oModule) {
                 $oModule->setTemplatePath($oMessageObject->getTemplatePath());
                 $oModule->setTemplateFile($oMessageObject->getTemplateFile());
                 // Otherwise, set message instance as the target module
             } else {
                 $oModule = $oMessageObject;
             }
             $this->_clearErrorSession();
         }
         // Check if layout_srl exists for the module
         if (Mobile::isFromMobilePhone()) {
             $layout_srl = $oModule->module_info->mlayout_srl;
         } else {
             $layout_srl = $oModule->module_info->layout_srl;
         }
         if ($layout_srl && !$oModule->getLayoutFile()) {
             // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
             $oLayoutModel =& getModel('layout');
             $layout_info = $oLayoutModel->getLayout($layout_srl);
             if ($layout_info) {
                 // Input extra_vars into $layout_info
                 if ($layout_info->extra_var_count) {
                     foreach ($layout_info->extra_var as $var_id => $val) {
                         if ($val->type == 'image') {
                             if (preg_match('/^\\.\\/files\\/attach\\/images\\/(.+)/i', $val->value)) {
                                 $val->value = Context::getRequestUri() . substr($val->value, 2);
                             }
                         }
                         $layout_info->{$var_id} = $val->value;
                     }
                 }
                 // Set menus into context
                 if ($layout_info->menu_count) {
                     foreach ($layout_info->menu as $menu_id => $menu) {
                         if (file_exists($menu->php_file)) {
                             @(include $menu->php_file);
                         }
                         Context::set($menu_id, $menu);
                     }
                 }
                 // Set layout information into context
                 Context::set('layout_info', $layout_info);
                 $oModule->setLayoutPath($layout_info->path);
                 $oModule->setLayoutFile('layout');
                 // If layout was modified, use the modified version
                 $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
                 if (file_exists($edited_layout)) {
                     $oModule->setEditedLayoutFile($edited_layout);
                 }
             }
         }
     }
     // Display contents
     $oDisplayHandler = new DisplayHandler();
     $oDisplayHandler->printContent($oModule);
 }
开发者ID:relip,项目名称:xe-core,代码行数:99,代码来源:ModuleHandler.class.php

示例9: procAdminRecompileCacheFile

 /**
  * Regenerate all cache files
  * @return void
  */
 function procAdminRecompileCacheFile()
 {
     // rename cache dir
     Rhymix\Framework\Storage::move(\RX_BASEDIR . 'files/cache', \RX_BASEDIR . 'files/cache_' . time());
     Rhymix\Framework\Storage::createDirectory(\RX_BASEDIR . 'files/cache');
     // remove module extend cache
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/config/module_extend.php');
     // remove debug files
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_debug_message.php');
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_debug_db_query.php');
     Rhymix\Framework\Storage::delete(RX_BASEDIR . 'files/_db_slow_query.php');
     $oModuleModel = getModel('module');
     $module_list = $oModuleModel->getModuleList();
     // call recompileCache for each module
     foreach ($module_list as $module) {
         $oModule = NULL;
         $oModule = getClass($module->module);
         if (method_exists($oModule, 'recompileCache')) {
             $oModule->recompileCache();
         }
     }
     // remove object cache
     if (!in_array(Rhymix\Framework\Cache::getDriverName(), array('file', 'sqlite', 'dummy'))) {
         Rhymix\Framework\Cache::clearAll();
     }
     // remove old cache dir
     $tmp_cache_list = FileHandler::readDir(\RX_BASEDIR . 'files', '/^(cache_[0-9]+)/');
     if ($tmp_cache_list) {
         foreach ($tmp_cache_list as $tmp_dir) {
             if (strval($tmp_dir) !== '') {
                 $tmp_dir = \RX_BASEDIR . 'files/' . strval($tmp_dir);
                 if (!Rhymix\Framework\Storage::isDirectory($tmp_dir)) {
                     continue;
                 }
                 // If possible, use system command to speed up recursive deletion
                 if (function_exists('exec') && !preg_match('/(?<!_)exec/', ini_get('disable_functions'))) {
                     if (strncasecmp(\PHP_OS, 'win', 3) == 0) {
                         @exec('rmdir /S /Q ' . escapeshellarg($tmp_dir));
                     } else {
                         @exec('rm -rf ' . escapeshellarg($tmp_dir));
                     }
                 }
                 // If the directory still exists, delete using PHP.
                 Rhymix\Framework\Storage::deleteDirectory($tmp_dir);
             }
         }
     }
     // remove duplicate indexes (only for CUBRID)
     $db_type = Context::getDBType();
     if ($db_type == 'cubrid') {
         $db = DB::getInstance();
         $db->deleteDuplicateIndexes();
     }
     // check autoinstall packages
     $oAutoinstallAdminController = getAdminController('autoinstall');
     $oAutoinstallAdminController->checkInstalled();
     $this->setMessage('success_updated');
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:62,代码来源:admin.admin.controller.php

示例10: getTables

 function getTables()
 {
     if ($this->query->index_hint && ($this->query->index_hint->attrs->for == 'ALL' || Context::getDBType() == strtolower($this->query->index_hint->attrs->for))) {
         return $this->tables = new TablesTag($this->query->tables, $this->query->index_hint);
     } else {
         return $this->tables = new TablesTag($this->query->tables);
     }
 }
开发者ID:relip,项目名称:xe-core,代码行数:8,代码来源:QueryTag.class.php

示例11: displayContent

 /**
  * display contents from executed module
  * @param ModuleObject $oModule module instance
  * @return void
  * */
 function displayContent($oModule = NULL)
 {
     // If the module is not set or not an object, set error
     if (!$oModule || !is_object($oModule)) {
         $this->error = 'msg_module_is_not_exists';
         $this->httpStatusCode = '404';
     }
     // If connection to DB has a problem even though it's not install module, set error
     if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) {
         $this->error = 'msg_dbconnect_failed';
     }
     // Call trigger after moduleHandler proc
     $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
     if (!$output->toBool()) {
         $this->error = $output->getMessage();
     }
     // Use message view object, if HTML call
     $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
     if (!isset($methodList[Context::getRequestMethod()])) {
         if ($_SESSION['XE_VALIDATOR_RETURN_URL']) {
             $display_handler = new DisplayHandler();
             $display_handler->_debugOutput();
             header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
             return;
         }
         // If error occurred, handle it
         if ($this->error) {
             // display content with message module instance
             $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
             $oMessageObject = ModuleHandler::getModuleInstance('message', $type);
             $oMessageObject->setError(-1);
             $oMessageObject->setMessage($this->error);
             $oMessageObject->dispMessage();
             if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') {
                 $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
                 $oMessageObject->setTemplateFile('http_status_code');
             }
             // If module was called normally, change the templates of the module into ones of the message view module
             if ($oModule) {
                 $oModule->setTemplatePath($oMessageObject->getTemplatePath());
                 $oModule->setTemplateFile($oMessageObject->getTemplateFile());
                 // Otherwise, set message instance as the target module
             } else {
                 $oModule = $oMessageObject;
             }
             $this->_clearErrorSession();
         }
         // Check if layout_srl exists for the module
         if (Mobile::isFromMobilePhone()) {
             $layout_srl = $oModule->module_info->mlayout_srl;
         } else {
             $layout_srl = $oModule->module_info->layout_srl;
         }
         // if layout_srl is rollback by module, set default layout
         if ($layout_srl == -1) {
             $viewType = Mobile::isFromMobilePhone() ? 'M' : 'P';
             $oLayoutAdminModel = getAdminModel('layout');
             $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
         }
         if ($layout_srl && !$oModule->getLayoutFile()) {
             // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
             $oLayoutModel = getModel('layout');
             $layout_info = $oLayoutModel->getLayout($layout_srl);
             if ($layout_info) {
                 // Input extra_vars into $layout_info
                 if ($layout_info->extra_var_count) {
                     foreach ($layout_info->extra_var as $var_id => $val) {
                         if ($val->type == 'image') {
                             if (strncmp('./files/attach/images/', $val->value, 22) === 0) {
                                 $val->value = Context::getRequestUri() . substr($val->value, 2);
                             }
                         }
                         $layout_info->{$var_id} = $val->value;
                     }
                 }
                 // Set menus into context
                 if ($layout_info->menu_count) {
                     foreach ($layout_info->menu as $menu_id => $menu) {
                         // set default menu set(included home menu)
                         if (!$menu->menu_srl || $menu->menu_srl == -1) {
                             $oMenuAdminController = getAdminController('menu');
                             $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
                             if (FileHandler::exists($homeMenuCacheFile)) {
                                 include $homeMenuCacheFile;
                             }
                             if (!$menu->menu_srl) {
                                 $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
                                 $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
                                 $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
                             } else {
                                 $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
                                 $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
                             }
                         }
                         $php_file = FileHandler::exists($menu->php_file);
//.........这里部分代码省略.........
开发者ID:kimkucheol,项目名称:xe-core,代码行数:101,代码来源:ModuleHandler.class.php

示例12: getEnv

 /**
  * Parameter arrange for send to XE collect server
  * @param string $type 'WORKING', 'INSTALL'
  * @return string
  */
 function getEnv($type = 'WORKING')
 {
     $skip = array('ext' => array('pcre', 'json', 'hash', 'dom', 'session', 'spl', 'standard', 'date', 'ctype', 'tokenizer', 'apache2handler', 'filter', 'posix', 'reflection', 'pdo'), 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget'), 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image'), 'layout' => array('default'), 'widget' => array('content', 'language_select', 'login_info', 'mcontent'), 'widgetstyle' => array());
     $info = array();
     $db_info = Context::getDBInfo();
     $info['type'] = $type != 'INSTALL' ? 'WORKING' : 'INSTALL';
     $info['location'] = _XE_LOCATION_;
     $info['package'] = _XE_PACKAGE_;
     $info['host'] = $db_type->default_url ? $db_type->default_url : getFullUrl();
     $info['app'] = $_SERVER['SERVER_SOFTWARE'];
     $info['xe_version'] = __XE_VERSION__;
     $info['php'] = phpversion();
     $info['db_type'] = Context::getDBType();
     $info['use_rewrite'] = $db_info->use_rewrite;
     $info['use_db_session'] = $db_info->use_db_session == 'Y' ? 'Y' : 'N';
     $info['use_ssl'] = $db_info->use_ssl;
     $info['phpext'] = '';
     foreach (get_loaded_extensions() as $ext) {
         $ext = strtolower($ext);
         if (in_array($ext, $skip['ext'])) {
             continue;
         }
         $info['phpext'] .= '|' . $ext;
     }
     $info['phpext'] = substr($info['phpext'], 1);
     $info['module'] = '';
     $oModuleModel = getModel('module');
     $module_list = $oModuleModel->getModuleList();
     if ($module_list) {
         foreach ($module_list as $module) {
             if (in_array($module->module, $skip['module'])) {
                 continue;
             }
             $info['module'] .= '|' . $module->module;
         }
     }
     $info['module'] = substr($info['module'], 1);
     $info['addon'] = '';
     $oAddonAdminModel = getAdminModel('addon');
     $addon_list = $oAddonAdminModel->getAddonList();
     if ($addon_list) {
         foreach ($addon_list as $addon) {
             if (in_array($addon->addon, $skip['addon'])) {
                 continue;
             }
             $info['addon'] .= '|' . $addon->addon;
         }
     }
     $info['addon'] = substr($info['addon'], 1);
     $info['layout'] = "";
     $oLayoutModel = getModel('layout');
     $layout_list = $oLayoutModel->getDownloadedLayoutList();
     if ($layout_list) {
         foreach ($layout_list as $layout) {
             if (in_array($layout->layout, $skip['layout'])) {
                 continue;
             }
             $info['layout'] .= '|' . $layout->layout;
         }
     }
     $info['layout'] = substr($info['layout'], 1);
     $info['widget'] = "";
     $oWidgetModel = getModel('widget');
     $widget_list = $oWidgetModel->getDownloadedWidgetList();
     if ($widget_list) {
         foreach ($widget_list as $widget) {
             if (in_array($widget->widget, $skip['widget'])) {
                 continue;
             }
             $info['widget'] .= '|' . $widget->widget;
         }
     }
     $info['widget'] = substr($info['widget'], 1);
     $info['widgetstyle'] = "";
     $oWidgetModel = getModel('widget');
     $widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
     if ($widgetstyle_list) {
         foreach ($widgetstyle_list as $widgetstyle) {
             if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) {
                 continue;
             }
             $info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle;
         }
     }
     $info['widgetstyle'] = substr($info['widgetstyle'], 1);
     $param = '';
     foreach ($info as $k => $v) {
         if ($v) {
             $param .= sprintf('&%s=%s', $k, urlencode($v));
         }
     }
     $param = substr($param, 1);
     return $param;
 }
开发者ID:conory,项目名称:rhymix,代码行数:99,代码来源:admin.admin.model.php

示例13: isValidPassword

 /**
  * @brief Compare plain text password to the password saved in DB
  */
 function isValidPassword($hashed_password, $password_text, $member_srl = null)
 {
     // False if no password in entered
     if (!$password_text) {
         return false;
     }
     $isSha1 = $this->useSha1 && function_exists('sha1');
     // Return true if the user input is equal to md5 hash value
     if ($hashed_password == md5($password_text)) {
         if ($isSha1 && $member_srl > 0) {
             $args = new stdClass();
             $args->member_srl = $member_srl;
             $args->hashed_password = md5(sha1(md5($password_text)));
             $oMemberController = getController('member');
             $oMemberController->updateMemberPassword($args);
         }
         return true;
     }
     // Return true if the user input is equal to the value of mysql_pre4_hash_password
     if (mysql_pre4_hash_password($password_text) == $hashed_password) {
         if ($isSha1 && $member_srl > 0) {
             $args = new stdClass();
             $args->member_srl = $member_srl;
             $args->hashed_password = md5(sha1(md5($password_text)));
             $oMemberController = getController('member');
             $oMemberController->updateMemberPassword($args);
         }
         return true;
     }
     // Verify the password by using old_password if the current db is MySQL. If correct, return true.
     if (substr(Context::getDBType(), 0, 5) == 'mysql') {
         $oDB =& DB::getInstance();
         if ($oDB->isValidOldPassword($password_text, $hashed_password)) {
             if ($isSha1 && $member_srl > 0) {
                 $args = new stdClass();
                 $args->member_srl = $member_srl;
                 $args->hashed_password = md5(sha1(md5($password_text)));
                 $oMemberController = getController('member');
                 $oMemberController->updateMemberPassword($args);
             }
             return true;
         }
     }
     if ($isSha1 && $hashed_password == md5(sha1(md5($password_text)))) {
         return true;
     }
     return false;
 }
开发者ID:Gunmania,项目名称:xe-core,代码行数:51,代码来源:member.model.php

示例14: checkPassword

 /**
  * @brief Check if a password matches a hash
  * @param string $password The password
  * @param string $hash The hash
  * @param string $algorithm The algorithm (optional)
  * @return bool
  */
 public function checkPassword($password, $hash, $algorithm = null)
 {
     if ($algorithm === null) {
         $algorithm = $this->checkAlgorithm($hash);
     }
     $password = trim($password);
     switch ($algorithm) {
         case 'md5':
             return md5($password) === $hash || md5(sha1(md5($password))) === $hash;
         case 'mysql_old_password':
             return class_exists('Context') && substr(Context::getDBType(), 0, 5) === 'mysql' ? DB::getInstance()->isValidOldPassword($password, $hash) : false;
         case 'mysql_password':
             return $hash[0] === '*' && substr($hash, 1) === strtoupper(sha1(sha1($password, true)));
         case 'pbkdf2':
             $hash = explode(':', $hash);
             $hash[3] = base64_decode($hash[3]);
             $hash_to_compare = $this->pbkdf2($password, $hash[2], $hash[0], intval($hash[1], 10), strlen($hash[3]));
             return $this->strcmpConstantTime($hash_to_compare, $hash[3]);
         case 'bcrypt':
             $hash_to_compare = $this->bcrypt($password, $hash);
             return $this->strcmpConstantTime($hash_to_compare, $hash);
         default:
             if ($algorithm && isset(self::$_custom[$algorithm])) {
                 $hash_callback = self::$_custom[$algorithm]['callback'];
                 $hash_to_compare = $hash_callback($password, $hash);
                 return $this->strcmpConstantTime($hash_to_compare, $hash);
             }
             if (in_array($algorithm, hash_algos())) {
                 return $this->strcmpConstantTime(hash($algorithm, $password), $hash);
             }
             return false;
     }
 }
开发者ID:perzona420,项目名称:xe-core,代码行数:40,代码来源:Password.class.php

示例15: isValidPassword

 /**
  * @brief 입력된 plain text 비밀번호와 DB에 저장된 비밀번호와의 비교
  **/
 function isValidPassword($hashed_password, $password_text)
 {
     // 입력된 비밀번호가 없으면 무조건 falase
     if (!$password_text) {
         return false;
     }
     // md5 해쉬된값가 맞으면 return true
     if ($hashed_password == md5($password_text)) {
         return true;
     }
     // mysql_pre4_hash_password함수의 값과 동일하면 return true
     if (mysql_pre4_hash_password($password_text) == $hashed_password) {
         return true;
     }
     // 현재 DB에서 mysql DB를 이용시 직접 old_password를 이용하여 검사하고 맞으면 비밀번호를 변경
     if (substr(Context::getDBType(), 0, 5) == 'mysql') {
         $oDB =& DB::getInstance();
         if ($oDB->isValidOldPassword($password_text, $hashed_password)) {
             return true;
         }
     }
     return false;
 }
开发者ID:hottaro,项目名称:xpressengine,代码行数:26,代码来源:member.model.php


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