Changeset 1284


Ignore:
Timestamp:
Apr 27, 2006, 11:08:50 PM (18 years ago)
Author:
plg
Message:

merge -r1281:1283 from branch 1.6 to trunk (bug 228 fixed one more time, and
other little things)

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r1278 r1284  
    16071607    else
    16081608    {
    1609       $insert{'status'} = boolean_to_string($conf['newcat_default_status']);
     1609      $insert{'status'} = $conf['newcat_default_status'];
    16101610    }
    16111611  }
     
    16131613  {
    16141614    $insert{'visible'} = boolean_to_string($conf['newcat_default_visible']);
    1615     $insert{'status'} = boolean_to_string($conf['newcat_default_status']);
     1615    $insert{'status'} = $conf['newcat_default_status'];
    16161616    $insert{'global_rank'} = $insert{'rank'};
    16171617  }
  • trunk/admin/site_update.php

    r1278 r1284  
    253253          ? false
    254254          : boolean_to_string($conf['newcat_default_uploadable']),
    255         'status'      => boolean_to_string($conf{'newcat_default_status'}),
     255        'status'      => $conf{'newcat_default_status'},
    256256        'visible'     => boolean_to_string($conf{'newcat_default_visible'}),
    257257        );
  • trunk/include/common.inc.php

    r1119 r1284  
    163163// since basic gallery information is not available
    164164//
    165 $query = '
    166 SELECT param,value
    167  FROM '.CONFIG_TABLE.'
    168 ;';
    169 if (!($result = pwg_query($query)))
    170 {
    171   die("Could not query config information");
    172 }
    173 
    174 while ( $row =mysql_fetch_array( $result ) )
    175 {
    176   if ( isset( $row['value'] ) )
    177   {
    178     $conf[$row['param']] = $row['value'];
    179   }
    180   else
    181   {
    182     $conf[$row['param']] = '';
    183   }
    184   // If the field is true or false, the variable is transformed into a
    185   // boolean value.
    186   if ( $conf[$row['param']] == 'true' or $conf[$row['param']] == 'false' )
    187   {
    188     $conf[$row['param']] = get_boolean( $conf[$row['param']] );
    189   }
    190 }
     165load_conf_from_db();
    191166
    192167include(PHPWG_ROOT_PATH.'include/user.inc.php');
  • trunk/include/functions.inc.php

    r1221 r1284  
    882882}
    883883
     884/**
     885 * Add configuration parameters from database to global $conf array
     886 *
     887 * @return void
     888 */
     889function load_conf_from_db()
     890{
     891  global $conf;
     892 
     893  $query = '
     894SELECT param,value
     895 FROM '.CONFIG_TABLE.'
     896;';
     897  $result = pwg_query($query);
     898
     899  if (mysql_num_rows($result) == 0)
     900  {
     901    die('No configuration data');
     902  }
     903
     904  while ($row = mysql_fetch_array($result))
     905  {
     906    $conf[ $row['param'] ] = isset($row['value']) ? $row['value'] : '';
     907   
     908    // If the field is true or false, the variable is transformed into a
     909    // boolean value.
     910    if ($conf[$row['param']] == 'true' or $conf[$row['param']] == 'false')
     911    {
     912      $conf[ $row['param'] ] = get_boolean($conf[ $row['param'] ]);
     913    }
     914  }
     915}
    884916?>
  • trunk/include/functions_user.inc.php

    r1231 r1284  
    447447  list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
    448448
     449  if ($user_id == $conf['webmaster_id'])
     450  {
     451    $status = 'webmaster';
     452  }
     453  else if ($user_id == $conf['guest_id'])
     454  {
     455    $status = 'guest';
     456  }
     457  else
     458  {
     459    $status = 'normal';
     460  }
     461 
    449462  $insert =
    450463    array(
    451464      'user_id' => $user_id,
    452       'status' => $user_id == $conf['webmaster_id'] ? 'admin' : 'normal',
     465      'status' => $status,
    453466      'template' => $conf['default_template'],
    454467      'nb_image_line' => $conf['nb_image_line'],
     
    461474      'maxheight' => $conf['default_maxheight'],
    462475      'registration_date' => $dbnow,
    463       'enabled_high' => $conf['newuser_default_enabled_high']
     476      'enabled_high' =>
     477        boolean_to_string($conf['newuser_default_enabled_high']),
    464478      );
    465479
  • trunk/install.php

    r1221 r1284  
    248248      $html_content = htmlentities( $file_content, ENT_QUOTES );
    249249      $html_content = nl2br( $html_content );
    250       $template->assign_block_vars('error_copy',
    251                                    array('FILE_CONTENT'=>$html_content));
     250      $template->assign_block_vars(
     251        'error_copy',
     252        array(
     253          'FILE_CONTENT' => $html_content,
     254          )
     255        );
    252256    }
    253257    @fputs($fp, $file_content, strlen($file_content));
     
    269273    $query = '
    270274UPDATE '.CONFIG_TABLE.'
    271   SET value = \''.$admin_mail.'\'
    272   WHERE param = \'mail_webmaster\'
    273 ;';
    274     mysql_query($query);
    275        
    276     $query = '
    277 UPDATE '.CONFIG_TABLE.'
    278275  SET value = \''.$language.'\'
    279276  WHERE param = \'default_language\'
    280277;';
    281278    mysql_query($query);
    282    
    283     $query = '
    284 INSERT
    285   INTO '.SITES_TABLE.'
    286   (id, galleries_url)
    287   VALUES
    288   (1, \''.PHPWG_ROOT_PATH.'galleries/\')
    289 ;';
    290     mysql_query($query);
     279
     280    // fill $conf global array
     281    load_conf_from_db();
     282
     283    $insert = array(
     284      'id' => 1,
     285      'galleries_url' => PHPWG_ROOT_PATH.'galleries/',
     286      );
     287    mass_inserts(SITES_TABLE, array_keys($insert), array($insert));
    291288   
    292289    // webmaster admin user
    293     $query = '
    294 INSERT INTO '.USERS_TABLE.'
    295   (id,username,password,mail_address)
    296   VALUES
    297   (1,\''.$admin_name.'\',\''.md5($admin_pass1).'\',\''.$admin_mail.'\')
    298 ;';
    299     mysql_query($query);
    300 
    301     $query = '
    302 INSERT INTO '.USER_INFOS_TABLE.'
    303   (user_id,status,language,enabled_high)
    304   VALUES
    305   (1, \'webmaster\', \''.$language.'\',\''.$conf['newuser_default_enabled_high'].'\')
    306 ;';
    307     mysql_query($query);
     290    $inserts = array(
     291      array(
     292        'id'           => 1,
     293        'username'     => $admin_name,
     294        'password'     => md5($admin_pass1),
     295        'mail_address' => $admin_mail,
     296        ),
     297      array(
     298        'id'           => 2,
     299        'username'     => 'guest',
     300        ),
     301      );
     302    mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts);
     303
     304    create_user_infos(1);
     305    create_user_infos(2);
    308306
    309307    $query = '
    310308UPDATE '.USER_INFOS_TABLE.'
    311   SET feed_id = \''.find_available_feed_id().'\'
    312   WHERE user_id = 1
    313 ;';
    314     mysql_query($query);
    315 
    316     // guest user
    317     $query = '
    318 INSERT INTO '.USERS_TABLE.'
    319   (id,username,password,mail_address)
    320   VALUES
    321   (2,\'guest\',\'\',\'\')
    322 ;';
    323     mysql_query($query);
    324 
    325     $query = '
    326 INSERT INTO '.USER_INFOS_TABLE.'
    327   (user_id,status,language,enabled_high)
    328   VALUES
    329   (2, \'guest\', \''.$language.'\',\'false\')
     309  SET language = \''.$language.'\'
    330310;';
    331311    mysql_query($query);
Note: See TracChangeset for help on using the changeset viewer.