mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
issue 2662 member, layout
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12251 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
aba8de04be
commit
cec308eef1
15 changed files with 8864 additions and 8331 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -3,10 +3,9 @@
|
||||||
* @class layoutAdminView
|
* @class layoutAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* admin view class of the layout module
|
* admin view class of the layout module
|
||||||
**/
|
*/
|
||||||
|
class layoutAdminModel extends layout
|
||||||
class layoutAdminModel extends layout {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init
|
* init
|
||||||
*/
|
*/
|
||||||
|
|
@ -61,14 +60,14 @@ class layoutAdminModel extends layout {
|
||||||
$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..');
|
$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..');
|
||||||
|
|
||||||
$layout_info->description = nl2br(trim($layout_info->description));
|
$layout_info->description = nl2br(trim($layout_info->description));
|
||||||
if (!is_object($layout_info->extra_var))
|
if(!is_object($layout_info->extra_var))
|
||||||
{
|
{
|
||||||
$layout_info->extra_var = new StdClass();
|
$layout_info->extra_var = new StdClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($layout_info->extra_var as $var_name => $val)
|
foreach($layout_info->extra_var as $var_name => $val)
|
||||||
{
|
{
|
||||||
if (isset($layout_info->{$var_name}->description))
|
if(isset($layout_info->{$var_name}->description))
|
||||||
{
|
{
|
||||||
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +83,7 @@ class layoutAdminModel extends layout {
|
||||||
$oLayoutModel = &getModel('layout');
|
$oLayoutModel = &getModel('layout');
|
||||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||||
// Error appears if there is no layout information is registered
|
// Error appears if there is no layout information is registered
|
||||||
if(!$layout_info)
|
if(!$layout_info)
|
||||||
{
|
{
|
||||||
return $this->dispLayoutAdminInstalledList();
|
return $this->dispLayoutAdminInstalledList();
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +91,7 @@ class layoutAdminModel extends layout {
|
||||||
// Get Layout Code
|
// Get Layout Code
|
||||||
$oLayoutModel = &getModel('layout');
|
$oLayoutModel = &getModel('layout');
|
||||||
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
||||||
|
|
||||||
if(!file_exists($layout_file))
|
if(!file_exists($layout_file))
|
||||||
{
|
{
|
||||||
// If faceoff
|
// If faceoff
|
||||||
|
|
@ -127,16 +126,15 @@ class layoutAdminModel extends layout {
|
||||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||||
Context::set('widget_list', $widget_list);
|
Context::set('widget_list', $widget_list);
|
||||||
|
|
||||||
|
|
||||||
$security = new Security($layout_info);
|
$security = new Security($layout_info);
|
||||||
$layout_info = $security->encodeHTML('.', '.author..');
|
$layout_info = $security->encodeHTML('.', '.author..');
|
||||||
Context::set('selected_layout', $layout_info);
|
Context::set('selected_layout', $layout_info);
|
||||||
|
|
||||||
//Security
|
//Security
|
||||||
$security = new Security();
|
$security = new Security();
|
||||||
$security->encodeHTML('layout_list..');
|
$security->encodeHTML('layout_list..');
|
||||||
$security->encodeHTML('layout_list..author..');
|
$security->encodeHTML('layout_list..author..');
|
||||||
|
|
||||||
$security = new Security();
|
$security = new Security();
|
||||||
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
|
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
|
||||||
|
|
||||||
|
|
@ -171,7 +169,9 @@ class layoutAdminModel extends layout {
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $designInfo->{$target};
|
return $designInfo->{$target};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* End of file layout.admin.model.php */
|
||||||
|
/* Location: ./modules/layout/layout.admin.model.php */
|
||||||
|
|
|
||||||
|
|
@ -1,396 +1,417 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class layoutAdminView
|
* @class layoutAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* admin view class of the layout module
|
* admin view class of the layout module
|
||||||
**/
|
*/
|
||||||
|
class layoutAdminView extends layout
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initialization
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
}
|
||||||
|
|
||||||
class layoutAdminView extends layout {
|
/**
|
||||||
|
* Display a installed layout list
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminInstalledList()
|
||||||
|
{
|
||||||
|
$type = Context::get('type');
|
||||||
|
$type = ($type != 'M') ? 'P' : 'M';
|
||||||
|
|
||||||
/**
|
// Set a layout list
|
||||||
* Initialization
|
$oLayoutModel = &getModel('layout');
|
||||||
* @return void
|
$layout_list = $oLayoutModel->getDownloadedLayoutList($type, true);
|
||||||
**/
|
if(!is_array($layout_list))
|
||||||
function init() {
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display a installed layout list
|
|
||||||
* @return void
|
|
||||||
**/
|
|
||||||
function dispLayoutAdminInstalledList() {
|
|
||||||
$type = Context::get('type');
|
|
||||||
$type = ($type != 'M') ? 'P' : 'M';
|
|
||||||
|
|
||||||
// Set a layout list
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
$layout_list = $oLayoutModel->getDownloadedLayoutList($type, true);
|
|
||||||
if(!is_array($layout_list))
|
|
||||||
{
|
|
||||||
$layout_list = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
if($type == 'P')
|
|
||||||
{
|
|
||||||
// get Theme layout
|
|
||||||
$oAdminModel = &getAdminModel('admin');
|
|
||||||
$themeList = $oAdminModel->getThemeList();
|
|
||||||
$themeLayoutList = array();
|
|
||||||
foreach($themeList as $themeInfo){
|
|
||||||
if(strpos($themeInfo->layout_info->name, '.') === false) continue;
|
|
||||||
$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
|
|
||||||
}
|
|
||||||
$layout_list = array_merge($layout_list, $themeLayoutList);
|
|
||||||
$layout_list[] = $oLayoutModel->getLayoutInfo('faceoff', null, 'P');
|
|
||||||
}
|
|
||||||
|
|
||||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
|
||||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
|
||||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
|
||||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
|
||||||
$this->setTemplateFile('installed_layout_list');
|
|
||||||
|
|
||||||
$security = new Security($layout_list);
|
|
||||||
$layout_list = $security->encodeHTML('..', '..author..');
|
|
||||||
|
|
||||||
//Security
|
|
||||||
$security = new Security();
|
|
||||||
$security->encodeHTML('layout_list..layout','layout_list..title');
|
|
||||||
|
|
||||||
foreach($layout_list as $no => $layout_info)
|
|
||||||
{
|
|
||||||
$layout_list[$no]->description = nl2br(trim($layout_info->description));
|
|
||||||
}
|
|
||||||
Context::set('layout_list', $layout_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display list of pc layout all instance
|
|
||||||
* @return void|Object (void : success, Object : fail)
|
|
||||||
*/
|
|
||||||
function dispLayoutAdminAllInstanceList()
|
|
||||||
{
|
{
|
||||||
$type = Context::get('type');
|
|
||||||
|
|
||||||
if (!in_array($type, array('P', 'M'))) $type = 'P';
|
|
||||||
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
|
|
||||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
|
||||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
|
||||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
|
||||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
|
||||||
|
|
||||||
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
|
||||||
$_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
|
|
||||||
|
|
||||||
$layout_list = array();
|
$layout_list = array();
|
||||||
foreach($_layout_list as $item)
|
}
|
||||||
|
|
||||||
|
if($type == 'P')
|
||||||
|
{
|
||||||
|
// get Theme layout
|
||||||
|
$oAdminModel = &getAdminModel('admin');
|
||||||
|
$themeList = $oAdminModel->getThemeList();
|
||||||
|
$themeLayoutList = array();
|
||||||
|
foreach($themeList as $themeInfo)
|
||||||
{
|
{
|
||||||
if(!$layout_list[$item->layout])
|
if(strpos($themeInfo->layout_info->name, '.') === false) continue;
|
||||||
|
$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
|
||||||
|
}
|
||||||
|
$layout_list = array_merge($layout_list, $themeLayoutList);
|
||||||
|
$layout_list[] = $oLayoutModel->getLayoutInfo('faceoff', null, 'P');
|
||||||
|
}
|
||||||
|
|
||||||
|
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||||
|
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||||
|
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||||
|
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||||
|
$this->setTemplateFile('installed_layout_list');
|
||||||
|
|
||||||
|
$security = new Security($layout_list);
|
||||||
|
$layout_list = $security->encodeHTML('..', '..author..');
|
||||||
|
|
||||||
|
//Security
|
||||||
|
$security = new Security();
|
||||||
|
$security->encodeHTML('layout_list..layout','layout_list..title');
|
||||||
|
|
||||||
|
foreach($layout_list as $no => $layout_info)
|
||||||
|
{
|
||||||
|
$layout_list[$no]->description = nl2br(trim($layout_info->description));
|
||||||
|
}
|
||||||
|
Context::set('layout_list', $layout_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display list of pc layout all instance
|
||||||
|
* @return void|Object (void : success, Object : fail)
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminAllInstanceList()
|
||||||
|
{
|
||||||
|
$type = Context::get('type');
|
||||||
|
|
||||||
|
if(!in_array($type, array('P', 'M'))) $type = 'P';
|
||||||
|
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
|
||||||
|
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||||
|
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||||
|
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||||
|
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||||
|
|
||||||
|
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
||||||
|
$_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
|
||||||
|
|
||||||
|
$layout_list = array();
|
||||||
|
foreach($_layout_list as $item)
|
||||||
|
{
|
||||||
|
if(!$layout_list[$item->layout])
|
||||||
|
{
|
||||||
|
$layout_list[$item->layout] = array();
|
||||||
|
$layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
|
||||||
|
if ($layout_info)
|
||||||
{
|
{
|
||||||
$layout_list[$item->layout] = array();
|
$layout_list[$item->layout]['title'] = $layout_info->title;
|
||||||
$layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
|
|
||||||
if ($layout_info)
|
|
||||||
{
|
|
||||||
$layout_list[$item->layout]['title'] = $layout_info->title;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout_list[$item->layout][] = $item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($layout_list, array($this, 'sortLayoutInstance'));
|
$layout_list[$item->layout][] = $item;
|
||||||
|
|
||||||
Context::set('layout_list', $layout_list);
|
|
||||||
|
|
||||||
$this->setTemplateFile('layout_all_instance_list');
|
|
||||||
|
|
||||||
$security = new Security();
|
|
||||||
$security->encodeHTML('layout_list..');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
usort($layout_list, array($this, 'sortLayoutInstance'));
|
||||||
* Sort layout instance by layout name, instance name
|
|
||||||
*/
|
Context::set('layout_list', $layout_list);
|
||||||
function sortLayoutInstance($a, $b)
|
|
||||||
|
$this->setTemplateFile('layout_all_instance_list');
|
||||||
|
|
||||||
|
$security = new Security();
|
||||||
|
$security->encodeHTML('layout_list..');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort layout instance by layout name, instance name
|
||||||
|
*/
|
||||||
|
function sortLayoutInstance($a, $b)
|
||||||
|
{
|
||||||
|
$aTitle = strtolower($a['title']);
|
||||||
|
$bTitle = strtolower($b['title']);
|
||||||
|
|
||||||
|
if($aTitle == $bTitle)
|
||||||
{
|
{
|
||||||
$aTitle = strtolower($a['title']);
|
return 0;
|
||||||
$bTitle = strtolower($b['title']);
|
|
||||||
|
|
||||||
if($aTitle == $bTitle)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ($aTitle < $bTitle) ? -1 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return ($aTitle < $bTitle) ? -1 : 1;
|
||||||
* Display list of pc layout instance
|
}
|
||||||
* @return void|Object (void : success, Object : fail)
|
|
||||||
*/
|
/**
|
||||||
function dispLayoutAdminInstanceList()
|
* Display list of pc layout instance
|
||||||
|
* @return void|Object (void : success, Object : fail)
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminInstanceList()
|
||||||
|
{
|
||||||
|
$type = Context::get('type');
|
||||||
|
$layout = Context::get('layout');
|
||||||
|
|
||||||
|
if(!in_array($type, array('P', 'M'))) $type = 'P';
|
||||||
|
if(!$layout) return $this->stop('msg_invalid_request');
|
||||||
|
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
|
||||||
|
if(!$layout_info) return $this->stop('msg_invalid_request');
|
||||||
|
|
||||||
|
Context::set('layout_info', $layout_info);
|
||||||
|
|
||||||
|
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
||||||
|
$layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, $layout, $columnList);
|
||||||
|
Context::set('layout_list', $layout_list);
|
||||||
|
|
||||||
|
$this->setTemplateFile('layout_instance_list');
|
||||||
|
|
||||||
|
$security = new Security();
|
||||||
|
$security->encodeHTML('layout_list..');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Layout setting page
|
||||||
|
* Once select a layout with empty value in the DB, then adjust values
|
||||||
|
* @return void|Object (void : success, Object : fail)
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminInsert()
|
||||||
|
{
|
||||||
|
$oModel = &getModel('layout');
|
||||||
|
$type = Context::get('type');
|
||||||
|
if(!in_array($type, array('P', 'M'))) $type = 'P';
|
||||||
|
|
||||||
|
//Security
|
||||||
|
$security = new Security();
|
||||||
|
$security->encodeHTML('layout_list..layout','layout_list..title');
|
||||||
|
|
||||||
|
// Get layout info
|
||||||
|
$layout = Context::get('layout');
|
||||||
|
if($layout == 'faceoff') return $this->stop('not supported');
|
||||||
|
|
||||||
|
$layout_info = $oModel->getLayoutInfo($layout, null, $type);
|
||||||
|
if(!$layout_info) return $this->stop('msg_invalid_request');
|
||||||
|
|
||||||
|
// get Menu list
|
||||||
|
$oMenuAdminModel = &getAdminModel('menu');
|
||||||
|
$menu_list = $oMenuAdminModel->getMenus();
|
||||||
|
Context::set('menu_list', $menu_list);
|
||||||
|
|
||||||
|
$security = new Security();
|
||||||
|
$security->encodeHTML('menu_list..');
|
||||||
|
|
||||||
|
$security = new Security($layout_info);
|
||||||
|
$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
|
||||||
|
|
||||||
|
$layout_info->description = nl2br(trim($layout_info->description));
|
||||||
|
if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
|
||||||
|
foreach($layout_info->extra_var as $var_name => $val)
|
||||||
{
|
{
|
||||||
$type = Context::get('type');
|
if(isset($layout_info->{$var_name}->description))
|
||||||
$layout = Context::get('layout');
|
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
||||||
|
|
||||||
if (!in_array($type, array('P', 'M'))) $type = 'P';
|
|
||||||
if (!$layout) return $this->stop('msg_invalid_request');
|
|
||||||
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
|
|
||||||
if (!$layout_info) return $this->stop('msg_invalid_request');
|
|
||||||
|
|
||||||
Context::set('layout_info', $layout_info);
|
|
||||||
|
|
||||||
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
|
||||||
$layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, $layout, $columnList);
|
|
||||||
Context::set('layout_list', $layout_list);
|
|
||||||
|
|
||||||
$this->setTemplateFile('layout_instance_list');
|
|
||||||
|
|
||||||
$security = new Security();
|
|
||||||
$security->encodeHTML('layout_list..');
|
|
||||||
}
|
}
|
||||||
|
Context::set('selected_layout', $layout_info);
|
||||||
|
|
||||||
/**
|
$this->setTemplateFile('layout_modify');
|
||||||
* Layout setting page
|
}
|
||||||
* Once select a layout with empty value in the DB, then adjust values
|
|
||||||
* @return void|Object (void : success, Object : fail)
|
|
||||||
**/
|
|
||||||
function dispLayoutAdminInsert() {
|
|
||||||
$oModel = &getModel('layout');
|
|
||||||
$type = Context::get('type');
|
|
||||||
if (!in_array($type, array('P', 'M'))) $type = 'P';
|
|
||||||
|
|
||||||
//Security
|
|
||||||
$security = new Security();
|
|
||||||
$security->encodeHTML('layout_list..layout','layout_list..title');
|
|
||||||
|
|
||||||
// Get layout info
|
/**
|
||||||
$layout = Context::get('layout');
|
* Insert Layout details
|
||||||
if ($layout == 'faceoff') return $this->stop('not supported');
|
* @return void
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminModify()
|
||||||
|
{
|
||||||
|
$oLayoutAdminModel = &getAdminModel('layout');
|
||||||
|
$oLayoutAdminModel->setLayoutAdminSetInfoView();
|
||||||
|
|
||||||
$layout_info = $oModel->getLayoutInfo($layout, null, $type);
|
Context::set('is_sitemap', '0');
|
||||||
if (!$layout_info) return $this->stop('msg_invalid_request');
|
$script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
|
||||||
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
$content = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view');
|
||||||
|
|
||||||
// get Menu list
|
Context::set('content', $content);
|
||||||
$oMenuAdminModel = &getAdminModel('menu');
|
|
||||||
$menu_list = $oMenuAdminModel->getMenus();
|
|
||||||
Context::set('menu_list', $menu_list);
|
|
||||||
|
|
||||||
$security = new Security();
|
$this->setTemplateFile('layout_modify');
|
||||||
$security->encodeHTML('menu_list..');
|
}
|
||||||
|
|
||||||
$security = new Security($layout_info);
|
/**
|
||||||
$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
|
* Edit layout codes
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminEdit()
|
||||||
|
{
|
||||||
|
// Set the layout with its information
|
||||||
|
$layout_srl = Context::get('layout_srl');
|
||||||
|
// Get layout information
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||||
|
// Error appears if there is no layout information is registered
|
||||||
|
if(!$layout_info) return $this->dispLayoutAdminInstalledList();
|
||||||
|
|
||||||
$layout_info->description = nl2br(trim($layout_info->description));
|
// Get Layout Code
|
||||||
if (!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
|
$oLayoutModel = &getModel('layout');
|
||||||
foreach($layout_info->extra_var as $var_name => $val)
|
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
||||||
|
if(!file_exists($layout_file))
|
||||||
|
{
|
||||||
|
// If faceoff
|
||||||
|
if($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
|
||||||
{
|
{
|
||||||
if (isset($layout_info->{$var_name}->description))
|
$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
|
||||||
$layout_info->{$var_name}->description = nl2br(trim($val->description));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$layout_file = sprintf('%s%s', $layout_info->path, 'layout.html');
|
||||||
}
|
}
|
||||||
Context::set('selected_layout', $layout_info);
|
|
||||||
|
|
||||||
$this->setTemplateFile('layout_modify');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
|
||||||
* Insert Layout details
|
if(file_exists($layout_css_file))
|
||||||
* @return void
|
{
|
||||||
**/
|
$layout_code_css = FileHandler::readFile($layout_css_file);
|
||||||
function dispLayoutAdminModify() {
|
Context::set('layout_code_css', $layout_code_css);
|
||||||
$oLayoutAdminModel = &getAdminModel('layout');
|
}
|
||||||
$oLayoutAdminModel->setLayoutAdminSetInfoView();
|
|
||||||
|
|
||||||
Context::set('is_sitemap', '0');
|
$layout_code = FileHandler::readFile($layout_file);
|
||||||
$script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>';
|
Context::set('layout_code', $layout_code);
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
|
||||||
$content = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view');
|
|
||||||
|
|
||||||
Context::set('content', $content);
|
// set User Images
|
||||||
|
$layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_info->layout_srl);
|
||||||
|
Context::set('layout_image_list', $layout_image_list);
|
||||||
|
|
||||||
$this->setTemplateFile('layout_modify');
|
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl);
|
||||||
}
|
Context::set('layout_image_path', $layout_image_path);
|
||||||
|
// Set widget list
|
||||||
|
$oWidgetModel = &getModel('widget');
|
||||||
|
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
||||||
|
Context::set('widget_list', $widget_list);
|
||||||
|
|
||||||
/**
|
$this->setTemplateFile('layout_edit');
|
||||||
* Edit layout codes
|
|
||||||
* @return void
|
|
||||||
**/
|
|
||||||
function dispLayoutAdminEdit() {
|
|
||||||
// Set the layout with its information
|
|
||||||
$layout_srl = Context::get('layout_srl');
|
|
||||||
// Get layout information
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
|
||||||
// Error appears if there is no layout information is registered
|
|
||||||
if(!$layout_info) return $this->dispLayoutAdminInstalledList();
|
|
||||||
|
|
||||||
// Get Layout Code
|
$security = new Security($layout_info);
|
||||||
$oLayoutModel = &getModel('layout');
|
$layout_info = $security->encodeHTML('.', '.author..');
|
||||||
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
|
Context::set('selected_layout', $layout_info);
|
||||||
if(!file_exists($layout_file)){
|
|
||||||
// If faceoff
|
|
||||||
if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)){
|
|
||||||
$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
|
|
||||||
}else{
|
|
||||||
$layout_file = sprintf('%s%s', $layout_info->path, 'layout.html');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
|
//Security
|
||||||
if(file_exists($layout_css_file)){
|
$security = new Security();
|
||||||
$layout_code_css = FileHandler::readFile($layout_css_file);
|
$security->encodeHTML('layout_list..');
|
||||||
Context::set('layout_code_css', $layout_code_css);
|
$security->encodeHTML('layout_list..author..');
|
||||||
}
|
|
||||||
|
|
||||||
$layout_code = FileHandler::readFile($layout_file);
|
$security = new Security();
|
||||||
Context::set('layout_code', $layout_code);
|
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
|
||||||
|
}
|
||||||
|
|
||||||
// set User Images
|
/**
|
||||||
$layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_info->layout_srl);
|
* Preview a layout
|
||||||
Context::set('layout_image_list', $layout_image_list);
|
* @return void|Object (void : success, Object : fail)
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminPreview()
|
||||||
|
{
|
||||||
|
$layout_srl = Context::get('layout_srl');
|
||||||
|
$code = Context::get('code');
|
||||||
|
$code_css = Context::get('code_css');
|
||||||
|
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
||||||
|
// Get the layout information
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||||
|
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
||||||
|
// Separately handle the layout if its type is faceoff
|
||||||
|
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
||||||
|
// Apply CSS directly
|
||||||
|
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
||||||
|
// Set names and values of extra_vars to $layout_info
|
||||||
|
if($layout_info->extra_var_count)
|
||||||
|
{
|
||||||
|
foreach($layout_info->extra_var as $var_id => $val)
|
||||||
|
{
|
||||||
|
$layout_info->{$var_id} = $val->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// menu in layout information becomes an argument for Context:: set
|
||||||
|
if($layout_info->menu_count)
|
||||||
|
{
|
||||||
|
foreach($layout_info->menu as $menu_id => $menu)
|
||||||
|
{
|
||||||
|
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||||
|
Context::set($menu_id, $menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl);
|
Context::set('layout_info', $layout_info);
|
||||||
Context::set('layout_image_path', $layout_image_path);
|
Context::set('content', Context::getLang('layout_preview_content'));
|
||||||
// Set widget list
|
// Temporary save the codes
|
||||||
$oWidgetModel = &getModel('widget');
|
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
||||||
$widget_list = $oWidgetModel->getDownloadedWidgetList();
|
FileHandler::writeFile($edited_layout_file, $code);
|
||||||
Context::set('widget_list', $widget_list);
|
|
||||||
|
|
||||||
$this->setTemplateFile('layout_edit');
|
// Compile
|
||||||
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
|
||||||
$security = new Security($layout_info);
|
$layout_path = $layout_info->path;
|
||||||
$layout_info = $security->encodeHTML('.', '.author..');
|
$layout_file = 'layout';
|
||||||
Context::set('selected_layout', $layout_info);
|
|
||||||
|
|
||||||
//Security
|
|
||||||
$security = new Security();
|
|
||||||
$security->encodeHTML('layout_list..');
|
|
||||||
$security->encodeHTML('layout_list..author..');
|
|
||||||
|
|
||||||
$security = new Security();
|
|
||||||
$security->encodeHTML('layout_code_css', 'layout_code', 'widget_list..title');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||||
* Preview a layout
|
Context::set('layout','none');
|
||||||
* @return void|Object (void : success, Object : fail)
|
// Convert widgets and others
|
||||||
**/
|
$oContext = &Context::getInstance();
|
||||||
function dispLayoutAdminPreview() {
|
Context::set('layout_tpl', $layout_tpl);
|
||||||
$layout_srl = Context::get('layout_srl');
|
// Delete Temporary Files
|
||||||
$code = Context::get('code');
|
FileHandler::removeFile($edited_layout_file);
|
||||||
$code_css = Context::get('code_css');
|
$this->setTemplateFile('layout_preview');
|
||||||
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
|
||||||
// Get the layout information
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
|
||||||
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
|
||||||
// Separately handle the layout if its type is faceoff
|
|
||||||
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
|
||||||
// Apply CSS directly
|
|
||||||
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
|
||||||
// Set names and values of extra_vars to $layout_info
|
|
||||||
if($layout_info->extra_var_count) {
|
|
||||||
foreach($layout_info->extra_var as $var_id => $val) {
|
|
||||||
$layout_info->{$var_id} = $val->value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// menu in layout information becomes an argument for Context:: set
|
|
||||||
if($layout_info->menu_count) {
|
|
||||||
foreach($layout_info->menu as $menu_id => $menu) {
|
|
||||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
|
||||||
Context::set($menu_id, $menu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Context::set('layout_info', $layout_info);
|
}
|
||||||
Context::set('content', Context::getLang('layout_preview_content'));
|
|
||||||
// Temporary save the codes
|
|
||||||
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
|
||||||
FileHandler::writeFile($edited_layout_file, $code);
|
|
||||||
|
|
||||||
// Compile
|
/**
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
* Modify admin layout of faceoff
|
||||||
|
* @deprecated
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function dispLayoutAdminLayoutModify()
|
||||||
|
{
|
||||||
|
// Get layout_srl
|
||||||
|
$current_module_info = Context::get('current_module_info');
|
||||||
|
$layout_srl = $current_module_info->layout_srl;
|
||||||
|
// Remove the remaining tmp files because of temporarily saving
|
||||||
|
// This part needs to be modified
|
||||||
|
$delete_tmp = Context::get('delete_tmp');
|
||||||
|
if($delete_tmp =='Y')
|
||||||
|
{
|
||||||
|
$oLayoutAdminController = &getAdminController('layout');
|
||||||
|
$oLayoutAdminController->deleteUserLayoutTempFile($layout_srl);
|
||||||
|
}
|
||||||
|
|
||||||
$layout_path = $layout_info->path;
|
$oLayoutModel = &getModel('layout');
|
||||||
$layout_file = 'layout';
|
// layout file is used as a temp.
|
||||||
|
$oLayoutModel->setUseUserLayoutTemp();
|
||||||
|
// Apply CSS in inline style
|
||||||
|
$faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl);
|
||||||
|
|
||||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
$css = FileHandler::readFile($faceoffcss);
|
||||||
Context::set('layout','none');
|
$match = null;
|
||||||
// Convert widgets and others
|
preg_match_all('/([^\{]+)\{([^\}]*)\}/is',$css,$match);
|
||||||
$oContext = &Context::getInstance();
|
for($i=0,$c=count($match[1]);$i<$c;$i++)
|
||||||
Context::set('layout_tpl', $layout_tpl);
|
{
|
||||||
// Delete Temporary Files
|
$name = trim($match[1][$i]);
|
||||||
FileHandler::removeFile($edited_layout_file);
|
$css = trim($match[2][$i]);
|
||||||
$this->setTemplateFile('layout_preview');
|
if(!$css) continue;
|
||||||
|
$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
|
||||||
|
$style[] .= sprintf('"%s":"%s"',$name,$css);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if(count($style))
|
||||||
|
{
|
||||||
|
$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>';
|
||||||
|
Context::addHtmlHeader($script);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
* Modify admin layout of faceoff
|
Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
|
||||||
* @deprecated
|
// Change widget codes in Javascript mode
|
||||||
* @return void
|
$oWidgetController = &getController('widget');
|
||||||
**/
|
$oWidgetController->setWidgetCodeInJavascriptMode();
|
||||||
function dispLayoutAdminLayoutModify(){
|
// Set a template file
|
||||||
// Get layout_srl
|
$this->setTemplateFile('faceoff_layout_edit');
|
||||||
$current_module_info = Context::get('current_module_info');
|
}
|
||||||
$layout_srl = $current_module_info->layout_srl;
|
|
||||||
// Remove the remaining tmp files because of temporarily saving
|
|
||||||
// This part needs to be modified
|
|
||||||
$delete_tmp = Context::get('delete_tmp');
|
|
||||||
if($delete_tmp =='Y'){
|
|
||||||
$oLayoutAdminController = &getAdminController('layout');
|
|
||||||
$oLayoutAdminController->deleteUserLayoutTempFile($layout_srl);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oLayoutModel = &getModel('layout');
|
/**
|
||||||
// layout file is used as a temp.
|
* Copy layout instance
|
||||||
$oLayoutModel->setUseUserLayoutTemp();
|
* @return void
|
||||||
// Apply CSS in inline style
|
*/
|
||||||
$faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl);
|
function dispLayoutAdminCopyLayout()
|
||||||
|
{
|
||||||
|
$layoutSrl = Context::get('layout_srl');
|
||||||
|
|
||||||
$css = FileHandler::readFile($faceoffcss);
|
$oLayoutModel = &getModel('layout');
|
||||||
$match = null;
|
$layout = $oLayoutModel->getLayout($layoutSrl);
|
||||||
preg_match_all('/([^\{]+)\{([^\}]*)\}/is',$css,$match);
|
|
||||||
for($i=0,$c=count($match[1]);$i<$c;$i++) {
|
|
||||||
$name = trim($match[1][$i]);
|
|
||||||
$css = trim($match[2][$i]);
|
|
||||||
if(!$css) continue;
|
|
||||||
$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
|
|
||||||
$style[] .= sprintf('"%s":"%s"',$name,$css);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(count($style)) {
|
Context::set('layout', $layout);
|
||||||
$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>';
|
$this->setTemplateFile('copy_layout');
|
||||||
Context::addHtmlHeader($script);
|
}
|
||||||
}
|
}
|
||||||
|
/* End of file layout.admin.view.php */
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
/* Location: ./modules/layout/layout.admin.view.php */
|
||||||
Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
|
|
||||||
// Change widget codes in Javascript mode
|
|
||||||
$oWidgetController = &getController('widget');
|
|
||||||
$oWidgetController->setWidgetCodeInJavascriptMode();
|
|
||||||
// Set a template file
|
|
||||||
$this->setTemplateFile('faceoff_layout_edit');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy layout instance
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function dispLayoutAdminCopyLayout(){
|
|
||||||
$layoutSrl = Context::get('layout_srl');
|
|
||||||
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
$layout = $oLayoutModel->getLayout($layoutSrl);
|
|
||||||
|
|
||||||
Context::set('layout', $layout);
|
|
||||||
$this->setTemplateFile('copy_layout');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,113 +1,121 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class layout
|
* @class layout
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* high class of the layout module
|
* high class of the layout module
|
||||||
**/
|
*/
|
||||||
|
class layout extends ModuleObject
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Implement if additional tasks are necessary when installing
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
function moduleInstall()
|
||||||
|
{
|
||||||
|
// Create a directory to be used in the layout
|
||||||
|
FileHandler::makeDir('./files/cache/layout');
|
||||||
|
|
||||||
class layout extends ModuleObject {
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement if additional tasks are necessary when installing
|
* a method to check if successfully installed
|
||||||
* @return Object
|
* @return boolean
|
||||||
**/
|
*/
|
||||||
function moduleInstall() {
|
function checkUpdate()
|
||||||
// Create a directory to be used in the layout
|
{
|
||||||
FileHandler::makeDir('./files/cache/layout');
|
$oDB = &DB::getInstance();
|
||||||
|
// 2009. 02. 11 Add site_srl to layout table
|
||||||
|
if(!$oDB->isColumnExists('layouts', 'site_srl')) return true;
|
||||||
|
// 2009. 02. 26 Move the previous layout for faceoff
|
||||||
|
$files = FileHandler::readDir('./files/cache/layout');
|
||||||
|
for($i=0,$c=count($files);$i<$c;$i++)
|
||||||
|
{
|
||||||
|
$filename = $files[$i];
|
||||||
|
if(preg_match('/([0-9]+)\.html/i',$filename)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
return new Object();
|
if(!$oDB->isColumnExists('layouts', 'layout_type')) return true;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
$args->layout = '.';
|
||||||
* a method to check if successfully installed
|
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
||||||
* @return boolean
|
if($output->data && count($output->data) > 0)
|
||||||
**/
|
{
|
||||||
function checkUpdate() {
|
foreach($output->data as $layout)
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
// 2009. 02. 11 Add site_srl to layout table
|
|
||||||
if(!$oDB->isColumnExists('layouts', 'site_srl')) return true;
|
|
||||||
// 2009. 02. 26 Move the previous layout for faceoff
|
|
||||||
$files = FileHandler::readDir('./files/cache/layout');
|
|
||||||
for($i=0,$c=count($files);$i<$c;$i++) {
|
|
||||||
$filename = $files[$i];
|
|
||||||
if(preg_match('/([0-9]+)\.html/i',$filename)) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$oDB->isColumnExists('layouts', 'layout_type')) return true;
|
|
||||||
|
|
||||||
$args->layout = '.';
|
|
||||||
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
|
||||||
if($output->data && count($output->data) > 0)
|
|
||||||
{
|
{
|
||||||
foreach($output->data as $layout)
|
$layout_path = explode('.', $layout->layout);
|
||||||
|
if(count($layout_path) != 2) continue;
|
||||||
|
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute update
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
function moduleUpdate()
|
||||||
|
{
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
// 2009. 02. 11 Add site_srl to menu table
|
||||||
|
if(!$oDB->isColumnExists('layouts', 'site_srl'))
|
||||||
|
{
|
||||||
|
$oDB->addColumn('layouts','site_srl','number',11,0,true);
|
||||||
|
}
|
||||||
|
// 2009. 02. 26 Move the previous layout for faceoff
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
$files = FileHandler::readDir('./files/cache/layout');
|
||||||
|
for($i=0,$c=count($files);$i<$c;$i++)
|
||||||
|
{
|
||||||
|
$filename = $files[$i];
|
||||||
|
if(!preg_match('/([0-9]+)\.html/i',$filename,$match)) continue;
|
||||||
|
$layout_srl = $match[1];
|
||||||
|
if(!$layout_srl) continue;
|
||||||
|
$path = $oLayoutModel->getUserLayoutPath($layout_srl);
|
||||||
|
if(!is_dir($path)) FileHandler::makeDir($path);
|
||||||
|
FileHandler::copyFile('./files/cache/layout/'.$filename, $path.'layout.html');
|
||||||
|
@unlink('./files/cache/layout/'.$filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$oDB->isColumnExists('layouts', 'layout_type'))
|
||||||
|
{
|
||||||
|
$oDB->addColumn('layouts','layout_type','char',1,'P',true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$args->layout = '.';
|
||||||
|
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
||||||
|
if($output->data && count($output->data) > 0)
|
||||||
|
{
|
||||||
|
foreach($output->data as $layout)
|
||||||
|
{
|
||||||
|
$layout_path = explode('.', $layout->layout);
|
||||||
|
if(count($layout_path) != 2) continue;
|
||||||
|
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1])))
|
||||||
{
|
{
|
||||||
$layout_path = explode('.', $layout->layout);
|
$args->layout = implode('|@|', $layout_path);
|
||||||
if(count($layout_path) != 2) continue;
|
$args->layout_srl = $layout->layout_srl;
|
||||||
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) return true;
|
$output = executeQuery('layout.updateLayout', $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return new Object(0, 'success_updated');
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
/**
|
||||||
}
|
* Re-generate the cache file
|
||||||
|
* @return void
|
||||||
/**
|
*/
|
||||||
* Execute update
|
function recompileCache()
|
||||||
* @return Object
|
{
|
||||||
**/
|
$path = './files/cache/layout';
|
||||||
function moduleUpdate() {
|
if(!is_dir($path))
|
||||||
$oDB = &DB::getInstance();
|
{
|
||||||
// 2009. 02. 11 Add site_srl to menu table
|
FileHandler::makeDir($path);
|
||||||
if(!$oDB->isColumnExists('layouts', 'site_srl')) {
|
return;
|
||||||
$oDB->addColumn('layouts','site_srl','number',11,0,true);
|
}
|
||||||
}
|
}
|
||||||
// 2009. 02. 26 Move the previous layout for faceoff
|
}
|
||||||
$oLayoutModel = &getModel('layout');
|
/* End of file layout.class.php */
|
||||||
$files = FileHandler::readDir('./files/cache/layout');
|
/* Location: ./modules/layout/layout.class.php */
|
||||||
for($i=0,$c=count($files);$i<$c;$i++) {
|
|
||||||
$filename = $files[$i];
|
|
||||||
if(!preg_match('/([0-9]+)\.html/i',$filename,$match)) continue;
|
|
||||||
$layout_srl = $match[1];
|
|
||||||
if(!$layout_srl) continue;
|
|
||||||
$path = $oLayoutModel->getUserLayoutPath($layout_srl);
|
|
||||||
if(!is_dir($path)) FileHandler::makeDir($path);
|
|
||||||
FileHandler::copyFile('./files/cache/layout/'.$filename, $path.'layout.html');
|
|
||||||
@unlink('./files/cache/layout/'.$filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$oDB->isColumnExists('layouts', 'layout_type')) {
|
|
||||||
$oDB->addColumn('layouts','layout_type','char',1,'P',true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$args->layout = '.';
|
|
||||||
$output = executeQueryArray('layout.getLayoutDotList', $args);
|
|
||||||
if($output->data && count($output->data) > 0)
|
|
||||||
{
|
|
||||||
foreach($output->data as $layout)
|
|
||||||
{
|
|
||||||
$layout_path = explode('.', $layout->layout);
|
|
||||||
if(count($layout_path) != 2) continue;
|
|
||||||
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1])))
|
|
||||||
{
|
|
||||||
$args->layout = implode('|@|', $layout_path);
|
|
||||||
$args->layout_srl = $layout->layout_srl;
|
|
||||||
$output = executeQuery('layout.updateLayout', $args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new Object(0, 'success_updated');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Re-generate the cache file
|
|
||||||
* @return void
|
|
||||||
**/
|
|
||||||
function recompileCache() {
|
|
||||||
$path = './files/cache/layout';
|
|
||||||
if(!is_dir($path)) {
|
|
||||||
FileHandler::makeDir($path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,265 +1,271 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class layoutView
|
* @class layoutView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* admin view class of the layout module
|
* admin view class of the layout module
|
||||||
**/
|
*/
|
||||||
|
class layoutView extends layout
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Initialization
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
}
|
||||||
|
|
||||||
class layoutView extends layout {
|
/**
|
||||||
|
* Pop-up layout details(conf/info.xml)
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function dispLayoutInfo()
|
||||||
|
{
|
||||||
|
// Get the layout information
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
|
||||||
|
if(!$layout_info) exit();
|
||||||
|
Context::set('layout_info', $layout_info);
|
||||||
|
// Set the layout to be pop-up
|
||||||
|
$this->setLayoutFile('popup_layout');
|
||||||
|
// Set a template file
|
||||||
|
$this->setTemplateFile('layout_detail_info');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization
|
* Preview a layout with module.
|
||||||
* @return void
|
*
|
||||||
**/
|
* @return Object
|
||||||
function init() {
|
*/
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
public function dispLayoutPreviewWithModule()
|
||||||
}
|
{
|
||||||
|
// admin check
|
||||||
/**
|
// this act is admin view but in normal view because do not load admin css/js files
|
||||||
* Pop-up layout details(conf/info.xml)
|
$logged_info = Context::get('logged_info');
|
||||||
* @return void
|
if($logged_info->is_admin != 'Y')
|
||||||
**/
|
|
||||||
function dispLayoutInfo() {
|
|
||||||
// Get the layout information
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
|
|
||||||
if(!$layout_info) exit();
|
|
||||||
Context::set('layout_info', $layout_info);
|
|
||||||
// Set the layout to be pop-up
|
|
||||||
$this->setLayoutFile('popup_layout');
|
|
||||||
// Set a template file
|
|
||||||
$this->setTemplateFile('layout_detail_info');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Preview a layout with module.
|
|
||||||
*
|
|
||||||
* @return Object
|
|
||||||
**/
|
|
||||||
public function dispLayoutPreviewWithModule()
|
|
||||||
{
|
{
|
||||||
// admin check
|
return $this->stop('msg_invalid_request');
|
||||||
// this act is admin view but in normal view because do not load admin css/js files
|
}
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
if($logged_info->is_admin != 'Y')
|
$layoutSrl = Context::get('layout_srl');
|
||||||
|
$layoutVars = Context::get('layout_vars');
|
||||||
|
$layoutVars = json_decode($layoutVars);
|
||||||
|
|
||||||
|
$moduleSrl = Context::get('target_module_srl');
|
||||||
|
$module = Context::get('module_name');
|
||||||
|
$mid = Context::get('target_mid');
|
||||||
|
$skin = Context::get('skin');
|
||||||
|
$skinVars = Context::get('skin_vars');
|
||||||
|
$skinVars = json_decode($skinVars);
|
||||||
|
|
||||||
|
$skinType = Context::get('skin_type');
|
||||||
|
$type = ($skinType == 'M') ? 'mobile' : 'view';
|
||||||
|
|
||||||
|
if($module == 'ARTICLE')
|
||||||
|
{
|
||||||
|
$module = 'page';
|
||||||
|
$page_type = 'ARTICLE';
|
||||||
|
$document_srl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($module)
|
||||||
|
{
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
$xml_info = $oModuleModel->getModuleActionXml($module);
|
||||||
|
//create content
|
||||||
|
if(!$mid && !$moduleSrl)
|
||||||
{
|
{
|
||||||
return $this->stop('msg_invalid_request');
|
if($skin && !$module)
|
||||||
}
|
|
||||||
|
|
||||||
$layoutSrl = Context::get('layout_srl');
|
|
||||||
$layoutVars = Context::get('layout_vars');
|
|
||||||
$layoutVars = json_decode($layoutVars);
|
|
||||||
|
|
||||||
$moduleSrl = Context::get('target_module_srl');
|
|
||||||
$module = Context::get('module_name');
|
|
||||||
$mid = Context::get('target_mid');
|
|
||||||
$skin = Context::get('skin');
|
|
||||||
$skinVars = Context::get('skin_vars');
|
|
||||||
$skinVars = json_decode($skinVars);
|
|
||||||
|
|
||||||
$skinType = Context::get('skin_type');
|
|
||||||
$type = ($skinType == 'M') ? 'mobile' : 'view';
|
|
||||||
|
|
||||||
if($module == 'ARTICLE')
|
|
||||||
{
|
|
||||||
$module = 'page';
|
|
||||||
$page_type = 'ARTICLE';
|
|
||||||
$document_srl = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($module)
|
|
||||||
{
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$xml_info = $oModuleModel->getModuleActionXml($module);
|
|
||||||
//create content
|
|
||||||
if(!$mid && !$moduleSrl)
|
|
||||||
{
|
{
|
||||||
if($skin && !$module)
|
return $this->stop(-1, 'msg_invalid_request');
|
||||||
{
|
|
||||||
return $this->stop(-1, 'msg_invalid_request');
|
|
||||||
}
|
|
||||||
|
|
||||||
$oModule = ModuleHandler::getModuleInstance($module, $type);
|
|
||||||
$oModule->setAct($xml_info->default_index_act);
|
|
||||||
$module_info->module = $module;
|
|
||||||
$module_info->module_type = $type;
|
|
||||||
$module_info->page_type = $page_type;
|
|
||||||
$module_info->document_srl= $document_srl;
|
|
||||||
$oModule->setModuleInfo($this->module_info, $xml_info);
|
|
||||||
$oModule->proc();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$oModuleHandler = new ModuleHandler($module, '', $mid, '', $moduleSrl);
|
|
||||||
$oModuleHandler->act = '';
|
|
||||||
$oModuleHandler->init();
|
|
||||||
$oModule = $oModuleHandler->procModule();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($oModule->toBool())
|
$oModule = ModuleHandler::getModuleInstance($module, $type);
|
||||||
{
|
$oModule->setAct($xml_info->default_index_act);
|
||||||
if($skin)
|
$module_info->module = $module;
|
||||||
{
|
$module_info->module_type = $type;
|
||||||
$skinDir = ($skinType == 'M') ? 'm.skins' : 'skins';
|
$module_info->page_type = $page_type;
|
||||||
$template_path = sprintf("%s%s/%s/",$oModule->module_path, $skinDir, $skin);
|
$module_info->document_srl= $document_srl;
|
||||||
$oModule->setTemplatePath($template_path);
|
$oModule->setModuleInfo($this->module_info, $xml_info);
|
||||||
|
$oModule->proc();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oModuleHandler = new ModuleHandler($module, '', $mid, '', $moduleSrl);
|
||||||
|
$oModuleHandler->act = '';
|
||||||
|
$oModuleHandler->init();
|
||||||
|
$oModule = $oModuleHandler->procModule();
|
||||||
|
}
|
||||||
|
|
||||||
if(is_array($skinVars))
|
if($oModule->toBool())
|
||||||
|
{
|
||||||
|
if($skin)
|
||||||
|
{
|
||||||
|
$skinDir = ($skinType == 'M') ? 'm.skins' : 'skins';
|
||||||
|
$template_path = sprintf("%s%s/%s/",$oModule->module_path, $skinDir, $skin);
|
||||||
|
$oModule->setTemplatePath($template_path);
|
||||||
|
|
||||||
|
if(is_array($skinVars))
|
||||||
|
{
|
||||||
|
foreach($skinVars as $key => $val)
|
||||||
{
|
{
|
||||||
foreach($skinVars as $key => $val)
|
$oModule->module_info->{$key} = $val;
|
||||||
{
|
|
||||||
$oModule->module_info->{$key} = $val;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
require_once("./classes/display/HTMLDisplayHandler.php");
|
require_once("./classes/display/HTMLDisplayHandler.php");
|
||||||
$handler = new HTMLDisplayHandler();
|
$handler = new HTMLDisplayHandler();
|
||||||
$output = $handler->toDoc($oModule);
|
$output = $handler->toDoc($oModule);
|
||||||
Context::set('content', $output);
|
Context::set('content', $output);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Context::set('content', Context::getLang('not_support_layout_preview'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Context::set('content', Context::getLang('layout_preview_content'));
|
Context::set('content', Context::getLang('not_support_layout_preview'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($layoutSrl)
|
|
||||||
{
|
|
||||||
if($layoutSrl == -1)
|
|
||||||
{
|
|
||||||
$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
|
|
||||||
$designInfoFile = sprintf(_XE_PATH_.'/files/site_design/design_%s.php', $site_srl);
|
|
||||||
@include($designInfoFile);
|
|
||||||
$layoutSrl = $designInfo->layout_srl;
|
|
||||||
}
|
|
||||||
|
|
||||||
$oLayoutModel = getModel('layout');
|
|
||||||
$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
|
|
||||||
|
|
||||||
if(!$layoutInfo)
|
|
||||||
{
|
|
||||||
return new Object(-1, 'msg_invalid_request');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set names and values of extra_vars to $layout_info
|
|
||||||
if($layoutInfo->extra_var_count)
|
|
||||||
{
|
|
||||||
foreach($layoutInfo->extra_var as $var_id => $val)
|
|
||||||
{
|
|
||||||
$layoutInfo->{$var_id} = $val->value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($layoutVars)
|
|
||||||
{
|
|
||||||
foreach($layoutVars as $key => $val)
|
|
||||||
{
|
|
||||||
$layoutInfo->{$key} = $val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// menu in layout information becomes an argument for Context:: set
|
|
||||||
if($layoutInfo->menu_count)
|
|
||||||
{
|
|
||||||
foreach($layoutInfo->menu as $menu_id => $menu)
|
|
||||||
{
|
|
||||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
|
||||||
Context::set($menu_id, $menu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Context::set('layout_info', $layoutInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compile
|
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
|
||||||
Context::clearHtmlHeader();
|
|
||||||
if($layoutSrl)
|
|
||||||
{
|
|
||||||
$layout_path = $layoutInfo->path;
|
|
||||||
$layout_file = 'layout';
|
|
||||||
$oModuleModel = getModel('module');
|
|
||||||
$part_config= $oModuleModel->getModulePartConfig('layout',$layoutSrl);
|
|
||||||
Context::addHtmlHeader($part_config->header_script);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$layout_path = './common/tpl';
|
|
||||||
$layout_file = 'default_layout';
|
|
||||||
}
|
|
||||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file);
|
|
||||||
Context::set('layout','none');
|
|
||||||
|
|
||||||
// Convert widgets and others
|
|
||||||
$oContext = &Context::getInstance();
|
|
||||||
Context::set('layout_tpl', $layout_tpl);
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
|
||||||
$this->setTemplateFile('layout_preview');
|
|
||||||
}
|
}
|
||||||
/**
|
else
|
||||||
* Preview a layout
|
|
||||||
* @return void|Object (void : success, Object : fail)
|
|
||||||
**/
|
|
||||||
function dispLayoutPreview()
|
|
||||||
{
|
{
|
||||||
// admin check
|
Context::set('content', Context::getLang('layout_preview_content'));
|
||||||
// this act is admin view but in normal view because do not load admin css/js files
|
}
|
||||||
$logged_info = Context::get('logged_info');
|
|
||||||
if ($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
|
|
||||||
|
|
||||||
$layout_srl = Context::get('layout_srl');
|
if($layoutSrl)
|
||||||
$code = Context::get('code');
|
{
|
||||||
|
if($layoutSrl == -1)
|
||||||
|
{
|
||||||
|
$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
|
||||||
|
$designInfoFile = sprintf(_XE_PATH_.'/files/site_design/design_%s.php', $site_srl);
|
||||||
|
@include($designInfoFile);
|
||||||
|
$layoutSrl = $designInfo->layout_srl;
|
||||||
|
}
|
||||||
|
|
||||||
$code_css = Context::get('code_css');
|
$oLayoutModel = getModel('layout');
|
||||||
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
|
||||||
// Get the layout information
|
|
||||||
$oLayoutModel = &getModel('layout');
|
|
||||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
|
||||||
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
|
||||||
// Separately handle the layout if its type is faceoff
|
|
||||||
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
|
||||||
// Apply CSS directly
|
|
||||||
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
|
||||||
// Set names and values of extra_vars to $layout_info
|
|
||||||
if($layout_info->extra_var_count) {
|
|
||||||
foreach($layout_info->extra_var as $var_id => $val) {
|
|
||||||
$layout_info->{$var_id} = $val->value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// menu in layout information becomes an argument for Context:: set
|
|
||||||
if($layout_info->menu_count) {
|
|
||||||
foreach($layout_info->menu as $menu_id => $menu) {
|
|
||||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
|
||||||
Context::set($menu_id, $menu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Context::set('layout_info', $layout_info);
|
if(!$layoutInfo)
|
||||||
Context::set('content', Context::getLang('layout_preview_content'));
|
{
|
||||||
// Temporary save the codes
|
return new Object(-1, 'msg_invalid_request');
|
||||||
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
}
|
||||||
FileHandler::writeFile($edited_layout_file, $code);
|
|
||||||
|
|
||||||
// Compile
|
// Set names and values of extra_vars to $layout_info
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
if($layoutInfo->extra_var_count)
|
||||||
|
{
|
||||||
|
foreach($layoutInfo->extra_var as $var_id => $val)
|
||||||
|
{
|
||||||
|
$layoutInfo->{$var_id} = $val->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$layout_path = $layout_info->path;
|
if($layoutVars)
|
||||||
$layout_file = 'layout';
|
{
|
||||||
|
foreach($layoutVars as $key => $val)
|
||||||
|
{
|
||||||
|
$layoutInfo->{$key} = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
// menu in layout information becomes an argument for Context:: set
|
||||||
Context::set('layout','none');
|
if($layoutInfo->menu_count)
|
||||||
// Convert widgets and others
|
{
|
||||||
$oContext = &Context::getInstance();
|
foreach($layoutInfo->menu as $menu_id => $menu)
|
||||||
Context::set('layout_tpl', $layout_tpl);
|
{
|
||||||
// Delete Temporary Files
|
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||||
FileHandler::removeFile($edited_layout_file);
|
Context::set($menu_id, $menu);
|
||||||
$this->setTemplateFile('layout_preview');
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
Context::set('layout_info', $layoutInfo);
|
||||||
?>
|
}
|
||||||
|
|
||||||
|
// Compile
|
||||||
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
Context::clearHtmlHeader();
|
||||||
|
if($layoutSrl)
|
||||||
|
{
|
||||||
|
$layout_path = $layoutInfo->path;
|
||||||
|
$layout_file = 'layout';
|
||||||
|
$oModuleModel = getModel('module');
|
||||||
|
$part_config= $oModuleModel->getModulePartConfig('layout',$layoutSrl);
|
||||||
|
Context::addHtmlHeader($part_config->header_script);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$layout_path = './common/tpl';
|
||||||
|
$layout_file = 'default_layout';
|
||||||
|
}
|
||||||
|
$layout_tpl = $oTemplate->compile($layout_path, $layout_file);
|
||||||
|
Context::set('layout','none');
|
||||||
|
|
||||||
|
// Convert widgets and others
|
||||||
|
$oContext = &Context::getInstance();
|
||||||
|
Context::set('layout_tpl', $layout_tpl);
|
||||||
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
|
$this->setTemplateFile('layout_preview');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Preview a layout
|
||||||
|
* @return void|Object (void : success, Object : fail)
|
||||||
|
*/
|
||||||
|
function dispLayoutPreview()
|
||||||
|
{
|
||||||
|
// admin check
|
||||||
|
// this act is admin view but in normal view because do not load admin css/js files
|
||||||
|
$logged_info = Context::get('logged_info');
|
||||||
|
if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
|
||||||
|
|
||||||
|
$layout_srl = Context::get('layout_srl');
|
||||||
|
$code = Context::get('code');
|
||||||
|
|
||||||
|
$code_css = Context::get('code_css');
|
||||||
|
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
||||||
|
// Get the layout information
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||||
|
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
|
||||||
|
// Separately handle the layout if its type is faceoff
|
||||||
|
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
|
||||||
|
// Apply CSS directly
|
||||||
|
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
|
||||||
|
// Set names and values of extra_vars to $layout_info
|
||||||
|
if($layout_info->extra_var_count)
|
||||||
|
{
|
||||||
|
foreach($layout_info->extra_var as $var_id => $val)
|
||||||
|
{
|
||||||
|
$layout_info->{$var_id} = $val->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// menu in layout information becomes an argument for Context:: set
|
||||||
|
if($layout_info->menu_count)
|
||||||
|
{
|
||||||
|
foreach($layout_info->menu as $menu_id => $menu)
|
||||||
|
{
|
||||||
|
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||||
|
Context::set($menu_id, $menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Context::set('layout_info', $layout_info);
|
||||||
|
Context::set('content', Context::getLang('layout_preview_content'));
|
||||||
|
// Temporary save the codes
|
||||||
|
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
|
||||||
|
FileHandler::writeFile($edited_layout_file, $code);
|
||||||
|
|
||||||
|
// Compile
|
||||||
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
|
||||||
|
$layout_path = $layout_info->path;
|
||||||
|
$layout_file = 'layout';
|
||||||
|
|
||||||
|
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
|
||||||
|
Context::set('layout','none');
|
||||||
|
// Convert widgets and others
|
||||||
|
$oContext = &Context::getInstance();
|
||||||
|
Context::set('layout_tpl', $layout_tpl);
|
||||||
|
// Delete Temporary Files
|
||||||
|
FileHandler::removeFile($edited_layout_file);
|
||||||
|
$this->setTemplateFile('layout_preview');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/* End of file layout.view.php */
|
||||||
|
/* Location: ./modules/layout/layout.view.php */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,283 +1,303 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class memberAdminModel
|
* @class memberAdminModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* admin model class of member module
|
* admin model class of member module
|
||||||
**/
|
*/
|
||||||
|
class memberAdminModel extends member
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* info of member
|
||||||
|
* @var object
|
||||||
|
*/
|
||||||
|
var $member_info = NULL;
|
||||||
|
|
||||||
class memberAdminModel extends member {
|
/**
|
||||||
|
* info of member groups
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
var $member_groups = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* info of member
|
* info of sign up form
|
||||||
* @var object
|
* @var array
|
||||||
**/
|
*/
|
||||||
var $member_info = NULL;
|
var $join_form_list = NULL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* info of member groups
|
* Initialization
|
||||||
* @var array
|
* @return void
|
||||||
**/
|
*/
|
||||||
var $member_groups = NULL;
|
function init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* info of sign up form
|
* Get a member list
|
||||||
* @var array
|
*
|
||||||
**/
|
* @return object|array (object : when member count is 1, array : when member count is more than 1)
|
||||||
var $join_form_list = NULL;
|
*/
|
||||||
|
function getMemberList()
|
||||||
|
{
|
||||||
|
// Search option
|
||||||
|
$args->is_admin = Context::get('is_admin')=='Y'?'Y':'';
|
||||||
|
$args->is_denied = Context::get('is_denied')=='Y'?'Y':'';
|
||||||
|
$args->selected_group_srl = Context::get('selected_group_srl');
|
||||||
|
|
||||||
/**
|
$filter = Context::get('filter_type');
|
||||||
* Initialization
|
switch($filter)
|
||||||
* @return void
|
{
|
||||||
**/
|
case 'super_admin' : $args->is_admin = 'Y';break;
|
||||||
function init() {
|
case 'site_admin' : $args->member_srls = $this->getSiteAdminMemberSrls();break;
|
||||||
}
|
case 'enable' : $args->is_denied = 'N';break;
|
||||||
|
case 'disable' : $args->is_denied = 'Y';break;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
$search_target = trim(Context::get('search_target'));
|
||||||
* Get a member list
|
$search_keyword = trim(Context::get('search_keyword'));
|
||||||
*
|
|
||||||
* @return object|array (object : when member count is 1, array : when member count is more than 1)
|
|
||||||
**/
|
|
||||||
function getMemberList() {
|
|
||||||
// Search option
|
|
||||||
$args->is_admin = Context::get('is_admin')=='Y'?'Y':'';
|
|
||||||
$args->is_denied = Context::get('is_denied')=='Y'?'Y':'';
|
|
||||||
$args->selected_group_srl = Context::get('selected_group_srl');
|
|
||||||
|
|
||||||
$filter = Context::get('filter_type');
|
if($search_target && $search_keyword)
|
||||||
switch($filter){
|
{
|
||||||
case 'super_admin' : $args->is_admin = 'Y';break;
|
switch($search_target)
|
||||||
case 'site_admin' : $args->member_srls = $this->getSiteAdminMemberSrls();break;
|
|
||||||
case 'enable' : $args->is_denied = 'N';break;
|
|
||||||
case 'disable' : $args->is_denied = 'Y';break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$search_target = trim(Context::get('search_target'));
|
|
||||||
$search_keyword = trim(Context::get('search_keyword'));
|
|
||||||
|
|
||||||
if($search_target && $search_keyword) {
|
|
||||||
switch($search_target) {
|
|
||||||
case 'user_id' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_user_id = $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'user_name' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_user_name = $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'nick_name' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_nick_name = $search_keyword;
|
|
||||||
$args->html_nick_name = htmlspecialchars($search_keyword);
|
|
||||||
break;
|
|
||||||
case 'email_address' :
|
|
||||||
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
|
||||||
$args->s_email_address = $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'regdate' :
|
|
||||||
$args->s_regdate = preg_replace("/[^0-9]/","",$search_keyword);
|
|
||||||
break;
|
|
||||||
case 'regdate_more' :
|
|
||||||
$args->s_regdate_more = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
|
||||||
break;
|
|
||||||
case 'regdate_less' :
|
|
||||||
$args->s_regdate_less = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
|
||||||
break;
|
|
||||||
case 'last_login' :
|
|
||||||
$args->s_last_login = $search_keyword;
|
|
||||||
break;
|
|
||||||
case 'last_login_more' :
|
|
||||||
$args->s_last_login_more = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
|
||||||
break;
|
|
||||||
case 'last_login_less' :
|
|
||||||
$args->s_last_login_less = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
|
||||||
break;
|
|
||||||
case 'extra_vars' :
|
|
||||||
$args->s_extra_vars = $search_keyword;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change the query id if selected_group_srl exists (for table join)
|
|
||||||
$sort_order = Context::get('sort_order');
|
|
||||||
$sort_index = Context::get('sort_index');
|
|
||||||
if(!$sort_index) {
|
|
||||||
$sort_index = "list_order";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$sort_order) {
|
|
||||||
$sort_order = 'asc';
|
|
||||||
}
|
|
||||||
|
|
||||||
if($sort_order != 'asc')
|
|
||||||
{
|
{
|
||||||
$sort_order = 'desc';
|
case 'user_id' :
|
||||||
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
|
$args->s_user_id = $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'user_name' :
|
||||||
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
|
$args->s_user_name = $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'nick_name' :
|
||||||
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
|
$args->s_nick_name = $search_keyword;
|
||||||
|
$args->html_nick_name = htmlspecialchars($search_keyword);
|
||||||
|
break;
|
||||||
|
case 'email_address' :
|
||||||
|
if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
|
||||||
|
$args->s_email_address = $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'regdate' :
|
||||||
|
$args->s_regdate = preg_replace("/[^0-9]/","",$search_keyword);
|
||||||
|
break;
|
||||||
|
case 'regdate_more' :
|
||||||
|
$args->s_regdate_more = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
||||||
|
break;
|
||||||
|
case 'regdate_less' :
|
||||||
|
$args->s_regdate_less = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
||||||
|
break;
|
||||||
|
case 'last_login' :
|
||||||
|
$args->s_last_login = $search_keyword;
|
||||||
|
break;
|
||||||
|
case 'last_login_more' :
|
||||||
|
$args->s_last_login_more = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
||||||
|
break;
|
||||||
|
case 'last_login_less' :
|
||||||
|
$args->s_last_login_less = substr(preg_replace("/[^0-9]/","",$search_keyword) . '00000000000000',0,14);
|
||||||
|
break;
|
||||||
|
case 'extra_vars' :
|
||||||
|
$args->s_extra_vars = $search_keyword;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($args->selected_group_srl) {
|
|
||||||
$query_id = 'member.getMemberListWithinGroup';
|
|
||||||
$args->sort_index = "member.".$sort_index;
|
|
||||||
} else {
|
|
||||||
$query_id = 'member.getMemberList';
|
|
||||||
$args->sort_index = $sort_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
$args->sort_order = $sort_order;
|
|
||||||
Context::set('sort_order', $sort_order);
|
|
||||||
// Other variables
|
|
||||||
$args->page = Context::get('page');
|
|
||||||
$args->list_count = 40;
|
|
||||||
$args->page_count = 10;
|
|
||||||
$output = executeQuery($query_id, $args);
|
|
||||||
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a memebr list for each site
|
|
||||||
*
|
|
||||||
* @param int $site_srl
|
|
||||||
* @param int $page
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
**/
|
|
||||||
function getSiteMemberList($site_srl, $page = 1) {
|
|
||||||
$args->site_srl = $site_srl;
|
|
||||||
$args->page = $page;
|
|
||||||
$args->list_count = 40;
|
|
||||||
$args->page_count = 10;
|
|
||||||
$query_id = 'member.getSiteMemberList';
|
|
||||||
$output = executeQueryArray($query_id, $args);
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get member_srls lists about site admins
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
**/
|
|
||||||
function getSiteAdminMemberSrls(){
|
|
||||||
$output = executeQueryArray('member.getSiteAdminMemberSrls');
|
|
||||||
if (!$output->toBool() || !$output->data) return array();
|
|
||||||
|
|
||||||
$member_srls = array();
|
|
||||||
foreach($output->data as $member_info){
|
|
||||||
$member_srls[] = $member_info->member_srl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $member_srls;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Change the query id if selected_group_srl exists (for table join)
|
||||||
* Return colorset list of a skin in the member module
|
$sort_order = Context::get('sort_order');
|
||||||
*
|
$sort_index = Context::get('sort_index');
|
||||||
* @return void
|
if(!$sort_index)
|
||||||
**/
|
{
|
||||||
function getMemberAdminColorset() {
|
$sort_index = "list_order";
|
||||||
$skin = Context::get('skin');
|
|
||||||
if(!$skin) $tpl = "";
|
|
||||||
else {
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
|
|
||||||
Context::set('skin_info', $skin_info);
|
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('member');
|
|
||||||
if(!$config->colorset) $config->colorset = "white";
|
|
||||||
Context::set('config', $config);
|
|
||||||
|
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
|
||||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'new_colorset_list');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->add('tpl', $tpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return member count with date
|
|
||||||
*
|
|
||||||
* @param string $date
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
**/
|
|
||||||
function getMemberCountByDate($date = '') {
|
|
||||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
|
||||||
|
|
||||||
$output = executeQuery('member.getMemberCountByDate', $args);
|
|
||||||
if(!$output->toBool()) return 0;
|
|
||||||
|
|
||||||
return $output->data->count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return site join member count with date
|
|
||||||
*
|
|
||||||
* @param string $date
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
**/
|
|
||||||
function getMemberGroupMemberCountByDate($date = '') {
|
|
||||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
|
||||||
|
|
||||||
$output = executeQuery('member.getMemberGroupMemberCountByDate', $args);
|
|
||||||
if(!$output->toBool()) return 0;
|
|
||||||
|
|
||||||
return count($output->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return add join Form
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
**/
|
|
||||||
function getMemberAdminInsertJoinForm() {
|
|
||||||
$member_join_form_srl = Context::get('member_join_form_srl');
|
|
||||||
|
|
||||||
$args->member_join_form_srl = $member_join_form_srl;
|
|
||||||
$output = executeQuery('member.getJoinForm', $args);
|
|
||||||
|
|
||||||
if($output->toBool() && $output->data){
|
|
||||||
$formInfo = $output->data;
|
|
||||||
$default_value = $formInfo->default_value;
|
|
||||||
if ($default_value){
|
|
||||||
$default_value = unserialize($default_value);
|
|
||||||
Context::set('default_value', $default_value);
|
|
||||||
}
|
|
||||||
Context::set('formInfo', $output->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
|
||||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'insert_join_form');
|
|
||||||
|
|
||||||
$this->add('tpl', str_replace("\n"," ",$tpl));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$sort_order)
|
||||||
/**
|
{
|
||||||
* check allowed target ip address when login for admin.
|
$sort_order = 'asc';
|
||||||
*
|
|
||||||
* @return boolean (true : allowed, false : refuse)
|
|
||||||
**/
|
|
||||||
function getMemberAdminIPCheck() {
|
|
||||||
|
|
||||||
$db_info = Context::getDBInfo();
|
|
||||||
$admin_ip_list = $db_info->admin_ip_list;
|
|
||||||
$admin_ip_list = explode(",",$admin_ip_list);
|
|
||||||
$oMemberModel = &getModel('member');
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
|
||||||
$falg = false;
|
|
||||||
foreach($admin_ip_list as $admin_ip_list_key => $admin_ip_value) {
|
|
||||||
if(preg_match('/^\d{1,3}(?:.(\d{1,3}|\*)){3}\s*$/', $admin_ip_value, $matches) && $ip) {
|
|
||||||
$admin_ip = $matches[0];
|
|
||||||
$admin_ip = str_replace('*','',$admin_ip);
|
|
||||||
$admin_ip_patterns[] = preg_quote($admin_ip);
|
|
||||||
$admin_ip_pattern = '/^('.implode($admin_ip_patterns,'|').')/';
|
|
||||||
if(preg_match($admin_ip_pattern, $ip, $matches)) return true;
|
|
||||||
$flag = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if(!$flag) return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
?>
|
if($sort_order != 'asc')
|
||||||
|
{
|
||||||
|
$sort_order = 'desc';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($args->selected_group_srl)
|
||||||
|
{
|
||||||
|
$query_id = 'member.getMemberListWithinGroup';
|
||||||
|
$args->sort_index = "member.".$sort_index;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$query_id = 'member.getMemberList';
|
||||||
|
$args->sort_index = $sort_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
$args->sort_order = $sort_order;
|
||||||
|
Context::set('sort_order', $sort_order);
|
||||||
|
// Other variables
|
||||||
|
$args->page = Context::get('page');
|
||||||
|
$args->list_count = 40;
|
||||||
|
$args->page_count = 10;
|
||||||
|
$output = executeQuery($query_id, $args);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a memebr list for each site
|
||||||
|
*
|
||||||
|
* @param int $site_srl
|
||||||
|
* @param int $page
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function getSiteMemberList($site_srl, $page = 1)
|
||||||
|
{
|
||||||
|
$args->site_srl = $site_srl;
|
||||||
|
$args->page = $page;
|
||||||
|
$args->list_count = 40;
|
||||||
|
$args->page_count = 10;
|
||||||
|
$query_id = 'member.getSiteMemberList';
|
||||||
|
$output = executeQueryArray($query_id, $args);
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get member_srls lists about site admins
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function getSiteAdminMemberSrls()
|
||||||
|
{
|
||||||
|
$output = executeQueryArray('member.getSiteAdminMemberSrls');
|
||||||
|
if(!$output->toBool() || !$output->data) return array();
|
||||||
|
|
||||||
|
$member_srls = array();
|
||||||
|
foreach($output->data as $member_info)
|
||||||
|
{
|
||||||
|
$member_srls[] = $member_info->member_srl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $member_srls;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return colorset list of a skin in the member module
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function getMemberAdminColorset()
|
||||||
|
{
|
||||||
|
$skin = Context::get('skin');
|
||||||
|
if(!$skin) $tpl = "";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
|
||||||
|
Context::set('skin_info', $skin_info);
|
||||||
|
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$config = $oModuleModel->getModuleConfig('member');
|
||||||
|
if(!$config->colorset) $config->colorset = "white";
|
||||||
|
Context::set('config', $config);
|
||||||
|
|
||||||
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
$tpl = $oTemplate->compile($this->module_path.'tpl', 'new_colorset_list');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->add('tpl', $tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return member count with date
|
||||||
|
*
|
||||||
|
* @param string $date
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getMemberCountByDate($date = '')
|
||||||
|
{
|
||||||
|
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||||
|
|
||||||
|
$output = executeQuery('member.getMemberCountByDate', $args);
|
||||||
|
if(!$output->toBool()) return 0;
|
||||||
|
|
||||||
|
return $output->data->count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return site join member count with date
|
||||||
|
*
|
||||||
|
* @param string $date
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
function getMemberGroupMemberCountByDate($date = '')
|
||||||
|
{
|
||||||
|
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||||
|
|
||||||
|
$output = executeQuery('member.getMemberGroupMemberCountByDate', $args);
|
||||||
|
if(!$output->toBool()) return 0;
|
||||||
|
|
||||||
|
return count($output->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return add join Form
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function getMemberAdminInsertJoinForm()
|
||||||
|
{
|
||||||
|
$member_join_form_srl = Context::get('member_join_form_srl');
|
||||||
|
|
||||||
|
$args->member_join_form_srl = $member_join_form_srl;
|
||||||
|
$output = executeQuery('member.getJoinForm', $args);
|
||||||
|
|
||||||
|
if($output->toBool() && $output->data)
|
||||||
|
{
|
||||||
|
$formInfo = $output->data;
|
||||||
|
$default_value = $formInfo->default_value;
|
||||||
|
if($default_value)
|
||||||
|
{
|
||||||
|
$default_value = unserialize($default_value);
|
||||||
|
Context::set('default_value', $default_value);
|
||||||
|
}
|
||||||
|
Context::set('formInfo', $output->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
|
$tpl = $oTemplate->compile($this->module_path.'tpl', 'insert_join_form');
|
||||||
|
|
||||||
|
$this->add('tpl', str_replace("\n"," ",$tpl));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check allowed target ip address when login for admin.
|
||||||
|
*
|
||||||
|
* @return boolean (true : allowed, false : refuse)
|
||||||
|
*/
|
||||||
|
function getMemberAdminIPCheck()
|
||||||
|
{
|
||||||
|
$db_info = Context::getDBInfo();
|
||||||
|
$admin_ip_list = $db_info->admin_ip_list;
|
||||||
|
$admin_ip_list = explode(",",$admin_ip_list);
|
||||||
|
$oMemberModel = &getModel('member');
|
||||||
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
|
$falg = false;
|
||||||
|
foreach($admin_ip_list as $admin_ip_list_key => $admin_ip_value)
|
||||||
|
{
|
||||||
|
if(preg_match('/^\d{1,3}(?:.(\d{1,3}|\*)){3}\s*$/', $admin_ip_value, $matches) && $ip)
|
||||||
|
{
|
||||||
|
$admin_ip = $matches[0];
|
||||||
|
$admin_ip = str_replace('*','',$admin_ip);
|
||||||
|
$admin_ip_patterns[] = preg_quote($admin_ip);
|
||||||
|
$admin_ip_pattern = '/^('.implode($admin_ip_patterns,'|').')/';
|
||||||
|
if(preg_match($admin_ip_pattern, $ip, $matches)) return true;
|
||||||
|
$flag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!$flag) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* End of file member.admin.model.php */
|
||||||
|
/* Location: ./modules/member/member.admin.model.php */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,53 +1,58 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class memberAPI
|
* @class memberAPI
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* API Processing of View Action in the member module
|
* API Processing of View Action in the member module
|
||||||
**/
|
*/
|
||||||
|
class memberAPI extends member
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Content List
|
||||||
|
*
|
||||||
|
* @param Object $oModule
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function dispSavedDocumentList(&$oModule)
|
||||||
|
{
|
||||||
|
$document_list = $this->arrangeContentList(Context::get('document_list'));
|
||||||
|
$oModule->add('document_list',$document_list);
|
||||||
|
$oModule->add('page_navigation',Context::get('page_navigation'));
|
||||||
|
}
|
||||||
|
|
||||||
class memberAPI extends member {
|
/**
|
||||||
|
* Arrange Contents
|
||||||
|
*
|
||||||
|
* @param array $content_list
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function arrangeContentList($content_list)
|
||||||
|
{
|
||||||
|
$output = array();
|
||||||
|
if(count($content_list))
|
||||||
|
{
|
||||||
|
foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val);
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content List
|
* Arrange Contents
|
||||||
*
|
*
|
||||||
* @param Object $oModule
|
* @param array $content_list
|
||||||
*
|
*
|
||||||
* @return void
|
* @return array
|
||||||
**/
|
*/
|
||||||
function dispSavedDocumentList(&$oModule) {
|
function arrangeContent($content)
|
||||||
$document_list = $this->arrangeContentList(Context::get('document_list'));
|
{
|
||||||
$oModule->add('document_list',$document_list);
|
$output = null;
|
||||||
$oModule->add('page_navigation',Context::get('page_navigation'));
|
if($content)
|
||||||
}
|
{
|
||||||
|
$output= $content->gets('document_srl','category_srl','nick_name','user_id','user_name','title','content','tags','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status');
|
||||||
/**
|
}
|
||||||
* Arrange Contents
|
return $output;
|
||||||
*
|
}
|
||||||
* @param array $content_list
|
}
|
||||||
*
|
/* End of file member.api.php */
|
||||||
* @return array
|
/* Location: ./modules/member/member.api.php */
|
||||||
**/
|
|
||||||
function arrangeContentList($content_list) {
|
|
||||||
$output = array();
|
|
||||||
if(count($content_list)) {
|
|
||||||
foreach($content_list as $key => $val) $output[] = $this->arrangeContent($val);
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Arrange Contents
|
|
||||||
*
|
|
||||||
* @param array $content_list
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
**/
|
|
||||||
function arrangeContent($content) {
|
|
||||||
$output = null;
|
|
||||||
if($content){
|
|
||||||
$output= $content->gets('document_srl','category_srl','nick_name','user_id','user_name','title','content','tags','voted_count','blamed_count','comment_count','regdate','last_update','extra_vars','status');
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
|
|
@ -1,433 +1,455 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class member
|
* @class member
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* high class of the member module
|
* high class of the member module
|
||||||
**/
|
*/
|
||||||
class member extends ModuleObject {
|
class member extends ModuleObject {
|
||||||
|
/**
|
||||||
|
* Use sha1 encryption
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
var $useSha1 = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use sha1 encryption
|
* constructor
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @return void
|
||||||
**/
|
*/
|
||||||
var $useSha1 = false;
|
function member()
|
||||||
|
{
|
||||||
|
if(!Context::isInstalled()) return;
|
||||||
|
|
||||||
/**
|
$oModuleModel = &getModel('module');
|
||||||
* constructor
|
$member_config = $oModuleModel->getModuleConfig('member');
|
||||||
*
|
// Set to use SSL upon actions related member join/information/password and so on
|
||||||
* @return void
|
if(Context::get('_use_ssl') == 'optional')
|
||||||
**/
|
|
||||||
function member() {
|
|
||||||
if(!Context::isInstalled()) return;
|
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$member_config = $oModuleModel->getModuleConfig('member');
|
|
||||||
// Set to use SSL upon actions related member join/information/password and so on
|
|
||||||
if(Context::get('_use_ssl') == 'optional') {
|
|
||||||
Context::addSSLAction('dispMemberModifyPassword');
|
|
||||||
Context::addSSLAction('dispMemberSignUpForm');
|
|
||||||
Context::addSSLAction('dispMemberModifyInfo');
|
|
||||||
Context::addSSLAction('dispMemberModifyEmailAddress');
|
|
||||||
Context::addSSLAction('dispMemberGetTempPassword');
|
|
||||||
Context::addSSLAction('dispMemberResendAuthMail');
|
|
||||||
Context::addSSLAction('dispMemberLoginForm');
|
|
||||||
Context::addSSLAction('dispMemberFindAccount');
|
|
||||||
Context::addSSLAction('dispMemberLeave');
|
|
||||||
Context::addSSLAction('procMemberLogin');
|
|
||||||
Context::addSSLAction('procMemberModifyPassword');
|
|
||||||
Context::addSSLAction('procMemberInsert');
|
|
||||||
Context::addSSLAction('procMemberModifyInfo');
|
|
||||||
Context::addSSLAction('procMemberFindAccount');
|
|
||||||
Context::addSSLAction('procMemberModifyEmailAddress');
|
|
||||||
Context::addSSLAction('procMemberUpdateAuthMail');
|
|
||||||
Context::addSSLAction('procMemberResendAuthMail');
|
|
||||||
Context::addSSLAction('procMemberLeave');
|
|
||||||
//Context::addSSLAction('getMemberMenu');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement if additional tasks are necessary when installing
|
|
||||||
*
|
|
||||||
* @return Object
|
|
||||||
**/
|
|
||||||
function moduleInstall() {
|
|
||||||
// Register action forward (to use in administrator mode)
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
$oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true);
|
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$args = $oModuleModel->getModuleConfig('member');
|
|
||||||
|
|
||||||
$isNotInstall = empty($args);
|
|
||||||
|
|
||||||
// Set the basic information
|
|
||||||
$args->enable_join = 'Y';
|
|
||||||
$args->enable_openid = 'N';
|
|
||||||
if(!$args->enable_auth_mail) $args->enable_auth_mail = 'N';
|
|
||||||
if(!$args->image_name) $args->image_name = 'Y';
|
|
||||||
if(!$args->image_mark) $args->image_mark = 'Y';
|
|
||||||
if(!$args->profile_image) $args->profile_image = 'Y';
|
|
||||||
if(!$args->image_name_max_width) $args->image_name_max_width = '90';
|
|
||||||
if(!$args->image_name_max_height) $args->image_name_max_height = '20';
|
|
||||||
if(!$args->image_mark_max_width) $args->image_mark_max_width = '20';
|
|
||||||
if(!$args->image_mark_max_height) $args->image_mark_max_height = '20';
|
|
||||||
if(!$args->profile_image_max_width) $args->profile_image_max_width = '80';
|
|
||||||
if(!$args->profile_image_max_height) $args->profile_image_max_height = '80';
|
|
||||||
if($args->group_image_mark!='Y') $args->group_image_mark = 'N';
|
|
||||||
|
|
||||||
global $lang;
|
|
||||||
$oMemberModel = &getModel('member');
|
|
||||||
// Create a member controller object
|
|
||||||
$oMemberController = &getController('member');
|
|
||||||
$oMemberAdminController = &getAdminController('member');
|
|
||||||
|
|
||||||
if(!$args->signupForm || !is_array($args->signupForm))
|
|
||||||
{
|
|
||||||
$identifier = $isNotInstall ? 'email_address' : 'user_id';
|
|
||||||
|
|
||||||
$args->signupForm = $oMemberAdminController->createSignupForm($identifier);
|
|
||||||
$args->identifier = $identifier;
|
|
||||||
|
|
||||||
$oModuleController->insertModuleConfig('member',$args);
|
|
||||||
|
|
||||||
// Create Ruleset File
|
|
||||||
FileHandler::makeDir('./files/ruleset');
|
|
||||||
$oMemberAdminController->_createSignupRuleset($args->signupForm);
|
|
||||||
$oMemberAdminController->_createLoginRuleset($args->identifier);
|
|
||||||
$oMemberAdminController->_createFindAccountByQuestion($args->identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
$groups = $oMemberModel->getGroups();
|
|
||||||
if(!count($groups)) {
|
|
||||||
// Set an administrator, regular member(group1), and associate member(group2)
|
|
||||||
$group_args->title = Context::getLang('admin_group');
|
|
||||||
$group_args->is_default = 'N';
|
|
||||||
$group_args->is_admin = 'Y';
|
|
||||||
$output = $oMemberAdminController->insertGroup($group_args);
|
|
||||||
|
|
||||||
unset($group_args);
|
|
||||||
$group_args->title = Context::getLang('default_group_1');
|
|
||||||
$group_args->is_default = 'Y';
|
|
||||||
$group_args->is_admin = 'N';
|
|
||||||
$output = $oMemberAdminController->insertGroup($group_args);
|
|
||||||
|
|
||||||
unset($group_args);
|
|
||||||
$group_args->title = Context::getLang('default_group_2');
|
|
||||||
$group_args->is_default = 'N';
|
|
||||||
$group_args->is_admin = 'N';
|
|
||||||
$oMemberAdminController->insertGroup($group_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure administrator information
|
|
||||||
$admin_args->is_admin = 'Y';
|
|
||||||
$output = executeQuery('member.getMemberList', $admin_args);
|
|
||||||
if(!$output->data) {
|
|
||||||
$admin_info = Context::gets('password','nick_name','email_address');
|
|
||||||
if($admin_info->email_address) {
|
|
||||||
$admin_info->user_id = 'admin';
|
|
||||||
$admin_info->user_name = 'admin';
|
|
||||||
// Insert admin information
|
|
||||||
$oMemberAdminController->insertAdmin($admin_info);
|
|
||||||
// Log-in Processing
|
|
||||||
$output = $oMemberController->doLogin($admin_info->email_address);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Register denied ID(default + module name)
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$module_list = $oModuleModel->getModuleList();
|
|
||||||
foreach($module_list as $key => $val) {
|
|
||||||
$oMemberAdminController->insertDeniedID($val->module,'');
|
|
||||||
}
|
|
||||||
$oMemberAdminController->insertDeniedID('www','');
|
|
||||||
$oMemberAdminController->insertDeniedID('root','');
|
|
||||||
$oMemberAdminController->insertDeniedID('administrator','');
|
|
||||||
$oMemberAdminController->insertDeniedID('telnet','');
|
|
||||||
$oMemberAdminController->insertDeniedID('ftp','');
|
|
||||||
$oMemberAdminController->insertDeniedID('http','');
|
|
||||||
// Create cache directory to use in the member module
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/image_name');
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/image_mark');
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/profile_image');
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/signature');
|
|
||||||
|
|
||||||
return new Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* a method to check if successfully installed
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
**/
|
|
||||||
function checkUpdate() {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
// check member directory (11/08/2007 added)
|
|
||||||
if(!is_dir("./files/member_extra_info")) return true;
|
|
||||||
// check member directory (22/10/2007 added)
|
|
||||||
if(!is_dir("./files/member_extra_info/profile_image")) return true;
|
|
||||||
// Add a column(is_register) to "member_auth_mail" table (22/04/2008)
|
|
||||||
$act = $oDB->isColumnExists("member_auth_mail", "is_register");
|
|
||||||
if(!$act) return true;
|
|
||||||
// Add a column(site_srl) to "member_group_member" table (11/15/2008)
|
|
||||||
if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true;
|
|
||||||
if(!$oDB->isColumnExists("member_group", "site_srl")) return true;
|
|
||||||
if($oDB->isIndexExists("member_group","uni_member_group_title")) return true;
|
|
||||||
|
|
||||||
// Add a column for list_order (05/18/2011)
|
|
||||||
if(!$oDB->isColumnExists("member_group", "list_order")) return true;
|
|
||||||
|
|
||||||
// image_mark 추가 (2009. 02. 14)
|
|
||||||
if(!$oDB->isColumnExists("member_group", "image_mark")) return true;
|
|
||||||
// Add c column for password expiration date
|
|
||||||
if(!$oDB->isColumnExists("member", "change_password_date")) return true;
|
|
||||||
|
|
||||||
// Add columns of question and answer to verify a password
|
|
||||||
if(!$oDB->isColumnExists("member", "find_account_question")) return true;
|
|
||||||
if(!$oDB->isColumnExists("member", "find_account_answer")) return true;
|
|
||||||
|
|
||||||
if(!$oDB->isColumnExists("member", "list_order")) return true;
|
|
||||||
if(!$oDB->isIndexExists("member","idx_list_order")) return true;
|
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('member');
|
|
||||||
// check signup form ordering info
|
|
||||||
if (!$config->signupForm) return true;
|
|
||||||
|
|
||||||
// check agreement field exist
|
|
||||||
if ($config->agreement) return true;
|
|
||||||
|
|
||||||
if($config->skin)
|
|
||||||
{
|
|
||||||
$config_parse = explode('.', $config->skin);
|
|
||||||
if (count($config_parse) > 1)
|
|
||||||
{
|
|
||||||
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
|
|
||||||
if(is_dir($template_path)) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// supprot multilanguage agreement.
|
|
||||||
if (is_readable('./files/member_extra_info/agreement.txt')) return true;
|
|
||||||
|
|
||||||
if (!is_readable('./files/ruleset/insertMember.xml')) return true;
|
|
||||||
if (!is_readable('./files/ruleset/login.xml')) return true;
|
|
||||||
if (!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute update
|
|
||||||
*
|
|
||||||
* @return Object
|
|
||||||
**/
|
|
||||||
function moduleUpdate() {
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
// Check member directory
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/image_name');
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/image_mark');
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/signature');
|
|
||||||
FileHandler::makeDir('./files/member_extra_info/profile_image');
|
|
||||||
// Add a column
|
|
||||||
if (!$oDB->isColumnExists("member_auth_mail", "is_register")) {
|
|
||||||
$oDB->addColumn("member_auth_mail", "is_register", "char", 1, "N", true);
|
|
||||||
}
|
|
||||||
// Add a column(site_srl) to "member_group_member" table (11/15/2008)
|
|
||||||
if (!$oDB->isColumnExists("member_group_member", "site_srl")) {
|
|
||||||
$oDB->addColumn("member_group_member", "site_srl", "number", 11, 0, true);
|
|
||||||
$oDB->addIndex("member_group_member", "idx_site_srl", "site_srl", false);
|
|
||||||
}
|
|
||||||
if (!$oDB->isColumnExists("member_group", "site_srl")) {
|
|
||||||
$oDB->addColumn("member_group", "site_srl", "number", 11, 0, true);
|
|
||||||
$oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true);
|
|
||||||
}
|
|
||||||
if($oDB->isIndexExists("member_group","uni_member_group_title")) {
|
|
||||||
$oDB->dropIndex("member_group","uni_member_group_title",true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a column(list_order) to "member_group" table (05/18/2011)
|
|
||||||
if (!$oDB->isColumnExists("member_group", "list_order")) {
|
|
||||||
$oDB->addColumn("member_group", "list_order", "number", 11, '', true);
|
|
||||||
$oDB->addIndex("member_group","idx_list_order", "list_order",false);
|
|
||||||
$output = executeQuery('member.updateAllMemberGroupListOrder');
|
|
||||||
}
|
|
||||||
// Add a column for image_mark (02/14/2009)
|
|
||||||
if(!$oDB->isColumnExists("member_group", "image_mark")) {
|
|
||||||
$oDB->addColumn("member_group", "image_mark", "text");
|
|
||||||
}
|
|
||||||
// Add a column for password expiration date
|
|
||||||
if(!$oDB->isColumnExists("member", "change_password_date")) {
|
|
||||||
$oDB->addColumn("member", "change_password_date", "date");
|
|
||||||
executeQuery('member.updateAllChangePasswordDate');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add columns of question and answer to verify a password
|
|
||||||
if(!$oDB->isColumnExists("member", "find_account_question")) {
|
|
||||||
$oDB->addColumn("member", "find_account_question", "number", 11);
|
|
||||||
}
|
|
||||||
if(!$oDB->isColumnExists("member", "find_account_answer")) {
|
|
||||||
$oDB->addColumn("member", "find_account_answer", "varchar", 250);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$oDB->isColumnExists("member", "list_order")) {
|
|
||||||
$oDB->addColumn("member", "list_order", "number", 11);
|
|
||||||
set_time_limit(0);
|
|
||||||
$args->list_order = 'member_srl';
|
|
||||||
executeQuery('member.updateMemberListOrderAll',$args);
|
|
||||||
executeQuery('member.updateMemberListOrderAll');
|
|
||||||
}
|
|
||||||
if(!$oDB->isIndexExists("member","idx_list_order")) {
|
|
||||||
$oDB->addIndex("member","idx_list_order", array("list_order"));
|
|
||||||
}
|
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$config = $oModuleModel->getModuleConfig('member');
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
|
|
||||||
// check agreement value exist
|
|
||||||
if($config->agreement)
|
|
||||||
{
|
|
||||||
$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
|
|
||||||
$output = FileHandler::writeFile($agreement_file, $config->agreement);
|
|
||||||
|
|
||||||
$config->agreement = NULL;
|
|
||||||
$output = $oModuleController->updateModuleConfig('member', $config);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oMemberAdminController = &getAdminController('member');
|
|
||||||
// check signup form ordering info
|
|
||||||
if (!$config->signupForm || !is_array($config->signupForm)){
|
|
||||||
$identifier = 'user_id';
|
|
||||||
|
|
||||||
$config->signupForm = $oMemberAdminController->createSignupForm($identifier);
|
|
||||||
$config->identifier = $identifier;
|
|
||||||
unset($config->agreement);
|
|
||||||
$output = $oModuleController->updateModuleConfig('member', $config);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($config->skin)
|
|
||||||
{
|
|
||||||
$config_parse = explode('.', $config->skin);
|
|
||||||
if (count($config_parse) > 1)
|
|
||||||
{
|
|
||||||
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
|
|
||||||
if(is_dir($template_path))
|
|
||||||
{
|
|
||||||
$config->skin = implode('|@|', $config_parse);
|
|
||||||
$oModuleController = &getController('module');
|
|
||||||
$oModuleController->updateModuleConfig('member', $config);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_readable('./files/member_extra_info/agreement.txt'))
|
|
||||||
{
|
|
||||||
$source_file = _XE_PATH_.'files/member_extra_info/agreement.txt';
|
|
||||||
$target_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
|
|
||||||
|
|
||||||
FileHandler::rename($source_file, $target_file);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileHandler::makeDir('./files/ruleset');
|
|
||||||
if (!is_readable('./files/ruleset/insertMember.xml'))
|
|
||||||
$oMemberAdminController->_createSignupRuleset($config->signupForm);
|
|
||||||
if (!is_readable('./files/ruleset/login.xml'))
|
|
||||||
$oMemberAdminController->_createLoginRuleset($config->identifier);
|
|
||||||
if (!is_readable('./files/ruleset/find_member_account_by_question.xml'))
|
|
||||||
$oMemberAdminController->_createFindAccountByQuestion($config->identifier);
|
|
||||||
|
|
||||||
return new Object(0, 'success_updated');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Re-generate the cache file
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
**/
|
|
||||||
function recompileCache() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Record login error and return the error, about IPaddress.
|
|
||||||
**/
|
|
||||||
function recordLoginError($error = 0, $message = 'success')
|
|
||||||
{
|
{
|
||||||
if($error == 0) return new Object($error, $message);
|
Context::addSSLAction('dispMemberModifyPassword');
|
||||||
|
Context::addSSLAction('dispMemberSignUpForm');
|
||||||
// Create a member model object
|
Context::addSSLAction('dispMemberModifyInfo');
|
||||||
$oMemberModel = &getModel('member');
|
Context::addSSLAction('dispMemberModifyEmailAddress');
|
||||||
$config = $oMemberModel->getMemberConfig();
|
Context::addSSLAction('dispMemberGetTempPassword');
|
||||||
|
Context::addSSLAction('dispMemberResendAuthMail');
|
||||||
// Check if there is recoding table.
|
Context::addSSLAction('dispMemberLoginForm');
|
||||||
$oDB = &DB::getInstance();
|
Context::addSSLAction('dispMemberFindAccount');
|
||||||
if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new Object($error, $message);
|
Context::addSSLAction('dispMemberLeave');
|
||||||
|
Context::addSSLAction('procMemberLogin');
|
||||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
Context::addSSLAction('procMemberModifyPassword');
|
||||||
|
Context::addSSLAction('procMemberInsert');
|
||||||
$output = executeQuery('member.getLoginCountByIp', $args);
|
Context::addSSLAction('procMemberModifyInfo');
|
||||||
if($output->data && $output->data->count)
|
Context::addSSLAction('procMemberFindAccount');
|
||||||
{
|
Context::addSSLAction('procMemberModifyEmailAddress');
|
||||||
$last_update = strtotime($output->data->last_update);
|
Context::addSSLAction('procMemberUpdateAuthMail');
|
||||||
$term = intval(time()-$last_update);
|
Context::addSSLAction('procMemberResendAuthMail');
|
||||||
//update, if IP address access in a short time, update count. If not, make count 1.
|
Context::addSSLAction('procMemberLeave');
|
||||||
if($term < $config->max_error_count_time)
|
//Context::addSSLAction('getMemberMenu');
|
||||||
{
|
|
||||||
$args->count = $output->data->count + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$args->count = 1;
|
|
||||||
}
|
|
||||||
unset($oMemberModel);
|
|
||||||
unset($config);
|
|
||||||
$output = executeQuery('member.updateLoginCountByIp', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//insert
|
|
||||||
$args->count = 1;
|
|
||||||
$output = executeQuery('member.insertLoginCountByIp', $args);
|
|
||||||
}
|
|
||||||
return new Object($error, $message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Record login error and return the error, about MemberSrl.
|
|
||||||
**/
|
|
||||||
function recordMemberLoginError($error = 0, $message = 'success', $args = NULL)
|
|
||||||
{
|
|
||||||
if($error == 0 || !$args->member_srl) return new Object($error, $message);
|
|
||||||
|
|
||||||
// Create a member model object
|
|
||||||
$oMemberModel = &getModel('member');
|
|
||||||
$config = $oMemberModel->getMemberConfig();
|
|
||||||
|
|
||||||
// Check if there is recoding table.
|
|
||||||
$oDB = &DB::getInstance();
|
|
||||||
if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new Object($error, $message);
|
|
||||||
|
|
||||||
$output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args);
|
|
||||||
if($output->data && $output->data->content)
|
|
||||||
{
|
|
||||||
//update
|
|
||||||
$content = unserialize($output->data->content);
|
|
||||||
$content[] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),time());
|
|
||||||
$args->content = serialize($content);
|
|
||||||
$output = executeQuery('member.updateLoginCountHistoryByMemberSrl', $args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//insert
|
|
||||||
$content[0] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),time());
|
|
||||||
$args->content = serialize($content);
|
|
||||||
$output = executeQuery('member.insertLoginCountHistoryByMemberSrl', $args);
|
|
||||||
}
|
|
||||||
return $this->recordLoginError($error, $message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
/**
|
||||||
|
* Implement if additional tasks are necessary when installing
|
||||||
|
*
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
function moduleInstall()
|
||||||
|
{
|
||||||
|
// Register action forward (to use in administrator mode)
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
$oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true);
|
||||||
|
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$args = $oModuleModel->getModuleConfig('member');
|
||||||
|
|
||||||
|
$isNotInstall = empty($args);
|
||||||
|
|
||||||
|
// Set the basic information
|
||||||
|
$args->enable_join = 'Y';
|
||||||
|
$args->enable_openid = 'N';
|
||||||
|
if(!$args->enable_auth_mail) $args->enable_auth_mail = 'N';
|
||||||
|
if(!$args->image_name) $args->image_name = 'Y';
|
||||||
|
if(!$args->image_mark) $args->image_mark = 'Y';
|
||||||
|
if(!$args->profile_image) $args->profile_image = 'Y';
|
||||||
|
if(!$args->image_name_max_width) $args->image_name_max_width = '90';
|
||||||
|
if(!$args->image_name_max_height) $args->image_name_max_height = '20';
|
||||||
|
if(!$args->image_mark_max_width) $args->image_mark_max_width = '20';
|
||||||
|
if(!$args->image_mark_max_height) $args->image_mark_max_height = '20';
|
||||||
|
if(!$args->profile_image_max_width) $args->profile_image_max_width = '80';
|
||||||
|
if(!$args->profile_image_max_height) $args->profile_image_max_height = '80';
|
||||||
|
if($args->group_image_mark!='Y') $args->group_image_mark = 'N';
|
||||||
|
|
||||||
|
global $lang;
|
||||||
|
$oMemberModel = &getModel('member');
|
||||||
|
// Create a member controller object
|
||||||
|
$oMemberController = &getController('member');
|
||||||
|
$oMemberAdminController = &getAdminController('member');
|
||||||
|
|
||||||
|
if(!$args->signupForm || !is_array($args->signupForm))
|
||||||
|
{
|
||||||
|
$identifier = $isNotInstall ? 'email_address' : 'user_id';
|
||||||
|
|
||||||
|
$args->signupForm = $oMemberAdminController->createSignupForm($identifier);
|
||||||
|
$args->identifier = $identifier;
|
||||||
|
|
||||||
|
$oModuleController->insertModuleConfig('member',$args);
|
||||||
|
|
||||||
|
// Create Ruleset File
|
||||||
|
FileHandler::makeDir('./files/ruleset');
|
||||||
|
$oMemberAdminController->_createSignupRuleset($args->signupForm);
|
||||||
|
$oMemberAdminController->_createLoginRuleset($args->identifier);
|
||||||
|
$oMemberAdminController->_createFindAccountByQuestion($args->identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
$groups = $oMemberModel->getGroups();
|
||||||
|
if(!count($groups))
|
||||||
|
{
|
||||||
|
// Set an administrator, regular member(group1), and associate member(group2)
|
||||||
|
$group_args->title = Context::getLang('admin_group');
|
||||||
|
$group_args->is_default = 'N';
|
||||||
|
$group_args->is_admin = 'Y';
|
||||||
|
$output = $oMemberAdminController->insertGroup($group_args);
|
||||||
|
|
||||||
|
unset($group_args);
|
||||||
|
$group_args->title = Context::getLang('default_group_1');
|
||||||
|
$group_args->is_default = 'Y';
|
||||||
|
$group_args->is_admin = 'N';
|
||||||
|
$output = $oMemberAdminController->insertGroup($group_args);
|
||||||
|
|
||||||
|
unset($group_args);
|
||||||
|
$group_args->title = Context::getLang('default_group_2');
|
||||||
|
$group_args->is_default = 'N';
|
||||||
|
$group_args->is_admin = 'N';
|
||||||
|
$oMemberAdminController->insertGroup($group_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure administrator information
|
||||||
|
$admin_args->is_admin = 'Y';
|
||||||
|
$output = executeQuery('member.getMemberList', $admin_args);
|
||||||
|
if(!$output->data)
|
||||||
|
{
|
||||||
|
$admin_info = Context::gets('password','nick_name','email_address');
|
||||||
|
if($admin_info->email_address)
|
||||||
|
{
|
||||||
|
$admin_info->user_id = 'admin';
|
||||||
|
$admin_info->user_name = 'admin';
|
||||||
|
// Insert admin information
|
||||||
|
$oMemberAdminController->insertAdmin($admin_info);
|
||||||
|
// Log-in Processing
|
||||||
|
$output = $oMemberController->doLogin($admin_info->email_address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Register denied ID(default + module name)
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$module_list = $oModuleModel->getModuleList();
|
||||||
|
foreach($module_list as $key => $val)
|
||||||
|
{
|
||||||
|
$oMemberAdminController->insertDeniedID($val->module,'');
|
||||||
|
}
|
||||||
|
$oMemberAdminController->insertDeniedID('www','');
|
||||||
|
$oMemberAdminController->insertDeniedID('root','');
|
||||||
|
$oMemberAdminController->insertDeniedID('administrator','');
|
||||||
|
$oMemberAdminController->insertDeniedID('telnet','');
|
||||||
|
$oMemberAdminController->insertDeniedID('ftp','');
|
||||||
|
$oMemberAdminController->insertDeniedID('http','');
|
||||||
|
// Create cache directory to use in the member module
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/image_name');
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/image_mark');
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/profile_image');
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/signature');
|
||||||
|
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* a method to check if successfully installed
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function checkUpdate()
|
||||||
|
{
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
// check member directory (11/08/2007 added)
|
||||||
|
if(!is_dir("./files/member_extra_info")) return true;
|
||||||
|
// check member directory (22/10/2007 added)
|
||||||
|
if(!is_dir("./files/member_extra_info/profile_image")) return true;
|
||||||
|
// Add a column(is_register) to "member_auth_mail" table (22/04/2008)
|
||||||
|
$act = $oDB->isColumnExists("member_auth_mail", "is_register");
|
||||||
|
if(!$act) return true;
|
||||||
|
// Add a column(site_srl) to "member_group_member" table (11/15/2008)
|
||||||
|
if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true;
|
||||||
|
if(!$oDB->isColumnExists("member_group", "site_srl")) return true;
|
||||||
|
if($oDB->isIndexExists("member_group","uni_member_group_title")) return true;
|
||||||
|
|
||||||
|
// Add a column for list_order (05/18/2011)
|
||||||
|
if(!$oDB->isColumnExists("member_group", "list_order")) return true;
|
||||||
|
|
||||||
|
// image_mark 추가 (2009. 02. 14)
|
||||||
|
if(!$oDB->isColumnExists("member_group", "image_mark")) return true;
|
||||||
|
// Add c column for password expiration date
|
||||||
|
if(!$oDB->isColumnExists("member", "change_password_date")) return true;
|
||||||
|
|
||||||
|
// Add columns of question and answer to verify a password
|
||||||
|
if(!$oDB->isColumnExists("member", "find_account_question")) return true;
|
||||||
|
if(!$oDB->isColumnExists("member", "find_account_answer")) return true;
|
||||||
|
|
||||||
|
if(!$oDB->isColumnExists("member", "list_order")) return true;
|
||||||
|
if(!$oDB->isIndexExists("member","idx_list_order")) return true;
|
||||||
|
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$config = $oModuleModel->getModuleConfig('member');
|
||||||
|
// check signup form ordering info
|
||||||
|
if(!$config->signupForm) return true;
|
||||||
|
|
||||||
|
// check agreement field exist
|
||||||
|
if($config->agreement) return true;
|
||||||
|
|
||||||
|
if($config->skin)
|
||||||
|
{
|
||||||
|
$config_parse = explode('.', $config->skin);
|
||||||
|
if(count($config_parse) > 1)
|
||||||
|
{
|
||||||
|
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
|
||||||
|
if(is_dir($template_path)) return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// supprot multilanguage agreement.
|
||||||
|
if(is_readable('./files/member_extra_info/agreement.txt')) return true;
|
||||||
|
|
||||||
|
if(!is_readable('./files/ruleset/insertMember.xml')) return true;
|
||||||
|
if(!is_readable('./files/ruleset/login.xml')) return true;
|
||||||
|
if(!is_readable('./files/ruleset/find_member_account_by_question.xml')) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute update
|
||||||
|
*
|
||||||
|
* @return Object
|
||||||
|
*/
|
||||||
|
function moduleUpdate()
|
||||||
|
{
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
// Check member directory
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/image_name');
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/image_mark');
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/signature');
|
||||||
|
FileHandler::makeDir('./files/member_extra_info/profile_image');
|
||||||
|
// Add a column
|
||||||
|
if(!$oDB->isColumnExists("member_auth_mail", "is_register"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member_auth_mail", "is_register", "char", 1, "N", true);
|
||||||
|
}
|
||||||
|
// Add a column(site_srl) to "member_group_member" table (11/15/2008)
|
||||||
|
if(!$oDB->isColumnExists("member_group_member", "site_srl"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member_group_member", "site_srl", "number", 11, 0, true);
|
||||||
|
$oDB->addIndex("member_group_member", "idx_site_srl", "site_srl", false);
|
||||||
|
}
|
||||||
|
if(!$oDB->isColumnExists("member_group", "site_srl"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member_group", "site_srl", "number", 11, 0, true);
|
||||||
|
$oDB->addIndex("member_group","idx_site_title", array("site_srl","title"),true);
|
||||||
|
}
|
||||||
|
if($oDB->isIndexExists("member_group","uni_member_group_title"))
|
||||||
|
{
|
||||||
|
$oDB->dropIndex("member_group","uni_member_group_title",true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add a column(list_order) to "member_group" table (05/18/2011)
|
||||||
|
if(!$oDB->isColumnExists("member_group", "list_order"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member_group", "list_order", "number", 11, '', true);
|
||||||
|
$oDB->addIndex("member_group","idx_list_order", "list_order",false);
|
||||||
|
$output = executeQuery('member.updateAllMemberGroupListOrder');
|
||||||
|
}
|
||||||
|
// Add a column for image_mark (02/14/2009)
|
||||||
|
if(!$oDB->isColumnExists("member_group", "image_mark"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member_group", "image_mark", "text");
|
||||||
|
}
|
||||||
|
// Add a column for password expiration date
|
||||||
|
if(!$oDB->isColumnExists("member", "change_password_date"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member", "change_password_date", "date");
|
||||||
|
executeQuery('member.updateAllChangePasswordDate');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add columns of question and answer to verify a password
|
||||||
|
if(!$oDB->isColumnExists("member", "find_account_question"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member", "find_account_question", "number", 11);
|
||||||
|
}
|
||||||
|
if(!$oDB->isColumnExists("member", "find_account_answer"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member", "find_account_answer", "varchar", 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$oDB->isColumnExists("member", "list_order"))
|
||||||
|
{
|
||||||
|
$oDB->addColumn("member", "list_order", "number", 11);
|
||||||
|
set_time_limit(0);
|
||||||
|
$args->list_order = 'member_srl';
|
||||||
|
executeQuery('member.updateMemberListOrderAll',$args);
|
||||||
|
executeQuery('member.updateMemberListOrderAll');
|
||||||
|
}
|
||||||
|
if(!$oDB->isIndexExists("member","idx_list_order"))
|
||||||
|
{
|
||||||
|
$oDB->addIndex("member","idx_list_order", array("list_order"));
|
||||||
|
}
|
||||||
|
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$config = $oModuleModel->getModuleConfig('member');
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
|
// check agreement value exist
|
||||||
|
if($config->agreement)
|
||||||
|
{
|
||||||
|
$agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
|
||||||
|
$output = FileHandler::writeFile($agreement_file, $config->agreement);
|
||||||
|
|
||||||
|
$config->agreement = NULL;
|
||||||
|
$output = $oModuleController->updateModuleConfig('member', $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
$oMemberAdminController = &getAdminController('member');
|
||||||
|
// check signup form ordering info
|
||||||
|
if(!$config->signupForm || !is_array($config->signupForm))
|
||||||
|
{
|
||||||
|
$identifier = 'user_id';
|
||||||
|
|
||||||
|
$config->signupForm = $oMemberAdminController->createSignupForm($identifier);
|
||||||
|
$config->identifier = $identifier;
|
||||||
|
unset($config->agreement);
|
||||||
|
$output = $oModuleController->updateModuleConfig('member', $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($config->skin)
|
||||||
|
{
|
||||||
|
$config_parse = explode('.', $config->skin);
|
||||||
|
if (count($config_parse) > 1)
|
||||||
|
{
|
||||||
|
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
|
||||||
|
if(is_dir($template_path))
|
||||||
|
{
|
||||||
|
$config->skin = implode('|@|', $config_parse);
|
||||||
|
$oModuleController = &getController('module');
|
||||||
|
$oModuleController->updateModuleConfig('member', $config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_readable('./files/member_extra_info/agreement.txt'))
|
||||||
|
{
|
||||||
|
$source_file = _XE_PATH_.'files/member_extra_info/agreement.txt';
|
||||||
|
$target_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt';
|
||||||
|
|
||||||
|
FileHandler::rename($source_file, $target_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
FileHandler::makeDir('./files/ruleset');
|
||||||
|
if(!is_readable('./files/ruleset/insertMember.xml'))
|
||||||
|
$oMemberAdminController->_createSignupRuleset($config->signupForm);
|
||||||
|
if(!is_readable('./files/ruleset/login.xml'))
|
||||||
|
$oMemberAdminController->_createLoginRuleset($config->identifier);
|
||||||
|
if(!is_readable('./files/ruleset/find_member_account_by_question.xml'))
|
||||||
|
$oMemberAdminController->_createFindAccountByQuestion($config->identifier);
|
||||||
|
|
||||||
|
return new Object(0, 'success_updated');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-generate the cache file
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function recompileCache()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Record login error and return the error, about IPaddress.
|
||||||
|
*/
|
||||||
|
function recordLoginError($error = 0, $message = 'success')
|
||||||
|
{
|
||||||
|
if($error == 0) return new Object($error, $message);
|
||||||
|
|
||||||
|
// Create a member model object
|
||||||
|
$oMemberModel = &getModel('member');
|
||||||
|
$config = $oMemberModel->getMemberConfig();
|
||||||
|
|
||||||
|
// Check if there is recoding table.
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
if(!$oDB->isTableExists('member_login_count') || $config->enable_login_fail_report == 'N') return new Object($error, $message);
|
||||||
|
|
||||||
|
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
|
$output = executeQuery('member.getLoginCountByIp', $args);
|
||||||
|
if($output->data && $output->data->count)
|
||||||
|
{
|
||||||
|
$last_update = strtotime($output->data->last_update);
|
||||||
|
$term = intval(time()-$last_update);
|
||||||
|
//update, if IP address access in a short time, update count. If not, make count 1.
|
||||||
|
if($term < $config->max_error_count_time)
|
||||||
|
{
|
||||||
|
$args->count = $output->data->count + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$args->count = 1;
|
||||||
|
}
|
||||||
|
unset($oMemberModel);
|
||||||
|
unset($config);
|
||||||
|
$output = executeQuery('member.updateLoginCountByIp', $args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//insert
|
||||||
|
$args->count = 1;
|
||||||
|
$output = executeQuery('member.insertLoginCountByIp', $args);
|
||||||
|
}
|
||||||
|
return new Object($error, $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Record login error and return the error, about MemberSrl.
|
||||||
|
*/
|
||||||
|
function recordMemberLoginError($error = 0, $message = 'success', $args = NULL)
|
||||||
|
{
|
||||||
|
if($error == 0 || !$args->member_srl) return new Object($error, $message);
|
||||||
|
|
||||||
|
// Create a member model object
|
||||||
|
$oMemberModel = &getModel('member');
|
||||||
|
$config = $oMemberModel->getMemberConfig();
|
||||||
|
|
||||||
|
// Check if there is recoding table.
|
||||||
|
$oDB = &DB::getInstance();
|
||||||
|
if(!$oDB->isTableExists('member_count_history') || $config->enable_login_fail_report == 'N') return new Object($error, $message);
|
||||||
|
|
||||||
|
$output = executeQuery('member.getLoginCountHistoryByMemberSrl', $args);
|
||||||
|
if($output->data && $output->data->content)
|
||||||
|
{
|
||||||
|
//update
|
||||||
|
$content = unserialize($output->data->content);
|
||||||
|
$content[] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),time());
|
||||||
|
$args->content = serialize($content);
|
||||||
|
$output = executeQuery('member.updateLoginCountHistoryByMemberSrl', $args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//insert
|
||||||
|
$content[0] = array($_SERVER['REMOTE_ADDR'],Context::getLang($message),time());
|
||||||
|
$args->content = serialize($content);
|
||||||
|
$output = executeQuery('member.insertLoginCountHistoryByMemberSrl', $args);
|
||||||
|
}
|
||||||
|
return $this->recordLoginError($error, $message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* End of file member.class.php */
|
||||||
|
/* Location: ./modules/member/member.class.php */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -8,7 +8,7 @@ class memberMobile extends memberView
|
||||||
*/
|
*/
|
||||||
var $memberInfo;
|
var $memberInfo;
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
// Get the member configuration
|
// Get the member configuration
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
|
|
@ -29,7 +29,7 @@ class memberMobile extends memberView
|
||||||
|
|
||||||
// if member_srl exists, set memberInfo
|
// if member_srl exists, set memberInfo
|
||||||
$member_srl = Context::get('member_srl');
|
$member_srl = Context::get('member_srl');
|
||||||
if($member_srl)
|
if($member_srl)
|
||||||
{
|
{
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
|
$this->memberInfo = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
|
||||||
|
|
@ -43,7 +43,7 @@ class memberMobile extends memberView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setTemplatePath($template_path);
|
$this->setTemplatePath($template_path);
|
||||||
|
|
||||||
$oLayoutModel = &getModel('layout');
|
$oLayoutModel = &getModel('layout');
|
||||||
$layout_info = $oLayoutModel->getLayout($this->member_config->mlayout_srl);
|
$layout_info = $oLayoutModel->getLayout($this->member_config->mlayout_srl);
|
||||||
|
|
@ -57,11 +57,12 @@ class memberMobile extends memberView
|
||||||
function dispMemberModifyInfo()
|
function dispMemberModifyInfo()
|
||||||
{
|
{
|
||||||
parent::dispMemberModifyInfo();
|
parent::dispMemberModifyInfo();
|
||||||
|
|
||||||
if($this->member_info)
|
if($this->member_info)
|
||||||
{
|
{
|
||||||
Context::set('oMemberInfo', get_object_vars($this->member_info));
|
Context::set('oMemberInfo', get_object_vars($this->member_info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file member.mobile.php */
|
||||||
|
/* Location: ./modules/member/member.mobile.php */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue