public function update($category) { $cat = new Category_Model(); if ($cat->category_exists($category) and apiler::is_authorized()) { $xml = apiler::get_xml(); $result = new Result_Model(); if ($result->insert($category, $_SERVER['PHP_AUTH_USER'], $xml['value'])) { print "OK"; die; } else { header("HTTP/1.1 400 Bad Request"); echo "Invalid request"; die; } } else { header("HTTP/1.0 404 Not Found"); die('Category not found or not authorized'); } }
/** * Verify credentials * * @return string Returns string "OK" if login is successful and error otherwise */ public function login() { if (apiler::is_authorized()) { print "OK"; die; } else { apiler::not_authorized(); } }