issue 106 Add support for CDN

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8764 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-08-12 09:24:54 +00:00
parent 52b3ae8d4f
commit e6eb7a75d2
19 changed files with 412 additions and 163 deletions

View file

@ -24,8 +24,7 @@ class Context {
var $ftp_info = NULL; ///< FTP info. var $ftp_info = NULL; ///< FTP info.
var $ssl_actions = array(); ///< list of actions to be sent via ssl (it is used by javascript xml handler for ajax) var $ssl_actions = array(); ///< list of actions to be sent via ssl (it is used by javascript xml handler for ajax)
var $js_files_map = array(); ///< hash map of javascript files. The file name is used as a key var $oFrontEndFileHandler;
var $css_files_map = array(); ///< hash map of css files. The file name is used as a key
var $html_header = NULL; ///< script codes in <head>..</head> var $html_header = NULL; ///< script codes in <head>..</head>
var $body_class = array(); ///< classnames of <body> var $body_class = array(); ///< classnames of <body>
@ -57,6 +56,14 @@ class Context {
return $theInstance; return $theInstance;
} }
/**
* @brief cunstructor
**/
function Context()
{
$this->oFrontEndFileHandler = new FrontEndFileHandler();
}
/** /**
* @brief initialization, it sets DB information, request arguments and so on. * @brief initialization, it sets DB information, request arguments and so on.
* @return none * @return none
@ -987,6 +994,7 @@ class Context {
/** /**
* @brief normalize file path * @brief normalize file path
* @return normalized file path * @return normalized file path
* @deprecated
*/ */
function normalizeFilePath($file) { function normalizeFilePath($file) {
if(strpos($file,'://')===false && $file{0}!='/' && $file{0}!='.') $file = './'.$file; if(strpos($file,'://')===false && $file{0}!='/' && $file{0}!='.') $file = './'.$file;
@ -996,6 +1004,9 @@ class Context {
return $file; return $file;
} }
/**
* @deprecated
**/
function getAbsFileUrl($file) { function getAbsFileUrl($file) {
$file = Context::normalizeFilePath($file); $file = Context::normalizeFilePath($file);
if(strpos($file,'./')===0) $file = dirname($_SERVER['SCRIPT_NAME']).'/'.substr($file,2); if(strpos($file,'./')===0) $file = dirname($_SERVER['SCRIPT_NAME']).'/'.substr($file,2);
@ -1004,37 +1015,54 @@ class Context {
return $file; return $file;
} }
/**
* @brief load front end file
* @params $args array
* case js
* $args[0]: file name
* $args[1]: type (head | body)
* $args[2]: target IE
* $args[3]: index
* case css
* $args[0]: file name
* $args[1]: media
* $args[2]: target IE
* $args[3]: index
**/
function loadFile($args, $cdnPath = '')
{
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->loadFile($args, $cdnPath);
}
function unloadFile($file, $targetIe = '', $media = 'all')
{
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetIe, $media);
}
function unloadAllFiles($type = 'all')
{
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->unloadAllFiles($type);
}
/** /**
* @brief Add the js file * @brief Add the js file
* @deprecated
**/ **/
function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head') { function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head') {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->loadFile(array($file, $type, $targetie, $index));
$avail_types = array('head', 'body');
if(!in_array($type, $avail_types)) $type = $avail_types[0];
$key = Context::getAbsFileUrl($file)."\t".$targetie;
$map = &$self->js_files_map;
// Is this file already registered?
if (!is_array($map[$type])) $map[$type] = array();
if (!isset($map[$type][$key]) || (int)$map[$type][$key] > (int)$index) $map[$type][$key] = (int)$index+count($map[$type])/1000-1;
} }
/** /**
* @brief Remove the js file * @brief Remove the js file
* @deprecated
**/ **/
function unloadJsFile($file, $optimized = false, $targetie = '') { function unloadJsFile($file, $optimized = false, $targetie = '') {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetie);
$remove_key = Context::getAbsFileUrl($file)."\t$targetie";
foreach($self->js_files_map as $key=>$val) {
if($key === $remove_key) {
unset($self->js_files_map[$key]);
return;
}
}
} }
/** /**
@ -1042,7 +1070,7 @@ class Context {
**/ **/
function unloadAllJsFiles() { function unloadAllJsFiles() {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->js_files_map = array(); $self->oFrontEndFileHandler->unloadAllJsFiles();
} }
/** /**
@ -1075,50 +1103,25 @@ class Context {
**/ **/
function getJsFile($type='head') { function getJsFile($type='head') {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->oFrontEndFileHandler->getJsFileList($type);
if(!is_array($self->js_files_map[$type])) $self->js_files_map[$type] = array();
$ret = array();
$map = &$self->js_files_map[$type];
asort($self->js_files_map[$type]);
foreach($map as $key=>$val) {
list($file, $targetie) = explode("\t", $key);
$ret[] = array('file'=>$file, 'targetie'=>$targetie);
}
return $ret;
} }
/** /**
* @brief Add CSS file * @brief Add CSS file
* @deprecated
**/ **/
function addCSSFile($file, $optimized=false, $media='all', $targetie='',$index=0) { function addCSSFile($file, $optimized=false, $media='all', $targetie='',$index=0) {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->loadFile(array($file, $media, $targetie, $index));
if(!$media) $media = 'all';
$key = Context::getAbsFileUrl($file)."\t$targetie\t$media";
$map = &$self->css_files_map;
if (!isset($map[$key]) || (int)$map[$key] > (int)$index) $map[$key] = (int)$index+count($map)/100-1;
} }
/** /**
* @brief Remove css file * @brief Remove css file
* @deprecated
**/ **/
function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') { function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetie, $media);
$remove_key = Context::getAbsFileUrl($file)."\t$targetie\t$media";
foreach($self->css_files_map as $key => $val) {
if($key === $remove_key) {
unset($self->css_files_map[$key]);
return;
}
}
} }
/** /**
@ -1126,7 +1129,7 @@ class Context {
**/ **/
function unloadAllCSSFiles() { function unloadAllCSSFiles() {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->css_files_map = array(); $self->oFrontEndFileHandler->unloadAllCssFiles();
} }
/** /**
@ -1134,16 +1137,7 @@ class Context {
**/ **/
function getCSSFile() { function getCSSFile() {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->oFrontEndFileHandler->getCssFileList();
asort($self->css_files_map);
$ret = array();
foreach($self->css_files_map as $key=>$val) {
list($_file, $_targetie, $_media) = explode("\t", $key);
$ret[] = array('file'=>$_file, 'media'=>$_media, 'targetie'=>$_targetie);
}
return $ret;
} }
/** /**
@ -1168,8 +1162,8 @@ class Context {
if(!$filename) continue; if(!$filename) continue;
if(substr($filename,0,2)=='./') $filename = substr($filename,2); if(substr($filename,0,2)=='./') $filename = substr($filename,2);
if(preg_match('/\.js$/i', $filename)) $self->addJsFile($plugin_path.$filename, false, '', 0, 'body'); if(preg_match('/\.js$/i', $filename)) $self->loadFile(array($plugin_path.$filename, 'body', '', 0));
elseif(preg_match('/\.css$/i', $filename)) $self->addCSSFile($plugin_path.$filename, false, 'all', '', 0); elseif(preg_match('/\.css$/i', $filename)) $self->loadFile(array($plugin_path.$filename, 'all', '', 0));
} }
if(is_dir($plugin_path.'lang')) $self->loadLang($plugin_path.'lang'); if(is_dir($plugin_path.'lang')) $self->loadLang($plugin_path.'lang');

View file

@ -5,7 +5,7 @@ class HTMLDisplayHandler {
* @brief Produce HTML compliant content given a module object.\n * @brief Produce HTML compliant content given a module object.\n
* @param[in] $oModule the module object * @param[in] $oModule the module object
**/ **/
function toDoc(&$oModule) function toDoc(&$oModule)
{ {
$oTemplate = &TemplateHandler::getInstance(); $oTemplate = &TemplateHandler::getInstance();
@ -14,7 +14,7 @@ class HTMLDisplayHandler {
$skin = $oModule->origin_module_info->skin; $skin = $oModule->origin_module_info->skin;
else else
$skin = $oModule->module_config->skin; $skin = $oModule->module_config->skin;
if ($skin){ if ($skin){
$theme_skin = explode('.', $skin); $theme_skin = explode('.', $skin);
if (count($theme_skin) == 2) if (count($theme_skin) == 2)
@ -58,7 +58,7 @@ class HTMLDisplayHandler {
// search if the changes CSS exists in the admin layout edit window // search if the changes CSS exists in the admin layout edit window
$edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);
if(file_exists($edited_layout_css)) Context::addCSSFile($edited_layout_css,true,'all','',100); if(file_exists($edited_layout_css)) Context::loadFile(array($edited_layout_css,'all','',100));
} }
if(!$layout_path) $layout_path = "./common/tpl"; if(!$layout_path) $layout_path = "./common/tpl";
if(!$layout_file) $layout_file = "default_layout"; if(!$layout_file) $layout_file = "default_layout";
@ -76,7 +76,7 @@ class HTMLDisplayHandler {
function prepareToPrint(&$output) { function prepareToPrint(&$output) {
if(Context::getResponseMethod() != 'HTML') return; if(Context::getResponseMethod() != 'HTML') return;
if(__DEBUG__==3) $start = getMicroTime(); if(__DEBUG__==3) $start = getMicroTime();
// move <style ..></style> in body to the header // move <style ..></style> in body to the header
@ -146,13 +146,12 @@ class HTMLDisplayHandler {
} }
/** /**
* @brief add given .css or .js file names in widget code to Context * @brief add given .css or .js file names in widget code to Context
* @param[in] $oModule the module object * @param[in] $oModule the module object
**/ **/
function _transMeta($matches) { function _transMeta($matches) {
if($matches[1]) return ''; if($matches[1]) return '';
if(substr($matches[2],'-4')=='.css') Context::addCSSFile($matches[2]); Context::loadFile($matches[2]);
elseif(substr($matches[2],'-3')=='.js') Context::addJSFile($matches[2]);
} }
function _loadJSCSS() function _loadJSCSS()
@ -162,31 +161,31 @@ class HTMLDisplayHandler {
// add common JS/CSS files // add common JS/CSS files
if(__DEBUG__) { if(__DEBUG__) {
$oContext->addJsFile('./common/js/jquery.js', false, '', -100000); $oContext->loadFile(array('./common/js/jquery.js', 'head', '', -100000));
$oContext->addJsFile('./common/js/x.js', false, '', -100000); $oContext->loadFile(array('./common/js/x.js', 'head', '', -100000));
$oContext->addJsFile('./common/js/common.js', false, '', -100000); $oContext->loadFile(array('./common/js/common.js', 'head', '', -100000));
$oContext->addJsFile('./common/js/js_app.js', false, '', -100000); $oContext->loadFile(array('./common/js/js_app.js', 'head', '', -100000));
$oContext->addJsFile('./common/js/xml_handler.js', false, '', -100000); $oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000));
$oContext->addJsFile('./common/js/xml_js_filter.js', false, '', -100000); $oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000));
$oContext->addCSSFile('./common/css/default.css', false, 'all', '', -100000); $oContext->loadFile(array('./common/css/default.css', 'all', '', -100000));
$oContext->addCSSFile('./common/css/button.css', false, 'all', '', -100000); $oContext->loadFile(array('./common/css/button.css', 'all', '', -100000));
} else { } else {
$oContext->addJsFile('./common/js/jquery.min.js', false, '', -100000); $oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -100000));
$oContext->addJsFile('./common/js/x.min.js', false, '', -100000); $oContext->loadFile(array('./common/js/x.min.js', 'head', '', -100000));
$oContext->addJsFile('./common/js/xe.min.js', false, '', -100000); $oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -100000));
$oContext->addCSSFile('./common/css/xe.min.css', false, 'all', '', -100000); $oContext->loadFile(array('./common/css/xe.min.css', 'all', '', -100000));
} }
// for admin page, add admin css // for admin page, add admin css
if(Context::get('module')=='admin' || strpos(Context::get('act'),'Admin')>0){ if(Context::get('module')=='admin' || strpos(Context::get('act'),'Admin')>0){
if(__DEBUG__) { if(__DEBUG__) {
$oContext->addCSSFile('./modules/admin/tpl/css/admin.css', false, 'all', '', 100000); $oContext->loadFile(array('./modules/admin/tpl/css/admin.css', 'all', '', 100000));
$oContext->addCSSFile("./modules/admin/tpl/css/admin_{$lang_type}.css", false, 'all', '', 100000); $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", 'all', '', 100000));
$oContext->addJsFile('./modules/admin/tpl/js/admin.js'); $oContext->loadFile('./modules/admin/tpl/js/admin.js');
} else { } else {
$oContext->addCSSFile('./modules/admin/tpl/css/admin.min.css', false, 'all', '', 100000); $oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', 'all', '', 100000));
$oContext->addCSSFile("./modules/admin/tpl/css/admin_{$lang_type}.min.css", false, 'all', '',10000); $oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.min.css", 'all', '',10000));
$oContext->addJsFile('./modules/admin/tpl/js/admin.js'); $oContext->loadFile('./modules/admin/tpl/js/admin.js');
} }
} }
} }

