Menu ▾ ▴

[r277]: / sharer.php  Maximize  Restore  History

Download this file

77 lines (73 with data), 3.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
include_once ("includes/init.php");
$fw->template->header(__("Pannello sharer"));
$fw->template->top();
$uid = (int) $_GET['u'];
switch ($_GET['a']) {
case "del":
$fw->ctrlToken($_GET);
$fw->db->sql_query("DELETE FROM `" . RELATION_USER_CIV_TABLE . "` WHERE `user_id`='" . $uid . "' AND `server`='" . SERVER . "'");
$fw->alerts("sharer.php", "sharer rimosso");
break;
case "add":
$fw->ctrlToken($_GET);
$fw->db->sql_query("UPDATE `" . RELATION_USER_CIV_TABLE . "` SET `status`='2' WHERE `user_id`='" . $uid . "' AND `server`='" . SERVER . "'");
$fw->alerts("sharer.php", "sharer aggiunto");
break;
case "perm":
break;
default:
$token = md5(auth());
$fw->session->set("tokenP",$token);
$sharer = $fw->civ->sharer;
$stato = array("", __("in attesa"), __("sharer"), __("owner"));
$option = null;
if ($fw->civ->status == 3) {
$option = array(
array('name' => 'read_mess', 'abbr' => 'R.M.', 'title' => __('leggere i messaggi')),
array('name' => 'write_mess', 'abbr' => 'W.M', 'title' => __('scrivere i messaggi')),
array('name' => 'del_mess', 'abbr' => 'D.M', 'title' => __('cancellare i messaggi')),
array('name' => 'read_report', 'abbr' => 'R.R', 'title' => __('leggere i report')),
array('name' => 'del_report', 'abbr' => 'D.R', 'title' => __('cancellare i report')),
array('name' => 'send_troops', 'abbr' => 'S.T', 'title' => __('inviare truppe')),
array('name' => 'send_attack', 'abbr' => 'S.A', 'title' => __('inviare attacchi')),
array('name' => 'market', 'abbr' => 'S.M', 'title' => __('inviare mercanti')),
array('name' => 'build', 'abbr' => 'B', 'title' => __('costruire')),
array('name' => 'option', 'abbr' => 'O', 'title' => __('gestire gli sharer')));
}
echo '<form method="post" action="sharer.php?a=perm"><table>
<tr><td></td><td>' . __("nome") . '</td><td>' . __("ruolo") . '</td>';
for ($j = 0; $option[$j]; $j++) {
echo '<td><abbr title="' . $option[$j]['title'] . '">' . $option[$j]['abbr'] . '</abbr></td>';
}
echo'</tr>';
for ($i = 0; $sharer[$i]; $i++) {
if ($sharer[$i]['last_activity'] > strtotime("-15 minutes"))
$act = 1;
elseif ($sharer[$i]['last_activity'] > strtotime("-1 days"))
$act = 2;
elseif ($sharer[$i]['last_activity'] > strtotime("-3 days"))
$act = 3;
elseif ($sharer[$i]['last_activity'] > strtotime("-7 days"))
$act = 4;
else
$act=5;
echo '<tr>
<td>' . (($sharer[$i]['status'] == 3) || ($sharer[$i]['user_id'] == $fw->user->data->ID) ? '' : '<a href="sharer.php?a=del&u=' . $sharer[$i]['user_id'] . '&tokenP=' . $token . '"><img src="' . PATH . 'common/images/del.gif" alt="delete" /></a>') . '
' . ($sharer[$i]['status'] == 1 ? '<a href="sharer.php?a=add&u=' . $sharer[$i]['user_id'] . '&tokenP=' . $token . '"><img src="' . PATH . 'common/images/ok.gif" alt="ok" /></a>' : '') . '</td>
<td> ' . $sharer[$i]['username'] . '</td>
<td>' . $stato[$sharer[$i]['status']] . '</td>';
if ($sharer[$i]['status'] != 3) {
for ($j = 0; $option[$j]; $j++) {
echo '<td><input type="checkbox" name="' . $option[$i]['name'] . $sharer[$i]['user_id'] . '" value="true" /></td>';
}
}
echo '</tr>';
}
echo '</table><input type="submit" value="' . __("salva") . '"/></form>';
break;
}
$fw->template->bottom();
$fw->template->footer();
$fw = null;
?>