% /* vim:set ft=sitecing: */ %%derive page = "/ancestry/page.chtml"; %%derive sources = "/ancestry/sources.chtml"; %%pragma main=page <%impl> #include #include using namespace std; #include #include #include #include "acconfig.h" <%codemethod string title() %> return "introduction"; <%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;nname && 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);

<% rfile %>

    <%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>
  • <% sfl.empty()?" ":sitecing::html_escape(sfl,sitecing::html_escape_nbsp) %>
  • }