Problem with saving preferences (patch)
Adam Yearout <[email protected]> Wed, 12 Mar 2003 20:50:22 -0800
| Newsgroups | gmane.comp.horde.sam |
|---|---|
| Message-ID | <[email protected]> |
Came across a small bug in regards to SAM's preference storing mechanism in sam/lib/Driver/sql.php. Originally it was set to simply ignore any changes if the setting matched the default setting, but then in that case, it wouldn't get changed _at all_. Modified the function so that it will DELETE the preference from the sql table instead, and thus simply load the default automatically for that user preference. Hope that makes sense. :) -- Adam Yearout [email protected] -- sam mailing list Frequently Asked Questions: http://horde.org/faq/ To unsubscribe, mail: [email protected]
sql.php.patch
(text/plain, 878 B)
--- sql.php.orig Sat Feb 15 16:30:05 2003
+++ sql.php Wed Mar 12 20:38:57 2003
@@ -199,11 +199,14 @@
}
foreach ($store as $preference => $value) {
- /* Don't save a user pref if it is just set to the
- * default. */
+ /* Delete the user pref if it is the same as the default */
if ($type === SAM_PREFTYPE_USER &&
array_key_exists($preference, $this->defaults) &&
$this->defaults[$preference] == $value) {
+ $this->_db->query(sprintf('DELETE FROM %s WHERE horde_id = %s AND preference = %s;',
+ $this->_params['table'],
+ $this->_db->quote($uid),
+ $this->_db->quote($preference)));
continue;
}