本文整理汇总了PHP中Context::getDBInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getDBInfo方法的具体用法?PHP Context::getDBInfo怎么用?PHP Context::getDBInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::getDBInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setDBInfo
/**
* @brief DB settings and connect/close
**/
function _setDBInfo()
{
$db_info = Context::getDBInfo();
$this->database = $db_info->master_db["db_database"];
$this->prefix = $db_info->master_db["db_table_prefix"];
//if(!substr($this->prefix,-1)!='_') $this->prefix .= '_';
}
示例2: _isFromMobilePhone
/**
* Get current mobile mode
*
* @return bool
*/
function _isFromMobilePhone()
{
if ($this->ismobile !== null) {
return $this->ismobile;
}
$db_info = Context::getDBInfo();
if ($db_info->use_mobile_view != "Y" || Context::get('full_browse') || $_COOKIE["FullBrowse"]) {
return $this->ismobile = false;
}
$xe_web_path = Context::pathToUrl(_XE_PATH_);
// default setting. if there is cookie for a device, XE do not have to check if it is mobile or not and it will enhance performace of the server.
$this->ismobile = FALSE;
$m = Context::get('m');
if (strlen($m) == 1) {
if ($m == "1") {
$this->ismobile = true;
} elseif ($m == "0") {
$this->ismobile = false;
}
} elseif (isset($_COOKIE['mobile'])) {
if ($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT'])) {
if ($_COOKIE['mobile'] == 'true') {
$this->ismobile = true;
} else {
$this->ismobile = false;
}
} else {
$this->ismobile = FALSE;
setcookie("mobile", FALSE, 0, $xe_web_path);
setcookie("user-agent", FALSE, 0, $xe_web_path);
if (!$this->isMobilePadCheckByAgent() && $this->isMobileCheckByAgent()) {
$this->ismobile = TRUE;
}
}
} else {
if ($this->isMobilePadCheckByAgent()) {
$this->ismobile = FALSE;
} else {
if ($this->isMobileCheckByAgent()) {
$this->ismobile = TRUE;
}
}
}
if ($this->ismobile !== NULL) {
if ($this->ismobile == TRUE) {
if ($_COOKIE['mobile'] != 'true') {
$_COOKIE['mobile'] = 'true';
setcookie("mobile", 'true', 0, $xe_web_path);
}
} elseif ($_COOKIE['mobile'] != 'false') {
$_COOKIE['mobile'] = 'false';
setcookie("mobile", 'false', 0, $xe_web_path);
}
if ($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT'])) {
setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']), 0, $xe_web_path);
}
}
return $this->ismobile;
}
示例3: _setDBInfo
/**
* @brief DB정보 설정 및 connect/ close
**/
function _setDBInfo()
{
$db_info = Context::getDBInfo();
$this->database = $db_info->db_database;
$this->prefix = $db_info->db_table_prefix;
if (!substr($this->prefix, -1) != '_') {
$this->prefix .= '_';
}
}
示例4: CacheHandler
/**
* Constructor.
*
* Do not use this directly. You can use getInstance() instead.
*
* @see CacheHandler::getInstance
* @param string $target type of cache (object|template)
* @param object $info info. of DB
* @param boolean $always_use_file If set true, use a file cache always
* @return CacheHandler
*/
function CacheHandler($target, $info = null, $always_use_file = false)
{
if (!$info) {
$info = Context::getDBInfo();
}
if ($info) {
if ($target == 'object') {
if ($info->use_object_cache == 'apc') {
$type = 'apc';
} else {
if (substr($info->use_object_cache, 0, 8) == 'memcache') {
$type = 'memcache';
$url = $info->use_object_cache;
} else {
if ($info->use_object_cache == 'wincache') {
$type = 'wincache';
} else {
if ($info->use_object_cache == 'file') {
$type = 'file';
} else {
if ($always_use_file) {
$type = 'file';
}
}
}
}
}
} else {
if ($target == 'template') {
if ($info->use_template_cache == 'apc') {
$type = 'apc';
} else {
if (substr($info->use_template_cache, 0, 8) == 'memcache') {
$type = 'memcache';
$url = $info->use_template_cache;
} else {
if ($info->use_template_cache == 'wincache') {
$type = 'wincache';
}
}
}
}
}
if ($type) {
$class = 'Cache' . ucfirst($type);
include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class);
$this->handler = call_user_func(array($class, 'getInstance'), $url);
$this->keyGroupVersions = $this->handler->get('key_group_versions', 0);
if (!$this->keyGroupVersions) {
$this->keyGroupVersions = array();
$this->handler->put('key_group_versions', $this->keyGroupVersions, 0);
}
}
}
}
示例5: _setDBInfo
/**
* @brief DB정보 설정 및 connect/ close
**/
function _setDBInfo()
{
$db_info = Context::getDBInfo();
$this->hostname = $db_info->db_hostname;
$this->port = $db_info->db_port;
$this->userid = $db_info->db_userid;
$this->password = $db_info->db_password;
$this->database = $db_info->db_database;
$this->prefix = $db_info->db_table_prefix;
if (!substr($this->prefix, -1) != '_') {
$this->prefix .= '_';
}
}
示例6: dispSeoAdminSetting
function dispSeoAdminSetting()
{
$vars = Context::getRequestVars();
if (!$vars->setting_section) {
Context::set('setting_section', 'general');
}
$config = $this->getConfig();
$db_info = Context::getDBInfo();
$hostname = parse_url($db_info->default_url);
$hostname = $hostname['host'];
Context::set('config', $config);
Context::set('hostname', $hostname);
}
示例7: getIndexHintString
/**
* Return index hint string
* @return string
*/
function getIndexHintString()
{
$result = '';
// Retrieve table prefix, to add it to index name
$db_info = Context::getDBInfo();
$prefix = $db_info->master_db["db_table_prefix"];
foreach ($this->index_hints_list as $index_hint) {
$index_hint_type = $index_hint->getIndexHintType();
if ($index_hint_type !== 'IGNORE') {
$result .= $this->alias . '.' . '"' . $prefix . substr($index_hint->getIndexName(), 1) . ($index_hint_type == 'FORCE' ? '(+)' : '') . ', ';
}
}
$result = substr($result, 0, -2);
return $result;
}
示例8: moduleUpdate
/**
* @brief 업데이트 실행
**/
function moduleUpdate()
{
$db_info = Context::getDBInfo();
// 카운터에 site_srl추가
$oDB =& DB::getInstance();
if (!$oDB->isColumnExists('counter_log', 'site_srl')) {
$oDB->addColumn('counter_log', 'site_srl', 'number', 11, 0, true);
}
if ($db_info->db_type == 'cubrid') {
if (!$oDB->isIndexExists('counter_log', $oDB->prefix . 'counter_log_idx_site_counter_log')) {
$oDB->addIndex('counter_log', $oDB->prefix . 'counter_log_idx_site_counter_log', array('site_srl', 'ipaddress'), false);
}
} else {
if (!$oDB->isIndexExists('counter_log', 'idx_site_counter_log')) {
$oDB->addIndex('counter_log', 'idx_site_counter_log', array('site_srl', 'ipaddress'), false);
}
}
return new Object(0, 'success_updated');
}
示例9: _getAgreement
function _getAgreement()
{
$agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . Context::get('lang_type') . '.txt';
if (is_readable($agreement_file)) {
return FileHandler::readFile($agreement_file);
}
$db_info = Context::getDBInfo();
$agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . $db_info->lang_type . '.txt';
if (is_readable($agreement_file)) {
return FileHandler::readFile($agreement_file);
}
$lang_selected = Context::loadLangSelected();
foreach ($lang_selected as $key => $val) {
$agreement_file = _XE_PATH_ . 'files/authentication/agreement_' . $key . '.txt';
if (is_readable($agreement_file)) {
return FileHandler::readFile($agreement_file);
}
}
return null;
}
示例10: isMobileEnabled
function isMobileEnabled()
{
$db_info = Context::getDBInfo();
return $db_info->use_mobile_view === 'Y';
}
示例11: _setDBInfo
/**
* DB info settings
* this method is protected
* @return void
*/
function _setDBInfo()
{
$db_info = Context::getDBInfo();
$this->master_db = $db_info->master_db;
if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] && $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"] && $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"] && $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"] && $db_info->master_db["db_database"] == $db_info->slave_db[0]["db_database"]) {
$this->slave_db[0] =& $this->master_db;
} else {
$this->slave_db = $db_info->slave_db;
}
$this->prefix = $db_info->master_db["db_table_prefix"];
$this->use_prepared_statements = $db_info->use_prepared_statements;
}
示例12: getMemberAdminIPCheck
/**
* check allowed target ip address when login for admin.
*
* @return boolean (true : allowed, false : refuse)
*/
function getMemberAdminIPCheck()
{
$db_info = Context::getDBInfo();
$admin_ip_list = $db_info->admin_ip_list;
if (!$admin_ip_list) {
return true;
}
if (!is_array($admin_ip_list)) {
$admin_ip_list = explode(',', $admin_ip_list);
}
if (!count($admin_ip_list) || IpFilter::filter($admin_ip_list)) {
return true;
} else {
return false;
}
}
示例13: procImporterAdminSync
/**
* Sync member information with document information
* @return void
*/
function procImporterAdminSync()
{
$oMemberModel = getModel('member');
$member_config = $oMemberModel->getMemberConfig();
$postFix = $member_config->identifier == 'email_address' ? 'ByEmail' : '';
// 계정이 이메일인 경우 이메일 정보로 사용자를 싱크하도록 한다. 이때 변수명은 그대로 user_id를 사용한다.
/* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다.
CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */
$db_info = Context::getDBInfo();
if ($db_info->db_type != "cubrid") {
$output = executeQuery('importer.updateDocumentSync' . $postFix);
$output = executeQuery('importer.updateCommentSync' . $postFix);
} else {
$output = executeQueryArray('importer.getDocumentMemberSrlWithUserID' . $postFix);
if (is_array($output->data) && count($output->data)) {
$success_count = 0;
$error_count = 0;
$total_count = 0;
foreach ($output->data as $val) {
$args->user_id = $val->user_id;
$args->member_srl = $val->member_srl;
$tmp = executeQuery('importer.updateDocumentSyncForCUBRID' . $postFix, $args);
if ($tmp->toBool() === true) {
$success_count++;
} else {
$error_count++;
}
$total_count++;
}
}
// documents section
$output = executeQueryArray('importer.getCommentMemberSrlWithUserID' . $postFix);
if (is_array($output->data) && count($output->data)) {
$success_count = 0;
$error_count = 0;
$total_count = 0;
foreach ($output->data as $val) {
$args->user_id = $val->user_id;
$args->member_srl = $val->member_srl;
$tmp = executeQuery('importer.updateCommentSyncForCUBRID' . $postFix, $args);
if ($tmp->toBool() === true) {
$success_count++;
} else {
$error_count++;
}
$total_count++;
}
}
// comments section
}
$this->setMessage('msg_sync_completed');
}
示例14: getOptimizedFiles
/**
* @brief optimize 대상 파일을 받아서 처리 후 optimize 된 파일이름을 return
**/
function getOptimizedFiles($source_files, $type = "js")
{
if (!is_array($source_files) || !count($source_files)) {
return;
}
// $source_files의 역슬래쉬 경로를 슬래쉬로 변경 (윈도우즈 대비)
foreach ($source_files as $key => $file) {
$source_files[$key]['file'] = str_replace("\\", "/", $file['file']);
}
// 관리자 설정시 설정이 되어 있지 않으면 패스
$db_info = Context::getDBInfo();
if ($db_info->use_optimizer == 'N') {
return $this->_getOptimizedRemoved($source_files);
}
// 캐시 디렉토리가 없으면 실행하지 않음
if (!is_dir($this->cache_path)) {
return $this->_getOptimizedRemoved($source_files);
}
$files = array();
if (!count($source_files)) {
return;
}
foreach ($source_files as $file) {
if (!$file || !$file['file']) {
continue;
}
if (empty($file['optimized']) || preg_match('/^https?:\\/\\//i', $file['file'])) {
$files[] = $file;
} else {
$targets[] = $file;
}
}
if (!count($targets)) {
return $this->_getOptimizedRemoved($files);
}
$optimized_info = $this->getOptimizedInfo($targets);
$path = sprintf("%s%s", $this->cache_path, $optimized_info[0]);
$filename = sprintf("%s.%s.%s.php", $optimized_info[0], $optimized_info[1], $type);
$this->doOptimizedFile($path, $filename, $targets, $type);
array_unshift($files, array('file' => $path . '/' . $filename, 'media' => 'all'));
$files = $this->_getOptimizedRemoved($files);
if (!count($files)) {
return $files;
}
$url_info = parse_url(Context::getRequestUri());
$abpath = $url_info['path'];
foreach ($files as $key => $val) {
$file = $val['file'];
if (substr($file, 0, 1) == '/' || strpos($file, '://') !== false) {
continue;
}
if (substr($file, 0, 2) == './') {
$file = substr($file, 2);
}
$file = $abpath . $file;
while (strpos($file, '/../') !== false) {
$file = preg_replace('/\\/([^\\/]+)\\/\\.\\.\\//', '/', $file);
}
$files[$key]['file'] = $file;
}
return $files;
}
示例15: procMenuAdminInsertItemForAdminMenu
/**
* Get all act list for admin menu
* @return void|object
*/
function procMenuAdminInsertItemForAdminMenu()
{
$requestArgs = Context::getRequestVars();
$tmpMenuName = explode(':', $requestArgs->menu_name);
$moduleName = $tmpMenuName[0];
$menuName = $tmpMenuName[1];
// variable setting
$logged_info = Context::get('logged_info');
//$oMenuAdminModel = getAdminModel('menu');
$oMemberModel = getModel('member');
//$parentMenuInfo = $oMenuAdminModel->getMenuItemInfo($requestArgs->parent_srl);
$groupSrlList = $oMemberModel->getMemberGroups($logged_info->member_srl);
//preg_match('/\{\$lang->menu_gnb\[(.*?)\]\}/i', $parentMenuInfo->name, $m);
$oModuleModel = getModel('module');
//$info = $oModuleModel->getModuleInfoXml($moduleName);
$info = $oModuleModel->getModuleActionXml($moduleName);
$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
if (empty($url)) {
$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
}
if (empty($url)) {
$url = getNotEncodedFullUrl('', 'module', 'admin');
}
$dbInfo = Context::getDBInfo();
$args = new stdClass();
$args->menu_item_srl = !$requestArgs->menu_item_srl ? getNextSequence() : $requestArgs->menu_item_srl;
$args->parent_srl = $requestArgs->parent_srl;
$args->menu_srl = $requestArgs->menu_srl;
$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
//if now page is https...
if (strpos($url, 'https') !== false) {
$args->url = str_replace('https' . substr($dbInfo->default_url, 4), '', $url);
} else {
$args->url = str_replace($dbInfo->default_url, '', $url);
}
$args->open_window = 'N';
$args->expand = 'N';
$args->normal_btn = '';
$args->hover_btn = '';
$args->active_btn = '';
$args->group_srls = implode(',', array_keys($groupSrlList));
$args->listorder = -1 * $args->menu_item_srl;
// Check if already exists
$oMenuModel = getAdminModel('menu');
$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
// Update if exists
if ($item_info->menu_item_srl == $args->menu_item_srl) {
$output = executeQuery('menu.updateMenuItem', $args);
if (!$output->toBool()) {
return $output;
}
} else {
$args->listorder = -1 * $args->menu_item_srl;
$output = executeQuery('menu.insertMenuItem', $args);
if (!$output->toBool()) {
return $output;
}
}
// Get information of the menu
$menu_info = $oMenuModel->getMenu($args->menu_srl);
$menu_title = $menu_info->title;
// Update the xml file and get its location
$xml_file = $this->makeXmlFile($args->menu_srl);
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminSetup');
$this->setRedirectUrl($returnUrl);
}