/[health_html]/inc/util.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 /inc/util.php

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

revision 1.8 by ravilov, Fri Oct 12 09:22:02 2001 UTC revision 1.10 by ravilov, Tue Oct 23 16:13:59 2001 UTC
# Line 38  Line 38 
38                  return array($w, $h);                  return array($w, $h);
39          }          }
40    
41          function GetLinks($read, $more, $more_title, $id, $cat, $name, $updown = false, $up = false, $down = false, $prikazi = true) {          function GetLinks($read, $more, $more_title, $id, $cat, $name, $updown = false, $up = false, $down = false, $prikazi = true, $related = false) {
42                  $t = new Smarty();                  $t = new Smarty();
43                  global $section, $section_menu, $section_menu2, $spec, $isMed, $isEdit, $offset;                  global $section, $section_menu, $section_menu2, $spec, $isMed, $isEdit, $offset;
44                  $t->assign("section", $section);                  $t->assign("section", $section);
# Line 50  Line 50 
50                  $t->assign("cat", $cat);                  $t->assign("cat", $cat);
51                  $t->assign("med", $isMed);                  $t->assign("med", $isMed);
52                  $m = "more";                  $m = "more";
53                  if ($cat == "t") $m = "tmore";                  if ($cat == "t" || $cat == "3") $m = "tmore";
54                  if ($cat == "w") $m = "wmore";                  if ($cat == "w") $m = "wmore";
55                  if ($cat == "p") $m = "pmore";                  if ($cat == "p") $m = "pmore";
56                  $t->assign("m", $m);                  $t->assign("m", $m);
57                  $t->assign("name", $name);                  $t->assign("name", $name);
58                  $t->assign("read", $read || ($more && !strstr($more, "?")) ? $read : "");                  $t->assign("read", $read /* && (!$more || ($more && !strpos($more, "?"))) ? $read : "" */);
59                  $t->assign("more", /* $more */ strstr($more, "?") ? $more : "");                  $t->assign("more", /* $more */ strstr($more, "?") ? $more : "");
60                  $t->assign("more_new", strstr($more, "://") ? true : false);                  $t->assign("more_new", strstr($more, "://") ? true : false);
61                  $t->assign("more_title", $more_title);                  $t->assign("more_title", $more_title);
# Line 64  Line 64 
64                  $t->assign("up", $up);                  $t->assign("up", $up);
65                  $t->assign("down", $down);                  $t->assign("down", $down);
66                  $t->assign("prikazi", $prikazi);                  $t->assign("prikazi", $prikazi);
67                    $t->assign("related", $related);
68                  return $t->fetch("links.tpl");                  return $t->fetch("links.tpl");
69          }          }
70    
# Line 90  Line 91 
91                  return $tp->fetch("highlight.tpl");                  return $tp->fetch("highlight.tpl");
92          }          }
93    
94          function GetAuthor($pic = "", $alt = "", $info = "", $width = 0, $height = 0) {          function GetAuthor($pic = "", $alt = "", $info = "", $width = 0, $height = 0, $cv = 0) {
95                  $t = new Smarty();                  $t = new Smarty();
96                  global $aupicdir;                  global $aupicdir;
97                  $t->assign("aupicdir", "$aupicdir/");                  $t->assign("aupicdir", "$aupicdir/");
98                  $t->assign("url", $pic);                  $t->assign("url", $pic);
99                  $t->assign("alt", $alt);                  $t->assign("alt", $alt);
100                  $t->assign("info", nl2br($info));                  $info = nl2br($info);
101                    if ($cv) {
102                            $info = str_replace("{", "<a href=\"autor.php?id=$cv\" target=\"_blank\" class=\"underlined\" onclick=\"window.open(this.href, this.target, 'width=450,height=600,toolbar=no,menu=no'); return false;\">", $info);
103                            $info = str_replace("}", "</a>", $info);
104                    } else {
105                            $info = str_replace("{", "", $info);
106                            $info = str_replace("}", "", $info);
107                    }
108                    $t->assign("info", $info);
109                  $t->assign("width", $width);                  $t->assign("width", $width);
110                  $t->assign("height", $hight);                  $t->assign("height", $hight);
111                  return $t->fetch("author.tpl");                  return $t->fetch("author.tpl");
# Line 106  Line 115 
115                  global $dbh;                  global $dbh;
116                  $conn = $dbh ? true : false;                  $conn = $dbh ? true : false;
117                  if (!$conn) include("inc/conn.php");                  if (!$conn) include("inc/conn.php");
118                  $sql = "SELECT stanje, trave, korov, stabla, date FROM semafor ORDER BY date DESC LIMIT 1";                  $sql = "SELECT stanje, trave, korov, stabla, date, prikazi_date FROM semafor ORDER BY date DESC LIMIT 1";
119                  $sth = $dbh->prepare($sql);                  $sth = $dbh->prepare($sql);
120                  if (!$sth) error("Cannot prepare query: \"$sql\"");                  if (!$sth) error("Cannot prepare query: \"$sql\"");
121                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
# Line 115  Line 124 
124                  if (!$conn) $dbh->disconnect();                  if (!$conn) $dbh->disconnect();
125                  $t = new Smarty();                  $t = new Smarty();
126                  if ($row) {                  if ($row) {
127                          list($stanje, $trave, $korov, $stabla, $date) = $row;                          list($stanje, $trave, $korov, $stabla, $date, $prik) = $row;
128                            if ($prik[0] == "f" || $prik[0] == "F") unset($prik);
129                          $t->assign("stabla", $stabla);                          $t->assign("stabla", $stabla);
130                          $t->assign("trave", $trave);                          $t->assign("trave", $trave);
131                          $t->assign("korov", $korov);                          $t->assign("korov", $korov);
132                          $t->assign("msg", $stanje);                          $t->assign("msg", $stanje);
133                          $t->assign("date", $date ? strftime("%d.%m.%y.", strtotime($date)) : "");                          $t->assign("date", $prik && $date ? strftime("%d.%m.%y.", strtotime($date)) : "");
134                  }                  }
135                  return $t->fetch("semafor-table.tpl");                  return $t->fetch("semafor-table.tpl");
136          }          }
# Line 171  Line 181 
181          }          }
182    
183          $isEdit = stristr($ME, "/edit/") ? true : false;          $isEdit = stristr($ME, "/edit/") ? true : false;
184          $isMed = stristr($ME, "med") || stristr($ME, "pm") ? true : false;          # $isMed = stristr($ME, "med") || stristr($ME, "pm") ? true : false;
185            include_once("_site.php");      // This should define $isMed.
186    
187          function Auth($user = "", $pwd = "") {          function Auth($user = "", $pwd = "") {
188                  global $ME,$HTTP_USER_AGENT,$REMOTE_ADDR;                  global $ME,$HTTP_USER_AGENT,$REMOTE_ADDR;

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

  ViewVC Help
Powered by ViewVC 1.1.26