Skip to content

Commit

Permalink
Merge pull request #78 from Leantime/hotfixes-2.0.4
Browse files Browse the repository at this point in the history
Hotfixes 2.0.4
  • Loading branch information
marcelfolaron authored Dec 30, 2019
2 parents b70856e + 00e26e4 commit f2cd9b0
Show file tree
Hide file tree
Showing 11 changed files with 596 additions and 193 deletions.
2 changes: 1 addition & 1 deletion config/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class settings {

public $appVersion = "2.0.4";

public $dbVersion = "2.0";
public $dbVersion = "2.0.4";

/**
* __construct
Expand Down
11 changes: 10 additions & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ server {
rewrite ^/?$ /index.php?act=dashboard.show;
rewrite ^/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2;
rewrite ^/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2&id=$3;
rewrite ^/([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2&id=$3&id2=$4;
}

location = /resetPassword {
Expand All @@ -74,6 +73,16 @@ server {
rewrite ^/install/([^/\.]+)/?$ /index.php?install=true;
}

location = /update {

rewrite ^(.*)$ /index.php?update=true;
}

location /update {

rewrite ^/update/([^/\.]+)/?$ /index.php?update=true;
}

# additional config
# favicon.ico
location = /favicon.ico {
Expand Down
8 changes: 5 additions & 3 deletions public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ RewriteRule ^resetPassword/([^/\.]+)/?$ /index.php?resetPassword=true&hash=$1
RewriteRule ^install$ /index.php?install=true
RewriteRule ^install/([^/\.]+)/?$ /index.php?install=true

RewriteRule ^update /index.php?update=true
RewriteRule ^update/([^/\.]+)/?$ /index.php?update=true

RewriteRule ^/?$ /index.php?act=dashboard.show
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2 [NC]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2&id=$3
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2&id=$3&id2=$4
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2 [QSA]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?act=$1.$2&id=$3 [QSA]



Expand Down
21 changes: 19 additions & 2 deletions src/core/class.application.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ public function start()
ob_start();

if($this->login->logged_in()===false) {
//Run password reset through application to avoid security holes in the front controller

//Hard coded routes for a few pages that can be access without login
if(isset($_GET['resetPassword']) === true) {
include '../src/resetPassword.php';
}else if(isset($_GET['install']) === true) {
include '../src/install.php';
}else if(isset($_GET['update']) === true) {
include '../src/update.php';
}else{
include '../src/login.php';
}
Expand Down Expand Up @@ -105,6 +107,21 @@ public function overrideThemeSettings() {
}
}

//Only run this if the user is not logged in (db should be updated/installed before user login)
if($this->login->logged_in()===false) {

if($settings->checkIfInstalled() === false && isset($_GET['install']) === false){
header("Location: /install");
exit();
}

$dbVersion = $settings->getSetting("db-version");
if ($this->settings->dbVersion != $dbVersion && isset($_GET['update']) === false && isset($_GET['install']) === false) {
header("Location: /update");
exit();
}
}


}

Expand Down
2 changes: 1 addition & 1 deletion src/core/class.db.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function __construct()

try{

$driver_options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8,sql_mode="NO_ENGINE_SUBSTITUTION"' );
$driver_options = array( PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4,sql_mode="NO_ENGINE_SUBSTITUTION"' );
$this->database = new PDO('mysql:host=' . $this->host . ';dbname='. $this->databaseName .'', $this->user, $this->password, $driver_options);
$this->database->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

Expand Down
Loading

0 comments on commit f2cd9b0

Please sign in to comment.