mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 19:42:38 +02:00
Fix video seconds count
This commit is contained in:
parent
e4eebfb104
commit
62fc92096f
5 changed files with 90 additions and 22 deletions
|
@ -48,7 +48,7 @@ foreach ($videos as $value) {
|
|||
echo "\nGet done";
|
||||
ob_flush();
|
||||
} else {
|
||||
echo "\nFile exists: " . $value['title'];
|
||||
echo "\nFile exists: " . $value['title']. " {$destination}";
|
||||
ob_flush();
|
||||
}
|
||||
|
||||
|
|
|
@ -208,8 +208,31 @@ abstract class ObjectYPT implements ObjectInterface {
|
|||
return $sql;
|
||||
}
|
||||
|
||||
public static function getSqlDateFilter() {
|
||||
$sql = '';
|
||||
$created_year = intval(@$_REQUEST['created_year']);
|
||||
$created_month = intval(@$_REQUEST['created_month']);
|
||||
$modified_year = intval(@$_REQUEST['modified_year']);
|
||||
$modified_month = intval(@$_REQUEST['modified_month']);
|
||||
|
||||
if(!empty($created_year)){
|
||||
$sql .= " AND YEAR(created) = $created_year ";
|
||||
}
|
||||
if(!empty($created_month)){
|
||||
$sql .= " AND MONTH(created) = $created_month ";
|
||||
}
|
||||
if(!empty($modified_year)){
|
||||
$sql .= " AND YEAR(modified) = $modified_year ";
|
||||
}
|
||||
if(!empty($modified_month)){
|
||||
$sql .= " AND MONTH(modified) = $modified_month ";
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
public static function getSqlSearchFromPost() {
|
||||
$sql = "";
|
||||
$sql = self::getSqlDateFilter();
|
||||
if (!empty($_POST['searchPhrase'])) {
|
||||
$_GET['q'] = $_POST['searchPhrase'];
|
||||
} elseif (!empty($_GET['search']['value'])) {
|
||||
|
|
|
@ -542,6 +542,7 @@ class PlayerSkins extends PluginAbstract {
|
|||
if (time >= 5 && time % 1 === 0) {
|
||||
addView({$videos_id}, time);
|
||||
}else{
|
||||
addViewFromCookie();
|
||||
addViewSetCookie(PHPSESSID, {$videos_id}, time, seconds_watching_video);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -531,10 +531,15 @@ function _addViewAsync() {
|
|||
});
|
||||
}
|
||||
|
||||
var _addViewFromCookie_addingtime = false;
|
||||
function addViewFromCookie() {
|
||||
if (typeof webSiteRootURL == 'undefined') {
|
||||
return false;
|
||||
}
|
||||
if(_addViewFromCookie_addingtime){
|
||||
return false;
|
||||
}
|
||||
_addViewFromCookie_addingtime = true;
|
||||
var addView_PHPSESSID = Cookies.get('addView_PHPSESSID');
|
||||
var addView_videos_id = Cookies.get('addView_videos_id');
|
||||
var addView_playerCurrentTime = Cookies.get('addView_playerCurrentTime');
|
||||
|
@ -566,13 +571,14 @@ function addViewFromCookie() {
|
|||
},
|
||||
async: false,
|
||||
success: function (response) {
|
||||
_addViewFromCookie_addingtime = false;
|
||||
console.log('addViewFromCookie', response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addViewSetCookie(PHPSESSID, videos_id, playerCurrentTime, seconds_watching_video) {
|
||||
//console.log('addViewSetCookie', videos_id, playerCurrentTime, seconds_watching_video);
|
||||
//console.log('addViewSetCookie', videos_id, playerCurrentTime, seconds_watching_video, new Error().stack);
|
||||
Cookies.set('addView_PHPSESSID', PHPSESSID, {
|
||||
path: '/',
|
||||
expires: 1
|
||||
|
|
|
@ -66,6 +66,34 @@ $v = new Video('', '', $videos_id);
|
|||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-inline">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="month">Month:</label>
|
||||
<select class="form-control" id="month">
|
||||
<?php
|
||||
$currMonth = date('m');
|
||||
echo "<option value='0'>All</option>";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
echo "<option value='{$i}'>{$i}</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="year">Year:</label>
|
||||
<select class="form-control" id="year">
|
||||
<?php
|
||||
$currYear = date('Y');
|
||||
echo "<option value='0'>All</option>";
|
||||
for ($i = $currYear; $i > $currYear - 20; $i--) {
|
||||
echo "<option value='{$i}'>{$i}</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<h3>
|
||||
<?php
|
||||
echo number_format_short($v->getViews_count());
|
||||
|
@ -108,11 +136,18 @@ $v = new Video('', '', $videos_id);
|
|||
?>
|
||||
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function getVideoViewsAjaxURL() {
|
||||
var url = webSiteRootURL + "view/videoViewsInfo.json.php?videos_id=<?php echo $videos_id; ?>&hash=<?php echo @$_REQUEST['hash']; ?>";
|
||||
url = addGetParam(url, 'created_year', $('#year').val());
|
||||
url = addGetParam(url, 'created_month', $('#month').val());
|
||||
return url;
|
||||
}
|
||||
var VideoViewsInfo;
|
||||
$(document).ready(function () {
|
||||
var VideoViewsInfo = $('#VideoViewsInfo').DataTable({
|
||||
VideoViewsInfo = $('#VideoViewsInfo').DataTable({
|
||||
"order": [[1, "desc"]],
|
||||
serverSide: true,
|
||||
"ajax": "<?php echo $global['webSiteRootURL']; ?>view/videoViewsInfo.json.php?videos_id=<?php echo $videos_id; ?>&hash=<?php echo @$_REQUEST['hash']; ?>",
|
||||
"ajax": getVideoViewsAjaxURL(),
|
||||
"columns": [
|
||||
{data: 'users_id', render: function (data, type, row) {
|
||||
return row.users
|
||||
|
@ -129,6 +164,9 @@ $v = new Video('', '', $videos_id);
|
|||
],
|
||||
select: true,
|
||||
});
|
||||
$('#year, #month').change(function(){
|
||||
VideoViewsInfo.ajax.url(getVideoViewsAjaxURL()).load();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue