admin news

This commit is contained in:
Philip Häusler 2011-06-03 05:49:56 +02:00
parent 9325d7a78a
commit 9941d2a7a7
5 changed files with 112 additions and 41 deletions

View File

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net -- http://www.phpmyadmin.net
-- --
-- Host: localhost -- Host: localhost
-- Erstellungszeit: 03. Juni 2011 um 03:12 -- Erstellungszeit: 03. Juni 2011 um 03:49
-- Server Version: 5.1.44 -- Server Version: 5.1.44
-- PHP-Version: 5.3.1 -- PHP-Version: 5.3.1
@ -71,23 +71,23 @@ CREATE TABLE IF NOT EXISTS `Counter` (
-- --
INSERT INTO `Counter` (`URL`, `Anz`) VALUES INSERT INTO `Counter` (`URL`, `Anz`) VALUES
('news', 164), ('news', 187),
('login', 26), ('login', 26),
('logout', 13), ('logout', 13),
('start', 26), ('start', 26),
('faq', 18), ('faq', 19),
('credits', 3), ('credits', 3),
('register', 3), ('register', 3),
('admin_rooms', 75), ('admin_rooms', 89),
('admin_angel_types', 70), ('admin_angel_types', 71),
('user_settings', 125), ('user_settings', 126),
('user_messages', 112), ('user_messages', 113),
('admin_groups', 114), ('admin_groups', 117),
('user_questions', 55), ('user_questions', 55),
('admin_questions', 42), ('admin_questions', 42),
('admin_faq', 55), ('admin_faq', 55),
('admin_news', 2), ('admin_news', 32),
('news_comments', 144); ('news_comments', 151);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -226,10 +226,6 @@ CREATE TABLE IF NOT EXISTS `News` (
-- Daten für Tabelle `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', `UID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
KEY `Refid` (`Refid`) 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` -- 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 INSERT INTO `news_comments` (`ID`, `Refid`, `Datum`, `Text`, `UID`) VALUES
(1, 10, '2011-06-03 04:12:28', 'FOobar :)', 1), (1, 10, '2011-06-03 04:12:28', 'FOobar :)', 1),
(2, 10, '2011-06-03 04:13:03', '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', `show` char(1) NOT NULL DEFAULT 'Y',
`Number` int(11) DEFAULT NULL, `Number` int(11) DEFAULT NULL,
PRIMARY KEY (`RID`) PRIMARY KEY (`RID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
-- --
-- Daten für Tabelle `Room` -- 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', 'DE', 'FAQs bearbeiten'),
('admin_faq', 'EN', 'Edit FAQs'), ('admin_faq', 'EN', 'Edit FAQs'),
('news_comments', 'DE', 'News Kommentare'), ('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 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', '', '', ''); (147, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', 'L', 'e10adc3949ba59abbe56e057f20f883e', 0, 0, 0, 6, 'EN', 0, 'L', 1307042703, '2011-06-02 00:55:09', '', '', '');
-- -------------------------------------------------------- -- --------------------------------------------------------

View File

@ -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") . '">&laquo 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;
}
?>

View File

@ -1,5 +1,4 @@
jetzt: jetzt:
* news administrieren
* user administrieren * user administrieren
* schichtimport * schichtimport
* schichtadministration * schichtadministration
@ -20,6 +19,7 @@ später:
* Löschen nur mit Rückfrage * Löschen nur mit Rückfrage
* FAQ ordentlich mehrsprachig machen * FAQ ordentlich mehrsprachig machen
* Fertig übersetzen/Sprachwirrwarr beseitigen * Fertig übersetzen/Sprachwirrwarr beseitigen
* Übersetzung
* schichten ueber monatsgrenzen einbaue im moment werden die tage nur * schichten ueber monatsgrenzen einbaue im moment werden die tage nur
hochgezaehlt und die monatzgrenzen werden ignoriert hochgezaehlt und die monatzgrenzen werden ignoriert

View File

@ -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 &Auml;nderungen vornehmen kann.
<?php
include ("includes/footer.php");
?>

View File

@ -66,6 +66,10 @@ if (in_array($p, $privileges)) {
elseif ($p == "admin_questions") { elseif ($p == "admin_questions") {
$content = admin_questions(); $content = admin_questions();
} }
elseif ($p == "admin_news") {
require_once ('includes/pages/admin_news.php');
$content = admin_news();
}
elseif ($p == "admin_angel_types") { elseif ($p == "admin_angel_types") {
require_once ('includes/pages/admin_angel_types.php'); require_once ('includes/pages/admin_angel_types.php');
$content = admin_angel_types(); $content = admin_angel_types();