📄 getpreferences.php
字号:
<?php
require_once("../inc/constants.inc.php");
require_once("../inc/properties.inc.php");
require_once("../inc/tools.inc.php");
require_once("../inc/db.inc.php");
header('Content-type: text/xml;');
if (!isset($_SESSION['user'])) {
die();
}
$dom = new DOMDocument('1.0', ENCODING);
$root = $dom->appendChild(new DOMElement('response'));
$sql = "SELECT * FROM `user` WHERE id='" . $_SESSION['user'] ."'";
$result = mysql_query($sql);
$root->setAttribute("sql", $sql);
if ($result && mysql_num_rows($result) > 0) {
if ($line = mysql_fetch_assoc($result)) {
$value = $line['notifybirthday'];
$notifyDuringTheDay = $root->appendChild(new DOMElement('notification'));
$notifyDuringTheDay->setAttribute("daysBefore", "0");
$notifyDuringTheDay->setAttribute("value", NOTIFY_BIRTHDAYS_DURING_THE_DAY);
$notifyDuringTheDay->setAttribute("checked", ((($value & NOTIFY_BIRTHDAYS_DURING_THE_DAY) == NOTIFY_BIRTHDAYS_DURING_THE_DAY) ? "1" : "0"));
$notifyDuringTheDay = $root->appendChild(new DOMElement('notification'));
$notifyDuringTheDay->setAttribute("daysBefore", "1");
$notifyDuringTheDay->setAttribute("value", NOTIFY_BIRTHDAYS_1_DAY_BEFORE);
$notifyDuringTheDay->setAttribute("checked", ((($value & NOTIFY_BIRTHDAYS_1_DAY_BEFORE) == NOTIFY_BIRTHDAYS_1_DAY_BEFORE) ? "1" : "0"));
$notifyDuringTheDay = $root->appendChild(new DOMElement('notification'));
$notifyDuringTheDay->setAttribute("daysBefore", "2");
$notifyDuringTheDay->setAttribute("value", NOTIFY_BIRTHDAYS_2_DAYS_BEFORE);
$notifyDuringTheDay->setAttribute("checked", ((($value & NOTIFY_BIRTHDAYS_2_DAYS_BEFORE) == NOTIFY_BIRTHDAYS_2_DAYS_BEFORE) ? "1" : "0"));
$notifyDuringTheDay = $root->appendChild(new DOMElement('notification'));
$notifyDuringTheDay->setAttribute("daysBefore", "5");
$notifyDuringTheDay->setAttribute("value", NOTIFY_BIRTHDAYS_5_DAYS_BEFORE);
$notifyDuringTheDay->setAttribute("checked", ((($value & NOTIFY_BIRTHDAYS_5_DAYS_BEFORE) == NOTIFY_BIRTHDAYS_5_DAYS_BEFORE) ? "1" : "0"));
}
}
echo $dom->saveXML();
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -