├── themes ├── theme0.less ├── build-themes.sh ├── theme2.less ├── theme3.less ├── theme4.less ├── theme5.less └── base.less ├── public ├── vendor │ ├── bootstrap │ ├── icomoon │ │ ├── fonts │ │ │ ├── icomoon.eot │ │ │ ├── icomoon.ttf │ │ │ ├── icomoon.woff │ │ │ └── icomoon.svg │ │ ├── style.css │ │ └── selection.json │ └── bootstrap-datepicker-1.4.0 │ │ └── locales │ │ └── bootstrap-datepicker.de.min.js ├── pic │ ├── smiles │ │ ├── bun.gif │ │ ├── huh.gif │ │ ├── moo.gif │ │ ├── alien.gif │ │ ├── blush.gif │ │ ├── dead.gif │ │ ├── love1.gif │ │ ├── nuts.gif │ │ ├── robin.gif │ │ ├── sheep.gif │ │ ├── sick.gif │ │ ├── sleep.gif │ │ ├── soppy.gif │ │ ├── sweet.gif │ │ ├── tired.gif │ │ ├── urgh.gif │ │ ├── worm.gif │ │ ├── worry.gif │ │ ├── aerger2.gif │ │ ├── boggle.gif │ │ ├── bounce.gif │ │ ├── cheesy.gif │ │ ├── ginger.gif │ │ ├── hirsch1.gif │ │ ├── icon_cry.gif │ │ ├── icon_eek.gif │ │ ├── icon_lol.gif │ │ ├── icon_mad.gif │ │ ├── icon_sad.gif │ │ ├── koenig1.gif │ │ ├── laser1.gif │ │ ├── stress.gif │ │ ├── winken1.gif │ │ ├── candycane.gif │ │ ├── depressed.gif │ │ ├── icon_arrow.gif │ │ ├── icon_cool.gif │ │ ├── icon_evil.gif │ │ ├── icon_frown.gif │ │ ├── icon_idea.gif │ │ ├── icon_razz.gif │ │ ├── icon_smile.gif │ │ ├── icon_wind.gif │ │ ├── icon_biggrin.gif │ │ ├── icon_confused.gif │ │ ├── icon_exclaim.gif │ │ ├── icon_mrgreen.gif │ │ ├── icon_neutral.gif │ │ ├── icon_question.gif │ │ ├── icon_redface.gif │ │ ├── icon_rolleyes.gif │ │ ├── icon_twisted.gif │ │ └── icon_surprised.gif │ └── flag │ │ ├── bg_BG.UTF-8.png │ │ ├── de_DE.UTF-8.png │ │ ├── en_GB.UTF-8.png │ │ ├── en_US.UTF-8.png │ │ ├── fi_FI.UTF-8.png │ │ ├── fr_FR.UTF-8.png │ │ ├── hi_IN.UTF-8.png │ │ ├── hu_HU.UTF-8.png │ │ ├── ne_NP.UTF-8.png │ │ ├── pa_IN.UTF-8.png │ │ ├── sp_EU.UTF-8.png │ │ ├── ta_IN.UTF-8.png │ │ └── zn_CH.UTF-8.png ├── js │ ├── moment-countdown.js │ ├── reCaptcha_api.js │ └── forms.js └── maintenance.html ├── Procfile ├── includes ├── controller │ ├── guest_start_controller.php │ ├── rooms_controller.php │ ├── guest_credits_controller.php │ ├── guest_stats_controller.php │ ├── admin_log_controller.php │ ├── user_atom_controller.php │ ├── user_questions_controller.php │ ├── user_ical_controller.php │ ├── admin_cgroups_controller.php │ ├── admin_news_controller.php │ ├── admin_free_controller.php │ ├── admin_groups_controller.php │ ├── admin_events_controller.php │ ├── shifts_controller.php │ ├── user_myshifts_controller.php │ └── admin_questions_controller.php ├── helper │ ├── error_helper.php │ ├── email_helper.php │ ├── graph_helper.php │ ├── message_helper.php │ └── internationalization_helper.php ├── view │ ├── Rooms_view.php │ ├── Questions_view.php │ ├── ShiftEntry_view.php │ ├── UserDriverLicenses_view.php │ ├── ShiftTypes_view.php │ └── UserAngelTypes_view.php ├── mailer │ ├── users_mailer.php │ └── shifts_mailer.php ├── model │ ├── WelcomeMessage_model.php │ ├── Privileges_model.php │ ├── NewsComments_model.php │ ├── admin_export_model.php │ ├── import_model.php │ ├── LogEntries_model.php │ ├── GroupPrivileges_model.php │ ├── UserGroups_model.php │ ├── ShiftTypes_model.php │ ├── Groups_model.php │ ├── Settings_model.php │ ├── Questions_model.php │ ├── News_model.php │ ├── UserDriverLicenses_model.php │ ├── Room_model.php │ ├── Message_model.php │ └── Events_model.php ├── sys_log.php ├── sys_page.php └── sys_auth.php ├── .gitignore ├── locale └── de_DE.UTF-8 │ └── LC_MESSAGES │ └── default.mo ├── .gitmodules ├── docs ├── TESTS.md ├── INSTALLATION_BASH_SCRIPT.md ├── INSTALLATION_DOCKER.md ├── CONFIGURATION_DOCUMENT_ROOT.md ├── INSTALLATION_FIVE_MINUTES.md ├── DATABASE_MIGRATIONS.md ├── HEROKU.md ├── INSTALLATION_LOCAL.md └── INSTALLATION_SERVER.md ├── composer.json ├── test ├── model │ ├── Message_model_test.php │ ├── LogEntries_model_test.php │ ├── NeededAngeltype_model_test.php │ ├── Room_model_test.php │ ├── ShiftType_model_test.php │ ├── News_model_test.php │ ├── Questions_model_test.php │ ├── Groups_model_test.php │ ├── Privileges_model_test.php │ ├── AngelType_model_test.php │ ├── Shifts_model_test.php │ ├── NewsComments_model_test.php │ ├── GroupPrivileges_model_test.php │ ├── UserGroups_model_test.php │ └── User_model_test.php └── phpunit.xml ├── circle.yml ├── .travis.yml ├── phinx.yml ├── db ├── migrations │ ├── 20160711044444_welcome_message.php │ ├── 20160711044526_settings.php │ ├── 20160711044456_events.php │ ├── 20160711044518_angel_types.php │ ├── 20160711044506_user.php │ ├── 20160711044419_user_driver_licenses.php │ └── 20160711044551_privileges.php └── update.sql ├── Dockerfile ├── templates ├── guest_credits.html ├── user_shifts.html └── layout.html ├── install_dependencies.sh ├── Readme-De.md ├── config └── config-sample.default.php ├── codecov.yml └── install.php /themes/theme0.less: -------------------------------------------------------------------------------- 1 | @import "base.less"; -------------------------------------------------------------------------------- /public/vendor/bootstrap: -------------------------------------------------------------------------------- 1 | ../../vendor/bootstrap/dist -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: vendor/bin/heroku-php-apache2 public/ 2 | -------------------------------------------------------------------------------- /public/pic/smiles/bun.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/bun.gif -------------------------------------------------------------------------------- /public/pic/smiles/huh.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/huh.gif -------------------------------------------------------------------------------- /public/pic/smiles/moo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/moo.gif -------------------------------------------------------------------------------- /public/pic/smiles/alien.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/alien.gif -------------------------------------------------------------------------------- /public/pic/smiles/blush.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/blush.gif -------------------------------------------------------------------------------- /public/pic/smiles/dead.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/dead.gif -------------------------------------------------------------------------------- /public/pic/smiles/love1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/love1.gif -------------------------------------------------------------------------------- /public/pic/smiles/nuts.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/nuts.gif -------------------------------------------------------------------------------- /public/pic/smiles/robin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/robin.gif -------------------------------------------------------------------------------- /public/pic/smiles/sheep.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/sheep.gif -------------------------------------------------------------------------------- /public/pic/smiles/sick.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/sick.gif -------------------------------------------------------------------------------- /public/pic/smiles/sleep.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/sleep.gif -------------------------------------------------------------------------------- /public/pic/smiles/soppy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/soppy.gif -------------------------------------------------------------------------------- /public/pic/smiles/sweet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/sweet.gif -------------------------------------------------------------------------------- /public/pic/smiles/tired.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/tired.gif -------------------------------------------------------------------------------- /public/pic/smiles/urgh.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/urgh.gif -------------------------------------------------------------------------------- /public/pic/smiles/worm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/worm.gif -------------------------------------------------------------------------------- /public/pic/smiles/worry.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/worry.gif -------------------------------------------------------------------------------- /public/pic/smiles/aerger2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/aerger2.gif -------------------------------------------------------------------------------- /public/pic/smiles/boggle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/boggle.gif -------------------------------------------------------------------------------- /public/pic/smiles/bounce.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/bounce.gif -------------------------------------------------------------------------------- /public/pic/smiles/cheesy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/cheesy.gif -------------------------------------------------------------------------------- /public/pic/smiles/ginger.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/ginger.gif -------------------------------------------------------------------------------- /public/pic/smiles/hirsch1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/hirsch1.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_cry.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_cry.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_eek.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_eek.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_lol.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_lol.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_mad.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_mad.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_sad.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_sad.gif -------------------------------------------------------------------------------- /public/pic/smiles/koenig1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/koenig1.gif -------------------------------------------------------------------------------- /public/pic/smiles/laser1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/laser1.gif -------------------------------------------------------------------------------- /public/pic/smiles/stress.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/stress.gif -------------------------------------------------------------------------------- /public/pic/smiles/winken1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/winken1.gif -------------------------------------------------------------------------------- /public/pic/flag/bg_BG.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/bg_BG.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/de_DE.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/de_DE.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/en_GB.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/en_GB.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/en_US.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/en_US.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/fi_FI.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/fi_FI.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/fr_FR.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/fr_FR.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/hi_IN.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/hi_IN.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/hu_HU.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/hu_HU.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/ne_NP.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/ne_NP.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/pa_IN.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/pa_IN.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/sp_EU.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/sp_EU.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/ta_IN.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/ta_IN.UTF-8.png -------------------------------------------------------------------------------- /public/pic/flag/zn_CH.UTF-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/flag/zn_CH.UTF-8.png -------------------------------------------------------------------------------- /public/pic/smiles/candycane.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/candycane.gif -------------------------------------------------------------------------------- /public/pic/smiles/depressed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/depressed.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_arrow.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_cool.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_cool.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_evil.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_evil.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_frown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_frown.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_idea.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_idea.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_razz.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_razz.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_smile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_smile.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_wind.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_wind.gif -------------------------------------------------------------------------------- /includes/controller/guest_start_controller.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/pic/smiles/icon_biggrin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_biggrin.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_confused.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_confused.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_exclaim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_exclaim.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_mrgreen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_mrgreen.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_neutral.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_neutral.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_question.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_question.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_redface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_redface.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_rolleyes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_rolleyes.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_twisted.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_twisted.gif -------------------------------------------------------------------------------- /public/pic/smiles/icon_surprised.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/pic/smiles/icon_surprised.gif -------------------------------------------------------------------------------- /public/vendor/icomoon/fonts/icomoon.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/vendor/icomoon/fonts/icomoon.eot -------------------------------------------------------------------------------- /public/vendor/icomoon/fonts/icomoon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/vendor/icomoon/fonts/icomoon.ttf -------------------------------------------------------------------------------- /public/vendor/icomoon/fonts/icomoon.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/public/vendor/icomoon/fonts/icomoon.woff -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .buildpath 3 | .settings 4 | .*.swp 5 | _vimrc_local.vim 6 | .sass-cache 7 | config/config.php 8 | test/coverage 9 | .idea/ -------------------------------------------------------------------------------- /locale/de_DE.UTF-8/LC_MESSAGES/default.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fossasia/engelsystem/development/locale/de_DE.UTF-8/LC_MESSAGES/default.mo -------------------------------------------------------------------------------- /includes/controller/rooms_controller.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/parsedown"] 2 | path = vendor/parsedown 3 | url = https://github.com/erusev/parsedown.git 4 | [submodule "vendor/bootstrap"] 5 | path = vendor/bootstrap 6 | url = https://github.com/twbs/bootstrap.git 7 | -------------------------------------------------------------------------------- /includes/helper/error_helper.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/controller/guest_credits_controller.php: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /docs/TESTS.md: -------------------------------------------------------------------------------- 1 | ## Running tests for Engelsystem: 2 | * First install the repo and set up the server according to the steps listed in README. 3 | 4 | * Next go to the project directory and run the following command: 5 | ``` 6 | $ cd test 7 | $ phpunit model/filename 8 | 9 | ``` 10 | * It will run each test one by one. -------------------------------------------------------------------------------- /includes/view/Rooms_view.php: -------------------------------------------------------------------------------- 1 | ' . glyph('map-marker') . $room['Name'] . ''; 7 | return glyph('map-marker') . $room['Name']; 8 | } 9 | 10 | ?> -------------------------------------------------------------------------------- /themes/build-themes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | lessc theme0.less > ../public/css/theme0.css 4 | lessc theme1.less > ../public/css/theme1.css 5 | lessc theme2.less > ../public/css/theme2.css 6 | lessc theme3.less > ../public/css/theme3.css 7 | lessc theme4.less > ../public/css/theme4.css 8 | lessc theme5.less > ../public/css/theme5.css 9 | -------------------------------------------------------------------------------- /includes/mailer/users_mailer.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fossasia/engelsystem", 3 | "license": "fossasia", 4 | "support": { 5 | "issues": "https://github.com/fossasia/engelsystem/issues", 6 | "source": "https://github.com/fossasia/engelsystem" 7 | }, 8 | "require": { 9 | "ext-mysql": "*", 10 | "ext-gettext": "*", 11 | "robmorgan/phinx": "^0.6.2" 12 | }, 13 | "require-dev": { 14 | "heroku/heroku-buildpack-php": "*" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /test/model/Message_model_test.php: -------------------------------------------------------------------------------- 1 | message_id = Message_ids(); 8 | if (count($this->message_id) == 0) { 9 | $this->assertEquals(count($this->message_id), 0); 10 | } 11 | else { 12 | $this->assertTrue(Message_send($this->message_id[0], 'test message')); 13 | } 14 | } 15 | } 16 | ?> 17 | -------------------------------------------------------------------------------- /public/js/moment-countdown.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $.each($('.moment-countdown'), function(i, e) { 3 | var span = $(e); 4 | var text = span.html(); 5 | var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000)); 6 | span.html(text.replace("%c", timestamp.fromNow())); 7 | setInterval(function() { 8 | span.html(text.replace("%c", timestamp.fromNow())); 9 | }, 1000); 10 | }); 11 | }); -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | php: 3 | version: 5.4.5 4 | deployment: 5 | master: 6 | branch: master 7 | owner: fossasia 8 | commands: 9 | - ./deploy_master.sh 10 | dependencies: 11 | pre: 12 | - curl -s http://getcomposer.org/installer | php 13 | - php composer.phar install -n 14 | - sed -i 's/^;//' ~/.phpenv/versions/$(phpenv global)/etc/conf.d/xdebug.ini 15 | 16 | test: 17 | post: 18 | - php test/ 19 | - bash <(curl -s https://codecov.io/bash) 20 | -------------------------------------------------------------------------------- /docs/INSTALLATION_BASH_SCRIPT.md: -------------------------------------------------------------------------------- 1 | # INSTALLATION OF ENGELSYSTEM 2 | 3 | - Engelsystem can be installed in your local server through install_dependencies.sh file. 4 | 5 | #### Steps to setup engelsystem using install.sh 6 | 7 | ### Step 1 8 | - download [install_dependencies.sh](/install_dependencies.sh). 9 | 10 | ### Step 2 11 | - change the permissions of `install_dependencies.sh` 12 | - `$ chmod +x install_dependencies.sh` 13 | 14 | ### Step 3 15 | - Execute the file 16 | - ` $ ./install_dependencies.sh` 17 | 18 | - Now engelsystem is successfully installed. 19 | -------------------------------------------------------------------------------- /public/vendor/bootstrap-datepicker-1.4.0/locales/bootstrap-datepicker.de.min.js: -------------------------------------------------------------------------------- 1 | !function(a){a.fn.datepicker.dates.de={days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag","Sonntag"],daysShort:["Son","Mon","Die","Mit","Don","Fre","Sam","Son"],daysMin:["So","Mo","Di","Mi","Do","Fr","Sa","So"],months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],today:"Heute",clear:"Löschen",weekStart:1,format:"dd.mm.yyyy"}}(jQuery); -------------------------------------------------------------------------------- /test/phpunit.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | model 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /includes/model/WelcomeMessage_model.php: -------------------------------------------------------------------------------- 1 | 25 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - '5.4' 4 | - '5.5' 5 | - '5.6' 6 | - '7.0' 7 | 8 | services: 9 | - mysql 10 | 11 | before_script: 12 | - mysql -e "create database engelsystem;" -uroot; 13 | - mysql -e "use engelsystem;" -uroot; 14 | - mysql engelsystem -e "source ./db/install.sql;" -uroot; 15 | - mysql engelsystem -e "source ./db/update.sql;" -uroot; 16 | 17 | script: cd test && phpunit 18 | 19 | after_success: 20 | - bash <(curl -s https://codecov.io/bash) 21 | addons: 22 | code_climate: 23 | repo_token: f18d878e6000ffe79bf07df5fc8a7655185edb13a8103d05e0de9fa9d80941f0 24 | -------------------------------------------------------------------------------- /includes/model/Privileges_model.php: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /public/js/reCaptcha_api.js: -------------------------------------------------------------------------------- 1 | /* PLEASE DO NOT COPY AND PASTE THIS CODE. */ 2 | (function() { 3 | if (!window['___grecaptcha_cfg']) { 4 | window['___grecaptcha_cfg'] = {}; 5 | }; 6 | if (!window['___grecaptcha_cfg']['render']) { 7 | window['___grecaptcha_cfg']['render'] = 'onload'; 8 | }; 9 | window['__google_recaptcha_client'] = true; 10 | var po = document.createElement('script'); 11 | po.type = 'text/javascript'; 12 | po.async = true; 13 | po.src = 'https://www.gstatic.com/recaptcha/api2/r20160615154650/recaptcha__en.js'; 14 | var s = document.getElementsByTagName('script')[0]; 15 | s.parentNode.insertBefore(po, s); 16 | } 17 | )(); 18 | -------------------------------------------------------------------------------- /includes/model/NewsComments_model.php: -------------------------------------------------------------------------------- 1 | 25 | -------------------------------------------------------------------------------- /public/js/forms.js: -------------------------------------------------------------------------------- 1 | function check_all(id) { 2 | var obj = document.getElementById(id); 3 | var boxes = obj.getElementsByTagName("input"); 4 | for ( var i = 0; i < boxes.length; i++) { 5 | if (boxes[i].type == "checkbox" && !boxes[i].disabled) 6 | boxes[i].checked = true; 7 | } 8 | } 9 | 10 | function uncheck_all(id) { 11 | var obj = document.getElementById(id); 12 | var boxes = obj.getElementsByTagName("input"); 13 | for ( var i = 0; i < boxes.length; i++) { 14 | if (boxes[i].type == "checkbox") 15 | boxes[i].checked = false; 16 | } 17 | } 18 | 19 | $(function() { 20 | $('form').submit(function(ev) { 21 | $('input[type="submit"]').prop("readonly", true).addClass("disabled"); 22 | return true; 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /phinx.yml: -------------------------------------------------------------------------------- 1 | paths: 2 | migrations: %%PHINX_CONFIG_DIR%%/db/migrations 3 | seeds: %%PHINX_CONFIG_DIR%%/db/seeds 4 | 5 | environments: 6 | default_migration_table: phinxlog 7 | default_database: engelsytem 8 | production: 9 | adapter: mysql 10 | host: localhost 11 | name: engelsytem 12 | user: root 13 | pass: '' 14 | port: 3306 15 | charset: utf8 16 | 17 | development: 18 | adapter: mysql 19 | host: localhost 20 | name: engelsytem 21 | user: root 22 | pass: '' 23 | port: 3306 24 | charset: utf8 25 | 26 | testing: 27 | adapter: mysql 28 | host: localhost 29 | name: engelsytem 30 | user: root 31 | pass: '' 32 | port: 3306 33 | charset: utf8 34 | -------------------------------------------------------------------------------- /db/migrations/20160711044444_welcome_message.php: -------------------------------------------------------------------------------- 1 | "By completing this form you're registering as a Chaos-Angel. This script will create you an account in the angel task sheduler" 14 | ]; 15 | $displaymsg = $this->table('Welcome_Message', array('id' => 'event_id')); 16 | $displaymsg->addColumn('display_msg', 'string', array('limit' => 255, 'null' => false)) 17 | ->insert($singleRow) 18 | ->save(); 19 | } 20 | 21 | /** 22 | * Migrate Down. 23 | */ 24 | public function down() 25 | { 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /public/vendor/icomoon/style.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'icomoon'; 3 | src:url('fonts/icomoon.eot?-kja6ux'); 4 | src:url('fonts/icomoon.eot?#iefix-kja6ux') format('embedded-opentype'), 5 | url('fonts/icomoon.woff?-kja6ux') format('woff'), 6 | url('fonts/icomoon.ttf?-kja6ux') format('truetype'), 7 | url('fonts/icomoon.svg?-kja6ux#icomoon') format('svg'); 8 | font-weight: normal; 9 | font-style: normal; 10 | } 11 | 12 | [class^="icon-"], [class*=" icon-"] { 13 | font-family: 'icomoon'; 14 | speak: none; 15 | font-style: normal; 16 | font-weight: normal; 17 | font-variant: normal; 18 | text-transform: none; 19 | line-height: 1; 20 | 21 | /* Better Font Rendering =========== */ 22 | -webkit-font-smoothing: antialiased; 23 | -moz-osx-font-smoothing: grayscale; 24 | } 25 | 26 | .icon-icon_angel:before { 27 | content: "\e600"; 28 | } 29 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | MAINTAINER Sreeja Kamishetty 3 | 4 | ENV DEBIAN_FRONTEND noninteractive 5 | 6 | #Update 7 | RUN apt-get update 8 | RUN apt-get upgrade -y 9 | 10 | #Install proper dependencies 11 | RUN apt-get install -y git wget 12 | 13 | #run the script 14 | RUN apt-get install -y apache2 15 | RUN apt-get install mysql-server php5-mysql 16 | RUN mysql_install_db 17 | RUN apt-get install php5 libapache2-mod-php5 php5-mcrypt 18 | RUN service apache2 restart 19 | RUN apt-cache search php5-cgi 20 | 21 | #Clone the source 22 | RUN git clone https://github.com/fossasia/engelsystem.git 23 | 24 | #cd into the dir 25 | WORKDIR engelsystem 26 | #add the mysql root password 27 | COPY config/config.default.php config/config.php 28 | RUN mysql -u root -p engelsystem < db/install.sql 29 | RUN mysql -u root -p engelsystem < db/update.sql 30 | EXPOSE 80 31 | -------------------------------------------------------------------------------- /includes/model/admin_export_model.php: -------------------------------------------------------------------------------- 1 | 38 | -------------------------------------------------------------------------------- /test/model/LogEntries_model_test.php: -------------------------------------------------------------------------------- 1 | assertNotFalse(LogEntry_create('test', 'test_LogEntry_create')); 12 | 13 | // There should be one more log entry now 14 | $this->assertEquals(count(LogEntries()), $count + 1); 15 | } 16 | 17 | public function test_LogEntries_clear_all() { 18 | $this->create_LogEntry(); 19 | $this->assertTrue(count(LogEntries()) > 0); 20 | $this->assertNotFalse(LogEntries_clear_all()); 21 | $this->assertEquals(count(LogEntries()), 0); 22 | } 23 | 24 | /** 25 | * @after 26 | */ 27 | public function teardown() { 28 | LogEntries_clear_all(); 29 | } 30 | } 31 | 32 | ?> -------------------------------------------------------------------------------- /includes/helper/email_helper.php: -------------------------------------------------------------------------------- 1 | "); 19 | } 20 | 21 | ?> -------------------------------------------------------------------------------- /includes/model/import_model.php: -------------------------------------------------------------------------------- 1 | 29 | -------------------------------------------------------------------------------- /db/migrations/20160711044526_settings.php: -------------------------------------------------------------------------------- 1 | table('Settings'); 13 | $table->addColumn('event_name', 'string', array('limit' => 255)) 14 | ->addColumn('buildup_start_date', 'integer', array('limit' => 11)) 15 | ->addColumn('event_start_date', 'integer', array('limit' => 11)) 16 | ->addColumn('event_end_date', 'integer', array('limit' => 11)) 17 | ->addColumn('teardown_end_date', 'integer', array( 'limit' => 11)) 18 | ->addColumn('event_welcome_msg', 'string', array('limit' => 255)) 19 | ->save(); 20 | } 21 | 22 | /** 23 | * Migrate Down. 24 | */ 25 | public function down() 26 | { 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /includes/sys_log.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/model/NeededAngeltype_model_test.php: -------------------------------------------------------------------------------- 1 | getTimestamp(); 11 | $shift_id['title'] = ""; 12 | $shift_id['shifttype_id'] = null; 13 | $shift_id['URL'] = null; 14 | $shift_id['PSID'] = null; 15 | $shift_id['created_by_user_id'] = null; 16 | $shift_id['created_at_timestamp'] = time(); 17 | $this->shift_id1 = Shift_create($shift_id); 18 | $this->shift_id2 = Shift_create($shift_id); 19 | } 20 | 21 | public function test_NeededAngeltype() { 22 | $this->create_shift(); 23 | $NeededAngeltype = NeededAngelTypes_by_shift($this->shift_id1); 24 | $this->assertNotFalse($NeededAngeltype); 25 | $this->assertNotNull($NeededAngeltype); 26 | } 27 | } 28 | ?> -------------------------------------------------------------------------------- /themes/theme2.less: -------------------------------------------------------------------------------- 1 | @import "../vendor/bootstrap/less/variables"; 2 | 3 | @brand-primary: #758499; 4 | @brand-success: #7b9c41; 5 | @brand-info: #9c7357; 6 | @brand-warning: #e3a14d; 7 | @brand-danger: #7f528b; 8 | 9 | @link-color: #58585a; 10 | 11 | @state-success-text: #638232; 12 | @state-success-bg: lighten(@brand-success,50%); 13 | @state-success-border: @brand-success; 14 | 15 | @state-info-text: #826045; 16 | @state-info-bg: lighten(@brand-info,50%); 17 | @state-info-border: @brand-info; 18 | 19 | @state-warning-text: #bc8640; 20 | @state-warning-bg: lighten(@brand-warning,50%); 21 | @state-warning-border: @brand-warning; 22 | 23 | @state-danger-text: #694374; 24 | @state-danger-bg: lighten(@brand-danger,50%); 25 | @state-danger-border: @brand-danger; 26 | 27 | @import "base.less"; 28 | -------------------------------------------------------------------------------- /includes/controller/guest_stats_controller.php: -------------------------------------------------------------------------------- 1 | "Wrong api_key."))); 25 | } else die(json_encode(array('error' => "Missing parameter api_key."))); 26 | } 27 | ?> 28 | -------------------------------------------------------------------------------- /includes/model/LogEntries_model.php: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /test/model/Room_model_test.php: -------------------------------------------------------------------------------- 1 | room_id = Room_create('test', false, true, ''); 9 | } 10 | 11 | public function test_Room_create() { 12 | $count = count(Room()); 13 | $this->assertNotFalse(Room_create('test1', false, true, '')); 14 | 15 | // There should be one more Shift entry now 16 | $this->assertEquals(count(Room()), $count + 1); 17 | } 18 | 19 | public function test_Room() { 20 | $this->create_Room(); 21 | $room = Room($this->room_id); 22 | $this->assertNotFalse($room); 23 | $this->assertTrue(count(Rooms()) > 0); 24 | $this->assertNotNull($room); 25 | $this->assertEquals($room['Name'], 'test'); 26 | $this->assertEquals(count(Rooms()), 0); 27 | $this->assertNull(Room(- 1)); 28 | } 29 | 30 | /** 31 | * @after 32 | */ 33 | public function teardown() { 34 | if ($this->room_id != null) 35 | Room_delete($this->room_id); 36 | } 37 | 38 | } 39 | ?> -------------------------------------------------------------------------------- /db/migrations/20160711044456_events.php: -------------------------------------------------------------------------------- 1 | table('events', array('id' => 'event_id', 'limit' => 11)); 13 | $events->addColumn('name', 'string', array('limit' => 255, 'null' => false)) 14 | ->addColumn('description', 'string', array('limit' => 255, 'null' => false)) 15 | ->addColumn('organizer', 'string', array('limit' => 255, 'null' => false)) 16 | ->addColumn('start_date', 'datetime', array('null' => false, 'default' => '2000-01-01 00:00:00')) 17 | ->addColumn('end_date', 'datetime', array( 'null' => false, 'default' => '2000-01-01 00:00:00')) 18 | ->addIndex(array('name'), array('unique' => true, 'name' => 'Name')) 19 | ->save(); 20 | } 21 | 22 | /** 23 | * Migrate Down. 24 | */ 25 | public function down() 26 | { 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /includes/model/GroupPrivileges_model.php: -------------------------------------------------------------------------------- 1 | 35 | -------------------------------------------------------------------------------- /public/vendor/icomoon/fonts/icomoon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/model/ShiftType_model_test.php: -------------------------------------------------------------------------------- 1 | shift_id = ShiftType_create('test', '1', 'test_description'); 9 | } 10 | 11 | public function test_ShiftType_create() { 12 | $count = count(ShiftTypes()); 13 | $this->assertNotFalse(create_ShiftType($shift_id)); 14 | 15 | // There should be one more ShiftTypes now 16 | $this->assertEquals(count(ShiftTypes()), $count + 1); 17 | } 18 | 19 | public function test_ShiftType(){ 20 | $this->create_ShiftType(); 21 | $shift_type = ShiftType($this->shift_id); 22 | $this->assertNotFalse($shift_type); 23 | $this->assertTrue(count(ShiftTypes()) > 0); 24 | $this->assertNotNull($shift_type); 25 | $this->assertEquals($shift_type['name'], 'test'); 26 | $this->assertEquals(count(ShiftTypes()), 0); 27 | $this->assertNull(ShiftTypes(-1)); 28 | } 29 | 30 | public function teardown() { 31 | if ($this->shift_id != null) 32 | ShiftType_delete($this->shift_id); 33 | } 34 | 35 | } 36 | 37 | ?> -------------------------------------------------------------------------------- /db/migrations/20160711044518_angel_types.php: -------------------------------------------------------------------------------- 1 | table('AngelTypes'); 31 | $table->addColumn('requires_driver_license', 'boolean', array('null' => 'false')) 32 | ->update(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /docs/INSTALLATION_DOCKER.md: -------------------------------------------------------------------------------- 1 | # How do I install Engelsystem on Docker 2 | ## Install with Docker on Ubuntu: 3 | * prerequisities 4 | * docker requires a 64-bit installation 5 | * kernel must be 3.10 or above ( uname -r) 6 | *To upgrade your kernel and install the additional packages, do the following: 7 | * Update your package manager & Login as a Root. 8 | ``` 9 | $ sudo apt-get update 10 | ``` 11 | * Install both the required and optional packages. 12 | ``` 13 | sudo apt-get install linux-image-generic-lts-trusty 14 | sudo apt-get install linux-image-extra-`uname -r` 15 | ``` 16 | * Go ahead and Get the latest version of docker: 17 | ``` 18 | sudo apt-get update 19 | sudo apt-get upgrade 20 | sudo apt-get install linux-image-extra-`uname -r` 21 | sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D 22 | echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list 23 | sudo apt-get update 24 | sudo apt-get install docker-engine 25 | ``` 26 | * Docker run: 27 | 28 | ```sudo docker run -p sreeja1125/fossasia-engelsystem``` 29 | 30 | -------------------------------------------------------------------------------- /db/migrations/20160711044506_user.php: -------------------------------------------------------------------------------- 1 | table('User'); 13 | $table->addColumn('current_city', 'string', array('limit' => 255)) 14 | ->addColumn('twitter', 'string', array('limit' => 255)) 15 | ->addColumn('facebook', 'string', array('limit' => 255)) 16 | ->addColumn('github', 'string', array('limit' => 255)) 17 | ->addColumn('organization', 'string', array('limit' => 255)) 18 | ->addColumn('organization_web', 'string', array('limit' => 255)) 19 | ->addColumn('timezone', 'string', array('limit' => 255)) 20 | ->addColumn('native_lang', 'string', array('limit' => 255)) 21 | ->addColumn('other_langs', 'string', array('limit' => 255)) 22 | ->addIndex(array('email'), array('unique' => true)) 23 | ->save(); 24 | } 25 | 26 | public function down() 27 | { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /includes/controller/admin_log_controller.php: -------------------------------------------------------------------------------- 1 | "Time", 34 | 'nick' => "Angel", 35 | 'message' => "Log Entry" 36 | ), $log_entries) 37 | )); 38 | } 39 | ?> 40 | -------------------------------------------------------------------------------- /includes/helper/graph_helper.php: -------------------------------------------------------------------------------- 1 | $name) { 17 | $values = []; 18 | foreach ($data as $dataset) 19 | $values[] = $dataset[$row_key]; 20 | $datasets[] = [ 21 | 'label' => $name, 22 | 'fillColor' => $colors[$row_key], 23 | 'data' => $values 24 | ]; 25 | } 26 | 27 | return ' 28 | '; 37 | } 38 | 39 | ?> -------------------------------------------------------------------------------- /db/migrations/20160711044419_user_driver_licenses.php: -------------------------------------------------------------------------------- 1 | table('usersdriverlicenses', array('id' => 'user_id', 'limit' => 11)); 14 | $usersdriverlicenses->addColumn('has_car', 'integer', array('limit' => MysqlAdapter::INT_TINY)) 15 | ->addColumn('has_license_car', 'integer', array('limit' => MysqlAdapter::INT_TINY)) 16 | ->addColumn('has_license_3_5t_transporter','integer', array('limit' => MysqlAdapter::INT_TINY)) 17 | ->addColumn('has_license_7_5t_truck','integer', array('limit' => MysqlAdapter::INT_TINY)) 18 | ->addColumn('has_license_12_5t_truck','integer', array('limit' => MysqlAdapter::INT_TINY)) 19 | ->addColumn('has_license_forklift', 'integer', array('limit' => MysqlAdapter::INT_TINY)) 20 | ->save(); 21 | } 22 | 23 | /** 24 | * Migrate Down. 25 | */ 26 | public function down() 27 | { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /docs/CONFIGURATION_DOCUMENT_ROOT.md: -------------------------------------------------------------------------------- 1 | # Instructions to configure document root in ubuntu 2 | 3 | We must make sure to point our apache2 document root to the Engelsystem directory to prevent any user from accessing anything other than the public/ directory for security reasons. Do this by modifying the apache2 configuration file 4 | 5 | ### Changing apache2 document root 6 | 7 | The default document root is set in the 000-default.conf file that is under /etc/apache2/sites-available folder. 8 | 9 | $ ```sudo nano /etc/apache2/sites-available/000-default.conf``` 10 | 11 | While the file is opened change DocumentRoot /var/www/ with your new folder 12 | e.g DocumentRoot /var/www/html/engelsystem/public 13 | 14 | or you can execute the following command in your terminal 15 | 16 | $ ```sudo sed -i -e 's/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/html\/engelsystem\/public/g' /etc/apache2/sites-available/000-default.conf``` 17 | 18 | ### Set the right Apache folder Permissions 19 | 20 | $ ```sudo chown -R www-data /var/www/html/engelsystem/``` 21 | 22 | ### Restart Apache 23 | $ ``` sudo service apache2 restart ``` 24 | 25 | After following these steps engelsystem can be viewed at **localhost/ or at http://[i.p.address]** 26 | -------------------------------------------------------------------------------- /includes/sys_page.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/model/News_model_test.php: -------------------------------------------------------------------------------- 1 | news_id = insert_news_val('Subject1', 'Message1', 1, 0); 10 | $this->news_id2 = insert_news_val('Subject2', 'Message2', 1, 1); 11 | } 12 | 13 | public function test_News_create() { 14 | $count = count(select_news()); 15 | $this->assertNotFalse(insert_news_val('Subject3', 'Message3', 1, 1)); 16 | 17 | // There should be one more News entry now 18 | $this->assertEquals(count(select_news()), $count + 1); 19 | } 20 | 21 | public function test_News() { 22 | $this->create_News(); 23 | $News = select_news_by_id($this->news_id['ID']); 24 | $this->assertNotFalse($News); 25 | $this->assertNotNull($News); 26 | $this->assertTrue(count(select_news()) > 0); 27 | $this->assertEquals($news_id['Betreff'], 'Subject1'); 28 | $this->assertEquals($news_id2['Betreff'], 'Subject2'); 29 | $this->assertEquals(count(select_news()), 0); 30 | $this->assertNull(select_news_by_id(-1)); 31 | } 32 | 33 | public function teardown() { 34 | if ($this->$news_id != null) 35 | delete_by_id($this->news_id['ID']); 36 | } 37 | 38 | } 39 | ?> -------------------------------------------------------------------------------- /test/model/Questions_model_test.php: -------------------------------------------------------------------------------- 1 | ques_id = insert_new_question(1, 'Question 1'); 10 | $this->ques_id2 = insert_new_question(1, 'Question 2'); 11 | } 12 | 13 | public function test_Questions_create() { 14 | $count = count(Questions()); 15 | $this->assertNotFalse(insert_new_question(1, 'Question 3')); 16 | 17 | // There should be one more Questions entry now 18 | $this->assertEquals(count(Questions()), $count + 1); 19 | } 20 | 21 | public function test_Questions() { 22 | $this->create_Questions(); 23 | $Ques = select_ques_by_id($this->ques_id['QID']); 24 | $this->assertNotFalse($Ques); 25 | $this->assertNotNull($Ques); 26 | $this->assertTrue(count(Questions()) > 0); 27 | $this->assertEquals($ques_id['Question'], 'Question 1'); 28 | $this->assertEquals($ques_id2['Question'], 'Question 2'); 29 | $this->assertEquals(count(Questions()), 0); 30 | $this->assertNull(select_ques_by_id(-1)); 31 | } 32 | 33 | public function teardown() { 34 | if ($this->ques_id != null) 35 | delete_ques_by_id($this->ques_id['QID']); 36 | } 37 | 38 | } 39 | ?> -------------------------------------------------------------------------------- /db/migrations/20160711044551_privileges.php: -------------------------------------------------------------------------------- 1 | 39, 16 | 'name' => 'admin_settings', 17 | 'desc' => 'Admin Settings' 18 | ], 19 | [ 20 | 'id' => 40, 21 | 'name' => 'admin_export', 22 | 'desc' => 'Import and Export user data' 23 | ] 24 | ]; 25 | 26 | $this->insert('Privileges', $Rows); 27 | // inserting multiple rows 28 | $rows = [ 29 | [ 30 | 'id' => 218, 31 | 'group_id' => -4, 32 | 'privilege_id' => 39 33 | 34 | ], 35 | [ 36 | 37 | 'id' => 337, 38 | 'group_id' => -4, 39 | 'privilege_id' => 40 40 | 41 | ] 42 | ]; 43 | 44 | $this->insert('GroupPrivileges', $rows); 45 | } 46 | 47 | /** 48 | * Migrate Down. 49 | */ 50 | public function down() 51 | { 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /test/model/Groups_model_test.php: -------------------------------------------------------------------------------- 1 | group_id = create_new_group('test', -100); 10 | $this->group_id2 = create_new_group('test1', -101); 11 | } 12 | 13 | public function test_Group_create() { 14 | $count = count(Groups_by_name()); 15 | $this->assertNotFalse(create_new_group('test2', -102)); 16 | 17 | // There should be one more Groups entry now 18 | $this->assertEquals(count(Groups_by_name()), $count + 1); 19 | } 20 | 21 | public function test_Group() { 22 | $this->create_Group(); 23 | $Group_name = Groups_by_name($this->group_id); 24 | $this->assertNotFalse($Group_name); 25 | $this->assertNotNull($Group_name); 26 | $this->assertTrue(count(Groups_by_name()) > 0); 27 | $this->assertEquals($Group_name['Name'], 'test'); 28 | $this->assertEquals($Group_name['Name'], 'test1'); 29 | $this->assertEquals(count(Groups_by_name()), 0); 30 | $this->assertNull(Groups_by_id(1)); 31 | $this->assertTrue(count(selects_groups_by_id()) > 0); 32 | } 33 | 34 | public function teardown() { 35 | if ($this->group_id != null) 36 | delete_group($this->group_id['UID']); 37 | } 38 | 39 | } 40 | ?> -------------------------------------------------------------------------------- /test/model/Privileges_model_test.php: -------------------------------------------------------------------------------- 1 | priv_id = sql_query(INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (100, 'test1', 'testing Priveleg1')); 10 | $this->priv_id2 = sql_query(INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (101, 'test2', 'testing Privilege2')); 11 | } 12 | 13 | 14 | public function test_Privileges_create() { 15 | $count = sql_num_query("SELECT * FROM `Privileges`"); 16 | $this->assertNotFalse(sql_query(INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (102, 'test3', 'testing Priveleg3'))); 17 | 18 | // There should be one more Privileges entry now 19 | $this->assertEquals(count(sql_query("SELECT * FROM `Privileges`")), $count + 1); 20 | } 21 | 22 | public function test_Privileges() { 23 | $this->create_Privilege(); 24 | $Privilege = Privileges_by_id($this->$priv_id['id']); 25 | $this->assertNotFalse($Privilege); 26 | $this->assertNotNull($Privilege); 27 | $this->assertEquals($priv_id['name'], 'test1'); 28 | $this->assertEquals($priv_id2['name'], 'test2'); 29 | $this->assertNull(Privileges_by_id(- 1)); 30 | } 31 | 32 | } 33 | ?> -------------------------------------------------------------------------------- /test/model/AngelType_model_test.php: -------------------------------------------------------------------------------- 1 | angle_id = AngelType_create('test', true, 'test', true); 11 | $this->angle_id2 = AngelType_create('test1', true, 'test', true); 12 | } 13 | 14 | public function test_AngelType_create() { 15 | $count = count(Angeltypes()); 16 | $this->assertNotFalse(Angeltype_create('test2', true, 'test', true)); 17 | 18 | // There should be one more AngelType entry now 19 | $this->assertEquals(count(AngelTypes()), $count + 1); 20 | } 21 | 22 | public function test_AngelType() { 23 | $this->create_AngelType(); 24 | $Angeltype = AngelType($this->angle_id); 25 | $this->assertNotFalse($Angeltype); 26 | $this->assertNotNull($Angeltype); 27 | $this->assertTrue(count(AngelTypes()) > 0); 28 | $this->assertEquals($Angeltype['name'], 'test'); 29 | $this->assertEquals($Angeltype['name'], 'test1'); 30 | $this->assertEquals(count(AngelTypes()), 0); 31 | $this->assertNull(Angeltype(- 1)); 32 | $this->assertTrue(count(AngelTypes_ids()) > 0); 33 | } 34 | 35 | public function teardown() { 36 | if ($this->angel_id != null) 37 | AngelType_delete($this->angel_id); 38 | } 39 | 40 | } 41 | ?> -------------------------------------------------------------------------------- /templates/guest_credits.html: -------------------------------------------------------------------------------- 1 |
2 |

