public function memoryAllocate($w, $h)
 {
     $mem_used = function_exists('memory_get_usage') ? @memory_get_usage() : 4000000;
     $mem_limit = @ini_get('memory_limit');
     if ($mem_used || $mem_limit) {
         $mem_limit = files::str2bytes($mem_limit);
         $mem_avail = $mem_limit - $mem_used - 512 * 1024;
         $mem_needed = $w * $h * 8;
         if ($mem_needed > $mem_avail) {
             if (@ini_set('memory_limit', $mem_limit + $mem_needed + $mem_used) === false) {
                 throw new Exception(__('Not enough memory to open image.'));
             }
             if (!$this->memory_limit) {
                 $this->memory_limit = $mem_limit;
             }
         }
     }
 }
Example #2
0
        }
        setcookie('okt_disable_browser_check', true, 0, $okt->config->app_path, '', isset($_SERVER['HTTPS']));
        unset($oMobileDetect);
    } elseif (!empty($_COOKIE['okt_use_mobile_theme']) && !empty($okt->config->theme_mobile)) {
        $sOktTheme = $okt->config->theme_mobile;
    } elseif (!empty($_COOKIE['okt_use_tablet_theme']) && !empty($okt->config->theme_tablet)) {
        $sOktTheme = $okt->config->theme_tablet;
    }
}
# URL du thème
define('OKT_THEME', $okt->config->app_path . OKT_THEMES_DIR . '/' . $sOktTheme);
# Chemin du thème
define('OKT_THEME_PATH', OKT_THEMES_PATH . '/' . $sOktTheme);
# Store upload_max_filesize in bytes
$u_max_size = files::str2bytes(ini_get('upload_max_filesize'));
$p_max_size = files::str2bytes(ini_get('post_max_size'));
if ($p_max_size < $u_max_size) {
    $u_max_size = $p_max_size;
}
define('OKT_MAX_UPLOAD_SIZE', $u_max_size);
unset($u_max_size, $p_max_size);
# Mode debug ?
if ((!OKT_XDEBUG || !$okt->config->xdebug_enabled) && (defined('OKT_FORCE_DEBUG') || $okt->config->debug_enabled)) {
    define('OKT_DEBUG', true);
} else {
    define('OKT_DEBUG', false);
}
if (OKT_DEBUG) {
    $okt->debug = new oktDebug();
    error_reporting(-1);
    ini_set('display_errors', 'On');