42 |
|
} |
43 |
|
else |
44 |
|
{ |
45 |
< |
api::Cout << "Location: http://" << env.get("HTTP_HOST") |
46 |
< |
<< env.get("SCRIPT_NAME") << "/daily/\r\n\r\n"; |
45 |
> |
api::Cout << "Location: http://" << env.get("HTTP_HOST") << env.get("SCRIPT_NAME") << "/daily/\r\n\r\n"; |
46 |
|
} |
47 |
|
} |
48 |
|
|
93 |
|
|
94 |
|
if (env.get("REQUEST_METHOD") == "POST") |
95 |
|
{ |
96 |
< |
std::streamsize length(lexical_cast<std::streamsize>(env.get("CONTENT_" |
98 |
< |
"TYPE"))); |
96 |
> |
std::streamsize length(lexical_cast<std::streamsize>(env.get("CONTENT_TYPE"))); |
97 |
|
char* content(new char[length]); |
98 |
|
|
99 |
|
api::Cin.Read(content, length); |
128 |
|
if (!date.IsEmpty()) ::strptime(date.NullTerminate(), "%Y-%m-%d", day); |
129 |
|
|
130 |
|
std::time_t difference(mktime(day) / 86400); |
131 |
< |
std::vector<ext::String> jargon(this->jargon.begin(), this->jargon.end()); |
132 |
< |
ext::String entry(jargon.size() ? jargon[difference % jargon.size()] : ""); |
131 |
> |
ext::Vector<ext::String> jargon(this->jargon.begin(), this->jargon.end()); |
132 |
> |
ext::String entry(jargon.GetSize() ? jargon[difference % jargon.GetSize()] : ""); |
133 |
|
|
134 |
|
select(entry); |
135 |
|
} |
138 |
|
{ |
139 |
|
::srandomdev(); |
140 |
|
|
141 |
< |
std::vector<ext::String> jargon(this->jargon.begin(), this->jargon.end()); |
142 |
< |
std::vector<ext::String>::size_type random(number.IsEmpty() ? ::random() : |
145 |
< |
lexical_cast<std::vector<ext::String>::size_type>(number)); |
141 |
> |
ext::Vector<ext::String> jargon(this->jargon.begin(), this->jargon.end()); |
142 |
> |
size_t random(number.IsEmpty() ? ::random() : lexical_cast<size_t>(number)); |
143 |
|
|
144 |
|
assert(random >= 0); |
145 |
< |
assert(random % jargon.size() < jargon.size()); |
145 |
> |
assert(random % jargon.GetSize() < jargon.GetSize()); |
146 |
|
|
147 |
< |
ext::String entry(jargon.size() ? jargon[random % jargon.size()] : ""); |
147 |
> |
ext::String entry(jargon.GetSize() ? jargon[random % jargon.GetSize()] : ""); |
148 |
|
|
149 |
|
select(entry); |
150 |
|
} |
155 |
|
{ |
156 |
|
api::Cout << "Content-Type: text/html; charset=UTF-8\r\n\r\n"; |
157 |
|
|
158 |
< |
Jargon jargon(path, selection, cgi.find("include") != cgi.end() |
162 |
< |
&& lexical_cast<bool>(ext::String(cgi.find("include")->second)), |
163 |
< |
cgi.find("relative") != cgi.end() |
164 |
< |
? ext::String(cgi.find("relative")->second) : ext::String()); |
158 |
> |
Jargon jargon(path, selection, cgi.find("include") != cgi.end() && lexical_cast<bool>(ext::String(cgi.find("include")->second)), cgi.find("relative") != cgi.end() ? ext::String(cgi.find("relative")->second) : ext::String()); |
159 |
|
|
160 |
|
api::Cout << jargon; |
161 |
|
} |