2013-06-04 2 views
0

루트 디렉토리에서/portal이라는 하위 디렉토리로 사이트를 이동했습니다. 그러나 사이트가 루트에있는 것처럼 모든 링크, CSS 스크립트 및 이미지가 연결됩니다.globals.php에서 하위 디렉토리 업데이트

내 웹 사이트가 http://thespartaninstitute.com/portal

되는 스크립트 개발자는이이 globals.php 섹션에서 편집 할 수 있다고 말했다. 나는 PHP를 몰라. 편집해야 할 부분에 대해 도움을 줄 수 있습니까? 감사! 아래는 PHP 파일의 관련 줄을 믿습니다. 귀하가 포함되어 있기 때문에 당신의 /portal 폴더에있는 PHP 파일/포함

<?php 
session_start(); 
ini_set("display_errors",1); 
error_reporting(E_ALL & ~E_NOTICE); 
define('REAL_PUBLIC_PATH',dirname(realpath(__FILE__)));#getcwd()); // e.g. /home/user/public_html 
define("PHP_DIR",REAL_PUBLIC_PATH."/../../ClixScript_PHP_DOCS/"); // DEFINE THE PATH TO your ClixScript_PHP_DOCS folder here... 
define('STORAGE_DIR',PHP_DIR.'storage/'); 
define("PHP_ERRORS_DIR",@constant("STORAGE_DIR")."err/PHP_errors.log"); 
define("START_MICROTIME",microtime(true)); 
define('REAL_PUBLIC_DIR',basename(getcwd())); // e.g public_html 
define('RUN_HOOK',PHP_DIR.'runHook.php'); 
define('ASSET_POINTS',0); 
define('ASSET_CASH',1); // USD 
define('ASSET_TE_CREDITS',250); // Traffic Exchange Credits 
define('CONTROLLER_DIR',constant("PHP_DIR").'controller/'); 

#define('PLUGIN_DIR',constant("PHP_DIR").'plugins/'); 


@set_magic_quotes_runtime(0); 
// DO NOT USE MAGIC QUOTES, this method will deal with those who still use it, but it's faster to just turn it off 
if (get_magic_quotes_gpc()) { 
    $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); 
    while (list($key, $val) = each($process)) { 
     foreach ($val as $k => $v) { 
      unset($process[$key][$k]); 
      if (is_array($v)) { 
       $process[$key][stripslashes($k)] = $v; 
       $process[] = &$process[$key][stripslashes($k)]; 
      } else { 
       $process[$key][stripslashes($k)] = stripslashes($v); 
      } 
     } 
    } 
    unset($process); 
} 
/** Includes : */ 
if(defined('INCLUDES') AND INCLUDES === TRUE) 
{ 
// Create array of all classes, their path and filenames (only to be used in __autoload later). 
$classes = getDirectory(PHP_DIR.'classes'); 

foreach ($classes as $path=>$v) 
{ 
    foreach($v as $file) 
    { 
     $files[] = $file; 
     $paths[] = $path; 
    } 
} 
// We need global variables to use in __autoload later... 
$GLOBALS['classes_file_names'] = &$classes_file_names; 
$classes_file_names = $files; 
$GLOBALS['classes_paths'] = &$classes_paths; 
$classes_paths = $paths; 

function __autoload($class_name) 
{ 

    $classes_paths = $GLOBALS['classes_paths']; 
    $classes_file_names = $GLOBALS['classes_file_names']; 

    $filename = strtolower('class.'.$class_name.'.php'); 

    if(($key = array_search($filename,$classes_file_names)) !== false) 
    { 
     require_once $classes_paths[$key]."/".$filename; 
    } 
    else 
    { 
     return false; 
    }  
} 


require_once PHP_DIR."config/config.php"; 

define('CUSTOM_CONTROLLER_DIR',constant("REAL_PUBLIC_PATH").DIRECTORY_SEPARATOR.'portal/view/theme/'.trim(Vars::$conf->site->template).'/ctr/'); 

$time_zone = Vars::$conf->site->time_zone; 
// if time zone has been specified: 
if(!empty($time_zone) and strpos($time_zone,'/') !== false) 
{ 
    // set default to it: 
    date_default_timezone_set($time_zone); 
} 

} 

