-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Schmidt
committed
Aug 30, 2016
0 parents
commit 4644bff
Showing
11 changed files
with
1,210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#ignore pling-music and pling-books | ||
*/pling-books-html5/* | ||
*/pling-music-html5/* | ||
|
||
#ignore store specific images | ||
*/images_sys/store_*/ | ||
#ignore eclipse files | ||
.buildpath | ||
.project | ||
.settings/* | ||
|
||
#ignore PHPStorm Files | ||
.idea/* | ||
|
||
#ignore local Vagrant dir | ||
.vagrant/* | ||
|
||
#ignore local tmp dir | ||
*/.tmb/* | ||
|
||
#ignore local dir | ||
local/* | ||
|
||
phing/* | ||
|
||
*.local* | ||
--.htaccess* | ||
.htaccess* | ||
.htpasswd* | ||
|
||
*.orig | ||
*.tsm | ||
|
||
*.ova | ||
|
||
*/.well-known | ||
|
||
loadstorm-41440.html | ||
mu-2cc5c638-f7c471ad-be42f5c0-99b8cf30.txt | ||
mu-9ff52416-7b5ae544-c8bac39d-dc810a54 | ||
|
||
#ignore thumbnails created by windows | ||
Thumbs.db | ||
#Ignore files build by Visual Studio | ||
*.obj | ||
*.exe | ||
*.pdb | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.cache | ||
*.ilk | ||
*.log | ||
[Bb]in | ||
[Dd]ebug*/ | ||
*.lib | ||
*.sbr | ||
obj/ | ||
[Rr]elease*/ | ||
_ReSharper*/ | ||
[Tt]est[Rr]esult* | ||
|
||
httpdocs/src/status.jsx |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ocs-cdn | ||
========= | ||
|
||
Content Delivery Network for ocs-www | ||
|
||
Installation: | ||
|
||
sudo apt-get install git | ||
sudo apt-get install nginx | ||
sudo apt-get install php5 php5-fpm php-apc | ||
sudo apt-get install php5-cli | ||
sudo apt-get install php5-curl | ||
sudo apt-get install libwww-perl | ||
sudo apt-get install php5-cgi php5-imagick | ||
|
||
Don't forget to copy the library-folder into /var/www/cdn/library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
/** | ||
* ocs-webserver | ||
* | ||
* Copyright 2016 by pling GmbH. | ||
* | ||
* This file is part of ocs-webserver. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
**/ | ||
|
||
// Define path to application directory | ||
defined('APPLICATION_PATH') | ||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__))); | ||
|
||
|
||
// Define application environment | ||
defined('APPLICATION_ENV') | ||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); | ||
|
||
defined('IMAGES_UPLOAD_PATH') | ||
|| define('IMAGES_UPLOAD_PATH', APPLICATION_PATH . '/img/'); | ||
|
||
|
||
// Ensure library/ is on include_path | ||
set_include_path(implode("/", array( | ||
APPLICATION_PATH . '/../library', | ||
get_include_path(), | ||
))); | ||
|
||
|
||
require_once 'Zend/Loader/Autoloader.php'; | ||
|
||
$loader = Zend_Loader_Autoloader::getInstance(); | ||
$loader->setFallbackAutoloader(true); | ||
|
||
$upload = new Zend_File_Transfer_Adapter_Http(); | ||
$upload->addValidator('Count', false, 1); | ||
$upload->addValidator('IsImage', false); | ||
$upload->addValidator('Size', false, array('min' => '2kB', 'max' => '2MB')); | ||
//$upload->addValidator('ImageSize', false, | ||
// array( | ||
// 'minwidth' => 50, | ||
// 'maxwidth' => 2000, | ||
// 'minheight' => 50, | ||
// 'maxheight' => 2000 | ||
// ) | ||
//); | ||
|
||
$_mime_type = array( | ||
'image/jpeg' => '.jpg', | ||
'image/jpg' => '.jpg', | ||
'image/png' => '.png', | ||
'image/gif' => '.gif', | ||
'application/x-empty' => '.png' | ||
); | ||
|
||
//create buckets | ||
$fileHash = $upload->getHash('sha1'); | ||
$destBucketPath = substr_replace($fileHash, '/', 1, 0); | ||
$destBucketPath = substr_replace($destBucketPath, '/', 3, 0); | ||
$destBucketPath = substr_replace($destBucketPath, '/', 5, 0); | ||
$destBucketPath = substr_replace($destBucketPath, '/', 7, 0); | ||
$destPath = IMAGES_UPLOAD_PATH . $destBucketPath . $_mime_type[$upload->getMimeType()]; | ||
|
||
$dir = dirname($destPath); | ||
if (!file_exists($destPath) and !is_dir($dir)) { | ||
mkdir($dir, 0777, true); | ||
} | ||
|
||
$upload->addFilter('Rename', array('target' => $destPath, 'overwrite' => true)); | ||
|
||
if (false === $upload->receive()) { | ||
header("HTTP/1.0 500 Server Error"); | ||
print implode("\n<br>", $upload->getMessages()); | ||
exit(0); | ||
} | ||
|
||
header("HTTP/1.0 200 OK"); | ||
print $destBucketPath . $_mime_type[$upload->getMimeType()]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
/** | ||
* ocs-webserver | ||
* | ||
* Copyright 2016 by pling GmbH. | ||
* | ||
* This file is part of ocs-webserver. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
**/ | ||
|
||
header("HTTP/1.1 503 Service Unavailable"); | ||
exit(1); | ||
|
||
date_default_timezone_set("Europe/Berlin"); | ||
setlocale(LC_ALL, 'de_DE@euro'); | ||
// Define path to application directory | ||
defined('APPLICATION_PATH') | ||
|| define('APPLICATION_PATH', realpath(dirname(__FILE__))); | ||
|
||
|
||
// Define application environment | ||
defined('APPLICATION_ENV') | ||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); | ||
|
||
defined('IMAGES_UPLOAD_PATH') | ||
|| define('IMAGES_UPLOAD_PATH', APPLICATION_PATH . '/img/'); | ||
|
||
|
||
// Ensure library/ is on include_path | ||
set_include_path(implode("/", array( | ||
APPLICATION_PATH . '/../library', | ||
get_include_path(), | ||
))); | ||
|
||
|
||
require_once 'Zend/Loader/Autoloader.php'; | ||
|
||
$loader = Zend_Loader_Autoloader::getInstance(); | ||
$loader->setFallbackAutoloader(true); | ||
|
||
$upload = new Zend_File_Transfer_Adapter_Http(); | ||
$upload->addValidator('Count', false, 1); | ||
$upload->addValidator('IsImage', false); | ||
$upload->addValidator('Size', false, array('min' => '2kB', 'max' => '2MB')); | ||
$upload->addValidator('ImageSize', false, | ||
array( | ||
'minwidth' => 50, | ||
'maxwidth' => 2000, | ||
'minheight' => 50, | ||
'maxheight' => 2000 | ||
) | ||
); | ||
//$upload->addFilter('Rename',array('target' => IMAGES_UPLOAD_PATH,'overwrite' => true)); | ||
//$upload->addFilter('Rename',IMAGES_UPLOAD_PATH); | ||
|
||
if (true == $upload->receive()) { | ||
|
||
$file_source = $upload->getFileName(); | ||
$file_destination = IMAGES_UPLOAD_PATH . basename($upload->getFileName()); | ||
|
||
if (rename($file_source, $file_destination)) { | ||
header("HTTP/1.0 200 OK"); | ||
print basename($upload->getFileName()); | ||
exit(0); | ||
} | ||
|
||
} | ||
header("HTTP/1.0 500 Server Error"); | ||
print implode("\n<br>", $upload->getMessages()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore | ||
!temp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
Oops, something went wrong.