Changeset 296
- Timestamp:
- 07/30/07 09:47:34 (1 year ago)
- Files:
-
- trunk/app/controllers/framework_setup_controller.php (modified) (1 diff)
- trunk/cache (deleted)
- trunk/config/boot.php (modified) (1 diff)
- trunk/index.php (modified) (1 diff)
- trunk/lib/Ak.php (modified) (5 diffs)
- trunk/lib/AkActionController.php (modified) (1 diff)
- trunk/lib/AkActionView/helpers/file_upload_helper.php (modified) (1 diff)
- trunk/lib/AkConverters/AkExcelToArray.php (modified) (1 diff)
- trunk/lib/AkConverters/AkMsExcelToMany.php (modified) (2 diffs)
- trunk/lib/AkConverters/AkMsWordToMany.php (modified) (2 diffs)
- trunk/lib/AkConverters/AkXdocToText.php (modified) (2 diffs)
- trunk/lib/AkImage.php (modified) (1 diff)
- trunk/lib/AkImage/AkImageColorScheme.php (modified) (1 diff)
- trunk/lib/constants.php (added)
- trunk/log (added)
- trunk/log/command_line.log (added)
- trunk/script/console (modified) (1 diff)
- trunk/test/unit/lib/utils/_Ak_file_functions.php (modified) (5 diffs)
- trunk/test/unit/lib/utils/_Ak_file_functions_over_ftp.php (modified) (8 diffs)
- trunk/tmp (added)
- trunk/tmp/cache (added)
- trunk/tmp/views (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/controllers/framework_setup_controller.php
r215 r296 188 188 $this->FrameworkSetup->relativizeStylesheetPaths(); 189 189 $this->FrameworkSetup->removeSetupFiles(); 190 190 unset($_SESSION); 191 191 $this->redirectTo(array('controller'=>'page')); 192 192 } trunk/config/boot.php
r295 r296 1 1 <?php 2 2 3 // If you need to customize the framework default settings or specify internationalization options,4 // edit the files config/testing.php, config/development.php, config/production.php5 6 3 /** 7 * This f unction sets a constant and returns it's value. If constant has been already defined it8 * will reutrn its original value.4 * This file and the lib/constants.php file perform most part of Akelos 5 * environment guessing. 9 6 * 10 * Returns null in case the constant does not exist7 * You can retrieve a list of current settings by running Ak::get_constants(); 11 8 * 12 * @param string $name 13 * @param mixed $value 9 * If you're running a high load site you might want to fine tune this options 10 * according to your environment. If you set the options implicitly you might 11 * gain in performance but loose in flexibility when moving to a different 12 * environment. 13 * 14 * If you need to customize the framework default settings or specify 15 * internationalization options, edit the files at config/environments/* 14 16 */ 15 function ak_define($name, $value = null)16 {17 $name = strtoupper($name);18 $name = substr($name,0,3) == 'AK_' ? $name : 'AK_'.$name;19 return defined($name) ? constant($name) : (is_null($value) ? null : (define($name, $value) ? $value : null));20 }21 22 17 23 18 defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); 24 25 19 defined('AK_BASE_DIR') ? null : define('AK_BASE_DIR', str_replace(DS.'config'.DS.'boot.php','',__FILE__)); 26 defined('AK_CONFIG_DIR') ? null : define('AK_CONFIG_DIR', AK_BASE_DIR.DS.'config');27 28 // If you need to customize the framework default settings or specify internationalization options,29 // edit the files config/testing.php, config/development.php, config/production.php30 if(AK_ENVIRONMENT != 'setup'){31 $akdb = $database_settings[strtolower(AK_ENVIRONMENT)];32 $dsn = $akdb['type'] == 'sqlite' ?33 'sqlite://'.urlencode($akdb['database_file']).'/?persist' :34 $akdb['type'].'://'.$akdb['user'].':'.$akdb['password'].'@'.$akdb['host'].35 (empty($akdb['port'])?'':':'.$akdb['port']).36 '/'.$akdb['database_name'].37 (!empty($akdb['options'])?'?'.$akdb['options']:'');38 39 require_once(AK_CONFIG_DIR.DS.'environments'.DS.AK_ENVIRONMENT.'.php');40 }41 42 unset($environment, $database_settings, $akdb);43 44 45 // Locale settings ( you must create a file at /config/locales/ using en.php as departure point)46 // Please be aware that your charset needs to be UTF-8 in order to edit the locales files47 // auto will enable all the locales at config/locales/ dir48 defined('AK_AVAILABLE_LOCALES') ? null : define('AK_AVAILABLE_LOCALES', 'auto');49 50 51 // Set these constants in order to allow only these locales on web requests52 // defined('AK_ACTIVE_RECORD_DEFAULT_LOCALES') ? null : define('AK_ACTIVE_RECORD_DEFAULT_LOCALES','en,es');53 // defined('AK_APP_LOCALES') ? null : define('AK_APP_LOCALES','en,es');54 // defined('AK_PUBLIC_LOCALES') ? null : define('AK_PUBLIC_LOCALES','en,es');55 56 defined('AK_URL_REWRITE_ENABLED') ? null : define('AK_URL_REWRITE_ENABLED', true);57 58 defined('AK_TIME_DIFFERENCE') ? null : define('AK_TIME_DIFFERENCE', 0); // Time difference from the webserver59 60 // COMMENT THIS LINE IF YOU DONT WANT THE FRAMEWORK TO CONNECT TO THE DATABASE ON EACH REQUEST AUTOMATICALLY61 defined('AK_WEB_REQUEST_CONNECT_TO_DATABASE_ON_INSTANTIATE') ? null : define('AK_WEB_REQUEST_CONNECT_TO_DATABASE_ON_INSTANTIATE', true);62 63 defined('AK_CLI') ? null : define('AK_CLI', php_sapi_name() == 'cli');64 defined('AK_WEB_REQUEST') ? null : define('AK_WEB_REQUEST', !empty($_SERVER['REQUEST_URI']));65 defined('AK_REQUEST_URI') ? null : define('AK_REQUEST_URI', isset($_SERVER['REQUEST_URI']) ?66 $_SERVER['REQUEST_URI'] :67 $_SERVER['PHP_SELF'] .'?'.(isset($_SERVER['argv']) ? $_SERVER['argv'][0] : $_SERVER['QUERY_STRING']));68 69 defined('AK_DEBUG') ? null : define('AK_DEBUG', AK_ENVIRONMENT == 'production' ? 0 : 1);70 71 @error_reporting(AK_DEBUG ? E_ALL : 0);72 73 defined('AK_CACHE_HANDLER') ? null : define('AK_CACHE_HANDLER', 2);74 75 defined('AK_APP_DIR') ? null : define('AK_APP_DIR', AK_BASE_DIR.DS.'app');76 defined('AK_APIS_DIR') ? null : define('AK_APIS_DIR', AK_APP_DIR.DS.'apis');77 defined('AK_MODELS_DIR') ? null : define('AK_MODELS_DIR', AK_APP_DIR.DS.'models');78 defined('AK_CONTROLLERS_DIR') ? null : define('AK_CONTROLLERS_DIR', AK_APP_DIR.DS.'controllers');79 defined('AK_VIEWS_DIR') ? null : define('AK_VIEWS_DIR', AK_APP_DIR.DS.'views');80 defined('AK_HELPERS_DIR') ? null : define('AK_HELPERS_DIR', AK_APP_DIR.DS.'helpers');81 defined('AK_ELEMENTS_DIR') ? null : define('AK_ELEMENTS_DIR', AK_VIEWS_DIR.DS.'elements');82 defined('AK_CACHE_DIR') ? null : define('AK_CACHE_DIR',AK_BASE_DIR.DS.'cache');83 defined('AK_COMPONENTS_DIR') ? null : define('AK_COMPONENTS_DIR',AK_BASE_DIR.DS.'components');84 defined('AK_PUBLIC_DIR') ? null : define('AK_PUBLIC_DIR', AK_BASE_DIR.DS.'public');85 defined('AK_TEST_DIR') ? null : define('AK_TEST_DIR', AK_BASE_DIR.DS.'test');86 defined('AK_SCRIPT_DIR') ? null : define('AK_SCRIPT_DIR',AK_BASE_DIR.DS.'script');87 88 defined('AK_DEFAULT_LAYOUT') ? null : define('AK_DEFAULT_LAYOUT', 'application');89 90 // Paths below this point refer to the Akelos Framework components.91 20 defined('AK_FRAMEWORK_DIR') ? null : define('AK_FRAMEWORK_DIR', AK_BASE_DIR); 92 defined('AK_CONTRIB_DIR') ? null : define('AK_CONTRIB_DIR',AK_FRAMEWORK_DIR.DS.'vendor');93 defined('AK_VENDOR_DIR') ? null : define('AK_VENDOR_DIR', AK_CONTRIB_DIR);94 defined('AK_DOCS_DIR') ? null : define('AK_DOCS_DIR',AK_FRAMEWORK_DIR.DS.'docs');95 21 defined('AK_LIB_DIR') ? null : define('AK_LIB_DIR',AK_FRAMEWORK_DIR.DS.'lib'); 96 22 97 98 defined('AK_CONFIG_INCLUDED') ? null : define('AK_CONFIG_INCLUDED',true); 99 defined('AK_FW') ? null : define('AK_FW',true); 100 101 if(AK_ENVIRONMENT != 'setup'){ 102 defined('AK_UPLOAD_FILES_USING_FTP') ? null : define('AK_UPLOAD_FILES_USING_FTP', !empty($ftp_settings)); 103 defined('AK_READ_FILES_USING_FTP') ? null : define('AK_READ_FILES_USING_FTP', false); 104 defined('AK_DELETE_FILES_USING_FTP') ? null : define('AK_DELETE_FILES_USING_FTP', !empty($ftp_settings)); 105 defined('AK_FTP_AUTO_DISCONNECT') ? null : define('AK_FTP_AUTO_DISCONNECT', !empty($ftp_settings)); 106 107 if(!empty($ftp_settings)){ 108 defined('AK_FTP_PATH') ? null : define('AK_FTP_PATH', $ftp_settings); 109 unset($ftp_settings); 110 } 111 } 112 113 @ini_set("arg_separator.output","&"); 114 115 @ini_set("session.name","AK_SESSID"); 116 @ini_set("include_path",(AK_LIB_DIR.PATH_SEPARATOR.AK_MODELS_DIR.PATH_SEPARATOR.AK_CONTRIB_DIR.DS.'pear'.PATH_SEPARATOR.ini_get("include_path"))); 117 defined('AK_PHP5') ? null : define('AK_PHP5', version_compare(PHP_VERSION, '5', '>=') == 1 ? true : false); 118 119 if(!AK_CLI && AK_WEB_REQUEST){ 120 121 defined('AK_SITE_URL_SUFFIX') ? null : define('AK_SITE_URL_SUFFIX', 122 '/'.str_replace(array(join(DS,array_diff((array)@explode(DS,AK_BASE_DIR), 123 (array)@explode('/',AK_REQUEST_URI))), AK_BASE_DIR, DS),'',AK_BASE_DIR)); 124 125 defined('AK_AUTOMATIC_SSL_DETECTION') ? null : define('AK_AUTOMATIC_SSL_DETECTION', 1); 126 127 defined('AK_PROTOCOL') ? null : define('AK_PROTOCOL',isset($_SERVER['HTTPS']) ? 'https://' : 'http://'); 128 defined('AK_HOST') ? null : define('AK_HOST', $_SERVER['SERVER_NAME'] == 'localhost' ? 129 // Will force to IP4 for localhost until IP6 is supported by helpers 130 ($_SERVER['SERVER_ADDR'] == '::1' ? '127.0.0.1' : $_SERVER['SERVER_ADDR']) : 131 $_SERVER['SERVER_NAME']); 132 defined('AK_REMOTE_IP') ? null : define('AK_REMOTE_IP',(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']); 133 134 defined('AK_SERVER_STANDARD_PORT') ? null : define('AK_SERVER_STANDARD_PORT', AK_PROTOCOL == 'https://' ? '443' : '80'); 135 136 $port = ($_SERVER['SERVER_PORT'] != AK_SERVER_STANDARD_PORT) 137 ? (empty($_SERVER['SERVER_PORT']) ? '' : ':'.$_SERVER['SERVER_PORT']) : ''; 138 139 if(isset($_SERVER['HTTP_HOST']) && strstr($_SERVER['HTTP_HOST'],':')){ 140 list(,$port) = explode(':', $_SERVER['HTTP_HOST']); 141 } 142 $suffix = ''; 143 if(defined('AK_SITE_HTPSS_URL_SUFFIX') && isset($_SERVER['HTTPS'])){ 144 $suffix = AK_SITE_HTPSS_URL_SUFFIX; 145 $port = strstr(AK_SITE_HTPSS_URL_SUFFIX,':') ? '' : $port; 146 }elseif(defined('AK_SITE_URL_SUFFIX') && AK_SITE_URL_SUFFIX != ''){ 147 $suffix = AK_SITE_URL_SUFFIX; 148 $port = strstr(AK_SITE_URL_SUFFIX,':') ? '' : $port; 149 } 150 if(!defined('AK_SITE_URL')){ 151 defined('AK_SITE_URL') ? null : define('AK_SITE_URL', trim(AK_PROTOCOL.AK_HOST, '/').$port.$suffix); 152 defined('AK_URL') ? null : define('AK_URL', AK_SITE_URL); 153 }else{ 154 if(AK_AUTOMATIC_SSL_DETECTION){ 155 defined('AK_URL') ? null : define('AK_URL', str_replace(array('https://','http://'),AK_PROTOCOL, AK_SITE_URL).$port.$suffix); 156 }else{ 157 defined('AK_URL') ? null : define('AK_URL', AK_SITE_URL.$port.$suffix); 158 } 159 } 160 defined('AK_CURRENT_URL') ? null : define('AK_CURRENT_URL', substr(AK_SITE_URL,0,strlen($suffix)*-1).AK_REQUEST_URI); 161 162 163 defined('AK_SERVER_PORT') ? null : define('AK_SERVER_PORT', empty($port) ? AK_SERVER_STANDARD_PORT : trim($port,':')); 164 165 unset($suffix, $port); 166 defined('AK_COOKIE_DOMAIN') ? null : define('AK_COOKIE_DOMAIN', AK_HOST); 167 // ini_set('session.cookie_domain', AK_COOKIE_DOMAIN); 168 169 }else{ 170 defined('AK_PROTOCOL') ? null : define('AK_PROTOCOL','http://'); 171 defined('AK_HOST') ? null : define('AK_HOST', 'localhost'); 172 defined('AK_REMOTE_IP') ? null : define('AK_REMOTE_IP','127.0.0.1'); 173 defined('AK_SITE_URL') ? null : define('AK_SITE_URL', 'http://localhost'); 174 defined('AK_URL') ? null : define('AK_URL', 'http://localhost/'); 175 defined('AK_CURRENT_URL') ? null : define('AK_CURRENT_URL', 'http://localhost/'); 176 defined('AK_COOKIE_DOMAIN') ? null : define('AK_COOKIE_DOMAIN', AK_HOST); 177 } 178 179 defined('AK_SESSION_HANDLER') ? null : define('AK_SESSION_HANDLER', 0); 180 defined('AK_SESSION_EXPIRE') ? null : define('AK_SESSION_EXPIRE', 600); 181 defined('AK_SESSION_NAME') ? null : define('AK_SESSION_NAME', 'AK_SESSID'); 182 183 defined('AK_DESKTOP') ? null : define('AK_DESKTOP', AK_SITE_URL == 'http://akelos'); 184 185 defined('AK_ASSET_HOST') ? null : define('AK_ASSET_HOST',''); 186 187 if(!defined('AK_ASSET_URL_PREFIX')){ 188 defined('AK_ASSET_URL_PREFIX') ? null : define('AK_ASSET_URL_PREFIX',str_replace(array(AK_BASE_DIR,'\\','//'),array('','/','/'), AK_PUBLIC_DIR)); 189 } 190 191 192 defined('AK_DEV_MODE') ? null : define('AK_DEV_MODE', AK_ENVIRONMENT == 'development'); 193 defined('AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES') ? null : define('AK_AUTOMATICALLY_UPDATE_LANGUAGE_FILES', AK_DEV_MODE); 194 defined('AK_ENABLE_PROFILER') ? null : define('AK_ENABLE_PROFILER', false); 195 defined('AK_PROFILER_GET_MEMORY') ? null : define('AK_PROFILER_GET_MEMORY',false); 196 197 $ADODB_CACHE_DIR = AK_CACHE_DIR; 198 199 /** 200 * Mode types for error reporting and loggin 201 */ 202 defined('AK_MODE_DISPLAY') ? null : define('AK_MODE_DISPLAY', 1); 203 defined('AK_MODE_MAIL') ? null : define('AK_MODE_MAIL', 2); 204 defined('AK_MODE_FILE') ? null : define('AK_MODE_FILE', 4); 205 defined('AK_MODE_DATABASE') ? null : define('AK_MODE_DATABASE', 8); 206 defined('AK_MODE_DIE') ? null : define('AK_MODE_DIE', 16); 207 208 defined('AK_LOG_EVENTS') ? null : define('AK_LOG_EVENTS', false); 209 210 defined('AK_ROUTES_MAPPING_FILE') ? null : define('AK_ROUTES_MAPPING_FILE', AK_CONFIG_DIR.DS.'routes.php'); 211 defined('AK_OS') ? null : define('AK_OS', (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? 'WINDOWS' : 'UNIX')); 212 defined('AK_CHARSET') ? null : define('AK_CHARSET', 'UTF-8'); 213 23 require_once(AK_LIB_DIR.DS.'constants.php'); 214 24 require_once(AK_LIB_DIR.DS.'Ak.php'); 215 216 /*217 if(!AK_CLI && (AK_DEBUG || AK_ENVIRONMENT == 'setup')){218 include_once(AK_LIB_DIR.DS.'AkDevelopmentErrorHandler.php');219 $__AkDevelopmentErrorHandler = new AkDevelopmentErrorHandler();220 set_error_handler(array(&$__AkDevelopmentErrorHandler, 'raiseError'));221 }222 */223 224 defined('AK_ACTION_CONTROLLER_DEFAULT_REQUEST_TYPE') ? null : define('AK_ACTION_CONTROLLER_DEFAULT_REQUEST_TYPE', 'web_request');225 defined('AK_ACTION_CONTROLLER_DEFAULT_ACTION') ? null : define('AK_ACTION_CONTROLLER_DEFAULT_ACTION', 'index');226 227 25 require_once(AK_LIB_DIR.DS.'AkActionController.php'); 228 26 trunk/index.php
r293 r296 15 15 */ 16 16 17 // Use the command line installer to only make your public the only public accesible point. 18 define('AK_INSECURE_APP_DIRECTORY_LAYOUT', true); 17 19 include('public'.DIRECTORY_SEPARATOR.'index.php'); 18 20 trunk/lib/Ak.php
r291 r296 1253 1253 { 1254 1254 $key = Ak::randomString(15); 1255 $compressed_file = AK_ CACHE_DIR.DS.'tmp'.DS.'d'.$key;1256 $uncompressed_file = AK_ CACHE_DIR.DS.'tmp'.DS.'s'.$key;1255 $compressed_file = AK_TMP_DIR.DS.'d'.$key; 1256 $uncompressed_file = AK_TMP_DIR.DS.'s'.$key; 1257 1257 1258 1258 if(@Ak::file_put_contents($uncompressed_file, $data)){ … … 1266 1266 gzclose($compressed); 1267 1267 }else{ 1268 trigger_error(Ak::t('Could not write to temporary directory for generating compressed file using Ak::compress(). Please provide write access to %dirname', array('%dirname'=>AK_ CACHE_DIR)), E_USER_ERROR);1268 trigger_error(Ak::t('Could not write to temporary directory for generating compressed file using Ak::compress(). Please provide write access to %dirname', array('%dirname'=>AK_TMP_DIR)), E_USER_ERROR); 1269 1269 } 1270 1270 $result = Ak::file_get_contents($compressed_file); … … 1275 1275 { 1276 1276 $key = Ak::randomString(15); 1277 $compressed_file = AK_ CACHE_DIR.DS.'tmp'.DS.'s'.$key;1278 $uncompressed_file = AK_ CACHE_DIR.DS.'tmp'.DS.'d'.$key;1277 $compressed_file = AK_TMP_DIR.DS.'s'.$key; 1278 $uncompressed_file = AK_TMP_DIR.DS.'d'.$key; 1279 1279 1280 1280 if(@Ak::file_put_contents($compressed_file, $compressed_data)){ … … 1288 1288 fclose($uncompressed); 1289 1289 }else{ 1290 trigger_error(Ak::t('Could not write to temporary directory for generating uncompressing file using Ak::uncompress(). Please provide write access to %dirname', array('%dirname'=>AK_ CACHE_DIR)), E_USER_ERROR);1290 trigger_error(Ak::t('Could not write to temporary directory for generating uncompressing file using Ak::uncompress(). Please provide write access to %dirname', array('%dirname'=>AK_TMP_DIR)), E_USER_ERROR); 1291 1291 } 1292 1292 $result = Ak::file_get_contents($uncompressed_file); … … 1845 1845 } 1846 1846 1847 /** 1848 * This function sets a constant and returns it's value. If constant has been already defined it 1849 * will reutrn its original value. 1850 * 1851 * Returns null in case the constant does not exist 1852 * 1853 * @param string $name 1854 * @param mixed $value 1855 */ 1856 function ak_define($name, $value = null) 1857 { 1858 $name = strtoupper($name); 1859 $name = substr($name,0,3) == 'AK_' ? $name : 'AK_'.$name; 1860 return defined($name) ? constant($name) : (is_null($value) ? null : (define($name, $value) ? $value : null)); 1861 } 1847 1862 1848 1863 /** trunk/lib/AkActionController.php
r285 r296 2473 2473 function sendDataAsStream($data, $options) 2474 2474 { 2475 $temp_file_name = tempnam(AK_ CACHE_DIR, Ak::randomString());2475 $temp_file_name = tempnam(AK_TMP_DIR, Ak::randomString()); 2476 2476 $fp = fopen($temp_file_name, 'w'); 2477 2477 fwrite($fp, $data); trunk/lib/AkActionView/helpers/file_upload_helper.php
r285 r296 51 51 * @param bool $send_json_response 52 52 */ 53 function handle_partial_upload($temporary_directory = AK_ CACHE_DIR, $send_json_response = true)53 function handle_partial_upload($temporary_directory = AK_TMP_DIR, $send_json_response = true) 54 54 { 55 55 $this->_instantiateCacheHandler(); trunk/lib/AkConverters/AkExcelToArray.php
r285 r296 51 51 $this->tmp_name = Ak::randomString(); 52 52 if(empty($this->source_file)){ 53 $this->source_file = AK_ CACHE_DIR.DS.$this->tmp_name.'.xls';53 $this->source_file = AK_TMP_DIR.DS.$this->tmp_name.'.xls'; 54 54 Ak::file_put_contents($this->source_file,$this->source); 55 55 $this->delete_source_file = true; trunk/lib/AkConverters/AkMsExcelToMany.php
r285 r296 42 42 $this->tmp_name = Ak::randomString(); 43 43 if(empty($this->source_file)){ 44 $this->source_file = AK_ CACHE_DIR.DS.$this->tmp_name.'.'.$this->ext;44 $this->source_file = AK_TMP_DIR.DS.$this->tmp_name.'.'.$this->ext; 45 45 Ak::file_put_contents($this->source_file,$this->source); 46 46 $this->delete_source_file = true; … … 53 53 $this->convert_to = !empty($this->convert_to) && empty($this->_file_type_codes[$this->convert_to]) ? 'csv' : (empty($this->convert_to) ? 'csv' : $this->convert_to); 54 54 $this->destination_file_name = empty($this->destination_file_name) ? $this->tmp_name.'.'.$this->convert_to : $this->destination_file_name.(strstr($this->destination_file_name,'.') ? '' : '.'.$this->convert_to); 55 $this->destination_file = empty($this->destination_file) ? AK_ CACHE_DIR.DS.$this->destination_file_name : $this->destination_file;55 $this->destination_file = empty($this->destination_file) ? AK_TMP_DIR.DS.$this->destination_file_name : $this->destination_file; 56 56 } 57 57 } trunk/lib/AkConverters/AkMsWordToMany.php
r285 r296 43 43 $this->tmp_name = Ak::randomString(); 44 44 if(empty($this->source_file)){ 45 $this->source_file = AK_ CACHE_DIR.DS.$this->tmp_name.'.'.$this->ext;45 $this->source_file = AK_TMP_DIR.DS.$this->tmp_name.'.'.$this->ext; 46 46 Ak::file_put_contents($this->source_file,$this->source); 47 47 $this->delete_source_file = true; … … 54 54 $this->convert_to = !empty($this->convert_to) && empty($this->_file_type_codes[$this->convert_to]) ? 'unicode' : (empty($this->convert_to) ? 'unicode' : $this->convert_to); 55 55 $this->destination_file_name = empty($this->destination_file_name) ? $this->tmp_name.'.'.$this->convert_to : $this->destination_file_name.(strstr($this->destination_file_name,'.') ? '' : '.'.$this->convert_to); 56 $this->destination_file = empty($this->destination_file) ? AK_ CACHE_DIR.DS.$this->destination_file_name : $this->destination_file;56 $this->destination_file = empty($this->destination_file) ? AK_TMP_DIR.DS.$this->destination_file_name : $this->destination_file; 57 57 } 58 58 } trunk/lib/AkConverters/AkXdocToText.php
r285 r296 46 46 $this->tmp_name = Ak::randomString(); 47 47 if(empty($this->source_file)){ 48 $this->source_file = AK_ CACHE_DIR.DS.$this->tmp_name.'.'.$this->ext;48 $this->source_file = AK_TMP_DIR.DS.$this->tmp_name.'.'.$this->ext; 49 49 Ak::file_put_contents($this->source_file,$this->source); 50 50 $this->delete_source_file = true; … … 57 57 $this->convert_to = 'txt'; 58 58 $this->destination_file_name = empty($this->destination_file_name) ? $this->tmp_name.'.'.$this->convert_to : $this->destination_file_name.(strstr($this->destination_file_name,'.') ? '' : '.'.$this->convert_to); 59 $this->destination_file = empty($this->destination_file) ? AK_ CACHE_DIR.DS.$this->destination_file_name : $this->destination_file;59 $this->destination_file = empty($this->destination_file) ? AK_TMP_DIR.DS.$this->destination_file_name : $this->destination_file; 60 60 } 61 61 trunk/lib/AkImage.php
r285 r296 48 48 function save($path = null, $quality = 90, $options = array()) 49 49 { 50 if(!$tmp_image_name = tempnam(AK_ CACHE_DIR,'ak_image_')){50 if(!$tmp_image_name = tempnam(AK_TMP_DIR,'ak_image_')){ 51 51 trigger_error(Ak::t('Could not create the temporary file %tmp_image_name for apliying changes and saving', array('%tmp_image_name'=>$tmp_image_name)), E_USER_ERROR); 52 52 } trunk/lib/AkImage/AkImageColorScheme.php
r285 r296 32 32 $this->Image =& new AkImage($image_path); 33 33 $this->Image->transform('resize',array('size'=>'24x24')); 34 $this->_tmp_file = AK_ CACHE_DIR.DS.'__AkImageColorScheme_'.Ak::randomString(32).'.jpg';34 $this->_tmp_file = AK_TMP_DIR.DS.'__AkImageColorScheme_'.Ak::randomString(32).'.jpg'; 35 35 $this->Image->save($this->_tmp_file); 36 36 } trunk/script/console
r278 r296 120 120 $result; 121 121 122 Ak::file_add_contents(AK_ CACHE_DIR.DS.'command_line.log',$promt_line.$command."\n".$result."\n");122 Ak::file_add_contents(AK_LOG_DIR.DS.'command_line.log',$promt_line.$command."\n".$result."\n"); 123 123 echo empty($result) ? $promt_line : "\n".$result."\n\n$promt_line"; 124 124 } trunk/test/unit/lib/utils/_Ak_file_functions.php
r279 r296 10 10 function Test_file_put_contents() 11 11 { 12 $file_name = AK_ CACHE_DIR.DS.'test_file_1.txt';12 $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 13 13 $content = 'This is the content of file 1'; 14 14 $this->assertFalse(!Ak::file_put_contents($file_name, $content)); … … 18 18 $this->assertFalse(!Ak::file_put_contents($file_name, $content)); 19 19 20 $file_name = AK_ CACHE_DIR.DS.'test_file_2.txt';20 $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 21 21 $content = "\n\rThis is the content of file 2\n"; 22 22 $this->assertFalse(!Ak::file_put_contents($file_name, $content)); … … 42 42 function Test_file_get_contents() 43 43 { 44 $file_name = AK_ CACHE_DIR.DS.'test_file_1.txt';44 $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 45 45 $content = 'This is the NEW content for file 1'; 46 46 $this->assertFalse(!Ak::file_get_contents($file_name) === $content); 47 47 48 $file_name = AK_ CACHE_DIR.DS.'test_file_2.txt';48 $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 49 49 $content = "\n\rThis is the content of file 2\n"; 50 50 $this->assertFalse(!Ak::file_get_contents($file_name) === $content); … … 62 62 function Test_copy_files() 63 63 { 64 $original_path = AK_ CACHE_DIR.DS.'test_file_1.txt';64 $original_path = AK_TMP_DIR.DS.'test_file_1.txt'; 65 65 $copy_path = $original_path.'.copy'; 66 66 $this->assertTrue(Ak::copy($original_path, $copy_path)); … … 82 82 function Test_file_delete() 83 83 { 84 $this->assertFalse(!Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_1.txt'));85 $this->assertFalse(!Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_2.txt'));86 $this->assertFalse(!Ak::file_delete( AK_CACHE_DIR.DS.'test_file_3.txt'));87 $this->assertFalse(!Ak::file_delete( AK_CACHE_DIR.'/test_file_4.txt'));84 $this->assertFalse(!Ak::file_delete(AK_TMP_DIR.DS.'test_file_1.txt')); 85 $this->assertFalse(!Ak::file_delete(AK_TMP_DIR.DS.'test_file_2.txt')); 86 $this->assertFalse(!Ak::file_delete('cache/test_file_3.txt')); 87 $this->assertFalse(!Ak::file_delete('cache/test_file_4.txt')); 88 88 $this->assertFalse(!Ak::file_delete('ak_test_folder/new_folder/test_file.txt')); 89 89 trunk/test/unit/lib/utils/_Ak_file_functions_over_ftp.php
r217 r296 15 15 function Test_file_put_contents() 16 16 { 17 $file_name = AK_ CACHE_DIR.DS.'test_file_1.txt';17 $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 18 18 $content = 'This is the content of file 1'; 19 19 $this->assertTrue(Ak::file_put_contents($file_name, $content)); … … 23 23 $this->assertTrue(Ak::file_put_contents($file_name, $content)); 24 24 25 $file_name = AK_ CACHE_DIR.DS.'test_file_2.txt';25 $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 26 26 $content = "\n\rThis is the content of file 2\n"; 27 27 $this->assertTrue(Ak::file_put_contents($file_name, $content)); … … 52 52 function Test_file_get_contents() 53 53 { 54 $file_name = AK_ CACHE_DIR.DS.'test_file_1.txt';55 $content = 'This is the NEW content for file 1'; 56 $this->assertTrue(Ak::file_get_contents($file_name) === $content); 57 58 $file_name = AK_ CACHE_DIR.DS.'test_file_2.txt';54 $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 55 $content = 'This is the NEW content for file 1'; 56 $this->assertTrue(Ak::file_get_contents($file_name) === $content); 57 58 $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 59 59 $content = "\n\rThis is the content of file 2\n"; 60 60 $this->assertTrue(Ak::file_get_contents($file_name) === $content); … … 76 76 function Test_file_delete() 77 77 { 78 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_1.txt'));79 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_2.txt'));80 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_3.txt'));81 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.'\test_file_4.txt'));78 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.DS.'test_file_1.txt')); 79 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.DS.'test_file_2.txt')); 80 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.DS.'test_file_3.txt')); 81 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.'\test_file_4.txt')); 82 82 $this->assertTrue(Ak::file_delete('ak_test_folder/new_folder/test_file.txt')); 83 83 $this->assertTrue(Ak::file_delete('ak_test_folder/folder with space/test file.txt')); … … 115 115 function Test_file_put_contents() 116 116 { 117 $file_name = AK_ CACHE_DIR.DS.'test_file_1.txt';117 $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 118 118 $content = 'This is the content of file 1'; 119 119 $this->assertTrue(Ak::file_put_contents($file_name, $content)); … … 123 123 $this->assertTrue(Ak::file_put_contents($file_name, $content)); 124 124 125 $file_name = AK_ CACHE_DIR.DS.'test_file_2.txt';125 $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 126 126 $content = "\n\rThis is the content of file 2\n"; 127 127 $this->assertTrue(Ak::file_put_contents($file_name, $content)); … … 146 146 function Test_file_get_contents() 147 147 { 148 $file_name = AK_ CACHE_DIR.DS.'test_file_1.txt';149 $content = 'This is the NEW content for file 1'; 150 $this->assertTrue(Ak::file_get_contents($file_name) === $content); 151 152 $file_name = AK_ CACHE_DIR.DS.'test_file_2.txt';148 $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 149 $content = 'This is the NEW content for file 1'; 150 $this->assertTrue(Ak::file_get_contents($file_name) === $content); 151 152 $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 153 153 $content = "\n\rThis is the content of file 2\n"; 154 154 $this->assertTrue(Ak::file_get_contents($file_name) === $content); … … 166 166 function Test_file_delete() 167 167 { 168 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_1.txt'));169 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_2.txt'));170 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.DS.'test_file_3.txt'));171 $this->assertTrue(Ak::file_delete(AK_ CACHE_DIR.'\test_file_4.txt'));168 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.DS.'test_file_1.txt')); 169 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.DS.'test_file_2.txt')); 170 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.DS.'test_file_3.txt')); 171 $this->assertTrue(Ak::file_delete(AK_TMP_DIR.'\test_file_4.txt')); 172 172 $this->assertTrue(Ak::file_delete('ak_test_folder/new_folder/test_file.txt')); 173 173
