3 |
//----------------------------------------- |
//----------------------------------------- |
4 |
// Custom made by Dobrica Pavlinusic <dpavlin@rot13.org> |
// Custom made by Dobrica Pavlinusic <dpavlin@rot13.org> |
5 |
|
|
6 |
|
// helper function to make full path of relative dir |
7 |
|
function dir2path($dir) { |
8 |
|
if (substr($dir,0,1) != "/") { |
9 |
|
return dirname($GLOBALS[SCRIPT_FILENAME])."/$dir"; |
10 |
|
} else { |
11 |
|
return $dir; |
12 |
|
} |
13 |
|
} |
14 |
|
|
15 |
function smarty_func_img() { |
function smarty_func_img() { |
16 |
extract(func_get_arg(0)); |
extract(func_get_arg(0)); |
17 |
|
|
24 |
|
|
25 |
|
|
26 |
if (isset($dir)) { |
if (isset($dir)) { |
27 |
$tdir=dirname($GLOBALS[SCRIPT_FILENAME])."/$dir"; |
$tdir=dir2path($dir); |
28 |
$h=opendir($dir); |
$h=opendir($dir); |
29 |
$pics=0; |
$pics=0; |
30 |
while ($tmp = readdir($h)) { |
while ($tmp = readdir($h)) { |
59 |
|
|
60 |
$out=""; |
$out=""; |
61 |
$product_link = array ( |
$product_link = array ( |
62 |
"andol.gif"=>"human_health.php?search=andol&show_description=on#results", |
"andol.gif"=>"http://www.pliva.hr/human_health.php?search=andol&show_description=on#results", |
63 |
"andol_c.jpg"=>"human_health.php?search=andol%25c&show_description=on#results", |
"andol_c.jpg"=>"http://www.pliva.hr/human_health.php?search=andol%25c&show_description=on#results", |
64 |
"bisolex.jpg"=>"human_health.php?search=bisolex&show_description=on#results", |
"bisolex.jpg"=>"http://www.pliva.hr/human_health.php?search=bisolex&show_description=on#results", |
65 |
"plibex.gif"=>"human_health.php?search=plibex&show_description=on#results", |
"plibex.gif"=>"http://www.pliva.hr/human_health.php?search=plibex&show_description=on#results", |
66 |
"plivit_b.gif"=>"human_health.php?search=plivit%25b&show_description=on#results", |
"plivit_b.gif"=>"http://www.pliva.hr/human_health.php?search=plivit%25b&show_description=on#results", |
67 |
"plivit_b6.gif"=>"human_health.php?search=plivit%25b6&show_description=on#results", |
"plivit_b6.gif"=>"http://www.pliva.hr/human_health.php?search=plivit%25b6&show_description=on#results", |
68 |
"plivit_c.gif"=>"human_health.php?search=plivit%25c&show_description=on#results", |
"plivit_c.gif"=>"http://www.pliva.hr/human_health.php?search=plivit%25c&show_description=on#results", |
69 |
|
"plivazdravlje.gif"=>"http://www.plivazdravlje.hr/", |
70 |
|
"plivamed.gif"=>"http://www.plivamed.net/", |
71 |
); |
); |
72 |
|
|
73 |
$pic=basename($src); |
$pic=basename($src); |
76 |
$add.=" border=\"0\""; |
$add.=" border=\"0\""; |
77 |
} |
} |
78 |
|
|
79 |
$size = GetImageSize(dirname($GLOBALS[SCRIPT_FILENAME])."/$src"); |
$size = GetImageSize(dir2path($src)); |
80 |
$out.="<img src=\"$src\" $size[3]$add>"; |
$out.="<img src=\"$src\" $size[3]$add>"; |
81 |
if ($product_link[$pic]) { |
if ($product_link[$pic]) { |
82 |
$out.="</a>"; |
$out.="</a>"; |
122 |
|
|
123 |
function smarty_mod_filesize($file,$dir,$unit="") |
function smarty_mod_filesize($file,$dir,$unit="") |
124 |
{ |
{ |
125 |
$path=dirname($GLOBALS[SCRIPT_FILENAME])."/$dir/$file"; |
$path=dir2path("$dir/$file"); |
126 |
|
$ext=explode(".",$file); |
127 |
|
$ext=strtoupper(array_pop($ext)); |
128 |
|
|
129 |
if ($size=filesize($path)) { |
if ($size=filesize($path)) { |
130 |
switch ($unit) { |
switch ($unit) { |
131 |
case 'Mb': |
case 'Mb': |
132 |
case 'mb': |
case 'mb': |
133 |
return sprintf("%2.1f Mb",$size/(1024*1024)); |
return sprintf("%s, %2.1f Mb",$ext,$size/(1024*1024)); |
134 |
case 'Kb': |
case 'Kb': |
135 |
case 'kb': |
case 'kb': |
136 |
return sprintf("%2.1f Mb",$size/1024); |
return sprintf("%s, %2.1f Mb",$ext,$size/1024); |
137 |
case 'auto': |
case 'auto': |
138 |
$size=$size/1024; # Kb |
$size=$size/1024; # Kb |
139 |
if ($size > 1024) { |
if ($size > 1024) { |
140 |
return sprintf("%2.1f Mb",$size/1024); |
return sprintf("%s, %2.1f Mb",$ext,$size/1024); |
141 |
} else { |
} else { |
142 |
return sprintf("%2.1f Kb",$size); |
return sprintf("%s, %2.1f Kb",$ext,$size); |
143 |
} |
} |
144 |
|
|
145 |
} |
} |
147 |
} |
} |
148 |
} |
} |
149 |
|
|
150 |
?> |
// input functions (input, rinput) |
151 |
|
|
152 |
|
function smarty_func_input() { |
153 |
|
extract(func_get_arg(0)); |
154 |
|
print "<input name=\"$name\" size=\"$size\" value=\"".$GLOBALS[$name]."\">"; |
155 |
|
print "<input type=\"hidden\" name=\"inputs_required[]\" value=\"$name\">"; |
156 |
|
if ($type) print "<input type=\"hidden\" name=\"inputs_required_type[$name]\" value=\"$type\">"; |
157 |
|
} |
158 |
|
|
159 |
|
function smarty_func_rinput() { |
160 |
|
extract(func_get_arg(0)); |
161 |
|
global $inputs_required_type; |
162 |
|
$ok=1; |
163 |
|
if (! isset($GLOBALS[$name]) || $GLOBALS[$name] == "") { |
164 |
|
$ok=0; |
165 |
|
} else { |
166 |
|
switch($inputs_required_type[$name]) { |
167 |
|
case 'email': |
168 |
|
if (!strstr($GLOBALS[$name],'@')) $ok=0; |
169 |
|
} |
170 |
|
} |
171 |
|
if ($ok) { |
172 |
|
print "$desc"; |
173 |
|
} else { |
174 |
|
print "<b>$desc</b>"; |
175 |
|
} |
176 |
|
} |
177 |
|
?> |