Пример #1
0
 function __construct($post = null)
 {
     if ($post) {
         $this->_meta = $post;
     } else {
         $this->_meta['id'] = null;
         $this->_meta['userid'] = User::getActiveUserId();
         $this->_meta['postip'] = request::getRemoteHost();
     }
 }
Пример #2
0
 /**
  * Update a wiki page
  * @param string $pagename The namespace and page name
  * @param string $title The page title
  * @param string $content The page content
  */
 function updatePage($pagename, $title, $content)
 {
     $ns = String::getNamespace('default', $pagename);
     $uri = String::getLocation($pagename);
     $db = new DatabaseConnection();
     $author = User::getActiveUserId();
     try {
         // pull the latest revision of the page
         $rs = $db->getSingleRow('SELECT MAX(revision) AS latest FROM wiki WHERE ns=\'%s\' AND uri=\'%s\'', $ns, $uri);
         $currev = $rs ? $rs['latest'] : 0;
         // set to 0 if no record returned
         // bump revision
         $currev++;
         // and insert the new data
         $db->updateRow("INSERT INTO wiki SET content='%s',revision='%d',title='%s',ns='%s',uri='%s',lastedit=NOW(),author='%d'", $content, $currev, $title, $ns, $uri, $author);
     } catch (DBXException $e) {
         die($e);
     }
 }