/** * Saves a preference to the liberty_content_prefs database table with the given pref name and value. If the value is NULL, the existing value will be delete and the value will not be saved. However, a zero will be stored. This will update the mPrefs hash. * * @param string Hash key for the mPrefs value * @param string Value for the mPrefs hash key */ function storePreference($pPrefName, $pPrefValue = NULL) { $ret = FALSE; if (LibertyContent::isValid()) { $query = "DELETE FROM `" . BIT_DB_PREFIX . "liberty_content_prefs` WHERE `content_id`=? AND `pref_name`=?"; $bindvars = array($this->mContentId, $pPrefName); $result = $this->mDb->query($query, $bindvars); if (!is_null($pPrefValue)) { $query = "INSERT INTO `" . BIT_DB_PREFIX . "liberty_content_prefs` (`content_id`,`pref_name`,`pref_value`) VALUES(?, ?, ?)"; $bindvars[] = substr($pPrefValue, 0, 250); $result = $this->mDb->query($query, $bindvars); $this->mPrefs[$pPrefName] = $pPrefValue; } $this->mPrefs[$pPrefName] = $pPrefValue; } return $ret; }