Ignore:
Timestamp:
Mar 5, 2004, 12:56:02 AM (21 years ago)
Author:
z0rglub
Message:

use new format of config table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/common.inc.php

    r375 r383  
    2525// | USA.                                                                  |
    2626// +-----------------------------------------------------------------------+
     27
    2728if( !defined("PHPWG_ROOT_PATH") )
    2829{
     
    167168// since basic forum information is not available
    168169//
    169 $sql = 'SELECT * FROM '.CONFIG_TABLE;
    170 if( !($result = mysql_query($sql)) )
     170$query = 'SELECT param,value';
     171$query.= ' FROM '.CONFIG_TABLE;
     172$query.= ';';
     173if( !( $result = mysql_query( $query ) ) )
    171174{
    172175  die("Could not query config information");
    173176}
    174177
    175 $row =mysql_fetch_array($result);
    176 // rertieving the configuration informations for site
    177 // $infos array is used to know the fields to retrieve in the table "config"
    178 // Each field becomes an information of the array $conf.
    179 // Example :
    180 //            prefix_thumbnail --> $conf['prefix_thumbnail']
    181 $infos = array( 'prefix_thumbnail', 'webmaster', 'mail_webmaster', 'access',
    182                 'session_id_size', 'session_keyword', 'session_time',
    183                 'max_user_listbox', 'show_comments', 'nb_comment_page',
    184                 'upload_available', 'upload_maxfilesize', 'upload_maxwidth',
    185                 'upload_maxheight', 'upload_maxwidth_thumbnail',
    186                 'upload_maxheight_thumbnail','log','comments_validation',
    187                 'comments_forall','authorize_cookies','mail_notification' );
    188 // affectation of each field of the table "config" to an information of the
    189 // array $conf.
    190 foreach ( $infos as $info ) {
    191   if ( isset( $row[$info] ) ) $conf[$info] = $row[$info];
    192   else                        $conf[$info] = '';
    193   // If the field is true or false, the variable is transformed into a boolean
    194   // value.
    195   if ( $conf[$info] == 'true' or $conf[$info] == 'false' )
    196   {
    197     $conf[$info] = get_boolean( $conf[$info] );
     178while ( $row =mysql_fetch_array( $result ) )
     179{
     180  if ( isset( $row['value'] ) )
     181  {
     182    $conf[$row['param']] = $row['value'];
     183  }
     184  else
     185  {
     186    $conf[$row['param']] = '';
     187  }
     188  // If the field is true or false, the variable is transformed into a
     189  // boolean value.
     190  if ( $conf[$row['param']] == 'true' or $conf[$row['param']] == 'false' )
     191  {
     192    $conf[$row['param']] = get_boolean( $conf[$row['param']] );
    198193  }
    199194}
Note: See TracChangeset for help on using the changeset viewer.