alliance updates

This commit is contained in:
unknown
2012-08-10 02:10:41 +03:00
parent d8e9705405
commit 34ca0ddc07
3 changed files with 40 additions and 0 deletions
+24
View File
@@ -108,6 +108,7 @@
public function sendInvite($post) {
global $form, $database, $session;
if($session->access != BANNED){
if(isset($post['a_name']) && !isset($post['a_uid'])){
$UserData = $database->getUserArray($post['a_name'], 0);
if($this->userPermArray['opt4'] == 0) {
$form->addError("perm", NO_PERMISSION);
@@ -129,6 +130,29 @@
// Log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . addslashes($session->username) . '</a> has invited <a href="spieler.php?uid=' . $UserData['id'] . '">' . $UserData['username'] . '</a> into the alliance.');
}
}elseif(isset($post['a_uid'])){
$UserData = $database->getUserArray($post['a_uid'], 1);
if($this->userPermArray['opt4'] == 0) {
$form->addError("perm", NO_PERMISSION);
}elseif(!isset($post['a_uid']) || $post['a_uid'] == "") {
$form->addError("name1", NAME_EMPTY);
}elseif(!$database->checkExist($UserData['email'], 1)) {
$form->addError("name2", ID_NO_EXIST.$post['a_uid']);
}elseif($post['a_uid'] == ($session->uid)) {
$form->addError("name3", SAME_NAME);
}elseif($database->getInvitation2($UserData['id'],$session->alliance)) {
$form->addError("name4", $UserData['username'].ALREADY_INVITED);
}elseif($UserData['alliance'] == $session->alliance) {
$form->addError("name5", $UserData['username'].ALREADY_IN_ALLY);
}else{
// Obtenemos la informacion necesaria
$aid = $session->alliance;
// Insertamos invitacion
$database->sendInvitation($UserData['id'], $aid, $session->uid);
// Log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . addslashes($session->username) . '</a> has invited <a href="spieler.php?uid=' . $UserData['id'] . '">' . $UserData['username'] . '</a> into the alliance.');
}
}
}else{
header("Location: banned.php");
}
+1
View File
@@ -71,6 +71,7 @@ define("NOT_OPENED_YET","Server not started yet.");
define("REGISTER_CLOSED","The register is closed. You can't register to this server.");
define("NAME_EMPTY","Please insert name");
define("NAME_NO_EXIST","There is no user with the name ");
define("ID_NO_EXIST","There is no user with the id ");
define("SAME_NAME","You can't invite yourself");
define("ALREADY_INVITED"," already invited");
define("ALREADY_IN_ALLY"," already in this alliance");
+15
View File
@@ -26,6 +26,21 @@ include("alli_menu.tpl");
<td><input class="name text" type="text" name="a_name" maxlength="20"><span class="error"></span></td>
</tr>
</tbody></table>
<table cellpadding="1" cellspacing="1" id="invite" class="small_option"><thead>
<form method="post" action="allianz.php">
<input type="hidden" name="s" value="5">
<input type="hidden" name="o" value="4">
<input type="hidden" name="a" value="4">
<tr>
<th colspan="2">Invite a player into the alliance (with user id)</th>
</tr>
</thead><tbody>
<tr><th>UID</th>
<td><input class="name text" type="text" name="a_uid" maxlength="10"><span class="error"></span></td>
</tr>
</tbody></table>(for who have ' in the name)
<p><input type="image" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" onclick="this.disabled=true;this.form.submit();"/></form> </p>
<p class="error"><?php echo $form->getError("name1"); ?><br /><?php echo $form->getError("name2"); ?><br /><?php echo $form->getError("name3"); ?><br /><?php echo $form->getError("name4"); ?><br /><?php echo $form->getError("name5"); ?><br /><?php echo $form->getError("perm"); ?></p><br />