#44 confirm angel types

main
Philip Häusler 13 years ago
parent b3d4d7dc52
commit 77381ebca8

@ -0,0 +1,21 @@
<?php
// create admin_user_angeltypes permission/privilege and assign it to the archangel usergroup.
if (sql_num_query("SELECT * FROM `Privileges` WHERE `name`='admin_user_angeltypes'") == 0) {
sql_query("INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES ( NULL , 'admin_user_angeltypes', 'Confirm restricted angel types' );");
$id = sql_id();
sql_query("INSERT INTO `GroupPrivileges` SET `group_id`=-5, `privilege_id`=" . sql_escape($id));
sql_query("INSERT INTO `Sprache` (
`TextID` ,
`Sprache` ,
`Text`
)
VALUES (
'admin_user_angeltypes', 'DE', 'Engeltypen freischalten'
), (
'admin_user_angeltypes', 'EN', 'Confirm angeltypes'
);");
$applied = true;
}
?>

@ -0,0 +1,46 @@
<?php
/**
* Auf dieser Seite können Erzengel Engeltypen für bestimmte Nutzer freischalten, z.B. nachdem diese für die Aufgabe geschult wurden.
*/
function admin_user_angeltypes() {
if (isset ($_REQUEST['confirm']) && test_request_int('confirm') && sql_num_query("SELECT * FROM `UserAngelTypes` WHERE `id`=" . sql_escape($_REQUEST['confirm']) . " AND `confirm_user_id` IS NULL") > 0) {
sql_query("UPDATE `UserAngelTypes` SET `confirm_user_id`=" . sql_escape($_SESSION['uid']) . " WHERE `id`=" . sql_escape($_REQUEST['confirm']) . " LIMIT 1");
success("Confirmed.");
redirect(page_link_to('admin_user_angeltypes'));
}
$users_source = sql_select("SELECT `UserAngelTypes`.`id`, `AngelTypes`.`name`, `User`.`Nick` FROM `UserAngelTypes` JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` JOIN `User` ON `UserAngelTypes`.`user_id`=`User`.`UID` WHERE `AngelTypes`.`restricted`=1 AND `UserAngelTypes`.`confirm_user_id` IS NULL");
$users = array ();
foreach ($users_source as $user) {
$user['actions'] = '<a href="' . page_link_to('admin_user_angeltypes') . '&confirm=' . $user['id'] . '">confirm</a>';
$users[] = $user;
}
return page(array (
msg(),
table(array (
'Nick' => "Nick",
'name' => "Angeltype",
'actions' => ""
), $users)
));
}
/**
* Anzeige, ob noch Engeltypen bestätigt werden müssen. Damit werden Erzengel auf jeder Seite im Kopfbereich "genervt".
*/
function admin_new_user_angeltypes() {
global $user, $privileges;
if (in_array("admin_user_angeltypes", $privileges)) {
$unconfirmed_angeltypes = sql_num_query("SELECT * FROM `UserAngelTypes` JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` WHERE `AngelTypes`.`restricted`=1 AND `UserAngelTypes`.`confirm_user_id` IS NULL LIMIT 1") > 0;
if ($unconfirmed_angeltypes)
return info('<a href="' . page_link_to('admin_user_angeltypes') . '">There are unconfirmed angeltypes!</a>', true);
}
return "";
}
?>

