undef HALF_FREQUENCY_SENDING_TO_CLIENT
[ryzomcore.git] / web / public_php / ams / func / upload.php
blobced82c48e537781dcefa405e99a565bc5ffcd00d
1 <?php
3 require( '../../config.php' );
4 require_once( $AMS_LIB . '/libinclude.php' );
5 $id = $_POST['PHPSESSID'];
6 session_id($id);
7 session_start();
9 // Set permission
10 if ( isset( $_SESSION['ticket_user'] ) ) {
11 $return['permission'] = unserialize( $_SESSION['ticket_user'] ) -> getPermission();
12 } else {
13 // default permission
14 $return['permission'] = 0;
19 if(WebUsers::isLoggedIn() && isset($_GET['id'])){
21 $ticket_id = filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT);
22 $target_ticket = new Ticket();
23 $target_ticket->load_With_TId($ticket_id);
24 if(($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId()) || Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) ){
26 if (!empty($_FILES)) {
27 $tempFile = $_FILES['Filedata']['tmp_name'];
29 $fileParts = pathinfo($_FILES['Filedata']['name']);
30 Ticket::add_Attachment($_GET['id'],$_FILES['Filedata']['name'],$_SESSION['id'],$tempFile);
31 echo "Uploaded :".$_FILES['Filedata']['name'];
32 } else {
33 echo "Upload Failed!";
35 echo "Upload Failed!";
37 echo "Upload Failed!";
39 echo "Upload Failed!";