Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Fixed error during install when using sub directory install https://github.com/givanz/Vvveb/discussions/201

givanz964064e4d7d0
diff --git a/install/controller/index.php b/install/controller/index.php
index e055577..55a27db 100755
--- a/install/controller/index.php
+++ b/install/controller/index.php
@@ -88,7 +88,7 @@ class Index extends Base {
}
}
- function checkRequirements() {
+ private function checkRequirements() {
$notMet = [];
if (version_compare(PHP_VERSION, MIN_PHP_VERSION) < 0) {
@@ -112,7 +112,7 @@ class Index extends Base {
return $notMet;
}
- function writeConfig($data) {
+ private function writeConfig($data) {
return \Vvveb\setConfig('db', $data);
$configFile = DIR_ROOT . 'config/db.php';
file_put_contents($configFile, "<?php\n return " . var_export($data, true) . ';');
@@ -368,7 +368,7 @@ class Index extends Base {
$menus = new menuSQL();
foreach ([1, 5] as $menu_id) { //main menu and footer menu id's
- $menuItems = $menus->getAll(['menu_id' => $menu_id, 'language_id' => 1])['menus'] ?? [];
+ $menuItems = $menus->get(['menu_id' => $menu_id, 'language_id' => 1])['menu'] ?? [];
foreach ($menuItems as $menuItem) {
$data = ['url' => V_SUBDIR_INSTALL . $menuItem['url'], 'menu_item_content' => []];
diff --git a/system/functions.php b/system/functions.php
index ba203a0..45bd605 100755
--- a/system/functions.php
+++ b/system/functions.php
@@ -37,7 +37,7 @@ function url($parameters, $mergeParameters = false, $useCurrentUrl = true) {
}
$url = System\Routes::url($parameters, $mergeParameters);
- $result .= $url ?? '';
+ $result .= (V_SUBDIR_INSTALL ? V_SUBDIR_INSTALL : '') . ($url ?? '');
} else {
static $url = '';
static $urlParams = [];
@@ -71,6 +71,8 @@ function url($parameters, $mergeParameters = false, $useCurrentUrl = true) {
if (isset($parameters['host'])) {
$result .= '//' . \Vvveb\System\Sites::url($parameters['host']);
unset($parameters['host']);
+ } else {
+ $result .= (V_SUBDIR_INSTALL ? V_SUBDIR_INSTALL : '');
}
$result .= ($useCurrentUrl ? $url['path'] ?? '' : '') . ($parameters ? '?' . urldecode(http_build_query($parameters)) : '');