View file

@ -0,0 +1,224 @@
<?php
/**
* @class FrontEndFileHandler
* @author NHN (developer@xpressengine.com)
**/
class FrontEndFileHandler extends Handler
{
var $cssMap = array();
var $jsHeadMap = array();
var $jsBodyMap = array();
var $cssMapIndex = array();
var $jsHeadMapIndex = array();
var $jsBodyMapIndex = array();
/**
* @brief load front end file
* @params $args array
* case js
* $args[0]: file name
* $args[1]: type (head | body)
* $args[2]: target IE
* $args[3]: index
* case css
* $args[0]: file name
* $args[1]: media
* $args[2]: target IE
* $args[3]: index
**/
function loadFile($args, $cdnPath = '')
{
if (!is_array($args)) $args = array($args);
$pathInfo = pathinfo($args[0]);
$file->fileName = $pathInfo['basename'];
$file->filePath = $this->_getAbsFileUrl($pathInfo['dirname']);
$file->fileExtension = strtolower($pathInfo['extension']);
$file->cdnPath = $cdnPath;
$availableExtension = array('css', 'js');
if (!in_array($file->fileExtension, $availableExtension)) return;
$file->targetIe = $args[2];
$file->index = (int)$args[3];
if ($file->fileExtension == 'css')
{
$file->media = $args[1];
$map = &$this->cssMap;
$mapIndex = &$this->cssMapIndex;
$key = $file->filePath . $file->fileName . "\t" . $file->targetIe . "\t" . $file->media;
}
else if ($file->fileExtension == 'js')
{
$type = $args[1];
if ($type == 'body')
{
$map = &$this->jsBodyMap;
$mapIndex = &$this->jsBodyMapIndex;
}
else
{
$map = &$this->jsHeadMap;
$mapIndex = &$this->jsHeadMapIndex;
}
$key = $file->filePath . $file->fileName . "\t" . $file->targetIe;
}
if (!isset($map[$key]) || $map[$key]->index > $file->index)
{
$file->index = ((int)$file->index + count($map));
$map[$key] = $file;
$mapIndex[$key] = $file->index;
}
debugPrint($file);
}
function unloadFile($fileName, $targetIe = '', $media = 'all')
{
$pathInfo = pathinfo($fileName);
$fileName = $pathInfo['basename'];
$filePath = $this->_getAbsFileUrl($pathInfo['dirname']);
$fileExtension = strtolower($pathInfo['extension']);
$key = $filePath . $fileName . "\t" . $targetIe;
if ($fileExtension == 'css')
{
$key .= "\t" . $media;
unset($this->cssMap[$key]);
unset($this->cssMapIndex[$key]);
}
else
{
unset($this->jsHeadMap[$key]);
unset($this->jsBodyMap[$key]);
unset($this->jsHeadMapIndex[$key]);
unset($this->jsBodyMapIndex[$key]);
}
}
function unloadAllFiles($type = 'all')
{
if ($type == 'css' || $type == 'all')
{
$cssMap = array();
$cssMapIndex = array();
}
if ($type == 'js' || $type == 'all')
{
$jsHeadMap = array();
$jsBodyMap = array();
$jsHeadMapIndex = array();
$jsBodyMapIndex = array();
}
}
function getCssFileList()
{
$map = &$this->cssMap;
$mapIndex = &$this->cssMapIndex;
$this->_sortMap($map, $mapIndex);
$dbInfo = Context::get('db_info');
$useCdn = $dbInfo->use_cdn;
$result = array();
foreach($map as $file)
{
if ($useCdn == 'Y' && $file->cdnPath)
{
$fullFilePath = __XE_CDN__ . $file->cdnPath . '/' . $file->fileName;
}
else
{
$fullFilePath = $file->filePath . '/' . $file->fileName;
}
$result[] = array('file' => $fullFilePath, 'media' => $file->media, 'targetie' => $file->targetIe);
}
return $result;
}
function getJsFileList($type = 'head')
{
if ($type == 'head')
{
$map = &$this->jsHeadMap;
$mapIndex = &$this->jsHeadMapIndex;
}
else
{
$map = &$this->jsBodyMap;
$mapIndex = &$this->jsBodyMapIndex;
}
$this->_sortMap($map, $mapIndex);
$dbInfo = Context::get('db_info');
$useCdn = $dbInfo->use_cdn;
$result = array();
foreach($map as $file)
{
if ($useCdn == 'Y' && $file->cdnPath)
{
$fullFilePath = __XE_CDN__ . $file->cdnPath . '/' . $file->fileName;
}
else
{
$fullFilePath = $file->filePath . '/' . $file->fileName;
}
$result[] = array('file' => $fullFilePath, 'targetie' => $file->targetIe);
}
return $result;
}
function _sortMap(&$map, &$index)
{
asort($index);
$sortedMap = array();
foreach($index as $key => $val)
{
$sortedMap[$key] = $map[$key];
}
$map = $sortedMap;
}
function _normalizeFilePath($path)
{
if (strpos($path, '://') === false && $path{0} != '/' && $path{0} != '.')
{
$path = './' . $path;
}
$path = preg_replace('@/\./|(?<!:)\/\/@', '/', $path);
while(strpos($path, '/../'))
{
$path = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $path, 1);
}
return $path;
}
function _getAbsFileUrl($path)
{
$path = $this->_normalizeFilePath($path);
if(strpos($path, './') === 0)
{
$path = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($path, 2);
}
else if(strpos($file, '../') === 0)
{
$file = $this->_normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$path}");
}
return $path;
}
}

