Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
471c547
Install.php
sreejakshetty Aug 3, 2016
a5e064a
Engelsystem Installation
sreejakshetty Aug 3, 2016
e189189
Fixed the code style violation
sreejakshetty Aug 3, 2016
dd6317c
installing engelsystem through script
sreejakshetty Aug 5, 2016
32f5413
Updated install.php
sreejakshetty Aug 5, 2016
c9b914a
codacy errors
sreejakshetty Aug 5, 2016
66e43a4
Reverted back the links and created docs and install.sh file
sreejakshetty Aug 6, 2016
d24d835
Updated install.sh
sreejakshetty Aug 6, 2016
3b2d934
Resolved synatax errors in bash and tested it on local server
sreejakshetty Aug 7, 2016
83bdc73
Updated install.php resolved the coding style issues, modified instal…
sreejakshetty Aug 8, 2016
a27dd5d
updated install.sh
sreejakshetty Aug 8, 2016
174c905
updated install.sh
sreejakshetty Aug 8, 2016
edf9da9
Resolved issues
sreejakshetty Aug 8, 2016
1db3287
Resolved Issues
sreejakshetty Aug 9, 2016
f3c500f
updated document root from script
sreejakshetty Aug 9, 2016
fd4ef00
Added folder permissions for apache
sreejakshetty Aug 9, 2016
a824aa1
Importing database
sreejakshetty Aug 10, 2016
6618941
Added documentation to configure document root and updated docs
sreejakshetty Aug 11, 2016
f2273c1
Updated Documentation for 5 minute installation
sreejakshetty Aug 12, 2016
4c27438
Updated documentation
sreejakshetty Aug 12, 2016
d8960f1
Resolved database installation script error
sreejakshetty Aug 14, 2016
709dacd
changed the charset and updated the information
sreejakshetty Aug 15, 2016
790fe4d
Validated
sreejakshetty Aug 16, 2016
7be0214
Fixed Apache log error
sreejakshetty Aug 17, 2016
f3722ea
Fixed Apache log error
Aug 17, 2016
85cf447
Renamed the file and edited the last message
Aug 17, 2016
a56aa96
resolved constant variables apache error
sreejakshetty Aug 18, 2016
54ab21c
Validateed for empty database
sreejakshetty Aug 19, 2016
a7a27cd
Apache errors
sreejakshetty Aug 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ To install loklak with Docker please refer to the loklak [Docker installation re

Please read how to deploy to [Heroku here](/docs/HEROKU.md)

## How do I install Engelsystem on my local machine from bash script

Please check out [the documentation here](/docs/INSTALLATION_BASH_SCRIPT.md).

## Report Bugs

Please report bugs and feature requests here https://github.com/engelsystem/engelsystem/issues
Expand Down
30 changes: 16 additions & 14 deletions config/config-sample.default.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
// define('CRYPT_ALG', '$1'); // MD5
// define('CRYPT_ALG', '$2y$13'); // Blowfish
// define('CRYPT_ALG', '$5$rounds=5000'); // SHA-256
define('CRYPT_ALG', '$6$rounds=5000'); // SHA-512
if (!defined('CRYPT_ALG'))
define('CRYPT_ALG', '$6$rounds=5000'); // SHA-512

define('MIN_PASSWORD_LENGTH', 8);
if (!defined('MIN_PASSWORD_LENGTH'))
define('MIN_PASSWORD_LENGTH', 8);

// When angels should specify a T - shirt size when registering or in their profile , set to true :
$enable_tshirt_size = true;
Expand All @@ -49,8 +51,8 @@

// voucher calculation
$voucher_settings = array(
"initial_vouchers" => 2,
"shifts_per_voucher" => 1
"initial_vouchers" => 2,
"shifts_per_voucher" => 1
);

// weigh every shift the same
Expand All @@ -60,17 +62,17 @@
$api_key = "";

// MySQL-Connection Settings
$config = array(
'host' => "localhost",
'user' => "username_here",
'pw' => "password_here",
'db' => "database_name_here"
);

$DB_HOST = "localhost";
$DB_USER = "username_here";
$DB_PASSWORD = "password_here";
$DB_NAME = "database_name_here";
/** reCaptcha Settings
* Visit http://www.google.com/recaptcha/admin#whyrecaptcha for generating reCaptcha keys for your website.
*/
define('capflg', ''); // Set reCaptch enalble or disable. true = enable , false = disable.
define('CAPTCHA_KEY_PUBLIC', ''); // Public/Data-site key
define('CAPTCHA_KEY_PRIVATE', ''); // Private/Secret Key
if (!defined('capflg'))
define('capflg', ''); // Set reCaptch enalble or disable. true = enable , false = disable.
if (!defined('CAPTCHA_KEY_PUBLIC'))
define('CAPTCHA_KEY_PUBLIC', ''); // Public/Data-site key
if (!defined('CAPTCHA_KEY_PRIVATE'))
define('CAPTCHA_KEY_PRIVATE', ''); // Private/Secret Key
?>
10 changes: 9 additions & 1 deletion db/update.sql
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ CREATE TABLE IF NOT EXISTS `Settings` (
`event_start_date` int(11) DEFAULT NULL,
`event_end_date` int(11) DEFAULT NULL,
`teardown_end_date` int(11) DEFAULT NULL,
`event_welcome_msg` varchar(255) DEFAULT NULL
`event_welcome_msg` varchar(255) DEFAULT NULL,
`table_migrated` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;

-- Added privilege for Admin Settings
Expand All @@ -82,3 +83,10 @@ INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (337, -4
-- Added privelege for the Create Groups page
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (41, 'admin_cgroups', 'Create new groups');
INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (339, -4, 41);

-- ------------------------------------------------------------------------------------
-- Added Privilege for install page.
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (42, 'install', 'Install Engelsystem');



25 changes: 25 additions & 0 deletions docs/CONFIGURATION_DOCUMENT_ROOT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Instructions to configure document root in ubuntu

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

### Changing apache2 document root

The default document root is set in the 000-default.conf file that is under /etc/apache2/sites-available folder.

$ ```sudo nano /etc/apache2/sites-available/000-default.conf```

While the file is opened change DocumentRoot /var/www/ with your new folder
e.g DocumentRoot /var/www/html/engelsystem/public

or you can execute the following command in your terminal

$ ```sudo sed -i -e 's/DocumentRoot \/var\/www\/html/DocumentRoot \/var\/www\/html\/engelsystem\/public/g' /etc/apache2/sites-available/000-default.conf```

### Set the right Apache folder Permissions

$ ```sudo chown -R www-data /var/www/html/engelsystem/```

### Restart Apache
$ ``` sudo service apache2 restart ```

After following these steps engelsystem can be viewed at **localhost/ or at http://[i.p.address]**
18 changes: 18 additions & 0 deletions docs/INSTALLATION_BASH_SCRIPT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# INSTALLATION OF ENGELSYSTEM

- Engelsystem can be installed in your local server through install.sh file.

#### Steps to setup engelsystem using install.sh

### Step 1
- download [install.sh](/install.sh).

### Step 2
- change the permissions of `install.sh`
- `$ chmod +x install.sh`

### Step 3
- Execute the file
- ` $ ./install.sh`

- Now engelsystem is successfully installed.
26 changes: 26 additions & 0 deletions docs/INSTALLATION_FIVE_MINUTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Five Minute Installation of Engelsystem
### Prerequisites
Please check out the docs for more information [the documentation here](/docs/).

1.1 PHP 5.4.x (cgi-fcgi)
1.2 MySQL-Server 5.5.x pr MariaDB
1.3 Webserver ( Apache/Nginx/lighttpd)

### Step 1: Download or Clone the repository
- ```$ git clone --recursive https://github.com/fossasia/engelsystem.git```

### Step 2: Create a Mysql Database
- Using the MySQL Client
- ```$ mysql -u root -p```
- ```mysql> CREATE DATABASE engelsystem;```

### Step 3: Set up config.php
- Go to engelsystem/config and copy the 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.

### Step 4: Upload the files
-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)

### Step 5: Run the Install Script
- Visit localhost/ on your browser you will be redirected to install script.

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.
6 changes: 0 additions & 6 deletions docs/INSTALLATION_LOCAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@

**        CREATE DATABASE engelsystem;**

**        use engelsystem;**

**        source \[path to engelsystem\]/engelsystem/db/install.sql;**

**        source \[path to engelsystem\]/engelsystem/db/update.sql;**

**        exit;**

*   Go to **engelsystem/config** and copy the 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.
Expand Down
5 changes: 1 addition & 4 deletions docs/INSTALLATION_SERVER.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

* Next, configure your Engelsystem database:



1. Create a database for the Engelsystem (give any name to it)

2. Open phpMyAdmin on the server to create tables in the database
Expand All @@ -29,7 +27,6 @@
4. Import the “install.sql” and “update.sql” to finish configuring the database for the Engelsystem



* 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:

\#vim /var/cpanel/userdata/USERNAME/DOMAINNAME.COM
Expand All @@ -47,7 +44,7 @@
\# service httpd restart
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/) .

## Setting up Captcha
## Setting up Captcha

* 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).
* Visit the link,http://www.google.com/recaptcha/admin#whyrecaptcha , and sign up for the reCaptcha API keys.
Expand Down
2 changes: 1 addition & 1 deletion includes/controller/guest_credits_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ function credits_title() {
function guest_credits() {
return template_render('../templates/guest_credits.html', array());
}
?>
?>
2 changes: 1 addition & 1 deletion includes/controller/user_shifts_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1024,4 +1024,4 @@ function make_select($items, $selected, $name, $title = null) {
$html .= '</div>' . "\n";
return $html;
}
?>
?>
5 changes: 3 additions & 2 deletions includes/engelsystem_provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
require_once realpath(__DIR__ . '/../includes/model/News_model.php');
require_once realpath(__DIR__ . '/../includes/model/Questions_model.php');
require_once realpath(__DIR__ . '/../includes/model/WelcomeMessage_model.php');
require_once realpath(__DIR__ . '/../includes/model/import_model.php');

require_once realpath(__DIR__ . '/../includes/view/AngelTypes_view.php');
require_once realpath(__DIR__ . '/../includes/view/Questions_view.php');
Expand Down Expand Up @@ -82,6 +83,7 @@
if (file_exists(realpath(__DIR__ . '/../config/config.php')))
require_once realpath(__DIR__ . '/../config/config.php');

require_once realpath(__DIR__ . '/../install.php');
if ($maintenance_mode) {
echo file_get_contents(__DIR__ . '/../public/maintenance.html');
die();
Expand All @@ -92,8 +94,7 @@
session_start();

gettext_init();

sql_connect($config['host'], $config['user'], $config['pw'], $config['db']);
sql_connect($DB_HOST, $DB_USER, $DB_PASSWORD,$DB_NAME);

load_auth();

Expand Down
3 changes: 1 addition & 2 deletions includes/helper/internationalization_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,4 @@ function make_langselect() {
$items[] = toolbar_item_link(htmlspecialchars($URL) . $locale, '', '<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name);
return $items;
}

?>
?>
8 changes: 8 additions & 0 deletions includes/model/Settings_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,12 @@ function Settings() {
return sql_select("SELECT * FROM `Settings`");
}

function update_table_migrated($value) {
return sql_query("UPDATE `Settings` SET `table_migrated`='" . sql_escape($value) . "'");
}

function insert_table_migrated($value) {
return sql_query("INSERT INTO `Settings` SET `table_migrated`='" . sql_escape($value) . "'");
}

?>
7 changes: 7 additions & 0 deletions includes/model/User_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,4 +552,11 @@ function user_by_id($id) {
return sql_select("SELECT * FROM `User` WHERE `UID`='" . sql_escape($id) . "' LIMIT 1");
}

function update_nick($username, $uid) {
return sql_query("UPDATE `User` SET `Nick`='" . sql_escape($username) . "' WHERE `UID`='" . sql_escape($uid) . "'");
}

function update_mail($email, $uid) {
return sql_query("UPDATE `User` SET `email`='" . sql_escape($email) . "' WHERE `UID`='" . sql_escape($uid) . "'");
}
?>
28 changes: 28 additions & 0 deletions includes/model/import_model.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

function import_tables() {
global $DB_HOST, $DB_PASSWORD, $DB_NAME, $DB_USER;
$import_install = '../db/install.sql';
$import_update = '../db/update.sql';
$command_install = 'mysql -h' .$DB_HOST .' -u' .$DB_USER .' -p' .$DB_PASSWORD .' ' .$DB_NAME .' < ' .$import_install;
$command_update = 'mysql -h' .$DB_HOST .' -u' .$DB_USER .' -p' .$DB_PASSWORD .' ' .$DB_NAME .' < ' .$import_update;
$output = array();
exec($command_install, $output, $worked_install);
exec($command_update, $output, $worked_update);

switch ($worked_install && $worked_update) {
case 0:
return true;
case 1:
return false;
}
}

function test_import() {
global $DB_NAME;
$sql = "SHOW TABLES FROM $DB_NAME";
$result = sql_query($sql);
return $result;
}

?>
2 changes: 1 addition & 1 deletion includes/sys_auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ function privileges_for_group($group_id) {
$privileges[] = $guest_priv['name'];
return $privileges;
}
?>
?>
11 changes: 8 additions & 3 deletions includes/sys_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,21 @@ function page_link_to_absolute($page) {
*/
function header_toolbar() {
global $p, $privileges, $user, $enable_tshirt_size, $max_freeloadable_shifts;

$settings = array();
$no_migrated = "";
if (test_import()) {
$settings = Settings();
$no_migrated = $settings[0]['table_migrated'];
}
$toolbar_items = array();

if (isset($user))
$toolbar_items[] = toolbar_item_link(page_link_to('shifts') . '&amp;action=next', 'time', User_shift_state_render($user));

if (! isset($user) && in_array('register', $privileges))
if (! isset($user) && in_array('register', $privileges) && $no_migrated == 1)
$toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $p == 'register');

if (in_array('login', $privileges))
if (in_array('login', $privileges) && $no_migrated == 1)
$toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login');

if (isset($user) && in_array('user_messages', $privileges))
Expand Down
2 changes: 1 addition & 1 deletion includes/sys_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,4 +487,4 @@ function form_multiselect($name, $label, $values, $tag = "") {
$list .= '</select></div>';
return $list;
}
?>
?>
Loading