Example #1
0
 /**
  * Set bits the owner is allowed to set.
  * @param GWF_Page $page
  */
 private function setOwnerOptions(GWF_Page $page)
 {
     $pages = GDO::table('GWF_Page');
     $bits = GWF_Page::SHOW_AUTHOR | GWF_Page::MODES | GWF_Page::COMMENTS | GWF_Page::ENABLED;
     $page->setOption($bits, false);
     $otherid = $page->getOtherID();
     # Kill all bits.
     $bits = ~$bits;
     if (false === $pages->update("page_options=page_options&{$bits}", "page_otherid={$otherid}")) {
         return false;
     }
     $bits = 0;
     $bits |= $_POST['type'];
     $bits |= isset($_POST['show_author']) ? GWF_Page::SHOW_AUTHOR : 0;
     $bits |= isset($_POST['show_comments']) ? GWF_Page::COMMENTS : 0;
     $bits |= isset($_POST['enabled']) ? GWF_Page::ENABLED : 0;
     return $page->saveOption($bits, true);
 }