add db-prefs.php
This commit is contained in:
parent
e0257be14a
commit
3bac89ad2a
|
@ -9,12 +9,14 @@
|
||||||
|
|
||||||
require_once "config.php";
|
require_once "config.php";
|
||||||
require_once "db.php";
|
require_once "db.php";
|
||||||
|
require_once "db-prefs.php";
|
||||||
require_once "functions.php";
|
require_once "functions.php";
|
||||||
require_once "magpierss/rss_fetch.inc";
|
require_once "magpierss/rss_fetch.inc";
|
||||||
|
|
||||||
$script_started = getmicrotime();
|
$script_started = getmicrotime();
|
||||||
|
|
||||||
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
||||||
|
$dbprefs_link = $link;
|
||||||
|
|
||||||
if (!$link) {
|
if (!$link) {
|
||||||
if (DB_TYPE == "mysql") {
|
if (DB_TYPE == "mysql") {
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?
|
||||||
|
|
||||||
|
require_once "config.php";
|
||||||
|
require_once "db.php";
|
||||||
|
|
||||||
|
global $dbprefs_link;
|
||||||
|
|
||||||
|
function get_pref($pref_name) {
|
||||||
|
|
||||||
|
$pref_name = db_escape_string($pref_name);
|
||||||
|
|
||||||
|
$result = db_query($dbprefs_link, "SELECT
|
||||||
|
value,ttrss_prefs_types.id as type_name
|
||||||
|
FROM ttrss_prefs,ttrss_prefs_types
|
||||||
|
WHERE pref_name = '$pref_name' AND ttrss_prefs_types.id = type_id");
|
||||||
|
|
||||||
|
if (db_num_rows($result) > 0) {
|
||||||
|
$value = db_fetch_result($result, 0, "value");
|
||||||
|
return $value;
|
||||||
|
} else {
|
||||||
|
die("Fatal error, unknown preferences key: $pref_name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in New Issue