Exemplo n.º 1
0
Arquivo: funcs.php Projeto: dg-wfk/dl
function check_token()
{
    return isset($_REQUEST['token']) && is_token($_REQUEST['token']);
}
Exemplo n.º 2
0
 public function __construct($bookalope, $book, $id_or_packed = NULL)
 {
     assert($bookalope instanceof BookalopeClient);
     $this->bookalope = $bookalope;
     if ($id_or_packed === NULL) {
         $params = array("name" => "Bookflow", "title" => "<no-title>");
         $url = "/api/books/" . $book->id . "/bookflows";
         $bookflow = $this->bookalope->http_post($url, $params)->bookflow;
     } else {
         if (is_string($id_or_packed)) {
             if (!is_token($id_or_packed)) {
                 throw new BookalopeTokenException($id_or_packed);
             }
             $url = "/api/bookflows/" . $id_or_packed;
             $bookflow = $this->bookalope->http_get($url)->bookflow;
         } else {
             if (is_object($id_or_packed)) {
                 $bookflow = $id_or_packed;
             } else {
                 throw new BookalopeError("Unexpected parameter type: \$id_or_packed.");
             }
         }
     }
     $this->id = $bookflow->id;
     $this->name = $bookflow->name;
     $this->step = $bookflow->step;
     $this->book = $book;
     $this->url = "/api/bookflows/" . $bookflow->id;
     // Metadata
     // TODO: Consider update() here to pull in server data.
     $this->title = NULL;
     $this->author = NULL;
     $this->copyright = NULL;
     $this->isbn = NULL;
     $this->language = NULL;
     $this->pubdate = NULL;
     $this->publisher = NULL;
 }