X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=common.php;h=d66927fbaa3ccd1f1e5240f7a2ff07086cd46f2c;hb=b6706dbfce855578ede6abdc3a810f17c81d61f7;hp=f0fd2c9bad71ac1b5342511616999d493934ac09;hpb=e3d161cb8ff2459746555bb546b7733ab25d8479;p=www.energie.vellum.cz.git diff --git a/common.php b/common.php index f0fd2c9..d66927f 100644 --- a/common.php +++ b/common.php @@ -10,7 +10,7 @@ $cvs_id_split=split(" ",$cvs_id); if (count($cvs_id_split)==8) { $cvs_id_split[1]="".$cvs_id_split[1].""; - $cvs_id_split[5]="".$cvs_id_split[5].""; + $cvs_id_split[5]="".$cvs_id_split[5].""; } $cvs_id_html=join(" ",$cvs_id_split); @@ -19,13 +19,13 @@ if (isset($detect_js) && !$have_js) $head.=''."\n"; - $user_agent=$HTTP_SERVER_VARS["HTTP_USER_AGENT"]; + $user_agent=(!isset($HTTP_SERVER_VARS["HTTP_USER_AGENT"]) ? "" : $HTTP_SERVER_VARS["HTTP_USER_AGENT"]); if (ereg("[[:<:]]MSIE ([0-9]+)\\.",$user_agent,$msie_major_a)) $msie_major=$msie_major_a[1]; else if (ereg("[[:<:]]Mozilla/([0-9]+)\\.",$user_agent,$mozilla_major_a)) $mozilla_major=$mozilla_major_a[1]; - $have_style=!ereg("Mozilla/4\\.[5-7]",$user_agent); + $have_style=!isset($mozilla_major) || $mozilla_major!=4; $have_css=true; // doesn't hurt anybody AFAIK function addpercents($url) @@ -43,7 +43,7 @@ function fatal($msg="UNKNOWN") { global $admin_mail; - print("\n

Nastala chyba pøi zpracování: $msg!

\n" + print("\n

 
 


Nastala chyba pøi zpracování: $msg!

\n" ."

Mù¾ete tento problém nahlásit správci tohoto webu.

\n"); footer(); } @@ -105,6 +105,14 @@ function db_row($query) return($r); } +function db_array($query) +{ + $q=db_query($query); + $r=mysql_fetch_array($q); + mysql_free_result($q); + return($r); +} + function db_item($query) { $row=db_row($query); @@ -210,11 +218,14 @@ function title_month($year,$month) function title_icons_table_month($year,$month,$month_last,$sequential) { + global $tb_clanek; + $month_a=month_a($year,$month,$month_last,$sequential); print("" .img($month_a["icon"],"titulní stránka ".$month_a["name_full"])."
" - ."obsah ".$month_a["name"]."" - ); + ."obsah ".$month_a["name"].""); + if (db_item("select count(*) from $tb_clanek where year=$year and month=$month")) + print("
ukázka èlánkù"); } function title_icons($year,$month) @@ -222,7 +233,7 @@ function title_icons($year,$month) global $tb_obsah; print("

" - .(isset($year) ? "" : "") + .(isset($year) ? "" : "") .title_name(&$year,&$month) .(isset($year) ? "" : "") ."

\n"); @@ -251,7 +262,7 @@ function title_icons($year,$month) $year=$row["year"]; print("" - .(!isset($wanted_year) ? "

 

" : "") + .(!isset($wanted_year) ? "

 

" : "") ."
\n" ."\n" ); @@ -270,7 +281,7 @@ function title_icons($year,$month) print(""); $month++; } - print("
Roèník $year (obsahy èísel)
"); title_icons_table_month($year,$row["month"]+1,$row["month_last"]+1,$row["sequential"]); @@ -304,7 +315,31 @@ function image_supported($mime) return(false); } -function footer() +// PHP dirname() is broken: ("/1/2/3"=>"/1/2", "/1"->"/") +function dirnameslashed($filename) +{ + $r=dirname($filename); + if (substr($r,-1)!="/") + $r.="/"; + return($r); +} + +function usersize($size) +{ + $suffix_a=array("","k","M","G","T"); + while ($size>=1000 && sizeof($suffix_a)>=2) { + $size/=1000; + array_shift($suffix_a); + } + return(round($size)." ".$suffix_a[0]."B"); +} + +function data_href($filename,$text) +{ + return("$text (".usersize(filesize($filename)).")"); +} + +function footer($delimit=true) { // deadlock prevention: global $footer_passed; @@ -313,20 +348,22 @@ function footer() $footer_passed=true; global $cvs_id_html,$viewcvs,$viewcvs,$HTTP_SERVER_VARS; + if ($delimit) + print("

 

\n"); + $uri="uri=".addpercents("http://".$HTTP_SERVER_VARS["HTTP_HOST"].$HTTP_SERVER_VARS["REQUEST_URI"]); ?> -

 


alt="Valid XHTML 1.0!" />"> alt="Valid XHTML 1.1!" /> alt="Valid CSS!" />
- =4) - print(''."\n"); + print(''."\n"); ?> - - + + Energie & peníze<?php if (isset($title_tail)) - print(": $title_tail"); + print(": ".htmlspecialchars($title_tail)); print("\n"); if ($have_css) { ?>