wake-up calls

This commit is contained in:
Philip Häusler 2011-06-03 16:22:33 +02:00
parent f38500a2f1
commit 7a6f4b2750
6 changed files with 138 additions and 164 deletions

View File

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net -- http://www.phpmyadmin.net
-- --
-- Host: localhost -- Host: localhost
-- Erstellungszeit: 03. Juni 2011 um 12:43 -- Erstellungszeit: 03. Juni 2011 um 14:20
-- Server Version: 5.1.44 -- Server Version: 5.1.44
-- PHP-Version: 5.3.1 -- PHP-Version: 5.3.1
@ -71,27 +71,28 @@ CREATE TABLE IF NOT EXISTS `Counter` (
-- --
INSERT INTO `Counter` (`URL`, `Anz`) VALUES INSERT INTO `Counter` (`URL`, `Anz`) VALUES
('news', 198), ('news', 206),
('login', 34), ('login', 42),
('logout', 15), ('logout', 19),
('start', 28), ('start', 32),
('faq', 19), ('faq', 27),
('credits', 7), ('credits', 7),
('register', 10), ('register', 12),
('admin_rooms', 90), ('admin_rooms', 90),
('admin_angel_types', 71), ('admin_angel_types', 71),
('user_settings', 134), ('user_settings', 137),
('user_messages', 113), ('user_messages', 113),
('admin_groups', 141), ('admin_groups', 149),
('user_questions', 55), ('user_questions', 55),
('admin_questions', 43), ('admin_questions', 43),
('admin_faq', 55), ('admin_faq', 56),
('admin_news', 33), ('admin_news', 33),
('news_comments', 151), ('news_comments', 151),
('admin_user', 206), ('admin_user', 206),
('user_meetings', 5), ('user_meetings', 5),
('admin_language', 25), ('admin_language', 29),
('admin_log', 5); ('admin_log', 19),
('user_wakeup', 61);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -137,32 +138,34 @@ CREATE TABLE IF NOT EXISTS `GroupPrivileges` (
`privilege_id` int(11) NOT NULL, `privilege_id` int(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `group_id` (`group_id`,`privilege_id`) KEY `group_id` (`group_id`,`privilege_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=74 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=85 ;
-- --
-- Daten für Tabelle `GroupPrivileges` -- Daten für Tabelle `GroupPrivileges`
-- --
INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES
(69, -2, 11), (83, -2, 8),
(24, -1, 5), (24, -1, 5),
(68, -2, 9), (82, -2, 11),
(67, -2, 17), (81, -2, 9),
(23, -1, 2), (23, -1, 2),
(62, -4, 16), (62, -4, 16),
(61, -4, 6), (61, -4, 6),
(66, -2, 15), (80, -2, 17),
(65, -2, 3), (79, -2, 15),
(71, -5, 10), (75, -5, 18),
(60, -4, 12), (60, -4, 12),
(59, -4, 14), (59, -4, 14),
(64, -2, 4), (78, -2, 3),
(58, -4, 13), (58, -4, 13),
(57, -4, 7), (57, -4, 7),
(63, -4, 5), (63, -4, 5),
(70, -2, 8), (77, -2, 4),
(72, -5, 18), (74, -5, 10),
(73, -3, 19); (73, -3, 19),
(76, -5, 20),
(84, -2, 20);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -276,7 +279,7 @@ CREATE TABLE IF NOT EXISTS `Privileges` (
`desc` varchar(1024) NOT NULL, `desc` varchar(1024) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`) UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=20 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=21 ;
-- --
-- Daten für Tabelle `Privileges` -- Daten für Tabelle `Privileges`
@ -301,7 +304,8 @@ INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES
(16, 'admin_user', 'Administrate the angels'), (16, 'admin_user', 'Administrate the angels'),
(17, 'user_meetings', 'Lists meetings (news)'), (17, 'user_meetings', 'Lists meetings (news)'),
(18, 'admin_language', 'Translate the system'), (18, 'admin_language', 'Translate the system'),
(19, 'admin_log', 'Display recent changes'); (19, 'admin_log', 'Display recent changes'),
(20, 'user_wakeup', 'User wakeup-service organization');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -557,7 +561,7 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
('inc_schicht_noch_gesucht', 'DE', ' noch gesucht'), ('inc_schicht_noch_gesucht', 'DE', ' noch gesucht'),
('inc_schicht_und', 'DE', ' und '), ('inc_schicht_und', 'DE', ' und '),
('pub_wake_beschreibung', 'DE', 'hier kannst du dich zum Wecken eintragen. Dazu sage einfach wann und wo und der Engel vom Dienst wird dich wecken.'), ('pub_wake_beschreibung', 'DE', 'hier kannst du dich zum Wecken eintragen. Dazu sage einfach wann und wo und der Engel vom Dienst wird dich wecken.'),
('pub_wake_beschreibung2', 'DE', 'Deine bisherigen eingetragenen Zeiten:'), ('pub_wake_beschreibung2', 'DE', 'Alle eingetragenen Weckwünsche, die nächsten zuerst.'),
('pub_wake_Datum', 'DE', 'Datum'), ('pub_wake_Datum', 'DE', 'Datum'),
('pub_wake_Ort', 'DE', 'Ort'), ('pub_wake_Ort', 'DE', 'Ort'),
('pub_wake_Bemerkung', 'DE', 'Bermerkung'), ('pub_wake_Bemerkung', 'DE', 'Bermerkung'),
@ -601,7 +605,7 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
('inc_schicht_wird', 'EN', ' is '), ('inc_schicht_wird', 'EN', ' is '),
('inc_schicht_noch_gesucht', 'EN', ' still needed '), ('inc_schicht_noch_gesucht', 'EN', ' still needed '),
('inc_schicht_und', 'EN', ' and '), ('inc_schicht_und', 'EN', ' and '),
('pub_wake_beschreibung2', 'EN', 'The wake-up calls you have ordered:\r\n'), ('pub_wake_beschreibung2', 'EN', 'All ordered wake-up calls, next first.'),
('pub_wake_Datum', 'EN', 'Date'), ('pub_wake_Datum', 'EN', 'Date'),
('pub_wake_Ort', 'EN', 'Place'), ('pub_wake_Ort', 'EN', 'Place'),
('pub_wake_change', 'EN', 'delete'), ('pub_wake_change', 'EN', 'delete'),
@ -1050,7 +1054,9 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
('admin_language', 'DE', 'Übersetzung'), ('admin_language', 'DE', 'Übersetzung'),
('admin_language', 'EN', 'Translation'), ('admin_language', 'EN', 'Translation'),
('admin_log', 'EN', 'Log'), ('admin_log', 'EN', 'Log'),
('admin_log', 'DE', 'Log'); ('admin_log', 'DE', 'Log'),
('user_wakeup', 'DE', 'Weckservice'),
('user_wakeup', 'EN', 'Wakeup service');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -1093,8 +1099,8 @@ 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', 'Gates', 'Bill', 42, '', '', '', '', '', '', '', '4297f44b13955235245b2497399d7a93', 1, 1, 0, 10, 'DE', 115, 'L', 1307105002, '0000-00-00 00:00:00', '', '', ''), (1, 'admin', 'Gates', 'Bill', 42, '', '', '', '', '', '', '', '21232f297a57a5a743894a0e4a801fc3', 1, 1, 0, 10, 'DE', 115, 'L', 1307110821, '0000-00-00 00:00:00', '', '', ''),
(148, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', '', '4297f44b13955235245b2497399d7a93', 0, 1, 1, 10, 'DE', 0, 'L', 1307082872, '2011-06-03 07:55:24', 'AudioEngel', '', ''); (148, 'msquare', '', '', 23, '', '', '', 'msquare@notrademark.de', '', '', '', '4297f44b13955235245b2497399d7a93', 0, 1, 1, 10, 'DE', 0, 'L', 1307110798, '2011-06-03 07:55:24', 'AudioEngel', '', '');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -1227,13 +1233,16 @@ INSERT INTO `UserPicture` (`UID`, `Bild`, `ContentType`, `show`) VALUES
CREATE TABLE IF NOT EXISTS `Wecken` ( CREATE TABLE IF NOT EXISTS `Wecken` (
`ID` int(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
`UID` int(11) NOT NULL DEFAULT '0', `UID` int(11) NOT NULL DEFAULT '0',
`Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `Date` int(11) NOT NULL,
`Ort` text NOT NULL, `Ort` text NOT NULL,
`Bemerkung` text NOT NULL, `Bemerkung` text NOT NULL,
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
-- --
-- Daten für Tabelle `Wecken` -- Daten für Tabelle `Wecken`
-- --
INSERT INTO `Wecken` (`ID`, `UID`, `Date`, `Ort`, `Bemerkung`) VALUES
(4, 1, 1307109840, 'Tent 23', 'knock knock leo, follow the white rabbit to the blue tent'),
(5, 1, 1307109840, 'Tent 23', 'knock knock leo, follow the white rabbit to the blue tent');

View File

@ -0,0 +1,92 @@
<?php
function user_wakeup() {
global $user;
$html = "";
if (isset ($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
case 'create' :
$date = DateTime::createFromFormat("Y-m-d H:i", $_REQUEST['Date']);
if ($date != null) {
$date = $date->getTimestamp();
$bemerkung = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['Bemerkung']));
$ort = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}]{1,})/ui", '', strip_tags($_REQUEST['Ort']));
$SQL = "INSERT INTO `Wecken` (`UID`, `Date`, `Ort`, `Bemerkung`) " .
"VALUES ('" . $user['UID'] . "', '" . $date . "', '" . $ort . "', " .
"'" . $bemerkung . "')";
sql_query($SQL);
$html .= success(Get_Text(4));
} else
$html .= error("Broken date!");
break;
case 'delete' :
if (isset ($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
$id = $_REQUEST['id'];
else
return error("Incomplete call, missing wake-up ID.");
$wakeup = sql_select("SELECT * FROM `Wecken` WHERE `ID`=" . sql_escape($id) . " LIMIT 1");
if (count($wakeup) > 0 && $wakeup[0]['UID'] == $user['UID']) {
sql_query("DELETE FROM `Wecken` WHERE `ID`=" . sql_escape($id) . " LIMIT 1");
$html .= success("Wake-up call deleted.");
} else
return error("No wake-up found.");
break;
}
}
$html .= "<p>" . Get_Text("Hello") . $user['Nick'] . ",<br />" . Get_Text("pub_wake_beschreibung") . "</p>\n\n";
$html .= Get_Text("pub_wake_beschreibung2");
$html .= '
<table border="0" width="100%" class="border" cellpadding="2" cellspacing="1">
<tr class="contenttopic">
<th>' . Get_Text("pub_wake_Datum") . '</th>
<th>' . Get_Text("pub_waeckliste_Nick") . '</th>
<th>' . Get_Text("pub_wake_Ort") . '</th>
<th>' . Get_Text("pub_wake_Bemerkung") . '</th>
<th></th>
</tr>
';
$sql = "SELECT * FROM `Wecken` ORDER BY `Date` ASC";
$Erg = sql_query($sql);
$count = mysql_num_rows($Erg);
for ($i = 0; $i < $count; $i++) {
$row = mysql_fetch_row($Erg);
$html .= '<tr class="content">';
$html .= '<td>' . date("Y-m-d H:i", mysql_result($Erg, $i, "Date")) . ' </td>';
$html .= '<td>' . UID2Nick(mysql_result($Erg, $i, "UID")) . ' </td>';
$html .= '<td>' . mysql_result($Erg, $i, "Ort") . ' </td>';
$html .= '<td>' . mysql_result($Erg, $i, "Bemerkung") . ' </td>';
if (mysql_result($Erg, $i, "UID") == $user['UID'])
$html .= '<td><a href="' . page_link_to("user_wakeup") . '&action=delete&id=' . mysql_result($Erg, $i, "ID") . "\">" . Get_Text("pub_wake_del") . '</a></td>';
else
$html .= '<td></td>';
$html .= '</tr>';
}
$html .= '</table><hr />' . Get_Text("pub_wake_Text2") . '
<form action="' . page_link_to("user_wakeup") . '&action=create" method="post">
<table>
<tr>
<td align="right">' . Get_Text("pub_wake_Datum") . ':</td>
<td><input type="text" name="Date" value="' . date("Y-m-d H:i") . '"></td>
</tr>
<tr>
<td align="right">' . Get_Text("pub_wake_Ort") . '</td>
<td><input type="text" name="Ort" value="Tent 23"></td>
</tr>
<tr>
<td align="right">' . Get_Text("pub_wake_Bemerkung") . '</td>
<td><textarea name="Bemerkung" rows="5" cols="40">knock knock leo, follow the white rabbit to the blue tent</textarea></td>
</tr>
</table>
<input type="submit" name="submit" value="' . Get_Text("pub_wake_bouton") . '" />
</form>';
return $html;
}
?>

View File

@ -27,6 +27,7 @@ function make_navigation() {
"user_shifts", "user_shifts",
"user_messages", "user_messages",
"user_questions", "user_questions",
"user_wakeup",
"user_settings" "user_settings"
)); ));

View File

@ -55,6 +55,10 @@ if (in_array($p, $privileges)) {
require_once ('includes/pages/user_questions.php'); require_once ('includes/pages/user_questions.php');
$content = user_questions(); $content = user_questions();
} }
elseif ($p == "user_wakeup") {
require_once ('includes/pages/user_wakeup.php');
$content = user_wakeup();
}
elseif ($p == "user_settings") { elseif ($p == "user_settings") {
require_once ('includes/pages/user_settings.php'); require_once ('includes/pages/user_settings.php');
$content = user_settings(); $content = user_settings();

View File

@ -1,46 +0,0 @@
<?php
require_once ('../bootstrap.php');
$title = "Himmel";
$header = "Weckdienst - Liste der zu weckenden Engel";
include "includes/header.php";
?>
<p><?php echo Get_Text("Hello") . $_SESSION['Nick'] . ",<br />\n" . Get_Text("pub_waeckliste_Text1"); ?></p>
<table border="0" width="100%" class="border" cellpadding="2" cellspacing="1">
<tr class="contenttopic">
<th align="left"><?php echo Get_Text("pub_waeckliste_Nick");?></th>
<th align="left"><?php echo Get_Text("pub_waeckliste_Datum");?></th>
<th align="left"><?php echo Get_Text("pub_waeckliste_Ort");?></th>
<th align="left"><?php echo Get_Text("pub_waeckliste_Comment");?></th>
</tr>
<?php
$sql = "SELECT * FROM `Wecken` ORDER BY `Date` ASC";
$Erg = mysql_query($sql, $con);
$count = mysql_num_rows($Erg);
for ($i = 0; $i < $count; $i++) {
$row = mysql_fetch_row($Erg);
?>
<tr class="content">
<td align="left"><?php echo UID2Nick(mysql_result($Erg, $i, "UID")); ?> </td>
<td align="left"><?php echo mysql_result($Erg, $i, "Date"); ?> </td>
<td align="left"><?php echo mysql_result($Erg, $i, "Ort"); ?> </td>
<td align="left"><?php echo mysql_result($Erg, $i, "Bemerkung"); ?> </td>
</tr>
<?php
}
?>
</table>
<?php
include "includes/footer.php";
?>

View File

@ -1,86 +0,0 @@
<?php
require_once ('../bootstrap.php');
$title = "Himmel";
$header = "Weckdienst";
include "includes/header.php";
if (isset ($_POST["eintragen"])) {
if ($_POST["eintragen"] == Get_Text("pub_wake_bouton")) {
$SQL = "INSERT INTO `Wecken` (`UID`, `Date`, `Ort`, `Bemerkung`) " .
"VALUES ('" . $_SESSION['UID'] . "', '" . $_POST["Date"] . "', '" . $_POST["Ort"] . "', " .
"'" . $_POST["Bemerkung"] . "')";
$Erg = mysql_query($SQL, $con);
if ($Erg == 1)
Print_Text(4);
}
}
if (isset ($_GET["eintragen"])) {
if ($_GET["eintragen"] == "loeschen") {
$SQL = "DELETE FROM `Wecken` WHERE `UID`='" . $_SESSION['UID'] . "' AND `ID`='" . $_GET["weckID"] . "' LIMIT 1";
$Erg = mysql_query($SQL, $con);
if ($Erg == 1)
Print_Text(4);
}
}
echo "<p>" . Get_Text("Hello") . $_SESSION['Nick'] . ",<br />" . Get_Text("pub_wake_beschreibung") . "</p>\n\n";
echo Get_Text("pub_wake_beschreibung2");
?>
<table border="0" width="100%" class="border" cellpadding="2" cellspacing="1">
<tr class="contenttopic">
<th align="left"><?php echo Get_Text("pub_wake_Datum"); ?></th>
<th align="left"><?php echo Get_Text("pub_wake_Ort"); ?></th>
<th align="left"><?php echo Get_Text("pub_wake_Bemerkung"); ?></th>
<th align="left"><?php echo Get_Text("pub_wake_change"); ?></th>
</tr>
<?php
$sql = "SELECT * FROM `Wecken` WHERE `UID`='" . $_SESSION['UID'] . "' ORDER BY `Date` ASC";
$Erg = mysql_query($sql, $con);
$count = mysql_num_rows($Erg);
for ($i = 0; $i < $count; $i++) {
$row = mysql_fetch_row($Erg);
?>
<tr class="content">
<td align="left"><?php echo mysql_result($Erg, $i, "Date"); ?> </td>
<td align="left"><?php echo mysql_result($Erg, $i, "Ort"); ?> </td>
<td align="left"><?php echo mysql_result($Erg, $i, "Bemerkung"); ?> </td>
<td align="left"><a href="./wecken.php?eintragen=loeschen&weckID=<?php echo mysql_result($Erg, $i, "ID") . "\">" . Get_Text("pub_wake_del"); ?></a></td>
</tr>
<?php
}
?>
</table>
<br /><br />
<?php echo Get_Text("pub_wake_Text2"); ?><br /><br />
<form action="wecken.php" method="post">
<table>
<tr>
<td align="right"><?php echo Get_Text("pub_wake_Datum"); ?>:</td>
<td align="left"><input type="text" name="Date" value="2003-08-05 08:00:00"></td>
</tr>
<tr>
<td align="right"><?php echo Get_Text("pub_wake_Ort"); ?></td>
<td align="left"><input type="text" name="Ort" value="Tent 23"></td>
</tr>
<tr>
<td align="right"><?php echo Get_Text("pub_wake_Bemerkung"); ?></td>
<td align="left"><textarea name="Bemerkung" rows="5" cols="40">knock knock leo, follow the white rabbit to the blue tent</textarea></td>
</tr>
</table>
<input type="submit" name="eintragen" value="<?php echo Get_Text("pub_wake_bouton"); ?>" />
</form>
<?php
include ("includes/footer.php");
?>