|
From: Ken T. <ke...@us...> - 2003-06-04 18:47:24
|
Update of /cvsroot/phpbt/phpbt
In directory sc8-pr-cvs1:/tmp/cvs-serv6144
Modified Files:
config.php upgrade.php user.php
Log Message:
finished storage handler for user's default #-of-results returned
discovered and fixed bug in user preferences page ("set" appeared many times)
pushed db_version pointer up to 3, adding def_results to TBL_USER_PREF
- updated schemas
- update.php
languages for def_results
Index: config.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/config.php,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- config.php 19 Apr 2003 18:12:36 -0000 1.36
+++ config.php 4 Jun 2003 18:47:19 -0000 1.37
@@ -37,7 +37,7 @@
// Database Table Config
// you can change either the prefix of the table names or each table name individually
-define ('DB_VERSION', 2); // the version of the database
+define ('DB_VERSION', 3); // the version of the database
define ('TBL_PREFIX', ''); // the prefix for all tables, leave empty to use the old style
define ('TBL_ACTIVE_SESSIONS', TBL_PREFIX.'active_sessions');
define ('TBL_DB_SEQUENCE', TBL_PREFIX.'db_sequence');
Index: upgrade.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/upgrade.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- upgrade.php 19 Apr 2003 18:12:37 -0000 1.33
+++ upgrade.php 4 Jun 2003 18:47:19 -0000 1.34
@@ -45,10 +45,15 @@
$db->query("create table if not exists ".TBL_PROJECT_PERM." ( project_id int(11) NOT NULL default '0', user_id int(11) NOT NULL default '0' )");
if ($thisvers < 2)
$db->query("alter table ".TBL_AUTH_GROUP." ADD assignable TINYINT DEFAULT 0 NOT NULL AFTER locked");
+ if ($thisvers < 3)
+ $db->query("ALTER TABLE ".TBL_USER_PREF." ADD def_results INT DEFAULT '20' NOT NULL");
break;
+ case 'pgsql' :
+ //! Missing Alter/Create's
case 'oci8' :
$db->query("create table ".TBL_PROJECT_PERM." ( project_id number(10) default '0' NOT NULL, user_id number(10) default '0' NOT NULL )");
//! TBL_AUTH_GROUP
+ //! TBL_USER_PERM.def_results (see mysql)
break;
}
@@ -60,10 +65,6 @@
$db->query("INSERT INTO ".TBL_CONFIGURATION." VALUES ('DB_VERSION', '".DB_VERSION."', 'Database Version <b>Warning:</b> Changing this might make things go horribly wrong.', 'string')");
}
- if ($thisvers < 3) {
-
- }
-
/* update to current DB_VERSION */
$db->query("UPDATE ".TBL_CONFIGURATION." SET varvalue = '".DB_VERSION."' WHERE varname = 'DB_VERSION'");
@@ -77,4 +78,4 @@
include 'templates/default/upgrade.html';
}
-?>
\ No newline at end of file
+?>
Index: user.php
===================================================================
RCS file: /cvsroot/phpbt/phpbt/user.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- user.php 18 Jun 2002 16:36:21 -0000 1.27
+++ user.php 4 Jun 2003 18:47:19 -0000 1.28
@@ -77,14 +77,18 @@
array_shift($old_prefs); // Drop the user_id field
$updates = array();
foreach ($old_prefs as $pref => $val) {
+ if ($pref == 'def_results') continue;
if (in_array($pref, $prefs) and !$val) {
- $updates[] = "set $pref = 1";
+ $updates[] = "$pref = 1";
} elseif (!in_array($pref, $prefs) and $val) {
- $updates[] = "set $pref = 0";
+ $updates[] = "$pref = 0";
}
}
+
+ $updates[] = 'def_results = '.(int)$prefs['def_results']; // override previous set
+
if (count($updates)) {
- $db->query("update ".TBL_USER_PREF.' '.@join(', ', $updates).
+ $db->query("update ".TBL_USER_PREF.' set '.@join(', ', $updates).
" where user_id = $u");
}
@@ -104,7 +108,7 @@
$pref_labels = array(
'email_notices' => $STRING['USER_PREF']['ReceiveNotifications'],
'saved_queries' => $STRING['USER_PREF']['ShowSavedQueries']
- );
+ );
$prefs = $db->getRow("select * from ".TBL_USER_PREF." where user_id = $u");
foreach ($pref_labels as $pref => $label) {
@@ -113,14 +117,17 @@
'label' => $label,
'checked' => $prefs[$pref]
);
- }
+ }
+
+ $def_results = $prefs['def_results'];
$t->assign(array(
'error' => $error,
'my_fields' => $_sv['db_fields'] ? $_sv['db_fields'] : $default_db_fields,
'field_titles' => $all_db_fields,
- 'preferences' => $preferences
- ));
+ 'preferences' => $preferences,
+ 'def_results' => $def_results
+ ));
$t->wrap('user.html', 'preferences');
}
@@ -142,7 +149,7 @@
change_bug_list_columns($_pv['column_list']);
break;
case 'changeprefs':
- change_preferences(isset($_pv['preferences']) ? $_pv['preferences'] : array());
+ change_preferences(isset($_pv['preferences']) ? array_merge($_pv['preferences'], array('def_results' => $_pv['def_results'])) : array());
break;
default:
show_preferences_form();
|