Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.DS_STORE
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# opencart
# vQmod for OpenCart
This is a repository for the opencart vqmod core script files.
First download and install vQmod from the main repository, then install the script files from this repository for use with opencart

1. Be sure you've installed the vQmod package first! This package only contains the opencart script files
2. Upload the xml and install folder to your vqmod folder on your server.
3. Overwrite any files that already exist
Steps to install:
1. Download the latest vQmod release from the releases page: https://github.com/vqmod/vqmod/releases
2. Then checkout this repository.
3. Upload the xml and install folder to your vqmod folder on your server.
4. Overwrite any files that already exist
5. Run the installer with https://yourstore.com/vqmod/install

When done, you should see the following files on your server
vqmod/xml/vqmod_opencart.xml
vqmod/install/index.php

4. Run the installer with https:/yourstore.com/vqmod/install
Where yourstore.com is your domain name and where vqmod is the folder you installed vqmod to (ex: /vqmod/, /custom_vqmod/, /changes/ .... )
2 changes: 2 additions & 0 deletions install/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Satisfy Any
Allow From All
67 changes: 38 additions & 29 deletions install/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,41 @@

if (!empty($_POST['admin_name'])) {
//$admin = 'admin';
$admin = htmlspecialchars($_POST['admin_name']);
$admin = htmlspecialchars(trim($_POST['admin_name']));
// Counters
$changes = 0;
$writes = 0;
$files = [];

// Load class required for installation
require('ugrsr.class.php');
$main_class = 'ugrsr.class.php';
if (!file_exists($main_class)) {
die('ERROR - UGRSR CLASS NOT FOUND - Please ensure you have uploaded the vQmod install files correctly');
}

require($main_class);

$vqmod_path = dirname(__FILE__, 2) . '/';

// Get the vqmod folder via the path
$vqmod_folder = basename($vqmod_path);

// OpenCart path
$opencart_path = dirname(__FILE__, 3) . '/';

// Get directory two above installation directory
$opencart_path = realpath(dirname(__FILE__) . '/../../') . '/';

// Verify path is correct
if(empty($opencart_path)) die('ERROR - COULD NOT DETERMINE OPENCART PATH CORRECTLY - ' . dirname(__FILE__));
if(empty($opencart_path)) {
die('ERROR - COULD NOT DETERMINE OPENCART PATH CORRECTLY - ' . __DIR__);
}

$write_errors = array();
if(!is_writeable($opencart_path . 'index.php')) {
if(!is_writable($opencart_path . 'index.php')) {
$write_errors[] = 'index.php not writeable';
}
if(!is_writeable($opencart_path . $admin . '/index.php')) {
if(!is_writable($opencart_path . $admin . '/index.php')) {
$write_errors[] = 'Administrator index.php not writeable';
}
if(!is_writeable($opencart_path . 'vqmod/pathReplaces.php')) {
if(!is_writable($opencart_path . $vqmod_folder . '/pathReplaces.php')) {
$write_errors[] = 'vQmod pathReplaces.php not writeable';
}

Expand All @@ -73,7 +85,7 @@
// Set file searching to off
$u->file_search = false;

// Attempt upgrade if necessary. Otherwise just continue with normal install
// Attempt upgrade if necessary. Otherwise, just continue with normal install
$u->addFile('index.php');
$u->addFile($admin . '/index.php');

Expand All @@ -82,21 +94,18 @@

$result = $u->run();

if($result['writes'] > 0) {
if(file_exists('../mods.cache')) {
unlink('../mods.cache');
}
//die('UPGRADE COMPLETE');
if(($result['writes'] > 0) && file_exists('../mods.cache')) {
unlink('../mods.cache');
}

$u->clearPatterns();
$u->resetFileList();

// Add catalog index files to files to include
// Add catalog index files to include
$u->addFile('index.php');

// Pattern to add vqmod include
$u->addPattern('~// Startup~', "// vQmod\nrequire_once('./vqmod/vqmod.php');\nVQMod::bootup();\n\n// VQMODDED Startup");
$u->addPattern('~// Startup~', "// vQmod\nrequire_once('./" . $vqmod_folder . "/vqmod.php');\nVQMod::bootup();\n\n// VQMODDED Startup");

$result = $u->run();
$writes += $result['writes'];
Expand All @@ -110,7 +119,7 @@
$u->addFile($admin . '/index.php');

// Pattern to add vqmod include
$u->addPattern('~// Startup~', "//vQmod\nrequire_once('../vqmod/vqmod.php');\nVQMod::bootup();\n\n// VQMODDED Startup");
$u->addPattern('~// Startup~', "//vQmod\nrequire_once('../" . $vqmod_folder . "/vqmod.php');\nVQMod::bootup();\n\n// VQMODDED Startup");

$result = $u->run();
$writes += $result['writes'];
Expand All @@ -127,15 +136,15 @@
$writes += $result['writes'];
$changes += $result['changes'];
$files = array_merge($files, $result['files']);

$u->clearPatterns();
$u->resetFileList();

// 2022 - Qphoria
// pathReplaces install

// Add vqmod/pathReplaces.php file
$u->addFile('vqmod/pathReplaces.php');
$u->addFile($vqmod_folder . '/pathReplaces.php');

// Pattern to add vqmod include
$u->addPattern('~// START REPLACES //~', "// VQMODDED START REPLACES //\nif (defined('DIR_CATALOG')) { \$replaces[] = array('~^admin\b~', basename(DIR_APPLICATION)); }");
Expand All @@ -157,10 +166,10 @@

// output result to user
die('VQMOD HAS BEEN INSTALLED ON YOUR SYSTEM!');
} else {
echo 'vQmod Installer for OpenCart<br/>';
echo '<form method="post">
<span>Admin Folder Name:<input type="text" name="admin_name" value="admin" /></span>
<input type="submit" value="Go" />
</form>';
}
}

echo 'vQmod Installer for OpenCart<br/>';
echo '<form method="post">
<span>Admin Folder Name:<input type="text" name="admin_name" value="admin" /></span>
<input type="submit" value="Go" />
</form>';
Loading