public static function addGIDs(GWF_Page $page, array $groups) { $oid = $page->getOtherID(); $table = self::table(__CLASS__); foreach ($groups as $gid) { if (false === $table->insertAssoc(array('pgid_oid' => $oid, 'pgid_gid' => $gid))) { return false; } } return true; }
public function validate_lang($m, $arg) { if (false !== ($error = GWF_LangSelect::validate_langid($arg, true))) { return $error; } $lid = (int) $arg; $oid = $this->page->getOtherID(); if (false === GDO::table('GWF_Page')->selectVar('1', "page_otherid={$oid} AND page_lang={$lid}")) { return false; } return $m->lang('err_dup_lid'); }
private function getPageTranslations(GWF_Page $page) { if (!$page->isOptionEnabled(GWF_Page::SHOW_TRANS)) { return array(); } $pid = $page->getID(); $oid = $page->getOtherID(); if (false === ($result = $page->selectAll('page_title title, page_url url, page_lang langid', "page_otherid={$oid} AND page_id!={$pid}", 'page_lang ASC', NULL, -1, -1, GDO::ARRAY_N))) { return array(); } return $result; }
/** * 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); }
/** * Assign the next possible root via cycle. * @param GWF_Page $page */ private function newRoot(GWF_Page $page) { $oid = $page->getOtherID(); $tablename = $page->getTableName(); if (false === ($nextid = $page->selectVar('page_id', "page_otherid={$oid} AND page_id!={$oid}", 'page_create_date ASC'))) { return false; } return $page->update("page_otherid={$nextid}", "page_otherid={$oid}"); }