issue 2662 page

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12255 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-11-19 09:56:12 +00:00
parent d456ea02e0
commit 7bb7241447
8 changed files with 1160 additions and 1079 deletions

View file

@ -3,20 +3,21 @@
* @class pageAdminController
* @author NHN (developers@xpressengine.com)
* @brief page of the module admin controller class
**/
class pageAdminController extends page {
*/
class pageAdminController extends page
{
/**
* @brief Initialization
**/
function init() {
*/
function init()
{
}
/**
* @brief Add a Page
**/
function procPageAdminInsert() {
*/
function procPageAdminInsert()
{
// Create model/controller object of the module module
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
@ -30,10 +31,12 @@
if($args->use_mobile != 'Y') $args->use_mobile = '';
// Check if an original module exists by using module_srl
if($args->module_srl) {
if($args->module_srl)
{
$columnList = array('module_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
if($module_info->module_srl != $args->module_srl) {
if($module_info->module_srl != $args->module_srl)
{
unset($args->module_srl);
}
else
@ -46,31 +49,38 @@
}
}
switch ($args->page_type){
case 'WIDGET' : {
switch ($args->page_type)
{
case 'WIDGET' :
{
unset($args->skin);
unset($args->mskin);
unset($args->path);
unset($args->mpath);
break;
}
case 'ARTICLE' : {
case 'ARTICLE' :
{
unset($args->page_caching_interval);
unset($args->path);
unset($args->mpath);
break;
}
case 'OUTSIDE' : {
case 'OUTSIDE' :
{
unset($args->skin);
unset($args->mskin);
break;
}
}
// Insert/update depending on module_srl
if(!$args->module_srl) {
if(!$args->module_srl)
{
$output = $oModuleController->insertModule($args);
$msg_code = 'success_registed';
} else {
}
else
{
$output = $oModuleController->updateModule($args);
$msg_code = 'success_updated';
}
@ -87,7 +97,7 @@
/**
* @brief Page Modify
**/
*/
function procPageAdminUpdate()
{
$this->procPageAdminInsert();
@ -111,8 +121,9 @@
/**
* @brief Save page edits
**/
function procPageAdminInsertContent() {
*/
function procPageAdminInsertContent()
{
$module_srl = Context::get('module_srl');
$content = Context::get('content');
if(!$module_srl) return new Object(-1,'msg_invalid_request');
@ -121,11 +132,13 @@
// Guhaeom won information page
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if($type == "mobile") {
if($type == "mobile")
{
if(!$mcontent) $mcontent = '';
$module_info->mcontent = $mcontent;
}
else {
else
{
if(!isset($content)) $content ='';
$module_info->content = $content;
}
@ -139,7 +152,8 @@
$obj->module_srl = $module_srl;
$obj->list_count = 99999999;
$output = $oDocumentModel->getDocumentList($obj);
if(count($output->data)) {
if(count($output->data))
{
foreach($output->data as $document)
{
if($document_srls[$document->document_srl]) continue;
@ -165,8 +179,9 @@
/**
* @brief Delete page
**/
function procPageAdminDelete() {
*/
function procPageAdminDelete()
{
$module_srl = Context::get('module_srl');
// Get an original
$oModuleController = &getController('module');
@ -183,8 +198,9 @@
/**
* @brief Additional pages of basic information
**/
function procPageAdminInsertConfig() {
*/
function procPageAdminInsertConfig()
{
// Get the basic information
$args = Context::getRequestVars();
// Insert by creating the module Controller object
@ -195,8 +211,9 @@
/**
* @brief Upload attachments
**/
function procUploadFile() {
*/
function procUploadFile()
{
// Basic variables setting
$upload_target_srl = Context::get('upload_target_srl');
$module_srl = Context::get('module_srl');
@ -210,8 +227,9 @@
/**
* @brief Delete the attachment
* Delete individual files in the editor using
**/
function procDeleteFile() {
*/
function procDeleteFile()
{
// Basic variable setting(upload_target_srl and module_srl set)
$upload_target_srl = Context::get('upload_target_srl');
$module_srl = Context::get('module_srl');
@ -225,8 +243,9 @@
/**
* @brief Clear widget cache files of the specified page
**/
function procPageAdminRemoveWidgetCache() {
*/
function procPageAdminRemoveWidgetCache()
{
$module_srl = Context::get('module_srl');
$oModuleModel = &getModel('module');
@ -326,7 +345,6 @@
// 성공 메세지 등록
$this->setMessage($msg_code);
}
}
?>
/* End of file page.admin.controller.php */
/* Location: ./modules/page/page.admin.controller.php */

View file

@ -3,29 +3,33 @@
* @class pageAdminView
* @author NHN (developers@xpressengine.com)
* @brief page admin view of the module class
**/
class pageAdminView extends page {
*/
class pageAdminView extends page
{
var $module_srl = 0;
var $list_count = 20;
var $page_count = 10;
/**
* @brief Initialization
**/
function init() {
*/
function init()
{
// Pre-check if module_srl exists. Set module_info if exists
$module_srl = Context::get('module_srl');
// Create module model object
$oModuleModel = &getModel('module');
// module_srl two come over to save the module, putting the information in advance
if($module_srl) {
if($module_srl)
{
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info) {
if(!$module_info)
{
Context::set('module_srl','');
$this->act = 'list';
} else {
}
else
{
ModuleModel::syncModuleToSite($module_info);
$this->module_info = $module_info;
Context::set('module_info',$module_info);
@ -40,13 +44,13 @@
// Get a template path (page in the administrative template tpl putting together)
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief Manage a list of pages showing
**/
function dispPageAdminContent() {
*/
function dispPageAdminContent()
{
$args->sort_index = "module_srl";
$args->page = Context::get('page');
$args->list_count = 40;
@ -81,15 +85,17 @@
/**
* @brief Information output of the selected page
**/
function dispPageAdminInfo() {
*/
function dispPageAdminInfo()
{
// Get module_srl by GET parameter
$module_srl = Context::get('module_srl');
$module_info = Context::get('module_info');
// If you do not value module_srl just showing the index page
if(!$module_srl) return $this->dispPageAdminContent();
// If the layout is destined to add layout information haejum (layout_title, layout)
if($module_info->layout_srl) {
if($module_info->layout_srl)
{
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($module_info->layout_srl);
$module_info->layout = $layout_info->layout;
@ -104,7 +110,8 @@
Context::set('mlayout_list', $mobile_layout_list);
// Set a template file
if ($this->module_info->page_type == 'ARTICLE'){
if($this->module_info->page_type == 'ARTICLE')
{
$oModuleModel = &getModel('module');
$skin_list = $oModuleModel->getSkins($this->module_path);
Context::set('skin_list',$skin_list);
@ -127,8 +134,9 @@
/**
* @brief Additional settings page showing
* For additional settings in a service module in order to establish links with other modules peyijiim
**/
function dispPageAdminPageAdditionSetup() {
*/
function dispPageAdminPageAdditionSetup()
{
// call by reference content from other modules to come take a year in advance for putting the variable declaration
$content = '';
@ -144,17 +152,20 @@
/**
* @brief Add Page Form Output
**/
function dispPageAdminInsert() {
*/
function dispPageAdminInsert()
{
// Get module_srl by GET parameter
$module_srl = Context::get('module_srl');
// Get and set module information if module_srl exists
if($module_srl) {
if($module_srl)
{
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title', 'layout_srl', 'use_mobile', 'mlayout_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
if($module_info->module_srl == $module_srl) Context::set('module_info',$module_info);
else {
else
{
unset($module_info);
unset($module_srl);
}
@ -232,8 +243,9 @@
/**
* @brief Edit Page Content
**/
function dispPageAdminContentModify() {
*/
function dispPageAdminContentModify()
{
// Set the module information
Context::set('module_info', $this->module_info);
@ -247,7 +259,6 @@
}
}
function _setWidgetTypeContentModify($isMobile = false)
{
// Setting contents
@ -314,8 +325,9 @@
/**
* @brief Delete page output
**/
function dispPageAdminDelete() {
*/
function dispPageAdminDelete()
{
$module_srl = Context::get('module_srl');
if(!$module_srl) return $this->dispContent();
@ -332,8 +344,9 @@
/**
* @brief Rights Listing
**/
function dispPageAdminGrantInfo() {
*/
function dispPageAdminGrantInfo()
{
// Common module settings page, call rights
$oModuleAdminModel = &getAdminModel('module');
$grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant);
@ -369,4 +382,5 @@
$this->setTemplateFile('skin_info');
}
}
?>
/* End of file page.admin.view.php */
/* Location: ./modules/page/page.admin.view.php */

View file

@ -3,14 +3,14 @@
* @class pageAPI
* @author NHN (developers@xpressengine.com)
* @brief View Action page for the module API processing
**/
class pageAPI extends page {
*/
class pageAPI extends page
{
/**
* @brief Page information
**/
function dispPageIndex(&$oModule) {
*/
function dispPageIndex(&$oModule)
{
$page_content = Context::get('page_content');
$oWidgetController = &getController('widget');
@ -22,4 +22,5 @@
$oModule->add('page_content',$page_content);
}
}
?>
/* End of file page.api.php */
/* Location: ./modules/page/page.api.php */

View file

@ -3,14 +3,14 @@
* @class page
* @author NHN (developers@xpressengine.com)
* @brief high class of the module page
**/
class page extends ModuleObject {
*/
class page extends ModuleObject
{
/**
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
*/
function moduleInstall()
{
// page generated from the cache directory to use
FileHandler::makeDir('./files/cache/page');
@ -19,8 +19,9 @@
/**
* @brief a method to check if successfully installed
**/
function checkUpdate() {
*/
function checkUpdate()
{
$output = executeQuery('page.pageTypeOpageCheck');
if($output->toBool() && $output->data) return true;
@ -32,12 +33,15 @@
/**
* @brief Execute update
**/
function moduleUpdate() {
*/
function moduleUpdate()
{
// opage module instance update
$output = executeQueryArray('page.pageTypeOpageCheck');
if ($output->toBool() && count($output->data) > 0){
foreach($output->data as $val){
if($output->toBool() && count($output->data) > 0)
{
foreach($output->data as $val)
{
$args->module_srl = $val->module_srl;
$args->name = 'page_type';
$args->value= 'OUTSIDE';
@ -50,8 +54,10 @@
// old page module instance update
$output = executeQueryArray('page.pageTypeNullCheck');
$skin_update_srls = array();
if ($output->toBool() && $output->data){
foreach($output->data as $val){
if($output->toBool() && $output->data)
{
foreach($output->data as $val)
{
$args->module_srl = $val->module_srl;
$args->name = 'page_type';
$args->value= 'WIDGET';
@ -61,7 +67,8 @@
}
}
if (count($skin_update_srls)>0){
if(count($skin_update_srls)>0)
{
$skin_args->module_srls = implode(',',$skin_update_srls);
$skin_args->is_skin_fix = "Y";
$ouput = executeQuery('page.updateSkinFix', $skin_args);
@ -71,8 +78,10 @@
/**
* @brief Re-generate the cache file
**/
function recompileCache() {
*/
function recompileCache()
{
}
}
?>
/* End of file page.class.php */
/* Location: ./modules/page/page.class.php */

View file

@ -3,43 +3,46 @@
* @class documentController
* @author NHN (developers@xpressengine.com)
* @brief controller class of the document module
**/
class pageController extends page {
*/
class pageController extends page
{
var $target_path = '';
/**
* @brief Initialization
**/
*/
function init() { }
/**
* @brief Extract a title
**/
function getTitle($content) {
*/
function getTitle($content)
{
preg_match('!<title([^>]*)>(.*?)<\/title>!is', $content, $buff);
return trim($buff[2]);
}
/**
* @brief Extract header script
**/
function getHeadScript($content) {
*/
function getHeadScript($content)
{
// remove the title tag
$content = preg_replace('!<title([^>]*)>(.*?)<\/title>!is','', $content);
// Remove meta tags
$content = preg_replace('!<(\/){0,1}meta([^>]*)>!is','', $content);
// Extract information such as <link, <style, <script and so on
preg_match_all('!<link([^>]*)>!is', $content, $link_buff);
for($i=0;$i<count($link_buff[0]);$i++) {
for($i=0;$i<count($link_buff[0]);$i++)
{
$tmp_str = trim($link_buff[0][$i]);
if(!$tmp_str) continue;
$header_script .= $tmp_str."\n";
}
preg_match_all('!<(style|script)(.*?)<\/(style|script)>!is', $content, $script_buff);
for($i=0;$i<count($script_buff[0]);$i++) {
for($i=0;$i<count($script_buff[0]);$i++)
{
$tmp_str = trim($script_buff[0][$i]);
if(!$tmp_str) continue;
$header_script .= $tmp_str."\n";
@ -50,8 +53,9 @@
/**
* @brief Extract the contents of the body
**/
function getBodyScript($content) {
*/
function getBodyScript($content)
{
// Extract content
preg_match('!<body([^>]*)>(.*?)<\/body>!is', $content, $body_buff);
$body_script = $body_buff[2];
@ -63,8 +67,9 @@
/**
* @brief Change the value of src, href in the content
**/
function replaceSrc($content, $path) {
*/
function replaceSrc($content, $path)
{
$url_info = parse_url($path);
$host = sprintf("%s://%s%s",$url_info['scheme'],$url_info['host'],$url_info['port']?':'.$url_info['port']:'');
$this->host = $host.'/';
@ -72,7 +77,8 @@
if(substr($path,-1)=='/') $path = substr($path,-1);
$t = explode('/',$path);
$_t = array();
for($i=0,$c=count($t)-1;$i<$c;$i++) {
for($i=0,$c=count($t)-1;$i<$c;$i++)
{
$v = trim($t[$i]);
if(!$v) continue;
$_t[] = $v;
@ -85,18 +91,24 @@
return $content;
}
function _replacePath($matches) {
function _replacePath($matches)
{
$val = trim($matches[3]);
if(preg_match('/^(http|https|ftp|telnet|mms|mailto)/i',$val)) return $matches[0];
if(substr($val,0,2)=='./') {
if(substr($val,0,2)=='./')
{
$path = $this->path.substr($val,2);
} elseif(substr($val,0,1)=='/') {
}
elseif(substr($val,0,1)=='/')
{
$path = $this->host.substr($val,1);
} else {
}
else
{
$path = $this->path.$val;
}
return sprintf("%s%s%s%s", $matches[1], $matches[2], $path, $matches[4]);
}
}
?>
/* End of file page.controller.php */
/* Location: ./modules/page/page.controller.php */

View file

@ -1,20 +1,23 @@
<?php
require_once(_XE_PATH_.'modules/page/page.view.php');
class pageMobile extends pageView {
function init() {
class pageMobile extends pageView
{
function init()
{
// Get a template path (page in the administrative template tpl putting together)
$this->setTemplatePath($this->module_path.'tpl');
switch($this->module_info->page_type)
{
case 'WIDGET' : {
case 'WIDGET' :
{
$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
$this->interval = (int)($this->module_info->page_caching_interval);
break;
}
case 'OUTSIDE' : {
case 'OUTSIDE' :
{
$this->cache_file = sprintf("./files/cache/opage/%d.%s.m.cache.php", $this->module_info->module_srl, Context::getSslStatus());
$this->interval = (int)($this->module_info->page_caching_interval);
$this->path = $this->module_info->mpath;
@ -23,7 +26,8 @@ class pageMobile extends pageView {
}
}
function dispPageIndex() {
function dispPageIndex()
{
// Variables used in the template Context:: set()
if($this->module_srl) Context::set('module_srl',$this->module_srl);
@ -118,9 +122,11 @@ class pageMobile extends pageView {
return $page_content;
}
function _getOutsideContent(){
function _getOutsideContent()
{
// check if it is http or internal file
if($this->path) {
if($this->path)
{
if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
}
@ -128,5 +134,5 @@ class pageMobile extends pageView {
return $content;
}
}
?>
/* End of file page.mobile.php */
/* Location: ./modules/page/page.mobile.php */

View file

@ -3,10 +3,9 @@
* @class pageView
* @author NHN (developers@xpressengine.com)
* @brief page view class of the module
**/
class pageView extends page {
*/
class pageView extends page
{
var $module_srl = 0;
var $list_count = 20;
var $page_count = 10;
@ -16,19 +15,22 @@
/**
* @brief Initialization
**/
function init() {
*/
function init()
{
// Get a template path (page in the administrative template tpl putting together)
$this->setTemplatePath($this->module_path.'tpl');
switch($this->module_info->page_type)
{
case 'WIDGET' : {
case 'WIDGET' :
{
$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
$this->interval = (int)($this->module_info->page_caching_interval);
break;
}
case 'OUTSIDE' : {
case 'OUTSIDE' :
{
$this->cache_file = sprintf("./files/cache/opage/%d.%s.cache.php", $this->module_info->module_srl, Context::getSslStatus());
$this->interval = (int)($this->module_info->page_caching_interval);
$this->path = $this->module_info->path;
@ -39,8 +41,9 @@
/**
* @brief General request output
**/
function dispPageIndex() {
*/
function dispPageIndex()
{
// Variables used in the template Context:: set()
if($this->module_srl) Context::set('module_srl',$this->module_srl);
@ -55,33 +58,42 @@
$this->setTemplateFile('content');
}
function _getWidgetContent(){
if($this->interval>0) {
function _getWidgetContent()
{
if($this->interval>0)
{
if(!file_exists($this->cache_file)) $mtime = 0;
else $mtime = filemtime($this->cache_file);
if($mtime + $this->interval*60 > time()) {
if($mtime + $this->interval*60 > time())
{
$page_content = FileHandler::readFile($this->cache_file);
$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
} else {
}
else
{
$oWidgetController = &getController('widget');
$page_content = $oWidgetController->transWidgetCode($this->module_info->content);
FileHandler::writeFile($this->cache_file, $page_content);
}
} else {
}
else
{
if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
$page_content = $this->module_info->content;
}
return $page_content;
}
function _getArticleContent(){
function _getArticleContent()
{
$oTemplate = &TemplateHandler::getInstance();
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument(0, true);
if ($this->module_info->document_srl){
if($this->module_info->document_srl)
{
$document_srl = $this->module_info->document_srl;
$oDocument->setDocument($document_srl);
Context::set('document_srl', $document_srl);
@ -102,9 +114,11 @@
return $page_content;
}
function _getOutsideContent(){
function _getOutsideContent()
{
// check if it is http or internal file
if($this->path) {
if($this->path)
{
if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
}
@ -114,18 +128,18 @@
/**
* @brief Save the file and return if a file is requested by http
**/
function getHtmlPage($path, $caching_interval, $cache_file) {
*/
function getHtmlPage($path, $caching_interval, $cache_file)
{
// Verify cache
if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > time()) {
if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > time())
{
$content = FileHandler::readFile($cache_file);
} else {
}
else
{
FileHandler::getRemoteFile($path, $cache_file);
$content = FileHandler::readFile($cache_file);
}
// Create opage controller
$oPageController = &getController('page');
@ -150,8 +164,9 @@
/**
* @brief Create a cache file in order to include if it is an internal file
**/
function executeFile($path, $caching_interval, $cache_file) {
*/
function executeFile($path, $caching_interval, $cache_file)
{
// Cancel if the file doesn't exist
if(!file_exists($path)) return;
// Get a path and filename
@ -159,7 +174,8 @@
$filename = $tmp_path[count($tmp_path)-1];
$filepath = preg_replace('/'.$filename."$/i","",$cache_file);
// Verify cache
if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= time() || filemtime($cache_file)<filemtime($path) ) {
if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= time() || filemtime($cache_file)<filemtime($path))
{
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
// Read a target file and get content
ob_start();
@ -190,14 +206,18 @@
return $content;
}
function _replacePath($matches) {
function _replacePath($matches)
{
$val = trim($matches[3]);
// Pass if the path is external or starts with /, #, { characters
// /=absolute path, #=hash in a page, {=Template syntax
if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val)) {
if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val))
{
return $matches[0];
// In case of .. , get a path
} elseif(preg_match('/^\.\./i',$val)) {
}
else if(preg_match('/^\.\./i',$val))
{
$p = Context::pathToUrl($this->path);
return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]);
}
@ -209,4 +229,5 @@
return $path;
}
}
?>
/* End of file page.view.php */
/* Location: ./modules/page/page.view.php */

View file

@ -3,16 +3,16 @@
* @class pageWap
* @author NHN (developers@xpressengine.com)
* @brief wap class page of the module
**/
class pageWap extends page {
*/
class pageWap extends page
{
/**
* @brief wap procedure method
*
* Page module does not include the following items on the full content control and output from the mobile class
**/
function procWAP(&$oMobile) {
*/
function procWAP(&$oMobile)
{
// Check permissions
if(!$this->grant->access) return $oMobile->setContent(Context::getLang('msg_not_permitted'));
// The contents of the widget chuchulham
@ -20,6 +20,6 @@
$content = $oWidgetController->transWidgetCode($this->module_info->content);
$oMobile->setContent($content);
}
}
?>
/* End of file page.wap.php */
/* Location: ./modules/page/page.wap.php */