Skip to content

Commit

Permalink
feature 2085 added: new method pwg.themes.performAction
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@8297 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Dec 24, 2010
1 parent d9545c0 commit 2f90ae9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions include/ws_functions.inc.php
Expand Up @@ -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;
}
}
?>

0 comments on commit 2f90ae9

Please sign in to comment.