From 7a6f4b2750465da6f59b13aefa575d734f5471f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philip=20H=C3=A4usler?=
Date: Fri, 3 Jun 2011 16:22:33 +0200
Subject: [PATCH] wake-up calls
---
DB/db_rewrite.sql | 73 ++++++++++++++-----------
includes/pages/user_wakeup.php | 92 ++++++++++++++++++++++++++++++++
includes/sys_menu.php | 1 +
www-ssl/index.php | 4 ++
www-ssl/nonpublic/waeckliste.php | 46 ----------------
www-ssl/nonpublic/wecken.php | 86 -----------------------------
6 files changed, 138 insertions(+), 164 deletions(-)
create mode 100644 includes/pages/user_wakeup.php
delete mode 100644 www-ssl/nonpublic/waeckliste.php
delete mode 100644 www-ssl/nonpublic/wecken.php
diff --git a/DB/db_rewrite.sql b/DB/db_rewrite.sql
index 525d6e7b..e4bb6689 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 12:43
+-- Erstellungszeit: 03. Juni 2011 um 14:20
-- Server Version: 5.1.44
-- PHP-Version: 5.3.1
@@ -71,27 +71,28 @@ CREATE TABLE IF NOT EXISTS `Counter` (
--
INSERT INTO `Counter` (`URL`, `Anz`) VALUES
-('news', 198),
-('login', 34),
-('logout', 15),
-('start', 28),
-('faq', 19),
+('news', 206),
+('login', 42),
+('logout', 19),
+('start', 32),
+('faq', 27),
('credits', 7),
-('register', 10),
+('register', 12),
('admin_rooms', 90),
('admin_angel_types', 71),
-('user_settings', 134),
+('user_settings', 137),
('user_messages', 113),
-('admin_groups', 141),
+('admin_groups', 149),
('user_questions', 55),
('admin_questions', 43),
-('admin_faq', 55),
+('admin_faq', 56),
('admin_news', 33),
('news_comments', 151),
('admin_user', 206),
('user_meetings', 5),
-('admin_language', 25),
-('admin_log', 5);
+('admin_language', 29),
+('admin_log', 19),
+('user_wakeup', 61);
-- --------------------------------------------------------
@@ -137,32 +138,34 @@ CREATE TABLE IF NOT EXISTS `GroupPrivileges` (
`privilege_id` int(11) NOT NULL,
PRIMARY KEY (`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`
--
INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES
-(69, -2, 11),
+(83, -2, 8),
(24, -1, 5),
-(68, -2, 9),
-(67, -2, 17),
+(82, -2, 11),
+(81, -2, 9),
(23, -1, 2),
(62, -4, 16),
(61, -4, 6),
-(66, -2, 15),
-(65, -2, 3),
-(71, -5, 10),
+(80, -2, 17),
+(79, -2, 15),
+(75, -5, 18),
(60, -4, 12),
(59, -4, 14),
-(64, -2, 4),
+(78, -2, 3),
(58, -4, 13),
(57, -4, 7),
(63, -4, 5),
-(70, -2, 8),
-(72, -5, 18),
-(73, -3, 19);
+(77, -2, 4),
+(74, -5, 10),
+(73, -3, 19),
+(76, -5, 20),
+(84, -2, 20);
-- --------------------------------------------------------
@@ -276,7 +279,7 @@ CREATE TABLE IF NOT EXISTS `Privileges` (
`desc` varchar(1024) NOT NULL,
PRIMARY KEY (`id`),
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`
@@ -301,7 +304,8 @@ INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES
(16, 'admin_user', 'Administrate the angels'),
(17, 'user_meetings', 'Lists meetings (news)'),
(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_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_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_Ort', 'DE', 'Ort'),
('pub_wake_Bemerkung', 'DE', 'Bermerkung'),
@@ -601,7 +605,7 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
('inc_schicht_wird', 'EN', ' is '),
('inc_schicht_noch_gesucht', 'EN', ' still needed '),
('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_Ort', 'EN', 'Place'),
('pub_wake_change', 'EN', 'delete'),
@@ -1050,7 +1054,9 @@ INSERT INTO `Sprache` (`TextID`, `Sprache`, `Text`) VALUES
('admin_language', 'DE', 'Übersetzung'),
('admin_language', 'EN', 'Translation'),
('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
-(1, 'admin', 'Gates', 'Bill', 42, '', '', '', '', '', '', '', '4297f44b13955235245b2497399d7a93', 1, 1, 0, 10, 'DE', 115, 'L', 1307105002, '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', '', '');
+(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', 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` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`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,
`Bemerkung` text NOT NULL,
PRIMARY KEY (`ID`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ;
--
-- 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');
diff --git a/includes/pages/user_wakeup.php b/includes/pages/user_wakeup.php
new file mode 100644
index 00000000..b6955669
--- /dev/null
+++ b/includes/pages/user_wakeup.php
@@ -0,0 +1,92 @@
+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 .= "" . Get_Text("Hello") . $user['Nick'] . ",
" . Get_Text("pub_wake_beschreibung") . "
\n\n";
+ $html .= Get_Text("pub_wake_beschreibung2");
+ $html .= '
+
+
+ ' . Get_Text("pub_wake_Datum") . ' |
+ ' . Get_Text("pub_waeckliste_Nick") . ' |
+ ' . Get_Text("pub_wake_Ort") . ' |
+ ' . Get_Text("pub_wake_Bemerkung") . ' |
+ |
+
+';
+
+ $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 .= '';
+ $html .= '' . date("Y-m-d H:i", mysql_result($Erg, $i, "Date")) . ' | ';
+ $html .= '' . UID2Nick(mysql_result($Erg, $i, "UID")) . ' | ';
+ $html .= '' . mysql_result($Erg, $i, "Ort") . ' | ';
+ $html .= '' . mysql_result($Erg, $i, "Bemerkung") . ' | ';
+ if (mysql_result($Erg, $i, "UID") == $user['UID'])
+ $html .= '" . Get_Text("pub_wake_del") . ' | ';
+ else
+ $html .= ' | ';
+ $html .= '
';
+ }
+
+ $html .= '
' . Get_Text("pub_wake_Text2") . '
+';
+
+ return $html;
+}
+?>
\ No newline at end of file
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index e81bed8d..b651a002 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -27,6 +27,7 @@ function make_navigation() {
"user_shifts",
"user_messages",
"user_questions",
+ "user_wakeup",
"user_settings"
));
diff --git a/www-ssl/index.php b/www-ssl/index.php
index 214ec54a..71c13d15 100644
--- a/www-ssl/index.php
+++ b/www-ssl/index.php
@@ -55,6 +55,10 @@ if (in_array($p, $privileges)) {
require_once ('includes/pages/user_questions.php');
$content = user_questions();
}
+ elseif ($p == "user_wakeup") {
+ require_once ('includes/pages/user_wakeup.php');
+ $content = user_wakeup();
+ }
elseif ($p == "user_settings") {
require_once ('includes/pages/user_settings.php');
$content = user_settings();
diff --git a/www-ssl/nonpublic/waeckliste.php b/www-ssl/nonpublic/waeckliste.php
deleted file mode 100644
index d98dd455..00000000
--- a/www-ssl/nonpublic/waeckliste.php
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-\n" . Get_Text("pub_waeckliste_Text1"); ?>
-
-
- |
- |
- |
- |
-
-
-
-
- |
- |
- |
- |
-
-
-
-
-
diff --git a/www-ssl/nonpublic/wecken.php b/www-ssl/nonpublic/wecken.php
deleted file mode 100644
index 0d44b48d..00000000
--- a/www-ssl/nonpublic/wecken.php
+++ /dev/null
@@ -1,86 +0,0 @@
-" . Get_Text("Hello") . $_SESSION['Nick'] . ",
" . Get_Text("pub_wake_beschreibung") . "
\n\n";
-echo Get_Text("pub_wake_beschreibung2");
-?>
-
-
-
-
-
-
-
-