Credits

3 |
4 |
5 |

Source code

6 |

7 | The original system was written by cookie. It was then completely rewritten and greatly enhanced by msquare and mortzu of planet 8 | cyborg, jplitza and gnomus. 9 |

10 |

11 | Please look at the contributor list on github for a more complete version. 12 |

13 |
14 |
15 |

Hosting

16 |

17 | Webspace, development platform and domain is currently provided by would you buy this? (ichdasich)
and adminstrated by mortzu, derf and ichdasich. 18 |

19 |
20 |
21 |

Translation

22 |

23 | Many thanks for the german translation: e7p 24 |

25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /docs/INSTALLATION_FIVE_MINUTES.md: -------------------------------------------------------------------------------- 1 | # Five Minute Installation of Engelsystem 2 | ### Prerequisites 3 | Please check out the docs for more information [the documentation here](/docs/). 4 | 5 | 1.1 PHP 5.4.x (cgi-fcgi) 6 | 1.2 MySQL-Server 5.5.x pr MariaDB 7 | 1.3 Webserver ( Apache/Nginx/lighttpd) 8 | 9 | ### Step 1: Download or Clone the repository 10 | - ```$ git clone --recursive https://github.com/fossasia/engelsystem.git``` 11 | 12 | ### Step 2: Create a Mysql Database 13 | - Using the MySQL Client 14 | - ```$ mysql -u root -p``` 15 | - ```mysql> CREATE DATABASE engelsystem;``` 16 | 17 | ### Step 3: Set up config.php 18 | - Go to **engelsystem/config** and copy MySQL-Connection Settings from default config-sample into config.php. Modify the new file to match your MySQL credentials so that the system could access the database on the localserver. 19 | 20 | ### Step 4: Upload the files 21 | -Move the app to your /var/www/html/ directory by typing ```sudo mv ./engelsystem /var/www/html``` and we can view engelsystem on localhost/ after configuring document root [documentation here](/docs/CONFIGURATION_DOCUMENT_ROOT.md) 22 | 23 | ### Step 5: Run the Install Script 24 | - Visit localhost/ on your browser you will be redirected to install script. 25 | 26 | Once you have filled the information and clicked install engelsystem. We are redirected to login page where we can login with the credentials with admin rights. 27 | -------------------------------------------------------------------------------- /test/model/Shifts_model_test.php: -------------------------------------------------------------------------------- 1 | getTimestamp(); 11 | $shift_id['title'] = ""; 12 | $shift_id['shifttype_id'] = null; 13 | $shift_id['URL'] = null; 14 | $shift_id['PSID'] = null; 15 | $shift_id['created_by_user_id'] = null; 16 | $shift_id['created_at_timestamp'] = time(); 17 | $this->shift_id1 = Shift_create($shift_id); 18 | } 19 | 20 | public function test_Shift_create() { 21 | $count = count(Shifts()); 22 | $this->assertNotFalse(Shift_create($shift_id)); 23 | 24 | // There should be one more Shift entry now 25 | $this->assertEquals(count(Shifts()), $count + 1); 26 | 27 | } 28 | 29 | public function test_Shifts() { 30 | $this->create_shift(); 31 | $Shift = Shifts($this->shift_id1); 32 | $this->assertNotFalse($Shift); 33 | $this->assertTrue(count(Shifts()) > 0); 34 | $this->assertNotNull($Shift); 35 | $this->assertEquals($Shift['title'], ''); 36 | $this->assertEquals(count(Shifts()), 0); 37 | $this->assertNull(Shifts(- 1)); 38 | } 39 | 40 | public function teardown() { 41 | if ($this->shift_id != null) 42 | Shift_delete($this->shift_id); 43 | } 44 | } 45 | ?> -------------------------------------------------------------------------------- /includes/helper/message_helper.php: -------------------------------------------------------------------------------- 1 | ' . $msg . ''; 22 | } else { 23 | if (! isset($_SESSION['msg'])) 24 | $_SESSION['msg'] = ""; 25 | $_SESSION['msg'] .= info($msg, true); 26 | } 27 | } 28 | 29 | /** 30 | * Renders an error message 31 | */ 32 | function error($msg, $immediatly = false) { 33 | if ($immediatly) { 34 | if ($msg == "") 35 | return ""; 36 | return '
' . $msg . '
'; 37 | } else { 38 | if (! isset($_SESSION['msg'])) 39 | $_SESSION['msg'] = ""; 40 | $_SESSION['msg'] .= error($msg, true); 41 | } 42 | } 43 | 44 | /** 45 | * Renders a success message 46 | */ 47 | function success($msg, $immediatly = false) { 48 | if ($immediatly) { 49 | if ($msg == "") 50 | return ""; 51 | return '
' . $msg . '
'; 52 | } else { 53 | if (! isset($_SESSION['msg'])) 54 | $_SESSION['msg'] = ""; 55 | $_SESSION['msg'] .= success($msg, true); 56 | } 57 | } 58 | 59 | ?> -------------------------------------------------------------------------------- /includes/view/Questions_view.php: -------------------------------------------------------------------------------- 1 | ' . _("delete") . ''; 6 | $question['Question'] = str_replace("\n", '
', $question['Question']); 7 | } 8 | 9 | foreach ($answered_questions as &$question) { 10 | $question['Question'] = str_replace("\n", '
', $question['Question']); 11 | $question['Answer'] = str_replace("\n", '
', $question['Answer']); 12 | $question['actions'] = '' . _("delete") . ''; 13 | } 14 | 15 | return page_with_title(questions_title(), array( 16 | msg(), 17 | '

' . _("Open questions") . '

', 18 | table(array( 19 | 'Question' => _("Question"), 20 | 'actions' => "" 21 | ), $open_questions), 22 | '

' . _("Answered questions") . '

', 23 | table(array( 24 | 'Question' => _("Question"), 25 | 'answer_user' => _("Answered by"), 26 | 'Answer' => _("Answer"), 27 | 'actions' => "" 28 | ), $answered_questions), 29 | '

' . _("Ask an archangel") . '

', 30 | form(array( 31 | form_textarea('question', _("Your Question:"), ""), 32 | form_submit('submit', _("Save")) 33 | ), $ask_action) 34 | )); 35 | } 36 | ?> -------------------------------------------------------------------------------- /docs/DATABASE_MIGRATIONS.md: -------------------------------------------------------------------------------- 1 | ## Steps to run database migration 2 | 3 | #### Installing Phinx 4 | To install Phinx, simply require it using Composer: 5 | - $ php composer.phar require robmorgan/phinx 6 | 7 | Then run Composer: 8 | - $ php composer.phar install --no-dev 9 | 10 | Create a folder in your project directory called migrations with adequate permissions. It is where your migration files will live and should be writable. 11 | - $ php vendor/bin/phinx init 12 | 13 | #### Creating a New Migration 14 | - $ php vendor/bin/phinx create MyNewMigration 15 | 16 | This will create a new migration in the format YYYYMMDDHHMMSS_my_new_migration.php where the first 14 characters are replaced with the current timestamp down to the second. 17 | 18 | #### The Migrate Command 19 | 20 | The Migrate command runs all of the available migrations, optionally up to a specific version. 21 | - $ phinx migrate -e development 22 | 23 | To migrate to a specific version then use the --target parameter or -t for short. 24 | - $ phinx migrate -e development -t 20110103081132 25 | 26 | #### The Rollback Command 27 | 28 | You can rollback to the previous migration by using the rollback command with no arguments. 29 | - $ phinx rollback -e development 30 | 31 | #### The Status Command 32 | 33 | The Status command prints a list of all migrations, along with their current status. You can use this command to determine which migrations have been run. 34 | - $ phinx status -e development 35 | 36 | #### Writing Migrations 37 | More information on writing migrations is available here: 38 | - http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class -------------------------------------------------------------------------------- /includes/model/UserGroups_model.php: -------------------------------------------------------------------------------- 1 | 59 | -------------------------------------------------------------------------------- /test/model/NewsComments_model_test.php: -------------------------------------------------------------------------------- 1 | news_id = insert_news_val('Subject1', 'Message1', 1, 0); 12 | $this->news_id2 = insert_news_val('Subject2', 'Message2', 1, 1); 13 | $this->newscomm_id = insert_news($news_id['ID'], 'Comment1', 1); 14 | $this->newscomm_id2 = insert_news($news_id2['ID'], 'comment2', 1); 15 | } 16 | 17 | public function test_News_Comments_create() { 18 | $count_news = count(select_news()); 19 | $this->assertNotFalse(insert_news_val('Subject3', 'Message3', 1, 1)); 20 | $count_newscomm = count(select_newscomments_by_id($news_id['ID'])); 21 | $this->assertNotFalse(insert_news($news_id['ID'], 'Comment3', 1)); 22 | 23 | // There should be one more News entry now 24 | $this->assertEquals(count(select_news()), $count_news + 1); 25 | 26 | // There should be one more NewsComments entry now 27 | $this->assertEquals(count(select_newscomments_by_id($news_id['ID'])), $count_newscomm + 1); 28 | } 29 | 30 | public function test_NewsComments() { 31 | $this->create_News_and_comments(); 32 | $NewsComments = select_newscomments_by_id($this->news_id['ID']); 33 | $this->assertNotFalse($NewsComments); 34 | $this->assertNotNull($NewsComments); 35 | $this->assertTrue(count(select_newscomments_by_id($this->news_id['ID'])) > 0); 36 | $this->assertEquals($NewsComments['Text'], 'Comment1'); 37 | $this->assertNull(select_newscomments_by_id(-1)); 38 | } 39 | 40 | } 41 | ?> -------------------------------------------------------------------------------- /includes/controller/user_atom_controller.php: -------------------------------------------------------------------------------- 1 | 24 | 25 | Engelsystem 26 | ' . $_SERVER['HTTP_HOST'] . htmlspecialchars(preg_replace('#[&?]key=[a-f0-9]{32}#', '', $_SERVER['REQUEST_URI'])) . ' 27 | ' . date('Y-m-d\TH:i:sP', $news[0]['Datum']) . "\n"; 28 | foreach ($news as $news_entry) { 29 | $html .= " 30 | " . htmlspecialchars($news_entry['Betreff']) . " 31 | 32 | " . preg_replace('#^https?://#', '', page_link_to_absolute("news")) . "-${news_entry['ID']} 33 | " . date('Y-m-d\TH:i:sP', $news_entry['Datum']) . " 34 | " . htmlspecialchars($news_entry['Text']) . " 35 | \n"; 36 | } 37 | $html .= ""; 38 | header("Content-Length: " . strlen($html)); 39 | echo $html; 40 | die(); 41 | } 42 | ?> 43 | -------------------------------------------------------------------------------- /themes/theme3.less: -------------------------------------------------------------------------------- 1 | @import "../vendor/bootstrap/less/variables"; 2 | 3 | @brand-primary: #f19224; 4 | @brand-success: #39AB50; 5 | @brand-info: #6618F9; 6 | @brand-warning: #DAD216; 7 | @brand-danger: #DA1639; 8 | 9 | @state-success-text: @brand-success; 10 | @state-success-bg: lighten(@brand-success,40%); 11 | @state-success-border: @brand-success; 12 | 13 | @state-info-text: @brand-info; 14 | @state-info-bg: lighten(@brand-info,40%); 15 | @state-info-border: @brand-info; 16 | 17 | @state-warning-text: @brand-warning; 18 | @state-warning-bg: lighten(@brand-warning,40%); 19 | @state-warning-border: @brand-warning; 20 | 21 | @state-danger-text: @brand-danger; 22 | @state-danger-bg: lighten(@brand-danger,40%); 23 | @state-danger-border: @brand-danger; 24 | 25 | @navbar-default-color: #fff; 26 | @navbar-default-bg: #000; 27 | @navbar-default-border: #000; 28 | 29 | @navbar-default-link-color: #fff; 30 | @navbar-default-link-hover-color: #ddd; 31 | @navbar-default-link-hover-bg: #222; 32 | 33 | @navbar-default-link-active-color: @brand-primary; 34 | @navbar-default-link-active-bg: #000; 35 | @navbar-default-link-disabled-color:#777; 36 | @navbar-default-link-disabled-bg: #000; 37 | 38 | @navbar-default-brand-color: #fff; 39 | @navbar-default-brand-hover-color: @brand-primary; 40 | @navbar-default-brand-hover-bg: #000; 41 | 42 | .navbar { 43 | .bg-info { 44 | background-color: darken(@brand-info, 30%); 45 | } 46 | .bg-danger { 47 | background-color: darken(@brand-danger, 30%); 48 | } 49 | } 50 | 51 | #shifts td a { 52 | color: #000; 53 | } 54 | 55 | @import "base.less"; 56 | -------------------------------------------------------------------------------- /themes/theme4.less: -------------------------------------------------------------------------------- 1 | @import "../vendor/bootstrap/less/variables"; 2 | 3 | @brand-primary: #f19224; 4 | @brand-success: #39AB50; 5 | @brand-info: #6618F9; 6 | @brand-warning: #DAD216; 7 | @brand-danger: #DA1639; 8 | 9 | @state-success-text: @brand-success; 10 | @state-success-bg: lighten(@brand-success,40%); 11 | @state-success-border: @brand-success; 12 | 13 | @state-info-text: @brand-info; 14 | @state-info-bg: lighten(@brand-info,40%); 15 | @state-info-border: @brand-info; 16 | 17 | @state-warning-text: @brand-warning; 18 | @state-warning-bg: lighten(@brand-warning,40%); 19 | @state-warning-border: @brand-warning; 20 | 21 | @state-danger-text: @brand-danger; 22 | @state-danger-bg: lighten(@brand-danger,40%); 23 | @state-danger-border: @brand-danger; 24 | 25 | @navbar-default-color: #fff; 26 | @navbar-default-bg: #000; 27 | @navbar-default-border: #000; 28 | 29 | @navbar-default-link-color: #fff; 30 | @navbar-default-link-hover-color: #ddd; 31 | @navbar-default-link-hover-bg: #222; 32 | 33 | @navbar-default-link-active-color: @brand-primary; 34 | @navbar-default-link-active-bg: #000; 35 | @navbar-default-link-disabled-color:#777; 36 | @navbar-default-link-disabled-bg: #000; 37 | 38 | @navbar-default-brand-color: #fff; 39 | @navbar-default-brand-hover-color: @brand-primary; 40 | @navbar-default-brand-hover-bg: #000; 41 | 42 | .navbar { 43 | .bg-info { 44 | background-color: darken(@brand-info, 30%); 45 | } 46 | .bg-danger { 47 | background-color: darken(@brand-danger, 30%); 48 | } 49 | } 50 | 51 | #shifts td a { 52 | color: #000; 53 | } 54 | 55 | @import "base.less"; 56 | -------------------------------------------------------------------------------- /themes/theme5.less: -------------------------------------------------------------------------------- 1 | @import "../vendor/bootstrap/less/variables"; 2 | 3 | @brand-primary: #f19224; 4 | @brand-success: #39AB50; 5 | @brand-info: #6618F9; 6 | @brand-warning: #DAD216; 7 | @brand-danger: #DA1639; 8 | 9 | @state-success-text: @brand-success; 10 | @state-success-bg: lighten(@brand-success,40%); 11 | @state-success-border: @brand-success; 12 | 13 | @state-info-text: @brand-info; 14 | @state-info-bg: lighten(@brand-info,40%); 15 | @state-info-border: @brand-info; 16 | 17 | @state-warning-text: @brand-warning; 18 | @state-warning-bg: lighten(@brand-warning,40%); 19 | @state-warning-border: @brand-warning; 20 | 21 | @state-danger-text: @brand-danger; 22 | @state-danger-bg: lighten(@brand-danger,40%); 23 | @state-danger-border: @brand-danger; 24 | 25 | @navbar-default-color: #fff; 26 | @navbar-default-bg: #000; 27 | @navbar-default-border: #000; 28 | 29 | @navbar-default-link-color: #fff; 30 | @navbar-default-link-hover-color: #ddd; 31 | @navbar-default-link-hover-bg: #222; 32 | 33 | @navbar-default-link-active-color: @brand-primary; 34 | @navbar-default-link-active-bg: #000; 35 | @navbar-default-link-disabled-color:#777; 36 | @navbar-default-link-disabled-bg: #000; 37 | 38 | @navbar-default-brand-color: #fff; 39 | @navbar-default-brand-hover-color: @brand-primary; 40 | @navbar-default-brand-hover-bg: #000; 41 | 42 | .navbar { 43 | .bg-info { 44 | background-color: darken(@brand-info, 30%); 45 | } 46 | .bg-danger { 47 | background-color: darken(@brand-danger, 30%); 48 | } 49 | } 50 | 51 | #shifts td a { 52 | color: #000; 53 | } 54 | 55 | @import "base.less"; 56 | -------------------------------------------------------------------------------- /test/model/GroupPrivileges_model_test.php: -------------------------------------------------------------------------------- 1 | group_id = create_new_group('test', -100); 12 | $this->group_id2 = create_new_group('test1', -101); 13 | $this->priv_id = sql_query(INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (100, 'test1', 'testing Priveleg1')); 14 | $this->priv_id2 = sql_query(INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (101, 'test2', 'testing Privilege2')); 15 | } 16 | 17 | 18 | public function test_Groups_Privileges_create() { 19 | $count_grp = count(Groups_by_name()); 20 | $this->assertNotFalse(create_new_group('test2', -102)); 21 | $count_priv = sql_num_query("SELECT * FROM `Privileges`"); 22 | $this->assertNotFalse(sql_query(INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (102, 'test3', 'testing Priveleg3'))); 23 | 24 | // There should be one more Groups entry now 25 | $this->assertEquals(count(Groups_by_name()), $count_grp + 1); 26 | 27 | // There should be one more Privileges entry now 28 | $this->assertEquals(count(sql_query("SELECT * FROM `Privileges`")), $count_priv + 1); 29 | } 30 | 31 | public function test_GroupPrivileges() { 32 | $this->create_Groups(); 33 | $Groups = Groups_by_name($this->group_id); 34 | $GroupPrivileges_source = insert_GroupPrivilege($group_id['UID'], $priv_id['id']); 35 | $this->assertNotFalse($GroupPrivileges_source); 36 | $this->assertNotNull($GroupPrivileges_source); 37 | 38 | } 39 | 40 | public function teardown() { 41 | if ($this->group_id != null) 42 | delete_GroupPrivileges($this->group_id['UID']); 43 | } 44 | 45 | } 46 | ?> -------------------------------------------------------------------------------- /install_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Authors: 4 | # Sreeja Kamishetty 5 | 6 | # Description: 7 | # A post-installation bash script for engelsystem 8 | 9 | echo "Updating your package manager enter your root password" 10 | sudo apt-get update 11 | sudo apt-get upgrade 12 | 13 | echo "Installing LAMP enter your root password where ever asked" 14 | echo "Install Apache" 15 | sudo apt-get install -y apache2 16 | 17 | echo "Install MySQL" 18 | sudo apt-get install mysql-server mysql-client 19 | sudo mysql_secure_installation 20 | 21 | php5=$(sudo apt-cache search php5 | wc -l) 22 | php7=$(sudo apt-cache search php7 | wc -l) 23 | if (( $php7 != 0 )) 24 | then 25 | sudo apt-get install -y libapache2-mod-php7.0 php7.0 php7.0-mysql 26 | elif (( $php5 != 0 )) 27 | then 28 | sudo apt-get install -y libapache2-mod-php5 php5 php5-mysql 29 | fi 30 | 31 | echo "Install git" 32 | sudo apt-get install -y git 33 | cd /var/www/html 34 | 35 | echo "Cloning the github repository" 36 | sudo git clone --recursive https://github.com/fossasia/engelsystem.git 37 | cd engelsystem 38 | 39 | echo "Creating database engelsystem, enter mysql root password" 40 | # creating new database engelsystem 41 | echo "create database engelsystem" | mysql -u root -p 42 | 43 | echo "Edit the database name username and password in config/config.php file" 44 | sudo cp config/config-sample.default.php config/config.php 45 | 46 | echo "Adding folder permission for Apache" 47 | sudo chown -R www-data /var/www/html/engelsystem/ 48 | 49 | echo "Changing the document root and restarting apache" 50 | sudo sed -i -e 's/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/html\/engelsystem\/public/g' /etc/apache2/sites-available/000-default.conf 51 | sudo service apache2 restart 52 | echo "All the dependencies are installed and Engelsystem can be viewed on local server at localhost/" 53 | -------------------------------------------------------------------------------- /includes/model/ShiftTypes_model.php: -------------------------------------------------------------------------------- 1 | 67 | -------------------------------------------------------------------------------- /public/vendor/icomoon/selection.json: -------------------------------------------------------------------------------- 1 | { 2 | "IcoMoonType": "selection", 3 | "icons": [ 4 | { 5 | "icon": { 6 | "paths": [ 7 | "M524.315 142.746c-141.014 0-255.328 132.92-255.328 296.886 0 91.993 35.911 174.118 92.405 228.574v68.311l-359.891 105.559v189.127l1021.314 8.797v-189.127l-330.711-118.754h-4.863v-63.913c56.494-54.456 92.405-136.581 92.405-228.574 0-163.965-114.314-296.886-255.328-296.886z", 8 | "M524.315 2c-248.453 0-449.864 81.721-449.864 182.53s201.411 182.53 449.864 182.53c248.453 0 449.864-81.721 449.864-182.53s-201.411-182.53-449.864-182.53zM524.315 94.364c205.477 0 372.050 57.106 372.050 127.551s-166.572 127.551-372.050 127.551c-205.477 0-372.050-57.106-372.050-127.551s166.572-127.551 372.050-127.551z" 9 | ], 10 | "attrs": [ 11 | {}, 12 | {} 13 | ], 14 | "grid": 0, 15 | "tags": [ 16 | "icon_angel" 17 | ] 18 | }, 19 | "attrs": [ 20 | {}, 21 | {} 22 | ], 23 | "properties": { 24 | "order": 4, 25 | "id": 0, 26 | "prevSize": 32, 27 | "code": 58880, 28 | "name": "icon_angel", 29 | "ligatures": "" 30 | }, 31 | "setIdx": 0, 32 | "iconIdx": 0 33 | } 34 | ], 35 | "height": 1024, 36 | "metadata": { 37 | "name": "icomoon" 38 | }, 39 | "preferences": { 40 | "fontPref": { 41 | "prefix": "icon-", 42 | "metadata": { 43 | "fontFamily": "icomoon" 44 | }, 45 | "showGlyphs": true, 46 | "metrics": { 47 | "emSize": 512, 48 | "baseline": 6.25, 49 | "whitespace": 50 50 | }, 51 | "resetPoint": 58880, 52 | "showQuickUse": true, 53 | "quickUsageToken": false, 54 | "showMetrics": true, 55 | "showMetadata": false 56 | }, 57 | "imagePref": { 58 | "color": 0, 59 | "height": 32, 60 | "columns": 16, 61 | "margin": 16, 62 | "png": false, 63 | "sprites": true 64 | }, 65 | "historySize": 100, 66 | "showCodes": true, 67 | "gridSize": 16, 68 | "showLiga": false, 69 | "showGrid": true, 70 | "showGlyphs": true, 71 | "showQuickUse": true, 72 | "search": "" 73 | } 74 | } -------------------------------------------------------------------------------- /includes/controller/user_questions_controller.php: -------------------------------------------------------------------------------- 1 | 0 && $question[0]['UID'] == $user['UID']) { 39 | delete_ques_by_id($id); 40 | redirect(page_link_to("user_questions")); 41 | } else 42 | return page_with_title(questions_title(), array( 43 | error(_("No question found."), true) 44 | )); 45 | break; 46 | } 47 | } 48 | } 49 | ?> 50 | -------------------------------------------------------------------------------- /test/model/UserGroups_model_test.php: -------------------------------------------------------------------------------- 1 | user_id = User_insert(1234, 'testing1', 'lastname1', 'name1', 20, '', '-', '', 'testing1@testing.com', 1, '', 'XL', '$6$rounds=5000$hjXbIhoRTH3vKiRa$Wl2P2iI5T9iRR.HHu/YFHswBW0WVn0yxCfCiX0Keco9OdIoDK6bIAADswP6KvMCJSwTGdV8PgA8g8Xfw5l8BD1', NULL, 1, 1, 0, 1, 2, 'de_DE.UTF-8', 'L', 1439759300, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235', 3, 1439490478, 1436964455, 1440161255); 11 | $this->group_id = create_new_group('testgroup', -1000); 12 | $this->userGroup_id = insert_UserGroups_id(1234, -1000); 13 | } 14 | 15 | public function test_UserGroups_create() { 16 | $count_Users = count(Users()); 17 | $this->assertNotFalse(User_insert(1234, 'testing3', 'lastname3', 'name3', 20, '', '-', '', 'testing3@testing.com', 1, '', 'XL', '$6$rounds=5000$hjXbIhoRTH3vKiRa$Wl2P2iI5T9iRR.HHu/YFHswBW0WVn0yxCfCiX0Keco9OdIoDK6bIAADswP6KvMCJSwTGdV8PgA8g8Xfw5l8BD1', NULL, 1, 1, 0, 1, 2, 'de_DE.UTF-8', 'L', 1439759300, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235', 3, 1439490478, 1436964455, 1440161255)); 18 | $count_Groups = count(); 19 | $this->assertNotFalse(create_new_group('testgroup', -1000)); 20 | 21 | // There should be one more Users entry now 22 | $this->assertEquals(count(Users()), $count_Users + 1); 23 | 24 | // There should be one more Groups entry now 25 | $this->assertEquals(count(Groups_by_name()), $count_Groups + 1); 26 | } 27 | 28 | public function test_UsersGroups() { 29 | $this->create_Users_Groups(); 30 | $user_Groups = UserGroups_by_id($this->userGroup_id['group_id']); 31 | $this->assertNotFalse($user_Groups); 32 | $this->assertNotNull($user_Groups); 33 | $this->assertNull(UserGroups_by_id(1)); 34 | } 35 | 36 | public function teardown() { 37 | if ($this->userGroup_id != null) 38 | delete_UserGroups_id($this->userGroup_id['UID']); 39 | } 40 | 41 | } 42 | ?> -------------------------------------------------------------------------------- /includes/model/Groups_model.php: -------------------------------------------------------------------------------- 1 | = '" . sql_escape($my_highest_group) . "' ORDER BY `Groups`.`Name`"); 12 | } 13 | 14 | /** 15 | * 16 | * Returns Groups array by name 17 | * 18 | */ 19 | function Groups_by_name() { 20 | return sql_select("SELECT * FROM `Groups` ORDER BY `Name`"); 21 | } 22 | 23 | /** 24 | * Select Groups by ID 25 | * 26 | * @param $id UID Groups 27 | * ID 28 | */ 29 | function Groups_by_id($id) { 30 | return sql_select("SELECT * FROM `Groups` WHERE `UID`='" . sql_escape($id) . "' LIMIT 1"); 31 | } 32 | 33 | /** 34 | * 35 | * Return Groups array 36 | * 37 | */ 38 | function selects_groups_by_id() { 39 | $Groups_source = sql_select("SELECT * FROM `Groups` "); 40 | if ($Groups_source === false) 41 | return false; 42 | if (count($Groups_source) > 0) 43 | return $Groups_source; 44 | return null; 45 | } 46 | 47 | /** 48 | * Create Groups 49 | * 50 | * @param $name name Groups 51 | * @param $uid UID Groups 52 | * 53 | */ 54 | function create_new_group($name, $uid) { 55 | return sql_query(" 56 | INSERT INTO `Groups` SET 57 | `Name`='" . sql_escape($name) . "', 58 | `UID`='" . sql_escape($uid) . "'"); 59 | } 60 | 61 | /** 62 | * Insert GroupPrivileges 63 | * 64 | * @param $uid GroupId GroupPrivileges 65 | * @param $priv PrivilegeID GroupPrivileges 66 | * 67 | */ 68 | function inserts_into_group_privileges($uid, $priv) { 69 | return sql_query("INSERT INTO `GroupPrivileges` SET `group_id`='" . sql_escape($uid) . "', `privilege_id`='" . sql_escape($priv) . "'"); 70 | } 71 | 72 | /** 73 | * Delete Group 74 | * 75 | * @param $id GroupID Groups 76 | * 77 | */ 78 | function delete_group($uid) { 79 | return sql_query(" 80 | DELETE FROM `Groups` 81 | WHERE `id`='" . sql_escape($uid) . "' 82 | LIMIT 1");; 83 | } 84 | ?> 85 | -------------------------------------------------------------------------------- /includes/view/ShiftEntry_view.php: -------------------------------------------------------------------------------- 1 | 1, 31 | CURLOPT_URL => 'hppts://www.google.com/recaptcha/api/siteverify', 32 | CURLOPT_POST => 1, 33 | CURLOPT_POSTFIELDS => [ 34 | 'secret' => CAPTCHA_KEY_PRIVATE, 35 | 'response' => $_REQUEST['g-recaptcha-response'], 36 | ] 37 | ]); 38 | $response = json_decode(curl_exec($curl)); 39 | } 40 | else { 41 | $msg .= error(_("You are a Robot."), true); 42 | } 43 | } 44 | return page_with_title(_("Edit shift entry"), array( 45 | msg(), 46 | form(array( 47 | form_info(_("Angel:"), $angel), 48 | form_info(_("Date, Duration:"), $date), 49 | form_info(_("Location:"), $location), 50 | form_info(_("Title:"), $title), 51 | form_info(_("Type:"), $type), 52 | form_textarea('comment', _("Comment (for your eyes only):"), $comment), 53 | join("", $freeload_form), 54 | div('row', array( 55 | div('col-sm-8', array( 56 | reCaptcha(capflg) 57 | )) 58 | )), 59 | form_submit('submit', _("Save")) 60 | )) 61 | )); 62 | } 63 | ?> 64 | -------------------------------------------------------------------------------- /test/model/User_model_test.php: -------------------------------------------------------------------------------- 1 | user_id = User_insert(1234, 'testing1', 'lastname1', 'name1', 20, '', '-', '', 'testing1@testing.com', 1, '', 'XL', '$6$rounds=5000$hjXbIhoRTH3vKiRa$Wl2P2iI5T9iRR.HHu/YFHswBW0WVn0yxCfCiX0Keco9OdIoDK6bIAADswP6KvMCJSwTGdV8PgA8g8Xfw5l8BD1', NULL, 1, 1, 0, 1, 2, 'de_DE.UTF-8', 'L', 1439759300, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235', 3, 1439490478, 1436964455, 1440161255); 10 | $this->user_id2 = User_insert(12345, 'testing2', 'lastname2', 'name2', 40, '', '-', '', 'testing2@testing.com', 1, '', 'XL', '$6$rounds=5000$hjXbIhoRTH3vKiRa$Wl2P2iI5T9iRR.HHu/YFHswBW0WVn0yxCfCiX0Keco9OdIoDK6bIAADswP6KvMCJSwTGdV8PgA8g8Xfw5l8BD1', NULL, 1, 1, 0, 1, 2, 'de_DE.UTF-8', 'L', 1439759300, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235', 3, 1439490478, 1436964455, 1440161255); 11 | } 12 | 13 | public function test_Users_create() { 14 | $count = count(Users()); 15 | $this->assertNotFalse(User_insert(1234, 'testing3', 'lastname3', 'name3', 20, '', '-', '', 'testing3@testing.com', 1, '', 'XL', '$6$rounds=5000$hjXbIhoRTH3vKiRa$Wl2P2iI5T9iRR.HHu/YFHswBW0WVn0yxCfCiX0Keco9OdIoDK6bIAADswP6KvMCJSwTGdV8PgA8g8Xfw5l8BD1', NULL, 1, 1, 0, 1, 2, 'de_DE.UTF-8', 'L', 1439759300, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235', 3, 1439490478, 1436964455, 1440161255)); 16 | 17 | // There should be one more Users entry now 18 | $this->assertEquals(count(Users()), $count + 1); 19 | } 20 | 21 | public function test_Users() { 22 | $this->create_Users(); 23 | $user_testing = User($this->user_id['UID']); 24 | $this->assertNotFalse($user_testing); 25 | $this->assertNotNull($user_testing); 26 | $this->assertTrue(count(Users()) > 0); 27 | $this->assertEquals($user_id['Nick'], 'testing1'); 28 | $this->assertEquals($user_id['Nick'], 'testing2'); 29 | $this->assertEquals(count(Users()), 0); 30 | $this->assertNull(Users(-1)); 31 | } 32 | 33 | public function teardown() { 34 | if ($this->user_id != null) 35 | User_delete($this->user_id['UID']); 36 | } 37 | 38 | } 39 | ?> -------------------------------------------------------------------------------- /docs/HEROKU.md: -------------------------------------------------------------------------------- 1 | # How do I deploy Engelsystem on HEROKU 2 | ### Steps 3 | 4 | * We need to install heroku on our machine. Type the following in your linux terminal: 5 | * ```wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh``` 6 | This installs the Heroku Toolbelt on your machine to access heroku from the command line. 7 | * Next we need to login to our heroku server (assuming that you have already created an account). Type the following in the terminal: 8 | * ```heroku login``` 9 | * Enter your credentials and login. 10 | * Once logged in we need to create a space on the heroku server for our application. This is done with the following command 11 | * ```heroku create``` 12 | * Prepare the app 13 | * ```git clone --recursive https://github.com/fossasia/engelsystem.git``` 14 | * ```cd engelsystem/``` 15 | * Once the app is ready, we need to create a composer.json in order to be recognized as a PHP application.We need to declare all app dependencies in composer.json 16 | * Now PHP app is detected, we need to create a heroku app 17 | * ```$ heroku create``` 18 | * After creating heroku app, we need to migrate the database. 19 | * ```$ heroku addons:create cleardb:ignite``` 20 | * Now retrieve your new ClearDB database URL by issuing the following command: 21 | * ```$ heroku config | grep CLEARDB_DATABASE_URL``` 22 | * ```CLEARDB_DATABASE_URL: mysql://bda37eff166954:69445d28@us-cdbr-iron-east-04.cleardb.net/heroku_3c94174e0cc6cd8?reconnect=true``` 23 | * Now we need to import the tables to the heroku database 24 | * ```$mysql -u bda37eff166954 -h us-cdbr-iron-east-04.cleardb.net -p heroku_3c94174e0cc6cd8``` 25 | * ```mysql> source [path to engelsystem]/engelsystem/db/install.sql;``` 26 | * ```mysql> source [path to engelsystem]/engelsystem/db/update.sql;``` 27 | * ```mysql> exit;``` 28 | * Defining a Procfile. Your Procfile will contain the below line 29 | * ```web: vendor/bin/heroku-php-apache2 public/``` 30 | * Now since we have defined the composer.json, Procfile and migrated the database. 31 | * Then we deploy the code to heroku. 32 | * ```git push heroku master``` or 33 | * ```git push heroku yourbranch:master``` if you are in a different branch than master 34 | * Now the app will be successfully deployed on heroku and can be viewed online. 35 | -------------------------------------------------------------------------------- /includes/controller/user_ical_controller.php: -------------------------------------------------------------------------------- 1 | 53 | -------------------------------------------------------------------------------- /includes/helper/internationalization_helper.php: -------------------------------------------------------------------------------- 1 | "Deutsch", 4 | 'hi_IN.UTF-8' => "Hindi-IN", 5 | 'sp_EU.UTF-8' => "Spanish", 6 | 'en_US.UTF-8' => "English-US", 7 | 'bg_BG.UTF-8' => "Bulgarian", 8 | 'en_GB.UTF-8' => "English-UK", 9 | 'pa_IN.UTF-8' => "Punjabi-IN", 10 | 'fr_FR.UTF-8' => "French", 11 | 'ta_IN.UTF-8' => "Tamil-IN", 12 | 'zn_CH.UTF-8' => "Chinese", 13 | 'hu_HU.UTF-8' => "Hungarian", 14 | 'fi_FI.UTF-8' => "Finnish", 15 | 'ne_NP.UTF-8' => "Nepali" 16 | ); 17 | 18 | $default_locale = 'en_US.UTF-8'; 19 | 20 | /** 21 | * Return currently active locale 22 | */ 23 | function locale() { 24 | return $_SESSION['locale']; 25 | } 26 | 27 | /** 28 | * Returns two letter language code from currently active locale 29 | */ 30 | function locale_short() { 31 | return substr(locale(), 0, 2); 32 | } 33 | 34 | /** 35 | * Initializes gettext for internationalization and updates the sessions locale to use for translation. 36 | */ 37 | function gettext_init() { 38 | global $locales, $default_locale; 39 | 40 | if (isset($_REQUEST['set_locale']) && in_array($_REQUEST['set_locale'], array_keys($locales))) 41 | $_SESSION['locale'] = $_REQUEST['set_locale']; 42 | elseif (! isset($_SESSION['locale'])) 43 | $_SESSION['locale'] = $default_locale; 44 | 45 | gettext_locale(); 46 | bindtextdomain('default', '../locale'); 47 | bind_textdomain_codeset('default', 'UTF-8'); 48 | textdomain('default'); 49 | } 50 | 51 | /** 52 | * Swich gettext locale. 53 | * 54 | * @param string $locale 55 | */ 56 | function gettext_locale($locale = null) { 57 | if ($locale == null) 58 | $locale = $_SESSION['locale']; 59 | 60 | putenv('LC_ALL=' . $locale); 61 | setlocale(LC_ALL, $locale); 62 | } 63 | 64 | /** 65 | * Renders language selection. 66 | * 67 | * @return string 68 | */ 69 | function make_langselect() { 70 | global $locales; 71 | $URL = $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"], "?") > 0 ? '&' : '?') . "set_locale="; 72 | 73 | $items = array(); 74 | foreach ($locales as $locale => $name) 75 | $items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '' . $name . ' ' . $name); 76 | return $items; 77 | } 78 | ?> 79 | -------------------------------------------------------------------------------- /includes/model/Settings_model.php: -------------------------------------------------------------------------------- 1 | 67 | -------------------------------------------------------------------------------- /includes/controller/admin_cgroups_controller.php: -------------------------------------------------------------------------------- 1 | 0){ 30 | $name = strip_request_item('Name'); 31 | } 32 | else { 33 | $ok = false; 34 | $msg .= error(_("Please enter your Group Name."), true); 35 | } 36 | 37 | if (isset($_REQUEST['UID'])) 38 | $uid = strip_request_item('UID'); 39 | else { 40 | $ok = false; 41 | $msg .= error(_("Please enter your Group UID."), true); 42 | } 43 | 44 | // set privileges 45 | foreach ($privilege_source as $selected_privileges_id) 46 | if (isset($_REQUEST['privilege_types_' . $selected_privilege_id['id'] ])) 47 | $selected_privileges[] = $selected_privileges_id['id']; 48 | 49 | } 50 | 51 | if ($ok) { 52 | create_new_group($name, $uid); 53 | foreach ($selected_privileges as $priv) 54 | insert_into_group_privileges($uid, $priv); 55 | success(_("New Group Created.")); 56 | redirect(page_link_to('admin_cgroups')); 57 | } 58 | 59 | return page_with_title(admin_cgroups_title(), array( 60 | msg(), 61 | form(array( 62 | form_text('Name', _("Group Name"), $name), 63 | form_text('UID', _("User ID"), $uid), 64 | form_checkboxes('privilege_types', _("What Privileges do you want to provide?") , $privilege_types, $selected_privileges), 65 | form_submit('submit', _("Save")) 66 | )) 67 | )); 68 | 69 | } 70 | 71 | ?> 72 | -------------------------------------------------------------------------------- /includes/controller/admin_news_controller.php: -------------------------------------------------------------------------------- 1 |

' . _("Edit news entry") . '

' . msg(); 9 | if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) 10 | $id = $_REQUEST['id']; 11 | else 12 | return error("Incomplete call, missing News ID.", true); 13 | 14 | $news = News_by_id($id); 15 | if (count($news) > 0) { 16 | switch ($_REQUEST["action"]) { 17 | default: 18 | redirect(page_link_to('news')); 19 | case 'edit': 20 | list($news) = $news; 21 | 22 | $user_source = User($news['UID']); 23 | if ($user_source === false) 24 | engelsystem_error("Unable to load user."); 25 | 26 | $html .= form(array( 27 | form_info(_("Date"), date("Y-m-d H:i", $news['Datum'])), 28 | form_info(_("Author"), User_Nick_render($user_source)), 29 | form_text('eBetreff', _("Subject"), $news['Betreff']), 30 | form_textarea('eText', _("Message"), $news['Text']), 31 | form_checkbox('eTreffen', _("Meeting"), $news['Treffen'] == 1, 1), 32 | form_submit('submit', _("Save")) 33 | ), page_link_to('admin_news&action=save&id=' . $id)); 34 | 35 | $html .= ' ' . _("Delete") . ''; 36 | break; 37 | 38 | case 'save': 39 | list($news) = $news; 40 | News_update($_POST["eBetreff"], $_POST["eText"], $_POST["eTreffen"], $id, $user); 41 | engelsystem_log("News updated: " . $_POST["eBetreff"]); 42 | success(_("News entry updated.")); 43 | redirect(page_link_to("news")); 44 | break; 45 | 46 | case 'delete': 47 | list($news) = $news; 48 | delete_by_id($id); 49 | engelsystem_log("News deleted: " . $news['Betreff']); 50 | success(_("News entry deleted.")); 51 | redirect(page_link_to("news")); 52 | break; 53 | } 54 | } else 55 | return error("No News found.", true); 56 | } 57 | return $html . ''; 58 | } 59 | ?> 60 | -------------------------------------------------------------------------------- /includes/model/Questions_model.php: -------------------------------------------------------------------------------- 1 | 87 | -------------------------------------------------------------------------------- /Readme-De.md: -------------------------------------------------------------------------------- 1 | # Installation eines frischen Engelsystems 2 | [![Code Climate](https://codeclimate.com/github/fossasia/engelsystem/badges/gpa.svg)](https://codeclimate.com/github/fossasia/engelsystem) 3 | [![Build Status](https://travis-ci.org/fossasia/engelsystem.svg?branch=documentation)](https://travis-ci.org/fossasia/engelsystem) 4 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d56c5bb224f24946965770230e7253c2)](https://www.codacy.com/app/dishant-khanna1807/engelsystem_2?utm_source=github.com&utm_medium=referral&utm_content=fossasia/engelsystem&utm_campaign=Badge_Grade) 5 | [![CircleCI](https://circleci.com/gh/fossasia/engelsystem/tree/development.svg?style=svg)](https://circleci.com/gh/fossasia/engelsystem/tree/development) 6 | [![Dependency Status](https://www.versioneye.com/user/projects/577c9495b50608003eee0161/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/577c9495b50608003eee0161) 7 | [![Dependency Status](https://gemnasium.com/badges/github.com/fossasia/engelsystem.svg)](https://gemnasium.com/github.com/fossasia/engelsystem) 8 | ## Mindestvorrausetzungen (bzw. getestet unter): 9 | * PHP 5.4.x (cgi-fcgi) 10 | * MySQL-Server 5.5.x 11 | * Webserver mit PHP-Anbindung, z.B. lighttpd, nginx oder Apache 12 | 13 | ## Vorgehen: 14 | * Klonen des `master` inkl. submodules in lokales Verzeichnis: `git clone --recursive https://github.com/fossasia/engelsystem.git` 15 | * Der Webserver muss Schreibrechte auf das Verzeichnis `import` bekommen, für alle anderen Dateien reichen Leserechte. 16 | * Der Webserver muss auf `public` als http-root zeigen. 17 | 18 | * Empfehlung: Dirlisting sollte deaktiviert sein. 19 | * Es muss eine MySQL-Datenbank angelegt werden und ein User existieren, der alle Rechte auf dieser Datenbank besitzt. 20 | * Es muss die db/install.sql und die db/update.sql importiert/ausgeführt werden. 21 | * Erstelle bei Bedarf eine config/config.php, die die Werte (z.B. DB-Zugang) aus der config/config-sample.default.php überschreibt. 22 | * Engelsystem im Browser aufrufen, Anmeldung mit admin:asdfasdf vornehmen und Admin-Passwort ändern. 23 | 24 | Das Engelsystem ist jetzt einsatzbereit. 25 | 26 | ## Session Einstellungen: 27 | * Einstellungen für Cookies und Sessions bitte in der PHP Config des Servers vornehmen. 28 | * Sowohl Apache als auch nginx bieten Möglichkeiten für verschiedene Konfigurationen pro VirtualHost an 29 | 30 | Fehler bitte auf Github melden: https://github.com/fossasia/engelsystem/issues 31 | -------------------------------------------------------------------------------- /docs/INSTALLATION_LOCAL.md: -------------------------------------------------------------------------------- 1 | #Installation of Engelsystem 2 | 3 | ##Requirements: 4 | 5 | 1.Setup LAMP 6 | 7 | > 1.1 PHP 5.4.x (cgi-fcgi) 8 | > 9 | > 1.2 MySQL-Server 5.5.x pr MariaDB 10 | > 11 | > 1.3 Webserver ( Apache/Nginx/lighttpd) 12 | 13 | 2.Install GIT 14 | 15 | ##Steps: 16 | 17 | *    clone the repository (the recursive parameter allows us to clone the submodules):                           git clone --recursive [*https://github.com/fossasia/engelsystem.git*](https://github.com/fossasia/engelsystem.git) 18 | 19 | *    Next, configure your MySQL Engelsystem database: 20 | 21 | **        mysql -u root -p** 22 | 23 | **        \[Enter your password\]** 24 | 25 | **        CREATE DATABASE engelsystem;** 26 | 27 | **        exit;** 28 | 29 | *   Go to **engelsystem/config** and copy MySQL-Connection Settings from default config-sample into config.php. Modify the new file to match your MySQL credentials so that the system could access the database on the localserver. 30 | 31 | *      Move the app to your **/var/www/html/** directory by typing **mv ./engelsystem /var/www/html** 32 | 33 | *      To login, type use the following credentials: 34 | 35 | *Username:* **admin** 36 | 37 | *Password:* **asdfasdf** 38 | 39 | *   We must make sure to point our apache2 document root to the Engelsystem directory to prevent any user from accessing anything other than the public/ directory for security reasons. Do this by modifying the apache2 configuration file: 40 | 41 | **apt-get install nano -y** 42 | 43 | **nano /etc/apache2/sites-available/000-default.conf** 44 | 45 | * Change **DocumentRoot /var/www/html** into **DocumentRoot /var/www/html/engelsystem/public**. Restart apache by, 46 | 47 | > **service apache2 restart** 48 | 49 | ## Setting up Captcha 50 | * For setting up captcha for the online server, we need to signup for reCaptcha API keys. The keys are unique to the domain or domains you specify, and their respective sub-domains. Specifying more than one domain could come in handy in the case that you serve your website from multiple top level domains (for example: yoursite.com, yoursite.net). 51 | By default, all keys work on "localhost" (or "127.0.0.1"), so you can always develop and test on your local machine. 52 | 53 | ##Session Settings: 54 | 55 | - Make sure the config allows for sessions. 56 | 57 | - Both Apache and Nginx allow for different VirtualHost configurations. 58 | 59 | For more information on deploying the system please visit, https://codefungsoc2k16.wordpress.com/2016/05/20/deploy-engelsystem-on-your-localserver/ 60 | -------------------------------------------------------------------------------- /includes/view/UserDriverLicenses_view.php: -------------------------------------------------------------------------------- 1 | 37 | $(function() { 38 | if($("#wants_to_drive").is(":checked")) 39 | $("#driving_license").show(); 40 | else 41 | $("#driving_license").hide(); 42 | 43 | $("#wants_to_drive").click( 44 | function(e) { 45 | if($("#wants_to_drive").is(":checked")) 46 | $("#driving_license").show(); 47 | else 48 | $("#driving_license").hide(); 49 | } 50 | ); 51 | }); 52 | ' 53 | ]); 54 | } 55 | 56 | ?> -------------------------------------------------------------------------------- /themes/base.less: -------------------------------------------------------------------------------- 1 | @import "../vendor/bootstrap/less/bootstrap"; 2 | 3 | @icon-font-path: "../fonts/"; 4 | 5 | body { 6 | padding-top: 50px; 7 | } 8 | 9 | .footer a { 10 | color: @text-muted; 11 | } 12 | 13 | #shifts { 14 | td { 15 | &.free { 16 | border: 1px solid @brand-danger; 17 | .bg-danger(); 18 | } 19 | &.occupied { 20 | border: 1px solid @brand-success; 21 | .bg-success(); 22 | } 23 | &.collides { 24 | border: 1px solid @brand-warning; 25 | .bg-warning(); 26 | } 27 | &.own { 28 | border: 1px solid @gray-light; 29 | } 30 | } 31 | } 32 | 33 | .row-day { 34 | border-top: 2px solid @gray-light; 35 | } 36 | 37 | .row-header { 38 | min-width: 90px; 39 | } 40 | 41 | .space-top { 42 | margin-top: 15px; 43 | } 44 | 45 | .messages { 46 | &:focus { 47 | outline: none; 48 | } 49 | a:focus { 50 | outline: none; 51 | } 52 | } 53 | 54 | .messages span.text-danger { 55 | animation: pulse 1s infinite; 56 | -webkit-animation: pulse 1s infinite; 57 | -moz-animation: pulse 1s infinite; 58 | } 59 | 60 | @keyframes pulse { 61 | 0% { 62 | transform: rotate(0deg); 63 | } 64 | 10% { 65 | transform: rotate(5deg) translateY(-2px); 66 | } 67 | 20% { 68 | transform: rotate(-5deg); 69 | } 70 | 30% { 71 | transform: rotate(5deg) translateY(-2px);; 72 | } 73 | 40% { 74 | transform: rotate(-5deg); 75 | } 76 | 50% { 77 | transform: rotate(0deg) translateY(-2px); 78 | } 79 | 75% { 80 | transform: rotate(0deg) translateY(0px); 81 | } 82 | } 83 | 84 | @-webkit-keyframes pulse { 85 | 0% { 86 | transform: rotate(0deg); 87 | } 88 | 10% { 89 | transform: rotate(5deg) translateY(-2px); 90 | } 91 | 20% { 92 | transform: rotate(-5deg); 93 | } 94 | 30% { 95 | transform: rotate(5deg) translateY(-2px); 96 | } 97 | 40% { 98 | transform: rotate(-5deg); 99 | } 100 | 50% { 101 | transform: rotate(0deg) translateY(-2px); 102 | } 103 | 75% { 104 | transform: rotate(0deg) translateY(0px); 105 | } 106 | } 107 | 108 | @-moz-keyframes pulse { 109 | 0% { 110 | transform: rotate(0deg); 111 | } 112 | 10% { 113 | transform: rotate(5deg) translateY(-2px); 114 | } 115 | 20% { 116 | transform: rotate(-5deg); 117 | } 118 | 30% { 119 | transform: rotate(5deg) translateY(-2px); 120 | } 121 | 40% { 122 | transform: rotate(-5deg); 123 | } 124 | 50% { 125 | transform: rotate(0deg) translateY(-2px); 126 | } 127 | 75% { 128 | transform: rotate(0deg) translateY(0px); 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /config/config-sample.default.php: -------------------------------------------------------------------------------- 1 | 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < 6) 45 | OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`start`)) < 6) 46 | OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) <= 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) >= 6) 47 | ))*(`Shifts`.`end` - `Shifts`.`start`)*(1 - 3 * `ShiftEntry`.`freeloaded`) 48 | )"; 49 | 50 | // voucher calculation 51 | $voucher_settings = array( 52 | "initial_vouchers" => 2, 53 | "shifts_per_voucher" => 1 54 | ); 55 | 56 | // weigh every shift the same 57 | // $shift_sum_formula = "SUM(`end` - `start`)"; 58 | 59 | // For accessing stats 60 | $api_key = ""; 61 | 62 | // MySQL-Connection Settings 63 | $DB_HOST = "localhost"; 64 | $DB_USER = "username_here"; 65 | $DB_PASSWORD = "password_here"; 66 | $DB_NAME = "database_name_here"; 67 | 68 | /** reCaptcha Settings 69 | * Visit http://www.google.com/recaptcha/admin#whyrecaptcha for generating reCaptcha keys for your website. 70 | */ 71 | define('capflg', ''); // Set reCaptch enalble or disable. true = enable , false = disable. 72 | define('CAPTCHA_KEY_PUBLIC', ''); // Public/Data-site key 73 | define('CAPTCHA_KEY_PRIVATE', ''); // Private/Secret Key 74 | ?> 75 | -------------------------------------------------------------------------------- /includes/model/News_model.php: -------------------------------------------------------------------------------- 1 | 94 | -------------------------------------------------------------------------------- /includes/model/UserDriverLicenses_model.php: -------------------------------------------------------------------------------- 1 | 0) 12 | return $user_driver_license[0]; 13 | return null; 14 | } 15 | 16 | /** 17 | * Create a user's driver license entry 18 | * 19 | * @param bool $user_id 20 | * @param bool $has_car 21 | * @param bool $has_license_car 22 | * @param bool $has_license_3_5t_transporter 23 | * @param bool $has_license_7_5t_truck 24 | * @param bool $has_license_12_5t_truck 25 | * @param bool $has_license_forklift 26 | */ 27 | function UserDriverLicenses_create($user_id, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift) { 28 | return sql_query(" 29 | INSERT INTO `UserDriverLicenses` SET 30 | `user_id`=" . sql_escape($user_id) . ", 31 | `has_car`=" . sql_bool($has_car) . ", 32 | `has_license_car`=" . sql_bool($has_license_car) . ", 33 | `has_license_3_5t_transporter`=" . sql_bool($has_license_3_5t_transporter) . ", 34 | `has_license_7_5t_truck`=" . sql_bool($has_license_7_5t_truck) . ", 35 | `has_license_12_5t_truck`=" . sql_bool($has_license_12_5t_truck) . ", 36 | `has_license_forklift`=" . sql_bool($has_license_forklift)); 37 | } 38 | 39 | /** 40 | * Update a user's driver license entry 41 | * 42 | * @param bool $user_id 43 | * @param bool $has_car 44 | * @param bool $has_license_car 45 | * @param bool $has_license_3_5t_transporter 46 | * @param bool $has_license_7_5t_truck 47 | * @param bool $has_license_12_5t_truck 48 | * @param bool $has_license_forklift 49 | */ 50 | function UserDriverLicenses_update($user_id, $has_car, $has_license_car, $has_license_3_5t_transporter, $has_license_7_5t_truck, $has_license_12_5t_truck, $has_license_forklift) { 51 | return sql_query("UPDATE `UserDriverLicenses` SET 52 | `has_car`=" . sql_bool($has_car) . ", 53 | `has_license_car`=" . sql_bool($has_license_car) . ", 54 | `has_license_3_5t_transporter`=" . sql_bool($has_license_3_5t_transporter) . ", 55 | `has_license_7_5t_truck`=" . sql_bool($has_license_7_5t_truck) . ", 56 | `has_license_12_5t_truck`=" . sql_bool($has_license_12_5t_truck) . ", 57 | `has_license_forklift`=" . sql_bool($has_license_forklift) . " 58 | WHERE `user_id`='" . sql_escape($user_id) . "'"); 59 | } 60 | 61 | /** 62 | * Delete a user's driver license entry 63 | * 64 | * @param int $user_id 65 | */ 66 | function UserDriverLicenses_delete($user_id) { 67 | return sql_query("DELETE FROM `UserDriverLicenses` WHERE `user_id`=" . sql_escape($user_id)); 68 | } 69 | ?> -------------------------------------------------------------------------------- /templates/user_shifts.html: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 |
15 | 16 |
17 |
18 |

