Users can specify if they want to receive or dont want to receive tickt updates!
--HG-- branch : quitta-gsoc-2013hg/feature/sse2
parent
f0f08fc374
commit
5174764f2d
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function change_receivemail(){
|
||||||
|
|
||||||
|
try{
|
||||||
|
//if logged in
|
||||||
|
if(WebUsers::isLoggedIn()){
|
||||||
|
|
||||||
|
if(isset($_POST['target_id'])){
|
||||||
|
|
||||||
|
|
||||||
|
if( ( ($_POST['target_id'] == $_SESSION['id']) || Ticket_User::isMod($_SESSION['ticket_user'])) && isset($_POST['ReceiveMail']) ){
|
||||||
|
$user_id = filter_var($_POST['target_id'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
$receiveMail = filter_var($_POST['ReceiveMail'], FILTER_SANITIZE_NUMBER_INT);
|
||||||
|
if($receiveMail == 0 || $receiveMail == 1){
|
||||||
|
WebUsers::setReceiveMail($user_id, $receiveMail);
|
||||||
|
}
|
||||||
|
header("Location: index.php?page=settings&id=".$user_id);
|
||||||
|
exit;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//ERROR: permission denied!
|
||||||
|
$_SESSION['error_code'] = "403";
|
||||||
|
header("Location: index.php?page=error");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
//ERROR: The form was not filled in correclty
|
||||||
|
header("Location: index.php?page=settings");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//ERROR: user is not logged in
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (PDOException $e) {
|
||||||
|
//go to error page or something, because can't access website db
|
||||||
|
print_r($e);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue