merge sandbox to trunk for 1.4.4.2

git-svn-id: http://xe-core.googlecode.com/svn/trunk@7944 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2010-11-30 07:01:36 +00:00
parent 9139515e57
commit f59deeb270
131 changed files with 11605 additions and 4218 deletions

View file

@ -135,6 +135,9 @@
// set authentication information in Context and session
if(Context::isInstalled()) {
$oModuleModel = &getModel('module');
$oModuleModel->loadModuleExtends();
$oMemberModel = &getModel('member');
$oMemberController = &getController('member');
@ -215,8 +218,6 @@
if(file_exists($db_config_file)) @include($db_config_file);
if(!$db_info->time_zone) $db_info->time_zone = date("O");
if(!$db_info->use_optimizer || $db_info->use_optimizer != 'N') $db_info->use_optimizer = 'Y';
else $db_info->use_optimizer = 'N';
if(!$db_info->qmail_compatibility || $db_info->qmail_compatibility != 'Y') $db_info->qmail_compatibility = 'N';
else $db_info->qmail_compatibility = 'Y';
if(!$db_info->use_ssl) $db_info->use_ssl = 'none';
@ -1157,15 +1158,16 @@
/**
* @brief js file을 추가
**/
function addJsFile($file, $optimized = true, $targetie = '',$index=null) {
function addJsFile($file, $optimized = false, $targetie = '',$index=null, $type="head") {
$oContext = &Context::getInstance();
return $oContext->_addJsFile($file, $optimized, $targetie,$index);
return $oContext->_addJsFile($file, $targetie,$index,$type);
}
/**
* @brief js file을 추가
**/
function _addJsFile($file, $optimized = true, $targetie = '',$index=null) {
function _addJsFile($file, $targetie = '',$index=null,$type="head") {
if($type != 'body') $type = 'head';
if(strpos($file,'://')===false && $file{0}!='/' && $file{0}!='.') $file = './'.$file;
$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
while(strpos($file,'/../')) $file = preg_replace('/\/([^\/]+)\/\.\.\//s','/',$file,1);
@ -1174,23 +1176,23 @@
if(is_null($index)) $index=count($this->js_files);
for($i=$index;array_key_exists($i,$this->js_files);$i++);
$this->js_files[$i] = array('file' => $file, 'optimized' => $optimized, 'targetie' => $targetie);
$this->js_files[$i] = array('file' => $file, 'targetie' => $targetie, 'type'=> $type);
}
/**
* @brief js file을 제거
**/
function unloadJsFile($file, $optimized = true, $targetie = '') {
function unloadJsFile($file, $optimized = false, $targetie = '') {
$oContext = &Context::getInstance();
return $oContext->_unloadJsFile($file, $optimized, $targetie);
return $oContext->_unloadJsFile($file, $targetie);
}
/**
* @brief js file을 제거
**/
function _unloadJsFile($file, $optimized, $targetie) {
function _unloadJsFile($file, $targetie) {
foreach($this->js_files as $key => $val) {
if(realpath($val['file'])==realpath($file) && $val['optimized'] == $optimized && $val['targetie'] == $targetie) {
if(realpath($val['file'])==realpath($file) && $val['targetie'] == $targetie) {
unset($this->js_files[$key]);
return;
}
@ -1229,6 +1231,7 @@
{
if(in_array($files[$i]['file'], $filenames))
unset($files[$i]);
$filenames[] = $files[$i]['file'];
}
@ -1238,32 +1241,37 @@
/**
* @brief js file 목록을 return
**/
function getJsFile() {
function getJsFile($type='head') {
$oContext = &Context::getInstance();
return $oContext->_getJsFile();
return $oContext->_getJsFile($type);
}
/**
* @brief js file 목록을 return
**/
function _getJsFile() {
require_once(_XE_PATH_."classes/optimizer/Optimizer.class.php");
$oOptimizer = new Optimizer();
return $oOptimizer->getOptimizedFiles($this->_getUniqueFileList($this->js_files), "js");
function _getJsFile($type) {
$_files = array();
$files = $this->_getUniqueFileList($this->js_files);
foreach($files as $k => $v)
{
if($v['type'] == $type) $_files[] = $v;
}
return $_files;
}
/**
* @brief CSS file 추가
**/
function addCSSFile($file, $optimized = true, $media = 'all', $targetie = '',$index = null) {
function addCSSFile($file, $optimized = false, $media = 'all', $targetie = '',$index = null) {
$oContext = &Context::getInstance();
return $oContext->_addCSSFile($file, $optimized, $media, $targetie,$index);
return $oContext->_addCSSFile($file, $media, $targetie,$index);
}
/**
* @brief CSS file 추가
**/
function _addCSSFile($file, $optimized = true, $media = 'all', $targetie = '', $index = null) {
function _addCSSFile($file, $media = 'all', $targetie = '', $index = null) {
if(strpos($file,'://')===false && substr($file,0,1)!='/' && substr($file,0,1)!='.') $file = './'.$file;
$file = str_replace(array('/./','//'),'/',$file);
while(strpos($file,'/../')) $file = preg_replace('/\/([^\/]+)\/\.\.\//s','/',$file,1);
@ -1274,23 +1282,23 @@
for($i=$index;array_key_exists($i,$this->css_files);$i++);
//if(preg_match('/^http:\/\//i',$file)) $file = str_replace(realpath("."), ".", realpath($file));
$this->css_files[$i] = array('file' => $file, 'optimized' => $optimized, 'media' => $media, 'targetie' => $targetie);
$this->css_files[$i] = array('file' => $file, 'media' => $media, 'targetie' => $targetie);
}
/**
* @brief css file을 제거
**/
function unloadCSSFile($file, $optimized = true, $media = 'all', $targetie = '') {
function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') {
$oContext = &Context::getInstance();
return $oContext->_unloadCSSFile($file, $optimized, $media, $targetie);
return $oContext->_unloadCSSFile($file, $media, $targetie);
}
/**
* @brief css file을 제거
**/
function _unloadCSSFile($file, $optimized, $media, $targetie) {
function _unloadCSSFile($file, $media, $targetie) {
foreach($this->css_files as $key => $val) {
if(realpath($val['file'])==realpath($file) && $val['optimized'] == $optimized && $val['media'] == $media && $val['targetie'] == $targetie) {
if(realpath($val['file'])==realpath($file) && $val['media'] == $media && $val['targetie'] == $targetie) {
unset($this->css_files[$key]);
return;
}
@ -1321,9 +1329,8 @@
* @brief CSS file 목록 return
**/
function _getCSSFile() {
require_once(_XE_PATH_."classes/optimizer/Optimizer.class.php");
$oOptimizer = new Optimizer();
return $oOptimizer->getOptimizedFiles($this->_getUniqueFileList($this->css_files), "css");
$files = $this->_getUniqueFileList($this->css_files);
return $files;
}
/**
@ -1351,8 +1358,8 @@
$filename = trim($list[$i]);
if(!$filename) continue;
if(substr($filename,0,2)=='./') $filename = substr($filename,2);
if(preg_match('/\.js$/i',$filename)) $this->_addJsFile($plugin_path.$filename, true, '', null);
elseif(preg_match('/\.css$/i',$filename)) $this->_addCSSFile($plugin_path.$filename, true, 'all','', null);
if(preg_match('/\.js$/i',$filename)) $this->_addJsFile($plugin_path.$filename, '', null, 'body');
elseif(preg_match('/\.css$/i',$filename)) $this->_addCSSFile($plugin_path.$filename, 'all','', null);
}
if(is_dir($plugin_path.'lang')) $this->_loadLang($plugin_path.'lang');