瀏覽代碼

relative path support

Serghey Rodin 9 年之前
父節點
當前提交
027290225b
共有 1 個文件被更改,包括 8 次插入9 次删除
  1. 8 9
      web/inc/main.php

+ 8 - 9
web/inc/main.php

@@ -1,7 +1,11 @@
 <?php
+
 session_start();
 
-require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n.php');
+define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
+$i = 0;
+
+require_once(dirname(__FILE__).'/i18n.php');
 
 // Check system settings
 if ((!isset($_SESSION['VERSION'])) && (!defined('NO_AUTH_REQUIRED'))) {
@@ -25,10 +29,6 @@ if (isset($_SESSION['user'])) {
     }
 }
 
-define('VESTA_CMD', '/usr/bin/sudo /usr/local/vesta/bin/');
-
-$i = 0;
-
 if (isset($_SESSION['language'])) {
     switch ($_SESSION['language']) {
         case 'ro':
@@ -80,7 +80,6 @@ function get_favourites(){
 }
 
 
-
 function check_error($return_var) {
     if ( $return_var > 0 ) {
         header("Location: /error/");
@@ -89,7 +88,7 @@ function check_error($return_var) {
 }
 
 function check_return_code($return_var,$output) {
-   if ($return_var != 0) {
+    if ($return_var != 0) {
         $error = implode('<br>', $output);
         if (empty($error)) $error = __('Error code:',$return_var);
         $_SESSION['error_msg'] = $error;
@@ -107,9 +106,9 @@ function top_panel($user, $TAB) {
     $panel = json_decode(implode('', $output), true);
     unset($output);
     if ( $user == 'admin' ) {
-        include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/panel.html');
+        include(dirname(__FILE__).'/../templates/admin/panel.html');
     } else {
-        include($_SERVER['DOCUMENT_ROOT'].'/templates/user/panel.html');
+        include(dirname(__FILE__).'/../templates/user/panel.html');
     }
 }