Fixed minor bugs
authorArtem Daniliants <artem@daniliants.com>
Fri, 19 Mar 2010 09:11:43 +0000 (11:11 +0200)
committerArtem Daniliants <artem@daniliants.com>
Fri, 19 Mar 2010 09:25:43 +0000 (11:25 +0200)
Server/application/controllers/api.php
Server/application/models/database_dump.sql

index 4d48e13..0b95e41 100644 (file)
@@ -111,7 +111,7 @@ class Api_Controller extends Controller{
     public function results($category, $limit){
        $results = New Result_Model();
        $cat = New Category_Model();
-        if ($cat->category_exists($category) AND $this->is_authorized()){
+        if ($cat->category_exists($category) AND $this->is_authorized() AND isset($limit)){
                $view = new View('api/results');
                $view->results = $results->get_results($category, $limit);
                $view->render(true);
@@ -142,7 +142,7 @@ class Api_Controller extends Controller{
        }
        else {
             header("HTTP/1.0 404 Not Found");
-            die('Category not found');
+            die('Category not found or not authorized');
        }
 
     }
index a1c18e3..bef5041 100644 (file)
@@ -4,7 +4,7 @@
 #
 # Host: localhost (MySQL 5.1.37)
 # Database: speedfreak
-# Generation Time: 2010-03-19 09:49:37 +0200
+# Generation Time: 2010-03-19 11:11:11 +0200
 # ************************************************************
 
 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@@ -52,6 +52,7 @@ CREATE TABLE `results` (
   `cat_id` int(11) NOT NULL,
   `user_id` int(11) NOT NULL,
   `value` text NOT NULL,
+  `result_date` datetime NOT NULL,
   KEY `cat_id` (`cat_id`),
   KEY `user_id` (`user_id`),
   CONSTRAINT `results_ibfk_1` FOREIGN KEY (`cat_id`) REFERENCES `categories` (`id`),
@@ -73,7 +74,7 @@ CREATE TABLE `users` (
   PRIMARY KEY (`id`),
   UNIQUE KEY `login_unique` (`username`),
   UNIQUE KEY `email_unique` (`email`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;