author | Michael Krelin <hacker@klever.net> | 2005-04-25 17:07:02 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-04-25 17:07:02 (UTC) |
commit | 33efe232e5ed39c2dcb486fc1c381f09654c0126 (patch) (side-by-side diff) | |
tree | 967b0c795cc8c407234640ed196c18c259394f6a /htdocs | |
parent | dc836540970e798a91ae9460690e4462365e770a (diff) | |
download | sitecing-33efe232e5ed39c2dcb486fc1c381f09654c0126.zip sitecing-33efe232e5ed39c2dcb486fc1c381f09654c0126.tar.gz sitecing-33efe232e5ed39c2dcb486fc1c381f09654c0126.tar.bz2 |
1. -svn-ed version
2. made changes necessary to get along well with recent konforka-sitecing changes
-rw-r--r-- | htdocs/handlers/exception_dev | 7 | ||||
-rw-r--r-- | htdocs/sources.chtml | 5 | ||||
-rw-r--r-- | htdocs/view.chtml | 9 |
3 files changed, 12 insertions, 9 deletions
diff --git a/htdocs/handlers/exception_dev b/htdocs/handlers/exception_dev index d8c84e1..d62f462 100644 --- a/htdocs/handlers/exception_dev +++ b/htdocs/handlers/exception_dev @@ -1,24 +1,25 @@ %%decl using namespace std; <%impl> #include <iostream> #include <fstream> #include <sstream> #include <cassert> #include <cstdarg> #include <stdexcept> #include <cxxabi.h> #include <sitecing/sitecing_util.h> #include <sitecing/util.h> #include <sitecing/magic.h> + #include <konforka/util.h> #include <konforka/exception.h> </%impl> %%var string message; %%var string root_source; %%var string root_intermediate; %%var string root_so; %%var string component; %%var int line_number = -1; %%var const exception* exception_caught; <%code> __SCIF->headers.clear(); __SCIF->out->seekp(0); @@ -245,35 +246,35 @@ string::size_type nd = ln.find_first_not_of("0123456789"); if(nd==string::npos) { try { error_file = sitecing::strip_prefix(fn,"In file included from "); }catch(sitecing::utility_no_prefix& unp) { error_file = fn; } error_line = strtol(ln.c_str(),0,10); } } } if((oel>0 && !oef.empty()) && (oel!=error_line || oef!=error_file)) { - string ef = "/"+sitecing::combine_path(root_source+component,oef); + string ef = "/"+konforka::combine_path(root_source+component,oef); report_error(ef,oel,remove_roots(cumulative)); cumulative.clear(); } } if(!cumulative.empty()) cumulative += '\n'; cumulative += line; } if(!(cumulative.empty() || error_file.empty() || error_line<0)) { - error_file = "/"+sitecing::combine_path(root_source+component,error_file); + error_file = "/"+konforka::combine_path(root_source+component,error_file); report_error(error_file,error_line,remove_roots(cumulative)); } } </%code> </div> </%method> <%method void handle_unknown_error() %> <div class="exception-unknown"> <h1>unknown error</h1> </div> </%method> <%method void report_error(const string& file,long line,const string& message) %> @@ -309,25 +310,25 @@ } <%output></ul></%output> } } } </%code> <div class="what"> <% sitecing::html_escape(message,sitecing::html_escape_br) %> </div> </div> </%method> <%codemethod string strip_roots(const string& filename) %> - string np = sitecing::normalize_path(filename); + string np = konforka::normalize_path(filename); try{ return sitecing::strip_prefix(np,root_source); }catch(sitecing::utility_no_prefix& e){ } try{ return sitecing::strip_prefix(np,root_intermediate); }catch(sitecing::utility_no_prefix& e){ } </%codemethod> <%codemethod string remove_roots(const string& str) %> string rv = str; string::size_type rp; string::size_type rl = root_source.length(); while((rp=rv.find(root_source))!=string::npos) { diff --git a/htdocs/sources.chtml b/htdocs/sources.chtml index 268b0e0..57a03e9 100644 --- a/htdocs/sources.chtml +++ b/htdocs/sources.chtml @@ -1,18 +1,19 @@ % /* vim:set ft=sitecing: */ %%derive layout = "/ancestry/layout.chtml"; %%derive sources = "/ancestry/sources.chtml"; %%pragma main=page <%impl> #include <sitecing/sitecing_util.h> + #include <konforka/util.h> </%impl> <%constructor> b_strict = false; PN_PREV("/quickref/metasyntax","syntax","meta syntax"); </%constructor> <%codemethod string title() %> return "runtime exceptions handling"; </%codemethod> <%method void content() %> <h1>browse this site sources</h1> <ul class="sourcebrowser"> @@ -22,27 +23,27 @@ % if(sf.dir) { /* the beginning */ <li class="dir"><% sf.dir %>/<ul class="dir"> % }else{ /* the end */ </ul></li> % } % }else{ <li class="file"><a href="/view/<% sf.dir %>/<% sf.name %>" title="<% sf.desc %>" target="insert"><% sf.name %></a></li> % } % } </ul> <%code> - string rfile = sitecing::normalize_path( + string rfile = konforka::normalize_path( sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/sources.chtml"), - sitecing::restrict_dotdot|sitecing::strip_leading_slash ); + konforka::restrict_dotdot|konforka::strip_leading_slash ); if(rfile.empty()) rfile = "about:blank"; else rfile = "/view/"+rfile; </%code> <div class="insert"> <iframe id="insert" name="insert" src="<% rfile %>" width="95%" height="300"> <p>I wanted to put an <iframe> here, but your browser does not seem to support it. That is okay, it still will open links somehow.</p> </iframe> </div> diff --git a/htdocs/view.chtml b/htdocs/view.chtml index f729465..809c54f 100644 --- a/htdocs/view.chtml +++ b/htdocs/view.chtml @@ -1,45 +1,46 @@ % /* vim:set ft=sitecing: */ %%derive page = "/ancestry/page.chtml"; %%derive sources = "/ancestry/sources.chtml"; %%pragma main=page <%impl> #include <iostream> #include <fstream> using namespace std; #include <sitecing/util.h> #include <sitecing/sitecing_util.h> + #include <konforka/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( + string rfile = konforka::normalize_path( sitecing::strip_prefix(__CGI->get_meta("PATH_INFO"),"/view.chtml"), - sitecing::restrict_dotdot|sitecing::strip_leading_slash ); + konforka::restrict_dotdot|konforka::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) + if(konforka::normalize_path(konforka::combine_path(sof->dir,sof->name,0),konforka::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); + string afile = konforka::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')) { |