소스 검색

Merge pull request #341 from causefx/cero-dev

Merge in changes
Cerothen 9 년 전
부모
커밋
08298f1602
4개의 변경된 파일27개의 추가작업 그리고 15개의 파일을 삭제
  1. 4 4
      .gitignore
  2. 1 1
      README.md
  3. 4 4
      error.php
  4. 18 6
      functions.php

+ 4 - 4
.gitignore

@@ -57,10 +57,10 @@ _config.yml
 test.php
 users.db
 config/config.php
-config/config.bak.php
+config/config*.bak.php
 config/users/
 config/users
-config/users.db
-config/users.bak.db
-
+config/users*.db
+config/users*.bak.db
+config/tmp/*
 

+ 1 - 1
README.md

@@ -52,6 +52,6 @@ Do you have quite a bit of services running on your computer or server?  Do you
 [![Feature Requests](http://feathub.com/causefx/Organizr?format=svg)](http://feathub.com/causefx/Organizr)
 
 Thanks to everyone that helped!  
-Special Shout-out to: [elmerfdz](https://github.com/elmerfdz) & [pyrostic](https://github.com/pyrostic) & [rix1337](https://github.com/rix1337)
+Special Shout-out to: [Cerothen](https://github.com/Cerothen) & [elmerfdz](https://github.com/elmerfdz) & [pyrostic](https://github.com/pyrostic) & [rix1337](https://github.com/rix1337)
 
 Theme Distributed with Extended License from Creative Market

+ 4 - 4
error.php

@@ -64,9 +64,9 @@ $errorImage = $codes[$status][2];
 
         <title><?=$errorTitle;?></title>
 
-        <link rel="stylesheet" href="<?php echo dirname($_SERVER['SCRIPT_NAME']); ?>/bower_components/bootstrap/dist/css/bootstrap.min.css">
-        <link rel="stylesheet" href="<?php echo dirname($_SERVER['SCRIPT_NAME']); ?>/bower_components/Waves/dist/waves.min.css"> 
-        <link rel="stylesheet" href="<?php echo dirname($_SERVER['SCRIPT_NAME']); ?>/css/style.css">
+        <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>bower_components/bootstrap/dist/css/bootstrap.min.css">
+        <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>bower_components/Waves/dist/waves.min.css"> 
+        <link rel="stylesheet" href="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>css/style.css">
     </head>
     <body class="gray-bg" style="padding: 0;">
         <div class="main-wrapper" style="position: initial;">
@@ -80,7 +80,7 @@ $errorImage = $codes[$status][2];
                                         <h1 class="zero-m text-uppercase" style="color:<?=$topbartext;?>; font-size: 40px;"><?=$errorTitle;?></h1>
                                     </div>
                                     <div class="big-box text-left">
-                                        <center><img src="images/<?=$errorImage;?>.png" style="height: 200px;"></center>
+                                        <center><img src="<?php echo checkRootPath(dirname($_SERVER['SCRIPT_NAME'])); ?>images/<?=$errorImage;?>.png" style="height: 200px;"></center>
                                         <h4 style="color: <?=$topbar;?>;" class="text-center"><?php echo $message;?></h4>
                                         <button style="background:<?=$topbar;?>;" onclick="window.history.back();" type="button" class="btn log-in btn-block btn-primary text-uppercase waves waves-effect waves-float"><text style="color:<?=$topbartext;?>;"><?php echo $language->translate("GO_BACK");?></text></button>
                                     </div>

+ 18 - 6
functions.php

@@ -838,8 +838,10 @@ function loadConfig($path = 'config/config.php') {
 // Commit new values to the configuration
 function updateConfig($new, $current = false) {
 	// Get config if not supplied
-	if (!$current) {
+	if ($current === false) {
 		$current = loadConfig();
+	} else if (is_string($current) && is_file($current)) {
+		$current = loadConfig($current);
 	}
 	
 	// Inject Parts
@@ -974,6 +976,7 @@ function upgradeCheck() {
 		
 		// Write config file
 		$config['CONFIG_VERSION'] = '1.32';
+		copy('config/config.php', 'config/config['.date('Y-m-d_H-i-s').'][pre1.32].bak.php');
 		$createConfigSuccess = createConfig($config);
 		
 		// Create new config
@@ -1008,22 +1011,24 @@ function upgradeCheck() {
 		}
 		
 		// Upgrade database to latest version
-		updateSQLiteDB($config['database_Location']);
+		updateSQLiteDB($config['database_Location'],'1.32');
 		
 		// Update Version and Commit
 		$config['CONFIG_VERSION'] = '1.33';
+		copy('config/config.php', 'config/config['.date('Y-m-d_H-i-s').'][1.32].bak.php');
 		$createConfigSuccess = createConfig($config);
 		unset($config);
 	}
 	
-	// Upgrade to 1.33
+	// Upgrade to 1.34
 	$config = loadConfig();
 	if (isset($config['database_Location']) && (!isset($config['CONFIG_VERSION']) || $config['CONFIG_VERSION'] < '1.34')) {
 		// Upgrade database to latest version
-		updateSQLiteDB($config['database_Location']);
+		updateSQLiteDB($config['database_Location'],'1.33');
 		
 		// Update Version and Commit
 		$config['CONFIG_VERSION'] = '1.34';
+		copy('config/config.php', 'config/config['.date('Y-m-d_H-i-s').'][1.33].bak.php');
 		$createConfigSuccess = createConfig($config);
 		unset($config);
 	}
@@ -1609,7 +1614,7 @@ function createSQLiteDB($path = false) {
 }
 
 // Upgrade Database
-function updateSQLiteDB($db_path = false) {
+function updateSQLiteDB($db_path = false, $oldVerNum = false) {
 	if (!$db_path) {
 		if (defined('DATABASE_LOCATION')) {
 			$db_path = DATABASE_LOCATION;
@@ -1638,7 +1643,7 @@ function updateSQLiteDB($db_path = false) {
 	$GLOBALS['file_db'] = null;
 	$pathDigest = pathinfo($db_path.'users.db');
 	if (file_exists($db_path.'users.db')) {
-		rename($db_path.'users.db', $pathDigest['dirname'].'/'.$pathDigest['filename'].'.bak.db');
+		rename($db_path.'users.db', $pathDigest['dirname'].'/'.$pathDigest['filename'].'['.date('Y-m-d_H-i-s').']'.($oldVerNum?'['.$oldVerNum.']':'').'.bak.db');
 	}
 	
 	// Create New Database
@@ -2404,5 +2409,12 @@ function getHeadphonesCalendar($url, $key, $list){
 
 }
 
+function checkRootPath($string){
+    if($string == "\\" || $string == "/"){
+        return "/";
+    }else{
+        return str_replace("\\", "/", $string) . "/";
+    }
+}
 
 ?>