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) {
|
function convertImageIfNotExists($source, $destination, $width, $height, $scaleUp = true) {
|
||||||
if (empty($source)) {
|
if (empty($source)) {
|
||||||
_error_log("convertImageToRoku: source image is empty");
|
_error_log("convertImageIfNotExists: source image is empty");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!file_exists($source)) {
|
if (!file_exists($source)) {
|
||||||
_error_log("convertImageToRoku: source does not exists");
|
_error_log("convertImageIfNotExists: source does not exists");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (file_exists($destination) && filesize($destination) > 1024) {
|
if (file_exists($destination) && filesize($destination) > 1024) {
|
||||||
|
|
|
@ -1,111 +1,112 @@
|
||||||
<?php
|
<?php
|
||||||
global $global, $config;
|
global $global, $config;
|
||||||
if (!isset($global['systemRootPath'])) {
|
if (!isset($global['systemRootPath'])) {
|
||||||
require_once '../videos/configuration.php';
|
require_once '../videos/configuration.php';
|
||||||
}
|
}
|
||||||
class Sites extends ObjectYPT
|
class Sites extends ObjectYPT
|
||||||
{
|
{
|
||||||
protected $name;
|
protected $id;
|
||||||
protected $url;
|
protected $name;
|
||||||
protected $status;
|
protected $url;
|
||||||
protected $secret;
|
protected $status;
|
||||||
|
protected $secret;
|
||||||
public static function getSearchFieldsNames()
|
|
||||||
{
|
public static function getSearchFieldsNames()
|
||||||
return ['name', 'url'];
|
{
|
||||||
}
|
return ['name', 'url'];
|
||||||
|
}
|
||||||
public static function getTableName()
|
|
||||||
{
|
public static function getTableName()
|
||||||
return 'sites';
|
{
|
||||||
}
|
return 'sites';
|
||||||
|
}
|
||||||
public function getName()
|
|
||||||
{
|
public function getName()
|
||||||
return $this->name;
|
{
|
||||||
}
|
return $this->name;
|
||||||
|
}
|
||||||
public function getUrl()
|
|
||||||
{
|
public function getUrl()
|
||||||
return $this->url;
|
{
|
||||||
}
|
return $this->url;
|
||||||
|
}
|
||||||
public function getStatus()
|
|
||||||
{
|
public function getStatus()
|
||||||
return $this->status;
|
{
|
||||||
}
|
return $this->status;
|
||||||
|
}
|
||||||
public function setName($name)
|
|
||||||
{
|
public function setName($name)
|
||||||
$this->name = $name;
|
{
|
||||||
}
|
$this->name = $name;
|
||||||
|
}
|
||||||
public function setUrl($url)
|
|
||||||
{
|
public function setUrl($url)
|
||||||
$this->url = $url;
|
{
|
||||||
}
|
$this->url = $url;
|
||||||
|
}
|
||||||
public function setStatus($status)
|
|
||||||
{
|
public function setStatus($status)
|
||||||
$this->status = $status;
|
{
|
||||||
}
|
$this->status = $status;
|
||||||
|
}
|
||||||
public function getSecret()
|
|
||||||
{
|
public function getSecret()
|
||||||
return $this->secret;
|
{
|
||||||
}
|
return $this->secret;
|
||||||
|
}
|
||||||
public function setSecret($secret)
|
|
||||||
{
|
public function setSecret($secret)
|
||||||
$this->secret = $secret;
|
{
|
||||||
}
|
$this->secret = $secret;
|
||||||
|
}
|
||||||
public function save()
|
|
||||||
{
|
public function save()
|
||||||
if (empty($this->getSecret())) {
|
{
|
||||||
$this->setSecret(md5(uniqid()));
|
if (empty($this->getSecret())) {
|
||||||
}
|
$this->setSecret(md5(uniqid()));
|
||||||
|
}
|
||||||
$siteURL = $this->getUrl();
|
|
||||||
if (substr($siteURL, -1) !== '/') {
|
$siteURL = $this->getUrl();
|
||||||
$siteURL .= "/";
|
if (substr($siteURL, -1) !== '/') {
|
||||||
}
|
$siteURL .= "/";
|
||||||
$this->setUrl($siteURL);
|
}
|
||||||
return parent::save();
|
$this->setUrl($siteURL);
|
||||||
}
|
return parent::save();
|
||||||
|
}
|
||||||
public static function getFromFileName($fileName)
|
|
||||||
{
|
public static function getFromFileName($fileName)
|
||||||
$obj = new stdClass();
|
{
|
||||||
$obj->url = '';
|
$obj = new stdClass();
|
||||||
$obj->secret = '';
|
$obj->url = '';
|
||||||
$obj->filename = $fileName;
|
$obj->secret = '';
|
||||||
$video = Video::getVideoFromFileNameLight($fileName);
|
$obj->filename = $fileName;
|
||||||
if (!empty($video['sites_id'])) {
|
$video = Video::getVideoFromFileNameLight($fileName);
|
||||||
$site = new Sites($video['sites_id']);
|
if (!empty($video['sites_id'])) {
|
||||||
$obj->url = $site->getUrl();
|
$site = new Sites($video['sites_id']);
|
||||||
$obj->secret = $site->getSecret();
|
$obj->url = $site->getUrl();
|
||||||
}
|
$obj->secret = $site->getSecret();
|
||||||
return $obj;
|
}
|
||||||
}
|
return $obj;
|
||||||
|
}
|
||||||
public static function getFromStatus($status)
|
|
||||||
{
|
public static function getFromStatus($status)
|
||||||
global $global;
|
{
|
||||||
if (!static::isTableInstalled()) {
|
global $global;
|
||||||
return false;
|
if (!static::isTableInstalled()) {
|
||||||
}
|
return false;
|
||||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status = ? ";
|
}
|
||||||
|
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status = ? ";
|
||||||
$res = sqlDAL::readSql($sql, 's', [$status]);
|
|
||||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
$res = sqlDAL::readSql($sql, 's', [$status]);
|
||||||
sqlDAL::close($res);
|
$fullData = sqlDAL::fetchAllAssoc($res);
|
||||||
$rows = [];
|
sqlDAL::close($res);
|
||||||
if ($res !== false) {
|
$rows = [];
|
||||||
foreach ($fullData as $row) {
|
if ($res !== false) {
|
||||||
$rows[] = $row;
|
foreach ($fullData as $row) {
|
||||||
}
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
return $rows;
|
}
|
||||||
}
|
return $rows;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -7,13 +7,13 @@ require_once $global['systemRootPath'] . 'objects/bootGrid.php';
|
||||||
require_once $global['systemRootPath'] . 'objects/user.php';
|
require_once $global['systemRootPath'] . 'objects/user.php';
|
||||||
|
|
||||||
class Subscribe extends ObjectYPT{
|
class Subscribe extends ObjectYPT{
|
||||||
private $id;
|
protected $id;
|
||||||
private $email;
|
protected $email;
|
||||||
private $status;
|
protected $status;
|
||||||
private $ip;
|
protected $ip;
|
||||||
private $users_id;
|
protected $users_id;
|
||||||
private $notify;
|
protected $notify;
|
||||||
private $subscriber_users_id;
|
protected $subscriber_users_id;
|
||||||
|
|
||||||
public function __construct($id, $email = "", $user_id = "", $subscriber_users_id = "")
|
public function __construct($id, $email = "", $user_id = "", $subscriber_users_id = "")
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ class Subscribe extends ObjectYPT{
|
||||||
return true;
|
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);
|
$obj = self::getSubscribeFromEmail($email, $user_id, $status);
|
||||||
if (empty($obj)) {
|
if (empty($obj)) {
|
||||||
|
@ -54,7 +54,7 @@ class Subscribe extends ObjectYPT{
|
||||||
return true;
|
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);
|
$obj = self::getSubscribeFromID($subscriber_users_id, $user_id, $status);
|
||||||
if (empty($obj)) {
|
if (empty($obj)) {
|
||||||
|
|
|
@ -76,6 +76,7 @@ if (!class_exists('Video')) {
|
||||||
'd' => 'Downloading',
|
'd' => 'Downloading',
|
||||||
't' => 'Transferring',
|
't' => 'Transferring',
|
||||||
'u' => 'Unlisted',
|
'u' => 'Unlisted',
|
||||||
|
's' => 'Unlisted but Searchable',
|
||||||
'r' => 'Recording',
|
'r' => 'Recording',
|
||||||
'f' => 'FansOnly',
|
'f' => 'FansOnly',
|
||||||
'b' => 'Broken Missing files'
|
'b' => 'Broken Missing files'
|
||||||
|
@ -89,6 +90,7 @@ if (!class_exists('Video')) {
|
||||||
'd' => '<i class=\'fas fa-download\'></i>',
|
'd' => '<i class=\'fas fa-download\'></i>',
|
||||||
't' => '<i class=\'fas fa-sync\'></i>',
|
't' => '<i class=\'fas fa-sync\'></i>',
|
||||||
'u' => '<i class=\'fas fa-eye\' style=\'color: #BBB;\'></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>',
|
'r' => '<i class=\'fas fa-circle\'></i>',
|
||||||
'f' => '<i class=\'fas fa-star\'></i>',
|
'f' => '<i class=\'fas fa-star\'></i>',
|
||||||
'b' => '<i class=\'fas fa-times\'></i>'
|
'b' => '<i class=\'fas fa-times\'></i>'
|
||||||
|
@ -101,6 +103,7 @@ if (!class_exists('Video')) {
|
||||||
public static $statusDownloading = 'd';
|
public static $statusDownloading = 'd';
|
||||||
public static $statusTranfering = 't';
|
public static $statusTranfering = 't';
|
||||||
public static $statusUnlisted = 'u';
|
public static $statusUnlisted = 'u';
|
||||||
|
public static $statusUnlistedButSearchable = 's';
|
||||||
public static $statusRecording = 'r';
|
public static $statusRecording = 'r';
|
||||||
public static $statusFansOnly = 'f';
|
public static $statusFansOnly = 'f';
|
||||||
public static $statusBrokenMissingFiles = 'b';
|
public static $statusBrokenMissingFiles = 'b';
|
||||||
|
@ -702,11 +705,7 @@ if (!class_exists('Video')) {
|
||||||
return $this->setStatus(Video::$statusActiveAndEncoding);
|
return $this->setStatus(Video::$statusActiveAndEncoding);
|
||||||
} else {
|
} else {
|
||||||
if ($this->getTitle() !== "Video automatically booked") {
|
if ($this->getTitle() !== "Video automatically booked") {
|
||||||
if (!empty($advancedCustom->makeVideosInactiveAfterEncode)) {
|
return $this->setStatus($advancedCustom->defaultVideoStatus);
|
||||||
return $this->setStatus(Video::$statusInactive);
|
|
||||||
} elseif (!empty($advancedCustom->makeVideosUnlistedAfterEncode)) {
|
|
||||||
return $this->setStatus(Video::$statusUnlisted);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return $this->setStatus(Video::$statusInactive);
|
return $this->setStatus(Video::$statusInactive);
|
||||||
}
|
}
|
||||||
|
@ -1446,6 +1445,9 @@ if (!class_exists('Video')) {
|
||||||
// for the cache on the database fast insert
|
// for the cache on the database fast insert
|
||||||
|
|
||||||
TimeLogEnd($timeLogName, __LINE__, 0.2);
|
TimeLogEnd($timeLogName, __LINE__, 0.2);
|
||||||
|
|
||||||
|
$allowedDurationTypes = array('video', 'audio');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @var array $global
|
* @var array $global
|
||||||
|
@ -1454,18 +1456,24 @@ if (!class_exists('Video')) {
|
||||||
$global['mysqli']->begin_transaction();
|
$global['mysqli']->begin_transaction();
|
||||||
foreach ($fullData as $row) {
|
foreach ($fullData as $row) {
|
||||||
if (is_null($row['likes'])) {
|
if (is_null($row['likes'])) {
|
||||||
|
_error_log("Video::updateLikesDislikes: id={$row['id']}");
|
||||||
$row['likes'] = self::updateLikesDislikes($row['id'], 'likes');
|
$row['likes'] = self::updateLikesDislikes($row['id'], 'likes');
|
||||||
}
|
}
|
||||||
if (is_null($row['dislikes'])) {
|
if (is_null($row['dislikes'])) {
|
||||||
|
_error_log("Video::updateLikesDislikes: id={$row['id']}");
|
||||||
$row['dislikes'] = self::updateLikesDislikes($row['id'], 'dislikes');
|
$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']);
|
$row['duration_in_seconds'] = self::updateDurationInSeconds($row['id'], $row['duration']);
|
||||||
if (empty($row['duration_in_seconds'])) {
|
if (empty($row['duration_in_seconds'])) {
|
||||||
//_error_log("Video duration_in_seconds not updated: id={$row['id']} type={$row['type']}");
|
//_error_log("Video duration_in_seconds not updated: id={$row['id']} type={$row['type']}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TimeLogStart("video::getInfo");
|
||||||
$row = self::getInfo($row, $getStatistcs);
|
$row = self::getInfo($row, $getStatistcs);
|
||||||
|
TimeLogEnd("video::getInfo", __LINE__);
|
||||||
$videos[] = $row;
|
$videos[] = $row;
|
||||||
}
|
}
|
||||||
$global['mysqli']->commit();
|
$global['mysqli']->commit();
|
||||||
|
@ -1541,9 +1549,13 @@ if (!class_exists('Video')) {
|
||||||
if (empty($otherInfo)) {
|
if (empty($otherInfo)) {
|
||||||
$otherInfo = [];
|
$otherInfo = [];
|
||||||
$otherInfo['category'] = xss_esc_back($row['category']);
|
$otherInfo['category'] = xss_esc_back($row['category']);
|
||||||
|
//TimeLogStart("video::otherInfo");
|
||||||
$otherInfo['groups'] = UserGroups::getVideosAndCategoriesUserGroups($row['id']);
|
$otherInfo['groups'] = UserGroups::getVideosAndCategoriesUserGroups($row['id']);
|
||||||
|
//TimeLogEnd("video::otherInfo", __LINE__, 0.05);
|
||||||
$otherInfo['tags'] = self::getTags($row['id']);
|
$otherInfo['tags'] = self::getTags($row['id']);
|
||||||
|
//TimeLogEnd("video::otherInfo", __LINE__, 0.05);
|
||||||
$cached = ObjectYPT::setCache($otherInfocachename, $otherInfo);
|
$cached = ObjectYPT::setCache($otherInfocachename, $otherInfo);
|
||||||
|
//TimeLogEnd("video::otherInfo", __LINE__, 0.05);
|
||||||
//_error_log("video::getInfo cache " . json_encode($cached));
|
//_error_log("video::getInfo cache " . json_encode($cached));
|
||||||
}
|
}
|
||||||
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
|
TimeLogEnd($timeLogName, __LINE__, $TimeLogLimit);
|
||||||
|
@ -2051,9 +2063,15 @@ if (!class_exists('Video')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getViewableStatus($showUnlisted = false) {
|
public static function getViewableStatus($showUnlisted = false) {
|
||||||
$viewable = ['a', 'k', 'f'];
|
$viewable = [Video::$statusActive, Video::$statusActiveAndEncoding, Video::$statusFansOnly];
|
||||||
if ($showUnlisted) {
|
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
|
* 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 = "") {
|
public static function getTags_($video_id, $type = "") {
|
||||||
global $advancedCustom, $advancedCustomUser, $getTags_;
|
global $advancedCustom, $advancedCustomUser, $getTags_;
|
||||||
|
$tolerance = 0.3;
|
||||||
if (!isset($getTags_)) {
|
if (!isset($getTags_)) {
|
||||||
$getTags_ = [];
|
$getTags_ = [];
|
||||||
}
|
}
|
||||||
|
@ -2720,7 +2738,7 @@ if (!class_exists('Video')) {
|
||||||
$tags[] = $objTag;
|
$tags[] = $objTag;
|
||||||
$objTag = new stdClass();
|
$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
|
a = active
|
||||||
|
@ -2758,6 +2776,9 @@ if (!class_exists('Video')) {
|
||||||
case Video::$statusUnlisted:
|
case Video::$statusUnlisted:
|
||||||
$objTag->type = "info";
|
$objTag->type = "info";
|
||||||
break;
|
break;
|
||||||
|
case Video::$statusUnlistedButSearchable:
|
||||||
|
$objTag->type = "info";
|
||||||
|
break;
|
||||||
case Video::$statusRecording:
|
case Video::$statusRecording:
|
||||||
$objTag->type = "danger isRecording isRecordingIcon";
|
$objTag->type = "danger isRecording isRecordingIcon";
|
||||||
break;
|
break;
|
||||||
|
@ -2769,7 +2790,7 @@ if (!class_exists('Video')) {
|
||||||
$tags[] = $objTag;
|
$tags[] = $objTag;
|
||||||
$objTag = new stdClass();
|
$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");
|
TimeLogStart("video::getTags_ userGroups $video_id, $type");
|
||||||
if (empty($type) || $type === "userGroups") {
|
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");
|
TimeLogStart("video::getTags_ category $video_id, $type");
|
||||||
if (empty($type) || $type === "category") {
|
if (empty($type) || $type === "category") {
|
||||||
|
@ -2832,7 +2853,7 @@ if (!class_exists('Video')) {
|
||||||
$objTag = new stdClass();
|
$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");
|
TimeLogStart("video::getTags_ source $video_id, $type");
|
||||||
if (empty($type) || $type === "source") {
|
if (empty($type) || $type === "source") {
|
||||||
|
@ -2852,7 +2873,7 @@ if (!class_exists('Video')) {
|
||||||
$objTag = new stdClass();
|
$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())) {
|
if (!empty($video->getRrating())) {
|
||||||
$rating = $video->getRrating();
|
$rating = $video->getRrating();
|
||||||
|
@ -2866,15 +2887,15 @@ if (!class_exists('Video')) {
|
||||||
//var_dump($tags);exit;
|
//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);
|
$array2 = AVideoPlugin::getVideoTags($video_id);
|
||||||
if (is_array($array2)) {
|
if (is_array($array2)) {
|
||||||
$tags = array_merge($tags, $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);
|
//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['current'] = $currentPage;
|
||||||
$_REQUEST['rowCount'] = $rowCount;
|
$_REQUEST['rowCount'] = $rowCount;
|
||||||
$getTags_[$index] = $tags;
|
$getTags_[$index] = $tags;
|
||||||
|
@ -3757,9 +3778,9 @@ if (!class_exists('Video')) {
|
||||||
public static function getHigestResolution($filename) {
|
public static function getHigestResolution($filename) {
|
||||||
global $global;
|
global $global;
|
||||||
$filename = self::getCleanFilenameFromFile($filename);
|
$filename = self::getCleanFilenameFromFile($filename);
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
$cacheName = "getHigestResolution($filename)";
|
$cacheName = "getHigestResolution($filename)";
|
||||||
$return = ObjectYPT::getSessionCache($cacheName, 0);
|
$return = ObjectYPT::getSessionCache($cacheName, 0);
|
||||||
if (!empty($return)) {
|
if (!empty($return)) {
|
||||||
|
@ -3777,7 +3798,7 @@ if (!class_exists('Video')) {
|
||||||
if ($v['type'] !== 'video') {
|
if ($v['type'] !== 'video') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if ($v['status'] !== self::$statusActive && $v['status'] !== self::$statusUnlisted) {
|
if ($v['status'] !== self::$statusActive && $v['status'] !== self::$statusUnlisted && $v['status'] !== self::$statusUnlistedButSearchable) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$video = new Video('', '', $v['id']);
|
$video = new Video('', '', $v['id']);
|
||||||
|
@ -3785,17 +3806,16 @@ if (!class_exists('Video')) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$HigestResolution = $video->getVideoHigestResolution();
|
$HigestResolution = $video->getVideoHigestResolution();
|
||||||
//_error_log("Video:::getHigestResolution::getVideosURL_V2($filename) 1 FROM database $HigestResolution");
|
|
||||||
if (!empty($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;
|
$resolution = $HigestResolution;
|
||||||
|
|
||||||
$return['resolution'] = $resolution;
|
$return['resolution'] = $resolution;
|
||||||
$return['resolution_text'] = getResolutionText($return['resolution']);
|
$return['resolution_text'] = getResolutionText($return['resolution']);
|
||||||
$return['resolution_label'] = getResolutionLabel($return['resolution']);
|
$return['resolution_label'] = getResolutionLabel($return['resolution']);
|
||||||
$return['resolution_string'] = trim($resolution . "p {$return['resolution_label']}");
|
$return['resolution_string'] = trim($resolution . "p {$return['resolution_label']}");
|
||||||
return $return;
|
return $return;
|
||||||
} else {
|
} else {
|
||||||
|
//_error_log("getHigestResolution($filename) 2 ".$video->getType());
|
||||||
$validFileExtensions = ['webm', 'mp4', 'm3u8'];
|
$validFileExtensions = ['webm', 'mp4', 'm3u8'];
|
||||||
$sources = getVideosURL_V2($filename);
|
$sources = getVideosURL_V2($filename);
|
||||||
if (!is_array($sources)) {
|
if (!is_array($sources)) {
|
||||||
|
@ -5099,6 +5119,7 @@ if (!class_exists('Video')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getChangeVideoStatusButton($videos_id) {
|
public static function getChangeVideoStatusButton($videos_id) {
|
||||||
|
global $statusThatTheUserCanUpdate;
|
||||||
$video = new Video('', '', $videos_id);
|
$video = new Video('', '', $videos_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5107,14 +5128,25 @@ if (!class_exists('Video')) {
|
||||||
*/
|
*/
|
||||||
$status = $video->getStatus();
|
$status = $video->getStatus();
|
||||||
|
|
||||||
$activeBtn = '<button onclick="changeVideoStatus(' . $videos_id . ', \'u\');" style="color: #090" type="button" '
|
$buttons = array();
|
||||||
. '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>';
|
$totalStatusButtons = count($statusThatTheUserCanUpdate);
|
||||||
$inactiveBtn = '<button onclick="changeVideoStatus(' . $videos_id . ', \'a\');" style="color: #A00" type="button" '
|
foreach ($statusThatTheUserCanUpdate as $key => $value) {
|
||||||
. '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>';
|
$index = $key+1;
|
||||||
$unlistedBtn = '<button onclick="changeVideoStatus(' . $videos_id . ', \'i\');" style="color: #BBB" type="button" '
|
if ($index > $totalStatusButtons - 1) {
|
||||||
. '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>';
|
$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) {
|
public static function canVideoBePurchased($videos_id) {
|
||||||
|
@ -5531,7 +5563,7 @@ if (!class_exists('Video')) {
|
||||||
if (!empty($video->getSerie_playlists_id())) {
|
if (!empty($video->getSerie_playlists_id())) {
|
||||||
return false;
|
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 ($video->getType() == 'audio' || $video->getType() == 'video') {
|
||||||
if (self::isMediaFileMissing($video->getFilename())) {
|
if (self::isMediaFileMissing($video->getFilename())) {
|
||||||
_error_log("Video::checkIfIsBroken($videos_id) true " . $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'])) {
|
if (!empty($_GET['v']) && empty($_GET['videoName'])) {
|
||||||
$_GET['videoName'] = Video::get_clean_title($_GET['v']);
|
$_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']} ";
|
$TimeLog = "AVideoPlugin::getVideoTags($videos_id) {$value['dirName']} ";
|
||||||
TimeLogStart($TimeLog);
|
TimeLogStart($TimeLog);
|
||||||
$p = static::loadPlugin($value['dirName']);
|
$p = static::loadPlugin($value['dirName']);
|
||||||
|
TimeLogEnd($TimeLog, __LINE__, 0.1);
|
||||||
if (is_object($p)) {
|
if (is_object($p)) {
|
||||||
$array = array_merge($array, $p->getVideoTags($videos_id));
|
$array = array_merge($array, $p->getVideoTags($videos_id));
|
||||||
|
TimeLogEnd($TimeLog, __LINE__, 0.1);
|
||||||
}
|
}
|
||||||
TimeLogEnd($TimeLog, __LINE__);
|
TimeLogEnd($TimeLog, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ class CustomizeAdvanced extends PluginAbstract {
|
||||||
'EnableMinifyJS',
|
'EnableMinifyJS',
|
||||||
'usePreloadLowResolutionImages',
|
'usePreloadLowResolutionImages',
|
||||||
'useFFMPEGToGenerateThumbs',
|
'useFFMPEGToGenerateThumbs',
|
||||||
|
'makeVideosInactiveAfterEncode',
|
||||||
|
'makeVideosUnlistedAfterEncode',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +166,7 @@ class CustomizeAdvanced extends PluginAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEmptyDataObject() {
|
public function getEmptyDataObject() {
|
||||||
global $global;
|
global $global, $statusThatTheUserCanUpdate, $advancedCustom;
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
$obj->logoMenuBarURL = "";
|
$obj->logoMenuBarURL = "";
|
||||||
$obj->encoderNetwork = "https://network.wwbn.net/";
|
$obj->encoderNetwork = "https://network.wwbn.net/";
|
||||||
|
@ -222,6 +224,27 @@ class CustomizeAdvanced extends PluginAbstract {
|
||||||
$obj->doNotUseXsendFile = false;
|
$obj->doNotUseXsendFile = false;
|
||||||
$obj->makeVideosInactiveAfterEncode = false;
|
$obj->makeVideosInactiveAfterEncode = false;
|
||||||
$obj->makeVideosUnlistedAfterEncode = 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;
|
$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');
|
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;
|
$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="#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>';
|
$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;
|
return $btn;
|
||||||
}
|
}
|
||||||
|
@ -587,6 +588,8 @@ class CustomizeUser extends PluginAbstract {
|
||||||
include $global['systemRootPath'] . 'plugin/CustomizeUser/View/tabAffiliation.php';
|
include $global['systemRootPath'] . 'plugin/CustomizeUser/View/tabAffiliation.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tabId = 'tabSubscriptions';
|
||||||
|
include $global['systemRootPath'] . 'plugin/CustomizeUser/View/tabSubscriptions.php';
|
||||||
return $btn;
|
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>
|
||||||
|
|
|
@ -1,43 +1,43 @@
|
||||||
<?php
|
<?php
|
||||||
global $global;
|
global $global;
|
||||||
|
|
||||||
if (empty($global['systemRootPath'])) {
|
if (empty($global['systemRootPath'])) {
|
||||||
$global['systemRootPath'] = dirname(__FILE__) . '/../../../';
|
$global['systemRootPath'] = dirname(__FILE__) . '/../../../';
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once $global['systemRootPath'] . 'videos/configuration.php';
|
require_once $global['systemRootPath'] . 'videos/configuration.php';
|
||||||
require_once $global['systemRootPath'] . 'objects/subscribe.php';
|
require_once $global['systemRootPath'] . 'objects/subscribe.php';
|
||||||
require_once $global['systemRootPath'] . 'plugin/Gallery/functions.php';
|
require_once $global['systemRootPath'] . 'plugin/Gallery/functions.php';
|
||||||
|
|
||||||
if (empty($obj)) {
|
if (empty($obj) || empty($obj->SubscribedChannelsRowCount)) {
|
||||||
$obj = AVideoPlugin::getDataObject('Gallery');
|
$obj = AVideoPlugin::getDataObject('Gallery');
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemsPerPage = 4;
|
$itemsPerPage = 4;
|
||||||
$total = Subscribe::getTotalSubscribedChannels(User::getId());
|
$total = Subscribe::getTotalSubscribedChannels(User::getId());
|
||||||
$page = getCurrentPage();
|
$page = getCurrentPage();
|
||||||
$channels = Subscribe::getSubscribedChannels(User::getId(), $itemsPerPage, $page);
|
$channels = Subscribe::getSubscribedChannels(User::getId(), $itemsPerPage, $page);
|
||||||
if (empty($channels)) {
|
if (empty($channels)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$totalPages = ceil($total / $itemsPerPage);
|
$totalPages = ceil($total / $itemsPerPage);
|
||||||
if ($totalPages < $page) {
|
if ($totalPages < $page) {
|
||||||
$page = $totalPages;
|
$page = $totalPages;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!-- mainAreaChannel start -->
|
<!-- mainAreaChannel start -->
|
||||||
<div class="mainAreaChannels">
|
<div class="mainAreaChannels">
|
||||||
<?php
|
<?php
|
||||||
foreach ($channels as $value) {
|
foreach ($channels as $value) {
|
||||||
$_POST['disableAddTo'] = 0;
|
$_POST['disableAddTo'] = 0;
|
||||||
createChannelItem($value['users_id'], $value['photoURL'], $value['identification'], $obj->SubscribedChannelsRowCount);
|
createChannelItem($value['users_id'], $value['photoURL'], $value['identification'], $obj->SubscribedChannelsRowCount);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-12" style="z-index: 1;">
|
<div class="col-sm-12" style="z-index: 1;">
|
||||||
<?php
|
<?php
|
||||||
//getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinityScrollGetFromSelector="", $infinityScrollAppendIntoSelector="")
|
//getPagination($total, $page = 0, $link = "", $maxVisible = 10, $infinityScrollGetFromSelector="", $infinityScrollAppendIntoSelector="")
|
||||||
echo getPagination($totalPages, $page, "{$global['webSiteRootURL']}plugin/Gallery/view/mainAreaChannels.php", 10, ".mainAreaChannels", ".mainAreaChannels");
|
echo getPagination($totalPages, $page, "{$global['webSiteRootURL']}plugin/Gallery/view/mainAreaChannels.php", 10, ".mainAreaChannels", ".mainAreaChannels");
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<!-- mainAreaChannel end -->
|
<!-- mainAreaChannel end -->
|
|
@ -701,6 +701,7 @@ class PlayerSkins extends PluginAbstract {
|
||||||
//_error_log("Cache not found $name");
|
//_error_log("Cache not found $name");
|
||||||
$video = new Video("", "", $videos_id);
|
$video = new Video("", "", $videos_id);
|
||||||
$fileName = $video->getFilename();
|
$fileName = $video->getFilename();
|
||||||
|
//_error_log("getVideoTags($videos_id) $fileName ".$video->getType());
|
||||||
$resolution = Video::getHigestResolution($fileName);
|
$resolution = Video::getHigestResolution($fileName);
|
||||||
$obj = new stdClass();
|
$obj = new stdClass();
|
||||||
if (empty($resolution) || empty($resolution['resolution_text'])) {
|
if (empty($resolution) || empty($resolution['resolution_text'])) {
|
||||||
|
|
|
@ -96,50 +96,22 @@ abstract class PluginAbstract {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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']));
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDataObject() {
|
public function getDataObject() {
|
||||||
$uuid = $this->getUUID();
|
$uuid = $this->getUUID();
|
||||||
if (empty(PluginAbstract::$dataObject[$uuid])) {
|
if (empty(PluginAbstract::$dataObject[$uuid])) {
|
||||||
$obj = Plugin::getPluginByUUID($uuid);
|
$obj = Plugin::getPluginByUUID($uuid);
|
||||||
//echo $obj['object_data'];
|
//echo $obj['object_data'];
|
||||||
$o = array();
|
$o = self::getObjectDataFromDatabase($uuid);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$eo = $this->getEmptyDataObject();
|
$eo = $this->getEmptyDataObject();
|
||||||
// check if the plugin define any array for the select option, if does, overwrite it
|
// check if the plugin define any array for the select option, if does, overwrite it
|
||||||
foreach ($eo as $key => $value) {
|
foreach ($eo as $key => $value) {
|
||||||
|
@ -215,18 +187,18 @@ abstract class PluginAbstract {
|
||||||
public static function getDataObjectAdvanced() {
|
public static function getDataObjectAdvanced() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDataObjectDeprecated() {
|
public static function getDataObjectDeprecated() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDataObjectExperimental() {
|
public static function getDataObjectExperimental() {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSomething($parameter_name, $type) {
|
public function isSomething($parameter_name, $type) {
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
if(empty($name) || !class_exists($name)){
|
if (empty($name) || !class_exists($name)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
eval("\$array = {$name}::getDataObject{$type}();");
|
eval("\$array = {$name}::getDataObject{$type}();");
|
||||||
|
@ -236,7 +208,7 @@ abstract class PluginAbstract {
|
||||||
return in_array($parameter_name, $array);
|
return in_array($parameter_name, $array);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAdvanced($parameter_name) {
|
public function isAdvanced($parameter_name) {
|
||||||
return $this->isSomething($parameter_name, 'Advanced');
|
return $this->isSomething($parameter_name, 'Advanced');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,16 +738,16 @@ abstract class PluginAbstract {
|
||||||
function onVideoSetRrating($video_id, $oldValue, $newValue) {
|
function onVideoSetRrating($video_id, $oldValue, $newValue) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type $file = [
|
* @param type $file = [
|
||||||
'filename' => "{$parts['filename']}.{$parts['extension']}",
|
'filename' => "{$parts['filename']}.{$parts['extension']}",
|
||||||
'path' => $file,
|
'path' => $file,
|
||||||
'url' => $source['url'],
|
'url' => $source['url'],
|
||||||
'url_noCDN' => @$source['url_noCDN'],
|
'url_noCDN' => @$source['url_noCDN'],
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'format' => strtolower($parts['extension']),
|
'format' => strtolower($parts['extension']),
|
||||||
]
|
]
|
||||||
* @return $file
|
* @return $file
|
||||||
*/
|
*/
|
||||||
function modifyURL($file) {
|
function modifyURL($file) {
|
||||||
|
@ -793,9 +765,9 @@ abstract class PluginAbstract {
|
||||||
function onVideoSetSerie_playlists_id($video_id, $oldValue, $newValue) {
|
function onVideoSetSerie_playlists_id($video_id, $oldValue, $newValue) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMobileHomePageURL() {
|
function getMobileHomePageURL() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateParameter($parameterName, $newValue) {
|
function updateParameter($parameterName, $newValue) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ class Tags extends ObjectYPT {
|
||||||
return empty($tagsArray)?(new stdClass()):$tagsArray;
|
return empty($tagsArray)?(new stdClass()):$tagsArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getAllTagsList($tags_types_id) {
|
static function getAllTags($tags_types_id) {
|
||||||
global $global;
|
global $global;
|
||||||
$tags_types_id = intval($tags_types_id);
|
$tags_types_id = intval($tags_types_id);
|
||||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE 1=1 ";
|
$sql = "SELECT * FROM " . static::getTableName() . " WHERE 1=1 ";
|
||||||
|
@ -123,16 +123,33 @@ class Tags extends ObjectYPT {
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY name ";
|
$sql .= " ORDER BY name ";
|
||||||
$res = sqlDAL::readSql($sql);
|
$res = sqlDAL::readSql($sql);
|
||||||
$fullData = sqlDAL::fetchAllAssoc($res);
|
$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();
|
$rows = array();
|
||||||
if ($res!=false) {
|
if ($res!=false) {
|
||||||
foreach ($fullData as $row) {
|
foreach ($fullData as $row) {
|
||||||
$rows[] = $row['name'];
|
$rows[] = $row['name'];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
|
|
||||||
}
|
}
|
||||||
return $rows;
|
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/Tags.php';
|
||||||
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/TagsHasVideos.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/TagsTypes.php';
|
||||||
|
require_once $global['systemRootPath'] . 'plugin/VideoTags/Objects/Tags_subscriptions.php';
|
||||||
|
|
||||||
class VideoTags extends PluginAbstract {
|
class VideoTags extends PluginAbstract {
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ class VideoTags extends PluginAbstract {
|
||||||
PluginTags::$FREE,
|
PluginTags::$FREE,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDescription() {
|
public function getDescription() {
|
||||||
$txt = "User interface for managing tags";
|
$txt = "User interface for managing tags";
|
||||||
$help = "";
|
$help = "";
|
||||||
|
@ -36,17 +38,17 @@ class VideoTags extends PluginAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
static function saveTags($tagsNameList, $videos_id) {
|
static function saveTags($tagsNameList, $videos_id) {
|
||||||
TimeLogStart(__FILE__."::".__FUNCTION__);
|
TimeLogStart(__FILE__ . "::" . __FUNCTION__);
|
||||||
// remove all tags from the video
|
// remove all tags from the video
|
||||||
$tagsSaved = array();
|
$tagsSaved = array();
|
||||||
$deleted = self::removeAllTagFromVideo($videos_id);
|
$deleted = self::removeAllTagFromVideo($videos_id);
|
||||||
TimeLogEnd(__FILE__."::".__FUNCTION__, __LINE__);
|
TimeLogEnd(__FILE__ . "::" . __FUNCTION__, __LINE__);
|
||||||
if (session_status() == PHP_SESSION_NONE) {
|
if (session_status() == PHP_SESSION_NONE) {
|
||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
unset($_SESSION['getVideoTags'][$videos_id]);
|
unset($_SESSION['getVideoTags'][$videos_id]);
|
||||||
session_write_close();
|
session_write_close();
|
||||||
TimeLogEnd(__FILE__."::".__FUNCTION__, __LINE__);
|
TimeLogEnd(__FILE__ . "::" . __FUNCTION__, __LINE__);
|
||||||
if ($deleted) {
|
if ($deleted) {
|
||||||
foreach ($tagsNameList as $value) {
|
foreach ($tagsNameList as $value) {
|
||||||
if (empty($value['items'])) {
|
if (empty($value['items'])) {
|
||||||
|
@ -64,7 +66,7 @@ class VideoTags extends PluginAbstract {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TimeLogEnd(__FILE__."::".__FUNCTION__, __LINE__);
|
TimeLogEnd(__FILE__ . "::" . __FUNCTION__, __LINE__);
|
||||||
//var_dump($tagsSaved, $tagsNameList, $videos_id);
|
//var_dump($tagsSaved, $tagsNameList, $videos_id);
|
||||||
return $tagsSaved;
|
return $tagsSaved;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +98,7 @@ class VideoTags extends PluginAbstract {
|
||||||
static function getAllFromVideosId($videos_id) {
|
static function getAllFromVideosId($videos_id) {
|
||||||
return TagsHasVideos::getAllFromVideosId($videos_id);
|
return TagsHasVideos::getAllFromVideosId($videos_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getArrayFromVideosId($videos_id) {
|
static function getArrayFromVideosId($videos_id) {
|
||||||
$rows = TagsHasVideos::getAllFromVideosId($videos_id);
|
$rows = TagsHasVideos::getAllFromVideosId($videos_id);
|
||||||
$array = array();
|
$array = array();
|
||||||
|
@ -115,7 +117,7 @@ class VideoTags extends PluginAbstract {
|
||||||
$str = "";
|
$str = "";
|
||||||
foreach ($types as $value) {
|
foreach ($types as $value) {
|
||||||
$input = self::getTagsInput($value['id']);
|
$input = self::getTagsInput($value['id']);
|
||||||
$str .= "<label for=\"tagTypesId{$value['id']}\">".__($value['name'])."</label><div class=\"clear clearfix\">{$input}</div> ";
|
$str .= "<label for=\"tagTypesId{$value['id']}\">" . __($value['name']) . "</label><div class=\"clear clearfix\">{$input}</div> ";
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
@ -182,14 +184,107 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
||||||
}
|
}
|
||||||
return User::isAdmin();
|
return User::isAdmin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getButton($tags_id){
|
||||||
|
global $global, $advancedCustom;
|
||||||
|
|
||||||
static function getLabels($videos_id, $showType=true) {
|
$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;
|
global $global;
|
||||||
|
|
||||||
$currentPage = getCurrentPage();
|
$currentPage = getCurrentPage();
|
||||||
$rowCount = getRowCount();
|
$rowCount = getRowCount();
|
||||||
$_REQUEST['current'] = 1;
|
$_REQUEST['current'] = 1;
|
||||||
$_REQUEST['rowCount'] = 1000;
|
$_REQUEST['rowCount'] = 1000;
|
||||||
|
|
||||||
$post = $_POST;
|
$post = $_POST;
|
||||||
unset($_POST);
|
unset($_POST);
|
||||||
|
@ -202,30 +297,27 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
||||||
$tags = TagsHasVideos::getAllFromVideosIdAndTagsTypesId($videos_id, $type['id']);
|
$tags = TagsHasVideos::getAllFromVideosIdAndTagsTypesId($videos_id, $type['id']);
|
||||||
$strT = "";
|
$strT = "";
|
||||||
foreach ($tags as $value) {
|
foreach ($tags as $value) {
|
||||||
if(empty($value['name']) || $value['name']==='-'){
|
if (empty($value['name']) || $value['name'] === '-') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$tooltip = "1 " . __("Video");
|
//$strT .= self::getTagHTMLLink($value['id'], $value['total']);
|
||||||
if ($value['total'] > 1) {
|
$strT .= self::getButton($value['tags_id']);
|
||||||
$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> ';
|
|
||||||
}
|
}
|
||||||
if (!empty($strT)) {
|
if (!empty($strT)) {
|
||||||
$label = "";
|
$label = "";
|
||||||
if($showType){
|
if ($showType) {
|
||||||
$name = str_replace("_", " ", $type['name']);
|
$name = str_replace("_", " ", $type['name']);
|
||||||
$label = "<strong class='label text-muted'>".__($name).": </strong> ";
|
$label = "<strong class='label text-muted'>" . __($name) . ": </strong> ";
|
||||||
}
|
}
|
||||||
$tagsStrList[] = "{$label}{$strT}";
|
$tagsStrList[] = "{$label}{$strT}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_POST = $post;
|
$_POST = $post;
|
||||||
$_GET = $get;
|
$_GET = $get;
|
||||||
|
|
||||||
$_REQUEST['current'] = $currentPage;
|
$_REQUEST['current'] = $currentPage;
|
||||||
$_REQUEST['rowCount'] = $rowCount;
|
$_REQUEST['rowCount'] = $rowCount;
|
||||||
return "<div class='text-muted'>".implode("</div><div class='text-muted'>", $tagsStrList)."</div>";
|
return "<div class='text-muted'>" . implode("</div><div class='text-muted'>", $tagsStrList) . "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPluginMenu() {
|
public function getPluginMenu() {
|
||||||
|
@ -233,62 +325,64 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
|
||||||
$filename = $global['systemRootPath'] . 'plugin/VideoTags/pluginMenu.html';
|
$filename = $global['systemRootPath'] . 'plugin/VideoTags/pluginMenu.html';
|
||||||
return file_get_contents($filename);
|
return file_get_contents($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getManagerVideosAddNew() {
|
||||||
public static function getManagerVideosAddNew(){
|
|
||||||
return '"videoTags": ' . self::getTagsInputsJquery() . ',';
|
return '"videoTags": ' . self::getTagsInputsJquery() . ',';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getManagerVideosReset(){
|
public static function getManagerVideosReset() {
|
||||||
return self::getTagsInputsJqueryRemoveAll();
|
return self::getTagsInputsJqueryRemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getManagerVideosEdit(){
|
public static function getManagerVideosEdit() {
|
||||||
$js = "if (typeof row.videoTags !== 'undefined' && row.videoTags.length) {
|
$js = "if (typeof row.videoTags !== 'undefined' && row.videoTags.length) {
|
||||||
for (i = 0; i < row.videoTags.length; i++) {
|
for (i = 0; i < row.videoTags.length; i++) {
|
||||||
$('#inputTags' + row.videoTags[i].tag_types_id).tagsinput('add', row.videoTags[i].name);
|
$('#inputTags' + row.videoTags[i].tag_types_id).tagsinput('add', row.videoTags[i].name);
|
||||||
}
|
}
|
||||||
}";
|
}";
|
||||||
return self::getManagerVideosReset().$js;
|
return self::getManagerVideosReset() . $js;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getManagerVideosEditField($type='Advanced'){
|
public static function getManagerVideosEditField($type = 'Advanced') {
|
||||||
if($type == 'SEO'){
|
if ($type == 'SEO') {
|
||||||
return self::getTagsInputs();
|
return self::getTagsInputs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getManagerVideosJavaScripts(){
|
public static function getManagerVideosJavaScripts() {
|
||||||
global $global;
|
global $global;
|
||||||
return "<script src=\"".getCDN()."plugin/VideoTags/bootstrap-tagsinput/bootstrap-tagsinput.min.js\" type=\"text/javascript\"></script><script src=\"".getCDN()."plugin/VideoTags/bootstrap-tagsinput/typeahead.bundle.js\" type=\"text/javascript\"></script>";
|
return "<script src=\"" . getCDN() . "plugin/VideoTags/bootstrap-tagsinput/bootstrap-tagsinput.min.js\" type=\"text/javascript\"></script><script src=\"" . getCDN() . "plugin/VideoTags/bootstrap-tagsinput/typeahead.bundle.js\" type=\"text/javascript\"></script>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function saveVideosAddNew($post, $videos_id){
|
public static function saveVideosAddNew($post, $videos_id) {
|
||||||
if(empty($post['videoTags'])){
|
if (empty($post['videoTags'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return self::saveTags($post['videoTags'], $videos_id);
|
return self::saveTags($post['videoTags'], $videos_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getAllVideosArray($videos_id){
|
public static function getAllVideosArray($videos_id) {
|
||||||
$row = array();
|
$row = array();
|
||||||
$row['videoTags'] = Tags::getAllFromVideosId($videos_id);
|
$row['videoTags'] = Tags::getAllFromVideosId($videos_id);
|
||||||
$row['videoTagsObject'] = Tags::getObjectFromVideosId($videos_id);
|
$row['videoTagsObject'] = Tags::getObjectFromVideosId($videos_id);
|
||||||
return $row;
|
return $row;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getPluginVersion() {
|
|
||||||
return "2.0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPluginVersion() {
|
||||||
|
return "3.0";
|
||||||
|
}
|
||||||
|
|
||||||
public function updateScript() {
|
public function updateScript() {
|
||||||
global $global;
|
global $global;
|
||||||
//update version 2.0
|
//update version 2.0
|
||||||
if(AVideoPlugin::compareVersion($this->getName(), "2.0")<0){
|
if (AVideoPlugin::compareVersion($this->getName(), "2.0") < 0) {
|
||||||
sqlDal::executeFile($global['systemRootPath'] . 'plugin/VideoTags/install/update.sql');
|
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;
|
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 -->
|
|
@ -1,54 +1,77 @@
|
||||||
-- MySQL Workbench Forward Engineering
|
-- MySQL Workbench Forward Engineering
|
||||||
|
|
||||||
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
||||||
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
||||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
|
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tags_types` (
|
CREATE TABLE IF NOT EXISTS `tags_types` (
|
||||||
`id` INT NOT NULL AUTO_INCREMENT,
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
`name` VARCHAR(45) NOT NULL,
|
`name` VARCHAR(45) NOT NULL,
|
||||||
`parameters_json` TEXT NULL,
|
`parameters_json` TEXT NULL,
|
||||||
`created` DATETIME NULL,
|
`created` DATETIME NULL,
|
||||||
`modified` DATETIME NULL,
|
`modified` DATETIME NULL,
|
||||||
PRIMARY KEY (`id`))
|
PRIMARY KEY (`id`))
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tags` (
|
CREATE TABLE IF NOT EXISTS `tags` (
|
||||||
`id` INT NOT NULL AUTO_INCREMENT,
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
`name` VARCHAR(255) NOT NULL,
|
`name` VARCHAR(255) NOT NULL,
|
||||||
`created` DATETIME NULL,
|
`created` DATETIME NULL,
|
||||||
`modified` DATETIME NULL,
|
`modified` DATETIME NULL,
|
||||||
`tags_types_id` INT NOT NULL,
|
`tags_types_id` INT NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `fk_tags_tags_types1_idx` (`tags_types_id` ASC),
|
INDEX `fk_tags_tags_types1_idx` (`tags_types_id` ASC),
|
||||||
INDEX `index_tag_name` (`name` ASC),
|
INDEX `index_tag_name` (`name` ASC),
|
||||||
CONSTRAINT `fk_tags_tags_types1`
|
CONSTRAINT `fk_tags_tags_types1`
|
||||||
FOREIGN KEY (`tags_types_id`)
|
FOREIGN KEY (`tags_types_id`)
|
||||||
REFERENCES `tags_types` (`id`)
|
REFERENCES `tags_types` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE)
|
ON UPDATE CASCADE)
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `tags_has_videos` (
|
CREATE TABLE IF NOT EXISTS `tags_has_videos` (
|
||||||
`id` INT NOT NULL AUTO_INCREMENT,
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
`tags_id` INT NOT NULL,
|
`tags_id` INT NOT NULL,
|
||||||
`videos_id` INT NOT NULL,
|
`videos_id` INT NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `fk_tags_has_videos_videos1_idx` (`videos_id` ASC),
|
INDEX `fk_tags_has_videos_videos1_idx` (`videos_id` ASC),
|
||||||
INDEX `fk_tags_has_videos_tags_idx` (`tags_id` ASC),
|
INDEX `fk_tags_has_videos_tags_idx` (`tags_id` ASC),
|
||||||
CONSTRAINT `fk_tags_has_videos_tags`
|
CONSTRAINT `fk_tags_has_videos_tags`
|
||||||
FOREIGN KEY (`tags_id`)
|
FOREIGN KEY (`tags_id`)
|
||||||
REFERENCES `tags` (`id`)
|
REFERENCES `tags` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE,
|
ON UPDATE CASCADE,
|
||||||
CONSTRAINT `fk_tags_has_videos_videos1`
|
CONSTRAINT `fk_tags_has_videos_videos1`
|
||||||
FOREIGN KEY (`videos_id`)
|
FOREIGN KEY (`videos_id`)
|
||||||
REFERENCES `videos` (`id`)
|
REFERENCES `videos` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE)
|
ON UPDATE CASCADE)
|
||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
SET SQL_MODE=@OLD_SQL_MODE;
|
CREATE TABLE IF NOT EXISTS `tags_subscriptions` (
|
||||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
`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="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, 'rrating', @$_GET['rrating']);
|
||||||
$url = addQueryStringParameter($url, 'tags_id', intval(@$_GET['tags_id']));
|
$url = addQueryStringParameter($url, 'tags_id', intval(@$_GET['tags_id']));
|
||||||
$url = addQueryStringParameter($url, 'current', count($categories) ? $_REQUEST['current'] + 1 : $_REQUEST['current']);
|
$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>
|
<a class="pagination__next" href="<?php echo $url; ?>"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1259,6 +1259,9 @@ li.dropdown-submenu > ul > li > a{
|
||||||
.getChangeVideoStatusButton.status_u button.getChangeVideoStatusButton_u{
|
.getChangeVideoStatusButton.status_u button.getChangeVideoStatusButton_u{
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
.getChangeVideoStatusButton.status_s button.getChangeVideoStatusButton_s{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.pleaseWaitDialog{
|
.pleaseWaitDialog{
|
||||||
z-index: 2001;
|
z-index: 2001;
|
||||||
|
|
|
@ -2289,6 +2289,7 @@ function changeVideoStatus(videos_id, status) {
|
||||||
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_a');
|
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_a');
|
||||||
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_u');
|
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_u');
|
||||||
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_i');
|
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_i');
|
||||||
|
$(".getChangeVideoStatusButton_" + videos_id).removeClass('status_s');
|
||||||
$(".getChangeVideoStatusButton_" + videos_id).addClass('status_' + response.status[item].status);
|
$(".getChangeVideoStatusButton_" + videos_id).addClass('status_' + response.status[item].status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2299,13 +2300,21 @@ function changeVideoStatus(videos_id, status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function avideoAjax(url, data) {
|
function avideoAjax(url, data) {
|
||||||
modal.showPleaseWait();
|
avideoAjax2(url, data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function avideoAjax2(url, data, pleaseWait) {
|
||||||
|
if(pleaseWait){
|
||||||
|
modal.showPleaseWait();
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
data: data,
|
data: data,
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
modal.hidePleaseWait();
|
if(pleaseWait){
|
||||||
|
modal.hidePleaseWait();
|
||||||
|
}
|
||||||
if (response.error) {
|
if (response.error) {
|
||||||
avideoAlertError(response.msg);
|
avideoAlertError(response.msg);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -147,7 +147,7 @@ if (!empty($_GET['iframe'])) {
|
||||||
if (CustomizeAdvanced::showDirectUploadButton()) {
|
if (CustomizeAdvanced::showDirectUploadButton()) {
|
||||||
?>
|
?>
|
||||||
<button class="btn btn-sm btn-xs btn-default" onclick="newVideo();" id="uploadMp4" data-toggle="tooltip"
|
<button class="btn btn-sm btn-xs btn-default" onclick="newVideo();" id="uploadMp4" data-toggle="tooltip"
|
||||||
title="<?php echo __("Upload files without encode"), ' ', implode(', ',CustomizeAdvanced::directUploadFiletypes()); ?>" >
|
title="<?php echo __("Upload files without encode"), ' ', implode(', ', CustomizeAdvanced::directUploadFiletypes()); ?>" >
|
||||||
<span class="fa fa-upload"></span>
|
<span class="fa fa-upload"></span>
|
||||||
<span class="hidden-md hidden-sm hidden-xs"><?php echo empty($advancedCustom->uploadMP4ButtonLabel) ? __("Direct upload") : __($advancedCustom->uploadMP4ButtonLabel); ?></span>
|
<span class="hidden-md hidden-sm hidden-xs"><?php echo empty($advancedCustom->uploadMP4ButtonLabel) ? __("Direct upload") : __($advancedCustom->uploadMP4ButtonLabel); ?></span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -241,12 +241,14 @@ if (!empty($_GET['iframe'])) {
|
||||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
|
<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>
|
<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">
|
<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>
|
<?php
|
||||||
<li><a href="#" onclick="changeStatus('i'); return false;"><i class="fas fa-eye-slash"></i></span> <?php echo __('Inactive'); ?></a></li>
|
foreach ($statusThatTheUserCanUpdate as $value) {
|
||||||
<li><a href="#" onclick="changeStatus('u'); return false;"><i class="fas fa-eye" style="color: #BBB;"></i> <?php echo __('Unlisted'); ?></a></li>
|
$statusIndex = $value[0];
|
||||||
<!--
|
$statusColor = $value[1];
|
||||||
<li><a href="#" onclick="changeStatus('p'); return false;"><span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span> <?php echo __('Private'); ?></a></li>
|
echo "<li><a href=\"#\" onclick=\"changeStatus('" . $statusIndex . "'); return false;\" style=\"color: {$statusColor}\">"
|
||||||
-->
|
. Video::$statusIcons[$statusIndex] .' '. __(Video::$statusDesc[$statusIndex]) . "</a></li>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
@ -326,15 +328,14 @@ if (!empty($_GET['iframe'])) {
|
||||||
$('#grid').bootgrid('reload');
|
$('#grid').bootgrid('reload');
|
||||||
return false;"><?php echo __('All'); ?></a></li>
|
return false;"><?php echo __('All'); ?></a></li>
|
||||||
<?php
|
<?php
|
||||||
$showOnly = ['a', 'i', 'e', 't', 'u', 'b'];
|
|
||||||
if (AVideoPlugin::isEnabled('FansSubscriptions')) {
|
if (AVideoPlugin::isEnabled('FansSubscriptions')) {
|
||||||
$showOnly[] = 'f';
|
$statusSearchFilter[] = Video::$statusFansOnly;
|
||||||
}
|
}
|
||||||
if (AVideoPlugin::isEnabled('SendRecordedToEncoder')) {
|
if (AVideoPlugin::isEnabled('SendRecordedToEncoder')) {
|
||||||
$showOnly[] = 'r';
|
$statusSearchFilter[] = Video::$statusRecording;
|
||||||
}
|
}
|
||||||
foreach (Video::$statusDesc as $key => $value) {
|
foreach (Video::$statusDesc as $key => $value) {
|
||||||
if (!in_array($key, $showOnly)) {
|
if (!in_array($key, $statusSearchFilter)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$text = Video::$statusIcons[$key] . ' ' . __($value);
|
$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 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 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>';
|
<?php
|
||||||
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>';
|
$totalStatusButtons = count($statusThatTheUserCanUpdate);
|
||||||
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>';
|
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 status;
|
||||||
var pluginsButtons = '<?php echo AVideoPlugin::getVideosManagerListButton(); ?>';
|
var pluginsButtons = '<?php echo AVideoPlugin::getVideosManagerListButton(); ?>';
|
||||||
var download = '';
|
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>';
|
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
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
if (row.status == "i") {
|
$ifCondition = 'row.status == "' . implode('" || row.status == "', $statusThatShowTheCompleteMenu) . '"';
|
||||||
status = inactiveBtn;
|
?>
|
||||||
} else if (row.status == "a" || row.status == "k") {
|
if (<?php echo $ifCondition; ?>) {
|
||||||
status = activeBtn;
|
eval('status = statusBtn_' + row.status + ';');
|
||||||
} 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;
|
|
||||||
} else {
|
} else {
|
||||||
return editBtn + deleteBtn;
|
return editBtn + deleteBtn;
|
||||||
}
|
}
|
||||||
|
@ -1920,50 +1926,9 @@ if (AVideoPlugin::isEnabledByName('PlayLists')) {
|
||||||
modal.hidePleaseWait();
|
modal.hidePleaseWait();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})
|
}).end().find(".command-statusBtn").on("click", function (e) {
|
||||||
.end().find(".command-unlisted").on("click", function (e) {
|
toggleVideoStatus(this);
|
||||||
var row_index = $(this).closest('tr').index();
|
}).end().find(".command-rotate").on("click", function (e) {
|
||||||
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) {
|
|
||||||
var row_index = $(this).closest('tr').index();
|
var row_index = $(this).closest('tr').index();
|
||||||
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
|
var row = $("#grid").bootgrid("getCurrentRows")[row_index];
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
|
@ -2073,4 +2038,19 @@ if (!empty($_GET['link'])) {
|
||||||
function whyICannotDownload(videos_id) {
|
function whyICannotDownload(videos_id) {
|
||||||
avideoAlertAJAXHTML(webSiteRootURL + "view/downloadChecker.php?videos_id=" + 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>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue