Пример #1
0
 /**
  * Delete language
  *
  * @access	private
  * @param   array 	$_post _POST array
  * @return  void
  */
 private function deleting($_post)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'languages', $_post['id'], 4);
     if (is_null($msg)) {
         // action
         $mod = new Language_model();
         $result = $mod->delete_lang($_post['id']);
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // clear useless permissions
         if ($result[1]) {
             $perm = new Permission_model();
             $perm->deleting_by_what('languages', $_post['id']);
             // set what update
             $msg->update[] = array('element' => 'tdown', 'url' => BASE_URL . 'languages', 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #2
0
 /**
  * Delete article's version
  *
  * @access	private
  * @param   integer $id article ID
  * @param   string 	$bid BID code
  * @return  void
  */
 private function deleting_version($id)
 {
     $msg = null;
     // check permissions
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'articles', $id, 4);
     if (is_null($msg)) {
         // do action
         $mod = new Article_model();
         $obj = $mod->get_by_id($id, 'articles', 'id_area, lang, bid');
         $result = $mod->delete($id);
         // clear useless permissions
         if ($result[1]) {
             $perm = new Permission_model();
             $perm->deleting_by_what('articles', $id);
         }
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // set what update
         if ($result[1]) {
             $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'articles/history/' . $obj->id_area . '/' . $obj->lang . '/' . $obj->bid, 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #3
0
 /**
  * Perform the uninstall
  *
  * @access	private
  * @param   array 	$_post _POST array
  * @return  void
  */
 private function uninstalling($_post)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'themes', $_post['id'], 4);
     if (is_null($msg)) {
         // do action
         $mod = new Theme_model();
         $result = $mod->uninstall($_post['id'], $_post['name']);
         // check the result
         if (is_array($result)) {
             $this->notice(false, '_theme_not_uninstalled');
             die;
             //X4Utils_helper::set_error($result, '_theme_not_uninstalled');
         } else {
             // uninstalled
             // set message
             $msg = AdmUtils_helper::set_msg(true);
             // clear useless permissions
             $perm = new Permission_model();
             if ($result) {
                 $perm->deleting_by_what('themes', $_post['id']);
             }
             $msg->update[] = array('element' => 'tdown', 'url' => BASE_URL . 'themes', 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #4
0
 /**
  * Uninstalling template
  *
  * @access	private
  * @param   array 	$_post _POST array
  * @return  void
  */
 private function uninstalling($_post)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'templates', $_post['id'], 4);
     if (is_null($msg)) {
         // do action
         $mod = new Template_model();
         $result = $mod->uninstall($_post['id']);
         if (is_array($result)) {
             // set error
             $msg = AdmUtils_helper::set_msg(false, '', $this->dict->get_word('_template_not_uninstalled'));
         } else {
             // set message
             $msg = AdmUtils_helper::set_msg($result);
             if ($result) {
                 // clear useless permissions
                 $perm = new Permission_model();
                 $perm->deleting_by_what('templates', $_post['id']);
                 $theme = $mod->get_var($_post['id_theme'], 'themes', 'name');
                 $msg->update[] = array('element' => 'tdown', 'url' => BASE_URL . 'templates/index/' . $_post['id_theme'] . '/' . $theme, 'title' => null);
             }
         }
     }
     $this->response($msg);
 }
Пример #5
0
 /**
  * Delete page
  *
  * @access	private
  * @param   integer 	$id Page ID
  * @return  void
  */
 private function deleting($id)
 {
     $msg = null;
     // check permissions
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'pages', $id, 4);
     if (is_null($msg)) {
         // action
         $mod = new Page_model('', '', $id);
         $page = $mod->get_by_id($id, 'pages', 'id_area, lang, xfrom');
         $result = $mod->delete_page($id, $this->site->site->domain);
         // clear useless permissions
         if ($result[1]) {
             $perm = new Permission_model();
             $perm->deleting_by_what('pages', $id);
         }
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // set what update
         if ($result[1]) {
             $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'pages/index/' . $page->id_area . '/' . $page->lang . '/' . str_replace('/', '-', $page->xfrom), 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #6
0
 /**
  * Uninstall the plugin
  *
  * @access	private
  * @param   object 	$obj Plugin Objject
  * @return  void
  */
 private function uninstalling($obj)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'modules', $obj->id, 4);
     if (is_null($msg)) {
         // do action
         $mod = new X4Plugin_model();
         $result = $mod->uninstall($obj->id);
         // check uninstalling
         if (is_array($result)) {
             $this->notice(false, '_plugin_not_uninstalled');
             die;
         } else {
             // set message
             $msg = AdmUtils_helper::set_msg(true);
             // uninstalled
             if ($result) {
                 // clear useless permissions
                 $perm = new Permission_model();
                 $perm->deleting_by_what('modules', $obj->id);
             }
             $area = $mod->get_by_id($obj->id_area, 'areas', 'name');
             $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'modules/index/' . $obj->id_area . '/' . $area->name, 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #7
0
 /**
  * Delete file
  *
  * @access	private
  * @param   integer	$id File ID
  * @param   array 	$_post _POST array
  * @return  void
  */
 private function deleting($id, $_post)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'files', $id, 4);
     if (is_null($msg)) {
         // action
         $mod = new File_model();
         $result = $mod->delete_file($id);
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         if ($result[1]) {
             // clear useless permissions
             $perm = new Permission_model();
             $perm->deleting_by_what('files', $id);
             // set what update
             $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'files/index/' . $_post['id_area'] . '/' . $_post['category'] . '/' . $_post['subcategory'], 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #8
0
 /**
  * Delete category
  *
  * @access	private
  * @param   integer	$id Category ID
  * @param   object	$obj Category Obj
  * @return  void
  */
 private function deleting($id, $obj)
 {
     $msg = null;
     // check permissions
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'categories', $id, 4);
     if (is_null($msg)) {
         // do action
         $mod = new Category_model();
         $result = $mod->delete($id);
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // clear useless permissions
         if ($result[1]) {
             $perm = new Permission_model();
             $perm->deleting_by_what('categories', $id);
             // set what update
             $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'categories/index/' . $obj->id_area . '/' . $obj->lang . '/' . $obj->tag, 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #9
0
 /**
  * Delete dictionary word
  *
  * @access	private
  * @param   object 	$obj Word object
  * @return  void
  */
 private function deleting($obj)
 {
     $msg = null;
     // check permission
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'dictionary', $obj->id, 4);
     if (is_null($msg)) {
         // do action
         $dict = new Dictionary_model();
         $result = $dict->delete($obj->id);
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // clear useless permissions
         if ($result[1]) {
             $perm = new Permission_model();
             $perm->deleting_by_what('dictionary', $obj->id);
             // set what update
             $msg->update[] = array('element' => 'tdown', 'url' => BASE_URL . 'dictionary/keys/' . $obj->lang . '/' . $obj->area . '/' . $obj->what, 'title' => null);
         }
     }
     $this->response($msg);
 }
Пример #10
0
 /**
  * Delete area
  *
  * @access	private
  * @param   integer	$id Area ID
  * @param   string 	$name Area name
  * @return  void
  */
 private function deleting($id, $name)
 {
     $msg = null;
     // check permissions
     $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'areas', $id, 4);
     if (is_null($msg)) {
         // action
         $area = new Area_model();
         $result = $area->delete_area($id, $name);
         // set message
         $msg = AdmUtils_helper::set_msg($result);
         // clear useless permissions
         if ($result[1]) {
             $perm = new Permission_model();
             $perm->deleting_by_what('areas', $id);
             // set what update
             $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'areas/index/1', 'title' => null);
         }
     }
     $this->response($msg);
 }