if(defined('INCLUDE_PLUGINS') AND INCLUDE_PLUGINS === TRUE) 
{ 

    define('PLUGIN_DIR',constant("REAL_PUBLIC_PATH").'/plugins/'); 
    define('PLUGIN_URL',Router::getHost().'plugins/'); 
/** 
* Load plugins (START) 
*/ 
$plugins = Plugins::getAllPluginNames(); 

$classes = array(); 

foreach($plugins as $plugin) 
{ 
    $path = PLUGIN_DIR.$plugin.'/classes'; 

    $res = getDirectory($path); 
    if(!empty($res)) 
    { 
     $classes[$path] = $res[$path];  
    } 
} 

foreach ($classes as $path=>$v) 
{ 
    foreach($v as $file) 
    { 
     $files[] = $file; 
     $paths[] = $path; 
    } 
} 

// We need global variables to use in __autoload later... 
$classes_file_names = array_merge($classes_file_names,$files); 
$classes_paths = array_merge($classes_paths,$paths); 


// Load Kohana Classes, start 
define('SYSPATH',true); 

include PHP_DIR.'classes/kohana/kohana/Exception.php'; 
include PHP_DIR.'classes/kohana/Exception.php'; 

include PHP_DIR.'classes/kohana/kohana/Arr.php'; 
include PHP_DIR.'classes/kohana/Arr.php'; 

include PHP_DIR.'classes/kohana/kohana/pagination.php'; 
include PHP_DIR.'classes/kohana/pagination.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/DB.php'; 
include PHP_DIR.'classes/kohana/database/classes/Kohana/Database.php'; 
include PHP_DIR.'classes/kohana/database/classes/DB.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Result.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Result.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Exception.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Exception.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/MySQL/Result.php'; 
include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/MySQL.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query/Builder.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query/Builder.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query/Builder/Where.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query/Builder/Where.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query/Builder/Delete.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query/Builder/Delete.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query/Builder/Insert.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query/Builder/Insert.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query/Builder/Join.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query/Builder/Join.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query/Builder/Select.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query/Builder/Select.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Query/Builder/Update.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/Query/Builder/Update.php'; 

include PHP_DIR.'classes/kohana/database/classes/Kohana/Database/Expression.php'; 

include PHP_DIR.'classes/kohana/database/classes/Database/MySQL.php'; 
include PHP_DIR.'classes/kohana/database/classes/Database/MySQL/Result.php'; 

include PHP_DIR.'classes/kohana/database/classes/Database/Expression.php'; 

// Load Kohana Classes, end 

// Load vendors: 
include PHP_DIR.'vendor/facebook/base_facebook.php'; 
include PHP_DIR.'vendor/facebook/facebook.php'; 
include PHP_DIR.'vendor/phpQuery/phpQuery-onefile.php'; 

// Load plugins 
Plugins::load(); 
// Set routes for all plugins (will not overwrite these already specified in config) 
Plugins::runMethod('routes'); 


/** 
* Load plugins (END) 
*/ 
} 
else 
{ 
    # exit; 
} 

Config::$language = 'us'; 
// If user has chosen language, set it: 
if(isset($_COOKIE['language_code'])) 
{ 
    if(in_array($_COOKIE['language_code'],array_keys(Config::$valid_languages))) 
    { 
     Config::$language = $_COOKIE['language_code']; 
    } 
} 
// If user has not set language, detect country of user and choose language based on that: 
if(!isset($_COOKIE['language_code'])) 
{ 
    $ip2c = new Ip2Country; 
    $ip2c->load(User::getRealIP()); 
    $country = strtolower($ip2c->countryCode); 

    if(in_array($country,array_keys(Config::$valid_languages))) 
    { 
     $expire=60*60*24*365*10;  
     setcookie('language_code',$country,(time()+$expire),'/'); 
     Config::$language = $country; 
    } 
} 
#$GLOBALS['sidebar_menu'] = $sidebar_menu; 
if(!defined('ONLY_GLOBALS')) 
{ 
    include PHP_DIR.'config/variables.php'; 
} 
/** 
* Functions: 
*/ 

function getDirectory($path = '.', $ignore = null) { 

    $default_ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini', '.ftpquota'); 
    if($ignore === null) $ignore = $default_ignore; 
    else $ignore = array_merge($default_ignore,$ignore); 

    $dirTree = array(); 
    $dirTreeTemp = array(); 
    $ignore[] = '.'; 
    $ignore[] = '..'; 

    $dh = @opendir($path); 

    if($dh !== false) 
    { 
     while (false !== ($file = readdir($dh))) { 

      if (!in_array($file, $ignore)) { 
       if (!is_dir("$path/$file")) { 

        $dirTree["$path"][] = $file; 

       } else { 

        $dirTreeTemp = getDirectory("$path/$file", $ignore); 
        if (is_array($dirTreeTemp))$dirTree = array_merge($dirTree, $dirTreeTemp); 
       } 
      } 
     } 
     closedir($dh); 
    } 

    return $dirTree; 
} 



class ErrorHandling 
{ 
    public function __construct() 
    { 
     $this->doer(); 
    } 

    public function doer() 
    { 
     ob_start(array(&$this, 'fatalErrorHandler')); 
     set_error_handler(array(&$this, 'errorHandler')); 
    } 

    public function logError($str) 
    { 
     $errpath = constant("PHP_ERRORS_DIR"); 
     $handle = fopen($errpath,"a+"); 
     fwrite($handle,$str."\r\n"); 
     fclose($handle); 
    } 

