mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-29 03:40:55 +00:00
add email related stuff to support groups
This commit is contained in:
parent
1ef67a97eb
commit
b37fdc7c95
8 changed files with 113 additions and 11 deletions
|
@ -5,6 +5,10 @@ class Support_Group{
|
|||
private $sGroupId;
|
||||
private $name;
|
||||
private $tag;
|
||||
private $groupEmail;
|
||||
private $iMAP_MailServer;
|
||||
private $iMAP_Username;
|
||||
private $iMAP_Password;
|
||||
|
||||
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||
|
||||
|
@ -35,15 +39,21 @@ class Support_Group{
|
|||
}
|
||||
|
||||
//wrapper for creating a support group
|
||||
public static function createSupportGroup( $name, $tag) {
|
||||
public static function createSupportGroup( $name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password) {
|
||||
|
||||
if(strlen($name) < 21 && strlen($name) > 4 &&strlen($tag) < 8 && strlen($tag) > 1 ){
|
||||
$notExists = self::supportGroup_EntryNotExists($name, $tag);
|
||||
if ( $notExists == "SUCCESS" ){
|
||||
$sGroup = new self();
|
||||
$sGroup->setName($name);
|
||||
$sGroup->setTag($tag);
|
||||
$values = array('Name' => $name, 'Tag' => $tag, 'GroupEmail' => $groupemail, 'IMAP_MailServer' => $imap_mailserver, 'IMAP_Username' => $imap_username, 'IMAP_Password' => $imap_password);
|
||||
$sGroup->setName($values['Name']);
|
||||
$sGroup->setTag($values['Tag']);
|
||||
$sGroup->setGroupEmail($values['GroupEmail']);
|
||||
$sGroup->setIMAP_MailServer($values['IMAP_MailServer']);
|
||||
$sGroup->setIMAP_Username($values['IMAP_Username']);
|
||||
$sGroup->setIMAP_Password($values['IMAP_Password']);
|
||||
$sGroup->create();
|
||||
|
||||
return "SUCCESS";
|
||||
}else{
|
||||
//return NAME_TAKEN or TAG_TAKEN
|
||||
|
@ -199,12 +209,16 @@ class Support_Group{
|
|||
$this->setSGroupId($values['SGroupId']);
|
||||
$this->setName($values['Name']);
|
||||
$this->setTag($values['Tag']);
|
||||
$this->setGroupEmail($values['GroupEmail']);
|
||||
$this->setIMAP_MailServer($values['IMAP_MailServer']);
|
||||
$this->setIMAP_Username($values['IMAP_Username']);
|
||||
$this->setIMAP_Password($values['IMAP_Password']);
|
||||
}
|
||||
|
||||
public function create() {
|
||||
$dbl = new DBLayer("lib");
|
||||
$query = "INSERT INTO support_group (Name, Tag) VALUES (:name, :tag)";
|
||||
$values = Array('name' => $this->name, 'tag' => $this->tag);
|
||||
$query = "INSERT INTO support_group (Name, Tag, GroupEmail, IMAP_MailServer, IMAP_Username, IMAP_Password) VALUES (:name, :tag, :groupemail, :imap_mailserver, :imap_username, :imap_password)";
|
||||
$values = Array('name' => $this->getName(), 'tag' => $this->getTag(), 'groupemail' => $this->getGroupEmail(), 'imap_mailserver' => $this->getIMAP_MailServer(), 'imap_username' => $this->getIMAP_Username(), 'imap_password' => $this->getIMAP_Password());
|
||||
$dbl->execute($query, $values);
|
||||
}
|
||||
|
||||
|
@ -247,6 +261,21 @@ class Support_Group{
|
|||
return $this->tag;
|
||||
}
|
||||
|
||||
public function getGroupEmail(){
|
||||
return $this->groupEmail;
|
||||
}
|
||||
|
||||
public function getIMAP_MailServer(){
|
||||
return $this->iMAP_MailServer;
|
||||
}
|
||||
|
||||
public function getIMAP_Username(){
|
||||
return $this->iMAP_Username;
|
||||
}
|
||||
|
||||
public function getIMAP_Password(){
|
||||
return $this->iMap_Password;
|
||||
}
|
||||
////////////////////////////////////////////Setters////////////////////////////////////////////////////
|
||||
|
||||
public function setSGroupId($id){
|
||||
|
@ -261,5 +290,19 @@ class Support_Group{
|
|||
$this->tag = $t;
|
||||
}
|
||||
|
||||
public function setGroupEmail($ge){
|
||||
$this->groupEmail = $ge;
|
||||
}
|
||||
|
||||
public function setIMAP_MailServer($ms){
|
||||
$this->iMAP_MailServer = $ms;
|
||||
}
|
||||
|
||||
public function setIMAP_Username($u){
|
||||
$this->iMAP_Username = $u;
|
||||
}
|
||||
|
||||
public function setIMAP_Password($p){
|
||||
$this->iMap_Password = $p;
|
||||
}
|
||||
}
|
|
@ -57,13 +57,21 @@ $CREATE_RING = true ;
|
|||
$AMS_LIB = dirname( dirname( __FILE__ ) ) . '/ams_lib';
|
||||
$AMS_TRANS = $AMS_LIB . '/translations';
|
||||
$AMS_CACHEDIR = $AMS_LIB . '/cache';
|
||||
|
||||
$DEFAULT_LANGUAGE = 'en';
|
||||
|
||||
$SITEBASE = dirname( __FILE__ ) . '/html/' ;
|
||||
|
||||
//defines the default language
|
||||
$DEFAULT_LANGUAGE = 'en';
|
||||
|
||||
//defines if logging actions should happen or not.
|
||||
$TICKET_LOGGING = true;
|
||||
$TICKET_MAILING_SUPPORT = true;
|
||||
|
||||
//defines the time format display
|
||||
$TIME_FORMAT = "m-d-Y H:i:s";
|
||||
|
||||
//defines which ingame layout template should be used
|
||||
$INGAME_LAYOUT = "basic";
|
||||
|
||||
//Defines mailing related stuff
|
||||
$SUPPORT_GROUP_IMAP_CRYPTKEY = "azerty";
|
||||
$TICKET_MAILING_SUPPORT = true;
|
||||
$MAIL_DIR = "/tmp";
|
||||
|
|
|
@ -8,8 +8,13 @@ function add_sgroup(){
|
|||
$name = filter_var($_POST['Name'],FILTER_SANITIZE_STRING);
|
||||
$inner_tag = filter_var($_POST['Tag'], FILTER_SANITIZE_STRING);
|
||||
$tag = "[" . $inner_tag . "]";
|
||||
$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);
|
||||
|
||||
$result['RESULT_OF_ADDING'] = Support_Group::createSupportGroup($name, $tag);
|
||||
$result['RESULT_OF_ADDING'] = Support_Group::createSupportGroup($name, $tag, $groupemail, $imap_mailserver, $imap_username, $imap_password);
|
||||
$result['permission'] = $_SESSION['ticket_user']->getPermission();
|
||||
$result['no_visible_elements'] = 'FALSE';
|
||||
$result['username'] = $_SESSION['user'];
|
||||
|
|
|
@ -14,7 +14,7 @@ function sgroup_list(){
|
|||
if(Ticket_User::isAdmin($_SESSION['ticket_user'])){
|
||||
$result['isAdmin'] = "TRUE";
|
||||
}
|
||||
$result['grouplist'] = Gui_Elements::make_table(Support_Group::getGroups(), Array("getSGroupId","getName","getTag"), Array("sGroupId","name","tag"));
|
||||
$result['grouplist'] = Gui_Elements::make_table(Support_Group::getGroups(), Array("getSGroupId","getName","getTag","getGroupEmail"), Array("sGroupId","name","tag","groupemail"));
|
||||
return $result;
|
||||
}else{
|
||||
//ERROR: No access!
|
||||
|
|
|
@ -286,6 +286,10 @@
|
|||
`SGroupId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||
`Name` VARCHAR(22) NOT NULL ,
|
||||
`Tag` VARCHAR(7) NOT NULL ,
|
||||
`GroupEmail` VARCHAR(45) NULL ,
|
||||
`IMAP_MailServer` VARCHAR(60) NULL ,
|
||||
`IMAP_Username` VARCHAR(45) NULL ,
|
||||
`IMAP_Password` VARCHAR(45) NULL ,
|
||||
PRIMARY KEY (`SGroupId`) ,
|
||||
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) ,
|
||||
UNIQUE INDEX `Tag_UNIQUE` (`Tag` ASC) )
|
||||
|
|
|
@ -241,6 +241,10 @@ CREATE TABLE IF NOT EXISTS `mydb`.`support_group` (
|
|||
`SGroupId` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT ,
|
||||
`Name` VARCHAR(22) NOT NULL ,
|
||||
`Tag` VARCHAR(7) NOT NULL ,
|
||||
`GroupEmail` VARCHAR(45) NULL ,
|
||||
`IMAP_MailServer` VARCHAR(60) NULL ,
|
||||
`IMAP_Username` VARCHAR(45) NULL ,
|
||||
`IMAP_Password` VARCHAR(45) NULL ,
|
||||
PRIMARY KEY (`SGroupId`) ,
|
||||
UNIQUE INDEX `Name_UNIQUE` (`Name` ASC) ,
|
||||
UNIQUE INDEX `Tag_UNIQUE` (`Tag` ASC) )
|
||||
|
|
Binary file not shown.
|
@ -19,6 +19,7 @@
|
|||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Tag</th>
|
||||
<th>Email</th>
|
||||
{if isset($isAdmin) && $isAdmin eq 'TRUE'}<th>Action</th>{/if}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -28,6 +29,7 @@
|
|||
<td>{$group.sGroupId}</td>
|
||||
<td><a href ="index.php?page=show_sgroup&id={$group.sGroupId}">{$group.name}</a></td>
|
||||
<td class="center"><span class="label label-important" >{$group.tag}</span></td>
|
||||
<td class="center">{$group.groupemail}</td>
|
||||
{if isset($isAdmin) && $isAdmin eq 'TRUE'}<td class="center"><a class="btn btn-danger" href="index.php?page=sgroup_list&delete={$group.sGroupId}"><i class="icon-trash icon-white"></i> Delete</a></td>{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
@ -71,6 +73,42 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">Group EmailAddress</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="text" id="GroupEmail" name="GroupEmail">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">IMAP MailServer IP</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="text" id="IMAP_MailServer" name="IMAP_MailServer">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">IMAP Username</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="text" id="IMAP_Username" name="IMAP_Username">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">IMAP Password</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="password" id="IMAP_Password" name="IMAP_Password">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="function" value="add_sgroup">
|
||||
|
||||
<div class="control-group">
|
||||
|
|
Loading…
Reference in a new issue