Beispiel #1
0
 /**
  * @param int $id
  * @param int $revision
  * @return bool
  */
 function set($id = null, $revision = null)
 {
     $id || ($id = $this->id);
     $sql = "SELECT WIKI_HANDLE, OWNER_ID, CREATED, REVISION_ID\r\n\t\t\tFROM TBL_WIKI as WP\r\n\t\t\tINNER JOIN TBL_WIKI_REVISION as WPR\r\n\t\t\t\tON WP.WIKI_ID = WPR.WIKI_ID\r\n\t\t\tWHERE WP.WIKI_ID = ?? ";
     if ($revision) {
         $sql .= " AND REVISION_ID = '" . $revision . "' ";
     } else {
         $sql .= " ORDER BY REVISION_ID DESC LIMIT 0,1";
     }
     $q = $this->db->query($sql);
     $q->bind_values($id);
     $q->execute();
     if (!$q->rows()) {
         return false;
     }
     $r = $q->fetch();
     $this->revision = new WikiRevision($this->db);
     $this->revision->set($id, $r->REVISION_ID);
     $this->id = $id;
     $this->handle = $r->WIKI_HANDLE;
     $this->owner = new User($this->db, $r->OWNER_ID);
     $this->create = $r->CREATED;
     return $this->complete = true;
 }