2013-07-15 15:29:19 +00:00
|
|
|
<?php
|
2013-09-13 22:39:03 +00:00
|
|
|
/**
|
|
|
|
* This function is beign used to add a new Support Group to the database.
|
|
|
|
* What it will do is check if the user who executed the function is an Admin, if so then it will filter all POST'ed data and use it to create a new Support_Group entry.
|
|
|
|
* if not logged in or not an admin, an appropriate redirection to an error page will take place.
|
|
|
|
* @author Daan Janssens, mentored by Matthew Lagoe
|
|
|
|
*/
|
2013-07-15 15:29:19 +00:00
|
|
|
function add_sgroup(){
|
2013-09-09 01:47:32 +00:00
|
|
|
global $INGAME_WEBPATH;
|
|
|
|
global $WEBPATH;
|
2013-07-15 15:29:19 +00:00
|
|
|
if(WebUsers::isLoggedIn()){
|
|
|
|
|
2013-09-13 22:39:03 +00:00
|
|
|
//check if admin
|
2013-09-09 01:47:32 +00:00
|
|
|
if( Ticket_User::isAdmin(unserialize($_SESSION['ticket_user']))){
|
2013-07-15 15:29:19 +00:00
|
|
|
$name = filter_var($_POST['Name'],FILTER_SANITIZE_STRING);
|
|
|
|
$inner_tag = filter_var($_POST['Tag'], FILTER_SANITIZE_STRING);
|
|
|
|
$tag = "[" . $inner_tag . "]";
|
2013-08-16 01:40:59 +00:00
|
|
|
$inner_tag = filter_var($_POST['Tag'], FILTER_SANITIZE_STRING);
|
|
|
|
$groupemail = filter_var($_POST['GroupEmail'], FILTER_SANITIZE_STRING);
|
|
|
|
$imap_mailserver = filter_var($_POST['IMAP_MailServer'], FILTER_SANITIZE_STRING);
|
|
|
|
$imap_username = filter_var($_POST['IMAP_Username'], FILTER_SANITIZE_STRING);
|
|
|
|
$imap_password = filter_var($_POST['IMAP_Password'], FILTER_SANITIZE_STRING);
|
2013-07-15 15:29:19 +00:00
|
|
|
|
2013-09-13 22:39:03 +00:00
|
|
|
//create a new support group
|
2013-08-16 01:40:59 +00:00
|
|
|
$result['RESULT_OF_ADDING'] = Support_Group::createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password);
|
2013-10-24 08:12:09 +00:00
|
|
|
$result['permission'] = unserialize($_SESSION['ticket_user'])->getPermission();
|
|
|
|
$result['no_visible_elements'] = 'FALSE';
|
|
|
|
$result['username'] = $_SESSION['user'];
|
|
|
|
global $SITEBASE;
|
|
|
|
require($SITEBASE . '/inc/sgroup_list.php');
|
|
|
|
$result= array_merge($result, sgroup_list());
|
|
|
|
return $result;
|
|
|
|
/*if (Helpers::check_if_game_client()) {
|
2013-09-09 01:47:32 +00:00
|
|
|
header("Location: ".$INGAME_WEBPATH."?page=sgroup_list");
|
|
|
|
}else{
|
|
|
|
header("Location: ".$WEBPATH."?page=sgroup_list");
|
|
|
|
}
|
2013-07-15 15:29:19 +00:00
|
|
|
exit;
|
2013-10-24 08:12:09 +00:00
|
|
|
*/
|
2013-07-15 15:29:19 +00:00
|
|
|
}else{
|
|
|
|
//ERROR: No access!
|
|
|
|
$_SESSION['error_code'] = "403";
|
|
|
|
header("Location: index.php?page=error");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
//ERROR: not logged in!
|
|
|
|
header("Location: index.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2013-09-09 01:47:32 +00:00
|
|
|
}
|