mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 01:06:19 +00:00
Functionality to modify mailsettings of a support group.
This commit is contained in:
parent
e169978d13
commit
141f40835f
7 changed files with 142 additions and 7 deletions
|
@ -12,7 +12,7 @@ class Support_Group{
|
|||
|
||||
////////////////////////////////////////////Functions////////////////////////////////////////////////////
|
||||
|
||||
//return all groups
|
||||
//return group
|
||||
public static function getGroup($id) {
|
||||
$dbl = new DBLayer("lib");
|
||||
$statement = $dbl->execute("SELECT * FROM support_group WHERE SGroupId = :id", array('id' => $id));
|
||||
|
@ -234,8 +234,8 @@ class Support_Group{
|
|||
//update private data to DB.
|
||||
public function update(){
|
||||
$dbl = new DBLayer("lib");
|
||||
$query = "UPDATE `support_group` SET `Name` = :name, `Tag` = :tag WHERE `SGroupId` = :id";
|
||||
$values = Array('id' => $this->getSGroupId(), 'name' => $this->getName(), 'tag' => $this->getTag() );
|
||||
$query = "UPDATE `support_group` SET `Name` = :name, `Tag` = :tag, `GroupEmail` = :groupemail, `IMAP_MailServer` = :mailserver, `IMAP_Username` = :username, `IMAP_Password` = :password WHERE `SGroupId` = :id";
|
||||
$values = Array('id' => $this->getSGroupId(), 'name' => $this->getName(), 'tag' => $this->getTag(), 'groupemail' => $this->getGroupEmail(), 'mailserver' => $this->getIMAP_MailServer(), 'username' => $this->getIMAP_Username(), 'password' => $this->getIMAP_Password() );
|
||||
$statement = $dbl->execute($query, $values);
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class Users{
|
|||
* @takes $email
|
||||
* @return true or false depending on if its a valid email format.
|
||||
*/
|
||||
private function validEmail( $email ){
|
||||
public function validEmail( $email ){
|
||||
$isValid = true;
|
||||
$atIndex = strrpos( $email, "@" );
|
||||
if ( is_bool( $atIndex ) && !$atIndex ){
|
||||
|
|
|
@ -53,6 +53,9 @@ user_already_added = "The user is already part of the group!"
|
|||
group_not_existing = "The group doesn't exist!"
|
||||
user_not_existing = "The user doesn't seem to exist"
|
||||
not_mod_or_admin = "You can only add Moderators or Admins!"
|
||||
modify_mail_of_group_success = "The Support Group's email settings have been modified!"
|
||||
email_not_valid = "The group email address is invalid!"
|
||||
no_password_given = "There was no password filled in!"
|
||||
|
||||
[sgroup_list]
|
||||
group_success = "The group has been created!"
|
||||
|
|
|
@ -49,6 +49,10 @@ user_already_added = "cet user est deja membre de la groupe!"
|
|||
group_not_existing = "cet Groupe n' existe pas!"
|
||||
user_not_existing = "cet user n'existe pas"
|
||||
not_mod_or_admin = "C'est possible d'ajoute seulement des mods et admins!"
|
||||
modify_mail_of_group_success = "Les parametres de messagerie du Groupe d'appui ont ete modifies!"
|
||||
email_not_valid = "L'adresse email de groupe est invalide!"
|
||||
no_password_given = "Il'n y a pas une passport!"
|
||||
|
||||
|
||||
[sgroup_list]
|
||||
group_success = "le group est cree!"
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
function modify_email_of_sgroup(){
|
||||
|
||||
if(WebUsers::isLoggedIn()){
|
||||
|
||||
if( Ticket_User::isAdmin($_SESSION['ticket_user']) && isset($_POST['target_id'])){
|
||||
|
||||
$sgroupid = filter_var($_POST['target_id'],FILTER_SANITIZE_NUMBER_INT);
|
||||
$group = Support_Group::getGroup($sgroupid);
|
||||
$groupemail = filter_var($_POST['GroupEmail'],FILTER_SANITIZE_STRING);
|
||||
if(Users::validEmail($groupemail)){
|
||||
$password = filter_var($_POST['IMAP_Password'],FILTER_SANITIZE_STRING);
|
||||
if($password != ""){
|
||||
$group->setGroupEmail($groupemail);
|
||||
$group->setIMAP_MailServer(filter_var($_POST['IMAP_MailServer'],FILTER_SANITIZE_STRING));
|
||||
$group->setIMAP_Username(filter_var($_POST['IMAP_Username'],FILTER_SANITIZE_STRING));
|
||||
$group->setIMAP_Password($password);
|
||||
$group->update();
|
||||
$result['RESULT_OF_MODIFYING'] = "SUCCESS";
|
||||
}else{
|
||||
$result['RESULT_OF_MODIFYING'] = "NO_PASSWORD";
|
||||
}
|
||||
}else{
|
||||
$result['RESULT_OF_MODIFYING'] = "EMAIL_NOT_VALID";
|
||||
}
|
||||
|
||||
$result['permission'] = $_SESSION['ticket_user']->getPermission();
|
||||
$result['no_visible_elements'] = 'FALSE';
|
||||
$result['username'] = $_SESSION['user'];
|
||||
global $SITEBASE;
|
||||
require_once($SITEBASE . 'inc/show_sgroup.php');
|
||||
$result= array_merge($result, show_sgroup());
|
||||
helpers :: loadtemplate( 'show_sgroup', $result);
|
||||
exit;
|
||||
|
||||
}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;
|
||||
}
|
||||
|
||||
}
|
|
@ -21,8 +21,10 @@ function show_sgroup(){
|
|||
}
|
||||
|
||||
$group = Support_Group::getGroup($result['target_id']);
|
||||
|
||||
$result['groupsname'] = $group->getName();
|
||||
$result['groupemail'] = $group->getGroupEmail();
|
||||
$result['imap_mailserver'] = $group->getIMAP_MailServer();
|
||||
$result['imap_username'] = $group->getIMAP_Username();
|
||||
$result['userlist'] = Gui_Elements::make_table(Support_Group::getAllUsersOfSupportGroup($result['target_id']), Array("getTUserId","getPermission","getExternId"), Array("tUserId","permission","externId"));
|
||||
$i = 0;
|
||||
foreach( $result['userlist'] as $user){
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</div>
|
||||
<div class="box-content">
|
||||
<div class="row-fluid">
|
||||
<legend>All members of the {$groupsname} Support Group</legend>
|
||||
<legend>{$groupsname} Support Group Members</legend>
|
||||
<table class="table table-striped table-bordered bootstrap-datatable datatable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
<form id="addSGroup" class="form-vertical" method="post" action="index.php?page=show_sgroup&id={$target_id}">
|
||||
|
||||
<legend>Add a user to the group '{$groupsname}'</legend>
|
||||
<legend style="margin:0">Add user to '{$groupsname}'</legend>
|
||||
|
||||
<div class="control-group" style="display: inline-block; ">
|
||||
<label class="control-label">username</label>
|
||||
|
@ -95,6 +95,83 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-header well" data-original-title="">
|
||||
<h2><i class="icon-pencil"></i> Modify Email Settings</h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
|
||||
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<div class="row-fluid">
|
||||
|
||||
<form id="modifyMailSGroup" class="form-vertical" method="post" action="index.php?page=show_sgroup&id={$target_id}">
|
||||
|
||||
<legend style="margin:0">Mail settings of '{$groupsname}'</legend>
|
||||
|
||||
<div class="control-group" style="display: inline-block; ">
|
||||
<label class="control-label">Group Email</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="text" id="GroupEmail" name="GroupEmail" value="{$groupemail}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="display: inline-block; ">
|
||||
<label class="control-label">IMAP Mail Server</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="text" id="IMAP_MailServer" name="IMAP_MailServer" value="{$imap_mailserver}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="display: inline-block; ">
|
||||
<label class="control-label">IMAP Username</label>
|
||||
<div class="controls">
|
||||
<div class="input-prepend">
|
||||
<input type="text" id="IMAP_Username" name="IMAP_Username" value="{$imap_username}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" style="display: inline-block; ">
|
||||
<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="modify_email_of_sgroup">
|
||||
<input type="hidden" name="target_id" value="{$target_id}">
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label"></label>
|
||||
<div class="controls">
|
||||
<button type="submit" class="btn btn-primary" >Update</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "SUCCESS"}
|
||||
<div class="alert alert-success">
|
||||
{$modify_mail_of_group_success}
|
||||
</div>
|
||||
{else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "EMAIL_NOT_VALID"}
|
||||
<div class="alert alert-error">
|
||||
{$email_not_valid}
|
||||
</div>
|
||||
{else if isset($RESULT_OF_MODIFYING) and $RESULT_OF_MODIFYING eq "NO_PASSWORD"}
|
||||
<div class="alert alert-error">
|
||||
{$no_password_given}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--/span-->
|
||||
{/if}
|
||||
</div><!--/row-->
|
||||
|
|
Loading…
Reference in a new issue