New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix session incompatibility with XH 1.7 #5

Merged
merged 1 commit into from Sep 19, 2017
Jump to file or symbol
Failed to load files and symbols.
+18 −2
Diff settings

Always

Just for now

Fix session incompatibility with XH 1.7

As of CMSimple_XH 1.7.0 the session uses a non-standard name, which
breaks compatibility with elFinder_xh 1.0.5. We fix this by checking
whether cmsimple/.sessionname exist, and if so we use its content to
set the appropriate session name before actually starting the session.

We also cater to `$_SESSION['xh_password']` now holding a string
instead of an array as before.
  • Loading branch information...
cmb69 committed Aug 23, 2017
commit 3602b73ad6161ecabd2d3b3f58ee1af3417c4a78
@@ -10,6 +10,10 @@
//error_reporting(0); // Set E_ALL for debuging
if (session_id() == '') {
$temp = dirname(__FILE__) . '/../../../cmsimple/.sessionname';
if (file_exists($temp)) {
session_name(file_get_contents($temp));
}
session_start();
}
@@ -19,13 +19,19 @@
function el_logincheck()
{
if (session_id() == '') {
$filename = dirname(__FILE__) . '/../../../cmsimple/.sessionname';
if (file_exists($filename)) {
session_name(file_get_contents($filename));
}
session_start();
}
$el_root = $_SESSION["elfinder"]["sn"];
return isset($_SESSION['xh_password'])
&& isset($_SESSION['xh_password'][$el_root])
&& (isset($_SESSION['xh_password'][$el_root])
&& $_SESSION['xh_password'][$el_root] == $_SESSION['elfinder']['password']
|| isset($_SESSION['xh_password'])
&& $_SESSION['xh_password'] == $_SESSION['elfinder']['password'])
&& isset($_SESSION['xh_user_agent'])
&& $_SESSION['xh_user_agent'] == md5($_SERVER['HTTP_USER_AGENT']);
}
@@ -18,13 +18,19 @@
function el_logincheck()
{
if (session_id() == '') {
$filename = dirname(__FILE__) . '/../../../cmsimple/.sessionname';
if (file_exists($filename)) {
session_name(file_get_contents($filename));
}
session_start();
}
$el_root = $_SESSION["elfinder"]["sn"];
return isset($_SESSION['xh_password'])
&& isset($_SESSION['xh_password'][$el_root])
&& (isset($_SESSION['xh_password'][$el_root])
&& $_SESSION['xh_password'][$el_root] == $_SESSION['elfinder']['password']
|| isset($_SESSION['xh_password'])
&& $_SESSION['xh_password'] == $_SESSION['elfinder']['password'])
&& isset($_SESSION['xh_user_agent'])
&& $_SESSION['xh_user_agent'] == md5($_SERVER['HTTP_USER_AGENT']);
}
ProTip! Use n and p to navigate between commits in a pull request.