Example #1
0
 function delete($f3)
 {
     $users = new User($this->db);
     $result = $users->remove($f3->get('PARAMS.id'));
     if ($users->error) {
         $this->httpResponse($users->error[code], $users->error);
     } else {
         $this->httpResponse("200", $result);
     }
 }
 public function delete($id)
 {
     $user = new User($id);
     if (!$user->exists()) {
         $this->message = "User not found";
         $this->status = 404;
         return;
     }
     if ($user->id != Session::$user['id']) {
         $this->message = "Unauthorized";
         $this->status = 403;
         return;
     }
     $user->remove();
     $this->message = "User removed";
     $this->status = 204;
 }
 function actionDelete($httpData)
 {
     if (!isset($httpData['id'])) {
         $this->view->outputBasicPage("Error", "Please specify a user ID.");
     } elseif (!isset($_SESSION[$this->userSession])) {
         $this->view->redirectMsg("Please login", "user.php?action=login&redirect=/index.php");
     } else {
         if ($_SESSION[$this->adminSession] != 1) {
             $this->view->outputBasicPage("Error", "Only the administrator can delete accounts.");
         } else {
             $u = new User($httpData["id"], $this->conn);
             if ($u->isValid()) {
                 $status = $u->remove();
                 $msg = $status ? "Deleted successfully" : "No user with that ID!";
                 $heading = $status ? "Deleted" : "Error";
                 $this->view->outputBasicPage($heading, $msg);
             } else {
                 $this->view->outputBasicPage("Error", "Invalid user ID.");
             }
         }
     }
 }
				break;
			}
		}
		var newOption = new Option(all[i].name, all[i].id,false,selected);
		newOption.setAttribute("title", all[i].email);
		list.options[list.options.length] = newOption;
	}	
}
</script>
</head>
<body>
<?php 
#delete
if ($action == 'delete' && (!isset($editSelf) || !$editSelf)) {
    $user = new User(intval($selected_user));
    $user->remove();
    $selected_user = 'new';
}
#save
if ($action == 'save') {
    $user = User::byName($name);
    if (!is_null($user)) {
        echo "<script language='JavaScript'>alert('" . _mb("Username must be unique!") . "');</script>";
    } else {
        $user = new User(null);
        $user->name = $name;
        $user->owner = $owner_id;
        $user->description = $description;
        $user->email = $email;
        $user->phone = $phone;
        $user->organization = $organization;
Example #5
0
<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
$IV = array('GET' => array('userid' => array('id')));
requireStrictRoute();
$result = User::remove($_GET['userid']);
if ($result === true) {
    Respond::PrintResult(array('error' => 0));
} else {
    Respond::PrintResult(array('error' => -1, 'result' => $result));
}
Example #6
0
 public function go()
 {
     try {
         // select visitor type (user or guest)
         if (self::CheckSession()) {
             $visitor = new User($_SESSION['user']['name']);
         } elseif (self::checkCookies()) {
             $visitor = new User($_COOKIE['name']);
         } else {
             $visitor = new Guest();
         }
         // select action
         $action = $visitor->getAction();
         // perform action
         if ($action) {
             switch ($action) {
                 case "login":
                     if ($visitor->auth()) {
                         $visitor = new User($visitor->getName());
                         $visitor->login();
                     }
                     break;
                 case "register":
                     if ($visitor->register()) {
                         $visitor = new User($visitor->getName());
                         $visitor->login();
                     }
                     break;
                 case "logout":
                     $visitor->logout();
                     break;
                 case "delete":
                     $visitor->remove();
                     break;
             }
             $this->reload();
         }
         // show html
         if ($visitor instanceof User) {
             $this->templateVars['name'] = $visitor->getName();
             $this->templateVars['id'] = $visitor->getId();
             $this->templateVars['regdate'] = $visitor->getRegDate();
             $this->templateVars['lastvisit'] = $visitor->getLastVisit();
             $this->showTemplate('inner');
         } elseif ($visitor instanceof Guest) {
             if (isset($_SESSION['message'])) {
                 $this->templateVars['message'] = $_SESSION['message'];
                 unset($_SESSION['message']);
             }
             if (isset($_SESSION['guest']['entered_name'])) {
                 $this->templateVars['entered_name'] = $_SESSION['guest']['entered_name'];
                 unset($_SESSION['guest']['entered_name']);
             }
             $this->showTemplate('login');
         } else {
             throw new \Exception();
         }
     } catch (\Exception $e) {
         $_SESSION['message'] = $e->getMessage();
         $this->reload();
     }
 }
Example #7
0
 /**
  * @param User $user
  * @throws \InvalidArgumentException
  * @internal param \App\Model\WishList $list
  * @return $this
  */
 public function removeFromUser(User $user)
 {
     if (!$user->loaded()) {
         throw new \InvalidArgumentException('User is not loaded.');
     }
     // If collection doesn't contain wish list, just stop
     if (!$user->wishlists->containsById($this)) {
         return $this;
     }
     // Else search for
     $itemInList = $user->wishlists->filterOneBy(array('id' => $this->id()));
     if ($itemInList) {
         $user->remove('wishlists', $itemInList);
     }
     return $this;
 }
Example #8
0
        } else {
            if ($mode == 'update') {
                //update object model
                $model->update($_POST)->save();
                echo 'Object updated successfully.';
            }
        }
    }
    return;
}
if (getPostNull($uid, 'uid')) {
    echo $model->getJson($uid);
    return;
}
if (getPost($rid, 'delete')) {
    $model->remove($rid);
    echo '0';
    return;
}
$this_file = basename(__FILE__);
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
 public function hapusUser($id)
 {
     $user = new User($this->registry);
     $user->remove($id);
     header('location:' . URL . 'referensi/user');
 }
Example #10
0
<?php

/**
 * User delete handler.
 */
$page->layout = 'admin';
$this->require_acl('admin', 'user');
$u = new User($_GET['id']);
$_GET = array_merge($_GET, (array) $u->orig());
if (!$u->remove()) {
    $page->title = __('An Error Occurred');
    echo __('Error Message') . ': ' . $u->error;
    return;
}
$this->hook('user/delete', $_GET);
$this->add_notification(__('Member deleted.'));
$this->redirect('/user/admin');
 public function remove()
 {
     if (!$this->securitypolicy->validateAccessRight(3, 'delete')) {
         $this->load->view('access_denied');
     }
     $user = new User();
     $user->remove($this->input->post('user-id'));
     if (empty($user->errors)) {
         $this->session->set_userdata(array('status' => 'success'));
         redirect('Admin/user_manager', 'refresh');
     } else {
         $this->_viewData['errors'] = $user->errors;
         $this->_backToForm();
     }
 }
 /**
  * undocumented function
  *
  * @return void
  * @author 
  **/
 public function deleteDo()
 {
     $id = Input::get('id');
     $validator = $this->deleteValid($id);
     if ($validator) {
         $user = User::remove(Input::get('id'));
         if ($user) {
             return Redirect::route('admin.user')->withStatuses(['delete' => 'Hapus Sukses!']);
         }
         return Redirect::route('admin.user')->withErrors(['delete' => 'Hapus Gagal!']);
     }
     return Redirect::route('admin.user')->withErrors(['used' => 'Maaf, data ini masih digunakan! Hapus Gagal.']);
 }