From 2f90ae92512d409e275d786177649c50af5d6e18 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 24 Dec 2010 18:03:30 +0000 Subject: feature 2085 added: new method pwg.themes.performAction git-svn-id: http://piwigo.org/svn/trunk@8297 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/ws_functions.inc.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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; + } +} ?> -- cgit v1.2.3