Пример #1
0
 /**
  *	@fn server_error_delete
  *	@short Action method that deletes server error items.
  */
 public function server_error_delete()
 {
     if (!empty($_GET['id'])) {
         $this->redirect_to(array('action' => 'server_error_read', 'id' => $_GET['id']));
     } else {
         if (!empty($_POST['id'])) {
             if (is_array($_POST['id'])) {
                 $conn = Db::get_connection();
                 $conn->prepare('DELETE FROM `server_errors` ' . "WHERE FIND_IN_SET(`id`, '{1}') " . 'LIMIT {2}', implode(',', $_POST['id']), count($_POST['id']));
                 $conn->exec();
                 Db::close_connection($conn);
             } else {
                 $error = new ServerError();
                 $error->find_by_id($_REQUEST['id']);
                 $error->delete();
             }
         }
         $this->redirect_to(array('action' => 'server_error_list'));
     }
 }