Browse Source

fix abs path on some files

CauseFX 5 years ago
parent
commit
83af32e3b1

+ 4 - 4
api/functions/api-functions.php

@@ -1169,7 +1169,7 @@ function importUsersType($array)
 
 function allTabs()
 {
-	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+	if (file_exists($GLOBALS['userConfigPath'])) {
 		try {
 			$connect = new Dibi\Connection([
 				'driver' => 'sqlite3',
@@ -1188,7 +1188,7 @@ function allTabs()
 
 function allGroups()
 {
-	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+	if (file_exists($GLOBALS['userConfigPath'])) {
 		try {
 			$connect = new Dibi\Connection([
 				'driver' => 'sqlite3',
@@ -1205,7 +1205,7 @@ function allGroups()
 
 function loadTabs($type = null)
 {
-	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php') && $type) {
+	if (file_exists($GLOBALS['userConfigPath']) && $type) {
 		try {
 			$connect = new Dibi\Connection([
 				'driver' => 'sqlite3',
@@ -1273,7 +1273,7 @@ function revokeToken($array)
 
 function getSchema()
 {
-	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+	if (file_exists($GLOBALS['userConfigPath'])) {
 		try {
 			$connect = new Dibi\Connection([
 				'driver' => 'sqlite3',

+ 2 - 1
api/functions/organizr-functions.php

@@ -484,7 +484,7 @@ function organizrStatus()
 			array_push($dependenciesInactive, $check);
 		}
 	}
-	if (!file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+	if (!file_exists($GLOBALS['userConfigPath'])) {
 		$status['status'] = "wizard";//wizard - ok for test
 	}
 	if (count($dependenciesInactive) > 0 || !is_writable(dirname(__DIR__, 2)) || !(version_compare(PHP_VERSION, $GLOBALS['minimumPHP']) >= 0)) {
@@ -498,6 +498,7 @@ function organizrStatus()
 	$status['version'] = $GLOBALS['installedVersion'];
 	$status['os'] = getOS();
 	$status['php'] = phpversion();
+	$status['userConfigPath'] = $GLOBALS['userConfigPath'];
 	return $status;
 }
 

+ 1 - 1
api/functions/upgrade-functions.php

@@ -1,7 +1,7 @@
 <?php
 function upgradeCheck()
 {
-	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+	if (file_exists($GLOBALS['userConfigPath'])) {
 		$tempLock = $GLOBALS['dbLocation'] . 'DBLOCK.txt';
 		$updateComplete = $GLOBALS['dbLocation'] . 'completed.txt';
 		$cleanup = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . "upgrade" . DIRECTORY_SEPARATOR;

+ 5 - 5
api/index.php

@@ -1013,7 +1013,7 @@ switch ($function) {
 	case 'v1_wizard_page':
 		switch ($method) {
 			case 'GET':
-				if (!file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+				if (!file_exists($GLOBALS['userConfigPath'])) {
 					$result['status'] = 'success';
 					$result['statusText'] = 'success';
 					$result['data'] = $pageWizard;
@@ -1045,7 +1045,7 @@ switch ($function) {
 	case 'v1_wizard_config':
 		switch ($method) {
 			case 'POST':
-				if (!file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+				if (!file_exists($GLOBALS['userConfigPath'])) {
 					$result['status'] = 'success';
 					$result['statusText'] = 'success';
 					$result['data'] = wizardConfig($_POST);
@@ -1064,7 +1064,7 @@ switch ($function) {
 	case 'v1_wizard_path':
 		switch ($method) {
 			case 'POST':
-				if (!file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+				if (!file_exists($GLOBALS['userConfigPath'])) {
 					$result['status'] = 'success';
 					$result['statusText'] = 'success';
 					$result['data'] = wizardPath($_POST);
@@ -1911,8 +1911,8 @@ if ($pretty) {
 	echo '<pre>' . safe_json_encode($result, JSON_PRETTY_PRINT) . '</pre>';
 } else {
 	// will add switch case lil later :/
-	if(isset(getallheaders()['Accept'])){
-		if(strtolower(getallheaders()['Accept']) == 'application/json'){
+	if (isset(getallheaders()['Accept'])) {
+		if (strtolower(getallheaders()['Accept']) == 'application/json') {
 			header('Content-Type: application/json; charset=utf-8');
 		}
 	}

+ 1 - 1
api/pages/custom/index.html

@@ -4,7 +4,7 @@ make sure to start page contents like so:
 <pre>
 &lt;?php
 // This is a check to make sure organizr is setup already...
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
     // All variables need to start with $customPage .... Make sure to change Simple to any word (First Letter needs to be capital)... i.e. $customPageNewish
 	// Also make sure to escape single quotes
 	$customPageSimple = '

+ 1 - 1
api/pages/homepage.php

@@ -1,5 +1,5 @@
 <?php
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
 	$pageHomepage = '
 <script>
 !function($) {

+ 1 - 1
api/pages/lockscreen.php

@@ -1,5 +1,5 @@
 <?php
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
 	$pageLockScreen = '
 <script>
 </script>

+ 1 - 1
api/pages/login.php

@@ -1,5 +1,5 @@
 <?php
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
 	$hideOrganizrLogin = (checkoAuth()) ? 'collapse' : 'collapse in';
 	$hideOrganizrLoginHeader = (checkoAuthOnly()) ? 'hidden' : '';
 	$hideOrganizrLoginHeader2 = (checkoAuth()) ? '' : 'hidden';

+ 1 - 1
api/pages/settings-plugins.php

@@ -1,5 +1,5 @@
 <?php
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
 	$pageSettingsPlugins = '
 <script>
 	buildPlugins();

+ 4 - 4
api/pages/settings-settings-logs.php

@@ -1,6 +1,6 @@
 <?php
-if(file_exists('config'.DIRECTORY_SEPARATOR.'config.php')){
-    $pageSettingsSettingsLogs = '
+if (file_exists($GLOBALS['userConfigPath'])) {
+	$pageSettingsSettingsLogs = '
     <script>
     $(document).on("click", ".swapLog", function(e) {
         var log = $(this).attr(\'data-name\')+\'Div\';
@@ -11,8 +11,8 @@ if(file_exists('config'.DIRECTORY_SEPARATOR.'config.php')){
     });
     </script>
     <div class="btn-group m-b-20 pull-left">
-        <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog active" data-name="loginLog" data-path="'.$GLOBALS['organizrLoginLog'].'" lang="en">Login Log</button>
-        <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog" data-name="orgLog" data-path="'.$GLOBALS['organizrLog'].'" lang="en">Organizr Log</button>
+        <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog active" data-name="loginLog" data-path="' . $GLOBALS['organizrLoginLog'] . '" lang="en">Login Log</button>
+        <button type="button" class="btn btn-default btn-outline waves-effect bg-org swapLog" data-name="orgLog" data-path="' . $GLOBALS['organizrLog'] . '" lang="en">Organizr Log</button>
     </div>
     <button class="btn btn-danger btn-sm waves-effect waves-light pull-right purgeLog" type="button"><span class="btn-label"><i class="fa fa-trash"></i></span>Purge Log</button>
     <div class="clearfix"></div>

+ 1 - 1
api/pages/settings-tab-editor-homepage-order.php

@@ -1,5 +1,5 @@
 <?php
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
 	$pageSettingsTabEditorHomepageOrder = '
 <script>
     $("#homepage-items-sort").sortable({

+ 1 - 1
api/pages/settings-tab-editor-tabs.php

@@ -1,5 +1,5 @@
 <?php
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
 	$pageSettingsTabEditorTabsPerformanceIcon = $GLOBALS['performanceDisableIconDropdown'] ? '' : '
 	allIcons().success(function(data) {
 	    $(".tabIconIconList").select2({

+ 1 - 1
api/pages/settings.php

@@ -1,5 +1,5 @@
 <?php
-if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+if (file_exists($GLOBALS['userConfigPath'])) {
 	$pageSettings = '
 <script>
     (function() {