void mtn_cms_page_builder::getpage( mtn_cms_http_response_data* response, mtn_cms_http_request_data* request, CppSQLite3DB* db, std::string* content) { _response = response; _request = request; _db = db; mtn_cms_cache_item cache; if (getcache(request->page, &cache)) { time_t t = time(NULL); if ( t <= (cache.ttl + cache.created) ) { (*content) = cache.data; response->status = MTN_CMS_HTTP_STATUS_OK; response->length = cache.data.length(); response->content_type = MTN_CMS_MIME_TEXT_HTML; return; } } if ( buildpage(request->page, *content)) { response->status = MTN_CMS_HTTP_STATUS_OK; response->length = content->length(); response->content_type = MTN_CMS_MIME_TEXT_HTML; return; } response->status = MTN_CMS_HTTP_STATUS_NOT_FOUND; return; }
Whist* getcurrentbyname(char *s) { int n; if((n = nametonum(s)) < 0) return nil; return getcache(n, 0); }
Whist* gethistory(int n) { return getcache(n, 1); }
Whist* getcurrent(int n) { return getcache(n, 0); }