Internals (II)
This commit is contained in:
parent
998ec79740
commit
a3aa9c3077
4 changed files with 22 additions and 28 deletions
21
init.php
21
init.php
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
require_once 'src/core.php';
|
||||
|
||||
function download($source, $destination)
|
||||
{
|
||||
$content = file_get_contents($source);
|
||||
|
@ -7,17 +9,20 @@ function download($source, $destination)
|
|||
file_put_contents($destination, $content);
|
||||
}
|
||||
|
||||
$path = './public_html/';
|
||||
$config = configFactory();
|
||||
$cssPath = $config->main->mediaPath . DS . 'css' . DS;
|
||||
$jsPath = $config->main->mediaPath . DS . 'js' . DS;
|
||||
$fontsPath = $config->main->mediaPath . DS . 'fonts' . DS;
|
||||
|
||||
//jQuery
|
||||
download('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', $path . 'media/js/jquery.min.js');
|
||||
download('http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', $path . 'media/js/jquery-ui.min.js');
|
||||
download('http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css', $path . 'media/css/jquery-ui.css');
|
||||
download('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', $jsPath . 'jquery.min.js');
|
||||
download('http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', $jsPath . 'jquery-ui.min.js');
|
||||
download('http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css', $cssPath . 'jquery-ui.css');
|
||||
|
||||
//jQuery Tag-it!
|
||||
download('http://raw.github.com/aehlke/tag-it/master/css/jquery.tagit.css', $path . 'media/css/jquery.tagit.css');
|
||||
download('http://raw.github.com/aehlke/tag-it/master/js/tag-it.min.js', $path . 'media/js/jquery.tagit.js');
|
||||
download('http://raw.github.com/aehlke/tag-it/master/css/jquery.tagit.css', $cssPath . 'jquery.tagit.css');
|
||||
download('http://raw.github.com/aehlke/tag-it/master/js/tag-it.min.js', $jsPath . 'jquery.tagit.js');
|
||||
|
||||
//fonts
|
||||
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans.ttf', $path . 'media/fonts/DroidSans.ttf');
|
||||
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans-Bold.ttf', $path . 'media/fonts/DroidSans-Bold.ttf');
|
||||
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans.ttf', $fontsPath . 'DroidSans.ttf');
|
||||
download('http://googlefontdirectory.googlecode.com/hg/apache/droidsans/DroidSans-Bold.ttf', $fontsPath . 'DroidSans-Bold.ttf');
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8488232806fd5ceecb25af39036f250b081ada3d
|
||||
Subproject commit b5876a672d107e4d6599cec52b9fa36e5558c16b
|
|
@ -1,18 +1,7 @@
|
|||
<?php
|
||||
chdir('..');
|
||||
require_once 'lib/redbean/RedBean/redbean.inc.php';
|
||||
require_once 'lib/chibi-core/Facade.php';
|
||||
require_once 'src/core.php';
|
||||
require_once 'src/Bootstrap.php';
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
setlocale(LC_CTYPE, 'en_US.UTF-8');
|
||||
|
||||
$query = $_SERVER['REQUEST_URI'];
|
||||
$configPaths =
|
||||
[
|
||||
__DIR__ . DIRECTORY_SEPARATOR . '../config.ini',
|
||||
__DIR__ . DIRECTORY_SEPARATOR . '../local.ini'
|
||||
];
|
||||
$configPaths = array_filter($configPaths, 'file_exists');
|
||||
|
||||
\Chibi\Facade::run($query, $configPaths, new Bootstrap());
|
||||
\Chibi\Facade::run($query, configFactory(), new Bootstrap());
|
||||
|
|
|
@ -157,7 +157,7 @@ class PostController
|
|||
do
|
||||
{
|
||||
$name = md5(mt_rand() . uniqid());
|
||||
$path = $this->config->main->filesPath . DIRECTORY_SEPARATOR . $name;
|
||||
$path = $this->config->main->filesPath . DS . $name;
|
||||
}
|
||||
while (file_exists($path));
|
||||
|
||||
|
@ -228,10 +228,10 @@ class PostController
|
|||
PrivilegesHelper::confirmWithException($this->context->user, Privilege::ViewPost);
|
||||
PrivilegesHelper::confirmWithException($this->context->user, Privilege::ViewPost, PostSafety::toString($post->safety));
|
||||
|
||||
$path = $this->config->main->thumbsPath . DIRECTORY_SEPARATOR . $post->name . '.png';
|
||||
$path = $this->config->main->thumbsPath . DS . $post->name . '.png';
|
||||
if (!file_exists($path))
|
||||
{
|
||||
$srcPath = $this->config->main->thumbsPath . DIRECTORY_SEPARATOR . $post->name;
|
||||
$srcPath = $this->config->main->thumbsPath . DS . $post->name;
|
||||
$dstPath = $path;
|
||||
$dstWidth = $this->config->browsing->thumbWidth;
|
||||
$dstHeight = $this->config->browsing->thumbHeight;
|
||||
|
@ -248,10 +248,10 @@ class PostController
|
|||
$srcImage = imagecreatefromgif($srcPath);
|
||||
break;
|
||||
case 'application/x-shockwave-flash':
|
||||
$path = $this->config->main->mediaPath . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'thumb-swf.png';
|
||||
$path = $this->config->main->mediaPath . DS . 'img' . DS . 'thumb-swf.png';
|
||||
break;
|
||||
default:
|
||||
$path = $this->config->main->mediaPath . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'thumb.png';
|
||||
$path = $this->config->main->mediaPath . DS . 'img' . DS . 'thumb.png';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ class PostController
|
|||
PrivilegesHelper::confirmWithException($this->context->user, Privilege::RetrievePost);
|
||||
PrivilegesHelper::confirmWithException($this->context->user, Privilege::RetrievePost, PostSafety::toString($post->safety));
|
||||
|
||||
$path = $this->config->main->filesPath . DIRECTORY_SEPARATOR . $post->name;
|
||||
$path = $this->config->main->filesPath . DS . $post->name;
|
||||
if (!file_exists($path))
|
||||
throw new SimpleException('Post file does not exist');
|
||||
if (!is_readable($path))
|
||||
|
|
Loading…
Reference in a new issue