/** * Set options that may be set by the owner of the root page, like group and stuff. * @param GWF_Page $page * @param string $gstring * @return boolean */ private function setRootOptions(GWF_Page $page, $gstring) { $pages = GDO::table('GWF_Page'); $bits = GWF_Page::LOGIN_REQUIRED | GWF_Page::SHOW_TRANS | GWF_Page::SHOW_SIMILAR | GWF_Page::SHOW_MODIFIED; $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; } # Set the new bits. $bits = 0; $bits |= isset($_POST['noguests']) ? GWF_Page::LOGIN_REQUIRED : 0; $bits |= isset($_POST['show_similar']) ? GWF_Page::SHOW_SIMILAR : 0; $bits |= isset($_POST['show_modified']) ? GWF_Page::SHOW_MODIFIED : 0; $bits |= isset($_POST['show_trans']) ? GWF_Page::SHOW_TRANS : 0; $page->setOption($bits, true); $page->setVar('page_groups', $gstring); $gstring = GDO::escape($gstring); # Fire the sql return GDO::table('GWF_Page')->update("page_groups='{$gstring}', page_options=page_options|{$bits}", "page_otherid={$otherid}"); }