Annotation of parser3/www/htdocs/auto.p, revision 1.20

1.18      paf         1: @USE
                      2: common/lib.p
                      3: common/layout.p
                      4: common/implode.p
                      5: date/dtf.p
                      6: mysql.p
                      7: 
                      8: 
                      9: 
                     10: #################################################################################################
1.17      paf        11: @auto[]
1.19      paf        12: $now[^date::now[]]
1.18      paf        13: 
1.19      paf        14: # id объекта с 404 ошибкой:
                     15: $MAIN:error404ObjectId(23)
                     16: # id объекта, где лежат глобальные данные о сайте:
                     17: $MAIN:siteDataObjectId(21)
1.18      paf        18: 
1.19      paf        19: # id корневого объекта раздела вопросы и ответы
                     20: $MAIN:faq_category_root_id(3)
1.18      paf        21: 
1.19      paf        22: $MAIN:pSQL[^mysql::init[$SQL.connect-string;^if(^env:QUERY_STRING.pos[mode=debug] >= 0){debug}{500}]]
1.18      paf        23: 
1.19      paf        24: ^detectBrowser[]
1.18      paf        25: 
1.19      paf        26: # константа для новостей
                     27: $MAIN:objIdNews(1)
1.18      paf        28: 
1.19      paf        29: # эта табличка нужна для очистки всякой фигни от ентитей/тегов
                     30: $repl[^table::create{a b
                     31: &nbsp^;         
                     32: &hellip^;      ...
                     33: &rdquo^;       "
                     34: &ldquo^;       "
                     35: &raquo^;       "
                     36: &laquo^;       "
                     37: &mdash^;       -
                     38: &ndash^;       -
                     39: &#8470^;       №
                     40: &bull^;         }]
1.18      paf        41: 
1.19      paf        42: $MAIN:user_images_dir[/i/users]
                     43: #end @auto[]
1.18      paf        44: 
                     45: 
                     46: 
                     47: #################################################################################################
                     48: @error404[][err_lang]
1.19      paf        49: ^location[/404/]
1.18      paf        50: #end @error404[]
                     51: 
                     52: 
                     53: 
                     54: #################################################################################################
                     55: @pageHeader[header]
                     56: $header
                     57: #end @pageHeader[]
                     58: 
                     59: 
                     60: 
                     61: #################################################################################################
                     62: @pageFooter[]
                     63: footer
                     64: #end @pageFooter[]
                     65: 
                     66: 
                     67: 
                     68: #################################################################################################
                     69: @body[content]
1.19      paf        70: <body bgcolor="#F4F4F4" text="#000000" link="#0000C4" alink="#0000C4" vlink="#073683" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" rightmargin="0" onLoad="init()">
1.18      paf        71:        $content
                     72: </body>
                     73: #end @body[]
                     74: 
                     75: 
                     76: 
                     77: #################################################################################################
                     78: @html[header;content]
                     79: <!-- Copyright (c) Art. Lebedev Studio | http://www.design.ru/ -->
                     80: <html>
                     81: <head>
                     82:        <base target="_top">
                     83:        <link rel="stylesheet" type="text/css" href="/main.css"></link>
                     84:        <title>AB.LV^if(def $header){ | ^taint[as-is][$header] }</title>
                     85: </head>
                     86: ^body{
                     87:        <table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#ffffff">
                     88:        ^pageHeader[]
                     89:        $content
                     90:        ^pageFooter[]
                     91:        </table>
                     92: }
                     93: <html>
                     94: #end @html[]
                     95: 
                     96: 
                     97: #################################################################################################
                     98: @main[]
                     99: ^pSQL.server{
                    100:        <html>
                    101:        <head>
                    102:                ^if(def $prepare){^prepare[]}
                    103:        </head>
1.19      paf       104:        ^body{^content[]}
1.18      paf       105:        </html>
                    106: }
                    107: # @main[]
                    108: 
                    109: 
                    110: 
                    111: #################################################################################################
