diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/common.inc.php | 27 | ||||
-rw-r--r-- | include/functions.inc.php | 32 | ||||
-rw-r--r-- | include/functions_user.inc.php | 18 |
3 files changed, 49 insertions, 28 deletions
diff --git a/include/common.inc.php b/include/common.inc.php index f66d1ee7f..8aeafb7bf 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -162,32 +162,7 @@ SELECT id // Setup gallery wide options, if this fails then we output a CRITICAL_ERROR // since basic gallery information is not available // -$query = ' -SELECT param,value - FROM '.CONFIG_TABLE.' -;'; -if (!($result = pwg_query($query))) -{ - die("Could not query config information"); -} - -while ( $row =mysql_fetch_array( $result ) ) -{ - if ( isset( $row['value'] ) ) - { - $conf[$row['param']] = $row['value']; - } - else - { - $conf[$row['param']] = ''; - } - // If the field is true or false, the variable is transformed into a - // boolean value. - if ( $conf[$row['param']] == 'true' or $conf[$row['param']] == 'false' ) - { - $conf[$row['param']] = get_boolean( $conf[$row['param']] ); - } -} +load_conf_from_db(); include(PHPWG_ROOT_PATH.'include/user.inc.php'); diff --git a/include/functions.inc.php b/include/functions.inc.php index 35b1e7935..166b0798f 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -881,4 +881,36 @@ function get_available_upgrade_ids() return $available_upgrade_ids; } +/** + * Add configuration parameters from database to global $conf array + * + * @return void + */ +function load_conf_from_db() +{ + global $conf; + + $query = ' +SELECT param,value + FROM '.CONFIG_TABLE.' +;'; + $result = pwg_query($query); + + if (mysql_num_rows($result) == 0) + { + die('No configuration data'); + } + + while ($row = mysql_fetch_array($result)) + { + $conf[ $row['param'] ] = isset($row['value']) ? $row['value'] : ''; + + // If the field is true or false, the variable is transformed into a + // boolean value. + if ($conf[$row['param']] == 'true' or $conf[$row['param']] == 'false') + { + $conf[ $row['param'] ] = get_boolean($conf[ $row['param'] ]); + } + } +} ?> diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 0965467ce..90fda9e55 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -446,10 +446,23 @@ function create_user_infos($user_id) list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); + if ($user_id == $conf['webmaster_id']) + { + $status = 'webmaster'; + } + else if ($user_id == $conf['guest_id']) + { + $status = 'guest'; + } + else + { + $status = 'normal'; + } + $insert = array( 'user_id' => $user_id, - 'status' => $user_id == $conf['webmaster_id'] ? 'admin' : 'normal', + 'status' => $status, 'template' => $conf['default_template'], 'nb_image_line' => $conf['nb_image_line'], 'nb_line_page' => $conf['nb_line_page'], @@ -460,7 +473,8 @@ function create_user_infos($user_id) 'maxwidth' => $conf['default_maxwidth'], 'maxheight' => $conf['default_maxheight'], 'registration_date' => $dbnow, - 'enabled_high' => $conf['newuser_default_enabled_high'] + 'enabled_high' => + boolean_to_string($conf['newuser_default_enabled_high']), ); include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |