Skip to content

Commit

Permalink
Merge pull request #59 from DanielnetoDotCom/master
Browse files Browse the repository at this point in the history
update unstable
  • Loading branch information
Vinzenz Hersche committed Apr 30, 2018
2 parents c40372b + cdbb791 commit 6d7cb3c
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 90 deletions.
30 changes: 21 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,34 @@
# Licensed under the terms of the CC-0 license, see
# https://creativecommons.org/publicdomain/zero/1.0/deed

FROM ubuntu:xenial
FROM php:7-apache

MAINTAINER TheAssassin <theassassin@assassinate-you.net>

RUN apt-get update \
&& apt-get install -y apache2 php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-gd php7.0-intl ffmpeg libimage-exiftool-perl python git curl python-pip \
&& rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /root/.cache \
&& a2enmod rewrite
RUN apt-get update && \
apt-get install -y wget git zip default-libmysqlclient-dev libbz2-dev libmemcached-dev libsasl2-dev libfreetype6-dev libicu-dev libjpeg-dev libmemcachedutil2 libpng-dev libxml2-dev mariadb-client ffmpeg libimage-exiftool-perl python curl python-pip && \
docker-php-ext-configure gd --with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include && \
docker-php-ext-install -j$(nproc) bcmath bz2 calendar exif gd gettext iconv intl mbstring mysqli opcache pdo_mysql zip && \
rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /root/.cache && \
a2enmod rewrite

