source: trunk/admin/configuration.php @ 85

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

Mail notification for admins

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