Skip to content

Instantly share code, notes, and snippets.

@kindlyfire
Created June 17, 2015 03:35
Show Gist options
  • Save kindlyfire/d70b333b5dccb3eb97a9 to your computer and use it in GitHub Desktop.
Save kindlyfire/d70b333b5dccb3eb97a9 to your computer and use it in GitHub Desktop.
if(!empty($this->request->getPost('act'))) {
$rq = $this->request->getPost('act');
$id = $this->request->getPost('id');
if($rq == 'accept') {
$target = BetaUser::findFirst($id);
$user = new Users();
if($user->save(array(
'user' => str_replace(' ', '', $target->name),
'email' => $target->email,
'username' => $target->name,
'password' => sha1($target->password),
'banned' => 'false',
'biography' => 'Default user bio',
'suscriptions' => '0',
'rights' => '0',
'img_profile' => 'http://data.kandles.eu/raw/repo/img/profile-default.png',
'img_header' => '0',
'address_code' => '0',
'address_country' => '0',
'address_number' => '0',
'address_street' => '0'
))) {
$this->view->msg = 'Saved !';
$target->delete();
}
else {
$messages = '';
foreach ($user->getMessages() as $message) {
$messages = $messages . $message . "\n";
}
$this->view->msg = $messages;
}
}
elseif($rq == 'deny') {
$target = BetaUser::findFirst($id);
$target->delete();
}
elseif($rq == 'ban') {
$target = Users::findFirst($id);
$target->banned = 'true';
if($target->update()) {
$this->view->msg = 'Saved !';
}
else {
$messages = '';
foreach ($target->getMessages() as $message) {
$messages = $messages . $message . "\n";
}
$this->view->msg = $messages;
}
}
else {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment