Changeset 293
- Timestamp:
- 07/26/07 07:30:10 (1 year ago)
- Files:
-
- trunk/app/application_controller.php (modified) (1 diff)
- trunk/app/models/framework_setup.php (modified) (6 diffs)
- trunk/index.php (modified) (1 diff)
- trunk/lib/AkActionView/helpers/asset_tag_helper.php (modified) (1 diff)
- trunk/public/index.php (modified) (2 diffs)
- trunk/script/setup (modified) (2 diffs)
- trunk/test/unit/lib/AkActionView/helpers/_HelpersUnitTester.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/application_controller.php
r285 r293 16 16 class ApplicationController extends AkActionController 17 17 { 18 18 19 } 19 20 trunk/app/models/framework_setup.php
r290 r293 329 329 %AK_FRAMEWORK_DIR 330 330 331 %AK_ASSET_URL_PREFIX 332 331 333 include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'boot.php'); 332 334 … … 360 362 $settings['%AK_FRAMEWORK_DIR'] = defined('AK_FRAMEWORK_DIR') ? 361 363 "defined('AK_FRAMEWORK_DIR') ? null : define('AK_FRAMEWORK_DIR', '".AK_FRAMEWORK_DIR."');" : ''; 364 365 366 $asset_path = $this->_getAssetBasePath(); 367 if(!empty($asset_path)){ 368 $settings['%AK_ASSET_URL_PREFIX'] = "define('AK_ASSET_URL_PREFIX','/".trim($this->getUrlSuffix(),'/').'/'.$asset_path."');"; 369 }else{ 370 $settings['%AK_ASSET_URL_PREFIX'] = ''; 371 } 372 362 373 } 363 374 … … 409 420 $file_2_content = @Ak::file_get_contents($file_2); 410 421 411 empty($file_1_content) ? null : @Ak::file_put_contents($file_1, str_replace('# RewriteBase /framework',' RewriteBase '.$this->getUrlSuffix(), $file_1_content)); 412 empty($file_2_content) ? null : @Ak::file_put_contents($file_2, str_replace('# RewriteBase /framework',' RewriteBase '.$this->getUrlSuffix(), $file_2_content)); 422 $url_suffix = $this->getUrlSuffix(); 423 424 $url_suffix = $url_suffix[0] != '/' ? '/'.$url_suffix : $url_suffix; 425 426 empty($file_1_content) ? null : @Ak::file_put_contents($file_1, str_replace('# RewriteBase /framework',' RewriteBase '.$url_suffix, $file_1_content)); 427 empty($file_2_content) ? null : @Ak::file_put_contents($file_2, str_replace('# RewriteBase /framework',' RewriteBase '.$url_suffix, $file_2_content)); 413 428 } 414 429 … … 435 450 { 436 451 $application_name = array_pop(explode('/',AK_SITE_URL_SUFFIX)); 437 $application_name = empty($application_name) ? substr(AK_BASE_DIR, strrpos(AK_BASE_DIR, DS)+1) : $application_name; 452 $application_name = empty($application_name) ? substr(AK_BASE_DIR, strrpos(AK_BASE_DIR, DS)+1) : $application_name; 438 453 return empty($application_name) ? 'my_app' : $application_name; 439 454 } … … 698 713 if($this->hasUrlSuffix()){ 699 714 $url_suffix = trim($this->getUrlSuffix(),'/'); 715 $asset_path = $this->_getAssetBasePath(); 716 if(!empty($asset_path)){ 717 $url_suffix = $asset_path.'/'.$url_suffix; 718 } 700 719 foreach ($this->stylesheets as $stylesheet) { 701 720 $filename = AK_PUBLIC_DIR.DS.'stylesheets'.DS.$stylesheet.'.css'; … … 705 724 } 706 725 726 } 727 728 function _getAssetBasePath() 729 { 730 return file_exists(AK_BASE_DIR.DS.'index.php') ? 'public' : ''; 707 731 } 708 732 trunk/index.php
r2 r293 15 15 */ 16 16 17 if(!@include('.'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php')){ 18 define('AK_ENVIRONMENT', 'setup'); 19 require('app'.DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR.'framework_setup_controller.php'); 20 exit; 21 } 22 23 include(AK_PUBLIC_DIR.DS.'index.php'); 17 include('public'.DIRECTORY_SEPARATOR.'index.php'); 24 18 25 19 ?> trunk/lib/AkActionView/helpers/asset_tag_helper.php
r285 r293 222 222 $source = $source[0] != '/' && !strstr($source,':') ? "/$dir/$source" : $source; 223 223 $source = !strstr($source,'.') ? "$source.$ext" : $source; 224 $source = !preg_match('/^[-a-z]+:\/\//',$source) ? '/'.ltrim(dirname(@$_SERVER['SCRIPT_NAME']).$source,'/\\'): $source;224 $source = !preg_match('/^[-a-z]+:\/\//',$source) ? AK_ASSET_URL_PREFIX.$source : $source; 225 225 $source = strstr($source,':') ? $source : AK_ASSET_HOST.$source; 226 226 $source = substr($source,0,2) == '//' ? substr($source,1) : $source; 227 227 228 return $source; 228 229 } trunk/public/index.php
r2 r293 15 15 */ 16 16 17 // defined('AK_FRAMEWORK_DIR') ? null : define('AK_FRAMEWORK_DIR', '/path/to/the/framework');17 defined('AK_FRAMEWORK_DIR') ? null : define('AK_FRAMEWORK_DIR', '/Volumes/Files/Projects/akelos_framework/trunk'); 18 18 19 19 /** … … 21 21 */ 22 22 if(!defined('AK_CONFIG_INCLUDED')){ 23 if(!file_exists( '..'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php')){23 if(!file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php')){ 24 24 define('AK_ENVIRONMENT', 'setup'); 25 require('..'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR.'framework_setup_controller.php'); 25 error_reporting(E_ALL); 26 @ini_set('display_errors', 1); 27 require(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR. 28 'app'.DIRECTORY_SEPARATOR.'controllers'.DIRECTORY_SEPARATOR.'framework_setup_controller.php'); 26 29 exit; 27 30 }else{ 28 include_once( '..'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');31 include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); 29 32 } 30 33 } trunk/script/setup
r281 r293 94 94 } 95 95 $this->yield("\n Could not create a symbolic link of ".$this->options['directory'].DS.'public'.' at '.$this->options['public_html']); 96 97 }else{ 98 $this->_addRootLevelDispatcher(); 99 $this->_addHtaccessDirectoryProtection(); 96 100 } 97 101 return false; … … 111 115 } 112 116 } 117 } 118 119 function _addRootLevelDispatcher() 120 { 121 $this->_copyFile($this->options['source'].DS.'index.php'); 122 $this->_copyFile($this->options['source'].DS.'.htaccess'); 123 } 124 125 function _addHtaccessDirectoryProtection() 126 { 127 foreach($this->source_tree as $k=>$node){ 128 $folder = array_shift(array_keys($node)); 129 $path = $this->options['directory'].DS.$folder; 130 if(is_dir($path) && !file_exists($path.DS.'.htaccess') && $folder != 'public'){ 131 file_put_contents($path.DS.'.htaccess', "order allow,deny\ndeny from all"); 132 } 133 } 134 113 135 } 114 136 trunk/test/unit/lib/AkActionView/helpers/_HelpersUnitTester.php
r2 r293 28 28 function HelpersUnitTester() 29 29 { 30 $base_url = parse_url(dirname(@$_SERVER['SCRIPT_NAME'])); 31 $this->testing_url_path = '/'.ltrim($base_url['path'], '/'); 30 $this->testing_url_path = AK_ASSET_URL_PREFIX; 32 31 } 33 32 }
