/[corp_html]/inc/Smarty.local.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

Annotation of /inc/Smarty.local.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Mar 3 12:56:17 2001 UTC (23 years, 2 months ago) by dpavlin
Branch: MAIN
lokalne promjene u Smarty.local.php

1 dpavlin 1.1 <?php
2    
3     //-----------------------------------------
4     // Custom made by Dobrica Pavlinusic <dpavlin@rot13.org>
5    
6     function smarty_func_img() {
7     extract(func_get_arg(0));
8    
9     $f=Array();
10    
11     global $img_time;
12     if (!isset($img_time)) {
13     $img_time=time();
14     }
15    
16    
17     if (isset($dir)) {
18     $tdir=dirname($GLOBALS[SCRIPT_FILENAME])."/$dir";
19     $h=opendir($dir);
20     $pics=0;
21     while ($tmp = readdir($h)) {
22     if (is_file("$tdir/$tmp") && substr($tmp,0,1)!=".") {
23     // print "$tdir/$tmp<br>\n";
24     $f[]=$tmp;
25     $pics++;
26     }
27     }
28     closedir($h);
29     // $f=shuffle($f);
30     $ord=($img_time+$nr) % $pics;
31     $src="$dir/$f[$ord]";
32     }
33    
34     $add="";
35     if (isset($border)) {
36     $add.=" border=\"$border\"";
37     }
38     if (isset($alt)) {
39     $add.=" alt=\"$alt\"";
40     }
41     if (isset($align)) {
42     $add.=" align=\"$align\"";
43     }
44     if (isset($hspace)) {
45     $add.=" hspace=\"$hspace\"";
46     }
47     if (isset($vspace)) {
48     $add.=" vspace=\"$vspace\"";
49     }
50    
51     $size = GetImageSize(dirname($GLOBALS[SCRIPT_FILENAME])."/$src");
52     print "<img src=\"$src\" $size[3]$add>";
53     }
54    
55     // checkboxes
56    
57     function smarty_func_html_checkboxes()
58     {
59     $print_result = true;
60    
61     extract(func_get_arg(0));
62    
63     settype($output, 'array');
64     settype($values, 'array');
65    
66     $html_result = "";
67    
68     for ($i = 0; $i < count($output); $i++) {
69     /* By default, check value against $selected */
70     $sel_check = $values[$i];
71     if (isset($before)) $html_result.=$before;
72     $html_result .= "<input type=checkbox name=\"".$values[$i]."\"";
73     if (isset($GLOBALS[$values[$i]])) {
74     $html_result .= " checked";
75     }
76     $html_result .= ">".$output[$i]."\n";
77     if (isset($after)) $html_result.=$after;
78     }
79    
80     if ($print_result)
81     print $html_result;
82     else
83     return $html_result;
84     }
85    
86     ?>
87    

  ViewVC Help
Powered by ViewVC 1.1.26