scratch – Diff between revs 115 and 123
?pathlinks?
Rev 115 | Rev 123 | |||
---|---|---|---|---|
Line 5... | Line 5... | |||
5 | ########################################################################### |
5 | ########################################################################### |
|
Line 6... | Line 6... | |||
6 | |
6 | |
|
7 | require_once('php/pseudocrypt.php'); |
7 | require_once('php/pseudocrypt.php'); |
|
8 | require_once('php/functions.php'); |
8 | require_once('php/functions.php'); |
|
- | 9 | require_once('vendor/autoload.php'); |
||
- | 10 | |
||
9 | require_once('vendor/autoload.php'); |
11 | ### FFMpeg |
|
Line -... | Line 12... | |||
- | 12 | require_once('vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php'); |
||
- | 13 | |
||
- | 14 | ### Aura URI |
||
- | 15 | require_once('vendor/aura/uri/src/Aura/Uri/PublicSuffixList.php'); |
||
- | 16 | require_once('vendor/aura/uri/src/Aura/Uri/Url/Factory.php'); |
||
- | 17 | require_once('vendor/aura/uri/src/Aura/Uri/Query.php'); |
||
- | 18 | require_once('vendor/aura/uri/src/Aura/Uri/Host.php'); |
||
- | 19 | require_once('vendor/aura/uri/src/Aura/Uri/Url.php'); |
||
- | 20 | require_once('vendor/aura/uri/src/Aura/Uri/Path.php'); |
||
- | 21 | use Aura\Uri\Url\Factory as UrlFactory; |
||
10 | require_once('vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/FFMpeg.php'); |
22 | use Aura\Uri\PublicSuffixList; |
|
11 | |
23 | |
|
Line 12... | Line 24... | |||
12 | ### Load configuration. |
24 | ### Load configuration. |
|
13 | $config = spyc_load_file('config.yaml'); |
25 | $config = spyc_load_file('config.yaml'); |
|
Line 63... | Line 75... | |||
63 | if (!file_exists($userPath)) { |
75 | if (!file_exists($userPath)) { |
|
64 | http_response_code(404); |
76 | http_response_code(404); |
|
65 | die('File not found.'); |
77 | die('File not found.'); |
|
66 | } |
78 | } |
|
Line -... | Line 79... | |||
- | 79 | |
||
- | 80 | ### Extract the server path. |
||
- | 81 | $URLFactory = new UrlFactory( |
||
- | 82 | $_SERVER, |
||
- | 83 | new PublicSuffixList(require 'vendor/aura/uri/data/public-suffix-list.php') |
||
- | 84 | ); |
||
- | 85 | $URL = $URLFactory->newCurrent(); |
||
- | 86 | |
||
- | 87 | ### HTTPs has to be enforced for opengraph sharing. |
||
- | 88 | if(strtoupper($URL->scheme) != 'HTTPS') |
||
- | 89 | $URL->setScheme('https'); |
||
- | 90 | |
||
- | 91 | $URL_PATH = array_shift( |
||
- | 92 | explode( |
||
- | 93 | 'og/'.$_GET['hash'], |
||
- | 94 | $URL->getFull() |
||
- | 95 | ) |
||
- | 96 | ); |
||
67 | |
97 | |
|
68 | $GRAPH_URL = $config['URL_PATH'].'og/'.$_GET['hash']; |
98 | $GRAPH_URL = $URL_PATH.'og/'.$_GET['hash']; |
|
69 | $CANON_URL = $config['URL_PATH'].'file.php?hash='.$_GET['hash']; |
99 | $CANON_URL = $URL_PATH.'file.php?hash='.$_GET['hash']; |
|
Line 70... | Line 100... | |||
70 | $BASIC_URL = $config['URL_PATH'].$_GET['hash']; |
100 | $BASIC_URL = $URL_PATH.$_GET['hash']; |
|
71 | |
101 | |
|
72 | switch(strtoupper($fileExtension)) { |
102 | switch(strtoupper($fileExtension)) { |
|
73 | case 'GIF': |
103 | case 'GIF': |
|
Line 144... | Line 174... | |||
144 | |
174 | |
|
145 | $videoWidth = $dimension->getWidth(); |
175 | $videoWidth = $dimension->getWidth(); |
|
Line 146... | Line 176... | |||
146 | $videoHeight = $dimension->getHeight(); |
176 | $videoHeight = $dimension->getHeight(); |
|
147 | |
177 | |
|
148 | ### Build paths. |
178 | ### Build paths. |
|
149 | $PREVIEW_IMAGE_URL = $config['URL_PATH'].$file; |
179 | $PREVIEW_IMAGE_URL = $URL_PATH.$file; |
|
Line 150... | Line 180... | |||
150 | $FLOW_PLAYER_VIDEO_URL = $config['URL_PATH'].'flowplayer/flowplayer.swf?config={"clip":"'.$BASIC_URL.'"}'; |
180 | $FLOW_PLAYER_VIDEO_URL = $URL_PATH.'flowplayer/flowplayer.swf?config={"clip":"'.$BASIC_URL.'"}'; |
|
151 | $FLOW_PLAYER = $config['URL_PATH'].'flowplayer/flowplayer.swf'; |
181 | $FLOW_PLAYER = $URL_PATH.'flowplayer/flowplayer.swf'; |
|
152 | |
182 | |
|
153 | echo <<<END |
183 | echo <<<END |