Skip to content

Commit

Permalink
PLUGINRANGERS-2312 | Improved path traversing when there are symlinks…
Browse files Browse the repository at this point in the history
… in the Prestashop CMS (#205)

* fix: Improved path traversing when there are symlinks

* fix: Removed echo used for debugging
  • Loading branch information
davidmolinacano authored Apr 23, 2024
1 parent 79b7904 commit 6f25c27
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 13 deletions.
8 changes: 7 additions & 1 deletion cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
* @copyright Doofinder
* @license GPLv3
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
$root_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
} else {
require_once dirname(__FILE__) . '/../../config/config.inc.php';
}

if (!defined('_PS_VERSION_')) {
exit;
Expand Down
11 changes: 9 additions & 2 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
* @copyright Doofinder
* @license GPLv3
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
$root_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
require_once $root_path . '/init.php';
} else {
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
}

if (!defined('_PS_VERSION_')) {
exit;
Expand Down
11 changes: 9 additions & 2 deletions doofinder-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
* @copyright Doofinder
* @license GPLv3
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
$root_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
require_once $root_path . '/init.php';
} else {
require_once dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
}

if (!defined('_PS_VERSION_')) {
exit;
Expand Down
4 changes: 2 additions & 2 deletions doofinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ class Doofinder extends Module
const DOOMANAGER_URL = 'https://admin.doofinder.com';
const GS_SHORT_DESCRIPTION = 1;
const GS_LONG_DESCRIPTION = 2;
const VERSION = '4.7.28';
const VERSION = '4.7.29';
const YES = 1;
const NO = 0;

public function __construct()
{
$this->name = 'doofinder';
$this->tab = 'search_filter';
$this->version = '4.7.28';
$this->version = '4.7.29';
$this->author = 'Doofinder (http://www.doofinder.com)';
$this->ps_versions_compliancy = ['min' => '1.5', 'max' => _PS_VERSION_];
$this->module_key = 'd1504fe6432199c7f56829be4bd16347';
Expand Down
8 changes: 7 additions & 1 deletion feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
* @copyright Doofinder
* @license GPLv3
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
$root_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
} else {
require_once dirname(__FILE__) . '/../../config/config.inc.php';
}

if (!defined('_PS_VERSION_')) {
exit;
Expand Down
9 changes: 8 additions & 1 deletion feeds/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
@set_time_limit(3600 * 2);
}

require_once dirname(__FILE__) . '/../../../config/config.inc.php';
$root_path = dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
} else {
require_once dirname(__FILE__) . '/../../../config/config.inc.php';
}

require_once dirname(__FILE__) . '/../lib/dfCategory_build.php';

if (!defined('_PS_VERSION_')) {
Expand Down
9 changes: 8 additions & 1 deletion feeds/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
@set_time_limit(3600 * 2);
}

require_once dirname(__FILE__) . '/../../../config/config.inc.php';
$root_path = dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
} else {
require_once dirname(__FILE__) . '/../../../config/config.inc.php';
}

require_once dirname(__FILE__) . '/../lib/dfCms_build.php';

if (!defined('_PS_VERSION_')) {
Expand Down
12 changes: 10 additions & 2 deletions feeds/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@
@set_time_limit(3600 * 2);
}

require_once dirname(__FILE__) . '/../../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../../init.php';
$root_path = dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
require_once $root_path . '/init.php';
} else {
require_once dirname(__FILE__) . '/../../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../../init.php';
}

require_once dirname(__FILE__) . '/../doofinder.php';

dfTools::validateSecurityToken(Tools::getValue('dfsec_hash'));
Expand Down
8 changes: 7 additions & 1 deletion landing.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
* @copyright Doofinder
* @license GPLv3
*/
require_once dirname(__FILE__) . '/../../config/config.inc.php';
$root_path = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
$config_file_path = $root_path . '/config/config.inc.php';
if (file_exists($config_file_path)) {
require_once $config_file_path;
} else {
require_once dirname(__FILE__) . '/../../config/config.inc.php';
}

if (!defined('_PS_VERSION_')) {
exit;
Expand Down

0 comments on commit 6f25c27

Please sign in to comment.