RUN pip install -U youtube-dl
# patch to use non-root port
RUN sed -i "s|Listen 80|Listen 8000|g" /etc/apache2/ports.conf && \
sed -i "s|:80|:8000|g" /etc/apache2/sites-available/* && \
echo "post_max_size = 10240M\nupload_max_filesize = 10240M" >> /usr/local/etc/php/php.ini

WORKDIR /var/www/html
RUN pip install -U youtube-dl

RUN rm -rf /var/www/html/*
COPY . /var/www/html

ADD docker/000-default.conf /etc/apache2/sites-enabled/000-default.conf
# fix permissions
RUN chown -R www-data. /var/www/html

# create volume
RUN install -d -m 0755 -o www-data -g www-data /var/www/html/videos

# set non-root user
USER www-data

CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
VOLUME ["/var/www/html/videos"]
1 change: 1 addition & 0 deletions plugin/Gallery/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function getEmptyDataObject() {
$obj->SubscribedChannelsRowCount = 12;
$obj->sortReverseable = false;
$obj->SubCategorys = false;
$obj->showTags = true;
return $obj;
}

Expand Down
26 changes: 14 additions & 12 deletions plugin/Gallery/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function showThis($who) {
return false;
}

function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord, $orderString,$defaultSort="ASC") {
if(!showThis($getName)){
function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord, $orderString, $defaultSort = "ASC") {
if (!showThis($getName)) {
return "";
}
if(!empty($_GET['showOnly'])){
if (!empty($_GET['showOnly'])) {
$rowCount = 60;
}
global $global, $args, $url;
Expand All @@ -30,9 +30,9 @@ function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord,
}
if (!empty($orderString)) {
$info = createOrderInfo($getName, $mostWord, $lessWord, $orderString);
echo __("{$title} (" . $info[2] . ")") . " (Page " . $_GET['page'] . ") <a href='" . $info[0] . "' >" . $info[1] . "</a>";
echo "{$title} (" . $info[2] . ") (Page " . $_GET['page'] . ") <a href='" . $info[0] . "' >" . $info[1] . "</a>";
} else {
echo __("{$title}");
echo "{$title}";
}
?>
</a>
Expand Down Expand Up @@ -65,7 +65,7 @@ function createGallery($title, $sort, $rowCount, $getName, $mostWord, $lessWord,
page: <?php echo $page; ?>,
maxVisible: 10
}).on('page', function (event, num) {
<?php echo 'var args = "' . $args . '";'; ?>
<?php echo 'var args = "' . $args . '";'; ?>
window.location.replace("<?php echo $url; ?>" + num + args);
});
});
Expand Down Expand Up @@ -152,12 +152,14 @@ function createGallerySection($videos) {
</a>
<?php } ?>
<?php
$value['tags'] = Video::getTags($value['id']);
foreach ($value['tags'] as $value2) {
if ($value2->label === __("Group")) {
?>
<span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span>
<?php
if (!empty($obj->showTags)) {
$value['tags'] = Video::getTags($value['id']);
foreach ($value['tags'] as $value2) {
if ($value2->label === __("Group")) {
?>
<span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span>
<?php
}
}
}
?>
Expand Down
52 changes: 27 additions & 25 deletions plugin/Gallery/view/BigVideo.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php if ($obj->BigVideo && empty($_GET['showOnly'])) {
<?php
if ($obj->BigVideo && empty($_GET['showOnly'])) {
$name = User::getNameIdentificationById($video['users_id']);
?>
<div class="clear clearfix">
Expand All @@ -14,7 +15,7 @@
<img src="<?php echo $images->thumbsJpgSmall; ?>" data-src="<?php echo $poster; ?>" alt="<?php echo $video['title']; ?>" class="thumbsJPG img img-responsive " style="height: auto; width: 100%;" id="thumbsJPG<?php echo $video['id']; ?>" />
<?php if (!empty($imgGif)) { ?>
<img src="<?php echo $global['webSiteRootURL']; ?>img/loading-gif.png" data-src="<?php echo $imgGif; ?>" style="position: absolute; top: 0; display: none;" alt="<?php echo $video['title']; ?>" id="thumbsGIF<?php echo $video['id']; ?>" class="thumbsGIF img-responsive <?php echo @$img_portrait; ?> rotate<?php echo $video['rotation']; ?>" height="130" />
<?php } ?>
<?php } ?>
</div>
<span class="duration"><?php echo Video::getCleanDuration($video['duration']); ?></span>
</a>
Expand All @@ -28,25 +29,27 @@
</div>
<div class="text-muted galeryDetails">
<div>
<?php if (empty($_GET['catName'])) { ?>
<a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $video['clean_category']; ?>/">
<?php
if (!empty($video['iconClass'])) {
?>
<i class="<?php echo $video['iconClass']; ?>"></i>
<?php if (empty($_GET['catName'])) { ?>
<a class="label label-default" href="<?php echo $global['webSiteRootURL']; ?>cat/<?php echo $video['clean_category']; ?>/">
<?php
}
?>
if (!empty($video['iconClass'])) {
?>
<i class="<?php echo $video['iconClass']; ?>"></i>
<?php
}
?>
<?php echo $video['category']; ?>
</a>
</a>
<?php } ?>
<?php
$video['tags'] = Video::getTags($video['id']);
foreach ($video['tags'] as $value2) {
if ($value2->label === __("Group")) {
?>
<span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span>
<?php
if (!empty($obj->showTags)) {
$video['tags'] = Video::getTags($video['id']);
foreach ($video['tags'] as $value2) {
if ($value2->label === __("Group")) {
?>
<span class="label label-<?php echo $value2->type; ?>"><?php echo $value2->text; ?></span>
<?php
}
}
}
?>
Expand All @@ -57,15 +60,15 @@
</div>
<div>
<i class="fa fa-clock-o"></i>
<?php echo humanTiming(strtotime($video['videoCreation'])), " ", __('ago'); ?>
<?php echo humanTiming(strtotime($video['videoCreation'])), " ", __('ago'); ?>
</div>
<div>
<i class="fa fa-user"></i>
<a class="text-muted" href="<?php echo $global['webSiteRootURL']; ?>channel/<?php echo $video['users_id']; ?>/">
<?php echo $name; ?>
<?php echo $name; ?>
</a>
</div>
<?php if (Video::canEdit($video['id'])) { ?>
<?php if (Video::canEdit($video['id'])) { ?>
<div>
<a href="<?php echo $global['webSiteRootURL']; ?>mvideos?video_id=<?php echo $video['id']; ?>" class="text-primary"><i class="fa fa-edit"></i> <?php echo __("Edit Video"); ?></a>
</div>
Expand All @@ -82,15 +85,14 @@
}
?>
<div><a class="label label-default " role="button" href="<?php echo $global['webSiteRootURL'] . "videos/" . $video['filename'] . $ext; ?>" download="<?php echo $video['title'] . $ext; ?>"><?php echo __("Download"); ?></a></div>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</div>
<?php
}
else if(!empty($_GET['showOnly'])){
<?php
} else if (!empty($_GET['showOnly'])) {
?>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<a href="<?php echo $global['webSiteRootURL']; ?>" class="btn btn-default"><i class="fa fa-arrow-left"></i> <?php echo __("Go Back"); ?></a>
<?php
}
12 changes: 1 addition & 11 deletions view/include/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,11 @@
}
?>
</footer>
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "YouPHPTube",
"version": "<?php echo $config->getVersion(); ?>",
"image": "http://youphptube.com/img/logo.png",
"description": "The Best YouTube Clone Script, a free web solution to build your own video sahring site."
}
</script>
<script>
<?php
if (User::isAdmin()) { ?>
window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {
console.log("<?php echo __('A Javascript-error happend. Please tell your admin to clear the folder videos/cache. \r\n If this doesn\'t help, attach these infos to a github-pull-request:'); ?> \r\n Msg:" + errorMsg+" \r\n Url: "+url+ ", line: "+lineNumber);//or any message
console.log("<?php echo 'A Javascript-error happend. Please tell your admin to clear the folder videos/cache. \r\n If this doesn\'t help, attach these infos to a github-pull-request:'; ?> \r\n Msg:" + errorMsg+" \r\n Url: "+url+ ", line: "+lineNumber);//or any message
return false;
}
<?php } ?>
Expand Down
1 change: 1 addition & 0 deletions view/mini-upload-form/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
$obj->error = false;
$obj->filename = $filename;
$obj->duration = $duration;
YouPHPTubePlugin::afterNewVideo($video->getId());
die(json_encode($obj));
}

Expand Down
9 changes: 9 additions & 0 deletions view/modeYoutube.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,20 @@
$catLink = "cat/{$_GET['catName']}/";
}

// add this because if you change the video category the video was not loading anymore
$catName = @$_GET['catName'];

if (empty($_GET['clean_title'])) {
$_GET['catName'] = "";
}

$video = Video::getVideo("", "viewableNotAd", false, false, true);

if (empty($video)) {
$video = Video::getVideo("", "viewableNotAd");
}
// add this because if you change the video category the video was not loading anymore
$_GET['catName'] = $catName;

if (empty($_GET['videoName'])) {
$_GET['videoName'] = $video['clean_title'];
Expand Down
16 changes: 11 additions & 5 deletions view/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,31 @@
<div class="form-group">
<div class="col-md-12 ">
<div id="croppie"></div>
<a id="upload-btn" class="btn btn-primary btn-xs btn-block"><?php echo __("Upload a Photo"); ?></a>
<center>
<a id="upload-btn" class="btn btn-primary"><i class="fa fa-upload"></i> <?php echo __("Upload a Photo"); ?></a>
</center>
</div>
<input type="file" id="upload" value="Choose a file" accept="image/*" style="display: none;" />
</div>

<div class="form-group">
<div class="col-md-12 ">
<div id="croppieBg"></div>
<a id="upload-btnBg" class="btn btn-success btn-xs btn-block"><?php echo __("Upload a Background"); ?></a>
<center>
<a id="upload-btnBg" class="btn btn-success"><i class="fa fa-upload"></i> <?php echo __("Upload a Background"); ?></a>
</center>
</div>
<input type="file" id="uploadBg" value="Choose a file" accept="image/*" style="display: none;" />
</div>


<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label"></label>
<div class="col-md-8">
<button type="submit" class="btn btn-primary" ><?php echo __("Save"); ?> <span class="glyphicon glyphicon-save"></span></button>
<hr>
<div class="col-md-12">
<center>
<button type="submit" class="btn btn-primary btn-lg" ><?php echo __("Save"); ?> <span class="fa fa-save"></span></button>
</center>
</div>
</div>
</fieldset>
Expand Down
58 changes: 30 additions & 28 deletions view/xsendfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,35 @@ function send_video($file) {
$path_parts = pathinfo($_GET['file']);
$file = $path_parts['basename'];
$path = "{$global['systemRootPath']}videos/{$file}";
if (!empty($_GET['download'])) {
$quoted = sprintf('"%s"', addcslashes(basename($_GET['file']), '"\\'));
$size = filesize($file);
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=' . $quoted);
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
YouPHPTubePlugin::xsendfilePreVideoPlay();
$advancedCustom = YouPHPTubePlugin::getObjectDataIfEnabled("CustomizeAdvanced");
if (empty($advancedCustom->doNotUseXsendFile)) {
header("X-Sendfile: {$path}");
}
if (empty($_GET['download'])) {
header("Content-type: " . mime_content_type($path));
}
header('Content-Length: ' . filesize($path));
if (!empty($advancedCustom->doNotUseXsendFile)) {
if (strtolower($path_parts['extension']) === "mp4" || strtolower($path_parts['extension']) === "webm") {
// Not working yet
//send_video($path);
echo url_get_contents($path);
} else {
echo url_get_contents($path);
if (file_exists($path)) {
if (!empty($_GET['download'])) {
$quoted = sprintf('"%s"', addcslashes(basename($_GET['file']), '"\\'));
$size = filesize($file);
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=' . $quoted);
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
YouPHPTubePlugin::xsendfilePreVideoPlay();
$advancedCustom = YouPHPTubePlugin::getObjectDataIfEnabled("CustomizeAdvanced");
if (empty($advancedCustom->doNotUseXsendFile)) {
header("X-Sendfile: {$path}");
}
if (empty($_GET['download'])) {
header("Content-type: " . mime_content_type($path));
}
header('Content-Length: ' . filesize($path));
if (!empty($advancedCustom->doNotUseXsendFile)) {
if (strtolower($path_parts['extension']) === "mp4" || strtolower($path_parts['extension']) === "webm") {
// Not working yet
//send_video($path);
echo url_get_contents($path);
} else {
echo url_get_contents($path);
}
}
die();
}
die();

0 comments on commit 6d7cb3c

Please sign in to comment.