protected function runPOST() { $factory = $this->representation->tag_types; $item = $factory->item($this->params->get->id); if ($item) { $item->name = strtolower($this->params->post->name); $item->description = $this->params->post->description; $item->persist(); } else { $this->setError(HTTPERROR_BAD_REQUEST, "Unknown tag_type with id '{$this->params->get->id}'"); } if ($this->status()) { header('Location: ' . \TooBasic\Managers\RoutesManager::Instance()->enroute(ROOTURI . '?action=tag_types')); } return $this->status(); }
protected function runPOST() { $ok = true; $factory = $this->representation->users(false, '\\TooBasic\\UsersManagement'); $item = $factory->item($this->params->get->id); if ($item) { $item->username = $this->params->post->username; $item->password = $this->params->post->password; $item->active = $this->params->post->active; $item->confimed = $this->params->post->confimed; $item->reset_password = $this->params->post->reset_password; $item->persist(); } else { $this->setError(HTTPERROR_BAD_REQUEST, "Unknown user with id '{$this->params->get->id}'"); $ok = false; } if ($ok) { header('Location: ' . \TooBasic\Managers\RoutesManager::Instance()->enroute(ROOTURI . '?action=users')); } return $ok; }
protected function runPOST() { $ok = true; $factory = $this->representation->users(false, '\\TooBasic\\UsersManagement'); $newId = $factory->create(); if ($newId) { $item = $factory->item($newId); $item->username = $this->params->post->username; $item->password = $this->params->post->password; $item->active = $this->params->post->active; $item->confimed = $this->params->post->confimed; $item->reset_password = $this->params->post->reset_password; $item->persist(); } else { $ok = false; } if ($ok) { header('Location: ' . \TooBasic\Managers\RoutesManager::Instance()->enroute(ROOTURI . '?action=users')); } return $ok; }
protected function runPOST() { global $Defaults; $sessionsManager = $this->model->sessions('TooBasic\\UsersManagement'); if (!$sessionsManager->isLoggedIn()) { $usersManager = $this->model->users('TooBasic\\UsersManagement'); $usr = $usersManager->validate($this->params->post->username, $this->params->post->password); if ($usr) { if (!$sessionsManager->logIn($usr)) { $this->setError(HTTPERROR_INTERNAL_SERVER_ERROR, "{$this->translate->login_error}"); } else { } } else { $this->setError(HTTPERROR_UNAUTHORIZED, $this->translate->login_unauthorized); } } else { $this->setError(HTTPERROR_BAD_REQUEST, $this->translate->already_logged_in); } $this->assign('loggedin', $sessionsManager->isLoggedIn()); $this->assign('homecallback', \TooBasic\Sanitizer::UriPath(ROOTURI . '/' . \TooBasic\Managers\RoutesManager::Instance()->enroute("?action={$Defaults[GC_DEFAULTS_ACTION]}"))); return $this->status(); }
protected function runPOST() { $factory = $this->representation->tag_types(false, 'Tagger'); $newId = $factory->create(); if ($newId) { $item = $factory->item($newId); $item->name = strtolower($this->params->post->name); $item->description = $this->params->post->description; $item->persist(); } else { $message = 'Unable to create a new item.'; $dberror = $factory->lastDBError(); if ($dberror) { $message .= " [{$dberror[0]}-{$dberror[1]}] {$dberror[2]}."; } $this->setError(HTTPERROR_INTERNAL_SERVER_ERROR, $message); } if ($this->status()) { header('Location: ' . \TooBasic\Managers\RoutesManager::Instance()->enroute(ROOTURI . '?action=tag_types')); } return $this->status(); }
protected function runPOST() { $factory = $this->representation->tags; $item = $factory->item($this->params->post->id); if ($item) { if (!$item->remove()) { $this->setError(HTTPERROR_INTERNAL_SERVER_ERROR, "Unable to remove tag with id '{$this->params->post->id}'"); $ok = false; } } else { $this->setError(HTTPERROR_BAD_REQUEST, "Unknown tag with id '{$this->params->post->id}'"); } if ($this->status()) { header('Location: ' . \TooBasic\Managers\RoutesManager::Instance()->enroute(ROOTURI . '?action=tags')); } return $this->status(); }