/[pliva-si]/multi.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /multi.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by dpavlin, Mon Jul 9 08:49:46 2001 UTC revision 1.9 by dpavlin, Wed Nov 7 12:09:58 2001 UTC
# Line 1  Line 1 
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    
# Line 13  if (! isset($p)) { Line 16  if (! isset($p)) {
16          $section="domov";          $section="domov";
17  } else {  } else {
18          // fetch current page          // fetch current page
19          $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";
20          $sth = $dbh->prepare("$sql");          $sth = $dbh->prepare("$sql");
21          $sth->execute();          $sth->execute();
22          $row=$sth->fetchrow_hash();          if (! $row=$sth->fetchrow_hash()) {
23                    $sth = $dbh->prepare("select min(num) as menu_num from menu");
24                    $sth->execute();
25                    $row2=$sth->fetchrow_hash();
26                    $row = array(id=>0,menu_num=>$row2[menu_num],name=>"Can't find page",html=>'',path=>'',type=>'');
27            }
28    
29          $title.=" : $row[name]";          $title.=" : $row[name]";
30          if ($row[type]=="h" && file_exists(find_html_file("multi",$row[html]))) {          $smarty->assign("mtext",$row[name]);
31            if ($row[type]=="h" && find_html_file("multi",$row[html])) {
32                  $main=join('',file(find_html_file("multi",$row[html])));                  $main=join('',file(find_html_file("multi",$row[html])));
33          } elseif ($row[type]=="p" && file_exists(find_html_file("",$row[path]))) {          } elseif ($row[type]=="p") {
34                  $main=join('',file(find_html_file("",$row[path])));                  if (find_html_file("",$row[path])) {
35                            $main=join('',file(find_html_file("",$row[path])));
36                            // fix entities from MS programs
37                            include("fix_msshit.inc");
38                            $main=fix_msshit($main);
39                    } else {
40                            $main="<b>can't find $row[path] for id $p</b>";
41                    }
42                  // try to load translation (html fix-up or something)                  // try to load translation (html fix-up or something)
43                  $fix_up="./fix_up/".str_replace("/","_",dirname($row[path])).".inc";                  $fix_up="./fix_up/".str_replace("/","_",dirname($row[path])).".inc";
44                    
45    #               $main.="<!-- trying to use fixup $fix_up -->";  ## DEBUG
46                  if (file_exists($fix_up)) {                  if (file_exists($fix_up)) {
47                          include($fix_up);                          include($fix_up);
48    #                       $main.="<!-- fixup: $fix_up -->";       ## DEBUG
49                  }                  }
50          } else {          } else {
51                  $main="<b>can't find multi page for id $p</b>";                  $main="<b>can't find multi page for id $p</b>";
# Line 42  if (! isset($p)) { Line 61  if (! isset($p)) {
61          $title=str_replace("\\n"," ",$title);   // nuke nl chars          $title=str_replace("\\n"," ",$title);   // nuke nl chars
62    
63          // fetch all pages in this multi-page          // fetch all pages in this multi-page
64          $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";
65          $sth = $dbh->prepare("$sql");          $sth = $dbh->prepare("$sql");
66          $sth->execute();          $sth->execute();
67    
# Line 53  if (! isset($p)) { Line 72  if (! isset($p)) {
72          while ($row=$sth->fetchrow_hash()) {          while ($row=$sth->fetchrow_hash()) {
73                  array_push($multi_page_url,"$PHP_SELF?p=$row[id]");                  array_push($multi_page_url,"$PHP_SELF?p=$row[id]");
74                  array_push($multi_page_id,$row[id]);                  array_push($multi_page_id,$row[id]);
75                  $multi_page_options[$row[id]]=$row[name];                  $drop_title=$row[name];
76                  #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)."...";
77                    $multi_page_options[$row[id]]=$drop_title;
78                  if ($row[id] == $p) {                  if ($row[id] == $p) {
79                          $current=$max;                          $current=$max;
80                          $curr_id=$row[id];                          $curr_id=$row[id];

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.26