/graph.php |
@@ -7,8 +7,20 @@ |
require_once('php/pseudocrypt.php'); |
require_once('php/functions.php'); |
require_once('vendor/autoload.php'); |
|
### FFMpeg |
require_once('vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php'); |
|
### Aura URI |
require_once('vendor/aura/uri/src/Aura/Uri/PublicSuffixList.php'); |
require_once('vendor/aura/uri/src/Aura/Uri/Url/Factory.php'); |
require_once('vendor/aura/uri/src/Aura/Uri/Query.php'); |
require_once('vendor/aura/uri/src/Aura/Uri/Host.php'); |
require_once('vendor/aura/uri/src/Aura/Uri/Url.php'); |
require_once('vendor/aura/uri/src/Aura/Uri/Path.php'); |
use Aura\Uri\Url\Factory as UrlFactory; |
use Aura\Uri\PublicSuffixList; |
|
### Load configuration. |
$config = spyc_load_file('config.yaml'); |
|
@@ -65,10 +77,28 @@ |
die('File not found.'); |
} |
|
$GRAPH_URL = $config['URL_PATH'].'og/'.$_GET['hash']; |
$CANON_URL = $config['URL_PATH'].'file.php?hash='.$_GET['hash']; |
$BASIC_URL = $config['URL_PATH'].$_GET['hash']; |
### Extract the server path. |
$URLFactory = new UrlFactory( |
$_SERVER, |
new PublicSuffixList(require 'vendor/aura/uri/data/public-suffix-list.php') |
); |
$URL = $URLFactory->newCurrent(); |
|
### HTTPs has to be enforced for opengraph sharing. |
if(strtoupper($URL->scheme) != 'HTTPS') |
$URL->setScheme('https'); |
|
$URL_PATH = array_shift( |
explode( |
'og/'.$_GET['hash'], |
$URL->getFull() |
) |
); |
|
$GRAPH_URL = $URL_PATH.'og/'.$_GET['hash']; |
$CANON_URL = $URL_PATH.'file.php?hash='.$_GET['hash']; |
$BASIC_URL = $URL_PATH.$_GET['hash']; |
|
switch(strtoupper($fileExtension)) { |
case 'GIF': |
list($width, $height) = getimagesize($userPath); |
@@ -146,9 +176,9 @@ |
$videoHeight = $dimension->getHeight(); |
|
### Build paths. |
$PREVIEW_IMAGE_URL = $config['URL_PATH'].$file; |
$FLOW_PLAYER_VIDEO_URL = $config['URL_PATH'].'flowplayer/flowplayer.swf?config={"clip":"'.$BASIC_URL.'"}'; |
$FLOW_PLAYER = $config['URL_PATH'].'flowplayer/flowplayer.swf'; |
$PREVIEW_IMAGE_URL = $URL_PATH.$file; |
$FLOW_PLAYER_VIDEO_URL = $URL_PATH.'flowplayer/flowplayer.swf?config={"clip":"'.$BASIC_URL.'"}'; |
$FLOW_PLAYER = $URL_PATH.'flowplayer/flowplayer.swf'; |
|
echo <<<END |
<html> |