-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin_setconfig.php
132 lines (95 loc) · 3.18 KB
/
admin_setconfig.php
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/* I codici qui inseriti sono proprietà di
* Francesco Stasi, pertanto ne è vietata la
* vendita e la cessione a terzi senza previa
* autorizzazione dell' autore.
*/
require_once("config.php");
require_once("libs/common.php");
if(!isset($_SESSION))
{
session_start();
}
logged();
$MyChar_obj=new Character(null,$_SESSION['char_name']);
$MyChar_obj->parseFromDb();
if(!($MyChar_obj->exists())){
echo "Personaggio inesistente.";
exit();
}
$_SESSION['modlevel']=$MyChar_obj->Account()->getModLevel();
if ($_SESSION['modlevel']<count($acc_level_array)-1){
echo "Accesso negato, permessi insufficienti.";
exit();
}
$landsettingslist=&$LandSettingsList->getSettings();
if (isset($_REQUEST['setting'])){
foreach($_REQUEST['setting'] as $k=>$v){
//echo $v;
$landsettingslist[$k]->setValue($v);
$msg="Preferenze Salvate.<br>\r\n";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="author" content="Francesco Stasi"/>
<title><?php echo $nome_land;?></title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<h2>Gestione delle Opzioni Land</h2>
<div class=""><?php echo $msg; ?></div>
<form id="setrights" name="setlandsetting" action="admin_setconfig.php" method="post">
<table>
<tr>
<td>#</td><td>Relativo a</td><td>Descrizione</td><td>Livello</td>
</tr>
<?php
$LandSettingsList->loadSettings();
foreach($LandSettingsList->getSettings() as $k=>$v){
//${$v->getVarName()}=$v->getValue();
$set_name = "name=\"setting[{$v->getId()}]\"";
$sel_type = "";
switch ($v->getType()) {
case 'integer':
if($v->getAcceptedValues()!=null){
$sel_input="<select $set_name >";
foreach ($v->getAcceptedValues() as $acpt_k => $acpt_v ) {
$v->getValue()==$acpt_v ? $selected='selected="selected"' : $selected="";
$sel_input.="<option value=\"{$acpt_v}\" $selected >{$acpt_k}</option>";
}
$sel_input.="</select>";
}else{
$sel_input="<input type=\"text\" itype=\"number\" $sel_type $set_name value=\"{$v->getValue()}\"/>";
}
break;
case 'double':
$sel_input="<input type=\"text\" dtype=\"number\" $sel_type $set_name value=\"{$v->getValue()}\"/>";
break;
case 'boolean':
$selY =""; $selN = "";
$v->getValue() == 1 ? $selY = 'selected="selected"' : $selN = 'selected="selected"';
$sel_input="<select $set_name ><option value=\"1\" $selY >Si</option><option value=\"0\" $selN >No</option></select>";
break;
case 'array':
$sel_input="<input type=\"text\" atype=\"arr\" $sel_type $set_name value=\"".htmlspecialchars($v->getValue(false))."\"/>";
break;
default:
$sel_input="<input type=\"text\" stype=\"str\" $sel_type $set_name value=\"".htmlspecialchars($v->getValue())."\"/>";
break;
}
echo "<tr class=\"".(($i++ % 2 == 0) ? 'even' : 'odd')."\">
<td>{$v->getId()}</td><td>{$v->getVarName()}</td><td>{$v->getDescription()}</td><td>{$sel_input}</td>
</tr>\r\n";
}
?>
</table>
<input type="submit" value="Salva" />
</form>
</body>
</html>