コード例 #1
0
ファイル: dispatcher.php プロジェクト: Nothorse/Giles
 public function handleedit($db, $path)
 {
     $book = $db->getBook($path[1]);
     $realbook = new ebook($book->file);
     $realbook->id = $path[1];
     $url = $_SERVER['PHP_SELF'];
     $realbook->title = isset($_POST['title']) ? $_POST['title'] : $realbook->title;
     $realbook->author = isset($_POST['author']) ? $_POST['author'] : $realbook->author;
     $realbook->sortauthor = isset($_POST['author']) ? strtolower($_POST['author']) : $realbook->sortauthor;
     if (isset($_POST['tags'])) {
         $tags = explode(',', $_POST['tags']);
         $realbook->tags = array();
         foreach ($tags as $tag) {
             $realbook->tags[] = trim($tag);
         }
     }
     $realbook->summary = isset($_POST['summary']) ? $_POST['summary'] : $realbook->summary;
     $realbook->modify_meta();
     $db->updateBook($realbook);
     $type = $_COOKIE['booksel'];
     $current = $_COOKIE['selval'];
     setcookie('booksel', '');
     setcookie('selval', '');
     $list = $type == 'tag' ? $db->getTagList() : $db->getAuthorlist();
     $this->display->printHeader();
     $this->display->printAuthorList($list, $type, $current);
     $booklist = $type == 'tag' ? $db->getTaggedBooks($current) : $db->getBookList('added desc', 'where author = \'' . SQLite3::escapeString($current) . '\'');
     $this->display->printBookList($booklist, 'books', $path[1]);
     echo getEditForm($realbook, $url);
     $this->display->printFoot();
     exit;
 }