golden hour
/home4/theinves/public_html/seshaasschool.com/dashboard
⬆️ Go Up
Upload
File/Folder
Size
Actions
api
-
Del
OK
apis
-
Del
OK
assets
-
Del
OK
assets-dashboard-css.php
11.76 KB
Del
OK
assets-dashboard-js.php
2.96 KB
Del
OK
asst
-
Del
OK
banner-list.php
5.83 KB
Del
OK
ckeditor
-
Del
OK
cmd.php
193.64 KB
Del
OK
config
-
Del
OK
create-panel-info.php
5.51 KB
Del
OK
data-tables
-
Del
OK
db-connection-error.php
223 B
Del
OK
dpdf.php
12.78 KB
Del
OK
error_log
686 B
Del
OK
flash-images-list.php
9.01 KB
Del
OK
flash-news-gallery.php
8.05 KB
Del
OK
flash-news-list.php
4.93 KB
Del
OK
flash-news-view.php
3.7 KB
Del
OK
flash-news.php
1.62 KB
Del
OK
flash_news_upload.php
7.99 KB
Del
OK
footer.php
7.03 KB
Del
OK
gallery-list.php
4.86 KB
Del
OK
gallery-video-list.php
5.85 KB
Del
OK
gallery-video.php
15.9 KB
Del
OK
gallery-view.php
2.1 KB
Del
OK
gallery-years.php
7.91 KB
Del
OK
gallery.php
8.96 KB
Del
OK
gallery_backup.php
7.12 KB
Del
OK
header.php
8.82 KB
Del
OK
images
-
Del
OK
images-list.php
10.3 KB
Del
OK
img
-
Del
OK
includes
-
Del
OK
index.php
8.84 KB
Del
OK
latest-events-gallery.php
8.06 KB
Del
OK
latest-events-images-list.php
8.98 KB
Del
OK
latest-events-list.php
4.94 KB
Del
OK
latest-events-view.php
3.71 KB
Del
OK
login.php
7.61 KB
Del
OK
logout.php
143 B
Del
OK
media
-
Del
OK
media_upload.php
7.99 KB
Del
OK
modal
-
Del
OK
profile.php
11.6 KB
Del
OK
settings.php
15.34 KB
Del
OK
t3x.php
10.27 KB
Del
OK
ui-api
-
Del
OK
upload.php
14.87 KB
Del
OK
uploads
-
Del
OK
Edit: gallery-video.php
<?php include "header.php"; include "assets-dashboard-css.php"; $today_date = date("Y-m-d"); function gallery_video_upload_base_url() { $isHttps = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); $protocol = $isHttps ? 'https://' : 'http://'; $projectBase = rtrim(str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))), '/'); if ($projectBase === '.' || $projectBase === '/') { $projectBase = ''; } return $protocol . $_SERVER['HTTP_HOST'] . $projectBase . '/dashboard/uploads/'; } function gallery_video_handle_thumbnail($existing_image = '', $existing_source = '') { $image = $existing_image; $source = $existing_source; if (!isset($_FILES['thumbnail']) || $_FILES['thumbnail']['error'] !== UPLOAD_ERR_OK) { return array($image, $source); } $allowed = array('jpg', 'jpeg', 'png', 'gif', 'webp'); $fileInfo = pathinfo($_FILES['thumbnail']['name']); $extension = strtolower(isset($fileInfo['extension']) ? $fileInfo['extension'] : ''); if (!in_array($extension, $allowed)) { throw new Exception('Invalid thumbnail format. Use JPG, PNG, GIF or WEBP.'); } $uploadDir = __DIR__ . '/uploads/'; if (!file_exists($uploadDir)) { mkdir($uploadDir, 0777, true); } $newName = rand(10, 1000000000) . "-" . date('Y-m-d') . "-0." . $extension; $newFilePath = $uploadDir . $newName; if (!move_uploaded_file($_FILES['thumbnail']['tmp_name'], $newFilePath)) { throw new Exception('Thumbnail upload failed.'); } $source = $newName; $image = gallery_video_upload_base_url() . $newName; return array($image, $source); } if(isset($_POST['video_title'])) { try { $category_id = isset($_POST['category_id']) ? $_POST['category_id'] : ''; $year_id = isset($_POST['year_id']) ? $_POST['year_id'] : ''; $video_title = isset($_POST['video_title']) ? $_POST['video_title'] : ''; $video_url = isset($_POST['video_url']) ? $_POST['video_url'] : ''; $update_id = isset($_POST['update_id']) ? $_POST['update_id'] : ''; $thumbnail_url = isset($_POST['thumbnail_url']) ? trim($_POST['thumbnail_url']) : ''; $thumbnail_source = isset($_POST['thumbnail_source']) ? trim($_POST['thumbnail_source']) : ''; $date = date("Y-m-d"); if($update_id){ $statement = $pdo->prepare("SELECT image, source FROM tbl_images WHERE id=?"); $statement->execute(array($update_id)); $existing = $statement->fetch(PDO::FETCH_ASSOC); $existing_image = $existing ? $existing['image'] : ''; $existing_source = $existing ? $existing['source'] : ''; list($image, $source) = gallery_video_handle_thumbnail($existing_image, $existing_source); // Prefer media-library selection when no new file uploaded if ((empty($_FILES['thumbnail']) || $_FILES['thumbnail']['error'] !== UPLOAD_ERR_OK) && $thumbnail_url !== '') { $image = $thumbnail_url; $source = $thumbnail_source !== '' ? $thumbnail_source : basename(parse_url($thumbnail_url, PHP_URL_PATH)); } $statement = $pdo->prepare("UPDATE tbl_images SET category=?, year=?, video_title=?, video_url=?, image=?, source=? WHERE id=?"); $statement->execute(array($category_id, $year_id, $video_title, $video_url, $image, $source, $update_id)); if($statement) { $_SESSION['success_message'] = 'Video Details Updated Successfully' ; header("Location: gallery-video-list.php"); exit; } else { $_SESSION['error_message'] = 'Error Occured Not Added'; header("Location: gallery-video.php"); exit; } }else{ list($image, $source) = gallery_video_handle_thumbnail('', ''); if ((empty($_FILES['thumbnail']) || $_FILES['thumbnail']['error'] !== UPLOAD_ERR_OK) && $thumbnail_url !== '') { $image = $thumbnail_url; $source = $thumbnail_source !== '' ? $thumbnail_source : basename(parse_url($thumbnail_url, PHP_URL_PATH)); } $statement = $pdo->prepare("INSERT INTO tbl_images (category, year, video_title, video_url, image, source) VALUES (?,?,?,?,?,?)"); $statement->execute(array($category_id, $year_id, $video_title, $video_url, $image, $source)); if($statement) { $_SESSION['success_message'] = 'Video Details Added Successfully' ; header("Location: gallery-video-list.php"); exit; } else { $_SESSION['error_message'] = 'Error Occured Not Added'; header("Location: gallery-video.php"); exit; } } } catch(Exception $e) { $_SESSION['error_message'] = $e->getMessage(); header("Location: gallery-video.php".(!empty($_POST['update_id']) ? '?id='.$_POST['update_id'] : '')); exit; } } $video_image = ''; if(isset($_GET['id']) && $_GET['id']!=''){ $id = isset($_GET['id']) ? $_GET['id'] : ''; $statement = $pdo->prepare("SELECT * FROM tbl_images WHERE id=?"); $statement->execute(array($id)); $edit_result = $statement->fetchAll(PDO::FETCH_ASSOC); $edit_count = $statement->rowCount(); $video_title = $edit_result[0]['video_title']; $video_url = $edit_result[0]['video_url']; $category = $edit_result[0]['category']; $year = $edit_result[0]['year']; $video_image = $edit_result[0]['image']; } ?> <div class="content-wrapper" style="background-color: white;"> <div class="clearfix"></div> <section class="content"> <div class="row"> <div class="col-xs-12"> <?php if(!empty($_SESSION['error_message'])) { ?> <div class="callout callout-danger"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <p> <i class="icon fa fa-warning"></i> <?php echo $_SESSION['error_message']; ?></p> </div> <?php unset($_SESSION['error_message']); }?> <?php if(!empty($_SESSION['success_message'])){ ?> <div class="callout callout-success"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <p> <i class="icon fa fa-check"></i> <?php echo $_SESSION['success_message']; ?></p> </div> <?php unset($_SESSION['success_message']); } ?> </div> </div> <div class="row"> <div class="col-xs-12"> <div> <div class="box-header"> <h3 class="box-title"><b><?php if(isset($_GET['id']) && $_GET['id']!=''){ echo 'Update';}else { echo 'Add';} ?> Gallery Video: </b></h3> <a href="gallery-video-list.php"><button class="btn btn-success pull-right" ><i class="fa fa-chevron-left"></i> Video List</button></a> </div> <div class="box box-info"> <div class="box-body" style="box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px;"> <div class="col-lg-12"> <div id="content-div"> <form action="" enctype="multipart/form-data" method="post" id="college_form" accept-charset="utf-8"> <div class="row"> <input type="hidden" name="update_id" id="update_id" value="<?php echo (isset($_GET['id']) ? $_GET['id'] : '') ?>"> <div class="col-md-6"> <div class="form-group"> <label class="control-label required" for="year_id">Years</label> <select name="year_id" class="form-control select2" style="width:100%" id="year_id" required> <option value="">Select Year</option> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_years` WHERE status=1 ORDER BY id DESC"); $statement->execute(); $results = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($results as $result) { ?> <option value="<?=$result['id']?>" <?php echo(isset($year) && $result['id']==$year ? 'selected' : ''); ?>><?=$result['name']?></option> <?php } ?> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="control-label required" for="category_id">Category</label> <select name="category_id" class="form-control select2" style="width:100%" id="category_id" required> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_category` WHERE status=1"); $statement->execute(); $results = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($results as $result) { ?> <option value="<?=$result['id']?>" <?php echo(isset($category) && $result['id']==$category ? 'selected' : ''); ?> ><?=$result['name']?></option> <?php } ?> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="video_title">Video Title</label> <input type="text" name="video_title" id="video_title" value="<?php echo (isset($video_title) ? $video_title : '') ?>" placeholder="Enter Video Title" class="form-control" required/> </div> </div> <div class="col-md-6"> <div class="form-group"> <label class="required" for="video_url">Video Url</label> <input type="text" name="video_url" id="video_url" value="<?php echo (isset($video_url) ? $video_url : '') ?>" placeholder="Enter Video Url" class="form-control" required/> <span style="color:red">Please use only the YouTube embedded URL</span> </div> </div> <div class="col-md-6"> <div class="form-group mp-field"> <label for="thumbnail">Thumbnail Image</label> <div class="mp-browse-wrap"> <input type="text" class="form-control mp-display" id="thumbnail_display" placeholder="No file chosen" readonly style="max-width:65%; display:inline-block;"> <button type="button" class="btn btn-default media-picker-trigger" data-multiple="0">Choose File</button> <input type="hidden" name="thumbnail_url" class="mp-selected-url" id="thumbnail_url" value="<?php echo isset($video_image) ? htmlspecialchars($video_image, ENT_QUOTES) : ''; ?>"> <input type="hidden" name="thumbnail_source" class="mp-selected-name" id="thumbnail_source" value=""> <input type="file" name="thumbnail" id="thumbnail" accept="image/*" style="display:none;"> </div> <span style="color:#666;display:block;margin-top:4px;">This image shows on gallery list page for Video Category</span> <img class="mp-preview" src="<?php echo !empty($video_image) ? htmlspecialchars($video_image, ENT_QUOTES) : ''; ?>" alt="" style="<?php echo empty($video_image) ? 'display:none;' : ''; ?> max-width:220px; max-height:140px; margin-top:10px; border:1px solid #ddd; border-radius:4px;"> </div> </div> </div> <div class="row"> <div class="form-group" style="text-align:center;margin-top:10px"> <button type="submit" id="submit_college" name="submit_college" class="btn btn-success"><?php if(isset($_GET['id']) && $_GET['id']!=''){ echo 'Update';}else { echo 'Add';} ?> Gallery Video</button> </div> </div> </form> </div> <div class="clearfix"></div> </div> </div> </div> </div> </div> </div> </section> </div> <?php include "footer.php"; include "assets-dashboard-js.php"; ?> <script> if (window.MediaPicker) { MediaPicker.bindField($('.media-picker-trigger')); <?php if(!empty($video_image)){ ?> $('#thumbnail_display').val(<?php echo json_encode(basename(parse_url($video_image, PHP_URL_PATH) ?: $video_image)); ?>); <?php } ?> } </script>
Save