1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Improve video sort parameters

the flix layour can now add specific channels
This commit is contained in:
Daniel Neto 2024-03-19 13:51:29 -03:00
parent f8ab66741d
commit 64aac53ada
50 changed files with 449 additions and 214 deletions

View file

@ -9,7 +9,7 @@ require_once $global['systemRootPath'] . 'objects/user.php';
class Channel
{
public static function getChannels($activeOnly = true, $FIND_IN_SET = "")
public static function getChannels($activeOnly = true, $FIND_IN_SET = "", $users_id_array = array())
{
global $global;
/**
@ -26,8 +26,11 @@ class Channel
if ($activeOnly) {
$sql .= " AND u.status = 'a' ";
}
if(!empty($users_id_array) && is_array($users_id_array)){
$sql .= " AND u.id IN(".implode(',',$users_id_array ).") ";
}
$sql .= BootGrid::getSqlFromPost(['user', 'about', 'channelName', 'u.name', 'u.email'], "", "", false, $FIND_IN_SET);
//var_dump($sql);exit;
$res = sqlDAL::readSql($sql);
$fullResult = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
@ -38,7 +41,7 @@ class Channel
$subscribe[] = $row;
}
} else {
$subscribe = false;
$subscribe = array();
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $subscribe;

View file

@ -2335,7 +2335,7 @@ function siteMap()
$xml .= '<!-- Videos -->';
setRowCount($advancedCustom->siteMapRowsLimit * 10);
$_POST['sort']['created'] = "DESC";
$rows = Video::getAllVideosLight(!empty($advancedCustom->showPrivateVideosOnSitemap) ? "viewableNotUnlisted" : "publicOnly");
$rows = Video::getAllVideosLight(!empty($advancedCustom->showPrivateVideosOnSitemap) ? Video::SORT_TYPE_VIEWABLENOTUNLISTED : Video::SORT_TYPE_PUBLICONLY);
if (empty($rows) || !is_array($rows)) {
$rows = [];
}

View file

@ -1,7 +1,7 @@
<?php
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getAllVideosAsync($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
//getAllVideosAsync($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
_session_write_close();
$status = $argv[1];
$showOnlyLoggedUserVideos = $argv[2];

View file

@ -1,7 +1,7 @@
<?php
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getTotalVideosInfo($status = "viewable", $showOnlyLoggedUserVideos = false,
//getTotalVideosInfo($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false,
//$ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false)
_session_write_close();
$filename = $argv[1];

View file

@ -1,7 +1,7 @@
<?php
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getTotalVideosInfo($status = "viewable", $showOnlyLoggedUserVideos = false,
//getTotalVideosInfo($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false,
//$ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false)
_session_write_close();
$video_id = $argv[1];

View file

@ -2,7 +2,7 @@
require_once '../videos/configuration.php';
require_once $global['systemRootPath'] . 'objects/video.php';
//getTotalVideosInfo($status = "viewable", $showOnlyLoggedUserVideos = false,
//getTotalVideosInfo($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false,
//$ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false)
_session_write_close();
$status = $argv[1];

View file

@ -92,7 +92,7 @@ class PlayList extends ObjectYPT
return false;
}
$videosArrayId = PlayList::getVideosIdFromPlaylist($playlists_id);
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
$videosP = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, true, $videosArrayId, false, true);
//$videosP = PlayList::sortVideos($videosP, $videosArrayId);
foreach ($videosP as $key => $value2) {
if (empty($videosP[$key]['type'])) {
@ -471,7 +471,7 @@ class PlayList extends ObjectYPT
{
global $global;
return Video::getAllVideosLight("viewableNotUnlisted", false, false, true, 'serie');
return Video::getAllVideosLight(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, false, true, 'serie');
}
public static function getVideosIndexFromPlaylistLight($playlists_id, $videos_id)

View file

@ -283,7 +283,7 @@ class Subscribe extends ObjectYPT{
$_POST['current'] = 1;
$_REQUEST['rowCount'] = 6;
$_POST['sort']['created'] = "DESC";
$row['latestVideos'] = Video::getAllVideos("viewable", $row['users_id']);
$row['latestVideos'] = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, $row['users_id']);
foreach ($row['latestVideos'] as $key => $video) {
$images = Video::getImageFromFilename($video['filename'], $video['type']);
$row['latestVideos'][$key]['Thumbnail'] = $images->thumbsJpg;

View file

@ -3094,10 +3094,15 @@ if (typeof gtag !== \"function\") {
public static function getAddChannelToGalleryButton($users_id)
{
$gallery = AVideoPlugin::isEnabledByName('Gallery');
if (empty($gallery)) {
return '';
if (!empty($gallery)) {
return Gallery::getAddChannelToGalleryButton($users_id);
}else{
$gallery = AVideoPlugin::isEnabledByName('YouPHPFlix2');
if (!empty($gallery)) {
return YouPHPFlix2::getAddChannelToYouPHPFlix2Button($users_id);
}
}
return Gallery::getAddChannelToGalleryButton($users_id);
return '';
}
public static function getBlockUserButton($users_id)
@ -3421,7 +3426,7 @@ if (typeof gtag !== \"function\") {
$_POST['current'] = 1;
$_REQUEST['rowCount'] = $objGallery->screenColsLarge;
$_POST['sort']['created'] = "DESC";
$uploadedVideos = Video::getAllVideos("viewable", $users_id);
$uploadedVideos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, $users_id);
$_POST['current'] = $current;
$_REQUEST['rowCount'] = $rowCount;
$_POST['sort'] = $sort;

View file

@ -148,6 +148,21 @@ if (!class_exists('Video')) {
const ASPECT_RATIO_VERTICAL = '9:16';
const ASPECT_RATIO_HORIZONTAL = '16:9';
const SORT_TYPE_SUGGESTED = 'suggested';
const SORT_TYPE_VIEWABLE = 'viewable';
const SORT_TYPE_VIEWABLENOTUNLISTED = 'viewableNotUnlisted';
const SORT_TYPE_PASSWORDPROTECTED = 'passwordProtected';
const SORT_TYPE_PUBLICONLY = 'publicOnly';
const SORT_TYPE_PRIVATEONLY = 'privateOnly';
const SORT_TYPE_TRENDING = 'trending';
const SORT_TYPE_MOSTWATCHED = 'mostWatched';
const SORT_TYPE_MOSTPOPULAR = 'mostPopular';
const SORT_TYPE_NAME = 'name';
const SORT_TYPE_SHORTS = 'shorts';
const SORT_TYPE_DATEADDED = 'dateadded';
public function __construct($title = "", $filename = "", $id = 0, $refreshCache = false)
{
global $global;
@ -464,9 +479,9 @@ if (!class_exists('Video')) {
$this->clean_title = self::fixCleanTitle($this->clean_title, 1, $this->id);
if (empty($this->status) || empty(self::$statusDesc[$this->status])) {
if($this->type != self::$videoTypeVideo){
if ($this->type != self::$videoTypeVideo) {
$this->status = Video::$statusActive;
}else{
} else {
$this->status = Video::$statusEncoding;
}
}
@ -1041,7 +1056,7 @@ if (!class_exists('Video')) {
{
$sql = "";
if ($status == "viewable") {
if ($status == Video::SORT_TYPE_VIEWABLE) {
if (User::isLogged()) {
$sql .= " AND ((v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
$sql .= " OR ((v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') ";
@ -1056,21 +1071,104 @@ if (!class_exists('Video')) {
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
$sql .= " )";
}
} elseif ($status == "viewableNotUnlisted") {
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
$sql .= " AND ( v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
$sql .= " OR (v.`order` IS NOT NULL AND (v.status='" . Video::$statusUnlisted . "' OR v.status='" . Video::$statusUnlistedButSearchable . "') )";
$sql .= " )";
} elseif ($status == "publicOnly") {
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
$sql .= " AND v.status IN ('" . Video::$statusActive . "', '" . Video::$statusActiveAndEncoding . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
} elseif ($status == "privateOnly") {
} elseif ($status == Video::SORT_TYPE_PRIVATEONLY) {
$sql .= " AND v.status IN ('" . Video::$statusActive . "', '" . Video::$statusActiveAndEncoding . "') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
} elseif (!empty($status)) {
} elseif ($status == Video::SORT_TYPE_SHORTS) {
$ShortsObj = AVideoPlugin::getDataObject("Shorts");
if (!empty($ShortsObj)) {
$max_duration_in_seconds = intval($ShortsObj->shortMaxDurationInSeconds);
if (empty($max_duration_in_seconds)) {
$max_duration_in_seconds = 60;
}
$sql .= " AND duration_in_seconds IS NOT NULL AND duration_in_seconds <= {$max_duration_in_seconds} AND duration_in_seconds > 0 ";
}
} elseif (!empty($status) && strlen($status) == 1) {
$sql .= " AND v.status = '{$status}'";
}
return $sql;
}
static function getSQLSort($sortType, $showOnlyLoggedUserVideos, $showUnlisted, $suggestedOnly)
{
$sql = '';
$sort = @$_POST['sort'];
switch ($sortType) {
case Video::SORT_TYPE_SUGGESTED:
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
$sql .= " ORDER BY RAND() ";
unset($_POST['sort']);
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
if (strpos(mb_strtolower($sql), 'limit') === false) {
$sql .= " LIMIT 60 ";
}
break;
case Video::SORT_TYPE_TRENDING:
unset($_POST['sort']['trending'], $_GET['sort']['trending']);
$rows = [];
if (!empty($_REQUEST['current']) && $_REQUEST['current'] == 1) {
$rows = VideoStatistic::getVideosWithMoreViews(Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos, $showUnlisted, $suggestedOnly);
}
//var_dump($_REQUEST['current'], $rows);
$ids = [];
foreach ($rows as $row) {
$ids[] = $row['id'];
}
//$daysLimit = getTrendingLimit();
if (!empty($ids)) {
$sql .= " ORDER BY FIND_IN_SET(v.id, '" . implode(",", $ids) . "') DESC, likes DESC ";
} else {
$sql .= " ORDER BY likes DESC ";
}
$sql .= ObjectYPT::getSqlLimit();
break;
case Video::SORT_TYPE_MOSTPOPULAR:
$_POST['sort']['likes'] = 'DESC';
case Video::SORT_TYPE_MOSTWATCHED:
$_POST['sort']['views_count'] = 'DESC';
case Video::SORT_TYPE_NAME:
$_POST['sort']['v.title'] = 'ASC';
case Video::SORT_TYPE_DATEADDED:
$_POST['sort']['v.created'] = 'DESC';
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
break;
default:
if (!empty($_POST['sort']['created']) && !empty($_POST['sort']['likes'])) {
$_POST['sort']['v.created'] = $_POST['sort']['created'];
unset($_POST['sort']['created']);
}
$sort = $_POST['sort'];
if (!empty($_POST['sort']['v.created']) || !empty($_POST['sort']['created'])) {
$created = !empty($_POST['sort']['v.created']) ? $_POST['sort']['v.created'] : $_POST['sort']['created'];
unset($_POST['sort']);
$_POST['sort'] = array();
if (strtoupper($created) === 'DESC') {
$_POST['sort']['v.`order`'] = 'IS NOT NULL DESC';
$_POST['sort']['`order`'] = 'ASC';
}
$_POST['sort']['v.created'] = $created;
}
//var_dump($_POST['sort']);exit;
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
unset($_POST['sort']);
$_POST['sort'] = $sort;
//var_dump($sql);exit;
break;
}
$_POST['sort'] = $sort;
return $sql;
}
static function getCatSQL()
{
$catName = @$_REQUEST['catName'];
@ -1094,20 +1192,20 @@ if (!class_exists('Video')) {
}
}
if (!empty($sqls)) {
$sql .= ' AND (' . implode((empty($_REQUEST['doNotShowCats'])?' OR ':' AND '), $sqls).')';
$sql .= ' AND (' . implode((empty($_REQUEST['doNotShowCats']) ? ' OR ' : ' AND '), $sqls) . ')';
}
}
return $sql;
}
public static function getVideo($id = "", $status = "viewable", $ignoreGroup = false, $random = false, $suggestedOnly = false, $showUnlisted = false, $ignoreTags = false, $activeUsersOnly = true)
public static function getVideo($id = "", $status = Video::SORT_TYPE_VIEWABLE, $ignoreGroup = false, $random = false, $suggestedOnly = false, $showUnlisted = false, $ignoreTags = false, $activeUsersOnly = true)
{
global $global, $config, $advancedCustom, $advancedCustomUser, $lastGetVideoSQL;
if ($config->currentVersionLowerThen('5')) {
return false;
}
$status = str_replace("'", "", $status);
if ($status === 'suggested') {
if ($status === Video::SORT_TYPE_SUGGESTED) {
$suggestedOnly = true;
$status = '';
}
@ -1182,7 +1280,7 @@ if (!class_exists('Video')) {
if (!empty($videosArrayId) && is_array($videosArrayId)) {
$sql .= " AND v.id IN ( '" . implode("', '", $videosArrayId) . "') ";
}
if ($status == "viewable") {
if ($status == Video::SORT_TYPE_VIEWABLE) {
$sql .= " AND ( ";
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
if (User::isAdmin()) {
@ -1191,7 +1289,7 @@ if (!class_exists('Video')) {
$sql .= " OR (v.status = '" . Video::$statusUnpublished . "' AND v.users_id = '" . User::getId() . "' )";
}
$sql .= " )";
} elseif ($status == "viewableNotUnlisted") {
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
$sql .= " AND ( ";
$sql .= " v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
if (User::isAdmin()) {
@ -1200,7 +1298,7 @@ if (!class_exists('Video')) {
$sql .= " OR (v.status = '" . Video::$statusUnpublished . "' AND v.users_id = '" . User::getId() . "' )";
}
$sql .= " )";
} elseif (!empty($status)) {
} elseif (!empty($status) && strlen($status) == 1) {
$sql .= " AND v.status = '{$status}'";
}
//$sql .= self::getSQLByStatus($status, $showUnlisted);
@ -1267,7 +1365,7 @@ if (!class_exists('Video')) {
$sql .= " AND v.clean_title = '{$videoName}' ";
} elseif (!empty($random)) {
$sql .= " AND v.id != {$random} ";
//getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $type = '') {
//getTotalVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $type = '') {
$numRows = self::getTotalVideos($status, false, $ignoreGroup, $showUnlisted, $activeUsersOnly, $suggestedOnly);
if ($numRows <= 2) {
$rand = 0;
@ -1550,7 +1648,7 @@ if (!class_exists('Video')) {
* @param string $videosArrayId an array with videos to return (for filter only)
* @return array
*/
public static function getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds = 0)
public static function getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds = 0)
{
global $global, $config, $advancedCustom, $advancedCustomUser;
if ($config->currentVersionLowerThen('11.7')) {
@ -1562,7 +1660,7 @@ if (!class_exists('Video')) {
* @var array $global
* @var object $global['mysqli']
*/
if (!empty($_POST['sort']['suggested'])) {
if (!empty($_POST['sort'][Video::SORT_TYPE_SUGGESTED])) {
$suggestedOnly = true;
}
@ -1588,10 +1686,10 @@ if (!class_exists('Video')) {
}
$passwordProtectedOnly = false;
$status = str_replace("'", "", $status);
if ($status === 'suggested') {
if ($status === Video::SORT_TYPE_SUGGESTED) {
$suggestedOnly = true;
$status = '';
} else if ($status === 'passwordProtected') {
} else if ($status === Video::SORT_TYPE_PASSWORDPROTECTED) {
$passwordProtectedOnly = true;
$status = '';
}
@ -1757,59 +1855,15 @@ if (!class_exists('Video')) {
$sql .= AVideoPlugin::getVideoWhereClause();
if (empty($videosArrayId)) {
$sortType = Video::SORT_TYPE_VIEWABLE;
if ($suggestedOnly) {
$sql .= " AND v.isSuggested = 1 AND v.status = '" . self::$statusActive . "' ";
$sql .= " ORDER BY RAND() ";
$sort = @$_POST['sort'];
unset($_POST['sort']);
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
if (strpos(mb_strtolower($sql), 'limit') === false) {
$sql .= " LIMIT 60 ";
}
$_POST['sort'] = $sort;
} elseif (!isset($_POST['sort']['trending']) && !isset($_GET['sort']['trending'])) {
if (!empty($_POST['sort']['created']) && !empty($_POST['sort']['likes'])) {
$_POST['sort']['v.created'] = $_POST['sort']['created'];
unset($_POST['sort']['created']);
}
$sort = $_POST['sort'];
if (!empty($_POST['sort']['v.created']) || !empty($_POST['sort']['created'])) {
$created = !empty($_POST['sort']['v.created']) ? $_POST['sort']['v.created'] : $_POST['sort']['created'];
unset($_POST['sort']);
$_POST['sort'] = array();
if (strtoupper($created) === 'DESC') {
$_POST['sort']['v.`order`'] = 'IS NOT NULL DESC';
$_POST['sort']['`order`'] = 'ASC';
}
$_POST['sort']['v.created'] = $created;
}
//var_dump($_POST['sort']);exit;
$sql .= BootGrid::getSqlFromPost([], empty($_POST['sort']['likes']) ? "v." : "", "", true);
unset($_POST['sort']);
$_POST['sort'] = $sort;
//var_dump($sql);exit;
} else {
unset($_POST['sort']['trending'], $_GET['sort']['trending']);
$rows = [];
if (!empty($_REQUEST['current']) && $_REQUEST['current'] == 1) {
$rows = VideoStatistic::getVideosWithMoreViews($status, $showOnlyLoggedUserVideos, $showUnlisted, $suggestedOnly);
}
//var_dump($_REQUEST['current'], $rows);
$ids = [];
foreach ($rows as $row) {
$ids[] = $row['id'];
}
//$daysLimit = getTrendingLimit();
if (!empty($ids)) {
$sql .= " ORDER BY FIND_IN_SET(v.id, '" . implode(",", $ids) . "') DESC, likes DESC ";
} else {
$sql .= " ORDER BY likes DESC ";
}
$sql .= ObjectYPT::getSqlLimit();
$sortType = Video::SORT_TYPE_SUGGESTED;
} elseif (isset($_POST['sort']['trending']) || isset($_GET['sort']['trending'])) {
$sortType = Video::SORT_TYPE_TRENDING;
}else if(strlen($status) > 1){
$sortType = $status;
}
$sql .= self::getSQLSort($sortType, $showOnlyLoggedUserVideos, $showUnlisted, $suggestedOnly);
}
if (strpos(mb_strtolower($sql), 'limit') === false) {
if (!empty($_GET['limitOnceToOne'])) {
@ -1833,7 +1887,7 @@ if (!class_exists('Video')) {
//var_dump($max_duration_in_seconds);echo $sql; //exit;
//_error_log("getAllVideos($status, $showOnlyLoggedUserVideos , $ignoreGroup , ". json_encode($videosArrayId).")" . $sql);
//var_dump($sql);exit;
//var_dump($sql, $videosArrayId, $status, debug_backtrace());exit;
//if(!empty($_REQUEST['test'])){var_dump($sql); }
global $_lastGetAllSQL;
$_lastGetAllSQL = $sql;
@ -1940,16 +1994,18 @@ if (!class_exists('Video')) {
}
static function hasPPV($videos_id){
if(AVideoPlugin::isEnabledByName('PayPerView')){
static function hasPPV($videos_id)
{
if (AVideoPlugin::isEnabledByName('PayPerView')) {
$plans = PayPerView::getAllPlansFromVideo($videos_id);
return !empty($plans);
}
return false;
}
static function hasSubscription($videos_id){
if(AVideoPlugin::isEnabledByName('Subscription')){
static function hasSubscription($videos_id)
{
if (AVideoPlugin::isEnabledByName('Subscription')) {
return Subscription::isVideoOnSubscription($videos_id);
}
return false;
@ -2313,14 +2369,14 @@ if (!class_exists('Video')) {
* @param string $showOnlyLoggedUserVideos
* @return array
*/
public static function getAllVideosLight($status = "viewable", $showOnlyLoggedUserVideos = false, $showUnlisted = false, $suggestedOnly = false, $type = '', $max_duration_in_seconds = 0, $with_order_only = false)
public static function getAllVideosLight($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $showUnlisted = false, $suggestedOnly = false, $type = '', $max_duration_in_seconds = 0, $with_order_only = false)
{
global $global, $config;
if ($config->currentVersionLowerThen('5')) {
return [];
}
$status = str_replace("'", "", $status);
if ($status === 'suggested') {
if ($status === Video::SORT_TYPE_SUGGESTED) {
$suggestedOnly = true;
$status = '';
}
@ -2350,7 +2406,7 @@ if (!class_exists('Video')) {
$sql .= " AND (v.users_id = '{$showOnlyLoggedUserVideos}' OR v.users_id_company = '{$showOnlyLoggedUserVideos}')";
}
/*
if ($status == "viewable") {
if ($status == Video::SORT_TYPE_VIEWABLE) {
if (User::isLogged()) {
$sql .= " AND (v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') ";
$sql .= " OR (v.status='" . Video::$statusUnlisted . "' ";
@ -2361,9 +2417,9 @@ if (!class_exists('Video')) {
} else {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
}
} elseif ($status == "viewableNotUnlisted") {
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
} elseif ($status == "publicOnly") {
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
$sql .= " AND v.status IN ('a', 'k') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
} elseif (!empty($status)) {
$sql .= " AND v.status = '{$status}'";
@ -2444,20 +2500,20 @@ if (!class_exists('Video')) {
return $videos;
}
public static function getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $type = '', $max_duration_in_seconds = 0)
public static function getTotalVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $type = '', $max_duration_in_seconds = 0)
{
global $global, $config, $advancedCustomUser;
if ($config->currentVersionLowerThen('11.7')) {
return false;
}
if (!empty($_POST['sort']['suggested'])) {
if (!empty($_POST['sort'][Video::SORT_TYPE_SUGGESTED])) {
$suggestedOnly = true;
}
$status = str_replace("'", "", $status);
if ($status === 'suggested') {
if ($status === Video::SORT_TYPE_SUGGESTED) {
$suggestedOnly = true;
$status = '';
} else if ($status === 'passwordProtected') {
} else if ($status === Video::SORT_TYPE_PASSWORDPROTECTED) {
$passwordProtectedOnly = true;
$status = '';
}
@ -2492,15 +2548,15 @@ if (!class_exists('Video')) {
$sql .= " AND v.id IN ( '" . implode("', '", $videosArrayId) . "') ";
}
if ($status == "viewable") {
if ($status == Video::SORT_TYPE_VIEWABLE) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
} elseif ($status == "viewableNotUnlisted") {
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
} elseif ($status == "publicOnly") {
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
$sql .= " AND v.status IN ('a', 'k') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
} elseif ($status == "privateOnly") {
} elseif ($status == Video::SORT_TYPE_PRIVATEONLY) {
$sql .= " AND v.status IN ('a', 'k') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
} elseif (!empty($status)) {
} elseif (!empty($status) && strlen($status) == 1) {
$sql .= " AND v.status = '{$status}'";
}
//$sql .= self::getSQLByStatus($status, $showUnlisted);
@ -2692,7 +2748,7 @@ if (!class_exists('Video')) {
return $newSearchFieldsNames;
}
public static function getTotalVideosInfo($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [])
public static function getTotalVideosInfo($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [])
{
$obj = new stdClass();
$obj->likes = 0;
@ -3630,7 +3686,7 @@ if (!class_exists('Video')) {
return self::isOwner($videos_id, $users_id);
}
public static function getRandom($excludeVideoId = false, $status = "viewable")
public static function getRandom($excludeVideoId = false, $status = Video::SORT_TYPE_VIEWABLE)
{
return static::getVideo("", $status, false, $excludeVideoId);
}
@ -4188,7 +4244,7 @@ if (!class_exists('Video')) {
$videoFilename = str_replace($paths['filename'], '', $videoFilename);
}
$newPath = addLastSlash($paths['path']) . "{$videoFilename}";
$newPath = str_replace('//', '/', $newPath);
//var_dump($newPath);
return $newPath;
@ -5470,7 +5526,7 @@ if (!class_exists('Video')) {
$videosListCache = new VideosListCacheHandler();
$videosListCache->deleteCache();
ObjectYPT::setLastDeleteALLCacheTime();
return true;
}
@ -6612,9 +6668,9 @@ if (!class_exists('Video')) {
if (!isset($_checkIfIsBrokenList)) {
$_checkIfIsBrokenList = array();
}
if(isset($_checkIfIsBrokenList[$videos_id])){
if (isset($_checkIfIsBrokenList[$videos_id])) {
return $_checkIfIsBrokenList[$videos_id];
}
}
if ($checkIfIsBroken > 10) {
_error_log("Video::checkIfIsBroken($videos_id) maximum check reached ");
$_checkIfIsBrokenList[$videos_id] = false;
@ -6626,7 +6682,7 @@ if (!class_exists('Video')) {
return $_checkIfIsBrokenList[$videos_id];
}
if ($video->getStatus() == Video::$statusActive || $video->getStatus() == Video::$statusUnlisted || $video->getStatus() == Video::$statusUnlistedButSearchable) {
if ($video->getType() == Video::$videoTypeAudio|| $video->getType() == Video::$videoTypeVideo) {
if ($video->getType() == Video::$videoTypeAudio || $video->getType() == Video::$videoTypeVideo) {
$checkIfIsBroken++;
if (self::isMediaFileMissing($video->getFilename())) {
_error_log("Video::checkIfIsBroken($videos_id) true " . $video->getFilename() . ' status=[' . $video->getStatus() . ']' . json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
@ -6637,7 +6693,7 @@ if (!class_exists('Video')) {
}
}
}
$_checkIfIsBrokenList[$videos_id] = $video->getStatus() == Video::$statusBrokenMissingFiles;
return $_checkIfIsBrokenList[$videos_id];
}

View file

@ -484,13 +484,13 @@ class VideoStatistic extends ObjectYPT {
$sql .= " AND v.users_id = '{$user['id']}' ";
}
}
if ($status == "viewable") {
if ($status == Video::SORT_TYPE_VIEWABLE) {
if (User::isLogged()) {
$sql .= " AND (v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "') OR (v.status='u' AND v.users_id ='" . User::getId() . "'))";
} else {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
}
} elseif ($status == "viewableNotUnlisted") {
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "') ";
} elseif (!empty($status)) {
$sql .= " AND v.status = '{$status}'";

View file

@ -30,12 +30,12 @@ $status = '';
if (!empty($_REQUEST['status'])) {
if (!empty(Video::$statusDesc[$_REQUEST['status']])) {
$status = $_REQUEST['status'];
} else if($_REQUEST['status'] == 'passwordProtected'){
$status = 'passwordProtected';
} else if($_REQUEST['status'] == Video::SORT_TYPE_PASSWORDPROTECTED){
$status = Video::SORT_TYPE_PASSWORDPROTECTED;
}
}
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds = 0)
//getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds = 0)
$videos = Video::getAllVideos($status, $showOnlyLoggedUserVideos, true, [], false, $showUnlisted, $activeUsersOnly, false, null, @$_REQUEST['type']);
resetCurrentPage();
//var_dump($videos);exit;

View file

@ -29,18 +29,18 @@ if (!empty($_GET['user']) && !empty($_GET['pass'])) {
$objMob = AVideoPlugin::getObjectData("MobileManager");
if (!empty($random)) {
$video = Video::getVideo("", "viewableNotUnlisted", true, false, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLENOTUNLISTED, true, false, true);
if (empty($video)) {
$video = Video::getVideo("", "viewableNotUnlisted", true, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLENOTUNLISTED, true, true);
}
$videos = [$video];
$total = 1;
} elseif ($objMob->netflixStyle) {
$videos = Video::getAllVideos("viewableNotUnlisted", false, true);
$total = Video::getTotalVideos("viewableNotUnlisted", false, true);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, true);
$total = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, true);
} else {
$videos = Video::getAllVideos("viewable");
$total = Video::getTotalVideos("viewable");
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE);
$total = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLE);
}
foreach ($videos as $key => $value) {

View file

@ -847,18 +847,18 @@ class API extends PluginAbstract
require_once $global['systemRootPath'] . 'objects/video.php';
$obj = $this->startResponseObject($parameters);
if (!empty($parameters['videos_id'])) {
$status = "viewable";
$status = Video::SORT_TYPE_VIEWABLE;
$ignoreGroup = false;
if (self::isAPISecretValid()) {
$status = "";
$ignoreGroup = true;
}
// getVideo($id = "", $status = "viewable", $ignoreGroup = false, $random = false, $suggestedOnly = false, $showUnlisted = false, $ignoreTags = false, $activeUsersOnly = true)
// getVideo($id = "", $status = Video::SORT_TYPE_VIEWABLE, $ignoreGroup = false, $random = false, $suggestedOnly = false, $showUnlisted = false, $ignoreTags = false, $activeUsersOnly = true)
$rows = [Video::getVideo($parameters['videos_id'], $status, $ignoreGroup, false, false, true)];
$totalRows = empty($rows) ? 0 : 1;
} elseif (self::isAPISecretValid()) {
$rows = Video::getAllVideos("viewable", false, true);
$totalRows = Video::getTotalVideos("viewable", false, true);
$rows = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, true);
$totalRows = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLE, false, true);
} elseif (!empty($parameters['clean_title'])) {
$rows = Video::getVideoFromCleanTitle($parameters['clean_title']);
$totalRows = empty($rows) ? 0 : 1;
@ -1209,7 +1209,7 @@ class API extends PluginAbstract
require_once $global['systemRootPath'] . 'objects/video.php';
$obj = $this->startResponseObject($parameters);
if (self::isAPISecretValid()) {
$totalRows = Video::getTotalVideos("viewable", false, true);
$totalRows = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLE, false, true);
} else {
$totalRows = Video::getTotalVideos();
}
@ -1694,8 +1694,8 @@ class API extends PluginAbstract
require_once $global['systemRootPath'] . 'objects/video.php';
$obj = $this->startResponseObject($parameters);
if (self::isAPISecretValid()) {
$rows = Video::getAllVideos("viewable", false, true);
$totalRows = Video::getTotalVideos("viewable", false, true);
$rows = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, true);
$totalRows = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLE, false, true);
} elseif (!empty($parameters['videos_id'])) {
$rows = [Video::getVideo($parameters['videos_id'])];
$totalRows = empty($rows) ? 0 : 1;

View file

@ -509,6 +509,26 @@ class AVideoPlugin
return false;
}
/**
* Undocumented function
*
* @param String $name
* @param String $parameterName
* @param [type] $parameterValue if it is null it will be removed
* @return void
*/
public static function setParameter($name, $parameterName, $parameterValue = null)
{
$obj = AVideoPlugin::getObjectData($name);
if(!isset($parameterValue)){
unset($obj->{$parameterName});
return false;
}else{
$obj->{$parameterName} = $parameterValue;
return true;
}
}
public static function setObjectDataParameter($name, $parameterName, $value)
{
$p = static::loadPlugin($name);

View file

@ -555,7 +555,7 @@ Disallow: *action=tagsearch*
}
$obj = $this->getDataObject();
$video = Video::getVideo($videos_id, "viewable", true);
$video = Video::getVideo($videos_id, Video::SORT_TYPE_VIEWABLE, true);
if (!empty($video['rrating']) && empty($_GET['rrating'])) {
$suffix = strtoupper(str_replace("-", "", $video['rrating']));
eval("\$show = \$obj->askRRatingConfirmationBeforePlay_$suffix;");

View file

@ -68,10 +68,10 @@ function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord,
$_REQUEST['current'] = $_GET['page'];
$_REQUEST['rowCount'] = $rowCount;
$videoStatus = 'viewableNotUnlisted';
$videoStatus = Video::SORT_TYPE_VIEWABLENOTUNLISTED;
if ($getName == 'privateContentOrder') {
$videoStatus = 'privateOnly';
$videoStatus = Video::SORT_TYPE_PRIVATEONLY;
$ignoreGroup = true;
}
$total = Video::getTotalVideos($videoStatus, false, $ignoreGroup);
@ -559,7 +559,7 @@ function createGalleryLiveSectionVideo($video, $zindex, $screenColsLarge = 0, $s
function createChannelItem($users_id, $photoURL = "", $identification = "", $rowCount = 12)
{
$total = Video::getTotalVideos("viewable", $users_id);
$total = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLE, $users_id);
if (empty($total)) {
return false;
}
@ -592,7 +592,7 @@ function createChannelItem($users_id, $photoURL = "", $identification = "", $row
$_POST['sort']['created'] = "DESC";
unsetCurrentPage();
$_REQUEST['rowCount'] = $rowCount;
$videos = Video::getAllVideos("viewable", $users_id);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, $users_id);
createGallerySection($videos);
?>
</div>
@ -627,7 +627,7 @@ function getTrendingVideos($rowCount = 12, $screenColsLarge = 0, $screenColsMedi
$_GET['sort']['trending'] = 1;
$_REQUEST['current'] = getCurrentPage();
$_REQUEST['rowCount'] = $rowCount;
$videos = Video::getAllVideos("viewableNotUnlisted");
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED);
// need to add dechex because some times it return an negative value and make it fails on javascript playlists
echo "<link href=\"" . getURL('plugin/Gallery/style.css') . "\" rel=\"stylesheet\" type=\"text/css\"/><div class='row gallery '>";
$countCols = createGallerySection($videos, true, false, $screenColsLarge, $screenColsMedium, $screenColsSmall, $screenColsXSmall);

View file

@ -5,11 +5,11 @@ if (empty($crc)) {
if ($obj->BigVideo && empty($_GET['showOnly'])) {
if (!empty($obj->useSuggestedVideosAsCarouselInBigVideo)) {
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
//$videoRows = Video::getAllVideosLight("viewable", !$obj->hidePrivateVideos, false, true);
//getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
//$videoRows = Video::getAllVideosLight(Video::SORT_TYPE_VIEWABLE, !$obj->hidePrivateVideos, false, true);
$_REQUEST['rowCount'] = 20;
unsetCurrentPage();
$videoRows = Video::getAllVideos("viewable", false, !$obj->hidePrivateVideos, array(), false, false, true, true);
$videoRows = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, !$obj->hidePrivateVideos, array(), false, false, true, true);
}
if (empty($videoRows)) {
$videoRows = array($video);

View file

@ -23,7 +23,7 @@ if (!empty($currentCat) && empty($_GET['showOnly'])) {
$_POST['sort']['likes'] = "DESC";
$_REQUEST['catName'] = $currentCat['clean_name'];
$_REQUEST['doNotShowCatChilds'] = 1;
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
global $contentSearchFound;
if (empty($contentSearchFound)) {
$contentSearchFound = !empty($videos);
@ -47,7 +47,7 @@ if (!empty($currentCat) && empty($_GET['showOnly'])) {
foreach ($rows as $key => $value) {
$_REQUEST['catName'] = $value['clean_name'];
$_REQUEST['doNotShowCatChilds'] = 0;
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
createCategorySection($videos);
}
}
@ -95,7 +95,7 @@ function createCategorySection($videos)
<div class="col-sm-12 gallerySection" >
<?php
$_REQUEST['catName'] = $videos[0]['clean_category'];
$total = Video::getTotalVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$total = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
$totalPages = ceil($total / getRowCount());
//var_dump($totalPages, $page);
$categoryURL = "{$global['webSiteRootURL']}cat/{$videos[0]['clean_category']}/page/";

View file

@ -31,7 +31,7 @@ $itemsPerPage = 4;
<?php
foreach ($tags as $value) {
$_POST['disableAddTo'] = 0;
$totalVideos = VideoTags::getTotalVideosFromTagsId($value['tags_id'], 'viewableNotUnlisted');
$totalVideos = VideoTags::getTotalVideosFromTagsId($value['tags_id'], Video::SORT_TYPE_VIEWABLENOTUNLISTED);
//var_dump($value['name'], $totalVideos);
if (empty($totalVideos)) {
continue;
@ -52,7 +52,7 @@ $itemsPerPage = 4;
setRowCount($obj->SubscribedTagsRowCount);
$old_tags_id = @$_GET['tags_id'];
$_GET['tags_id'] = $value['tags_id'];
$videos = Video::getAllVideos("viewable");
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE);
$_GET['tags_id'] = $old_tags_id;
createGallerySection($videos);
?>

View file

@ -12,7 +12,7 @@ if (!empty($liveobj) && empty($liveobj->doNotShowLiveOnCategoryList)) {
unset($_POST['sort']);
$_POST['sort']['v.created'] = "DESC";
$_POST['sort']['likes'] = "DESC";
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
//exit;
if (empty($videos)) {
echo '<!-- empty videos -->';

View file

@ -41,10 +41,10 @@ if ($obj->sortReverseable) {
$orderString = str_replace("&&", "&", $orderString);
$orderString = str_replace("//", "/", $orderString);
}
$video = Video::getVideo("", "viewable", !$obj->hidePrivateVideos, false, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, !$obj->hidePrivateVideos, false, true);
$debugLastGetVideoSQL = $lastGetVideoSQL;
if (empty($video)) {
$video = Video::getVideo("", "viewable", !$obj->hidePrivateVideos, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, !$obj->hidePrivateVideos, true);
$debugLastGetVideoSQL = $lastGetVideoSQL;
}//var_dump(!empty($video), debug_backtrace());exit;
$total = 0;

View file

@ -15,7 +15,7 @@ ImageGallery::dieIfIsInvalid($videos_id);
//$global['bypassSameDomainCheck'] = 1;
User::loginFromRequestIfNotLogged();
$video = Video::getVideo($videos_id, "viewable", false, false, false, true);
$video = Video::getVideo($videos_id, Video::SORT_TYPE_VIEWABLE, false, false, false, true);
Video::unsetAddView($video['id']);
AVideoPlugin::getEmbed($video['id']);

View file

@ -3509,7 +3509,7 @@ Click <a href=\"{link}\">here</a> to join our live.";
$sql .= " AND u.status = 'a' ";
}
if ($status == "publicOnly") {
if ($status == Video::SORT_TYPE_PUBLICONLY) {
$sql .= " AND v.public = 1 ";
} elseif (!empty($status)) {
$sql .= " AND v.`public` = '{$status}'";

View file

@ -114,8 +114,8 @@ if (!$liveFound && AVideoPlugin::isEnabledByName('LiveLinks')) {
if (!$liveFound) {
$_POST['rowCount'] = 1;
$_POST['sort']['created'] = 'DESC';
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds = 0)
$videos = Video::getAllVideos('viewableNotUnlisted', false, false, [], false, false, true, false, null, Video::$videoTypeVideo);
//getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds = 0)
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, false, [], false, false, true, false, null, Video::$videoTypeVideo);
if (empty($videos)) {
videoNotFound('');
}

View file

@ -333,7 +333,7 @@ class LiveLinks extends PluginAbstract {
$sql .= " AND u.status = 'a' ";
}
if ($status == "publicOnly") {
if ($status == Video::SORT_TYPE_PUBLICONLY) {
$sql .= " AND v.`type` = 'public' ";
} elseif (!empty($status)) {
$sql .= " AND v.`status` = '{$status}'";

View file

@ -21,7 +21,7 @@ if (!User::canStream()) {
$pl = new PlayList($_REQUEST['program_id']);
//var_dump($pl->getName());exit;
//$videosArrayId = PlayList::getVideosIdFromPlaylist($_REQUEST['program_id']);
//$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
//$videosP = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, true, $videosArrayId, false, true);
//var_dump( $videosP);exit;
$_page = new Page(array('Schedule Playlist'));
$_page->setExtraStyles(

View file

@ -665,7 +665,7 @@ class PlayerSkins extends PluginAbstract
$catName = @$_REQUEST['catName'];
$cat = new Category($video->getCategories_id());
$_REQUEST['catName'] = $cat->getClean_name();
$next_video = Video::getVideo('', 'viewable', false, true);
$next_video = Video::getVideo('', Video::SORT_TYPE_VIEWABLE, false, true);
$_REQUEST['catName'] = $catName;
if (!empty($next_video['id'])) {
$nextURL = Video::getURLFriendly($next_video['id'], isEmbed());

View file

@ -23,9 +23,9 @@ if(!empty($ShortsObj)){
$_POST['sort']['trending'] = 1;
$_REQUEST['rowCount'] = 12;
$videos['recordsTotal'] = Video::getTotalVideos("viewable", false, false, false, true, false,'audio_and_video', $shortMaxDurationInSeconds);
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds=0) {
$videos['data'] = Video::getAllVideos("viewable", false, false, [], false, false, true, false, null, 'audio_and_video', $shortMaxDurationInSeconds);
$videos['recordsTotal'] = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLE, false, false, false, true, false,'audio_and_video', $shortMaxDurationInSeconds);
//getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = [], $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $is_serie = null, $type = '', $max_duration_in_seconds=0) {
$videos['data'] = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, false, [], false, false, true, false, null, 'audio_and_video', $shortMaxDurationInSeconds);
foreach ($videos['data'] as $key => $video) {
$images = object_to_array(Video::getImageFromFilename($video['filename'], $video['type']));
$videos['data'][$key]['images'] = $images;

View file

@ -90,20 +90,20 @@ class TagsHasVideos extends ObjectYPT {
return $rows;
}
static function getTotalVideosFromTagsId($tags_id, $status = "viewable") {
static function getTotalVideosFromTagsId($tags_id, $status = Video::SORT_TYPE_VIEWABLE) {
global $global;
if (!static::isTableInstalled()) {
return false;
}
$sql = "SELECT count(thv.id) as total FROM " . static::getTableName() . " thv LEFT JOIN videos v ON v.id = thv.videos_id "
. " WHERE tags_id=? ";
if ($status == "viewable") {
if ($status == Video::SORT_TYPE_VIEWABLE) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus(true)) . "')";
} elseif ($status == "viewableNotUnlisted") {
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
} elseif ($status == "publicOnly") {
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
$sql .= " AND v.status IN ('a', 'k') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
} elseif ($status == "privateOnly") {
} elseif ($status == Video::SORT_TYPE_PRIVATEONLY) {
$sql .= " AND v.status IN ('a', 'k') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
} elseif (!empty($status)) {
$sql .= " AND v.status = '{$status}'";
@ -117,20 +117,20 @@ class TagsHasVideos extends ObjectYPT {
return intval($fullData['total']);
}
static function getAllVideosFromTagsId($tags_id, $limit = 100, $status = "viewable") {
static function getAllVideosFromTagsId($tags_id, $limit = 100, $status = Video::SORT_TYPE_VIEWABLE) {
global $global;
if (!static::isTableInstalled()) {
return false;
}
$sql = "SELECT v.*, thv.* FROM " . static::getTableName() . " thv LEFT JOIN videos v ON v.id = thv.videos_id "
. " WHERE thv.tags_id=? ";
if ($status == "viewable") {
if ($status == Video::SORT_TYPE_VIEWABLE) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus(true)) . "')";
} elseif ($status == "viewableNotUnlisted") {
} elseif ($status == Video::SORT_TYPE_VIEWABLENOTUNLISTED) {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus(false)) . "')";
} elseif ($status == "publicOnly") {
} elseif ($status == Video::SORT_TYPE_PUBLICONLY) {
$sql .= " AND v.status IN ('a', 'k') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) = 0";
} elseif ($status == "privateOnly") {
} elseif ($status == Video::SORT_TYPE_PRIVATEONLY) {
$sql .= " AND v.status IN ('a', 'k') AND (SELECT count(id) FROM videos_group_view as gv WHERE gv.videos_id = v.id ) > 0";
} elseif (!empty($status)) {
$sql .= " AND v.status = '{$status}'";
@ -145,7 +145,7 @@ class TagsHasVideos extends ObjectYPT {
return $fullData;
}
static function getAllVideosIdFromTagsId($tags_id, $limit = 100, $status = "viewable") {
static function getAllVideosIdFromTagsId($tags_id, $limit = 100, $status = Video::SORT_TYPE_VIEWABLE) {
global $global;
$rows = self::getAllVideosFromTagsId($tags_id, $limit, $status);
$ids = array();

View file

@ -137,11 +137,11 @@ class VideoTags extends PluginAbstract {
return $array;
}
static function getAllVideosIdFromTagsId($tags_id, $limit = 100, $status = "viewable") {
static function getAllVideosIdFromTagsId($tags_id, $limit = 100, $status = Video::SORT_TYPE_VIEWABLE) {
return TagsHasVideos::getAllVideosIdFromTagsId($tags_id, $limit, $status);
}
static function getTotalVideosFromTagsId($tags_id, $status = "viewable") {
static function getTotalVideosFromTagsId($tags_id, $status = Video::SORT_TYPE_VIEWABLE) {
return TagsHasVideos::getTotalVideosFromTagsId($tags_id, $status);
}

View file

@ -26,7 +26,7 @@ if(file_exists($progressFile)){
unlink($progressFile);
}
$plugin = AVideoPlugin::loadPluginIfEnabled("VimeoAPI");
$videos = Video::getAllVideosLight("viewable", false, true, false);
$videos = Video::getAllVideosLight(Video::SORT_TYPE_VIEWABLE, false, true, false);
$obj->msg = "Process start at ". date("Y-m-d h:i:s"). " Total of ".count($videos)." Videos\n";

View file

@ -41,20 +41,26 @@ class YouPHPFlix2 extends PluginAbstract
$obj->hidePrivateVideos = false;
$obj->pageDots = true;
$obj->Suggested = true;
$obj->SuggestedCustomTitle = 'Suggested';
$obj->SuggestedAutoPlay = true;
$obj->PlayList = true;
$obj->PlayListAutoPlay = true;
$obj->Channels = true;
$obj->ChannelsAutoPlay = true;
$obj->Trending = true;
$obj->TrendingCustomTitle = 'Trending';
$obj->TrendingAutoPlay = true;
$obj->DateAdded = true;
$obj->DateAddedCustomTitle = 'Date added (newest)';
$obj->DateAddedAutoPlay = true;
$obj->MostPopular = true;
$obj->MostPopularCustomTitle = "Most popular";
$obj->MostPopularAutoPlay = true;
$obj->MostWatched = true;
$obj->MostWatchedCustomTitle = 'Most watched';
$obj->MostWatchedAutoPlay = true;
$obj->SortByName = false;
$obj->SortByNameCustomTitle = 'Alphabetical';
$obj->SortByNameAutoPlay = true;
$obj->Categories = true;
$obj->CategoriesAutoPlay = true;
@ -149,6 +155,9 @@ class YouPHPFlix2 extends PluginAbstract
} else {
$js .= '<script>var playVideoOnFullscreen = false;</script>';
}
if(!empty($global['channelToYouPHPFlix2'])){
$js .= '<script src="' . getURL('plugin/YouPHPFlix2/view/js/addChannel.js') . '"></script>';
}
$js .= '<script src="' . getURL('plugin/YouPHPFlix2/view/js/fullscreen.js') . '"></script>';
return $js;
}
@ -199,7 +208,7 @@ class YouPHPFlix2 extends PluginAbstract
if ($obj->PlayList) {
$plObj = AVideoPlugin::getDataObjectIfEnabled('PlayLists');
if (!empty($plObj)) {
$programs = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos, array(), false, false, true, false, true);
$programs = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos, array(), false, false, true, false, true);
cleanSearchVar();
if (!empty($programs)) {
$countSections++;
@ -289,4 +298,45 @@ class YouPHPFlix2 extends PluginAbstract
}
return $object;
}
public static function getAddChannelToYouPHPFlix2Button($users_id)
{
global $global, $config;
$filePath = $global['systemRootPath'] . 'plugin/YouPHPFlix2/buttonChannelToYouPHPFlix2.php';
$varsArray = array('users_id' => $users_id);
$button = getIncludeFileContent($filePath, $varsArray);
return $button;
}
public static function setAddChannelToYouPHPFlix2($users_id, $add)
{
global $global, $config;
$users_id = intval($users_id);
$add = intval($add);
$obj = AVideoPlugin::getObjectData('YouPHPFlix2');
$parameterName = "Channel_{$users_id}_";
if (!empty($add)) {
$obj->{$parameterName} = true;
$obj->{"{$parameterName}CustomTitle"} = User::getNameIdentificationById($users_id);
$obj->{"{$parameterName}Autoplay"} = true;
} else {
unset($obj->{$parameterName});
unset($obj->{"{$parameterName}CustomTitle"});
unset($obj->{"{$parameterName}Autoplay"});
}
return AVideoPlugin::setObjectData('YouPHPFlix2', $obj);
}
public static function isChannelToYouPHPFlix2($users_id)
{
$obj = AVideoPlugin::getObjectData('YouPHPFlix2');
$parameterName = "Channel_{$users_id}_";
return !empty($obj->{$parameterName});
}
}

View file

@ -0,0 +1,26 @@
<?php
$titleBtn1 = __('Add to first page');
$titleBtn2 = __('Remove first page');
global $global;
$global['channelToYouPHPFlix2'] = 1;
$class = '';
if(YouPHPFlix2::isChannelToYouPHPFlix2($users_id)){
$class = 'isChannelToYouPHPFlix2';
}
if(!User::isAdmin()){
return '';
}
?>
<div class="ChannelToYouPHPFlix2<?php echo $users_id; ?> <?php echo $class; ?>" style="display: inline-block;">
<button class="btn btn-primary btn-xs addChannelToYouPHPFlix2" onclick="channelToYouPHPFlix2(<?php echo $users_id; ?>, 1);" data-toggle="tooltip" title="<?php echo $titleBtn1; ?>" >
<i class="fas fa-plus"></i> <small><?php echo $titleBtn1; ?></small>
</button>
<button class="btn btn-danger btn-xs removeChannelFromYouPHPFlix2" onclick="channelToYouPHPFlix2(<?php echo $users_id; ?>, 0);" data-toggle="tooltip" title="<?php echo $titleBtn2; ?>" >
<i class="fas fa-trash"></i> <small><?php echo $titleBtn2; ?></small>
</button>
</div>
<script>
$(document).ready(function () {
});
</script>

View file

@ -0,0 +1,32 @@
<?php
require_once '../../videos/configuration.php';
header('Content-Type: application/json');
$resp = new stdClass();
$resp->error = true;
$resp->msg = "";
$resp->users_id = intval($_REQUEST['users_id']);
$resp->add = intval($_REQUEST['add']);
if (empty($resp->users_id)) {
forbiddenPage('User is empty');
}
if (!User::isAdmin()) {
forbiddenPage('Admin only');
}
$plugin = AVideoPlugin::loadPluginIfEnabled('YouPHPFlix2');
if (empty($plugin)) {
forbiddenPage('YouPHPFlix2 not enabled');
}
$resp->response = YouPHPFlix2::setAddChannelToYouPHPFlix2($resp->users_id, $resp->add);
$resp->error = empty($resp->response);
die(json_encode($resp));

View file

@ -2,9 +2,9 @@
global $advancedCustom;
$uid = uniqid();
$obj2 = AVideoPlugin::getObjectData("YouPHPFlix2");
$video = Video::getVideo("", "viewableNotUnlisted", !$obj2->hidePrivateVideos, false, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLENOTUNLISTED, !$obj2->hidePrivateVideos, false, true);
if (empty($video)) {
$video = Video::getVideo("", "viewableNotUnlisted", !$obj2->hidePrivateVideos, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLENOTUNLISTED, !$obj2->hidePrivateVideos, true);
}
if ($obj->BigVideo && empty($_GET['showOnly'])) {
if (empty($video)) {

View file

@ -1,4 +1,4 @@
@import "../../../Gallery/style.css";
/*@import "../../../YouPHPFlix2/style.css";*/
body {
padding-top: 50px;
}
@ -403,4 +403,12 @@ body.fullscreen{
.rowSerie{
display: inline-table;
}
.isChannelToYouPHPFlix2 .addChannelToYouPHPFlix2, .removeChannelFromYouPHPFlix2{
display: none;
}
.isChannelToYouPHPFlix2 .removeChannelFromYouPHPFlix2 {
display: inline-block;
}

View file

@ -0,0 +1,19 @@
function channelToYouPHPFlix2(users_id, add) {
$.ajax({
url: webSiteRootURL + 'plugin/YouPHPFlix2/channelToYouPHPFlix2.json.php',
method: 'POST',
data: {'users_id': users_id, 'add': add},
success: function (response) {
avideoResponse(response);
if(!response.error){
if(response.add){
$('.ChannelToYouPHPFlix2'+response.users_id).addClass('isChannelToYouPHPFlix2');
}else{
$('.ChannelToYouPHPFlix2'+response.users_id).removeClass('isChannelToYouPHPFlix2');
}
}
}
});
}

View file

@ -24,14 +24,14 @@ $percent = 90;
$dataFlickirty->autoPlay = 10000;
}
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false)
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos, array(), false, false, true, true);
//getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false)
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos, array(), false, false, true, true);
if (!empty($videos)) {
?>
<div class="row topicRow">
<h2>
<i class="glyphicon glyphicon-sort-by-attributes"></i> <?php
echo __("Suggested");
echo __($obj->SuggestedCustomTitle);
?>
</h2>
<!-- Date Added -->
@ -43,9 +43,27 @@ $percent = 90;
<?php
}
}
$channels = $users_id_array = array();
require_once $global['systemRootPath'] . 'objects/Channel.php';
if ($obj->Channels) {
require_once $global['systemRootPath'] . 'objects/Channel.php';
$users_id_array = VideoStatistic::getUsersIDFromChannelsWithMoreViews();
$channels = Channel::getChannels(true, "u.id, '" . implode(",", $users_id_array) . "'");
}
foreach ($obj as $key => $value) {
if ($value === true && preg_match('/Channel_([0-9]+)_$/', $key, $matches)) {
$users_id = intval($matches[1]);
if (in_array($users_id, $users_id_array)) {
continue;
}
$users_id_array[] = $users_id;
}
}
if (!empty($users_id_array)) {
$channels2 = Channel::getChannels(true, '', $users_id_array);
$channels = array_merge($channels, $channels2);
}
if (!empty($channels)) {
$dataFlickirty = new stdClass();
$dataFlickirty->wrapAround = true;
$dataFlickirty->pageDots = !empty($obj->pageDots);
@ -56,16 +74,13 @@ $percent = 90;
if ($obj->ChannelsAutoPlay) {
$dataFlickirty->autoPlay = 10000;
}
$users_id_array = VideoStatistic::getUsersIDFromChannelsWithMoreViews();
$channels = Channel::getChannels(true, "u.id, '" . implode(",", $users_id_array) . "'");
if (!empty($channels)) {
$countChannels = 0;
$countChannels = 0;
foreach ($channels as $channel) {
if ($countChannels > 5) {
break;
}
$_POST['sort']['created'] = "DESC";
$videos = Video::getAllVideos("viewable", $channel['id']);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, $channel['id']);
unset($_POST['sort']['created']);
if (empty($videos)) {
continue;
@ -73,7 +88,7 @@ $percent = 90;
$countChannels++;
$link = User::getChannelLinkFromChannelName($channel["channelName"]);
?>
<div class="row topicRow">
<div class="row topicRow channelRow channel_<?php echo $channel["id"]; ?>">
<h2>
<a href="<?php echo $link; ?>">
<img src="<?php echo User::getPhoto($channel["id"]); ?>" class="img img-responsive pull-left" style="max-width: 18px; max-height: 18px; margin-right: 5px;">
@ -88,9 +103,9 @@ $percent = 90;
<?php
}
}
}
$search = getSearchVar();
if (empty($search)) {
$plObj = AVideoPlugin::getDataObjectIfEnabled('PlayLists');
@ -133,7 +148,7 @@ $percent = 90;
}
}
if ($obj->PlayList) {
$programs = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos, array(), false, false, true, false, true);
$programs = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos, array(), false, false, true, false, true);
cleanSearchVar();
if (!empty($programs)) {
foreach ($programs as $serie) {
@ -195,14 +210,14 @@ $percent = 90;
$_POST['sort']['trending'] = "";
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
unset($_POST['sort']['trending']);
if (!empty($videos)) {
?>
<div class="row topicRow">
<h2>
<i class="glyphicon glyphicon-sort-by-attributes"></i> <?php
echo __("Trending");
echo __($obj->TrendingCustomTitle);
?>
</h2>
<!-- Date Added -->
@ -229,13 +244,13 @@ $percent = 90;
unset($_POST['sort']);
$_POST['sort']['created'] = "DESC";
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
if (!empty($videos)) {
?>
<div class="row topicRow">
<h2>
<i class="glyphicon glyphicon-sort-by-attributes"></i> <?php
echo __("Date added (newest)");
echo __($obj->DateAddedCustomTitle);
?>
</h2>
<!-- Date Added -->
@ -265,12 +280,12 @@ $percent = 90;
unset($_POST['sort']);
$_POST['sort']['likes'] = "DESC";
$_POST['sort']['v.created'] = "DESC";
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
?>
<div class="row topicRow">
<span class="md-col-12">&nbsp;</span>
<h2>
<i class="glyphicon glyphicon-thumbs-up"></i> <?php echo __("Most popular"); ?>
<i class="glyphicon glyphicon-thumbs-up"></i> <?php echo __($obj->MostPopularCustomTitle); ?>
</h2>
<!-- Most Popular -->
<?php
@ -299,12 +314,12 @@ $percent = 90;
unset($_POST['sort']);
$_POST['sort']['views_count'] = "DESC";
$_POST['sort']['created'] = "DESC";
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
?>
<span class="md-col-12">&nbsp;</span>
<div class="row topicRow">
<h2>
<i class="glyphicon glyphicon-eye-open"></i> <?php echo __("Most watched"); ?>
<i class="glyphicon glyphicon-eye-open"></i> <?php echo __($obj->MostWatchedCustomTitle); ?>
</h2>
<!-- Most watched -->
<?php
@ -331,12 +346,12 @@ $percent = 90;
unset($_POST['sort']);
$_POST['sort']['title'] = "ASC";
$_POST['sort']['created'] = "DESC";
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj->hidePrivateVideos);
?>
<span class="md-col-12">&nbsp;</span>
<div class="row topicRow">
<h2>
<i class="fas fa-sort-alpha-down"></i> <?php echo __("Alphabetical"); ?>
<i class="fas fa-sort-alpha-down"></i> <?php echo __($obj->SortByNameCustomTitle); ?>
</h2>
<!-- Most watched -->
<?php
@ -407,6 +422,7 @@ $percent = 90;
</script>
<?php
}
unset($_POST['sort']);
unset($_REQUEST['current']);
unset($_REQUEST['rowCount']);

View file

@ -93,7 +93,7 @@ $videosCounter = 0;
$_POST['sort']['likes'] = "DESC";
TimeLogStart("modeFlixCategory.php getAllVideos");
$videos = Video::getAllVideos("viewableNotUnlisted", false, !$obj2->hidePrivateVideos);
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED, false, !$obj2->hidePrivateVideos);
TimeLogEnd("modeFlixCategory.php getAllVideos", __LINE__);
TimeLogEnd($timeLog2, __LINE__);

View file

@ -26,7 +26,7 @@ if(file_exists($progressFile)){
unlink($progressFile);
}
$plugin = AVideoPlugin::loadPluginIfEnabled("YouTubeAPI");
$videos = Video::getAllVideosLight("viewable", false, true, false);
$videos = Video::getAllVideosLight(Video::SORT_TYPE_VIEWABLE, false, true, false);
$obj->msg = "Process start at ". date("Y-m-d h:i:s"). " Total of ".count($videos)." Videos\n";

View file

@ -25,7 +25,7 @@ if (empty($channelPassword) && !$isMyChannel) {
$status = 'a';
$showUnlisted = false;
} else {
$status = 'viewable';
$status = Video::SORT_TYPE_VIEWABLE;
$showUnlisted = true;
}

View file

@ -79,14 +79,14 @@ unset($_POST['current']);
$rowCount = $_POST['rowCount'];
$_REQUEST['rowCount'] = 6;
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
//getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
if (empty($videosArrayId) && ($playlist['status'] == "favorite" || $playlist['status'] == "watch_later")) {
unset($playlists[$key]);
continue;
} elseif (empty($videosArrayId)) {
$videosP = [];
} else {
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
$videosP = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, true, $videosArrayId, false, true);
//var_dump($videosArrayId);exit;
} //var_dump($videosArrayId, $videosP); exit;
$totalDuration = 0;

View file

@ -69,14 +69,14 @@ $_page->setExtraStyles(
$videosArrayId = PlayList::getVideosIdFromPlaylist($program['id']);
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);
//getAllVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
//getAllVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $videosArrayId = array(), $getStatistcs = false, $showUnlisted = false, $activeUsersOnly = true)
if (empty($videosArrayId) && ($program['status'] == "favorite" || $program['status'] == "watch_later")) {
unset($programs[$key]);
continue;
} elseif (empty($videosArrayId)) {
$videosP = [];
} else {
$videosP = Video::getAllVideos("viewable", false, true, $videosArrayId, false, true);
$videosP = Video::getAllVideos(Video::SORT_TYPE_VIEWABLE, false, true, $videosArrayId, false, true);
} //var_dump($videosArrayId, $videosP);exit;
@$timesC[__LINE__] += microtime(true) - $startC;
$startC = microtime(true);

View file

@ -29,7 +29,7 @@ $obj->date = date("Y-m-d H:i:s");
$obj->MySQLDate = getMySQLDate();
$obj->version = $config->getVersion();
$obj->plugins = Plugin::getAvailablePluginsBasic();
///getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $type = '')
///getTotalVideos($status = Video::SORT_TYPE_VIEWABLE, $showOnlyLoggedUserVideos = false, $ignoreGroup = false, $showUnlisted = false, $activeUsersOnly = true, $suggestedOnly = false, $type = '')
$obj->totalVideos = Video::getTotalVideos('', false, true, true);
$obj->totalUsers = User::getTotalUsers(true, 'a');
$obj->totalChannels = Channel::getTotalChannels();;

View file

@ -60,7 +60,7 @@ if (!empty($video['next_videos_id'])) {
$catName = @$_REQUEST['catName'];
$cat = new Category($video['categories_id']);
$_REQUEST['catName'] = $cat->getClean_name();
$next_video = Video::getVideo('', 'viewable', false, true);
$next_video = Video::getVideo('', Video::SORT_TYPE_VIEWABLE, false, true);
$_REQUEST['catName'] = $catName;
if (!empty($next_video['id'])) {
$obj->nextURL = Video::getURLFriendly($next_video['id']);

View file

@ -7,7 +7,7 @@ $isModeYouTube = 1;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
//var_dump(Video::getVideo(73, "viewable", false, false, false, true));
//var_dump(Video::getVideo(73, Video::SORT_TYPE_VIEWABLE, false, false, false, true));
//var_dump(Video::userGroupAndVideoGroupMatch(User::getId(), 73));exit;
//var_dump(Video::getUserGroups());
$TimeLogLimitMY = 0.5;
@ -124,18 +124,18 @@ if (!empty($evideo)) {
}
if (empty($video) && !empty($videos_id)) {
$video = Video::getVideo($videos_id, "viewable", false, false, false, true);
$video = Video::getVideo($videos_id, Video::SORT_TYPE_VIEWABLE, false, false, false, true);
//var_dump($_GET, $video);exit;
//var_dump('Line: '.__LINE__, $_REQUEST['v'], $video);exit;
}
TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
if (empty($video)) {
$video = Video::getVideo("", "viewable", false, false, true, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, false, false, true, true);
}
TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
if (empty($video)) {
$video = Video::getVideo("", "viewable", false, false, false, true);
$video = Video::getVideo("", Video::SORT_TYPE_VIEWABLE, false, false, false, true);
}
TimeLogEnd($timeLogNameMY, __LINE__, $TimeLogLimitMY);
if (empty($video)) {

View file

@ -4,7 +4,7 @@ if (empty($global['systemRootPath'])) {
}
require_once $global['systemRootPath'] . 'objects/subscribe.php';
if ((empty($video) || !is_array($video)) && !empty($_GET['videos_id'])) {
$video = Video::getVideo(intval($_GET['videos_id']), "viewable", true, false, true, true);
$video = Video::getVideo(intval($_GET['videos_id']), Video::SORT_TYPE_VIEWABLE, true, false, true, true);
$created = !empty($video['videoCreation']) ? $video['videoCreation'] : $video['created'];
$video['creator'] = Video::getCreatorHTML($video['users_id'], '<div class="clearfix"></div><small>' . humanTiming(_strtotime($created)) . '</small>');
$source = Video::getSourceFile($video['filename']);

View file

@ -24,7 +24,7 @@ if (!empty($evideo)) {
} else {
$videos_id = getVideos_id();
if (!empty($videos_id)) {
$video = Video::getVideo($videos_id, "viewable", false, false, false, true);
$video = Video::getVideo($videos_id, Video::SORT_TYPE_VIEWABLE, false, false, false, true);
} elseif (!empty($_GET['videoName'])) {
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
}

View file

@ -64,12 +64,12 @@ $searchForVideosNow = preg_match('/videosList.php$/', $_SERVER['PHP_SELF']);
//var_dump($_POST['sort']);
if ($searchForVideosNow) {
$videos = Video::getAllVideos("viewableNotUnlisted");
$videos = Video::getAllVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED);
if (empty($videos)) {
//echo '<div id="videosList"></div>';
exit;
}
$total = Video::getTotalVideos("viewableNotUnlisted");
$total = Video::getTotalVideos(Video::SORT_TYPE_VIEWABLENOTUNLISTED);
$totalPages = ceil($total / getRowCount());
if (empty($totalPages)) {
$totalPages = 1;