*/
class admin_plugin_epub extends DokuWiki_Admin_Plugin {
var $output = '';
private $helper;
private $cache;
private $req;
private $metadir;
private $dbg=false;
private $results = "";
function __construct () {
$this->helper = $this->loadHelper('epub', true);
$this->cache = $this->helper->getCache() ;
$this->metadir = metaFN('epub',"");
}
/**
* handle user request
*/
function handle() {
if (!isset($_REQUEST['cmd'])) return; // first time - nothing to do
$msg="";
if (!checkSecurityToken()) return;
if (!is_array($_REQUEST['cmd'])) return;
$epub_deletions = array();
$which = key($_REQUEST['cmd']);
foreach($_REQUEST['book_id'] as $md5=>$id) {
if($which == 'media') {
$epub_deletions[] = $this->helper->delete_media($md5);
}
$this->helper->delete_page($md5);
}
if(is_array($_REQUEST['book_id'])) $this->cache = $this->helper->getCache() ;
if(count($epub_deletions)) {
$this->results = "Results
";
$this->results .= implode('
', $epub_deletions);
}
/* if debugging */
if($this->dbg) {
$this->req = print_r($_REQUEST,true) . $msg . "which=$which\n";
$this->req .= print_r($epub_deletions,true);
$this->req = str_replace("\n","
",$this->req);
}
}
function html() {
ptln( $this->locale_xhtml('admin_header'));
$cache = $this->cache;
$current_books = $this->cache['current_books'];
unset ($cache['current_books']);
//ptln('
' .$this->results . '