public function invokeHandler(RequestData $data, $search = "") { $order_by = $data->get("order_by", "updated"); $search_by = $data->get("search_by", "title"); $categories = $data->get("categories", array()); $language = $data->get("language", ""); $type = $data->get("type", ""); $stories = new Stories(); $stories->RELEVANCE = empty($search) ? 0 : 0.1; $stories->setCategories($categories); $stories->setClasses($type, $language); if ($search_by == 'title') { $stories_results = $stories->searchByTitle($search, 0, $order_by); } else { if ($search_by == 'text') { $stories_results = $stories->searchByText($search, 0, $order_by); } else { $stories_results = $stories->searchByAll($search, 0, $order_by); } } if (count($stories_results)) { // echo "REPLACE INTO search_cache(search_text) values(".$search.")"; $RDb = DBService::getDB(); $res = $RDb->update("REPLACE INTO search_cache(search_text) values('" . $search . "')"); } // print_r($stories->get(0)); return $stories_results; }
public function invokeHandler(User $user, RequestData $data) { $chapid = $data->get("chapid", NULL); $itemid = $data->get("sid", 0); if ($chapid != NULL && is_numeric($chapid)) { return Reviews::getByChapter($itemid, $chapid); } else { return null; } }
/** * @RequestMapping(url="json/user_stories",type=json) * @RequestParams(true) */ public function invokeHandler(RequestData $data) { $uid = $data->get("uid"); $stories = new Stories(); $author = new UserDetails($uid); $author->fetchDetails(); return $author; }
public function invokeHandler(RequestData $data) { $uid = $data->get("uid"); $stories = new Stories(); if ($uid != NULL && is_numeric($uid)) { return $stories->byUser($uid); } else { return null; } }
public function invokeHandler(RequestData $data) { $search = $data->get("search", ""); $response = array(); $RDb = DBService::getDB(); $res = $RDb->fetchAll("SELECT * FROM search_cache\n\t\t\t\tWHERE UPPER(search_text) like UPPER(%s)\n\t\t\t\tORDER BY search_text", "'%" . $search . "%'"); if (count($res) == 0) { $res = $RDb->fetchAll("SELECT title as search_text FROM fanfiction_stories\n\t\t\t\t\tWHERE UPPER(title) like UPPER(%s)\n\t\t\t\t\tORDER BY title", "'%" . $search . "%'"); } if (count($res) == 0) { $response['error'] = true; return false; } else { $response['data'] = $res; $response['error'] = false; return $response; } }
public function invokeHandler(RequestData $data, User $user) { $sid = $data->get("sid", ""); return new Story($sid); }