Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/WWBN/AVideo
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jun 30, 2020
2 parents 0c442a2 + 6263afb commit 98162bc
Show file tree
Hide file tree
Showing 15 changed files with 849 additions and 58 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
/plugin/CreateUserManager/
/plugin/ImportFromOtherVideoPlatform/
/plugin/PayPerView/
/plugin/PayPerViewLive/
/plugin/VideoHLS/
/plugin/Chat2/
/plugin/User_Controll/
Expand Down
31 changes: 22 additions & 9 deletions install/getAllWebp.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@
if (!isCommandLineInterface()) {
return die('Command Line only');
}

$global['limitForUnlimitedVideos'] = -1;
$videos = video::getAllVideosLight("", false, true);
$count = 0;
foreach ($videos as $value) {
if($value['type']!='video'){
$count++;
echo "\n Start ($count) ******\n";
if ($value['type'] != 'video') {
echo "\nType ({$value['type']}) is not a video: " . $value['title'];
echo "\n End ($count) ******\n";
ob_flush();
continue;
}
echo "\nStart: ".$value['title'];
echo "\nStart: " . $value['title'];
ob_flush();
$videoFileName = $value['filename'];
$destination = "{$global['systemRootPath']}videos/{$videoFileName}.webp";
if (!file_exists($destination)) {
echo "\nGet webp";
ob_flush();
$videosURL = getFirstVideoURL($videoFileName);
$videoPath = getFirstVideoPath($videoFileName);
$duration = (Video::getItemDurationSeconds(Video::getDurationFromFile($videoPath)) / 2);
Expand All @@ -25,23 +33,28 @@
$file_headers = @get_headers($url);
if (!$file_headers || $file_headers[0] == 'HTTP/1.1 404 Not Found') {
echo "\nGet webp not found {$url}";
ob_flush();
continue;
} else {
$url = $config->getEncoderURL() . "getImageMP4/" . base64_encode($url) . "/webp/{$duration}";
$image = url_get_contents($url);
file_put_contents($destination, $image);
}
}else{
} else {
echo "\nVideo URL empty";
ob_flush();
}

echo "\nGet done";
}else{
echo "\nFile exists: ".$value['title'];
ob_flush();
} else {
echo "\nFile exists: " . $value['title'];
ob_flush();
}
echo "\nFinish: ".$value['title'];

echo "\nFinish: " . $value['title'];
echo "\n******\n";
ob_flush();
}

function getFirstVideoURL($videoFileName) {
Expand Down
22 changes: 21 additions & 1 deletion objects/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,13 @@ static function getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos =
if (!empty($_GET['catName'])) {
$cn .= ", c.clean_name as cn";
}
if (AVideoPlugin::isEnabledByName("VideoTags")) {
if (!empty($_GET['tags_id']) && empty($videosArrayId)) {
TimeLogStart("video::getAllVideos::getAllVideosIdFromTagsId({$_GET['tags_id']})");
$videosArrayId = VideoTags::getAllVideosIdFromTagsId($_GET['tags_id']);
TimeLogEnd("video::getAllVideos::getAllVideosIdFromTagsId({$_GET['tags_id']})", __LINE__);
}
}

$sql = "SELECT v.users_id, v.type, v.id, v.title,v.description, c.name as category {$cn} "
. "FROM videos v "
Expand All @@ -1341,6 +1348,9 @@ static function getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos =
if (!$ignoreGroup) {
$sql .= self::getUserGroupsCanSeeSQL();
}
if (!empty($videosArrayId) && is_array($videosArrayId)) {
$sql .= " AND v.id IN ( '" . implode("', '", $videosArrayId) . "') ";
}
if ($status == "viewable") {
$sql .= " AND v.status IN ('" . implode("','", Video::getViewableStatus($showUnlisted)) . "')";
} elseif ($status == "viewableNotUnlisted") {
Expand Down Expand Up @@ -1380,7 +1390,17 @@ static function getTotalVideos($status = "viewable", $showOnlyLoggedUserVideos =

$sql .= AVideoPlugin::getVideoWhereClause();

$sql .= BootGrid::getSqlSearchFromPost(array('v.title', 'v.description', 'c.name'));

if (!empty($_POST['searchPhrase'])) {
if (AVideoPlugin::isEnabledByName("VideoTags")) {
$sql .= " AND (";
$sql .= "v.id IN (select videos_id FROM tags_has_videos LEFT JOIN tags as t ON tags_id = t.id AND t.name LIKE '%{$_POST['searchPhrase']}%' WHERE t.id is NOT NULL)";
$sql .= BootGrid::getSqlSearchFromPost(array('v.title', 'v.description', 'c.name', 'c.description'), "OR");
$sql .= ")";
} else {
$sql .= BootGrid::getSqlSearchFromPost(array('v.title', 'v.description', 'c.name', 'c.description'));
}
}

if ($suggestedOnly) {
$sql .= " AND v.isSuggested = 1 ";
Expand Down
154 changes: 133 additions & 21 deletions plugin/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function get_api_category($parameters) {
$obj->rows = $rows;
return new ApiObject("", false, $obj);
}

/**
* @param type $parameters
* 'APISecret' to list all videos
Expand All @@ -133,54 +133,54 @@ public function get_api_category($parameters) {
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&playlists_id=1&index=2&APISecret={APISecret}
* @return \ApiObject
*/
public function get_api_video_from_program($parameters){
public function get_api_video_from_program($parameters) {
global $global;
$playlists = AVideoPlugin::loadPlugin("PlayLists");
if(empty($parameters['playlists_id'])){
if (empty($parameters['playlists_id'])) {
return new ApiObject("Playlist ID is empty", true, $parameters);
}
$videos = PlayLists::getOnlyVideosAndAudioIDFromPlaylistLight($parameters['playlists_id']);
if(empty($videos)){

if (empty($videos)) {
return new ApiObject("There are no videos for this playlist", true, $parameters);
}
if(empty($parameters['index'])){

if (empty($parameters['index'])) {
$parameters['index'] = 0;
}
if(empty($videos[$parameters['index']])){

if (empty($videos[$parameters['index']])) {
$video = $videos[0];
}else{
} else {
$video = $videos[$parameters['index']];
}
$parameters['nextIndex'] = $parameters['index']+1;
if(empty($videos[$parameters['nextIndex']])){

$parameters['nextIndex'] = $parameters['index'] + 1;

if (empty($videos[$parameters['nextIndex']])) {
$parameters['nextIndex'] = 0;
}
$videoPath = Video::getHigherVideoPathFromID($video['id']);
$parameters['videos_id'] = $video['id'];
$parameters['path'] = $videoPath;

return new ApiObject("", false, $parameters);
}

/**
* @param type $parameters
* 'APISecret' to list all videos
* 'videos_id' the video id
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&videos_id=1&APISecret={APISecret}
* @return \ApiObject
*/
public function get_api_video_file($parameters){
public function get_api_video_file($parameters) {
global $global;
$obj = $this->startResponseObject($parameters);
$obj->video_file = Video::getHigherVideosPathsFromID($videos_id);
return new ApiObject("", false, $obj);
}

/**
* @param type $parameters
* ['APISecret' to list all videos]
Expand Down Expand Up @@ -430,12 +430,12 @@ public function get_api_channels($parameters) {
$obj->photo = User::getPhoto($value['id']);
$obj->channelLink = User::getChannelLink($value['id']);
$obj->name = User::getNameIdentificationById($value['id']);

$list[] = $obj;
}
return new ApiObject("", false, $list);
}

/**
* @param type $parameters
* Return all Programs (Playlists) on this site
Expand Down Expand Up @@ -463,7 +463,7 @@ public function get_api_programs($parameters) {
}
return new ApiObject("", false, $list);
}

/**
* @param type $parameters
* Return all categories on this site
Expand Down Expand Up @@ -716,6 +716,118 @@ private function favorite($parameters, $add) {
exit;
}

/**
* @param type $parameters
* Try this API <a href="../Chat2/api.html">here</a>
* 'message' the message for the chat
* ['users_id'] User's ID to what this message will be sent to (send the users_id or room_users_id)
* ['room_users_id'] User's ID from the channel where this message will be sent to (send the users_id or room_users_id)
* 'message' URL encoded message
* 'user' usename of the user
* 'pass' password of the user
* 'encodedPass' tell the script id the password submited is raw or encrypted
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&message=HelloWorld&users_id=2&room_users_id=4&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
* @return type
*/
public function set_api_chat2_message($parameters) {
global $global;
$plugin = AVideoPlugin::loadPluginIfEnabled("Chat2");
if (empty($plugin)) {
return new ApiObject("Plugin disabled");
}
if (!User::isLogged()) {
return new ApiObject("User must be logged");
}
$_POST['message'] = $parameters['message'];
$_GET['users_id'] = $parameters['users_id'];
$_GET['room_users_id'] = $parameters['room_users_id'];
include $global['systemRootPath'] . 'plugin/Chat2/sendMessage.json.php';
exit;
}


/**
* @param type $parameters
* The sample here will return 10 messages
* Try this API <a href="../Chat2/api.html">here</a>
* ['to_users_id'] User's ID where this message was private sent to
* ['lower_then_id'] Chat message ID to filter the message search. will only return messages before that chat id
* ['greater_then_id'] Chat message ID to filter the message search. will only return messages after that chat id
* 'message' URL encoded message
* 'user' usename of the user
* 'pass' password of the user
* 'encodedPass' tell the script id the password submited is raw or encrypted
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&greater_then_id=88&lower_then_id=98&to_users_id=2&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
* @return type
*/
public function get_api_chat2_chat($parameters) {
global $global;
$plugin = AVideoPlugin::loadPluginIfEnabled("Chat2");
if (empty($plugin)) {
return new ApiObject("Plugin disabled");
}
if (!User::isLogged()) {
return new ApiObject("User must be logged");
}
$_GET['to_users_id'] = $parameters['to_users_id'];
$_GET['lower_then_id'] = $parameters['lower_then_id'];

if(!empty($parameters['greater_then_id'])){
if(empty($_SESSION['chatLog'])){
$_SESSION['chatLog'] = array();
}
if(empty($_SESSION['chatLog'][$_GET['to_users_id']])){
$_SESSION['chatLog'][$_GET['to_users_id']] = array();
}
$_SESSION['chatLog'][$_GET['to_users_id']][0]['id'] = $parameters['greater_then_id'];
}

include $global['systemRootPath'] . 'plugin/Chat2/getChat.json.php';
exit;
}



/**
* @param type $parameters
* The sample here will return 10 messages id greater then 88 and lower then 98
* Try this API <a href="../Chat2/api.html">here</a>
* ['room_users_id'] User's ID (channel) where this message was public sent to
* ['lower_then_id'] Chat message ID to filter the message search. will only return messages before that chat id
* ['greater_then_id'] Chat message ID to filter the message search. will only return messages after that chat id
* 'message' URL encoded message
* 'user' usename of the user
* 'pass' password of the user
* 'encodedPass' tell the script id the password submited is raw or encrypted
* @example {webSiteRootURL}plugin/API/{getOrSet}.json.php?APIName={APIName}&greater_then_id=88&lower_then_id=98&room_users_id=2&user=admin&pass=f321d14cdeeb7cded7489f504fa8862b&encodedPass=true
* @return type
*/
public function get_api_chat2_room($parameters) {
global $global;
$plugin = AVideoPlugin::loadPluginIfEnabled("Chat2");
if (empty($plugin)) {
return new ApiObject("Plugin disabled");
}
if (!User::isLogged()) {
return new ApiObject("User must be logged");
}
$_GET['room_users_id'] = $parameters['room_users_id'];
$_GET['lower_then_id'] = $parameters['lower_then_id'];

if(!empty($parameters['greater_then_id'])){
if(empty($_SESSION['chatLog'])){
$_SESSION['chatLog'] = array();
}
if(empty($_SESSION['chatLog'][$_GET['to_users_id']])){
$_SESSION['chatLog'][$_GET['to_users_id']] = array();
}
$_SESSION['chatLog'][$_GET['to_users_id']][0]['id'] = $parameters['greater_then_id'];
}

include $global['systemRootPath'] . 'plugin/Chat2/getRoom.json.php';
exit;
}

}

class ApiObject {
Expand Down
6 changes: 3 additions & 3 deletions plugin/Gallery/view/mainArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function afterExtraVideos($liveLi) {
?>
<div id="categoriesContainer"></div>
<p class="pagination infiniteScrollPagination">
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?current=1&search=<?php echo getSearchVar(); ?>"></a>
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?tags_id=<?php echo intval(@$_GET['tags_id']); ?>&current=1&search=<?php echo getSearchVar(); ?>"></a>
</p>
<div class="scroller-status">
<div class="infinite-scroll-request loader-ellips text-center">
Expand All @@ -91,10 +91,10 @@ function afterExtraVideos($liveLi) {
history: false
});
$container.on('request.infiniteScroll', function (event, path) {
console.log('Loading page: ' + path);
//console.log('Loading page: ' + path);
});
$container.on('append.infiniteScroll', function (event, response, path, items) {
console.log('Append page: ' + path);
//console.log('Append page: ' + path);
lazyImage();
});
setTimeout(function () {
Expand Down
2 changes: 1 addition & 1 deletion plugin/Gallery/view/modeGalleryCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
?>
</div>
<p class="pagination">
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?current=<?php echo count($categories)?$_POST['current'] + 1:$_POST['current']; ?>&search=<?php echo getSearchVar(); ?>"></a>
<a class="pagination__next" href="<?php echo $global['webSiteRootURL']; ?>plugin/Gallery/view/modeGalleryCategory.php?tags_id=<?php echo intval(@$_GET['tagsid']); ?>&current=<?php echo count($categories)?$_POST['current'] + 1:$_POST['current']; ?>&search=<?php echo getSearchVar(); ?>"></a>
</p>
2 changes: 1 addition & 1 deletion plugin/WWBN/page/wwbn_signup.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
include $global['systemRootPath'] . 'view/include/navbar.php';
?>
<div class="container-fluid">
<iframe src="https://dev4.wwbn.com/platform/?section=signup&webSiteRootURL=<?php echo urlencode($global['webSiteRootURL']); ?>" style="width: 100%; height: calc(100vh - 60px);"></iframe>
<iframe src="https://dev4.wwbn.com/platform/?section=signup&webSiteRootURL=<?php echo urlencode($global['webSiteRootURL']); ?>" style="width: 100%; height: calc(100vh - 60px);" frameBorder="0"></iframe>
</div>
<?php
include $global['systemRootPath'] . 'view/include/footer.php';
Expand Down
1 change: 1 addition & 0 deletions plugin/YPTWallet/Objects/Wallet.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static function getFromUser($users_id) {
$res = $global['mysqli']->query($sql);
if ($res) {
$row = $res->fetch_assoc();
$res->free();// do not cache the result
} else {
$row = false;
}
Expand Down
Loading

0 comments on commit 98162bc

Please sign in to comment.