1 |
<?php |
<?php |
2 |
|
|
3 |
|
$max_title_len=20; // max. length of titles in drop-down |
4 |
|
|
5 |
require("Smarty.class.php"); |
require("Smarty.class.php"); |
6 |
require("conn.inc"); |
require("conn.inc"); |
7 |
|
|
16 |
$section="domov"; |
$section="domov"; |
17 |
} else { |
} else { |
18 |
// fetch current page |
// fetch current page |
19 |
$sql="select id,menu_num,name,html from multi where visible and id=$p"; |
$sql="select id,menu_num,name,html,path,type from multi where $visible_is_true and id=$p"; |
20 |
$sth = $dbh->prepare("$sql"); |
$sth = $dbh->prepare("$sql"); |
21 |
$sth->execute(); |
$sth->execute(); |
22 |
$row=$sth->fetchrow_hash(); |
$row=$sth->fetchrow_hash(); |
23 |
|
|
24 |
$title.=" : $row[name]"; |
$title.=" : $row[name]"; |
25 |
if (file_exists(find_html_file("multi",$row[html]))) { |
if ($row[type]=="h" && find_html_file("multi",$row[html])) { |
26 |
$main=join('',file(find_html_file("multi",$row[html]))); |
$main=join('',file(find_html_file("multi",$row[html]))); |
27 |
|
} elseif ($row[type]=="p") { |
28 |
|
if (find_html_file("",$row[path])) { |
29 |
|
$main=join('',file(find_html_file("",$row[path]))); |
30 |
|
// fix entities from MS programs |
31 |
|
include("fix_msshit.inc"); |
32 |
|
$main=fix_msshit($main); |
33 |
|
} else { |
34 |
|
$main="<b>can't find $row[path] for id $p</b>"; |
35 |
|
} |
36 |
|
// try to load translation (html fix-up or something) |
37 |
|
$fix_up="./fix_up/".str_replace("/","_",dirname($row[path])).".inc"; |
38 |
|
|
39 |
|
# $main.="<!-- trying to use fixup $fix_up -->"; ## DEBUG |
40 |
|
if (file_exists($fix_up)) { |
41 |
|
include($fix_up); |
42 |
|
# $main.="<!-- fixup: $fix_up -->"; ## DEBUG |
43 |
|
} |
44 |
} else { |
} else { |
45 |
$main="<b>can't find multi page for id $p</b>"; |
$main="<b>can't find multi page for id $p</b>"; |
46 |
} |
} |
55 |
$title=str_replace("\\n"," ",$title); // nuke nl chars |
$title=str_replace("\\n"," ",$title); // nuke nl chars |
56 |
|
|
57 |
// fetch all pages in this multi-page |
// fetch all pages in this multi-page |
58 |
$sql="select id,name from multi where visible and menu_num=$row[menu_num] order by menu_num,num"; |
$sql="select id,name from multi where $visible_is_true and menu_num=$row[menu_num] order by menu_num,num"; |
59 |
$sth = $dbh->prepare("$sql"); |
$sth = $dbh->prepare("$sql"); |
60 |
$sth->execute(); |
$sth->execute(); |
61 |
|
|
66 |
while ($row=$sth->fetchrow_hash()) { |
while ($row=$sth->fetchrow_hash()) { |
67 |
array_push($multi_page_url,"$PHP_SELF?p=$row[id]"); |
array_push($multi_page_url,"$PHP_SELF?p=$row[id]"); |
68 |
array_push($multi_page_id,$row[id]); |
array_push($multi_page_id,$row[id]); |
69 |
$multi_page_options[$row[id]]=$row[name]; |
$drop_title=$row[name]; |
70 |
#array_push($multi_page_options,array( value=>$row[id], output=>$row[name])); |
if (strlen($drop_title) > $max_title_len) $drop_title=substr($drop_title,0,$max_title_len)."..."; |
71 |
|
$multi_page_options[$row[id]]=$drop_title; |
72 |
if ($row[id] == $p) { |
if ($row[id] == $p) { |
73 |
$current=$max; |
$current=$max; |
74 |
$curr_id=$row[id]; |
$curr_id=$row[id]; |