aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-12-24 18:03:30 +0000
committerplegall <plg@piwigo.org>2010-12-24 18:03:30 +0000
commit2f90ae92512d409e275d786177649c50af5d6e18 (patch)
tree7a218ea7e54c48b0a0f45c66453b72ba9affbb4a /include
parentd9545c00f75e8ccdc633ed6cbaff2f97efaf0dc2 (diff)
feature 2085 added: new method pwg.themes.performAction
git-svn-id: http://piwigo.org/svn/trunk@8297 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/ws_functions.inc.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index b617779d5..ab4c342cc 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -2539,4 +2539,36 @@ function ws_plugins_performAction($params, &$service)
}
}
+function ws_themes_performAction($params, &$service)
+{
+ global $template;
+
+ if (!is_admin() || is_adviser() )
+ {
+ return new PwgError(401, 'Access denied');
+ }
+
+ if (empty($params['pwg_token']) or get_pwg_token() != $params['pwg_token'])
+ {
+ return new PwgError(403, 'Invalid security token');
+ }
+
+ define('IN_ADMIN', true);
+ include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
+ $themes = new themes();
+ $errors = $themes->perform_action($params['action'], $params['theme']);
+
+ if (!empty($errors))
+ {
+ return new PwgError(500, $errors);
+ }
+ else
+ {
+ if (in_array($params['action'], array('activate', 'deactivate')))
+ {
+ $template->delete_compiled_templates();
+ }
+ return true;
+ }
+}
?>