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

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

  ViewVC Help
Powered by ViewVC 1.1.26