    public function fatalErrorHandler($buffer) 
    { 
     if(ereg("(error</b>:)(.+)(<br)", $buffer, $regs)) 
     { 
     $err = preg_replace("/<.*?>/","",$regs[2]); 
      $time = "[".Time::unixReadable()."]"; 
      $this->logError($time.' Fatal Error:'.$err.' [SCRIPT TERMINATED]'); 
      return "Fatal error occured, execution halted"; 
     } 
     return $buffer; 
    } 

    public function errorHandler($errno, $errstr, $errfile, $errline) 
    { 
     $time = "[".Time::unixReadable()."]"; 
     if($errno != 2048 && $errno != 0) 
     { 
      switch($errno) 
      { 
       case 256: 
        $str = $time.' E_USER_ERROR ['.$errno.'] '.$errstr.' in file '.$errfile.'('.$errline.') [SCRIPT TERMINATED]'; 
        break; 
       case 512: 
        $str = $time.' E_USER_WARNING ['.$errno.'] '.$errstr.' in file '.$errfile.'('.$errline.')'; 
       break; 
       case 8: 
        $str = $time.' E_USER_NOTICE ['.$errno.'] '.$errstr.' in file '.$errfile.'('.$errline.')'; 
       break; 
       default: 
        $str = $time.' Unknown error type ['.$errno.'] '.$errstr.' in file '.$errfile.'('.$errline.')'; 
       break; 
      } 
      $this->logError($str); 
     } 
     elseif($errno == "FATAL" || $errno == "ERROR") 
     { 
      $this->logError($time.' Fatal Error ['.$errno.'] '.$errstr.' in file '.$errfile.'('.$errline.') [SCRIPT TERMINATED]'); 
      ob_end_flush(); 
     } 
    } 
} 

?> 

답변

0

검색, HTML 페이지의 <HEAD> 일부를 생성합니다.
HTML 소스를 볼 수 있으므로 5-6 개의 CSS 및 JavaScript가 있습니다. 예를 들어 :

<link rel="stylesheet" type="text/css" href="http://thespartaninstitute.com/view/theme/thespartaninstitute/css/layout.css" /> 
<link rel="stylesheet" type="text/css" href="http://thespartaninstitute.com/view/theme/thespartaninstitute/css/jquery.qtip.css" media="screen" /> 
<link rel="stylesheet" type="text/css" href="http://thespartaninstitute.com/view/theme/thespartaninstitute/css/niceforms-default.css" media="all" /> 

이 같아야합니다

<link rel="stylesheet" type="text/css" href="http://thespartaninstitute.com/portal/view/theme/thespartaninstitute/css/layout.css" /> 
<link rel="stylesheet" type="text/css" href="http://thespartaninstitute.com/portal/view/theme/thespartaninstitute/css/jquery.qtip.css" media="screen" /> 
<link rel="stylesheet" type="text/css" href="http://thespartaninstitute.com/portal/view/theme/thespartaninstitute/css/niceforms-default.css" media="all" /> 

당신은 당신의 도메인 이름 뒤에 /portal/을 추가해야합니다 모든 경로를 포함에.
이러한 포함이 단순한 HTML 형식 인 경우 도메인 뒤에 /portal/을 입력하면됩니다.

PHP 변수 또는 정의 된 상수가있는 경우이를 변경해야합니다. 또는 앞서 언급했듯이 도메인 이름 뒤에 /portal/을 쓰면됩니다.

echo SITE_ROOT.'view/theme/thespartaninstitute/css/layout.css'; 

다음으로 변경 : 예를 들어
당신은 같은 것을 보면

echo SITE_ROOT.'/portal/view/theme/thespartaninstitute/css/layout.css'; 

또는 SITE_ROOTdefine를 검색하고이를 위해 /portal/을 추가합니다. 이 경우 나는 첫 번째 해결책을 제안 할 것이다.

변수 이상의 단지보다 사이트 루트이 같이 포함 된 일정이있는 경우 :

echo THEME_INCLUDE_PATH.'css/layout.css'; 

이 그런 다음 globals.phpTHEME_INCLUDE_PATH을 발견하고이 도메인 후 /portal/ 추가하기.

+0

감사합니다. 내 사이트 디자이너에게 문제가 발생하기 때문에 포함을 수동으로 변경하고 싶지 않습니다. – Mohammad

+0

그러나 나는 전역에서 이것을 발견했다. 무슨 소리 야? 그리고 그렇다면 어떻게 편집해야합니까? define ('CUSTOM_CONTROLLER_DIR', 상수 ("REAL_PUBLIC_PATH") .DIRECTORY_SEPARATOR.view/theme/'. trim (Vars :: $ conf-> site-> template).'/ ctr/'); – Mohammad

+0

감사합니다. 운이 없다 : \ – Mohammad