コード例 #1
0
ファイル: Moderate.php プロジェクト: sinfocol/gwf3
 public function onDelete(GWF_Page $page, $do_cleanup = true)
 {
     # History is per page basis, and can be deleted easily.
     if (false === GWF_PageHistory::onDelete($page)) {
         return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     #
     if (false === GWF_PageTagMap::onDelete($page)) {
         return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     # Last of them?
     $num_trans = $page->selectVar('COUNT(*)', "page_otherid={$oid}");
     if ($num_trans === 1) {
         if (false === GWF_PageGID::onDelete($page)) {
             return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     } elseif ($page->isRoot()) {
         if (!$this->newRoot($page)) {
             return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     if (false === $page->delete()) {
         return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if ($do_cleanup) {
         if (false === $this->onDeleteCleanup()) {
             return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
     }
     GWF_Website::addDefaultOutput($this->module->message('msg_deleted'));
     return true;
 }
コード例 #2
0
ファイル: GWF_PageTags.php プロジェクト: sinfocol/gwf3
 /**
  * Fill the tag tables for a page.
  * @param GWF_Page $page
  * @param array $tags
  * @return boolean
  */
 public static function updateTags(GWF_Page $page, $tags, $langid)
 {
     if (false === GWF_PageTagMap::onDelete($page)) {
         return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $pid = $page->getID();
     foreach (explode(',', $tags) as $tag) {
         $tag = trim($tag);
         if ($tag !== '') {
             if (!self::insertTag($tag, $pid, $langid)) {
                 return false;
             }
         }
     }
     if (false === self::cleanupTags()) {
         return false;
     }
     return true;
 }