source: branches/release-1_3/include/config.inc.php @ 297

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

Simplifying concatenation of $infos variables to select in the database

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1<?php
2/***************************************************************************
3 *                              config.inc.php                             *
4 *                            -------------------                          *
5 *   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
6 *   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
7 *                                                                         *
8 *   $Id: config.inc.php 297 2004-01-18 22:06:34Z z0rglub $
9 *                                                                         *
10 ***************************************************************************
11
12 ***************************************************************************
13 *                                                                         *
14 *   This program is free software; you can redistribute it and/or modify  *
15 *   it under the terms of the GNU General Public License as published by  *
16 *   the Free Software Foundation;                                         *
17 *                                                                         *
18 ***************************************************************************/
19unset( $conf, $page, $user, $lang );
20$conf = array();
21$page = array();
22$user = array();
23$lang = array();
24
25include_once( PREFIX_INCLUDE.'./include/functions.inc.php' );
26include( PREFIX_INCLUDE.'./include/vtemplate.class.php' );
27// How to change the order of display for images in a category ?
28//
29// You have to modify $conf['order_by'].
30// There are several fields that can order the display :
31//  - date_available : the date of the adding to the gallery
32//  - file : the name of the file
33// Once you've chosen which field(s) to use for ordering,
34// you must chose the ascending or descending order for each field.
35// examples :
36// 1. $conf['order_by'] = " order by date_available desc, file asc";
37//    will order pictures by date_available descending & by filename ascending
38// 2. $conf['order_by'] = " order by file asc";
39//    will only order pictures by file ascending
40//    without taking into account the date_available
41$conf['order_by'] = ' ORDER BY date_available DESC, file ASC';
42
43$conf['nb_image_row']       = array(4,5,6,7,8);
44$conf['nb_row_page']        = array(2,3,4,5,6,7,10,20,1000);
45$conf['slideshow_period']   = array(2,5,10);
46$conf['last_days']          = array(1,2,3,10,30,365);
47$conf['version']            = '1.3.1 [devel]';
48$conf['site_url']           = 'http://www.phpwebgallery.net';
49$conf['forum_url']          = 'http://forum.phpwebgallery.net';
50$conf['picture_ext']        = array('jpg','JPG','gif','GIF','png','PNG');
51$conf['document_ext']       = array('doc','pdf','zip');
52$conf['top_number']         = 10;
53$conf['anti-flood_time']    = 60; // seconds between 2 comments : 0 to disable
54$conf['max_LOV_categories'] = 50;
55
56database_connection();
57// rertieving the configuration informations for site
58// $infos array is used to know the fields to retrieve in the table "config"
59// Each field becomes an information of the array $conf.
60// Example :
61//            prefix_thumbnail --> $conf['prefix_thumbnail']
62$infos = array( 'prefix_thumbnail', 'webmaster', 'mail_webmaster', 'access',
63                'session_id_size', 'session_keyword', 'session_time',
64                'max_user_listbox', 'show_comments', 'nb_comment_page',
65                'upload_available', 'upload_maxfilesize', 'upload_maxwidth',
66                'upload_maxheight', 'upload_maxwidth_thumbnail',
67                'upload_maxheight_thumbnail','log','comments_validation',
68                'comments_forall','authorize_cookies','mail_notification' );
69
70$query  = 'SELECT '.implode( ',', $infos );
71$query.= ' FROM '.PREFIX_TABLE.'config;';
72
73$row = mysql_fetch_array( mysql_query( $query ) );
74
75// affectation of each field of the table "config" to an information of the
76// array $conf.
77foreach ( $infos as $info ) {
78  if ( isset( $row[$info] ) ) $conf[$info] = $row[$info];
79  else                        $conf[$info] = '';
80  // If the field is true or false, the variable is transformed into a boolean
81  // value.
82  if ( $conf[$info] == 'true' or $conf[$info] == 'false' )
83  {
84    $conf[$info] = get_boolean( $conf[$info] );
85  }
86}
87?>
Note: See TracBrowser for help on using the repository browser.