Changeset 296

Show
Ignore:
Timestamp:
07/30/07 09:47:34 (1 year ago)
Author:
bermiferrer
Message:

Some big changes are being introduced on this commit.

The first is related on the way that Akelos bootstraps.

Before this commit the file config/boot.php contained most of Akelos environment guessing code. It was the place were constants were defined.

That made users have to update their config/boot.php file every time the file was updated which was too frequently.

From now ahead constants are defined at lib/constants.php which is in the framework path instead of in the application path.

config/boot.php will just lookup for the framework and base dir and that will hardly change at all.

The other change is related with the reduction of writable paths in Akelos.
The default location of the cache directory has moved to the newly created ./tmp/cache directory.

Temporary data now resides at ./tmp instead of previous ./cache/tmp

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/framework_setup_controller.php

    r215 r296  
    188188                $this->FrameworkSetup->relativizeStylesheetPaths(); 
    189189                $this->FrameworkSetup->removeSetupFiles(); 
    190                  
     190                unset($_SESSION); 
    191191                $this->redirectTo(array('controller'=>'page')); 
    192192            } 
  • trunk/config/boot.php

    r295 r296  
    11<?php 
    22 
    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.php 
    5  
    63/** 
    7  * This function sets a constant and returns it's value. If constant has been already defined it 
    8  * will reutrn its original value.  
     4 * This file and the lib/constants.php file perform most part of Akelos  
     5 * environment guessing. 
    96 *  
    10  * Returns null in case the constant does not exist 
     7 * You can retrieve a list of current settings by running Ak::get_constants(); 
    118 * 
    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/* 
    1416 */ 
    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  
    2217 
    2318defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); 
    24  
    2519defined('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.php 
    30 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 files 
    47 // auto will enable all the locales at config/locales/ dir 
    48 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 requests 
    52 // 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 webserver 
    59  
    60 // COMMENT THIS LINE IF YOU DONT WANT THE FRAMEWORK TO CONNECT TO THE DATABASE ON EACH REQUEST AUTOMATICALLY 
    61 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. 
    9120defined('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'); 
    9521defined('AK_LIB_DIR') ? null : define('AK_LIB_DIR',AK_FRAMEWORK_DIR.DS.'lib'); 
    9622 
    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  
     23require_once(AK_LIB_DIR.DS.'constants.php'); 
    21424require_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  
    22725require_once(AK_LIB_DIR.DS.'AkActionController.php'); 
    22826 
  • trunk/index.php

    r293 r296  
    1515 */ 
    1616 
     17// Use the command line installer to only make your public the only public accesible point. 
     18define('AK_INSECURE_APP_DIRECTORY_LAYOUT', true); 
    1719include('public'.DIRECTORY_SEPARATOR.'index.php'); 
    1820 
  • trunk/lib/Ak.php

    r291 r296  
    12531253    { 
    12541254        $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; 
    12571257 
    12581258        if(@Ak::file_put_contents($uncompressed_file, $data)){ 
     
    12661266            gzclose($compressed); 
    12671267        }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); 
    12691269        } 
    12701270        $result = Ak::file_get_contents($compressed_file); 
     
    12751275    { 
    12761276        $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; 
    12791279 
    12801280        if(@Ak::file_put_contents($compressed_file, $compressed_data)){ 
     
    12881288            fclose($uncompressed); 
    12891289        }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); 
    12911291        } 
    12921292        $result = Ak::file_get_contents($uncompressed_file); 
     
    18451845} 
    18461846 
     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 */ 
     1856function 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} 
    18471862 
    18481863/** 
  • trunk/lib/AkActionController.php

    r285 r296  
    24732473    function sendDataAsStream($data, $options) 
    24742474    { 
    2475         $temp_file_name = tempnam(AK_CACHE_DIR, Ak::randomString()); 
     2475        $temp_file_name = tempnam(AK_TMP_DIR, Ak::randomString()); 
    24762476        $fp = fopen($temp_file_name, 'w'); 
    24772477        fwrite($fp, $data); 
  • trunk/lib/AkActionView/helpers/file_upload_helper.php

    r285 r296  
    5151     * @param bool $send_json_response 
    5252     */ 
    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) 
    5454    { 
    5555        $this->_instantiateCacheHandler(); 
  • trunk/lib/AkConverters/AkExcelToArray.php

    r285 r296  
    5151        $this->tmp_name = Ak::randomString(); 
    5252        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'; 
    5454            Ak::file_put_contents($this->source_file,$this->source); 
    5555            $this->delete_source_file = true; 
  • trunk/lib/AkConverters/AkMsExcelToMany.php

    r285 r296  
    4242        $this->tmp_name = Ak::randomString(); 
    4343        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; 
    4545            Ak::file_put_contents($this->source_file,$this->source); 
    4646            $this->delete_source_file = true; 
     
    5353        $this->convert_to = !empty($this->convert_to) && empty($this->_file_type_codes[$this->convert_to]) ? 'csv' : (empty($this->convert_to) ? 'csv' : $this->convert_to); 
    5454        $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; 
    5656    } 
    5757} 
  • trunk/lib/AkConverters/AkMsWordToMany.php

    r285 r296  
    4343        $this->tmp_name = Ak::randomString(); 
    4444        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; 
    4646            Ak::file_put_contents($this->source_file,$this->source); 
    4747            $this->delete_source_file = true; 
     
    5454        $this->convert_to = !empty($this->convert_to) && empty($this->_file_type_codes[$this->convert_to]) ? 'unicode' : (empty($this->convert_to) ? 'unicode' : $this->convert_to); 
    5555        $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; 
    5757    } 
    5858} 
  • trunk/lib/AkConverters/AkXdocToText.php

    r285 r296  
    4646        $this->tmp_name = Ak::randomString(); 
    4747        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; 
    4949            Ak::file_put_contents($this->source_file,$this->source); 
    5050            $this->delete_source_file = true; 
     
    5757        $this->convert_to = 'txt'; 
    5858        $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; 
    6060    } 
    6161 
  • trunk/lib/AkImage.php

    r285 r296  
    4848     function save($path = null, $quality = 90, $options = array()) 
    4949     { 
    50          if(!$tmp_image_name = tempnam(AK_CACHE_DIR,'ak_image_')){ 
     50         if(!$tmp_image_name = tempnam(AK_TMP_DIR,'ak_image_')){ 
    5151             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); 
    5252         } 
  • trunk/lib/AkImage/AkImageColorScheme.php

    r285 r296  
    3232        $this->Image =& new AkImage($image_path); 
    3333        $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'; 
    3535        $this->Image->save($this->_tmp_file); 
    3636    } 
  • trunk/script/console

    r278 r296  
    120120            $result; 
    121121 
    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"); 
    123123            echo empty($result) ? $promt_line : "\n".$result."\n\n$promt_line"; 
    124124        } 
  • trunk/test/unit/lib/utils/_Ak_file_functions.php

    r279 r296  
    1010    function Test_file_put_contents() 
    1111    { 
    12         $file_name = AK_CACHE_DIR.DS.'test_file_1.txt'; 
     12        $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 
    1313        $content = 'This is the content of file 1'; 
    1414        $this->assertFalse(!Ak::file_put_contents($file_name, $content)); 
     
    1818        $this->assertFalse(!Ak::file_put_contents($file_name, $content)); 
    1919         
    20         $file_name = AK_CACHE_DIR.DS.'test_file_2.txt'; 
     20        $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 
    2121        $content = "\n\rThis is the content of file 2\n"; 
    2222        $this->assertFalse(!Ak::file_put_contents($file_name, $content)); 
     
    4242   function Test_file_get_contents() 
    4343   { 
    44        $file_name = AK_CACHE_DIR.DS.'test_file_1.txt'; 
     44       $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 
    4545       $content = 'This is the NEW content for file 1'; 
    4646       $this->assertFalse(!Ak::file_get_contents($file_name) === $content); 
    4747        
    48        $file_name = AK_CACHE_DIR.DS.'test_file_2.txt'; 
     48       $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 
    4949       $content = "\n\rThis is the content of file 2\n"; 
    5050       $this->assertFalse(!Ak::file_get_contents($file_name) === $content); 
     
    6262   function Test_copy_files() 
    6363    { 
    64         $original_path = AK_CACHE_DIR.DS.'test_file_1.txt'; 
     64        $original_path = AK_TMP_DIR.DS.'test_file_1.txt'; 
    6565        $copy_path = $original_path.'.copy'; 
    6666        $this->assertTrue(Ak::copy($original_path, $copy_path)); 
     
    8282    function Test_file_delete() 
    8383    { 
    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')); 
    8888        $this->assertFalse(!Ak::file_delete('ak_test_folder/new_folder/test_file.txt')); 
    8989 
  • trunk/test/unit/lib/utils/_Ak_file_functions_over_ftp.php

    r217 r296  
    1515    function Test_file_put_contents() 
    1616    { 
    17         $file_name = AK_CACHE_DIR.DS.'test_file_1.txt'; 
     17        $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 
    1818        $content = 'This is the content of file 1'; 
    1919        $this->assertTrue(Ak::file_put_contents($file_name, $content)); 
     
    2323        $this->assertTrue(Ak::file_put_contents($file_name, $content)); 
    2424         
    25         $file_name = AK_CACHE_DIR.DS.'test_file_2.txt'; 
     25        $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 
    2626        $content = "\n\rThis is the content of file 2\n"; 
    2727        $this->assertTrue(Ak::file_put_contents($file_name, $content)); 
     
    5252    function Test_file_get_contents() 
    5353    { 
    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'; 
    5959        $content = "\n\rThis is the content of file 2\n"; 
    6060        $this->assertTrue(Ak::file_get_contents($file_name) === $content); 
     
    7676    function Test_file_delete() 
    7777    { 
    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')); 
    8282        $this->assertTrue(Ak::file_delete('ak_test_folder/new_folder/test_file.txt')); 
    8383        $this->assertTrue(Ak::file_delete('ak_test_folder/folder with space/test file.txt')); 
     
    115115    function Test_file_put_contents() 
    116116    { 
    117         $file_name = AK_CACHE_DIR.DS.'test_file_1.txt'; 
     117        $file_name = AK_TMP_DIR.DS.'test_file_1.txt'; 
    118118        $content = 'This is the content of file 1'; 
    119119        $this->assertTrue(Ak::file_put_contents($file_name, $content)); 
     
    123123        $this->assertTrue(Ak::file_put_contents($file_name, $content)); 
    124124         
    125         $file_name = AK_CACHE_DIR.DS.'test_file_2.txt'; 
     125        $file_name = AK_TMP_DIR.DS.'test_file_2.txt'; 
    126126        $content = "\n\rThis is the content of file 2\n"; 
    127127        $this->assertTrue(Ak::file_put_contents($file_name, $content)); 
     
    146146    function Test_file_get_contents() 
    147147    { 
    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'; 
    153153        $content = "\n\rThis is the content of file 2\n"; 
    154154        $this->assertTrue(Ak::file_get_contents($file_name) === $content); 
     
    166166    function Test_file_delete() 
    167167    { 
    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')); 
    172172        $this->assertTrue(Ak::file_delete('ak_test_folder/new_folder/test_file.txt')); 
    173173