summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorPaul Merrill <napalminc@gmail.com>2010-11-04 05:16:13 -0700
committerPaul Merrill <napalminc@gmail.com>2010-11-04 05:16:13 -0700
commit4f8bd4da1f515a10326022f6cc58e3c0c54812aa (patch)
treefa9f37d9490e0aaaa3e538214a18e1e19cecfddc /inc
parent5805de70b42d8674bcfd96cf57192f6c4a641d2c (diff)
parentf9357612af9660968d57947e8e4b303c7e0536ea (diff)
Merge branch 'sti'
Conflicts: inc/config.php inc/functions.php post.php
Diffstat (limited to 'inc')
-rw-r--r--inc/config.php8
-rw-r--r--inc/functions.php52
2 files changed, 58 insertions, 2 deletions
diff --git a/inc/config.php b/inc/config.php
index fbaca0d8..13c8e9e1 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -53,6 +53,10 @@
define('MAX_WIDTH', 10000);
define('MAX_HEIGHT', MAX_WIDTH);
+ define('ALLOW_ZIP', true);
+ define('ZIP_IMAGE', 'src/zip.png');
+
+
/**
Redraw the image using GD functions to strip any excess data (commonly ZIP archives)
WARNING: Very beta. Currently strips animated GIFs too :(
@@ -63,7 +67,7 @@
define('REDRAW_GIF', false);
// Display the aspect ratio in a post's file info
- define('SHOW_RATIO', false);
+ define('SHOW_RATIO', true);
define('DIR_IMG', 'src/');
define('DIR_THUMB', 'thumb/');
@@ -92,7 +96,7 @@
define('URL_MATCH', '/^' . (@$_SERVER['HTTPS']?'https':'http').':\/\/'.$_SERVER['HTTP_HOST'] . '(' . preg_quote(ROOT, '/') . '|' . preg_quote(ROOT, '/') . '' . preg_quote(FILE_INDEX, '/') . '|' . preg_quote(ROOT, '/') . '' . str_replace('%d', '\d+', preg_quote(FILE_PAGE, '/')) . ')$/');
- if(!defined(IS_INSTALLATION)) {
+ if(!defined('IS_INSTALLATION')) {
if(!file_exists(DIR_IMG)) @mkdir(DIR_IMG) or error("Couldn't create " . DIR_IMG . ". Install manually.");
if(!file_exists(DIR_THUMB)) @mkdir(DIR_THUMB) or error("Couldn't create " . DIR_IMG . ". Install manually.");
if(!file_exists(DIR_RES)) @mkdir(DIR_RES) or error("Couldn't create " . DIR_IMG . ". Install manually.");
diff --git a/inc/functions.php b/inc/functions.php
index 10f23e7f..ad658295 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -24,6 +24,58 @@
}
}
+ function post($post, $OP) {
+ global $sql;
+ if($OP) {
+ mysql_query(
+ sprintf("INSERT INTO `posts` VALUES ( NULL, NULL, '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s' )",
+ $post['subject'],
+ $post['email'],
+ $post['name'],
+ $post['trip'],
+ $post['body'],
+ time(),
+ time(),
+ $post['thumb'],
+ $post['thumbwidth'],
+ $post['thumbheight'],
+ $post['file'],
+ $post['width'],
+ $post['height'],
+ $post['filesize'],
+ $post['filename'],
+ $post['filehash'],
+ $post['password'],
+ mysql_real_escape_string($_SERVER['REMOTE_ADDR'])
+ ), $sql) or error(mysql_error($sql));
+ return mysql_insert_id($sql);
+ } else {
+ mysql_query(
+ sprintf("INSERT INTO `posts` VALUES ( NULL, '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d', '%d', '%s', '%s', '%s', '%s' )",
+ $post['thread'],
+ $post['subject'],
+ $post['email'],
+ $post['name'],
+ $post['trip'],
+ $post['body'],
+ time(),
+ time(),
+ $post['has_file']?$post['thumb']:null,
+ $post['has_file']?$post['thumbwidth']:null,
+ $post['has_file']?$post['thumbheight']:null,
+ $post['has_file']?$post['file']:null,
+ $post['has_file']?$post['width']:null,
+ $post['has_file']?$post['height']:null,
+ $post['has_file']?$post['filesize']:null,
+ $post['has_file']?$post['filename']:null,
+ $post['has_file']?$post['filehash']:null,
+ $post['password'],
+ mysql_real_escape_string($_SERVER['REMOTE_ADDR'])
+ ), $sql) or error(mysql_error($sql));
+ return mysql_insert_id($sql);
+ }
+ }
+
function index($page) {
global $sql, $board;