diff options
author | Bot <bot@myigel.name> | 2017-01-02 15:43:36 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-01-02 15:49:53 +0100 |
commit | d71e7bbfad2f07f82df0c515608996d250fd4182 (patch) | |
tree | 5083a17b218c08b3a699a0bf15bec926cc2dd185 /includes/pages/user_atom.php | |
parent | 7313e15ce8236e19331fb6639a3a5b97c8f06ecd (diff) |
Formatting
Diffstat (limited to 'includes/pages/user_atom.php')
-rw-r--r-- | includes/pages/user_atom.php | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/includes/pages/user_atom.php b/includes/pages/user_atom.php index 88e8f201..ee4ddae5 100644 --- a/includes/pages/user_atom.php +++ b/includes/pages/user_atom.php @@ -4,24 +4,24 @@ function user_atom() { global $user, $DISPLAY_NEWS; - - if (! isset($_REQUEST['key']) || ! preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) { + + if (!isset($_REQUEST['key']) || !preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) { engelsystem_error("Missing key."); } $key = $_REQUEST['key']; - + $user = User_by_api_key($key); if ($user == null) { engelsystem_error("Key invalid."); } - if (! in_array('atom', privileges_for_user($user['UID']))) { + if (!in_array('atom', privileges_for_user($user['UID']))) { engelsystem_error("No privilege for atom."); } - + $news = sql_select("SELECT * FROM `News` " . (empty($_REQUEST['meetings']) ? '' : 'WHERE `Treffen` = 1 ') . "ORDER BY `ID` DESC LIMIT " . sql_escape($DISPLAY_NEWS)); - + $output = make_atom_entries_from_news($news); - + header('Content-Type: application/atom+xml; charset=utf-8'); header("Content-Length: " . strlen($output)); raw_output($output); @@ -32,7 +32,13 @@ function make_atom_entries_from_news($news_entries) $html = '<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Engelsystem</title> - <id>' . $_SERVER['HTTP_HOST'] . htmlspecialchars(preg_replace('#[&?]key=[a-f0-9]{32}#', '', $_SERVER['REQUEST_URI'])) . '</id> + <id>' . $_SERVER['HTTP_HOST'] + . htmlspecialchars(preg_replace( + '#[&?]key=[a-f0-9]{32}#', + '', + $_SERVER['REQUEST_URI'] + )) + . '</id> <updated>' . date('Y-m-d\TH:i:sP', $news_entries[0]['Datum']) . "</updated>\n"; foreach ($news_entries as $news_entry) { $html .= make_atom_entry_from_news($news_entry); |