Fixed Support Groups

This commit is contained in:
Botanic 2013-10-24 01:12:09 -07:00
parent d47d351122
commit 73dc75fa5b
5 changed files with 18 additions and 15 deletions

View file

@ -60,9 +60,10 @@ class Support_Group{
* @return a string that specifies if it was a success or not (SUCCESS, SIZE_ERROR, NAME_TAKEN or TAG_TAKEN ) * @return a string that specifies if it was a success or not (SUCCESS, SIZE_ERROR, NAME_TAKEN or TAG_TAKEN )
*/ */
public static function createSupportGroup( $name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password) { public static function createSupportGroup( $name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password) {
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
if(strlen($name) < 21 && strlen($name) > 4 &&strlen($tag) < 8 && strlen($tag) > 1 ){ if(strlen($name) <= 21 && strlen($name) >= 4 &&strlen($tag) <= 8 && strlen($tag) >= 2 ){
$notExists = self::supportGroup_EntryNotExists($name, $tag); $notExists = self::supportGroup_EntryNotExists($name, $tag);
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
if ( $notExists == "SUCCESS" ){ if ( $notExists == "SUCCESS" ){
$sGroup = new self(); $sGroup = new self();
$values = array('Name' => $name, 'Tag' => $tag, 'GroupEmail' => $groupemail, 'IMAP_MailServer' => $imap_mailserver, 'IMAP_Username' => $imap_username, 'IMAP_Password' => $imap_password); $values = array('Name' => $name, 'Tag' => $tag, 'GroupEmail' => $groupemail, 'IMAP_MailServer' => $imap_mailserver, 'IMAP_Username' => $imap_username, 'IMAP_Password' => $imap_password);
@ -79,12 +80,14 @@ class Support_Group{
$sGroup->setIMAP_Password($enc_password); $sGroup->setIMAP_Password($enc_password);
$sGroup->create(); $sGroup->create();
return "SUCCESS"; error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
}else{ }else{
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
//return NAME_TAKEN or TAG_TAKEN //return NAME_TAKEN or TAG_TAKEN
return $notExists; return $notExists;
} }
}else{ }else{
error_log( "Error at line " . __LINE__ . " in file " . __FILE__);
//RETURN ERROR that indicates SIZE //RETURN ERROR that indicates SIZE
return "SIZE_ERROR"; return "SIZE_ERROR";
} }

View file

@ -35,7 +35,7 @@
<tr><td> <tr><td>
<p><h3>Add a Support group</h3></p> <p><h3>Add a Support group</h3></p>
<form id="addSGroup" class="form-vertical" method="post" action="{$ingame_webpath}"> <form id="addSGroup" class="form-vertical" method="post" action="{$ingame_webpath}?page=sgroup_list">
<table cellpadding="1"> <table cellpadding="1">
<tr> <tr>
<td> <td>

View file

@ -23,20 +23,20 @@ function add_sgroup(){
//create a new support group //create a new support group
$result['RESULT_OF_ADDING'] = Support_Group::createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password); $result['RESULT_OF_ADDING'] = Support_Group::createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password);
//$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission(); $result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
//$result['no_visible_elements'] = 'FALSE'; $result['no_visible_elements'] = 'FALSE';
//$result['username'] = $_SESSION['user']; $result['username'] = $_SESSION['user'];
//global $SITEBASE; global $SITEBASE;
//require($SITEBASE . '/inc/sgroup_list.php'); require($SITEBASE . '/inc/sgroup_list.php');
//$result= array_merge($result, sgroup_list()); $result= array_merge($result, sgroup_list());
//return helpers :: loadtemplate( 'sgroup_list', $result, true); return $result;
if (Helpers::check_if_game_client()) { /*if (Helpers::check_if_game_client()) {
header("Location: ".$INGAME_WEBPATH."?page=sgroup_list"); header("Location: ".$INGAME_WEBPATH."?page=sgroup_list");
}else{ }else{
header("Location: ".$WEBPATH."?page=sgroup_list"); header("Location: ".$WEBPATH."?page=sgroup_list");
} }
exit; exit;
*/
}else{ }else{
//ERROR: No access! //ERROR: No access!
$_SESSION['error_code'] = "403"; $_SESSION['error_code'] = "403";

View file

@ -51,7 +51,7 @@
<div class="box-content"> <div class="box-content">
<div class="row-fluid"> <div class="row-fluid">
<form id="addSGroup" class="form-vertical" method="post" action="index.php"> <form id="addSGroup" class="form-vertical" method="post" action="index.php?page=sgroup_list">
<legend>Add a support group</legend> <legend>Add a support group</legend>

View file

@ -42,7 +42,7 @@
<span id="supportGroupList" {if isset($prev_created_who) AND $prev_created_who eq "user"}style="display:none;"{else if isset($prev_created_who) AND $prev_created_who eq "support_group"}style="display:inline;"{else}style="display:none;"{/if}> <span id="supportGroupList" {if isset($prev_created_who) AND $prev_created_who eq "user"}style="display:none;"{else if isset($prev_created_who) AND $prev_created_who eq "support_group"}style="display:inline;"{else}style="display:none;"{/if}>
<select style="width: 140px;" name="groupid"> <select style="width: 140px;" name="groupid">
{foreach from=$grouplist item=group} {foreach from=$grouplist item=group}
<option value="{$group.sGroupId}" {if $prev_created_groupid eq $group.sGroupId}selected="selected"{/if}>{$group.name}</option> <option value="{$group.sGroupId}" {if isset($prev_created_groupid) AND $prev_created_groupid eq $group.sGroupId}selected="selected"{/if}>{$group.name}</option>
{/foreach} {/foreach}
</select> </select>
</span> </span>