source: trunk/admin/configuration.php @ 21

Last change on this file since 21 was 21, checked in by z0rglub, 21 years ago

* empty log message *

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 33.1 KB
Line 
1<?
2/***************************************************************************
3 *                             configuration.php                           *
4 *                            -------------------                          *
5 *   application          : PhpWebGallery 1.3                              *
6 *   website              : http://www.phpwebgallery.net                   *
7 *   author               : Pierrick LE GALL <pierrick@z0rglub.com>        *
8 *                                                                         *
9 ***************************************************************************/
10
11/***************************************************************************
12 *                                                                         *
13 *   This program is free software; you can redistribute it and/or modify  *
14 *   it under the terms of the GNU General Public License as published by  *
15 *   the Free Software Foundation;                                         *
16 *                                                                         *
17 ***************************************************************************/
18
19include_once( './include/isadmin.inc.php' );
20       
21$Caracs = array("¥" => "Y", "µ" => "u", "À" => "A", "Á" => "A", 
22                "Â" => "A", "Ã" => "A", "Ä" => "A", "Å" => "A", 
23                "Æ" => "A", "Ç" => "C", "È" => "E", "É" => "E", 
24                "Ê" => "E", "Ë" => "E", "Ì" => "I", "Í" => "I", 
25                "Î" => "I", "Ï" => "I", "Ð" => "D", "Ñ" => "N", 
26                "Ò" => "O", "Ó" => "O", "Ô" => "O", "Õ" => "O", 
27                "Ö" => "O", "Ø" => "O", "Ù" => "U", "Ú" => "U", 
28                "Û" => "U", "Ü" => "U", "Ý" => "Y", "ß" => "s", 
29                "à" => "a", "á" => "a", "â" => "a", "ã" => "a", 
30                "ä" => "a", "å" => "a", "æ" => "a", "ç" => "c", 
31                "è" => "e", "é" => "e", "ê" => "e", "ë" => "e", 
32                "ì" => "i", "í" => "i", "î" => "i", "ï" => "i", 
33                "ð" => "o", "ñ" => "n", "ò" => "o", "ó" => "o", 
34                "ô" => "o", "õ" => "o", "ö" => "o", "ø" => "o", 
35                "ù" => "u", "ú" => "u", "û" => "u", "ü" => "u", 
36                "ý" => "y", "ÿ" => "y");
37//------------------------------ verification and registration of modifications
38$conf_infos =
39array( 'prefix_thumbnail','webmaster','mail_webmaster','access',
40       'session_id_size','session_time','session_keyword','max_user_listbox',
41       'show_comments','nb_comment_page','upload_available',
42       'upload_maxfilesize', 'upload_maxwidth','upload_maxheight',
43       'upload_maxwidth_thumbnail','upload_maxheight_thumbnail' );
44$default_user_infos =
45array( 'nb_image_line','nb_line_page','theme','language','maxwidth',
46       'maxheight','expand','show_nb_comments','short_period','long_period',
47       'template' );
48$error = array();
49if ( isset( $_POST['submit'] ) )
50{
51  $int_pattern = '/^\d+$/';
52  // empty session table if asked
53  if ( $_POST['empty_session_table'] == 1 )
54  {
55    $query = 'DELETE FROM '.PREFIX_TABLE.'sessions';
56    $query.= ' WHERE expiration < '.time().';';
57    mysql_query( $query );
58  }
59  // deletion of site as asked
60  $query = 'SELECT id';
61  $query.= ' FROM '.PREFIX_TABLE.'sites';
62  $query.= " WHERE galleries_url <> './galleries/';";
63  $result = mysql_query( $query );
64  while ( $row = mysql_fetch_array( $result ) )
65  {
66    $site = 'delete_site_'.$row['id'];
67    if ( $_POST[$site] == 1 ) delete_site( $row['id'] );
68  }
69  // thumbnail prefix must not contain accentuated characters
70  $old_prefix = $_POST['prefix_thumbnail'];
71  $prefix = strtr( $_POST['prefix_thumbnail'], $Caracs );
72  if ( $old_prefix != $prefix )
73  {
74    array_push( $error, $lang['conf_err_prefixe'] );
75  }
76  // mail mail must be formatted as follows : name@server.com
77  $pattern = '/^[\w-]+(\.[\w-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$/';
78  if ( !preg_match( $pattern, $_POST['mail_webmaster'] ) )
79  {
80    array_push( $error, $lang['conf_err_mail'] );
81  }
82  // periods must be integer values, they represents number of days
83  if ( !preg_match( $int_pattern, $_POST['short_period'] )
84       or !preg_match( $int_pattern, $_POST['long_period'] ) )
85  {
86    array_push( $error, $lang['err_periods'] );
87  }
88  else
89  {
90    // long period must be longer than short period
91    if ( $_POST['long_period'] <= $_POST['short_period']
92         or $_POST['short_period'] <= 0 )
93    {
94      array_push( $error, $lang['err_periods_2'] );
95    }
96  }
97  // session_id size must be an integer between 4 and 50
98  if ( !preg_match( $int_pattern, $_POST['session_id_size'] )
99       or $_POST['session_id_size'] < 4
100       or $_POST['session_id_size'] > 50 )
101  {
102    array_push( $error, $lang['conf_err_sid_size'] );
103  }
104  // session_time must be an integer between 5 and 60, in minutes
105  if ( !preg_match( $int_pattern, $_POST['session_time'] )
106       or $_POST['session_time'] < 5
107       or $_POST['session_time'] > 60 )
108  {
109    array_push( $error, $lang['conf_err_sid_time'] );
110  }
111  // max_user_listbox must be an integer between 0 and 255 included
112  if ( !preg_match( $int_pattern, $_POST['max_user_listbox'] )
113       or $_POST['max_user_listbox'] < 0
114       or $_POST['max_user_listbox'] > 255 )
115  {
116    array_push( $error, $lang['conf_err_max_user_listbox'] );
117  }
118  // the number of comments per page must be an integer between 5 and 50
119  // included
120  if ( !preg_match( $int_pattern, $_POST['nb_comment_page'] )
121       or $_POST['nb_comment_page'] < 5
122       or $_POST['nb_comment_page'] > 50 )
123  {
124    array_push( $error, $lang['conf_err_comment_number'] );
125  }
126  // the maximum upload filesize must be an integer between 10 and 1000
127  if ( !preg_match( $int_pattern, $_POST['upload_maxfilesize'] )
128       or $_POST['upload_maxfilesize'] < 10
129       or $_POST['upload_maxfilesize'] > 1000 )
130  {
131    array_push( $error, $lang['conf_err_upload_maxfilesize'] );
132  }
133  // the maximum width of uploaded pictures must be an integer superior to
134  // 10
135  if ( !preg_match( $int_pattern, $_POST['upload_maxwidth'] )
136       or $_POST['upload_maxwidth'] < 10 )
137  {
138    array_push( $error, $lang['conf_err_upload_maxwidth'] );
139  }
140  // the maximum height  of uploaded pictures must be an integer superior to
141  // 10
142  if ( !preg_match( $int_pattern, $_POST['upload_maxheight'] )
143       or $_POST['upload_maxheight'] < 10 )
144  {
145    array_push( $error, $lang['conf_err_upload_maxheight'] );
146  }
147  // the maximum width of uploaded thumbnails must be an integer superior to
148  // 10
149  if ( !preg_match( $int_pattern, $_POST['upload_maxwidth_thumbnail'] )
150       or $_POST['upload_maxwidth_thumbnail'] < 10 )
151  {
152    array_push( $error, $lang['conf_err_upload_maxwidth_thumbnail'] );
153  }
154  // the maximum width of uploaded thumbnails must be an integer superior to
155  // 10
156  if ( !preg_match( $int_pattern, $_POST['upload_maxheight_thumbnail'] )
157       or $_POST['upload_maxheight_thumbnail'] < 10 )
158  {
159    array_push( $error, $lang['conf_err_upload_maxheight_thumbnail'] );
160  }
161
162  if ( $_POST['maxwidth'] != ''
163       and ( !preg_match( $int_pattern, $_POST['maxwidth'] )
164             or $_POST['maxwidth'] < 50 ) )
165  {
166    array_push( $error, $lang['err_maxwidth'] );
167  }
168  if ( $_POST['maxheight']
169       and ( !preg_match( $int_pattern, $_POST['maxheight'] )
170             or $_POST['maxheight'] < 50 ) )
171  {
172    array_push( $error, $lang['err_maxheight'] );
173  }
174  // updating configuraiton if no error found
175  if ( count( $error ) == 0 )
176  {
177    mysql_query( 'DELETE FROM '.PREFIX_TABLE.'config;' );
178    $query = 'INSERT INTO '.PREFIX_TABLE.'config';
179    $query.= ' (';
180    foreach ( $conf_infos as $i => $conf_info ) {
181      if ( $i > 0 ) $query.= ',';
182      $query.= $conf_info;
183    }
184    $query.= ')';
185    $query.= ' VALUES';
186    $query.= ' (';
187    foreach ( $conf_infos as $i => $conf_info ) {
188      if ( $i > 0 ) $query.= ',';
189      if ( $_POST[$conf_info] == '' ) $query.= 'NULL';
190      else                            $query.= "'".$_POST[$conf_info]."'";
191    }
192    $query.= ')';
193    $query.= ';';
194    echo $query;
195    mysql_query( $query );
196
197    $tab_theme = explode( ' - ', $_POST['theme'] );
198    $_POST['theme'] = $tab_theme[0].'/'.$tab_theme[1];
199
200    $query = 'UPDATE '.PREFIX_TABLE.'users';
201    $query.= ' SET';
202    foreach ( $default_user_infos as $i => $default_user_info ) {
203      if ( $i > 0 ) $query.= ',';
204      else          $query.= ' ';
205      $query.= $default_user_info;
206      $query.= ' = ';
207      if ( $_POST[$default_user_info] == '' )
208      {
209        $query.= 'NULL';
210      }
211      else
212      {
213        $query.= "'".$_POST[$default_user_info]."'";
214      }
215    }
216    $query.= " WHERE username = 'guest'";
217    $query.= ';';
218    mysql_query( $query );
219  }
220//--------------------------------------------------------- data initialization
221  foreach ( $conf_infos as $conf_info ) {
222    $$conf_info = $_POST[$conf_info];
223  }
224  foreach ( $default_user_infos as $default_user_info ) {
225    $$default_user_info = $_POST[$default_user_info];
226  }
227}
228else
229{
230//--------------------------------------------------------- data initialization
231  $query  = 'SELECT';
232  foreach ( $conf_infos as $i => $conf_info ) {
233    if ( $i > 0 ) $query.= ',';
234    else          $query.= ' ';
235    $query.= $conf_info;
236  }
237  $query .= ' FROM '.PREFIX_TABLE.'config;';
238  $row = mysql_fetch_array( mysql_query( $query ) );
239  foreach ( $conf_infos as $conf_info ) {
240    $$conf_info = $row[$conf_info];
241  }
242
243  $query  = 'SELECT';
244  foreach ( $default_user_infos as $i => $default_user_info ) {
245    if ( $i > 0 ) $query.= ',';
246    else          $query.= ' ';
247    $query.= $default_user_info;
248  }
249  $query.= ' FROM '.PREFIX_TABLE.'users';
250  $query.= " WHERE username = 'guest'";
251  $query.= ';';
252  $row = mysql_fetch_array( mysql_query( $query ) );
253  foreach ( $default_user_infos as $default_user_info ) {
254    $$default_user_info = $row[$default_user_info];
255  }
256}
257//----------------------------------------------------- template initialization
258$sub = $vtp->Open(
259  '../template/'.$user['template'].'/admin/configuration.vtp' );
260
261$tpl = array( 'conf_confirmation','remote_site','delete',
262              'conf_remote_site_delete_info','submit' );
263templatize_array( $tpl, 'lang', $sub );
264//-------------------------------------------------------------- errors display
265if ( sizeof( $error ) != 0 )
266{
267  $vtp->addSession( $sub, 'errors' );
268  for ( $i = 0; $i < sizeof( $error ); $i++ )
269  {
270    $vtp->addSession( $sub, 'li' );
271    $vtp->setVar( $sub, 'li.li', $error[$i] );
272    $vtp->closeSession( $sub, 'li' );
273  }
274  $vtp->closeSession( $sub, 'errors' );
275}
276//-------------------------------------------------------- confirmation display
277if ( count( $error ) == 0 and isset( $_POST['submit'] ) )
278{
279  $vtp->addSession( $sub, 'confirmation' );
280  $vtp->closeSession( $sub, 'confirmation' );
281}
282//----------------------------------------------------------------- form action
283$form_action = add_session_id( './admin.php?page=configuration' );
284$vtp->setVar( $sub, 'form_action', $form_action );
285//------------------------------------------------------- general configuration
286$vtp->addSession( $sub, 'line' );
287$vtp->addSession( $sub, 'title_line' );
288$vtp->setVar( $sub, 'title_line.title', $lang['conf_general_title'] );
289$vtp->closeSession( $sub, 'title_line' );
290$vtp->closeSession( $sub, 'line' );
291
292$vtp->addSession( $sub, 'line' );
293$vtp->addSession( $sub, 'space_line' );
294$vtp->closeSession( $sub, 'space_line' );
295$vtp->closeSession( $sub, 'line' );
296// webmaster name
297$vtp->addSession( $sub, 'line' );
298$vtp->addSession( $sub, 'param_line' );
299$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_webmaster'] );
300$vtp->addSession( $sub, 'hidden' );
301$vtp->setVar( $sub, 'hidden.text', $webmaster );
302$vtp->setVar( $sub, 'hidden.name', 'webmaster' );
303$vtp->setVar( $sub, 'hidden.value', $webmaster );
304$vtp->closeSession( $sub, 'hidden' );
305$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_webmaster_info'] );
306$vtp->closeSession( $sub, 'param_line' );
307$vtp->closeSession( $sub, 'line' );
308// webmaster mail address
309$vtp->addSession( $sub, 'line' );
310$vtp->addSession( $sub, 'param_line' );
311$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_mail'] );
312$vtp->addSession( $sub, 'text' );
313$vtp->setVar( $sub, 'text.name', 'mail_webmaster' );
314$vtp->setVar( $sub, 'text.value', $mail_webmaster );
315$vtp->closeSession( $sub, 'text' );
316$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_mail_info'] );
317$vtp->closeSession( $sub, 'param_line' );
318$vtp->closeSession( $sub, 'line' );
319// prefix for thumbnails
320$vtp->addSession( $sub, 'line' );
321$vtp->addSession( $sub, 'param_line' );
322$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_prefix'] );
323$vtp->addSession( $sub, 'text' );
324$vtp->setVar( $sub, 'text.name', 'prefix_thumbnail' );
325$vtp->setVar( $sub, 'text.value', $prefix_thumbnail );
326$vtp->closeSession( $sub, 'text' );
327$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_prefix_info'] );
328$vtp->closeSession( $sub, 'param_line' );
329$vtp->closeSession( $sub, 'line' );
330// access type
331$vtp->addSession( $sub, 'line' );
332$vtp->addSession( $sub, 'param_line' );
333$vtp->setVar( $sub, 'param_line.name', $lang['conf_general_access'] );
334$vtp->addSession( $sub, 'group' );
335$vtp->addSession( $sub, 'radio' );
336$vtp->setVar( $sub, 'radio.name', 'access' );
337$vtp->setVar( $sub, 'radio.value', 'free' );
338$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_1'] );
339$checked = '';
340if ( $access == 'free' )
341{
342  $checked = ' checked="checked"';
343}
344$vtp->setVar( $sub, 'radio.checked', $checked );
345$vtp->closeSession( $sub, 'radio' );
346$vtp->addSession( $sub, 'radio' );
347$vtp->setVar( $sub, 'radio.name', 'access' );
348$vtp->setVar( $sub, 'radio.value', 'restricted' );
349$vtp->setVar( $sub, 'radio.option', $lang['conf_general_access_2'] );
350$checked = '';
351if ( $access == 'restricted' )
352{
353  $checked = ' checked="checked"';
354}
355$vtp->setVar( $sub, 'radio.checked', $checked );
356$vtp->closeSession( $sub, 'radio' );
357$vtp->closeSession( $sub, 'group' );
358$vtp->setVar( $sub, 'param_line.def', $lang['conf_general_access_info'] );
359$vtp->closeSession( $sub, 'param_line' );
360$vtp->closeSession( $sub, 'line' );
361// maximum user number to display in the listbox of identification page
362$vtp->addSession( $sub, 'line' );
363$vtp->addSession( $sub, 'param_line' );
364$vtp->setVar( $sub, 'param_line.name',
365              $lang['conf_general_max_user_listbox'] );
366$vtp->addSession( $sub, 'text' );
367$vtp->setVar( $sub, 'text.name', 'max_user_listbox' );
368$vtp->setVar( $sub, 'text.value', $max_user_listbox );
369$vtp->closeSession( $sub, 'text' );
370$vtp->setVar( $sub, 'param_line.def',
371              $lang['conf_general_max_user_listbox_info'] );
372$vtp->closeSession( $sub, 'param_line' );
373$vtp->closeSession( $sub, 'line' );
374
375$vtp->addSession( $sub, 'line' );
376$vtp->addSession( $sub, 'space_line' );
377$vtp->closeSession( $sub, 'space_line' );
378$vtp->closeSession( $sub, 'line' );
379//------------------------------------------------------ comments configuration
380$vtp->addSession( $sub, 'line' );
381$vtp->addSession( $sub, 'title_line' );
382$vtp->setVar( $sub, 'title_line.title', $lang['conf_comments_title'] );
383$vtp->closeSession( $sub, 'title_line' );
384$vtp->closeSession( $sub, 'line' );
385
386$vtp->addSession( $sub, 'line' );
387$vtp->addSession( $sub, 'space_line' );
388$vtp->closeSession( $sub, 'space_line' );
389$vtp->closeSession( $sub, 'line' );
390// show comments ?
391$vtp->addSession( $sub, 'line' );
392$vtp->addSession( $sub, 'param_line' );
393$vtp->setVar( $sub, 'param_line.name', $lang['conf_comments_show_comments'] );
394$vtp->addSession( $sub, 'group' );
395$vtp->addSession( $sub, 'radio' );
396$vtp->setVar( $sub, 'radio.name', 'show_comments' );
397$vtp->setVar( $sub, 'radio.value', 'true' );
398$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
399$checked = '';
400if ( $show_comments == 'true' )
401{
402  $checked = ' checked="checked"';
403}
404$vtp->setVar( $sub, 'radio.checked', $checked );
405$vtp->closeSession( $sub, 'radio' );
406$vtp->addSession( $sub, 'radio' );
407$vtp->setVar( $sub, 'radio.name', 'show_comments' );
408$vtp->setVar( $sub, 'radio.value', 'false' );
409$vtp->setVar( $sub, 'radio.option', $lang['no'] );
410$checked = '';
411if ( $show_comments == 'false' )
412{
413  $checked = ' checked="checked"';
414}
415$vtp->setVar( $sub, 'radio.checked', $checked );
416$vtp->closeSession( $sub, 'radio' );
417$vtp->closeSession( $sub, 'group' );
418$vtp->setVar( $sub, 'param_line.def',
419              $lang['conf_comments_show_comments_info'] );
420$vtp->closeSession( $sub, 'param_line' );
421$vtp->closeSession( $sub, 'line' );
422// number of comments per page
423$vtp->addSession( $sub, 'line' );
424$vtp->addSession( $sub, 'param_line' );
425$vtp->setVar( $sub, 'param_line.name',
426              $lang['conf_comments_comments_number'] );
427$vtp->addSession( $sub, 'text' );
428$vtp->setVar( $sub, 'text.name', 'nb_comment_page' );
429$vtp->setVar( $sub, 'text.value', $nb_comment_page );
430$vtp->closeSession( $sub, 'text' );
431$vtp->setVar( $sub, 'param_line.def',
432              $lang['conf_comments_comments_number_info'] );
433$vtp->closeSession( $sub, 'param_line' );
434$vtp->closeSession( $sub, 'line' );
435
436$vtp->addSession( $sub, 'line' );
437$vtp->addSession( $sub, 'space_line' );
438$vtp->closeSession( $sub, 'space_line' );
439$vtp->closeSession( $sub, 'line' );
440//-------------------------------------------------- default user configuration
441$vtp->addSession( $sub, 'line' );
442$vtp->addSession( $sub, 'title_line' );
443$vtp->setVar( $sub, 'title_line.title', $lang['conf_default_title'] );
444$vtp->closeSession( $sub, 'title_line' );
445$vtp->closeSession( $sub, 'line' );
446
447$vtp->addSession( $sub, 'line' );
448$vtp->addSession( $sub, 'space_line' );
449$vtp->closeSession( $sub, 'space_line' );
450$vtp->closeSession( $sub, 'line' );
451// default language
452$vtp->addSession( $sub, 'line' );
453$vtp->addSession( $sub, 'param_line' );
454$vtp->setVar( $sub, 'param_line.name', $lang['customize_language'] );
455$vtp->addSession( $sub, 'select' );
456$vtp->setVar( $sub, 'select.name', 'language' );
457$option = get_languages( '../language/' );
458for ( $i = 0; $i < sizeof( $option ); $i++ )
459{
460  $vtp->addSession( $sub, 'option' );
461  $vtp->setVar( $sub, 'option.option', $option[$i] );
462  if ( $option[$i] == $language )
463  {
464    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
465  }
466  $vtp->closeSession( $sub, 'option' );
467}
468$vtp->closeSession( $sub, 'select' );
469$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_language_info'] );
470$vtp->closeSession( $sub, 'param_line' );
471$vtp->closeSession( $sub, 'line' );
472// number of image per row
473$vtp->addSession( $sub, 'line' );
474$vtp->addSession( $sub, 'param_line' );
475$vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_image_per_row'] );
476$vtp->addSession( $sub, 'select' );
477$vtp->setVar( $sub, 'select.name', 'nb_image_line' );
478for ( $i = 0; $i < sizeof( $conf['nb_image_row'] ); $i++ )
479{
480  $vtp->addSession( $sub, 'option' );
481  $vtp->setVar( $sub, 'option.option', $conf['nb_image_row'][$i] );
482  if ( $conf['nb_image_row'][$i] == $nb_image_line )
483  {
484    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
485  }
486  $vtp->closeSession( $sub, 'option' );
487}
488$vtp->closeSession( $sub, 'select' );
489$vtp->setVar( $sub, 'param_line.def',
490              $lang['conf_default_nb_image_per_row_info'] );
491$vtp->closeSession( $sub, 'param_line' );
492$vtp->closeSession( $sub, 'line' );
493// number of row per page
494$vtp->addSession( $sub, 'line' );
495$vtp->addSession( $sub, 'param_line' );
496$vtp->setVar( $sub, 'param_line.name', $lang['customize_nb_row_per_page'] );
497$vtp->addSession( $sub, 'select' );
498$vtp->setVar( $sub, 'select.name', 'nb_line_page' );
499for ( $i = 0; $i < sizeof( $conf['nb_row_page'] ); $i++ )
500{
501  $vtp->addSession( $sub, 'option' );
502  $vtp->setVar( $sub, 'option.option', $conf['nb_row_page'][$i] );
503  if ( $conf['nb_row_page'][$i] == $nb_line_page )
504  {
505    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
506  }
507  $vtp->closeSession( $sub, 'option' );
508}
509$vtp->closeSession( $sub, 'select' );
510$vtp->setVar( $sub, 'param_line.def',
511              $lang['conf_default_nb_row_per_page_info'] );
512$vtp->closeSession( $sub, 'param_line' );
513$vtp->closeSession( $sub, 'line' );
514// template
515$vtp->addSession( $sub, 'line' );
516$vtp->addSession( $sub, 'param_line' );
517$vtp->setVar( $sub, 'param_line.name', $lang['customize_template'] );
518$vtp->addSession( $sub, 'select' );
519$vtp->setVar( $sub, 'select.name', 'template' );
520$option = get_dirs( '../template/' );
521for ( $i = 0; $i < sizeof( $option ); $i++ )
522{
523  $vtp->addSession( $sub, 'option' );
524  $vtp->setVar( $sub, 'option.option', $option[$i] );
525  if ( $option[$i] == $template )
526  {
527    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
528  }
529  $vtp->closeSession( $sub, 'option' );
530}
531$vtp->closeSession( $sub, 'select' );
532$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_template_info'] );
533$vtp->closeSession( $sub, 'param_line' );
534$vtp->closeSession( $sub, 'line' );
535// theme
536$vtp->addSession( $sub, 'line' );
537$vtp->addSession( $sub, 'param_line' );
538$vtp->setVar( $sub, 'param_line.name', $lang['customize_theme'] );
539$vtp->addSession( $sub, 'select' );
540$vtp->setVar( $sub, 'select.name', 'theme' );
541$option = get_themes( '../theme/' );
542for ( $i = 0; $i < sizeof( $option ); $i++ )
543{
544  $vtp->addSession( $sub, 'option' );
545  $vtp->setVar( $sub, 'option.option', $option[$i] );
546  if ( $option[$i] == str_replace( "/", " - ", $theme ) )
547  {
548    $vtp->setVar( $sub, 'option.selected', ' selected="selected"' );
549  }
550  $vtp->closeSession( $sub, 'option' );
551}
552$vtp->closeSession( $sub, 'select' );
553$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_theme_info'] );
554$vtp->closeSession( $sub, 'param_line' );
555$vtp->closeSession( $sub, 'line' );
556// short period time
557$vtp->addSession( $sub, 'line' );
558$vtp->addSession( $sub, 'param_line' );
559$vtp->setVar( $sub, 'param_line.name', $lang['customize_short_period'] );
560$vtp->addSession( $sub, 'text' );
561$vtp->setVar( $sub, 'text.name', 'short_period' );
562$vtp->setVar( $sub, 'text.value', $short_period );
563$vtp->closeSession( $sub, 'text' );
564$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_short_period_info']);
565$vtp->closeSession( $sub, 'param_line' );
566$vtp->closeSession( $sub, 'line' );
567// long period time
568$vtp->addSession( $sub, 'line' );
569$vtp->addSession( $sub, 'param_line' );
570$vtp->setVar( $sub, 'param_line.name', $lang['customize_long_period'] );
571$vtp->addSession( $sub, 'text' );
572$vtp->setVar( $sub, 'text.name', 'long_period' );
573$vtp->setVar( $sub, 'text.value', $long_period );
574$vtp->closeSession( $sub, 'text' );
575$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_long_period_info'] );
576$vtp->closeSession( $sub, 'param_line' );
577$vtp->closeSession( $sub, 'line' );
578// max displayed width
579$vtp->addSession( $sub, 'line' );
580$vtp->addSession( $sub, 'param_line' );
581$vtp->setVar( $sub, 'param_line.name', $lang['maxwidth'] );
582$vtp->addSession( $sub, 'text' );
583$vtp->setVar( $sub, 'text.name', 'maxwidth' );
584$vtp->setVar( $sub, 'text.value', $maxwidth );
585$vtp->closeSession( $sub, 'text' );
586$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxwidth_info'] );
587$vtp->closeSession( $sub, 'param_line' );
588$vtp->closeSession( $sub, 'line' );
589// max displayed height
590$vtp->addSession( $sub, 'line' );
591$vtp->addSession( $sub, 'param_line' );
592$vtp->setVar( $sub, 'param_line.name', $lang['maxheight'] );
593$vtp->addSession( $sub, 'text' );
594$vtp->setVar( $sub, 'text.name', 'maxheight' );
595$vtp->setVar( $sub, 'text.value', $maxheight );
596$vtp->closeSession( $sub, 'text' );
597$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_maxheight_info'] );
598$vtp->closeSession( $sub, 'param_line' );
599$vtp->closeSession( $sub, 'line' );
600// expand all categories ?
601$vtp->addSession( $sub, 'line' );
602$vtp->addSession( $sub, 'param_line' );
603$vtp->setVar( $sub, 'param_line.name', $lang['customize_expand'] );
604$vtp->addSession( $sub, 'group' );
605$vtp->addSession( $sub, 'radio' );
606$vtp->setVar( $sub, 'radio.name', 'expand' );
607
608$vtp->setVar( $sub, 'radio.value', 'true' );
609$checked = '';
610if ( $expand == 'true' )
611{
612  $checked = ' checked="checked"';
613}
614$vtp->setVar( $sub, 'radio.checked', $checked );
615$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
616$vtp->closeSession( $sub, 'radio' );
617$vtp->addSession( $sub, 'radio' );
618$vtp->setVar( $sub, 'radio.name', 'expand' );
619$vtp->setVar( $sub, 'radio.value', 'false' );
620$checked = '';
621if ( $expand == 'false' )
622{
623  $checked = ' checked="checked"';
624}
625$vtp->setVar( $sub, 'radio.checked', $checked );
626$vtp->setVar( $sub, 'radio.option', $lang['no'] );
627$vtp->closeSession( $sub, 'radio' );
628$vtp->closeSession( $sub, 'group' );
629$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_expand_info'] );
630$vtp->closeSession( $sub, 'param_line' );
631$vtp->closeSession( $sub, 'line' );
632// show number of comments on thumbnails page
633$vtp->addSession( $sub, 'line' );
634$vtp->addSession( $sub, 'param_line' );
635$vtp->setVar( $sub, 'param_line.name', $lang['customize_show_nb_comments'] );
636$vtp->addSession( $sub, 'group' );
637$vtp->addSession( $sub, 'radio' );
638$vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
639$vtp->setVar( $sub, 'radio.value', 'true' );
640$checked = '';
641if ( $show_nb_comments == 'true' )
642{
643  $checked = ' checked="checked"';
644}
645$vtp->setVar( $sub, 'radio.checked', $checked );
646$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
647$vtp->closeSession( $sub, 'radio' );
648$vtp->addSession( $sub, 'radio' );
649$vtp->setVar( $sub, 'radio.name', 'show_nb_comments' );
650$vtp->setVar( $sub, 'radio.value', 'false' );
651$checked = '';
652if ( $show_nb_comments == 'false' )
653{
654  $checked = ' checked="checked"';
655}
656$vtp->setVar( $sub, 'radio.checked', $checked );
657$vtp->setVar( $sub, 'radio.option', $lang['no'] );
658$vtp->closeSession( $sub, 'radio' );
659$vtp->closeSession( $sub, 'group' );
660$vtp->setVar( $sub, 'param_line.def', $lang['conf_default_show_nb_comments_info'] );
661$vtp->closeSession( $sub, 'param_line' );
662$vtp->closeSession( $sub, 'line' );
663
664$vtp->addSession( $sub, 'line' );
665$vtp->addSession( $sub, 'space_line' );
666$vtp->closeSession( $sub, 'space_line' );
667$vtp->closeSession( $sub, 'line' );
668//-------------------------------------------------------- upload configuration
669$vtp->addSession( $sub, 'line' );
670$vtp->addSession( $sub, 'title_line' );
671$vtp->setVar( $sub, 'title_line.title', $lang['conf_upload_title'] );
672$vtp->closeSession( $sub, 'title_line' );
673$vtp->closeSession( $sub, 'line' );
674
675$vtp->addSession( $sub, 'line' );
676$vtp->addSession( $sub, 'space_line' );
677$vtp->closeSession( $sub, 'space_line' );
678$vtp->closeSession( $sub, 'line' );
679// is upload available ?
680$vtp->addSession( $sub, 'line' );
681$vtp->addSession( $sub, 'param_line' );
682$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_available'] );
683$vtp->addSession( $sub, 'group' );
684$vtp->addSession( $sub, 'radio' );
685$vtp->setVar( $sub, 'radio.name', 'upload_available' );
686$vtp->setVar( $sub, 'radio.value', 'true' );
687$checked = '';
688if ( $upload_available == 'true' )
689{
690  $checked = ' checked="checked"';
691}
692$vtp->setVar( $sub, 'radio.checked', $checked );
693$vtp->setVar( $sub, 'radio.option', $lang['yes'] );
694$vtp->closeSession( $sub, 'radio' );
695$vtp->addSession( $sub, 'radio' );
696$vtp->setVar( $sub, 'radio.name', 'upload_available' );
697$vtp->setVar( $sub, 'radio.value', 'false' );
698$checked = '';
699if ( $upload_available == 'false' )
700{
701  $checked = ' checked="checked"';
702}
703$vtp->setVar( $sub, 'radio.checked', $checked );
704$vtp->setVar( $sub, 'radio.option', $lang['no'] );
705$vtp->closeSession( $sub, 'radio' );
706$vtp->closeSession( $sub, 'group' );
707$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_available_info'] );
708$vtp->closeSession( $sub, 'param_line' );
709$vtp->closeSession( $sub, 'line' );
710// max filesize uploadable
711$vtp->addSession( $sub, 'line' );
712$vtp->addSession( $sub, 'param_line' );
713$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxfilesize'] );
714$vtp->addSession( $sub, 'text' );
715$vtp->setVar( $sub, 'text.name', 'upload_maxfilesize' );
716$vtp->setVar( $sub, 'text.value', $upload_maxfilesize );
717$vtp->closeSession( $sub, 'text' );
718$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxfilesize_info'] );
719$vtp->closeSession( $sub, 'param_line' );
720$vtp->closeSession( $sub, 'line' );
721// maxwidth uploadable
722$vtp->addSession( $sub, 'line' );
723$vtp->addSession( $sub, 'param_line' );
724$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxwidth'] );
725$vtp->addSession( $sub, 'text' );
726$vtp->setVar( $sub, 'text.name', 'upload_maxwidth' );
727$vtp->setVar( $sub, 'text.value', $upload_maxwidth );
728$vtp->closeSession( $sub, 'text' );
729$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxwidth_info'] );
730$vtp->closeSession( $sub, 'param_line' );
731$vtp->closeSession( $sub, 'line' );
732// maxheight uploadable
733$vtp->addSession( $sub, 'line' );
734$vtp->addSession( $sub, 'param_line' );
735$vtp->setVar( $sub, 'param_line.name', $lang['conf_upload_maxheight'] );
736$vtp->addSession( $sub, 'text' );
737$vtp->setVar( $sub, 'text.name', 'upload_maxheight' );
738$vtp->setVar( $sub, 'text.value', $upload_maxheight );
739$vtp->closeSession( $sub, 'text' );
740$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_info'] );
741$vtp->closeSession( $sub, 'param_line' );
742$vtp->closeSession( $sub, 'line' );
743// maxwidth for thumbnail
744$vtp->addSession( $sub, 'line' );
745$vtp->addSession( $sub, 'param_line' );
746$vtp->setVar( $sub, 'param_line.name',$lang['conf_upload_maxwidth_thumbnail']);
747$vtp->addSession( $sub, 'text' );
748$vtp->setVar( $sub, 'text.name', 'upload_maxwidth_thumbnail' );
749$vtp->setVar( $sub, 'text.value', $upload_maxwidth_thumbnail );
750$vtp->closeSession( $sub, 'text' );
751$vtp->setVar($sub,'param_line.def',$lang['conf_upload_maxwidth_thumbnail_info']);
752$vtp->closeSession( $sub, 'param_line' );
753$vtp->closeSession( $sub, 'line' );
754// maxheight for thumbnail
755$vtp->addSession( $sub, 'line' );
756$vtp->addSession( $sub, 'param_line' );
757$vtp->setVar( $sub,'param_line.name',$lang['conf_upload_maxheight_thumbnail']);
758$vtp->addSession( $sub, 'text' );
759$vtp->setVar( $sub, 'text.name', 'upload_maxheight_thumbnail' );
760$vtp->setVar( $sub, 'text.value', $upload_maxheight_thumbnail );
761$vtp->closeSession( $sub, 'text' );
762$vtp->setVar( $sub, 'param_line.def', $lang['conf_upload_maxheight_thumbnail_info']);
763$vtp->closeSession( $sub, 'param_line' );
764$vtp->closeSession( $sub, 'line' );
765
766$vtp->addSession( $sub, 'line' );
767$vtp->addSession( $sub, 'space_line' );
768$vtp->closeSession( $sub, 'space_line' );
769$vtp->closeSession( $sub, 'line' );
770//------------------------------------------------------ sessions configuration
771$vtp->addSession( $sub, 'line' );
772$vtp->addSession( $sub, 'title_line' );
773$vtp->setVar( $sub, 'title_line.title', $lang['conf_session_title'] );
774$vtp->closeSession( $sub, 'title_line' );
775$vtp->closeSession( $sub, 'line' );
776
777$vtp->addSession( $sub, 'line' );
778$vtp->addSession( $sub, 'space_line' );
779$vtp->closeSession( $sub, 'space_line' );
780$vtp->closeSession( $sub, 'line' );
781// session size
782$vtp->addSession( $sub, 'line' );
783$vtp->addSession( $sub, 'param_line' );
784$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_size'] );
785$vtp->addSession( $sub, 'text' );
786$vtp->setVar( $sub, 'text.name', 'session_id_size' );
787$vtp->setVar( $sub, 'text.value', $session_id_size );
788$vtp->closeSession( $sub, 'text' );
789$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_size_info']);
790$vtp->closeSession( $sub, 'param_line' );
791$vtp->closeSession( $sub, 'line' );
792// session length
793$vtp->addSession( $sub, 'line' );
794$vtp->addSession( $sub, 'param_line' );
795$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_time'] );
796$vtp->addSession( $sub, 'text' );
797$vtp->setVar( $sub, 'text.name', 'session_time' );
798$vtp->setVar( $sub, 'text.value', $session_time );
799$vtp->closeSession( $sub, 'text' );
800$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_time_info']);
801$vtp->closeSession( $sub, 'param_line' );
802$vtp->closeSession( $sub, 'line' );
803// session keyword
804$vtp->addSession( $sub, 'line' );
805$vtp->addSession( $sub, 'param_line' );
806$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_key'] );
807$vtp->addSession( $sub, 'text' );
808$vtp->setVar( $sub, 'text.name', 'session_keyword' );
809$vtp->setVar( $sub, 'text.value', $session_keyword );
810$vtp->closeSession( $sub, 'text' );
811$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_key_info']);
812$vtp->closeSession( $sub, 'param_line' );
813$vtp->closeSession( $sub, 'line' );
814// session deletion
815$vtp->addSession( $sub, 'line' );
816$vtp->addSession( $sub, 'param_line' );
817$vtp->setVar( $sub, 'param_line.name', $lang['conf_session_delete'] );
818$vtp->addSession( $sub, 'check' );
819$vtp->addSession( $sub, 'box' );
820$vtp->setVar( $sub, 'box.name', 'empty_session_table' );
821$vtp->setVar( $sub, 'box.value', '1' );
822$vtp->setVar( $sub, 'box.checked', ' checked="checked"' );
823$vtp->closeSession( $sub, 'box' );
824$vtp->closeSession( $sub, 'check' );
825$vtp->setVar( $sub, 'param_line.def', $lang['conf_session_delete_info'] );
826$vtp->closeSession( $sub, 'param_line' );
827$vtp->closeSession( $sub, 'line' );
828
829$vtp->addSession( $sub, 'line' );
830$vtp->addSession( $sub, 'space_line' );
831$vtp->closeSession( $sub, 'space_line' );
832$vtp->closeSession( $sub, 'line' );
833//------------------------------------------------ remote sites administration
834$query = 'select id,galleries_url';
835$query.= ' from '.PREFIX_TABLE.'sites';
836$query.= " where galleries_url <> './galleries/';";
837$result = mysql_query( $query );
838if ( mysql_num_rows( $result ) > 0 )
839{
840  $vtp->addSession( $sub, 'remote_sites' );
841  $i = 0;
842  while ( $row = mysql_fetch_array( $result ) )
843  {
844    $vtp->addSession( $sub, 'site' );
845    $vtp->setVar( $sub, 'site.url', $row['galleries_url'] );
846    $vtp->setVar( $sub, 'site.id', $row['id'] );
847    if ( $i == 0 )
848    {
849      $vtp->addSession( $sub, 'rowspan' );
850      $vtp->setVar( $sub, 'rowspan.nb_sites', mysql_num_rows( $result ) );
851      $vtp->closeSession( $sub, 'rowspan' );
852    }
853    $vtp->closeSession( $sub, 'site' );
854    $i++;
855  }
856  $vtp->closeSession( $sub, 'remote_sites' );
857}
858//----------------------------------------------------------- sending html code
859$vtp->Parse( $handle , 'sub', $sub );
860?>
Note: See TracBrowser for help on using the repository browser.