--- multi.php 2001/07/10 07:50:34 1.4 +++ multi.php 2001/11/07 14:24:02 1.10 @@ -10,23 +10,33 @@ $smarty->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]))); + $main=fix_msshit($main); } elseif ($row[type]=="p") { - if (file_exists(find_html_file("",$row[path]))) { + 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"; } @@ -52,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();