Revert previous CI hell
This commit is contained in:
parent
f82d61a129
commit
6c004f8f96
46 changed files with 407 additions and 1305 deletions
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use League\Flysystem\FileNotFoundException;
|
||||
|
@ -54,7 +34,7 @@ class AdminController extends Controller
|
|||
$totalSize += $filesystem->getSize($media->storage_path);
|
||||
}
|
||||
|
||||
return view()->render($response, 'dashboard/system.twig', array(
|
||||
return view()->render($response, 'dashboard/system.twig', [
|
||||
'usersCount' => $usersCount,
|
||||
'mediasCount' => $mediasCount,
|
||||
'orphanFilesCount' => $orphanFilesCount,
|
||||
|
@ -63,7 +43,7 @@ class AdminController extends Controller
|
|||
'upload_max_filesize' => ini_get('upload_max_filesize'),
|
||||
'installed_lang' => $this->lang->getList(),
|
||||
'forced_lang' => $request->getAttribute('forced_lang'),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +69,7 @@ class AdminController extends Controller
|
|||
|
||||
$this->database->query('DELETE FROM `uploads` WHERE `user_id` IS NULL');
|
||||
|
||||
$this->session->alert(lang('deleted_orphans', array($deleted)));
|
||||
$this->session->alert(lang('deleted_orphans', [$deleted]));
|
||||
|
||||
return redirect($response, route('system'));
|
||||
}
|
||||
|
@ -112,7 +92,7 @@ class AdminController extends Controller
|
|||
$this->database->query('DELETE FROM `settings` WHERE `key` = \'lang\'');
|
||||
}
|
||||
|
||||
$this->session->alert(lang('lang_set', array(param($request, 'lang'))));
|
||||
$this->session->alert(lang('lang_set', [param($request, 'lang')]));
|
||||
|
||||
return redirect($response, route('system'));
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
@ -49,19 +29,19 @@ class ClientController extends Controller
|
|||
return redirect($response, $request->getHeaderLine('Referer'));
|
||||
}
|
||||
|
||||
$json = array(
|
||||
$json = [
|
||||
'DestinationType' => 'ImageUploader, TextUploader, FileUploader',
|
||||
'RequestURL' => route('upload'),
|
||||
'FileFormName' => 'upload',
|
||||
'Arguments' => array(
|
||||
'Arguments' => [
|
||||
'file' => '$filename$',
|
||||
'text' => '$input$',
|
||||
'token' => $user->token,
|
||||
),
|
||||
],
|
||||
'URL' => '$json:url$',
|
||||
'ThumbnailURL' => '$json:url$/raw',
|
||||
'DeletionURL' => '$json:url$/delete/'.$user->token,
|
||||
);
|
||||
];
|
||||
|
||||
return json($response, $json, 200, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)
|
||||
->withHeader('Content-Disposition', 'attachment;filename="'.$user->username.'-ShareX.sxcu"');
|
||||
|
@ -92,11 +72,11 @@ class ClientController extends Controller
|
|||
|
||||
return view()->render($response->withHeader('Content-Disposition', 'attachment;filename="xbackbone_uploader_'.$user->username.'.sh"'),
|
||||
'scripts/xbackbone_uploader.sh.twig',
|
||||
array(
|
||||
[
|
||||
'username' => $user->username,
|
||||
'upload_url' => route('upload'),
|
||||
'token' => $user->token,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Database\DB;
|
||||
|
@ -86,7 +66,7 @@ abstract class Controller
|
|||
try {
|
||||
$totalSize += $filesystem->getSize($media->storage_path);
|
||||
} catch (FileNotFoundException $e) {
|
||||
$this->logger->error('Error calculating file size', array('exception' => $e));
|
||||
$this->logger->error('Error calculating file size', ['exception' => $e]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Database\Queries\MediaQuery;
|
||||
|
@ -83,12 +63,12 @@ class DashboardController extends Controller
|
|||
return view()->render(
|
||||
$response,
|
||||
($this->session->get('admin', false) && $this->session->get('gallery_view', true)) ? 'dashboard/list.twig' : 'dashboard/grid.twig',
|
||||
array(
|
||||
[
|
||||
'medias' => $query->getMedia(),
|
||||
'next' => $page < floor($query->getPages()),
|
||||
'previous' => $page >= 1,
|
||||
'current_page' => ++$page,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
@ -56,7 +36,7 @@ class LoginController extends Controller
|
|||
public function login(Request $request, Response $response): Response
|
||||
{
|
||||
$username = param($request, 'username');
|
||||
$result = $this->database->query('SELECT `id`, `email`, `username`, `password`,`is_admin`, `active` FROM `users` WHERE `username` = ? OR `email` = ? LIMIT 1', array($username, $username))->fetch();
|
||||
$result = $this->database->query('SELECT `id`, `email`, `username`, `password`,`is_admin`, `active` FROM `users` WHERE `username` = ? OR `email` = ? LIMIT 1', [$username, $username])->fetch();
|
||||
|
||||
if (!$result || !password_verify(param($request, 'password'), $result->password)) {
|
||||
$this->session->alert(lang('bad_login'), 'danger');
|
||||
|
@ -82,7 +62,7 @@ class LoginController extends Controller
|
|||
$this->session->set('admin', $result->is_admin);
|
||||
$this->session->set('used_space', humanFileSize($this->getUsedSpaceByUser($result->id)));
|
||||
|
||||
$this->session->alert(lang('welcome', array($result->username)), 'info');
|
||||
$this->session->alert(lang('welcome', [$result->username]), 'info');
|
||||
$this->logger->info("User $result->username logged in.");
|
||||
|
||||
if (param($request, 'remember') === 'on') {
|
||||
|
@ -90,22 +70,22 @@ class LoginController extends Controller
|
|||
$token = bin2hex(random_bytes(32));
|
||||
$expire = time() + 604800; // a week
|
||||
|
||||
$this->database->query('UPDATE `users` SET `remember_selector`=?, `remember_token`=?, `remember_expire`=? WHERE `id`=?', array(
|
||||
$this->database->query('UPDATE `users` SET `remember_selector`=?, `remember_token`=?, `remember_expire`=? WHERE `id`=?', [
|
||||
$selector,
|
||||
password_hash($token, PASSWORD_DEFAULT),
|
||||
date('Y-m-d\TH:i:s', $expire),
|
||||
$result->id,
|
||||
));
|
||||
]);
|
||||
|
||||
// Workaround for php <= 7.3
|
||||
if (PHP_VERSION_ID < 70300) {
|
||||
setcookie('remember', "{$selector}:{$token}", $expire, '; SameSite=Lax', '', false, true);
|
||||
} else {
|
||||
setcookie('remember', "{$selector}:{$token}", array(
|
||||
setcookie('remember', "{$selector}:{$token}", [
|
||||
'expires' => $expire,
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax',
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use GuzzleHttp\Psr7\Stream;
|
||||
|
@ -42,13 +22,13 @@ class MediaController extends Controller
|
|||
* @param string $mediaCode
|
||||
* @param string|null $token
|
||||
*
|
||||
* @return Response
|
||||
* @throws HttpNotFoundException
|
||||
* @throws \Twig\Error\LoaderError
|
||||
* @throws \Twig\Error\RuntimeError
|
||||
* @throws \Twig\Error\SyntaxError
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function show(Request $request, Response $response, string $userCode, string $mediaCode, string $token = null): Response
|
||||
{
|
||||
|
@ -86,12 +66,12 @@ class MediaController extends Controller
|
|||
throw new HttpNotFoundException($request);
|
||||
}
|
||||
|
||||
return view()->render($response, 'upload/public.twig', array(
|
||||
return view()->render($response, 'upload/public.twig', [
|
||||
'delete_token' => $token,
|
||||
'media' => $media,
|
||||
'type' => $type,
|
||||
'url' => urlFor("/{$userCode}/{$mediaCode}"),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,10 +79,10 @@ class MediaController extends Controller
|
|||
* @param Response $response
|
||||
* @param int $id
|
||||
*
|
||||
* @throws HttpNotFoundException
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
* @throws HttpNotFoundException
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public function getRawById(Request $request, Response $response, int $id): Response
|
||||
{
|
||||
|
@ -122,11 +102,11 @@ class MediaController extends Controller
|
|||
* @param string $mediaCode
|
||||
* @param string|null $ext
|
||||
*
|
||||
* @return Response
|
||||
* @throws HttpBadRequestException
|
||||
* @throws HttpNotFoundException
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public function getRaw(Request $request, Response $response, string $userCode, string $mediaCode, ?string $ext = null): Response
|
||||
{
|
||||
|
@ -149,10 +129,10 @@ class MediaController extends Controller
|
|||
* @param string $userCode
|
||||
* @param string $mediaCode
|
||||
*
|
||||
* @throws HttpNotFoundException
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
* @throws HttpNotFoundException
|
||||
*
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
public function download(Request $request, Response $response, string $userCode, string $mediaCode): Response
|
||||
{
|
||||
|
@ -170,23 +150,23 @@ class MediaController extends Controller
|
|||
* @param Response $response
|
||||
* @param int $id
|
||||
*
|
||||
* @return Response
|
||||
* @throws HttpNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function togglePublish(Request $request, Response $response, int $id): Response
|
||||
{
|
||||
if ($this->session->get('admin')) {
|
||||
$media = $this->database->query('SELECT * FROM `uploads` WHERE `id` = ? LIMIT 1', $id)->fetch();
|
||||
} else {
|
||||
$media = $this->database->query('SELECT * FROM `uploads` WHERE `id` = ? AND `user_id` = ? LIMIT 1', array($id, $this->session->get('user_id')))->fetch();
|
||||
$media = $this->database->query('SELECT * FROM `uploads` WHERE `id` = ? AND `user_id` = ? LIMIT 1', [$id, $this->session->get('user_id')])->fetch();
|
||||
}
|
||||
|
||||
if (!$media) {
|
||||
throw new HttpNotFoundException($request);
|
||||
}
|
||||
|
||||
$this->database->query('UPDATE `uploads` SET `published`=? WHERE `id`=?', array($media->published ? 0 : 1, $media->id));
|
||||
$this->database->query('UPDATE `uploads` SET `published`=? WHERE `id`=?', [$media->published ? 0 : 1, $media->id]);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -196,10 +176,10 @@ class MediaController extends Controller
|
|||
* @param Response $response
|
||||
* @param int $id
|
||||
*
|
||||
* @throws HttpUnauthorizedException
|
||||
* @throws HttpNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
* @throws HttpUnauthorizedException
|
||||
*
|
||||
* @throws HttpNotFoundException
|
||||
*/
|
||||
public function delete(Request $request, Response $response, int $id): Response
|
||||
{
|
||||
|
@ -211,7 +191,7 @@ class MediaController extends Controller
|
|||
|
||||
if ($this->session->get('admin', false) || $media->user_id === $this->session->get('user_id')) {
|
||||
$this->deleteMedia($request, $media->storage_path, $id);
|
||||
$this->logger->info('User '.$this->session->get('username').' deleted a media.', array($id));
|
||||
$this->logger->info('User '.$this->session->get('username').' deleted a media.', [$id]);
|
||||
$this->session->set('used_space', humanFileSize($this->getUsedSpaceByUser($this->session->get('user_id'))));
|
||||
} else {
|
||||
throw new HttpUnauthorizedException($request);
|
||||
|
@ -231,10 +211,10 @@ class MediaController extends Controller
|
|||
* @param string $mediaCode
|
||||
* @param string $token
|
||||
*
|
||||
* @throws HttpUnauthorizedException
|
||||
* @throws HttpNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
* @throws HttpUnauthorizedException
|
||||
*
|
||||
* @throws HttpNotFoundException
|
||||
*/
|
||||
public function deleteByToken(Request $request, Response $response, string $userCode, string $mediaCode, string $token): Response
|
||||
{
|
||||
|
@ -260,7 +240,7 @@ class MediaController extends Controller
|
|||
|
||||
if ($this->session->get('admin', false) || $user->id === $media->user_id) {
|
||||
$this->deleteMedia($request, $media->storage_path, $media->mediaId);
|
||||
$this->logger->info('User '.$user->username.' deleted a media via token.', array($media->mediaId));
|
||||
$this->logger->info('User '.$user->username.' deleted a media via token.', [$media->mediaId]);
|
||||
} else {
|
||||
throw new HttpUnauthorizedException($request);
|
||||
}
|
||||
|
@ -296,10 +276,10 @@ class MediaController extends Controller
|
|||
{
|
||||
$mediaCode = pathinfo($mediaCode)['filename'];
|
||||
|
||||
$media = $this->database->query('SELECT `uploads`.*, `users`.*, `users`.`id` AS `userId`, `uploads`.`id` AS `mediaId` FROM `uploads` INNER JOIN `users` ON `uploads`.`user_id` = `users`.`id` WHERE `user_code` = ? AND `uploads`.`code` = ? LIMIT 1', array(
|
||||
$media = $this->database->query('SELECT `uploads`.*, `users`.*, `users`.`id` AS `userId`, `uploads`.`id` AS `mediaId` FROM `uploads` INNER JOIN `users` ON `uploads`.`user_id` = `users`.`id` WHERE `user_code` = ? AND `uploads`.`code` = ? LIMIT 1', [
|
||||
$userCode,
|
||||
$mediaCode,
|
||||
))->fetch();
|
||||
])->fetch();
|
||||
|
||||
return $media;
|
||||
}
|
||||
|
@ -311,9 +291,9 @@ class MediaController extends Controller
|
|||
* @param $media
|
||||
* @param string $disposition
|
||||
*
|
||||
* @return Response
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
protected function streamMedia(Request $request, Response $response, Filesystem $storage, $media, string $disposition = 'inline'): Response
|
||||
{
|
||||
|
@ -325,7 +305,7 @@ class MediaController extends Controller
|
|||
} else {
|
||||
$stream = new Stream($storage->readStream($media->storage_path));
|
||||
|
||||
if (!in_array(explode('/', $mime)[0], array('image', 'video', 'audio')) || $disposition === 'attachment') {
|
||||
if (!in_array(explode('/', $mime)[0], ['image', 'video', 'audio']) || $disposition === 'attachment') {
|
||||
return $response->withHeader('Content-Type', $mime)
|
||||
->withHeader('Content-Disposition', $disposition.'; filename="'.$media->filename.'"')
|
||||
->withHeader('Content-Length', $stream->getSize())
|
||||
|
@ -350,9 +330,9 @@ class MediaController extends Controller
|
|||
* @param null $height
|
||||
* @param string $disposition
|
||||
*
|
||||
* @return Response
|
||||
* @throws FileNotFoundException
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
protected function makeThumbnail(Filesystem $storage, $media, $width = null, $height = null, string $disposition = 'inline')
|
||||
{
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
@ -36,7 +16,7 @@ class ThemeController extends Controller
|
|||
{
|
||||
$apiJson = json_decode(file_get_contents('https://bootswatch.com/api/4.json'));
|
||||
|
||||
$out = array();
|
||||
$out = [];
|
||||
|
||||
$out['Default - Bootstrap 4 default theme'] = 'https://bootswatch.com/_vendor/bootstrap/dist/css/bootstrap.min.css';
|
||||
foreach ($apiJson->themes as $theme) {
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
@ -120,11 +100,11 @@ class UpgradeController extends Controller
|
|||
*/
|
||||
public function checkForUpdates(Request $request, Response $response): Response
|
||||
{
|
||||
$jsonResponse = array(
|
||||
$jsonResponse = [
|
||||
'status' => null,
|
||||
'message' => null,
|
||||
'upgrade' => false,
|
||||
);
|
||||
];
|
||||
|
||||
$acceptPrerelease = param($request, 'prerelease', 'false') === 'true';
|
||||
|
||||
|
@ -155,15 +135,15 @@ class UpgradeController extends Controller
|
|||
|
||||
protected function getApiJson()
|
||||
{
|
||||
$opts = array(
|
||||
'http' => array(
|
||||
$opts = [
|
||||
'http' => [
|
||||
'method' => 'GET',
|
||||
'header' => array(
|
||||
'header' => [
|
||||
'User-Agent: XBackBone-App',
|
||||
'Accept: application/vnd.github.v3+json',
|
||||
),
|
||||
),
|
||||
);
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$data = @file_get_contents(self::GITHUB_SOURCE_API, false, stream_context_create($opts));
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use League\Flysystem\FileExistsException;
|
||||
|
@ -32,11 +12,11 @@ class UploadController extends Controller
|
|||
* @param Request $request
|
||||
* @param Response $response
|
||||
*
|
||||
* @return Response
|
||||
* @throws \Twig\Error\RuntimeError
|
||||
* @throws \Twig\Error\SyntaxError
|
||||
* @throws \Twig\Error\LoaderError
|
||||
*
|
||||
* @return Response
|
||||
* @throws \Twig\Error\LoaderError
|
||||
*/
|
||||
public function webUpload(Request $request, Response $response): Response
|
||||
{
|
||||
|
@ -48,25 +28,25 @@ class UploadController extends Controller
|
|||
return redirect($response, $request->getHeaderLine('Referer'));
|
||||
}
|
||||
|
||||
return view()->render($response, 'upload/web.twig', array(
|
||||
return view()->render($response, 'upload/web.twig', [
|
||||
'user' => $user,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Response $response
|
||||
*
|
||||
* @return Response
|
||||
* @throws FileExistsException
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function upload(Request $request, Response $response): Response
|
||||
{
|
||||
$json = array(
|
||||
$json = [
|
||||
'message' => null,
|
||||
'version' => PLATFORM_VERSION,
|
||||
);
|
||||
];
|
||||
|
||||
if ($this->config['maintenance']) {
|
||||
$json['message'] = 'Endpoint under maintenance.';
|
||||
|
@ -125,17 +105,17 @@ class UploadController extends Controller
|
|||
|
||||
$this->storage->writeStream($storagePath, $file->getStream()->detach());
|
||||
|
||||
$this->database->query('INSERT INTO `uploads`(`user_id`, `code`, `filename`, `storage_path`) VALUES (?, ?, ?, ?)', array(
|
||||
$this->database->query('INSERT INTO `uploads`(`user_id`, `code`, `filename`, `storage_path`) VALUES (?, ?, ?, ?)', [
|
||||
$user->id,
|
||||
$code,
|
||||
$file->getClientFilename(),
|
||||
$storagePath,
|
||||
));
|
||||
]);
|
||||
|
||||
$json['message'] = 'OK.';
|
||||
$json['url'] = urlFor("/{$user->user_code}/{$code}.{$fileInfo['extension']}");
|
||||
|
||||
$this->logger->info("User $user->username uploaded new media.", array($this->database->getPdo()->lastInsertId()));
|
||||
$this->logger->info("User $user->username uploaded new media.", [$this->database->getPdo()->lastInsertId()]);
|
||||
|
||||
return json($response, $json, 201);
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
@ -45,18 +25,18 @@ class UserController extends Controller
|
|||
{
|
||||
$page = max(0, --$page);
|
||||
|
||||
$users = $this->database->query('SELECT * FROM `users` LIMIT ? OFFSET ?', array(self::PER_PAGE, $page * self::PER_PAGE))->fetchAll();
|
||||
$users = $this->database->query('SELECT * FROM `users` LIMIT ? OFFSET ?', [self::PER_PAGE, $page * self::PER_PAGE])->fetchAll();
|
||||
|
||||
$pages = $this->database->query('SELECT COUNT(*) AS `count` FROM `users`')->fetch()->count / self::PER_PAGE;
|
||||
|
||||
return view()->render($response,
|
||||
'user/index.twig',
|
||||
array(
|
||||
[
|
||||
'users' => $users,
|
||||
'next' => $page < floor($pages),
|
||||
'previous' => $page >= 1,
|
||||
'current_page' => ++$page,
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -118,7 +98,7 @@ class UserController extends Controller
|
|||
|
||||
$token = $this->generateNewToken();
|
||||
|
||||
$this->database->query('INSERT INTO `users`(`email`, `username`, `password`, `is_admin`, `active`, `user_code`, `token`) VALUES (?, ?, ?, ?, ?, ?, ?)', array(
|
||||
$this->database->query('INSERT INTO `users`(`email`, `username`, `password`, `is_admin`, `active`, `user_code`, `token`) VALUES (?, ?, ?, ?, ?, ?, ?)', [
|
||||
param($request, 'email'),
|
||||
param($request, 'username'),
|
||||
password_hash(param($request, 'password'), PASSWORD_DEFAULT),
|
||||
|
@ -126,10 +106,10 @@ class UserController extends Controller
|
|||
param($request, 'is_active') !== null ? 1 : 0,
|
||||
$userCode,
|
||||
$token,
|
||||
));
|
||||
]);
|
||||
|
||||
$this->session->alert(lang('user_created', array(param($request, 'username'))), 'success');
|
||||
$this->logger->info('User '.$this->session->get('username').' created a new user.', array(array_diff_key($request->getParsedBody(), array_flip(array('password')))));
|
||||
$this->session->alert(lang('user_created', [param($request, 'username')]), 'success');
|
||||
$this->logger->info('User '.$this->session->get('username').' created a new user.', [array_diff_key($request->getParsedBody(), array_flip(['password']))]);
|
||||
|
||||
return redirect($response, route('user.index'));
|
||||
}
|
||||
|
@ -151,10 +131,10 @@ class UserController extends Controller
|
|||
{
|
||||
$user = $this->getUser($request, $id, false);
|
||||
|
||||
return view()->render($response, 'user/edit.twig', array(
|
||||
return view()->render($response, 'user/edit.twig', [
|
||||
'profile' => false,
|
||||
'user' => $user,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,57 +154,57 @@ class UserController extends Controller
|
|||
if (param($request, 'email') === null) {
|
||||
$this->session->alert(lang('email_required'), 'danger');
|
||||
|
||||
return redirect($response, route('user.edit', array('id' => $id)));
|
||||
return redirect($response, route('user.edit', ['id' => $id]));
|
||||
}
|
||||
|
||||
if ($this->database->query('SELECT COUNT(*) AS `count` FROM `users` WHERE `email` = ? AND `email` <> ?', array(param($request, 'email'), $user->email))->fetch()->count > 0) {
|
||||
if ($this->database->query('SELECT COUNT(*) AS `count` FROM `users` WHERE `email` = ? AND `email` <> ?', [param($request, 'email'), $user->email])->fetch()->count > 0) {
|
||||
$this->session->alert(lang('email_taken'), 'danger');
|
||||
|
||||
return redirect($response, route('user.edit', array('id' => $id)));
|
||||
return redirect($response, route('user.edit', ['id' => $id]));
|
||||
}
|
||||
|
||||
if (param($request, 'username') === null) {
|
||||
$this->session->alert(lang('username_required'), 'danger');
|
||||
|
||||
return redirect($response, route('user.edit', array('id' => $id)));
|
||||
return redirect($response, route('user.edit', ['id' => $id]));
|
||||
}
|
||||
|
||||
if ($this->database->query('SELECT COUNT(*) AS `count` FROM `users` WHERE `username` = ? AND `username` <> ?', array(param($request, 'username'), $user->username))->fetch()->count > 0) {
|
||||
if ($this->database->query('SELECT COUNT(*) AS `count` FROM `users` WHERE `username` = ? AND `username` <> ?', [param($request, 'username'), $user->username])->fetch()->count > 0) {
|
||||
$this->session->alert(lang('username_taken'), 'danger');
|
||||
|
||||
return redirect($response, route('user.edit', array('id' => $id)));
|
||||
return redirect($response, route('user.edit', ['id' => $id]));
|
||||
}
|
||||
|
||||
if ($user->id === $this->session->get('user_id') && param($request, 'is_admin') === null) {
|
||||
$this->session->alert(lang('cannot_demote'), 'danger');
|
||||
|
||||
return redirect($response, route('user.edit', array('id' => $id)));
|
||||
return redirect($response, route('user.edit', ['id' => $id]));
|
||||
}
|
||||
|
||||
if (param($request, 'password') !== null && !empty(param($request, 'password'))) {
|
||||
$this->database->query('UPDATE `users` SET `email`=?, `username`=?, `password`=?, `is_admin`=?, `active`=? WHERE `id` = ?', array(
|
||||
$this->database->query('UPDATE `users` SET `email`=?, `username`=?, `password`=?, `is_admin`=?, `active`=? WHERE `id` = ?', [
|
||||
param($request, 'email'),
|
||||
param($request, 'username'),
|
||||
password_hash(param($request, 'password'), PASSWORD_DEFAULT),
|
||||
param($request, 'is_admin') !== null ? 1 : 0,
|
||||
param($request, 'is_active') !== null ? 1 : 0,
|
||||
$user->id,
|
||||
));
|
||||
]);
|
||||
} else {
|
||||
$this->database->query('UPDATE `users` SET `email`=?, `username`=?, `is_admin`=?, `active`=? WHERE `id` = ?', array(
|
||||
$this->database->query('UPDATE `users` SET `email`=?, `username`=?, `is_admin`=?, `active`=? WHERE `id` = ?', [
|
||||
param($request, 'email'),
|
||||
param($request, 'username'),
|
||||
param($request, 'is_admin') !== null ? 1 : 0,
|
||||
param($request, 'is_active') !== null ? 1 : 0,
|
||||
$user->id,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$this->session->alert(lang('user_updated', array(param($request, 'username'))), 'success');
|
||||
$this->logger->info('User '.$this->session->get('username')." updated $user->id.", array(
|
||||
array_diff_key((array) $user, array_flip(array('password'))),
|
||||
array_diff_key($request->getParsedBody(), array_flip(array('password'))),
|
||||
));
|
||||
$this->session->alert(lang('user_updated', [param($request, 'username')]), 'success');
|
||||
$this->logger->info('User '.$this->session->get('username')." updated $user->id.", [
|
||||
array_diff_key((array) $user, array_flip(['password'])),
|
||||
array_diff_key($request->getParsedBody(), array_flip(['password'])),
|
||||
]);
|
||||
|
||||
return redirect($response, route('user.index'));
|
||||
}
|
||||
|
@ -273,10 +253,10 @@ class UserController extends Controller
|
|||
{
|
||||
$user = $this->getUser($request, $this->session->get('user_id'), true);
|
||||
|
||||
return view()->render($response, 'user/edit.twig', array(
|
||||
return view()->render($response, 'user/edit.twig', [
|
||||
'profile' => true,
|
||||
'user' => $user,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -299,23 +279,23 @@ class UserController extends Controller
|
|||
|
||||
$user = $this->getUser($request, $id, true);
|
||||
|
||||
if ($this->database->query('SELECT COUNT(*) AS `count` FROM `users` WHERE `email` = ? AND `email` <> ?', array(param($request, 'email'), $user->email))->fetch()->count > 0) {
|
||||
if ($this->database->query('SELECT COUNT(*) AS `count` FROM `users` WHERE `email` = ? AND `email` <> ?', [param($request, 'email'), $user->email])->fetch()->count > 0) {
|
||||
$this->session->alert(lang('email_taken'), 'danger');
|
||||
|
||||
return redirect($response, route('profile'));
|
||||
}
|
||||
|
||||
if (param($request, 'password') !== null && !empty(param($request, 'password'))) {
|
||||
$this->database->query('UPDATE `users` SET `email`=?, `password`=? WHERE `id` = ?', array(
|
||||
$this->database->query('UPDATE `users` SET `email`=?, `password`=? WHERE `id` = ?', [
|
||||
param($request, 'email'),
|
||||
password_hash(param($request, 'password'), PASSWORD_DEFAULT),
|
||||
$user->id,
|
||||
));
|
||||
]);
|
||||
} else {
|
||||
$this->database->query('UPDATE `users` SET `email`=? WHERE `id` = ?', array(
|
||||
$this->database->query('UPDATE `users` SET `email`=? WHERE `id` = ?', [
|
||||
param($request, 'email'),
|
||||
$user->id,
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
$this->session->alert(lang('profile_updated'), 'success');
|
||||
|
@ -340,10 +320,10 @@ class UserController extends Controller
|
|||
|
||||
$token = $this->generateNewToken();
|
||||
|
||||
$this->database->query('UPDATE `users` SET `token`=? WHERE `id` = ?', array(
|
||||
$this->database->query('UPDATE `users` SET `token`=? WHERE `id` = ?', [
|
||||
$token,
|
||||
$user->id,
|
||||
));
|
||||
]);
|
||||
|
||||
$this->logger->info('User '.$this->session->get('username')." refreshed token of user $user->id.");
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Database;
|
||||
|
||||
use PDO;
|
||||
|
@ -47,10 +27,10 @@ class DB
|
|||
}
|
||||
}
|
||||
|
||||
public function query(string $query, $parameters = array())
|
||||
public function query(string $query, $parameters = [])
|
||||
{
|
||||
if (!is_array($parameters)) {
|
||||
$parameters = array($parameters);
|
||||
$parameters = [$parameters];
|
||||
}
|
||||
$query = $this->pdo->prepare($query);
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Database;
|
||||
|
||||
use PDOException;
|
||||
|
@ -99,13 +79,13 @@ class Migrator
|
|||
try {
|
||||
$this->db->getPdo()->exec($sql);
|
||||
if (!$exists) {
|
||||
$this->db->query('INSERT INTO `migrations` VALUES (?,?)', array(basename($file), 1));
|
||||
$this->db->query('INSERT INTO `migrations` VALUES (?,?)', [basename($file), 1]);
|
||||
} else {
|
||||
$this->db->query('UPDATE `migrations` SET `migrated`=? WHERE `name`=?', array(1, basename($file)));
|
||||
$this->db->query('UPDATE `migrations` SET `migrated`=? WHERE `name`=?', [1, basename($file)]);
|
||||
}
|
||||
} catch (PDOException $exception) {
|
||||
if (!$exists) {
|
||||
$this->db->query('INSERT INTO `migrations` VALUES (?,?)', array(basename($file), 0));
|
||||
$this->db->query('INSERT INTO `migrations` VALUES (?,?)', [basename($file), 0]);
|
||||
}
|
||||
|
||||
throw $exception;
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Database\Queries;
|
||||
|
||||
use App\Database\DB;
|
||||
|
@ -132,7 +112,7 @@ class MediaQuery
|
|||
}
|
||||
|
||||
$orderAndSearch = '';
|
||||
$params = array();
|
||||
$params = [];
|
||||
|
||||
if ($this->text !== null) {
|
||||
$orderAndSearch = $this->isAdmin ? 'WHERE `uploads`.`filename` LIKE ? ' : 'AND `uploads`.`filename` LIKE ? ';
|
||||
|
@ -153,11 +133,11 @@ class MediaQuery
|
|||
$queryMedia = sprintf($queryMedia, $orderAndSearch);
|
||||
|
||||
if ($this->isAdmin) {
|
||||
$this->media = $this->db->query($queryMedia, array_merge($params, array(self::PER_PAGE_ADMIN, $page * self::PER_PAGE_ADMIN)))->fetchAll();
|
||||
$this->media = $this->db->query($queryMedia, array_merge($params, [self::PER_PAGE_ADMIN, $page * self::PER_PAGE_ADMIN]))->fetchAll();
|
||||
$this->pages = $this->db->query($queryPages, $params)->fetch()->count / self::PER_PAGE_ADMIN;
|
||||
} else {
|
||||
$this->media = $this->db->query($queryMedia, array_merge(array($this->userId), $params, array(self::PER_PAGE, $page * self::PER_PAGE)))->fetchAll();
|
||||
$this->pages = $this->db->query($queryPages, array_merge(array($this->userId), $params))->fetch()->count / self::PER_PAGE;
|
||||
$this->media = $this->db->query($queryMedia, array_merge([$this->userId], $params, [self::PER_PAGE, $page * self::PER_PAGE]))->fetchAll();
|
||||
$this->pages = $this->db->query($queryPages, array_merge([$this->userId], $params))->fetch()->count / self::PER_PAGE;
|
||||
}
|
||||
|
||||
foreach ($this->media as $media) {
|
||||
|
@ -186,7 +166,7 @@ class MediaQuery
|
|||
$offset = $page * self::PER_PAGE_ADMIN;
|
||||
$limit = self::PER_PAGE_ADMIN;
|
||||
} else {
|
||||
$userCode = $this->db->query('SELECT `user_code` FROM `users` WHERE `id` = ?', array($this->userId))->fetch()->user_code;
|
||||
$userCode = $this->db->query('SELECT `user_code` FROM `users` WHERE `id` = ?', [$this->userId])->fetch()->user_code;
|
||||
$files = $this->storage->listFiles($userCode);
|
||||
$this->pages = count($files) / self::PER_PAGE;
|
||||
|
||||
|
@ -198,9 +178,9 @@ class MediaQuery
|
|||
|
||||
if ($this->text !== null) {
|
||||
if ($this->isAdmin) {
|
||||
$medias = $this->db->query('SELECT `uploads`.*, `users`.`user_code`, `users`.`username` FROM `uploads` LEFT JOIN `users` ON `uploads`.`user_id` = `users`.`id` WHERE `uploads`.`filename` LIKE ? ', array('%'.htmlentities($this->text).'%'))->fetchAll();
|
||||
$medias = $this->db->query('SELECT `uploads`.*, `users`.`user_code`, `users`.`username` FROM `uploads` LEFT JOIN `users` ON `uploads`.`user_id` = `users`.`id` WHERE `uploads`.`filename` LIKE ? ', ['%'.htmlentities($this->text).'%'])->fetchAll();
|
||||
} else {
|
||||
$medias = $this->db->query('SELECT `uploads`.*, `users`.`user_code`, `users`.`username` FROM `uploads` LEFT JOIN `users` ON `uploads`.`user_id` = `users`.`id` WHERE `user_id` = ? AND `uploads`.`filename` LIKE ? ', array($this->userId, '%'.htmlentities($this->text).'%'))->fetchAll();
|
||||
$medias = $this->db->query('SELECT `uploads`.*, `users`.`user_code`, `users`.`username` FROM `uploads` LEFT JOIN `users` ON `uploads`.`user_id` = `users`.`id` WHERE `user_id` = ? AND `uploads`.`filename` LIKE ? ', [$this->userId, '%'.htmlentities($this->text).'%'])->fetchAll();
|
||||
}
|
||||
|
||||
$paths = array_column($files, 'path');
|
||||
|
@ -216,7 +196,7 @@ class MediaQuery
|
|||
$paths[$media->storage_path] = $media;
|
||||
}
|
||||
|
||||
$this->media = array();
|
||||
$this->media = [];
|
||||
foreach ($files as $file) {
|
||||
$media = $paths[$file['path']];
|
||||
if (!is_object($media)) {
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Exception\Handlers;
|
||||
|
||||
use Slim\Handlers\ErrorHandler;
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Exception\Handlers\Renderers;
|
||||
|
||||
use App\Exceptions\UnderMaintenanceException;
|
||||
|
@ -65,6 +45,6 @@ class HtmlErrorRenderer implements ErrorRendererInterface
|
|||
return view()->string('errors/400.twig');
|
||||
}
|
||||
|
||||
return view()->string('errors/500.twig', array('exception' => $displayErrorDetails ? $exception : null));
|
||||
return view()->string('errors/500.twig', ['exception' => $displayErrorDetails ? $exception : null]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Slim\Exception\HttpSpecializedException;
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Factories;
|
||||
|
||||
use App\Web\View;
|
||||
|
@ -36,12 +16,12 @@ class ViewFactory
|
|||
$config = $container->get('config');
|
||||
$loader = new FilesystemLoader(BASE_DIR.'resources/templates');
|
||||
|
||||
$twig = new Environment($loader, array(
|
||||
$twig = new Environment($loader, [
|
||||
'cache' => BASE_DIR.'resources/cache/twig',
|
||||
'autoescape' => 'html',
|
||||
'debug' => $config['debug'],
|
||||
'auto_reload' => $config['debug'],
|
||||
));
|
||||
]);
|
||||
|
||||
$request = ServerRequestCreatorFactory::determineServerRequestCreator()->createServerRequestFromGlobals();
|
||||
|
||||
|
@ -67,14 +47,14 @@ class ViewFactory
|
|||
public static function createInstallerInstance(Container $container)
|
||||
{
|
||||
$config = $container->get('config');
|
||||
$loader = new FilesystemLoader(array(BASE_DIR.'install/templates', BASE_DIR.'resources/templates'));
|
||||
$loader = new FilesystemLoader([BASE_DIR.'install/templates', BASE_DIR.'resources/templates']);
|
||||
|
||||
$twig = new Environment($loader, array(
|
||||
$twig = new Environment($loader, [
|
||||
'cache' => false,
|
||||
'autoescape' => 'html',
|
||||
'debug' => $config['debug'],
|
||||
'auto_reload' => $config['debug'],
|
||||
));
|
||||
]);
|
||||
|
||||
$request = ServerRequestCreatorFactory::determineServerRequestCreator()->createServerRequestFromGlobals();
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
|
@ -40,7 +20,7 @@ class AdminMiddleware extends Middleware
|
|||
*/
|
||||
public function __invoke(Request $request, RequestHandler $handler): ResponseInterface
|
||||
{
|
||||
if (!$this->database->query('SELECT `id`, `is_admin` FROM `users` WHERE `id` = ? LIMIT 1', array($this->session->get('user_id')))->fetch()->is_admin) {
|
||||
if (!$this->database->query('SELECT `id`, `is_admin` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->is_admin) {
|
||||
$this->session->set('admin', false);
|
||||
|
||||
throw new HttpUnauthorizedException($request);
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
|
@ -43,7 +23,7 @@ class AuthMiddleware extends Middleware
|
|||
return redirect(new Response(), route('login.show'));
|
||||
}
|
||||
|
||||
if (!$this->database->query('SELECT `id`, `active` FROM `users` WHERE `id` = ? LIMIT 1', array($this->session->get('user_id')))->fetch()->active) {
|
||||
if (!$this->database->query('SELECT `id`, `active` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->active) {
|
||||
$this->session->alert(lang('account_disabled'), 'danger');
|
||||
$this->session->set('logged', false);
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use App\Exceptions\UnderMaintenanceException;
|
||||
|
@ -39,7 +19,7 @@ class CheckForMaintenanceMiddleware extends Middleware
|
|||
*/
|
||||
public function __invoke(Request $request, RequestHandler $handler): Response
|
||||
{
|
||||
if (isset($this->config['maintenance']) && $this->config['maintenance'] && !$this->database->query('SELECT `id`, `is_admin` FROM `users` WHERE `id` = ? LIMIT 1', array($this->session->get('user_id')))->fetch()->is_admin) {
|
||||
if (isset($this->config['maintenance']) && $this->config['maintenance'] && !$this->database->query('SELECT `id`, `is_admin` FROM `users` WHERE `id` = ? LIMIT 1', [$this->session->get('user_id')])->fetch()->is_admin) {
|
||||
throw new UnderMaintenanceException($request);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use App\Controllers\Controller;
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
@ -40,7 +20,7 @@ class RememberMiddleware extends Middleware
|
|||
list($selector, $token) = explode(':', $request->getCookieParams()['remember']);
|
||||
|
||||
$result = $this->database->query('SELECT `id`, `email`, `username`,`is_admin`, `active`, `remember_token` FROM `users` WHERE `remember_selector` = ? AND `remember_expire` > ? LIMIT 1',
|
||||
array($selector, date('Y-m-d\TH:i:s', time()))
|
||||
[$selector, date('Y-m-d\TH:i:s', time())]
|
||||
)->fetch();
|
||||
|
||||
if ($result && password_verify($token, $result->remember_token) && $result->active) {
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Web;
|
||||
|
||||
class Lang
|
||||
|
@ -37,7 +17,7 @@ class Lang
|
|||
protected static $instance;
|
||||
|
||||
/** @var array */
|
||||
protected $cache = array();
|
||||
protected $cache = [];
|
||||
|
||||
/**
|
||||
* @return Lang
|
||||
|
@ -105,7 +85,7 @@ class Lang
|
|||
*/
|
||||
public static function getList()
|
||||
{
|
||||
$languages = array();
|
||||
$languages = [];
|
||||
|
||||
$default = count(include self::$langPath.self::DEFAULT_LANG.'.lang.php') - 1;
|
||||
|
||||
|
@ -131,7 +111,7 @@ class Lang
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get($key, $args = array()): string
|
||||
public function get($key, $args = []): string
|
||||
{
|
||||
return $this->getString($key, self::$lang, $args);
|
||||
}
|
||||
|
@ -158,7 +138,7 @@ class Lang
|
|||
$transDict = include self::$langPath.$redLang.'.lang.php';
|
||||
$this->cache[$lang] = $transDict;
|
||||
} else {
|
||||
$transDict = array();
|
||||
$transDict = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Web;
|
||||
|
||||
use Exception;
|
||||
|
@ -53,13 +33,13 @@ class Session
|
|||
);
|
||||
}
|
||||
|
||||
$started = @session_start(array(
|
||||
$started = @session_start([
|
||||
'name' => $name,
|
||||
'save_path' => $path,
|
||||
'cookie_httponly' => true,
|
||||
'gc_probability' => 25,
|
||||
'cookie_samesite' => 'Lax', // works only for php >= 7.3
|
||||
));
|
||||
]);
|
||||
|
||||
if (!$started) {
|
||||
throw new Exception("Cannot start the HTTP session. That the session path '{$path}' is writable and your PHP settings.");
|
||||
|
@ -90,7 +70,7 @@ class Session
|
|||
*/
|
||||
public function clear(): void
|
||||
{
|
||||
$_SESSION = array();
|
||||
$_SESSION = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,7 +127,7 @@ class Session
|
|||
*/
|
||||
public function alert($message, string $type = 'info'): void
|
||||
{
|
||||
$_SESSION['_flash'][] = array($type => $message);
|
||||
$_SESSION['_flash'][] = [$type => $message];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,7 +138,7 @@ class Session
|
|||
public function getAlert(): ?array
|
||||
{
|
||||
$flash = self::get('_flash');
|
||||
self::set('_flash', array());
|
||||
self::set('_flash', []);
|
||||
|
||||
return $flash;
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
namespace App\Web;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
|
@ -56,7 +36,7 @@ class View
|
|||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function render(Response $response, string $view, ?array $parameters = array())
|
||||
public function render(Response $response, string $view, ?array $parameters = [])
|
||||
{
|
||||
$body = $this->twig->render($view, $parameters);
|
||||
$response->getBody()->write($body);
|
||||
|
@ -74,7 +54,7 @@ class View
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function string(string $view, ?array $parameters = array())
|
||||
public function string(string $view, ?array $parameters = [])
|
||||
{
|
||||
return $this->twig->render($view, $parameters);
|
||||
}
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Slim\Factory\ServerRequestCreatorFactory;
|
||||
|
@ -42,7 +22,7 @@ if (!function_exists('humanFileSize')) {
|
|||
for ($i = 0; ($size / 1024) > 0.9; $i++, $size /= 1024) {
|
||||
}
|
||||
|
||||
return round($size, $precision).' '.array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB')[$i];
|
||||
return round($size, $precision).' '.['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'][$i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +55,7 @@ if (!function_exists('isDisplayableImage')) {
|
|||
*/
|
||||
function isDisplayableImage(string $mime): bool
|
||||
{
|
||||
return in_array($mime, array(
|
||||
return in_array($mime, [
|
||||
'image/apng',
|
||||
'image/bmp',
|
||||
'image/gif',
|
||||
|
@ -86,7 +66,7 @@ if (!function_exists('isDisplayableImage')) {
|
|||
'image/svg+xml',
|
||||
'image/tiff',
|
||||
'image/webp',
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +221,7 @@ if (!function_exists('route')) {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function route(string $path, array $args = array(), string $append = ''): string
|
||||
function route(string $path, array $args = [], string $append = ''): string
|
||||
{
|
||||
global $app;
|
||||
$uri = $app->getRouteCollector()->getRouteParser()->relativeUrlFor($path, $args);
|
||||
|
@ -304,7 +284,7 @@ if (!function_exists('lang')) {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function lang(string $key, $args = array()): string
|
||||
function lang(string $key, $args = []): string
|
||||
{
|
||||
return resolve('lang')->get($key, $args);
|
||||
}
|
||||
|
@ -318,7 +298,7 @@ if (!function_exists('isBot')) {
|
|||
*/
|
||||
function isBot(string $userAgent)
|
||||
{
|
||||
$bots = array(
|
||||
$bots = [
|
||||
'TelegramBot',
|
||||
'facebookexternalhit/',
|
||||
'Discordbot/',
|
||||
|
@ -326,7 +306,7 @@ if (!function_exists('isBot')) {
|
|||
'Facebot',
|
||||
'curl/',
|
||||
'wget/',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($bots as $bot) {
|
||||
if (stripos($userAgent, $bot) !== false) {
|
||||
|
@ -348,7 +328,7 @@ if (!function_exists('mime2font')) {
|
|||
*/
|
||||
function mime2font($mime)
|
||||
{
|
||||
$classes = array(
|
||||
$classes = [
|
||||
'image' => 'fa-file-image',
|
||||
'audio' => 'fa-file-audio',
|
||||
'video' => 'fa-file-video',
|
||||
|
@ -370,7 +350,7 @@ if (!function_exists('mime2font')) {
|
|||
'application/gzip' => 'fa-file-archive',
|
||||
'application/zip' => 'fa-file-archive',
|
||||
'application/octet-stream' => 'fa-file-alt',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($classes as $fullMime => $class) {
|
||||
if (strpos($mime, $fullMime) === 0) {
|
||||
|
@ -405,7 +385,7 @@ if (!function_exists('queryParams')) {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function queryParams(array $replace = array())
|
||||
function queryParams(array $replace = [])
|
||||
{
|
||||
$request = ServerRequestCreatorFactory::determineServerRequestCreator()->createServerRequestFromGlobals();
|
||||
|
||||
|
|
|
@ -1,25 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
// Auth routes
|
||||
use App\Controllers\AdminController;
|
||||
use App\Controllers\ClientController;
|
||||
use App\Controllers\DashboardController;
|
||||
|
@ -36,58 +17,58 @@ use Slim\Routing\RouteCollectorProxy;
|
|||
|
||||
global $app;
|
||||
$app->group('', function (RouteCollectorProxy $group) {
|
||||
$group->get('/home[/page/{page}]', array(DashboardController::class, 'home'))->setName('home');
|
||||
$group->get('/upload', array(UploadController::class, 'webUpload'))->setName('upload.web');
|
||||
$group->get('/home[/page/{page}]', [DashboardController::class, 'home'])->setName('home');
|
||||
$group->get('/upload', [UploadController::class, 'webUpload'])->setName('upload.web');
|
||||
|
||||
$group->group('', function (RouteCollectorProxy $group) {
|
||||
$group->get('/home/switchView', array(DashboardController::class, 'switchView'))->setName('switchView');
|
||||
$group->get('/home/switchView', [DashboardController::class, 'switchView'])->setName('switchView');
|
||||
|
||||
$group->get('/system/deleteOrphanFiles', array(AdminController::class, 'deleteOrphanFiles'))->setName('system.deleteOrphanFiles');
|
||||
$group->get('/system/deleteOrphanFiles', [AdminController::class, 'deleteOrphanFiles'])->setName('system.deleteOrphanFiles');
|
||||
|
||||
$group->get('/system/themes', array(ThemeController::class, 'getThemes'))->setName('theme');
|
||||
$group->post('/system/theme/apply', array(ThemeController::class, 'applyTheme'))->setName('theme.apply');
|
||||
$group->get('/system/themes', [ThemeController::class, 'getThemes'])->setName('theme');
|
||||
$group->post('/system/theme/apply', [ThemeController::class, 'applyTheme'])->setName('theme.apply');
|
||||
|
||||
$group->post('/system/lang/apply', array(AdminController::class, 'applyLang'))->setName('lang.apply');
|
||||
$group->post('/system/lang/apply', [AdminController::class, 'applyLang'])->setName('lang.apply');
|
||||
|
||||
$group->post('/system/customHead', array(AdminController::class, 'applyCustomHead'))->setName('customHead.apply');
|
||||
$group->post('/system/customHead', [AdminController::class, 'applyCustomHead'])->setName('customHead.apply');
|
||||
|
||||
$group->post('/system/upgrade', array(UpgradeController::class, 'upgrade'))->setName('system.upgrade');
|
||||
$group->get('/system/checkForUpdates', array(UpgradeController::class, 'checkForUpdates'))->setName('system.checkForUpdates');
|
||||
$group->post('/system/upgrade', [UpgradeController::class, 'upgrade'])->setName('system.upgrade');
|
||||
$group->get('/system/checkForUpdates', [UpgradeController::class, 'checkForUpdates'])->setName('system.checkForUpdates');
|
||||
|
||||
$group->get('/system', array(AdminController::class, 'system'))->setName('system');
|
||||
$group->get('/system', [AdminController::class, 'system'])->setName('system');
|
||||
|
||||
$group->get('/users[/page/{page}]', array(UserController::class, 'index'))->setName('user.index');
|
||||
$group->get('/users[/page/{page}]', [UserController::class, 'index'])->setName('user.index');
|
||||
})->add(AdminMiddleware::class);
|
||||
|
||||
$group->group('/user', function (RouteCollectorProxy $group) {
|
||||
$group->get('/create', array(UserController::class, 'create'))->setName('user.create');
|
||||
$group->post('/create', array(UserController::class, 'store'))->setName('user.store');
|
||||
$group->get('/{id}/edit', array(UserController::class, 'edit'))->setName('user.edit');
|
||||
$group->post('/{id}', array(UserController::class, 'update'))->setName('user.update');
|
||||
$group->get('/{id}/delete', array(UserController::class, 'delete'))->setName('user.delete');
|
||||
$group->get('/create', [UserController::class, 'create'])->setName('user.create');
|
||||
$group->post('/create', [UserController::class, 'store'])->setName('user.store');
|
||||
$group->get('/{id}/edit', [UserController::class, 'edit'])->setName('user.edit');
|
||||
$group->post('/{id}', [UserController::class, 'update'])->setName('user.update');
|
||||
$group->get('/{id}/delete', [UserController::class, 'delete'])->setName('user.delete');
|
||||
})->add(AdminMiddleware::class);
|
||||
|
||||
$group->get('/profile', array(UserController::class, 'profile'))->setName('profile');
|
||||
$group->post('/profile/{id}', array(UserController::class, 'profileEdit'))->setName('profile.update');
|
||||
$group->post('/user/{id}/refreshToken', array(UserController::class, 'refreshToken'))->setName('refreshToken');
|
||||
$group->get('/user/{id}/config/sharex', array(ClientController::class, 'getShareXConfig'))->setName('config.sharex');
|
||||
$group->get('/user/{id}/config/script', array(ClientController::class, 'getBashScript'))->setName('config.script');
|
||||
$group->get('/profile', [UserController::class, 'profile'])->setName('profile');
|
||||
$group->post('/profile/{id}', [UserController::class, 'profileEdit'])->setName('profile.update');
|
||||
$group->post('/user/{id}/refreshToken', [UserController::class, 'refreshToken'])->setName('refreshToken');
|
||||
$group->get('/user/{id}/config/sharex', [ClientController::class, 'getShareXConfig'])->setName('config.sharex');
|
||||
$group->get('/user/{id}/config/script', [ClientController::class, 'getBashScript'])->setName('config.script');
|
||||
|
||||
$group->post('/upload/{id}/publish', array(MediaController::class, 'togglePublish'))->setName('upload.publish');
|
||||
$group->post('/upload/{id}/unpublish', array(MediaController::class, 'togglePublish'))->setName('upload.unpublish');
|
||||
$group->get('/upload/{id}/raw', array(MediaController::class, 'getRawById'))->add(AdminMiddleware::class)->setName('upload.raw');
|
||||
$group->map(array('GET', 'POST'), '/upload/{id}/delete', array(MediaController::class, 'delete'))->setName('upload.delete');
|
||||
$group->post('/upload/{id}/publish', [MediaController::class, 'togglePublish'])->setName('upload.publish');
|
||||
$group->post('/upload/{id}/unpublish', [MediaController::class, 'togglePublish'])->setName('upload.unpublish');
|
||||
$group->get('/upload/{id}/raw', [MediaController::class, 'getRawById'])->add(AdminMiddleware::class)->setName('upload.raw');
|
||||
$group->map(['GET', 'POST'],'/upload/{id}/delete', [MediaController::class, 'delete'])->setName('upload.delete');
|
||||
})->add(App\Middleware\CheckForMaintenanceMiddleware::class)->add(AuthMiddleware::class);
|
||||
|
||||
$app->get('/', array(DashboardController::class, 'redirects'))->setName('root');
|
||||
$app->get('/login', array(LoginController::class, 'show'))->setName('login.show');
|
||||
$app->post('/login', array(LoginController::class, 'login'))->setName('login');
|
||||
$app->map(array('GET', 'POST'), '/logout', array(LoginController::class, 'logout'))->setName('logout');
|
||||
$app->get('/', [DashboardController::class, 'redirects'])->setName('root');
|
||||
$app->get('/login', [LoginController::class, 'show'])->setName('login.show');
|
||||
$app->post('/login', [LoginController::class, 'login'])->setName('login');
|
||||
$app->map(['GET', 'POST'], '/logout', [LoginController::class, 'logout'])->setName('logout');
|
||||
|
||||
$app->post('/upload', array(UploadController::class, 'upload'))->setName('upload');
|
||||
$app->post('/upload', [UploadController::class, 'upload'])->setName('upload');
|
||||
|
||||
$app->get('/{userCode}/{mediaCode}', array(MediaController::class, 'show'))->setName('public');
|
||||
$app->get('/{userCode}/{mediaCode}/delete/{token}', array(MediaController::class, 'show'))->setName('public.delete.show')->add(CheckForMaintenanceMiddleware::class);
|
||||
$app->post('/{userCode}/{mediaCode}/delete/{token}', array(MediaController::class, 'deleteByToken'))->setName('public.delete')->add(CheckForMaintenanceMiddleware::class);
|
||||
$app->get('/{userCode}/{mediaCode}/raw[.{ext}]', array(MediaController::class, 'getRaw'))->setName('public.raw');
|
||||
$app->get('/{userCode}/{mediaCode}/download', array(MediaController::class, 'download'))->setName('public.download');
|
||||
$app->get('/{userCode}/{mediaCode}', [MediaController::class, 'show'])->setName('public');
|
||||
$app->get('/{userCode}/{mediaCode}/delete/{token}', [MediaController::class, 'show'])->setName('public.delete.show')->add(CheckForMaintenanceMiddleware::class);
|
||||
$app->post('/{userCode}/{mediaCode}/delete/{token}', [MediaController::class, 'deleteByToken'])->setName('public.delete')->add(CheckForMaintenanceMiddleware::class);
|
||||
$app->get('/{userCode}/{mediaCode}/raw[.{ext}]', [MediaController::class, 'getRaw'])->setName('public.raw');
|
||||
$app->get('/{userCode}/{mediaCode}/download', [MediaController::class, 'download'])->setName('public.download');
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
use App\Exception\Handlers\AppErrorHandler;
|
||||
use App\Exception\Handlers\Renderers\HtmlErrorRenderer;
|
||||
use App\Factories\ViewFactory;
|
||||
|
@ -46,22 +26,22 @@ if (!file_exists('config.php') && is_dir('install/')) {
|
|||
}
|
||||
|
||||
// Load the config
|
||||
$config = array_replace_recursive(array(
|
||||
$config = array_replace_recursive([
|
||||
'app_name' => 'XBackBone',
|
||||
'base_url' => isset($_SERVER['HTTPS']) ? 'https://'.$_SERVER['HTTP_HOST'] : 'http://'.$_SERVER['HTTP_HOST'],
|
||||
'debug' => false,
|
||||
'maintenance' => false,
|
||||
'db' => array(
|
||||
'db' => [
|
||||
'connection' => 'sqlite',
|
||||
'dsn' => BASE_DIR.'resources/database/xbackbone.db',
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
),
|
||||
'storage' => array(
|
||||
],
|
||||
'storage' => [
|
||||
'driver' => 'local',
|
||||
'path' => realpath(__DIR__.'/').DIRECTORY_SEPARATOR.'storage',
|
||||
),
|
||||
), require BASE_DIR.'config.php');
|
||||
],
|
||||
], require BASE_DIR.'config.php');
|
||||
|
||||
$builder = new ContainerBuilder();
|
||||
|
||||
|
@ -70,13 +50,13 @@ if (!$config['debug']) {
|
|||
$builder->writeProxiesToFile(true, BASE_DIR.'/resources/cache/proxies');
|
||||
}
|
||||
|
||||
$builder->addDefinitions(array(
|
||||
$builder->addDefinitions([
|
||||
'config' => value($config),
|
||||
View::class => factory(function (Container $container) {
|
||||
return ViewFactory::createAppInstance($container);
|
||||
}),
|
||||
'view' => get(View::class),
|
||||
));
|
||||
]);
|
||||
|
||||
$builder->addDefinitions(__DIR__.'/container.php');
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
use App\Database\DB;
|
||||
use App\Web\Lang;
|
||||
use App\Web\Session;
|
||||
|
@ -39,7 +19,7 @@ use Spatie\Dropbox\Client as DropboxClient;
|
|||
use Spatie\FlysystemDropbox\DropboxAdapter;
|
||||
use Superbalist\Flysystem\GoogleStorage\GoogleStorageAdapter;
|
||||
|
||||
return array(
|
||||
return [
|
||||
Logger::class => factory(function () {
|
||||
$logger = new Logger('app');
|
||||
|
||||
|
@ -74,22 +54,22 @@ return array(
|
|||
case 'local':
|
||||
return new Filesystem(new Local($config['storage']['path']));
|
||||
case 's3':
|
||||
$client = new S3Client(array(
|
||||
'credentials' => array(
|
||||
$client = new S3Client([
|
||||
'credentials' => [
|
||||
'key' => $config['storage']['key'],
|
||||
'secret' => $config['storage']['secret'],
|
||||
),
|
||||
],
|
||||
'region' => $config['storage']['region'],
|
||||
'version' => 'latest',
|
||||
));
|
||||
]);
|
||||
|
||||
return new Filesystem(new AwsS3Adapter($client, $config['storage']['bucket'], $config['storage']['path']));
|
||||
case 'dropbox':
|
||||
$client = new DropboxClient($config['storage']['token']);
|
||||
|
||||
return new Filesystem(new DropboxAdapter($client), array('case_sensitive' => false));
|
||||
return new Filesystem(new DropboxAdapter($client), ['case_sensitive' => false]);
|
||||
case 'ftp':
|
||||
return new Filesystem(new FtpAdapter(array(
|
||||
return new Filesystem(new FtpAdapter([
|
||||
'host' => $config['storage']['host'],
|
||||
'username' => $config['storage']['username'],
|
||||
'password' => $config['storage']['password'],
|
||||
|
@ -98,12 +78,12 @@ return array(
|
|||
'passive' => $config['storage']['passive'],
|
||||
'ssl' => $config['storage']['ssl'],
|
||||
'timeout' => 30,
|
||||
)));
|
||||
]));
|
||||
case 'google-cloud':
|
||||
$client = new StorageClient(array(
|
||||
$client = new StorageClient([
|
||||
'projectId' => $config['storage']['project_id'],
|
||||
'keyFilePath' => $config['storage']['key_path'],
|
||||
));
|
||||
]);
|
||||
|
||||
return new Filesystem(new GoogleStorageAdapter($client, $client->bucket($config['storage']['bucket'])));
|
||||
default:
|
||||
|
@ -116,4 +96,4 @@ return array(
|
|||
return Lang::build(Lang::recognize(), BASE_DIR.'resources/lang/');
|
||||
}),
|
||||
'lang' => get(Lang::class),
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,35 +1,15 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'base_url' => 'https://localhost', // no trailing slash
|
||||
'db' => array(
|
||||
'db' => [
|
||||
'connection' => 'sqlite',
|
||||
'dsn' => 'resources/database/xbackbone.db',
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
),
|
||||
'storage' => array(
|
||||
],
|
||||
'storage' => [
|
||||
'driver' => 'local',
|
||||
'path' => './storage',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
|
20
index.php
20
index.php
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
(PHP_MAJOR_VERSION >= 7 && PHP_MINOR_VERSION >= 1) ?: die('Sorry, PHP 7.1 or above is required to run XBackBone.');
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
|
|
|
@ -1,25 +1,5 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
(PHP_MAJOR_VERSION >= 7 && PHP_MINOR_VERSION >= 1) ?: die('Sorry, PHP 7.1 or above is required to run XBackBone.');
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
|
@ -43,20 +23,20 @@ define('PLATFORM_VERSION', json_decode(file_get_contents(__DIR__.'/../composer.j
|
|||
define('BASE_DIR', realpath(__DIR__.'/../').DIRECTORY_SEPARATOR);
|
||||
|
||||
// default config
|
||||
$config = array(
|
||||
$config = [
|
||||
'base_url' => str_replace('/install/', '', (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http')."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
|
||||
'debug' => true,
|
||||
'db' => array(
|
||||
'db' => [
|
||||
'connection' => 'sqlite',
|
||||
'dsn' => realpath(__DIR__.'/../').implode(DIRECTORY_SEPARATOR, array('resources', 'database', 'xbackbone.db')),
|
||||
'dsn' => realpath(__DIR__.'/../').implode(DIRECTORY_SEPARATOR, ['resources', 'database', 'xbackbone.db']),
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
),
|
||||
'storage' => array(
|
||||
],
|
||||
'storage' => [
|
||||
'driver' => 'local',
|
||||
'path' => realpath(__DIR__.'/../').DIRECTORY_SEPARATOR.'storage',
|
||||
),
|
||||
);
|
||||
],
|
||||
];
|
||||
|
||||
if (file_exists(__DIR__.'/../config.php')) {
|
||||
$config = array_replace_recursive($config, require __DIR__.'/../config.php');
|
||||
|
@ -64,13 +44,13 @@ if (file_exists(__DIR__.'/../config.php')) {
|
|||
|
||||
$builder = new ContainerBuilder();
|
||||
|
||||
$builder->addDefinitions(array(
|
||||
$builder->addDefinitions([
|
||||
'config' => value($config),
|
||||
View::class => factory(function (Container $container) {
|
||||
return ViewFactory::createInstallerInstance($container);
|
||||
}),
|
||||
'view' => get(View::class),
|
||||
));
|
||||
]);
|
||||
$builder->addDefinitions(__DIR__.'/../bootstrap/container.php');
|
||||
|
||||
$app = Bridge::create($builder->build());
|
||||
|
@ -108,9 +88,9 @@ $app->get('/', function (Response $response, View $view, Session $session) use (
|
|||
|
||||
$installed = file_exists(__DIR__.'/../config.php');
|
||||
|
||||
return $view->render($response, 'install.twig', array(
|
||||
return $view->render($response, 'install.twig', [
|
||||
'installed' => $installed,
|
||||
));
|
||||
]);
|
||||
})->setName('install');
|
||||
|
||||
$app->post('/', function (Request $request, Response $response, Filesystem $storage, Session $session) use (&$config) {
|
||||
|
@ -215,7 +195,7 @@ $app->post('/', function (Request $request, Response $response, Filesystem $stor
|
|||
|
||||
// if not installed, create the default admin account
|
||||
if (!$installed) {
|
||||
$db->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES (?, 'admin', ?, 1, ?)", array(param($request, 'email'), password_hash(param($request, 'password'), PASSWORD_DEFAULT), humanRandomString(5)));
|
||||
$db->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES (?, 'admin', ?, 1, ?)", [param($request, 'email'), password_hash(param($request, 'password'), PASSWORD_DEFAULT), humanRandomString(5)]);
|
||||
}
|
||||
|
||||
// post install cleanup
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'Bulgarian',
|
||||
'enforce_language' => 'Изберете език',
|
||||
'yes' => 'Да',
|
||||
|
@ -90,4 +70,4 @@ return array(
|
|||
'user_deleted' => 'Потребителят бе изтрит.',
|
||||
'cannot_delete' => 'Не можете да изтриете себе си.',
|
||||
'gallery' => 'Галерия',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'Danish',
|
||||
'yes' => 'Ja',
|
||||
'no' => 'Nej',
|
||||
|
@ -64,4 +44,4 @@ return array(
|
|||
'is_active' => 'Er aktiv',
|
||||
'is_admin' => 'Er administrator',
|
||||
'your_profile' => 'Din Profil',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'German',
|
||||
'yes' => 'Ja',
|
||||
'no' => 'Nein',
|
||||
|
@ -134,4 +114,4 @@ return array(
|
|||
'remember_me' => 'Erinnere mich daran',
|
||||
'please_wait' => 'Bitte warten…',
|
||||
'dont_close' => 'Schließen Sie diesen Tab erst, wenn Sie fertig sind.',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'English',
|
||||
'enforce_language' => 'Enforce language',
|
||||
'yes' => 'Yes',
|
||||
|
@ -131,4 +111,4 @@ return array(
|
|||
'remember_me' => 'Remember me',
|
||||
'please_wait' => 'Please wait…',
|
||||
'dont_close' => 'Do not close this tab until completion.',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'Spanish',
|
||||
'yes' => 'Si',
|
||||
'no' => 'No',
|
||||
|
@ -120,4 +100,4 @@ return array(
|
|||
'lang_name' => 'nombre del lenguaje',
|
||||
'default_lang_behavior' => 'XBackBone tratará de coincidir con el lenguaje predeterminado del navegador (recurrimos al Inglés automáticamente).',
|
||||
'lang_set' => 'Lenguaje del sistema impuesto a "%s"',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'French',
|
||||
'yes' => 'Oui',
|
||||
'no' => 'Non',
|
||||
|
@ -113,4 +93,4 @@ return array(
|
|||
'remember_me' => 'Se souvenir de moi',
|
||||
'please_wait' => 'Veuillez patienter…',
|
||||
'dont_close' => 'Ne fermez pas cette fenêtre jusqu\'à complétion.',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'Italian',
|
||||
'yes' => 'Sì',
|
||||
'no' => 'No',
|
||||
|
@ -129,6 +109,6 @@ return array(
|
|||
'custom_head_html_hint' => 'Questo contenuto sarà aggiunto al tag <head> in ogni pagina.',
|
||||
'custom_head_set' => 'Custom Head HTML applicato con successo.',
|
||||
'remember_me' => 'Ricordami',
|
||||
'please_wait' => 'Attendere prego…',
|
||||
'please_wait' => 'Attendere prego...',
|
||||
'dont_close' => 'Non chiudere questa scheda fino al completamento.',
|
||||
);
|
||||
];
|
||||
|
|
1
resources/lang/ja.lang.php
Normal file
1
resources/lang/ja.lang.php
Normal file
|
@ -0,0 +1 @@
|
|||
<?php
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'theme' => 'Drakt',
|
||||
'username_taken' => 'Brukernavnet er i bruk.',
|
||||
'file_size_no_match' => 'Nedlastet fil samsvarer ikke med riktig filstørrelse.',
|
||||
|
@ -130,4 +110,4 @@ return array(
|
|||
'custom_head_set' => 'Egendefinert HTML-hode lagt til.',
|
||||
'remember_me' => 'Husk meg',
|
||||
'please_wait' => 'Vent…',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'Dutch',
|
||||
'yes' => 'Ja',
|
||||
'no' => 'Nee',
|
||||
|
@ -122,4 +102,4 @@ return array(
|
|||
'lang_name' => 'Taal',
|
||||
'default_lang_behavior' => 'XBackBone probeert standaard de taal van de browser te matchen (fallback is Engels).',
|
||||
'lang_set' => 'Systeemtaal "%s" afgedwongen',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'Portuguese',
|
||||
'yes' => 'Sim',
|
||||
'no' => 'Não',
|
||||
|
@ -64,4 +44,4 @@ return array(
|
|||
'your_profile' => 'O teu perfil',
|
||||
'token' => 'Token',
|
||||
'copy' => 'Copiar',
|
||||
);
|
||||
];
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @author Sergio Brighenti <sergio@brighenti.me>
|
||||
*
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
return array(
|
||||
return [
|
||||
'lang' => 'Russian',
|
||||
'yes' => 'Да',
|
||||
'no' => 'Нет',
|
||||
|
@ -122,4 +102,4 @@ return array(
|
|||
'lang_name' => 'язык',
|
||||
'default_lang_behavior' => 'XBackBone попробует выбрать язык вашего браузера по умолчанию, иначе будет выбран Английский.',
|
||||
'lang_set' => 'Выбран следующий язык: "%s"',
|
||||
);
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue