Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
v2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rijkvanzanten committed Jul 9, 2019
1 parent b508d09 commit d5812f1
Show file tree
Hide file tree
Showing 56 changed files with 1,387 additions and 332 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Directus allows you to manage multilingual content in as many languages as your

### Community

* **[Slack](https://slack.directus.io)** — Come join almost a thousand members discussing the future of Directus. Our helpful members are also quick to offer advice for simple questions you may have while getting started.
* **[Slack](https://directus.chat)** — Come join over a thousand members discussing the future of Directus. Our helpful members are also quick to offer advice for simple questions you may have while getting started.
* **[Twitter](https://twitter.com/directus)** — Follow us on Twitter to be the first to hear about product updates, see sneak peeks of new features, and vote on polls regarding the future of our platform.

### GitHub Tickets
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"webonyx/graphql-php": "^0.13.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7.25"
"phpunit/phpunit": "^5.7.25",
"phpbench/phpbench": "@dev"
},
"suggest": {
"paragonie/random_compat": "Generates cryptographically more secure pseudo-random bytes",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php


use Phinx\Migration\AbstractMigration;

class AddLoginAttemptsAllowedSetting extends AbstractMigration
{
public function up()
{
$fieldObject = [
'field' => 'login_attempts_allowed',
'type' => 'integer',
'interface' => 'numeric',
];
$collection = 'directus_settings';

$checkSql = sprintf('SELECT 1 FROM `directus_fields` WHERE `collection` = "%s" AND `field` = "%s";', $collection, $fieldObject['field']);
$result = $this->query($checkSql)->fetch();

if (!$result) {
$insertSqlFormat = 'INSERT INTO `directus_fields` (`collection`, `field`, `type`, `interface`) VALUES ("%s", "%s", "%s", "%s");';
$insertSql = sprintf($insertSqlFormat, $collection, $fieldObject['field'], $fieldObject['type'], $fieldObject['interface']);
$this->execute($insertSql);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<?php


use Phinx\Migration\AbstractMigration;

class UpdateIstanbulTimezone extends AbstractMigration
{
public function up()
{
$options = json_encode([
'choices' => [
'Pacific/Midway' => '(UTC-11:00) Midway Island',
'Pacific/Samoa' => '(UTC-11:00) Samoa',
'Pacific/Honolulu' => '(UTC-10:00) Hawaii',
'US/Alaska' => '(UTC-09:00) Alaska',
'America/Los_Angeles' => '(UTC-08:00) Pacific Time (US & Canada)',
'America/Tijuana' => '(UTC-08:00) Tijuana',
'US/Arizona' => '(UTC-07:00) Arizona',
'America/Chihuahua' => '(UTC-07:00) Chihuahua',
'America/Mexico/La_Paz' => '(UTC-07:00) La Paz',
'America/Mazatlan' => '(UTC-07:00) Mazatlan',
'US/Mountain' => '(UTC-07:00) Mountain Time (US & Canada)',
'America/Managua' => '(UTC-06:00) Central America',
'US/Central' => '(UTC-06:00) Central Time (US & Canada)',
'America/Guadalajara' => '(UTC-06:00) Guadalajara',
'America/Mexico_City' => '(UTC-06:00) Mexico City',
'America/Monterrey' => '(UTC-06:00) Monterrey',
'Canada/Saskatchewan' => '(UTC-06:00) Saskatchewan',
'America/Bogota' => '(UTC-05:00) Bogota',
'US/Eastern' => '(UTC-05:00) Eastern Time (US & Canada)',
'US/East-Indiana' => '(UTC-05:00) Indiana (East)',
'America/Lima' => '(UTC-05:00) Lima',
'America/Quito' => '(UTC-05:00) Quito',
'Canada/Atlantic' => '(UTC-04:00) Atlantic Time (Canada)',
'America/New_York' => '(UTC-04:00) New York',
'America/Caracas' => '(UTC-04:30) Caracas',
'America/La_Paz' => '(UTC-04:00) La Paz',
'America/Santiago' => '(UTC-04:00) Santiago',
'America/Santo_Domingo' => '(UTC-04:00) Santo Domingo',
'Canada/Newfoundland' => '(UTC-03:30) Newfoundland',
'America/Sao_Paulo' => '(UTC-03:00) Brasilia',
'America/Argentina/Buenos_Aires' => '(UTC-03:00) Buenos Aires',
'America/Argentina/GeorgeTown' => '(UTC-03:00) Georgetown',
'America/Godthab' => '(UTC-03:00) Greenland',
'America/Noronha' => '(UTC-02:00) Mid-Atlantic',
'Atlantic/Azores' => '(UTC-01:00) Azores',
'Atlantic/Cape_Verde' => '(UTC-01:00) Cape Verde Is.',
'Africa/Casablanca' => '(UTC+00:00) Casablanca',
'Europe/Edinburgh' => '(UTC+00:00) Edinburgh',
'Etc/Greenwich' => '(UTC+00:00) Greenwich Mean Time : Dublin',
'Europe/Lisbon' => '(UTC+00:00) Lisbon',
'Europe/London' => '(UTC+00:00) London',
'Africa/Monrovia' => '(UTC+00:00) Monrovia',
'UTC' => '(UTC+00:00) UTC',
'Europe/Amsterdam' => '(UTC+01:00) Amsterdam',
'Europe/Belgrade' => '(UTC+01:00) Belgrade',
'Europe/Berlin' => '(UTC+01:00) Berlin',
'Europe/Bern' => '(UTC+01:00) Bern',
'Europe/Bratislava' => '(UTC+01:00) Bratislava',
'Europe/Brussels' => '(UTC+01:00) Brussels',
'Europe/Budapest' => '(UTC+01:00) Budapest',
'Europe/Copenhagen' => '(UTC+01:00) Copenhagen',
'Europe/Ljubljana' => '(UTC+01:00) Ljubljana',
'Europe/Madrid' => '(UTC+01:00) Madrid',
'Europe/Paris' => '(UTC+01:00) Paris',
'Europe/Prague' => '(UTC+01:00) Prague',
'Europe/Rome' => '(UTC+01:00) Rome',
'Europe/Sarajevo' => '(UTC+01:00) Sarajevo',
'Europe/Skopje' => '(UTC+01:00) Skopje',
'Europe/Stockholm' => '(UTC+01:00) Stockholm',
'Europe/Vienna' => '(UTC+01:00) Vienna',
'Europe/Warsaw' => '(UTC+01:00) Warsaw',
'Africa/Lagos' => '(UTC+01:00) West Central Africa',
'Europe/Zagreb' => '(UTC+01:00) Zagreb',
'Europe/Athens' => '(UTC+02:00) Athens',
'Europe/Bucharest' => '(UTC+02:00) Bucharest',
'Africa/Cairo' => '(UTC+02:00) Cairo',
'Africa/Harare' => '(UTC+02:00) Harare',
'Europe/Helsinki' => '(UTC+02:00) Helsinki',
'Asia/Jerusalem' => '(UTC+02:00) Jerusalem',
'Europe/Kyiv' => '(UTC+02:00) Kyiv',
'Africa/Johannesburg' => '(UTC+02:00) Pretoria',
'Europe/Riga' => '(UTC+02:00) Riga',
'Europe/Sofia' => '(UTC+02:00) Sofia',
'Europe/Tallinn' => '(UTC+02:00) Tallinn',
'Europe/Vilnius' => '(UTC+02:00) Vilnius',
'Europe/Istanbul' => '(UTC+03:00) Istanbul',
'Asia/Baghdad' => '(UTC+03:00) Baghdad',
'Asia/Kuwait' => '(UTC+03:00) Kuwait',
'Europe/Minsk' => '(UTC+03:00) Minsk',
'Africa/Nairobi' => '(UTC+03:00) Nairobi',
'Asia/Riyadh' => '(UTC+03:00) Riyadh',
'Europe/Volgograd' => '(UTC+03:00) Volgograd',
'Asia/Tehran' => '(UTC+03:30) Tehran',
'Asia/Abu_Dhabi' => '(UTC+04:00) Abu Dhabi',
'Asia/Baku' => '(UTC+04:00) Baku',
'Europe/Moscow' => '(UTC+04:00) Moscow',
'Asia/Muscat' => '(UTC+04:00) Muscat',
'Europe/St_Petersburg' => '(UTC+04:00) St. Petersburg',
'Asia/Tbilisi' => '(UTC+04:00) Tbilisi',
'Asia/Yerevan' => '(UTC+04:00) Yerevan',
'Asia/Kabul' => '(UTC+04:30) Kabul',
'Asia/Islamabad' => '(UTC+05:00) Islamabad',
'Asia/Karachi' => '(UTC+05:00) Karachi',
'Asia/Tashkent' => '(UTC+05:00) Tashkent',
'Asia/Calcutta' => '(UTC+05:30) Chennai',
'Asia/Kolkata' => '(UTC+05:30) Kolkata',
'Asia/Mumbai' => '(UTC+05:30) Mumbai',
'Asia/New_Delhi' => '(UTC+05:30) New Delhi',
'Asia/Sri_Jayawardenepura' => '(UTC+05:30) Sri Jayawardenepura',
'Asia/Katmandu' => '(UTC+05:45) Kathmandu',
'Asia/Almaty' => '(UTC+06:00) Almaty',
'Asia/Astana' => '(UTC+06:00) Astana',
'Asia/Dhaka' => '(UTC+06:00) Dhaka',
'Asia/Yekaterinburg' => '(UTC+06:00) Ekaterinburg',
'Asia/Rangoon' => '(UTC+06:30) Rangoon',
'Asia/Bangkok' => '(UTC+07:00) Bangkok',
'Asia/Hanoi' => '(UTC+07:00) Hanoi',
'Asia/Jakarta' => '(UTC+07:00) Jakarta',
'Asia/Novosibirsk' => '(UTC+07:00) Novosibirsk',
'Asia/Beijing' => '(UTC+08:00) Beijing',
'Asia/Chongqing' => '(UTC+08:00) Chongqing',
'Asia/Hong_Kong' => '(UTC+08:00) Hong Kong',
'Asia/Krasnoyarsk' => '(UTC+08:00) Krasnoyarsk',
'Asia/Kuala_Lumpur' => '(UTC+08:00) Kuala Lumpur',
'Australia/Perth' => '(UTC+08:00) Perth',
'Asia/Singapore' => '(UTC+08:00) Singapore',
'Asia/Taipei' => '(UTC+08:00) Taipei',
'Asia/Ulan_Bator' => '(UTC+08:00) Ulaan Bataar',
'Asia/Urumqi' => '(UTC+08:00) Urumqi',
'Asia/Irkutsk' => '(UTC+09:00) Irkutsk',
'Asia/Osaka' => '(UTC+09:00) Osaka',
'Asia/Sapporo' => '(UTC+09:00) Sapporo',
'Asia/Seoul' => '(UTC+09:00) Seoul',
'Asia/Tokyo' => '(UTC+09:00) Tokyo',
'Australia/Adelaide' => '(UTC+09:30) Adelaide',
'Australia/Darwin' => '(UTC+09:30) Darwin',
'Australia/Brisbane' => '(UTC+10:00) Brisbane',
'Australia/Canberra' => '(UTC+10:00) Canberra',
'Pacific/Guam' => '(UTC+10:00) Guam',
'Australia/Hobart' => '(UTC+10:00) Hobart',
'Australia/Melbourne' => '(UTC+10:00) Melbourne',
'Pacific/Port_Moresby' => '(UTC+10:00) Port Moresby',
'Australia/Sydney' => '(UTC+10:00) Sydney',
'Asia/Yakutsk' => '(UTC+10:00) Yakutsk',
'Asia/Vladivostok' => '(UTC+11:00) Vladivostok',
'Pacific/Auckland' => '(UTC+12:00) Auckland',
'Pacific/Fiji' => '(UTC+12:00) Fiji',
'Pacific/Kwajalein' => '(UTC+12:00) International Date Line West',
'Asia/Kamchatka' => '(UTC+12:00) Kamchatka',
'Asia/Magadan' => '(UTC+12:00) Magadan',
'Pacific/Marshall_Is' => '(UTC+12:00) Marshall Is.',
'Asia/New_Caledonia' => '(UTC+12:00) New Caledonia',
'Asia/Solomon_Is' => '(UTC+12:00) Solomon Is.',
'Pacific/Wellington' => '(UTC+12:00) Wellington',
'Pacific/Tongatapu' => '(UTC+13:00) Nuku\'alofa'
],
'placeholder' => 'Choose a timezone...'
]);

$this->execute(\Directus\phinx_update(
$this->getAdapter(),
'directus_fields',
['options' => $options],
['collection' => 'directus_users', 'field' => 'timezone']
));
}
}
2 changes: 1 addition & 1 deletion public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Options +SymLinksIfOwnerMatch
<IfModule mod_php7.c>
php_value upload_max_filesize 50M
php_value post_max_size 100M
</IfModule>
</IfModule>
15 changes: 8 additions & 7 deletions public/thumbnail/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
if (!$image) {
// now we can create the thumb
switch ($thumbnailer->action) {
// http://image.intervention.io/api/resize
// http://image.intervention.io/api/resize
case 'contain':
$image = $thumbnailer->contain();
break;
// http://image.intervention.io/api/fit
// http://image.intervention.io/api/fit
case 'crop':
default:
$image = $thumbnailer->crop();
Expand All @@ -58,13 +58,14 @@
header('Content-type: ' . $thumbnailer->getThumbnailMimeType());
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));
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
header("Access-Control-Allow-Headers: Access-Control-Allow-Headers,Content-Type");
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 $image;
exit(0);
}

catch (Exception $e) {
} catch (Exception $e) {
$filePath = ArrayUtils::get($settings, 'thumbnail_not_found_location');
if (is_string($filePath) && !empty($filePath) && $filePath[0] !== '/') {
$filePath = $basePath . '/' . $filePath;
Expand Down
8 changes: 8 additions & 0 deletions public/uploads/_/originals/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
deny from all
</FilesMatch>

<IfModule mod_headers.c>
<FilesMatch "\.(jpe?g|png|gif|mp3|wav|ogg|m4a|mp4|mov|wmv|avi)$">
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
Header set Access-Control-Allow-Headers "Access-Control-Allow-Headers,Content-Type"
</FilesMatch>
</IfModule>

# Respond with 404 if the file doesn't exists
# Before the API mod_rewrite catches the request
<IfModule mod_rewrite.c>
Expand Down
4 changes: 2 additions & 2 deletions src/core/Directus/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Application extends App
*
* @var string
*/
const DIRECTUS_VERSION = '2.2.1';
const DIRECTUS_VERSION = '2.2.2';

/**
* NOT USED
Expand Down Expand Up @@ -142,7 +142,7 @@ public function setCheckRequirementsFunction(\Closure $function)
protected function createConfig(array $appConfig)
{
return [
'settings' => ArrayUtils::pull($appConfig, 'settings', []),
'settings' => $appConfig['settings'],
'config' => function () use ($appConfig) {
return new Config($appConfig);
}
Expand Down
28 changes: 23 additions & 5 deletions src/core/Directus/Application/CoreServicesProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Directus\Authentication\Sso\Social;
use Directus\Authentication\User\Provider\UserTableGatewayProvider;
use Directus\Cache\Response;
use Directus\Cache\Exception\InvalidCacheAdapterException;
use Directus\Cache\Exception\InvalidCacheConfigurationException;
use Directus\Config\StatusMapping;
use Directus\Database\Connection;
use Directus\Database\Exception\ConnectionFailedException;
Expand Down Expand Up @@ -127,12 +129,14 @@ protected function getLogger()

$filenameFormat = '%s.%s.log';
foreach (Logger::getLevels() as $name => $level) {
if ($path !== "php://stdout" && $path !== "php://stderr") {
$path . '/' . sprintf($filenameFormat, strtolower($name), date('Y-m-d'));
}
$handler = new StreamHandler(
$path . '/' . sprintf($filenameFormat, strtolower($name), date('Y-m-d')),
$path,
$level,
false
);

$handler->setFormatter($formatter);
$logger->pushHandler($handler);
}
Expand Down Expand Up @@ -542,7 +546,7 @@ protected function getEmitter()
];
// Authenticated user can see their private info
// Admin can see all users private info
if (!$acl->isAdmin() && $userId !== (int)$row['id']) {
if (!$acl->isAdmin() && $userId !== (int) $row['id']) {
$omit = array_merge($omit, [
'token',
'email_notifications',
Expand Down Expand Up @@ -894,7 +898,7 @@ protected function getCache()
$pool = $poolConfig;
} else {
if (!in_array($poolConfig['adapter'], ['apc', 'apcu', 'array', 'filesystem', 'memcached', 'memcache', 'redis', 'void'])) {
throw new \Exception("Valid cache adapters are 'apc', 'apcu', 'filesystem', 'memcached', 'memcache', 'redis'");
throw new InvalidCacheAdapterException();
}

$pool = new VoidCachePool();
Expand All @@ -915,7 +919,7 @@ protected function getCache()

if ($adapter == 'filesystem') {
if (empty($poolConfig['path']) || !is_string($poolConfig['path'])) {
throw new \Exception('"cache.pool.path parameter is required for "filesystem" adapter and must be a string');
throw new InvalidCacheConfigurationException($adapter);
}

$cachePath = $poolConfig['path'];
Expand All @@ -931,6 +935,15 @@ protected function getCache()
}

if ($adapter == 'memcached' || $adapter == 'memcache') {

if ($adapter == 'memcached' && !extension_loaded('memcached')) {
throw new InvalidCacheConfigurationException($adapter);
}

if ($adapter == 'memcache' && !extension_loaded('memcache')) {
throw new InvalidCacheConfigurationException($adapter);
}

$client = $adapter == 'memcached' ? new \Memcached() : new \Memcache();
if (isset($poolConfig['url'])) {
$urls = explode(';', $poolConfig['url']);
Expand All @@ -954,6 +967,11 @@ protected function getCache()
}

if ($adapter == 'redis') {

if (!extension_loaded('redis')) {
throw new InvalidCacheConfigurationException($adapter);
}

$host = (isset($poolConfig['host'])) ? $poolConfig['host'] : 'localhost';
$port = (isset($poolConfig['port'])) ? $poolConfig['port'] : 6379;
$socket = (isset($poolConfig['socket'])) ? $poolConfig['socket'] : null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Directus\Authentication\Exception;

use Directus\Exception\NotFoundException;

class UserSuspendedException extends NotFoundException
{
const ERROR_CODE = 103;

public function __construct()
{
parent::__construct('Your account is suspended due to maximum allowed login attempts. Please contact your administrator to activate your account.', static::ERROR_CODE);
}
}
Loading

0 comments on commit d5812f1

Please sign in to comment.