1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
DanieL 2022-11-19 17:45:17 -03:00
parent 00ff264631
commit 3842e8b242
20 changed files with 221 additions and 160 deletions

View file

@ -124,7 +124,7 @@ if (empty($output)) {
$obj->playlists = [['name' => $playlistName, 'itemIds'=>$itemIds]];
$obj->categories = [['name' => $categoryName, 'playlistName' => $playlistName, 'order' => 'most_recent']];
$output = _json_encode($obj, JSON_UNESCAPED_UNICODE);
$output = _json_encode($obj);
if (empty($output) && json_last_error()) {
$output = json_encode(json_last_error_msg());
var_dump($obj);

View file

@ -8,7 +8,6 @@ if (!isCommandLineInterface()) {
AVideoPlugin::loadPlugin("Live");
$channelName = ($channelName);
$sql = "SELECT lt.*, u.* FROM users u LEFT JOIN live_transmitions lt ON users_id = u.id "
. " WHERE canStream = 1 AND status = 'a' ORDER BY public DESC LIMIT 20";
$res = sqlDAL::readSql($sql);

View file

@ -70,8 +70,8 @@ function getAllFlags() {
/**
* Deprecated replaced by Layout::getAvilableFlags()
* @global type $global
* @return type
* @global array $global
* @return array
*/
function getEnabledLangs() {
global $global;

View file

@ -44,6 +44,7 @@ foreach ($categories as $key => $value) {
*/
}
if (empty($_POST['sort']) && empty($_GET['sort'])) {
array_multisort(array_column($categories, 'hierarchyAndName'), SORT_ASC, $categories);
$array_column = array_column($categories, 'hierarchyAndName');
array_multisort($array_column, SORT_ASC, $categories);
}
echo '{ "current": '.getCurrentPage().',"rowCount": '.getRowCount().', "total": '.$total.', "rows":'. _json_encode($categories).'}';

View file

@ -181,7 +181,14 @@ class Category {
return false;
}
}
/**
*
* @param string $clean_title
* @param int $count
* @param int $id
* @param string $original_title
* @return string
*/
public static function fixCleanTitle($clean_title, $count, $id, $original_title = "") {
global $global;

View file

@ -79,7 +79,6 @@ class Comment {
forbiddenPage('Permission denied');
}
//$this->comment = htmlentities($this->comment);
$this->comment = ($this->comment);
if (empty($this->comment)) {
return false;
@ -112,6 +111,10 @@ class Comment {
. " (?, ?, ?, {$this->comments_id_pai}, now(), now())";
$resp = sqlDAL::writeSql($sql, "sii", [xss_esc($this->comment), $users_id, $this->videos_id]);
}
/**
* @var array $global
* @var object $global['mysqli']
*/
if ((empty($resp)) && ($global['mysqli']->errno != 0)) {
die('Error (comment save) : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
@ -224,6 +227,10 @@ class Comment {
}
//$comment = $res->fetch_all(MYSQLI_ASSOC);
} else {
/**
* @var array $global
* @var object $global['mysqli']
*/
$comment = false;
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}

View file

@ -14,7 +14,7 @@ require_once $global['systemRootPath'] . 'objects/functions.php';
// gettig the mobile submited value
$inputJSON = url_get_contents('php://input');
$input = _json_decode($inputJSON, true); //convert JSON into array
$input = _json_decode($inputJSON); //convert JSON into array
unset($_REQUEST["redirectUri"]);
if (!empty($input) && empty($_REQUEST)) {
foreach ($input as $key => $value) {

View file

@ -6,7 +6,7 @@ $AVideoStreamer_UA = "AVideoStreamer";
$AVideoStorage_UA = "AVideoStorage";
$mysql_connect_was_closed = 1;
if(!isset($global) || !is_array($global)){
if (!isset($global) || !is_array($global)) {
$global = array();
}
@ -517,13 +517,13 @@ function secondsToDuration($seconds) {
/**
*
* @global type $global
* @global array $global
* @param string $mail
* call it before send mail to let AVideo decide the method
*/
function setSiteSendMessage(\PHPMailer\PHPMailer\PHPMailer &$mail) {
global $global;
if(empty($mail)){
if (empty($mail)) {
$mail = new \PHPMailer\PHPMailer\PHPMailer();
}
if (empty($_POST["comment"])) {
@ -737,7 +737,7 @@ function sendEmailToSiteOwner($subject, $message) {
if (!$resp) {
_error_log("sendEmailToSiteOwner Error Info: {$mail->ErrorInfo}");
} else {
_error_log("sendEmailToSiteOwner Success Info: $subject " );
_error_log("sendEmailToSiteOwner Success Info: $subject ");
}
return $resp;
} catch (Exception $e) {
@ -1588,7 +1588,7 @@ function getSources($fileName, $returnArray = false, $try = 0) {
/**
*
* @param string $file_src
* @return stringget image size with cache
* @return array get image size with cache
*/
function getimgsize($file_src) {
global $_getimagesize;
@ -1939,19 +1939,48 @@ function im_resizeV3($file_src, $file_dest, $wd, $hd) {
exec($ffmpeg . " < /dev/null 2>&1", $output, $return_val);
}
if(false){
class Imagick{
if (false) {
class Imagick {
const FILTER_BOX = 1;
function getImageFormat(){return '';}
function coalesceImages(){return new Imagick();}
function nextImage(){return true;}
function resizeImage(){}
function deconstructImages(){return new Imagick();}
function clear(){}
function destroy(){}
function writeImages(){}
function getImageFormat() {
return '';
}
function coalesceImages() {
return new Imagick();
}
function nextImage() {
return true;
}
function resizeImage() {
}
function deconstructImages() {
return new Imagick();
}
function clear() {
}
function destroy() {
}
function writeImages() {
}
}
}
function im_resize_gif($file_src, $file_dest, $max_width, $max_height) {
if (class_exists('Imagick')) {
$imagick = new Imagick($file_src);
@ -3246,7 +3275,7 @@ function removeQueryStringParameter($url, $varname) {
* @return string
*/
function addQueryStringParameter($url, $varname, $value) {
if($value === null || $value === ''){
if ($value === null || $value === '') {
return removeQueryStringParameter($url, $varname);
}
@ -3501,7 +3530,7 @@ function siteMap() {
$global['rowCount'] = $_REQUEST['rowCount'] = $advancedCustom->siteMapRowsLimit * 10;
$_POST['sort']['created'] = "DESC";
$rows = Video::getAllVideosLight(!empty($advancedCustom->showPrivateVideosOnSitemap) ? "viewableNotUnlisted" : "publicOnly");
if(empty($rows) || !is_array($rows)){
if (empty($rows) || !is_array($rows)) {
$rows = array();
}
_error_log("siteMap: getAllVideos " . count($rows));
@ -4391,14 +4420,14 @@ function _mysql_connect($persistent = false) {
function _mysql_commit() {
global $global;
if (_mysql_is_open()) {
try{
try {
/**
*
* @var array $global
* @var object $global['mysqli']
*/
@$global['mysqli']->commit();
}catch(Exception $exc){
} catch (Exception $exc) {
}
//$global['mysqli'] = false;
@ -4410,14 +4439,14 @@ function _mysql_close() {
if (_mysql_is_open()) {
//_error_log('MySQL Closed '. json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)));
$mysql_connect_was_closed = 1;
try{
try {
/**
*
* @var array $global
* @var object $global['mysqli']
*/
@$global['mysqli']->close();
}catch(Exception $exc){
} catch (Exception $exc) {
}
//$global['mysqli'] = false;
@ -6082,7 +6111,7 @@ function examineJSONError($object) {
function _json_encode_utf8($object) {
$object = object_to_array($object);
if(!is_array($object)){
if (!is_array($object)) {
return false;
}
$objectEncoded = $object;
@ -6104,9 +6133,9 @@ function _json_encode($object) {
return $object;
}
if(!empty($_json_encode_force_utf8)){
if (!empty($_json_encode_force_utf8)) {
$json = _json_encode_utf8($object);
if(!empty($json)){
if (!empty($json)) {
return $json;
}
}
@ -6114,9 +6143,9 @@ function _json_encode($object) {
$json = json_encode($object);
$errors = array();
if (empty($json) && json_last_error()) {
if(preg_match('/Malformed UTF-8 characters/i', json_last_error_msg())){
if (preg_match('/Malformed UTF-8 characters/i', json_last_error_msg())) {
$json = _json_encode_utf8($object);
if(!empty($json)){
if (!empty($json)) {
$_json_encode_force_utf8 = 1;
return $json;
}
@ -6135,13 +6164,13 @@ function _json_encode($object) {
$json = _json_encode_utf8($object);
if (empty($json) && json_last_error()) {
$errors[] = "_json_encode: Error 4 Found: " . json_last_error_msg();
}else{
} else {
$_json_encode_force_utf8 = 1;
}
}
}
}
if(empty($json) && !empty($errors)){
if (empty($json) && !empty($errors)) {
foreach ($errors as $value) {
_error_log($value);
}
@ -6639,7 +6668,7 @@ function _unsetcookie($cookieName) {
/**
* This function is not 100% but try to tell if the site is in an iFrame
* @global type $global
* @global array $global
* @return boolean
*/
function isIframeInDifferentDomain() {
@ -6943,7 +6972,7 @@ function getServerClock() {
/**
* Xsendfile and FFMPEG are required for this feature
* @global type $global
* @global array $global
* @param string $filepath
* @return boolean
*/
@ -8347,16 +8376,18 @@ function fixPath($path, $addLastSlash = false) {
return $path;
}
if(false){
function openssl_cipher_key_length(){
if (false) {
function openssl_cipher_key_length() {
return 0;
}
}
function getHashMethodsAndInfo(){
function getHashMethodsAndInfo() {
global $global, $_getHashMethod;
if(empty($_getHashMethod)){
if (empty($_getHashMethod)) {
if (empty($global['salt'])) {
$global['salt'] = '11234567890abcdef';
}
@ -8369,23 +8400,22 @@ function getHashMethodsAndInfo(){
$cipher_algo = 'rc4';
}
$cipher_methods = openssl_get_cipher_methods();
if(!in_array($cipher_algo, $cipher_methods)){
if (!in_array($cipher_algo, $cipher_methods)) {
$base = 32;
$cipher_algo = $cipher_methods[0];
}
$ivlen = openssl_cipher_iv_length($cipher_algo);
if(function_exists('openssl_cipher_key_length')){
if (function_exists('openssl_cipher_key_length')) {
$keylen = openssl_cipher_key_length($cipher_algo);
}else{
} else {
$keylen = $ivlen;
}
$iv = substr($saltMD5, 0, $ivlen);
$key = substr($saltMD5, 0, $keylen);
$_getHashMethod = array('cipher_algo'=>$cipher_algo, 'iv'=>$iv, 'key'=>$key, 'base'=>$base);
$_getHashMethod = array('cipher_algo' => $cipher_algo, 'iv' => $iv, 'key' => $key, 'base' => $base);
}
return $_getHashMethod;
}
@ -8415,9 +8445,9 @@ function idToHash($id) {
//$hash = preg_replace('/^([+]+)/', '', $hash);
$hash = preg_replace('/(=+)$/', '', $hash);
$hash = str_replace(['/', '+', '='], ['_', '-', '.'], $hash);
if(empty($hash)){
_error_log('idToHash error: '.openssl_error_string().PHP_EOL. json_encode(array('id'=>$id, 'cipher_algo'=>$cipher_algo, 'base'=>$base, 'idConverted'=>$idConverted, 'hash'=>$hash, 'iv'=>$iv)));
if(!empty($global['useLongHash'])){
if (empty($hash)) {
_error_log('idToHash error: ' . openssl_error_string() . PHP_EOL . json_encode(array('id' => $id, 'cipher_algo' => $cipher_algo, 'base' => $base, 'idConverted' => $idConverted, 'hash' => $hash, 'iv' => $iv)));
if (!empty($global['useLongHash'])) {
$global['useLongHash'] = 0;
return idToHash($id);
}
@ -8463,7 +8493,7 @@ function videosHashToID($hash_of_videos_id) {
/**
*
* @global type $advancedCustom
* @global type $global
* @global array $global
* @global type $_getCDNURL
* @param string $type enum(CDN, CDN_S3,CDN_B2,CDN_FTP,CDN_YPTStorage,CDN_Live,CDN_LiveServers)
* @param string $id the ID of the URL in case the CDN is an array
@ -9382,7 +9412,7 @@ function is_email($strOrArray) {
/**
* https://codepen.io/ainalem/pen/LJYRxz
* @global type $global
* @global array $global
* @param string $id
* @param string $type 1 to 8 [1=x, 2=<-, 3=close, 4=x, 5=<-, 6=x, 7=x, 8=x]
* @param string $parameters
@ -9753,3 +9783,24 @@ function getIframePaths() {
return array('relative' => $relativeSRC, 'url' => $url, 'path' => "{$global['systemRootPath']}{$relativeSRC}", 'modeYoutube' => $modeYoutube);
}
function getFeedButton($rss, $mrss, $roku) {
$buttons = '<div class="dropdown feedDropdown" style="display: inline-block;" data-toggle="tooltip" title="' . __("Feed") . '">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-rss-square"></i>
<span class="hidden-xs hidden-sm">' . __("Feed") . '</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">';
if (isValidURL($rss)) {
$buttons .= '<li><a href="' . $rss . '" target="_blank">RSS</a></li>';
}
if (isValidURL($mrss)) {
$buttons .= '<li><a href="' . $mrss . '" target="_blank">MRSS</a></li>';
}
if (isValidURL($roku)) {
$buttons .= '<li><a href="' . $roku . '" target="_blank">Roku</a></li>';
}
$buttons .= '</ul></div>';
return $buttons;
}

View file

@ -94,7 +94,7 @@ class PlayList extends ObjectYPT {
/**
*
* @global type $global
* @global array $global
* @param string $publicOnly
* @param string $userId if not present check session
* @param string $isVideoIdPresent pass the ID of the video checking
@ -211,7 +211,7 @@ class PlayList extends ObjectYPT {
/**
*
* @global type $global
* @global array $global
* @param string $publicOnly
* @param string $userId if not present check session
* @param string $isVideoIdPresent pass the ID of the video checking

View file

@ -161,7 +161,7 @@ class Subscribe extends ObjectYPT{
/**
* return all subscribers that has subscribe to an user channel
* @global type $global
* @global array $global
* @param string $user_id
* @return array
*/
@ -229,7 +229,7 @@ class Subscribe extends ObjectYPT{
/**
* return all channels that a user has subscribed
* @global type $global
* @global array $global
* @param string $user_id
* @return boolean
*/

View file

@ -1416,7 +1416,7 @@ if (typeof gtag !== \"function\") {
/**
* this is the deprecated function, with week password
* @global type $global
* @global array $global
* @param string $user
* @param string $pass
* @param string $mustBeactive

View file

@ -1191,7 +1191,7 @@ if (!class_exists('Video')) {
/**
*
* @global type $global
* @global array $global
* @param string $status
* @param string $showOnlyLoggedUserVideos you may pass an user ID to filter results
* @param string $ignoreGroup
@ -1702,10 +1702,10 @@ if (!class_exists('Video')) {
/**
* Same as getAllVideos() method but a lighter query
* @global type $global
* @global array $global
* @global type $config
* @param string $showOnlyLoggedUserVideos
* @return boolean
* @return array
*/
public static function getAllVideosLight($status = "viewable", $showOnlyLoggedUserVideos = false, $showUnlisted = false, $suggestedOnly = false) {
global $global, $config;
@ -2942,7 +2942,7 @@ if (!class_exists('Video')) {
/**
*
* @global type $global
* @global array $global
* @param string $videos_id
* @param string $users_id if is empty will use the logged user
* @return boolean
@ -2973,7 +2973,7 @@ if (!class_exists('Video')) {
/**
*
* @global type $global
* @global array $global
* @param string $videos_id
* @param string $users_id if is empty will use the logged user
* @return boolean
@ -4378,7 +4378,7 @@ if (!class_exists('Video')) {
/**
*
* @global type $global
* @global array $global
* @param string $videos_id
* @param string $clean_title
* @param string $embed

View file

@ -1294,7 +1294,9 @@ Click <a href=\"{link}\">here</a> to join our live.";
public static function getPlayerServer($ignoreCDN = false) {
$obj = AVideoPlugin::getObjectData("Live");
/**
* @var string $url
*/
$url = $obj->playerServer;
if (empty($ignoreCDN)) {
$url = getCDNOrURL($url, 'CDN_Live');
@ -3726,6 +3728,9 @@ Click <a href=\"{link}\">here</a> to join our live.";
$ls = new Live_schedule($live_schedule_id);
$users_id = Live_schedule::getUsers_idOrCompany($live_schedule_id);
$title = $ls->getTitle();
/**
* @var string $date_start
*/
$date_start = $ls->getScheduled_time();
$date_end = '';
$joinURL = Live::getLinkToLiveFromUsers_id($users_id, $live_schedule_id);

View file

@ -208,7 +208,6 @@ class LiveTransmition extends ObjectYPT
{
global $global;
_mysql_connect();
$userName = ($userName);
$sql = "SELECT * FROM users WHERE user = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "s", [$userName], true);
$data = sqlDAL::fetchAssoc($res);
@ -228,7 +227,6 @@ class LiveTransmition extends ObjectYPT
{
global $global;
_mysql_connect();
$channelName = ($channelName);
$sql = "SELECT * FROM users WHERE channelName = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "s", [$channelName], true);
$data = sqlDAL::fetchAssoc($res);

View file

@ -99,13 +99,11 @@ class LiveTransmitionHistory extends ObjectYPT {
global $global;
$Char = "&zwnj;";
$title = str_replace($Char, '', $title);
$title = ($title);
$this->title = $title;
}
public function setDescription($description) {
global $global;
$description = ($description);
$this->description = $description;
}
@ -163,7 +161,7 @@ class LiveTransmitionHistory extends ObjectYPT {
/**
*
* @param int $liveTransmitionHistory_id
* @return object
* @return array
*/
public static function getApplicationObject($liveTransmitionHistory_id) {
global $global;
@ -392,7 +390,6 @@ class LiveTransmitionHistory extends ObjectYPT {
public static function getLatest($key, $live_servers_id = null, $active=false) {
global $global;
$key = ($key);
if (empty($key)) {
return false;

View file

@ -53,8 +53,6 @@ class Live_schedule extends ObjectYPT
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
_error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
@ -74,8 +72,6 @@ class Live_schedule extends ObjectYPT
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
_error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
@ -158,8 +154,6 @@ class Live_schedule extends ObjectYPT
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
@ -196,8 +190,6 @@ class Live_schedule extends ObjectYPT
$row['serverURL'] = Live::getServerURL($row['key'], $row['users_id']);
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
@ -295,7 +287,10 @@ class Live_schedule extends ObjectYPT
{
return intval($this->live_servers_id);
}
/**
*
* @return string
*/
public function getScheduled_time()
{
return $this->scheduled_time;
@ -358,8 +353,6 @@ class Live_schedule extends ObjectYPT
$this->key = uniqid();
}
$this->description = ($this->description);
$this->_setTimeZone(date_default_timezone_get());
//$key = Live::getKeyFromUser($this->getUsers_id());

View file

@ -114,7 +114,9 @@ class Live_servers extends ObjectYPT
{
return trim($this->rtmp_server);
}
/**
* @return string
*/
public function getPlayerServer()
{
return $this->playerServer;
@ -240,7 +242,6 @@ class Live_servers extends ObjectYPT
$host = trim($rtmpHostURI);
$parts = parse_url($host);
$host = "rtmp://{$parts["host"]}{$parts["path"]}";
$host = ($host);
$sql = "SELECT * FROM " . static::getTableName() . " WHERE rtmp_server LIKE '%{$host}%' AND status = 'a' ";
$res = sqlDAL::readSql($sql);
$data = sqlDAL::fetchAssoc($res);

View file

@ -52,18 +52,12 @@ if ($isMyChannel) {
<li><a href="<?php echo $global['webSiteRootURL']; ?>objects/playlistSort.php?playlist_id=<?php echo $program['id']; ?>&sort=4"><i class="fas fa-sort-numeric-down-alt"></i> <?php echo __("Created Date"); ?> Desc 9-0</a></li>
</ul>
</div>
<div class="dropdown" style="display: inline-block;">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-rss-square"></i>
<span class="hidden-xs hidden-sm"><?php echo __("Feed"); ?></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo $global['webSiteRootURL']; ?>feed/?program_id=<?php echo $program['id']; ?>" target="_blank">RSS</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>mrss/?program_id=<?php echo $program['id']; ?>" target="_blank">MRSS</a></li>
<li><a href="<?php echo $global['webSiteRootURL']; ?>roku.json?program_id=<?php echo $program['id']; ?>" target="_blank">Roku</a></li>
</ul>
</div>
<?php
$rss = "{$global['webSiteRootURL']}feed/?program_id={$program['id']}";
$mrss = "{$global['webSiteRootURL']}mrss/?program_id={$program['id']}";
$roku = "{$global['webSiteRootURL']}roku.json/?program_id={$program['id']}";
echo getFeedButton($rss, $mrss, $roku);
?>
<div class="pull-right btn-group" style="display: inline-flex;">
<?php
echo PlayLists::getShowOnTVSwitch($program['id']);

View file

@ -184,7 +184,7 @@ class Scheduler extends PluginAbstract {
/**
*
* @global type $global
* @global array $global
* @param string $title
* @param string $description
* @param string $date_start

View file

@ -112,6 +112,9 @@ if($advancedCustomUser->showChannelLiveTab){
position: relative;
overflow: hidden;
}
.feedDropdown{
margin-right: 4px;
}
</style>
<!-- <?php var_dump($uploadedTotalVideos, $user_id, !isToHidePrivateVideos()); ?> -->
<div class="clearfix"></div>
@ -148,7 +151,7 @@ if($advancedCustomUser->showChannelLiveTab){
}
?>
<div class="row">
<div class="col-6 col-md-12">
<div class="col-sm-12">
<h2 class="pull-left">
<?php
echo $user->getNameIdentificationBd();
@ -161,6 +164,11 @@ if($advancedCustomUser->showChannelLiveTab){
echo getUserOnlineLabel($user_id, 'pull-right', 'padding: 0 5px;');
?>
<?php
$urlChannel = addLastSlash(User::getChannelLink($user_id));
$rss = "{$urlChannel}rss";
$mrss = "{$urlChannel}mrss";
$roku = "{$urlChannel}roku.json";
echo getFeedButton($rss, $mrss, $roku);
echo User::getAddChannelToGalleryButton($user_id);
echo User::getBlockUserButton($user_id);
echo Subscribe::getButton($user_id);