commit
599f2fd264
@ -0,0 +1,91 @@
|
||||
image: php
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .composer
|
||||
|
||||
services:
|
||||
- mariadb:10.2
|
||||
|
||||
variables:
|
||||
MYSQL_DATABASE: engelsystem
|
||||
MYSQL_USER: engel
|
||||
MYSQL_PASSWORD: engelsystem
|
||||
MYSQL_HOST: mariadb
|
||||
COMPOSER_HOME: .composer
|
||||
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
|
||||
|
||||
before_script:
|
||||
# Fix permissions after gitlab messed them up
|
||||
- find . -type f -exec chmod 644 {} \;
|
||||
- find . -type d -exec chmod 755 {} \;
|
||||
# Install required Packages
|
||||
- apt update -yqq
|
||||
- apt install -yqq git unzip mariadb-client
|
||||
- docker-php-ext-install pdo pdo_mysql gettext
|
||||
# Install xdebug
|
||||
- pecl install xdebug
|
||||
- docker-php-ext-enable xdebug
|
||||
# MySQL DB
|
||||
- mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" < db/install.sql
|
||||
- mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" < db/update.sql
|
||||
# Install Composer
|
||||
- curl -sS https://getcomposer.org/installer | php -- --no-ansi --install-dir /usr/local/bin/ --filename composer
|
||||
- /usr/local/bin/composer --no-ansi install
|
||||
|
||||
.test_template: &test_definition
|
||||
artifacts:
|
||||
name: "${CI_JOB_NAME}_${CI_PROJECT_ID}_${PHP_VERSION}"
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- ./coverage/
|
||||
coverage: '/^\s*Lines:\s*(\d+(?:\.\d+)?%)/'
|
||||
script: vendor/bin/phpunit --colors=never --coverage-text --coverage-html ./coverage/
|
||||
|
||||
test:7.0:
|
||||
image: php:7.0
|
||||
<<: *test_definition
|
||||
|
||||
test:7.1:
|
||||
image: php:7.1
|
||||
<<: *test_definition
|
||||
|
||||
deploy_staging:
|
||||
stage: deploy
|
||||
only:
|
||||
- master
|
||||
script:
|
||||
- |-
|
||||
if [ -z "${SSH_PRIVATE_KEY}" ] || [ -z "${REMOTE}" ] || [ -z "${REMOTE_PATH}" ]; then
|
||||
echo "Skipping deployment";
|
||||
exit
|
||||
fi
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$SSH_PRIVATE_KEY" | sed -e 's/\r//g' > ~/.ssh/id_ed25519
|
||||
- chmod 600 ~/.ssh/id_ed25519
|
||||
- apt update && apt install -yqq rsync openssh-client
|
||||
- /usr/local/bin/composer --no-ansi install --no-dev
|
||||
- /usr/local/bin/composer --no-ansi dump-autoload --optimize
|
||||
- echo "syncing ${PWD}/ to ${REMOTE}:${REMOTE_PATH}/${CI_JOB_ID}-${CI_COMMIT_SHA}/"
|
||||
- |-
|
||||
rsync -vAax --exclude '.git*' --exclude .composer/ \
|
||||
-e "ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" \
|
||||
./ "${REMOTE}:${REMOTE_PATH}/${CI_JOB_ID}-${CI_COMMIT_SHA}/"
|
||||
- |-
|
||||
ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "${REMOTE}" "
|
||||
set -e
|
||||
|
||||
if [[ -f \"${REMOTE_PATH}/current/config/config.php\" ]]; then
|
||||
echo \"Config backup\"
|
||||
cp \"${REMOTE_PATH}/current/config/config.php\" config.php
|
||||
fi
|
||||
|
||||
echo \"Changing symlink\"
|
||||
unlink \"${REMOTE_PATH}/current\"
|
||||
ln -s \"${REMOTE_PATH}/${CI_JOB_ID}-${CI_COMMIT_SHA}\" \"${REMOTE_PATH}/current\"
|
||||
|
||||
if [[ -f config.php ]]; then
|
||||
echo \"Restoring config\"
|
||||
cp config.php \"${REMOTE_PATH}/current/config/config.php\"
|
||||
fi
|
||||
"
|
@ -1,6 +0,0 @@
|
||||
[submodule "vendor/parsedown"]
|
||||
path = vendor/parsedown
|
||||
url = https://github.com/erusev/parsedown.git
|
||||
[submodule "vendor/bootstrap"]
|
||||
path = themes/assets/bootstrap
|
||||
url = https://github.com/twbs/bootstrap.git
|
@ -1,25 +0,0 @@
|
||||
# Installation of Engelsystem
|
||||
|
||||
## Requirements:
|
||||
* PHP 5.4.x (cgi-fcgi)
|
||||
* MySQL-Server 5.5.x
|
||||
* Webserver, i.e. lighttpd, nginx, or Apache
|
||||
|
||||
## Directions:
|
||||
* Clone the master branch with the submodules: `git clone --recursive https://github.com/engelsystem/engelsystem.git`
|
||||
* Webserver must have write access to the 'import' directory and read access for all other directories
|
||||
* Webserver must be public.
|
||||
|
||||
* Recommended: Directory Listing should be disabled.
|
||||
* There must a be MySQL database created with a user who has full rights to that database.
|
||||
* It must be created by the db/install.sql and db/update.sql files.
|
||||
* If necessary, create a config/config.php to override values from config/config.default.php.
|
||||
* In the browser, login with credentials admin:asdfasdf and change the password.
|
||||
|
||||
Engelsystem can now be used.
|
||||
|
||||
## Session Settings:
|
||||
* Make sure the config allows for sessions.
|
||||
* Both Apache and Nginx allow for different VirtualHost configurations.
|
||||
|
||||
Report Bugs: https://github.com/engelsystem/engelsystem/issues
|
@ -1,28 +1,42 @@
|
||||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/20b3b0b4e93344a29da6bec77f329e7a)](https://www.codacy.com/app/engelsystem/engelsystem)
|
||||
[![GPL](https://img.shields.io/github/license/engelsystem/engelsystem.svg?maxAge=2592000)]()
|
||||
|
||||
# Installation eines frischen Engelsystems
|
||||
# Engelsystem
|
||||
|
||||
## Mindestvorrausetzungen (bzw. getestet unter):
|
||||
* PHP 5.4.x (cgi-fcgi)
|
||||
* MySQL-Server 5.5.x
|
||||
* Webserver mit PHP-Anbindung, z.B. lighttpd, nginx oder Apache
|
||||
Please visit https://engelsystem.de for a feature list.
|
||||
|
||||
## Vorgehen:
|
||||
* Klonen des `master` inkl. submodules in lokales Verzeichnis: `git clone --recursive https://github.com/engelsystem/engelsystem.git`
|
||||
* Der Webserver muss Schreibrechte auf das Verzeichnis `import` bekommen, für alle anderen Dateien reichen Leserechte.
|
||||
* Der Webserver muss auf `public` als http-root zeigen.
|
||||
## Installation
|
||||
|
||||
* Empfehlung: Dirlisting sollte deaktiviert sein.
|
||||
* Es muss eine MySQL-Datenbank angelegt werden und ein User existieren, der alle Rechte auf dieser Datenbank besitzt.
|
||||
* Es muss die db/install.sql und die db/update.sql importiert/ausgeführt werden.
|
||||
* Erstelle bei Bedarf eine config/config.php, die die Werte (z.B. DB-Zugang) aus der config/config.default.php überschreibt.
|
||||
* Engelsystem im Browser aufrufen, Anmeldung mit admin:asdfasdf vornehmen und Admin-Passwort ändern.
|
||||
### Requirements:
|
||||
* PHP >= 7.0.0
|
||||
* MySQL-Server >= 5.5.x
|
||||
* Webserver, i.e. lighttpd, nginx, or Apache
|
||||
|
||||
Das Engelsystem ist jetzt einsatzbereit.
|
||||
### Directions:
|
||||
* Clone the master branch: `git clone https://github.com/engelsystem/engelsystem.git`
|
||||
* Install [Composer](https://getcomposer.org/download/)
|
||||
* Install project dependencies: `composer install`
|
||||
* Webserver must have write access to the 'import' directory and read access for all other directories
|
||||
* Webserver must point to the public directory.
|
||||
|
||||
## Session Einstellungen:
|
||||
* Einstellungen für Cookies und Sessions bitte in der PHP Config des Servers vornehmen.
|
||||
* Sowohl Apache als auch nginx bieten Möglichkeiten für verschiedene Konfigurationen pro VirtualHost an
|
||||
* Recommended: Directory Listing should be disabled.
|
||||
* There must a be MySQL database created with a user who has full rights to that database.
|
||||
* It must be created by the db/install.sql and db/update.sql files.
|
||||
* If necessary, create a config/config.php to override values from config/config.default.php.
|
||||
* In the browser, login with credentials admin:asdfasdf and change the password.
|
||||
|
||||
Fehler bitte auf Github melden: https://github.com/engelsystem/engelsystem/issues
|
||||
Engelsystem can now be used.
|
||||
|
||||
### Session Settings:
|
||||
* Make sure the config allows for sessions.
|
||||
* Both Apache and Nginx allow for different VirtualHost configurations.
|
||||
|
||||
Report Bugs: https://github.com/engelsystem/engelsystem/issues
|
||||
|
||||
## Development
|
||||
Since the engelsystem is open source, you can help to improve the system. We really love to get pull requests containing fixes or implementations of our Github issues.
|
||||
|
||||
Please create single pull requests for every feature instead of creating one big monster of pull request containing a complete rewrite.
|
||||
|
||||
### Codestyle
|
||||
Please ensure that your pull requests follow [PSR-2](http://www.php-fig.org/psr/psr-2/) and [PSR-4](http://www.php-fig.org/psr/psr-4/).
|
||||
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "engelsystem/engelsystem",
|
||||
"description": "Shift planning system for chaos events",
|
||||
"type": "project",
|
||||
"license": "GPL-2.0",
|
||||
"authors": [
|
||||
{
|
||||
"name": "msquare",
|
||||
"email": "msquare@notrademark.de"
|
||||
},
|
||||
{
|
||||
"name": "MyIgel",
|
||||
"email": "igor.scheller@igorshp.de"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"erusev/parsedown": "^1.6",
|
||||
"illuminate/container": "5.5.*",
|
||||
"psr/container": "^1.0",
|
||||
"psr/log": "^1.0",
|
||||
"symfony/http-foundation": "^3.3",
|
||||
"twbs/bootstrap": "^3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"filp/whoops": "^2.1",
|
||||
"phpunit/phpunit": "^6.3",
|
||||
"symfony/var-dumper": "^3.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Engelsystem\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
]
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
// Application config
|
||||
|
||||
return [
|
||||
// Service providers
|
||||
'providers' => [
|
||||
\Engelsystem\Logger\LoggerServiceProvider::class,
|
||||
\Engelsystem\Exceptions\ExceptionsServiceProvider::class,
|
||||
\Engelsystem\Config\ConfigServiceProvider::class,
|
||||
\Engelsystem\Routing\RoutingServiceProvider::class,
|
||||
\Engelsystem\Renderer\RendererServiceProvider::class,
|
||||
\Engelsystem\Database\DatabaseServiceProvider::class,
|
||||
\Engelsystem\Http\RequestServiceProvider::class,
|
||||
\Engelsystem\Http\SessionServiceProvider::class,
|
||||
],
|
||||
];
|
@ -0,0 +1,10 @@
|
||||
update User set Nick=concat('User',UID), Name=concat('Name',UID), Vorname=concat('Prename',UID), `Alter`=0, Telefon='', DECT='', Handy='', email=concat('engel', UID, '@engelsystem.de'), jabber='', Hometown='';
|
||||
update Messages set Text=concat('Message', id);
|
||||
update News set Betreff=concat('Subject', ID), Text=concat('News', ID);
|
||||
update NewsComments set Text=concat('Comment', ID);
|
||||
update Questions set Question=concat('Question', QID), Answer=concat('Answer', QID);
|
||||
update ShiftEntry set Comment='', freeload_comment='';
|
||||
update ShiftTypes set name=concat('Shifttype',id), description='Description';
|
||||
update AngelTypes set name=concat('Angeltype',id), description=concat('Description of angeltype',id);
|
||||
TRUNCATE TABLE LogEntries;
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// Check for autoloader
|
||||
if (!is_readable(__DIR__ . '/../vendor/autoload.php')) {
|
||||
die('Please run composer.phar install');
|
||||
}
|
||||
|
||||
// Include composer autoloader
|
||||
$loader = require __DIR__ . '/../vendor/autoload.php';
|
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use Engelsystem\Application;
|
||||
use Engelsystem\Config\Config;
|
||||
use Engelsystem\Exceptions\Handler;
|
||||
use Engelsystem\Exceptions\Handlers\HandlerInterface;
|
||||
|
||||
/**
|
||||
* This file includes all needed functions, connects to the db etc.
|
||||
*/
|
||||
require_once __DIR__ . '/autoload.php';
|
||||
|
||||
|
||||
/**
|
||||
* Include legacy code
|
||||
*/
|
||||
require __DIR__ . '/includes.php';
|
||||
|
||||
|
||||
/**
|
||||
* Initialize and bootstrap the application
|
||||
*/
|
||||
$app = new Application(realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'));
|
||||
$appConfig = $app->make(Config::class);
|
||||
$appConfig->set(require config_path('app.php'));
|
||||
$app->bootstrap($appConfig);
|
||||
|
||||
|
||||
/**
|
||||
* Configure application
|
||||
*/
|
||||
date_default_timezone_set($app->get('config')->get('timezone'));
|
||||
|
||||
if (config('environment') == 'development') {
|
||||
$errorHandler = $app->get('error.handler');
|
||||
$errorHandler->setEnvironment(Handler::ENV_DEVELOPMENT);
|
||||
$app->bind(HandlerInterface::class, 'error.handler.development');
|
||||
ini_set('display_errors', true);
|
||||
error_reporting(E_ALL);
|
||||
} else {
|
||||
ini_set('display_errors', false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for maintenance
|
||||
*/
|
||||
if ($app->get('config')->get('maintenance')) {
|
||||
echo file_get_contents(__DIR__ . '/../templates/maintenance.html');
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Init translations
|
||||
*/
|
||||
gettext_init();
|
||||
|
||||
|
||||
/**
|
||||
* Init authorization
|
||||
*/
|
||||
load_auth();
|
@ -1,104 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file includes all needed functions, connects to the db etc.
|
||||
*/
|
||||
require_once realpath(__DIR__ . '/../includes/mysqli_provider.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/sys_auth.php');
|
||||
require_once realpath(__DIR__ . '/../includes/sys_form.php');
|
||||
require_once realpath(__DIR__ . '/../includes/sys_log.php');
|
||||
require_once realpath(__DIR__ . '/../includes/sys_menu.php');
|
||||
require_once realpath(__DIR__ . '/../includes/sys_page.php');
|
||||
require_once realpath(__DIR__ . '/../includes/sys_template.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/model/AngelType_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/EventConfig_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/LogEntries_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/Message_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/NeededAngelTypes_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/Room_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/ShiftEntry_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/Shifts_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/ShiftsFilter.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/ShiftSignupState.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/ShiftTypes_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/UserAngelTypes_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/UserDriverLicenses_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/UserGroups_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/User_model.php');
|
||||
require_once realpath(__DIR__ . '/../includes/model/ValidationResult.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/view/AngelTypes_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/EventConfig_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/Questions_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/Rooms_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/ShiftCalendarLane.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/ShiftCalendarRenderer.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/ShiftCalendarShiftRenderer.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/ShiftsFilterRenderer.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/Shifts_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/ShiftEntry_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/ShiftTypes_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/UserAngelTypes_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/UserDriverLicenses_view.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/UserHintsRenderer.php');
|
||||
require_once realpath(__DIR__ . '/../includes/view/User_view.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/controller/angeltypes_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/event_config_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/rooms_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/shift_entries_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/shifts_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/shifttypes_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/users_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/user_angeltypes_controller.php');
|
||||
require_once realpath(__DIR__ . '/../includes/controller/user_driver_licenses_controller.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/helper/graph_helper.php');
|
||||
require_once realpath(__DIR__ . '/../includes/helper/internationalization_helper.php');
|
||||
require_once realpath(__DIR__ . '/../includes/helper/message_helper.php');
|
||||
require_once realpath(__DIR__ . '/../includes/helper/error_helper.php');
|
||||
require_once realpath(__DIR__ . '/../includes/helper/email_helper.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/mailer/shifts_mailer.php');
|
||||
require_once realpath(__DIR__ . '/../includes/mailer/users_mailer.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../config/config.default.php');
|
||||
if (file_exists(realpath(__DIR__ . '/../config/config.php'))) {
|
||||
require_once realpath(__DIR__ . '/../config/config.php');
|
||||
}
|
||||
|
||||
if ($maintenance_mode) {
|
||||
echo file_get_contents(__DIR__ . '/../public/maintenance.html');
|
||||
die();
|
||||
}
|
||||
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_active.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_arrive.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_free.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_groups.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_import.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_log.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_questions.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_rooms.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_shifts.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/admin_user.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/guest_login.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/user_messages.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/user_myshifts.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/user_news.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/user_questions.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/user_settings.php');
|
||||
require_once realpath(__DIR__ . '/../includes/pages/user_shifts.php');
|
||||
|
||||
require_once realpath(__DIR__ . '/../vendor/parsedown/Parsedown.php');
|
||||
|
||||
session_start();
|
||||
|
||||
gettext_init();
|
||||
|
||||
sql_connect($config['host'], $config['user'], $config['pw'], $config['db']);
|
||||
|
||||
load_auth();
|
||||
|
||||
?>
|
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Include legacy code
|
||||
*/
|
||||
$includeFiles = [
|
||||
__DIR__ . '/../includes/sys_auth.php',
|
||||
__DIR__ . '/../includes/sys_form.php',
|
||||
__DIR__ . '/../includes/sys_log.php',
|
||||
__DIR__ . '/../includes/sys_menu.php',
|
||||
__DIR__ . '/../includes/sys_page.php',
|
||||
__DIR__ . '/../includes/sys_template.php',
|
||||
|
||||
__DIR__ . '/../includes/model/AngelType_model.php',
|
||||
__DIR__ . '/../includes/model/EventConfig_model.php',
|
||||
__DIR__ . '/../includes/model/LogEntries_model.php',
|
||||
__DIR__ . '/../includes/model/Message_model.php',
|
||||
__DIR__ . '/../includes/model/NeededAngelTypes_model.php',
|
||||
__DIR__ . '/../includes/model/Room_model.php',
|
||||
__DIR__ . '/../includes/model/ShiftEntry_model.php',
|
||||
__DIR__ . '/../includes/model/Shifts_model.php',
|
||||
__DIR__ . '/../includes/model/ShiftsFilter.php',
|
||||
__DIR__ . '/../includes/model/ShiftSignupState.php',
|
||||
__DIR__ . '/../includes/model/ShiftTypes_model.php',
|
||||
__DIR__ . '/../includes/model/UserAngelTypes_model.php',
|
||||
__DIR__ . '/../includes/model/UserDriverLicenses_model.php',
|
||||
__DIR__ . '/../includes/model/UserGroups_model.php',
|
||||
__DIR__ . '/../includes/model/User_model.php',
|
||||
__DIR__ . '/../includes/model/ValidationResult.php',
|
||||
|
||||
__DIR__ . '/../includes/view/AngelTypes_view.php',
|
||||
__DIR__ . '/../includes/view/EventConfig_view.php',
|
||||
__DIR__ . '/../includes/view/Questions_view.php',
|
||||
__DIR__ . '/../includes/view/Rooms_view.php',
|
||||
__DIR__ . '/../includes/view/ShiftCalendarLane.php',
|
||||
__DIR__ . '/../includes/view/ShiftCalendarRenderer.php',
|
||||
__DIR__ . '/../includes/view/ShiftCalendarShiftRenderer.php',
|
||||
__DIR__ . '/../includes/view/ShiftsFilterRenderer.php',
|
||||
__DIR__ . '/../includes/view/Shifts_view.php',
|
||||
__DIR__ . '/../includes/view/ShiftEntry_view.php',
|
||||
__DIR__ . '/../includes/view/ShiftTypes_view.php',
|
||||
__DIR__ . '/../includes/view/UserAngelTypes_view.php',
|
||||
__DIR__ . '/../includes/view/UserDriverLicenses_view.php',
|
||||
__DIR__ . '/../includes/view/UserHintsRenderer.php',
|
||||
__DIR__ . '/../includes/view/User_view.php',
|
||||
|
||||
__DIR__ . '/../includes/controller/angeltypes_controller.php',
|
||||
__DIR__ . '/../includes/controller/event_config_controller.php',
|
||||
__DIR__ . '/../includes/controller/rooms_controller.php',
|
||||
__DIR__ . '/../includes/controller/shift_entries_controller.php',
|
||||
__DIR__ . '/../includes/controller/shifts_controller.php',
|
||||
__DIR__ . '/../includes/controller/shifttypes_controller.php',
|
||||
__DIR__ . '/../includes/controller/users_controller.php',
|
||||
__DIR__ . '/../includes/controller/user_angeltypes_controller.php',
|
||||
__DIR__ . '/../includes/controller/user_driver_licenses_controller.php',
|
||||
|
||||
__DIR__ . '/../includes/helper/graph_helper.php',
|
||||
__DIR__ . '/../includes/helper/internationalization_helper.php',
|
||||
__DIR__ . '/../includes/helper/message_helper.php',
|
||||
__DIR__ . '/../includes/helper/error_helper.php',
|
||||
__DIR__ . '/../includes/helper/email_helper.php',
|
||||
|
||||
__DIR__ . '/../includes/mailer/shifts_mailer.php',
|
||||
__DIR__ . '/../includes/mailer/users_mailer.php',
|
||||
|
||||
__DIR__ . '/../includes/pages/admin_active.php',
|
||||
__DIR__ . '/../includes/pages/admin_arrive.php',
|
||||
__DIR__ . '/../includes/pages/admin_free.php',
|
||||
__DIR__ . '/../includes/pages/admin_groups.php',
|
||||
__DIR__ . '/../includes/pages/admin_import.php',
|
||||
__DIR__ . '/../includes/pages/admin_log.php',
|
||||
__DIR__ . '/../includes/pages/admin_questions.php',
|
||||
__DIR__ . '/../includes/pages/admin_rooms.php',
|
||||
__DIR__ . '/../includes/pages/admin_shifts.php',
|
||||
__DIR__ . '/../includes/pages/admin_user.php',
|
||||
__DIR__ . '/../includes/pages/guest_login.php',
|
||||
__DIR__ . '/../includes/pages/user_messages.php',
|
||||
__DIR__ . '/../includes/pages/user_myshifts.php',
|
||||
__DIR__ . '/../includes/pages/user_news.php',
|
||||
__DIR__ . '/../includes/pages/user_questions.php',
|
||||
__DIR__ . '/../includes/pages/user_settings.php',
|
||||
__DIR__ . '/../includes/pages/user_shifts.php',
|
||||
];
|
||||
foreach ($includeFiles as $file) {
|
||||
require_once realpath($file);
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @param User $user_source
|
||||
* @param array $user
|
||||
* @return bool
|
||||
*/
|
||||
function mail_user_delete($user) {
|
||||
engelsystem_email_to_user($user, '[engelsystem] ' . _("Your account has been deleted"), _("Your angelsystem account has been deleted. If you have any questions regarding your account deletion, please contact heaven."));
|
||||
function mail_user_delete($user)
|
||||
{
|
||||
return engelsystem_email_to_user(
|
||||
$user,
|
||||
'[engelsystem] ' . _('Your account has been deleted'),
|
||||
_('Your angelsystem account has been deleted. If you have any questions regarding your account deletion, please contact heaven.')
|
||||
);
|
||||
}
|
||||
?>
|
@ -1,17 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Engelsystem\Database\DB;
|
||||
|
||||
/**
|
||||
* Returns users groups
|
||||
* @param User $user
|
||||
*
|
||||
* @param array $user
|
||||
* @return array
|
||||
*/
|
||||
function User_groups($user) {
|
||||
return sql_select("
|
||||
function User_groups($user)
|
||||
{
|
||||
return DB::select('
|
||||
SELECT `Groups`.*
|
||||
FROM `UserGroups`
|
||||
JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
|
||||
WHERE `UserGroups`.`uid`='" . sql_escape($user['UID']) . "'
|
||||
WHERE `UserGroups`.`uid`=?
|
||||
ORDER BY `UserGroups`.`group_id`
|
||||
");
|
||||
',
|
||||
[$user['UID']]
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
@ -1,216 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Close connection.
|
||||
*/
|
||||
function sql_close() {
|
||||
global $sql_connection;
|
||||
|
||||
return $sql_connection->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return NULL if given value is null.
|
||||
*/
|
||||
function sql_null($value = null) {
|
||||
return $value == null ? 'NULL' : ("'" . sql_escape($value) . "'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Start new transaction.
|
||||
*/
|
||||
function sql_transaction_start() {
|
||||
global $sql_nested_transaction_level;
|
||||
|
||||
if ($sql_nested_transaction_level ++ == 0) {
|
||||
return sql_query("BEGIN");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commit transaction.
|
||||
*/
|
||||
function sql_transaction_commit() {
|
||||
global $sql_nested_transaction_level;
|
||||
|
||||
if (-- $sql_nested_transaction_level == 0) {
|
||||
return sql_query("COMMIT");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop transaction, revert database.
|
||||
*/
|
||||
function sql_transaction_rollback() {
|
||||
global $sql_nested_transaction_level;
|
||||
|
||||
if (-- $sql_nested_transaction_level == 0) {
|
||||
return sql_query("ROLLBACK");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs an sql error.
|
||||
*
|
||||
* @param string $message
|
||||
* @return false
|
||||
*/
|
||||
function sql_error($message) {
|
||||
sql_close();
|
||||
|
||||
$message = trim($message) . "\n";
|
||||
$message .= debug_string_backtrace() . "\n";
|
||||
|
||||
error_log('mysql_provider error: ' . $message);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to mysql server.
|
||||
*
|
||||
* @param string $host
|
||||
* Host
|
||||
* @param string $user
|
||||
* Username
|
||||
* @param string $pass
|
||||
* Password
|
||||
* @param string $db_name
|
||||
* DB to select
|
||||
* @return mysqli The connection handler
|
||||
*/
|
||||
function sql_connect($host, $user, $pass, $db_name) {
|
||||
global $sql_connection;
|
||||
|
||||
$sql_connection = new mysqli($host, $user, $pass, $db_name);
|
||||
if ($sql_connection->connect_errno) {
|
||||
error("Unable to connect to MySQL: " . $sql_connection->connect_error);
|
||||
return sql_error("Unable to connect to MySQL: " . $sql_connection->connect_error);
|
||||
}
|
||||
|
||||
$result = $sql_connection->query("SET CHARACTER SET utf8;");
|
||||
if (! $result) {
|
||||
return sql_error("Unable to set utf8 character set (" . $sql_connection->errno . ") " . $sql_connection->error);
|
||||
}
|
||||
|
||||
$result = $sql_connection->set_charset('utf8');
|
||||
if (! $result) {
|
||||
return sql_error("Unable to set utf8 names (" . $sql_connection->errno . ") " . $sql_connection->error);
|
||||
}
|
||||
|
||||
return $sql_connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the selected db in current mysql-connection.
|
||||
*
|
||||
* @param
|
||||
* $db_name
|
||||
* @return bool true on success, false on error
|
||||
*/
|
||||
function sql_select_db($db_name) {
|
||||
global $sql_connection;
|
||||
if (! $sql_connection->select_db($db_name)) {
|
||||
return sql_error("No database selected.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* MySQL SELECT query
|
||||
*
|
||||
* @param string $query
|
||||
* @return Result array or false on error
|
||||
*/
|
||||
function sql_select($query) {
|
||||
global $sql_connection;
|
||||
|
||||
// echo $query . ";\n";
|
||||
// echo debug_string_backtrace() . "\n";
|
||||
|
||||
$result = $sql_connection->query($query);
|
||||
if ($result) {
|
||||
$data = [];
|
||||
while ($line = $result->fetch_assoc()) {
|
||||
array_push($data, $line);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
|
||||
}
|
||||
|
||||
/**
|
||||
* MySQL execute a query
|
||||
*
|
||||
* @param string $query
|
||||
* @return mysqli_result boolean resource or false on error
|
||||
*/
|
||||
function sql_query($query) {
|
||||
global $sql_connection;
|
||||
|
||||
$result = $sql_connection->query($query);
|
||||
if ($result) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns last inserted id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function sql_id() {
|
||||
global $sql_connection;
|
||||
return $sql_connection->insert_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a string for a sql query.
|
||||
*
|
||||
* @param string $query
|
||||
* @return string
|
||||
*/
|
||||
function sql_escape($query) {
|
||||
global $sql_connection;
|
||||
return $sql_connection->real_escape_string($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a boolean for mysql-queries.
|
||||
*
|
||||
* @param boolean $boolean
|
||||
* @return string
|
||||
*/
|
||||
function sql_bool($boolean) {
|
||||
return $boolean == true ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
|
||||
/**
|
||||
* Count query result lines.
|
||||
*
|
||||
* @param string $query
|
||||
* @return int Count of result lines
|
||||
*/
|
||||
function sql_num_query($query) {
|
||||
return sql_query($query)->num_rows;
|
||||
}
|
||||
|
||||
function sql_select_single_col($query) {
|
||||
$result = sql_select($query);
|
||||
return array_map('array_shift', $result);
|
||||
}
|
||||
|
||||
function sql_select_single_cell($query) {
|
||||
return array_shift(array_shift(sql_select($query)));
|
||||
}
|
||||
|
||||
?>
|
@ -1,67 +1,92 @@
|
||||
<?php
|
||||
|
||||
function admin_news() {
|
||||
global $user;
|
||||
use Engelsystem\Database\DB;
|
||||
|
||||
if (! isset($_GET["action"])) {
|
||||
redirect(page_link_to("news"));
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function admin_news()
|
||||
{
|
||||
global $user, $privileges;
|
||||
$request = request();
|
||||
|
||||
if (!$request->has('action')) {
|
||||
redirect(page_link_to('news'));
|
||||
}
|
||||
|
||||
$html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>' . msg();
|
||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
||||
$news_id = $_REQUEST['id'];
|
||||
$html = '<div class="col-md-12"><h1>' . _('Edit news entry') . '</h1>' . msg();
|
||||
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
|
||||
$news_id = $request->input('id');
|
||||
} else {
|
||||
return error("Incomplete call, missing News ID.", true);
|
||||
return error('Incomplete call, missing News ID.', true);
|
||||
}
|
||||
|
||||
$news = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($news_id) . "' LIMIT 1");
|
||||
$news = DB::selectOne('SELECT * FROM `News` WHERE `ID`=? LIMIT 1', [$news_id]);
|
||||
if (empty($news)) {
|
||||
return error("No News found.", true);
|
||||
return error('No News found.', true);
|
||||
}
|
||||
switch ($_REQUEST["action"]) {
|
||||
default:
|
||||
redirect(page_link_to('news'));
|
||||
case 'edit':
|
||||
list($news) = $news;
|
||||
|
||||
switch ($request->input('action')) {
|
||||
case 'edit':
|
||||
$user_source = User($news['UID']);
|
||||
|
||||
$html .= form([
|
||||
form_info(_("Date"), date("Y-m-d H:i", $news['Datum'])),
|
||||
form_info(_("Author"), User_Nick_render($user_source)),
|
||||
form_text('eBetreff', _("Subject"), $news['Betreff']),
|
||||
form_textarea('eText', _("Message"), $news['Text']),
|
||||
form_checkbox('eTreffen', _("Meeting"), $news['Treffen'] == 1, 1),
|
||||
form_submit('submit', _("Save"))
|
||||
], page_link_to('admin_news&action=save&id=' . $news_id));
|
||||
$html .= form(
|
||||
[
|
||||
form_info(_('Date'), date('Y-m-d H:i', $news['Datum'])),
|
||||
form_info(_('Author'), User_Nick_render($user_source)),
|
||||
form_text('eBetreff', _('Subject'), $news['Betreff']),
|
||||
form_textarea('eText', _('Message'), $news['Text']),
|
||||
form_checkbox('eTreffen', _('Meeting'), $news['Treffen'] == 1, 1),
|
||||
form_submit('submit', _('Save'))
|
||||
],
|
||||
page_link_to('admin_news', ['action' => 'save', 'id' => $news_id])
|
||||
);
|
||||
|
||||
$html .= '<a class="btn btn-danger" href="' . page_link_to('admin_news&action=delete&id=' . $news_id) . '"><span class="glyphicon glyphicon-trash"></span> ' . _("Delete") . '</a>';
|
||||
$html .= '<a class="btn btn-danger" href="'
|
||||
. page_link_to('admin_news', ['action' => 'delete', 'id' => $news_id])
|
||||
. '">'
|
||||
. '<span class="glyphicon glyphicon-trash"></span> ' . _('Delete')
|
||||
. '</a>';
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
list($news) = $news;
|
||||
$text = $request->postData('eText');
|
||||
if (!in_array('admin_news_html', $privileges)) {
|
||||
$text = strip_tags($text);
|
||||
}
|
||||
|
||||
sql_query("UPDATE `News` SET
|
||||
`Datum`='" . sql_escape(time()) . "',
|
||||
`Betreff`='" . sql_escape($_POST["eBetreff"]) . "',
|
||||
`Text`='" . sql_escape($_POST["eText"]) . "',
|
||||
`UID`='" . sql_escape($user['UID']) . "',
|
||||
`Treffen`='" . sql_escape($_POST["eTreffen"]) . "'
|
||||
WHERE `ID`='" . sql_escape($news_id) . "'");
|
||||
engelsystem_log("News updated: " . $_POST["eBetreff"]);
|
||||
success(_("News entry updated."));
|
||||
redirect(page_link_to("news"));
|
||||
DB::update('
|
||||
UPDATE `News` SET
|
||||
`Datum`=?,
|
||||
`Betreff`=?,
|
||||
`Text`=?,
|
||||
`UID`=?,
|
||||
`Treffen`=?
|
||||
WHERE `ID`=?
|
||||
',
|
||||
[
|
||||
time(),
|
||||
strip_tags($request->postData('eBetreff')),
|
||||
$text,
|
||||
$user['UID'],
|
||||
$request->has('eTreffen') ? 1 : 0,
|
||||
$news_id
|
||||
]
|
||||
);
|
||||
|
||||
engelsystem_log('News updated: ' . $request->postData('eBetreff'));
|
||||
success(_('News entry updated.'));
|
||||
redirect(page_link_to('news'));
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
list($news) = $news;
|
||||
|
||||
sql_query("DELETE FROM `News` WHERE `ID`='" . sql_escape($news_id) . "' LIMIT 1");
|
||||
engelsystem_log("News deleted: " . $news['Betreff']);
|
||||
success(_("News entry deleted."));
|
||||
redirect(page_link_to("news"));
|
||||
DB::delete('DELETE FROM `News` WHERE `ID`=? LIMIT 1', [$news_id]);
|
||||
engelsystem_log('News deleted: ' . $news['Betreff']);
|
||||
success(_('News entry deleted.'));
|
||||
redirect(page_link_to('news'));
|
||||
break;
|
||||
default:
|
||||
redirect(page_link_to('news'));
|
||||
}
|
||||
return $html . '</div>';
|
||||
}
|
||||
?>
|
@ -1,9 +1,17 @@
|
||||
<?php
|
||||
function credits_title() {
|
||||
return _("Credits");
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function credits_title()
|
||||
{
|
||||
return _('Credits');
|
||||
}
|
||||
|
||||
function guest_credits() {
|
||||
return template_render(__DIR__ . '/../../templates/guest_credits.html', []);
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function guest_credits()
|
||||
{
|
||||
return view(__DIR__ . '/../../templates/guest_credits.html');
|
||||
}
|
||||
?>
|
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
function guest_start() {
|
||||
function guest_start()
|
||||
{
|
||||
redirect(page_link_to('login'));
|
||||
return true;
|
||||
}
|
||||
?>
|
@ -1,57 +1,88 @@
|
||||
<?php
|
||||
|
||||
function questions_title() {
|
||||
return _("Ask the Heaven");
|
||||
use Engelsystem\Database\DB;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function questions_title()
|
||||
{
|
||||
return _('Ask the Heaven');
|
||||
}
|
||||
|
||||
function user_questions() {
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
function user_questions()
|
||||
{
|
||||
global $user;
|
||||
$request = request();
|
||||
|
||||
if (! isset($_REQUEST['action'])) {
|
||||
$open_questions = sql_select("SELECT * FROM `Questions` WHERE `AID` IS NULL AND `UID`='" . sql_escape($user['UID']) . "'");
|
||||
if (!$request->has('action')) {
|
||||
$open_questions = DB::select(
|
||||
'SELECT * FROM `Questions` WHERE `AID` IS NULL AND `UID`=?',
|
||||
[$user['UID']]
|
||||
);
|
||||
|
||||
$answered_questions = sql_select("SELECT * FROM `Questions` WHERE NOT `AID` IS NULL AND `UID`='" . sql_escape($user['UID']) . "'");
|
||||
$answered_questions = DB::select(
|
||||
'SELECT * FROM `Questions` WHERE NOT `AID` IS NULL AND `UID`=?',
|
||||
[$user['UID']]
|
||||
);
|
||||
foreach ($answered_questions as &$question) {
|
||||
$answer_user_source = User($question['AID']);
|
||||
$question['answer_user'] = User_Nick_render($answer_user_source);
|
||||
}
|
||||
|
||||
return Questions_view($open_questions, $answered_questions, page_link_to("user_questions") . '&action=ask');
|
||||
return Questions_view(
|
||||
$open_questions,
|
||||
$answered_questions,
|
||||
page_link_to('user_questions', ['action' => 'ask'])
|
||||
);
|
||||
} else {
|
||||
switch ($_REQUEST['action']) {
|
||||
switch ($request->input('action')) {
|
||||
case 'ask':
|
||||
$question = strip_request_item_nl('question');
|
||||
if ($question != "") {
|
||||
$result = sql_query("INSERT INTO `Questions` SET `UID`='" . sql_escape($user['UID']) . "', `Question`='" . sql_escape($question) . "'");
|
||||
if ($result === false) {
|
||||
engelsystem_error(_("Unable to save question."));
|
||||
}
|
||||
success(_("You question was saved."));
|
||||
redirect(page_link_to("user_questions"));
|
||||
if ($question != '') {
|
||||
DB::insert('
|
||||
INSERT INTO `Questions` (`UID`, `Question`)
|
||||
VALUES (?, ?)
|
||||
',
|
||||
[$user['UID'], $question]
|
||||
);
|
||||
|
||||
success(_('You question was saved.'));
|
||||
redirect(page_link_to('user_questions'));
|
||||
} else {
|
||||
return page_with_title(questions_title(), [
|
||||
error(_("Please enter a question!"), true)
|
||||
error(_('Please enter a question!'), true)
|
||||
]);
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
||||
$question_id = $_REQUEST['id'];
|
||||
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
|
||||
$question_id = $request->input('id');
|
||||
} else {
|
||||
return error(_("Incomplete call, missing Question ID."), true);
|
||||
return error(_('Incomplete call, missing Question ID.'), true);
|
||||
}
|
||||
|
||||
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
||||
if (count($question) > 0 && $question[0]['UID'] == $user['UID']) {
|
||||
sql_query("DELETE FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
||||
redirect(page_link_to("user_questions"));
|
||||
$question = DB::selectOne(
|
||||
'SELECT `UID` FROM `Questions` WHERE `QID`=? LIMIT 1',
|
||||
[$question_id]
|
||||
);
|
||||
if (!empty($question) && $question['UID'] == $user['UID']) {
|
||||
DB::delete(
|
||||
'DELETE FROM `Questions` WHERE `QID`=? LIMIT 1',
|
||||
[$question_id]
|
||||
);
|
||||
redirect(page_link_to('user_questions'));
|
||||
} else {
|
||||
return page_with_title(questions_title(), [
|
||||
error(_("No question found."), true)
|
||||
error(_('No question found.'), true)
|
||||
]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
?>
|
@ -1,37 +1,50 @@
|
||||
<?php
|
||||
|
||||
function Questions_view($open_questions, $answered_questions, $ask_action) {
|
||||
/**
|
||||
* @param array[] $open_questions
|
||||
* @param array[] $answered_questions
|
||||
* @param string $ask_action
|
||||
* @return string
|
||||
*/
|
||||
function Questions_view($open_questions, $answered_questions, $ask_action)
|
||||
{
|
||||
foreach ($open_questions as &$question) {
|
||||
$question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
|
||||
$question['actions'] = '<a href="'
|
||||
. page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
|
||||
. '">'
|
||||
. _('delete')
|
||||
. '</a>';
|
||||
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
||||
}
|
||||
|
||||
foreach ($answered_questions as &$question) {
|
||||
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
||||
$question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
|
||||
$question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
|
||||
$question['actions'] = '<a href="'
|
||||
. page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
|
||||
. '">'
|
||||
. _('delete')
|
||||
. '</a>';
|
||||
}
|
||||
|
||||
return page_with_title(questions_title(), [
|
||||
msg(),
|
||||
heading(_("Open questions"), 2),
|
||||
heading(_('Open questions'), 2),
|
||||
table([
|
||||
'Question' => _("Question"),
|
||||
'actions' => ""
|
||||
'Question' => _('Question'),
|
||||
'actions' => ''
|
||||
], $open_questions),
|
||||
heading(_("Answered questions"), 2),
|
||||
heading(_('Answered questions'), 2),
|
||||
table([
|
||||
'Question' => _("Question"),
|
||||
'answer_user' => _("Answered by"),
|
||||
'Answer' => _("Answer"),
|
||||
'actions' => ""
|
||||
'Question' => _('Question'),
|
||||
'answer_user' => _('Answered by'),
|
||||
'Answer' => _('Answer'),
|
||||
'actions' => ''
|
||||
], $answered_questions),
|
||||
heading(_("Ask the Heaven"), 2),
|
||||
heading(_('Ask the Heaven'), 2),
|
||||
form([
|
||||
form_textarea('question', _("Your Question:"), ""),
|
||||
form_submit('submit', _("Save"))
|
||||
form_textarea('question', _('Your Question:'), ''),
|
||||
form_submit('submit', _('Save'))
|
||||
], $ask_action)
|
||||
]);
|
||||
}
|
||||
|
||||
?>
|
@ -1,20 +1,42 @@
|
||||
<?php
|
||||
use Engelsystem\ShiftsFilterRenderer;
|
||||
|
||||
use Engelsystem\ShiftCalendarRenderer;
|
||||
use Engelsystem\ShiftsFilterRenderer;
|
||||
|
||||
/**
|
||||
* @param array $room
|
||||
* @param ShiftsFilterRenderer $shiftsFilterRenderer
|
||||
* @param ShiftCalendarRenderer $shiftCalendarRenderer
|
||||
* @return string
|
||||
*/
|
||||
function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$assignNotice = '';
|
||||
if (config('signup_requires_arrival') && !$user['Gekommen']) {
|
||||
$assignNotice = info(render_user_arrived_hint(), true);
|
||||
}
|
||||
|
||||
function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer) {
|
||||
return page_with_title(glyph('map-marker') . $room['Name'], [
|
||||
$shiftsFilterRenderer->render(room_link($room)) ,
|
||||
$shiftsFilterRenderer->render(page_link_to('rooms', [
|
||||
'action' => 'view',
|
||||
'room_id' => $room['RID']
|
||||
])),
|
||||
$assignNotice,
|
||||
$shiftCalendarRenderer->render()
|
||||
]);
|
||||
}
|
||||
|
||||
function Room_name_render($room) {
|
||||
/**
|
||||
* @param array $room
|
||||
* @return string
|
||||
*/
|
||||
function Room_name_render($room)
|
||||
{
|
||||
global $privileges;
|
||||
if (in_array('view_rooms', $privileges)) {
|
||||
return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room['Name'] . '</a>';
|
||||
}
|
||||
return glyph('map-marker') . $room['Name'];
|
||||
}
|
||||
|
||||
?>
|
@ -1,88 +1,205 @@
|
||||
<?php
|
||||
|
||||
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter) {
|
||||
return page_with_title($supporter ? _("Add supporter rights") : _("Remove supporter rights"), [
|
||||
/**
|
||||
* @param array $user_angeltype
|
||||
* @param array $user
|
||||
* @param array $angeltype
|
||||
* @param bool $supporter
|
||||
* @return string
|
||||
*/
|
||||
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter)
|
||||
{
|
||||
return page_with_title($supporter ? _('Add supporter rights') : _('Remove supporter rights'), [
|
||||
msg(),
|
||||
info(sprintf($supporter ? _("Do you really want to add supporter rights for %s to %s?") : _("Do you really want to remove supporter rights for %s from %s?"), $angeltype['name'], User_Nick_render($user)), true),
|
||||
info(sprintf(
|
||||
$supporter
|
||||
? _('Do you really want to add supporter rights for %s to %s?')
|
||||
: _('Do you really want to remove supporter rights for %s from %s?'),
|
||||
$angeltype['name'],
|
||||
User_Nick_render($user)
|
||||
), true),
|
||||
buttons([
|
||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
||||
button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $user_angeltype['id'] . '&supporter=' . ($supporter ? '1' : '0') . '&confirmed', _("yes"), 'ok')
|
||||
button(
|
||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||
_('cancel'),
|
||||
'cancel'
|
||||
),
|
||||
button(
|
||||
page_link_to('user_angeltypes', [
|
||||
'action' => 'update',
|
||||
'user_angeltype_id' => $user_angeltype['id'],
|
||||
'supporter' => ($supporter ? '1' : '0'),
|
||||
'confirmed' => 1,
|
||||
]),
|
||||
_('yes'),
|
||||
'ok'
|
||||
)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
function UserAngelTypes_delete_all_view($angeltype) {
|
||||
return page_with_title(_("Deny all users"), [
|
||||
/**
|
||||
* @param array $angeltype
|
||||
* @return string
|
||||
*/
|
||||
function UserAngelTypes_delete_all_view($angeltype)
|
||||
{
|
||||
return page_with_title(_('Deny all users'), [
|
||||
msg(),
|
||||
info(sprintf(_("Do you really want to deny all users for %s?"), $angeltype['name']), true),
|
||||
info(sprintf(_('Do you really want to deny all users for %s?'), $angeltype['name']), true),
|
||||
buttons([
|
||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
||||
button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'] . '&confirmed', _("yes"), 'ok')
|
||||
button(
|
||||
page_link_to(
|
||||
'angeltypes',
|
||||
['action' => 'view', 'angeltype_id' => $angeltype['id']]
|
||||
),
|
||||
_('cancel'),
|
||||
'cancel'
|
||||
),
|
||||
button(
|
||||
page_link_to(
|
||||
'user_angeltypes',
|
||||
['action' => 'delete_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
|
||||
),
|
||||
_('yes'),
|
||||
'ok'
|
||||
)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
function UserAngelTypes_confirm_all_view($angeltype) {
|
||||
return page_with_title(_("Confirm all users"), [
|
||||
/**
|
||||
* @param array $angeltype
|
||||
* @return string
|
||||
*/
|
||||
function UserAngelTypes_confirm_all_view($angeltype)
|
||||
{
|
||||
return page_with_title(_('Confirm all users'), [
|
||||
msg(),
|
||||
info(sprintf(_("Do you really want to confirm all users for %s?"), $angeltype['name']), true),
|
||||
info(sprintf(_('Do you really want to confirm all users for %s?'), $angeltype['name']), true),
|
||||
buttons([
|
||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
||||
button(page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'] . '&confirmed', _("yes"), 'ok')
|
||||
button(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]), _('cancel'),
|
||||
'cancel'),
|
||||
button(
|
||||
page_link_to('user_angeltypes',
|
||||
['action' => 'confirm_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]),
|
||||
_('yes'),
|
||||
'ok'
|
||||
)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
function UserAngelType_confirm_view($user_angeltype, $user, $angeltype) {
|
||||
return page_with_title(_("Confirm angeltype for user"), [
|
||||
/**
|
||||
* @param array $user_angeltype
|
||||
* @param array $user
|
||||
* @param array $angeltype
|
||||
* @return string
|
||||
*/
|
||||
function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
|
||||
{
|
||||
return page_with_title(_('Confirm angeltype for user'), [
|
||||
msg(),
|
||||
info(sprintf(_("Do you really want to confirm %s for %s?"), User_Nick_render($user), $angeltype['name']), true),
|
||||
info(sprintf(_('Do you really want to confirm %s for %s?'), User_Nick_render($user), $angeltype['name']), true),
|
||||
buttons([
|
||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
||||
button(page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed', _("yes"), 'ok')
|
||||
button(
|
||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||
_('cancel'),
|
||||
'cancel'
|
||||
),
|
||||
button(
|
||||
page_link_to(
|
||||
'user_angeltypes',
|
||||
['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]
|
||||
),
|
||||
_('yes'),
|
||||
'ok'
|
||||
)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
function UserAngelType_delete_view($user_angeltype, $user, $angeltype) {
|
||||
return page_with_title(_("Remove angeltype"), [
|
||||
/**
|
||||
* @param array $user_angeltype
|
||||
* @param array $user
|
||||
* @param array $angeltype
|
||||
* @return string
|
||||
*/
|
||||
function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
|
||||
{
|
||||
return page_with_title(_('Remove angeltype'), [
|
||||
msg(),
|
||||
info(sprintf(_("Do you really want to delete %s from %s?"), User_Nick_render($user), $angeltype['name']), true),
|
||||
info(sprintf(_('Do you really want to delete %s from %s?'), User_Nick_render($user), $angeltype['name']), true),
|
||||
buttons([
|
||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
||||
button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed', _("yes"), 'ok')
|
||||
button(
|
||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||
_('cancel'),
|
||||
'cancel'
|
||||
),
|
||||
button(
|
||||
page_link_to('user_angeltypes',
|
||||
['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]),
|
||||
_('yes'),
|
||||
'ok'
|
||||
)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
function UserAngelType_add_view($angeltype, $users_source, $user_id) {
|
||||
/**
|
||||
* @param array $angeltype
|
||||
* @param array[] $users_source
|
||||
* @param int $user_id
|
||||
* @return string
|
||||
*/
|
||||
function UserAngelType_add_view($angeltype, $users_source, $user_id)
|
||||
{
|
||||
$users = [];
|
||||
foreach ($users_source as $user_source) {
|
||||
$users[$user_source['UID']] = User_Nick_render($user_source);
|
||||
}
|
||||
|
||||
return page_with_title(_("Add user to angeltype"), [
|
||||
return page_with_title(_('Add user to angeltype'), [
|
||||
msg(),
|
||||
buttons([
|
||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("back"), 'back')
|
||||
button(
|
||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||
_('back'),
|
||||
'back'
|
||||
)
|
||||
]),
|
||||
form([
|
||||
form_info(_("Angeltype"), $angeltype['name']),
|
||||
form_select('user_id', _("User"), $users, $user_id),
|
||||
form_submit('submit', _("Add"))
|
||||
form_info(_('Angeltype'), $angeltype['name']),
|
||||
form_select('user_id', _('User'), $users, $user_id),
|
||||
form_submit('submit', _('Add'))
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
function UserAngelType_join_view($user, $angeltype) {
|
||||
return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), [
|
||||
/**
|
||||
* @param array $user
|
||||
* @param array $angeltype
|
||||
* @return string
|
||||
*/
|
||||
function UserAngelType_join_view($user, $angeltype)
|
||||
{
|
||||
return page_with_title(sprintf(_('Become a %s'), $angeltype['name']), [
|
||||
msg(),
|
||||
info(sprintf(_("Do you really want to add %s to %s?"), User_Nick_render($user), $angeltype['name']), true),
|
||||
info(sprintf(_('Do you really want to add %s to %s?'), User_Nick_render($user), $angeltype['name']), true),
|
||||
buttons([
|
||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
||||
button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed', _("save"), 'ok')
|
||||
button(
|
||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||
_('cancel'),
|
||||
'cancel'
|
||||
),
|
||||
button(
|
||||
page_link_to(
|
||||
'user_angeltypes',
|
||||
['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user['UID'], 'confirmed' => 1]
|
||||
),
|
||||
_('save'),
|
||||
'ok'
|
||||
)
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
?>
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,19 @@
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.5/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
bootstrap="./includes/engelsystem_provider.php"
|
||||
bootstrap="./tests/autoload.php"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.3/phpunit.xsd"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false">
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Models">
|
||||
<directory>./test/model/</directory>
|
||||
<testsuite name="Feature">
|
||||
<directory>./tests/Feature</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Unit">
|
||||
<directory>./tests/Unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./include/</directory>
|
||||
<directory>./public/</directory>
|
||||
<directory>./src/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<const name="PHPUNIT_TESTSUITE" value="true" />
|
||||
</php>
|
||||
</phpunit>
|
||||
|
@ -0,0 +1,8 @@
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine on
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue