示例#1
0
 /**
  * Delete article
  * Delete all versions of an article
  *
  * @access	private
  * @param   array 	$_post _POST array
  * @return  void
  */
 private function deleting($_post)
 {
     $msg = null;
     // check permissions on articles
     $mod = new Article_model();
     $artt = $mod->get_all_by_bid($_post['bid']);
     foreach ($artt as $i) {
         if (is_null($msg)) {
             $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'articles', $i->id, 4);
         }
     }
     // check permissions on pages
     $smod = new Section_model();
     $pp = $smod->get_pages_by_bid($_post['bid']);
     foreach ($pp as $i) {
         if (is_null($msg)) {
             $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'pages', $i->id, 3);
         }
     }
     if (is_null($msg)) {
         // do action
         $result = $mod->delete_by_bid($_post['bid']);
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // set what update
         if ($result[1]) {
             $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'articles/index/' . $_post['id_area'] . '/' . $_post['lang'], 'title' => null);
         }
     }
     $this->response($msg);
 }