KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /var/www/parasoffline.edukrypt.in/application/modules/admin/views/dropbox/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/parasoffline.edukrypt.in/application/modules/admin/views/dropbox/file_list.php
<?php
// print_r($folder_name);exit;
if (isset($message)) {
	echo '<div class="alert alert-success" role="alert">' . $message . '</div>';
}

if (!empty($this->session->flashdata('message'))) {
	echo $this->session->flashdata('message');
}

?>
<div id="lec_msg"></div>
<div class="row">

	<?php if ($p_type == 'list') : ?>
		<div class="col-md-12">
			<div class="box box-primary">
				<div class="box-body">



					<div class="table-responsive">
						<a href="javascript:;" id="sync_video" class="btn btn-primary" data-type="video" data-foldername="<?php echo $folder_name; ?>"><i class="fa fa-refresh"></i> Sync Video</a>
						<a href="<?php echo base_url('admin/dropbox/dropbox_upload'); ?>" class="btn btn-primary"><i class="fa fa-upload"></i> Upload Video</a>
						<a href="<?php echo base_url('admin/dropbox/dropbox_upload_pdf'); ?>" class="btn btn-primary"><i class="fa fa-upload"></i> Upload PDF</a>

						<table class="table table-bordered table-striped table-hover table-sm" id="upload_lecture_list">
							<thead style="font-size: 12px;">
								<th>Si</th>
								<th>Name</th>
								<th>Path</th>
								<th>Video Id</th>
								<th>Size</th>
								<!-- <th>Downloadable</th> -->
								<th>Modified Date</th>

							</thead>
							<?php
							if (!empty($dropbox_albums)) {
								$i = 1;
								foreach ($dropbox_albums as $dropbox_album) {
							?>
									<tr>
										<td><?php echo $i;
											$i++; ?></td>
										<td><?php echo $dropbox_album->name; ?></td>
										<td><?php echo $dropbox_album->path_lower; ?></td>
										<td><?php echo $dropbox_album->id; ?></td>
										<td><?php echo $dropbox_album->size; ?></td>
										<td><?php echo $dropbox_album->server_modified; ?></td>
										<td> <button data-toggle="modal" data-target="#model<?php echo $i; ?>" data-name="<?php echo $dropbox_album->name; ?>" data-path="<?php echo $dropbox_album->path_lower; ?>" class="btn btn-sm btn-primary download-file-link"><i class="fa fa-download"></i></button>
											<button data-path="<?php echo $dropbox_album->path_lower; ?>" class="btn btn-sm btn-danger delete-file"><i class="fa fa-trash"></i></button>
										</td>
										<!-- <td><?php echo $dropbox_album->name; ?></td> -->



									</tr>
									<!-- Modal -->
									<div id="model<?php echo $i; ?>" class="modal fade" role="dialog">
										<div class="modal-dialog">

											<!-- Modal content-->
											<div class="modal-content">
												<div class="modal-header">
													<button type="button" class="close" data-dismiss="modal">&times;</button>
													<h4 class="modal-title">Download Link: <?php echo $dropbox_album->name; ?></h4>
												</div>
												<div class="modal-body">
													<textarea style="margin-bottom:5px;" class="form-control" readonly class="temp-url"></textarea>

													<button style="margin-right:5px;" type="button" data-path="<?php echo $dropbox_album->path_lower; ?>" class="btn btn-default temp-link">Get Link</button>
												</div>
												<div class="modal-footer">
													<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
												</div>
											</div>

										</div>
									</div>

							<?php }
							} ?>
						</table>
					</div>

				</div>
			</div>
		</div>
	<?php endif; ?>



</div>



<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/datatables/dataTables.bootstrap4.min.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/datatables/responsive.bootstrap4.min.css'); ?>">
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/plugins/datatables/buttons.bootstrap4.min.css'); ?>">
<script type="text/javascript" src="<?php echo base_url('assets/plugins/datatables/jquery.dataTables.min.js'); ?>"></script>
<script type="text/javascript" src="<?php echo base_url('assets/plugins/datatables/dataTables.bootstrap4.min.js'); ?>"></script>

<script>


</script>

<script type="text/javascript">
	$(document).ready(function() {

		$(document).on("click", ".delete-file", function() {
			var prompt = confirm("Are you sure you want to delete this file?");
			if (prompt) {
				var _path = $(this).data('path');
				var settings = {
					"url": "https://api.dropboxapi.com/2/files/delete_v2",
					"method": "POST",
					"timeout": 0,
					"headers": {
						"Content-Type": "application/json",
						"Authorization": "Bearer HkXug3yoWOAAAAAAAAAAJACxINAHcwUn3Typ0hnMDsZvBqMTvBpKTmfUwKvSXNWE"
					},
					"data": JSON.stringify({
						"path": "" + _path
					}),
				};

				$.ajax(settings).done(function(response) {
					alert("File deleted: " + response.metadata.name + ",Click Sync Videos to update list!");
				});
			}
		});


		/* 	
		$(document).on("click", ".copy-url", function () {
			$(this).data('link').select;
			document.execCommand('copy');
		}); */

		$(document).on("click", ".temp-link", function() {
			var _path = $(this).data('path');
			var _linkelem = $(this).prev('textarea');
			var _thisVal = $(this);
			var settings = {
				"url": "https://api.dropboxapi.com/2/files/get_temporary_link",
				"method": "POST",
				"timeout": 0,
				"headers": {
					"Content-Type": "application/json",
					"Authorization": "Bearer HkXug3yoWOAAAAAAAAAAJACxINAHcwUn3Typ0hnMDsZvBqMTvBpKTmfUwKvSXNWE"
				},
				"data": JSON.stringify({
					"path": "" + _path
				}),
			};

			$.ajax(settings).done(function(response) {
				_linkelem.val(response.link);
				// _thisVal.after('<button data-link="'+response.link+'" type="button" class="btn btn-default copy-url">Copy Link</button>');

			});
		});

		$(document).on("click", ".download-file-link", function() {
			var fileName = $(this).data('name');
			var filePath = $(this).data('path');
			$("#fileName").val(fileName);
			$("#filePath").val(filePath);
			$('#myModal').modal('show');
		});

		$('#sync_video').click(function() {

			var foldername = $(this).data("foldername");
			var type = $(this).data("type");
			$.ajax({
				type: "post",
				data: {
					'foldername': foldername,
					'type': type
				},
				url: "<?php echo base_url(); ?>" + "admin/dropbox/get_drop_box_album/",
				beforeSend: function() {
					$('#sync_video').html('<i class="fa fa-refresh"></i> Please Wait....');
				},

				success: function(result) {
					$('#sync_video').html('<i class="fa fa-refresh"></i> Sync Video');
					location.reload();
				}
			});
			// alert(foldername);
		});


		$('#upload_lecture_list').DataTable();

	});
</script>

Anon7 - 2021