PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/productjuly1video/famousmusictv.click/ajax/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/productjuly1video/famousmusictv.click/ajax/post.php

<?php
if (IS_LOGGED == false || $pt->config->post_system != 'on') {
    $data = array('status' => 400, 'error' => 'Not logged in');
    echo json_encode($data);
    exit();
}

if ($first == 'create') {
	$data['status'] = 400;
	if (empty($_POST['text']) || empty($_FILES["image"])) {
        $data['message'] = $lang->please_check_details;
    }
    else if (!empty($_FILES["image"]["error"]) || !file_exists($_FILES["image"]["tmp_name"])) {
        $data['message'] = $lang->image_not_valid; 
    } 
    else{

    	if (file_exists($_FILES["image"]["tmp_name"])) {
	        $image = getimagesize($_FILES["image"]["tmp_name"]);
	        if (!in_array($image[2], array(
	            IMAGETYPE_GIF,
	            IMAGETYPE_JPEG,
	            IMAGETYPE_PNG,
	            IMAGETYPE_BMP
	        ))){
	            $data['message'] = $lang->image_not_valid; 
	        }
	    }
	    if (empty($data['message'])) {
	    	$file_info   = array(
	            'file' => $_FILES['image']['tmp_name'],
	            'size' => $_FILES['image']['size'],
	            'name' => $_FILES['image']['name'],
	            'type' => $_FILES['image']['type'],
	            'crop' => array(
	                'width' => 600,
	                'height' => 400
	            )
	        );

	        $file_upload     = PT_ShareFile($file_info);

	        if (!empty($file_upload['filename'])) {
	            $post_image  = PT_Secure($file_upload['filename']);
	            $insert_data = array(
	                'image' => $post_image,
	                'text' => PT_Secure($_POST['text']),
	                'time' => time(),
	                'user_id' => $pt->user->id
	            );

	            $insert     = $db->insert(T_ACTIVITES,$insert_data);
	            $data['status'] = 200 ;
		        $data['link']    = PT_Link('@'.$pt->user->username.'?page=activities');
	        }
	    }
    }
}

if ($first == 'edit') {
	$data['status'] = 400;
	if (empty($_POST['text']) || empty($_POST['id']) || !is_numeric($_POST['id']) || $_POST['id'] < 1) {
        $data['message'] = $lang->please_check_details;
    }
    else{
    	if (!empty($_FILES["image"])) {
    		if (file_exists($_FILES["image"]["tmp_name"])) {
		        $image = getimagesize($_FILES["image"]["tmp_name"]);
		        if (!in_array($image[2], array(
		            IMAGETYPE_GIF,
		            IMAGETYPE_JPEG,
		            IMAGETYPE_PNG,
		            IMAGETYPE_BMP
		        ))){
		            $data['message'] = $lang->image_not_valid; 
		        }
		    }
    	}

	    if (empty($data['message'])) {
	    	$id    = PT_Secure($_POST['id']);
	    	$post = $db->where('id',$id)->getOne(T_ACTIVITES);
			if (!empty($post) && ($post->user_id == $pt->user->id || PT_IsAdmin())) {
				$update_data = array(
	                'text' => PT_Secure($_POST['text'])
	            );


		    	if (!empty($_FILES['image'])) {
		    		$file_info   = array(
			            'file' => $_FILES['image']['tmp_name'],
			            'size' => $_FILES['image']['size'],
			            'name' => $_FILES['image']['name'],
			            'type' => $_FILES['image']['type'],
			            'crop' => array(
			                'width' => 600,
			                'height' => 400
			            )
			        );

			        $file_upload     = PT_ShareFile($file_info);
			        $update_data['image'] = $file_upload['filename'];

			        if (file_exists($post->image)) {
			            unlink($post->image);
			        }
			        
			        else if ($s3 === true) {
			            PT_DeleteFromToS3($post->image);
			        }
		    	}

	            $insert     = $db->where('id',$id)->update(T_ACTIVITES,$update_data);
	            $data['status'] = 200 ;
		        $data['link']    = PT_Link('@'.$pt->user->username.'?page=activities');
			}
	    }
    }
}