示例#1
0
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;
}
示例#2
0
文件: io.c 项目: bhanug/harvey
Whist*
getcurrentbyname(char *s)
{
	int n;

	if((n = nametonum(s)) < 0)
		return nil;
	return getcache(n, 0);
}
示例#3
0
文件: io.c 项目: bhanug/harvey
Whist*
gethistory(int n)
{
	return getcache(n, 1);
}
示例#4
0
文件: io.c 项目: bhanug/harvey
Whist*
getcurrent(int n)
{
	return getcache(n, 0);
}