Dependancy extensions safety checks

This commit is contained in:
Marcin Kurczewski 2013-11-13 23:36:58 +01:00
parent 8cd457848c
commit 9ec269330c
3 changed files with 18 additions and 6 deletions

View file

@ -50,7 +50,7 @@ download('http://raw.github.com/aehlke/tag-it/master/css/jquery.tagit.css', $lib
download('http://raw.github.com/aehlke/tag-it/master/js/tag-it.min.js', $libPath . 'tagit' . DS . 'jquery.tagit.js');
//Mousetrap
download('https://raw.github.com/ccampbell/mousetrap/master/mousetrap.min.js', $libPath . 'mousetrap' . DS . 'mousetrap.min.js');
download('http://raw.github.com/ccampbell/mousetrap/master/mousetrap.min.js', $libPath . 'mousetrap' . DS . 'mousetrap.min.js');
//fonts
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans.ttf', $fontsPath . 'DroidSans.ttf');

View file

@ -243,7 +243,14 @@ class PostController
/* file details */
$mimeType = $sourcePath ? mime_content_type($sourcePath) : null;
$mimeType = null;
if ($sourcePath)
{
if (function_exists('mime_content_type'))
$mimeType = mime_content_type($sourcePath);
else
$mimeType = $suppliedFile['type'];
}
$imageWidth = null;
$imageHeight = null;
switch ($mimeType)

View file

@ -11,16 +11,21 @@ function trueStartTime()
}
trueStartTime();
require_once __DIR__ . '/../lib/php-markdown/Michelf/Markdown.php';
require_once __DIR__ . '/../lib/redbean/RedBean/redbean.inc.php';
require_once __DIR__ . '/../lib/chibi-core/Facade.php';
require_once __DIR__ . '/../lib/chibi-core/Registry.php';
$requiredExtensions = ['pdo', 'pdo_sqlite', 'gd', 'openssl'];
foreach ($requiredExtensions as $ext)
if (!extension_loaded($ext))
die('PHP extension "' . $ext . '" must be enabled to continue.' . PHP_EOL);
date_default_timezone_set('UTC');
setlocale(LC_CTYPE, 'en_US.UTF-8');
ini_set('memory_limit', '128M');
define('DS', DIRECTORY_SEPARATOR);
require_once __DIR__ . '/../lib/php-markdown/Michelf/Markdown.php';
require_once __DIR__ . '/../lib/redbean/RedBean/redbean.inc.php';
require_once __DIR__ . '/../lib/chibi-core/Facade.php';
require_once __DIR__ . '/../lib/chibi-core/Registry.php';
function configFactory()
{
static $config = null;