getMessage(); } } // return image data if(isset($_REQUEST['img']) && isset($epub)){ $img = $epub->Cover(); header('Content-Type: '.$img['mime']); echo $img['data']; exit; } // save epub data if($_REQUEST['save'] && isset($epub)){ $epub->Title($_POST['title']); $epub->Description($_POST['description']); $epub->Language($_POST['language']); $epub->Publisher($_POST['publisher']); $epub->Copyright($_POST['copyright']); $epub->ISBN($_POST['isbn']); $epub->Subjects($_POST['subjects']); $authors = array(); foreach((array) $_POST['authorname'] as $num => $name){ if($name){ $as = $_POST['authoras'][$num]; if(!$as) $as = $name; $authors[$as] = $name; } } $epub->Authors($authors); // handle image $cover = ''; if(preg_match('/^https?:\/\//i',$_POST['coverurl'])){ $data = @file_get_contents($_POST['coverurl']); if($data){ $cover = tempnam(sys_get_temp_dir(), 'epubcover'); file_put_contents($cover,$data); unset($data); } }elseif(is_uploaded_file($_FILES['coverfile']['tmp_name'])){ $cover = $_FILES['coverfile']['tmp_name']; } if($cover){ $info = @getimagesize($cover); if(preg_match('/^image\/(gif|jpe?g|png)$/',$info['mime'])){ $epub->Cover($cover,$info['meta']); }else{ $error = "Not a valid image file".$cover; } } // save the ebook try{ $epub->save(); }catch(Exception $e){ $error = $e->getMessage(); } // clean up temporary cover file if($cover) @unlink($cover); // rename $author = array_shift(array_keys($epub->Authors())); $title = $epub->Title(); $new = to_file($author.'-'.$title); $new = $bookdir.$new.'.epub'; $old = $epub->file(); if(realpath($new) != realpath($old)){ if(!@rename($old,$new)) $new = $old; //rename failed, stay here } $go = basename($new,'.epub'); header('Location: ?book='.rawurlencode($go)); exit; } header('Content-Type: text/html; charset=utf-8'); ?> EPub Manager
Title
Authors Authors() as $as => $name){ ?>

()

Description
Subjects
Publisher
Copyright
Language

ISBN

Cover Image

URL:

EPub Manager

View and edit epub books stored in .

',htmlspecialchars(file_get_contents('LICENSE'))) ?>