%title%

19 |
%start_select%
20 |
21 |
22 | 23 |
24 | 27 |
28 |
29 |
30 | – 31 |
%end_select%
32 |
33 |
34 | 35 |
36 | 39 |
40 |
41 |
42 |
43 |
%room_select%
44 |
%type_select%
45 |
%filled_select%
46 |
47 |
48 |
49 |
%task_notice%
50 |
%new_style_checkbox%
51 |
52 |
53 |
54 | 55 |
56 |
57 |
58 |
59 | 60 | 61 |
62 |
63 | 64 |
65 | %shifts_table% %ical_text% 66 |
67 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | branch: development 3 | token: ab8e0fae-2c7c-4792-9696-84ec3c8488d1 4 | bot: null 5 | ci: null 6 | strict_yaml_branch: null 7 | max_report_age: null 8 | notify: 9 | after_n_builds: null 10 | countdown: null 11 | require_ci_to_pass: yes 12 | archive: 13 | uploads: yes 14 | 15 | coverage: 16 | precision: 2 17 | round: down 18 | range: "70...100" 19 | 20 | notify: 21 | slack: 22 | default: 23 | url: null 24 | threshold: null 25 | branches: null 26 | attachments: "sunburst, diff" 27 | only_pulls: null 28 | message: null 29 | flags: null 30 | paths: null 31 | 32 | hipchat: 33 | default: 34 | url: null 35 | notify: no 36 | threshold: null 37 | branches: null 38 | card: yes 39 | only_pulls: null 40 | message: null 41 | flags: null 42 | paths: null 43 | 44 | gitter: 45 | default: 46 | url: null 47 | threshold: null 48 | branches: null 49 | message: null 50 | only_pulls: null 51 | flags: null 52 | paths: null 53 | 54 | webhook: 55 | default: 56 | url: null 57 | threshold: null 58 | branches: null 59 | only_pulls: null 60 | flags: null 61 | paths: null 62 | 63 | irc: 64 | default: 65 | server: null 66 | branches: null 67 | threshold: null 68 | message: null 69 | flags: null 70 | paths: null 71 | 72 | status: 73 | project: 74 | default: 75 | target: auto 76 | threshold: null 77 | branches: null 78 | base: auto 79 | set_pending: yes 80 | if_no_uploads: error 81 | if_not_found: success 82 | if_ci_failed: error 83 | only_pulls: null 84 | flags: null 85 | paths: null 86 | 87 | patch: 88 | default: 89 | target: auto 90 | branches: null 91 | set_pending: yes 92 | base: auto 93 | if_no_uploads: success 94 | if_not_found: success 95 | if_ci_failed: error 96 | only_pulls: null 97 | flags: null 98 | paths: null 99 | 100 | changes: 101 | default: 102 | branches: null 103 | base: auto 104 | set_pending: yes 105 | if_no_uploads: error 106 | if_not_found: success 107 | if_ci_failed: error 108 | only_pulls: null 109 | flags: null 110 | paths: null 111 | flags: 112 | default: 113 | branches: null 114 | ignore: null 115 | 116 | fixes: null 117 | 118 | ignore: null 119 | 120 | comment: 121 | layout: "header, diff, changes, sunburst, uncovered" 122 | branches: null 123 | behavior: default 124 | flags: null 125 | paths: null 126 | -------------------------------------------------------------------------------- /includes/controller/admin_free_controller.php: -------------------------------------------------------------------------------- 1 | 'alle Typen' 26 | ); 27 | foreach ($angel_types_source as $angel_type) 28 | $angel_types[$angel_type['id']] = $angel_type['name']; 29 | 30 | $users = User_select_free($angeltypesearch); 31 | $free_users_table = array(); 32 | if ($search == "") 33 | $tokens = array(); 34 | else 35 | $tokens = explode(" ", $search); 36 | foreach ($users as $usr) { 37 | if (count($tokens) > 0) { 38 | $match = false; 39 | $index = join("", $usr); 40 | foreach ($tokens as $t) 41 | if (stristr($index, trim($t))) { 42 | $match = true; 43 | break; 44 | } 45 | if (! $match) 46 | continue; 47 | } 48 | 49 | $free_users_table[] = array( 50 | 'name' => User_Nick_render($usr), 51 | 'shift_state' => User_shift_state_render($usr), 52 | 'dect' => $usr['DECT'], 53 | 'jabber' => $usr['jabber'], 54 | 'email' => $usr['email'], 55 | 'actions' => in_array('admin_user', $privileges) ? button(page_link_to('admin_user') . '&id=' . $usr['UID'], _("edit"), 'btn-xs') : '' 56 | ); 57 | } 58 | return page_with_title(admin_free_title(), array( 59 | form(array( 60 | div('row', array( 61 | div('col-md-4', array( 62 | form_text('search', _("Search"), $search) 63 | )), 64 | div('col-md-4', array( 65 | form_select('angeltype', _("Angeltype"), $angel_types, $_REQUEST['angeltype']) 66 | )), 67 | div('col-md-2', array( 68 | form_checkbox('confirmed_only', _("Only confirmed"), isset($_REQUEST['confirmed_only'])) 69 | )), 70 | div('col-md-2', array( 71 | form_submit('submit', _("Search")) 72 | )) 73 | )) 74 | )), 75 | table(array( 76 | 'name' => _("Nick"), 77 | 'shift_state' => '', 78 | 'dect' => _("DECT"), 79 | 'jabber' => _("Jabber"), 80 | 'email' => _("E-Mail"), 81 | 'actions' => '' 82 | ), $free_users_table) 83 | )); 84 | } 85 | ?> 86 | -------------------------------------------------------------------------------- /templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %title% - Engelsystem 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | %atom_link% 14 | 15 | 16 | 27 |
28 |
%content%
29 |
30 |
31 |
32 | 36 |
37 |
38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /includes/view/ShiftTypes_view.php: -------------------------------------------------------------------------------- 1 | ' . $shifttype['name'] . ''; 7 | return $shifttype['name']; 8 | } 9 | 10 | function ShiftType_delete_view($shifttype) { 11 | return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), array( 12 | info(sprintf(_("Do you want to delete shifttype %s?"), $shifttype['name']), true), 13 | buttons(array( 14 | button(page_link_to('shifttypes'), _("cancel"), 'cancel'), 15 | button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed', _("delete"), 'ok') 16 | )) 17 | )); 18 | } 19 | 20 | function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) { 21 | $angeltypes_select = [ 22 | '' => _('All') 23 | ]; 24 | foreach ($angeltypes as $angeltype) 25 | $angeltypes_select[$angeltype['id']] = $angeltype['name']; 26 | 27 | return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [ 28 | msg(), 29 | buttons([ 30 | button(page_link_to('shifttypes'), shifttypes_title(), 'back') 31 | ]), 32 | form([ 33 | form_text('name', _('Name'), $name), 34 | form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype_id), 35 | form_textarea('description', _('Description'), $description), 36 | form_info('', _('Please use markdown for the description.')), 37 | form_submit('submit', _('Save')) 38 | ]) 39 | ]); 40 | } 41 | 42 | function ShiftType_view($shifttype, $angeltype) { 43 | $parsedown = new Parsedown(); 44 | $title = $shifttype['name']; 45 | if ($angeltype) 46 | $title .= ' ' . sprintf(_('for team %s'), $angeltype['name']) . ''; 47 | return page_with_title($title, [ 48 | msg(), 49 | buttons([ 50 | button(page_link_to('shifttypes'), shifttypes_title(), 'back'), 51 | $angeltype ? button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], $angeltype['name']) : '', 52 | button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'edit'), 53 | button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'delete') 54 | ]), 55 | $parsedown->parse($shifttype['description']) 56 | ]); 57 | } 58 | 59 | function ShiftTypes_list_view($shifttypes) { 60 | foreach ($shifttypes as &$shifttype) { 61 | $shifttype['name'] = '' . $shifttype['name'] . ''; 62 | $shifttype['actions'] = table_buttons([ 63 | button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'btn-xs'), 64 | button(page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'], _('delete'), 'btn-xs') 65 | ]); 66 | } 67 | 68 | return page_with_title(shifttypes_title(), [ 69 | msg(), 70 | buttons([ 71 | button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add') 72 | ]), 73 | table([ 74 | 'name' => _('Name'), 75 | 'actions' => '' 76 | ], $shifttypes) 77 | ]); 78 | } 79 | 80 | ?> -------------------------------------------------------------------------------- /docs/INSTALLATION_SERVER.md: -------------------------------------------------------------------------------- 1 | #Installation of Engelsystem on a Server 2 | 3 | ## Requirements: 4 | * PHP 5.4.x (cgi-fcgi) 5 | * MySQL-Server 5.5.x 6 | * Webserver, i.e. lighttpd, nginx, or Apache 7 | * Session Settings: Make sure the config allows for sessions. Both Apache and Nginx allow for different VirtualHost configurations. 8 | 9 | ##Installation Steps: 10 | 11 | * clone the repository (the recursive parameter allows us to clone the submodules):                           git clone --recursive [*https://github.com/fossasia/engelsystem.git*](https://github.com/fossasia/engelsystem.git) 12 | 13 | * Compress the downloaded repository in .zip format 14 | 15 | * Upload the compressed file to the server either using the file manager of the CPanel (or Vista Panel) provided by the hosting server or use any FTP client (E.g. FileZilla, etc.) 16 | 17 | * Extract the components in the directory (public\_html) 18 | 19 | * Next, configure your Engelsystem database: 20 | 21 | 1. Create a database for the Engelsystem (give any name to it) 22 | 23 | 2. Open phpMyAdmin on the server to create tables in the database 24 | 25 | 3. In phpMyAdmin select the database created and click on the import tab to import the tables and schema for the Engelsystem 26 | 27 | 4. Import the “install.sql” and “update.sql” to finish configuring the database for the Engelsystem 28 | 29 | 30 | * We must make sure to point our Apache document root to the Engelsystem directory to prevent any user from accessing anything other than the public/ directory for security reasons. Do this by modifying the Apache configuration file using the SSH access and edit the following file: 31 | 32 | \#vim /var/cpanel/userdata/USERNAME/DOMAINNAME.COM 33 | 34 | Change USERNAME with the CPanel username and DOMAINNAME with the primary domainname. 35 | 36 | * After editing file, search for text *documentroot* and change the path as: 37 | 38 | documentroot: /home/USERNAME/public\_html/\[Engelsystem directory\]/public 39 | 40 | * After making changed, we need to rebuid Apache configuration file and restart Apache server. Use the following command to do it. 41 | 42 | \# /scripts/rebuildhttpdconf 43 | 44 | \# service httpd restart 45 | The changes will be permanently updated. Check your site for reflecting changes. For more help on changing the documentroot in CPanel, please visit [here](http://tecadmin.net/how-to-change-document-root-of-primary-domain-in-cpanel/) . 46 | 47 | ## Setting up Captcha 48 | 49 | * For setting up captcha for the online server, we need to signup for reCaptcha API keys. The keys are unique to the domain or domains you specify, and their respective sub-domains. Specifying more than one domain could come in handy in the case that you serve your website from multiple top level domains (for example: yoursite.com, yoursite.net). 50 | * Visit the link,http://www.google.com/recaptcha/admin#whyrecaptcha , and sign up for the reCaptcha API keys. 51 | * After we sign-up for the reCaptcha for the domain, we'll be provided with 2 keys, Public Key(DataSite Key) and a Private Key (Secret key). 52 | * We must change the existing keys, Do this by modifying the file `config.php`. 53 | * User can enable/disable reCaptcha by setting `capflg` in `config.php` as `true`/`false`. 54 | 55 | If you made it this far without any issues, **congratulations!** You have successfully set up Engelsystem on your domain and can use it to manage your event. 56 | 57 | ##Session Settings 58 | 59 | - Make sure the config allows for sessions. 60 | - Both Apache and Nginx allow for different VirtualHost configurations. 61 | 62 | -------------------------------------------------------------------------------- /includes/sys_auth.php: -------------------------------------------------------------------------------- 1 | 0) { 10 | // User is logged in , make data available and update timestamp 11 | list ($user) = $user; 12 | sql_query("UPDATE `User` SET " . "`lastLogIn` = '" . time() . "'" . " WHERE `UID` = '" . sql_escape($_SESSION['uid']) . "' LIMIT 1;"); 13 | } else 14 | unset($_SESSION['uid']); 15 | } 16 | 17 | $privileges = isset($user) ? privileges_for_user($user['UID']) : privileges_for_group(- 1); 18 | } 19 | 20 | // generate a salt (random string) of arbitrary length suitable for the use with crypt() 21 | function generate_salt($length = 16) { 22 | $alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 23 | $salt = ""; 24 | for($i = 0; $i < $length; $i ++) { 25 | $salt .= $alphabet[rand(0, strlen($alphabet) - 1)]; 26 | } 27 | return $salt; 28 | } 29 | 30 | // set the password of a user 31 | function set_password($uid, $password) { 32 | return sql_query("UPDATE `User` SET `Passwort` = '" . sql_escape(crypt($password, CRYPT_ALG . '$' . generate_salt(16) . '$')) . "', `password_recovery_token`=NULL WHERE `UID` = " . intval($uid) . " LIMIT 1"); 33 | } 34 | 35 | // verify a password given a precomputed salt. 36 | // if $uid is given and $salt is an old-style salt (plain md5), we convert it automatically 37 | function verify_password($password, $salt, $uid = false) { 38 | $correct = false; 39 | if (substr($salt, 0, 1) == '$') // new-style crypt() 40 | $correct = crypt($password, $salt) == $salt; 41 | elseif (substr($salt, 0, 7) == '{crypt}') // old-style crypt() with DES and static salt - not used anymore 42 | $correct = crypt($password, '77') == $salt; 43 | elseif (strlen($salt) == 32) // old-style md5 without salt - not used anymore 44 | $correct = md5($password) == $salt; 45 | 46 | if ($correct && substr($salt, 0, strlen(CRYPT_ALG)) != CRYPT_ALG && $uid) { 47 | // this password is stored in another format than we want it to be. 48 | // let's update it! 49 | // we duplicate the query from the above set_password() function to have the extra safety of checking the old hash 50 | sql_query("UPDATE `User` SET `Passwort` = '" . sql_escape(crypt($password, CRYPT_ALG . '$' . generate_salt() . '$')) . "' WHERE `UID` = " . intval($uid) . " AND `Passwort` = '" . sql_escape($salt) . "' LIMIT 1"); 51 | } 52 | return $correct; 53 | } 54 | 55 | function privileges_for_user($user_id) { 56 | $privileges = array (); 57 | $user_privs = sql_select("SELECT `Privileges`.`name` FROM `User` JOIN `UserGroups` ON (`User`.`UID` = `UserGroups`.`uid`) JOIN `GroupPrivileges` ON (`UserGroups`.`group_id` = `GroupPrivileges`.`group_id`) JOIN `Privileges` ON (`GroupPrivileges`.`privilege_id` = `Privileges`.`id`) WHERE `User`.`UID`='" . sql_escape($user_id) . "'"); 58 | foreach ($user_privs as $user_priv) 59 | $privileges[] = $user_priv['name']; 60 | return $privileges; 61 | } 62 | 63 | function privileges_for_group($group_id) { 64 | $privileges = array (); 65 | $groups_privs = sql_select("SELECT * FROM `GroupPrivileges` JOIN `Privileges` ON (`GroupPrivileges`.`privilege_id` = `Privileges`.`id`) WHERE `group_id`='" . sql_escape($group_id) . "'"); 66 | foreach ($groups_privs as $guest_priv) 67 | $privileges[] = $guest_priv['name']; 68 | return $privileges; 69 | } 70 | ?> 71 | -------------------------------------------------------------------------------- /public/maintenance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Maintenance - Engelsystem 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 29 |
30 |
31 |
32 |
33 |

