--- multi.php 2001/07/09 08:49:46 1.2 +++ multi.php 2001/11/07 14:24:02 1.10 @@ -1,4 +1,7 @@ assign( array ( Title=>"PLIVA Ljubljana" ) ); include("find_html_file.inc"); +include("fix_msshit.inc"); if (! isset($p)) { $p=0; $section="domov"; } else { // fetch current page - $sql="select id,menu_num,name,html,path,type 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"; $sth = $dbh->prepare("$sql"); $sth->execute(); - $row=$sth->fetchrow_hash(); + if (! $row=$sth->fetchrow_hash()) { + $sth = $dbh->prepare("select min(num) as menu_num from menu"); + $sth->execute(); + $row2=$sth->fetchrow_hash(); + $row = array(id=>0,menu_num=>$row2[menu_num],name=>"Can't find page",html=>'',path=>'',type=>''); + } $title.=" : $row[name]"; - if ($row[type]=="h" && file_exists(find_html_file("multi",$row[html]))) { + $smarty->assign("mtext",$row[name]); + if ($row[type]=="h" && find_html_file("multi",$row[html])) { $main=join('',file(find_html_file("multi",$row[html]))); - } elseif ($row[type]=="p" && file_exists(find_html_file("",$row[path]))) { - $main=join('',file(find_html_file("",$row[path]))); + $main=fix_msshit($main); + } elseif ($row[type]=="p") { + if (find_html_file("",$row[path])) { + $main=join('',file(find_html_file("",$row[path]))); + // fix entities from MS programs + $main=fix_msshit($main); + } else { + $main="can't find $row[path] for id $p"; + } // try to load translation (html fix-up or something) $fix_up="./fix_up/".str_replace("/","_",dirname($row[path])).".inc"; + +# $main.=""; ## DEBUG if (file_exists($fix_up)) { include($fix_up); +# $main.=""; ## DEBUG } } else { $main="can't find multi page for id $p"; @@ -42,7 +62,7 @@ $title=str_replace("\\n"," ",$title); // nuke nl chars // fetch all pages in this multi-page - $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"; $sth = $dbh->prepare("$sql"); $sth->execute(); @@ -53,8 +73,9 @@ while ($row=$sth->fetchrow_hash()) { array_push($multi_page_url,"$PHP_SELF?p=$row[id]"); array_push($multi_page_id,$row[id]); - $multi_page_options[$row[id]]=$row[name]; - #array_push($multi_page_options,array( value=>$row[id], output=>$row[name])); + $drop_title=$row[name]; + if (strlen($drop_title) > $max_title_len) $drop_title=substr($drop_title,0,$max_title_len)."..."; + $multi_page_options[$row[id]]=$drop_title; if ($row[id] == $p) { $current=$max; $curr_id=$row[id];