root/mytrz-gallery/index.php

Revision 55, 5.5 KB (checked in by aqua, 4 years ago)

reimport old stuffes

Line 
1<?
2
3        /* get config variables */
4        require_once("config.php");
5        require_once("function.php");
6       
7        if( !isset($list_file) ){
8                echo "list file is not defined... check config file";
9        }
10        else if( !file_exists($list_file) ){
11                echo "list file is not present... make new :D";
12        }
13        else {
14                /* if original img folder is updated ... refresh list :) */
15                $last_update  = filemtime( $img_dir );
16                $last_refresh = filemtime( $data_file );
17
18                /* is there update? */
19                if( $last_refresh < $last_update ){
20                        update_list($last_refresh);
21                }
22        }
23       
24        $page = $_GET[page];
25       
26        /* open list */
27        if( !($file = fopen($list_file, "r")) ){
28                /* die with error */
29                echo "no list file detected :)";
30
31                exit;
32        }
33
34        /* get list */
35        while( !feof($file) )
36                $temp .= fread( $file, 4096 );
37
38        fclose( $file );
39        unset( $file );
40
41        $data = explode( "\n", $temp );
42        unset($temp);
43
44        /* caculate page number */
45        if(!$page) 
46                $page=1;
47
48        $total    = count($data) - 1;
49        $t_page   = (int)( ($total - 1) / $p_page ) + 1;
50
51        $t_page_g = (int) ( ($t_page - 1) / $p_list ) + 1;
52        $c_page_g = (int) ( ($page - 1) / $p_list ) + 1;
53
54        if( ( $page * $p_page ) > $total )
55                $end = $total % $p_page;
56        else 
57                $end = $p_page;
58
59        $start = ( $page - 1 ) * $p_page;
60
61                echo "
62<html>
63<head>
64        <title> :::  Linux œºÅ©ž°ŒŠ žðÀœ ::: </title>
65        <style>
66        <!--
67
68                td { font-size: 9pt; font-family: verdana, ±Œž² ; }
69                a {font-size:9pt;color:#111111;text-decoration:none}
70                a:hover {font-size:9pt;color:#444444;text-decoration:underline}
71
72        -->
73        </style>
74        <script language=JavaScript>
75        <!-- JavaScript
76
77        //var msgWin;
78       
79                _dom=0;
80                strs=\"\";
81
82                function keypresshandler(e){
83
84                        if(document.all) e=window.event; // for IE
85                        if(_dom==3) var EventStatus = e.srcElement.tagName;
86                        else if(_dom==1) var EventStatus = e.target.nodeName; // for Mozilla
87
88                        if(EventStatus == 'INPUT' || EventStatus == 'TEXTAREA' || _dom == 2) return;
89
90        var cc = '';
91        var ch = '';
92
93                        if(_dom==3) {                   // for IE
94
95                                if(e.keyCode>0) {
96
97                                        ch=String.fromCharCode(e.keyCode);
98                                        cc=e.keyCode;
99
100                                }
101
102                        } else {                       // for Mozilla
103
104                                cc=(e.keyCode);
105
106                                if(e.charCode>0) {
107
108                                        ch=String.fromCharCode(e.charCode);
109
110                                }
111
112                        }
113
114                        if(e.altKey || e.ctrlKey) return;
115
116        ";
117       
118        if( $page < $t_page ){
119       
120                echo "
121                if(ch == 'n' || ch == 'N')
122                                        self.location = './?page=".($_GET[page]+1)."';
123
124                ";
125        }
126        else{
127
128                echo "
129                if(ch == 'n' || ch == 'N')
130                                        alert('ž¶Áöž· ÆäÀÌÁöÀÔŽÏŽÙ..');
131
132                ";
133        }
134               
135       
136        if( $page > 1 ){
137
138                echo "
139                else if( ch == 'b' || ch == 'B' )
140                        self.location = './?page=".($page-1)."';
141                       
142                ";
143
144        }
145        else {
146
147                echo "
148                else if( ch == 'b' || ch == 'B' )
149                        alert('ùÆäÀÌÁöÀÔŽÏŽÙ..');
150                       
151                ";
152
153        }
154
155
156        echo "
157                        return;
158                }
159
160                function input(){
161
162                        _dom=document.all ? 3 : (document.getElementById ? 1 : (document.layers ? 2 : 0));
163                        document.onkeypress = keypresshandler;
164
165                }
166       
167        function winopen( url ,width, height) {
168               
169                //if( msgWin )
170                //      msgWin.close();
171
172                if( navigator.userAgent.indexOf(\"MSIE\") == -1 ){
173               
174                        msgWin = window.open(url, 'photo', 'scrollbars=yes,status=no,resizable=no,fullscreen=no,width='+width+',height='+height+',top=0,left=0');
175
176                }
177                else{
178               
179                        msgWin = window.open(url, 'photo', 'scrollbars=no,status=no,resizable=yes,fullscreen=no,width='+width+',height='+height+',top=0,left=0');
180
181                }
182                msgWin.moveTo(0,0);
183               
184        }
185
186                input();
187        // - JavaScript - -->
188        </script>
189</head>
190
191<body>
192<table align=center cellspacing=3 cellpadding=0>
193<tr>
194        <td colspan=3 valign=bottom>
195        <b>Total:</b> $total <b>Page:</b> $page/$t_page 
196        </td>
197</tr>
198<tr>
199        <td>
200                ";
201       
202                unset($total);
203       
204                for($i=0;$i<$end;$i++){
205
206                if( is_file( "./original/".$data[$start] ) ){
207
208                        $image_size = getimagesize( "./original/".$data[$start] );
209                       
210                        if( $image_size[0] > 1024 )
211                                $image_size[0] = 1024;
212                               
213                        if( $image_size[1] > 768 )
214                                $image_size[1] = 768;
215                               
216                        $link = "<a href=\"javascript:winopen( 'show_pic.php?img=".$data[$start]."', $image_size[0], $image_size[1] )\"><img src='./".$data[$start]."' border=0></a>";
217
218                }
219                else{
220
221                        $link = "<img src='./".$data[$start]."' border=0>";
222
223                }
224       
225                        echo "
226<table width=252 cellpadding=0 cellspacing=0 border=0  align=center bgcolor=#f3f3f3>
227<tr height=5>
228        <td width=5><img src=/image/img_tl.gif border=0></td>
229        <td background=/image/img_t.gif><img height=5 width=1 border=0></td>
230        <td width=5><img src=/image/img_tr.gif border=0></td>
231</tr>
232<tr>
233        <td background=/image/img_l.gif><img width=5 height=1></td>
234        <td>". $link ."</td>
235        <td background=/image/img_r.gif><img width=5 height=1></td>
236</tr>
237<tr height=5>
238        <td width=5><img src=/image/img_bl.gif border=0></td>
239        <td background=/image/img_b.gif><img height=5 width=1 border=0></td>
240        <td width=5><img src=/image/img_br.gif border=0></td>
241</tr>
242</table>
243                        ";
244       
245                if( ($i%3) == 2 ) echo "</td></tr><tr><td>\n";
246                else echo "</td><td>\n";
247
248                        $start++;
249                unset( $link );
250
251                }
252        echo "</td></tr><tr><td colspan=3>";
253
254                unset($i);
255
256                if($c_page_g>1){
257                 
258                        $mov=($c_page_g-1)*$p_list;
259                        echo "
260                        <a href=$PHP_SELF?page=1>[1]</a>..
261                        <a href=$PHP_SELF?page=$mov>[prev]</a>
262                        ";
263
264                }
265
266                if($c_page_g==$t_page_g) $end=$t_page+1;
267                else $end=$c_page_g*$p_list+1;
268
269                $start=($c_page_g-1)*$p_list+1;
270
271                while($start<$end){
272
273                        if( $start != $page )
274                                echo "<a href=$PHP_SELF?page=$start>[$start]</a>";
275                else 
276                        echo " ".$start." ";
277                        $start++;
278
279                }
280
281                if($c_page_g<$t_page_g){
282
283                        $mov=$c_page_g*$p_list+1;
284                        echo "
285                        <a href=$PHP_SELF?page=$mov>[next]</a>
286                        .. <a href=$PHP_SELF?page=$t_page>[$t_page]</a>
287                        ";
288
289                }
290
291        }
292        else{
293
294                echo "DatažŠ ºÒ·¯¿ÀŽÂ µ¥ œÇÆÐÇßœÀŽÏŽÙ..";
295
296        }
297
298       
299        echo "
300        </td>
301</tr>
302</table>
303        ";
304
305?>
306</body>
307</html>
Note: See TracBrowser for help on using the browser.