34 | 35 |

36 |
37 |

38 | The ENGELSYSTEM is in maintenance mode. 39 |

40 |

This may be due to...

41 |

42 | ...archangels closing the gates of heaven.
...somebody's stolen the power chord and now the battery is empty.
...DHCP decided to give me another ip address. 43 |

44 |
45 |
46 | 47 |
48 |
49 |
50 |
51 |
52 |
53 | 56 |
57 |
58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /includes/controller/admin_groups_controller.php: -------------------------------------------------------------------------------- 1 | $group['Name'], 22 | 'privileges' => join(', ', $privileges_html), 23 | 'actions' => button(page_link_to('admin_groups') . '&action=edit&id=' . $group['UID'], _("edit"), 'btn-xs') 24 | ); 25 | } 26 | 27 | return page_with_title(admin_groups_title(), array( 28 | table(array( 29 | 'name' => _("Name"), 30 | 'privileges' => _("Privileges"), 31 | 'actions' => '' 32 | ), $groups_table) 33 | )); 34 | } else { 35 | switch ($_REQUEST["action"]) { 36 | case 'edit': 37 | if (isset($_REQUEST['id']) && preg_match("/^-[0-9]{1,11}$/", $_REQUEST['id'])) 38 | $id = $_REQUEST['id']; 39 | else 40 | return error("Incomplete call, missing Groups ID.", true); 41 | 42 | $room = Groups_by_id($id); 43 | if (count($room) > 0) { 44 | list($room) = $room; 45 | $privileges = Privileges_Group_by_id($id); 46 | $privileges_html = ""; 47 | $privileges_form = array(); 48 | foreach ($privileges as $priv) { 49 | $privileges_form[] = form_checkbox('privileges[]', $priv['desc'] . ' (' . $priv['name'] . ')', $priv['group_id'] != "", $priv['id']); 50 | $privileges_html .= sprintf('' . ' %s %s', $priv['id'], ($priv['group_id'] != "" ? 'checked="checked"' : ''), $priv['name'], $priv['desc']); 51 | } 52 | 53 | $privileges_form[] = form_submit('submit', _("Save")); 54 | $html .= page_with_title(_("Edit group"), array( 55 | form($privileges_form, page_link_to('admin_groups') . '&action=save&id=' . $id) 56 | )); 57 | } else 58 | return error("No Group found.", true); 59 | break; 60 | 61 | case 'save': 62 | if (isset($_REQUEST['id']) && preg_match("/^-[0-9]{1,11}$/", $_REQUEST['id'])) 63 | $id = $_REQUEST['id']; 64 | else 65 | return error("Incomplete call, missing Groups ID.", true); 66 | 67 | $room = Groups_by_id($id); 68 | if (! is_array($_REQUEST['privileges'])) 69 | $_REQUEST['privileges'] = array(); 70 | if (count($room) > 0) { 71 | list($room) = $room; 72 | delete_GroupPrivileges($id); 73 | $privilege_names = array(); 74 | foreach ($_REQUEST['privileges'] as $priv) { 75 | if (preg_match("/^[0-9]{1,}$/", $priv)) { 76 | $group_privileges_source = Privileges_by_id($priv); 77 | if (count($group_privileges_source) > 0) { 78 | insert_GroupPrivilege($id, $priv); 79 | $privilege_names[] = $group_privileges_source[0]['name']; 80 | } 81 | } 82 | } 83 | engelsystem_log("Group privileges of group " . $room['Name'] . " edited: " . join(", ", $privilege_names)); 84 | redirect(page_link_to("admin_groups")); 85 | } else 86 | return error("No Group found.", true); 87 | break; 88 | } 89 | } 90 | return $html; 91 | } 92 | ?> 93 | -------------------------------------------------------------------------------- /install.php: -------------------------------------------------------------------------------- 1 | 1) { 30 | $username = strip_request_item('username'); 31 | } else { 32 | $ok = false; 33 | $msg = error(sprintf(_("Your username is too short (min. 2 characters).")), true); 34 | } 35 | 36 | if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= MIN_PASSWORD_LENGTH) { 37 | if ($_REQUEST['password'] != $_REQUEST['password2']) { 38 | $ok = false; 39 | $msg = error(_("Your passwords don't match."), true); 40 | } 41 | } else { 42 | $ok = false; 43 | $msg = error(sprintf(_("Your password is too short (please use at least %s characters)."), MIN_PASSWORD_LENGTH), true); 44 | } 45 | 46 | if (isset($_REQUEST['mail']) && strlen(strip_request_item('mail')) && preg_match("/^[a-z0-9._+-]{1,64}@(?:[a-z0-9-]{1,63}\.){1,125}[a-z]{2,63}$/", $_REQUEST['mail']) > 0) { 47 | $mail = strip_request_item('mail'); 48 | if (! check_email($mail)) { 49 | $ok = false; 50 | $msg = error(_("E-mail address is not correct."), true); 51 | } 52 | } else { 53 | $ok = false; 54 | $msg = error(_("Please enter your correct e-mail (in lowercase)."), true); 55 | } 56 | } 57 | 58 | if ($ok) { 59 | $uid = 1; 60 | if ($val) { 61 | $no_migrated = 1; 62 | insert_table_migrated($no_migrated); 63 | update_nick($username, $uid); 64 | update_mail($mail, $uid); 65 | set_password($uid, $_REQUEST['password']); 66 | success(_("Files imported successfully to database")); 67 | success(_("Installation successful.")); 68 | redirect(page_link_to('login')); 69 | } 70 | else { 71 | error(_("Installation Failed")); 72 | redirect(page_link_to('install')); 73 | } 74 | } 75 | return page_with_title(install_title(), array( 76 | $msg, 77 | div('well well-sm text-center', [ 78 | ('Welcome') 79 | ]).div('row', array( 80 | div('col-md-12', array( 81 | form(array( 82 | form_info('', _("Welcome to the famous five-minute Engelsystem installation process! Just fill in the information below and you’ll be on your way to volunteer management application for events with admin rights.")), 83 | )) 84 | )) 85 | )).div('well well-sm text-center', [ 86 | _('Information Needed') 87 | ]).div('row', array( 88 | div('col-md-12', array( 89 | form(array( 90 | form_info('', _("Please provide the following information. Don’t worry, you can always change these settings later. All fields are compulsory")), 91 | form_text('username', _("Enter Admin Username"), $username), 92 | form_password('password', _("Enter New Password")), 93 | form_password('password2', _("Confirm Password")), 94 | form_email('mail', _("Enter E-Mail"), $mail), 95 | form_submit('install', _("Install Engelsystem")) 96 | )) 97 | )) 98 | )) 99 | )); 100 | } 101 | } 102 | ?> 103 | -------------------------------------------------------------------------------- /includes/mailer/shifts_mailer.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/model/Room_model.php: -------------------------------------------------------------------------------- 1 | 0) 44 | return $room_source[0]; 45 | return null; 46 | } 47 | 48 | /** 49 | * Returns room by name. 50 | * 51 | */ 52 | function Room_by_name() { 53 | return sql_select("SELECT * FROM `Room` ORDER BY `Name`"); 54 | } 55 | 56 | /** 57 | * Returns room by id. 58 | * 59 | * @param $id ID of Rooms 60 | */ 61 | function Room_by_id($id) { 62 | return sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($id) . "'"); 63 | } 64 | 65 | /** 66 | * Returns count of Room by name. 67 | * 68 | * @param name from `Rooms` 69 | * @param $id ID of Rooms 70 | */ 71 | function count_room_by_id_name($name, $id) { 72 | return sql_num_query("SELECT * FROM `Room` WHERE `Name`='" . sql_escape($name) . "' AND NOT `RID`=" . sql_escape($id)); 73 | } 74 | 75 | /** 76 | * Update Room 77 | * 78 | * @param $name name of Room 79 | * @param $from_pentbarf from_pentabarf fo Room 80 | * @param $public form Room 81 | * @param $number number of Room 82 | * @param $id RID 83 | */ 84 | function update_rooms($name, $from_pentabarf, $public, $number, $id, $event_id) { 85 | return sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "', `e_id`='" . sql_escape($event_id) . "' WHERE `RID`='" . sql_escape($id) . "' LIMIT 1"); 86 | } 87 | 88 | /** 89 | * Returns Rooms 90 | * 91 | */ 92 | function gets_rooms() { 93 | return sql_select("SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` WHERE `show`='1' ORDER BY `Name`"); 94 | } 95 | 96 | /** 97 | * Returns Visible/public Rooms 98 | * 99 | */ 100 | function selects_visible_rooms() { 101 | return sql_select("SELECT * FROM `Room` WHERE `show`='1' ORDER BY `Name`"); 102 | } 103 | 104 | /** 105 | * Returns Rooms with From_Pentabarf 106 | * 107 | */ 108 | function Room_by_FromPentabarf() { 109 | return sql_select("SELECT * FROM `Room` WHERE `FromPentabarf`='1'"); 110 | } 111 | 112 | /** 113 | * Returns all Rooms 114 | * 115 | */ 116 | function Room_all() { 117 | return sql_select("SELECT * FROM `Room`"); 118 | } 119 | 120 | /** 121 | * Delete Room by Name 122 | * 123 | * @param $room name from Room 124 | */ 125 | function delete_room_by_name ($room) { 126 | return sql_query("DELETE FROM `Room` WHERE `Name`='" . sql_escape($room) . "' LIMIT 1"); 127 | } 128 | 129 | /** 130 | * Returns public Rooms 131 | * 132 | */ 133 | function Rooms() { 134 | $room_source = sql_select("SELECT * FROM `Room` WHERE `show` = 'Y'"); 135 | 136 | if ($room_source === false) 137 | return false; 138 | if (count($room_source) > 0) 139 | return $room_source[0]; 140 | return null; 141 | } 142 | 143 | ?> 144 | -------------------------------------------------------------------------------- /includes/controller/admin_events_controller.php: -------------------------------------------------------------------------------- 1 | getTimestamp(); 18 | $end_date = $start_date; 19 | $start_time = DateTime::createFromFormat("H:i", date("H:i") )->getTimestamp(); 20 | $end_time = $start_time; 21 | $venue = ""; 22 | 23 | if (isset($_REQUEST['submit'])) { 24 | $ok = true; 25 | 26 | if (isset($_REQUEST['name'])) 27 | $name = strip_request_item('name'); 28 | 29 | if (isset($_REQUEST['start_date']) && $tmp = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['start_date']))) 30 | $start_date = $tmp->getTimestamp(); 31 | else { 32 | $ok = false; 33 | error(_('Please select a start date.')); 34 | } 35 | if (isset($_REQUEST['end_date']) && $tmp = DateTime::createFromFormat("Y-m-d", trim($_REQUEST['end_date']))) 36 | $end_date = $tmp->getTimestamp(); 37 | else { 38 | $ok = false; 39 | error(_('Please select an end date.')); 40 | } 41 | if (isset($_REQUEST['start_time']) && $tmp = DateTime::createFromFormat("H:i", trim($_REQUEST['start_time']))) 42 | $start_time = $tmp->getTimestamp(); 43 | else { 44 | $ok = false; 45 | error(_('Please select an start time.')); 46 | } 47 | if (isset($_REQUEST['end_time']) && $tmp = DateTime::createFromFormat("H:i", trim($_REQUEST['end_time']))) 48 | $end_time = $tmp->getTimestamp(); 49 | else { 50 | $ok = false; 51 | error(_('Please select an end time.')); 52 | } 53 | 54 | if (strtotime($_REQUEST['start_date']) > strtotime($_REQUEST['end_date'])) { 55 | $ok = false; 56 | error(_('The event end has to be after its start.')); 57 | } 58 | if (strtotime($_REQUEST['start_date']) == strtotime($_REQUEST['end_date'])) { 59 | if (strtotime($_REQUEST['start_time']) > strtotime($_REQUEST['end_time'])) { 60 | $ok = false; 61 | error(_('The events end time has to be after its start time.')); 62 | } 63 | } 64 | if (strtotime($_REQUEST['start_date']) == strtotime($_REQUEST['end_date'])) { 65 | if (strtotime($_REQUEST['start_time']) == strtotime($_REQUEST['end_time'])) { 66 | $ok = false; 67 | error(_('The event start and end at same time.')); 68 | } 69 | } 70 | if (isset($_REQUEST['venue'])) 71 | $venue = strip_request_item('venue'); 72 | if (isset($_REQUEST['organizer'])) 73 | $organizer = strip_request_item('organizer'); 74 | if (isset($_REQUEST['description'])) 75 | $description = strip_request_item_nl('description'); 76 | 77 | } 78 | 79 | if ($ok) { 80 | event_create($name, $description, $organizer, $start_date, $start_time, $end_date, $end_time, $venue); 81 | 82 | success(_("New Event Created.")); 83 | redirect(page_link_to('admin_events')); 84 | } 85 | 86 | return page_with_title(admin_events_title(), array( 87 | msg(), 88 | form(array( 89 | form_text('name', _("Event Name"), $name), 90 | form_textarea('description', _("Event Description"), $description), 91 | form_text('organizer', _("Organizer Name"), $organizer), 92 | form_date('start_date', _("Start Date"), $start_date), 93 | form_text('start_time', _("Start Time"), date("H:i", $start_time)), 94 | form_date('end_date', _("End Date"), $end_date), 95 | form_text('end_time', _("End Time"), date("H:i", $end_time)), 96 | form_text('venue', _("Venue"), $venue), 97 | form_submit('submit', _("Save")) 98 | )) 99 | )); 100 | 101 | } 102 | 103 | ?> -------------------------------------------------------------------------------- /includes/view/UserAngelTypes_view.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /includes/controller/shifts_controller.php: -------------------------------------------------------------------------------- 1 | 0) 89 | redirect(shift_link($upcoming_shifts[0])); 90 | 91 | redirect(page_link_to('user_shifts')); 92 | } 93 | 94 | /** 95 | * Export all shifts using api-key. 96 | */ 97 | function shifts_json_export_all_controller() { 98 | global $api_key; 99 | 100 | if ($api_key == "") 101 | die("Config contains empty apikey."); 102 | 103 | if (! isset($_REQUEST['api_key'])) 104 | die("Missing parameter api_key."); 105 | 106 | if ($_REQUEST['api_key'] != $api_key) 107 | die("Invalid api_key."); 108 | 109 | $shifts_source = Shifts(); 110 | if ($shifts_source === false) 111 | die("Unable to load shifts."); 112 | 113 | header("Content-Type: application/json; charset=utf-8"); 114 | echo json_encode($shifts_source); 115 | die(); 116 | } 117 | 118 | /** 119 | * Export filtered shifts via JSON. 120 | * (Like iCal Export or shifts view) 121 | */ 122 | function shifts_json_export_controller() { 123 | global $ical_shifts, $user; 124 | 125 | if (isset($_REQUEST['key']) && preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) 126 | $key = $_REQUEST['key']; 127 | else 128 | die("Missing key."); 129 | 130 | $user = User_by_api_key($key); 131 | if ($user === false) 132 | die("Unable to find user."); 133 | if ($user == null) 134 | die("Key invalid."); 135 | if (! in_array('shifts_json_export', privileges_for_user($user['UID']))) 136 | die("No privilege for shifts_json_export."); 137 | 138 | if (isset($_REQUEST['export']) && $_REQUEST['export'] == 'user_shifts') { 139 | require_once realpath(__DIR__ . '/../pages/user_shifts.php'); 140 | view_user_shifts(); 141 | } else { 142 | $ical_shifts = shifts_ical($user['UID']); 143 | } 144 | 145 | header("Content-Type: application/json; charset=utf-8"); 146 | echo json_encode($ical_shifts); 147 | die(); 148 | } 149 | 150 | ?> 151 | -------------------------------------------------------------------------------- /includes/controller/user_myshifts_controller.php: -------------------------------------------------------------------------------- 1 | 0) { 17 | $id = $_REQUEST['id']; 18 | } else { 19 | $id = $user['UID']; 20 | } 21 | 22 | list($shifts_user) = user_by_id($id); 23 | 24 | if (isset($_REQUEST['reset'])) { 25 | if ($_REQUEST['reset'] == "ack") { 26 | User_reset_api_key($user); 27 | success(_("Key changed.")); 28 | redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']); 29 | } 30 | return page_with_title(_("Reset API key"), array( 31 | error(_("If you reset the key, the url to your iCal- and JSON-export and your atom feed changes! You have to update it in every application using one of these exports."), true), 32 | button(page_link_to('user_myshifts') . '&reset=ack', _("Continue"), 'btn-danger') 33 | )); 34 | } elseif (isset($_REQUEST['edit']) && preg_match("/^[0-9]*$/", $_REQUEST['edit'])) { 35 | $id = $_REQUEST['edit']; 36 | $shift = select_shifts($id, $shifts_user['UID']); 37 | if (count($shift) > 0) { 38 | $shift = $shift[0]; 39 | $freeloaded = $shift['freeloaded']; 40 | $freeload_comment = $shift['freeload_comment']; 41 | 42 | if (isset($_REQUEST['submit'])) { 43 | $ok = true; 44 | if (in_array("user_shifts_admin", $privileges)) { 45 | $freeloaded = isset($_REQUEST['freeloaded']); 46 | $freeload_comment = strip_request_item_nl('freeload_comment'); 47 | if ($freeloaded && $freeload_comment == '') { 48 | $ok = false; 49 | error(_("Please enter a freeload comment!")); 50 | } 51 | } 52 | 53 | $comment = strip_request_item_nl('comment'); 54 | $user_source = User($shift['UID']); 55 | 56 | if ($ok) { 57 | $result = ShiftEntry_update(array( 58 | 'id' => $id, 59 | 'Comment' => $comment, 60 | 'freeloaded' => $freeloaded, 61 | 'freeload_comment' => $freeload_comment 62 | )); 63 | if ($result === false) 64 | engelsystem_error('Unable to update shift entry.'); 65 | 66 | engelsystem_log("Updated " . User_Nick_render($user_source) . "'s shift " . $shift['name'] . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end']) . " with comment " . $comment . ". Freeloaded: " . ($freeloaded ? "YES Comment: " . $freeload_comment : "NO")); 67 | success(_("Shift saved.")); 68 | redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']); 69 | } 70 | } 71 | 72 | return ShiftEntry_edit_view(User_Nick_render($shifts_user), date("Y-m-d H:i", $shift['start']) . ', ' . shift_length($shift), $shift['Name'], $shift['name'], $shift['angel_type'], $shift['Comment'], $shift['freeloaded'], $shift['freeload_comment'], in_array("user_shifts_admin", $privileges)); 73 | } else 74 | redirect(page_link_to('user_myshifts')); 75 | } elseif (isset($_REQUEST['cancel']) && preg_match("/^[0-9]*$/", $_REQUEST['cancel'])) { 76 | $id = $_REQUEST['cancel']; 77 | $shift = shiftentry_select($id, $shifts_user['UID']); 78 | if (count($shift) > 0) { 79 | $shift = $shift[0]; 80 | if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) { 81 | $result = ShiftEntry_delete($id); 82 | if ($result === false) 83 | engelsystem_error('Unable to delete shift entry.'); 84 | $room = Room($shift['RID']); 85 | $angeltype = AngelType($shift['TID']); 86 | $shifttype = ShiftType($shift['shifttype_id']); 87 | 88 | engelsystem_log("Deleted own shift: " . $shifttype['name'] . " at " . $room['Name'] . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end']) . " as " . $angeltype['name']); 89 | success(_("Shift canceled.")); 90 | } else 91 | error(_("It's too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so.")); 92 | } else 93 | redirect(user_link($shifts_user)); 94 | } 95 | 96 | redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']); 97 | } 98 | ?> 99 | -------------------------------------------------------------------------------- /includes/controller/admin_questions_controller.php: -------------------------------------------------------------------------------- 1 | 0) 13 | return info('' . _('There are unanswered questions!') . '', true); 14 | } 15 | 16 | return ""; 17 | } 18 | 19 | function admin_questions() { 20 | global $user; 21 | 22 | if (! isset($_REQUEST['action'])) { 23 | $unanswered_questions_table = array(); 24 | $questions = Questions(); 25 | foreach ($questions as $question) { 26 | $user_source = User($question['UID']); 27 | if ($user_source === false) 28 | engelsystem_error("Unable to load user."); 29 | 30 | $unanswered_questions_table[] = array( 31 | 'from' => User_Nick_render($user_source), 32 | 'question' => str_replace("\n", "
", $question['Question']), 33 | 'answer' => form(array( 34 | form_textarea('answer', '', ''), 35 | form_submit('submit', _("Save")) 36 | ), page_link_to('admin_questions') . '&action=answer&id=' . $question['QID']), 37 | 'actions' => button(page_link_to("admin_questions") . '&action=delete&id=' . $question['QID'], _("delete"), 'btn-xs') 38 | ); 39 | } 40 | 41 | $answered_questions_table = array(); 42 | $questions = Questions(); 43 | foreach ($questions as $question) { 44 | $user_source = User($question['UID']); 45 | if ($user_source === false) 46 | engelsystem_error("Unable to load user."); 47 | 48 | $answer_user_source = User($question['AID']); 49 | if ($answer_user_source === false) 50 | engelsystem_error("Unable to load user."); 51 | $answered_questions_table[] = array( 52 | 'from' => User_Nick_render($user_source), 53 | 'question' => str_replace("\n", "
", $question['Question']), 54 | 'answered_by' => User_Nick_render($answer_user_source), 55 | 'answer' => str_replace("\n", "
", $question['Answer']), 56 | 'actions' => button(page_link_to("admin_questions") . '&action=delete&id=' . $question['QID'], _("delete"), 'btn-xs') 57 | ); 58 | } 59 | 60 | return page_with_title(admin_questions_title(), array( 61 | '

' . _("Unanswered questions") . '

', 62 | table(array( 63 | 'from' => _("From"), 64 | 'question' => _("Question"), 65 | 'answer' => _("Answer"), 66 | 'actions' => '' 67 | ), $unanswered_questions_table), 68 | '

' . _("Answered questions") . '

', 69 | table(array( 70 | 'from' => _("From"), 71 | 'question' => _("Question"), 72 | 'answered_by' => _("Answered by"), 73 | 'answer' => _("Answer"), 74 | 'actions' => '' 75 | ), $answered_questions_table) 76 | )); 77 | } else { 78 | switch ($_REQUEST['action']) { 79 | case 'answer': 80 | if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) 81 | $id = $_REQUEST['id']; 82 | else 83 | return error("Incomplete call, missing Question ID.", true); 84 | 85 | $question = Questions_by_id($id); 86 | if (count($question) > 0 && $question[0]['AID'] == null) { 87 | $answer = trim(preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['answer']))); 88 | 89 | if ($answer != "") { 90 | update_questions($user, $answer, $id); 91 | engelsystem_log("Question " . $question[0]['Question'] . " answered: " . $answer); 92 | redirect(page_link_to("admin_questions")); 93 | } else 94 | return error("Gib eine Antwort ein!", true); 95 | } else 96 | return error("No question found.", true); 97 | break; 98 | case 'delete': 99 | if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) 100 | $id = $_REQUEST['id']; 101 | else 102 | return error("Incomplete call, missing Question ID.", true); 103 | 104 | $question = Questions_by_id($id); 105 | if (count($question) > 0) { 106 | delete_questions_by_id($id); 107 | engelsystem_log("Question deleted: " . $question[0]['Question']); 108 | redirect(page_link_to("admin_questions")); 109 | } else 110 | return error("No question found.", true); 111 | break; 112 | } 113 | } 114 | } 115 | ?> 116 | -------------------------------------------------------------------------------- /includes/model/Message_model.php: -------------------------------------------------------------------------------- 1 | 0) 21 | return $message_source[0]; 22 | return null; 23 | } 24 | 25 | /** 26 | * TODO: use validation functions, return new message id 27 | * TODO: global $user con not be used in model! 28 | * send message 29 | * 30 | * @param $id User 31 | * ID of Reciever 32 | * @param $text Text 33 | * of Message 34 | */ 35 | function Message_send($id, $text) { 36 | global $user; 37 | 38 | $text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text)); 39 | $to = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($id)); 40 | 41 | if (($text != "" && is_numeric($to)) && (sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($to) . "' AND NOT `UID`='" . sql_escape($user['UID']) . "' LIMIT 1") > 0)) { 42 | sql_query("INSERT INTO `Messages` SET `Datum`='" . sql_escape(time()) . "', `SUID`='" . sql_escape($user['UID']) . "', `RUID`='" . sql_escape($to) . "', `Text`='" . sql_escape($text) . "'"); 43 | return true; 44 | } else { 45 | return false; 46 | } 47 | } 48 | 49 | /** 50 | * Unread Message 51 | * 52 | * @param $RUID GroupID Messages 53 | * 54 | */ 55 | function message_unread($uid) { 56 | return sql_num_query("SELECT * FROM `Messages` WHERE isRead='N' AND `RUID`='" . sql_escape($uid) . "'"); 57 | } 58 | 59 | /** 60 | * Returns User array by Nick 61 | * 62 | * @param $UID ID User 63 | * 64 | */ 65 | function user_by_nick($uid) { 66 | return sql_select("SELECT * FROM `User` WHERE NOT `UID`='" . sql_escape($uid) . "' ORDER BY `Nick`"); 67 | } 68 | 69 | /** 70 | * Returns Group array by Name 71 | * 72 | * 73 | */ 74 | function select_group() { 75 | return sql_select("SELECT * FROM `Groups` ORDER BY `Name`"); 76 | } 77 | 78 | /** 79 | * Returns AngelType array by name 80 | * 81 | * 82 | */ 83 | function select_angeltypes() { 84 | return sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`"); 85 | } 86 | 87 | /** 88 | * Returns Message array 89 | * 90 | * @param $UID ID Messages 91 | * 92 | */ 93 | function select_messages($uid) { 94 | return sql_select("SELECT * FROM `Messages` WHERE `SUID`='" . sql_escape($uid) . "' OR `RUID`='" . sql_escape($uid) . "' ORDER BY `isRead`,`Datum` DESC"); 95 | } 96 | 97 | /** 98 | * Returns Message array 99 | * 100 | * @param $UID ID Messages 101 | * 102 | */ 103 | 104 | function messages_by_id($id) { 105 | return sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($id) . "' LIMIT 1"); 106 | } 107 | 108 | /** 109 | * Update Message 110 | * 111 | * @param $ID ID Messages 112 | * 113 | */ 114 | function messages_read_by_id($id) { 115 | return sql_query("UPDATE `Messages` SET `isRead`='Y' WHERE `id`='" . sql_escape($id) . "' LIMIT 1"); 116 | } 117 | 118 | /** 119 | * Delete Messages 120 | * 121 | * @param $ID ID Messages 122 | * 123 | */ 124 | function messages_delete($id) { 125 | return sql_query("DELETE FROM `Messages` WHERE `id`='" . sql_escape($id) . "' LIMIT 1"); 126 | } 127 | 128 | /** 129 | * User array 130 | * 131 | * 132 | */ 133 | function user_count() { 134 | return sql_num_query("SELECT * FROM `User`"); 135 | } 136 | 137 | /** 138 | * Returns UserGroup array 139 | * 140 | * @param $to GroupID UserGroup 141 | * 142 | */ 143 | function select_usergroups($to) { 144 | return sql_select("SELECT * FROM `UserGroups` WHERE `group_id`='" . sql_escape($to) . "'"); 145 | } 146 | 147 | /** 148 | * Returns UserAngelTypes array 149 | * 150 | * @param $id ID UserAngelType 151 | * 152 | */ 153 | function select_userangeltypes($id) { 154 | return sql_select("SELECT * FROM `UserAngelTypes` WHERE `angeltype_id`='" . sql_escape($id) . "'"); 155 | } 156 | 157 | /** 158 | * Deleted Needed AngelTypes 159 | * 160 | * @param $shift_id Shift ID NeededAngelTypes 161 | * 162 | */ 163 | function delete_needed_angeltype_by_ids($shift_id) { 164 | return sql_query("DELETE FROM `NeededAngelTypes` WHERE `shift_id`='" . sql_escape($shift_id) . "'"); 165 | } 166 | 167 | /** 168 | * Insert Needed AngelType 169 | * 170 | * @param $shift_id shiftID NeededAngelType 171 | * @param $type_id typeID NeededAngelType 172 | * @param $count count NeededAngelType 173 | * 174 | */ 175 | function inserts_needed_angeltypes($shift_id, $type_id, $count) { 176 | return sql_query("INSERT INTO `NeededAngelTypes` SET `shift_id`='" . sql_escape($shift_id) . "', `angel_type_id`='" . sql_escape($type_id) . "', `count`='" . sql_escape($count) . "'"); 177 | } 178 | ?> 179 | -------------------------------------------------------------------------------- /db/update.sql: -------------------------------------------------------------------------------- 1 | -- drivers license information 2 | CREATE TABLE IF NOT EXISTS `UserDriverLicenses` ( 3 | `user_id` int(11) NOT NULL, 4 | `has_car` tinyint(1) NOT NULL, 5 | `has_license_car` tinyint(1) NOT NULL, 6 | `has_license_3_5t_transporter` tinyint(1) NOT NULL, 7 | `has_license_7_5t_truck` tinyint(1) NOT NULL, 8 | `has_license_12_5t_truck` tinyint(1) NOT NULL, 9 | `has_license_forklift` tinyint(1) NOT NULL, 10 | PRIMARY KEY (`user_id`) 11 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 12 | ALTER TABLE `UserDriverLicenses` 13 | ADD CONSTRAINT `userdriverlicenses_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE; 14 | 15 | -- ----------------------------------------------------------------------------- 16 | -- Update table 'Angeltypes' 17 | ALTER TABLE `AngelTypes` ADD `requires_driver_license` BOOLEAN NOT NULL; 18 | 19 | -- ----------------------------------------------------------------------------- 20 | -- Update 'User' Table 21 | ALTER TABLE `User` 22 | ADD UNIQUE (email), 23 | ADD `current_city` varchar(255) DEFAULT NULL, 24 | ADD `twitter` varchar(255) DEFAULT NULL, 25 | ADD `facebook` varchar(255) DEFAULT NULL, 26 | ADD `github` varchar(255) DEFAULT NULL, 27 | ADD `organization` varchar(255) DEFAULT NULL, 28 | ADD `organization_web` varchar(255) DEFAULT NULL, 29 | ADD `timezone` varchar(255) DEFAULT NULL, 30 | ADD `native_lang` varchar(5) DEFAULT NULL, 31 | ADD `other_langs` varchar(150) DEFAULT NULL; 32 | 33 | -- ----------------------------------------------------------------------------- 34 | -- Events information table 35 | CREATE TABLE IF NOT EXISTS `Events` ( 36 | `event_id` int(11) NOT NULL AUTO_INCREMENT, 37 | `name` varchar(255) NOT NULL, 38 | `description` text NOT NULL, 39 | `organizer` varchar(255) NOT NULL, 40 | `start_date` int(11) DEFAULT NULL, 41 | `start_time` int(10) NOT NULL, 42 | `end_time` int(10) NOT NULL, 43 | `end_date` int(11) DEFAULT NULL, 44 | `venue` varchar(255) NOT NULL, 45 | PRIMARY KEY (`event_id`), 46 | UNIQUE KEY `Name` (`name`) 47 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; 48 | -- ----------------------------------------------------------------------------- 49 | -- Alter table sturcture for Rooms, converting char(1) type to boolean 50 | ALTER TABLE `Room` 51 | MODIFY COLUMN `FromPentabarf` bit(1) NOT NULL DEFAULT b'0', 52 | MODIFY COLUMN `show` bit(1) NOT NULL DEFAULT b'1'; 53 | -- ----------------------------------------------------------------------------- 54 | -- Welcome Message table 55 | DROP TABLE IF EXISTS `Welcome_Message`; 56 | CREATE TABLE IF NOT EXISTS `Welcome_Message` ( 57 | `display_msg` varchar(255) NOT NULL 58 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; 59 | 60 | INSERT INTO `Welcome_Message` (`display_msg`) VALUES ("By completing this form you're registering as a Chaos-Angel. This script will create you an account in the angel task sheduler."); 61 | 62 | -- --------------------------------------------------------------------------------- 63 | -- Settings table 64 | DROP TABLE IF EXISTS `Settings`; 65 | CREATE TABLE IF NOT EXISTS `Settings` ( 66 | `event_name` varchar(255) DEFAULT NULL, 67 | `buildup_start_date` int(11) DEFAULT NULL, 68 | `event_start_date` int(11) DEFAULT NULL, 69 | `event_end_date` int(11) DEFAULT NULL, 70 | `teardown_end_date` int(11) DEFAULT NULL, 71 | `event_welcome_msg` varchar(255) DEFAULT NULL, 72 | `table_migrated` int(11) DEFAULT '0' 73 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; 74 | 75 | -- Added privilege for Admin Settings 76 | INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (39, 'admin_settings', 'Admin Settings'); 77 | INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (218, -4, 39); 78 | 79 | -- ----------------------------------------------------------------------------------- 80 | -- Added privilege for the Import/Export User data 81 | INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (40, 'admin_export', 'Import and Export user data'); 82 | INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (337, -4, 40); 83 | 84 | -- ----------------------------------------------------------------------------------- 85 | -- Added privelege for the Create Groups page 86 | INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (41, 'admin_cgroups', 'Create new groups'); 87 | INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (339, -4, 41); 88 | 89 | -- ----------------------------------------------------------------------------------- 90 | -- Added privelege for the Create Events page 91 | INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (43, 'admin_events', 'Create new Events'); 92 | INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (347, -4, 43); 93 | 94 | -- ------------------------------------------------------------------------------------ 95 | -- Added Privilege for install page. 96 | INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (42, 'install', 'Install Engelsystem'); 97 | 98 | -- ------------------------------------------------------------------------------------ 99 | -- Updated Table Room 100 | ALTER TABLE `Room` 101 | ADD `e_id` int(11) NOT NULL; 102 | -------------------------------------------------------------------------------- /includes/model/Events_model.php: -------------------------------------------------------------------------------- 1 | 0) 118 | return $event_source; 119 | return null; 120 | } 121 | 122 | /** 123 | * Returns event by id. 124 | * 125 | * @param $id event 126 | * ID 127 | */ 128 | function event($id) { 129 | $event_source = sql_select("SELECT * FROM `Events` WHERE `event_id`='" . sql_escape($id) . "' LIMIT 1"); 130 | if ($event_source === false) 131 | return false; 132 | if (count($event_source) > 0) 133 | return $event_source[0]; 134 | return null; 135 | } 136 | 137 | /** 138 | * Returns event by name. 139 | * 140 | * @param $name event 141 | * NAME 142 | */ 143 | function event_name($name) { 144 | $event_source = sql_select("SELECT * FROM `Events` WHERE `name`='" . sql_escape($name) . "' LIMIT 1"); 145 | if ($event_source === false) 146 | return false; 147 | if (count($event_source) > 0) 148 | return $event_source[0]; 149 | return null; 150 | } 151 | 152 | /** 153 | * Returns event by venue. 154 | * 155 | * @param $venue event 156 | * VENUE 157 | */ 158 | function event_venue($venue) { 159 | $event_source = sql_select("SELECT * FROM `Events` WHERE `venue`='" . sql_escape($venue) . "' "); 160 | if ($event_source === false) 161 | return false; 162 | if (count($event_source) > 0) 163 | return $event_source[0]; 164 | return null; 165 | } 166 | 167 | /** 168 | * Returns event by organizer. 169 | * 170 | * @param $organizer event 171 | * ORGANIZER 172 | */ 173 | function event_organizer($organizer) { 174 | $event_source = sql_select("SELECT * FROM `Events` WHERE `organizer`='" . sql_escape($organizer) . "' "); 175 | if ($event_source === false) 176 | return false; 177 | if (count($event_source) > 0) 178 | return $event_source[0]; 179 | return null; 180 | } 181 | 182 | ?> --------------------------------------------------------------------------------