Skip to content

Commit

Permalink
Merge pull request WWBN#2 from WWBN/master
Browse files Browse the repository at this point in the history
make up to date
  • Loading branch information
ronaldod authored May 8, 2020
2 parents 79bc192 + d7f57fc commit 0e6dd59
Show file tree
Hide file tree
Showing 55 changed files with 804 additions and 594 deletions.
2 changes: 1 addition & 1 deletion install/checkConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
exit;
}

$installationVersion = "8.7";
$installationVersion = "8.8";


header('Content-Type: application/json');
Expand Down
23 changes: 23 additions & 0 deletions install/updateDiskUsage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
//streamer config
require_once '../videos/configuration.php';

if(!isCommandLineInterface()){
return die('Command Line only');
}

$total = Video::getTotalVideos("",false, true, true, false, false);
$videos = Video::getAllVideosLight("", false, true, false);
$count = 0;
foreach ($videos as $value){
$count++;
$updated = Video::updateFilesize($value['id']);
echo "{$count}/{$total} (".($updated?"success":"fail").") [{$value['id']}] {$value['title']}".PHP_EOL;
ob_flush();
}

die();




8 changes: 8 additions & 0 deletions locale/br.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,11 @@
$t['hours'] = "horas";
$t['minutes'] = "minutos";
$t['seconds'] = "segundos";
$t['Total Videos'] = "Total de Videos";
$t['View Details'] = "Ver Detalhes";
$t['Total Videos Views'] = "Total de Visualizações";
$t['Total Subscriptions'] = "Total de Inscritos";
$t['Total Video Comments'] = "Total de comentários";
$t['Total Videos Likes'] = "Total de Likes";
$t['Total Videos Dislikes'] = "Total de Dislikes";
$t['Total Duration Videos (Minutes)'] = "Duração total dos Vídeos em Minutos";
8 changes: 2 additions & 6 deletions objects/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,19 +527,15 @@ static function getTotalVideosFromCategory($categories_id, $showUnlisted = false
foreach ($rows as $value) {
$total += self::getTotalVideosFromCategory($value['id'], $showUnlisted, $getAllVideos, $renew);
}
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
_session_start();
$_SESSION['categoryTotal'][$categories_id][intval($showUnlisted)][intval($getAllVideos)] = $total;
}
return $_SESSION['categoryTotal'][$categories_id][intval($showUnlisted)][intval($getAllVideos)];
}

static function clearCacheCount() {
// clear category count cache
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
_session_start();
unset($_SESSION['categoryTotal']);
//session_write_close();
}
Expand Down
2 changes: 1 addition & 1 deletion objects/configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function getAuthCanComment() {
}

function setAuthCanUploadVideos($authCanUploadVideos) {
$this->authCanUploadVideos = $authCanUploadVideos;
$this->authCanUploadVideos = intval($authCanUploadVideos);
}

