diff --git a/.gitignore b/.gitignore index cafcae420d..5b615a5611 100644 --- a/.gitignore +++ b/.gitignore @@ -93,4 +93,5 @@ test.php /plugin/PedagoFlix/ /plugin/YPTWebRTC/ plugin/CustomizeUser/getMyAccount.php -*.rnd \ No newline at end of file +*.rnd +/plugin/Gift/ \ No newline at end of file diff --git a/.htaccess b/.htaccess index e2d667f105..33f2842e14 100644 --- a/.htaccess +++ b/.htaccess @@ -85,6 +85,7 @@ Options All -Indexes RewriteEngine on #VideoHLS for DRM + RewriteRule ^buy/? plugin/Layout/buy.php [NC,L,QSA] RewriteRule ^id/? view/id.php [NC,L,QSA] RewriteRule ^logo.png view/logo.png.php [NC,L,QSA] diff --git a/locale/function.js.php b/locale/function.js.php new file mode 100644 index 0000000000..46d7c583c0 --- /dev/null +++ b/locale/function.js.php @@ -0,0 +1,39 @@ + +var translations = ; + +function __(str, allowHTML = false) { + let returnStr = str; + + // Check if translation exists for exact string + if (translations.hasOwnProperty(str)) { + returnStr = translations[str]; + } else { + // Case insensitive check + let lowerCaseKey = Object.keys(translations).find(key => key.toLowerCase() === str.toLowerCase()); + if (lowerCaseKey) { + returnStr = translations[lowerCaseKey]; + } + } + + if (allowHTML) { + return returnStr; + } + + // Escape certain characters for security + return returnStr.replace(/'/g, "'").replace(/"/g, """).replace(//g, ">"); +} \ No newline at end of file diff --git a/objects/functions.php b/objects/functions.php index 4cea2e134b..1c4771fb53 100644 --- a/objects/functions.php +++ b/objects/functions.php @@ -4461,42 +4461,42 @@ function getLdJson($videos_id) if ($duration == "PT0H0M0S") { $duration = "PT0H0M1S"; } - $output = ' - '; + $data = array( + "@context" => "http://schema.org/", + "@type" => "VideoObject", + "name" => getSEOTitle($video['title']), + "description" => $description, + "thumbnailUrl" => array($img), + "uploadDate" => date("Y-m-d\Th:i:s", strtotime($video['created'])), + "duration" => $duration, + "contentUrl" => Video::getLinkToVideo($videos_id, '', false, false), + "embedUrl" => Video::getLinkToVideo($videos_id, '', true, false), + "interactionCount" => $video['views_count'], + "@id" => Video::getPermaLink($videos_id), + "datePublished" => date("Y-m-d", strtotime($video['created'])), + "interactionStatistic" => array( + array( + "@type" => "InteractionCounter", + "interactionService" => array( + "@type" => "WebSite", + "name" => str_replace('"', '', $config->getWebSiteTitle()), + "@id" => $global['webSiteRootURL'] + ), + "interactionType" => "http://schema.org/LikeAction", + "userInteractionCount" => $video['views_count'] + ), + array( + "@type" => "InteractionCounter", + "interactionType" => "http://schema.org/WatchAction", + "userInteractionCount" => $video['views_count'] + ) + ) + ); + + $output = ''; + ObjectYPT::setCacheGlobal("getLdJson{$videos_id}", $output); echo $output; } @@ -10847,7 +10847,7 @@ function getMP3ANDMP4DownloadLinksFromHLS($videos_id, $video_type) if (!empty($videoHLSObj) && method_exists('VideoHLS', 'getMP3ANDMP4DownloadLinks')) { $downloadOptions = VideoHLS::getMP3ANDMP4DownloadLinks($videos_id); } else { - _error_log("getMP3ANDMP4DownloadLinksFromHLS($videos_id, $video_type): invalid plugin"); + //_error_log("getMP3ANDMP4DownloadLinksFromHLS($videos_id, $video_type): invalid plugin"); } } else { _error_log("getMP3ANDMP4DownloadLinksFromHLS($videos_id, $video_type): invalid vidreo type"); diff --git a/objects/video.php b/objects/video.php index 48c09d45b7..d6c9b5f593 100644 --- a/objects/video.php +++ b/objects/video.php @@ -545,7 +545,7 @@ if (!class_exists('Video')) { if (empty($this->duration_in_seconds)) { $this->duration_in_seconds = durationToSeconds($this->duration); } - + //var_dump($this->clean_title);exit; if (!empty($this->id)) { if (!$this->userCanManageVideo() && !$allowOfflineUser && !Permissions::canModerateVideos()) { forbiddenPage('Permission denied'); @@ -1428,7 +1428,6 @@ if (!class_exists('Video')) { $sql .= AVideoPlugin::getVideoWhereClause(); $sql .= "ORDER BY RAND() LIMIT {$limit}"; - $res = sqlDAL::readSql($sql); $fullData = sqlDAL::fetchAllAssoc($res); @@ -2881,7 +2880,6 @@ if (!class_exists('Video')) { public function setDescription($description) { global $global, $advancedCustom; - if (empty($advancedCustom)) { $advancedCustom = AVideoPlugin::getDataObject('CustomizeAdvanced'); } @@ -5185,7 +5183,7 @@ if (!class_exists('Video')) { sqlDAL::close($res); if ($res !== false) { - if ($videoRow !== false) { + if (is_array($videoRow)) { return $videoRow['clean_title']; } } else { diff --git a/objects/videoAddNew.json.php b/objects/videoAddNew.json.php index b03feedeca..ffb5cebcb1 100644 --- a/objects/videoAddNew.json.php +++ b/objects/videoAddNew.json.php @@ -166,6 +166,7 @@ if (Permissions::canAdminVideos()) { $obj->setCreated($_REQUEST['created']); } } + TimeLogEnd(__FILE__, __LINE__); $resp = $obj->save(true); // if is a new embed video diff --git a/objects/video_statistic.php b/objects/video_statistic.php index 003264977d..9651bf0dae 100644 --- a/objects/video_statistic.php +++ b/objects/video_statistic.php @@ -583,7 +583,6 @@ class VideoStatistic extends ObjectYPT { //_error_log("Delete Query: ".$sql); return sqlDAL::writeSql($sql, "i", [$days]); } - _error_log("Id for table " . static::getTableName() . " not defined for deletion", AVideoLog::$ERROR); return false; } diff --git a/plugin/Cache/Cache.php b/plugin/Cache/Cache.php index a2d9279b3d..83e98ef990 100644 --- a/plugin/Cache/Cache.php +++ b/plugin/Cache/Cache.php @@ -396,6 +396,25 @@ class Cache extends PluginAbstract { return CachesInDB::_deleteCacheStartingWith('firstPage'); } + public static function deleteOldCache($days, $limit = 5000) { + global $global; + $days = intval($days); + if (!empty($days)) { + $sql = "DELETE FROM CachesInDB "; + $sql .= " WHERE created < DATE_SUB(NOW(), INTERVAL ? DAY) "; + $sql .= " LIMIT $limit"; + $global['lastQuery'] = $sql; + + return sqlDAL::writeSql($sql, "i", [$days]); + } + return false; + } + function executeEveryMinute() { + global $global; + $global['systemRootPath'] . 'plugin/Cache/deleteStatistics.json.php'; + self::deleteOldCache(1); + } + } function sanitize_output($buffer) { diff --git a/plugin/CustomizeUser/CustomizeUser.php b/plugin/CustomizeUser/CustomizeUser.php index 8e99223fea..de4e87f7a2 100644 --- a/plugin/CustomizeUser/CustomizeUser.php +++ b/plugin/CustomizeUser/CustomizeUser.php @@ -13,82 +13,170 @@ require_once $global['systemRootPath'] . 'plugin/CustomizeUser/Objects/Users_aff class CustomizeUser extends PluginAbstract { - + private static function _getSocialMedia() { return [ 'website' => [ - 'class'=>'icoCopy', + 'class' => 'icoCopy', 'icon' => 'fas fa-globe', 'label' => __("Website"), 'placeholder' => __("Website URL"), 'isActive' => true, ], - 'youtube' => [ - 'class'=>'icoYoutube', - 'icon' => 'fab fa-youtube', - 'label' => __("Youtube"), - 'placeholder' => __("Youtube URL"), - 'isActive' => true, - ], 'facebook' => [ - 'class'=>'icoFacebook', + 'class' => 'icoFacebook', 'icon' => 'fab fa-facebook-f', 'label' => __("Facebook"), 'placeholder' => __("Facebook URL"), 'isActive' => true, ], - 'twitter' => [ - 'class'=>'icoTwitter', - 'icon' => 'fab fa-twitter', - 'label' => __("Twitter"), - 'placeholder' => __("Twitter URL"), + 'youtube' => [ + 'class' => 'icoYoutube', + 'icon' => 'fab fa-youtube', + 'label' => __("Youtube"), + 'placeholder' => __("Youtube URL"), 'isActive' => true, ], 'instagram' => [ - 'class'=>'icoInstagram', + 'class' => 'icoInstagram', 'icon' => 'fab fa-instagram', 'label' => __("Instagram"), 'placeholder' => __("Instagram URL"), 'isActive' => true, ], - 'spreaker' => [ - 'class'=>'icoSpreaker', - 'icon' => 'fas fa-heart', - 'label' => __("Spreaker"), - 'placeholder' => __("Spreaker URL"), + /* + 'whatsapp' => [ + 'class' => 'icoWhatsapp', + 'icon' => 'fab fa-whatsapp', + 'label' => __("Whatsapp"), + 'placeholder' => __("Whatsapp URL"), + 'isActive' => true, + ], + */ + 'twitter' => [ + 'class' => 'icoTwitter', + 'icon' => 'fab fa-twitter', + 'label' => __("Twitter"), + 'placeholder' => __("Twitter URL"), 'isActive' => true, ], 'linkedin' => [ - 'class'=>'icoLinkedIn', + 'class' => 'icoLinkedIn', 'icon' => 'fab fa-linkedin-in', 'label' => __("LinkedIn"), 'placeholder' => __("LinkedIn URL"), 'isActive' => true, ], 'tiktok' => [ - 'class'=>'icoTikTok', + 'class' => 'icoTikTok', 'icon' => 'fab fa-tiktok', 'label' => __("TikTok"), 'placeholder' => __("TikTok URL"), 'isActive' => true, ], - 'patreon' => [ - 'class'=>'icoPatreon', - 'icon' => 'fab fa-patreon', - 'label' => __("Patreon"), - 'placeholder' => __("Patreon URL"), - 'isActive' => true, - ], 'pinterest' => [ - 'class'=>'icoPinterest', + 'class' => 'icoPinterest', 'icon' => 'fab fa-pinterest', 'label' => __("Pinterest"), 'placeholder' => __("Pinterest URL"), 'isActive' => true, - ] + ], + 'reddit' => [ + 'class' => 'icoReddit', + 'icon' => 'fab fa-reddit', + 'label' => __("Reddit"), + 'placeholder' => __("Reddit URL"), + 'isActive' => true, + ], + /* + 'telegram' => [ + 'class' => 'icoTelegram', + 'icon' => 'fab fa-telegram', + 'label' => __("Telegram"), + 'placeholder' => __("Telegram URL"), + 'isActive' => true, + ], + 'google' => [ + 'class' => 'icoGoogle', + 'icon' => 'fab fa-google', + 'label' => __("Google"), + 'placeholder' => __("Google URL"), + 'isActive' => true, + ], + */ + 'vimeo' => [ + 'class' => 'icoVimeo', + 'icon' => 'fab fa-vimeo', + 'label' => __("Vimeo"), + 'placeholder' => __("Vimeo URL"), + 'isActive' => true, + ], + 'tumblr' => [ + 'class' => 'icoTumblr', + 'icon' => 'fab fa-tumblr', + 'label' => __("Tumblr"), + 'placeholder' => __("Tumblr URL"), + 'isActive' => true, + ], + 'spreaker' => [ + 'class' => 'icoSpreaker', + 'icon' => 'fas fa-heart', + 'label' => __("Spreaker"), + 'placeholder' => __("Spreaker URL"), + 'isActive' => true, + ], + /* + 'rss' => [ + 'class' => 'icoRss', + 'icon' => 'fas fa-rss', + 'label' => __("RSS"), + 'placeholder' => __("RSS URL"), + 'isActive' => true, + ], + 'gab' => [ + 'class' => 'icoGab', + 'icon' => 'fab fa-gab', + 'label' => __("Gab"), + 'placeholder' => __("Gab URL"), + 'isActive' => true, + ], + */ + 'clouthub' => [ + 'class' => 'icoCloutHub', + 'icon' => 'fas fa-cloud', + 'label' => __("CloutHub"), + 'placeholder' => __("CloutHub URL"), + 'isActive' => true, + ], + 'pinboard' => [ + 'class' => 'icoPinboard', + 'icon' => 'fas fa-thumbtack', + 'label' => __("Pinboard"), + 'placeholder' => __("Pinboard URL"), + 'isActive' => true, + ], + 'apple' => [ + 'class' => 'icoApple', + 'icon' => 'fab fa-apple', + 'label' => __("Apple"), + 'placeholder' => __("Apple URL"), + ], + 'imdb' => [ + 'class' => 'icoIMDB', + 'icon' => 'fab fa-imdb', + 'label' => __("IMDB"), + 'placeholder' => __("IMDB URL"), + ], + 'podcast' => [ + 'class' => 'icoPodcast', + 'icon' => 'fas fa-podcast', + 'label' => __("Podcast"), + 'placeholder' => __("Podcast URL"), + ], ]; } + public static function getSocialMedia() { $obj = AVideoPlugin::getDataObject('CustomizeUser'); @@ -281,16 +369,18 @@ class CustomizeUser extends PluginAbstract return $obj; } - function onUserSocketConnect() { + function onUserSocketConnect() + { global $global; echo file_get_contents($global['systemRootPath'] . 'plugin/CustomizeUser/onUserSocketConnect.js'); } - function onUserSocketDisconnect() { + function onUserSocketDisconnect() + { global $global; echo file_get_contents($global['systemRootPath'] . 'plugin/CustomizeUser/onUserSocketDisconnect.js'); } - + static function getCallerButton($users_id, $class = '') { global $global; @@ -569,7 +659,7 @@ class CustomizeUser extends PluginAbstract //_error_log("CustomizeUser::getModeYouTube this video is embed and whitelisted, we will by pass the security check"); return true; } else { - _error_log("CustomizeUser::getModeYouTube this video is NOT whitelisted, [".(@$_SERVER['HTTP_REFERER'])."]"); + _error_log("CustomizeUser::getModeYouTube this video is NOT whitelisted, [" . (@$_SERVER['HTTP_REFERER']) . "]"); } } $cansee = User::canWatchVideoWithAds($videos_id); diff --git a/plugin/Layout/buy.php b/plugin/Layout/buy.php new file mode 100644 index 0000000000..2f09cd2879 --- /dev/null +++ b/plugin/Layout/buy.php @@ -0,0 +1,133 @@ +getUsers_id(); +if (User::isLogged()) { + $response = $video->whyUserCannotWatchVideo(User::getId(), $videos_id); + if ($response->canWatch) { + header('Location: ' . Video::getURL($videos_id)); + exit; + } +} +$title = array('Buy'); +$title[] = $video->getTitle(); +$nameId = User::getNameIdentificationById($users_id); +$poster = Video::getPoster($videos_id); +//User::getChannelLink() +$_page = new Page($title); +/* +$_page->setInlineStyles("body { + background-image: url('{$poster}'); + background-size: cover; + background-repeat: no-repeat; + background-attachment: fixed; + background-position: center center; +}"); + +// FansSubscriptions +$name = 'FansSubscriptions'; +if ($p = AVideoPlugin::loadPluginIfEnabled($name)) { + $obj = $p->getDataObject(); + if (FansSubscriptions::isFansOnly($videos_id)) { + + } +} +*/ +// PayPerView +$name = 'PayPerView'; +if ($p = AVideoPlugin::loadPluginIfEnabled($name)) { + $obj = $p->getDataObject(); + $isVideoPPV = PayPerView::isVideoPayPerView($videos_id); + if ($isVideoPPV) { + $ppvplans = PayPerView::getAllPlansFromVideo($videos_id); + } +} +// Subscription +$name = 'Subscription'; +if ($p = AVideoPlugin::loadPluginIfEnabled($name)) { + $subplans = $p->getPlansFromVideo($videos_id); +} + +?> +
" . implode("
or ", $names) . "
";
-
+
$dir = $global['systemRootPath'] . 'plugin/PlayerSkins/epg.php';
$desc .= "0 * * * * php {$dir}
";
-
+
return $desc;
}
@@ -70,13 +70,14 @@ class PlayerSkins extends PluginAbstract {
$obj->contextMenuShare = true;
$obj->playerFullHeight = false;
$obj->playsinline = true;
+ $obj->showVideoSEOViewForBots = true;
return $obj;
}
-
- static function getPlaysinline(){
+
+ static function getPlaysinline() {
$obj = AVideoPlugin::getObjectData('PlayerSkins');
- if($obj->playsinline){
+ if ($obj->playsinline) {
return ' playsinline webkit-playsinline="webkit-playsinline" ';
}
return '';
@@ -103,7 +104,7 @@ class PlayerSkins extends PluginAbstract {
}
$images = Video::getImageFromFilename($filename);
if ($vType == 'video') {
- $htmlMediaTag = '';
} else if ($vType == 'audio') {
- $htmlMediaTag = '