1
0
Fork 0
mirror of synced 2024-06-28 11:10:46 +12:00

Merge branch 'master' of github.com:appwrite/appwrite

This commit is contained in:
eldadfux 2019-10-02 21:04:13 +03:00
commit 2ed96bd891
17 changed files with 608 additions and 38 deletions

View file

@ -100,27 +100,27 @@ We really ❤️ pull requests! If you wish to help, you can learn more about ho
Created by [Eldad Fux](https://twitter.com/eldadfux) with the amazing help of our **amazing contributors:**
* 🇺🇸 Justin Dorfman ([Github](https://github.com/jdorfman), [Twitter](https://twitter.com/jdorfman))
* 🇺🇳 0xflotus ([Github](https://github.com/0xflotus))
* 🇳🇴 Petter Charles Redfern ([Github](https://github.com/Chaaarles))
* 🇧🇷 Jessé Souza ([Github](https://github.com/jessescn))
* 🇪🇸 Esther Álvarez Feijoo ([Github](https://github.com/EstherAF))
* 🇮🇳 Christy Jacob ([Github](https://github.com/christyjacob4), [Linkedin](https://www.linkedin.com/in/christyjacob4/))
* 🇺🇦 Dmitriy Danilov ([Github](https://github.com/daniloff200), [Twitter](https://twitter.com/daniloff200))
* 🇮🇩 Zeet ([Github](https://github.com/Kiy4h))
* 🇫🇮 Pessi Päivärinne ([Github](https://github.com/pessip))
* 🇺🇳 Sergi Vos ([Github](https://github.com/sergivb01), [Twitter](https://twitter.com/sergivb01), [Linkedin](https://www.linkedin.com/in/sergivb01/))
* 🇮🇱 Tomer Cohen ([Github](https://github.com/tomer), [Twitter](https://twitter.com/tomer))
* 🇮🇹 Tatiana ([Github](https://github.com/tacoelho))
* 🇬🇷 Panagiotis Skarlas ([Github](https://github.com/1qk1), [Twitter](https://twitter.com/qktweets))
* 🇷🇺 Alexey Pyltsyn ([Github](https://github.com/lex111))
* 🇩🇪 Robin C ([Github](https://github.com/Taminoful))
* 🇮🇳 Parikshit Hooda ([Github](https://github.com/Parikshit-Hooda))
* 🇫🇷 Corentin Le Fur ([Github](https://github.com/crtlf))
* 🇬🇧 Callum Lowry ([Github](https://github.com/Girxffe))
* 🇷🇴 Bogdan Covrig ([Github](https://github.com/BogDAAAMN), [Twitter](https://twitter.com/BogdanCovrig))
* 🇳🇱 Kolkies ([Github](https://github.com/kolkies.dev))
* 🇹🇷 Mustafa Dur ([Github](https://github.com/tosbaha))
* 🇵🇹 Luís Pinto ([Github](https://github.com/LiTO773))
* 🇮🇳 Saksham Saxena ([Github](https://github.com/sakkshm))
* 🇮🇱 Dima Vishnevetsky ([Github](https://github.com/dimshik100), [Twitter](https://twitter.com/dimshik100))
* 🇺🇸 Justin Dorfman ([GitHub](https://github.com/jdorfman), [Twitter](https://twitter.com/jdorfman))
* 🇺🇳 0xflotus ([GitHub](https://github.com/0xflotus))
* 🇳🇴 Petter Charles Redfern ([GitHub](https://github.com/Chaaarles))
* 🇧🇷 Jessé Souza ([GitHub](https://github.com/jessescn))
* 🇪🇸 Esther Álvarez Feijoo ([GitHub](https://github.com/EstherAF))
* 🇮🇳 Christy Jacob ([GitHub](https://github.com/christyjacob4), [Linkedin](https://www.linkedin.com/in/christyjacob4/))
* 🇺🇦 Dmitriy Danilov ([GitHub](https://github.com/daniloff200), [Twitter](https://twitter.com/daniloff200))
* 🇮🇩 Zeet ([GitHub](https://github.com/Kiy4h))
* 🇫🇮 Pessi Päivärinne ([GitHub](https://github.com/pessip))
* 🇺🇳 Sergi Vos ([GitHub](https://github.com/sergivb01), [Twitter](https://twitter.com/sergivb01), [Linkedin](https://www.linkedin.com/in/sergivb01/))
* 🇮🇱 Tomer Cohen ([GitHub](https://github.com/tomer), [Twitter](https://twitter.com/tomer))
* 🇮🇹 Tatiana ([GitHub](https://github.com/tacoelho))
* 🇬🇷 Panagiotis Skarlas ([GitHub](https://github.com/1qk1), [Twitter](https://twitter.com/qktweets))
* 🇷🇺 Alexey Pyltsyn ([GitHub](https://github.com/lex111))
* 🇩🇪 Robin C ([GitHub](https://github.com/Taminoful))
* 🇮🇳 Parikshit Hooda ([GitHub](https://github.com/Parikshit-Hooda))
* 🇫🇷 Corentin Le Fur ([GitHub](https://github.com/crtlf))
* 🇬🇧 Callum Lowry ([GitHub](https://github.com/Girxffe))
* 🇷🇴 Bogdan Covrig ([GitHub](https://github.com/BogDAAAMN), [Twitter](https://twitter.com/BogdanCovrig))
* 🇳🇱 Kolkies ([GitHub](https://github.com/kolkies.dev))
* 🇹🇷 Mustafa Dur ([GitHub](https://github.com/tosbaha))
* 🇵🇹 Luís Pinto ([GitHub](https://github.com/LiTO773))
* 🇮🇳 Saksham Saxena ([GitHub](https://github.com/sakkshm))
* 🇮🇱 Dima Vishnevetsky ([GitHub](https://github.com/dimshik100), [Twitter](https://twitter.com/dimshik100))

View file

@ -1,16 +1,16 @@
<?php
return [
'settings.inspire' => '"The art of being wise is the art of knowing what to overlook."', // This is the line printed in the homepage and console 'view-source'
'settings.inspire' => '"Искусство быть мудрым — это искусство знать, чем можно пренебречь."', // This is the line printed in the homepage and console 'view-source'
'settings.locale' => 'ru',
'settings.direction' => 'rtl',
'settings.direction' => 'ltr',
'auth.emails.team' => '%s Команда',
'auth.emails.confirm.title' => 'Подтверждение Аккаунта',
'auth.emails.team' => 'Команда %s',
'auth.emails.confirm.title' => 'Подтверждение аккаунта',
'auth.emails.confirm.body' => 'ru.email.auth.confirm.tpl',
'auth.emails.recovery.title' => 'Сброс Пароля',
'auth.emails.recovery.title' => 'Сброс пароля',
'auth.emails.recovery.body' => 'ru.email.auth.recovery.tpl',
'auth.emails.invitation.title' => 'Приглашение в %s Команду в %s',
'auth.emails.invitation.title' => 'Приглашение в команду %s по проекту %s',
'auth.emails.invitation.body' => 'ru.email.auth.invitation.tpl',
'locale.country.unknown' => 'Неизвестно',

View file

@ -7,10 +7,10 @@
</style>
<div style="direction: {{direction}}">
Здравствуйте {{name}},
Здравствуйте, {{name}},
<br />
<br />
Перейдите по ссылке чтобы подтвердить свою адрес электронной почты.
Перейдите по ссылке, чтобы подтвердить свой адрес электронной почты.
<br />
<a href="{{redirect}}">{{redirect}}</a>
<br />

View file

@ -10,10 +10,10 @@
Здравствуйте,
<br />
<br />
Это письмо было отправлено вам потому что <b>{{owner}}</b> хочет пригласить вас стать членом команды <b>{{team}}</b> в {{project}}.
Это письмо отправлено вам, потому что <b>{{owner}}</b> приглашает стать членом команды <b>{{team}}</b> в проекте {{project}}.
<br />
<br />
Перейдите по ссылке чтобы присоединиться к команде <b>{{team}}</b> :
Перейдите по ссылке, чтобы присоединиться к команде <b>{{team}}</b> :
<br />
<a href="{{redirect}}">{{redirect}}</a>
<br />

View file

@ -7,10 +7,10 @@
</style>
<div style="direction: {{direction}}">
Здравствуйте {{name}},
Здравствуйте, {{name}},
<br />
<br />
Перейдите по ссылке чтобы сбросить свой пароль для {{project}} .
Перейдите по ссылке, чтобы сбросить пароль для проекта {{project}}.
<br />
<a href="{{redirect}}">{{redirect}}</a>
<br />

View file

@ -0,0 +1,24 @@
<style>
* {
font-family: sans-serif,Arial;
-webkit-font-smoothing: antialiased;
font-weight: lighter;
}
</style>
<div style="direction: {{direction}}">
Xin chào {{name}},
<br />
<br />
Hãy vào liên kết này để xác nhận địa chỉ email của bạn.
<br />
<a href="{{redirect}}">{{redirect}}</a>
<br />
<br />
Xin hãy bỏ qua email này nếu bạn không yêu cầu xác nhận địa chỉ này.
<br />
<br />
Xin cảm ơn,
<br />
{{project}} team
</div>

View file

@ -0,0 +1,27 @@
<style>
* {
font-family: sans-serif,Arial;
-webkit-font-smoothing: antialiased;
font-weight: lighter;
}
</style>
<div style="direction: {{direction}}">
Xin chào,
<br />
<br />
Bạn nhận được email này vì <b>{{owner}}</b> muốn mời bạn tham gia {{project}} cùng với <b>{{team}}</b> team.
<br />
<br />
Hãy theo liên kết này để tham gia vào <b>{{team}}</b> team:
<br />
<a href="{{redirect}}">{{redirect}}</a>
<br />
<br />
Nếu bạn không thích tham gia, hãy bỏ qua lời nhắn này.
<br />
<br />
Xin cảm ơn,
<br />
{{project}} team
</div>

View file

@ -0,0 +1,24 @@
<style>
* {
font-family: sans-serif,Arial;
-webkit-font-smoothing: antialiased;
font-weight: lighter;
}
</style>
<div style="direction: {{direction}}">
Xin chào {{name}},
<br />
<br />
Hãy theo liên kết này để khôi phục mật khẩu của bạn ở {{project}}.
<br />
<a href="{{redirect}}">{{redirect}}</a>
<br />
<br />
Hãy bỏ qua lời nhắn này nếu bạn không yêu cầu khôi phục mật khẩu.
<br />
<br />
Xin cảm ơn,
<br />
{{project}} team
</div>

View file

@ -0,0 +1,11 @@
<?php
return [
'AF' => 'Châu Phi',
'AN' => 'Nam Cực',
'AS' => 'Châu Á',
'EU' => 'Châu Âu',
'NA' => 'Bắc Mỹ',
'OC' => 'Châu Đại Dương',
'SA' => 'Nam Mỹ',
];

View file

@ -0,0 +1,198 @@
<?php
return [
'AF' => 'Afghanistan',
'AO' => 'Angola',
'AL' => 'Albania',
'AD' => 'Andorra',
'AE' => 'United Arab Emirates',
'AR' => 'Argentina',
'AM' => 'Armenia',
'AG' => 'Antigua and Barbuda',
'AU' => 'Australia',
'AT' => 'Austria',
'AZ' => 'Azerbaijan',
'BI' => 'Burundi',
'BE' => 'Belgium',
'BJ' => 'Benin',
'BF' => 'Burkina Faso',
'BD' => 'Bangladesh',
'BG' => 'Bulgaria',
'BH' => 'Bahrain',
'BS' => 'Bahamas',
'BA' => 'Bosnia and Herzegovina',
'BY' => 'Belarus',
'BZ' => 'Belize',
'BO' => 'Bolivia',
'BR' => 'Brazil',
'BB' => 'Barbados',
'BN' => 'Brunei',
'BT' => 'Bhutan',
'BW' => 'Botswana',
'CF' => 'Central African Republic',
'CA' => 'Canada',
'CH' => 'Switzerland',
'CL' => 'Chile',
'CN' => 'China',
'CI' => 'Ivory Coast',
'CM' => 'Cameroon',
'CD' => 'DR Congo',
'CG' => 'Republic of the Congo',
'CO' => 'Colombia',
'KM' => 'Comoros',
'CV' => 'Cape Verde',
'CR' => 'Costa Rica',
'CU' => 'Cuba',
'CY' => 'Cyprus',
'CZ' => 'Czechia',
'DE' => 'Germany',
'DJ' => 'Djibouti',
'DM' => 'Dominica',
'DK' => 'Denmark',
'DO' => 'Dominican Republic',
'DZ' => 'Algeria',
'EC' => 'Ecuador',
'EG' => 'Egypt',
'ER' => 'Eritrea',
'ES' => 'Spain',
'EE' => 'Estonia',
'ET' => 'Ethiopia',
'FI' => 'Finland',
'FJ' => 'Fiji',
'FR' => 'France',
'FM' => 'Micronesia',
'GA' => 'Gabon',
'GB' => 'United Kingdom',
'GE' => 'Georgia',
'GH' => 'Ghana',
'GN' => 'Guinea',
'GM' => 'Gambia',
'GW' => 'Guinea-Bissau',
'GQ' => 'Equatorial Guinea',
'GR' => 'Greece',
'GD' => 'Grenada',
'GT' => 'Guatemala',
'GY' => 'Guyana',
'HN' => 'Honduras',
'HR' => 'Croatia',
'HT' => 'Haiti',
'HU' => 'Hungary',
'ID' => 'Indonesia',
'IN' => 'India',
'IE' => 'Ireland',
'IR' => 'Iran',
'IQ' => 'Iraq',
'IS' => 'Iceland',
'IL' => 'Israel',
'IT' => 'Italy',
'JM' => 'Jamaica',
'JO' => 'Jordan',
'JP' => 'Japan',
'KZ' => 'Kazakhstan',
'KE' => 'Kenya',
'KG' => 'Kyrgyzstan',
'KH' => 'Cambodia',
'KI' => 'Kiribati',
'KN' => 'Saint Kitts and Nevis',
'KR' => 'South Korea',
'KW' => 'Kuwait',
'LA' => 'Laos',
'LB' => 'Lebanon',
'LR' => 'Liberia',
'LY' => 'Libya',
'LC' => 'Saint Lucia',
'LI' => 'Liechtenstein',
'LK' => 'Sri Lanka',
'LS' => 'Lesotho',
'LT' => 'Lithuania',
'LU' => 'Luxembourg',
'LV' => 'Latvia',
'MA' => 'Morocco',
'MC' => 'Monaco',
'MD' => 'Moldova',
'MG' => 'Madagascar',
'MV' => 'Maldives',
'MX' => 'Mexico',
'MH' => 'Marshall Islands',
'MK' => 'Macedonia',
'ML' => 'Mali',
'MT' => 'Malta',
'MM' => 'Myanmar',
'ME' => 'Montenegro',
'MN' => 'Mongolia',
'MZ' => 'Mozambique',
'MR' => 'Mauritania',
'MU' => 'Mauritius',
'MW' => 'Malawi',
'MY' => 'Malaysia',
'NA' => 'Namibia',
'NE' => 'Niger',
'NG' => 'Nigeria',
'NI' => 'Nicaragua',
'NL' => 'Netherlands',
'NO' => 'Norway',
'NP' => 'Nepal',
'NR' => 'Nauru',
'NZ' => 'New Zealand',
'OM' => 'Oman',
'PK' => 'Pakistan',
'PA' => 'Panama',
'PE' => 'Peru',
'PH' => 'Philippines',
'PW' => 'Palau',
'PG' => 'Papua New Guinea',
'PL' => 'Poland',
'KP' => 'North Korea',
'PT' => 'Portugal',
'PY' => 'Paraguay',
'QA' => 'Qatar',
'RO' => 'Romania',
'RU' => 'Russia',
'RW' => 'Rwanda',
'SA' => 'Saudi Arabia',
'SD' => 'Sudan',
'SN' => 'Senegal',
'SG' => 'Singapore',
'SB' => 'Solomon Islands',
'SL' => 'Sierra Leone',
'SV' => 'El Salvador',
'SM' => 'San Marino',
'SO' => 'Somalia',
'RS' => 'Serbia',
'SS' => 'South Sudan',
'ST' => 'São Tomé and Príncipe',
'SR' => 'Suriname',
'SK' => 'Slovakia',
'SI' => 'Slovenia',
'SE' => 'Sweden',
'SZ' => 'Swaziland',
'SC' => 'Seychelles',
'SY' => 'Syria',
'TD' => 'Chad',
'TG' => 'Togo',
'TH' => 'Thailand',
'TJ' => 'Tajikistan',
'TM' => 'Turkmenistan',
'TL' => 'Timor-Leste',
'TO' => 'Tonga',
'TT' => 'Trinidad and Tobago',
'TN' => 'Tunisia',
'TR' => 'Turkey',
'TV' => 'Tuvalu',
'TZ' => 'Tanzania',
'UG' => 'Uganda',
'UA' => 'Ukraine',
'UY' => 'Uruguay',
'US' => 'United States',
'UZ' => 'Uzbekistan',
'VA' => 'Vatican City',
'VC' => 'Saint Vincent and the Grenadines',
'VE' => 'Venezuela',
'VN' => 'Việt Nam',
'VU' => 'Vanuatu',
'WS' => 'Samoa',
'YE' => 'Yemen',
'ZA' => 'South Africa',
'ZM' => 'Zambia',
'ZW' => 'Zimbabwe',
];

21
app/config/locale/vi.php Normal file
View file

@ -0,0 +1,21 @@
<?php
return [
'settings.inspire' => '"Nghệ thuật khôn ngoan là nghệ thuật biết những gì cần bỏ qua."', // This is the line printed in the homepage and console 'view-source'
'settings.locale' => 'vi',
'settings.direction' => 'ltr',
// Service - Users
'auth.emails.team' => '%s Team',
'auth.emails.confirm.title' => 'Xác nhận tài khoản',
'auth.emails.confirm.body' => 'vi.email.auth.confirm.tpl',
'auth.emails.recovery.title' => 'Đặt lại mật khẩu',
'auth.emails.recovery.body' => 'vi.email.auth.recovery.tpl',
'auth.emails.invitation.title' => 'Lời mới vào %s Team ở %s',
'auth.emails.invitation.body' => 'vi.email.auth.invitation.tpl',
'locale.country.unknown' => 'Chưa xác định',
'countries' => include 'vi.countries.php',
'continents' => include 'vi.continents.php',
];

View file

@ -34,7 +34,7 @@ return [
'microsoft' => [
'developers' => 'https://developer.microsoft.com/en-us/',
'icon' => 'icon-windows',
'enabled' => false,
'enabled' => true,
],
'twitter' => [
'developers' => 'https://developer.twitter.com/',
@ -46,4 +46,9 @@ return [
'icon' => 'icon-linkedin',
'enabled' => true,
],
'dropbox' => [
'developers' => 'https://www.dropbox.com/developers/documentation',
'icon' => 'icon-dropbox',
'enabled' => true,
],
];

View file

@ -4,7 +4,7 @@ $home = $this->getParam('home', '');
<footer class="clear margin-top-xl">
<ul class="copyright pull-start">
<li>
<a href="https://github.com/appwrite/appwrite" target="_blank"><i class="icon-github-circled"></i> Github Repository</a>
<a href="https://github.com/appwrite/appwrite" target="_blank"><i class="icon-github-circled"></i> GitHub Repository</a>
</li>
<li>
<a href="https://github.com/appwrite/appwrite/issues/new?body=%0A%0A%0A---%0AAppwrite Version:%20<?php echo VERSION; ?>" target="_blank">Open an Issue</a>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

128
src/Auth/OAuth/Dropbox.php Normal file
View file

@ -0,0 +1,128 @@
<?php
namespace Auth\OAuth;
use Auth\OAuth;
// Reference Material
// https://www.dropbox.com/developers/reference/oauth-guide
// https://www.dropbox.com/developers/documentation/http/documentation#users-get_current_account
class Dropbox extends OAuth
{
/**
* @var array
*/
protected $user = [];
/**
* @return string
*/
public function getName(): string
{
return 'dropbox';
}
/**
* @return string
*/
public function getLoginURL(): string
{
return 'https://www.dropbox.com/oauth2/authorize?'.
'client_id='.urlencode($this->appID).
'&redirect_uri='.urlencode($this->callback).
'&state='.urlencode(json_encode($this->state)).
'&response_type=code';
}
/**
* @param string $code
*
* @return string
*/
public function getAccessToken(string $code): string
{
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$accessToken = $this->request(
'POST',
'https://api.dropboxapi.com/oauth2/token',
$headers,
'code='.urlencode($code).
'&client_id='.urlencode($this->appID).
'&client_secret='.urlencode($this->appSecret).
'&redirect_uri='.urlencode($this->callback).
'&grant_type=authorization_code'
);
$accessToken = json_decode($accessToken, true);
if (isset($accessToken['access_token'])) {
return $accessToken['access_token'];
}
return '';
}
/**
* @param string $accessToken
*
* @return string
*/
public function getUserID(string $accessToken): string
{
$user = $this->getUser($accessToken);
if (isset($user['account_id'])) {
return $user['account_id'];
}
return '';
}
/**
* @param string $accessToken
*
* @return string
*/
public function getUserEmail(string $accessToken): string
{
$user = $this->getUser($accessToken);
if (isset($user['email'])) {
return $user['email'];
}
return '';
}
/**
* @param string $accessToken
*
* @return string
*/
public function getUserName(string $accessToken): string
{
$user = $this->getUser($accessToken);
if (isset($user['name'])) {
return $user['name']['display_name'];
}
return '';
}
/**
* @param string $accessToken
*
* @return array
*/
protected function getUser(string $accessToken): array
{
if (empty($this->user)) {
$headers[] = 'Authorization: Bearer '. urlencode($accessToken);
$user = $this->request('POST', 'https://api.dropboxapi.com/2/users/get_current_account', $headers);
$this->user = json_decode($user, true);
}
return $this->user;
}
}

View file

@ -0,0 +1,132 @@
<?php
namespace Auth\OAuth;
use Auth\OAuth;
// Reference Material
// https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
// https://docs.microsoft.com/en-us/graph/auth-v2-user
class Microsoft extends OAuth
{
/**
* @var array
*/
protected $user = [];
/**
* @return string
*/
public function getName(): string
{
return 'microsoft';
}
/**
* @return string
*/
public function getLoginURL(): string
{
return 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?'.
'client_id='.urlencode($this->appID).
'&redirect_uri='.urlencode($this->callback).
'&state='.urlencode(json_encode($this->state)).
'&scope=offline_access+user.read'.
'&response_type=code'.
'&response_mode=query';
}
/**
* @param string $code
*
* @return string
*/
public function getAccessToken(string $code): string
{
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$accessToken = $this->request(
'POST',
'https://login.microsoftonline.com/common/oauth2/v2.0/token',
$headers,
'code='.urlencode($code).
'&client_id='.urlencode($this->appID).
'&client_secret='.urlencode($this->appSecret).
'&redirect_uri='.urlencode($this->callback).
'&scope=offline_access+user.read'.
'&grant_type=authorization_code'
);
$accessToken = json_decode($accessToken, true);
if (isset($accessToken['access_token'])) {
return $accessToken['access_token'];
}
return '';
}
/**
* @param string $accessToken
*
* @return string
*/
public function getUserID(string $accessToken): string
{
$user = $this->getUser($accessToken);
if (isset($user['id'])) {
return $user['id'];
}
return '';
}
/**
* @param string $accessToken
*
* @return string
*/
public function getUserEmail(string $accessToken): string
{
$user = $this->getUser($accessToken);
if (isset($user['userPrincipalName'])) {
return $user['userPrincipalName'];
}
return '';
}
/**
* @param string $accessToken
*
* @return string
*/
public function getUserName(string $accessToken): string
{
$user = $this->getUser($accessToken);
if (isset($user['displayName'])) {
return $user['displayName'];
}
return '';
}
/**
* @param string $accessToken
*
* @return array
*/
protected function getUser(string $accessToken): array
{
if (empty($this->user)) {
$headers[] = 'Authorization: Bearer '. urlencode($accessToken);
$user = $this->request('GET', 'https://graph.microsoft.com/v1.0/me', $headers);
$this->user = json_decode($user, true);
}
return $this->user;
}
}