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'); download('http://raw.github.com/aehlke/tag-it/master/js/tag-it.min.js', $libPath . 'tagit' . DS . 'jquery.tagit.js');
//Mousetrap //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 //fonts
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans.ttf', $fontsPath . 'DroidSans.ttf'); download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans.ttf', $fontsPath . 'DroidSans.ttf');

View file

@ -243,7 +243,14 @@ class PostController
/* file details */ /* 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; $imageWidth = null;
$imageHeight = null; $imageHeight = null;
switch ($mimeType) switch ($mimeType)

View file

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