@ -99,8 +99,12 @@ function user_settings() {
"', `Hometown`='" . sql_escape($hometown) . "' WHERE `UID`=" . sql_escape($user['UID'])); "', `Hometown`='" . sql_escape($hometown) . "' WHERE `UID`=" . sql_escape($user['UID']));
// Assign angel-types // Assign angel-types
sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user['UID'])); foreach ($angel_types_source as $angel_type)
if (!in_array($angel_type['id'], $selected_angel_types))
sql_query("DELETE FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user['UID']) . " AND `angeltype_id`=" . sql_escape($angel_type['id']) . " LIMIT 1");
foreach ($selected_angel_types as $selected_angel_type_id) foreach ($selected_angel_types as $selected_angel_type_id)
if (sql_num_query("SELECT * FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user['UID']) . " AND `angeltype_id`=" . sql_escape($selected_angel_type_id) . " LIMIT 1") == 0)
sql_query("INSERT INTO `UserAngelTypes` SET `user_id`=" . sql_escape($user['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id)); sql_query("INSERT INTO `UserAngelTypes` SET `user_id`=" . sql_escape($user['UID']) . ", `angeltype_id`=" . sql_escape($selected_angel_type_id));
success("Settings saved."); success("Settings saved.");

@ -43,6 +43,7 @@ function make_navigation() {
"admin_usershifts", "admin_usershifts",
"admin_questions", "admin_questions",
"admin_angel_types", "admin_angel_types",
"admin_user_angeltypes",
"admin_shifts", "admin_shifts",
"admin_rooms", "admin_rooms",
"admin_groups", "admin_groups",

@ -14,6 +14,7 @@ require_once ('config/config.php');
require_once ('config/config_db.php'); require_once ('config/config_db.php');
require_once ('includes/pages/admin_questions.php'); require_once ('includes/pages/admin_questions.php');
require_once ('includes/pages/admin_user_angeltypes.php');
require_once ('includes/pages/user_messages.php'); require_once ('includes/pages/user_messages.php');
session_start(); session_start();
@ -94,6 +95,10 @@ elseif (in_array($p, $privileges)) {
require_once ('includes/pages/admin_user.php'); require_once ('includes/pages/admin_user.php');
$content = admin_user(); $content = admin_user();
} }
elseif ($p == "admin_user_angeltypes") {
require_once ('includes/pages/admin_user_angeltypes.php');
$content = admin_user_angeltypes();
}
elseif ($p == "admin_arrive") { elseif ($p == "admin_arrive") {
require_once ('includes/pages/admin_arrive.php'); require_once ('includes/pages/admin_arrive.php');
$content = admin_arrive(); $content = admin_arrive();
@ -172,6 +177,10 @@ if (isset ($user) && $p != "user_messages")
if (isset ($user) && $p != "admin_questions") if (isset ($user) && $p != "admin_questions")
$content = admin_new_questions() . $content; $content = admin_new_questions() . $content;
// Erzengel Hinweis für freizuschaltende Engeltypen
if (isset ($user) && $p != "admin_user_angeltypes")
$content = admin_new_user_angeltypes() . $content;
echo template_render('../templates/layout.html', array ( echo template_render('../templates/layout.html', array (
'theme' => isset ($user) ? $user['color'] : $default_theme, 'theme' => isset ($user) ? $user['color'] : $default_theme,
'title' => $title, 'title' => $title,

@ -1,162 +0,0 @@
<p>
%greeting%
</p>
<hr/>
<p>
%text_user_data%
</p>
<form action="%link%&action=setUserData" method="post">
<table>
<tr>
<td>
%label_nick%
</td>
<td>
<input type="text" name="nick" size="23" value="%nick%">
</td>
</tr>
<tr>
<td>
%label_name%
</td>
<td>
<input type="text" name="name" size="23" value="%name%">
</td>
</tr>
<tr>
<td>
%label_prename%
</td>
<td>
<input type="text" name="prename" size="23" value="%prename%">
</td>
</tr>
<tr>
<td>
%label_age%
</td>
<td>
<input type="text" name="age" size="3" value="%age%">
</td>
</tr>
<tr>
<td>
%label_tel%
</td>
<td>
<input type="text" name="tel" size="40" value="%tel%">
</td>
</tr>
<tr>
<td>
%label_mobile%
</td>
<td>
<input type="text" name="mobile" size="40" value="%mobile%">
</td>
</tr>
<tr>
<td>
%label_dect%
</td>
<td>
<input type="text" name="dect" size="4" value="%dect%">
</td>
</tr>
<tr>
<td>
%label_mail%
</td>
<td>
<input type="text" name="mail" size="40" value="%mail%">
</td>
</tr>
<tr>
<td>
ICQ
</td>
<td>
<input type="text" name="icq" size="40" value="%icq%">
</td>
</tr>
<tr>
<td>
jabber
</td>
<td>
<input type="text" name="jabber" size="40" value="%jabber%">
</td>
</tr>
<tr>
<td>
%label_hometown%
</td>
<td>
<input type="text" name="hometown" size="40" value="%hometown%">
</td>
</tr>%tshirts%
</table><input type="submit" value="%label_save%">
</form><hr/>
<p>
%text_password%
</p>
<form action="%link%&action=set" method="post">
<table>
<tr>
<td>
%current_pw_label%
</td>
<td>
<input type="password" name="current_pw" size="20">
</td>
</tr>
<tr>
<td>
%new_pw_label%
</td>
<td>
<input type="password" name="new_pw" size="20">
</td>
</tr>
<tr>
<td>
%new_pw2_label%
</td>
<td>
<input type="password" name="new_pw2" size="20">
</td>
</tr>
</table><input type="submit" value="%label_save%">
</form><hr/>
<p>
%text_theme%
</p>
<form action="%link%&action=colour" method="post">
<table>
<tr>
<td>
%theme_label%
</td>
<td>
%theme_select%
</td>
</tr>
</table>
<input type="submit" value="%label_save%">
</form><hr/>
<p>
%text_language%
</p>
<form action="%link%&action=sprache" method="post">
<table>
<tr>
<td>
%language_label%
</td>
<td>
%language_select%
</td>
</tr>
</table>
<input type="submit" value="%label_save%">
</form>

@ -1,4 +0,0 @@
<tr>
<td>%label_size%</td>
<td>%size_select%</td>
</tr>
Loading…
Cancel
Save