forked from pouetnet/pouet2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_party_edit.php
80 lines (59 loc) · 1.63 KB
/
admin_party_edit.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
<?
require_once("bootstrap.inc.php");
require_once("include_pouet/box-modalmessage.php");
require_once("include_pouet/box-party-submit.php");
if ($currentUser && !$currentUser->CanEditItems())
{
redirect("party.php?which=".(int)$_GET["which"]);
exit();
}
class PouetBoxAdminEditParty extends PouetBoxSubmitParty
{
function PouetBoxAdminEditParty( $id )
{
parent::__construct();
$this->id = (int)$id;
$this->party = PouetParty::Spawn( $this->id );
$this->title = "edit this party: "._html( $this->party->name );
}
function Commit($data)
{
global $partyID;
$a = array();
$a["name"] = trim($data["name"]);
$a["web"] = $data["website"];
SQLLib::UpdateRow("parties",$a,"id=".$this->id);
gloperator_log( "party", $this->id, "party_edit" );
return array();
}
function LoadFromDB()
{
parent::LoadFromDB();
$this->fields["name"]["value"] = $this->party->name;
$this->fields["website"]["value"] = $this->party->web;
}
}
$form = new PouetFormProcessor();
$form->SetSuccessURL( "party.php?which=".(int)$_GET["which"], true );
$box = new PouetBoxAdminEditParty( $_GET["which"] );
$form->Add( "party", $box );
if ($currentUser && $currentUser->CanEditItems())
$form->Process();
$TITLE = "edit a party: ".$box->party->name;
require_once("include_pouet/header.php");
require("include_pouet/menu.inc.php");
echo "<div id='content'>\n";
if (get_login_id())
{
$form->Display();
}
else
{
require_once("include_pouet/box-login.php");
$box = new PouetBoxLogin();
$box->Render();
}
echo "</div>\n";
require("include_pouet/menu.inc.php");
require_once("include_pouet/footer.php");
?>