function setAuthCanViewChart($authCanViewChart) {
Expand Down
10 changes: 9 additions & 1 deletion objects/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,15 @@ function getUsageFromFilename($filename, $dir = "") {
foreach ($files as $f) {
if (is_dir($f)) {
_error_log("getUsageFromFilename: {$f} is Dir");
$totalSize += getDirSize($f);
$dirSize = getDirSize($f);
$totalSize += $dirSize;
if($dirSize<10000 && AVideoPlugin::isEnabledByName('YPTStorage')){
// probably the HLS file is hosted on the YPTStorage
$info = YPTStorage::getFileInfo($filename);
if(!empty($info->size)){
$totalSize += $info->size;
}
}
} else if (is_file($f)) {
$filesize = filesize($f);
if ($filesize < 20) { // that means it is a dummy file
Expand Down
13 changes: 13 additions & 0 deletions objects/sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ function save() {
return parent::save();
}

static function getFromFileName($fileName){
$obj = new stdClass();
$obj->url = "";
$obj->secret = "";
$obj->filename = $fileName;
$video = Video::getVideoFromFileNameLight($fileName);
if(!empty($video['sites_id'])){
$site = new Sites($video['sites_id']);
$obj->url = $site->getUrl();
$obj->secret = $site->getSecret();
}
return $obj;
}


}
48 changes: 48 additions & 0 deletions objects/uploadChannelArt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

global $global, $config;
if (!isset($global['systemRootPath'])) {
require_once '../videos/configuration.php';
}
require_once $global['systemRootPath'] . 'objects/video.php';

if(empty($_GET['video_id']) && !empty($_POST['videos_id'])){
$_GET['video_id'] = $_POST['videos_id'];
}

$obj = new stdClass();
$obj->error = true;
if (!User::isLogged()) {
$obj->msg = 'You cant edit this file';
die(json_encode($obj));
}
header('Content-Type: application/json');
// A list of permitted file extensions
$allowed = array('jpg', 'jpeg', 'gif', 'png');
if (isset($_FILES['file_data']) && $_FILES['file_data']['error'] == 0) {
$extension = pathinfo($_FILES['file_data']['name'], PATHINFO_EXTENSION);
if (!in_array(strtolower($extension), $allowed)) {
$obj->msg = "File extension error [{$_FILES['file_data']['name']}], we allow only (" . implode(",", $allowed) . ")";
die(json_encode($obj));
}

$tmpDestination = "{$global['systemRootPath']}videos/userPhoto/tmp_background".User::getId().".". $extension;
$obj->file = "videos/userPhoto/background".User::getId().".jpg";
$oldfile = "{$global['systemRootPath']}videos/userPhoto/background".User::getId().".png";

if (!move_uploaded_file($_FILES['file_data']['tmp_name'], $tmpDestination)) {
$obj->msg = "Error on move_file_uploaded_file(" . $_FILES['file_data']['tmp_name'] . ", " . "{$global['systemRootPath']}videos/" . $filename . $ext;
die(json_encode($obj));
}
convertImage($tmpDestination, $global['systemRootPath'].$obj->file, 70);
unlink($tmpDestination);
if(file_exists($oldfile)){
unlink($oldfile);
}

echo "{}";
exit;
}
$obj->msg = "\$_FILES Error";
$obj->FILES = $_FILES;
die(json_encode($obj));
20 changes: 17 additions & 3 deletions objects/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -1460,11 +1460,25 @@ static function getTags($user_id) {
}

function getBackgroundURL() {
if (empty($this->backgroundURL)) {
$this->backgroundURL = "view/img/background.png";
}
global $global;
$this->backgroundURL = self::getBackgroundURLFromUserID($this->id);
return $this->backgroundURL;
}

static function getBackgroundURLFromUserID($users_id=0){
if(empty($users_id)){
$users_id = User::getId();
}
global $global;
$backgroundURL = "videos/userPhoto/background{$users_id}.jpg";
if(!file_exists($global['systemRootPath'] . $backgroundURL)){
$backgroundURL = "videos/userPhoto/background{$users_id}.png";
}
if(!file_exists($global['systemRootPath'] . $backgroundURL)){
$backgroundURL = "view/img/background.jpg";
}
return $backgroundURL;
}

function setBackgroundURL($backgroundURL) {
$this->backgroundURL = strip_tags($backgroundURL);
Expand Down
5 changes: 3 additions & 2 deletions objects/video.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ static function internalAutoset($catId, $videoFound, $audioFound) {

function setClean_title($clean_title) {
$clean_title = preg_replace('/[!#$&\'()*+,\\/:;=?@[\\]% ]+/', '-', trim(strtolower(cleanString($clean_title))));
$clean_title = preg_replace('/[\x00-\x1F\x7F]/u', '', $clean_title);
$this->clean_title = $clean_title;
}

Expand Down Expand Up @@ -2441,7 +2442,7 @@ static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
}
$token = "";
$secure = AVideoPlugin::loadPluginIfEnabled('SecureVideosDirectory');
if (($type == ".mp3" || $type == ".mp4" || $type == ".webm" || $type == ".m3u8" || $type == ".pdf" || $type == ".zip")) {
if ((preg_match("/.*\\.mp3$/", $type) || preg_match("/.*\\.mp4$/", $type) || preg_match("/.*\\.webm$/", $type) || $type == ".m3u8" || $type == ".pdf" || $type == ".zip")) {
$vars = array();
if (!empty($secure)) {
$vars[] = $secure->getToken($filename);
Expand All @@ -2459,7 +2460,7 @@ static function getSourceFile($filename, $type = ".jpg", $includeS3 = false) {
$video = Video::getVideoFromFileNameLight(str_replace(array('_Low', '_SD', '_HD'), array('', '', ''), $filename));
$canUseCDN = canUseCDN($video['id']);

if (!empty($video['sites_id']) && ($type == ".mp3" || $type == ".mp4" || $type == ".webm" || $type == ".m3u8" || $type == ".pdf" || $type == ".zip")) {
if (!empty($video['sites_id']) && (preg_match("/.*\\.mp3$/", $type) || preg_match("/.*\\.mp4$/", $type) || preg_match("/.*\\.webm$/", $type) || $type == ".m3u8" || $type == ".pdf" || $type == ".zip")) {
$site = new Sites($video['sites_id']);
$siteURL = rtrim($site->getUrl(), '/') . '/';
$source['url'] = "{$siteURL}videos/{$filename}{$type}{$token}";
Expand Down
1 change: 1 addition & 0 deletions objects/videos.json.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
$videos[$key]['next_video'] = array();
$videos[$key]['description'] = preg_replace('/[\x00-\x1F\x7F]/u', '', $videos[$key]['description']);
$videos[$key]['title'] = preg_replace('/[\x00-\x1F\x7F]/u', '', $videos[$key]['title']);
$videos[$key]['clean_title'] = preg_replace('/[\x00-\x1F\x7F]/u', '', $videos[$key]['clean_title']);
$videos[$key]['typeLabels'] = Video::getVideoTypeLabels($videos[$key]['filename']);
if(!empty($videos[$key]['next_videos_id'])){
unset($_POST['searchPhrase']);
Expand Down
1 change: 0 additions & 1 deletion plugin/AD_Server/index_body.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@
</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>
<script src="<?php echo $global['webSiteRootURL']; ?>js/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/Chart.bundle.min.js"></script>

<script type="text/javascript">
Expand Down
1 change: 0 additions & 1 deletion plugin/AD_Server/index_head.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
?>
<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"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>

<style>
#campaignVideosTable td img {
Expand Down
2 changes: 1 addition & 1 deletion plugin/AD_Server/view/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
type="video/mp4" ></source>
</video>
<!-- Load dependent scripts -->
<script src="../../../view/js/video.js/video.js" type="text/javascript"></script>
<script src="../../../view/js/video.js/video.min.js" type="text/javascript"></script>
<script src="//imasdk.googleapis.com/js/sdkloader/ima3.js"></script>
<script src="../../../view/js/videojs-contrib-ads/videojs-contrib-ads.js" type="text/javascript"></script>
<script src="../videojs-ima/videojs.ima.js" type="text/javascript"></script>
Expand Down
2 changes: 2 additions & 0 deletions plugin/CustomizeAdvanced/CustomizeAdvanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public function getEmptyDataObject() {
$obj->doNotShowEmbedButton = false;
$obj->embedBackgroundColor = "white";
$obj->embedButtonLabel = "";
$obj->embedCodeTemplate = '<div class="embed-responsive embed-responsive-16by9"><iframe width="640" height="360" style="max-width: 100%;max-height: 100%; border:none;" src="{embedURL}" frameborder="0" allowfullscreen="allowfullscreen" allow="autoplay" scrolling="no">iFrame is not supported!</iframe></div>';
$obj->embedCodeTemplateObject = '<div class="embed-responsive embed-responsive-16by9"><object width="640" height="360"><param name="movie" value="{embedURL}"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="{embedURL}" allowscriptaccess="always" allowfullscreen="true" width="640" height="360"></embed></object></div>';
$obj->doNotShowEncoderHLS = false;
$obj->doNotShowEncoderResolutionLow = false;
$obj->doNotShowEncoderResolutionSD = false;
Expand Down
9 changes: 1 addition & 8 deletions plugin/FBTube/view/modeFacebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@
<?php
include $global['systemRootPath'] . 'view/include/head.php';
?>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/video.js/video.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/video.js/video.min.js" type="text/javascript"></script>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/webui-popover/jquery.webui-popover.min.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-ui/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<script src="<?php echo $global['webSiteRootURL']; ?>view/view/js/videojs-persistvolume/videojs.persistvolume.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/webui-popover/jquery.webui-popover.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/bootstrap-list-filter/bootstrap-list-filter.min.js" type="text/javascript"></script>
<script src="<?php echo $global['webSiteRootURL']; ?>view/js/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script>
/*** Handle jQuery plugin naming conflict between jQuery UI and Bootstrap ***/
$.widget.bridge('uibutton', $.ui.button);
$.widget.bridge('uitooltip', $.ui.tooltip);
</script>
</head>

<body class="<?php echo $global['bodyClass']; ?>">
Expand Down
Loading

0 comments on commit 0e6dd59

Please sign in to comment.