author | Michael Krelin <hacker@klever.net> | 2005-01-30 00:57:53 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-01-30 00:57:53 (UTC) |
commit | 71f4cc84c3788c6904ede17cd626a9ca9c349e3b (patch) (side-by-side diff) | |
tree | cfe7736ae3416ad314b7451b756e587335c357c7 /htdocs/view.chtml | |
parent | acd2a536dd6bb3ef9438482725f77ac9044ae79b (diff) | |
download | sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.zip sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.gz sitecing-71f4cc84c3788c6904ede17cd626a9ca9c349e3b.tar.bz2 |
initial commit into repository
-rw-r--r-- | htdocs/view.chtml | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/htdocs/view.chtml b/htdocs/view.chtml new file mode 100644 index 0000000..d885330 --- a/dev/null +++ b/htdocs/view.chtml @@ -0,0 +1,54 @@ +% html(); return; /* vim:set ft=sitecing: */ +%%derive page = "/ancestry/page.chtml"; +%%derive sources = "/ancestry/sources.chtml"; +<%impl> + #include <iostream> + #include <fstream> + using namespace std; + #include <sitecing/util.h> + #include <sitecing/sitecing_util.h> + #include <konforka/exception.h> + #include "acconfig.h" +</%impl> +<%codemethod string title() %> + return "introduction"; +</%codemethod> +<%method void body() %> + <%code> + string rfile = sitecing::normalize_path( + sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), + sitecing::restrict_dotdot|sitecing::strip_leading_slash ); + sourcefile_t *sof = 0; + for(int n=0;n<source_files_count;n++) { + sof = &source_files[n]; + if(sof->name && sof->dir) { + if(sitecing::normalize_path(sitecing::combine_path(sof->dir,sof->name,0),sitecing::strip_leading_slash)==rfile) + break; + } + sof = 0; + } + if(!sof) + throw konforka::exception(CODEPOINT,"no access to the file allowed"); + string afile = sitecing::combine_path(WEB_ROOT,rfile,0); + </%code> + <div class="source"> + <h1><% rfile %></h1> + <ul> + <%code> + ifstream sf(afile.c_str()); + if(!sf.good()) + throw konforka::exception(CODEPOINT,"could not open source file"); + while(!sf.eof()) { + string sfl; + getline(sf,sfl); + for(string::size_type t=sfl.find('\t');t!=string::npos;t=sfl.find('\t')) { + sfl.replace(t,1,8-(t%8),' '); + } + <%output> + <li><% sfl.empty()?" ":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %></li> + </%output> + } + </%code> + </ul> + </div> +</%method> |