<?php
/**
* worker.php - Fetching commands from frontend and react on them
* @package phlyMail Nahariya 4.0+ Default branch
* @subpackage Handler Bookmarks
* @copyright 2004-2010 phlyLabs, Berlin (http://phlylabs.de)
* @version 0.0.5 2010-04-06
*/
// Only valid within phlyMail
if (!defined('_IN_PHM_')) die();
switch ($_REQUEST['what']) {
case 'rename_folder':
case 'folder_move':
case 'folder_delete':
case 'folder_create':
case 'folder_empty':
header('Content-Type: text/javascript; charset=UTF-8');
// Include the setup module and let it hanlde the operation
require_once(dirname(__FILE__).'/setup.folders.php');
if ($error) { // React on errors
echo 'alert("'.addcslashes($error, '"').'")'.LF;
} else { // No errors - force reload of the folder list to reflect changes done
echo 'flist_refresh("bookmarks");'.LF.'if (parent.CurrentHandler == "bookmarks") parent.frames.PHM_tr.refreshlist()'.LF;
}
exit;
break;
case 'item_move':
case 'item_copy':
case 'item_delete':
case 'item_rename':
header('Content-Type: '.(!isset($_REQUEST['no_json']) ? 'application/json' : 'text/javascript').'; charset=UTF-8');
// Include the setup module and let it hanlde the operation
require_once(dirname(__FILE__).'/setup.items.php');
if ($error) { // React on errors
echo (!isset($_REQUEST['no_json'])) ? '{"error":"'.addcslashes($error, '"').'","done":"1"}' : 'alert("'.addcslashes($error, '"').'")'.LF;;
} else { // No errors - force reload of the folder to reflect changes done
echo (!isset($_REQUEST['no_json']))
? '{"done":"1"}'
: 'parent.frames.PHM_tl.flist_refresh("bookmarks");'.LF.'if (parent.CurrentHandler == "bookmarks") parent.frames.PHM_tr.refreshlist()'.LF;
}
exit;
break;
}
?>