This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
1 parent
8ac1fbb
commit b8739c9
Showing
377 changed files
with
39,560 additions
and
4,485 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
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
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
31 changes: 31 additions & 0 deletions
31
migrations/upgrades/schemas/20190520094300_use_timeline.php
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,31 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class UseTimeline extends AbstractMigration | ||
{ | ||
public function up() | ||
{ | ||
$this->execute(\Directus\phinx_update( | ||
$this->getAdapter(), | ||
'directus_collection_presets', | ||
[ | ||
'view_type' => 'timeline', | ||
'view_query' => json_encode([ | ||
'timeline' => [ | ||
'sort' => '-action_on' | ||
] | ||
]), | ||
'view_options' => json_encode([ | ||
'timeline' => [ | ||
'date' => 'action_on', | ||
'title' => '{{ action_by.first_name }} {{ action_by.last_name }} ({{ action }})', | ||
'content' => 'action_by', | ||
'color' => 'action' | ||
] | ||
]) | ||
], | ||
['collection' => 'directus_activity'] | ||
)); | ||
} | ||
} |
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,2 @@ | ||
RewriteEngine On | ||
RewriteRule (.*) index.php [L] |
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,94 @@ | ||
<?php | ||
|
||
require __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use Directus\Util\ArrayUtils; | ||
use Directus\Filesystem\Thumbnailer; | ||
|
||
$basePath = realpath(__DIR__ . '/../../'); | ||
// Get Project name | ||
$projectName = \Directus\get_api_project_from_request(); | ||
|
||
try { | ||
$app = \Directus\create_app_with_project_name($basePath, $projectName); | ||
} catch (\Exception $e) { | ||
http_response_code(404); | ||
header('Content-Type: application/json'); | ||
echo json_encode([ | ||
'error' => [ | ||
'error' => 8, | ||
'message' => 'API Project Configuration Not Found: ' . $projectName | ||
] | ||
]); | ||
exit; | ||
} | ||
|
||
$filesystem = $app->getContainer()->get('filesystem')->getAdapter(); | ||
|
||
//Remove the project name from the URL | ||
$path = urldecode(\Directus\get_virtual_path()); | ||
if (substr($path, 0, strlen($projectName)) == $projectName) { | ||
$path = substr($path, strlen($projectName)); | ||
} | ||
|
||
$settings = \Directus\get_directus_proxy_downloads_settings(); | ||
$timeToLive = \Directus\array_get($settings, 'proxy_downloads_cache_ttl', 86400); | ||
try { | ||
|
||
//Forward HTTP headers | ||
$metadata = $filesystem->getMetadata($path); | ||
|
||
header('HTTP/1.1 200 OK'); | ||
if (array_key_exists('mimetype', $metadata)) { | ||
header('Content-type: ' . $metadata['mimetype']); | ||
} else { | ||
$mimetype = $filesystem->getMimetype($path); | ||
if ($mimetype) { | ||
header('Content-type: ' . $mimetype); | ||
} | ||
} | ||
if (array_key_exists('size', $metadata)) { | ||
header('Content-Length: ' . $metadata['size']); | ||
} else { | ||
$size = $filesystem->getSize($path); | ||
if ($size) { | ||
header('Content-Length: ' . $size); | ||
} | ||
} | ||
header("Pragma: cache"); | ||
header('Cache-Control: max-age=' . $timeToLive); | ||
header('Last-Modified: '. gmdate('D, d M Y H:i:s \G\M\T', time())); | ||
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + $timeToLive)); | ||
|
||
//Forward HTTP body | ||
$resource = $filesystem->readStream($path); | ||
ob_end_flush(); | ||
fpassthru($resource); | ||
exit(0); | ||
} | ||
|
||
catch (Exception $e) { | ||
$filePath = ArrayUtils::get($settings, 'proxy_downloads_not_found_location'); | ||
if (is_string($filePath) && !empty($filePath) && $filePath[0] !== '/') { | ||
$filePath = $basePath . '/' . $filePath; | ||
} | ||
|
||
// TODO: Throw message if the error is a invalid configuration | ||
if (file_exists($filePath)) { | ||
$mime = mime_content_type($filePath); | ||
|
||
// TODO: Do we need to cache non-existing files? | ||
if ($mime) { | ||
header('Content-type: ' . $mime); | ||
} | ||
header("Pragma: cache"); | ||
header('Cache-Control: max-age=' . $timeToLive); | ||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \G\M\T', time())); | ||
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $timeToLive)); | ||
echo file_get_contents($filePath); | ||
} else { | ||
http_response_code(404); | ||
} | ||
|
||
exit(0); | ||
} |
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
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
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
Oops, something went wrong.