1.19      paf       112: @postprocess[body][repl;tmp]
                    113: ^if(def $body){
                    114:        ^if($MAIN:browser eq "nn" && $MAIN:browser_ver < 5){
                    115:                $repl[^table::create{a  b
1.18      paf       116: &hellip^;      &#133^;
                    117: &rdquo^;       &#148^;
                    118: &ldquo^;       &#147^;
                    119: &mdash^;       &#151^;
                    120: &ndash^;       &#150^;
                    121: &bull^;        &#149^;}]
1.19      paf       122:                $result[^body.replace[$repl]]
                    123:        }{
                    124:                $result[$body]
                    125:        }
                    126:        $not_optimized_space[^taint[as-is][ ]]
                    127:        $not_optimized_tab[^taint[as-is][^#09]]
                    128:        $not_optimized_enter[^taint[as-is][^#0A]]
                    129:        $result[^result.match[прОбЭл][g]{$not_optimized_space}]
                    130:        $result[^result.match[тАб][g]{$not_optimized_tab}]
                    131:        $result[^result.match[энтЕр][g]{$not_optimized_enter}]
1.18      paf       132: }{
1.19      paf       133:        $result[]
1.18      paf       134: }
                    135: ^getStat[]
1.19      paf       136: ^rusage[]
1.18      paf       137: # а это мы можем вывести список макросов, которые outdated, но которые вызывались...
                    138: # ^printOutdatedMacro[]
                    139: #end @postprocess[body]
                    140: 
                    141: 
                    142: 
                    143: #################################################################################################
1.19      paf       144: @rusage[msg][rusage]
1.18      paf       145: ^if(!in "/admin/"){
                    146: $rusage[$status:rusage]
                    147: $now[^date::now[]]
1.20    ! paf       148: $s[[^now.sql-string[]] $rusage.utime   $rusage.maxrss  [$status:memory.used/$status:memory.free/$status:memory.since_compact/$status:memory.process]   $env:REMOTE_ADDR        $request:uri^if(def $msg){ $msg}^#0A]
1.18      paf       149: ^s.save[append;/../data/rusage.log]
1.19      paf       150: }
1.18      paf       151: #end @rusage[]
                    152: 
1.19      paf       153: 
1.18      paf       154: 
                    155: #################################################################################################
                    156: # этот метод выведет статистику, собранную экземпляром класса $MAIN:pSQL
                    157: @getStat[]
                    158: ^if(def $MAIN:pSQL && $MAIN:pSQL.debug){
                    159:        $result[^MAIN:pSQL.getStatistics[/../data/sql.txt]]
                    160: }{
                    161:        $result[]
                    162: }
1.19      paf       163: #end @stat[]
                    164: 
                    165: 
                    166: 
                    167: #################################################################################################
                    168: # метод достает названия методов с комментариями у указаного файла и показывает их
                    169: @getComments[f][file;fd;t;comments]
                    170: $file[^if(def $f){$f}{/../data/classes/engine.p}]
                    171: ^if(-f $file){
                    172:        $fd[^file::load[text;$file]]
                    173:        
                    174:        $t[$fd.text]
                    175:        $t[^t.match[^^##[^^#]*^$][mg]{}]
                    176:        $t[^t.match[(\n){3,}][g]{${match.1}$match.1}]
                    177:        $comments[^t.match[(#{5,}\n#\s.*?\n@.+?\^])][g]]
                    178:        
                    179:        $result[^taint[as-is][^comments.menu{$comments.1^#0A^#0A^#0A}]]
                    180: }
                    181: #end @getComments[]
                    182: 
1.18      paf       183: 
                    184: 
                    185: #################################################################################################
1.19      paf       186: @log404[][str]
                    187: $str[^now.sql-string[] $request:uri    $env:HTTP_REFERER       $env:REMOTE_ADDR^#0A]
                    188: ^str.save[append;/../data/missing_url.txt]
                    189: #end @log404[]
                    190: 

E-mail: