|
@@ -7,6 +7,7 @@ use app\models\User;
|
|
|
use app\models\Anime;
|
|
use app\models\Anime;
|
|
|
use app\models\Entry;
|
|
use app\models\Entry;
|
|
|
use \lithium\security\Auth;
|
|
use \lithium\security\Auth;
|
|
|
|
|
+use \lithium\util\Validator;
|
|
|
|
|
|
|
|
|
|
|
|
|
class AnimeListController extends \lithium\action\Controller {
|
|
class AnimeListController extends \lithium\action\Controller {
|
|
@@ -81,6 +82,7 @@ class AnimeListController extends \lithium\action\Controller {
|
|
|
{
|
|
{
|
|
|
//Create an entry with the data
|
|
//Create an entry with the data
|
|
|
$entry = Entry::create($this->request->data);
|
|
$entry = Entry::create($this->request->data);
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//Get the current user
|
|
//Get the current user
|
|
|
$user = Auth::check('default');
|
|
$user = Auth::check('default');
|
|
@@ -93,11 +95,16 @@ class AnimeListController extends \lithium\action\Controller {
|
|
|
unset($this->request->data['tags']);
|
|
unset($this->request->data['tags']);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ var_dump($entry->_validates);
|
|
|
//If the entry is valid
|
|
//If the entry is valid
|
|
|
- if ($entry->validates()) {
|
|
|
|
|
- //Store it, :TODO: make sure this passes at some point, silent failure sucks
|
|
|
|
|
|
|
+ if (Validator::check($entry->data(),$entry->_validates, array('skipEmpty' => true))) {
|
|
|
|
|
+ //Store it, :TODO: make sure this passes at some point, silent failures suck
|
|
|
$entry->add($username);
|
|
$entry->add($username);
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
|
|
+ if($entry->add($username))
|
|
|
|
|
+ {
|
|
|
//Redirect the user to their anime list
|
|
//Redirect the user to their anime list
|
|
|
return $this->redirect("/animelist/view/$username");
|
|
return $this->redirect("/animelist/view/$username");
|
|
|
}
|
|
}
|