diff options
author | Philip Häusler <msquare@notrademark.de> | 2011-06-03 05:49:56 +0200 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2011-06-03 05:49:56 +0200 |
commit | 9941d2a7a799ad45b8e54c528c2161f880ab159e (patch) | |
tree | 2cd2b5ee4adaeb7ed6c1b6fec90d0012216e84d4 | |
parent | 9325d7a78adac2aeee96324fa23528f8110d198f (diff) |
admin news
-rw-r--r-- | DB/db_rewrite.sql | 39 | ||||
-rw-r--r-- | includes/pages/admin_news.php | 87 | ||||
-rw-r--r-- | txt/TODO | 2 | ||||
-rw-r--r-- | www-ssl/admin/index.php | 21 | ||||
-rw-r--r-- | www-ssl/index.php | 4 |
5 files changed, 112 insertions, 41 deletions
diff --git a/DB/db_rewrite.sql b/DB/db_rewrite.sql index b85f04c9..f5ba1c6d 100644 --- a/DB/db_rewrite.sql +++ b/DB/db_rewrite.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Erstellungszeit: 03. Juni 2011 um 03:12 +-- Erstellungszeit: 03. Juni 2011 um 03:49 -- Server Version: 5.1.44 -- PHP-Version: 5.3.1 @@ -71,23 +71,23 @@ CREATE TABLE IF NOT EXISTS `Counter` ( -- INSERT INTO `Counter` (`URL`, `Anz`) VALUES -('news', 164), +('news', 187), ('login', 26), ('logout', 13), ('start', 26), -('faq', 18), +('faq', 19), ('credits', 3), ('register', 3), -('admin_rooms', 75), -('admin_angel_types', 70), -('user_settings', 125), -('user_messages', 112), -('admin_groups', 114), +('admin_rooms', 89), +('admin_angel_types', 71), +('user_settings', 126), +('user_messages', 113), +('admin_groups', 117), ('user_questions', 55), ('admin_questions', 42), ('admin_faq', 55), -('admin_news', 2), -('news_comments', 144); +('admin_news', 32), +('news_comments', 151); -- -------------------------------------------------------- @@ -226,10 +226,6 @@ CREATE TABLE IF NOT EXISTS `News` ( -- Daten für Tabelle `News` -- -INSERT INTO `News` (`ID`, `Datum`, `Betreff`, `Text`, `UID`, `Treffen`) VALUES -(1, 1307070566, 'asdf', 'asdf', 1, 0), -(2, 1307070579, 'Achtung, Treffen!', 'Uiuiuiui.', 1, 0), -(3, 1307070686, 'Achtung, Treffen!', 'Jojojo!', 1, 1); -- -------------------------------------------------------- @@ -245,7 +241,7 @@ CREATE TABLE IF NOT EXISTS `news_comments` ( `UID` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`), KEY `Refid` (`Refid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Daten für Tabelle `news_comments` @@ -254,7 +250,8 @@ CREATE TABLE IF NOT EXISTS `news_comments` ( INSERT INTO `news_comments` (`ID`, `Refid`, `Datum`, `Text`, `UID`) VALUES (1, 10, '2011-06-03 04:12:28', 'FOobar :)', 1), (2, 10, '2011-06-03 04:13:03', 'FOobar :)', 1), -(3, 10, '2011-06-03 04:13:06', 'FOobar :)', 1); +(3, 10, '2011-06-03 04:13:06', 'FOobar :)', 1), +(4, 3, '2011-06-03 05:20:05', 'Fünününü!', 1); -- -------------------------------------------------------- @@ -327,12 +324,14 @@ CREATE TABLE IF NOT EXISTS `Room` ( `show` char(1) NOT NULL DEFAULT 'Y', `Number` int(11) DEFAULT NULL, PRIMARY KEY (`RID`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -- -- Daten für Tabelle `Room` -- +INSERT INTO `Room` (`RID`, `Name`, `Man`, `FromPentabarf`, `show`, `Number`) VALUES +(2, 'Mein Zimmer', 'msquare', 'N', 'Y', 1337); -- -------------------------------------------------------- @@ -1028,7 +1027,9 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES ('admin_faq', 'DE', 'FAQs bearbeiten'), ('admin_faq', 'EN', 'Edit FAQs'), ('news_comments', 'DE', 'News Kommentare'), -('news_comments', 'EN', 'News comments'); +('news_comments', 'EN', 'News comments'), +('admin_news', 'DE', 'News verwalten'), +('admin_news', 'EN', 'Manage news'); -- -------------------------------------------------------- @@ -1071,7 +1072,7 @@ CREATE TABLE IF NOT EXISTS `User` ( -- INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Size`, `Passwort`, `Gekommen`, `Aktiv`, `Tshirt`, `color`, `Sprache`, `Avatar`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`) VALUES -(1, 'admin', '', '', 0, '', '', '', '', '', '', 'L', '21232f297a57a5a743894a0e4a801fc3', 0, 0, 0, 10, 'DE', 115, 'L', 1307070695, '0000-00-00 00:00:00', '', '', ''), +(1, 'admin', '', '', 0, '', '', '', '', '', '', 'L', '21232f297a57a5a743894a0e4a801fc3', 0, 0, 0, 10, 'DE', 115, 'L', 1307072950, '0000-00-00 00:00:00', '', '', ''), (147, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', 'L', 'e10adc3949ba59abbe56e057f20f883e', 0, 0, 0, 6, 'EN', 0, 'L', 1307042703, '2011-06-02 00:55:09', '', '', ''); -- -------------------------------------------------------- diff --git a/includes/pages/admin_news.php b/includes/pages/admin_news.php new file mode 100644 index 00000000..2c6e1f45 --- /dev/null +++ b/includes/pages/admin_news.php @@ -0,0 +1,87 @@ +<?php +function admin_news() { + global $user; + + if (!isset ($_GET["action"])) { + header("Location: " . page_link_to("news")); + } else { + $html = ""; + switch ($_GET["action"]) { + case 'edit' : + if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + $id = $_REQUEST['id']; + else + return error("Incomplete call, missing News ID."); + + $news = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); + if (count($news) > 0) { + list ($news) = $news; + + $html .= '<a href="' . page_link_to("news") . '">« Back</a>'; + + $html .= "<form action=\"" . page_link_to("admin_news") . "&action=save\" method=\"post\">\n"; + + $html .= "<table>\n"; + $html .= " <tr><td>Datum</td><td>" . + date("Y-m-d H:i", $news['Datum']) . "</td></tr>\n"; + $html .= " <tr><td>Betreff</td><td><input type=\"text\" size=\"40\" name=\"eBetreff\" value=\"" . + $news["Betreff"] . "\"></td></tr>\n"; + $html .= " <tr><td>Text</td><td><textarea rows=\"10\" cols=\"80\" name=\"eText\">" . + $news["Text"] . "</textarea></td></tr>\n"; + $html .= " <tr><td>Engel</td><td>" . + UID2Nick($news["UID"]) . "</td></tr>\n"; + $html .= " <tr><td>Treffen</td><td>" . html_select_key('eTreffen', array ( + '1' => "Ja", + '0' => "Nein" + ), $news['Treffen']) . "</td></tr>\n"; + $html .= "</table>"; + + $html .= "<input type=\"hidden\" name=\"id\" value=\"" . $id . "\">\n"; + $html .= "<input type=\"submit\" name=\"submit\" value=\"Speichern\">\n"; + $html .= "</form>"; + + $html .= "<form action=\"" . page_link_to("admin_news") . "&action=delete\" method=\"POST\">\n"; + $html .= "<input type=\"hidden\" name=\"id\" value=\"" . $id . "\">\n"; + $html .= "<input type=\"submit\" name=\"submit\" value=\"Löschen\">\n"; + $html .= "</form>"; + } else + return error("No News found."); + break; + + case 'save' : + if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + $id = $_REQUEST['id']; + else + return error("Incomplete call, missing News ID."); + + $news = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); + if (count($news) > 0) { + list ($news) = $news; + + sql_query("UPDATE `News` SET `Datum`='" . sql_escape(time()) . "', `Betreff`='" . sql_escape($_POST["eBetreff"]) . "', `Text`='" . sql_escape($_POST["eText"]) . "', `UID`='" . sql_escape($user['UID']) . + "', `Treffen`='" . sql_escape($_POST["eTreffen"]) . "' WHERE `ID`=".sql_escape($id)." LIMIT 1"); + header("Location: " . page_link_to("news")); + } else + return error("No News found."); + break; + + case 'delete' : + if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) + $id = $_REQUEST['id']; + else + return error("Incomplete call, missing News ID."); + + $news = sql_select("SELECT * FROM `News` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); + if (count($news) > 0) { + list ($news) = $news; + + sql_query("DELETE FROM `news` WHERE `ID`=" . sql_escape($id) . " LIMIT 1"); + header("Location: " . page_link_to("news")); + } else + return error("No News found."); + break; + } + } + return $html; +} +?>
\ No newline at end of file @@ -1,5 +1,4 @@ jetzt: - * news administrieren * user administrieren * schichtimport * schichtadministration @@ -20,6 +19,7 @@ später: * Löschen nur mit Rückfrage * FAQ ordentlich mehrsprachig machen * Fertig übersetzen/Sprachwirrwarr beseitigen + * Übersetzung * schichten ueber monatsgrenzen einbaue im moment werden die tage nur hochgezaehlt und die monatzgrenzen werden ignoriert diff --git a/www-ssl/admin/index.php b/www-ssl/admin/index.php deleted file mode 100644 index 4e761078..00000000 --- a/www-ssl/admin/index.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -require_once ('../bootstrap.php'); - -$title = "Erzengel"; -$header = "Index"; -include ("includes/header.php"); -include ("includes/funktion_db_list.php"); - -echo "Hallo Erzengel " . $_SESSION['Nick'] . ",<br />\n"; -?> - -du bist jetzt im Erzengel-Bereich. Hier kannst du die Engel-Verwaltung vornehmen.<br /><br /> - -Bitte melde dich <a href="../logout.php">hier</a> nach getaner Arbeit immer ab, damit kein anderer hier Änderungen vornehmen kann. - -<?php - - -include ("includes/footer.php"); -?> - diff --git a/www-ssl/index.php b/www-ssl/index.php index 9524459a..c62b03e0 100644 --- a/www-ssl/index.php +++ b/www-ssl/index.php @@ -66,6 +66,10 @@ if (in_array($p, $privileges)) { elseif ($p == "admin_questions") { $content = admin_questions(); } + elseif ($p == "admin_news") { + require_once ('includes/pages/admin_news.php'); + $content = admin_news(); + } elseif ($p == "admin_angel_types") { require_once ('includes/pages/admin_angel_types.php'); $content = admin_angel_types(); |