View file

@ -2,19 +2,19 @@
/** /**
* @class TemplateHandler * @class TemplateHandler
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief template compiler * @brief template compiler
* @version 0.1 * @version 0.1
* @remarks It compiles template file by using regular expression into php * @remarks It compiles template file by using regular expression into php
* code, and XE caches compiled code for further uses * code, and XE caches compiled code for further uses
**/ **/
class TemplateHandler extends Handler { class TemplateHandler extends Handler {
var $compiled_path = './files/cache/template_compiled/'; ///< path of compiled caches files var $compiled_path = './files/cache/template_compiled/'; ///< path of compiled caches files
var $path = null; ///< target directory var $path = null; ///< target directory
var $filename = null; ///< target filename var $filename = null; ///< target filename
var $file = null; ///< target file (fullpath) var $file = null; ///< target file (fullpath)
var $xe_path = null; ///< XpressEngine base path var $xe_path = null; ///< XpressEngine base path
var $web_path = null; ///< tpl file web path var $web_path = null; ///< tpl file web path
var $compiled_file = null; ///< tpl file web path var $compiled_file = null; ///< tpl file web path
@ -42,11 +42,11 @@
* @brief set variables for template compile * @brief set variables for template compile
**/ **/
function init($tpl_path, $tpl_filename, $tpl_file) { function init($tpl_path, $tpl_filename, $tpl_file) {
// verify arguments // verify arguments
if(substr($tpl_path,-1)!='/') $tpl_path .= '/'; if(substr($tpl_path,-1)!='/') $tpl_path .= '/';
if(!file_exists($tpl_path.$tpl_filename)&&file_exists($tpl_path.$tpl_filename.'.html')) $tpl_filename .= '.html'; if(!file_exists($tpl_path.$tpl_filename)&&file_exists($tpl_path.$tpl_filename.'.html')) $tpl_filename .= '.html';
// create tpl_file variable // create tpl_file variable
if(!$tpl_file) $tpl_file = $tpl_path.$tpl_filename; if(!$tpl_file) $tpl_file = $tpl_path.$tpl_filename;
// set template file infos. // set template file infos.
@ -69,11 +69,11 @@
} }
/** /**
* @brief compiles specified tpl file and execution result in Context into resultant content * @brief compiles specified tpl file and execution result in Context into resultant content
* @param[in] $tpl_path path of the directory containing target template file * @param[in] $tpl_path path of the directory containing target template file
* @param[in] $tpl_filename target template file's name * @param[in] $tpl_filename target template file's name
* @param[in] $tpl_file if specified use it as template file's full path * @param[in] $tpl_file if specified use it as template file's full path
* @return Returns compiled result in case of success, NULL otherwise * @return Returns compiled result in case of success, NULL otherwise
*/ */
function compile($tpl_path, $tpl_filename, $tpl_file = '') { function compile($tpl_path, $tpl_filename, $tpl_file = '') {
// store the starting time for debug information // store the starting time for debug information
@ -136,16 +136,16 @@
} }
/** /**
* @brief compile a template file specified in $tpl_file and * @brief compile a template file specified in $tpl_file and
* @pre files specified by $tpl_file exists. * @pre files specified by $tpl_file exists.
* @param[in] $tpl_file path of tpl file * @param[in] $tpl_file path of tpl file
* @param[in] $compiled_tpl_file if specified, write compiled result into the file * @param[in] $compiled_tpl_file if specified, write compiled result into the file
* @return compiled result in case of success or NULL in case of error * @return compiled result in case of success or NULL in case of error
**/ **/
function parse() { function parse() {
if(!file_exists($this->file)) return; if(!file_exists($this->file)) return;
// read tpl file // read tpl file
$buff = FileHandler::readFile($this->file); $buff = FileHandler::readFile($this->file);
// replace value of src in img/input/script tag // replace value of src in img/input/script tag
@ -172,10 +172,10 @@
// replace include <!--#include($filename)--> // replace include <!--#include($filename)-->
$buff = preg_replace_callback('!<\!--#include\(([^\)]*?)\)-->!is', array($this, '_compileIncludeToCode'), $buff); $buff = preg_replace_callback('!<\!--#include\(([^\)]*?)\)-->!is', array($this, '_compileIncludeToCode'), $buff);
// replace <!--@, --> // replace <!--@, -->
$buff = preg_replace_callback('!<\!--@(.*?)-->!is', array($this, '_compileFuncToCode'), $buff); $buff = preg_replace_callback('!<\!--@(.*?)-->!is', array($this, '_compileFuncToCode'), $buff);
// remove comments <!--// ~ --> // remove comments <!--// ~ -->
$buff = preg_replace('!(\n?)( *?)<\!--//(.*?)-->!is', '', $buff); $buff = preg_replace('!(\n?)( *?)<\!--//(.*?)-->!is', '', $buff);
// import xml filter/ css/ js/ files <!--%import("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css) // import xml filter/ css/ js/ files <!--%import("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css)
@ -245,7 +245,7 @@
} }
/** /**
* @brief fetch using ob_* function * @brief fetch using ob_* function
* @param[in] $compiled_tpl_file path of compiled template file * @param[in] $compiled_tpl_file path of compiled template file
* @param[in] $buff if buff is not null, eval it instead of including compiled template file * @param[in] $buff if buff is not null, eval it instead of including compiled template file
* @param[in] $tpl_path set context's tpl path * @param[in] $tpl_path set context's tpl path
@ -271,7 +271,7 @@
* @param[in] $matches match * @param[in] $matches match
* @return changed result * @return changed result
**/ **/
function _replacePath($matches) function _replacePath($matches)
{ {
preg_match_all('/src="([^"]*?)"/is', $matches[0], $m); preg_match_all('/src="([^"]*?)"/is', $matches[0], $m);
for($i=0,$c=count($m[0]);$i<$c;$i++) { for($i=0,$c=count($m[0]);$i<$c;$i++) {
@ -279,7 +279,7 @@
if(substr($path,0,1)=='/' || substr($path,0,1)=='{' || strpos($path,'://')!==false) continue; if(substr($path,0,1)=='/' || substr($path,0,1)=='{' || strpos($path,'://')!==false) continue;
if(substr($path,0,2)=='./') $path = substr($path,2); if(substr($path,0,2)=='./') $path = substr($path,2);
$target = $this->web_path.$path; $target = $this->web_path.$path;
while(strpos($target,'/../')!==false) while(strpos($target,'/../')!==false)
{ {
$target = preg_replace('/\/([^\/]+)\/\.\.\//','/',$target); $target = preg_replace('/\/([^\/]+)\/\.\.\//','/',$target);
} }
@ -358,7 +358,7 @@
} }
} }
if(substr(trim($tag),-2)!='/>') if(substr(trim($tag),-2)!='/>')
{ {
while(false !== $close_pos = strpos($next, '</'.$tag_name)) while(false !== $close_pos = strpos($next, '</'.$tag_name))
{ {
@ -375,7 +375,7 @@
} }
/** /**
* @brief replace pipe cond and |cond= * @brief replace pipe cond and |cond=
**/ **/
function _replacePipeCond($matches) function _replacePipeCond($matches)
{ {
@ -425,7 +425,7 @@
$tag_head .= '<?php if('.$m[1][$i].') { ?>'; $tag_head .= '<?php if('.$m[1][$i].') { ?>';
$tag_tail .= '<?php } ?>'; $tag_tail .= '<?php } ?>';
} }
} }
if(!preg_match('/ cond="([^"]+)"/is',$tag)) { if(!preg_match('/ cond="([^"]+)"/is',$tag)) {
print "<strong>Invalid XpressEngine Template Syntax</strong><br/>"; print "<strong>Invalid XpressEngine Template Syntax</strong><br/>";
@ -435,11 +435,11 @@
} }
$tag = preg_replace('/ cond="([^"]+)"/is','', $tag); $tag = preg_replace('/ cond="([^"]+)"/is','', $tag);
if(substr(trim($tag),-2)=='/>') if(substr(trim($tag),-2)=='/>')
{ {
$buff = $pre.$tag_head.$tag.$tag_tail.$next; $buff = $pre.$tag_head.$tag.$tag_tail.$next;
} }
else else
{ {
while(false !== $close_pos = strpos($next, '</'.$tag_name)) while(false !== $close_pos = strpos($next, '</'.$tag_name))
{ {
@ -452,14 +452,14 @@
$buff = $pre.$tag_head.$tag.$tag_tail.$next; $buff = $pre.$tag_head.$tag.$tag_tail.$next;
} }
} }
return $buff; return $buff;
} }
/** /**
* @brief replace include tags which include other template files * @brief replace include tags which include other template files
**/ **/
function _replaceInclude($matches) function _replaceInclude($matches)
{ {
if(!preg_match('/target=\"([^\"]+)\"/is',$matches[0], $m)) { if(!preg_match('/target=\"([^\"]+)\"/is',$matches[0], $m)) {
print '"target" attribute missing in "'.htmlspecialchars($matches[0]); print '"target" attribute missing in "'.htmlspecialchars($matches[0]);
@ -512,7 +512,7 @@
$base_path = $this->path; $base_path = $this->path;
$target = $attrs['target']; $target = $attrs['target'];
if(!preg_match('/^(http|https)/i',$target)) if(!preg_match('/^(http|https)/i',$target))
{ {
if(substr($target,0,2)=='./') $target = substr($target,2); if(substr($target,0,2)=='./') $target = substr($target,2);
if(substr($target,0,1)!='/') $target = $web_path.$target; if(substr($target,0,1)!='/') $target = $web_path.$target;
@ -567,19 +567,19 @@
// css file // css file
case 'css' : case 'css' :
if($type == 'unload') { if($type == 'unload') {
$output = '<?php Context::unloadCSSFile("'.$source_filename.'"); ?>'; $output = '<?php Context::unloadFile("'.$source_filename.'","'.$attrs['targetie'].'","'.$attrs['media'].'"); ?>';
} else { } else {
$meta_file = $source_filename; $meta_file = $source_filename;
$output = '<?php Context::addCSSFile("'.$source_filename.'",false,"'.$attrs['media'].'","'.$attrs['targetie'].'",'.$attrs['index'].'); ?>'; $output = '<?php Context::loadFile(array("'.$source_filename.'","'.$attrs['media'].'","'.$attrs['targetie'].'","'.$attrs['index'].'"), "'.$attrs['cdn'].'"); ?>';
} }
break; break;
// js file // js file
case 'js' : case 'js' :
if($type == 'unload') { if($type == 'unload') {
$output = '<?php Context::unloadJsFile("'.$source_filename.'"); ?>'; $output = '<?php Context::unloadFile("'.$source_filename.'","'.$attrs['targetie'].'","'.$attrs['media'].'"); ?>';
} else { } else {
$meta_file = $source_filename; $meta_file = $source_filename;
$output = '<?php Context::addJsFile("'.$source_filename.'",false,"'.$attrs['targetie'].'",'.$attrs['index'].',"'.$attrs['type'].'"); ?>'; $output = '<?php Context::loadFile(array("'.$source_filename.'","'.$attrs['type'].'","'.$attrs['targetie'].'","'.$attrs['index'].'"), "'.$attrs['cdn'].'"); ?>';
} }
break; break;
} }
@ -658,7 +658,7 @@
$filename = array_pop($tmp_arr); $filename = array_pop($tmp_arr);
$path = implode('/', $tmp_arr).'/'; $path = implode('/', $tmp_arr).'/';
// try to include // try to include
$output = sprintf( $output = sprintf(
'<?php%s'. '<?php%s'.
'$oTemplate = &TemplateHandler::getInstance();%s'. '$oTemplate = &TemplateHandler::getInstance();%s'.
@ -674,8 +674,8 @@
} }
/** /**
* @brief replace $... variables in { } with Context::get(...) * @brief replace $... variables in { } with Context::get(...)
* @param[in] $matches match * @param[in] $matches match
* @return replaced result in case of success or NULL in case of error * @return replaced result in case of success or NULL in case of error
**/ **/
function _compileVarToContext($matches) { function _compileVarToContext($matches) {
@ -779,7 +779,7 @@
/** /**
* @brief replace xe specific code, "<!--%filename-->" with appropriate php code * @brief replace xe specific code, "<!--%filename-->" with appropriate php code
* @param[in] $matches match * @param[in] $matches match
* @return Returns modified result or NULL in case of error * @return Returns modified result or NULL in case of error
**/ **/
@ -846,19 +846,19 @@
// css file // css file
case 'css' : case 'css' :
if(preg_match('/^(http|\/)/i',$source_filename)) { if(preg_match('/^(http|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::addCSSFile("%s", %s, "%s", "%s", %s); ?>', $source_filename, 'false', $media, $targetie, $index); $output = sprintf('<?php Context::loadFile(array("%s", "%s", "%s", "%s")); ?>', $source_filename, $media, $targetie, $index);
} else { } else {
$meta_file = $base_path.$filename; $meta_file = $base_path.$filename;
$output = sprintf('<?php Context::addCSSFile("%s%s", %s, "%s", "%s", %s); ?>', $base_path, $filename, $optimized, $media, $targetie, $index); $output = sprintf('<?php Context::loadFile(array("%s%s", "%s", "%s", "%s")); ?>', $base_path, $filename, $media, $targetie, $index);
} }
break; break;
// js file // js file
case 'js' : case 'js' :
if(preg_match('/^(http|\/)/i',$source_filename)) { if(preg_match('/^(http|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::addJsFile("%s", %s, "%s", %s,"%s"); ?>', $source_filename, 'false', $targetie, $index, $type); $output = sprintf('<?php Context::loadFile(array("%s", "%s", "%s","%s")); ?>', $source_filename, $type, $targetie, $index);
} else { } else {
$meta_file = $base_path.$filename; $meta_file = $base_path.$filename;
$output = sprintf('<?php Context::addJsFile("%s%s", %s, "%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie, $index, $type); $output = sprintf('<?php Context::loadFile(array("%s%s", "%s", "%s", "%s")); ?>', $base_path, $filename, $type, $targetie, $index);
} }
break; break;
} }
@ -869,7 +869,7 @@
} }
/** /**
* @brief import javascript plugin * @brief import javascript plugin
* @param[in] $matches match * @param[in] $matches match
* @return result loading the plugin * @return result loading the plugin
* @remarks javascript plugin works as optimized = false * @remarks javascript plugin works as optimized = false
@ -881,12 +881,12 @@
} }
/** /**
* @brief remove loading part of css/ js file * @brief remove loading part of css/ js file
* @param[in] $matches match * @param[in] $matches match
* @return removed result * @return removed result
**/ **/
function _compileUnloadCode($matches) { function _compileUnloadCode($matches) {
// find xml file // find xml file
$base_path = $this->path; $base_path = $this->path;
$given_file = trim($matches[1]); $given_file = trim($matches[1]);
if(!$given_file) return; if(!$given_file) return;
@ -915,17 +915,17 @@
// css file // css file
case 'css' : case 'css' :
if(preg_match('/^(http|https|\/)/i',$source_filename)) { if(preg_match('/^(http|https|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::unloadCSSFile("%s", %s, "%s", "%s"); ?>', $source_filename, 'false', $media, $targetie); $output = sprintf('<?php Context::unloadFile("%s", "%s", "%s"); ?>', $source_filename, $targetie, $media);
} else { } else {
$output = sprintf('<?php Context::unloadCSSFile("%s%s", %s, "%s", "%s"); ?>', $base_path, $filename, $optimized, $media, $targetie); $output = sprintf('<?php Context::unloadFile("%s%s", "%s", "%s"); ?>', $base_path, $filename, $targetie, $media);
} }
break; break;
// js file // js file
case 'js' : case 'js' :
if(preg_match('/^(http|https|\/)/i',$source_filename)) { if(preg_match('/^(http|https|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::unloadJsFile("%s", %s, "%s"); ?>', $source_filename, 'false', $targetie); $output = sprintf('<?php Context::unloadFile("%s", "%s"); ?>', $source_filename, $targetie);
} else { } else {
$output = sprintf('<?php Context::unloadJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie); $output = sprintf('<?php Context::unloadFile("%s%s", "%s"); ?>', $base_path, $filename, $targetie);
} }
break; break;
} }

View file

@ -6,8 +6,8 @@
* @version 0.2 * @version 0.2
* *
* it convert xml code into js file and save the result as a cache file * it convert xml code into js file and save the result as a cache file
* @code * @code
* { * {
* <filter name="name of javascript funcion" act="action name" confirm_msg_code="message string to be prompted when submitting the form" > * <filter name="name of javascript funcion" act="action name" confirm_msg_code="message string to be prompted when submitting the form" >
* <form> <-- code to validate data in the form * <form> <-- code to validate data in the form
* <node target="name" required="true" minlength="1" maxlength="5" filter="email,userid,alpha,number" equalto="target" /> * <node target="name" required="true" minlength="1" maxlength="5" filter="email,userid,alpha,number" equalto="target" />
@ -42,7 +42,7 @@
* tag = key : name of variable that will contain the result of the execution * tag = key : name of variable that will contain the result of the execution
* } * }
**/ **/
class XmlJsFilter extends XmlParser { class XmlJsFilter extends XmlParser {
var $version = '0.2.5'; var $version = '0.2.5';
var $compiled_path = './files/cache/js_filter_compiled/'; // / directory path for compiled cache file var $compiled_path = './files/cache/js_filter_compiled/'; // / directory path for compiled cache file
@ -66,7 +66,7 @@
if(!file_exists($this->xml_file)) return; if(!file_exists($this->xml_file)) return;
if(!file_exists($this->js_file)) $this->_compile(); if(!file_exists($this->js_file)) $this->_compile();
else if(filemtime($this->xml_file)>filemtime($this->js_file)) $this->_compile(); else if(filemtime($this->xml_file)>filemtime($this->js_file)) $this->_compile();
Context::addJsFile($this->js_file, false, '',null,'body'); Context::loadFile(array($this->js_file, 'body', '',null));
} }
/** /**
@ -90,7 +90,7 @@
$module = $attrs->module; $module = $attrs->module;
$act = $attrs->act; $act = $attrs->act;
$extend_filter = $attrs->extend_filter; $extend_filter = $attrs->extend_filter;
$field_node = $xml_obj->filter->form->node; $field_node = $xml_obj->filter->form->node;
if($field_node && !is_array($field_node)) $field_node = array($field_node); if($field_node && !is_array($field_node)) $field_node = array($field_node);
@ -181,7 +181,7 @@
// Check extend_filter_item // Check extend_filter_item
$rule_types = array('homepage'=>'homepage', 'email_address'=>'email'); $rule_types = array('homepage'=>'homepage', 'email_address'=>'email');
for($i=0;$i<$extend_filter_count;$i++) { for($i=0;$i<$extend_filter_count;$i++) {
$filter_item = $extend_filter_list[$i]; $filter_item = $extend_filter_list[$i];
$target = trim($filter_item->name); $target = trim($filter_item->name);
@ -265,7 +265,7 @@
$confirm_msg = ''; $confirm_msg = '';
if ($confirm_msg_code) $confirm_msg = $lang->{$confirm_msg_code}; if ($confirm_msg_code) $confirm_msg = $lang->{$confirm_msg_code};
$jsdoc = array(); $jsdoc = array();
$jsdoc[] = "function {$filter_name}(form){ return legacy_filter('{$filter_name}', form, '{$module}', '{$act}', {$callback_func}, [".implode(',', $responses)."], '".addslashes($confirm_msg)."', {".implode(',', $rename_params)."}) };"; $jsdoc[] = "function {$filter_name}(form){ return legacy_filter('{$filter_name}', form, '{$module}', '{$act}', {$callback_func}, [".implode(',', $responses)."], '".addslashes($confirm_msg)."', {".implode(',', $rename_params)."}) };";
$jsdoc[] = '(function($){'; $jsdoc[] = '(function($){';

View file

@ -32,7 +32,7 @@
<!--@if($css_file['targetie'])--> <!--@if($css_file['targetie'])-->
<!--[if {$css_file['targetie']}]> <!--[if {$css_file['targetie']}]>
<!--@end--> <!--@end-->
<link rel="stylesheet" href="{$css_file['file']}?{__ZBXE_VERSION__}" type="text/css" charset="UTF-8" media="{$css_file['media']}" /> <link rel="stylesheet" href="{$css_file['file']}" type="text/css" charset="UTF-8" media="{$css_file['media']}" />
<!--@if($css_file['targetie'])--> <!--@if($css_file['targetie'])-->
<![endif]--> <![endif]-->
<!--@end--> <!--@end-->
@ -42,7 +42,7 @@
<!--@if($js_file['targetie'])--> <!--@if($js_file['targetie'])-->
<!--[if {$js_file['targetie']}]> <!--[if {$js_file['targetie']}]>
<!--@end--> <!--@end-->
<script type="text/javascript" src="{$js_file['file']}?{__ZBXE_VERSION__}"></script> <script type="text/javascript" src="{$js_file['file']}"></script>
<!--@if($js_file['targetie'])--> <!--@if($js_file['targetie'])-->
<![endif]--> <![endif]-->
<!--@end--> <!--@end-->
@ -90,7 +90,7 @@
<!--@if($js_file['targetie'])--> <!--@if($js_file['targetie'])-->
<!--[if {$js_file['targetie']}]> <!--[if {$js_file['targetie']}]>
<!--@end--> <!--@end-->
<script type="text/javascript" src="{$js_file['file']}?{__ZBXE_VERSION__}"></script> <script type="text/javascript" src="{$js_file['file']}"></script>
<!--@if($js_file['targetie'])--> <!--@if($js_file['targetie'])-->
<![endif]--> <![endif]-->
<!--@end--> <!--@end-->

View file

@ -20,14 +20,14 @@
$logged_info = $oMemberModel->getLoggedInfo(); $logged_info = $oMemberModel->getLoggedInfo();
if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator"); if($logged_info->is_admin!='Y') return $this->stop("msg_is_not_administrator");
// change into administration layout // change into administration layout
$this->setTemplatePath($this->module_path.'tpl'); $this->setTemplatePath($this->module_path.'tpl');
$this->setLayoutPath($this->getTemplatePath()); $this->setLayoutPath($this->getTemplatePath());
$this->setLayoutFile('layout.html'); $this->setLayoutFile('layout.html');
$this->makeGnbUrl(); $this->makeGnbUrl();
// Retrieve the list of installed modules // Retrieve the list of installed modules
$db_info = Context::getDBInfo(); $db_info = Context::getDBInfo();
@ -41,6 +41,7 @@
Context::set('use_db_session', $db_info->use_db_session=='N'?'N':'Y'); Context::set('use_db_session', $db_info->use_db_session=='N'?'N':'Y');
Context::set('use_mobile_view', $db_info->use_mobile_view =='Y'?'Y':'N'); Context::set('use_mobile_view', $db_info->use_mobile_view =='Y'?'Y':'N');
Context::set('use_ssl', $db_info->use_ssl?$db_info->use_ssl:"none"); Context::set('use_ssl', $db_info->use_ssl?$db_info->use_ssl:"none");
Context::set('use_cdn', $db_info->use_cdn?$db_info->use_cdn:"none");
if($db_info->http_port) Context::set('http_port', $db_info->http_port); if($db_info->http_port) Context::set('http_port', $db_info->http_port);
if($db_info->https_port) Context::set('https_port', $db_info->https_port); if($db_info->https_port) Context::set('https_port', $db_info->https_port);
@ -117,7 +118,7 @@
if($val->category == 'statistics') $val->category = 'accessory'; if($val->category == 'statistics') $val->category = 'accessory';
if($val->module == 'admin' || !$val->admin_index_act) continue; if($val->module == 'admin' || !$val->admin_index_act) continue;
// get action information // get action information
$action_spec = $oModuleModel->getModuleActionXml($val->module); $action_spec = $oModuleModel->getModuleActionXml($val->module);
$actions = array(); $actions = array();
if($action_spec->default_index_act) $actions[] = $action_spec->default_index_act; if($action_spec->default_index_act) $actions[] = $action_spec->default_index_act;
@ -131,14 +132,14 @@
$obj->index_act = $val->admin_index_act; $obj->index_act = $val->admin_index_act;
if(in_array(Context::get('act'), $actions)) $obj->selected = true; if(in_array(Context::get('act'), $actions)) $obj->selected = true;
// Packages // Packages
if($val->category == 'package') { if($val->category == 'package') {
if($package_idx == 0) $obj->position = "first"; if($package_idx == 0) $obj->position = "first";
else $obj->position = "mid"; else $obj->position = "mid";
$package_modules[] = $obj; $package_modules[] = $obj;
$package_idx ++; $package_idx ++;
if($obj->selected) Context::set('package_selected',true); if($obj->selected) Context::set('package_selected',true);
// Modules // Modules
} else { } else {
$installed_modules[] = $obj; $installed_modules[] = $obj;
} }
@ -194,7 +195,7 @@
Context::set('download_link', $buff->zbxe_news->attrs->download_link); Context::set('download_link', $buff->zbxe_news->attrs->download_link);
} }
// DB Information // DB Information
$db_info = Context::getDBInfo(); $db_info = Context::getDBInfo();
Context::set('selected_lang', $db_info->lang_type); Context::set('selected_lang', $db_info->lang_type);
@ -302,7 +303,7 @@
$output = executeQuery("admin.getDocumentCount", $args); $output = executeQuery("admin.getDocumentCount", $args);
$status->document->total = $output->data->count; $status->document->total = $output->data->count;
// Comment Status // Comment Status
$output = executeQueryArray("admin.getCommentStatus", $args); $output = executeQueryArray("admin.getCommentStatus", $args);
if($output->data) { if($output->data) {
foreach($output->data as $var) { foreach($output->data as $var) {
@ -316,7 +317,7 @@
$output = executeQuery("admin.getCommentCount", $args); $output = executeQuery("admin.getCommentCount", $args);
$status->comment->total = $output->data->count; $status->comment->total = $output->data->count;
// Trackback Status // Trackback Status
$output = executeQueryArray("admin.getTrackbackStatus", $args); $output = executeQueryArray("admin.getTrackbackStatus", $args);
if($output->data) { if($output->data) {
foreach($output->data as $var) { foreach($output->data as $var) {
@ -330,7 +331,7 @@
$output = executeQuery("admin.getTrackbackCount", $args); $output = executeQuery("admin.getTrackbackCount", $args);
$status->trackback->total = $output->data->count; $status->trackback->total = $output->data->count;
// Attached files Status // Attached files Status
$output = executeQueryArray("admin.getFileStatus", $args); $output = executeQueryArray("admin.getFileStatus", $args);
if($output->data) { if($output->data) {
foreach($output->data as $var) { foreach($output->data as $var) {
@ -400,7 +401,7 @@
Context::set('lang_selected', Context::loadLangSelected()); Context::set('lang_selected', Context::loadLangSelected());
Context::set('use_mobile_view', $db_info->use_mobile_view=="Y"?'Y':'N'); Context::set('use_mobile_view', $db_info->use_mobile_view=="Y"?'Y':'N');
$ftp_info = Context::getFTPInfo(); $ftp_info = Context::getFTPInfo();
Context::set('ftp_info', $ftp_info); Context::set('ftp_info', $ftp_info);
@ -441,7 +442,7 @@
Context::addHtmlFooter($img); Context::addHtmlFooter($img);
FileHandler::removeDir($path); FileHandler::removeDir($path);
FileHandler::writeFile($path.__ZBXE_VERSION__,'1'); FileHandler::writeFile($path.__ZBXE_VERSION__,'1');
} else if($_SESSION['enviroment_gather']=='Y' && !file_exists($path.__ZBXE_VERSION__)) { } else if($_SESSION['enviroment_gather']=='Y' && !file_exists($path.__ZBXE_VERSION__)) {
$oAdminAdminModel = &getAdminModel('admin'); $oAdminAdminModel = &getAdminModel('admin');
@ -450,7 +451,7 @@
Context::addHtmlFooter($img); Context::addHtmlFooter($img);
FileHandler::removeDir($path); FileHandler::removeDir($path);
FileHandler::writeFile($path.__ZBXE_VERSION__,'1'); FileHandler::writeFile($path.__ZBXE_VERSION__,'1');
unset($_SESSION['enviroment_gather']); unset($_SESSION['enviroment_gather']);
} }
} }

View file

@ -107,4 +107,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -107,4 +107,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -106,4 +106,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -105,4 +105,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -97,4 +97,6 @@ $lang->status = '상태';
$lang->find_site = '사이트 찾기'; $lang->find_site = '사이트 찾기';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -105,4 +105,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -106,4 +106,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -108,4 +108,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -106,4 +106,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -106,4 +106,6 @@ $lang->find_site = 'Find Site';
$lang->action = '실행'; $lang->action = '실행';
$lang->select_module_id = '모듈 아이디를 선택하세요.'; $lang->select_module_id = '모듈 아이디를 선택하세요.';
$lang->use_cdn = 'CDN 사용';
$lang->about_cdn = 'XE core의 css, js 파일을 CDN으로부터 제공받으려면 체크하세요.';
?> ?>

View file

@ -38,6 +38,13 @@
<p>{$lang->about_rewrite}</p> <p>{$lang->about_rewrite}</p>
</td> </td>
</tr> </tr>
<tr>
<th><div>{$lang->use_cdn}</div></th>
<td>
<input type="checkbox" name="use_cdn" value="Y" <!--@if($use_cdn=='Y')-->checked="checked"<!--@end--> />
<p>{$lang->about_cdn}</p>
</td>
</tr>
<tr> <tr>
<th><div>{$lang->use_sso}</div></th> <th><div>{$lang->use_sso}</div></th>
<td> <td>
@ -110,7 +117,7 @@
<tr> <tr>
<th><div>{$lang->server_ports}</div></th> <th><div>{$lang->server_ports}</div></th>
<td> <td>
HTTP : <input type="text" name="http_port" class="inputTypeText" size="5" value="{$http_port}" />, HTTP : <input type="text" name="http_port" class="inputTypeText" size="5" value="{$http_port}" />,
HTTPS: <input type="text" name="https_port" class="inputTypeText" size="5" value="{$https_port}" /> HTTPS: <input type="text" name="https_port" class="inputTypeText" size="5" value="{$https_port}" />
<p>{$lang->about_server_ports}</p> <p>{$lang->about_server_ports}</p>
</td> </td>
@ -146,7 +153,7 @@
</tr> </tr>
<tr> <tr>
<th scope="col"><div><label for="textfield23">{$lang->ftp_host} (default: 127.0.0.1)</label></div></th> <th scope="col"><div><label for="textfield23">{$lang->ftp_host} (default: 127.0.0.1)</label></div></th>
<td><input id="textfield23" type="text" name="ftp_host" value="{$ftp_info->ftp_host}" class="inputTypeText" /></td> <td><input id="textfield23" type="text" name="ftp_host" value="{$ftp_info->ftp_host}" class="inputTypeText" /></td>
</tr> </tr>
<tr> <tr>
<th scope="col"><div><label for="textfield24">{$lang->ftp_port} (default: 21) </label></div></th> <th scope="col"><div><label for="textfield24">{$lang->ftp_port} (default: 21) </label></div></th>
@ -165,7 +172,7 @@
<tr> <tr>
<th scope="col" rowspan="2"><div>{$lang->msg_ftp_installed_ftp_realpath}<br /><br/>{$lang->msg_ftp_installed_realpath}:<br/> {_XE_PATH_}</div></th> <th scope="col" rowspan="2"><div>{$lang->msg_ftp_installed_ftp_realpath}<br /><br/>{$lang->msg_ftp_installed_realpath}:<br/> {_XE_PATH_}</div></th>
<td> <td>
<input type="text" name="ftp_root_path" value="{$ftp_info->ftp_root_path}" class="inputTypeText w400" /> <input type="text" name="ftp_root_path" value="{$ftp_info->ftp_root_path}" class="inputTypeText w400" />
</td> </td>
</tr> </tr>
<tr id="ftplist"> <tr id="ftplist">

View file

@ -51,6 +51,9 @@
$use_sso = Context::get('use_sso'); $use_sso = Context::get('use_sso');
if($use_sso !='Y') $use_sso = 'N'; 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'); $time_zone = Context::get('time_zone');
$qmail_compatibility = Context::get('qmail_compatibility'); $qmail_compatibility = Context::get('qmail_compatibility');
@ -80,6 +83,7 @@
$db_info->use_rewrite = $use_rewrite; $db_info->use_rewrite = $use_rewrite;
$db_info->use_sso = $use_sso; $db_info->use_sso = $use_sso;
$db_info->use_ssl = $use_ssl; $db_info->use_ssl = $use_ssl;
$db_info->use_cdn = $use_cdn;
$db_info->use_html5 = $use_html5; $db_info->use_html5 = $use_html5;
$db_info->use_mobile_view = $use_mobile_view; $db_info->use_mobile_view = $use_mobile_view;
if($http_port) $db_info->http_port = (int) $http_port; if($http_port) $db_info->http_port = (int) $http_port;
@ -124,7 +128,7 @@
} }
function procInstallAdminRemoveFTPInfo() { function procInstallAdminRemoveFTPInfo() {
$ftp_config_file = Context::getFTPConfigFile(); $ftp_config_file = Context::getFTPConfigFile();
if(file_exists($ftp_config_file)) unlink($ftp_config_file); if(file_exists($ftp_config_file)) unlink($ftp_config_file);
if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
$this->setMessage('success_deleted'); $this->setMessage('success_deleted');
@ -149,7 +153,7 @@
if(ini_get('safe_mode')) { if(ini_get('safe_mode')) {
$ftp_info->ftp_password = Context::get('ftp_password'); $ftp_info->ftp_password = Context::get('ftp_password');
} }
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n"; $buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
foreach($ftp_info as $key => $val) { foreach($ftp_info as $key => $val) {
if(!$val) continue; if(!$val) continue;