本文整理汇总了PHP中Context::getDefaultUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getDefaultUrl方法的具体用法?PHP Context::getDefaultUrl怎么用?PHP Context::getDefaultUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::getDefaultUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: proc
/**
* @brief 위젯의 실행 부분
*
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
// 제목
$title = $args->title;
// 출력된 목록 수
$list_count = (int) $args->list_count;
if (!$list_count) {
$list_count = 5;
}
$args->list_count = $list_count;
// 중복 허용/ 비허용 체크
if ($args->allow_repetition != 'Y') {
$output = executeQueryArray('widgets.planet_document.getUniqueNewestDocuments', $args);
} else {
$output = executeQueryArray('widgets.planet_document.getNewestDocuments', $args);
}
// 플래닛 글 목록 구함
$oPlanetModel =& getModel('planet');
Context::set('planet', $planet = $oPlanetModel->getPlanet());
if (count($output->data)) {
foreach ($output->data as $key => $val) {
$document_srl = $val->document_srl;
$oPlanet = null;
$oPlanet = new PlanetItem();
$oPlanet->setAttribute($val);
$planet_list[] = $oPlanet;
}
} else {
$planet_list = array();
}
Context::set('planet_list', $planet_list);
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// 템플릿 파일을 지정
$tpl_file = 'list';
if (!$args->thumbnail_width) {
$args->thumbnail_width = 50;
}
if (!$args->thumbnail_height) {
$args->thumbnail_height = 50;
}
$widget_info->thumbnail_width = $args->thumbnail_width;
$widget_info->thumbnail_height = $args->thumbnail_height;
$widget_info->domain = Context::getDefaultUrl();
if (!$args->show_number_of_comments) {
$args->show_number_of_comments = "N";
}
if (!$args->show_author_name) {
$args->show_author_name = "N";
}
$widget_info->show_number_of_comments = $args->show_number_of_comments;
$widget_info->show_author_name = $args->show_author_name;
$widget_info->content_cut_size = $args->content_cut_size;
Context::set('widget_info', $widget_info);
// 템플릿 컴파일
$oTemplate =& TemplateHandler::getInstance();
$output = $oTemplate->compile($tpl_path, $tpl_file);
return $output;
}
示例2: proc
/**
* @brief 위젯의 실행 부분
*
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
$oModuleModel =& getModel('module');
// 대상 모듈 (mid_list는 기존 위젯의 호환을 위해서 처리하는 루틴을 유지. module_srl로 위젯에서 변경)
if ($args->mid_list) {
$tmp_mid = explode(",", $args->mid_list);
$args->mid = $tmp_mid[0];
}
if ($args->mid) {
$args->srl = $oModuleModel->getModuleSrlByMid($args->mid);
if (is_array($args->srl)) {
$args->srl = $args->srl[0];
}
}
$obj->module_srl = $args->srl;
// 선택된 모듈이 없으면 실행 취소
if (!$obj->module_srl) {
return Context::getLang('msg_not_founded');
}
// 모듈의 정보를 구함
$module_info = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl);
// 대상 모듈의 카테고리 파일을 불러옴
$oDocumentModel =& getModel('document');
$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
// 전체 개수를 구함
$widget_info->total_document_count = $oDocumentModel->getDocumentCount($obj->module_srl);
$widget_info->module_info = $module_info;
$widget_info->mid = $module_info->mid;
$widget_info->document_category = $document_category;
$widget_info->category_list = $category_list;
$widget_info->total_title = $args->total_title;
if ($module_info->site_srl) {
$site_module_info = Context::get('site_module_info');
if ($site_module_info->site_srl == $module_info->site_srl) {
$widget_info->domain = $site_module_info->domain;
} else {
$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
$widget_info->domain = $site_info->domain;
}
} else {
$widget_info->domain = Context::getDefaultUrl();
}
Context::set('colorset', $args->colorset);
Context::set('widget_info', $widget_info);
// 템플릿 컴파일
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
$tpl_file = 'category';
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例3: setTextyle
function setTextyle($module_srl)
{
$oTextyleModel =& getModel('textyle');
$this->oTextyle = $oTextyleModel->getTextyle($module_srl);
$this->module_srl = $module_srl;
$this->site_srl = $oTextyle->site_srl;
$oModuleModel =& getModel('module');
$this->site_info = $oModuleModel->getSiteInfo($this->site_srl);
// setting
$setting->language = $oTextyle->default_language;
$setting->domain = Context::getDefaultUrl();
$setting->timezone = $oTextyle->timezone;
$this->setting = $setting;
}
示例4: dispTextmessageAdminConfig
/**
* 기본설정 페이지
*/
function dispTextmessageAdminConfig()
{
$config = textmessageModel::getConfig();
$callback_url = Context::getDefaultUrl();
$callback_url_style = "";
if ($config->callback_url) {
$callback_url = $config->callback_url;
} else {
$callback_url_style = 'style="color:red;"';
}
Context::set('callback_url', $callback_url);
Context::set('callback_url_style', $callback_url_style);
Context::set('config', $config);
// 템플릿 파일 지정
$this->setTemplateFile('config');
}
示例5: proc
/**
* @brief 위젯의 실행 부분
*
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
$oModuleModel =& getModel('module');
// 대상 모듈 추출
if ($args->mid_list) {
$tmp_mid = explode(",", $args->mid_list);
$args->mid = $tmp_mid[0];
}
if ($args->mid) {
$args->srl = $oModuleModel->getModuleSrlByMid($args->mid);
}
// 선택된 모듈이 없으면 실행 취소
$obj->module_srl = $args->srl;
if (!$obj->module_srl) {
return Context::getLang('msg_not_founded');
}
// 모듈의 정보를 구함
$module_info = $oModuleModel->getModuleInfoByModuleSrl($obj->module_srl);
// document 모듈의 model 객체를 받아서 getMonthlyArchivedList() method를 실행
$oDocumentModel =& getModel('document');
$output = $oDocumentModel->getMonthlyArchivedList($obj);
// 템플릿 파일에서 사용할 변수들을 세팅
if ($module_info->site_srl) {
$site_module_info = Context::get('site_module_info');
if ($site_module_info->site_srl == $module_info->site_srl) {
$widget_info->domain = $site_module_info->domain;
} else {
$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
$widget_info->domain = $site_info->domain;
}
} else {
$widget_info->domain = Context::getDefaultUrl();
}
$widget_info->module_info = $module_info;
$widget_info->mid = $module_info->mid;
$widget_info->archive_list = $output->data;
Context::set('widget_info', $widget_info);
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// 템플릿 파일을 지정
$tpl_file = 'archive_list';
// 템플릿 컴파일
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例6: getBookmarkUrl
/**
* @brief bookmark url return
**/
function getBookmarkUrl($member_srl)
{
if (!$member_srl) {
return '';
}
$base_url = Context::getDefaultUrl();
if (!$base_url) {
$base_url = Context::getRequestUrl();
}
$html_url = str_replace('&', '&', $base_url . '?act=dispMaterialPopup&module=material');
$js_url = Context::getRequestUri() . 'modules/material/tpl/js/material_grabber.js';
$auth = $this->getAuthByMemberSrl($member_srl);
if (!$auth) {
$oMaterialController =& getController('material');
$output = $oMaterialController->insertMaterialAuth($member_srl);
$auth = $this->getAuthByMemberSrl($member_srl);
}
$bookmark_url = "javascript:(function(){var w=window,d=document,x=w.open('about:blank','XE_materialGrabWin','width=300,height=0,location=0,scrollbars=0,toolbar=0,status=0,menubar=0,resizable'),s=d.createElement('script');s.setAttribute('src','" . $js_url . "');w.auth='" . $auth . "';w.__xe_root='" . $html_url . "';d.body.appendChild(s);w.setTimeout(function(){x.focus()},100);})();";
return $bookmark_url;
}
示例7: dispSyndicationAdminConfig
public function dispSyndicationAdminConfig()
{
$oModuleModel = getModel('module');
$module_config = $oModuleModel->getModuleConfig('syndication');
if (!$module_config->target_services) {
$module_config->target_services = array();
}
foreach ($this->services as $key => $val) {
unset($obj);
$obj = new stdClass();
$obj->service = $key;
$obj->ping = $val;
$obj->selected = in_array($key, $module_config->target_services) ? true : false;
$services[] = $obj;
}
Context::set('services', $services);
if (!$module_config->site_url) {
$module_config->site_url = Context::getDefaultUrl() ? Context::getDefaultUrl() : getFullUrl();
}
Context::set('site_url', preg_replace('/^(http|https):\\/\\//i', '', $module_config->site_url));
if (!$module_config->year) {
$module_config->year = date("Y");
}
Context::set('year', $module_config->year);
$output = executeQueryArray('syndication.getExceptModules');
$except_module_list = array();
if ($output->data && count($output->data) > 0) {
foreach ($output->data as $item) {
$except_module_list[] = $item;
}
}
Context::set('except_module', $except_module_list);
//Security
$security = new Security();
$security->encodeHTML('services..service', 'except_module..ping');
$security->encodeHTML('except_module..mid', 'except_module..browser_title');
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile('config');
}
示例8: dispSyndicationAdminConfig
public function dispSyndicationAdminConfig()
{
$oModuleModel = getModel('module');
$module_config = $oModuleModel->getModuleConfig('syndication');
$oSyndicationModel = getModel('syndication');
Context::set('ping_log', $oSyndicationModel->getResentPingLog());
if (!$module_config->syndication_use) {
$module_config->syndication_use = 'Y';
}
if (!$module_config->site_url) {
$module_config->site_url = Context::getDefaultUrl() ? Context::getDefaultUrl() : getFullUrl();
}
if (!$module_config->year) {
$module_config->year = date("Y");
}
if (!isset($module_config->syndication_password)) {
$module_config->syndication_password = uniqid();
}
Context::set('syndication_use', $module_config->syndication_use);
Context::set('site_url', preg_replace('/^(http|https):\\/\\//i', '', $module_config->site_url));
Context::set('year', $module_config->year);
Context::set('syndication_token', $module_config->syndication_token);
Context::set('syndication_password', $module_config->syndication_password);
$output = executeQueryArray('syndication.getExceptModules');
$except_module_list = array();
if ($output->data && count($output->data) > 0) {
foreach ($output->data as $item) {
$except_module_list[] = $item;
}
}
Context::set('except_module', $except_module_list);
//Security
$security = new Security();
$security->encodeHTML('services..service', 'except_module..ping');
$security->encodeHTML('except_module..mid', 'except_module..browser_title');
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile('config');
}
示例9: init
/**
* Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action
* @return boolean true: OK, false: redirected
* */
public function init()
{
$oModuleModel = getModel('module');
$site_module_info = Context::get('site_module_info');
// if success_return_url and error_return_url is incorrect
$urls = array(Context::get('success_return_url'), Context::get('error_return_url'));
foreach ($urls as $url) {
if (empty($url)) {
continue;
}
$urlInfo = parse_url($url);
$host = $urlInfo['host'];
$defaultUrl = Context::getDefaultUrl();
if ($defaultUrl) {
$defaultUrlInfo = parse_url($defaultUrl);
$defaultHost = $defaultUrlInfo['host'];
} else {
$defaultHost = $_SERVER['HTTP_HOST'];
}
if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) {
throw new Exception('msg_default_url_is_null');
}
}
if (!$this->document_srl && $this->mid && $this->entry) {
$oDocumentModel = getModel('document');
$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
if ($this->document_srl) {
Context::set('document_srl', $this->document_srl);
}
}
// Get module's information based on document_srl, if it's specified
if ($this->document_srl) {
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
// If the document does not exist, remove document_srl
if (!$module_info) {
unset($this->document_srl);
} else {
// If it exists, compare mid based on the module information
// if mids are not matching, set it as the document's mid
if (!$this->mid || $this->mid != $module_info->mid) {
if (Context::getRequestMethod() == 'GET') {
$this->mid = $module_info->mid;
header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
return FALSE;
} else {
$this->mid = $module_info->mid;
Context::set('mid', $this->mid);
}
}
// if requested module is different from one of the document, remove the module information retrieved based on the document number
if ($this->module && $module_info->module != $this->module) {
unset($module_info);
}
}
}
// If module_info is not set yet, and there exists mid information, get module information based on the mid
if (!$module_info && $this->mid) {
$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
//if($this->module && $module_info->module != $this->module) unset($module_info);
}
// redirect, if module_site_srl and site_srl are different
if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) {
$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
return FALSE;
}
// If module_info is not set still, and $module does not exist, find the default module
if (!$module_info && !$this->module && !$this->mid) {
$module_info = $site_module_info;
}
if (!$module_info && !$this->module && $site_module_info->module_site_srl) {
$module_info = $site_module_info;
}
// redirect, if site_srl of module_info is different from one of site's module_info
if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) {
// If the module is of virtual site
if ($module_info->site_srl) {
$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
$redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
// If it's called from a virtual site, though it's not a module of the virtual site
} else {
if (!Context::getDefaultUrl()) {
return Context::getLang('msg_default_url_is_not_defined');
} else {
$redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry'));
}
}
header("Location: {$redirect_url}");
return FALSE;
}
// If module info was set, retrieve variables from the module information
if ($module_info) {
$this->module = $module_info->module;
$this->mid = $module_info->mid;
$this->module_info = $module_info;
Context::setBrowserTitle($module_info->browser_title);
//.........这里部分代码省略.........
示例10: isInternalURL
/**
* Check if a URL is internal to this site.
*
* @param string $url
* @return bool
*/
public static function isInternalURL($url)
{
$domain = self::getDomainFromURL($url);
if ($domain === false) {
return true;
}
if ($domain === self::getDomainFromURL('http://' . $_SERVER['HTTP_HOST'])) {
return true;
}
if ($domain === self::getDomainFromURL(\Context::getDefaultUrl())) {
return true;
}
return false;
}
示例11: getDefaultMid
/**
* @brief Get the defaul mid according to the domain
*/
function getDefaultMid()
{
$default_url = Context::getDefaultUrl();
if ($default_url && substr_compare($default_url, '/', -1) === 0) {
$default_url = substr($default_url, 0, -1);
}
$request_url = Context::getRequestUri();
if ($request_url && substr_compare($request_url, '/', -1) === 0) {
$request_url = substr($request_url, 0, -1);
}
$default_url_parse = parse_url($default_url);
$request_url_parse = parse_url($request_url);
$vid = Context::get('vid');
$mid = Context::get('mid');
// Set up
$domain = '';
$site_info = NULL;
if ($default_url && $default_url_parse['host'] != $request_url_parse['host']) {
$url_info = parse_url($request_url);
$hostname = $url_info['host'];
$path = $url_info['path'];
if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) {
$path = substr($path, 0, -1);
}
$domain = sprintf('%s%s%s', $hostname, $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $path);
}
if ($domain === '') {
if (!$vid) {
$vid = $mid;
}
if ($vid) {
$domain = $vid;
}
}
$oCacheHandler = CacheHandler::getInstance('object', null, true);
// If domain is set, look for subsite
if ($domain !== '') {
$site_info = false;
if ($oCacheHandler->isSupport()) {
$object_key = 'site_info:' . md5($domain);
$domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
$site_info = $oCacheHandler->get($domain_cache_key);
}
if ($site_info === false) {
$args = new stdClass();
$args->domain = $domain;
$output = executeQuery('module.getSiteInfoByDomain', $args);
$site_info = $output->data;
if ($oCacheHandler->isSupport()) {
$oCacheHandler->put($domain_cache_key, $site_info);
}
}
if ($site_info && $vid) {
Context::set('vid', $site_info->domain, true);
if (strtolower($mid) == strtolower($site_info->domain)) {
Context::set('mid', $site_info->mid, true);
}
}
if (!$site_info || !$site_info->domain) {
$domain = '';
unset($site_info);
}
}
// If no virtual website was found, get default website
if ($domain === '') {
$site_info = false;
if ($oCacheHandler->isSupport()) {
$object_key = 'default_site';
$default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
$site_info = $oCacheHandler->get($default_site_cache_key);
}
if ($site_info === false) {
$args = new stdClass();
$args->site_srl = 0;
$output = executeQuery('module.getSiteInfo', $args);
// Update the related informaion if there is no default site info
if (!$output->data) {
// Create a table if sites table doesn't exist
$oDB =& DB::getInstance();
if (!$oDB->isTableExists('sites')) {
$oDB->createTableByXmlFile(_XE_PATH_ . 'modules/module/schemas/sites.xml');
}
if (!$oDB->isTableExists('sites')) {
return;
}
// Get mid, language
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
$db_info = Context::getDBInfo();
$domain = Context::getDefaultUrl();
$url_info = parse_url($domain);
$domain = $url_info['host'] . (!empty($url_info['port']) && $url_info['port'] != 80 ? ':' . $url_info['port'] : '') . $url_info['path'];
$site_args = new stdClass();
$site_args->site_srl = 0;
$site_args->index_module_srl = $mid_output->data->module_srl;
$site_args->domain = $domain;
$site_args->default_language = $db_info->lang_type;
if ($output->data && !$output->data->index_module_srl) {
//.........这里部分代码省略.........
示例12: moduleUpdate
/**
* Execute update
* @return Object
*/
function moduleUpdate()
{
$oDB =& DB::getInstance();
// 2009. 02. 11 menu added to the table site_srl
if (!$oDB->isColumnExists('menu', 'site_srl')) {
$oDB->addColumn('menu', 'site_srl', 'number', 11, 0, true);
}
// 2012. 02. 01 title index check
if (!$oDB->isIndexExists("menu", "idx_title")) {
$oDB->addIndex('menu', 'idx_title', array('title'));
}
// 2015. 06. 15 add column desc
if (!$oDB->isColumnExists('menu_item', 'desc')) {
$oDB->addColumn('menu_item', 'desc', 'varchar', 250, "", true);
}
// 1.7(maserati) shortcut column add and mirgration
if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) {
$oDB->addColumn('menu_item', 'is_shortcut', 'char', 1, 'N');
// check empty url and change shortcut type
$oMenuAdminModel = getAdminModel('menu');
$output = $oMenuAdminModel->getMenus();
if (is_array($output)) {
$menuItemUniqueList = array();
$menuItemAllList = array();
foreach ($output as $key => $value) {
unset($args);
$args->menu_srl = $value->menu_srl;
$output2 = executeQueryArray('menu.getMenuItems', $args);
if (is_array($output2->data)) {
foreach ($output2->data as $key2 => $value2) {
$menuItemAllList[$value2->menu_item_srl] = $value2->url;
if (!in_array($value2->url, $menuItemUniqueList)) {
$menuItemUniqueList[$value2->menu_item_srl] = $value2->url;
}
// if url is empty, change type to shortcurt
if ($value2->is_shortcut == 'N' && (!$value2->url || strncasecmp('http', $value2->url, 4) === 0)) {
$value2->is_shortcut = 'Y';
$output3 = executeQuery('menu.updateMenuItem', $value2);
}
}
}
}
$oModuleModel = getModel('module');
// if duplicate reference, change type to shortcut
$shortcutItemList = array_diff_assoc($menuItemAllList, $menuItemUniqueList);
foreach ($output as $key => $value) {
unset($args);
$args->menu_srl = $value->menu_srl;
$output2 = executeQueryArray('menu.getMenuItems', $args);
if (is_array($output2->data)) {
foreach ($output2->data as $key2 => $value2) {
if (!empty($value2->url) && strncasecmp('http', $value2->url, 4) !== 0) {
$moduleInfo = $oModuleModel->getModuleInfoByMid($value2->url);
if (!$moduleInfo->module_srl) {
$value2->url = Context::getDefaultUrl();
if (!$value2->url) {
$value2->url = '#';
}
$value2->is_shortcut = 'Y';
$updateOutput = executeQuery('menu.updateMenuItem', $value2);
}
}
if ($shortcutItemList[$value2->menu_item_srl]) {
$value2->is_shortcut = 'Y';
$output3 = executeQuery('menu.updateMenuItem', $value2);
}
}
}
}
}
$this->recompileCache();
}
// for 1.7.4 update, 기존에 생성된 Temporary menu 항목 정리
$oMenuAdminModel = getAdminModel('menu');
$args = new stdClass();
$args->title = array("Temporary menu");
$temp_menus = executeQueryArray('menu.getMenuByTitle', $args);
$args = new stdClass();
if ($temp_menus->toBool() && count($temp_menus->data)) {
$oMenuAdminController = getAdminController('menu');
foreach ($temp_menus->data as $menu) {
$args->current_menu_srl = $menu->menu_srl;
$args->menu_srl = $oMenuAdminController->getUnlinkedMenu();
$output3 = executeQuery('menu.updateMenuItems', $args);
if ($output3->toBool()) {
// delete
$oMenuAdminController->deleteMenu($menu->menu_srl);
}
}
$this->recompileCache();
}
return new Object(0, 'success_updated');
}
示例13: iconUrlCheck
function iconUrlCheck($iconname, $default_icon_name, $default)
{
$site_info = Context::get('site_module_info');
$virtual_site = '';
if ($site_info->site_srl) {
$virtual_site = $site_info->site_srl . '/';
}
$file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
if (!$file_exsit && $default === true) {
$icon_url = './modules/admin/tpl/img/' . $default_icon_name;
} elseif ($file_exsit) {
$default_url = Context::getDefaultUrl();
$icon_url = $default_url . 'files/attach/xeicon/' . $virtual_site . $iconname;
}
return $icon_url;
}
示例14: setDomain
function setDomain($domain)
{
static $default_domain = null;
if (!$domain) {
if (is_null($default_domain)) {
$default_domain = Context::getDefaultUrl();
}
$domain = $default_domain;
}
$this->domain = $domain;
}
示例15: init
/**
* Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action
* @return boolean true: OK, false: redirected
* */
public function init()
{
$oModuleModel = getModel('module');
$site_module_info = Context::get('site_module_info');
// if success_return_url and error_return_url is incorrect
$urls = array(Context::get('success_return_url'), Context::get('error_return_url'));
foreach ($urls as $url) {
if (empty($url)) {
continue;
}
if ($host = parse_url($url, PHP_URL_HOST)) {
$defaultHost = parse_url(Context::getDefaultUrl(), PHP_URL_HOST);
if ($host !== $defaultHost) {
$siteModuleHost = $site_module_info->domain;
if (strpos($siteModuleHost, '/') !== false) {
$siteModuleHost = parse_url($siteModuleHost, PHP_URL_HOST);
}
if ($host !== $siteModuleHost) {
Context::set('success_return_url', null);
Context::set('error_return_url', null);
}
}
}
}
if (!$this->document_srl && $this->mid && $this->entry) {
$oDocumentModel = getModel('document');
$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
if ($this->document_srl) {
Context::set('document_srl', $this->document_srl);
}
}
// Get module's information based on document_srl, if it's specified
if ($this->document_srl) {
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
// If the document does not exist, remove document_srl
if (!$module_info) {
if (Context::getRequestMethod() == 'GET') {
$this->error = 'The document does not exist';
$this->httpStatusCode = '404';
return true;
} else {
unset($this->document_srl);
}
} else {
// If it exists, compare mid based on the module information
// if mids are not matching, set it as the document's mid
if (!$this->mid || $this->mid != $module_info->mid) {
if (Context::getRequestMethod() == 'GET') {
Context::setCacheControl(0);
header('location: ' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $module_info->mid, 'document_srl', $this->document_srl), true, 301);
return false;
} else {
$this->mid = $module_info->mid;
Context::set('mid', $this->mid);
}
}
// if requested module is different from one of the document, remove the module information retrieved based on the document number
if ($this->module && $module_info->module != $this->module) {
unset($module_info);
}
// if the secret document permission does not have, specify HTTP 403
if (Context::getRequestMethod() == 'GET') {
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($this->document_srl);
if ($oDocument->isSecret() || $oDocument->get('status') === $oDocumentModel->getConfigStatus('temp')) {
if (!$oDocument->isGranted() && !$oDocument->isAccessible()) {
$this->httpStatusCode = '403';
}
}
}
}
}
// If module_info is not set yet, and there exists mid information, get module information based on the mid
if (!$module_info && $this->mid) {
$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
//if($this->module && $module_info->module != $this->module) unset($module_info);
}
// redirect, if module_site_srl and site_srl are different
if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) {
Context::setCacheControl(0);
$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
header('location: ' . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid), true, 301);
return false;
}
// If module_info is not set still, and $module does not exist, find the default module
if (!$module_info && !$this->module && !$this->mid) {
$module_info = $site_module_info;
}
if (!$module_info && !$this->module && $site_module_info->module_site_srl) {
$module_info = $site_module_info;
}
// redirect, if site_srl of module_info is different from one of site's module_info
if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !Rhymix\Framework\UA::isRobot()) {
// If the module is of virtual site
if ($module_info->site_srl) {
$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
//.........这里部分代码省略.........