File:  [parser3project] / parser3 / www / htdocs / Attic / auto.p
Revision 1.22.8.1: download - view: text, annotated - select for diffs - revision graph
Wed Jul 27 14:04:15 2005 UTC (20 years, 11 months ago) by paf
Diff to: branchpoint 1.22: preferred, unified
! new asserts were all false. regretfully reverted them all to checks

@USE
common/lib.p
common/layout.p
common/implode.p
date/dtf.p
mysql.p



#################################################################################################
@auto[]
# id объекта с 404 ошибкой:
$MAIN:error404ObjectId(23)
# id объекта, где лежат глобальные данные о сайте:
$MAIN:siteDataObjectId(21)

# id корневого объекта раздела вопросы и ответы
$MAIN:faq_category_root_id(3)

$MAIN:pSQL[^mysql::init[$SQL.connect-string;^if(^env:QUERY_STRING.pos[mode=debug] >= 0 || ^request:uri.pos[block_edit] >= 0){debug}]]

#^detectBrowser[]

# константа для новостей
$MAIN:objIdNews(1)

# эта табличка нужна для очистки всякой фигни от ентитей/тегов
$repl[^table::create{a	b
&nbsp^;	 
&hellip^;	...
&rdquo^;	"
&ldquo^;	"
&raquo^;	"
&laquo^;	"
&mdash^;	-
&ndash^;	-
&#8470^;	№
&bull^;	 }]
#end @auto[]



#################################################################################################
@unhandled_exceptionXXX[exception;stack][i;j]
$response:content-type[
	$.value[text/html]
	$.charset[$response:charset]
]

<title>Server error.</title>
<body bgcolor=white>
<font color=black>
<pre>В настоящее время на сервере проводятся регламентные работы. 
Пожалуйста, зайдите позже.<br />
Приносим наши извинения за возможные неудобства.<br />
Если вы хотите оставить нам сообщение, пишите: <a href="mailto:mailbox@parser.ru">mailbox@parser.ru</a></pre>
<!--
comment:
^untaint{$exception.comment}
^if(def $exception.source){
	source: $exception.source
	file: ^untaint{$exception.file^($exception.lineno^)}
}
^if(def $exception.type){type: exception.type=$exception.type}
^if($stack){
	stack backtrace:
	^stack.menu{$stack.name $stack.file^($stack.lineno^)}[^#0A]
}
//-->
#end



#################################################################################################
@error404[][err_lang]
^location[/404/]
#end @error404[]



#################################################################################################
@pageHeader[header]
$header
#end @pageHeader[]



#################################################################################################
@pageFooter[]
footer
#end @pageFooter[]



#################################################################################################
@body[content]
<body bgcolor="#F4F4F4" text="#000000" link="#0000C4" alink="#0000C4" vlink="#073683" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" onLoad="init()">
	$content
</body>
#end @body[]



#################################################################################################
@html[header;content]
<!-- Copyright (c) Art. Lebedev Studio | http://www.design.ru/ -->
<html>
<head>
	<base target="_top">
	<link rel="stylesheet" type="text/css" href="/main.css"></link>
	<title>AB.LV^if(def $header){ | ^taint[as-is][$header] }</title>
</head>
^body{
	<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#ffffff">
	^pageHeader[]
	$content
	^pageFooter[]
	</table>
}
<html>
#end @html[]


#################################################################################################
@main[]
^pSQL.server{
	<html>
	<head>
		^if(def $prepare){^prepare[]}
	</head>
	^body{^content[]}
	</html>
}
# @main[]



#################################################################################################
@postprocess[body][repl;tmp]
^if(def $body){
	^if($MAIN:browser eq "nn" && $MAIN:browser_ver < 5){
		$repl[^table::create{a	b
&hellip^;	&#133^;
&rdquo^;	&#148^;
&ldquo^;	&#147^;
&mdash^;	&#151^;
&ndash^;	&#150^;
&bull^;	&#149^;}]
		$result[^body.replace[$repl]]
	}{
		$result[$body]
	}
	$not_optimized_space[^taint[as-is][ ]]
	$not_optimized_tab[^taint[as-is][^#09]]
	$not_optimized_enter[^taint[as-is][^#0A]]
	$result[^result.match[прОбЭл][g]{$not_optimized_space}]
	$result[^result.match[тАб][g]{$not_optimized_tab}]
	$result[^result.match[энтЕр][g]{$not_optimized_enter}]

	^rem{ *** обрабатываем [parser]код[/parser] *** }
	$result[^result.match[\[(parser)\](.+?)\[/\1\]][g]{^taint[as-is][^process{$match.2}]}]
}{
	$result[]
}
^getStat[]
^rusage[]
# а это мы можем вывести список макросов, которые outdated, но которые вызывались...
# ^printOutdatedMacro[]
#end @postprocess[body]



#################################################################################################
@rusage[msg][rusage]
#^if(!in "/admin/"){
$rusage[$status:rusage]
$now[^date::now[]]
$s[[^now.sql-string[]]	$rusage.utime	$rusage.stime	$rusage.maxrss	$rusage.ixrss	$rusage.idrss	$rusage.isrss	$request:uri	$env:REMOTE_ADDR	[$status:memory.used/$status:memory.free/$status:memory.since_compact/$status:memory.process] $msg^#0A]
^s.save[append;/../data/rusage.log]
#}
#end @rusage[]



#################################################################################################
# этот метод выведет статистику, собранную экземпляром класса $MAIN:pSQL
@getStat[]
^if(def $MAIN:pSQL && $MAIN:pSQL.debug){
	$result[^MAIN:pSQL.getStatistics[/../data/sql.txt]]
}{
	$result[]
}
#end @stat[]



#################################################################################################
# метод достает названия методов с комментариями у указаного файла и показывает их
@getComments[f][file;fd;t;comments]
$file[^if(def $f){$f}{/../data/classes/engine.p}]
^if(-f $file){
	$fd[^file::load[text;$file]]
	
	$t[$fd.text]
	$t[^t.match[^^##[^^#]*^$][mg]{}]
	$t[^t.match[(\n){3,}][g]{${match.1}$match.1}]
	$comments[^t.match[(#{5,}\n#\s.*?\n@.+?\^])][g]]
	
	$result[^taint[as-is][^comments.menu{$comments.1^#0A^#0A^#0A}]]
}
#end @getComments[]

E-mail: