';
return 0;
}
$page = $totalPages;
$_REQUEST['current'] = $totalPages;
}
$videos = Video::getAllVideos("viewableNotUnlisted", false, $ignoreGroup);
// need to add dechex because some times it return an negative value and make it fails on javascript playlists
?>
diff --git a/plugin/Live/Live.php b/plugin/Live/Live.php
index 17516ca1c..1bd7d53f4 100644
--- a/plugin/Live/Live.php
+++ b/plugin/Live/Live.php
@@ -1,2440 +1,2518 @@
and receive HLS streaming from servers";
$lu = AVideoPlugin::loadPlugin("LiveUsers");
if (!empty($lu)) {
if (version_compare($lu->getPluginVersion(), "2.0") < 0) {
$desc .= "
You MUST update your LiveUsers plugin to version 2.0 or greater
";
}
}
return $desc;
}
public function getName() {
return "Live";
}
public function getHTMLMenuRight() {
global $global;
$buttonTitle = $this->getButtonTitle();
$obj = $this->getDataObject();
if (!empty($obj->hideTopButton)) {
return '';
}
include $global['systemRootPath'] . 'plugin/Live/view/menuRight.php';
}
public function getUUID() {
return "e06b161c-cbd0-4c1d-a484-71018efa2f35";
}
public function getPluginVersion() {
return "7.2";
}
public function updateScript() {
global $global;
//update version 2.0
$sql = "SELECT 1 FROM live_transmitions_history LIMIT 1";
$res = sqlDAL::readSql($sql);
$fetch = sqlDAL::fetchAssoc($res);
if (!$fetch) {
sqlDal::writeSql(file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV2.0.sql'));
}
//update version 3.0
$sql = "SELECT 1 FROM live_transmition_history_log LIMIT 1";
$res = sqlDAL::readSql($sql);
$fetch = sqlDAL::fetchAssoc($res);
if (!$fetch) {
sqlDal::writeSql(file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV3.0.sql'));
}
//update version 4.0
$sql = "SELECT 1 FROM live_servers LIMIT 1";
$res = sqlDAL::readSql($sql);
$fetch = sqlDAL::fetchAssoc($res);
if (!$fetch) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV4.0.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
//update version 5.0
$sql = "SELECT 1 FROM live_restreams LIMIT 1";
$res = sqlDAL::readSql($sql);
$fetch = sqlDAL::fetchAssoc($res);
if (!$fetch) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV5.0.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
//update version 5.1
if (AVideoPlugin::compareVersion($this->getName(), "5.1") < 0) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV5.1.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
//update version 5.2
if (AVideoPlugin::compareVersion($this->getName(), "5.2") < 0) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV5.2.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
if (AVideoPlugin::compareVersion($this->getName(), "6.0") < 0) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV6.0.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
if (AVideoPlugin::compareVersion($this->getName(), "7.0") < 0) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV7.0.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
if (AVideoPlugin::compareVersion($this->getName(), "7.2") < 0) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Live/install/updateV7.2.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
return true;
}
public function getEmptyDataObject() {
global $global;
$server = parse_url($global['webSiteRootURL']);
$scheme = "http";
$port = "8080";
if (strtolower($server["scheme"]) == "https") {
$scheme = "https";
$port = "8443";
}
$obj = new stdClass();
$obj->button_title = "LIVE";
self::addDataObjectHelper('button_title', 'Button Title', 'This is the title that will appear in your button to enter in the Live panel');
$obj->server = "rtmp://{$server['host']}/live";
self::addDataObjectHelper('server', 'RTMP Server URL', 'Usually it is ' . "rtmp://{$server['host']}/live");
$obj->playerServer = "{$scheme}://{$server['host']}:{$port}/live";
self::addDataObjectHelper('playerServer', 'Player URL', 'This is a URL to your NGINX server, this URL will be used by the HTML5 player, If your site is HTTPS your player URL MUST be HTTPS as well, usually it is ' . "{$scheme}://{$server['host']}:{$port}/live");
$obj->stats = "{$scheme}://{$server['host']}:{$port}/stat";
self::addDataObjectHelper('stats', 'Stats Page URL', 'When you installed the NGINX you also install the stat.xsl, we will use it to grab the information when you have livestreams running, usually it is ' . "{$scheme}://{$server['host']}:{$port}/stat");
$obj->restreamerURL = "{$global['webSiteRootURL']}plugin/Live/standAloneFiles/restreamer.json.php";
self::addDataObjectHelper('restreamerURL', 'Restreamer URL', 'https://github.com/WWBN/AVideo/wiki/Restream');
$obj->controlURL = "{$global['webSiteRootURL']}plugin/Live/standAloneFiles/control.json.php";
self::addDataObjectHelper('controlURL', 'Control URL');
$obj->controlServer = "http://localhost:8080/";
self::addDataObjectHelper('controlServer', 'Control Server');
$obj->disableRestream = false;
self::addDataObjectHelper('disableRestream', 'Disable Restream', 'If you check this, we will not send requests to your Restreamer URL');
$obj->disableDVR = false;
self::addDataObjectHelper('disableDVR', 'Disable DVR', 'Enable or disable the DVR Feature, you can control the DVR length in your nginx.conf on the parameter hls_playlist_length');
$obj->disableGifThumbs = false;
self::addDataObjectHelper('disableGifThumbs', 'Disable Gif Thumbs', 'This option will disable the Animated Gif render, it will save some hardware capacity from your encoder and may speedup your page');
$obj->disableLiveThumbs = false;
self::addDataObjectHelper('disableLiveThumbs', 'Disable Live thumbnails', 'This option will disable the çive image extraction and will use the user static image, it will save some hardware capacity from your encoder and may speedup your page');
$obj->hideTopButton = false;
self::addDataObjectHelper('hideTopButton', 'Hide Top Button', 'This will hide the "Go Live" button on the top menu bar');
$obj->useAadaptiveMode = false;
self::addDataObjectHelper('useAadaptiveMode', 'Adaptive mode', 'https://github.com/WWBN/AVideo/wiki/Adaptive-Bitrates-on-Livestream');
$obj->protectLive = false;
self::addDataObjectHelper('protectLive', 'Live Protection', 'With this your encryption key will be protected, and only your site player will be able to play your videos, download tools will not be able to download your video. if you want to share your live externally you can use the embed and you will still be protected. but if you want to use the m3u8 file you must disable this');
$obj->experimentalWebcam = false;
self::addDataObjectHelper('experimentalWebcam', 'Experimental Webcam', 'Requires flash and it is deprecated, will be removed. not recommend to enable it.');
$obj->doNotShowLiveOnVideosList = false;
self::addDataObjectHelper('doNotShowLiveOnVideosList', 'Do not show live on videos list', 'We will not show the live thumbs on the main Gallery page');
$obj->doNotShowOnlineOfflineLabel = false;
self::addDataObjectHelper('doNotShowOnlineOfflineLabel', 'Hide the Online/Offline Badge on live streams');
$obj->doNotShowLiveOnCategoryList = false;
self::addDataObjectHelper('doNotShowLiveOnCategoryList', 'Do not show live on site category list', 'We will not show the live thumbs on the main Gallery page');
$obj->doNotShowOfflineLiveOnCategoryList = false;
self::addDataObjectHelper('doNotShowOfflineLiveOnCategoryList', 'Do not show offline lives on site category list', 'We will not show the live thumbs on the main Gallery page if it is offline');
$obj->limitLiveOnVideosList = 12;
self::addDataObjectHelper('limitLiveOnVideosList', 'Videos List Limit', 'This will limit the maximum of videos that you will see in the Videos page');
-//$obj->doNotShowGoLiveButton = false;
-//self::addDataObjectHelper('doNotShowGoLiveButton', 'Hide Top Button', 'This will hide the "Go Live" button on the top menu bar');
+ $obj->doNotShowGoLiveButton = false;
+ self::addDataObjectHelper('doNotShowGoLiveButton', 'Hide Top Go live Button', 'This will hide the "Go Live" button on the top menu bar');
$obj->doNotProcessNotifications = false;
self::addDataObjectHelper('doNotProcessNotifications', 'Do not show notifications', 'Do not show the notification on the top bar');
$obj->useLiveServers = false;
self::addDataObjectHelper('useLiveServers', 'Use Live Servers', 'Check this if you will use External Live Servers https://github.com/WWBN/AVideo/wiki/Live-Plugin#livestream-server-balance ');
$obj->disableMeetCamera = false;
self::addDataObjectHelper('disableMeetCamera', 'Disable Meet camera', 'This requires out Meet Server, with the Meet camera you can use your PC webcam directly in the webpage or mobile to make livestreams');
$obj->playLiveInFullScreen = false;
self::addDataObjectHelper('playLiveInFullScreen', 'Play Livestream in Full Screen');
$obj->playLiveInFullScreenOnIframe = false;
self::addDataObjectHelper('playLiveInFullScreenOnIframe', 'Play Livestream in Full Screen on IFrame');
$obj->hls_path = "/HLS/live";
self::addDataObjectHelper('hls_path', 'HLS Path URL', 'Used only when we stop a Live, we use this path to delete the files');
$obj->requestStatsTimout = 4; // if the server does not respond we stop wait
self::addDataObjectHelper('requestStatsTimout', 'Stats Timout', 'If a remote server (stats page) does not respond we stop waiting after this timeout');
$obj->cacheStatsTimout = 15; // we will cache the result
self::addDataObjectHelper('cacheStatsTimout', 'Stats Cache Timeout', 'we will cache the result, this will save some resources');
$obj->requestStatsInterval = 15; // how many seconds untill request the stats again
self::addDataObjectHelper('requestStatsInterval', 'Stats Request Interval', 'how many seconds until request the stats again');
$obj->streamDeniedMsg = "You can not stream live videos";
self::addDataObjectHelper('streamDeniedMsg', 'Denied Message', 'We will show this message when a user is not allowed so watch a livestream');
$obj->allowMultipleLivesPerUser = true;
self::addDataObjectHelper('allowMultipleLivesPerUser', 'Allow Multiple Lives Per User', 'Your users will be able to make unlimited livestreams');
$obj->controllButtonsShowOnlyToAdmin_record_start = false;
self::addDataObjectHelper('controllButtonsShowOnlyToAdmin_record_start', 'Show Record Start Button Only to Admin', 'Regular users will not able to see this button');
$obj->controllButtonsShowOnlyToAdmin_record_stop = false;
self::addDataObjectHelper('controllButtonsShowOnlyToAdmin_record_stop', 'Show Record Stop Button Only to Admin', 'Regular users will not able to see this button');
$obj->controllButtonsShowOnlyToAdmin_drop_publisher = false;
self::addDataObjectHelper('controllButtonsShowOnlyToAdmin_drop_publisher', 'Show Drop Publisher Button Only to Admin', 'Regular users will not able to see this button');
$obj->controllButtonsShowOnlyToAdmin_drop_publisher_reset_key = false;
self::addDataObjectHelper('controllButtonsShowOnlyToAdmin_drop_publisher_reset_key', 'Show Drop Publisher and Reset Key Button Only to Admin', 'Regular users will not able to see this button');
$obj->controllButtonsShowOnlyToAdmin_save_dvr = false;
self::addDataObjectHelper('controllButtonsShowOnlyToAdmin_save_dvr', 'Show Save DVR Button Only to Admin', 'Regular users will not able to see this button');
-
-
+
+
$obj->webRTC_player = 'https://webrtc.ypt.me/player/';
return $obj;
}
public function getHeadCode() {
global $global;
$obj = $this->getDataObject();
// preload image
$js = "";
$css = '';
if (!empty($obj->playLiveInFullScreen)) {
if ((isLive() || isEmbed()) && canFullScreen()) {
$css .= '';
$css .= '';
}
$js .= '';
$css .= '';
}
return $js . $css;
}
public function getFooterCode() {
$obj = $this->getDataObject();
global $global;
$js = '';
if (!empty($obj->playLiveInFullScreen)) {
$js = '';
$js .= '';
} else
if (!empty($obj->playLiveInFullScreenOnIframe)) {
$js = '';
$js .= '';
}
include $global['systemRootPath'] . 'plugin/Live/view/footer.php';
return $js;
}
public function getButtonTitle() {
$o = $this->getDataObject();
return $o->button_title;
}
public function getKey() {
$o = $this->getDataObject();
return $o->key;
}
static function getDestinationApplicationName() {
$server = self::getPlayerServer();
$server = rtrim($server, "/");
$parts = explode("/", $server);
$app = array_pop($parts);
$domain = self::getControl();
//return "{$domain}/control/drop/publisher?app={$app}&name={$key}";
return "{$app}?p=" . User::getUserPass();
}
static function getDestinationHost() {
$server = self::getServer();
$host = parse_url($server, PHP_URL_HOST);
return $host;
}
static function getDestinationPort() {
$server = self::getServer();
$port = parse_url($server, PHP_URL_PORT);
if (empty($port)) {
$port = 1935;
}
return $port;
}
static function getServer($live_servers_id = -1) {
$obj = AVideoPlugin::getObjectData("Live");
if (!empty($obj->useLiveServers)) {
if ($live_servers_id < 0) {
$live_servers_id = self::getCurrentLiveServersId();
}
$ls = new Live_servers($live_servers_id);
if (!empty($ls->getRtmp_server())) {
return $ls->getRtmp_server();
}
}
return trim($obj->server);
}
static function getDropURL($key, $live_servers_id = 0) {
$server = self::getPlayerServer();
$server = rtrim($server, "/");
$parts = explode("/", $server);
$app = array_pop($parts);
$domain = self::getControl($live_servers_id);
//return "{$domain}/control/drop/publisher?app={$app}&name={$key}";
return "{$domain}?command=drop_publisher&app={$app}&name={$key}&token=" . getToken(60);
}
static function getIsRecording($key, $live_servers_id = 0) {
$server = self::getPlayerServer();
$server = rtrim($server, "/");
$parts = explode("/", $server);
$app = array_pop($parts);
$domain = self::getControl($live_servers_id);
//return "{$domain}/control/drop/publisher?app={$app}&name={$key}";
return "{$domain}?command=is_recording&app={$app}&name={$key}&token=" . getToken(60);
}
static function getStartRecordURL($key, $live_servers_id = 0) {
$server = self::getPlayerServer();
$server = rtrim($server, "/");
$parts = explode("/", $server);
$app = array_pop($parts);
$domain = self::getControl($live_servers_id);
//return "{$domain}/control/drop/publisher?app={$app}&name={$key}";
return "{$domain}?command=record_start&app={$app}&name={$key}&token=" . getToken(60);
}
static function getStopRecordURL($key, $live_servers_id = 0) {
$server = self::getPlayerServer();
$server = rtrim($server, "/");
$parts = explode("/", $server);
$app = array_pop($parts);
$domain = self::getControl($live_servers_id);
return "{$domain}?command=record_stop&app={$app}&name={$key}&token=" . getToken(60);
}
static function controlRecording($key, $live_servers_id, $start = true, $try = 0) {
if ($start) {
$url = self::getStartRecordURL($key, $live_servers_id);
} else {
$url = self::getStopRecordURL($key, $live_servers_id);
}
$response = url_get_contents($url, '', 5);
_error_log("Live:controlRecording {$url} {$live_servers_id} - [{$response}]");
$obj = new stdClass();
$obj->error = true;
$obj->msg = "";
$obj->remoteResponse = false;
if (!empty($response)) {
$json = json_decode($response);
if (!empty($json)) {
if ($start && empty($json->error) && empty($json->response) && $try < 4) {
_error_log("Live:controlRecording start record is not ready trying again in 5 seconds " . (isCommandLineInterface() ? 'From Command Line' : 'Not Command Line'));
_error_log("Live:controlRecording " . json_encode(debug_backtrace()));
sleep(5);
return self::controlRecording($key, $live_servers_id, $start, $try + 1);
}
_error_log("Live:controlRecording start record is ready {$json->response}");
$obj->error = $json->error;
$obj->msg = $json->msg;
$obj->remoteResponse = true;
} else {
$obj->msg = "JSON response fail";
}
} else {
$obj->msg = "Control response fail";
}
if ($obj->error) {
_error_log("Live::controlRecording: [$key], [$live_servers_id], [$start] " . json_encode($obj));
}
return $obj;
}
static function controlRecordingAsync($key, $live_servers_id, $start = true) {
global $global;
outputAndContinueInBackground();
$command = "php {$global['systemRootPath']}plugin/Live/controlRecording.php '$key' '$live_servers_id' '$start'";
_error_log("NGINX Live::controlRecordingAsync start ($command)");
$pid = execAsync($command);
_error_log("NGINX Live::controlRecordingAsync end {$pid}");
return $pid;
}
static function userCanRecordLive($users_id) {
if (!AVideoPlugin::isEnabledByName('SendRecordedToEncoder')) {
return false;
}
return SendRecordedToEncoder::canRecord($users_id);
}
static function getButton($command, $key, $live_servers_id = 0, $iconsOnly = false, $label = "", $class = "", $tooltip = "") {
if (!User::canStream()) {
return '';
}
global $global;
$id = "getButton" . uniqid();
$afterLabel = "";
$obj = AVideoPlugin::getDataObject('Live');
switch ($command) {
case "record_start":
if ($obj->controllButtonsShowOnlyToAdmin_record_start && !User::isAdmin()) {
return '';
}
if (!self::userCanRecordLive(User::getId())) {
return '';
}
$buttonClass = "btn btn-success";
$iconClass = "fas fa-video";
if (empty($label)) {
$label = __("Start Record");
}
if (empty($tooltip)) {
$tooltip = __("Start Record");
}
$afterLabel = '';
break;
case "record_stop":
if (!self::userCanRecordLive(User::getId())) {
return '';
}
if ($obj->controllButtonsShowOnlyToAdmin_record_stop && !User::isAdmin()) {
return '';
}
$buttonClass = "btn btn-danger";
$iconClass = "fas fa-video-slash";
if (empty($label)) {
$label = __("Stop Record");
}
if (empty($tooltip)) {
$tooltip = __("Stop Record");
}
break;
case "drop_publisher":
if ($obj->controllButtonsShowOnlyToAdmin_drop_publisher && !User::isAdmin()) {
return '';
}
$buttonClass = "btn btn-default";
$iconClass = "fas fa-wifi";
if (empty($label)) {
$label = __("Disconnect Livestream");
}
if (empty($tooltip)) {
$tooltip = __("Disconnect Livestream");
}
break;
case "drop_publisher_reset_key":
if ($obj->controllButtonsShowOnlyToAdmin_drop_publisher_reset_key && !User::isAdmin()) {
return '';
}
$buttonClass = "btn btn-default";
$iconClass = "fas fa-key";
if (empty($label)) {
$label = __("Disconnect Livestream");
}
if (empty($tooltip)) {
$tooltip = __("Disconnect Livestream") . __(" and also reset the stream name/key");
}
break;
case "save_dvr":
$obj2 = AVideoPlugin::getDataObjectIfEnabled('SendRecordedToEncoder');
if (empty($obj2) || empty($obj2->saveDVREnable)) {
return '';
}
if ($obj->controllButtonsShowOnlyToAdmin_save_dvr && !User::isAdmin()) {
return '';
}
if (!self::userCanRecordLive(User::getId())) {
return '';
}
- return ''.SendRecordedToEncoder::getSaveDVRButton($key, $live_servers_id, $class);
+ return '' . SendRecordedToEncoder::getSaveDVRButton($key, $live_servers_id, $class);
break;
default:
return '';
}
if ($iconsOnly) {
$label = "";
}
$html = "";
return $html;
}
static function getRecordControlls($key, $live_servers_id = 0, $iconsOnly = false) {
if (!User::canStream()) {
return "";
}
$btn = "
\ No newline at end of file
diff --git a/plugin/LiveLinks/view/extraItem.html b/plugin/LiveLinks/view/extraItem.html
index e10ba3dd0..880ee7fe9 100644
--- a/plugin/LiveLinks/view/extraItem.html
+++ b/plugin/LiveLinks/view/extraItem.html
@@ -1,24 +1,22 @@
\ No newline at end of file
diff --git a/plugin/LiveLinks/view/extraItemVideoPage.html b/plugin/LiveLinks/view/extraItemVideoPage.html
index dd4573aac..c2baf92cd 100644
--- a/plugin/LiveLinks/view/extraItemVideoPage.html
+++ b/plugin/LiveLinks/view/extraItemVideoPage.html
@@ -1,15 +1,15 @@
\ No newline at end of file
diff --git a/plugin/LiveLinks/view/videoListItem.html b/plugin/LiveLinks/view/videoListItem.html
index e678027e7..431dcb259 100644
--- a/plugin/LiveLinks/view/videoListItem.html
+++ b/plugin/LiveLinks/view/videoListItem.html
@@ -1,42 +1,33 @@
\ No newline at end of file
diff --git a/plugin/MobileManager/MobileManager.php b/plugin/MobileManager/MobileManager.php
index 2e5374034..02df09ff9 100644
--- a/plugin/MobileManager/MobileManager.php
+++ b/plugin/MobileManager/MobileManager.php
@@ -1,98 +1,98 @@
isReadyLabel(array('API'));
return $desc;
}
public function getName() {
return "MobileManager";
}
public function getUUID() {
return "4c1f4f76-b336-4ddc-a4de-184efe715c09";
}
public function getPluginVersion() {
return "1.5";
}
public function getEmptyDataObject() {
global $global;
$obj = new stdClass();
//$obj->aboutPage = "";
//$obj->disableGif = false;
$obj->doNotAllowAnonimusAccess = false;
$obj->doNotAllowUpload = false;
$obj->hideCreateAccount = false;
$obj->hideTabTrending = false;
$obj->hideTabLive = false;
$obj->hideTabSubscription = false;
$obj->hideTabChat2 = false;
$obj->hideTabPlayLists = false;
$obj->hideViewsCounter = false;
$obj->hideLikes = false;
$o = new stdClass();
$o->type = "textarea";
$o->value = "This Software must be used for Good, never Evil. There is no tolerance for objectionable content or abusive users. It is expressly forbidden to use this app to build porn sites, violence, racism or anything else that affects human integrity or denigrates the image of anyone.\n"
. "Any complaints, or through the application or any other electronic means will be analyzed and in case of any criteria established by the developer or local laws, are disrespected, we reserve the right to block and ban any site from our systems\n"
. "The banned site will be prohibited from using any of our resources, including mobile applications, encoder, plugins, etc.";
$obj->EULA = $o;
$obj->themeDark = false;
$obj->portraitImage = false;
$obj->netflixStyle = false;
//$obj->netflixPlayList = true;
//$obj->netflixPlayListAutoPlay = true;
$obj->netflixDateAdded = true;
//$obj->netflixDateAddedAutoPlay = true;
$obj->netflixMostPopular = true;
//$obj->netflixMostPopularAutoPlay = true;
$obj->netflixMostWatched = true;
//$obj->netflixMostWatchedAutoPlay = true;
$obj->netflixCategories = true;
//$obj->netflixCategoriesAutoPlay = true;
//$obj->netflixSortByName = false;
$obj->netflixBigVideo = true;
$obj->disableWhitelabel = false;
$obj->disableComments = false;
$obj->approvalMode = false;
$obj->showMeet = true;
- $obj->goLiveWithMeet = true;
+ $obj->goLiveWithMeet = false;
$obj->doNotAutoSearch = false;
$obj->playStoreApp = 'https://play.google.com/store/apps/details?id=mobile.youphptube.com';
$obj->appleStoreApp = 'https://apps.apple.com/us/app/youphptube/id1337322357';
$obj->pwa_background_color = "#000000";
$o = new stdClass();
$o->type = array('fullscreen', 'standalone', 'minimal-ui');
$o->value = "standalone";
$obj->pwa_display = $o;
$obj->pwa_scope = "/";
return $obj;
}
public function upload(){
}
}
diff --git a/plugin/PayPalYPT/Objects/PayPalYPT_log.php b/plugin/PayPalYPT/Objects/PayPalYPT_log.php
index f225be296..cdb010814 100644
--- a/plugin/PayPalYPT/Objects/PayPalYPT_log.php
+++ b/plugin/PayPalYPT/Objects/PayPalYPT_log.php
@@ -1,126 +1,155 @@
errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
function setId($id) {
$this->id = intval($id);
}
function setAgreement_id($agreement_id) {
$this->agreement_id = $agreement_id;
}
function setUsers_id($users_id) {
$this->users_id = intval($users_id);
}
function setJson($json) {
- if(!is_string($json)){
+ if (!is_string($json)) {
$json = _json_encode($json);
}
$this->json = $json;
}
function setRecurring_payment_id($recurring_payment_id) {
$this->recurring_payment_id = $recurring_payment_id;
}
function setValue($value) {
$this->value = floatval($value);
}
function setToken($token) {
$this->token = $token;
}
function getId() {
return intval($this->id);
}
function getAgreement_id() {
return $this->agreement_id;
}
function getUsers_id() {
return intval($this->users_id);
}
function getJson() {
return $this->json;
}
function getRecurring_payment_id() {
return $this->recurring_payment_id;
}
function getValue() {
return floatval($this->value);
}
function getToken() {
return $this->token;
}
-
+
static function getFromToken($token) {
global $global;
$sql = "SELECT * FROM " . static::getTableName() . " WHERE token = ? LIMIT 1";
// I had to add this because the about from customize plugin was not loading on the about page http://127.0.0.1/AVideo/about
$res = sqlDAL::readSql($sql, "s", array($token), true);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res) {
$row = $data;
} else {
$row = false;
}
return $row;
}
-
+
static function getFromRecurringPaymentId($recurring_payment_id) {
global $global;
$sql = "SELECT * FROM " . static::getTableName() . " WHERE recurring_payment_id = ? LIMIT 1";
// I had to add this because the about from customize plugin was not loading on the about page http://127.0.0.1/AVideo/about
$res = sqlDAL::readSql($sql, "s", array($recurring_payment_id), true);
$data = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
if ($res) {
$row = $data;
} else {
$row = false;
}
return $row;
}
+ static function getAllFromUser($users_id) {
+ global $global;
+ $sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ? ";
+
+ $sql .= self::getSqlFromPost();
+ $res = sqlDAL::readSql($sql, "i", array($users_id));
+ $fullData = sqlDAL::fetchAllAssoc($res);
+ sqlDAL::close($res);
+ $rows = array();
+ if ($res != false) {
+ foreach ($fullData as $row) {
+ $search = array('"get":{"json":"{', '}","success"');
+ $replace = array('"get":{"json":{', '},"success"');
+ $row['json'] = str_replace($search, $replace, $row['json']);
+ $rows[] = $row;
+ }
+ } else {
+ _error_log($sql . ' Error : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
+ }
+ return $rows;
+ }
+
+ public function save() {
+ global $global;
+ $this->json = $global['mysqli']->real_escape_string($this->json);
+
+ return parent::save();
+ }
+
}
diff --git a/plugin/PayPalYPT/PayPalYPT.php b/plugin/PayPalYPT/PayPalYPT.php
index 076746edd..04a70ce58 100644
--- a/plugin/PayPalYPT/PayPalYPT.php
+++ b/plugin/PayPalYPT/PayPalYPT.php
@@ -1,875 +1,880 @@
Go to Paypal developer Site here (you must have Paypal account, of course)
Click on Create App on right side of page
Choose name of your app and click Create App
Now you can see and manage everything include client ID and secret.";
}
public function getName() {
return "PayPalYPT";
}
public function getUUID() {
return "5f613a09-c0b6-4264-85cb-47ae076d949f";
}
public function getPluginVersion() {
return "2.0";
}
public function getEmptyDataObject() {
$obj = new stdClass();
$obj->ClientID = "ASUkHFpWX0T8sr8EiGdLZ05m-RAb8l-hdRxoq-OXWmua2i7EUfqFkMZvSoGgH2LhK7zAqt29IiS2oRTn";
$obj->ClientSecret = "ECxtMBsLr0cFwSCgI0uaDiVzEUbVlV3r_o_qaU-SOsQqCEOKPq4uGlr1C0mhdDmEyO30mw7-PF0bOnfo";
$obj->subscriptionButtonLabel = "Subscribe With PayPal";
$obj->paymentButtonLabel = "Pay With PayPal";
$obj->ClientSecret = "ECxtMBsLr0cFwSCgI0uaDiVzEUbVlV3r_o_qaU-SOsQqCEOKPq4uGlr1C0mhdDmEyO30mw7-PF0bOnfo";
$obj->disableSandbox = false;
return $obj;
}
public function setUpPayment($invoiceNumber, $redirect_url, $cancel_url, $total = '1.00', $currency = "USD", $description = "") {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
$notify_url = "{$global['webSiteRootURL']}plugin/PayPalYPT/ipn.php";
// After Step 2
$payer = new \PayPal\Api\Payer();
$payer->setPaymentMethod('paypal');
$amount = new \PayPal\Api\Amount();
$amount->setTotal($total);
$amount->setCurrency($currency);
$transaction = new \PayPal\Api\Transaction();
$transaction->setAmount($amount);
$transaction->setNotifyUrl($notify_url);
$transaction->setInvoiceNumber($invoiceNumber);
$transaction->setDescription($description);
$redirectUrls = new \PayPal\Api\RedirectUrls();
$redirectUrls->setReturnUrl($redirect_url)
->setCancelUrl($cancel_url);
$payment = new \PayPal\Api\Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setTransactions(array($transaction))
->setRedirectUrls($redirectUrls);
// After Step 3
try {
$payment->create($apiContext);
return $payment;
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
// This will print the detailed information on the exception.
//REALLY HELPFUL FOR DEBUGGING
_error_log("PayPal Error: " . $ex->getData());
}
return false;
}
public function getPlanDetails($plan_id) {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
try {
$plan = Plan::get($plan_id, $apiContext);
} catch (Exception $ex) {
return $ex;
}
return $plan;
}
private function executePayment() {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
// ### Approval Status
// Determine if the user approved the payment or not
// Get the payment Object by passing paymentId
// payment id was previously stored in session in
// CreatePaymentUsingPayPal.php
$paymentId = $_GET['paymentId'];
$payment = Payment::get($paymentId, $apiContext);
$amount = self::getAmountFromPayment($payment);
$total = $amount->total;
$currency = $amount->currency;
// ### Payment Execute
// PaymentExecution object includes information necessary
// to execute a PayPal account payment.
// The payer_id is added to the request query parameters
// when the user is redirected from paypal back to your site
$execution = new PaymentExecution();
$execution->setPayerId($_GET['PayerID']);
// ### Optional Changes to Amount
// If you wish to update the amount that you wish to charge the customer,
// based on the shipping address or any other reason, you could
// do that by passing the transaction object with just `amount` field in it.
// Here is the example on how we changed the shipping to $1 more than before.
$transaction = new Transaction();
$amount = new Amount();
//$details = new Details();
$amount->setCurrency($currency);
$amount->setTotal($total);
//$amount->setDetails($details);
$transaction->setAmount($amount);
// Add the above transaction object inside our Execution object.
$execution->addTransaction($transaction);
try {
// Execute the payment
// (See bootstrap.php for more on `ApiContext`)
$result = $payment->execute($execution, $apiContext);
try {
$payment = Payment::get($paymentId, $apiContext);
} catch (Exception $ex) {
return false;
}
} catch (Exception $ex) {
return false;
}
return $payment;
}
private function createBillingPlan($redirect_url, $cancel_url, $total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = 'Base Agreement', $plans_id = 0) {
global $global;
_error_log("createBillingPlan: start: " . json_encode(array($redirect_url, $cancel_url, $total, $currency, $frequency, $interval, $name)));
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
$notify_url = "{$global['webSiteRootURL']}plugin/PayPalYPT/ipn.php";
// Create a new billing plan
$plan = new Plan();
$plan->setName(substr(cleanString($name), 0, 126))
->setDescription(substr(cleanString($name), 0, 126))
->setType('INFINITE');
$paymentDefinitionArray = array();
if (!empty($plans_id)) {
$subs = new SubscriptionPlansTable($plans_id);
$trialDays = $subs->getHow_many_days_trial();
if (!empty($trialDays)) {
$trialPaymentDefinition = new PaymentDefinition();
$trialPaymentDefinition->setName('Trial Payment')
->setType('TRIAL')
->setFrequency('Day')
->setFrequencyInterval($trialDays)
->setCycles("1")
->setAmount(new Currency(array('value' => 0, 'currency' => $currency)));
$paymentDefinitionArray[] = $trialPaymentDefinition;
}
}
// Set billing plan definitions
$paymentDefinition = new PaymentDefinition();
$paymentDefinition->setName('Regular Payments')
->setType('REGULAR')
->setFrequency($frequency)
->setFrequencyInterval($interval)
->setCycles('0')
->setAmount(new Currency(array('value' => $total, 'currency' => $currency)));
$paymentDefinitionArray[] = $paymentDefinition;
$plan->setPaymentDefinitions($paymentDefinitionArray);
// Set merchant preferences
$merchantPreferences = new MerchantPreferences();
// if there is a trial do not charge a setup fee
if (empty($trialDays)) {
$merchantPreferences->setReturnUrl($redirect_url)
->setCancelUrl($cancel_url)
//->setNotifyUrl($notify_url)
->setAutoBillAmount('yes')
->setInitialFailAmountAction('CONTINUE')
->setMaxFailAttempts('0')
->setSetupFee(new Currency(array('value' => $total, 'currency' => $currency)));
} else {
$merchantPreferences->setReturnUrl($redirect_url)
->setCancelUrl($cancel_url)
//->setNotifyUrl($notify_url)
->setAutoBillAmount('yes')
->setInitialFailAmountAction('CONTINUE')
->setMaxFailAttempts('0');
}
$plan->setMerchantPreferences($merchantPreferences);
//create plan
try {
$createdPlan = $plan->create($apiContext);
try {
$patch = new Patch();
$value = new PayPalModel('{"state":"ACTIVE"}');
$patch->setOp('replace')
->setPath('/')
->setValue($value);
$patchRequest = new PatchRequest();
$patchRequest->addPatch($patch);
$createdPlan->update($patchRequest, $apiContext);
$plan = Plan::get($createdPlan->getId(), $apiContext);
_error_log("createBillingPlan: " . json_encode(array($redirect_url, $cancel_url, $total, $currency, $frequency, $interval, $name)));
// Output plan id
return $plan;
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("PayPal Error createBillingPlan 1: " . $ex->getData());
} catch (Exception $ex) {
_error_log("PayPal Error createBillingPlan 2: " . $ex->getData());
}
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("PayPal Error createBillingPlan 3: " . $ex->getData());
} catch (Exception $ex) {
_error_log("PayPal Error createBillingPlan 4: " . $ex->getData());
}
return false;
}
private function getPlanId() {
global $global;
if (!empty($_POST['plans_id'])) {
$s = new SubscriptionPlansTable($_POST['plans_id']);
$plan_id = $s->getPaypal_plan_id();
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
try {
$plan = Plan::get($plan_id, $apiContext);
if (!empty($plan)) {
return $plan->getId();
}
} catch (Exception $ex) {
return false;
}
}
return false;
}
public function setUpSubscription($invoiceNumber, $redirect_url, $cancel_url, $total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = 'Base Agreement') {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
$notify_url = "{$global['webSiteRootURL']}plugin/PayPalYPT/ipn.php";
$planId = $this->getPlanId();
if (empty($planId)) {
//createBillingPlan($redirect_url, $cancel_url, $total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = 'Base Agreement')
$plan = $this->createBillingPlan($redirect_url, $cancel_url, $total, $currency, $frequency, $interval, $name, $_POST['plans_id']);
if (empty($plan)) {
_error_log("PayPal Error setUpSubscription Plan ID is empty ");
return false;
}
$planId = $plan->getId();
// save the paypal plan ID for reuse
if (!empty($_POST['plans_id'])) {
$s = new SubscriptionPlansTable($_POST['plans_id']);
$s->setPaypal_plan_id($planId);
$s->save();
}
}
// Create new agreement
// the setup fee will be the first payment and start date is the next payment
$subs = new SubscriptionPlansTable($_POST['plans_id']);
if (!empty($subs)) {
$trialDays = $subs->getHow_many_days_trial();
}
if (!empty($trialDays)) {
$startDate = date("Y-m-d\TH:i:s.000\Z", strtotime("+12 hour"));
} else {
$startDate = date("Y-m-d\TH:i:s.000\Z", strtotime("+{$interval} {$frequency}"));
}
$agreement = new Agreement();
$agreement->setName(substr(cleanString($name), 0, 126))
->setDescription(substr(cleanString($name), 0, 126))
->setStartDate($startDate);
$plan = new Plan();
$plan->setId($planId);
$agreement->setPlan($plan);
// Add payer type
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$agreement->setPayer($payer);
try {
// Create agreement
$agreement = $agreement->create($apiContext);
// Extract approval URL to redirect user
return $agreement;
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("PayPal Error createBillingPlan 5: startDate: {$startDate} " . $ex->getData());
} catch (Exception $ex) {
_error_log("PayPal Error createBillingPlan 6: startDate: {$startDate} " . $ex->getData());
}
return false;
}
public function setUpSubscriptionV2($total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = '', $json = '', $trialDays = 0) {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
//createBillingPlanV2($total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = '', $trialDays = 0)
$plan = $this->createBillingPlanV2($total, $currency, $frequency, $interval, $name, $json, $trialDays);
if (empty($plan)) {
_error_log("setUpSubscriptionV2: PayPal Error setUpSubscription Plan ID is empty ");
return false;
}
$planId = $plan->getId();
// Create new agreement
// the setup fee will be the first payment and start date is the next payment
if (!empty($trialDays)) {
$startDate = date("Y-m-d\TH:i:s.000\Z", strtotime("+12 hour"));
} else {
$startDate = date("Y-m-d\TH:i:s.000\Z", strtotime("+{$interval} {$frequency}"));
}
$agreement = new Agreement();
$agreement->setName(substr(cleanString($name), 0, 126))
->setDescription(substr(cleanString($json), 0, 126))
->setStartDate($startDate);
$plan = new Plan();
$plan->setId($planId);
$agreement->setPlan($plan);
// Add payer type
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$agreement->setPayer($payer);
try {
// Create agreement
$agreement = $agreement->create($apiContext);
// Extract approval URL to redirect user
return $agreement;
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("setUpSubscriptionV2: PayPal Error createBillingPlan 5: startDate: {$startDate} " . $ex->getData());
} catch (Exception $ex) {
_error_log("setUpSubscriptionV2: PayPal Error createBillingPlan 6: startDate: {$startDate} " . $ex->getData());
}
return false;
}
private function createBillingPlanV2($total = '1.00', $currency = "USD", $frequency = "Month", $interval = 1, $name = '', $json = '', $trialDays = 0) {
global $global;
$currency = strtoupper($currency);
_error_log("createBillingPlanV2: createBillingPlan: start: " . json_encode(array($total, $currency, $frequency, $interval, $name, $trialDays)));
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
$notify_url = "{$global['webSiteRootURL']}plugin/PayPalYPT/ipnV2.php";
$notify_url = addQueryStringParameter($notify_url, 'json', $json);
$cancel_url = addQueryStringParameter($notify_url, 'success', 0);
$success_url = addQueryStringParameter($notify_url, 'success', 1);
// Create a new billing plan
$plan = new Plan();
$plan->setName(substr(cleanString($name), 0, 126))
- ->setDescription(substr(cleanString($name), 0, 126))
+ ->setDescription(substr(json_encode(User::getId()), 0, 126))
->setType('INFINITE');
$paymentDefinitionArray = array();
if (!empty($trialDays)) {
$trialPaymentDefinition = new PaymentDefinition();
$trialPaymentDefinition->setName('Trial Payment')
->setType('TRIAL')
->setFrequency('Day')
->setFrequencyInterval($trialDays)
->setCycles("1")
->setAmount(new Currency(array('value' => 0, 'currency' => $currency)));
$paymentDefinitionArray[] = $trialPaymentDefinition;
}
// Set billing plan definitions
$paymentDefinition = new PaymentDefinition();
$paymentDefinition->setName('Regular Payments')
->setType('REGULAR')
->setFrequency($frequency)
->setFrequencyInterval($interval)
->setCycles('0')
->setAmount(new Currency(array('value' => $total, 'currency' => $currency)));
$paymentDefinitionArray[] = $paymentDefinition;
$plan->setPaymentDefinitions($paymentDefinitionArray);
// Set merchant preferences
$merchantPreferences = new MerchantPreferences();
// if there is a trial do not charge a setup fee
if (empty($trialDays)) {
$merchantPreferences->setReturnUrl($success_url)
->setCancelUrl($cancel_url)
->setNotifyUrl($notify_url)
- ->setAutoBillAmount('yes')
+ ->setAutoBillAmount('YES')
->setInitialFailAmountAction('CONTINUE')
->setMaxFailAttempts('0')
->setSetupFee(new Currency(array('value' => $total, 'currency' => $currency)));
} else {
$merchantPreferences->setReturnUrl($success_url)
->setCancelUrl($cancel_url)
->setNotifyUrl($notify_url)
- ->setAutoBillAmount('yes')
+ ->setAutoBillAmount('YES')
->setInitialFailAmountAction('CONTINUE')
->setMaxFailAttempts('0');
}
$plan->setMerchantPreferences($merchantPreferences);
//create plan
try {
$createdPlan = $plan->create($apiContext);
try {
$patch = new Patch();
$value = new PayPalModel('{"state":"ACTIVE"}');
$patch->setOp('replace')
->setPath('/')
->setValue($value);
$patchRequest = new PatchRequest();
$patchRequest->addPatch($patch);
$createdPlan->update($patchRequest, $apiContext);
$plan = Plan::get($createdPlan->getId(), $apiContext);
_error_log("createBillingPlanV2: createBillingPlan: " . json_encode(array($total, $currency, $frequency, $interval, $name, $trialDays, $plan)));
// Output plan id
return $plan;
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("createBillingPlanV2: PayPal Error createBillingPlan 1: " . $ex->getData());
} catch (Exception $ex) {
_error_log("createBillingPlanV2: PayPal Error createBillingPlan 2: " . $ex->getData());
}
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("createBillingPlanV2: PayPal Error createBillingPlan 3: " . $ex->getData());
} catch (Exception $ex) {
_error_log("createBillingPlanV2: PayPal Error createBillingPlan 4: " . $ex->getData());
}
return false;
}
private function executeBillingAgreement() {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
$token = $_GET['token'];
$agreement = new \PayPal\Api\Agreement();
try {
// Execute agreement
_error_log("PayPal Try to execute ");
$agreement->execute($token, $apiContext);
return $agreement;
} catch (PayPal\Exception\PayPalConnectionException $ex) {
_error_log("PayPal Error executeBillingAgreement: " . $ex->getData());
} catch (Exception $ex) {
_error_log("PayPal Error executeBillingAgreement: " . $ex);
}
return false;
}
static function getBillingAgreement($agreement_id) {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
return Agreement::get($agreement_id, $apiContext);
}
static function cancelAgreement($agreement_id) {
global $global;
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
//Create an Agreement State Descriptor, explaining the reason to suspend.
$agreementStateDescriptor = new AgreementStateDescriptor();
$agreementStateDescriptor->setNote("Canceled by user");
$createdAgreement = self::getBillingAgreement($agreement_id);
try {
$createdAgreement->suspend($agreementStateDescriptor, $apiContext);
// Lets get the updated Agreement Object
return Agreement::get($createdAgreement->getId(), $apiContext);
} catch (Exception $ex) {
return false;
}
}
function execute() {
if (!empty($_GET['paymentId'])) {
_error_log("PayPal Execute payment ");
return $this->executePayment();
} else if (!empty($_GET['token'])) {
_error_log("PayPal Billing Agreement ");
return $this->executeBillingAgreement();
}
_error_log("PayPal no payment to execute ");
return false;
}
static function getAmountFromPayment($payment) {
if (!is_object($payment)) {
return false;
}
if (get_class($payment) === 'PayPal\Api\Agreement') {
$amount = new stdClass();
//_error_log("getAmountFromPayment: ".json_encode($payment));
//_error_log("getAmountFromPayment: ". print_r($payment, true));
//_error_log("getAmountFromPayment: ".($payment->getId()));
//_error_log("getAmountFromPayment: ".($payment->getPlan()));
//_error_log("getAmountFromPayment: ".($payment->getPlan()->payment_definitions->amount->value));
//_error_log("getAmountFromPayment: ".($payment->getPlan()->merchant_preferences->setup_fee->value));
//$amount->total = $payment->agreement_details->last_payment_amount->value;
if (!empty(@$payment->getPlan()->payment_definitions->amount->value)) {
$amount->total = $payment->getPlan()->payment_definitions->amount->value;
} else if (!empty(@$payment->getPlan()->merchant_preferences->setup_fee->value)) {
$amount->total = $payment->getPlan()->merchant_preferences->setup_fee->value;
} else {
$amount->total = 0;
}
$amount->total = floatval($amount->total);
return $amount;
} else {
return $payment->getTransactions()[0]->amount;
}
}
function sendToPayPal($invoiceNumber, $redirect_url, $cancel_url, $total, $currency) {
$payment = $this->setUpPayment($invoiceNumber, $redirect_url, $cancel_url, $total, $currency);
if (!empty($payment)) {
header("Location: {$payment->getApprovalLink()}");
exit;
}
}
static function updateBillingPlan($plan_id, $total = '1.00', $currency = "USD", $interval = 1, $name = 'Base Agreement') {
global $global;
if (empty($plan_id)) {
return false;
}
require $global['systemRootPath'] . 'plugin/PayPalYPT/bootstrap.php';
$createdPlan = Plan::get($plan_id, $apiContext);
try {
$patch1 = new Patch();
$patch1->setOp('replace')
->setPath('/')
->setValue(_json_decode('{"name": "' . $name . '"}'));
$paymentDefinitions = $createdPlan->getPaymentDefinitions();
$paymentDefinition = $paymentDefinitions[0];
$paymentDefinitionId = $paymentDefinition->getId();
$patch2 = new Patch();
$patch2->setOp('replace')
->setPath('/payment-definitions/' . $paymentDefinitionId)
->setValue(_json_decode('{
"amount": {
"currency": "' . $currency . '",
"value": "' . $total . '"
},
"frequency_interval": "' . $interval . '"
}'));
$patchRequest = new PatchRequest();
$patchRequest->addPatch($patch1);
$patchRequest->addPatch($patch2);
$createdPlan->update($patchRequest, $apiContext);
return Plan::get($createdPlan->getId(), $apiContext);
} catch (Exception $ex) {
_error_log("PayPal Error updateBillingPlan: " . $ex->getData());
}
return false;
}
static function IPNcheck() {
$obj = AVideoPlugin::getDataObject('PayPalYPT');
$raw_post_data = file_get_contents('php://input');
$raw_post_array = explode('&', $raw_post_data);
$myPost = array();
foreach ($raw_post_array as $keyval) {
$keyval = explode('=', $keyval);
if (count($keyval) == 2)
$myPost[$keyval[0]] = urldecode($keyval[1]);
}
// read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'
$req = 'cmd=_notify-validate';
if (function_exists('get_magic_quotes_gpc')) {
$get_magic_quotes_exists = true;
}
foreach ($myPost as $key => $value) {
if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
$value = urlencode(stripslashes($value));
} else {
$value = urlencode($value);
}
$req .= "&$key=$value";
}
// Step 2: POST IPN data back to PayPal to validate
$ipnURL = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr';
if(!empty($obj->disableSandbox)){
$ipnURL = 'https://ipnpb.paypal.com/cgi-bin/webscr';
}
_error_log("IPNcheck: URL {$ipnURL} [$req]");
$ch = curl_init($ipnURL);
//curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-IPN-VerificationScript');
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'User-Agent: PHP-IPN-Verification-Script',
'Connection: Close',
));
// In wamp-like environments that do not come bundled with root authority certificates,
// please download 'cacert.pem' from "https://curl.haxx.se/docs/caextract.html" and set
// the directory path of the certificate as shown below:
// curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
if (!($res = curl_exec($ch))) {
_error_log("IPNcheck: Got " . curl_error($ch) . " when processing IPN data");
curl_close($ch);
exit;
}
// inspect IPN validation result and act accordingly
if (strcmp($res, "VERIFIED") == 0) {
_error_log("IPNcheck SUCCESS: The response from IPN was: " . $res . "");
return true;
} else if (strcmp($res, "INVALID") == 0) {
// IPN invalid, log for manual investigation
_error_log("IPNcheck ERROR: The response from IPN was: " . $res . "");
return false;
}
_error_log("IPNcheck ERROR: Unknow response from IPN : " . $res . "");
return false;
curl_close($ch);
}
public static function setUserReceiverEmail($users_id, $email) {
$user = new User($users_id);
$paramName = 'PayPalReceiverEmail';
return $user->addExternalOptions($paramName, $email);
}
public static function getUserReceiverEmail($users_id) {
$user = new User($users_id);
$paramName = 'PayPalReceiverEmail';
return $user->getExternalOption($paramName);
}
public function getMyAccount($users_id) {
global $global;
$obj = AVideoPlugin::getDataObjectIfEnabled('YPTWallet');
if (empty($obj) || empty($obj->enableAutoWithdrawFundsPagePaypal)) {
return '';
}
include $global['systemRootPath'] . 'plugin/PayPalYPT/payOutReceiverEmailForm.php';
}
public static function WalletPayout($users_id_to_be_paid, $value) {
global $config, $global;
$obj = new stdClass();
$obj->error = true;
$obj->msg = '';
$obj->response = false;
if (empty($value)) {
$obj->msg = 'value is empty';
return $obj;
}
$wallet = AVideoPlugin::getDataObjectIfEnabled('YPTWallet');
if (empty($wallet)) {
$obj->msg = 'YPTWallet plugin is disabled';
return $obj;
}
// check if the user has a paypal email
$receiver_email = self::getUserReceiverEmail($users_id_to_be_paid);
if (empty($receiver_email)) {
$obj->msg = "The user {$users_id_to_be_paid} does not have a paypal receiver email";
return $obj;
}
mysqlBeginTransaction();
// transfer money from wallet
$description = "Paypal payout to {$receiver_email} [users_id=$users_id_to_be_paid]";
$transfer = YPTWallet::transferBalanceToSiteOwner($users_id_to_be_paid, $value, $description, true);
if ($transfer) {
$email_subject = $note = "You received " . YPTWallet::formatCurrency($value) . " from " . $config->getWebSiteTitle() . " ";
// payout using paypal
$obj->response = self::Payout($receiver_email, $value, $wallet->currency, $note, $email_subject);
if (empty($obj->response) || !empty($obj->response->error)) {
$description = "Paypal refund";
$obj->msg = 'PayPal Payout error: ' . $obj->response->msg;
$transfer = YPTWallet::transferBalanceFromSiteOwner($users_id_to_be_paid, $value, $description, true);
mysqlRollback();
return $obj;
}else{
$payout_batch_id = $obj->response->response->result->batch_header->payout_batch_id;
$paymentLink = " ";
$description .= $paymentLink;
YPTWallet::setLogInfo($transfer, $obj->response);
YPTWallet::setLogDescription($transfer, $description);
}
$obj->error = false;
}
mysqlCommit();
return $obj;
}
public static function Payout($receiver_email, $value, $currency = 'USD', $note = '', $email_subject = '') {
$obj = new stdClass();
$obj->msg = '';
$obj->error = true;
$obj->response = false;
if (empty($value)) {
$obj->msg = 'PayPal::Payout value is empty';
_error_log($obj->msg);
return $obj;
}
if (empty($receiver_email)) {
$obj->msg = "PayPal::Payout The user {$users_id_to_be_paid} does not have a paypal receiver email";
_error_log($obj->msg);
return $obj;
}
$wallet = AVideoPlugin::getDataObjectIfEnabled('YPTWallet');
if (empty($wallet) || empty($wallet->enableAutoWithdrawFundsPagePaypal)) {
$obj->msg = 'PayPal::Payout Wallet enableAutoWithdrawFundsPagePaypal is disabled';
_error_log($obj->msg);
return $obj;
}
try {
$request = new PaypalPayoutsSDK\Payouts\PayoutsPostRequest();
$request->body = new stdClass();
$request->body->sender_batch_header = new stdClass();
$request->body->sender_batch_header->email_subject = $email_subject;
$item = new stdClass();
$item->recipient_type = 'EMAIL';
$item->receiver = $receiver_email;
$item->note = $note;
$item->amount = new stdClass();
$item->amount->currency = $currency;
$item->amount->value = $value;
$request->body->items = array($item);
$request->body = object_to_array($request->body);
$client = PayPalClient::client();
$obj->response = $client->execute($request);
// To toggle printing the whole response body comment/uncomment below line
$msg = json_encode($obj->response, JSON_PRETTY_PRINT) . PHP_EOL;
$obj->msg = 'PayPal::Payout ' . $msg;
_error_log($obj->msg);
if(is_object($obj->response) && $obj->response->statusCode == 201){
$obj->error = false;
}
return $obj;
} catch (HttpException $e) {
$msg = '';
//Parse failure response
$msg .= $e->getMessage() . PHP_EOL;
$error = json_decode($e->getMessage());
$msg .= $error->message . PHP_EOL;
$msg .= $error->name . PHP_EOL;
$msg .= $error->debug_id . PHP_EOL;
$obj->msg = 'PayPal::Payout ' . $msg;
_error_log($obj->msg);
}
return $obj;
}
public static function getPayoutInfo($payout_batch_id) {
try {
$request = new PaypalPayoutsSDK\Payouts\PayoutsGetRequest($payout_batch_id);
$client = PayPalClient::client();
return $client->execute($request);
} catch (HttpException $e) {
$msg = '';
//Parse failure response
$msg .= $e->getMessage() . PHP_EOL;
$error = json_decode($e->getMessage());
$msg .= $error->message . PHP_EOL;
$msg .= $error->name . PHP_EOL;
$msg .= $error->debug_id . PHP_EOL;
$obj->msg = 'PayPal::PayoutInfo ' . $msg;
_error_log($obj->msg);
}
return $obj;
}
public function getWalletConfigurationHTML($users_id, $wallet, $walletDataObject) {
global $global;
$obj = AVideoPlugin::getDataObjectIfEnabled('YPTWallet');
if (empty($obj->enableAutoWithdrawFundsPagePaypal)) {
return '';
}
include_once $global['systemRootPath'] . 'plugin/PayPalYPT/getWalletConfigurationHTML.php';
}
public function getPluginMenu() {
global $global;
return '';
}
static function isTokenUsed($token){
$row = PayPalYPT_log::getFromToken($token);
return !empty($row);
}
static function isRecurringPaymentIdUsed($recurring_payment_id){
$row = PayPalYPT_log::getFromRecurringPaymentId($recurring_payment_id);
return !empty($row);
}
+
+ static function getAllLogsFromUser($users_id){
+ $rows = PayPalYPT_log::getAllFromUser($users_id);
+ return $rows;
+ }
}
diff --git a/plugin/PayPalYPT/agreementCancel.json.php b/plugin/PayPalYPT/agreementCancel.json.php
new file mode 100644
index 000000000..e2c92689a
--- /dev/null
+++ b/plugin/PayPalYPT/agreementCancel.json.php
@@ -0,0 +1,37 @@
+error = true;
+$obj->msg = "";
+
+if (!User::isLogged()) {
+ $obj->msg = "Only for Logged";
+ die(json_encode($obj));
+}
+
+if (empty($_REQUEST['agreement'])) {
+ $obj->msg = "Empty Agreement ID";
+ die(json_encode($obj));
+}
+
+if(!User::isLogged()){
+ $obj->msg = "Please login first";
+ die(json_encode($obj));
+}
+
+$plugin = AVideoPlugin::loadPluginIfEnabled("PayPalYPT");
+
+$agreement = PayPalYPT::cancelAgreement($_REQUEST['agreement']);
+
+if(empty($agreement)){
+ $obj->msg = "Agreement not found";
+ die(json_encode($obj));
+}
+
+$obj->error = false;
+_error_log("agreementCancel: ".json_encode($agreement->getAgreementDetails()));
+die(json_encode($obj));
+?>
\ No newline at end of file
diff --git a/plugin/PayPalYPT/ipnV2.php b/plugin/PayPalYPT/ipnV2.php
index fae4d440f..848c1ba8c 100644
--- a/plugin/PayPalYPT/ipnV2.php
+++ b/plugin/PayPalYPT/ipnV2.php
@@ -1,125 +1,142 @@
error = true;
$obj->msg = '';
$redirectUri = YPTWallet::getAddFundsSuccessRedirectURL();
if (empty($redirectUri)) {
$redirectUri = getRedirectUri();
}
if (empty($plugin)) {
$obj->msg = 'Wallet Disabled';
die(json_encode($obj));
}
if (empty($paypal)) {
$obj->msg = 'PayPal Disabled';
die(json_encode($obj));
}
if (empty($_REQUEST['success'])) {
header('Location: ' . $redirectUri);
exit;
}
-_error_log("PayPalIPN V2: " . json_encode($obj));
_error_log("PayPalIPN V2: POST " . json_encode($_POST));
_error_log("PayPalIPN V2: GET " . json_encode($_GET));
$json = _json_decode(@$_GET['json']);
if (User::isLogged()) {
$json->users_id = User::getId();
}
if (!empty($_GET['token'])) {
_error_log("PayPalIPN V2: token {$_GET['token']} ");
if (!PayPalYPT::isTokenUsed($_GET['token'])) {
_error_log("PayPalIPN V2: token will be processed ");
$agreement = $paypal->execute();
- $payment_amount = floatval($agreement->agreement_details->last_payment_amount->value);
- $payment_currency = $agreement->agreement_details->last_payment_amount->currency;
+ //_error_log("PayPalIPN V2: agreement ". print_r($agreement->getAgreementDetails()->getLastPaymentAmount()->getValue(), true));
+
+ if ($agreement->getState() !== 'Active') {
+ $obj->msg = 'The Agreement is not active yet ';
+ _error_log("PayPalIPN V2: {$obj->msg} ");
+ die(json_encode($obj));
+ }
+
+ $lastPayment = $agreement->getAgreementDetails()->getLastPaymentAmount();
+ if (empty($lastPayment)) {
+ $lastPayment = $agreement->getPlan()->getMerchantPreferences()->getSetupFee();
+ }
+ if (empty($lastPayment)) {
+ _error_log("PayPalIPN V2: agreement " . print_r($agreement, true));
+ var_dump($agreement);
+ exit;
+ }
+ $payment_amount = floatval($lastPayment->getValue());
+ $payment_currency = $lastPayment->getCurrency();
//$payment_time = strtotime($agreement->agreement_details->last_payment_date);
$pp = new PayPalYPT_log(0);
$pp->setUsers_id($json->users_id);
$pp->setAgreement_id($agreement->id);
$pp->setToken($_GET['token']);
$pp->setValue($payment_amount);
- $pp->setJson(array('agreement' => $agreement, 'post' => $_POST, 'get' => $_GET));
+ $pp->setJson(array('post' => $_POST, 'get' => $_GET));
} else {
_error_log("PayPalIPN V2: token was already processed ");
}
//var_dump($agreement, date('Y-m-d\TH:i:s'));
//exit;
} else {
$ipn = PayPalYPT::IPNcheck();
if (!$ipn) {
$obj->msg = 'IPN Fail';
_error_log("PayPalIPN V2: IPN Fail ");
die(json_encode($obj));
}
_error_log("PayPalIPN V2: else ");
if (!PayPalYPT::isRecurringPaymentIdUsed($_POST["verify_sign"])) {
_error_log("PayPalIPN V2: verify_sign will be processed ");
$payment_amount = empty($_POST['mc_gross']) ? $_POST['amount'] : $_POST['mc_gross'];
$payment_currency = empty($_POST['mc_currency']) ? $_POST['currency_code'] : $_POST['mc_currency'];
$pp = new PayPalYPT_log(0);
$pp->setUsers_id($json->users_id);
$pp->setRecurring_payment_id($_POST["verify_sign"]);
$pp->setValue($payment_amount);
$pp->setJson(array('ipn' => $ipn, 'post' => $_POST, 'get' => $_GET));
} else {
_error_log("PayPalIPN V2: verify_sign was already processed ");
}
}
if (!empty($pp) && is_object($pp)) {
if ($pp->save()) {
if ($walletObject->currency === $payment_currency) {
_error_log("PayPalIPN V2: token log saved $json->users_id, $payment_amount");
if (!empty($payment_amount) && !empty($json->users_id)) {
$plugin->addBalance($json->users_id, $payment_amount, "PayPal Subscription from token", json_encode($_POST));
} else {
_error_log("PayPalIPN V2: ERROR balance not added");
}
} else {
_error_log("PayPalIPN V2: Invalid currency $walletObject->currency===$payment_currency ");
}
} else {
_error_log("PayPalIPN V2: FAIL to save log");
}
}
if (!empty($json->type)) {
switch ($json->type) {
case 'FansSubscriptions':
_error_log("PayPalIPN V2 FansSubscriptions");
if (!empty($json->Fsubscriptions_plan_id) && !empty($json->users_id)) {
$fsObj = AVideoPlugin::getDataObjectIfEnabled('FansSubscriptions');
if (!empty($fsObj) && !empty($json->users_id)) {
- if (FansSubscriptions::renew($json->users_id, $json->Fsubscriptions_plan_id)) {
+ if ($renew = FansSubscriptions::renew($json->users_id, $json->Fsubscriptions_plan_id)) {
+ $redirectUri = addQueryStringParameter($redirectUri, 'msg', $renew->msg);
header('Location: ' . $redirectUri);
exit;
}
}
}
break;
}
}
_error_log("PayPalIPN V2 END");
?>
\ No newline at end of file
diff --git a/plugin/PayPalYPT/subscriptions_list.php b/plugin/PayPalYPT/subscriptions_list.php
new file mode 100644
index 000000000..4d1de9140
--- /dev/null
+++ b/plugin/PayPalYPT/subscriptions_list.php
@@ -0,0 +1,118 @@
+
+
+
+
+ Paypal subscriptions
+
+
+
+
+
+
+
+
+
+
#
+
+
+
+
+
+
+
+
+ getState();
+ }
+ }
+ ?>
+
+
+
+ get->json->type; ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugin/PlayLists/PlayLists.php b/plugin/PlayLists/PlayLists.php
index 252bbe6f0..444348369 100644
--- a/plugin/PlayLists/PlayLists.php
+++ b/plugin/PlayLists/PlayLists.php
@@ -1,759 +1,759 @@
")
. __(" You can use the Edit Parameters button to rename it to your choosing. We recommend to keep the Program name ")
. __("as it is defaulted to in order to be well indexed in the SearchTube and Other AVideo Platform search and network indexing tools.");
}
public function getName() {
return __("Programs");
}
public function getUUID() {
return "plist12345-370-4b1f-977a-fd0e5cabtube";
}
public function getPluginVersion() {
return "1.0";
}
public function getEmptyDataObject() {
global $global;
$obj = new stdClass();
$obj->name = __("Program");
$obj->playOnSelect = true;
$obj->autoadvance = true;
$obj->usersCanOnlyCreatePlayListsFromTheirContent = false;
$obj->useOldPlayList = false;
$obj->expandPlayListOnChannels = false;
$obj->usePlaylistPlayerForSeries = true;
$obj->showWatchLaterOnLeftMenu = true;
$obj->showFavoriteOnLeftMenu = true;
$obj->showWatchLaterOnProfileMenu = true;
$obj->showFavoriteOnProfileMenu = true;
$obj->showPlayLiveButton = true;
$obj->showTrailerInThePlayList = true;
$obj->showTVFeatures = false;
return $obj;
}
public function getWatchActionButton($videos_id) {
global $global, $livet;
if (isLive() && empty($videos_id) && !empty($livet)) {
include $global['systemRootPath'] . 'plugin/PlayLists/actionButtonLive.php';
} else {
if (!self::canAddVideoOnPlaylist($videos_id)) {
return "";
}
$obj = $this->getDataObject();
//echo "getNetflixActionButton: ".$videos_id;
$btnClass = "btn btn-default no-outline";
include $global['systemRootPath'] . 'plugin/PlayLists/actionButton.php';
}
}
public function getNetflixActionButton($videos_id) {
global $global;
if (!self::canAddVideoOnPlaylist($videos_id)) {
return "";
}
$obj = $this->getDataObject();
//echo "getNetflixActionButton: ".$videos_id;
$btnClass = "btn btn-primary";
include $global['systemRootPath'] . 'plugin/PlayLists/actionButton.php';
}
public function getGalleryActionButton($videos_id) {
global $global;
if (!self::canAddVideoOnPlaylist($videos_id)) {
return "";
}
$obj = $this->getDataObject();
//echo "getNetflixActionButton: ".$videos_id;
- $btnClass = "text-primary";
+ $btnClass = "";
echo '
';
include $global['systemRootPath'] . 'plugin/PlayLists/actionButton.php';
echo '
';
}
public function getHeadCode() {
global $global;
$obj = $this->getDataObject();
$css = '';
$css .= '';
if (!empty(getPlaylists_id())) {
$css .= "";
}
return $css;
}
public function getFooterCode() {
global $global;
$obj = $this->getDataObject();
include $global['systemRootPath'] . 'plugin/PlayLists/footer.php';
$js = '';
if (isEmbed()) {
if (self::showTVFeatures()) {
$js .= '';
}
}
if (isLive() && self::showTVFeatures()) {
if (!empty($_REQUEST['playlists_id_live']) &&
!self::isPlaylistLive($_REQUEST['playlists_id_live']) &&
self::canManagePlaylist($_REQUEST['playlists_id_live'])) {
$liveLink = PlayLists::getLiveLink($_REQUEST['playlists_id_live']);
$js .= '';
}
}
if (!empty(getPlaylists_id())) {
PlayerSkins::getStartPlayerJS(file_get_contents("{$global['systemRootPath']}plugin/PlayLists/playerButton.js"));
}
return $js;
}
static function canAddVideoOnPlaylist($videos_id) {
if (empty($videos_id)) {
return false;
}
$obj = AVideoPlugin::getObjectData("PlayLists");
if (!User::isAdmin() && $obj->usersCanOnlyCreatePlayListsFromTheirContent) {
if (User::isLogged()) {
$users_id = Video::getOwner($videos_id);
if (User::getId() == $users_id) {
return true;
}
}
return false;
}
return true;
}
static function isVideoOnFavorite($videos_id, $users_id) {
return PlayList::isVideoOnFavorite($videos_id, $users_id);
}
static function isVideoOnWatchLater($videos_id, $users_id) {
return PlayList::isVideoOnWatchLater($videos_id, $users_id);
}
static function getFavoriteIdFromUser($users_id) {
return PlayList::getFavoriteIdFromUser($users_id);
}
static function getWatchLaterIdFromUser($users_id) {
return PlayList::getWatchLaterIdFromUser($users_id);
}
static function getWatchLaterLink() {
if (!User::isLogged()) {
return "";
}
global $global;
return "{$global['webSiteRootURL']}watch-later";
}
static function getFavoriteLink() {
if (!User::isLogged()) {
return "";
}
global $global;
return "{$global['webSiteRootURL']}favorite";
}
public function thumbsOverlay($videos_id) {
global $global;
include $global['systemRootPath'] . 'plugin/PlayLists/buttons.php';
}
static function isPlayListASerie($serie_playlists_id) {
global $global, $config;
$serie_playlists_id = intval($serie_playlists_id);
$sql = "SELECT * FROM videos WHERE serie_playlists_id = ? LIMIT 1";
$res = sqlDAL::readSql($sql, "i", array($serie_playlists_id), true);
$video = sqlDAL::fetchAssoc($res);
sqlDAL::close($res);
return $video;
}
static function removeSerie($serie_playlists_id) {
$video = self::isPlayListASerie($serie_playlists_id);
if (!empty($video)) {
$video = new Video("", "", $video['id']);
return $video->delete();
}
return false;
}
static function saveSerie($serie_playlists_id) {
$playlist = new PlayList($serie_playlists_id);
if (empty($playlist)) {
return false;
}
$video = self::isPlayListASerie($serie_playlists_id);
if (!empty($video)) {
$filename = $video['filename'];
$v = new Video("", "", $video['id']);
} else {
$filename = 'serie_playlists_' . uniqid();
$v = new Video("", $filename);
}
$v->setTitle($playlist->getName());
$v->setSerie_playlists_id($serie_playlists_id);
$v->setUsers_id($playlist->getUsers_id());
$v->setStatus('u');
$v->setFilename($filename);
$v->setType("serie");
return $v->save();
}
public function getStart() {
global $global;
$whitelistedFiles = array('VMAP.php');
$baseName = basename($_SERVER["SCRIPT_FILENAME"]);
if (!in_array($baseName, $whitelistedFiles)) {
if (!empty($_GET['videoName'])) {
$obj = $this->getDataObject();
if ($obj->usePlaylistPlayerForSeries) {
$video = Video::getVideoFromCleanTitle($_GET['videoName']);
if ($video['type'] == 'serie' && !empty($video['serie_playlists_id'])) {
if (basename($_SERVER["SCRIPT_FILENAME"]) == "videoEmbeded.php") {
$link = PlayLists::getLink($video['serie_playlists_id'], true);
} else {
$link = PlayLists::getLink($video['serie_playlists_id']);
}
header("Location: {$link}");
exit;
}
}
}
}
}
static function getLink($playlists_id, $embed = false) {
global $global;
$obj = AVideoPlugin::getObjectData("PlayLists");
if ($embed) {
return $global['webSiteRootURL'] . "plugin/PlayLists/embed.php?playlists_id=" . $playlists_id;
} else {
if (empty($obj->useOldPlayList)) {
return $global['webSiteRootURL'] . "plugin/PlayLists/player.php?playlists_id=" . $playlists_id;
} else {
return $global['webSiteRootURL'] . "program/" . $playlists_id;
}
}
}
public function navBarButtons() {
global $global;
$obj = AVideoPlugin::getObjectData("PlayLists");
$str = "";
if ($obj->showWatchLaterOnLeftMenu) {
$str .= '
showChannelHomeTab) {
if (!empty($_GET['current'])) { // means you are paging the Videos tab
$active = "";
}
$obj = AVideoPlugin::getObjectData("YouPHPFlix2");
?>
-
\ No newline at end of file
diff --git a/view/channelPlaylistItems.php b/view/channelPlaylistItems.php
index c74012f4f..5b13317a9 100644
--- a/view/channelPlaylistItems.php
+++ b/view/channelPlaylistItems.php
@@ -1,596 +1,598 @@
".__('Sorry you do not have anything available')."
";
+
+ if ($current == 1) {
+ echo "
" . __('Sorry you do not have anything available') . "