mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
Add a new video status
unlisted but searchable
This commit is contained in:
parent
f509db6cc6
commit
f574e97d2a
32 changed files with 1297 additions and 435 deletions
|
@ -3922,11 +3922,11 @@ function convertImageToRoku($source, $destination) {
|
|||
|
||||
function convertImageIfNotExists($source, $destination, $width, $height, $scaleUp = true) {
|
||||
if (empty($source)) {
|
||||
_error_log("convertImageToRoku: source image is empty");
|
||||
_error_log("convertImageIfNotExists: source image is empty");
|
||||
return false;
|
||||
}
|
||||
if (!file_exists($source)) {
|
||||
_error_log("convertImageToRoku: source does not exists");
|
||||
_error_log("convertImageIfNotExists: source does not exists");
|
||||
return false;
|
||||
}
|
||||
if (file_exists($destination) && filesize($destination) > 1024) {
|
||||
|
|
|
@ -5,6 +5,7 @@ if (!isset($global['systemRootPath'])) {
|
|||
}
|
||||
class Sites extends ObjectYPT
|
||||
{
|
||||
protected $id;
|
||||
protected $name;
|
||||
protected $url;
|
||||
protected $status;
|
||||
|
|
|
@ -7,13 +7,13 @@ require_once $global['systemRootPath'] . 'objects/bootGrid.php';
|
|||
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||
|
||||
class Subscribe extends ObjectYPT{
|
||||
private $id;
|
||||
private $email;
|
||||
private $status;
|
||||
private $ip;
|
||||
private $users_id;
|
||||
private $notify;
|
||||
private $subscriber_users_id;
|
||||
protected $id;
|
||||
protected $email;
|
||||
protected $status;
|
||||
protected $ip;
|
||||
protected $users_id;
|
||||
protected $notify;
|
||||
protected $subscriber_users_id;
|
||||
|
||||
public function __construct($id, $email = "", $user_id = "", $subscriber_users_id = "")
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ class Subscribe extends ObjectYPT{
|
|||
return true;
|
||||
}
|
||||
|
||||
private function loadFromEmail($email, $user_id, $status = "a")
|
||||
protected function loadFromEmail($email, $user_id, $status = "a")
|
||||
{
|
||||
$obj = self::getSubscribeFromEmail($email, $user_id, $status);
|
||||
if (empty($obj)) {
|
||||
|
@ -54,7 +54,7 @@ class Subscribe extends ObjectYPT{
|
|||
return true;
|
||||
}
|
||||
|
||||
private function loadFromId($subscriber_users_id, $user_id, $status = "a")
|
||||
protected function loadFromId($subscriber_users_id, $user_id, $status = "a")
|
||||
{
|
||||
$obj = self::getSubscribeFromID($subscriber_users_id, $user_id, $status);
|
||||
if (empty($obj)) {
|
||||
|
|
|
@ -76,6 +76,7 @@ if (!class_exists('Video')) {
|
|||
'd' => 'Downloading',
|
||||
't' => 'Transferring',
|
||||
'u' => 'Unlisted',
|
||||
's' => 'Unlisted but Searchable',
|
||||
'r' => 'Recording',
|
||||
'f' => 'FansOnly',
|
||||
'b' => 'Broken Missing files'
|
||||
|
@ -89,6 +90,7 @@ if (!class_exists('Video')) {
|
|||
'd' => '<i class=\'fas fa-download\'></i>',
|
||||
't' => '<i class=\'fas fa-sync\'></i>',
|
||||
'u' => '<i class=\'fas fa-eye\' style=\'color: #BBB;\'></i>',
|
||||
's' => '<i class=\'fas fa-search\' style=\'color: #BBB;\'></i>',
|
||||
'r' => '<i class=\'fas fa-circle\'></i>',
|
||||
'f' => '<i class=\'fas fa-star\'></i>',
|
||||
'b' => '<i class=\'fas fa-times\'></i>'
|
||||
|
@ -101,6 +103,7 @@ if (!class_exists('Video')) {
|
|||
public static $statusDownloading = 'd';
|
||||
public static $statusTranfering = 't';
|
||||
public static $statusUnlisted = 'u';
|
||||
public static $statusUnlistedButSearchable = 's';
|
||||
public static $statusRecording = 'r';
|
||||
public static $statusFansOnly = 'f';
|
||||
public static $statusBrokenMissingFiles = 'b';
|
||||
|
@ -702,11 +705,7 @@ if (!class_exists('Video')) {
|
|||
return $this->setStatus(Video::$statusActiveAndEncoding);
|
||||
} else {
|
||||
if ($this->getTitle() !== "Video automatically booked") {
|
||||
if (!empty($advancedCustom->makeVideosInactiveAfterEncode)) {
|
||||
return $this->setStatus(Video::$statusInactive);
|
||||
} elseif (!empty($advancedCustom->makeVideosUnlistedAfterEncode)) {
|
||||
return $this->setStatus(Video::$statusUnlisted);
|
||||
}
|
||||
return $this->setStatus($advancedCustom->defaultVideoStatus);
|
||||
} else {
|
||||
return $this->setStatus(Video::$statusInactive);
|
||||
}
|
||||
|
@ -1446,6 +1445,9 @@ if (!class_exists('Video')) {
|
|||
// for the cache on the database fast insert
|
||||
|
||||
TimeLogEnd($timeLogName, __LINE__, 0.2);
|
||||
|
||||
$allowedDurationTypes = array('video', 'audio');
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array $global
|
||||
|
@ -1454,18 +1456,24 @@ if (!class_exists('Video')) {
|
|||
$global['mysqli']->begin_transaction();
|
||||
foreach ($fullData as $row) {
|
||||
if (is_null($row['likes'])) {
|
||||
_error_log("Video::updateLikesDislikes: id={$row['id']}");
|
||||
$row['likes'] = self::updateLikesDislikes($row['id'], 'likes');
|
||||
}
|
||||
if (is_null($row['dislikes'])) {
|
||||
_error_log("Video::updateLikesDislikes: id={$row['id']}");
|
||||
$row['dislikes'] = self::updateLikesDislikes($row['id'], 'dislikes');
|
||||
}
|
||||
if (empty($row['duration_in_seconds']) && $row['type'] !== 'article') {
|
||||
|
||||
if (empty($row['duration_in_seconds']) && in_array($row['type'], $allowedDurationTypes)) {
|
||||
_error_log("Video::duration_in_seconds: id={$row['id']} {$row['duration']} {$row['type']}");
|
||||
$row['duration_in_seconds'] = self::updateDurationInSeconds($row['id'], $row['duration']);
|
||||
if (empty($row['duration_in_seconds'])) {
|
||||
//_error_log("Video duration_in_seconds not updated: id={$row['id']} type={$row['type']}");
|
||||
}
|
||||
}
|
||||
TimeLogStart("video::getInfo");
|
||||
$row = self::getInfo($row, $getStatistcs);
|
||||
TimeLogEnd("video::getInfo", __LINE__);
|
||||
$videos[] = $row;
|
||||
}
|
||||
$global['mysqli']->commit();
|
||||
|
@ -1541,9 +1549,13 @@ if (!class_exists('Video')) {
|
|||
if (empty($otherInfo)) {
|
||||
$otherInfo = [];
|
||||
$otherInfo['category'] = xss_esc_back($row['category']);
|
||||
//TimeLogStart("video::otherInfo");
|
||||
$otherInfo['groups'] = UserGroups::getVideosAndCategoriesUserGroups($row['id']);
|
||||
//TimeLogEnd("video::otherInfo", __LINE__, 0.05);
|
||||
$otherInfo['tags'] = self::getTags($row['id']);
|
||||
//TimeLogEnd("video::otherInfo", __LINE__, 0.05);
|
||||
$cached = ObjectYPT::setCache($otherInfocachename, $otherInfo);
|
||||
//TimeLogEnd("video::otherInfo", __LINE__, 0.05);
|
||||
//_error_log("video::getInfo cache " . json_encode($cached));
|
||||
}
|
||||
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
|
||||
|
@ -2051,9 +2063,15 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
|
||||
public static function getViewableStatus($showUnlisted = false) {
|
||||
$viewable = ['a', 'k', 'f'];
|
||||
$viewable = [Video::$statusActive, Video::$statusActiveAndEncoding, Video::$statusFansOnly];
|
||||
if ($showUnlisted) {
|
||||
$viewable[] = "u";
|
||||
$viewable[] = Video::$statusUnlisted;
|
||||
$viewable[] = Video::$statusUnlistedButSearchable;
|
||||
} else {
|
||||
$search = getSearchVar();
|
||||
if(!empty($search)){
|
||||
$viewable[] = Video::$statusUnlistedButSearchable;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Cannot do that otherwise it will list videos on the list videos menu
|
||||
|
@ -2642,7 +2660,7 @@ if (!class_exists('Video')) {
|
|||
|
||||
public static function getTags_($video_id, $type = "") {
|
||||
global $advancedCustom, $advancedCustomUser, $getTags_;
|
||||
|
||||
$tolerance = 0.3;
|
||||
if (!isset($getTags_)) {
|
||||
$getTags_ = [];
|
||||
}
|
||||
|
@ -2720,7 +2738,7 @@ if (!class_exists('Video')) {
|
|||
$tags[] = $objTag;
|
||||
$objTag = new stdClass();
|
||||
}
|
||||
TimeLogEnd("video::getTags_ new Video $video_id, $type", __LINE__, 0.5);
|
||||
TimeLogEnd("video::getTags_ new Video $video_id, $type", __LINE__, $tolerance);
|
||||
|
||||
/**
|
||||
a = active
|
||||
|
@ -2758,6 +2776,9 @@ if (!class_exists('Video')) {
|
|||
case Video::$statusUnlisted:
|
||||
$objTag->type = "info";
|
||||
break;
|
||||
case Video::$statusUnlistedButSearchable:
|
||||
$objTag->type = "info";
|
||||
break;
|
||||
case Video::$statusRecording:
|
||||
$objTag->type = "danger isRecording isRecordingIcon";
|
||||
break;
|
||||
|
@ -2769,7 +2790,7 @@ if (!class_exists('Video')) {
|
|||
$tags[] = $objTag;
|
||||
$objTag = new stdClass();
|
||||
}
|
||||
TimeLogEnd("video::getTags_ status $video_id, $type", __LINE__, 0.5);
|
||||
TimeLogEnd("video::getTags_ status $video_id, $type", __LINE__, $tolerance);
|
||||
|
||||
TimeLogStart("video::getTags_ userGroups $video_id, $type");
|
||||
if (empty($type) || $type === "userGroups") {
|
||||
|
@ -2809,7 +2830,7 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
}
|
||||
}
|
||||
TimeLogEnd("video::getTags_ userGroups $video_id, $type", __LINE__, 0.5);
|
||||
TimeLogEnd("video::getTags_ userGroups $video_id, $type", __LINE__, $tolerance);
|
||||
|
||||
TimeLogStart("video::getTags_ category $video_id, $type");
|
||||
if (empty($type) || $type === "category") {
|
||||
|
@ -2832,7 +2853,7 @@ if (!class_exists('Video')) {
|
|||
$objTag = new stdClass();
|
||||
}
|
||||
}
|
||||
TimeLogEnd("video::getTags_ category $video_id, $type", __LINE__, 0.5);
|
||||
TimeLogEnd("video::getTags_ category $video_id, $type", __LINE__, $tolerance);
|
||||
|
||||
TimeLogStart("video::getTags_ source $video_id, $type");
|
||||
if (empty($type) || $type === "source") {
|
||||
|
@ -2852,7 +2873,7 @@ if (!class_exists('Video')) {
|
|||
$objTag = new stdClass();
|
||||
}
|
||||
}
|
||||
TimeLogEnd("video::getTags_ source $video_id, $type", __LINE__, 0.5);
|
||||
TimeLogEnd("video::getTags_ source $video_id, $type", __LINE__, $tolerance);
|
||||
|
||||
if (!empty($video->getRrating())) {
|
||||
$rating = $video->getRrating();
|
||||
|
@ -2866,15 +2887,15 @@ if (!class_exists('Video')) {
|
|||
//var_dump($tags);exit;
|
||||
}
|
||||
|
||||
TimeLogStart("video::getTags_ AVideoPlugin::getVideoTags $video_id", __LINE__, 0.5);
|
||||
TimeLogStart("video::getTags_ AVideoPlugin::getVideoTags $video_id", __LINE__, $tolerance);
|
||||
$array2 = AVideoPlugin::getVideoTags($video_id);
|
||||
if (is_array($array2)) {
|
||||
$tags = array_merge($tags, $array2);
|
||||
}
|
||||
TimeLogEnd("video::getTags_ AVideoPlugin::getVideoTags $video_id", __LINE__, 0.5);
|
||||
TimeLogEnd("video::getTags_ AVideoPlugin::getVideoTags $video_id", __LINE__, $tolerance);
|
||||
//var_dump($tags);
|
||||
|
||||
TimeLogEnd("video::getTags_ $video_id, $type", __LINE__, 0.5);
|
||||
TimeLogEnd("video::getTags_ $video_id, $type", __LINE__, $tolerance*2);
|
||||
$_REQUEST['current'] = $currentPage;
|
||||
$_REQUEST['rowCount'] = $rowCount;
|
||||
$getTags_[$index] = $tags;
|
||||
|
@ -3777,7 +3798,7 @@ if (!class_exists('Video')) {
|
|||
if ($v['type'] !== 'video') {
|
||||
return [];
|
||||
}
|
||||
if ($v['status'] !== self::$statusActive && $v['status'] !== self::$statusUnlisted) {
|
||||
if ($v['status'] !== self::$statusActive && $v['status'] !== self::$statusUnlisted && $v['status'] !== self::$statusUnlistedButSearchable) {
|
||||
return [];
|
||||
}
|
||||
$video = new Video('', '', $v['id']);
|
||||
|
@ -3785,17 +3806,16 @@ if (!class_exists('Video')) {
|
|||
return [];
|
||||
}
|
||||
$HigestResolution = $video->getVideoHigestResolution();
|
||||
//_error_log("Video:::getHigestResolution::getVideosURL_V2($filename) 1 FROM database $HigestResolution");
|
||||
if (!empty($HigestResolution)) {
|
||||
//_error_log("Video:::getHigestResolution::getVideosURL_V2($filename) 2 FROM database $HigestResolution");
|
||||
//_error_log("getHigestResolution($filename) 1 {$HigestResolution} ".$video->getType());
|
||||
$resolution = $HigestResolution;
|
||||
|
||||
$return['resolution'] = $resolution;
|
||||
$return['resolution_text'] = getResolutionText($return['resolution']);
|
||||
$return['resolution_label'] = getResolutionLabel($return['resolution']);
|
||||
$return['resolution_string'] = trim($resolution . "p {$return['resolution_label']}");
|
||||
return $return;
|
||||
} else {
|
||||
//_error_log("getHigestResolution($filename) 2 ".$video->getType());
|
||||
$validFileExtensions = ['webm', 'mp4', 'm3u8'];
|
||||
$sources = getVideosURL_V2($filename);
|
||||
if (!is_array($sources)) {
|
||||
|
@ -5099,6 +5119,7 @@ if (!class_exists('Video')) {
|
|||
}
|
||||
|
||||
public static function getChangeVideoStatusButton($videos_id) {
|
||||
global $statusThatTheUserCanUpdate;
|
||||
$video = new Video('', '', $videos_id);
|
||||
|
||||
/**
|
||||
|
@ -5107,14 +5128,25 @@ if (!class_exists('Video')) {
|
|||
*/
|
||||
$status = $video->getStatus();
|
||||
|
||||
$activeBtn = '<button onclick="changeVideoStatus(' . $videos_id . ', \'u\');" style="color: #090" type="button" '
|
||||
. 'class="btn btn-default btn-xs getChangeVideoStatusButton_a" data-toggle="tooltip" title="' . str_replace("'", "\\'", __("This video is Active and Listed, click here to unlist it")) . '"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>';
|
||||
$inactiveBtn = '<button onclick="changeVideoStatus(' . $videos_id . ', \'a\');" style="color: #A00" type="button" '
|
||||
. 'class="btn btn-default btn-xs getChangeVideoStatusButton_i" data-toggle="tooltip" title="' . str_replace("'", "\\'", __("This video is inactive, click here to activate it")) . '"><span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span></button>';
|
||||
$unlistedBtn = '<button onclick="changeVideoStatus(' . $videos_id . ', \'i\');" style="color: #BBB" type="button" '
|
||||
. 'class="btn btn-default btn-xs getChangeVideoStatusButton_u" data-toggle="tooltip" title="' . str_replace("'", "\\'", __("This video is unlisted, click here to inactivate it")) . '"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>';
|
||||
$buttons = array();
|
||||
$totalStatusButtons = count($statusThatTheUserCanUpdate);
|
||||
foreach ($statusThatTheUserCanUpdate as $key => $value) {
|
||||
$index = $key+1;
|
||||
if ($index > $totalStatusButtons - 1) {
|
||||
$index = 0;
|
||||
}
|
||||
$nextStatus = $statusThatTheUserCanUpdate[$index][0];
|
||||
$format = __("This video is %s, click here to make it %s");
|
||||
$statusIndex = $value[0];
|
||||
$statusColor = $value[1];
|
||||
$tooltip = sprintf($format, Video::$statusDesc[$statusIndex], Video::$statusDesc[$nextStatus]);
|
||||
|
||||
return "<span class='getChangeVideoStatusButton getChangeVideoStatusButton_{$videos_id} status_{$status}'>{$activeBtn}{$inactiveBtn}{$unlistedBtn}</span>";
|
||||
$buttons[] = "<button type=\"button\" style=\"color: {$statusColor}\" class=\"btn btn-default btn-xs getChangeVideoStatusButton_{$statusIndex}\" onclick=\"changeVideoStatus({$videos_id}, '{$nextStatus}');return false\" "
|
||||
. "type=\"button\" nextStatus=\"{$nextStatus}\" data-toggle=\"tooltip\" title=" . printJSString($tooltip, true) . ">"
|
||||
. str_replace("'", '"', Video::$statusIcons[$statusIndex]) . "</button>";
|
||||
}
|
||||
|
||||
return "<span class='getChangeVideoStatusButton getChangeVideoStatusButton_{$videos_id} status_{$status}'>".implode('',$buttons)."</span>";
|
||||
}
|
||||
|
||||
public static function canVideoBePurchased($videos_id) {
|
||||
|
@ -5531,7 +5563,7 @@ if (!class_exists('Video')) {
|
|||
if (!empty($video->getSerie_playlists_id())) {
|
||||
return false;
|
||||
}
|
||||
if ($video->getStatus() == Video::$statusActive || $video->getStatus() == Video::$statusUnlisted) {
|
||||
if ($video->getStatus() == Video::$statusActive || $video->getStatus() == Video::$statusUnlisted || $video->getStatus() == Video::$statusUnlistedButSearchable) {
|
||||
if ($video->getType() == 'audio' || $video->getType() == 'video') {
|
||||
if (self::isMediaFileMissing($video->getFilename())) {
|
||||
_error_log("Video::checkIfIsBroken($videos_id) true " . $video->getFilename());
|
||||
|
@ -5733,3 +5765,29 @@ if (!class_exists('Video')) {
|
|||
if (!empty($_GET['v']) && empty($_GET['videoName'])) {
|
||||
$_GET['videoName'] = Video::get_clean_title($_GET['v']);
|
||||
}
|
||||
|
||||
$statusThatShowTheCompleteMenu = array(
|
||||
Video::$statusActive,
|
||||
Video::$statusInactive,
|
||||
Video::$statusActiveAndEncoding,
|
||||
Video::$statusUnlistedButSearchable,
|
||||
Video::$statusUnlisted,
|
||||
Video::$statusFansOnly,
|
||||
);
|
||||
|
||||
$statusSearchFilter = array(
|
||||
Video::$statusActive,
|
||||
Video::$statusInactive,
|
||||
Video::$statusEncoding,
|
||||
Video::$statusTranfering,
|
||||
Video::$statusUnlisted,
|
||||
Video::$statusUnlistedButSearchable,
|
||||
Video::$statusBrokenMissingFiles,
|
||||
);
|
||||
|
||||
$statusThatTheUserCanUpdate = array(
|
||||
array(Video::$statusActive, '#0A0'),
|
||||
array(Video::$statusInactive, '#B00'),
|
||||
array(Video::$statusUnlisted, '#AAA'),
|
||||
array(Video::$statusUnlistedButSearchable, '#BBB'),
|
||||
);
|
|
@ -1683,8 +1683,10 @@ class AVideoPlugin
|
|||
$TimeLog = "AVideoPlugin::getVideoTags($videos_id) {$value['dirName']} ";
|
||||
TimeLogStart($TimeLog);
|
||||
$p = static::loadPlugin($value['dirName']);
|
||||
TimeLogEnd($TimeLog, __LINE__, 0.1);
|
||||
if (is_object($p)) {
|
||||
$array = array_merge($array, $p->getVideoTags($videos_id));
|
||||
TimeLogEnd($TimeLog, __LINE__, 0.1);
|
||||
}
|
||||
TimeLogEnd($TimeLog, __LINE__);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ class CustomizeAdvanced extends PluginAbstract {
|
|||
'EnableMinifyJS',
|
||||
'usePreloadLowResolutionImages',
|
||||
'useFFMPEGToGenerateThumbs',
|
||||
'makeVideosInactiveAfterEncode',
|
||||
'makeVideosUnlistedAfterEncode',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -164,7 +166,7 @@ class CustomizeAdvanced extends PluginAbstract {
|
|||
}
|
||||
|
||||
public function getEmptyDataObject() {
|
||||
global $global;
|
||||
global $global, $statusThatTheUserCanUpdate, $advancedCustom;
|
||||
$obj = new stdClass();
|
||||
$obj->logoMenuBarURL = "";
|
||||
$obj->encoderNetwork = "https://network.wwbn.net/";
|
||||
|
@ -222,6 +224,27 @@ class CustomizeAdvanced extends PluginAbstract {
|
|||
$obj->doNotUseXsendFile = false;
|
||||
$obj->makeVideosInactiveAfterEncode = false;
|
||||
$obj->makeVideosUnlistedAfterEncode = false;
|
||||
|
||||
$o = new stdClass();
|
||||
$o->type = array();
|
||||
foreach ($statusThatTheUserCanUpdate as $value) {
|
||||
$statusIndex = $value[0];
|
||||
$statusColor = $value[1];
|
||||
$o->type[$statusIndex] = Video::$statusDesc[$statusIndex];
|
||||
}
|
||||
|
||||
$dbObject = PluginAbstract::getObjectDataFromDatabase($this->getUUID());
|
||||
|
||||
if (!empty($dbObject->makeVideosInactiveAfterEncode)) {
|
||||
$o->value = Video::$statusInactive;
|
||||
} elseif (!empty($dbObject->makeVideosUnlistedAfterEncode)) {
|
||||
$o->value = Video::$statusUnlisted;
|
||||
}else{
|
||||
$o->value = Video::$statusActive;
|
||||
}
|
||||
$obj->defaultVideoStatus = $o;
|
||||
self::addDataObjectHelper('defaultVideoStatus', 'Default video status', 'When you submit a video that will be the default status');
|
||||
|
||||
$obj->usePermalinks = false;
|
||||
self::addDataObjectHelper('usePermalinks', 'Do not show video title on URL', 'This option is not good for SEO, but makes the URL clear');
|
||||
$obj->useVideoIDOnSEOLinks = true;
|
||||
|
|
|
@ -544,6 +544,7 @@ class CustomizeUser extends PluginAbstract {
|
|||
|
||||
$btn .= '<li><a data-toggle="tab" href="#tabAffiliation">' . __('Affiliations') . ' ' . $totalNotifications . '</a></li>';
|
||||
}
|
||||
$btn .= '<li><a data-toggle="tab" href="#tabSubscriptions">' . __('Subscriptions') . '</a></li>';
|
||||
$btn .= '<li><a onclick="avideoModalIframeSmall(webSiteRootURL+\'plugin/CustomizeUser/confirmDeleteUser.php?users_id=' . $users_id . '\');return false;" style="cursor: pointer;"><i class="fas fa-trash"></i> ' . __('Delete my account') . '</a></li>';
|
||||
return $btn;
|
||||
}
|
||||
|
@ -587,6 +588,8 @@ class CustomizeUser extends PluginAbstract {
|
|||
include $global['systemRootPath'] . 'plugin/CustomizeUser/View/tabAffiliation.php';
|
||||
}
|
||||
|
||||
$tabId = 'tabSubscriptions';
|
||||
include $global['systemRootPath'] . 'plugin/CustomizeUser/View/tabSubscriptions.php';
|
||||
return $btn;
|
||||
}
|
||||
|
||||
|
|
43
plugin/CustomizeUser/View/tabSubscriptions.php
Normal file
43
plugin/CustomizeUser/View/tabSubscriptions.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
$isVideoTagsEnabled = AVideoPlugin::isEnabledByName('VideoTags');
|
||||
?>
|
||||
<div id="<?php echo $tabId; ?>" class="tab-pane fade in" style="padding: 10px 0;">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#contentProducersSubs"><i class="fas fa-user"></i> <?php echo __('Users'); ?></a></li>
|
||||
<?php
|
||||
if ($isVideoTagsEnabled) {
|
||||
?>
|
||||
<li><a data-toggle="tab" href="#tagsSubs"><i class="fas fa-tags"></i> <?php echo __('Tags'); ?></a></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="contentProducersSubs" class="tab-pane fade in active">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/Gallery/view/mainAreaChannels.php';
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if ($isVideoTagsEnabled) {
|
||||
?>
|
||||
<div id="tagsSubs" class="tab-pane fade">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/VideoTags/View/list.php';
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
});
|
||||
</script>
|
||||
|
|
@ -9,7 +9,7 @@ require_once $global['systemRootPath'] . 'videos/configuration.php';
|
|||
require_once $global['systemRootPath'] . 'objects/subscribe.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/Gallery/functions.php';
|
||||
|
||||
if (empty($obj)) {
|
||||
if (empty($obj) || empty($obj->SubscribedChannelsRowCount)) {
|
||||
$obj = AVideoPlugin::getDataObject('Gallery');
|
||||
}
|
||||
|
||||
|
|
|
@ -701,6 +701,7 @@ class PlayerSkins extends PluginAbstract {
|
|||
//_error_log("Cache not found $name");
|
||||
$video = new Video("", "", $videos_id);
|
||||
$fileName = $video->getFilename();
|
||||
//_error_log("getVideoTags($videos_id) $fileName ".$video->getType());
|
||||
$resolution = Video::getHigestResolution($fileName);
|
||||
$obj = new stdClass();
|
||||
if (empty($resolution) || empty($resolution['resolution_text'])) {
|
||||
|
|
|
@ -96,50 +96,22 @@ abstract class PluginAbstract {
|
|||
return "";
|
||||
}
|
||||
|
||||
public function getDataObject() {
|
||||
$uuid = $this->getUUID();
|
||||
if (empty(PluginAbstract::$dataObject[$uuid])) {
|
||||
static function getObjectDataFromDatabase($uuid) {
|
||||
$obj = Plugin::getPluginByUUID($uuid);
|
||||
//echo $obj['object_data'];
|
||||
$o = array();
|
||||
if (!empty($obj['object_data'])) {
|
||||
$o = _json_decode(stripslashes($obj['object_data']));
|
||||
$json_last_error = json_last_error();
|
||||
if ($json_last_error !== JSON_ERROR_NONE) {
|
||||
//var_dump($this->getName(), $json_last_error, $o, $obj['object_data']);
|
||||
//_error_log('getDataObject - JSON error (' . $json_last_error . ') ' . $this->getName()." ".$this->getUUID());
|
||||
$o = _json_decode($obj['object_data']);
|
||||
$json_last_error = json_last_error();
|
||||
}
|
||||
switch ($json_last_error) {
|
||||
case JSON_ERROR_NONE:
|
||||
//echo ' - No errors';
|
||||
break;
|
||||
default:
|
||||
_error_log('getDataObject - JSON error ' . $this->getName());
|
||||
_error_log($obj['object_data']);
|
||||
_error_log('striped slashes');
|
||||
_error_log(stripslashes($obj['object_data']));
|
||||
case JSON_ERROR_DEPTH:
|
||||
_error_log(' - Maximum stack depth exceeded');
|
||||
break;
|
||||
case JSON_ERROR_STATE_MISMATCH:
|
||||
_error_log(' - Underflow or the modes mismatch');
|
||||
break;
|
||||
case JSON_ERROR_CTRL_CHAR:
|
||||
_error_log(' - Unexpected control character found');
|
||||
break;
|
||||
case JSON_ERROR_SYNTAX:
|
||||
_error_log(' - Syntax error, malformed JSON');
|
||||
_error_log($obj['object_data']);
|
||||
_error_log('striped slashes');
|
||||
_error_log(stripslashes($obj['object_data']));
|
||||
break;
|
||||
case JSON_ERROR_UTF8:
|
||||
_error_log(' - Malformed UTF-8 characters, possibly incorrectly encoded');
|
||||
break;
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
public function getDataObject() {
|
||||
$uuid = $this->getUUID();
|
||||
if (empty(PluginAbstract::$dataObject[$uuid])) {
|
||||
$obj = Plugin::getPluginByUUID($uuid);
|
||||
//echo $obj['object_data'];
|
||||
$o = self::getObjectDataFromDatabase($uuid);
|
||||
$eo = $this->getEmptyDataObject();
|
||||
// check if the plugin define any array for the select option, if does, overwrite it
|
||||
foreach ($eo as $key => $value) {
|
||||
|
|
|
@ -114,7 +114,7 @@ class Tags extends ObjectYPT {
|
|||
return empty($tagsArray)?(new stdClass()):$tagsArray;
|
||||
}
|
||||
|
||||
static function getAllTagsList($tags_types_id) {
|
||||
static function getAllTags($tags_types_id) {
|
||||
global $global;
|
||||
$tags_types_id = intval($tags_types_id);
|
||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE 1=1 ";
|
||||
|
@ -124,15 +124,32 @@ class Tags extends ObjectYPT {
|
|||
$sql .= " ORDER BY name ";
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
return $fullData;
|
||||
}
|
||||
|
||||
sqlDAL::close($res);
|
||||
static function getAllTagsWithTotalVideos($tags_types_id) {
|
||||
global $global;
|
||||
$tags_types_id = intval($tags_types_id);
|
||||
$sql = "SELECT *, (SELECT count(thv.id) FROM tags_has_videos thv WHERE tags_id = t.id ) as total_videos FROM " . static::getTableName() . " t WHERE 1=1 ";
|
||||
if(!empty($tags_types_id)){
|
||||
$sql .= " AND tags_types_id = $tags_types_id ";
|
||||
}
|
||||
$sql .= " ORDER BY name ";
|
||||
//echo $sql;
|
||||
$res = sqlDAL::readSql($sql);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
return $fullData;
|
||||
}
|
||||
|
||||
|
||||
static function getAllTagsList($tags_types_id) {
|
||||
global $global;
|
||||
$fullData = self::getAllTags($tags_types_id);
|
||||
$rows = array();
|
||||
if ($res!=false) {
|
||||
foreach ($fullData as $row) {
|
||||
$rows[] = $row['name'];
|
||||
}
|
||||
} else {
|
||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
|
132
plugin/VideoTags/Objects/Tags_subscriptions.php
Normal file
132
plugin/VideoTags/Objects/Tags_subscriptions.php
Normal file
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
require_once dirname(__FILE__) . '/../../../videos/configuration.php';
|
||||
|
||||
class Tags_subscriptions extends ObjectYPT {
|
||||
|
||||
protected $id, $tags_id, $users_id, $notify;
|
||||
|
||||
static function getSearchFieldsNames() {
|
||||
return array();
|
||||
}
|
||||
|
||||
static function getTableName() {
|
||||
return 'tags_subscriptions';
|
||||
}
|
||||
|
||||
function setId($id) {
|
||||
$this->id = intval($id);
|
||||
}
|
||||
|
||||
function setTags_id($tags_id) {
|
||||
$this->tags_id = intval($tags_id);
|
||||
}
|
||||
|
||||
function setUsers_id($users_id) {
|
||||
$this->users_id = intval($users_id);
|
||||
}
|
||||
|
||||
function getId() {
|
||||
return intval($this->id);
|
||||
}
|
||||
|
||||
function getTags_id() {
|
||||
return intval($this->tags_id);
|
||||
}
|
||||
|
||||
function getUsers_id() {
|
||||
return intval($this->users_id);
|
||||
}
|
||||
|
||||
public function getNotify() {
|
||||
if(empty($notify)){
|
||||
return 0;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function setNotify($notify): void {
|
||||
if(empty($notify)){
|
||||
$this->notify = 0;
|
||||
}else{
|
||||
$this->notify = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static function getTotalFromTag($tags_id){
|
||||
global $global;
|
||||
$tags_id = intval($tags_id);
|
||||
$users_id = intval($users_id);
|
||||
$sql = "SELECT count(id) as total FROM " . static::getTableName() . " WHERE tags_id = ? LIMIT 1";
|
||||
$res = sqlDAL::readSql($sql, "i", [$tags_id], true);
|
||||
$data = sqlDAL::fetchAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
if ($res) {
|
||||
return $data['total'];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static function getFromTagAndUser($tags_id, $users_id){
|
||||
global $global;
|
||||
$tags_id = intval($tags_id);
|
||||
$users_id = intval($users_id);
|
||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE tags_id = ? AND users_id = ? LIMIT 1";
|
||||
$res = sqlDAL::readSql($sql, "ii", [$tags_id, $users_id], true);
|
||||
$data = sqlDAL::fetchAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
if ($res) {
|
||||
$row = $data;
|
||||
} else {
|
||||
$row = false;
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
static function getAllFromUsers_id($users_id){
|
||||
global $global;
|
||||
$users_id = intval($users_id);
|
||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ?";
|
||||
$res = sqlDAL::readSql($sql, "i", [$users_id], true);
|
||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||
sqlDAL::close($res);
|
||||
return $fullData;
|
||||
}
|
||||
|
||||
static function getAllTagsIdsFromUsers_id($users_id){
|
||||
$fullData = self::getAllFromUsers_id($users_id);
|
||||
$rows = [];
|
||||
if ($res !== false) {
|
||||
foreach ($fullData as $row) {
|
||||
$rows[] = $row['tags_id'];
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
static function subscribe($tags_id, $users_id, $notify = 0){
|
||||
$row = self::getFromTagAndUser($tags_id, $users_id);
|
||||
if(!empty($row)){
|
||||
// already subscribed
|
||||
return true;
|
||||
}
|
||||
$tag = new Tags_subscriptions(0);
|
||||
$tag->setTags_id($tags_id);
|
||||
$tag->setUsers_id($users_id);
|
||||
$tag->setNotify($notify);
|
||||
return $tag->save();
|
||||
}
|
||||
|
||||
static function unsubscribe($tags_id, $users_id){
|
||||
$row = self::getFromTagAndUser($tags_id, $users_id);
|
||||
if(empty($row)){
|
||||
// already unsubscribed
|
||||
return true;
|
||||
}
|
||||
$tag = new Tags_subscriptions($row['id']);
|
||||
return $tag->delete();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ require_once $global['systemRootPath'] . 'plugin/Plugin.abstract.php';
|
|||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/Tags.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/TagsHasVideos.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/TagsTypes.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/Tags_subscriptions.php';
|
||||
|
||||
class VideoTags extends PluginAbstract {
|
||||
|
||||
|
@ -13,6 +14,7 @@ class VideoTags extends PluginAbstract {
|
|||
PluginTags::$FREE,
|
||||
);
|
||||
}
|
||||
|
||||
public function getDescription() {
|
||||
$txt = "User interface for managing tags";
|
||||
$help = "";
|
||||
|
@ -183,6 +185,99 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
|||
return User::isAdmin();
|
||||
}
|
||||
|
||||
public static function getButton($tags_id){
|
||||
global $global, $advancedCustom;
|
||||
|
||||
$rowCount = getRowCount();
|
||||
$total = Tags_subscriptions::getTotalFromTag($tags_id);
|
||||
$tag = new Tags($tags_id);
|
||||
$btnFile = $global['systemRootPath'] . 'plugin/VideoTags/subscribeBtnOffline.html';
|
||||
|
||||
$notify = '';
|
||||
$email = '';
|
||||
$subscribed = '';
|
||||
$subscribeText = '<i class="far fa-circle"></i> '.$tag->getName();
|
||||
$subscribedText = '<i class="far fa-check-circle"></i> '.$tag->getName();
|
||||
$user_id = User::getId();
|
||||
if (User::isLogged()) {
|
||||
$btnFile = $global['systemRootPath'] . 'plugin/VideoTags/subscribeBtn.html';
|
||||
$email = User::getMail();
|
||||
$subs = Tags_subscriptions::getFromTagAndUser($tags_id, $user_id);
|
||||
|
||||
if (!empty($subs)) {
|
||||
if (!empty($subs['notify'])) {
|
||||
$notify = 'notify';
|
||||
}
|
||||
$subscribed = 'subscribed';
|
||||
}
|
||||
}
|
||||
$content = local_get_contents($btnFile);
|
||||
|
||||
$signInBTN = ("<a class='btn btn-primary btn-sm btn-block' href='{$global['webSiteRootURL']}user'>".__("Sign in to subscribe to this tag")."</a>");
|
||||
|
||||
$search = [
|
||||
'_tags_id_',
|
||||
'_users_id_',
|
||||
'{notify}',
|
||||
'{tooltipStop}',
|
||||
'{tooltip}',
|
||||
'{titleOffline}',
|
||||
'{tooltipOffline}',
|
||||
'{email}', '{total}',
|
||||
'{subscribed}', '{subscribeText}', '{subscribedText}'
|
||||
];
|
||||
|
||||
$replace = [
|
||||
$tags_id,
|
||||
$user_id,
|
||||
$notify,
|
||||
__("Stop getting notified for every new video"),
|
||||
__("Click to get notified for every new video"),
|
||||
__("Want to subscribe to this tag?"),
|
||||
$signInBTN,
|
||||
$email, $total,
|
||||
$subscribed, $subscribeText, $subscribedText, ];
|
||||
|
||||
$btnHTML = str_replace($search, $replace, $content);
|
||||
return $btnHTML;
|
||||
}
|
||||
|
||||
static function getTagLink($tags_id) {
|
||||
global $global;
|
||||
if (empty($tags_id)) {
|
||||
return '';
|
||||
}
|
||||
$tag = new Tags($tags_id);
|
||||
|
||||
if (empty($tag->getName())) {
|
||||
return '';
|
||||
}
|
||||
return $global['webSiteRootURL'] . 'tag/' . $tags_id . '/' . urlencode($tag->getName());
|
||||
}
|
||||
|
||||
static function getTagHTMLLink($tags_id, $total_videos = 0) {
|
||||
global $global;
|
||||
if (empty($tags_id)) {
|
||||
return '';
|
||||
}
|
||||
$tag = new Tags($tags_id);
|
||||
|
||||
if (empty($tag->getName()) || $tag->getName() === '-') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($total_videos) {
|
||||
$tooltipText = "1 " . __("Video");
|
||||
if ($total_videos > 1) {
|
||||
$tooltipText = "{$total_videos} " . __("Videos");
|
||||
}
|
||||
$tooltip = "data-toggle=\"tooltip\" title=\"{$tooltipText}\"";
|
||||
}
|
||||
|
||||
$strT = '<a ' . $tooltip . ' href="' . VideoTags::getTagLink($tags_id) . '" class="label label-primary">' . __($tag->getName()) . '</a> ';
|
||||
return $strT;
|
||||
}
|
||||
|
||||
static function getLabels($videos_id, $showType = true) {
|
||||
global $global;
|
||||
|
||||
|
@ -205,11 +300,8 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
|||
if (empty($value['name']) || $value['name'] === '-') {
|
||||
continue;
|
||||
}
|
||||
$tooltip = "1 " . __("Video");
|
||||
if ($value['total'] > 1) {
|
||||
$tooltip = "{$value['total']} " . __("Videos");
|
||||
}
|
||||
$strT .= '<a data-toggle="tooltip" title="' . $tooltip . '" href="' . $global['webSiteRootURL'] . 'tag/' . $value['tags_id'] . '/' . urlencode($value['name']) . '" class="label label-primary">' . __($value['name']) . '</a> ';
|
||||
//$strT .= self::getTagHTMLLink($value['id'], $value['total']);
|
||||
$strT .= self::getButton($value['tags_id']);
|
||||
}
|
||||
if (!empty($strT)) {
|
||||
$label = "";
|
||||
|
@ -234,7 +326,6 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
|||
return file_get_contents($filename);
|
||||
}
|
||||
|
||||
|
||||
public static function getManagerVideosAddNew() {
|
||||
return '"videoTags": ' . self::getTagsInputsJquery() . ',';
|
||||
}
|
||||
|
@ -277,9 +368,8 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
|||
return $row;
|
||||
}
|
||||
|
||||
|
||||
public function getPluginVersion() {
|
||||
return "2.0";
|
||||
return "3.0";
|
||||
}
|
||||
|
||||
public function updateScript() {
|
||||
|
@ -288,7 +378,11 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
|||
if (AVideoPlugin::compareVersion($this->getName(), "2.0") < 0) {
|
||||
sqlDal::executeFile($global['systemRootPath'] . 'plugin/VideoTags/install/update.sql');
|
||||
}
|
||||
if (AVideoPlugin::compareVersion($this->getName(), "3.0") < 0) {
|
||||
sqlDal::executeFile($global['systemRootPath'] . 'plugin/VideoTags/install/updateV3.0.sql');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
25
plugin/VideoTags/View/Tags_subscriptions/add.json.php
Normal file
25
plugin/VideoTags/View/Tags_subscriptions/add.json.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
header('Content-Type: application/json');
|
||||
require_once '../../../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/Tags_subscriptions.php';
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = "";
|
||||
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled('VideoTags');
|
||||
|
||||
if(!User::isAdmin()){
|
||||
$obj->msg = "You cant do this";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$o = new Tags_subscriptions(@$_POST['id']);
|
||||
$o->setTags_id($_POST['tags_id']);
|
||||
$o->setUsers_id($_POST['users_id']);
|
||||
|
||||
if($id = $o->save()){
|
||||
$obj->error = false;
|
||||
}
|
||||
|
||||
echo json_encode($obj);
|
20
plugin/VideoTags/View/Tags_subscriptions/delete.json.php
Normal file
20
plugin/VideoTags/View/Tags_subscriptions/delete.json.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
require_once '../../../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/Tags_subscriptions.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled('VideoTags');
|
||||
|
||||
if(!User::isAdmin()){
|
||||
$obj->msg = "You cant do this";
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
$row = new Tags_subscriptions($id);
|
||||
$obj->error = !$row->delete();
|
||||
die(json_encode($obj));
|
||||
?>
|
29
plugin/VideoTags/View/Tags_subscriptions/index.php
Normal file
29
plugin/VideoTags/View/Tags_subscriptions/index.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../../videos/configuration.php';
|
||||
}
|
||||
if (!User::isAdmin()) {
|
||||
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo getLanguage(); ?>">
|
||||
<head>
|
||||
<title><?php echo $config->getWebSiteTitle(); ?> :: VideoTags</title>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
include $global['systemRootPath'] . 'plugin/VideoTags/View/{$classname}/index_head.php';
|
||||
?>
|
||||
</head>
|
||||
<body class="<?php echo $global['bodyClass']; ?>">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||
include $global['systemRootPath'] . 'plugin/VideoTags/View/{$classname}/index_body.php';
|
||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
?>
|
||||
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
|
||||
</body>
|
||||
</html>
|
197
plugin/VideoTags/View/Tags_subscriptions/index_body.php
Normal file
197
plugin/VideoTags/View/Tags_subscriptions/index_body.php
Normal file
|
@ -0,0 +1,197 @@
|
|||
<?php
|
||||
global $global, $config;
|
||||
if (!isset($global['systemRootPath'])) {
|
||||
require_once '../../videos/configuration.php';
|
||||
}
|
||||
if (!User::isAdmin()) {
|
||||
header("Location: {$global['webSiteRootURL']}?error=" . __("You can not do this"));
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<i class="fas fa-cog"></i> <?php echo __("Configurations"); ?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="panel panel-default ">
|
||||
<div class="panel-heading"><i class="far fa-plus-square"></i> <?php echo __("Create"); ?></div>
|
||||
<div class="panel-body">
|
||||
<form id="panelTags_subscriptionsForm">
|
||||
<div class="row">
|
||||
<input type="hidden" name="id" id="Tags_subscriptionsid" value="" >
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="Tags_subscriptionstags_id"><?php echo __("Tags Id"); ?>:</label>
|
||||
<select class="form-control input-sm" name="tags_id" id="Tags_subscriptionstags_id">
|
||||
<?php
|
||||
$options = Tags_subscriptions::getAllTags();
|
||||
foreach ($options as $value) {
|
||||
echo '<option value="'.$value['id'].'">'.$value['id'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label for="Tags_subscriptionsusers_id"><?php echo __("Users Id"); ?>:</label>
|
||||
<select class="form-control input-sm" name="users_id" id="Tags_subscriptionsusers_id">
|
||||
<?php
|
||||
$options = Tags_subscriptions::getAllUsers();
|
||||
foreach ($options as $value) {
|
||||
echo '<option value="'.$value['id'].'">'.$value['id'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<div class="btn-group pull-right">
|
||||
<span class="btn btn-success" id="newTags_subscriptionsLink" onclick="clearTags_subscriptionsForm()"><i class="fas fa-plus"></i> <?php echo __("New"); ?></span>
|
||||
<button class="btn btn-primary" type="submit"><i class="fas fa-save"></i> <?php echo __("Save"); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="panel panel-default ">
|
||||
<div class="panel-heading"><i class="fas fa-edit"></i> <?php echo __("Edit"); ?></div>
|
||||
<div class="panel-body">
|
||||
<table id="Tags_subscriptionsTable" class="display table table-bordered table-responsive table-striped table-hover table-condensed" width="100%" cellspacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="Tags_subscriptionsbtnModelLinks" style="display: none;">
|
||||
<div class="btn-group pull-right">
|
||||
<button href="" class="edit_Tags_subscriptions btn btn-default btn-xs">
|
||||
<i class="fa fa-edit"></i>
|
||||
</button>
|
||||
<button href="" class="delete_Tags_subscriptions btn btn-danger btn-xs">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function clearTags_subscriptionsForm() {
|
||||
$('#Tags_subscriptionsid').val('');
|
||||
$('#Tags_subscriptionstags_id').val('');
|
||||
$('#Tags_subscriptionsusers_id').val('');
|
||||
}
|
||||
$(document).ready(function () {
|
||||
$('#addTags_subscriptionsBtn').click(function () {
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/VideoTags/View/addTags_subscriptionsVideo.php',
|
||||
data: $('#panelTags_subscriptionsForm').serialize(),
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if (response.error) {
|
||||
avideoAlertError(response.msg);
|
||||
} else {
|
||||
avideoToast("<?php echo __("Your register has been saved!"); ?>");
|
||||
$("#panelTags_subscriptionsForm").trigger("reset");
|
||||
}
|
||||
clearTags_subscriptionsForm();
|
||||
tableVideos.ajax.reload();
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
});
|
||||
var Tags_subscriptionstableVar = $('#Tags_subscriptionsTable').DataTable({
|
||||
serverSide: true,
|
||||
"ajax": "<?php echo $global['webSiteRootURL']; ?>plugin/VideoTags/View/Tags_subscriptions/list.json.php",
|
||||
"columns": [
|
||||
{"data": "id"},
|
||||
{
|
||||
sortable: false,
|
||||
data: null,
|
||||
defaultContent: $('#Tags_subscriptionsbtnModelLinks').html()
|
||||
}
|
||||
],
|
||||
select: true,
|
||||
});
|
||||
$('#newTags_subscriptions').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
$('#panelTags_subscriptionsForm').trigger("reset");
|
||||
$('#Tags_subscriptionsid').val('');
|
||||
});
|
||||
$('#panelTags_subscriptionsForm').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/VideoTags/View/Tags_subscriptions/add.json.php',
|
||||
data: $('#panelTags_subscriptionsForm').serialize(),
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if (response.error) {
|
||||
avideoAlertError(response.msg);
|
||||
} else {
|
||||
avideoToast("<?php echo __("Your register has been saved!"); ?>");
|
||||
$("#panelTags_subscriptionsForm").trigger("reset");
|
||||
}
|
||||
Tags_subscriptionstableVar.ajax.reload();
|
||||
$('#Tags_subscriptionsid').val('');
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#Tags_subscriptionsTable').on('click', 'button.delete_Tags_subscriptions', function (e) {
|
||||
e.preventDefault();
|
||||
var tr = $(this).closest('tr')[0];
|
||||
var data = Tags_subscriptionstableVar.row(tr).data();
|
||||
swal({
|
||||
title: "<?php echo __("Are you sure?"); ?>",
|
||||
text: "<?php echo __("You will not be able to recover this action!"); ?>",
|
||||
icon: "warning",
|
||||
buttons: true,
|
||||
dangerMode: true,
|
||||
})
|
||||
.then(function (willDelete) {
|
||||
if (willDelete) {
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo $global['webSiteRootURL']; ?>plugin/VideoTags/View/Tags_subscriptions/delete.json.php",
|
||||
data: data
|
||||
|
||||
}).done(function (resposta) {
|
||||
if (resposta.error) {
|
||||
avideoAlertError(resposta.msg);
|
||||
}
|
||||
Tags_subscriptionstableVar.ajax.reload();
|
||||
modal.hidePleaseWait();
|
||||
});
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
$('#Tags_subscriptionsTable').on('click', 'button.edit_Tags_subscriptions', function (e) {
|
||||
e.preventDefault();
|
||||
var tr = $(this).closest('tr')[0];
|
||||
var data = Tags_subscriptionstableVar.row(tr).data();
|
||||
$('#Tags_subscriptionsid').val(data.id);
|
||||
$('#Tags_subscriptionstags_id').val(data.tags_id);
|
||||
$('#Tags_subscriptionsusers_id').val(data.users_id);
|
||||
});
|
||||
});
|
||||
</script>
|
5
plugin/VideoTags/View/Tags_subscriptions/index_head.php
Normal file
5
plugin/VideoTags/View/Tags_subscriptions/index_head.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
$plugin = AVideoPlugin::loadPluginIfEnabled('VideoTags');
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
|
10
plugin/VideoTags/View/Tags_subscriptions/list.json.php
Normal file
10
plugin/VideoTags/View/Tags_subscriptions/list.json.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
require_once '../../../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/Tags_subscriptions.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$rows = Tags_subscriptions::getAll();
|
||||
$total = Tags_subscriptions::getTotal();
|
||||
|
||||
?>
|
||||
{"data": <?php echo json_encode($rows); ?>, "draw": <?php echo intval(@$_REQUEST['draw']); ?>, "recordsTotal":<?php echo $total; ?>, "recordsFiltered":<?php echo $total; ?>}
|
46
plugin/VideoTags/View/editor.php
Normal file
46
plugin/VideoTags/View/editor.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
require_once '../../../videos/configuration.php';
|
||||
AVideoPlugin::loadPlugin("VideoTags");
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo getLanguage(); ?>">
|
||||
<head>
|
||||
<title><?php echo $config->getWebSiteTitle(); ?> :: VideoTags</title>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/head.php';
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.css"/>
|
||||
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body class="<?php echo $global['bodyClass']; ?>">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/navbar.php';
|
||||
?>
|
||||
<div class="container-fluid">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><?php echo __('VideoTags') ?>
|
||||
<div class="pull-right">
|
||||
<?php echo AVideoPlugin::getSwitchButton("VideoTags"); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a data-toggle="tab" href="#Tags_subscriptions"><?php echo __("Tags Subscriptions"); ?></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="Tags_subscriptions" class="tab-pane fade in active" style="padding: 10px;">
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'plugin/VideoTags/View/Tags_subscriptions/index_body.php';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="<?php echo $global['webSiteRootURL']; ?>view/css/DataTables/datatables.min.js"></script>
|
||||
<script src="<?php echo $global['webSiteRootURL']; ?>js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
|
||||
<?php
|
||||
include $global['systemRootPath'] . 'view/include/footer.php';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
69
plugin/VideoTags/View/list.php
Normal file
69
plugin/VideoTags/View/list.php
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
global $global;
|
||||
?>
|
||||
<!-- mainAreaTags start -->
|
||||
<div class="mainAreaTags row">
|
||||
<?php
|
||||
$tags_count = 0;
|
||||
$totalColumns = 4;
|
||||
$tagsTypes = TagsTypes::getAll();
|
||||
$subscribedTagsIds = Tags_subscriptions::getAllTagsIdsFromUsers_id(User::getId());
|
||||
foreach ($tagsTypes as $tagType) {
|
||||
$tags = Tags::getAllTagsWithTotalVideos($tagType['id']);
|
||||
if (empty($tags)) {
|
||||
continue;
|
||||
}
|
||||
$tags_count++;
|
||||
if($tags_count%$totalColumns===0){
|
||||
echo '<div class="clearfix"></div>';
|
||||
}
|
||||
?>
|
||||
<div class="col-md-<?php echo 12/$totalColumns; ?>">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<?php
|
||||
echo $tagType['name'];
|
||||
?>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="list-group"><?php
|
||||
foreach ($tags as $tag) {
|
||||
$encryptedIdAndUser = encryptString(array('tags_id'=>$tag['id'], 'users_id'=> User::getId(), ));
|
||||
$checked = '';
|
||||
if(in_array($tag['id'], $subscribedTagsIds)){
|
||||
$checked = 'checked';
|
||||
}
|
||||
|
||||
?>
|
||||
<label class="list-group-item">
|
||||
<input class="form-check-input tagCheckBox" type="checkbox" value="<?php echo $encryptedIdAndUser; ?>" <?php echo $checked; ?>>
|
||||
<?php echo $tag['name']; ?>
|
||||
<a class="btn btn-xs btn-default pull-right" href="<?php echo VideoTags::getTagLink($tag['id']); ?>" style="margin: 0 10px;">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
</a>
|
||||
<span class="badge"><?php echo $tag['total_videos'], ' ', __('videos'); ?></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('.tagCheckBox').change(function(){
|
||||
var encryptedIdAndUser = $(this).val();
|
||||
var is_checked = $(this).is(":checked");
|
||||
var data = {encryptedIdAndUser:encryptedIdAndUser, add: is_checked};
|
||||
var url = webSiteRootURL + 'plugin/VideoTags/subscribe.json.php';
|
||||
avideoAjax2(url, data, false);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!-- mainAreaTags end -->
|
|
@ -49,6 +49,29 @@ CREATE TABLE IF NOT EXISTS `tags_has_videos` (
|
|||
ON UPDATE CASCADE)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tags_subscriptions` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`created` DATETIME NULL,
|
||||
`modified` DATETIME NULL,
|
||||
`tags_id` INT(11) NOT NULL,
|
||||
`users_id` INT(11) NOT NULL,
|
||||
`notify` TINYINT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fk_tags_subscriptions_tags1_idx` (`tags_id` ASC),
|
||||
INDEX `fk_tags_subscriptions_users1_idx` (`users_id` ASC),
|
||||
INDEX `indextagsnotify` (notify ASC),
|
||||
CONSTRAINT `fk_tags_subscriptions_tags1`
|
||||
FOREIGN KEY (`tags_id`)
|
||||
REFERENCES `tags` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_tags_subscriptions_users1`
|
||||
FOREIGN KEY (`users_id`)
|
||||
REFERENCES `users` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
||||
|
|
22
plugin/VideoTags/install/updateV3.0.sql
Normal file
22
plugin/VideoTags/install/updateV3.0.sql
Normal file
|
@ -0,0 +1,22 @@
|
|||
CREATE TABLE IF NOT EXISTS `tags_subscriptions` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`created` DATETIME NULL,
|
||||
`modified` DATETIME NULL,
|
||||
`tags_id` INT(11) NOT NULL,
|
||||
`users_id` INT(11) NOT NULL,
|
||||
`notify` TINYINT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `fk_tags_subscriptions_tags1_idx` (`tags_id` ASC) ,
|
||||
INDEX `fk_tags_subscriptions_users1_idx` (`users_id` ASC) ,
|
||||
INDEX `indextagsnotify` (notify ASC) VISIBLE,
|
||||
CONSTRAINT `fk_tags_subscriptions_tags1`
|
||||
FOREIGN KEY (`tags_id`)
|
||||
REFERENCES `tags` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_tags_subscriptions_users1`
|
||||
FOREIGN KEY (`users_id`)
|
||||
REFERENCES `users` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE)
|
||||
ENGINE = InnoDB;
|
|
@ -1 +1,2 @@
|
|||
<button onclick="avideoModalIframe(webSiteRootURL + 'plugin/VideoTags/');" class="btn btn-primary btn-xs btn-block"><i class="fas fa-list-ul"></i> Create Tag Type</button>
|
||||
<button onclick="avideoModalIframeLarge(webSiteRootURL + 'plugin/VideoTags/View/editor.php')" class="btn btn-primary btn-xs btn-block"><i class="fa fa-edit"></i> Tags Subscriptions</button>
|
47
plugin/VideoTags/subscribe.json.php
Normal file
47
plugin/VideoTags/subscribe.json.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
require_once '../../videos/configuration.php';
|
||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/TagsTypes.php';
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->error = true;
|
||||
$obj->msg = '';
|
||||
$obj->add = !_empty($_REQUEST['add']);
|
||||
$obj->response = false;
|
||||
|
||||
if (empty($_REQUEST['encryptedIdAndUser'])) {
|
||||
$obj->msg = 'Encrypted info not found';
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$obj->decryptedIdAndUser = decryptString($_REQUEST['encryptedIdAndUser']);
|
||||
|
||||
if (empty($obj->decryptedIdAndUser)) {
|
||||
$obj->msg = 'Decryption error';
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
$obj->decryptedIdAndUser = object_to_array(json_decode($obj->decryptedIdAndUser));
|
||||
|
||||
if (empty($obj->decryptedIdAndUser['tags_id'])) {
|
||||
$obj->msg = 'tags_id error';
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
if (empty($obj->decryptedIdAndUser['users_id']) || $obj->decryptedIdAndUser['users_id'] !== User::getId()) {
|
||||
$obj->msg = 'users_id error';
|
||||
die(json_encode($obj));
|
||||
}
|
||||
|
||||
if ($obj->add) {
|
||||
$obj->msg = 'Tag subscribed';
|
||||
$obj->response = Tags_subscriptions::subscribe($obj->decryptedIdAndUser['tags_id'], $obj->decryptedIdAndUser['users_id']);
|
||||
} else {
|
||||
$obj->msg = 'Tag unsubscribed';
|
||||
$obj->response = Tags_subscriptions::unsubscribe($obj->decryptedIdAndUser['tags_id'], $obj->decryptedIdAndUser['users_id']);
|
||||
}
|
||||
$obj->error = empty($obj->response);
|
||||
|
||||
die(json_encode($obj));
|
||||
?>
|
24
plugin/VideoTags/subscribeBtn.html
Normal file
24
plugin/VideoTags/subscribeBtn.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div class="btn-group notificationButton notificationButton_user_id_ {subscribed} {notify} ">
|
||||
<button class='btn btn-xs btn-danger subs_user_id_ subscribe'
|
||||
onclick="subscribe('{email}', '_user_id_');">
|
||||
<b class='text'>{subscribeText}</b>
|
||||
<span class="badge">{total}</span>
|
||||
</button>
|
||||
<button class='btn btn-xs btn-success subs_user_id_ subscribed'
|
||||
onclick="subscribe('{email}', '_user_id_');">
|
||||
<b class='text'>{subscribedText}</b>
|
||||
<span class="badge">{total}</span>
|
||||
</button>
|
||||
<button onclick="toogleNotify(_user_id_);"
|
||||
class="faa-parent animated-hover btn btn-success btn-xs notifyBtn doNotify"
|
||||
data-toggle="tooltip"
|
||||
title="{tooltipStop}">
|
||||
<i class="fas fa-bell faa-ring" ></i>
|
||||
</button>
|
||||
<button onclick="toogleNotify(_user_id_);"
|
||||
class="faa-parent animated-hover btn btn-default btn-xs notifyBtn doNotNotify"
|
||||
data-toggle="tooltip"
|
||||
title="{tooltip}">
|
||||
<i class="fas fa-bell-slash faa-ring"></i>
|
||||
</button>
|
||||
</div>
|
9
plugin/VideoTags/subscribeBtnOffline.html
Normal file
9
plugin/VideoTags/subscribeBtnOffline.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<div class="btn-group" >
|
||||
<button class='btn btn-xs btn-danger subs_tags_id_ subscribeTag'
|
||||
title="{titleOffline}"
|
||||
data-content="{tooltipOffline}"
|
||||
tabindex="0" role="button" data-html="true" data-toggle="popover" data-placement="bottom" >
|
||||
<b class='text'>{subscribeText}</b>
|
||||
<span class="badge">{total}</span>
|
||||
</button>
|
||||
</div>
|
|
@ -153,9 +153,6 @@ $videosCounter = 0;
|
|||
$url = addQueryStringParameter($url, 'rrating', @$_GET['rrating']);
|
||||
$url = addQueryStringParameter($url, 'tags_id', intval(@$_GET['tags_id']));
|
||||
$url = addQueryStringParameter($url, 'current', count($categories) ? $_REQUEST['current'] + 1 : $_REQUEST['current']);
|
||||
if (!empty($_REQUEST['search'])) {
|
||||
$url = addQueryStringParameter($url, 'search', $_REQUEST['search']);
|
||||
}
|
||||
?>
|
||||
<a class="pagination__next" href="<?php echo $url; ?>"></a>
|
||||
</p>
|
||||
|
|
|
@ -1259,6 +1259,9 @@ li.dropdown-submenu > ul > li > a{
|
|||
.getChangeVideoStatusButton.status_u button.getChangeVideoStatusButton_u{
|
||||
display: block;
|
||||
}
|
||||
.getChangeVideoStatusButton.status_s button.getChangeVideoStatusButton_s{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.pleaseWaitDialog{
|
||||
z-index: 2001;
|
||||
|
|
|
@ -2289,6 +2289,7 @@ function changeVideoStatus(videos_id, status) {
|
|||
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_a');
|
||||
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_u');
|
||||
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_i');
|
||||
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_s');
|
||||
$(".getChangeVideoStatusButton_" + videos_id).addClass('status_' + response.status[item].status);
|
||||
}
|
||||
|
||||
|
@ -2299,13 +2300,21 @@ function changeVideoStatus(videos_id, status) {
|
|||
}
|
||||
|
||||
function avideoAjax(url, data) {
|
||||
avideoAjax2(url, data, true);
|
||||
}
|
||||
|
||||
function avideoAjax2(url, data, pleaseWait) {
|
||||
if(pleaseWait){
|
||||
modal.showPleaseWait();
|
||||
}
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
if(pleaseWait){
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
if (response.error) {
|
||||
avideoAlertError(response.msg);
|
||||
} else {
|
||||
|
|
|
@ -241,12 +241,14 @@ if (!empty($_GET['iframe'])) {
|
|||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="far fa-eye"></i> <span class="hidden-md hidden-sm hidden-xs"><?php echo __('Status'); ?></span> <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="#" onclick="changeStatus('a'); return false;"><i class="fas fa-eye"></i> <?php echo __('Active'); ?></a></li>
|
||||
<li><a href="#" onclick="changeStatus('i'); return false;"><i class="fas fa-eye-slash"></i></span> <?php echo __('Inactive'); ?></a></li>
|
||||
<li><a href="#" onclick="changeStatus('u'); return false;"><i class="fas fa-eye" style="color: #BBB;"></i> <?php echo __('Unlisted'); ?></a></li>
|
||||
<!--
|
||||
<li><a href="#" onclick="changeStatus('p'); return false;"><span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span> <?php echo __('Private'); ?></a></li>
|
||||
-->
|
||||
<?php
|
||||
foreach ($statusThatTheUserCanUpdate as $value) {
|
||||
$statusIndex = $value[0];
|
||||
$statusColor = $value[1];
|
||||
echo "<li><a href=\"#\" onclick=\"changeStatus('" . $statusIndex . "'); return false;\" style=\"color: {$statusColor}\">"
|
||||
. Video::$statusIcons[$statusIndex] .' '. __(Video::$statusDesc[$statusIndex]) . "</a></li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
|
@ -326,15 +328,14 @@ if (!empty($_GET['iframe'])) {
|
|||
$('#grid').bootgrid('reload');
|
||||
return false;"><?php echo __('All'); ?></a></li>
|
||||
<?php
|
||||
$showOnly = ['a', 'i', 'e', 't', 'u', 'b'];
|
||||
if (AVideoPlugin::isEnabled('FansSubscriptions')) {
|
||||
$showOnly[] = 'f';
|
||||
$statusSearchFilter[] = Video::$statusFansOnly;
|
||||
}
|
||||
if (AVideoPlugin::isEnabled('SendRecordedToEncoder')) {
|
||||
$showOnly[] = 'r';
|
||||
$statusSearchFilter[] = Video::$statusRecording;
|
||||
}
|
||||
foreach (Video::$statusDesc as $key => $value) {
|
||||
if (!in_array($key, $showOnly)) {
|
||||
if (!in_array($key, $statusSearchFilter)) {
|
||||
continue;
|
||||
}
|
||||
$text = Video::$statusIcons[$key] . ' ' . __($value);
|
||||
|
@ -1595,10 +1596,24 @@ if (empty($advancedCustom->disableCopyEmbed)) {
|
|||
|
||||
var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Edit")); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>'
|
||||
var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Delete")); ?>"><i class="fa fa-trash"></i></button>';
|
||||
var activeBtn = '<button style="color: #090" type="button" class="btn btn-default btn-xs command-active" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("This video is Active and Listed, click here to unlist it")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>';
|
||||
var inactiveBtn = '<button style="color: #A00" type="button" class="btn btn-default btn-xs command-inactive" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("This video is inactive, click here to activate it")); ?>"><span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span></button>';
|
||||
var unlistedBtn = '<button style="color: #BBB" type="button" class="btn btn-default btn-xs command-unlisted" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("This video is unlisted, click here to inactivate it")); ?>"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>';
|
||||
var fansOnlyBtn = '<button style="color: #FFD700" type="button" class="btn btn-default btn-xs command-fansOnly" data-row-id="' + row.id + '" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("This video is for fans Only, click here to toogle it")); ?>" onclick="avideoAjax(webSiteRootURL+\'plugin/FansSubscriptions/toogleFansOnly.json.php?videos_id=' + row.id + '\', {});"><i class="fas fa-star" aria-hidden="true"></i></button>';
|
||||
|
||||
<?php
|
||||
$totalStatusButtons = count($statusThatTheUserCanUpdate);
|
||||
foreach ($statusThatTheUserCanUpdate as $key => $value) {
|
||||
$index = $key+1;
|
||||
if ($index > $totalStatusButtons - 1) {
|
||||
$index = 0;
|
||||
}
|
||||
$nextStatus = $statusThatTheUserCanUpdate[$index][0];
|
||||
$format = __("This video is %s, click here to make it %s");
|
||||
$statusIndex = $value[0];
|
||||
$statusColor = $value[1];
|
||||
$tooltip = sprintf($format, Video::$statusDesc[$statusIndex], Video::$statusDesc[$nextStatus]);
|
||||
|
||||
echo "var statusBtn_{$statusIndex} = '<button type=\"button\" style=\"color: {$statusColor}\" class=\"btn btn-default btn-xs command-statusBtn\" data-row-id=\"' + row.id + '\" nextStatus=\"{$nextStatus}\" data-toggle=\"tooltip\" title=" . printJSString($tooltip, true) . ">" . str_replace("'", '"', Video::$statusIcons[$statusIndex]) . "</button>';";
|
||||
}
|
||||
?>
|
||||
|
||||
var status;
|
||||
var pluginsButtons = '<?php echo AVideoPlugin::getVideosManagerListButton(); ?>';
|
||||
var download = '';
|
||||
|
@ -1654,20 +1669,11 @@ if (Permissions::canAdminVideos()) {
|
|||
download += '<button type="button" class="btn btn-default btn-xs btn-block" onclick="whyICannotDownload(' + row.id + ');" data-toggle="tooltip" title="<?php echo str_replace("'", "\\'", __("Download disabled")); ?>"><span class="fa-stack" style="font-size: 0.8em;"><i class="fa fa-download fa-stack-1x"></i><i class="fas fa-ban fa-stack-2x" style="color:Tomato"></i></span></button>';
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
if (row.status == "i") {
|
||||
status = inactiveBtn;
|
||||
} else if (row.status == "a" || row.status == "k") {
|
||||
status = activeBtn;
|
||||
} else if (row.status == "u") {
|
||||
status = unlistedBtn;
|
||||
} else if (row.status == "f") {
|
||||
status = fansOnlyBtn;
|
||||
} else if (row.status == "x") {
|
||||
return editBtn + deleteBtn;
|
||||
} else if (row.status == "d") {
|
||||
return editBtn + deleteBtn;
|
||||
$ifCondition = 'row.status == "' . implode('" || row.status == "', $statusThatShowTheCompleteMenu) . '"';
|
||||
?>
|
||||
if (<?php echo $ifCondition; ?>) {
|
||||
eval('status = statusBtn_' + row.status + ';');
|
||||
} else {
|
||||
return editBtn + deleteBtn;
|
||||
}
|
||||
|
@ -1920,50 +1926,9 @@ if (AVideoPlugin::isEnabledByName('PlayLists')) {
|
|||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
})
|
||||
.end().find(".command-unlisted").on("click", function (e) {
|
||||
var row_index = $(this).closest('tr').index();
|
||||
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>objects/videoStatus.json.php',
|
||||
data: {"id": row.id, "status": "i"},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
$("#grid").bootgrid("reload");
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
})
|
||||
.end().find(".command-active").on("click", function (e) {
|
||||
var row_index = $(this).closest('tr').index();
|
||||
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>objects/videoStatus.json.php',
|
||||
data: {"id": row.id, "status": "u"},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
$("#grid").bootgrid("reload");
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
})
|
||||
.end().find(".command-inactive").on("click", function (e) {
|
||||
var row_index = $(this).closest('tr').index();
|
||||
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: '<?php echo $global['webSiteRootURL']; ?>objects/videoStatus.json.php',
|
||||
data: {"id": row.id, "status": "a"},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
$("#grid").bootgrid("reload");
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
})
|
||||
.end().find(".command-rotate").on("click", function (e) {
|
||||
}).end().find(".command-statusBtn").on("click", function (e) {
|
||||
toggleVideoStatus(this);
|
||||
}).end().find(".command-rotate").on("click", function (e) {
|
||||
var row_index = $(this).closest('tr').index();
|
||||
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
|
||||
modal.showPleaseWait();
|
||||
|
@ -2073,4 +2038,19 @@ if (!empty($_GET['link'])) {
|
|||
function whyICannotDownload(videos_id) {
|
||||
avideoAlertAJAXHTML(webSiteRootURL + "view/downloadChecker.php?videos_id=" + videos_id);
|
||||
}
|
||||
function toggleVideoStatus(t) {
|
||||
var row_index = $(t).closest('tr').index();
|
||||
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
|
||||
var nextStatus= $(t).attr('nextStatus');
|
||||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'objects/videoStatus.json.php',
|
||||
data: {"id": row.id, "status": nextStatus},
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
$("#grid").bootgrid("reload");
|
||||
modal.hidePleaseWait();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue