mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
issue 2662 module
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12254 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
59b001578f
commit
d456ea02e0
8 changed files with 5394 additions and 4967 deletions
|
|
@ -1,22 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class moduleAdminController
|
* @class moduleAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief admin controller class of the module module
|
* @brief admin controller class of the module module
|
||||||
**/
|
*/
|
||||||
|
class moduleAdminController extends module
|
||||||
class moduleAdminController extends module {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add the module category
|
* @brief Add the module category
|
||||||
**/
|
*/
|
||||||
function procModuleAdminInsertCategory() {
|
function procModuleAdminInsertCategory()
|
||||||
|
{
|
||||||
$args->title = Context::get('title');
|
$args->title = Context::get('title');
|
||||||
$output = executeQuery('module.insertModuleCategory', $args);
|
$output = executeQuery('module.insertModuleCategory', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
@ -29,8 +30,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update category
|
* @brief Update category
|
||||||
**/
|
*/
|
||||||
function procModuleAdminUpdateCategory() {
|
function procModuleAdminUpdateCategory()
|
||||||
|
{
|
||||||
$output = $this->doUpdateModuleCategory();
|
$output = $this->doUpdateModuleCategory();
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
|
@ -42,8 +44,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete category
|
* @brief Delete category
|
||||||
**/
|
*/
|
||||||
function procModuleAdminDeleteCategory() {
|
function procModuleAdminDeleteCategory()
|
||||||
|
{
|
||||||
$output = $this->doDeleteModuleCategory();
|
$output = $this->doDeleteModuleCategory();
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
|
@ -55,8 +58,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Change the title of the module category
|
* @brief Change the title of the module category
|
||||||
**/
|
*/
|
||||||
function doUpdateModuleCategory() {
|
function doUpdateModuleCategory()
|
||||||
|
{
|
||||||
$args->title = Context::get('title');
|
$args->title = Context::get('title');
|
||||||
$args->module_category_srl = Context::get('module_category_srl');
|
$args->module_category_srl = Context::get('module_category_srl');
|
||||||
return executeQuery('module.updateModuleCategory', $args);
|
return executeQuery('module.updateModuleCategory', $args);
|
||||||
|
|
@ -64,15 +68,16 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete the module category
|
* @brief Delete the module category
|
||||||
**/
|
*/
|
||||||
function doDeleteModuleCategory() {
|
function doDeleteModuleCategory()
|
||||||
|
{
|
||||||
$args->module_category_srl = Context::get('module_category_srl');
|
$args->module_category_srl = Context::get('module_category_srl');
|
||||||
return executeQuery('module.deleteModuleCategory', $args);
|
return executeQuery('module.deleteModuleCategory', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Copy Module
|
* @brief Copy Module
|
||||||
**/
|
*/
|
||||||
function procModuleAdminCopyModule($args = NULL)
|
function procModuleAdminCopyModule($args = NULL)
|
||||||
{
|
{
|
||||||
$isProc = false;
|
$isProc = false;
|
||||||
|
|
@ -92,7 +97,8 @@
|
||||||
|
|
||||||
// Get module name to create and browser title
|
// Get module name to create and browser title
|
||||||
$clones = array();
|
$clones = array();
|
||||||
for($i=1;$i<=10;$i++) {
|
for($i=1;$i<=10;$i++)
|
||||||
|
{
|
||||||
$mid = trim($args->{"mid_".$i});
|
$mid = trim($args->{"mid_".$i});
|
||||||
if(!$mid) continue;
|
if(!$mid) continue;
|
||||||
if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
|
if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid');
|
||||||
|
|
@ -112,15 +118,18 @@
|
||||||
$module_args->module_srl = $module_srl;
|
$module_args->module_srl = $module_srl;
|
||||||
$output = executeQueryArray('module.getModuleGrants', $module_args);
|
$output = executeQueryArray('module.getModuleGrants', $module_args);
|
||||||
$grant = array();
|
$grant = array();
|
||||||
if($output->data) {
|
if($output->data)
|
||||||
|
{
|
||||||
foreach($output->data as $key => $val) $grant[$val->name][] = $val->group_srl;
|
foreach($output->data as $key => $val) $grant[$val->name][] = $val->group_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get Extra Vars
|
// get Extra Vars
|
||||||
$extra_args->module_srl = $module_srl;
|
$extra_args->module_srl = $module_srl;
|
||||||
$extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args);
|
$extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args);
|
||||||
if ($extra_output->toBool() && is_array($extra_output->data)){
|
if($extra_output->toBool() && is_array($extra_output->data))
|
||||||
foreach($extra_output->data as $info){
|
{
|
||||||
|
foreach($extra_output->data as $info)
|
||||||
|
{
|
||||||
$extra_vars->{$info->name} = $info->value;
|
$extra_vars->{$info->name} = $info->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -194,7 +203,7 @@
|
||||||
|
|
||||||
// Grant module permissions
|
// Grant module permissions
|
||||||
if(count($grant)) $oModuleController->insertModuleGrants($module_srl, $grant);
|
if(count($grant)) $oModuleController->insertModuleGrants($module_srl, $grant);
|
||||||
if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
|
if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
|
||||||
|
|
||||||
if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
|
if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
|
||||||
if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
|
if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
|
||||||
|
|
@ -219,7 +228,8 @@
|
||||||
|
|
||||||
if($isProc)
|
if($isProc)
|
||||||
{
|
{
|
||||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||||
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
htmlHeader();
|
htmlHeader();
|
||||||
alertScript($message);
|
alertScript($message);
|
||||||
|
|
@ -236,8 +246,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save the module permissions
|
* @brief Save the module permissions
|
||||||
**/
|
*/
|
||||||
function procModuleAdminInsertGrant() {
|
function procModuleAdminInsertGrant()
|
||||||
|
{
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
// Get module_srl
|
// Get module_srl
|
||||||
|
|
@ -249,13 +260,14 @@
|
||||||
// Register Admin ID
|
// Register Admin ID
|
||||||
$oModuleController->deleteAdminId($module_srl);
|
$oModuleController->deleteAdminId($module_srl);
|
||||||
$admin_member = Context::get('admin_member');
|
$admin_member = Context::get('admin_member');
|
||||||
if($admin_member) {
|
if($admin_member)
|
||||||
|
{
|
||||||
$admin_members = explode(',',$admin_member);
|
$admin_members = explode(',',$admin_member);
|
||||||
for($i=0;$i<count($admin_members);$i++) {
|
for($i=0;$i<count($admin_members);$i++)
|
||||||
|
{
|
||||||
$admin_id = trim($admin_members[$i]);
|
$admin_id = trim($admin_members[$i]);
|
||||||
if(!$admin_id) continue;
|
if(!$admin_id) continue;
|
||||||
$oModuleController->insertAdminId($module_srl, $admin_id);
|
$oModuleController->insertAdminId($module_srl, $admin_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// List permissions
|
// List permissions
|
||||||
|
|
@ -266,17 +278,22 @@
|
||||||
$grant_list->access->default = 'guest';
|
$grant_list->access->default = 'guest';
|
||||||
$grant_list->manager->default = 'manager';
|
$grant_list->manager->default = 'manager';
|
||||||
|
|
||||||
foreach($grant_list as $grant_name => $grant_info) {
|
foreach($grant_list as $grant_name => $grant_info)
|
||||||
|
{
|
||||||
// Get the default value
|
// Get the default value
|
||||||
$default = Context::get($grant_name.'_default');
|
$default = Context::get($grant_name.'_default');
|
||||||
// -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users
|
// -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users
|
||||||
if(strlen($default)){
|
if(strlen($default))
|
||||||
|
{
|
||||||
$grant->{$grant_name}[] = $default;
|
$grant->{$grant_name}[] = $default;
|
||||||
continue;
|
continue;
|
||||||
// users in a particular group
|
// users in a particular group
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$group_srls = Context::get($grant_name);
|
$group_srls = Context::get($grant_name);
|
||||||
if($group_srls) {
|
if($group_srls)
|
||||||
|
{
|
||||||
if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
|
if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
|
||||||
elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
|
elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
|
||||||
else $group_srls = array($group_srls);
|
else $group_srls = array($group_srls);
|
||||||
|
|
@ -292,9 +309,12 @@
|
||||||
$output = executeQuery('module.deleteModuleGrants', $args);
|
$output = executeQuery('module.deleteModuleGrants', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
// Permissions stored in the DB
|
// Permissions stored in the DB
|
||||||
if ($grant){
|
if($grant)
|
||||||
foreach($grant as $grant_name => $group_srls) {
|
{
|
||||||
foreach($group_srls as $key => $val) {
|
foreach($grant as $grant_name => $group_srls)
|
||||||
|
{
|
||||||
|
foreach($group_srls as $key => $val)
|
||||||
|
{
|
||||||
$args = null;
|
$args = null;
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->name = $grant_name;
|
$args->name = $grant_name;
|
||||||
|
|
@ -309,8 +329,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Updating Skins
|
* @brief Updating Skins
|
||||||
**/
|
*/
|
||||||
function procModuleAdminUpdateSkinInfo() {
|
function procModuleAdminUpdateSkinInfo()
|
||||||
|
{
|
||||||
// Get information of the module_srl
|
// Get information of the module_srl
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
$mode = Context::get('_mode');
|
$mode = Context::get('_mode');
|
||||||
|
|
@ -364,22 +385,26 @@
|
||||||
// Get a variable to delete
|
// Get a variable to delete
|
||||||
$del_var = $obj->{"del_".$vars->name};
|
$del_var = $obj->{"del_".$vars->name};
|
||||||
unset($obj->{"del_".$vars->name});
|
unset($obj->{"del_".$vars->name});
|
||||||
if($del_var == 'Y') {
|
if($del_var == 'Y')
|
||||||
|
{
|
||||||
FileHandler::removeFile($skin_vars[$vars->name]->value);
|
FileHandler::removeFile($skin_vars[$vars->name]->value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Use the previous data if not uploaded
|
// Use the previous data if not uploaded
|
||||||
if(!$image_obj['tmp_name']) {
|
if(!$image_obj['tmp_name'])
|
||||||
|
{
|
||||||
$obj->{$vars->name} = $skin_vars[$vars->name]->value;
|
$obj->{$vars->name} = $skin_vars[$vars->name]->value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Ignore if the file is not successfully uploaded
|
// Ignore if the file is not successfully uploaded
|
||||||
if(!is_uploaded_file($image_obj['tmp_name'])) {
|
if(!is_uploaded_file($image_obj['tmp_name']))
|
||||||
|
{
|
||||||
unset($obj->{$vars->name});
|
unset($obj->{$vars->name});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Ignore if the file is not an image
|
// Ignore if the file is not an image
|
||||||
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
|
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
|
||||||
|
{
|
||||||
unset($obj->{$vars->name});
|
unset($obj->{$vars->name});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -390,7 +415,8 @@
|
||||||
|
|
||||||
$filename = $path.$image_obj['name'];
|
$filename = $path.$image_obj['name'];
|
||||||
// Move the file
|
// Move the file
|
||||||
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
|
if(!move_uploaded_file($image_obj['tmp_name'], $filename))
|
||||||
|
{
|
||||||
unset($obj->{$vars->name});
|
unset($obj->{$vars->name});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -425,7 +451,6 @@
|
||||||
{
|
{
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_saved');
|
$this->setMessage('success_saved');
|
||||||
|
|
@ -434,8 +459,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List module information
|
* @brief List module information
|
||||||
**/
|
*/
|
||||||
function procModuleAdminModuleSetup() {
|
function procModuleAdminModuleSetup()
|
||||||
|
{
|
||||||
$vars = Context::getRequestVars();
|
$vars = Context::getRequestVars();
|
||||||
|
|
||||||
if(!$vars->module_srls) return new Object(-1,'msg_invalid_request');
|
if(!$vars->module_srls) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
@ -456,7 +482,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($module_srls as $module_srl) {
|
foreach($module_srls as $module_srl)
|
||||||
|
{
|
||||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
|
||||||
|
|
||||||
foreach($updateList as $val)
|
foreach($updateList as $val)
|
||||||
|
|
@ -467,10 +494,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setMessage('success_registed');
|
$this->setMessage('success_registed');
|
||||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||||
if (Context::get('success_return_url')) {
|
{
|
||||||
|
if(Context::get('success_return_url'))
|
||||||
|
{
|
||||||
$this->setRedirectUrl(Context::get('success_return_url'));
|
$this->setRedirectUrl(Context::get('success_return_url'));
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
htmlHeader();
|
htmlHeader();
|
||||||
alertScript($lang->success_registed);
|
alertScript($lang->success_registed);
|
||||||
|
|
@ -484,8 +515,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief List permissions of the module
|
* @brief List permissions of the module
|
||||||
**/
|
*/
|
||||||
function procModuleAdminModuleGrantSetup() {
|
function procModuleAdminModuleGrantSetup()
|
||||||
|
{
|
||||||
$module_srls = Context::get('module_srls');
|
$module_srls = Context::get('module_srls');
|
||||||
if(!$module_srls) return new Object(-1,'msg_invalid_request');
|
if(!$module_srls) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
||||||
|
|
@ -503,17 +535,22 @@
|
||||||
$grant_list->access->default = 'guest';
|
$grant_list->access->default = 'guest';
|
||||||
$grant_list->manager->default = 'manager';
|
$grant_list->manager->default = 'manager';
|
||||||
|
|
||||||
foreach($grant_list as $grant_name => $grant_info) {
|
foreach($grant_list as $grant_name => $grant_info)
|
||||||
|
{
|
||||||
// Get the default value
|
// Get the default value
|
||||||
$default = Context::get($grant_name.'_default');
|
$default = Context::get($grant_name.'_default');
|
||||||
// -1 = Sign only, 0 = all users
|
// -1 = Sign only, 0 = all users
|
||||||
if(strlen($default)){
|
if(strlen($default))
|
||||||
|
{
|
||||||
$grant->{$grant_name}[] = $default;
|
$grant->{$grant_name}[] = $default;
|
||||||
continue;
|
continue;
|
||||||
// Users in a particular group
|
// Users in a particular group
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$group_srls = Context::get($grant_name);
|
$group_srls = Context::get($grant_name);
|
||||||
if($group_srls) {
|
if($group_srls)
|
||||||
|
{
|
||||||
if(!is_array($group_srls))
|
if(!is_array($group_srls))
|
||||||
{
|
{
|
||||||
if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
|
if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
|
||||||
|
|
@ -527,16 +564,18 @@
|
||||||
$grant->{$group_srls} = array();
|
$grant->{$group_srls} = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Stored in the DB
|
// Stored in the DB
|
||||||
foreach($modules as $module_srl) {
|
foreach($modules as $module_srl)
|
||||||
|
{
|
||||||
$args = null;
|
$args = null;
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$output = executeQuery('module.deleteModuleGrants', $args);
|
$output = executeQuery('module.deleteModuleGrants', $args);
|
||||||
if(!$output->toBool()) continue;
|
if(!$output->toBool()) continue;
|
||||||
// Permissions stored in the DB
|
// Permissions stored in the DB
|
||||||
foreach($grant as $grant_name => $group_srls) {
|
foreach($grant as $grant_name => $group_srls)
|
||||||
foreach($group_srls as $key => $val) {
|
{
|
||||||
|
foreach($group_srls as $key => $val)
|
||||||
|
{
|
||||||
$args = null;
|
$args = null;
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->name = $grant_name;
|
$args->name = $grant_name;
|
||||||
|
|
@ -547,10 +586,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->setMessage('success_registed');
|
$this->setMessage('success_registed');
|
||||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
|
||||||
if (Context::get('success_return_url')) {
|
{
|
||||||
|
if(Context::get('success_return_url'))
|
||||||
|
{
|
||||||
$this->setRedirectUrl(Context::get('success_return_url'));
|
$this->setRedirectUrl(Context::get('success_return_url'));
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
htmlHeader();
|
htmlHeader();
|
||||||
alertScript($lang->success_registed);
|
alertScript($lang->success_registed);
|
||||||
|
|
@ -564,8 +607,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add/Update language
|
* @brief Add/Update language
|
||||||
**/
|
*/
|
||||||
function procModuleAdminInsertLang() {
|
function procModuleAdminInsertLang()
|
||||||
|
{
|
||||||
// Get language code
|
// Get language code
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$target = Context::get('target');
|
$target = Context::get('target');
|
||||||
|
|
@ -587,12 +631,13 @@
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
// Enter
|
// Enter
|
||||||
$lang_supported = Context::get('lang_supported');
|
$lang_supported = Context::get('lang_supported');
|
||||||
foreach($lang_supported as $key => $val) {
|
foreach($lang_supported as $key => $val)
|
||||||
|
{
|
||||||
$args->lang_code = $key;
|
$args->lang_code = $key;
|
||||||
$args->value = trim(Context::get($key));
|
$args->value = trim(Context::get($key));
|
||||||
|
|
||||||
// if request method is json, strip slashes
|
// if request method is json, strip slashes
|
||||||
if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc())
|
if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc())
|
||||||
{
|
{
|
||||||
$args->value = stripslashes($args->value);
|
$args->value = stripslashes($args->value);
|
||||||
}
|
}
|
||||||
|
|
@ -614,8 +659,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove language
|
* @brief Remove language
|
||||||
**/
|
*/
|
||||||
function procModuleAdminDeleteLang() {
|
function procModuleAdminDeleteLang()
|
||||||
|
{
|
||||||
// Get language code
|
// Get language code
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$args->site_srl = (int)$site_module_info->site_srl;
|
$args->site_srl = (int)$site_module_info->site_srl;
|
||||||
|
|
@ -663,8 +709,10 @@
|
||||||
// Get a list of modules at the site
|
// Get a list of modules at the site
|
||||||
$output = executeQueryArray('module.getSiteModules', $args);
|
$output = executeQueryArray('module.getSiteModules', $args);
|
||||||
$mid_list = array();
|
$mid_list = array();
|
||||||
if(count($output->data)) {
|
if(count($output->data))
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
$module = trim($val->module);
|
$module = trim($val->module);
|
||||||
if(!$module) continue;
|
if(!$module) continue;
|
||||||
|
|
||||||
|
|
@ -698,8 +746,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$selected_module = Context::get('selected_module');
|
$selected_module = Context::get('selected_module');
|
||||||
if(count($mid_list)) {
|
if(count($mid_list))
|
||||||
foreach($mid_list as $module => $val) {
|
{
|
||||||
|
foreach($mid_list as $module => $val)
|
||||||
|
{
|
||||||
if(!$selected_module) $selected_module = $module;
|
if(!$selected_module) $selected_module = $module;
|
||||||
$xml_info = $oModuleModel->getModuleInfoXml($module);
|
$xml_info = $oModuleModel->getModuleInfoXml($module);
|
||||||
|
|
||||||
|
|
@ -741,13 +791,17 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save the file of user-defined language code
|
* @brief Save the file of user-defined language code
|
||||||
**/
|
*/
|
||||||
function makeCacheDefinedLangCode($site_srl = 0) {
|
function makeCacheDefinedLangCode($site_srl = 0)
|
||||||
|
{
|
||||||
// Get the language file of the current site
|
// Get the language file of the current site
|
||||||
if(!$site_srl) {
|
if(!$site_srl)
|
||||||
|
{
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$args->site_srl = (int)$site_module_info->site_srl;
|
$args->site_srl = (int)$site_module_info->site_srl;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
}
|
}
|
||||||
$output = executeQueryArray('module.getLang', $args);
|
$output = executeQueryArray('module.getLang', $args);
|
||||||
|
|
@ -757,7 +811,8 @@
|
||||||
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
|
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);
|
||||||
|
|
||||||
$langMap = array();
|
$langMap = array();
|
||||||
foreach($output->data as $key => $val) {
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
$langMap[$val->lang_code][$val->name] = $val->value;
|
$langMap[$val->lang_code][$val->name] = $val->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -770,7 +825,8 @@
|
||||||
$langMap[$defaultLang] = array();
|
$langMap[$defaultLang] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($lang_supported as $langCode => $langName) {
|
foreach($lang_supported as $langCode => $langName)
|
||||||
|
{
|
||||||
if(!is_array($langMap[$langCode]))
|
if(!is_array($langMap[$langCode]))
|
||||||
{
|
{
|
||||||
$langMap[$langCode] = array();
|
$langMap[$langCode] = array();
|
||||||
|
|
@ -913,6 +969,6 @@
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
/* End of file module.admin.controller.php */
|
||||||
?>
|
/* Location: ./modules/module/module.admin.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,40 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class moduleAdminModel
|
* @class moduleAdminModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @brief AdminModel class of the "module" module
|
* @brief AdminModel class of the "module" module
|
||||||
**/
|
*/
|
||||||
|
class moduleAdminModel extends module
|
||||||
class moduleAdminModel extends module {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return a list of target modules by using module_srls separated by comma(,)
|
* @brief Return a list of target modules by using module_srls separated by comma(,)
|
||||||
* Used in the ModuleSelector
|
* Used in the ModuleSelector
|
||||||
**/
|
*/
|
||||||
function getModuleAdminModuleList() {
|
function getModuleAdminModuleList()
|
||||||
|
{
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$args->module_srls = Context::get('module_srls');
|
$args->module_srls = Context::get('module_srls');
|
||||||
$output = executeQueryArray('module.getModulesInfo', $args);
|
$output = executeQueryArray('module.getModulesInfo', $args);
|
||||||
if(!$output->toBool() || !$output->data) return new Object();
|
if(!$output->toBool() || !$output->data) return new Object();
|
||||||
|
|
||||||
foreach($output->data as $key => $val) {
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
$info_xml = $oModuleModel->getModuleInfoXml($val->module);
|
$info_xml = $oModuleModel->getModuleInfoXml($val->module);
|
||||||
$oModuleController->replaceDefinedLangCode($val->browser_title);
|
$oModuleController->replaceDefinedLangCode($val->browser_title);
|
||||||
$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
|
$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
|
||||||
}
|
}
|
||||||
$modules = explode(',',$args->module_srls);
|
$modules = explode(',',$args->module_srls);
|
||||||
for($i=0;$i<count($modules);$i++) {
|
for($i=0;$i<count($modules);$i++)
|
||||||
|
{
|
||||||
$module_list[$modules[$i]] = $list[$modules[$i]];
|
$module_list[$modules[$i]] = $list[$modules[$i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,7 +42,8 @@
|
||||||
$this->add('module_list', $module_list);
|
$this->add('module_list', $module_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getModuleMidList($args){
|
function getModuleMidList($args)
|
||||||
|
{
|
||||||
$args->list_count = 20;
|
$args->list_count = 20;
|
||||||
$args->page_count = 10;
|
$args->page_count = 10;
|
||||||
$output = executeQueryArray('module.getModuleMidList', $args);
|
$output = executeQueryArray('module.getModuleMidList', $args);
|
||||||
|
|
@ -57,7 +61,8 @@
|
||||||
$grantList->access->default = 'guest';
|
$grantList->access->default = 'guest';
|
||||||
if(count($grantList))
|
if(count($grantList))
|
||||||
{
|
{
|
||||||
foreach($grantList as $key => $val) {
|
foreach($grantList as $key => $val)
|
||||||
|
{
|
||||||
if(!$val->default) $val->default = 'guest';
|
if(!$val->default) $val->default = 'guest';
|
||||||
if($val->default == 'root') $val->default = 'manager';
|
if($val->default == 'root') $val->default = 'manager';
|
||||||
$grant_list->{$key} = $val;
|
$grant_list->{$key} = $val;
|
||||||
|
|
@ -88,8 +93,9 @@
|
||||||
/**
|
/**
|
||||||
* @brief Common:: module's permission displaying page in the module
|
* @brief Common:: module's permission displaying page in the module
|
||||||
* Available when using module instance in all the modules
|
* Available when using module instance in all the modules
|
||||||
**/
|
*/
|
||||||
function getModuleGrantHTML($module_srl, $source_grant_list) {
|
function getModuleGrantHTML($module_srl, $source_grant_list)
|
||||||
|
{
|
||||||
if(!$module_srl)
|
if(!$module_srl)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -106,8 +112,10 @@
|
||||||
// Grant virtual permission for access and manager
|
// Grant virtual permission for access and manager
|
||||||
$grant_list->access->title = Context::getLang('grant_access');
|
$grant_list->access->title = Context::getLang('grant_access');
|
||||||
$grant_list->access->default = 'guest';
|
$grant_list->access->default = 'guest';
|
||||||
if(count($source_grant_list)) {
|
if(count($source_grant_list))
|
||||||
foreach($source_grant_list as $key => $val) {
|
{
|
||||||
|
foreach($source_grant_list as $key => $val)
|
||||||
|
{
|
||||||
if(!$val->default) $val->default = 'guest';
|
if(!$val->default) $val->default = 'guest';
|
||||||
if($val->default == 'root') $val->default = 'manager';
|
if($val->default == 'root') $val->default = 'manager';
|
||||||
$grant_list->{$key} = $val;
|
$grant_list->{$key} = $val;
|
||||||
|
|
@ -120,13 +128,16 @@
|
||||||
$default_grant = array();
|
$default_grant = array();
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$output = executeQueryArray('module.getModuleGrants', $args);
|
$output = executeQueryArray('module.getModuleGrants', $args);
|
||||||
if($output->data) {
|
if($output->data)
|
||||||
foreach($output->data as $val) {
|
{
|
||||||
|
foreach($output->data as $val)
|
||||||
|
{
|
||||||
if($val->group_srl == 0) $default_grant[$val->name] = 'all';
|
if($val->group_srl == 0) $default_grant[$val->name] = 'all';
|
||||||
else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
|
else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
|
||||||
else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
|
else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
|
||||||
else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
|
else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
$selected_group[$val->name][] = $val->group_srl;
|
$selected_group[$val->name][] = $val->group_srl;
|
||||||
$default_grant[$val->name] = 'group';
|
$default_grant[$val->name] = 'group';
|
||||||
}
|
}
|
||||||
|
|
@ -198,7 +209,8 @@
|
||||||
else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
|
else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
|
||||||
else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
|
else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
|
||||||
else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
|
else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
$selectedGroup->{$val->name}[] = $val->group_srl;
|
$selectedGroup->{$val->name}[] = $val->group_srl;
|
||||||
$defaultGrant->{$val->name} = 'group';
|
$defaultGrant->{$val->name} = 'group';
|
||||||
}
|
}
|
||||||
|
|
@ -225,8 +237,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Common:: skin setting page for the module
|
* @brief Common:: skin setting page for the module
|
||||||
**/
|
*/
|
||||||
function getModuleSkinHTML($module_srl) {
|
function getModuleSkinHTML($module_srl)
|
||||||
|
{
|
||||||
return $this->_getModuleSkinHTML($module_srl, 'P');
|
return $this->_getModuleSkinHTML($module_srl, 'P');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,22 +347,29 @@
|
||||||
/**
|
/**
|
||||||
* @brief Get values for a particular language code
|
* @brief Get values for a particular language code
|
||||||
* Return its corresponding value if lang_code is specified. Otherwise return $name.
|
* Return its corresponding value if lang_code is specified. Otherwise return $name.
|
||||||
**/
|
*/
|
||||||
function getLangCode($site_srl, $name) {
|
function getLangCode($site_srl, $name)
|
||||||
|
{
|
||||||
$lang_supported = Context::get('lang_supported');
|
$lang_supported = Context::get('lang_supported');
|
||||||
|
|
||||||
if(substr($name,0,12)=='$user_lang->') {
|
if(substr($name,0,12)=='$user_lang->')
|
||||||
|
{
|
||||||
$args->site_srl = (int)$site_srl;
|
$args->site_srl = (int)$site_srl;
|
||||||
$args->name = substr($name,12);
|
$args->name = substr($name,12);
|
||||||
$output = executeQueryArray('module.getLang', $args);
|
$output = executeQueryArray('module.getLang', $args);
|
||||||
if($output->data) {
|
if($output->data)
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
$selected_lang[$val->lang_code] = $val->value;
|
$selected_lang[$val->lang_code] = $val->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$tmp = unserialize($name);
|
$tmp = unserialize($name);
|
||||||
if($tmp) {
|
if($tmp)
|
||||||
|
{
|
||||||
$selected_lang = array();
|
$selected_lang = array();
|
||||||
$rand_name = $tmp[Context::getLangType()];
|
$rand_name = $tmp[Context::getLangType()];
|
||||||
if(!$rand_name) $rand_name = array_shift($tmp);
|
if(!$rand_name) $rand_name = array_shift($tmp);
|
||||||
|
|
@ -372,8 +392,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return if the module language in ajax is requested
|
* @brief Return if the module language in ajax is requested
|
||||||
**/
|
*/
|
||||||
function getModuleAdminLangCode() {
|
function getModuleAdminLangCode()
|
||||||
|
{
|
||||||
$name = Context::get('name');
|
$name = Context::get('name');
|
||||||
if(!$name) return new Object(-1,'msg_invalid_request');
|
if(!$name) return new Object(-1,'msg_invalid_request');
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
|
@ -384,7 +405,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns lang list by lang name
|
* @brief Returns lang list by lang name
|
||||||
**/
|
*/
|
||||||
function getModuleAdminLangListByName()
|
function getModuleAdminLangListByName()
|
||||||
{
|
{
|
||||||
$args = Context::getRequestVars();
|
$args = Context::getRequestVars();
|
||||||
|
|
@ -404,7 +425,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return lang list
|
* @brief Return lang list
|
||||||
**/
|
*/
|
||||||
function getModuleAdminLangListByValue()
|
function getModuleAdminLangListByValue()
|
||||||
{
|
{
|
||||||
$args = Context::getRequestVars();
|
$args = Context::getRequestVars();
|
||||||
|
|
@ -414,15 +435,18 @@
|
||||||
|
|
||||||
// search value
|
// search value
|
||||||
$output = executeQueryArray('module.getLangNameByValue', $args);
|
$output = executeQueryArray('module.getLangNameByValue', $args);
|
||||||
if ($output->toBool() && is_array($output->data)){
|
if($output->toBool() && is_array($output->data))
|
||||||
|
{
|
||||||
unset($args->value);
|
unset($args->value);
|
||||||
|
|
||||||
foreach($output->data as $data) {
|
foreach($output->data as $data)
|
||||||
|
{
|
||||||
$args->langName = $data->name;
|
$args->langName = $data->name;
|
||||||
$columnList = array('lang_code', 'name', 'value');
|
$columnList = array('lang_code', 'name', 'value');
|
||||||
$outputByName = executeQueryArray('module.getLangListByName', $args, $columnList);
|
$outputByName = executeQueryArray('module.getLangListByName', $args, $columnList);
|
||||||
|
|
||||||
if($outputByName->toBool()) {
|
if($outputByName->toBool())
|
||||||
|
{
|
||||||
$langList = array_merge($langList, $outputByName->data);
|
$langList = array_merge($langList, $outputByName->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -433,7 +457,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return current lang list
|
* @brief Return current lang list
|
||||||
**/
|
*/
|
||||||
function getLangListByLangcode($args)
|
function getLangListByLangcode($args)
|
||||||
{
|
{
|
||||||
$output = executeQueryArray('module.getLangListByLangcode', $args);
|
$output = executeQueryArray('module.getLangListByLangcode', $args);
|
||||||
|
|
@ -512,5 +536,6 @@
|
||||||
|
|
||||||
$this->add('module_info', $module_info);
|
$this->add('module_info', $module_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file module.admin.model.php */
|
||||||
|
/* Location: ./modules/module/module.admin.model.php */
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,33 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class moduleAdminView
|
* @class moduleAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief admin view class of the module module
|
* @brief admin view class of the module module
|
||||||
**/
|
*/
|
||||||
|
class moduleAdminView extends module
|
||||||
class moduleAdminView extends module {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
// Set the template path
|
// Set the template path
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Module admin page
|
* @brief Module admin page
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminContent() {
|
function dispModuleAdminContent()
|
||||||
|
{
|
||||||
$this->dispModuleAdminList();
|
$this->dispModuleAdminList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Display a lost of modules
|
* @brief Display a lost of modules
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminList() {
|
function dispModuleAdminList()
|
||||||
|
{
|
||||||
// Obtain a list of modules
|
// Obtain a list of modules
|
||||||
$oAdminModel = &getAdminModel('admin');
|
$oAdminModel = &getAdminModel('admin');
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
@ -34,7 +36,8 @@
|
||||||
$module_list = $oModuleModel->getModuleList();
|
$module_list = $oModuleModel->getModuleList();
|
||||||
if(is_array($module_list))
|
if(is_array($module_list))
|
||||||
{
|
{
|
||||||
foreach($module_list as $key => $val) {
|
foreach($module_list as $key => $val)
|
||||||
|
{
|
||||||
$module_list[$key]->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path);
|
$module_list[$key]->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path);
|
||||||
|
|
||||||
// get easyinstall need update
|
// get easyinstall need update
|
||||||
|
|
@ -43,7 +46,7 @@
|
||||||
$module_list[$key]->need_autoinstall_update = $package[$packageSrl]->need_update;
|
$module_list[$key]->need_autoinstall_update = $package[$packageSrl]->need_update;
|
||||||
|
|
||||||
// get easyinstall update url
|
// get easyinstall update url
|
||||||
if ($module_list[$key]->need_autoinstall_update == 'Y')
|
if($module_list[$key]->need_autoinstall_update == 'Y')
|
||||||
{
|
{
|
||||||
$module_list[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
|
$module_list[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
|
||||||
}
|
}
|
||||||
|
|
@ -54,8 +57,10 @@
|
||||||
|
|
||||||
$favoriteList = $output->get('favoriteList');
|
$favoriteList = $output->get('favoriteList');
|
||||||
$favoriteModuleList = array();
|
$favoriteModuleList = array();
|
||||||
if ($favoriteList){
|
if($favoriteList)
|
||||||
foreach($favoriteList as $favorite => $favorite_info){
|
{
|
||||||
|
foreach($favoriteList as $favorite => $favorite_info)
|
||||||
|
{
|
||||||
$favoriteModuleList[] = $favorite_info->module;
|
$favoriteModuleList[] = $favorite_info->module;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -73,8 +78,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Pop-up details of the module (conf/info.xml)
|
* @brief Pop-up details of the module (conf/info.xml)
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminInfo() {
|
function dispModuleAdminInfo()
|
||||||
|
{
|
||||||
// Obtain a list of modules
|
// Obtain a list of modules
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module'));
|
$module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module'));
|
||||||
|
|
@ -92,8 +98,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Module Categories
|
* @brief Module Categories
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminCategory() {
|
function dispModuleAdminCategory()
|
||||||
|
{
|
||||||
$module_category_srl = Context::get('module_category_srl');
|
$module_category_srl = Context::get('module_category_srl');
|
||||||
|
|
||||||
// Obtain a list of modules
|
// Obtain a list of modules
|
||||||
|
|
@ -102,7 +109,8 @@
|
||||||
//Security
|
//Security
|
||||||
$security = new Security();
|
$security = new Security();
|
||||||
|
|
||||||
if($module_category_srl) {
|
if($module_category_srl)
|
||||||
|
{
|
||||||
$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
|
$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
|
||||||
Context::set('selected_category', $selected_category);
|
Context::set('selected_category', $selected_category);
|
||||||
|
|
||||||
|
|
@ -112,7 +120,9 @@
|
||||||
// Set a template file
|
// Set a template file
|
||||||
$this->setTemplateFile('category_update_form');
|
$this->setTemplateFile('category_update_form');
|
||||||
// If not selected, display a list of categories
|
// If not selected, display a list of categories
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$category_list = $oModuleModel->getModuleCategories();
|
$category_list = $oModuleModel->getModuleCategories();
|
||||||
Context::set('category_list', $category_list);
|
Context::set('category_list', $category_list);
|
||||||
|
|
||||||
|
|
@ -126,8 +136,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Feature to copy module
|
* @brief Feature to copy module
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminCopyModule() {
|
function dispModuleAdminCopyModule()
|
||||||
|
{
|
||||||
// Get a target module to copy
|
// Get a target module to copy
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
// Get information of the module
|
// Get information of the module
|
||||||
|
|
@ -144,8 +155,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Applying the default settings to all modules
|
* @brief Applying the default settings to all modules
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminModuleSetup() {
|
function dispModuleAdminModuleSetup()
|
||||||
|
{
|
||||||
$module_srls = Context::get('module_srls');
|
$module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
$modules = explode(',',$module_srls);
|
$modules = explode(',',$module_srls);
|
||||||
|
|
@ -179,8 +191,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Apply module addition settings to all modules
|
* @brief Apply module addition settings to all modules
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminModuleAdditionSetup() {
|
function dispModuleAdminModuleAdditionSetup()
|
||||||
|
{
|
||||||
$module_srls = Context::get('module_srls');
|
$module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
$modules = explode(',',$module_srls);
|
$modules = explode(',',$module_srls);
|
||||||
|
|
@ -201,8 +214,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Applying module permission settings to all modules
|
* @brief Applying module permission settings to all modules
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminModuleGrantSetup() {
|
function dispModuleAdminModuleGrantSetup()
|
||||||
|
{
|
||||||
$module_srls = Context::get('module_srls');
|
$module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
$modules = explode(',',$module_srls);
|
$modules = explode(',',$module_srls);
|
||||||
|
|
@ -216,8 +230,10 @@
|
||||||
// Grant virtual permissions for access and manager
|
// Grant virtual permissions for access and manager
|
||||||
$grant_list->access->title = Context::getLang('grant_access');
|
$grant_list->access->title = Context::getLang('grant_access');
|
||||||
$grant_list->access->default = 'guest';
|
$grant_list->access->default = 'guest';
|
||||||
if(count($source_grant_list)) {
|
if(count($source_grant_list))
|
||||||
foreach($source_grant_list as $key => $val) {
|
{
|
||||||
|
foreach($source_grant_list as $key => $val)
|
||||||
|
{
|
||||||
if(!$val->default) $val->default = 'guest';
|
if(!$val->default) $val->default = 'guest';
|
||||||
if($val->default == 'root') $val->default = 'manager';
|
if($val->default == 'root') $val->default = 'manager';
|
||||||
$grant_list->{$key} = $val;
|
$grant_list->{$key} = $val;
|
||||||
|
|
@ -240,11 +256,11 @@
|
||||||
$this->setTemplateFile('module_grant_setup');
|
$this->setTemplateFile('module_grant_setup');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Language codes
|
* @brief Language codes
|
||||||
**/
|
*/
|
||||||
function dispModuleAdminLangcode() {
|
function dispModuleAdminLangcode()
|
||||||
|
{
|
||||||
// Get the language file of the current site
|
// Get the language file of the current site
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$args->site_srl = (int)$site_module_info->site_srl;
|
$args->site_srl = (int)$site_module_info->site_srl;
|
||||||
|
|
@ -275,7 +291,8 @@
|
||||||
$this->setTemplateFile('module_langcode');
|
$this->setTemplateFile('module_langcode');
|
||||||
}
|
}
|
||||||
|
|
||||||
function dispModuleAdminFileBox(){
|
function dispModuleAdminFileBox()
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$output = $oModuleModel->getModuleFileBoxList();
|
$output = $oModuleModel->getModuleFileBoxList();
|
||||||
$page = Context::get('page');
|
$page = Context::get('page');
|
||||||
|
|
@ -285,5 +302,6 @@
|
||||||
Context::set('page', $page);
|
Context::set('page', $page);
|
||||||
$this->setTemplateFile('adminFileBox');
|
$this->setTemplateFile('adminFileBox');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file module.admin.view.php */
|
||||||
|
/* Location: ./modules/module/module.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class module
|
* @class module
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief high class of the module module
|
* @brief high class of the module module
|
||||||
**/
|
*/
|
||||||
|
class module extends ModuleObject
|
||||||
class module extends ModuleObject {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implement if additional tasks are necessary when installing
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
**/
|
*/
|
||||||
function moduleInstall() {
|
function moduleInstall()
|
||||||
|
{
|
||||||
// Register action forward (to use in administrator mode)
|
// Register action forward (to use in administrator mode)
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
// Insert site information into the sites table
|
// Insert site information into the sites table
|
||||||
$args->site_srl = 0;
|
$args->site_srl = 0;
|
||||||
$output = $oDB->executeQuery('module.getSite', $args);
|
$output = $oDB->executeQuery('module.getSite', $args);
|
||||||
if(!$output->data || !$output->data->index_module_srl) {
|
if(!$output->data || !$output->data->index_module_srl)
|
||||||
|
{
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
$domain = Context::getDefaultUrl();
|
$domain = Context::getDefaultUrl();
|
||||||
$url_info = parse_url($domain);
|
$url_info = parse_url($domain);
|
||||||
|
|
@ -43,8 +44,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief a method to check if successfully installed
|
* @brief a method to check if successfully installed
|
||||||
**/
|
*/
|
||||||
function checkUpdate() {
|
function checkUpdate()
|
||||||
|
{
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
// 2008. 10. 27 Add multi-index in the table, the module_part_config
|
// 2008. 10. 27 Add multi-index in the table, the module_part_config
|
||||||
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
|
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
|
||||||
|
|
@ -55,7 +57,8 @@
|
||||||
// Move permissions/skin information of all modules to the table, grants.
|
// Move permissions/skin information of all modules to the table, grants.
|
||||||
if(!$oDB->isColumnExists('sites', 'default_language')) return true;
|
if(!$oDB->isColumnExists('sites', 'default_language')) return true;
|
||||||
// Delete extra_vars* column
|
// Delete extra_vars* column
|
||||||
for($i=1;$i<=20;$i++) {
|
for($i=1;$i<=20;$i++)
|
||||||
|
{
|
||||||
if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
|
if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
|
||||||
}
|
}
|
||||||
// Insert site information to the table, sites
|
// Insert site information to the table, sites
|
||||||
|
|
@ -102,21 +105,25 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Execute update
|
* @brief Execute update
|
||||||
**/
|
*/
|
||||||
function moduleUpdate() {
|
function moduleUpdate()
|
||||||
|
{
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg
|
// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg
|
||||||
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) {
|
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config"))
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$modules = $oModuleModel->getModuleList();
|
$modules = $oModuleModel->getModuleList();
|
||||||
foreach($modules as $key => $module_info) {
|
foreach($modules as $key => $module_info)
|
||||||
|
{
|
||||||
$module = $module_info->module;
|
$module = $module_info->module;
|
||||||
if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
|
if(!in_array($module, array('point','trackback','layout','rss','file','comment','editor'))) continue;
|
||||||
$config = $oModuleModel->getModuleConfig($module);
|
$config = $oModuleModel->getModuleConfig($module);
|
||||||
|
|
||||||
$module_config = null;
|
$module_config = null;
|
||||||
switch($module) {
|
switch($module)
|
||||||
|
{
|
||||||
case 'point' :
|
case 'point' :
|
||||||
$module_config = $config->module_point;
|
$module_config = $config->module_point;
|
||||||
unset($config->module_point);
|
unset($config->module_point);
|
||||||
|
|
@ -128,29 +135,34 @@
|
||||||
case 'editor' :
|
case 'editor' :
|
||||||
$module_config = $config->module_config;
|
$module_config = $config->module_config;
|
||||||
unset($config->module_config);
|
unset($config->module_config);
|
||||||
if(is_array($module_config) && count($module_config)) {
|
if(is_array($module_config) && count($module_config))
|
||||||
foreach($module_config as $key => $val) {
|
{
|
||||||
|
foreach($module_config as $key => $val)
|
||||||
|
{
|
||||||
if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
|
if(isset($module_config[$key]->module_srl)) unset($module_config[$key]->module_srl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'layout' :
|
case 'layout' :
|
||||||
$tmp = $config->header_script;
|
$tmp = $config->header_script;
|
||||||
if(is_array($tmp) && count($tmp)) {
|
if(is_array($tmp) && count($tmp))
|
||||||
foreach($tmp as $k => $v) {
|
{
|
||||||
|
foreach($tmp as $k => $v)
|
||||||
|
{
|
||||||
if(!$v && !trim($v)) continue;
|
if(!$v && !trim($v)) continue;
|
||||||
$module_config[$k]->header_script = $v;
|
$module_config[$k]->header_script = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$config = null;
|
$config = null;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$oModuleController->insertModuleConfig($module, $config);
|
$oModuleController->insertModuleConfig($module, $config);
|
||||||
|
|
||||||
if(is_array($module_config) && count($module_config)) {
|
if(is_array($module_config) && count($module_config))
|
||||||
foreach($module_config as $module_srl => $module_part_config) {
|
{
|
||||||
|
foreach($module_config as $module_srl => $module_part_config)
|
||||||
|
{
|
||||||
$oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config);
|
$oModuleController->insertModulePartConfig($module,$module_srl,$module_part_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -158,7 +170,8 @@
|
||||||
$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
|
$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
|
||||||
}
|
}
|
||||||
// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns
|
// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns
|
||||||
if(!$oDB->isIndexExists('modules',"idx_site_mid")) {
|
if(!$oDB->isIndexExists('modules',"idx_site_mid"))
|
||||||
|
{
|
||||||
$oDB->dropIndex("modules","unique_mid",true);
|
$oDB->dropIndex("modules","unique_mid",true);
|
||||||
$oDB->addColumn('modules','site_srl','number',11,0,true);
|
$oDB->addColumn('modules','site_srl','number',11,0,true);
|
||||||
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
|
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
|
||||||
|
|
@ -168,15 +181,18 @@
|
||||||
|
|
||||||
if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
|
if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
|
||||||
// Move permission, skin info, extection info, admin ID of all modules to the table, grants
|
// Move permission, skin info, extection info, admin ID of all modules to the table, grants
|
||||||
if($oDB->isColumnExists('modules', 'grants')) {
|
if($oDB->isColumnExists('modules', 'grants'))
|
||||||
|
{
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$oDocumentController = &getController('document');
|
$oDocumentController = &getController('document');
|
||||||
// Get a value of the current system language code
|
// Get a value of the current system language code
|
||||||
$lang_code = Context::getLangType();
|
$lang_code = Context::getLangType();
|
||||||
// Get module_info of all modules
|
// Get module_info of all modules
|
||||||
$output = executeQueryArray('module.getModuleInfos');
|
$output = executeQueryArray('module.getModuleInfos');
|
||||||
if(count($output->data)) {
|
if(count($output->data))
|
||||||
foreach($output->data as $module_info) {
|
{
|
||||||
|
foreach($output->data as $module_info)
|
||||||
|
{
|
||||||
// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority
|
// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority
|
||||||
$module_srl = trim($module_info->module_srl);
|
$module_srl = trim($module_info->module_srl);
|
||||||
// grant an authority
|
// grant an authority
|
||||||
|
|
@ -187,10 +203,13 @@
|
||||||
if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
|
if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
|
||||||
// Insert super admin's ID
|
// Insert super admin's ID
|
||||||
$admin_id = trim($module_info->admin_id);
|
$admin_id = trim($module_info->admin_id);
|
||||||
if($admin_id && $admin_id != 'Array') {
|
if($admin_id && $admin_id != 'Array')
|
||||||
|
{
|
||||||
$admin_ids = explode(',',$admin_id);
|
$admin_ids = explode(',',$admin_id);
|
||||||
if(count($admin_id)) {
|
if(count($admin_id))
|
||||||
foreach($admin_ids as $admin_id) {
|
{
|
||||||
|
foreach($admin_ids as $admin_id)
|
||||||
|
{
|
||||||
$oModuleController->insertAdminId($module_srl, $admin_id);
|
$oModuleController->insertAdminId($module_srl, $admin_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -198,7 +217,8 @@
|
||||||
// Save extra configurations for each module(column data which doesn't exist in the defaut modules)
|
// Save extra configurations for each module(column data which doesn't exist in the defaut modules)
|
||||||
$extra_vars = unserialize($module_info->extra_vars);
|
$extra_vars = unserialize($module_info->extra_vars);
|
||||||
$document_extra_keys = null;
|
$document_extra_keys = null;
|
||||||
if($extra_vars->extra_vars && count($extra_vars->extra_vars)) {
|
if($extra_vars->extra_vars && count($extra_vars->extra_vars))
|
||||||
|
{
|
||||||
$document_extra_keys = $extra_vars->extra_vars;
|
$document_extra_keys = $extra_vars->extra_vars;
|
||||||
unset($extra_vars->extra_vars);
|
unset($extra_vars->extra_vars);
|
||||||
}
|
}
|
||||||
|
|
@ -206,9 +226,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
|
* Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
|
||||||
**/
|
*/
|
||||||
// Insert extra vars if planet module is
|
// Insert extra vars if planet module is
|
||||||
if($module_info->module == 'planet') {
|
if($module_info->module == 'planet')
|
||||||
|
{
|
||||||
if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
|
if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
|
||||||
$planet_extra_keys->name = 'postscript';
|
$planet_extra_keys->name = 'postscript';
|
||||||
$planet_extra_keys->type = 'text';
|
$planet_extra_keys->type = 'text';
|
||||||
|
|
@ -219,15 +240,18 @@
|
||||||
$document_extra_keys[20] = $planet_extra_keys;
|
$document_extra_keys[20] = $planet_extra_keys;
|
||||||
}
|
}
|
||||||
// Register keys for document extra vars
|
// Register keys for document extra vars
|
||||||
if(count($document_extra_keys)) {
|
if(count($document_extra_keys))
|
||||||
foreach($document_extra_keys as $var_idx => $val) {
|
{
|
||||||
|
foreach($document_extra_keys as $var_idx => $val)
|
||||||
|
{
|
||||||
$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx);
|
$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx);
|
||||||
}
|
}
|
||||||
// 2009-04-14 Fixed a bug that only 100 extra vars are moved
|
// 2009-04-14 Fixed a bug that only 100 extra vars are moved
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$total_count = $oDocumentModel->getDocumentCount($module_srl);
|
$total_count = $oDocumentModel->getDocumentCount($module_srl);
|
||||||
|
|
||||||
if ($total_count > 0) {
|
if($total_count > 0)
|
||||||
|
{
|
||||||
$per_page = 100;
|
$per_page = 100;
|
||||||
$total_pages = (int) (($total_count - 1) / $per_page) + 1;
|
$total_pages = (int) (($total_count - 1) / $per_page) + 1;
|
||||||
// Get extra vars if exist
|
// Get extra vars if exist
|
||||||
|
|
@ -237,13 +261,17 @@
|
||||||
$doc_args->sort_index = 'list_order';
|
$doc_args->sort_index = 'list_order';
|
||||||
$doc_args->order_type = 'asc';
|
$doc_args->order_type = 'asc';
|
||||||
|
|
||||||
for ($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++) {
|
for($doc_args->page = 1; $doc_args->page <= $total_pages; $doc_args->page++)
|
||||||
|
{
|
||||||
$output = executeQueryArray('document.getDocumentList', $doc_args);
|
$output = executeQueryArray('document.getDocumentList', $doc_args);
|
||||||
|
|
||||||
if ($output->toBool() && $output->data && count($output->data)) {
|
if($output->toBool() && $output->data && count($output->data))
|
||||||
foreach ($output->data as $document) {
|
{
|
||||||
if (!$document) continue;
|
foreach ($output->data as $document)
|
||||||
foreach ($document as $key => $var) {
|
{
|
||||||
|
if(!$document) continue;
|
||||||
|
foreach ($document as $key => $var)
|
||||||
|
{
|
||||||
if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
|
if (strpos($key, 'extra_vars') !== 0 || !trim($var) || $var == 'N;') continue;
|
||||||
$var_idx = str_replace('extra_vars','',$key);
|
$var_idx = str_replace('extra_vars','',$key);
|
||||||
$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
|
$oDocumentController->insertDocumentExtraVar($module_srl, $document->document_srl, $var_idx, $var, 'extra_vars'.$var_idx, $lang_code);
|
||||||
|
|
@ -268,18 +296,21 @@
|
||||||
$oDB->dropColumn('modules','extra_vars');
|
$oDB->dropColumn('modules','extra_vars');
|
||||||
}
|
}
|
||||||
// Rights of all modules/skins transferring the information into a table Update grants
|
// Rights of all modules/skins transferring the information into a table Update grants
|
||||||
if(!$oDB->isColumnExists('sites', 'default_language')) {
|
if(!$oDB->isColumnExists('sites', 'default_language'))
|
||||||
|
{
|
||||||
$oDB->addColumn('sites','default_language','varchar',255,0,false);
|
$oDB->addColumn('sites','default_language','varchar',255,0,false);
|
||||||
}
|
}
|
||||||
// extra_vars * Remove Column
|
// extra_vars * Remove Column
|
||||||
for($i=1;$i<=20;$i++) {
|
for($i=1;$i<=20;$i++)
|
||||||
|
{
|
||||||
if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
|
if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
|
||||||
$oDB->dropColumn('documents','extra_vars'.$i);
|
$oDB->dropColumn('documents','extra_vars'.$i);
|
||||||
}
|
}
|
||||||
// Enter the main site information sites on the table
|
// Enter the main site information sites on the table
|
||||||
$args->site_srl = 0;
|
$args->site_srl = 0;
|
||||||
$output = $oDB->executeQuery('module.getSite', $args);
|
$output = $oDB->executeQuery('module.getSite', $args);
|
||||||
if(!$output->data) {
|
if(!$output->data)
|
||||||
|
{
|
||||||
// Basic mid, language Wanted
|
// Basic mid, language Wanted
|
||||||
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
|
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
|
|
@ -295,32 +326,41 @@
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($oDB->isIndexExists('sites','idx_domain')){
|
if($oDB->isIndexExists('sites','idx_domain'))
|
||||||
|
{
|
||||||
$oDB->dropIndex('sites','idx_domain');
|
$oDB->dropIndex('sites','idx_domain');
|
||||||
}
|
}
|
||||||
if(!$oDB->isIndexExists('sites','unique_domain')){
|
if(!$oDB->isIndexExists('sites','unique_domain'))
|
||||||
|
{
|
||||||
$this->updateForUniqueSiteDomain();
|
$this->updateForUniqueSiteDomain();
|
||||||
$oDB->addIndex('sites','unique_domain',array('domain'),true);
|
$oDB->addIndex('sites','unique_domain',array('domain'),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$oDB->isColumnExists("modules", "use_mobile")) {
|
if(!$oDB->isColumnExists("modules", "use_mobile"))
|
||||||
|
{
|
||||||
$oDB->addColumn('modules','use_mobile','char',1,'N');
|
$oDB->addColumn('modules','use_mobile','char',1,'N');
|
||||||
}
|
}
|
||||||
if(!$oDB->isColumnExists("modules", "mlayout_srl")) {
|
if(!$oDB->isColumnExists("modules", "mlayout_srl"))
|
||||||
|
{
|
||||||
$oDB->addColumn('modules','mlayout_srl','number',11, 0);
|
$oDB->addColumn('modules','mlayout_srl','number',11, 0);
|
||||||
}
|
}
|
||||||
if(!$oDB->isColumnExists("modules", "mcontent")) {
|
if(!$oDB->isColumnExists("modules", "mcontent"))
|
||||||
|
{
|
||||||
$oDB->addColumn('modules','mcontent','bigtext');
|
$oDB->addColumn('modules','mcontent','bigtext');
|
||||||
}
|
}
|
||||||
if(!$oDB->isColumnExists("modules", "mskin")) {
|
if(!$oDB->isColumnExists("modules", "mskin"))
|
||||||
|
{
|
||||||
$oDB->addColumn('modules','mskin','varchar',250);
|
$oDB->addColumn('modules','mskin','varchar',250);
|
||||||
}
|
}
|
||||||
if(!$oDB->isColumnExists("modules", "is_skin_fix")){
|
if(!$oDB->isColumnExists("modules", "is_skin_fix"))
|
||||||
|
{
|
||||||
$oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N');
|
$oDB->addColumn('modules', 'is_skin_fix', 'char', 1, 'N');
|
||||||
$output = executeQueryArray('module.getAllSkinSetModule');
|
$output = executeQueryArray('module.getAllSkinSetModule');
|
||||||
if ($output->toBool() && $output->data){
|
if($output->toBool() && $output->data)
|
||||||
|
{
|
||||||
$module_srls = array();
|
$module_srls = array();
|
||||||
foreach($output->data as $val){
|
foreach($output->data as $val)
|
||||||
|
{
|
||||||
$module_srls[] = $val->module_srl;
|
$module_srls[] = $val->module_srl;
|
||||||
}
|
}
|
||||||
unset($args);
|
unset($args);
|
||||||
|
|
@ -329,7 +369,8 @@
|
||||||
$output = executeQuery('module.updateSkinFixModules', $args);
|
$output = executeQuery('module.updateSkinFixModules', $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$oDB->isColumnExists("module_config", "site_srl")){
|
if(!$oDB->isColumnExists("module_config", "site_srl"))
|
||||||
|
{
|
||||||
$oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true);
|
$oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true);
|
||||||
}
|
}
|
||||||
FileHandler::makeDir('./files/ruleset');
|
FileHandler::makeDir('./files/ruleset');
|
||||||
|
|
@ -389,9 +430,11 @@
|
||||||
{
|
{
|
||||||
$oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N');
|
$oDB->addColumn('modules', 'is_mskin_fix', 'char', 1, 'N');
|
||||||
$output = executeQueryArray('module.getAllMobileSkinSetModule');
|
$output = executeQueryArray('module.getAllMobileSkinSetModule');
|
||||||
if ($output->toBool() && $output->data){
|
if($output->toBool() && $output->data)
|
||||||
|
{
|
||||||
$module_srls = array();
|
$module_srls = array();
|
||||||
foreach($output->data as $val){
|
foreach($output->data as $val)
|
||||||
|
{
|
||||||
$module_srls[] = $val->module_srl;
|
$module_srls[] = $val->module_srl;
|
||||||
}
|
}
|
||||||
unset($args);
|
unset($args);
|
||||||
|
|
@ -410,7 +453,7 @@
|
||||||
* @param int $menuSrl
|
* @param int $menuSrl
|
||||||
*
|
*
|
||||||
* @return Object
|
* @return Object
|
||||||
**/
|
*/
|
||||||
private function updateLinkModule($moduleInfos, $menuSrl)
|
private function updateLinkModule($moduleInfos, $menuSrl)
|
||||||
{
|
{
|
||||||
if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
|
if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
|
||||||
|
|
@ -490,10 +533,12 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Re-generate the cache file
|
* @brief Re-generate the cache file
|
||||||
**/
|
*/
|
||||||
function recompileCache() {
|
function recompileCache()
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleModel->getModuleList();
|
$oModuleModel->getModuleList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file module.class.php */
|
||||||
|
/* Location: ./modules/module/module.class.php */
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class moduleController
|
* @class moduleController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief controller class of the module module
|
* @brief controller class of the module module
|
||||||
**/
|
*/
|
||||||
|
class moduleController extends module
|
||||||
class moduleController extends module {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add action forward
|
* @brief Add action forward
|
||||||
* Action forward finds and forwards if an action is not in the requested module
|
* Action forward finds and forwards if an action is not in the requested module
|
||||||
* This is used when installing a module
|
* This is used when installing a module
|
||||||
**/
|
*/
|
||||||
function insertActionForward($module, $type, $act) {
|
function insertActionForward($module, $type, $act)
|
||||||
|
{
|
||||||
$args->module = $module;
|
$args->module = $module;
|
||||||
$args->type = $type;
|
$args->type = $type;
|
||||||
$args->act = $act;
|
$args->act = $act;
|
||||||
|
|
@ -29,8 +30,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete action forward
|
* @brief Delete action forward
|
||||||
**/
|
*/
|
||||||
function deleteActionForward($module, $type, $act) {
|
function deleteActionForward($module, $type, $act)
|
||||||
|
{
|
||||||
$args->module = $module;
|
$args->module = $module;
|
||||||
$args->type = $type;
|
$args->type = $type;
|
||||||
$args->act = $act;
|
$args->act = $act;
|
||||||
|
|
@ -43,8 +45,9 @@
|
||||||
* @brief Add module trigger
|
* @brief Add module trigger
|
||||||
* module trigger is to call a trigger to a target module
|
* module trigger is to call a trigger to a target module
|
||||||
*
|
*
|
||||||
**/
|
*/
|
||||||
function insertTrigger($trigger_name, $module, $type, $called_method, $called_position) {
|
function insertTrigger($trigger_name, $module, $type, $called_method, $called_position)
|
||||||
|
{
|
||||||
$args->trigger_name = $trigger_name;
|
$args->trigger_name = $trigger_name;
|
||||||
$args->module = $module;
|
$args->module = $module;
|
||||||
$args->type = $type;
|
$args->type = $type;
|
||||||
|
|
@ -65,14 +68,14 @@
|
||||||
FileHandler::removeFilesInDir("./files/cache/triggers");
|
FileHandler::removeFilesInDir("./files/cache/triggers");
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete module trigger
|
* @brief Delete module trigger
|
||||||
*
|
*
|
||||||
**/
|
*/
|
||||||
function deleteTrigger($trigger_name, $module, $type, $called_method, $called_position) {
|
function deleteTrigger($trigger_name, $module, $type, $called_method, $called_position)
|
||||||
|
{
|
||||||
$args->trigger_name = $trigger_name;
|
$args->trigger_name = $trigger_name;
|
||||||
$args->module = $module;
|
$args->module = $module;
|
||||||
$args->type = $type;
|
$args->type = $type;
|
||||||
|
|
@ -98,8 +101,9 @@
|
||||||
/**
|
/**
|
||||||
* @brief Add module extend
|
* @brief Add module extend
|
||||||
*
|
*
|
||||||
**/
|
*/
|
||||||
function insertModuleExtend($parent_module, $extend_module, $type, $kind=''){
|
function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
|
||||||
|
{
|
||||||
if($kind != 'admin') $kind = '';
|
if($kind != 'admin') $kind = '';
|
||||||
if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
|
if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
|
||||||
if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
|
if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
|
||||||
|
|
@ -122,8 +126,9 @@
|
||||||
/**
|
/**
|
||||||
* @brief Delete module extend
|
* @brief Delete module extend
|
||||||
*
|
*
|
||||||
**/
|
*/
|
||||||
function deleteModuleExtend($parent_module, $extend_module, $type, $kind=''){
|
function deleteModuleExtend($parent_module, $extend_module, $type, $kind='')
|
||||||
|
{
|
||||||
$cache_file = './files/config/module_extend.php';
|
$cache_file = './files/config/module_extend.php';
|
||||||
FileHandler::removeFile($cache_file);
|
FileHandler::removeFile($cache_file);
|
||||||
|
|
||||||
|
|
@ -137,15 +142,16 @@
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateModuleConfig($module, $config, $site_srl = 0)
|
||||||
function updateModuleConfig($module, $config, $site_srl = 0){
|
{
|
||||||
$args->module = $module;
|
$args->module = $module;
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
|
$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
|
||||||
|
|
||||||
foreach($config as $key => $val){
|
foreach($config as $key => $val)
|
||||||
|
{
|
||||||
$origin_config->{$key} = $val;
|
$origin_config->{$key} = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,8 +161,9 @@
|
||||||
/**
|
/**
|
||||||
* @brief Enter a specific set of modules
|
* @brief Enter a specific set of modules
|
||||||
* In order to manage global configurations of modules such as board, member and so on
|
* In order to manage global configurations of modules such as board, member and so on
|
||||||
**/
|
*/
|
||||||
function insertModuleConfig($module, $config, $site_srl = 0) {
|
function insertModuleConfig($module, $config, $site_srl = 0)
|
||||||
|
{
|
||||||
$args->module = $module;
|
$args->module = $module;
|
||||||
$args->config = serialize($config);
|
$args->config = serialize($config);
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
|
|
@ -179,8 +186,9 @@
|
||||||
/**
|
/**
|
||||||
* @brief Save module configurations of the mid
|
* @brief Save module configurations of the mid
|
||||||
* Manage mid configurations depending on module
|
* Manage mid configurations depending on module
|
||||||
**/
|
*/
|
||||||
function insertModulePartConfig($module, $module_srl, $config) {
|
function insertModulePartConfig($module, $module_srl, $config)
|
||||||
|
{
|
||||||
$args->module = $module;
|
$args->module = $module;
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->config = serialize($config);
|
$args->config = serialize($config);
|
||||||
|
|
@ -197,20 +205,21 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('module.insertModulePartConfig', $args);
|
$output = executeQuery('module.insertModulePartConfig', $args);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief create virtual site
|
* @brief create virtual site
|
||||||
**/
|
*/
|
||||||
function insertSite($domain, $index_module_srl) {
|
function insertSite($domain, $index_module_srl)
|
||||||
if(isSiteID($domain)) {
|
{
|
||||||
|
if(isSiteID($domain))
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid');
|
if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid');
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$domain = strtolower($domain);
|
$domain = strtolower($domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -233,20 +242,22 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief modify virtual site
|
* @brief modify virtual site
|
||||||
**/
|
*/
|
||||||
function updateSite($args) {
|
function updateSite($args)
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$columnList = array('sites.site_srl', 'sites.domain');
|
$columnList = array('sites.site_srl', 'sites.domain');
|
||||||
$site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList);
|
$site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList);
|
||||||
if($site_info->domain != $args->domain) {
|
if($site_info->domain != $args->domain)
|
||||||
|
{
|
||||||
$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
|
$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
|
||||||
if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain');
|
if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain');
|
||||||
if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid');
|
if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid');
|
||||||
|
|
||||||
if($args->domain && !isSiteID($args->domain)) {
|
if($args->domain && !isSiteID($args->domain))
|
||||||
|
{
|
||||||
$args->domain = $args->domain;
|
$args->domain = $args->domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
$output = executeQuery('module.updateSite', $args);
|
$output = executeQuery('module.updateSite', $args);
|
||||||
//clear cache for default mid
|
//clear cache for default mid
|
||||||
|
|
@ -257,8 +268,10 @@
|
||||||
$mid = $module_info->mid;
|
$mid = $module_info->mid;
|
||||||
|
|
||||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||||
if($oCacheHandler->isSupport()){
|
if($oCacheHandler->isSupport())
|
||||||
if($args->site_srl == 0){
|
{
|
||||||
|
if($args->site_srl == 0)
|
||||||
|
{
|
||||||
$cache_key = 'object_default_mid:_';
|
$cache_key = 'object_default_mid:_';
|
||||||
$oCacheHandler->delete($cache_key);
|
$oCacheHandler->delete($cache_key);
|
||||||
}
|
}
|
||||||
|
|
@ -270,8 +283,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Arrange module information
|
* @brief Arrange module information
|
||||||
**/
|
*/
|
||||||
function arrangeModuleInfo(&$args, &$extra_vars) {
|
function arrangeModuleInfo(&$args, &$extra_vars)
|
||||||
|
{
|
||||||
// Remove unnecessary information
|
// Remove unnecessary information
|
||||||
unset($args->body);
|
unset($args->body);
|
||||||
unset($args->act);
|
unset($args->act);
|
||||||
|
|
@ -308,8 +322,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Insert module
|
* @brief Insert module
|
||||||
**/
|
*/
|
||||||
function insertModule($args) {
|
function insertModule($args)
|
||||||
|
{
|
||||||
$output = $this->arrangeModuleInfo($args, $extra_vars);
|
$output = $this->arrangeModuleInfo($args, $extra_vars);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
// Check whether the module name already exists
|
// Check whether the module name already exists
|
||||||
|
|
@ -333,7 +348,8 @@
|
||||||
|
|
||||||
// Insert a module
|
// Insert a module
|
||||||
$output = executeQuery('module.insertModule', $args);
|
$output = executeQuery('module.insertModule', $args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool())
|
||||||
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -349,8 +365,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Modify module information
|
* @brief Modify module information
|
||||||
**/
|
*/
|
||||||
function updateModule($args) {
|
function updateModule($args)
|
||||||
|
{
|
||||||
$output = $this->arrangeModuleInfo($args, $extra_vars);
|
$output = $this->arrangeModuleInfo($args, $extra_vars);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
|
@ -369,7 +386,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('module.isExistsModuleName', $args);
|
$output = executeQuery('module.isExistsModuleName', $args);
|
||||||
if(!$output->toBool() || $output->data->count) {
|
if(!$output->toBool() || $output->data->count)
|
||||||
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return new Object(-1, 'msg_module_name_exists');
|
return new Object(-1, 'msg_module_name_exists');
|
||||||
}
|
}
|
||||||
|
|
@ -379,7 +397,8 @@
|
||||||
$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
|
$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
|
||||||
|
|
||||||
$output = executeQuery('module.updateModule', $args);
|
$output = executeQuery('module.updateModule', $args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool())
|
||||||
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -393,7 +412,8 @@
|
||||||
|
|
||||||
//remove from cache
|
//remove from cache
|
||||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||||
if($oCacheHandler->isSupport()){
|
if($oCacheHandler->isSupport())
|
||||||
|
{
|
||||||
$cache_key = 'object_module_info:'.$args->module_srl;
|
$cache_key = 'object_module_info:'.$args->module_srl;
|
||||||
$oCacheHandler->delete($cache_key);
|
$oCacheHandler->delete($cache_key);
|
||||||
$cache_key = 'object:'.$args->mid.'_'.$args->site_srl;
|
$cache_key = 'object:'.$args->mid.'_'.$args->site_srl;
|
||||||
|
|
@ -406,8 +426,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Change the module's virtual site
|
* @brief Change the module's virtual site
|
||||||
**/
|
*/
|
||||||
function updateModuleSite($module_srl, $site_srl, $layout_srl = 0) {
|
function updateModuleSite($module_srl, $site_srl, $layout_srl = 0)
|
||||||
|
{
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
$args->layout_srl = $layout_srl;
|
$args->layout_srl = $layout_srl;
|
||||||
|
|
@ -418,8 +439,9 @@
|
||||||
* @brief Delete module
|
* @brief Delete module
|
||||||
*
|
*
|
||||||
* Attempt to delete all related information when deleting a module.
|
* Attempt to delete all related information when deleting a module.
|
||||||
**/
|
*/
|
||||||
function deleteModule($module_srl) {
|
function deleteModule($module_srl)
|
||||||
|
{
|
||||||
if(!$module_srl) return new Object(-1,'msg_invalid_request');
|
if(!$module_srl) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
||||||
// check start module
|
// check start module
|
||||||
|
|
@ -440,7 +462,8 @@
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
// Delete module information from the DB
|
// Delete module information from the DB
|
||||||
$output = executeQuery('module.deleteModule', $args);
|
$output = executeQuery('module.deleteModule', $args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool())
|
||||||
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
@ -453,9 +476,11 @@
|
||||||
// Remove the module manager
|
// Remove the module manager
|
||||||
$this->deleteAdminId($module_srl);
|
$this->deleteAdminId($module_srl);
|
||||||
// Call a trigger (after)
|
// Call a trigger (after)
|
||||||
if($output->toBool()) {
|
if($output->toBool())
|
||||||
|
{
|
||||||
$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
|
$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
|
||||||
if(!$trigger_output->toBool()) {
|
if(!$trigger_output->toBool())
|
||||||
|
{
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $trigger_output;
|
return $trigger_output;
|
||||||
}
|
}
|
||||||
|
|
@ -465,7 +490,8 @@
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
//remove from cache
|
//remove from cache
|
||||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||||
if($oCacheHandler->isSupport()){
|
if($oCacheHandler->isSupport())
|
||||||
|
{
|
||||||
$cache_key = 'object_module_info:'.$args->module_srl;
|
$cache_key = 'object_module_info:'.$args->module_srl;
|
||||||
$oCacheHandler->delete($cache_key);
|
$oCacheHandler->delete($cache_key);
|
||||||
$cache_key = 'object:module_extra_vars_'.$args->module_srl;
|
$cache_key = 'object:module_extra_vars_'.$args->module_srl;
|
||||||
|
|
@ -478,14 +504,16 @@
|
||||||
* @brief Change other information of the module
|
* @brief Change other information of the module
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function updateModuleSkinVars($module_srl, $skin_vars) {
|
function updateModuleSkinVars($module_srl, $skin_vars)
|
||||||
|
{
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set is_default as N in all modules(the default module is disabled)
|
* @brief Set is_default as N in all modules(the default module is disabled)
|
||||||
**/
|
*/
|
||||||
function clearDefaultModule() {
|
function clearDefaultModule()
|
||||||
|
{
|
||||||
$output = executeQuery('module.clearDefaultModule');
|
$output = executeQuery('module.clearDefaultModule');
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
|
|
@ -494,15 +522,17 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update menu_srl of mid which belongs to menu_srl
|
* @brief Update menu_srl of mid which belongs to menu_srl
|
||||||
**/
|
*/
|
||||||
function updateModuleMenu($args) {
|
function updateModuleMenu($args)
|
||||||
|
{
|
||||||
return executeQuery('module.updateModuleMenu', $args);
|
return executeQuery('module.updateModuleMenu', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update layout_srl of mid which belongs to menu_srl
|
* @brief Update layout_srl of mid which belongs to menu_srl
|
||||||
**/
|
*/
|
||||||
function updateModuleLayout($layout_srl, $menu_srl_list) {
|
function updateModuleLayout($layout_srl, $menu_srl_list)
|
||||||
|
{
|
||||||
if(!count($menu_srl_list)) return;
|
if(!count($menu_srl_list)) return;
|
||||||
|
|
||||||
$args->layout_srl = $layout_srl;
|
$args->layout_srl = $layout_srl;
|
||||||
|
|
@ -513,8 +543,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Change the site administrator
|
* @brief Change the site administrator
|
||||||
**/
|
*/
|
||||||
function insertSiteAdmin($site_srl, $arr_admins) {
|
function insertSiteAdmin($site_srl, $arr_admins)
|
||||||
|
{
|
||||||
// Remove the site administrator
|
// Remove the site administrator
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
|
|
||||||
|
|
@ -523,7 +554,8 @@
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
// Get user id of an administrator
|
// Get user id of an administrator
|
||||||
if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
|
if(!is_array($arr_admins) || !count($arr_admins)) return new Object();
|
||||||
foreach($arr_admins as $key => $user_id) {
|
foreach($arr_admins as $key => $user_id)
|
||||||
|
{
|
||||||
if(!trim($user_id)) continue;
|
if(!trim($user_id)) continue;
|
||||||
$admins[] = trim($user_id);
|
$admins[] = trim($user_id);
|
||||||
}
|
}
|
||||||
|
|
@ -531,15 +563,19 @@
|
||||||
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$member_config = $oMemberModel->getMemberConfig();
|
$member_config = $oMemberModel->getMemberConfig();
|
||||||
if($member_config->identifier == 'email_address') {
|
if($member_config->identifier == 'email_address')
|
||||||
|
{
|
||||||
$args->email_address = '\''.implode('\',\'',$admins).'\'';
|
$args->email_address = '\''.implode('\',\'',$admins).'\'';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$args->user_ids = '\''.implode('\',\'',$admins).'\'';
|
$args->user_ids = '\''.implode('\',\'',$admins).'\'';
|
||||||
}
|
}
|
||||||
$output = executeQueryArray('module.getAdminSrls', $args);
|
$output = executeQueryArray('module.getAdminSrls', $args);
|
||||||
if(!$output->toBool()||!$output->data) return $output;
|
if(!$output->toBool()||!$output->data) return $output;
|
||||||
|
|
||||||
foreach($output->data as $key => $val) {
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
unset($args);
|
unset($args);
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
$args->member_srl = $val->member_srl;
|
$args->member_srl = $val->member_srl;
|
||||||
|
|
@ -551,12 +587,13 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Specify the admin ID to a module
|
* @brief Specify the admin ID to a module
|
||||||
**/
|
*/
|
||||||
function insertAdminId($module_srl, $admin_id) {
|
function insertAdminId($module_srl, $admin_id)
|
||||||
|
{
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$member_config = $oMemberModel->getMemberConfig();
|
$member_config = $oMemberModel->getMemberConfig();
|
||||||
|
|
||||||
if ($member_config->identifier == 'email_address')
|
if($member_config->identifier == 'email_address')
|
||||||
$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
|
$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
|
||||||
else
|
else
|
||||||
$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
|
$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
|
||||||
|
|
@ -569,11 +606,13 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove the admin ID from a module
|
* @brief Remove the admin ID from a module
|
||||||
**/
|
*/
|
||||||
function deleteAdminId($module_srl, $admin_id = '') {
|
function deleteAdminId($module_srl, $admin_id = '')
|
||||||
|
{
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
|
|
||||||
if($admin_id) {
|
if($admin_id)
|
||||||
|
{
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
|
$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
|
||||||
if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
|
if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
|
||||||
|
|
@ -604,8 +643,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Insert skin vars to a module
|
* @brief Insert skin vars to a module
|
||||||
**/
|
*/
|
||||||
function _insertModuleSkinVars($module_srl, $obj, $mode) {
|
function _insertModuleSkinVars($module_srl, $obj, $mode)
|
||||||
|
{
|
||||||
$mode = $mode === 'P' ? 'P' : 'M';
|
$mode = $mode === 'P' ? 'P' : 'M';
|
||||||
|
|
||||||
$oDB = DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
|
|
@ -621,7 +661,8 @@
|
||||||
if(!$obj || !count($obj)) return new Object();
|
if(!$obj || !count($obj)) return new Object();
|
||||||
|
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
foreach($obj as $key => $val) {
|
foreach($obj as $key => $val)
|
||||||
|
{
|
||||||
// #17927989 For an old board which used the old blog module
|
// #17927989 For an old board which used the old blog module
|
||||||
// it often saved menu item(stdClass) on the skin info column
|
// it often saved menu item(stdClass) on the skin info column
|
||||||
// When updating the module on XE core 1.2.0 later versions, it occurs an error
|
// When updating the module on XE core 1.2.0 later versions, it occurs an error
|
||||||
|
|
@ -672,8 +713,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove skin vars of a module
|
* @brief Remove skin vars of a module
|
||||||
**/
|
*/
|
||||||
function _deleteModuleSkinVars($module_srl, $mode) {
|
function _deleteModuleSkinVars($module_srl, $mode)
|
||||||
|
{
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$mode = $mode === 'P' ? 'P' : 'M';
|
$mode = $mode === 'P' ? 'P' : 'M';
|
||||||
|
|
||||||
|
|
@ -700,12 +742,14 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register extra vars to the module
|
* @brief Register extra vars to the module
|
||||||
**/
|
*/
|
||||||
function insertModuleExtraVars($module_srl, $obj) {
|
function insertModuleExtraVars($module_srl, $obj)
|
||||||
|
{
|
||||||
$this->deleteModuleExtraVars($module_srl);
|
$this->deleteModuleExtraVars($module_srl);
|
||||||
if(!$obj || !count($obj)) return;
|
if(!$obj || !count($obj)) return;
|
||||||
|
|
||||||
foreach($obj as $key => $val) {
|
foreach($obj as $key => $val)
|
||||||
|
{
|
||||||
$args = null;
|
$args = null;
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->name = trim($key);
|
$args->name = trim($key);
|
||||||
|
|
@ -717,8 +761,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove extra vars from the module
|
* @brief Remove extra vars from the module
|
||||||
**/
|
*/
|
||||||
function deleteModuleExtraVars($module_srl) {
|
function deleteModuleExtraVars($module_srl)
|
||||||
|
{
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
return executeQuery('module.deleteModuleExtraVars', $args);
|
return executeQuery('module.deleteModuleExtraVars', $args);
|
||||||
//remove from cache
|
//remove from cache
|
||||||
|
|
@ -732,56 +777,64 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Grant permission to the module
|
* @brief Grant permission to the module
|
||||||
**/
|
*/
|
||||||
function insertModuleGrants($module_srl, $obj) {
|
function insertModuleGrants($module_srl, $obj)
|
||||||
|
{
|
||||||
$this->deleteModuleGrants($module_srl);
|
$this->deleteModuleGrants($module_srl);
|
||||||
if(!$obj || !count($obj)) return;
|
if(!$obj || !count($obj)) return;
|
||||||
|
|
||||||
foreach($obj as $name => $val) {
|
foreach($obj as $name => $val)
|
||||||
|
{
|
||||||
if(!$val || !count($val)) continue;
|
if(!$val || !count($val)) continue;
|
||||||
|
|
||||||
foreach($val as $group_srl) {
|
foreach($val as $group_srl)
|
||||||
|
{
|
||||||
$args = null;
|
$args = null;
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->name = $name;
|
$args->name = $name;
|
||||||
$args->group_srl = trim($group_srl);
|
$args->group_srl = trim($group_srl);
|
||||||
if(!$args->name || !$args->group_srl) continue;
|
if(!$args->name || !$args->group_srl) continue;
|
||||||
executeQuery('module.insertModuleGrant', $args);
|
executeQuery('module.insertModuleGrant', $args);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove permission from the module
|
* @brief Remove permission from the module
|
||||||
**/
|
*/
|
||||||
function deleteModuleGrants($module_srl) {
|
function deleteModuleGrants($module_srl)
|
||||||
|
{
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
return executeQuery('module.deleteModuleGrants', $args);
|
return executeQuery('module.deleteModuleGrants', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Change user-defined language
|
* @brief Change user-defined language
|
||||||
**/
|
*/
|
||||||
function replaceDefinedLangCode(&$output, $isReplaceLangCode = true) {
|
function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
|
||||||
|
{
|
||||||
if($isReplaceLangCode)
|
if($isReplaceLangCode)
|
||||||
{
|
{
|
||||||
$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
|
$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function _replaceLangCode($matches) {
|
|
||||||
|
function _replaceLangCode($matches)
|
||||||
|
{
|
||||||
static $lang = null;
|
static $lang = null;
|
||||||
|
|
||||||
|
if(is_null($lang))
|
||||||
if(is_null($lang)) {
|
{
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
if(!$site_module_info){
|
if(!$site_module_info)
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$site_module_info = $oModuleModel->getDefaultMid();
|
$site_module_info = $oModuleModel->getDefaultMid();
|
||||||
Context::set('site_module_info', $site_module_info);
|
Context::set('site_module_info', $site_module_info);
|
||||||
}
|
}
|
||||||
$cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType());
|
$cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType());
|
||||||
if(!file_exists($cache_file)) {
|
if(!file_exists($cache_file))
|
||||||
|
{
|
||||||
$oModuleAdminController = &getAdminController('module');
|
$oModuleAdminController = &getAdminController('module');
|
||||||
$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
|
$oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
|
||||||
}
|
}
|
||||||
|
|
@ -807,8 +860,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add and update a file into the file box
|
* @brief Add and update a file into the file box
|
||||||
**/
|
*/
|
||||||
function procModuleFileBoxAdd(){
|
function procModuleFileBoxAdd()
|
||||||
|
{
|
||||||
$ajax = Context::get('ajax');
|
$ajax = Context::get('ajax');
|
||||||
if ($ajax) Context::setRequestMethod('JSON');
|
if ($ajax) Context::setRequestMethod('JSON');
|
||||||
|
|
||||||
|
|
@ -821,7 +875,8 @@
|
||||||
if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
|
if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
|
||||||
{
|
{
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
foreach($attributeNames as $no => $name){
|
foreach($attributeNames as $no => $name)
|
||||||
|
{
|
||||||
if(empty($name))
|
if(empty($name))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -843,12 +898,14 @@
|
||||||
$vars->member_srl = $logged_info->member_srl;
|
$vars->member_srl = $logged_info->member_srl;
|
||||||
|
|
||||||
// update
|
// update
|
||||||
if($module_filebox_srl > 0){
|
if($module_filebox_srl > 0)
|
||||||
|
{
|
||||||
$vars->module_filebox_srl = $module_filebox_srl;
|
$vars->module_filebox_srl = $module_filebox_srl;
|
||||||
$output = $this->updateModuleFileBox($vars);
|
$output = $this->updateModuleFileBox($vars);
|
||||||
|
}
|
||||||
// insert
|
// insert
|
||||||
}else{
|
else
|
||||||
|
{
|
||||||
if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
|
if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured');
|
||||||
$addfile = Context::get('addfile');
|
$addfile = Context::get('addfile');
|
||||||
if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
|
if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured');
|
||||||
|
|
@ -870,14 +927,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update a file into the file box
|
* @brief Update a file into the file box
|
||||||
**/
|
*/
|
||||||
function updateModuleFileBox($vars){
|
function updateModuleFileBox($vars)
|
||||||
|
{
|
||||||
// have file
|
// have file
|
||||||
if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])){
|
if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
|
||||||
|
{
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
|
$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
|
||||||
FileHandler::removeFile($output->data->filename);
|
FileHandler::removeFile($output->data->filename);
|
||||||
|
|
@ -888,14 +945,14 @@
|
||||||
$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
|
$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
|
||||||
$tmp = $vars->addfile['tmp_name'];
|
$tmp = $vars->addfile['tmp_name'];
|
||||||
|
|
||||||
if(!@move_uploaded_file($tmp, $save_filename)) {
|
if(!@move_uploaded_file($tmp, $save_filename))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
|
$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
|
||||||
$args->filename = $save_filename;
|
$args->filename = $save_filename;
|
||||||
$args->filesize = $vars->addfile['size'];
|
$args->filesize = $vars->addfile['size'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$args->module_filebox_srl = $vars->module_filebox_srl;
|
$args->module_filebox_srl = $vars->module_filebox_srl;
|
||||||
|
|
@ -907,8 +964,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add a file into the file box
|
* @brief Add a file into the file box
|
||||||
**/
|
*/
|
||||||
function insertModuleFileBox($vars){
|
function insertModuleFileBox($vars)
|
||||||
|
{
|
||||||
// set module_filebox_srl
|
// set module_filebox_srl
|
||||||
$vars->module_filebox_srl = getNextSequence();
|
$vars->module_filebox_srl = getNextSequence();
|
||||||
|
|
||||||
|
|
@ -920,11 +978,11 @@
|
||||||
$tmp = $vars->addfile['tmp_name'];
|
$tmp = $vars->addfile['tmp_name'];
|
||||||
|
|
||||||
// upload
|
// upload
|
||||||
if(!@move_uploaded_file($tmp, $save_filename)) {
|
if(!@move_uploaded_file($tmp, $save_filename))
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// insert
|
// insert
|
||||||
$args->module_filebox_srl = $vars->module_filebox_srl;
|
$args->module_filebox_srl = $vars->module_filebox_srl;
|
||||||
$args->member_srl = $vars->member_srl;
|
$args->member_srl = $vars->member_srl;
|
||||||
|
|
@ -941,9 +999,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete a file from the file box
|
* @brief Delete a file from the file box
|
||||||
**/
|
*/
|
||||||
|
function procModuleFileBoxDelete()
|
||||||
function procModuleFileBoxDelete(){
|
{
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
|
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
|
|
@ -954,8 +1012,8 @@
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteModuleFileBox($vars){
|
function deleteModuleFileBox($vars)
|
||||||
|
{
|
||||||
// delete real file
|
// delete real file
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
|
$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
|
||||||
|
|
@ -968,25 +1026,29 @@
|
||||||
/**
|
/**
|
||||||
* @brief function of locking (timeout is in seconds)
|
* @brief function of locking (timeout is in seconds)
|
||||||
*/
|
*/
|
||||||
function lock($lock_name, $timeout, $member_srl = null) {
|
function lock($lock_name, $timeout, $member_srl = null)
|
||||||
|
{
|
||||||
$this->unlockTimeoutPassed();
|
$this->unlockTimeoutPassed();
|
||||||
$args->lock_name = $lock_name;
|
$args->lock_name = $lock_name;
|
||||||
if(!$timeout) $timeout = 60;
|
if(!$timeout) $timeout = 60;
|
||||||
$args->deadline = date("YmdHis", time() + $timeout);
|
$args->deadline = date("YmdHis", time() + $timeout);
|
||||||
if($member_srl) $args->member_srl = $member_srl;
|
if($member_srl) $args->member_srl = $member_srl;
|
||||||
$output = executeQuery('module.insertLock', $args);
|
$output = executeQuery('module.insertLock', $args);
|
||||||
if($output->toBool()) {
|
if($output->toBool())
|
||||||
|
{
|
||||||
$output->add('lock_name', $lock_name);
|
$output->add('lock_name', $lock_name);
|
||||||
$output->add('deadline', $args->deadline);
|
$output->add('deadline', $args->deadline);
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function unlockTimeoutPassed() {
|
function unlockTimeoutPassed()
|
||||||
|
{
|
||||||
executeQuery('module.deleteLocksTimeoutPassed');
|
executeQuery('module.deleteLocksTimeoutPassed');
|
||||||
}
|
}
|
||||||
|
|
||||||
function unlock($lock_name, $deadline) {
|
function unlock($lock_name, $deadline)
|
||||||
|
{
|
||||||
$args->lock_name = $lock_name;
|
$args->lock_name = $lock_name;
|
||||||
$args->deadline = $deadline;
|
$args->deadline = $deadline;
|
||||||
$output = executeQuery('module.deleteLock', $args);
|
$output = executeQuery('module.deleteLock', $args);
|
||||||
|
|
@ -999,5 +1061,6 @@
|
||||||
$output = executeQuery('module.updateModuleInSites', $args);
|
$output = executeQuery('module.updateModuleInSites', $args);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file module.controller.php */
|
||||||
|
/* Location: ./modules/module/module.controller.php */
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
class moduleMobile extends moduleObject
|
||||||
class moduleMobile extends moduleObject {
|
{
|
||||||
function dispModuleChangeLang() {
|
function dispModuleChangeLang()
|
||||||
|
{
|
||||||
$this->setTemplatePath(sprintf("%stpl/",$this->module_path));
|
$this->setTemplatePath(sprintf("%stpl/",$this->module_path));
|
||||||
$this->setTemplateFile('lang.html');
|
$this->setTemplateFile('lang.html');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* End of file module.mobile.php */
|
||||||
?>
|
/* Location: ./modules/module/module.mobile.php */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,24 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class moduleView
|
* @class moduleView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief view class of the module module
|
* @brief view class of the module module
|
||||||
**/
|
*/
|
||||||
|
class moduleView extends module
|
||||||
class moduleView extends module {
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialization
|
* @brief Initialization
|
||||||
**/
|
*/
|
||||||
function init() {
|
function init()
|
||||||
|
{
|
||||||
// Set the template path
|
// Set the template path
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Display skin information
|
* @brief Display skin information
|
||||||
**/
|
*/
|
||||||
function dispModuleSkinInfo() {
|
function dispModuleSkinInfo()
|
||||||
|
{
|
||||||
$selected_module = Context::get('selected_module');
|
$selected_module = Context::get('selected_module');
|
||||||
$skin = Context::get('skin');
|
$skin = Context::get('skin');
|
||||||
// Get modules/skin information
|
// Get modules/skin information
|
||||||
|
|
@ -38,8 +39,9 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Select a module
|
* @brief Select a module
|
||||||
**/
|
*/
|
||||||
function dispModuleSelectList() {
|
function dispModuleSelectList()
|
||||||
|
{
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
@ -52,25 +54,34 @@
|
||||||
// If there is no site keyword, use as information of the current virtual site
|
// If there is no site keyword, use as information of the current virtual site
|
||||||
$args = null;
|
$args = null;
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->is_admin == 'Y') {
|
if($logged_info->is_admin == 'Y')
|
||||||
|
{
|
||||||
$query_id = 'module.getSiteModules';
|
$query_id = 'module.getSiteModules';
|
||||||
$module_category_exists = false;
|
$module_category_exists = false;
|
||||||
if(!$site_keyword) {
|
if(!$site_keyword)
|
||||||
|
{
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
if($site_module_info && $logged_info->is_admin != 'Y') {
|
if($site_module_info && $logged_info->is_admin != 'Y')
|
||||||
|
{
|
||||||
$site_keyword = $site_module_info->domain;
|
$site_keyword = $site_module_info->domain;
|
||||||
$args->site_srl = (int)$site_module_info->site_srl;
|
$args->site_srl = (int)$site_module_info->site_srl;
|
||||||
Context::set('site_keyword', $site_keyword);
|
Context::set('site_keyword', $site_keyword);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$query_id = 'module.getDefaultModules';
|
$query_id = 'module.getDefaultModules';
|
||||||
$args->site_srl = 0;
|
$args->site_srl = 0;
|
||||||
$module_category_exists = true;
|
$module_category_exists = true;
|
||||||
}
|
}
|
||||||
// If site keyword exists, extract information from the sites
|
// If site keyword exists, extract information from the sites
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$args->site_keyword = $site_keyword;
|
$args->site_keyword = $site_keyword;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$query_id = 'module.getSiteModules';
|
$query_id = 'module.getSiteModules';
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$args->site_srl = (int)$site_module_info->site_srl;
|
$args->site_srl = (int)$site_module_info->site_srl;
|
||||||
|
|
@ -79,8 +90,10 @@
|
||||||
// Get a list of modules at the site
|
// Get a list of modules at the site
|
||||||
$output = executeQueryArray($query_id, $args);
|
$output = executeQueryArray($query_id, $args);
|
||||||
$category_list = $mid_list = array();
|
$category_list = $mid_list = array();
|
||||||
if(count($output->data)) {
|
if(count($output->data))
|
||||||
foreach($output->data as $key => $val) {
|
{
|
||||||
|
foreach($output->data as $key => $val)
|
||||||
|
{
|
||||||
$module = trim($val->module);
|
$module = trim($val->module);
|
||||||
if(!$module) continue;
|
if(!$module) continue;
|
||||||
|
|
||||||
|
|
@ -93,8 +106,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$selected_module = Context::get('selected_module');
|
$selected_module = Context::get('selected_module');
|
||||||
if(count($mid_list)) {
|
if(count($mid_list))
|
||||||
foreach($mid_list as $module => $val) {
|
{
|
||||||
|
foreach($mid_list as $module => $val)
|
||||||
|
{
|
||||||
if(!$selected_module) $selected_module = $module;
|
if(!$selected_module) $selected_module = $module;
|
||||||
$xml_info = $oModuleModel->getModuleInfoXml($module);
|
$xml_info = $oModuleModel->getModuleInfoXml($module);
|
||||||
$mid_list[$module]->title = $xml_info->title;
|
$mid_list[$module]->title = $xml_info->title;
|
||||||
|
|
@ -114,8 +129,10 @@
|
||||||
// Set a template file
|
// Set a template file
|
||||||
$this->setTemplateFile('module_selector');
|
$this->setTemplateFile('module_selector');
|
||||||
}
|
}
|
||||||
|
|
||||||
// See the file box
|
// See the file box
|
||||||
function dispModuleFileBox(){
|
function dispModuleFileBox()
|
||||||
|
{
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
|
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
|
|
@ -123,7 +140,6 @@
|
||||||
|
|
||||||
if(!$input_name) return new Object(-1, 'msg_not_permitted');
|
if(!$input_name) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
|
|
||||||
$addscript = sprintf('<script>//<![CDATA[
|
$addscript = sprintf('<script>//<![CDATA[
|
||||||
var selected_filebox_input_name = "%s";
|
var selected_filebox_input_name = "%s";
|
||||||
//]]></script>',$input_name);
|
//]]></script>',$input_name);
|
||||||
|
|
@ -140,8 +156,10 @@
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
$this->setTemplateFile('filebox_list');
|
$this->setTemplateFile('filebox_list');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Screen to add a file box
|
// Screen to add a file box
|
||||||
function dispModuleFileBoxAdd(){
|
function dispModuleFileBoxAdd()
|
||||||
|
{
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
|
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
|
|
@ -151,5 +169,6 @@
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
$this->setTemplateFile('filebox_add');
|
$this->setTemplateFile('filebox_add');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
/* End of file module.view.php */
|
||||||
|
/* Location: ./modules/module/module.view.php */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue