From 9941d2a7a799ad45b8e54c528c2161f880ab159e Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Fri, 3 Jun 2011 05:49:56 +0200 Subject: admin news --- DB/db_rewrite.sql | 39 +++++++++---------- includes/pages/admin_news.php | 87 +++++++++++++++++++++++++++++++++++++++++++ txt/TODO | 2 +- www-ssl/admin/index.php | 21 ----------- www-ssl/index.php | 4 ++ 5 files changed, 112 insertions(+), 41 deletions(-) create mode 100644 includes/pages/admin_news.php delete mode 100644 www-ssl/admin/index.php 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 @@ + 0) { + list ($news) = $news; + + $html .= '« Back'; + + $html .= "
\n"; + + $html .= "\n"; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= "
Datum" . + date("Y-m-d H:i", $news['Datum']) . "
Betreff
Text
Engel" . + UID2Nick($news["UID"]) . "
Treffen" . html_select_key('eTreffen', array ( + '1' => "Ja", + '0' => "Nein" + ), $news['Treffen']) . "
"; + + $html .= "\n"; + $html .= "\n"; + $html .= "
"; + + $html .= "
\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "
"; + } 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 diff --git a/txt/TODO b/txt/TODO index 42684e23..02dd8626 100644 --- a/txt/TODO +++ b/txt/TODO @@ -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 @@ -\n"; -?> - -du bist jetzt im Erzengel-Bereich. Hier kannst du die Engel-Verwaltung vornehmen.

- -Bitte melde dich hier nach getaner Arbeit immer ab, damit kein anderer hier Änderungen vornehmen kann. - - - 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(); -- cgit v1.2.3-70-g09d2