From f9aa6a898f67b7ce259ec942c8effd8ae2ada1df Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 13 Jan 2010 21:30:17 +0300 Subject: updating issue fix for schema 63 (2) --- functions.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index f6ce227f0..507595e77 100644 --- a/functions.php +++ b/functions.php @@ -1685,17 +1685,19 @@ if (!$profile) { $profile = "NULL"; - $profile_qpart = "profile IS NULL"; + $profile_qpart = "AND profile IS NULL"; } else { - $profile_qpart = "profile = '$profile'"; + $profile_qpart = "AND profile = '$profile'"; } + if (get_schema_version($link) < 63) $profile_qpart = ""; + db_query($link, "BEGIN"); $result = db_query($link, "SELECT pref_name,def_value FROM ttrss_prefs"); $u_result = db_query($link, "SELECT pref_name - FROM ttrss_user_prefs WHERE owner_uid = '$uid' AND $profile_qpart"); + FROM ttrss_user_prefs WHERE owner_uid = '$uid' $profile_qpart"); $active_prefs = array(); @@ -1707,9 +1709,16 @@ if (array_search($line["pref_name"], $active_prefs) === FALSE) { // print "adding " . $line["pref_name"] . "
"; - db_query($link, "INSERT INTO ttrss_user_prefs - (owner_uid,pref_name,value, profile) VALUES - ('$uid', '".$line["pref_name"]."','".$line["def_value"]."', $profile)"); + if (get_schema_version($link) < 63) { + db_query($link, "INSERT INTO ttrss_user_prefs + (owner_uid,pref_name,value) VALUES + ('$uid', '".$line["pref_name"]."','".$line["def_value"]."')"); + + } else { + db_query($link, "INSERT INTO ttrss_user_prefs + (owner_uid,pref_name,value, profile) VALUES + ('$uid', '".$line["pref_name"]."','".$line["def_value"]."', $profile)"); + } } } -- cgit v1.2.3-54-g00ecf