Skip to content

Commit

Permalink
Added COM_getInstallDir to get the actual "admin/install" directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Sep 22, 2018
1 parent c986e5e commit 08bc421
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 40 deletions.
18 changes: 3 additions & 15 deletions public_html/admin/sectest.php
Expand Up @@ -204,23 +204,11 @@ function doTest($baseUrl, $urlToCheck, $what)
*/
function checkInstallDir()
{
global $_CONF, $LANG_SECTEST, $failed_tests;
global $LANG_SECTEST, $failed_tests;

// we don't have the path to the admin directory, so try to figure it out
// from $_CONF['site_admin_url']
$adminUrl = $_CONF['site_admin_url'];
if (strrpos($adminUrl, '/') === strlen($adminUrl)) {
$adminUrl = substr($adminUrl, 0, -1);
}
$pos = strrpos($adminUrl, '/');
if ($pos === false) {
// only guessing ...
$installDir = $_CONF['path_html'] . 'admin/install';
} else {
$installDir = $_CONF['path_html'] . substr($adminUrl, $pos + 1) . '/install';
}
$installDir = COM_getInstallDir();

if (is_dir($installDir)) {
if (!empty($installDir)) {
$retval = '<li>' . sprintf($LANG_SECTEST['remove_inst'],
'<strong>' . $installDir . '</strong>') . ' '
. $LANG_SECTEST['remove_inst2'] . '</li>';
Expand Down
31 changes: 6 additions & 25 deletions public_html/index.php
Expand Up @@ -8,7 +8,7 @@
// | |
// | Geeklog homepage. |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2017 by the following authors: |
// | Copyright (C) 2000-2018 by the following authors: |
// | |
// | Authors: Tony Bibbs - tony@tonybibbs.com |
// | Mark Limburg - mlimburg@users.sourceforge.net |
Expand Down Expand Up @@ -163,31 +163,12 @@ function fixTopic(&$A, $tid_list)

if (SEC_inGroup('Root') && ($page === 1)) {
$done = DB_getItem($_TABLES['vars'], 'value', "name = 'security_check'");
if ($done != 1) {
/**
* we don't have the path to the admin directory, so try to figure it
* out from $_CONF['site_admin_url']
*
* @todo FIXME: this duplicates some code from admin/sectest.php
*/
$adminurl = $_CONF['site_admin_url'];
if (strrpos($adminurl, '/') == strlen($adminurl)) {
$adminurl = substr($adminurl, 0, -1);
}
$pos = strrpos($adminurl, '/');
if ($pos === false) {
// only guessing ...
$installdir = $_CONF['path_html'] . 'admin/install';
} else {
$installdir = $_CONF['path_html'] . substr($adminurl, $pos + 1)
. '/install';
}

if (is_dir($installdir)) {
// deliberatly NOT print the actual path to the install dir
$secmsg = sprintf($LANG_SECTEST['remove_inst'], '')
. ' ' . $MESSAGE[92];
$display .= COM_showMessageText($secmsg);
if ($done != 1) {
if (COM_getInstallDir() !== '') {
// deliberately NOT print the actual path to the install dir
$secMsg = sprintf($LANG_SECTEST['remove_inst'], '') . ' ' . $MESSAGE[92];
$display .= COM_showMessageText($secMsg);
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions public_html/lib-common.php
Expand Up @@ -8595,6 +8595,33 @@ function COM_isEnableDeveloperModeLog($type)
require_once $_CONF['path'] . 'plugins/' . $pi_name . '/functions.inc';
}

/**
* Return the actual admin/install directory
*
* @return string
* @since Geeklog 2.2.1
*/
function COM_getInstallDir()
{
global $_CONF;

$adminUrl = $_CONF['site_admin_url'];
if (strrpos($adminUrl, '/') == strlen($adminUrl)) {
$adminUrl = substr($adminUrl, 0, -1);
}

$pos = strrpos($adminUrl, '/');
if ($pos === false) {
// only guessing ...
$installDir = $_CONF['path_html'] . 'admin/install';
} else {
$installDir = $_CONF['path_html'] . substr($adminUrl, $pos + 1) . '/install';
}
$installDir = str_replace('\\', '/', $installDir);

return is_dir($installDir) ? $installDir : '';
}

// Check and see if any plugins (or custom functions)
// have scheduled tasks to perform
if (!isset($_VARS['last_scheduled_run']) || !is_numeric($_VARS['last_scheduled_run'])) {
Expand Down
Empty file added system/classes/Session.php
Empty file.

0 comments on commit 08bc421

Please sign in to comment.