aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-03-28 22:30:04 +0000
committerrub <rub@piwigo.org>2007-03-28 22:30:04 +0000
commit69b26ddc47829d3876fbf786ad1c4e5b33f05b76 (patch)
treec187aba3cfcdddb984254b4f9f8fc1a41af1a4a5
parent60903d8c88c976ff4886fd72a7e5e37f7c7a79b8 (diff)
Issue 578
User guest must be real user Step 2: Installation finished, guest must be used on list and group, corrections git-svn-id: http://piwigo.org/svn/trunk@1930 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/cat_perm.php1
-rw-r--r--admin/user_list.php16
-rw-r--r--include/functions_user.inc.php22
-rw-r--r--install.php16
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php2
-rw-r--r--language/fr_FR.iso-8859-1/admin.lang.php2
6 files changed, 35 insertions, 24 deletions
diff --git a/admin/cat_perm.php b/admin/cat_perm.php
index 7fa279c49..3782d7190 100644
--- a/admin/cat_perm.php
+++ b/admin/cat_perm.php
@@ -275,7 +275,6 @@ $query = '
SELECT '.$conf['user_fields']['id'].' AS id,
'.$conf['user_fields']['username'].' AS username
FROM '.USERS_TABLE.'
- WHERE '.$conf['user_fields']['id'].' != '.$conf['guest_id'].'
;';
$result = pwg_query($query);
while($row = mysql_fetch_array($result))
diff --git a/admin/user_list.php b/admin/user_list.php
index 15b009290..ae1c0af36 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -103,7 +103,7 @@ SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
ON u.'.$conf['user_fields']['id'].' = ui.user_id
LEFT JOIN '.USER_GROUP_TABLE.' AS ug
ON u.'.$conf['user_fields']['id'].' = ug.user_id
- WHERE u.'.$conf['user_fields']['id'].' != '.$conf['guest_id'];
+ WHERE u.'.$conf['user_fields']['id'].' > 0';
if (isset($filter['username']))
{
$query.= '
@@ -791,11 +791,19 @@ foreach ($page['filtered_users'] as $num => $local_user)
'CHECKED' => $checked,
'U_PROFILE' => $profile_url.$local_user['id'],
'U_PERM' => $perm_url.$local_user['id'],
- 'USERNAME' => $local_user['username'],
- 'STATUS' => $lang['user_status_'.$local_user['status']].(($local_user['adviser'] == 'true') ? ' ['.$lang['adviser'].']' : ''),
+ 'USERNAME' => $local_user['username']
+ .($local_user['id'] == $conf['guest_id']
+ ? '<BR />['.l10n('is_the_guest').']' : '')
+ .($local_user['id'] == $conf['default_user_id']
+ ? '<BR />['.l10n('is_the_default').']' : ''),
+ 'STATUS' => $lang['user_status_'.
+ $local_user['status']].(($local_user['adviser'] == 'true')
+ ? '<BR />['.l10n('adviser').']' : ''),
'EMAIL' => get_email_address_as_display_text($local_user['email']),
'GROUPS' => $groups_string,
- 'PROPERTIES' => (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) ? $lang['is_high_enabled'] : $lang['is_high_disabled']
+ 'PROPERTIES' =>
+ (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
+ ? $lang['is_high_enabled'] : $lang['is_high_disabled']
)
);
}
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 635055f1a..0bae2a0d7 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -726,6 +726,13 @@ function get_default_user_info($convert_str = true)
$result = pwg_query($query);
$page['cache_default_user'] = mysql_fetch_assoc($result);
+
+ if ($page['cache_default_user'] !== false)
+ {
+ unset($page['cache_default_user']['user_id']);
+ unset($page['cache_default_user']['status']);
+ unset($page['cache_default_user']['registration_date']);
+ }
}
if (is_array($page['cache_default_user']) and $convert_str)
@@ -793,8 +800,9 @@ function get_default_language()
* add user informations based on default values
*
* @param int user_id / array of user_if
+ * @param array of values used to override default user values
*/
-function create_user_infos($arg_id)
+function create_user_infos($arg_id, $override_values = null)
{
global $conf;
@@ -822,7 +830,12 @@ function create_user_infos($arg_id)
// Default on structure are used
$default_user = array();
}
-
+
+ if (!is_null($override_values))
+ {
+ $default_user = array_merge($default_user, $override_values);
+ print_r($default_user);
+ }
foreach ($user_ids as $user_id)
{
@@ -840,12 +853,13 @@ function create_user_infos($arg_id)
$status = 'normal';
}
- $insert =
+ $insert = array_merge(
+ $default_user,
array(
'user_id' => $user_id,
'status' => $status,
'registration_date' => $dbnow
- );
+ ));
array_push($inserts, $insert);
}
diff --git a/install.php b/install.php
index 831ed98c2..19eee1600 100644
--- a/install.php
+++ b/install.php
@@ -312,13 +312,6 @@ define(\'PHPWG_INSTALLED\', true);
$table_prefix
);
- $query = '
-UPDATE '.CONFIG_TABLE.'
- SET value = \''.$language.'\'
- WHERE param = \'default_language\'
-;';
- mysql_query($query);
-
// fill $conf global array
load_conf_from_db();
@@ -343,14 +336,7 @@ UPDATE '.CONFIG_TABLE.'
);
mass_inserts(USERS_TABLE, array_keys($inserts[0]), $inserts);
- create_user_infos(1);
- create_user_infos(2);
-
- $query = '
-UPDATE '.USER_INFOS_TABLE.'
- SET language = \''.$language.'\'
-;';
- mysql_query($query);
+ create_user_infos(array(1,2), array('language' => $language));
// Available upgrades must be ignored after a fresh installation. To
// make PWG avoid upgrading, we must tell it upgrades have already been
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index 8860a663c..e72c3dbd3 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -589,4 +589,6 @@ $lang['%d lines filtered'] = '%d lines filtered';
$lang['%d members: %s'] = '%d members: %s';
$lang['%d guests'] = '%d guests';
$lang['Hour'] = 'Hour';
+$lang['is_the_guest'] = 'guest';
+$lang['is_the_default'] = 'default values';
?>
diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php
index 56c237033..084d6099d 100644
--- a/language/fr_FR.iso-8859-1/admin.lang.php
+++ b/language/fr_FR.iso-8859-1/admin.lang.php
@@ -588,4 +588,6 @@ $lang['%d lines filtered'] = '%d lignes filtrées';
$lang['%d members: %s'] = '%d membres: %s';
$lang['%d guests'] = '%d invités';
$lang['Hour'] = 'Heure';
+$lang['is_the_guest'] = 'invité';
+$lang['is_the_default'] = 'valeurs par défaut';
?>