mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 04:52:14 +09:00
issue 2119. supporting php 5.4. addon module.
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12707 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
8a7c28babc
commit
ee9247e866
4 changed files with 309 additions and 103 deletions
|
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin model class of addon module
|
* Admin model class of addon module
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
*/
|
*/
|
||||||
class addonAdminModel extends addon
|
class addonAdminModel extends addon
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization
|
* Initialization
|
||||||
*
|
*
|
||||||
|
|
@ -12,6 +14,7 @@ class addonAdminModel extends addon
|
||||||
*/
|
*/
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,7 +26,10 @@ class addonAdminModel extends addon
|
||||||
function getAddonPath($addon_name)
|
function getAddonPath($addon_name)
|
||||||
{
|
{
|
||||||
$class_path = sprintf('./addons/%s/', $addon_name);
|
$class_path = sprintf('./addons/%s/', $addon_name);
|
||||||
if(is_dir($class_path)) return $class_path;
|
if(is_dir($class_path))
|
||||||
|
{
|
||||||
|
return $class_path;
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,7 +42,7 @@ class addonAdminModel extends addon
|
||||||
{
|
{
|
||||||
$addonList = $this->getAddonList(0, 'site');
|
$addonList = $this->getAddonList(0, 'site');
|
||||||
|
|
||||||
$oAutoinstallModel = &getModel('autoinstall');
|
$oAutoinstallModel = getModel('autoinstall');
|
||||||
foreach($addonList as $key => $addon)
|
foreach($addonList as $key => $addon)
|
||||||
{
|
{
|
||||||
// get easyinstall remove url
|
// get easyinstall remove url
|
||||||
|
|
@ -69,18 +75,25 @@ class addonAdminModel extends addon
|
||||||
// Wanted to add a list of activated
|
// Wanted to add a list of activated
|
||||||
$inserted_addons = $this->getInsertedAddons($site_srl, $gtype);
|
$inserted_addons = $this->getInsertedAddons($site_srl, $gtype);
|
||||||
// Downloaded and installed add-on to the list of Wanted
|
// Downloaded and installed add-on to the list of Wanted
|
||||||
$searched_list = FileHandler::readDir('./addons','/^([a-zA-Z0-9-_]+)$/');
|
$searched_list = FileHandler::readDir('./addons', '/^([a-zA-Z0-9-_]+)$/');
|
||||||
$searched_count = count($searched_list);
|
$searched_count = count($searched_list);
|
||||||
if(!$searched_count) return;
|
if(!$searched_count)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
sort($searched_list);
|
sort($searched_list);
|
||||||
|
|
||||||
$oAddonAdminController = &getAdminController('addon');
|
$oAddonAdminController = getAdminController('addon');
|
||||||
|
|
||||||
for($i=0;$i<$searched_count;$i++)
|
for($i = 0; $i < $searched_count; $i++)
|
||||||
{
|
{
|
||||||
// Add the name of
|
// Add the name of
|
||||||
$addon_name = $searched_list[$i];
|
$addon_name = $searched_list[$i];
|
||||||
if($addon_name == "smartphone") continue;
|
if($addon_name == "smartphone")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Add the path (files/addons precedence)
|
// Add the path (files/addons precedence)
|
||||||
$path = $this->getAddonPath($addon_name);
|
$path = $this->getAddonPath($addon_name);
|
||||||
// Wanted information on the add-on
|
// Wanted information on the add-on
|
||||||
|
|
@ -89,9 +102,9 @@ class addonAdminModel extends addon
|
||||||
|
|
||||||
$info->addon = $addon_name;
|
$info->addon = $addon_name;
|
||||||
$info->path = $path;
|
$info->path = $path;
|
||||||
$info->activated = false;
|
$info->activated = FALSE;
|
||||||
$info->mactivated = false;
|
$info->mactivated = FALSE;
|
||||||
$info->fixed = false;
|
$info->fixed = FALSE;
|
||||||
// Check if a permossion is granted entered in DB
|
// Check if a permossion is granted entered in DB
|
||||||
if(!in_array($addon_name, array_keys($inserted_addons)))
|
if(!in_array($addon_name, array_keys($inserted_addons)))
|
||||||
{
|
{
|
||||||
|
|
@ -101,9 +114,18 @@ class addonAdminModel extends addon
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if($inserted_addons[$addon_name]->is_used=='Y') $info->activated = true;
|
if($inserted_addons[$addon_name]->is_used == 'Y')
|
||||||
if($inserted_addons[$addon_name]->is_used_m=='Y') $info->mactivated = true;
|
{
|
||||||
if ($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y') $info->fixed = true;
|
$info->activated = TRUE;
|
||||||
|
}
|
||||||
|
if($inserted_addons[$addon_name]->is_used_m == 'Y')
|
||||||
|
{
|
||||||
|
$info->mactivated = TRUE;
|
||||||
|
}
|
||||||
|
if($gtype == 'global' && $inserted_addons[$addon_name]->is_fixed == 'Y')
|
||||||
|
{
|
||||||
|
$info->fixed = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$list[] = $info;
|
$list[] = $info;
|
||||||
|
|
@ -123,25 +145,38 @@ class addonAdminModel extends addon
|
||||||
{
|
{
|
||||||
// Get a path of the requested module. Return if not exists.
|
// Get a path of the requested module. Return if not exists.
|
||||||
$addon_path = $this->getAddonPath($addon);
|
$addon_path = $this->getAddonPath($addon);
|
||||||
if(!$addon_path) return;
|
if(!$addon_path)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Read the xml file for module skin information
|
// Read the xml file for module skin information
|
||||||
$xml_file = sprintf("%sconf/info.xml", $addon_path);
|
$xml_file = sprintf("%sconf/info.xml", $addon_path);
|
||||||
if(!file_exists($xml_file)) return;
|
if(!file_exists($xml_file))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$oXmlParser = new XmlParser();
|
$oXmlParser = new XmlParser();
|
||||||
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
|
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
|
||||||
$xml_obj = $tmp_xml_obj->addon;
|
$xml_obj = $tmp_xml_obj->addon;
|
||||||
|
|
||||||
if(!$xml_obj) return;
|
if(!$xml_obj)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// DB is set to bring history
|
// DB is set to bring history
|
||||||
$db_args = new stdClass();
|
$db_args = new stdClass();
|
||||||
$db_args->addon = $addon;
|
$db_args->addon = $addon;
|
||||||
if($gtype == 'global') $output = executeQuery('addon.getAddonInfo',$db_args);
|
if($gtype == 'global')
|
||||||
|
{
|
||||||
|
$output = executeQuery('addon.getAddonInfo', $db_args);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db_args->site_srl = $site_srl;
|
$db_args->site_srl = $site_srl;
|
||||||
$output = executeQuery('addon.getSiteAddonInfo',$db_args);
|
$output = executeQuery('addon.getSiteAddonInfo', $db_args);
|
||||||
}
|
}
|
||||||
$extra_vals = unserialize($output->data->extra_vars);
|
$extra_vals = unserialize($output->data->extra_vars);
|
||||||
|
|
||||||
|
|
@ -164,6 +199,7 @@ class addonAdminModel extends addon
|
||||||
if($xml_obj->version && $xml_obj->attrs->version == '0.2')
|
if($xml_obj->version && $xml_obj->attrs->version == '0.2')
|
||||||
{
|
{
|
||||||
// addon format v0.2
|
// addon format v0.2
|
||||||
|
$date_obj = new stdClass();
|
||||||
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
$addon_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
$addon_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
|
|
||||||
|
|
@ -175,9 +211,17 @@ class addonAdminModel extends addon
|
||||||
$addon_info->license = $xml_obj->license->body;
|
$addon_info->license = $xml_obj->license->body;
|
||||||
$addon_info->license_link = $xml_obj->license->attrs->link;
|
$addon_info->license_link = $xml_obj->license->attrs->link;
|
||||||
|
|
||||||
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
|
if(!is_array($xml_obj->author))
|
||||||
else $author_list = $xml_obj->author;
|
{
|
||||||
|
$author_list = array();
|
||||||
|
$author_list[] = $xml_obj->author;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$author_list = $xml_obj->author;
|
||||||
|
}
|
||||||
|
|
||||||
|
$addon_info->author = array();
|
||||||
foreach($author_list as $author)
|
foreach($author_list as $author)
|
||||||
{
|
{
|
||||||
$author_obj = new stdClass();
|
$author_obj = new stdClass();
|
||||||
|
|
@ -191,18 +235,30 @@ class addonAdminModel extends addon
|
||||||
if($xml_obj->extra_vars)
|
if($xml_obj->extra_vars)
|
||||||
{
|
{
|
||||||
$extra_var_groups = $xml_obj->extra_vars->group;
|
$extra_var_groups = $xml_obj->extra_vars->group;
|
||||||
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
if(!$extra_var_groups)
|
||||||
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
{
|
||||||
|
$extra_var_groups = $xml_obj->extra_vars;
|
||||||
|
}
|
||||||
|
if(!is_array($extra_var_groups))
|
||||||
|
{
|
||||||
|
$extra_var_groups = array($extra_var_groups);
|
||||||
|
}
|
||||||
|
|
||||||
foreach($extra_var_groups as $group)
|
foreach($extra_var_groups as $group)
|
||||||
{
|
{
|
||||||
$extra_vars = $group->var;
|
$extra_vars = $group->var;
|
||||||
if(!is_array($group->var)) $extra_vars = array($group->var);
|
if(!is_array($group->var))
|
||||||
|
{
|
||||||
|
$extra_vars = array($group->var);
|
||||||
|
}
|
||||||
|
|
||||||
foreach($extra_vars as $key => $val)
|
foreach($extra_vars as $key => $val)
|
||||||
{
|
{
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
if(!$val->attrs->type) { $val->attrs->type = 'text'; }
|
if(!$val->attrs->type)
|
||||||
|
{
|
||||||
|
$val->attrs->type = 'text';
|
||||||
|
}
|
||||||
|
|
||||||
$obj->group = $group->title->body;
|
$obj->group = $group->title->body;
|
||||||
$obj->name = $val->attrs->name;
|
$obj->name = $val->attrs->name;
|
||||||
|
|
@ -213,8 +269,14 @@ class addonAdminModel extends addon
|
||||||
{
|
{
|
||||||
$obj->value = $extra_vals->{$obj->name};
|
$obj->value = $extra_vals->{$obj->name};
|
||||||
}
|
}
|
||||||
if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
|
if(strpos($obj->value, '|@|') != FALSE)
|
||||||
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
|
{
|
||||||
|
$obj->value = explode('|@|', $obj->value);
|
||||||
|
}
|
||||||
|
if($obj->type == 'mid_list' && !is_array($obj->value))
|
||||||
|
{
|
||||||
|
$obj->value = array($obj->value);
|
||||||
|
}
|
||||||
|
|
||||||
// 'Select'type obtained from the option list.
|
// 'Select'type obtained from the option list.
|
||||||
if($val->options && !is_array($val->options))
|
if($val->options && !is_array($val->options))
|
||||||
|
|
@ -237,17 +299,34 @@ class addonAdminModel extends addon
|
||||||
// history
|
// history
|
||||||
if($xml_obj->history)
|
if($xml_obj->history)
|
||||||
{
|
{
|
||||||
if(!is_array($xml_obj->history)) $history[] = $xml_obj->history;
|
if(!is_array($xml_obj->history))
|
||||||
else $history = $xml_obj->history;
|
{
|
||||||
|
$history = array();
|
||||||
|
$history[] = $xml_obj->history;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$history = $xml_obj->history;
|
||||||
|
}
|
||||||
|
|
||||||
|
$addon_info->history = array();
|
||||||
foreach($history as $item)
|
foreach($history as $item)
|
||||||
{
|
{
|
||||||
unset($obj);
|
$obj = new stdClass();
|
||||||
|
|
||||||
if($item->author)
|
if($item->author)
|
||||||
{
|
{
|
||||||
(!is_array($item->author)) ? $obj->author_list[] = $item->author : $obj->author_list = $item->author;
|
if(!is_array($item->author))
|
||||||
|
{
|
||||||
|
$obj->author_list = array();
|
||||||
|
$obj->author_list[] = $item->author;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$obj->author_list = $item->author;
|
||||||
|
}
|
||||||
|
|
||||||
|
$obj->author = array();
|
||||||
foreach($obj->author_list as $author)
|
foreach($obj->author_list as $author)
|
||||||
{
|
{
|
||||||
$author_obj = new stdClass();
|
$author_obj = new stdClass();
|
||||||
|
|
@ -267,8 +346,17 @@ class addonAdminModel extends addon
|
||||||
|
|
||||||
if($item->log)
|
if($item->log)
|
||||||
{
|
{
|
||||||
(!is_array($item->log)) ? $obj->log[] = $item->log : $obj->log = $item->log;
|
if(!is_array($item->log))
|
||||||
|
{
|
||||||
|
$obj->log = array();
|
||||||
|
$obj->log[] = $item->log;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$obj->log = $item->log;
|
||||||
|
}
|
||||||
|
|
||||||
|
$obj->logs = array();
|
||||||
foreach($obj->log as $log)
|
foreach($obj->log as $log)
|
||||||
{
|
{
|
||||||
$log_obj = new stdClass();
|
$log_obj = new stdClass();
|
||||||
|
|
@ -284,31 +372,44 @@ class addonAdminModel extends addon
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// addon format 0.1
|
// addon format 0.1
|
||||||
|
$addon_info = new stdClass();
|
||||||
$addon_info->addon_name = $addon;
|
$addon_info->addon_name = $addon;
|
||||||
$addon_info->title = $xml_obj->title->body;
|
$addon_info->title = $xml_obj->title->body;
|
||||||
$addon_info->description = trim($xml_obj->author->description->body);
|
$addon_info->description = trim($xml_obj->author->description->body);
|
||||||
$addon_info->version = $xml_obj->attrs->version;
|
$addon_info->version = $xml_obj->attrs->version;
|
||||||
|
$date_obj = new stdClass();
|
||||||
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
|
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
$addon_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
$addon_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
|
||||||
$author_obj->name = $xml_obj->author->name->body;
|
$author_obj->name = $xml_obj->author->name->body;
|
||||||
$author_obj->email_address = $xml_obj->author->attrs->email_address;
|
$author_obj->email_address = $xml_obj->author->attrs->email_address;
|
||||||
$author_obj->homepage = $xml_obj->author->attrs->link;
|
$author_obj->homepage = $xml_obj->author->attrs->link;
|
||||||
|
$addon_info->author = array();
|
||||||
$addon_info->author[] = $author_obj;
|
$addon_info->author[] = $author_obj;
|
||||||
|
|
||||||
if($xml_obj->extra_vars)
|
if($xml_obj->extra_vars)
|
||||||
{
|
{
|
||||||
// Expand the variable order
|
// Expand the variable order
|
||||||
$extra_var_groups = $xml_obj->extra_vars->group;
|
$extra_var_groups = $xml_obj->extra_vars->group;
|
||||||
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
if(!$extra_var_groups)
|
||||||
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
{
|
||||||
|
$extra_var_groups = $xml_obj->extra_vars;
|
||||||
|
}
|
||||||
|
if(!is_array($extra_var_groups))
|
||||||
|
{
|
||||||
|
$extra_var_groups = array($extra_var_groups);
|
||||||
|
}
|
||||||
foreach($extra_var_groups as $group)
|
foreach($extra_var_groups as $group)
|
||||||
{
|
{
|
||||||
$extra_vars = $group->var;
|
$extra_vars = $group->var;
|
||||||
if(!is_array($group->var)) $extra_vars = array($group->var);
|
if(!is_array($group->var))
|
||||||
|
{
|
||||||
|
$extra_vars = array($group->var);
|
||||||
|
}
|
||||||
|
|
||||||
|
$addon_info->extra_vars = array();
|
||||||
foreach($extra_vars as $key => $val)
|
foreach($extra_vars as $key => $val)
|
||||||
{
|
{
|
||||||
unset($obj);
|
$obj = new stdClass();
|
||||||
|
|
||||||
$obj->group = $group->title->body;
|
$obj->group = $group->title->body;
|
||||||
$obj->name = $val->attrs->name;
|
$obj->name = $val->attrs->name;
|
||||||
|
|
@ -319,14 +420,21 @@ class addonAdminModel extends addon
|
||||||
{
|
{
|
||||||
$obj->value = $extra_vals->{$obj->name};
|
$obj->value = $extra_vals->{$obj->name};
|
||||||
}
|
}
|
||||||
if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
|
if(strpos($obj->value, '|@|') != false)
|
||||||
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
|
{
|
||||||
|
$obj->value = explode('|@|', $obj->value);
|
||||||
|
}
|
||||||
|
if($obj->type == 'mid_list' && !is_array($obj->value))
|
||||||
|
{
|
||||||
|
$obj->value = array($obj->value);
|
||||||
|
}
|
||||||
// 'Select'type obtained from the option list.
|
// 'Select'type obtained from the option list.
|
||||||
if($val->options && !is_array($val->options))
|
if($val->options && !is_array($val->options))
|
||||||
{
|
{
|
||||||
$val->options = array($val->options);
|
$val->options = array($val->options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$obj->options = array();
|
||||||
for($i = 0, $c = count($val->options); $i < $c; $i++)
|
for($i = 0, $c = count($val->options); $i < $c; $i++)
|
||||||
{
|
{
|
||||||
$obj->options[$i]->title = $val->options[$i]->title->body;
|
$obj->options[$i]->title = $val->options[$i]->title->body;
|
||||||
|
|
@ -351,17 +459,23 @@ class addonAdminModel extends addon
|
||||||
{
|
{
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->list_order = 'addon';
|
$args->list_order = 'addon';
|
||||||
if($gtype == 'global') $output = executeQuery('addon.getAddons', $args);
|
if($gtype == 'global')
|
||||||
|
{
|
||||||
|
$output = executeQueryArray('addon.getAddons', $args);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
$output = executeQuery('addon.getSiteAddons', $args);
|
$output = executeQueryArray('addon.getSiteAddons', $args);
|
||||||
|
}
|
||||||
|
if(!$output->data)
|
||||||
|
{
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
if(!$output->data) return array();
|
|
||||||
if(!is_array($output->data)) $output->data = array($output->data);
|
|
||||||
|
|
||||||
$activated_count = count($output->data);
|
$activated_count = count($output->data);
|
||||||
for($i=0;$i<$activated_count;$i++)
|
$addon_list = array();
|
||||||
|
for($i = 0; $i < $activated_count; $i++)
|
||||||
{
|
{
|
||||||
$addon = $output->data[$i];
|
$addon = $output->data[$i];
|
||||||
$addon_list[$addon->addon] = $addon;
|
$addon_list[$addon->addon] = $addon;
|
||||||
|
|
@ -380,21 +494,38 @@ class addonAdminModel extends addon
|
||||||
*/
|
*/
|
||||||
function isActivatedAddon($addon, $site_srl = 0, $type = "pc", $gtype = 'site')
|
function isActivatedAddon($addon, $site_srl = 0, $type = "pc", $gtype = 'site')
|
||||||
{
|
{
|
||||||
|
$args = new stdClass();
|
||||||
$args->addon = $addon;
|
$args->addon = $addon;
|
||||||
if($gtype == 'global')
|
if($gtype == 'global')
|
||||||
{
|
{
|
||||||
if($type == "pc") $output = executeQuery('addon.getAddonIsActivated', $args);
|
if($type == "pc")
|
||||||
else $output = executeQuery('addon.getMAddonIsActivated', $args);
|
{
|
||||||
|
$output = executeQuery('addon.getAddonIsActivated', $args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$output = executeQuery('addon.getMAddonIsActivated', $args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
if($type == "pc") $output = executeQuery('addon.getSiteAddonIsActivated', $args);
|
if($type == "pc")
|
||||||
else $output = executeQuery('addon.getSiteMAddonIsActivated', $args);
|
{
|
||||||
|
$output = executeQuery('addon.getSiteAddonIsActivated', $args);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$output = executeQuery('addon.getSiteMAddonIsActivated', $args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if($output->data->count>0) return true;
|
if($output->data->count > 0)
|
||||||
return false;
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* End of file addon.admin.model.php */
|
/* End of file addon.admin.model.php */
|
||||||
/* Location: ./modules/addon/addon.admin.model.php */
|
/* Location: ./modules/addon/addon.admin.model.php */
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Admin view class of addon modules
|
* Admin view class of addon modules
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
*/
|
*/
|
||||||
class addonAdminView extends addon
|
class addonAdminView extends addon
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization
|
* Initialization
|
||||||
*
|
*
|
||||||
|
|
@ -12,7 +14,7 @@ class addonAdminView extends addon
|
||||||
*/
|
*/
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path . 'tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,10 +24,10 @@ class addonAdminView extends addon
|
||||||
*/
|
*/
|
||||||
function dispAddonAdminIndex()
|
function dispAddonAdminIndex()
|
||||||
{
|
{
|
||||||
$oAdminModel = &getAdminModel('admin');
|
$oAdminModel = getAdminModel('admin');
|
||||||
|
|
||||||
// Add to the list settings
|
// Add to the list settings
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = getAdminModel('addon');
|
||||||
$addon_list = $oAddonModel->getAddonListForSuperAdmin();
|
$addon_list = $oAddonModel->getAddonListForSuperAdmin();
|
||||||
|
|
||||||
$security = new Security($addon_list);
|
$security = new Security($addon_list);
|
||||||
|
|
@ -53,14 +55,18 @@ class addonAdminView extends addon
|
||||||
// Wanted to add the requested
|
// Wanted to add the requested
|
||||||
$selected_addon = Context::get('selected_addon');
|
$selected_addon = Context::get('selected_addon');
|
||||||
// Wanted to add the requested information
|
// Wanted to add the requested information
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = getAdminModel('addon');
|
||||||
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl, 'site');
|
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl, 'site');
|
||||||
Context::set('addon_info', $addon_info);
|
Context::set('addon_info', $addon_info);
|
||||||
// Get a mid list
|
// Get a mid list
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = getModel('module');
|
||||||
$oModuleAdminModel = &getAdminModel('module');
|
$oModuleAdminModel = getAdminModel('module');
|
||||||
|
|
||||||
if($site_module_info->site_srl) $args->site_srl = $site_module_info->site_srl;
|
$args = new stdClass();
|
||||||
|
if($site_module_info->site_srl)
|
||||||
|
{
|
||||||
|
$args->site_srl = $site_module_info->site_srl;
|
||||||
|
}
|
||||||
$columnList = array('module_srl', 'module_category_srl', 'mid', 'browser_title');
|
$columnList = array('module_srl', 'module_category_srl', 'mid', 'browser_title');
|
||||||
$mid_list = $oModuleModel->getMidList($args, $columnList);
|
$mid_list = $oModuleModel->getMidList($args, $columnList);
|
||||||
// module_category and module combination
|
// module_category and module combination
|
||||||
|
|
@ -79,10 +85,12 @@ class addonAdminView extends addon
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$module_categories = array();
|
||||||
|
$module_categories[0] = new stdClass();
|
||||||
$module_categories[0]->list = $mid_list;
|
$module_categories[0]->list = $mid_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('mid_list',$module_categories);
|
Context::set('mid_list', $module_categories);
|
||||||
|
|
||||||
// Template specifies the path and file
|
// Template specifies the path and file
|
||||||
$this->setTemplateFile('setup_addon');
|
$this->setTemplateFile('setup_addon');
|
||||||
|
|
@ -108,7 +116,7 @@ class addonAdminView extends addon
|
||||||
// Wanted to add the requested
|
// Wanted to add the requested
|
||||||
$selected_addon = Context::get('selected_addon');
|
$selected_addon = Context::get('selected_addon');
|
||||||
// Wanted to add the requested information
|
// Wanted to add the requested information
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = getAdminModel('addon');
|
||||||
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
|
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
|
||||||
Context::set('addon_info', $addon_info);
|
Context::set('addon_info', $addon_info);
|
||||||
// Set the layout to be pop-up
|
// Set the layout to be pop-up
|
||||||
|
|
@ -119,6 +127,7 @@ class addonAdminView extends addon
|
||||||
$security = new Security();
|
$security = new Security();
|
||||||
$security->encodeHTML('addon_info.', 'addon_info.author..');
|
$security->encodeHTML('addon_info.', 'addon_info.author..');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* End of file addon.admin.view.php */
|
/* End of file addon.admin.view.php */
|
||||||
/* Location: ./modules/addon/addon.admin.view.php */
|
/* Location: ./modules/addon/addon.admin.view.php */
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* High class of addon modules
|
* High class of addon modules
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
*/
|
*/
|
||||||
class addon extends ModuleObject
|
class addon extends ModuleObject
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement if additional tasks are necessary when installing
|
* Implement if additional tasks are necessary when installing
|
||||||
*
|
*
|
||||||
|
|
@ -13,7 +15,7 @@ class addon extends ModuleObject
|
||||||
function moduleInstall()
|
function moduleInstall()
|
||||||
{
|
{
|
||||||
// Register to add a few
|
// Register to add a few
|
||||||
$oAddonController = &getAdminController('addon');
|
$oAddonController = getAdminController('addon');
|
||||||
$oAddonController->doInsert('autolink', 0, 'site', 'Y');
|
$oAddonController->doInsert('autolink', 0, 'site', 'Y');
|
||||||
$oAddonController->doInsert('blogapi');
|
$oAddonController->doInsert('blogapi');
|
||||||
$oAddonController->doInsert('counter', 0, 'site', 'Y');
|
$oAddonController->doInsert('counter', 0, 'site', 'Y');
|
||||||
|
|
@ -35,14 +37,23 @@ class addon extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function checkUpdate()
|
function checkUpdate()
|
||||||
{
|
{
|
||||||
$oDB = &DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
if(!$oDB->isColumnExists("addons", "is_used_m")) return true;
|
if(!$oDB->isColumnExists("addons", "is_used_m"))
|
||||||
if(!$oDB->isColumnExists("addons_site", "is_used_m")) return true;
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
if(!$oDB->isColumnExists("addons_site", "is_used_m"))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// 2011. 7. 29. add is_fixed column
|
// 2011. 7. 29. add is_fixed column
|
||||||
if(!$oDB->isColumnExists('addons', 'is_fixed')) return true;
|
if(!$oDB->isColumnExists('addons', 'is_fixed'))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -52,20 +63,20 @@ class addon extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function moduleUpdate()
|
function moduleUpdate()
|
||||||
{
|
{
|
||||||
$oDB = &DB::getInstance();
|
$oDB = DB::getInstance();
|
||||||
if(!$oDB->isColumnExists("addons", "is_used_m"))
|
if(!$oDB->isColumnExists("addons", "is_used_m"))
|
||||||
{
|
{
|
||||||
$oDB->addColumn("addons", "is_used_m", "char", 1, "N", true);
|
$oDB->addColumn("addons", "is_used_m", "char", 1, "N", TRUE);
|
||||||
}
|
}
|
||||||
if(!$oDB->isColumnExists("addons_site", "is_used_m"))
|
if(!$oDB->isColumnExists("addons_site", "is_used_m"))
|
||||||
{
|
{
|
||||||
$oDB->addColumn("addons_site", "is_used_m", "char", 1, "N", true);
|
$oDB->addColumn("addons_site", "is_used_m", "char", 1, "N", TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2011. 7. 29. add is_fixed column
|
// 2011. 7. 29. add is_fixed column
|
||||||
if(!$oDB->isColumnExists('addons', 'is_fixed'))
|
if(!$oDB->isColumnExists('addons', 'is_fixed'))
|
||||||
{
|
{
|
||||||
$oDB->addColumn('addons', 'is_fixed', 'char', 1, 'N', true);
|
$oDB->addColumn('addons', 'is_fixed', 'char', 1, 'N', TRUE);
|
||||||
|
|
||||||
// move addon info to addon_site table
|
// move addon info to addon_site table
|
||||||
$output = executeQueryArray('addon.getAddons');
|
$output = executeQueryArray('addon.getAddons');
|
||||||
|
|
@ -73,6 +84,7 @@ class addon extends ModuleObject
|
||||||
{
|
{
|
||||||
foreach($output->data as $row)
|
foreach($output->data as $row)
|
||||||
{
|
{
|
||||||
|
$args = new stdClass();
|
||||||
$args->site_srl = 0;
|
$args->site_srl = 0;
|
||||||
$args->addon = $row->addon;
|
$args->addon = $row->addon;
|
||||||
$args->is_used = $row->is_used;
|
$args->is_used = $row->is_used;
|
||||||
|
|
@ -93,6 +105,7 @@ class addon extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function recompileCache()
|
function recompileCache()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Addon module's controller class
|
* Addon module's controller class
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
*/
|
*/
|
||||||
class addonController extends addon
|
class addonController extends addon
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialization
|
* Initialization
|
||||||
*
|
*
|
||||||
|
|
@ -12,6 +14,7 @@ class addonController extends addon
|
||||||
*/
|
*/
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,20 +26,34 @@ class addonController extends addon
|
||||||
function getCacheFilePath($type = "pc")
|
function getCacheFilePath($type = "pc")
|
||||||
{
|
{
|
||||||
static $addon_file;
|
static $addon_file;
|
||||||
if(isset($addon_file)) return $addon_file;
|
if(isset($addon_file))
|
||||||
|
{
|
||||||
|
return $addon_file;
|
||||||
|
}
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$site_srl = $site_module_info->site_srl;
|
$site_srl = $site_module_info->site_srl;
|
||||||
|
|
||||||
$addon_path = _XE_PATH_.'files/cache/addons/';
|
$addon_path = _XE_PATH_ . 'files/cache/addons/';
|
||||||
|
|
||||||
$addon_file = $addon_path.$site_srl.$type.'.acivated_addons.cache.php';
|
$addon_file = $addon_path . $site_srl . $type . '.acivated_addons.cache.php';
|
||||||
|
|
||||||
if($this->addon_file_called) return $addon_file;
|
if($this->addon_file_called)
|
||||||
$this->addon_file_called = true;
|
{
|
||||||
|
return $addon_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addon_file_called = TRUE;
|
||||||
|
|
||||||
|
if(!is_dir($addon_path))
|
||||||
|
{
|
||||||
|
FileHandler::makeDir($addon_path);
|
||||||
|
}
|
||||||
|
if(!file_exists($addon_file))
|
||||||
|
{
|
||||||
|
$this->makeCacheFile($site_srl, $type);
|
||||||
|
}
|
||||||
|
|
||||||
if(!is_dir($addon_path)) FileHandler::makeDir($addon_path);
|
|
||||||
if(!file_exists($addon_file)) $this->makeCacheFile($site_srl, $type);
|
|
||||||
return $addon_file;
|
return $addon_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,7 +66,7 @@ class addonController extends addon
|
||||||
*/
|
*/
|
||||||
function _getMidList($selected_addon, $site_srl = 0)
|
function _getMidList($selected_addon, $site_srl = 0)
|
||||||
{
|
{
|
||||||
$oAddonAdminModel = &getAdminModel('addon');
|
$oAddonAdminModel = getAdminModel('addon');
|
||||||
$addon_info = $oAddonAdminModel->getAddonInfoXml($selected_addon, $site_srl);
|
$addon_info = $oAddonAdminModel->getAddonInfoXml($selected_addon, $site_srl);
|
||||||
return $addon_info->mid_list;
|
return $addon_info->mid_list;
|
||||||
}
|
}
|
||||||
|
|
@ -62,14 +79,14 @@ class addonController extends addon
|
||||||
* @param int $site_srl Site srl
|
* @param int $site_srl Site srl
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _setAddMid($selected_addon,$mid, $site_srl=0)
|
function _setAddMid($selected_addon, $mid, $site_srl = 0)
|
||||||
{
|
{
|
||||||
// Wanted to add the requested information
|
// Wanted to add the requested information
|
||||||
$mid_list = $this->_getMidList($selected_addon, $site_srl);
|
$mid_list = $this->_getMidList($selected_addon, $site_srl);
|
||||||
|
|
||||||
$mid_list[] = $mid;
|
$mid_list[] = $mid;
|
||||||
$new_mid_list = array_unique($mid_list);
|
$new_mid_list = array_unique($mid_list);
|
||||||
$this->_setMid($selected_addon,$new_mid_list, $site_srl);
|
$this->_setMid($selected_addon, $new_mid_list, $site_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -80,17 +97,20 @@ class addonController extends addon
|
||||||
* @param int $site_srl Site srl
|
* @param int $site_srl Site srl
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _setDelMid($selected_addon,$mid,$site_srl=0)
|
function _setDelMid($selected_addon, $mid, $site_srl = 0)
|
||||||
{
|
{
|
||||||
// Wanted to add the requested information
|
// Wanted to add the requested information
|
||||||
$mid_list = $this->_getMidList($selected_addon,$site_srl);
|
$mid_list = $this->_getMidList($selected_addon, $site_srl);
|
||||||
|
|
||||||
$new_mid_list = array();
|
$new_mid_list = array();
|
||||||
if(is_array($mid_list))
|
if(is_array($mid_list))
|
||||||
{
|
{
|
||||||
for($i=0,$c=count($mid_list);$i<$c;$i++)
|
for($i = 0, $c = count($mid_list); $i < $c; $i++)
|
||||||
{
|
{
|
||||||
if($mid_list[$i] != $mid) $new_mid_list[] = $mid_list[$i];
|
if($mid_list[$i] != $mid)
|
||||||
|
{
|
||||||
|
$new_mid_list[] = $mid_list[$i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -98,7 +118,7 @@ class addonController extends addon
|
||||||
$new_mid_list[] = $mid;
|
$new_mid_list[] = $mid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_setMid($selected_addon,$new_mid_list,$site_srl);
|
$this->_setMid($selected_addon, $new_mid_list, $site_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -109,10 +129,10 @@ class addonController extends addon
|
||||||
* @param int $site_srl Site srl
|
* @param int $site_srl Site srl
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function _setMid($selected_addon,$mid_list,$site_srl=0)
|
function _setMid($selected_addon, $mid_list, $site_srl = 0)
|
||||||
{
|
{
|
||||||
$args->mid_list = join('|@|',$mid_list);
|
$args->mid_list = join('|@|', $mid_list);
|
||||||
$this->doSetup($selected_addon, $args,$site_srl);
|
$this->doSetup($selected_addon, $args, $site_srl);
|
||||||
$this->makeCacheFile($site_srl);
|
$this->makeCacheFile($site_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +148,7 @@ class addonController extends addon
|
||||||
$args = Context::getRequestVars();
|
$args = Context::getRequestVars();
|
||||||
$addon_name = $args->addon_name;
|
$addon_name = $args->addon_name;
|
||||||
$mid = $args->mid;
|
$mid = $args->mid;
|
||||||
$this->_setAddMid($addon_name,$mid,$site_module_info->site_srl);
|
$this->_setAddMid($addon_name, $mid, $site_module_info->site_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -144,7 +164,7 @@ class addonController extends addon
|
||||||
$addon_name = $args->addon_name;
|
$addon_name = $args->addon_name;
|
||||||
$mid = $args->mid;
|
$mid = $args->mid;
|
||||||
|
|
||||||
$this->_setDelMid($addon_name,$mid,$site_module_info->site_srl);
|
$this->_setDelMid($addon_name, $mid, $site_module_info->site_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -158,18 +178,30 @@ class addonController extends addon
|
||||||
function makeCacheFile($site_srl = 0, $type = "pc", $gtype = 'site')
|
function makeCacheFile($site_srl = 0, $type = "pc", $gtype = 'site')
|
||||||
{
|
{
|
||||||
// Add-on module for use in creating the cache file
|
// Add-on module for use in creating the cache file
|
||||||
$buff = "";
|
$buff = '';
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = getAdminModel('addon');
|
||||||
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype);
|
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype);
|
||||||
foreach($addon_list as $addon => $val)
|
foreach($addon_list as $addon => $val)
|
||||||
{
|
{
|
||||||
if($val->addon == "smartphone") continue;
|
if($val->addon == "smartphone")
|
||||||
if(!is_dir(_XE_PATH_.'addons/'.$addon)) continue;
|
{
|
||||||
if(($type == "pc" && $val->is_used != 'Y') || ($type == "mobile" && $val->is_used_m != 'Y') || ($gtype == 'global' && $val->is_fixed != 'Y')) continue;
|
continue;
|
||||||
|
}
|
||||||
|
if(!is_dir(_XE_PATH_ . 'addons/' . $addon))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(($type == "pc" && $val->is_used != 'Y') || ($type == "mobile" && $val->is_used_m != 'Y') || ($gtype == 'global' && $val->is_fixed != 'Y'))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$extra_vars = unserialize($val->extra_vars);
|
$extra_vars = unserialize($val->extra_vars);
|
||||||
$mid_list = $extra_vars->mid_list;
|
$mid_list = $extra_vars->mid_list;
|
||||||
if(!is_array($mid_list)||!count($mid_list)) $mid_list = null;
|
if(!is_array($mid_list) || !count($mid_list))
|
||||||
|
{
|
||||||
|
$mid_list = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
$buff .= '$rm = \'' . $extra_vars->xe_run_method . "';";
|
$buff .= '$rm = \'' . $extra_vars->xe_run_method . "';";
|
||||||
$buff .= '$ml = array(';
|
$buff .= '$ml = array(';
|
||||||
|
|
@ -202,11 +234,20 @@ class addonController extends addon
|
||||||
|
|
||||||
$buff = sprintf('<?php if(!defined("__XE__")) exit(); $_m = Context::get(\'mid\'); %s ?>', $buff);
|
$buff = sprintf('<?php if(!defined("__XE__")) exit(); $_m = Context::get(\'mid\'); %s ?>', $buff);
|
||||||
|
|
||||||
$addon_path = _XE_PATH_.'files/cache/addons/';
|
$addon_path = _XE_PATH_ . 'files/cache/addons/';
|
||||||
if(!is_dir($addon_path)) FileHandler::makeDir($addon_path);
|
if(!is_dir($addon_path))
|
||||||
|
{
|
||||||
|
FileHandler::makeDir($addon_path);
|
||||||
|
}
|
||||||
|
|
||||||
if($gtype == 'site') $addon_file = $addon_path.$site_srl.$type.'.acivated_addons.cache.php';
|
if($gtype == 'site')
|
||||||
else $addon_file = $addon_path.$type.'.acivated_addons.cache.php';
|
{
|
||||||
|
$addon_file = $addon_path . $site_srl . $type . '.acivated_addons.cache.php';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$addon_file = $addon_path . $type . '.acivated_addons.cache.php';
|
||||||
|
}
|
||||||
|
|
||||||
FileHandler::writeFile($addon_file, $buff);
|
FileHandler::writeFile($addon_file, $buff);
|
||||||
}
|
}
|
||||||
|
|
@ -220,13 +261,20 @@ class addonController extends addon
|
||||||
* @param string $gtype site or global
|
* @param string $gtype site or global
|
||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
function doSetup($addon, $extra_vars,$site_srl=0, $gtype = 'site')
|
function doSetup($addon, $extra_vars, $site_srl = 0, $gtype = 'site')
|
||||||
{
|
{
|
||||||
if(!is_array($extra_vars->mid_list)) unset($extra_vars->mid_list);
|
if(!is_array($extra_vars->mid_list))
|
||||||
|
{
|
||||||
|
unset($extra_vars->mid_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
$args = new stdClass();
|
||||||
$args->addon = $addon;
|
$args->addon = $addon;
|
||||||
$args->extra_vars = serialize($extra_vars);
|
$args->extra_vars = serialize($extra_vars);
|
||||||
if($gtype == 'global') return executeQuery('addon.updateAddon', $args);
|
if($gtype == 'global')
|
||||||
|
{
|
||||||
|
return executeQuery('addon.updateAddon', $args);
|
||||||
|
}
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
return executeQuery('addon.updateSiteAddon', $args);
|
return executeQuery('addon.updateSiteAddon', $args);
|
||||||
}
|
}
|
||||||
|
|
@ -239,13 +287,18 @@ class addonController extends addon
|
||||||
*/
|
*/
|
||||||
function removeAddonConfig($site_srl)
|
function removeAddonConfig($site_srl)
|
||||||
{
|
{
|
||||||
$addon_path = _XE_PATH_.'files/cache/addons/';
|
$addon_path = _XE_PATH_ . 'files/cache/addons/';
|
||||||
$addon_file = $addon_path.$site_srl.'.acivated_addons.cache.php';
|
$addon_file = $addon_path . $site_srl . '.acivated_addons.cache.php';
|
||||||
if(file_exists($addon_file)) FileHandler::removeFile($addon_file);
|
if(file_exists($addon_file))
|
||||||
|
{
|
||||||
|
FileHandler::removeFile($addon_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
$args = new stdClass();
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
executeQuery('addon.deleteSiteAddons', $args);
|
executeQuery('addon.deleteSiteAddons', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* End of file addon.controller.php */
|
/* End of file addon.controller.php */
|
||||||
/* Location: ./modules/addon/addon.controller.php */
|
/* Location: ./modules/addon/addon.controller.php */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue