Skip to content

Instantly share code, notes, and snippets.

@tivuno
Created March 19, 2024 12:02
Show Gist options
  • Save tivuno/ba81febd7ca94b3bce1033b80c86c712 to your computer and use it in GitHub Desktop.
Save tivuno/ba81febd7ca94b3bce1033b80c86c712 to your computer and use it in GitHub Desktop.
<?php
/**
* Cornelius - Core PrestaShop module
* @author tivuno.com <hi@tivuno.com>
* @copyright 2018 - 2024 © tivuno.com
* @license https://tivuno.com/blog/bp/business-news/2-basic-license
*/
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', __DIR__);
}
include _PS_ADMIN_DIR_ . '/../config/config.inc.php';
// echo md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME'));
if (isset($_GET['secure_key']) && isset($_GET['module'])) {
$secureKey = md5(_COOKIE_KEY_ . Configuration::get('PS_SHOP_NAME'));
if ($secureKey === $_GET['secure_key']) {
$module = Module::getInstanceByName($_GET['module']);
if (Validate::isLoadedObject($module) && Module::isEnabled($_GET['module'])) {
require_once _PS_MODULE_DIR_ . 'tvcore/models/TvcoreFile.php';
$module_dir = _PS_MODULE_DIR_ . $_GET['module'];
$directories = TvcoreFile::getSubDirectories($module_dir);
foreach ($directories as $dir) {
TvcoreFile::copyFile($module_dir, $dir, 'index.php');
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment