Skip to content

Commit

Permalink
PHP 7 Umstellung
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbe committed Dec 24, 2015
1 parent 52c2b3f commit 10d472f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion admin/config.php
Expand Up @@ -253,7 +253,7 @@ function set_config_para() {
# die checkbox hat immer einen anderen wert als der gespeicherte deshalb keine prüfung
$CMS_CONF->set($syntax_name, $syntax_value);
if($syntax_name == "modrewrite" and true !== ($error = write_modrewrite($syntax_value)))
return $error;;
return $error;
if($syntax_name == "usesitemap") {
if(true !== ($error = write_robots()))
return $error;
Expand Down
47 changes: 23 additions & 24 deletions admin/sessionClass.php
Expand Up @@ -9,26 +9,26 @@
@session_name(SESSION_MO);
@session_save_path(BASE_DIR.$TMP_DIR);

$use_session = false;
# hat session_save_path functioniert?
if(strstr(@session_save_path(),BASE_DIR.$TMP_DIR))
$use_session = true;
if(strstr(@session_save_path(),BASE_DIR.$TMP_DIR)) {
define("MULTI_USER", true);
define("MULTI_USER_FILE","");
# können wir denn session_save_path benutzen
elseif(strlen(@session_save_path()) > 2 and @is_writable(@session_save_path()))
$use_session = true;
# hat session_save_path functioniert? ansonsten server eigene session verwenden
if($use_session) {
#session_set_cookie_params(0,$BASE_DIR,$_SERVER['SERVER_NAME']);
} elseif(strlen(@session_save_path()) > 2 and @is_writable(@session_save_path())) {
define("MULTI_USER", true);
define("MULTI_USER_FILE",md5(BASE_DIR));
}
# hat session_save_path functioniert? ansonsten server eigene session verwenden
if(defined("MULTI_USER") and MULTI_USER) {
$lifetime = 1440;
if(@ini_get("session.gc_maxlifetime") > 2); # wir ziehen in der admin_template.php 10 secunden ab
$lifetime = @ini_get("session.gc_maxlifetime");
#$lifetime = 1000000;

define("MULTI_USER_TIME", $lifetime);
new SessionSaveHandler();
} else
define("MULTI_USER", false);
unset($TMP_DIR,$use_session);
unset($TMP_DIR);

class SessionSaveHandler {
protected $savePath;
Expand All @@ -48,18 +48,17 @@ public function __construct() {
public function open($savePath, $sessionName) {
$this->savePath = $savePath.((substr($savePath,-1) != "/") ? "/" : "");
$this->sessionName = $sessionName;
if(!is_file($this->savePath."users.conf.php")) {
@file_put_contents($this->savePath."users.conf.php","<?php die(); ?>\n".serialize(array()),LOCK_EX);

if(!is_file($this->savePath.MULTI_USER_FILE."users.conf.php")) {
@file_put_contents($this->savePath.MULTI_USER_FILE."users.conf.php","<?php die(); ?>\n".serialize(array()),LOCK_EX);
}
@chmod($this->savePath."users.conf.php",0600);
$ret = true;
if(!is_file($this->savePath."session.conf.php")) {
$ret = @file_put_contents($this->savePath."session.conf.php","<?php die(); ?>\n".serialize(array()),LOCK_EX);
@chmod($this->savePath.MULTI_USER_FILE."users.conf.php",0600);

if(!is_file($this->savePath.MULTI_USER_FILE."session.conf.php")) {
@file_put_contents($this->savePath.MULTI_USER_FILE."session.conf.php","<?php die(); ?>\n".serialize(array()),LOCK_EX);
}
# if(($lifetime = ini_get("session.gc_maxlifetime")) > 1);
# $this->gc($lifetime);
@chmod($this->savePath."session.conf.php",0600);
return $ret;
@chmod($this->savePath.MULTI_USER_FILE."session.conf.php",0600);
return true;
}

public function close() {
Expand Down Expand Up @@ -104,7 +103,7 @@ public function gc($maxlifetime) {
}

protected function getSessionArray() {
if(false !== ($conf = @file_get_contents($this->savePath."session.conf.php"))) {
if(false !== ($conf = @file_get_contents($this->savePath.MULTI_USER_FILE."session.conf.php"))) {
$conf = str_replace("<?php die(); ?>","",$conf);
$conf = trim($conf);
$conf = unserialize($conf);
Expand All @@ -117,7 +116,7 @@ protected function getSessionArray() {
protected function saveSessionArray($conf = array()) {
if(defined('MULTI_USER') and MULTI_USER) {
$new_array = array();
if(false !== ($confusers = @file_get_contents($this->savePath."users.conf.php"))) {
if(false !== ($confusers = @file_get_contents($this->savePath.MULTI_USER_FILE."users.conf.php"))) {
$confusers = str_replace("<?php die(); ?>","",$confusers);
$confusers = trim($confusers);
$confusers = unserialize($confusers);
Expand All @@ -130,10 +129,10 @@ protected function saveSessionArray($conf = array()) {
}
}
}
@file_put_contents($this->savePath."users.conf.php","<?php die(); ?>\n".serialize($new_array),LOCK_EX);
@file_put_contents($this->savePath.MULTI_USER_FILE."users.conf.php","<?php die(); ?>\n".serialize($new_array),LOCK_EX);
}
$conf = "<?php die(); ?>".serialize($conf);
if(false === (@file_put_contents($this->savePath."session.conf.php",$conf,LOCK_EX)))
if(false === (@file_put_contents($this->savePath.MULTI_USER_FILE."session.conf.php",$conf,LOCK_EX)))
return false;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion cms/DefaultConfCMS.php
Expand Up @@ -2,7 +2,7 @@

define("CMSVERSION","2.0");
define("CMSNAME","Amalia");
define("CMSREVISION","46");
define("CMSREVISION","47");

#!!!!!!!! die version müssen wir noch checken
define("MIN_PHP_VERSION","5.1.2");
Expand Down
13 changes: 10 additions & 3 deletions install.php
Expand Up @@ -53,6 +53,10 @@
define("BASE_DIR", $base_dir);
unset($base_dir); // verwendung im script verhindern

$name_id = 'MOZILOID_'.md5($_SERVER['SERVER_NAME'].BASE_DIR);
define("SESSION_MO",$name_id);
unset($name_id);

$LANG_INSTALL = array();
$LANG_INSTALL['deDE'] = 'Deutsch';
$LANG_INSTALL['enEN'] = 'English';
Expand All @@ -76,7 +80,12 @@
$ADMIN_CONF = false;
$CMS_CONF = false;
# eigene session
require_once(BASE_DIR_ADMIN."sessionClass.php");
if(is_file(BASE_DIR_ADMIN."sessionClass.php")) {
require_once(BASE_DIR_ADMIN."sessionClass.php");
} else
@session_name(SESSION_MO);

session_start();
# Default conf
require_once(BASE_DIR.CMS_DIR_NAME."/DefaultConfCMS.php");
# wenn die sachen kein die() oder fatal error ergeben ist es gut
Expand Down Expand Up @@ -107,8 +116,6 @@
setTimeLocale($LANG);
}

session_start();

ini_set("default_charset", CHARSET);
header('content-type: text/html; charset='.strtolower(CHARSET));

Expand Down

0 comments on commit 10d472f

Please sign in to comment.