mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-15 17:29:55 +09:00
merge from 1.7.3.5(r13153:r13167)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@13168 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
cc47d2b247
commit
2d3f149b5a
2042 changed files with 129266 additions and 126243 deletions
|
|
@ -1,216 +1,300 @@
|
|||
<?php
|
||||
require_once(_XE_PATH_.'modules/addon/addon.controller.php');
|
||||
|
||||
/**
|
||||
* Admin controller class of addon modules
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
class addonAdminController extends addonController {
|
||||
require_once(_XE_PATH_ . 'modules/addon/addon.controller.php');
|
||||
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
/**
|
||||
* Admin controller class of addon modules
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
*/
|
||||
class addonAdminController extends addonController
|
||||
{
|
||||
|
||||
/**
|
||||
* Set addon activate
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function procAddonAdminSaveActivate()
|
||||
/**
|
||||
* Initialization
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set addon activate
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAddonAdminSaveActivate()
|
||||
{
|
||||
$pcOnList = Context::get('pc_on');
|
||||
$mobileOnList = Context::get('mobile_on');
|
||||
$fixed = Context::get('fixed');
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
|
||||
if($site_module_info->site_srl)
|
||||
{
|
||||
$pcOnList = Context::get('pc_on');
|
||||
$mobileOnList = Context::get('mobile_on');
|
||||
$fixed = Context::get('fixed');
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
|
||||
if($site_module_info->site_srl) $site_srl = $site_module_info->site_srl;
|
||||
else $site_srl = 0;
|
||||
$site_srl = $site_module_info->site_srl;
|
||||
}
|
||||
else
|
||||
{
|
||||
$site_srl = 0;
|
||||
}
|
||||
|
||||
if (!$pcOnList) $pcOnList = array();
|
||||
if (!$mobileOnList) $mobileOnList = array();
|
||||
if (!$fixed) $fixed = array();
|
||||
if(!$pcOnList)
|
||||
{
|
||||
$pcOnList = array();
|
||||
}
|
||||
if(!$mobileOnList)
|
||||
{
|
||||
$mobileOnList = array();
|
||||
}
|
||||
if(!$fixed)
|
||||
{
|
||||
$fixed = array();
|
||||
}
|
||||
|
||||
if (!is_array($pcOnList)) $pcOnList = array($pcOnList);
|
||||
if (!is_array($mobileOnList)) $pcOnList = array($mobileOnList);
|
||||
if (!is_array($fixed)) $pcOnList = array($fixed);
|
||||
if(!is_array($pcOnList))
|
||||
{
|
||||
$pcOnList = array($pcOnList);
|
||||
}
|
||||
if(!is_array($mobileOnList))
|
||||
{
|
||||
$pcOnList = array($mobileOnList);
|
||||
}
|
||||
if(!is_array($fixed))
|
||||
{
|
||||
$pcOnList = array($fixed);
|
||||
}
|
||||
|
||||
// get current addon info
|
||||
$oModel = &getAdminModel('addon');
|
||||
$currentAddonList = $oModel->getAddonList($site_srl, 'site');
|
||||
// get current addon info
|
||||
$oModel = getAdminModel('addon');
|
||||
$currentAddonList = $oModel->getAddonList($site_srl, 'site');
|
||||
|
||||
// get need update addon list
|
||||
$updateList = array();
|
||||
foreach($currentAddonList as $addon)
|
||||
// get need update addon list
|
||||
$updateList = array();
|
||||
foreach($currentAddonList as $addon)
|
||||
{
|
||||
if($addon->activated !== in_array($addon->addon_name, $pcOnList))
|
||||
{
|
||||
if ($addon->activated !== in_array($addon->addon_name, $pcOnList))
|
||||
{
|
||||
$updateList[] = $addon->addon_name;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($addon->mactivated !== in_array($addon->addon_name, $mobileOnList))
|
||||
{
|
||||
$updateList[] = $addon->addon_name;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($addon->fixed !== in_array($addon->addon_name, $fixed))
|
||||
{
|
||||
$updateList[] = $addon->addon_name;
|
||||
continue;
|
||||
}
|
||||
$updateList[] = $addon->addon_name;
|
||||
continue;
|
||||
}
|
||||
|
||||
// update
|
||||
foreach($updateList as $targetAddon)
|
||||
if($addon->mactivated !== in_array($addon->addon_name, $mobileOnList))
|
||||
{
|
||||
unset($args);
|
||||
|
||||
if (in_array($targetAddon, $pcOnList))
|
||||
$args->is_used = 'Y';
|
||||
else
|
||||
$args->is_used = 'N';
|
||||
|
||||
if (in_array($targetAddon, $mobileOnList))
|
||||
$args->is_used_m = 'Y';
|
||||
else
|
||||
$args->is_used_m = 'N';
|
||||
|
||||
if (in_array($targetAddon, $fixed))
|
||||
$args->fixed = 'Y';
|
||||
else
|
||||
$args->fixed = 'N';
|
||||
|
||||
$args->addon = $targetAddon;
|
||||
$args->site_srl = $site_srl;
|
||||
|
||||
$output = executeQuery('addon.updateSiteAddon', $args);
|
||||
if (!$output->toBool()) return $output;
|
||||
$updateList[] = $addon->addon_name;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (count($updateList))
|
||||
if($addon->fixed !== in_array($addon->addon_name, $fixed))
|
||||
{
|
||||
$this->makeCacheFile($site_srl, 'pc', 'site');
|
||||
$this->makeCacheFile($site_srl, 'mobile', 'site');
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated', 'info');
|
||||
if (Context::get('success_return_url'))
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('success_return_url'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAddonAdminIndex'));
|
||||
$updateList[] = $addon->addon_name;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add active/inactive change
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function procAddonAdminToggleActivate() {
|
||||
$oAddonModel = &getAdminModel('addon');
|
||||
// update
|
||||
foreach($updateList as $targetAddon)
|
||||
{
|
||||
$args = new stdClass();
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
// batahom addon values
|
||||
$addon = Context::get('addon');
|
||||
$type = Context::get('type');
|
||||
if(!$type) $type = "pc";
|
||||
if($addon) {
|
||||
// If enabled Disables
|
||||
if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type)) $this->doDeactivate($addon, $site_module_info->site_srl, $type);
|
||||
// If it is disabled Activate
|
||||
else $this->doActivate($addon, $site_module_info->site_srl, $type);
|
||||
if(in_array($targetAddon, $pcOnList))
|
||||
{
|
||||
$args->is_used = 'Y';
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->is_used = 'N';
|
||||
}
|
||||
|
||||
$this->makeCacheFile($site_module_info->site_srl, $type);
|
||||
}
|
||||
if(in_array($targetAddon, $mobileOnList))
|
||||
{
|
||||
$args->is_used_m = 'Y';
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->is_used_m = 'N';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the configuration information input
|
||||
*
|
||||
* @return Object
|
||||
**/
|
||||
function procAddonAdminSetupAddon() {
|
||||
$args = Context::getRequestVars();
|
||||
$module = $args->module;
|
||||
$addon_name = $args->addon_name;
|
||||
unset($args->module);
|
||||
unset($args->act);
|
||||
unset($args->addon_name);
|
||||
unset($args->body);
|
||||
unset($args->error_return_url);
|
||||
if(in_array($targetAddon, $fixed))
|
||||
{
|
||||
$args->fixed = 'Y';
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->fixed = 'N';
|
||||
}
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$args->addon = $targetAddon;
|
||||
$args->site_srl = $site_srl;
|
||||
|
||||
$output = $this->doSetup($addon_name, $args, $site_module_info->site_srl, 'site');
|
||||
if (!$output->toBool()) return $output;
|
||||
$output = executeQuery('addon.updateSiteAddon', $args);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$this->makeCacheFile($site_module_info->site_srl, "pc", 'site');
|
||||
$this->makeCacheFile($site_module_info->site_srl, "mobile", 'site');
|
||||
if(count($updateList))
|
||||
{
|
||||
$this->makeCacheFile($site_srl, 'pc', 'site');
|
||||
$this->makeCacheFile($site_srl, 'mobile', 'site');
|
||||
}
|
||||
|
||||
$this->setRedirectUrl(getNotEncodedUrl('', 'module', $module, 'act', 'dispAddonAdminSetup', 'selected_addon', $addon_name), $output);
|
||||
}
|
||||
$this->setMessage('success_updated', 'info');
|
||||
if(Context::get('success_return_url'))
|
||||
{
|
||||
$this->setRedirectUrl(Context::get('success_return_url'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAddonAdminIndex'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add active/inactive change
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAddonAdminToggleActivate()
|
||||
{
|
||||
$oAddonModel = getAdminModel('addon');
|
||||
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
// batahom addon values
|
||||
$addon = Context::get('addon');
|
||||
$type = Context::get('type');
|
||||
if(!$type)
|
||||
{
|
||||
$type = "pc";
|
||||
}
|
||||
if($addon)
|
||||
{
|
||||
// If enabled Disables
|
||||
if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type))
|
||||
{
|
||||
$this->doDeactivate($addon, $site_module_info->site_srl, $type);
|
||||
}
|
||||
// If it is disabled Activate
|
||||
else
|
||||
{
|
||||
$this->doActivate($addon, $site_module_info->site_srl, $type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds addon to DB
|
||||
*
|
||||
* @param string $addon Addon name
|
||||
* @param int $site_srl Site srl
|
||||
* @param string $gtype site or global
|
||||
* @param string $isUsed Whether to use
|
||||
* @return Object
|
||||
**/
|
||||
function doInsert($addon, $site_srl = 0, $gtype = 'site', $isUsed = 'N') {
|
||||
$args->addon = $addon;
|
||||
$args->is_used = $isUsed;
|
||||
if($gtype == 'global') return executeQuery('addon.insertAddon', $args);
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.insertSiteAddon', $args);
|
||||
}
|
||||
$this->makeCacheFile($site_module_info->site_srl, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate addon
|
||||
*
|
||||
* @param string $addon Addon name
|
||||
* @param int $site_srl Site srl
|
||||
* @param string $type pc or modile
|
||||
* @param string $gtype site or global
|
||||
* @return Object
|
||||
**/
|
||||
function doActivate($addon, $site_srl = 0, $type = "pc", $gtype = 'site') {
|
||||
$args->addon = $addon;
|
||||
if($type == "pc") $args->is_used = 'Y';
|
||||
else $args->is_used_m = "Y";
|
||||
if($gtype == 'global') return executeQuery('addon.updateAddon', $args);
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.updateSiteAddon', $args);
|
||||
}
|
||||
/**
|
||||
* Add the configuration information input
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
function procAddonAdminSetupAddon()
|
||||
{
|
||||
$args = Context::getRequestVars();
|
||||
$module = $args->module;
|
||||
$addon_name = $args->addon_name;
|
||||
unset($args->module);
|
||||
unset($args->act);
|
||||
unset($args->addon_name);
|
||||
unset($args->body);
|
||||
unset($args->error_return_url);
|
||||
|
||||
/**
|
||||
* Deactivate Addon
|
||||
*
|
||||
* @param string $addon Addon name
|
||||
* @param int $site_srl Site srl
|
||||
* @param string $type pc or mobile
|
||||
* @param string $gtype site or global
|
||||
**/
|
||||
function doDeactivate($addon, $site_srl = 0, $type = "pc", $gtype = 'site') {
|
||||
$args->addon = $addon;
|
||||
if($type == "pc") $args->is_used = 'N';
|
||||
else $args->is_used_m = 'N';
|
||||
if($gtype == 'global') return executeQuery('addon.updateAddon', $args);
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.updateSiteAddon', $args);
|
||||
}
|
||||
}
|
||||
?>
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
|
||||
$output = $this->doSetup($addon_name, $args, $site_module_info->site_srl, 'site');
|
||||
if(!$output->toBool())
|
||||
{
|
||||
return $output;
|
||||
}
|
||||
|
||||
$this->makeCacheFile($site_module_info->site_srl, "pc", 'site');
|
||||
$this->makeCacheFile($site_module_info->site_srl, "mobile", 'site');
|
||||
|
||||
$this->setRedirectUrl(getNotEncodedUrl('', 'module', $module, 'act', 'dispAddonAdminSetup', 'selected_addon', $addon_name), $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds addon to DB
|
||||
*
|
||||
* @param string $addon Addon name
|
||||
* @param int $site_srl Site srl
|
||||
* @param string $gtype site or global
|
||||
* @param string $isUsed Whether to use
|
||||
* @return Object
|
||||
*/
|
||||
function doInsert($addon, $site_srl = 0, $gtype = 'site', $isUsed = 'N')
|
||||
{
|
||||
$args->addon = $addon;
|
||||
$args->is_used = $isUsed;
|
||||
if($gtype == 'global')
|
||||
{
|
||||
return executeQuery('addon.insertAddon', $args);
|
||||
}
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.insertSiteAddon', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate addon
|
||||
*
|
||||
* @param string $addon Addon name
|
||||
* @param int $site_srl Site srl
|
||||
* @param string $type pc or modile
|
||||
* @param string $gtype site or global
|
||||
* @return Object
|
||||
*/
|
||||
function doActivate($addon, $site_srl = 0, $type = "pc", $gtype = 'site')
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->addon = $addon;
|
||||
if($type == "pc")
|
||||
{
|
||||
$args->is_used = 'Y';
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->is_used_m = "Y";
|
||||
}
|
||||
if($gtype == 'global')
|
||||
{
|
||||
return executeQuery('addon.updateAddon', $args);
|
||||
}
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.updateSiteAddon', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivate Addon
|
||||
*
|
||||
* @param string $addon Addon name
|
||||
* @param int $site_srl Site srl
|
||||
* @param string $type pc or mobile
|
||||
* @param string $gtype site or global
|
||||
*/
|
||||
function doDeactivate($addon, $site_srl = 0, $type = "pc", $gtype = 'site')
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args->addon = $addon;
|
||||
if($type == "pc")
|
||||
{
|
||||
$args->is_used = 'N';
|
||||
}
|
||||
else
|
||||
{
|
||||
$args->is_used_m = 'N';
|
||||
}
|
||||
if($gtype == 'global')
|
||||
{
|
||||
return executeQuery('addon.updateAddon', $args);
|
||||
}
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.updateSiteAddon', $args);
|
||||
}
|
||||
|
||||
}
|
||||
/* End of file addon.admin.controller.php */
|
||||
/* Location: ./modules/addon/addon.admin.controller.php */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue