mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 01:39:24 +02:00
This commit is contained in:
parent
53167fbdba
commit
508848fa94
5 changed files with 729 additions and 696 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/nbproject/private/
|
||||
/videos/
|
|
@ -1,447 +1,462 @@
|
|||
<?php
|
||||
require_once '../objects/functions.php';
|
||||
|
||||
function isApache() {
|
||||
if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function isPHP($version = "'7.0.0'") {
|
||||
if (version_compare(PHP_VERSION, $version) >= 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function modRewriteEnabled() {
|
||||
return in_array('mod_rewrite', apache_get_modules());
|
||||
}
|
||||
|
||||
function isFFMPEG() {
|
||||
return trim(shell_exec('which ffmpeg'));
|
||||
}
|
||||
|
||||
function getPathToApplication() {
|
||||
return str_replace("install/index.php", "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
}
|
||||
|
||||
function getURLToApplication() {
|
||||
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
$url = str_replace("install/index.php", "", $url);
|
||||
return $url;
|
||||
}
|
||||
|
||||
//max_execution_time = 7200
|
||||
function check_max_execution_time() {
|
||||
$max_size = ini_get('max_execution_time');
|
||||
$recomended_size = 7200;
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//post_max_size = 100M
|
||||
function check_post_max_size() {
|
||||
$max_size = parse_size(ini_get('post_max_size'));
|
||||
$recomended_size = parse_size('100M');
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//upload_max_filesize = 100M
|
||||
function check_upload_max_filesize() {
|
||||
$max_size = parse_size(ini_get('upload_max_filesize'));
|
||||
$recomended_size = parse_size('100M');
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//memory_limit = 100M
|
||||
function check_memory_limit() {
|
||||
$max_size = parse_size(ini_get('memory_limit'));
|
||||
$recomended_size = parse_size('100M');
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($_SERVER);exit;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Install YouPHPTube</title>
|
||||
<link href="../view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../view/bootstrap/bootstrapSelectPicker/css/bootstrap-select.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../view/css/flag-icon-css-master/css/flag-icon.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../view/js/seetalert/sweetalert.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="../view/js/jquery-3.2.0.min.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
if (file_exists('../videos/configuration.php')) {
|
||||
require_once '../videos/configuration.php';
|
||||
?>
|
||||
<div class="container">
|
||||
<h3 class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-ok-circle"></span>
|
||||
Your system is installed, remove the <code><?php echo $global['systemRootPath']; ?>install</code> directory to continue
|
||||
<hr>
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-success btn-lg center-block">Go to the main page</a>
|
||||
</h3>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="container">
|
||||
<img src="../view/img/logo.png" alt="Logo" class="img img-responsive center-block"/>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-xs-12">
|
||||
<?php
|
||||
if (isApache()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong><?php echo $_SERVER['SERVER_SOFTWARE']; ?> is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your server is <?php echo $_SERVER['SERVER_SOFTWARE']; ?>, you must install Apache</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (isPHP("5.6")) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>PHP <?php echo PHP_VERSION; ?> is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your PHP version is <?php echo PHP_VERSION; ?>, you must install PHP 5.6.x or greater</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (modRewriteEnabled()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Mod Rewrite module is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Mod Rewrite is not enabled</strong>
|
||||
<details>
|
||||
In order to use mod_rewrite you can type the following command in the terminal:<br>
|
||||
<code>a2enmod rewrite</code><br>
|
||||
Restart apache2 after<br>
|
||||
<code>/etc/init.d/apache2 restart</code>
|
||||
</details>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($ffmpeg = isFFMPEG()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>FFMPEG <?php echo $ffmpeg; ?> is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>FFmpeg is not enabled</strong>
|
||||
<details>
|
||||
FFmpeg has been removed from Ubuntu 14.04 and was replaced by Libav. This decision has been reversed so that FFmpeg is available now in Ubuntu 15.04 again, but there is still no official package for 14.04. In this tutorial, I will show you how to install FFmpeg from mc3man ppa. Add the mc3man ppa:
|
||||
<br>
|
||||
<code>sudo add-apt-repository ppa:mc3man/trusty-media</code>
|
||||
<br>
|
||||
And confirm the following message by pressing <enter>:
|
||||
<br>
|
||||
<code>
|
||||
Also note that with apt-get a sudo apt-get dist-upgrade is needed for initial setup & with some package upgrades
|
||||
More info: https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media
|
||||
Press [ENTER] to continue or ctrl-c to cancel adding it
|
||||
</code>
|
||||
<br>
|
||||
Update the package list.
|
||||
<br>
|
||||
<code>
|
||||
sudo apt-get update
|
||||
sudo apt-get dist-upgrade
|
||||
</code>
|
||||
<br>
|
||||
Now FFmpeg is available to be installed with apt:
|
||||
<br>
|
||||
<code>sudo apt-get install ffmpeg</code>
|
||||
|
||||
</details>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (is_writable("../videos")) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your videos directory is writable</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your videos directory must be writable</strong>
|
||||
<details>
|
||||
you can set the permissions.
|
||||
<br>
|
||||
<code>sudo chmod -R 777 /var/www/[YouPHPTube Dir]/videos</code>
|
||||
</details>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (check_max_execution_time()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your max_execution_time is <?php echo ini_get('max_execution_time'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your max_execution_time is <?php echo ini_get('max_execution_time'); ?>, it must be at least 7200</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (check_post_max_size()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?>, it must be at least 100M</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (check_upload_max_filesize()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?>, it must be at least 100M</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (check_memory_limit()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your memory_limit is <?php echo ini_get('memory_limit'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your memory_limit is <?php echo ini_get('memory_limit'); ?>, it must be at least 100M</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-12 col-xs-12">
|
||||
<form id="configurationForm">
|
||||
<div class="form-group">
|
||||
<label for="webSiteRootURL">Your Site URL</label>
|
||||
<input type="text" class="form-control" id="webSiteRootURL" placeholder="Enter your URL (http://yoursite.com)" value="<?php echo getURLToApplication(); ?>" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="systemRootPath">System Path to Application</label>
|
||||
<input type="text" class="form-control" id="systemRootPath" placeholder="System Path to Application (/var/www/[application_path])" value="<?php echo getPathToApplication(); ?>" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="webSiteTitle">Title of your Web Site</label>
|
||||
<input type="text" class="form-control" id="webSiteTitle" placeholder="Enter the title of your Web Site" value="YouPHPTube" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="contactEmail">Contact E-mail</label>
|
||||
<input type="email" class="form-control" id="contactEmail" placeholder="Enter e-mail contact of your Web Site" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databaseHost">Database Host</label>
|
||||
<input type="text" class="form-control" id="databaseHost" placeholder="Enter Database Host" value="localhost" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databaseUser">Database User</label>
|
||||
<input type="text" class="form-control" id="databaseUser" placeholder="Enter Database User" value="root" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databasePass">Database Password</label>
|
||||
<input type="password" class="form-control" id="databasePass" placeholder="Enter Database Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databaseName">Database Name</label>
|
||||
<input type="text" class="form-control" id="databaseName" placeholder="Enter Database Name" value="youPHPTube" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mainLanguage">Select the main Language</label>
|
||||
|
||||
<select class="selectpicker" data-width="fit" id="mainLanguage">
|
||||
<option data-content='<span class="flag-icon flag-icon-us"></span> English' value="en">English</option>
|
||||
<option data-content='<span class="flag-icon flag-icon-es"></span> Spanish' value="es">Spanish</option>
|
||||
<option data-content='<span class="flag-icon flag-icon-fr"></span> French' value="fr">French</option>
|
||||
<option data-content='<span class="flag-icon flag-icon-br"></span> Brazilian Portuguese' value="pt_BR">Brazilian Portuguese</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="systemAdminPass">System Admin password</label>
|
||||
<input type="password" class="form-control" id="systemAdminPass" placeholder="Enter System Admin password" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="confirmSystemAdminPass">Confirm System Admin password</label>
|
||||
<input type="password" class="form-control" id="confirmSystemAdminPass" placeholder="Confirm System Admin password" required="required">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
<script src="../view/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
<script src="../view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.min.js" type="text/javascript"></script>
|
||||
<script src="../view/js/seetalert/sweetalert.min.js" type="text/javascript"></script>
|
||||
<script src="../view/js/script.js" type="text/javascript"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('.selectpicker').selectpicker();
|
||||
$('#configurationForm').submit(function (evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
var systemAdminPass = $('#systemAdminPass').val();
|
||||
var confirmSystemAdminPass = $('#confirmSystemAdminPass').val();
|
||||
|
||||
if (!systemAdminPass) {
|
||||
swal("Sorry!", "Your System Admin Password can not be blank!", "error");
|
||||
return false;
|
||||
}
|
||||
if (systemAdminPass != confirmSystemAdminPass) {
|
||||
swal("Sorry!", "Your System Admin Password must be confirmed!", "error");
|
||||
return false;
|
||||
}
|
||||
|
||||
modal.showPleaseWait();
|
||||
var webSiteRootURL = $('#webSiteRootURL').val();
|
||||
var systemRootPath = $('#systemRootPath').val();
|
||||
var webSiteTitle = $('#webSiteTitle').val();
|
||||
var databaseHost = $('#databaseHost').val();
|
||||
var databaseUser = $('#databaseUser').val();
|
||||
var databasePass = $('#databasePass').val();
|
||||
var databaseName = $('#databaseName').val();
|
||||
var mainLanguage = $('#mainLanguage').val();
|
||||
var contactEmail = $('#contactEmail').val();
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'install/checkConfiguration.php',
|
||||
data: {
|
||||
webSiteRootURL: webSiteRootURL,
|
||||
systemRootPath: systemRootPath,
|
||||
webSiteTitle: webSiteTitle,
|
||||
databaseHost: databaseHost,
|
||||
databaseUser: databaseUser,
|
||||
databasePass: databasePass,
|
||||
databaseName: databaseName,
|
||||
mainLanguage: mainLanguage,
|
||||
systemAdminPass: systemAdminPass,
|
||||
contactEmail: contactEmail
|
||||
},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
if (response.error) {
|
||||
swal("Sorry!", response.error, "error");
|
||||
} else {
|
||||
swal("Congratulations!", response.error, "success");
|
||||
window.location.reload(false);
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
modal.hidePleaseWait();
|
||||
if (xhr.status == 404) {
|
||||
swal("Sorry!", "Your Site URL is wrong!", "error");
|
||||
}else{
|
||||
swal("Sorry!", "Unknow error!", "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
require_once '../objects/functions.php';
|
||||
|
||||
function checkVideosDir(){
|
||||
$dir = "../videos";
|
||||
if (file_exists($dir)) {
|
||||
if(is_writable($dir)){
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return mkdir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
function isApache() {
|
||||
if (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
function isPHP($version = "'7.0.0'") {
|
||||
if (version_compare(PHP_VERSION, $version) >= 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function modRewriteEnabled() {
|
||||
return in_array('mod_rewrite', apache_get_modules());
|
||||
}
|
||||
|
||||
function isFFMPEG() {
|
||||
return trim(shell_exec('which ffmpeg'));
|
||||
}
|
||||
|
||||
function getPathToApplication() {
|
||||
return str_replace("install/index.php", "", $_SERVER["SCRIPT_FILENAME"]);
|
||||
}
|
||||
|
||||
function getURLToApplication() {
|
||||
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
||||
$url = str_replace("install/index.php", "", $url);
|
||||
return $url;
|
||||
}
|
||||
|
||||
//max_execution_time = 7200
|
||||
function check_max_execution_time() {
|
||||
$max_size = ini_get('max_execution_time');
|
||||
$recomended_size = 7200;
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//post_max_size = 100M
|
||||
function check_post_max_size() {
|
||||
$max_size = parse_size(ini_get('post_max_size'));
|
||||
$recomended_size = parse_size('100M');
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//upload_max_filesize = 100M
|
||||
function check_upload_max_filesize() {
|
||||
$max_size = parse_size(ini_get('upload_max_filesize'));
|
||||
$recomended_size = parse_size('100M');
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//memory_limit = 100M
|
||||
function check_memory_limit() {
|
||||
$max_size = parse_size(ini_get('memory_limit'));
|
||||
$recomended_size = parse_size('100M');
|
||||
if ($recomended_size > $max_size) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($_SERVER);exit;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Install YouPHPTube</title>
|
||||
<link href="../view/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../view/bootstrap/bootstrapSelectPicker/css/bootstrap-select.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../view/css/flag-icon-css-master/css/flag-icon.min.css" rel="stylesheet" type="text/css"/>
|
||||
<link href="../view/js/seetalert/sweetalert.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="../view/js/jquery-3.2.0.min.js" type="text/javascript"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
if (file_exists('../videos/configuration.php')) {
|
||||
require_once '../videos/configuration.php';
|
||||
?>
|
||||
<div class="container">
|
||||
<h3 class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-ok-circle"></span>
|
||||
Your system is installed, remove the <code><?php echo $global['systemRootPath']; ?>install</code> directory to continue
|
||||
<hr>
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-success btn-lg center-block">Go to the main page</a>
|
||||
</h3>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="container">
|
||||
<img src="../view/img/logo.png" alt="Logo" class="img img-responsive center-block"/>
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-12 col-xs-12">
|
||||
<?php
|
||||
if (isApache()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong><?php echo $_SERVER['SERVER_SOFTWARE']; ?> is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your server is <?php echo $_SERVER['SERVER_SOFTWARE']; ?>, you must install Apache</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (isPHP("5.6")) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>PHP <?php echo PHP_VERSION; ?> is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your PHP version is <?php echo PHP_VERSION; ?>, you must install PHP 5.6.x or greater</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (modRewriteEnabled()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Mod Rewrite module is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Mod Rewrite is not enabled</strong>
|
||||
<details>
|
||||
In order to use mod_rewrite you can type the following command in the terminal:<br>
|
||||
<code>a2enmod rewrite</code><br>
|
||||
Restart apache2 after<br>
|
||||
<code>/etc/init.d/apache2 restart</code>
|
||||
</details>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($ffmpeg = isFFMPEG()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>FFMPEG <?php echo $ffmpeg; ?> is Present</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>FFmpeg is not enabled</strong>
|
||||
<details>
|
||||
FFmpeg has been removed from Ubuntu 14.04 and was replaced by Libav. This decision has been reversed so that FFmpeg is available now in Ubuntu 15.04 again, but there is still no official package for 14.04. In this tutorial, I will show you how to install FFmpeg from mc3man ppa. Add the mc3man ppa:
|
||||
<br>
|
||||
<code>sudo add-apt-repository ppa:mc3man/trusty-media</code>
|
||||
<br>
|
||||
And confirm the following message by pressing <enter>:
|
||||
<br>
|
||||
<code>
|
||||
Also note that with apt-get a sudo apt-get dist-upgrade is needed for initial setup & with some package upgrades
|
||||
More info: https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media
|
||||
Press [ENTER] to continue or ctrl-c to cancel adding it
|
||||
</code>
|
||||
<br>
|
||||
Update the package list.
|
||||
<br>
|
||||
<code>
|
||||
sudo apt-get update
|
||||
sudo apt-get dist-upgrade
|
||||
</code>
|
||||
<br>
|
||||
Now FFmpeg is available to be installed with apt:
|
||||
<br>
|
||||
<code>sudo apt-get install ffmpeg</code>
|
||||
|
||||
</details>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (checkVideosDir()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your videos directory is writable</strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your videos directory must be writable</strong>
|
||||
<details>
|
||||
If the video directory does not exists create it!
|
||||
<br>
|
||||
<code>sudo mkdir /var/www/[YouPHPTube Dir]/videos</code>
|
||||
<br>
|
||||
Then you can set the permissions.
|
||||
<br>
|
||||
<code>sudo chmod -R 777 /var/www/[YouPHPTube Dir]/videos</code>
|
||||
</details>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if (check_max_execution_time()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your max_execution_time is <?php echo ini_get('max_execution_time'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your max_execution_time is <?php echo ini_get('max_execution_time'); ?>, it must be at least 7200</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (check_post_max_size()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your post_max_size is <?php echo ini_get('post_max_size'); ?>, it must be at least 100M</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (check_upload_max_filesize()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your upload_max_filesize is <?php echo ini_get('upload_max_filesize'); ?>, it must be at least 100M</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (check_memory_limit()) {
|
||||
?>
|
||||
<div class="alert alert-success">
|
||||
<span class="glyphicon glyphicon-check"></span>
|
||||
<strong>Your memory_limit is <?php echo ini_get('memory_limit'); ?></strong>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-danger">
|
||||
<span class="glyphicon glyphicon-unchecked"></span>
|
||||
<strong>Your memory_limit is <?php echo ini_get('memory_limit'); ?>, it must be at least 100M</strong>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-12 col-xs-12">
|
||||
<form id="configurationForm">
|
||||
<div class="form-group">
|
||||
<label for="webSiteRootURL">Your Site URL</label>
|
||||
<input type="text" class="form-control" id="webSiteRootURL" placeholder="Enter your URL (http://yoursite.com)" value="<?php echo getURLToApplication(); ?>" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="systemRootPath">System Path to Application</label>
|
||||
<input type="text" class="form-control" id="systemRootPath" placeholder="System Path to Application (/var/www/[application_path])" value="<?php echo getPathToApplication(); ?>" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="webSiteTitle">Title of your Web Site</label>
|
||||
<input type="text" class="form-control" id="webSiteTitle" placeholder="Enter the title of your Web Site" value="YouPHPTube" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="contactEmail">Contact E-mail</label>
|
||||
<input type="email" class="form-control" id="contactEmail" placeholder="Enter e-mail contact of your Web Site" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databaseHost">Database Host</label>
|
||||
<input type="text" class="form-control" id="databaseHost" placeholder="Enter Database Host" value="localhost" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databaseUser">Database User</label>
|
||||
<input type="text" class="form-control" id="databaseUser" placeholder="Enter Database User" value="root" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databasePass">Database Password</label>
|
||||
<input type="password" class="form-control" id="databasePass" placeholder="Enter Database Password">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="databaseName">Database Name</label>
|
||||
<input type="text" class="form-control" id="databaseName" placeholder="Enter Database Name" value="youPHPTube" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mainLanguage">Select the main Language</label>
|
||||
|
||||
<select class="selectpicker" data-width="fit" id="mainLanguage">
|
||||
<option data-content='<span class="flag-icon flag-icon-us"></span> English' value="en">English</option>
|
||||
<option data-content='<span class="flag-icon flag-icon-es"></span> Spanish' value="es">Spanish</option>
|
||||
<option data-content='<span class="flag-icon flag-icon-fr"></span> French' value="fr">French</option>
|
||||
<option data-content='<span class="flag-icon flag-icon-br"></span> Brazilian Portuguese' value="pt_BR">Brazilian Portuguese</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="systemAdminPass">System Admin password</label>
|
||||
<input type="password" class="form-control" id="systemAdminPass" placeholder="Enter System Admin password" required="required">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="confirmSystemAdminPass">Confirm System Admin password</label>
|
||||
<input type="password" class="form-control" id="confirmSystemAdminPass" placeholder="Confirm System Admin password" required="required">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
<script src="../view/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
<script src="../view/bootstrap/bootstrapSelectPicker/js/bootstrap-select.min.js" type="text/javascript"></script>
|
||||
<script src="../view/js/seetalert/sweetalert.min.js" type="text/javascript"></script>
|
||||
<script src="../view/js/script.js" type="text/javascript"></script>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('.selectpicker').selectpicker();
|
||||
$('#configurationForm').submit(function (evt) {
|
||||
evt.preventDefault();
|
||||
|
||||
var systemAdminPass = $('#systemAdminPass').val();
|
||||
var confirmSystemAdminPass = $('#confirmSystemAdminPass').val();
|
||||
|
||||
if (!systemAdminPass) {
|
||||
swal("Sorry!", "Your System Admin Password can not be blank!", "error");
|
||||
return false;
|
||||
}
|
||||
if (systemAdminPass != confirmSystemAdminPass) {
|
||||
swal("Sorry!", "Your System Admin Password must be confirmed!", "error");
|
||||
return false;
|
||||
}
|
||||
|
||||
modal.showPleaseWait();
|
||||
var webSiteRootURL = $('#webSiteRootURL').val();
|
||||
var systemRootPath = $('#systemRootPath').val();
|
||||
var webSiteTitle = $('#webSiteTitle').val();
|
||||
var databaseHost = $('#databaseHost').val();
|
||||
var databaseUser = $('#databaseUser').val();
|
||||
var databasePass = $('#databasePass').val();
|
||||
var databaseName = $('#databaseName').val();
|
||||
var mainLanguage = $('#mainLanguage').val();
|
||||
var contactEmail = $('#contactEmail').val();
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'install/checkConfiguration.php',
|
||||
data: {
|
||||
webSiteRootURL: webSiteRootURL,
|
||||
systemRootPath: systemRootPath,
|
||||
webSiteTitle: webSiteTitle,
|
||||
databaseHost: databaseHost,
|
||||
databaseUser: databaseUser,
|
||||
databasePass: databasePass,
|
||||
databaseName: databaseName,
|
||||
mainLanguage: mainLanguage,
|
||||
systemAdminPass: systemAdminPass,
|
||||
contactEmail: contactEmail
|
||||
},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
if (response.error) {
|
||||
swal("Sorry!", response.error, "error");
|
||||
} else {
|
||||
swal("Congratulations!", response.error, "success");
|
||||
window.location.reload(false);
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
modal.hidePleaseWait();
|
||||
if (xhr.status == 404) {
|
||||
swal("Sorry!", "Your Site URL is wrong!", "error");
|
||||
}else{
|
||||
swal("Sorry!", "Unknow error!", "error");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
7
nbproject/project.properties
Normal file
7
nbproject/project.properties
Normal file
|
@ -0,0 +1,7 @@
|
|||
include.path=${php.global.include.path}
|
||||
php.version=PHP_54
|
||||
source.encoding=UTF-8
|
||||
src.dir=.
|
||||
tags.asp=false
|
||||
tags.short=false
|
||||
web.root=.
|
9
nbproject/project.xml
Normal file
9
nbproject/project.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://www.netbeans.org/ns/project/1">
|
||||
<type>org.netbeans.modules.php.project</type>
|
||||
<configuration>
|
||||
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
||||
<name>YouPHPTube</name>
|
||||
</data>
|
||||
</configuration>
|
||||
</project>
|
498
view/index.php
498
view/index.php
|
@ -1,249 +1,249 @@
|
|||
<?php
|
||||
if (!file_exists('../videos/configuration.php') || file_exists('../install/index.php')) {
|
||||
if (!file_exists('../install/index.php')) {
|
||||
die("No Configuration and no Installation");
|
||||
}
|
||||
header("Location: install/index.php");
|
||||
}
|
||||
|
||||
require_once '../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$video = Video::getVideo();
|
||||
|
||||
if (empty($_GET['page'])) {
|
||||
$_GET['page'] = 1;
|
||||
} else {
|
||||
$_GET['page'] = intval($_GET['page']);
|
||||
}
|
||||
$_POST['rowCount'] = 10;
|
||||
$_POST['current'] = $_GET['page'];
|
||||
$_POST['sort']['created'] = 'desc';
|
||||
$videos = Video::getAllVideos();
|
||||
$total = Video::getTotalVideos();
|
||||
$totalPages = ceil($total / $_POST['rowCount']);
|
||||
//var_dump($video);exit;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo $global['webSiteTitle']; ?> :: <?php echo $video['title']; ?></title>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
include 'include/navbar.php';
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
|
||||
<?php
|
||||
if (!empty($video)) {
|
||||
if (empty($_GET['search'])) {
|
||||
?>
|
||||
<div class="row main-video">
|
||||
<div class="col-xs-12 col-sm-12 col-lg-2"></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-8">
|
||||
<div align="center" class="embed-responsive embed-responsive-16by9">
|
||||
<video poster="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.jpg" controls crossorigin class="embed-responsive-item" id="mainVideo">
|
||||
<source src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.mp4" type="video/mp4">
|
||||
<source src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.webm" type="video/webm">
|
||||
<p><?php echo __("If you can't view this video, your browser does not support HTML5 videos"); ?></p>
|
||||
</video>
|
||||
</div>
|
||||
<script>
|
||||
var playCount = 0;
|
||||
$('#mainVideo').bind('play', function (e) {
|
||||
playCount++;
|
||||
if (playCount == 1) {
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>addViewCountVideo',
|
||||
method: 'post',
|
||||
data: {'id': "<?php echo $video['id']; ?>"}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-lg-2"></div>
|
||||
</div><!--/row-->
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-7 ">
|
||||
<div class="row bgWhite">
|
||||
<div class="col-xs-4 col-sm-4 col-lg-4">
|
||||
<img src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.jpg" alt="<?php echo $video['title']; ?>" class="img-responsive" height="130px" />
|
||||
</div>
|
||||
<div class="col-xs-8 col-sm-8 col-lg-8">
|
||||
<h1>
|
||||
<?php echo $video['title']; ?>
|
||||
</h1>
|
||||
<h3>
|
||||
<?php echo __("Category"); ?>: <?php echo $video['category']; ?>
|
||||
</h3>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-6"><?php echo __("Created"); ?>: <?php echo $video['created']; ?></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-6" style="text-align: right;"><?php echo __("Views"); ?>: <?php echo $video['views_count']; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bgWhite">
|
||||
<div class="input-group">
|
||||
<textarea class="form-control custom-control" rows="3" style="resize:none" id="comment"></textarea>
|
||||
<span class="input-group-addon btn btn-success" id="saveCommentBtn"><span class="glyphicon glyphicon-comment"></span> <?php echo __("Comment"); ?></span>
|
||||
</div>
|
||||
<h4><?php echo __("Comments"); ?>:</h4>
|
||||
<table id="grid" class="table table-condensed table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="user" data-width="150px"><?php echo __("User"); ?></th>
|
||||
<th data-column-id="comment" ><?php echo __("Comment"); ?></th>
|
||||
<th data-column-id="created" data-order="desc" data-width="150px"><?php echo __("Created"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var grid = $("#grid").bootgrid({
|
||||
ajax: true,
|
||||
url: "<?php echo $global['webSiteRootURL'] . "comments.json/" . $video['id']; ?>",
|
||||
templates: {
|
||||
header: ""
|
||||
}
|
||||
});
|
||||
|
||||
$('#saveCommentBtn').click(function () {
|
||||
if ($('#comment').val().length > 5) {
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>saveComment',
|
||||
method: 'POST',
|
||||
data: {'comment': $('#comment').val(), 'video': "<?php echo $video['id']; ?>"},
|
||||
success: function (response) {
|
||||
if (response.status === "1") {
|
||||
swal("<?php echo __("Congratulations"); ?>!", "<?php echo __("Your comment has been saved!"); ?>", "success");
|
||||
$('#comment').val('');
|
||||
$('#grid').bootgrid('reload');
|
||||
} else {
|
||||
swal("<?php echo __("Sorry"); ?>!", "<?php echo __("Your comment has NOT been saved!"); ?>", "error");
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
swal("<?php echo __("Sorry"); ?>!", "<?php echo __("Your comment must be bigger then 5 characters!"); ?>", "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<div class="row bgWhite">
|
||||
<h4><span class="glyphicon glyphicon-share"></span> <?php echo __("Share Video"); ?>:</h4>
|
||||
<div class="highlight"><pre><code><?php
|
||||
$code = '<iframe width="640" height="480" style="max-width: 100%;max-height: 100%;" src="' . $global['webSiteRootURL'] . 'videoEmbeded/' . $video['clean_title'] . '" frameborder="0" allowfullscreen="allowfullscreen"></iframe>';
|
||||
echo htmlentities($code);
|
||||
?></code></pre></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-3 bgWhite">
|
||||
<?php
|
||||
foreach ($videos as $value) {
|
||||
?>
|
||||
<div class="col-lg-12 col-sm-12 col-xs-12 bottom-border">
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>video/<?php echo $value['clean_title']; ?>" title="<?php echo $value['title']; ?>">
|
||||
<div class="col-lg-5 col-sm-5 col-xs-5">
|
||||
<img src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $value['filename']; ?>.jpg" alt="<?php echo $value['title']; ?>" class="img-responsive" height="130px" />
|
||||
</div>
|
||||
<div class="col-lg-7 col-sm-7 col-xs-7">
|
||||
<div class="text-uppercase"><strong><?php echo $value['title']; ?></strong></div>
|
||||
<div class="">
|
||||
<span class="glyphicon glyphicon-play-circle"></span>
|
||||
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
|
||||
<div>
|
||||
<?php echo __("Category"); ?>: <?php echo $value['category']; ?>
|
||||
</div>
|
||||
<div><?php echo __("Created"); ?>: <?php echo $value['created']; ?></div>
|
||||
<div><?php echo __("Views"); ?>: <?php echo $value['views_count']; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<ul class="pages">
|
||||
</ul>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Total Itens <?php echo $total; ?>
|
||||
|
||||
$('.pages').bootpag({
|
||||
total: <?php echo $totalPages; ?>,
|
||||
page: <?php echo $_GET['page']; ?>,
|
||||
maxVisible: 10
|
||||
}).on('page', function (event, num) {
|
||||
window.location.replace("<?php echo $global['webSiteRootURL']; ?>page/" + num);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-10">
|
||||
<?php
|
||||
foreach ($videos as $value) {
|
||||
?>
|
||||
<div class="col-lg-3 col-sm-12 col-xs-12">
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>video/<?php echo $value['clean_title']; ?>" title="<?php echo $value['title']; ?>">
|
||||
<img src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $value['filename']; ?>.jpg" alt="<?php echo $value['title']; ?>" class="img-responsive" height="130px" />
|
||||
<h2><?php echo $value['title']; ?></h2>
|
||||
<span class="glyphicon glyphicon-play-circle"></span>
|
||||
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<ul class="pages">
|
||||
</ul>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Total Itens <?php echo $total; ?>
|
||||
|
||||
$('.pages').bootpag({
|
||||
total: <?php echo $totalPages; ?>,
|
||||
page: <?php echo $_GET['page']; ?>,
|
||||
maxVisible: 10
|
||||
}).on('page', function (event, num) {
|
||||
window.location.replace("<?php echo $global['webSiteRootURL']; ?>page/" + num);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-warning">
|
||||
<span class="glyphicon glyphicon-facetime-video"></span> <strong><?php echo __("Warning"); ?>!</strong> <?php echo __("Video not found"); ?>.
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
include 'include/footer.php';
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
if (!file_exists('../videos/configuration.php')) {
|
||||
if (!file_exists('../install/index.php')) {
|
||||
die("No Configuration and no Installation");
|
||||
}
|
||||
header("Location: install/index.php");
|
||||
}
|
||||
|
||||
require_once '../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'objects/video.php';
|
||||
$video = Video::getVideo();
|
||||
|
||||
if (empty($_GET['page'])) {
|
||||
$_GET['page'] = 1;
|
||||
} else {
|
||||
$_GET['page'] = intval($_GET['page']);
|
||||
}
|
||||
$_POST['rowCount'] = 10;
|
||||
$_POST['current'] = $_GET['page'];
|
||||
$_POST['sort']['created'] = 'desc';
|
||||
$videos = Video::getAllVideos();
|
||||
$total = Video::getTotalVideos();
|
||||
$totalPages = ceil($total / $_POST['rowCount']);
|
||||
//var_dump($video);exit;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo $_SESSION['language']; ?>">
|
||||
<head>
|
||||
<title><?php echo $global['webSiteTitle']; ?> :: <?php echo $video['title']; ?></title>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
include 'include/navbar.php';
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
|
||||
<?php
|
||||
if (!empty($video)) {
|
||||
if (empty($_GET['search'])) {
|
||||
?>
|
||||
<div class="row main-video">
|
||||
<div class="col-xs-12 col-sm-12 col-lg-2"></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-8">
|
||||
<div align="center" class="embed-responsive embed-responsive-16by9">
|
||||
<video poster="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.jpg" controls crossorigin class="embed-responsive-item" id="mainVideo">
|
||||
<source src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.mp4" type="video/mp4">
|
||||
<source src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.webm" type="video/webm">
|
||||
<p><?php echo __("If you can't view this video, your browser does not support HTML5 videos"); ?></p>
|
||||
</video>
|
||||
</div>
|
||||
<script>
|
||||
var playCount = 0;
|
||||
$('#mainVideo').bind('play', function (e) {
|
||||
playCount++;
|
||||
if (playCount == 1) {
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>addViewCountVideo',
|
||||
method: 'post',
|
||||
data: {'id': "<?php echo $video['id']; ?>"}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-lg-2"></div>
|
||||
</div><!--/row-->
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-7 ">
|
||||
<div class="row bgWhite">
|
||||
<div class="col-xs-4 col-sm-4 col-lg-4">
|
||||
<img src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $video['filename']; ?>.jpg" alt="<?php echo $video['title']; ?>" class="img-responsive" height="130px" />
|
||||
</div>
|
||||
<div class="col-xs-8 col-sm-8 col-lg-8">
|
||||
<h1>
|
||||
<?php echo $video['title']; ?>
|
||||
</h1>
|
||||
<h3>
|
||||
<?php echo __("Category"); ?>: <?php echo $video['category']; ?>
|
||||
</h3>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-6"><?php echo __("Created"); ?>: <?php echo $video['created']; ?></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-6" style="text-align: right;"><?php echo __("Views"); ?>: <?php echo $video['views_count']; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bgWhite">
|
||||
<div class="input-group">
|
||||
<textarea class="form-control custom-control" rows="3" style="resize:none" id="comment"></textarea>
|
||||
<span class="input-group-addon btn btn-success" id="saveCommentBtn"><span class="glyphicon glyphicon-comment"></span> <?php echo __("Comment"); ?></span>
|
||||
</div>
|
||||
<h4><?php echo __("Comments"); ?>:</h4>
|
||||
<table id="grid" class="table table-condensed table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="user" data-width="150px"><?php echo __("User"); ?></th>
|
||||
<th data-column-id="comment" ><?php echo __("Comment"); ?></th>
|
||||
<th data-column-id="created" data-order="desc" data-width="150px"><?php echo __("Created"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var grid = $("#grid").bootgrid({
|
||||
ajax: true,
|
||||
url: "<?php echo $global['webSiteRootURL'] . "comments.json/" . $video['id']; ?>",
|
||||
templates: {
|
||||
header: ""
|
||||
}
|
||||
});
|
||||
|
||||
$('#saveCommentBtn').click(function () {
|
||||
if ($('#comment').val().length > 5) {
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>saveComment',
|
||||
method: 'POST',
|
||||
data: {'comment': $('#comment').val(), 'video': "<?php echo $video['id']; ?>"},
|
||||
success: function (response) {
|
||||
if (response.status === "1") {
|
||||
swal("<?php echo __("Congratulations"); ?>!", "<?php echo __("Your comment has been saved!"); ?>", "success");
|
||||
$('#comment').val('');
|
||||
$('#grid').bootgrid('reload');
|
||||
} else {
|
||||
swal("<?php echo __("Sorry"); ?>!", "<?php echo __("Your comment has NOT been saved!"); ?>", "error");
|
||||
}
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
swal("<?php echo __("Sorry"); ?>!", "<?php echo __("Your comment must be bigger then 5 characters!"); ?>", "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<div class="row bgWhite">
|
||||
<h4><span class="glyphicon glyphicon-share"></span> <?php echo __("Share Video"); ?>:</h4>
|
||||
<div class="highlight"><pre><code><?php
|
||||
$code = '<iframe width="640" height="480" style="max-width: 100%;max-height: 100%;" src="' . $global['webSiteRootURL'] . 'videoEmbeded/' . $video['clean_title'] . '" frameborder="0" allowfullscreen="allowfullscreen"></iframe>';
|
||||
echo htmlentities($code);
|
||||
?></code></pre></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-3 bgWhite">
|
||||
<?php
|
||||
foreach ($videos as $value) {
|
||||
?>
|
||||
<div class="col-lg-12 col-sm-12 col-xs-12 bottom-border">
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>video/<?php echo $value['clean_title']; ?>" title="<?php echo $value['title']; ?>">
|
||||
<div class="col-lg-5 col-sm-5 col-xs-5">
|
||||
<img src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $value['filename']; ?>.jpg" alt="<?php echo $value['title']; ?>" class="img-responsive" height="130px" />
|
||||
</div>
|
||||
<div class="col-lg-7 col-sm-7 col-xs-7">
|
||||
<div class="text-uppercase"><strong><?php echo $value['title']; ?></strong></div>
|
||||
<div class="">
|
||||
<span class="glyphicon glyphicon-play-circle"></span>
|
||||
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
|
||||
<div>
|
||||
<?php echo __("Category"); ?>: <?php echo $value['category']; ?>
|
||||
</div>
|
||||
<div><?php echo __("Created"); ?>: <?php echo $value['created']; ?></div>
|
||||
<div><?php echo __("Views"); ?>: <?php echo $value['views_count']; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<ul class="pages">
|
||||
</ul>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Total Itens <?php echo $total; ?>
|
||||
|
||||
$('.pages').bootpag({
|
||||
total: <?php echo $totalPages; ?>,
|
||||
page: <?php echo $_GET['page']; ?>,
|
||||
maxVisible: 10
|
||||
}).on('page', function (event, num) {
|
||||
window.location.replace("<?php echo $global['webSiteRootURL']; ?>page/" + num);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
</div>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
<div class="col-xs-12 col-sm-12 col-lg-10">
|
||||
<?php
|
||||
foreach ($videos as $value) {
|
||||
?>
|
||||
<div class="col-lg-3 col-sm-12 col-xs-12">
|
||||
<a href="<?php echo $global['webSiteRootURL']; ?>video/<?php echo $value['clean_title']; ?>" title="<?php echo $value['title']; ?>">
|
||||
<img src="<?php echo $global['webSiteRootURL']; ?>videos/<?php echo $value['filename']; ?>.jpg" alt="<?php echo $value['title']; ?>" class="img-responsive" height="130px" />
|
||||
<h2><?php echo $value['title']; ?></h2>
|
||||
<span class="glyphicon glyphicon-play-circle"></span>
|
||||
<span class="duration"><?php echo Video::getCleanDuration($value['duration']); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<ul class="pages">
|
||||
</ul>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Total Itens <?php echo $total; ?>
|
||||
|
||||
$('.pages').bootpag({
|
||||
total: <?php echo $totalPages; ?>,
|
||||
page: <?php echo $_GET['page']; ?>,
|
||||
maxVisible: 10
|
||||
}).on('page', function (event, num) {
|
||||
window.location.replace("<?php echo $global['webSiteRootURL']; ?>page/" + num);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-12 col-lg-1"></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<div class="alert alert-warning">
|
||||
<span class="glyphicon glyphicon-facetime-video"></span> <strong><?php echo __("Warning"); ?>!</strong> <?php echo __("Video not found"); ?>.
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
include 'include/footer.php';
|
||||
?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue