Add new directory structure. Tags will contain current and past releases, and stable will contain any bug fixes to the current stable release so users won't have to get the potentially broken trunk build to fix a screwup in stable.

Trunk updated to 0.9

git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@176 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee
This commit is contained in:
Sazpaimon committed 2009-05-27 06:37:50 +00:00
commit 88bacfad9c
316 files changed
+79806

No files matched your search

+135
View File
@@ -0,0 +1,135 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Bans Class
*
* Assorted banning-related functions placed into class format
*
* @package kusaba
*/
class Bans {
/* Perform a check for a ban record for a specified IP address */
function BanCheck($ip, $board = '', $force_display = false) {
global $tc_db;
if (!isset($_COOKIE['tc_previousip'])) {
$_COOKIE['tc_previousip'] = '';
}
$bans = Array();
$results = $tc_db->GetAll("SELECT * FROM `".KU_DBPREFIX."banlist` WHERE ((`type` = '0' AND ( `ipmd5` = '" . md5($ip) . "' OR `ipmd5` = '". md5($_COOKIE['tc_previousip']) . "' )) OR `type` = '1') AND (`expired` = 0)" );
if (count($results)>0) {
foreach($results AS $line) {
if(($line['type'] == 1 && strpos($ip, md5_decrypt($line['ip'], KU_RANDOMSEED)) === 0) || $line['type'] == 0) {
if ($line['until'] != 0 && $line['until'] < time()){
$tc_db->Execute("UPDATE `".KU_DBPREFIX."banlist` SET `expired` = 1 WHERE `id` = ".$line['id']);
$line['expired'] = 1;
$this->UpdateHtaccess();
}
if ($line['globalban']!=1) {
if ((in_array($board, explode('|', $line['boards'])) || $board == '')) {
$line['appealin'] = substr(timeDiff($line['appealat'], true, 2), 0, -1);
$bans[] = $line;
}
} else {
$line['appealin'] = substr(timeDiff($line['appealat'], true, 2), 0, -1);
$bans[] = $line;
}
}
}
}
if(count($bans) > 0){
$tc_db->Execute("END TRANSACTION");
echo $this->DisplayBannedMessage($bans);
die();
}
if ($force_display) {
/* Instructed to display a page whether banned or not, so we will inform them today is their rucky day */
echo '<title>'._gettext('YOU ARE NOT BANNED!').'</title><div align="center"><img src="'. KU_WEBFOLDER .'youarenotbanned.jpg"><br /><br />'._gettext('Unable to find record of your IP being banned.').'</div>';
} else {
return true;
}
}
/* Add a ip/ip range ban */
function BanUser($ip, $modname, $globalban, $duration, $boards, $reason, $staffnote, $appealat=0, $type=0, $allowread=1, $proxyban=false) {
global $tc_db;
if ($duration>0) {
$ban_globalban = '0';
} else {
$ban_globalban = '1';
}
if ($duration>0) {
$ban_until = time()+$duration;
} else {
$ban_until = '0';
}
$tc_db->Execute("INSERT INTO `".KU_DBPREFIX."banlist` ( `ip` , `ipmd5` , `type` , `allowread` , `globalban` , `boards` , `by` , `at` , `until` , `reason`, `staffnote`, `appealat` ) VALUES ( ".$tc_db->qstr(md5_encrypt($ip, KU_RANDOMSEED))." , '".md5($ip)."' , '".$type."' , '".$allowread."' , '".$globalban."' , '".$boards."' , '".$modname."' , '".time()."' , ".$tc_db->qstr($ban_until)." , ".$reason." , ".$staffnote.", ".$appealat." ) ");
if (!$proxyban && $type == 1) {
$this->UpdateHtaccess();
}
return true;
}
/* Return the page which will inform the user a quite unfortunate message */
function DisplayBannedMessage($bans, $board='') {
/* Set a cookie with the users current IP address in case they use a proxy to attempt to make another post */
setcookie('tc_previousip', $_SERVER['REMOTE_ADDR'], (time() + 604800), KU_BOARDSFOLDER);
require_once KU_ROOTDIR . 'lib/dwoo.php';
$dwoo_data->assign('bans', $bans);
return $dwoo->get(KU_TEMPLATEDIR .'/banned.tpl', $dwoo_data);
}
function UpdateHtaccess() {
global $tc_db;
$htaccess_contents = file_get_contents(KU_BOARDSDIR.'.htaccess');
$htaccess_contents_preserve = substr($htaccess_contents, 0, strpos($htaccess_contents, '## !KU_BANS:')+12)."\n";
$htaccess_contents_bans_iplist = '';
$results = $tc_db->GetAll("SELECT `ip` FROM `".KU_DBPREFIX."banlist` WHERE `allowread` = 0 AND `type` = 0 AND (`expired` = 1) ORDER BY `ip` ASC");
if (count($results) > 0) {
$htaccess_contents_bans_iplist .= 'RewriteCond %{REMOTE_ADDR} (';
foreach($results AS $line) {
$htaccess_contents_bans_iplist .= str_replace('.', '\\.', md5_decrypt($line['ip'], KU_RANDOMSEED)) . '|';
}
$htaccess_contents_bans_iplist = substr($htaccess_contents_bans_iplist, 0, -1);
$htaccess_contents_bans_iplist .= ')$' . "\n";
}
if ($htaccess_contents_bans_iplist!='') {
$htaccess_contents_bans_start = "<IfModule mod_rewrite.c>\nRewriteEngine On\n";
$htaccess_contents_bans_end = "RewriteRule !^(banned.php|youarebanned.jpg|favicon.ico|css/site_futaba.css)$ " . KU_BOARDSFOLDER . "banned.php [L]\n</IfModule>";
} else {
$htaccess_contents_bans_start = '';
$htaccess_contents_bans_end = '';
}
$htaccess_contents_new = $htaccess_contents_preserve.$htaccess_contents_bans_start.$htaccess_contents_bans_iplist.$htaccess_contents_bans_end;
file_put_contents(KU_BOARDSDIR.'.htaccess', $htaccess_contents_new);
}
}
?>
+949
View File
@@ -0,0 +1,949 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Board and Post classes
*
* @package kusaba
*/
/**
* Board class
*
* Contains all board configurations. This class handles all board page
* rendering, using the templates
*
* @package kusaba
*
* TODO: replace repetitive code blocks with functions.
*/
class Board {
/* Declare the public variables */
/**
* Array to hold the boards settings
*/
var $board = array();
/**
* Archive directory, set when archiving is enabled
*
* @var string Archive directory
*/
var $archive_dir;
/**
* Dwoo class
*
* @var class Dwoo
*/
var $dwoo;
/**
* Dwoo data class
*
* @var class Dwoo
*/
var $dwoo_data;
/**
* Load balancer class
*
* @var class Load balancer
*/
var $loadbalancer;
/**
* Initialization function for the Board class, which is called when a new
* instance of this class is created. Takes a board directory as an
* argument
*
* @param string $board Board name/directory
* @param boolean $extra grab additional data for page generation purposes. Only false if all that's needed is the board info.
* @return class
*/
function Board($board, $extra = true) {
global $tc_db, $CURRENTLOCALE;
// If the instance was created with the board argument present, get all of the board info and configuration values and save it inside of the class
if ($board!='') {
$query = "SELECT * FROM `".KU_DBPREFIX."boards` WHERE `name` = ".$tc_db->qstr($board)." LIMIT 1";
$results = $tc_db->GetAll($query);
foreach ($results[0] as $key=>$line) {
if (!is_numeric($key)) {
$this->board[$key] = $line;
}
}
// Type
$types = array('img', 'txt', 'oek', 'upl');
$this->board['text_readable'] = $types[$this->board['type']];
if ($extra) {
// Boardlist
$this->board['boardlist'] = $this->DisplayBoardList();
// Get the unique posts for this board
$this->board['uniqueposts'] = $tc_db->GetOne("SELECT COUNT(DISTINCT `ipmd5`) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']. " AND `IS_DELETED` = 0");
if($this->board['type'] != 1) {
$this->board['filetypes_allowed'] = $tc_db->GetAll("SELECT ".KU_DBPREFIX."filetypes.filetype FROM ".KU_DBPREFIX."boards, ".KU_DBPREFIX."filetypes, ".KU_DBPREFIX."board_filetypes WHERE ".KU_DBPREFIX."boards.id = " . $this->board['id'] . " AND ".KU_DBPREFIX."board_filetypes.boardid = " . $this->board['id'] . " AND ".KU_DBPREFIX."board_filetypes.typeid = ".KU_DBPREFIX."filetypes.id ORDER BY ".KU_DBPREFIX."filetypes.filetype ASC;");
}
$this->board['loadbalanceurl_formatted'] = ($this->board['loadbalanceurl'] != '') ? substr($this->board['loadbalanceurl'], 0, strrpos($this->board['loadbalanceurl'], '/')) : '';
if ($this->board['loadbalanceurl'] != '' && $this->board['loadbalancepassword'] != '') {
require_once KU_ROOTDIR . 'inc/classes/loadbalancer.class.php';
$this->loadbalancer = new Load_Balancer;
$this->loadbalancer->url = $this->board['loadbalanceurl'];
$this->loadbalancer->password = $this->board['loadbalancepassword'];
}
if ($this->board['locale'] && $this->board['locale'] != KU_LOCALE) {
changeLocale($this->board['locale']);
}
}
}
}
function __destruct() {
changeLocale(KU_LOCALE);
}
/**
* Regenerate all board and thread pages
*/
function RegenerateAll() {
$this->RegeneratePages();
$this->RegenerateThreads();
}
/**
* Regenerate all pages
*/
function RegeneratePages() {
global $tc_db, $CURRENTLOCALE;
$this->InitializeDwoo();
$results = $tc_db->GetAll("SELECT `filetype` FROM `" . KU_DBPREFIX . "embeds`");
foreach ($results as $line) {
$this->board['filetypes'][] .= $line[0];
}
$this->dwoo_data->assign('filetypes', $this->board['filetypes']);
$maxpages = $this->board['maxpages'];
$numposts = $tc_db->GetAll("SELECT COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND `parentid` = 0 AND `IS_DELETED` = 0");
if ($this->board['type'] == 1) {
$postsperpage = KU_THREADSTXT;
} elseif ($this->board['type'] == 3) {
$postsperpage = 30;
} else {
$postsperpage = KU_THREADS;
}
$i = 0;
$liststooutput = 0;
$totalpages = calculatenumpages($this->board['type'], ($numposts[0][0]-1));
if ($totalpages == '-1') {
$totalpages = 0;
}
$this->dwoo_data->assign('numpages', $totalpages);
while ($i <= $totalpages) {
$newposts = Array();
$this->dwoo_data->assign('thispage', $i);
$threads = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND `parentid` = 0 AND `IS_DELETED` = 0 ORDER BY `stickied` DESC, `bumped` DESC LIMIT ". ($postsperpage)." OFFSET ". $postsperpage * $i);
$executiontime_start_page = microtime_float();
foreach ($threads as $thread) {
// If the thread is on the page set to mark, && hasn't been marked yet, mark it
if ($thread['deleted_timestamp'] == 0 && $this->board['markpage'] > 0 && $i >= $this->board['markpage']) {
$tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `deleted_timestamp` = '" . (time() + 7200) . "' WHERE `boardid` = " . $tc_db->qstr($this->board['id'])." AND `id` = '" . $thread['id'] . "'");
clearPostCache($thread['id'], $this->board['name']);
$this->RegenerateThreads($thread['id']);
$this->dwoo_data->assign('replythread', 0);
}
$replycount = Array();
if ($this->board['type'] == 1 || $this->board['type'] == 3 ) {
$replycount = $tc_db->GetAll("SELECT COUNT(`id`) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $tc_db->qstr($this->board['id'])." AND `parentid` = " . $thread['id']);
} else {
if (KU_DBTYPE != 'sqlite')
$replycount = $tc_db->GetAll("SELECT COUNT(`id`) AS id , SUM( IF(file_md5!='',1,0) ) AS files FROM( SELECT id,file_md5 FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']." AND `parentid` = ".$thread['id']." AND `IS_DELETED` = 0 ORDER BY `timestamp` DESC LIMIT 100000000 OFFSET " . (($thread['stickied'] == 1) ? (KU_REPLIESSTICKY) : (KU_REPLIES)) . " ) AS replies");
else {
$replycount[0][] = $tc_db->GetOne("SELECT COUNT(`id`) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']." AND `parentid` = ".$thread['id']." AND `IS_DELETED` = 0 OFFSET " . (($thread['stickied'] == 1) ? (KU_REPLIESSTICKY) : (KU_REPLIES)));
$replycount[0][] = $tc_db->GetOne("SELECT COUNT(`id`) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']." AND `parentid` = ".$thread['id']." AND `file` != '' AND `IS_DELETED` = 0 OFFSET " . (($thread['stickied'] == 1) ? (KU_REPLIESSTICKY) : (KU_REPLIES)));
}
}
$thread['replies'] = $replycount[0][0];
$thread['images'] = (isset($replycount[0][1]) ? $replycount[0][1] : '');
$thread = $this->BuildPost($thread, true);
if ($this->board['type'] != 3) {
$posts = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']." AND `parentid` = ".$thread['id']." " . (($this->board['type'] != 1) ? ("AND `IS_DELETED` = 0") : ("")) . " ORDER BY `id` DESC LIMIT ".(($thread['stickied'] == 1) ? (KU_REPLIESSTICKY) : (KU_REPLIES)));
foreach ($posts as $key=>$post) {
$posts[$key] = $this->BuildPost($post, true);
}
$posts = array_reverse($posts);
array_unshift($posts, $thread);
$newposts[] = $posts;
} else {
if (!$thread['tag']) $thread['tag'] = '*';
$newposts[] = $thread;
}
}
if ($this->board['type'] == 0 && !isset($embeds)) {
$embeds = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "embeds`");
$this->dwoo_data->assign('embeds', $embeds);
}
if (!isset($header)){
$header = $this->PageHeader();
$header = str_replace("<!sm_threadid>", 0, $header);
}
if (!isset($postbox)) {
$postbox = $this->Postbox();
$postbox = str_replace("<!sm_threadid>", 0, $postbox);
}
$this->dwoo_data->assign('posts', $newposts);
$this->dwoo_data->assign('file_path', getCLBoardPath($this->board['name'], $this->board['loadbalanceurl_formatted'], ''));
$content = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_board_page.tpl', $this->dwoo_data);
$footer = $this->Footer(false, (microtime_float() - $executiontime_start_page), (($this->board['type'] == 1) ? (true) : (false)));
$content = $header.$postbox.$content.$footer;
$content = str_replace("\t", '',$content);
$content = str_replace("&nbsp;\r\n", '&nbsp;',$content);
if ($i == 0) {
$page = KU_BOARDSDIR.$this->board['name'].'/'.KU_FIRSTPAGE;
$this->PrintPage($page, $content, $this->board['name']);
} else {
$page = KU_BOARDSDIR.$this->board['name'].'/'.$i.'.html';
$this->PrintPage($page, $content, $this->board['name']);
}
$i++;
}
// If text board, rebuild thread list html files
if ($this->board['type'] == 1) {
$numpostsleft = $tc_db->GetOne("SELECT COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = 0");
$liststooutput = floor(($numpostsleft-1) / 40);
$this->dwoo_data->assign('numpages', $liststooutput+1);
$listpage = 0;
$currentpostwave = 0;
while ($numpostsleft>0) {
$this->dwoo_data->assign('thispage', $listpage+1);
$executiontime_start_list = microtime_float();
$page = $this->PageHeader(0, $currentpostwave, $liststooutput);
$this->Footer(false, (microtime_float()-$executiontime_start_list), true);
if ($listpage==0) {
$this->PrintPage(KU_BOARDSDIR.$this->board['name'].'/list.html', $page, $this->board['name']);
} else {
$this->PrintPage(KU_BOARDSDIR.$this->board['name'].'/list'.($listpage+1).'.html', $page, $this->board['name']);
}
$currentpostwave += 40;
$numpostsleft -= 40;
$listpage++;
}
}
// If the board has catalog mode enabled, build it
if ($this->board['enablecatalog'] == 1 && ($this->board['type'] == 0 || $this->board['type'] == 2)) {
$executiontime_start_catalog = microtime_float();
$catalog_head = $this->PageHeader().
'&#91;<a href="' . KU_BOARDSFOLDER . $this->board['name'] . '/">'._gettext('Return').'</a>&#93; <div class="catalogmode">'._gettext('Catalog Mode').'</div>' . "\n" .
'<table border="1" align="center">' . "\n" . '<tr>' . "\n";
$catalog_page = '';
$results = $tc_db->GetAll("SELECT `id` , `subject` , `file` , `file_type` FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = 0 ORDER BY `stickied` DESC, `bumped` DESC");
$numresults = count($results);
if ($numresults > 0) {
$celnum = 0;
$trbreak = 0;
$row = 1;
// Calculate the number of rows we will actually output
$maxrows = max(1, (($numresults - ($numresults % 12)) / 12));
foreach ($results as $line) {
$celnum++;
$trbreak++;
if ($trbreak == 13 && $celnum != $numresults) {
$catalog_page .= '</tr>' . "\n" . '<tr>' . "\n";
$row++;
$trbreak = 1;
}
if ($row <= $maxrows) {
$replies = $tc_db->GetOne("SELECT COUNT(*) FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $this->board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = " . $line['id']);
$catalog_page .= '<td valign="middle">' . "\n" .
'<a href="' . KU_BOARDSFOLDER . $this->board['name'] . '/res/' . $line['id'] . '.html"';
if ($line['subject'] != '') {
$catalog_page .= ' title="' . $line['subject'] . '"';
}
$catalog_page .= '>';
if ($line['file'] != '' && $line['file'] != 'removed') {
if ($line['file_type'] == 'jpg' || $line['file_type'] == 'png' || $line['file_type'] == 'gif') {
$file_path = getCLBoardPath($this->board['name'], $this->board['loadbalanceurl_formatted'], $this->archive_dir);
$catalog_page .= '<img src="' . $file_path . '/thumb/' . $line['file'] . 'c.' . $line['file_type'] . '" alt="' . $line['id'] . '" border="0" />';
} else {
$catalog_page .= _gettext('File');
}
} elseif ($line['file'] == 'removed') {
$catalog_page .= 'Rem.';
} else {
$catalog_page .= _gettext('None');
}
$catalog_page .= '</a><br />' . "\n" . '<small>' . $replies . '</small>' . "\n" . '</td>' . "\n";
}
}
} else {
$catalog_page .= '<td>' . "\n" .
_gettext('No threads.') . "\n" .
'</td>' . "\n";
}
$catalog_page .= '</tr>' . "\n" . '</table><br /><hr />' .
$this->Footer(false, (microtime_float()-$executiontime_start_catalog));
$this->PrintPage(KU_BOARDSDIR . $this->board['name'] . '/catalog.html', $catalog_head.$catalog_page, $this->board['name']);
}
// Delete old pages
$dir = KU_BOARDSDIR.$this->board['name'];
$files = glob ("$dir/*.html");
if (is_array($files)) {
foreach ($files as $htmlfile) {
if (preg_match("/[0-9+].html/", $htmlfile)) {
if (substr(basename($htmlfile), 0, strpos(basename($htmlfile), '.html'))>$totalpages) {
unlink($htmlfile);
}
}
if (preg_match("/list[0-9+].html/", $htmlfile)) {
if (substr(basename($htmlfile), 4, strpos(basename($htmlfile), '.html'))>($liststooutput+1)) {
unlink($htmlfile);
}
}
if (preg_match("/catalog.html/", $htmlfile)) {
if (!($this->board['enablecatalog'] == 1 && ($this->board['type'] == 0 || $this->board['type'] == 2))) {
unlink($htmlfile);
}
}
}
}
}
/**
* Regenerate each thread's corresponding html file, starting with the most recently bumped
*/
function RegenerateThreads($id = 0) {
global $tc_db, $CURRENTLOCALE;
require_once(KU_ROOTDIR."lib/dwoo.php");
if (!isset($this->dwoo)) { $this->dwoo = New Dwoo; $this->dwoo_data = new Dwoo_Data(); $this->InitializeDwoo(); }
$embeds = Array();
$numimages = 0;
if ($this->board['type'] != 1 && !$embeds) {
$embeds = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "embeds`");
$this->dwoo_data->assign('embeds', $embeds);
foreach ($embeds as $embed) {
$this->board['filetypes'][] .= $embed['filetype'];
}
$this->dwoo_data->assign('filetypes', $this->board['filetypes']);
}
if ($id == 0) {
// Build every thread
$header = $this->PageHeader(1);
if ($this->board['type'] != 2){
$postbox = $this->Postbox(1);
}
$threads = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND `parentid` = 0 AND `IS_DELETED` = 0 ORDER BY `id` DESC");
if (count($threads) > 0) {
foreach($threads as $thread) {
$numimages = 0;
$executiontime_start_thread = microtime_float();
$posts = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND (`id` = " . $thread['id'] . " OR `parentid` = " . $thread['id'] . ") " . (($this->board['type'] != 1) ? ("AND `IS_DELETED` = 0") : ("")) . " ORDER BY `id` ASC");
if ($this->board['type'] != 1 || ((isset($posts[0]['IS_DELETED']) && $posts[0]['IS_DELETED'] == 0) || (isset($posts[0]['is_deleted']) && $posts[0]['is_deleted'] == 0))) {
// There might be a chance that the post was deleted during another RegenerateThreads() session, if there are no posts, move on to the next thread.
if(count($posts) > 0){
foreach ($posts as $key=>$post) {
if (($post['file_type'] == 'jpg' || $post['file_type'] == 'gif' || $post['file_type'] == 'png') && $post['parentid'] != 0) {
$numimages++;
}
$posts[$key] = $this->BuildPost($post, false);
}
$header_replaced = str_replace("<!sm_threadid>", $thread['id'], $header);
$this->dwoo_data->assign('numimages', $numimages);
$this->dwoo_data->assign('replythread', $thread['id']);
$this->dwoo_data->assign('posts', $posts);
$this->dwoo_data->assign('file_path', getCLBoardPath($this->board['name'], $this->board['loadbalanceurl_formatted'], ''));
if ($this->board['type'] != 2){
$postbox_replaced = str_replace("<!sm_threadid>", $thread['id'], $postbox);
}
else {
$postbox_replaced = $this->Postbox($thread['id']);
}
$reply = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_reply_header.tpl', $this->dwoo_data);
$content = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_thread.tpl', $this->dwoo_data);
if (!isset($footer)) $footer = $this->Footer(false, (microtime_float() - $executiontime_start_thread), (($this->board['type'] == 1) ? (true) : (false)));
$content = $header_replaced.$reply.$postbox_replaced.$content.$footer;
$content = str_replace("\t", '',$content);
$content = str_replace("&nbsp;\r\n", '&nbsp;',$content);
$this->PrintPage(KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/res/' . $thread['id'] . '.html', $content, $this->board['name']);
if (KU_FIRSTLAST) {
$replycount = (count($posts)-1);
if ($replycount > 50) {
$this->dwoo_data->assign('replycount', $replycount);
$this->dwoo_data->assign('modifier', "last50");
// Grab the last 50 replies
$posts50 = array_slice($posts, -50, 50);
// Add on the OP
array_unshift($posts50, $posts[0]);
$this->dwoo_data->assign('posts', $posts50);
$content = $this->dwoo->get(KU_TEMPLATEDIR . '/img_thread.tpl', $this->dwoo_data);
$content = $header_replaced.$reply.$postbox_replaced.$content.$footer;
$content = str_replace("\t", '',$content);
$content = str_replace("&nbsp;\r\n", '&nbsp;',$content);
unset($posts50);
$this->PrintPage(KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/res/' . $thread['id'] . '+50.html', $content, $this->board['name']);
if ($replycount > 100) {
$this->dwoo_data->assign('modifier', "first100");
// Grab the first 100 posts
$posts100 = array_slice($posts, 0, 100);
$this->dwoo_data->assign('posts', $posts100);
$content = $this->dwoo->get(KU_TEMPLATEDIR . '/img_thread.tpl', $this->dwoo_data);
$content = $header_replaced.$reply.$postbox_replaced.$content.$footer;
$content = str_replace("\t", '',$content);
$content = str_replace("&nbsp;\r\n", '&nbsp;',$content);
unset($posts100);
$this->PrintPage(KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/res/' . $thread['id'] . '-100.html', $content, $this->board['name']);
}
$this->dwoo_data->assign('modifier', "");
}
}
}
}
}
}
} else {
$executiontime_start_thread = microtime_float();
// Build only that thread
$thread = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND (`id` = " . $id . " OR `parentid` = " . $id . ") " . (($this->board['type'] != 1) ? ("AND `IS_DELETED` = 0") : ("")) . " ORDER BY `id` ASC");
if ($this->board['type'] != 1 || ((isset($thread[0]['IS_DELETED']) && $thread[0]['IS_DELETED'] == 0) || (isset($thread[0]['is_deleted']) && $thread[0]['is_deleted'] == 0))) {
foreach ($thread as $key=>$post) {
if (($post['file_type'] == 'jpg' || $post['file_type'] == 'gif' || $post['file_type'] == 'png') && $post['parentid'] != 0) {
$numimages++;
}
$thread[$key] = $this->BuildPost($post, false);
}
$header = $this->PageHeader($id);
$postbox = $this->Postbox($id);
$this->dwoo_data->assign('numimages', $numimages);
$header = str_replace("<!sm_threadid>", $id, $header);
$this->dwoo_data->assign('replythread', $id);
if ($this->board['type'] != 2){
$postbox = str_replace("<!sm_threadid>", $id, $postbox);
}
$this->dwoo_data->assign('threadid', $thread[0]['id']);
$this->dwoo_data->assign('posts', $thread);
$this->dwoo_data->assign('file_path', getCLBoardPath($this->board['name'], $this->board['loadbalanceurl_formatted'], ''));
$postbox = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_reply_header.tpl', $this->dwoo_data).$postbox;
$content = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_thread.tpl', $this->dwoo_data);
if (!isset($footer)) $footer = $this->Footer(false, (microtime_float() - $executiontime_start_thread), (($this->board['type'] == 1) ? (true) : (false)));
$content = $header.$postbox.$content.$footer;
$content = str_replace("\t", '',$content);
$content = str_replace("&nbsp;\r\n", '&nbsp;',$content);
$this->PrintPage(KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/res/' . $id . '.html', $content, $this->board['name']);
if (KU_FIRSTLAST) {
$replycount = $tc_db->GetOne("SELECT COUNT(`id`) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id'] . " AND `parentid` = " . $id . " AND `IS_DELETED` = 0");
if ($replycount > 50) {
$this->dwoo_data->assign('replycount', $replycount);
$this->dwoo_data->assign('modifier', "last50");
// Grab the last 50 replies
$posts50 = array_slice($thread, -50, 50);
// Add the thread to the top of this, since it wont be included in the result
array_unshift($posts50, $thread[0]);
$this->dwoo_data->assign('posts', $posts50);
$content = $this->dwoo->get(KU_TEMPLATEDIR . '/img_thread.tpl', $this->dwoo_data);
$content = $header.$reply.$postbox.$content.$footer;
$content = str_replace("\t", '',$content);
$content = str_replace("&nbsp;\r\n", '&nbsp;',$content);
unset($posts50);
$this->PrintPage(KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/res/' . $id . '+50.html', $content, $this->board['name']);
if ($replycount > 100) {
$this->dwoo_data->assign('modifier', "first100");
// Grab the first 100 posts
$posts100 = array_slice($thread, 0, 100);
$this->dwoo_data->assign('posts', $posts100);
$this->dwoo_data->assign('posts', $posts);
$content = $this->dwoo->get(KU_TEMPLATEDIR . '/img_thread.tpl', $this->dwoo_data);
$content = $header.$reply.$postbox.$content.$footer;
$content = str_replace("\t", '',$content);
$content = str_replace("&nbsp;\r\n", '&nbsp;',$content);
unset($posts100);
$this->PrintPage(KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/res/' . $id . '-100.html', $content, $this->board['name']);
}
$this->dwoo_data->assign('modifier', "");
}
}
}
}
}
function BuildPost($post, $page) {
global $CURRENTLOCALE;
if ($this->board['type'] == 1 && ((isset($post['IS_DELETED']) && $post['IS_DELETED'] == 1) || (isset($post['is_deleted']) && $post['is_deleted'] == 1))) {
$post['name'] = '';
$post['email'] = '';
$post['tripcode'] = _gettext('Deleted');
$post['message'] = '<font color="gray">'._gettext('This post has been deleted.').'</font>';
}
$dateEmail = (empty($this->board['anonymous'])) ? $post['email'] : 0;
$post['message'] = stripslashes(formatLongMessage($post['message'], $this->board['name'], (($post['parentid'] == 0) ? ($post['id']) : ($post['parentid'])), $page));
$post['timestamp_formatted'] = formatDate($post['timestamp'], 'post', $CURRENTLOCALE, $dateEmail);
$post['reflink'] = formatReflink($this->board['name'], (($post['parentid'] == 0) ? ($post['id']) : ($post['parentid'])), $post['id'], $CURRENTLOCALE);
if (isset($this->board['filetypes']) && in_array($post['file_type'], $this->board['filetypes'])) {
$post['videobox'] = embeddedVideoBox($post);
}
if ($post['file_type'] == 'mp3' && $this->board['loadbalanceurl'] == '') {
//Grab the ID3 info. TODO: Make this work for load-balanced boards.
// include getID3() library
require_once(KU_ROOTDIR . 'lib/getid3/getid3.php');
// Initialize getID3 engine
$getID3 = new getID3;
$post['id3'] = $getID3->analyze(KU_BOARDSDIR.$this->board['name'].'/src/'.$post['file'].'.mp3');
getid3_lib::CopyTagsToComments($post['id3']);
}
if ($post['file_type']!='jpg'&&$post['file_type']!='gif'&&$post['file_type']!='png'&&$post['file_type']!=''&&!in_array($post['file_type'], $this->board['filetypes'])) {
if(!isset($filetype_info[$post['file_type']])) $filetype_info[$post['file_type']] = getfiletypeinfo($post['file_type']);
$post['nonstandard_file'] = KU_WEBPATH . '/inc/filetypes/' . $filetype_info[$post['file_type']][0];
if($post['thumb_w']!=0&&$post['thumb_h']!=0) {
if(file_exists(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$post['file'].'s.jpg'))
$post['nonstandard_file'] = KU_WEBPATH . '/' .$this->board['name'].'/thumb/'.$post['file'].'s.jpg';
elseif(file_exists(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$post['file'].'s.png'))
$post['nonstandard_file'] = KU_WEBPATH . '/' .$this->board['name'].'/thumb/'.$post['file'].'s.png';
elseif(file_exists(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$post['file'].'s.gif'))
$post['nonstandard_file'] = KU_WEBPATH . '/' .$this->board['name'].'/thumb/'.$post['file'].'s.gif';
else {
$post['thumb_w'] = $filetype_info[$post['file_type']][1];
$post['thumb_h'] = $filetype_info[$post['file_type']][2];
}
}
else {
$post['thumb_w'] = $filetype_info[$post['file_type']][1];
$post['thumb_h'] = $filetype_info[$post['file_type']][2];
}
}
return $post;
}
/**
* Build the page header
*
* @param integer $replythread The ID of the thread the header is being build for. 0 if it is for a board page
* @param integer $liststart The number which the thread list starts on (text boards only)
* @param integer $liststooutput The number of list pages which will be generated (text boards only)
* @return string The built header
*/
function PageHeader($replythread = '0', $liststart = '0', $liststooutput = '-1') {
global $tc_db, $CURRENTLOCALE;
$tpl = Array();
$tpl['htmloptions'] = ((KU_LOCALE == 'he' && empty($this->board['locale'])) || $this->board['locale'] == 'he') ? ' dir="rtl"' : '' ;
$tpl['title'] = '';
if (KU_DIRTITLE) {
$tpl['title'] .= '/' . $this->board['name'] . '/ - ';
}
$tpl['title'] .= $this->board['desc'];
$ad_top = 185;
$ad_right = 25;
if ($this->board['type']==1) {
$ad_top -= 50;
} else {
if ($replythread!=0) {
$ad_top += 50;
}
}
if ($this->board['type']==2) {
$ad_top += 40;
}
$this->dwoo_data->assign('title', $tpl['title']);
$this->dwoo_data->assign('htmloptions', $tpl['htmloptions']);
$this->dwoo_data->assign('locale', $CURRENTLOCALE);
$this->dwoo_data->assign('ad_top', $ad_top);
$this->dwoo_data->assign('ad_right', $ad_right);
$this->dwoo_data->assign('board', $this->board);
$this->dwoo_data->assign('replythread', $replythread);
if ($this->board['type'] != 1) {
$topads = $tc_db->GetOne("SELECT code FROM `" . KU_DBPREFIX . "ads` WHERE `position` = 'top' AND `disp` = '1'");
$this->dwoo_data->assign('topads', $topads);
$this->dwoo_data->assign('ku_styles', explode(':', KU_STYLES));
$this->dwoo_data->assign('ku_defaultstyle', (!empty($this->board['defaultstyle']) ? ($this->board['defaultstyle']) : (KU_DEFAULTSTYLE)));
} else {
$this->dwoo_data->assign('ku_styles', explode(':', KU_TXTSTYLES));
$this->dwoo_data->assign('ku_defaultstyle', (!empty($this->board['defaultstyle']) ? ($this->board['defaultstyle']) : (KU_DEFAULTTXTSTYLE)));
}
$this->dwoo_data->assign('boardlist', $this->board['boardlist']);
$global_header = $this->dwoo->get(KU_TEMPLATEDIR . '/global_board_header.tpl', $this->dwoo_data);
if ($this->board['type'] != 1) {
$header = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_header.tpl', $this->dwoo_data);
} else {
if ($liststooutput == -1) {
$this->dwoo_data->assign('isindex', true);
} else {
$this->dwoo_data->assign('isindex', false);
}
if ($replythread != 0) $this->dwoo_data->assign('isthread', true);
$header = $this->dwoo->get(KU_TEMPLATEDIR . '/txt_header.tpl', $this->dwoo_data);
if ($replythread == 0) {
$startrecord = ($liststooutput >= 0 || $this->board['compactlist']) ? 40 : KU_THREADSTXT ;
$threads = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $tc_db->qstr($this->board['id']) . " AND `parentid` = 0 AND `IS_DELETED` = 0 ORDER BY `stickied` DESC, `bumped` DESC LIMIT " . $startrecord . " OFFSET " . $liststart);
foreach($threads AS $key=>$thread) {
$replycount = $tc_db->GetOne("SELECT COUNT(`id`) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $tc_db->qstr($this->board['id']) . " AND `parentid` = " . $thread['id']);
$threads[$key]['replies'] = $replycount;
}
$this->dwoo_data->assign('threads', $threads);
$header .= $this->dwoo->get(KU_TEMPLATEDIR . '/txt_threadlist.tpl', $this->dwoo_data);
}
}
return $global_header.$header;
}
/**
* Build the page header for an oekaki posting
*
* @param integer $replyto The ID of the thread being replied to. 0 for a new thread
*/
function OekakiHeader($replyto, $postoek) {
$executiontime_start = microtime_float();
$this->InitializeDwoo();
$page = $this->PageHeader();
$this->dwoo_data->assign('replythread', $replyto);
$page .= $this->Postbox();
$executiontime_stop = microtime_float();
$page .= $this->Footer(false, ($executiontime_stop - $executiontime_start));
$this->PrintPage('', $page, true);
}
/**
* Generate the postbox area
*
* @param integer $replythread The ID of the thread being replied to. 0 if not replying
* @param string $postboxnotice The postbox notice
* @return string The generated postbox
*/
function Postbox($replythread = 0) {
global $tc_db;
if (KU_BLOTTER && $this->board['type'] != 1) {
$this->dwoo_data->assign('blotter', getBlotter());
$this->dwoo_data->assign('blotter_updated', getBlotterLastUpdated());
}
$postbox = '';
if ($this->board['type'] == 2 && $replythread > 0) {
$oekposts = $tc_db->GetAll("SELECT `id` FROM `" . KU_DBPREFIX."posts` WHERE `boardid` = " . $this->board['id']." AND (`id` = ".$replythread." OR `parentid` = ".$replythread.") AND `file` != '' AND `file` != 'removed' AND `file_type` IN ('jpg', 'gif', 'png') AND `IS_DELETED` = 0 ORDER BY `parentid` ASC, `timestamp` ASC");
$this->dwoo_data->assign('oekposts', $oekposts);
}
if(($this->board['type'] == 1 && $replythread == 0) || $this->board['type'] != 1) {
$postbox .= $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_post_box.tpl', $this->dwoo_data);
}
return $postbox;
}
/**
* Display the user-defined list of boards found in boards.html
*
* @param boolean $is_textboard If the board this is being displayed for is a text board
* @return string The board list
*/
function DisplayBoardList($is_textboard = false) {
if (KU_GENERATEBOARDLIST) {
global $tc_db;
$output = '';
$results = $tc_db->GetAll("SELECT `id` FROM `" . KU_DBPREFIX . "sections` ORDER BY `order` ASC");
$boards = array();
foreach($results AS $line) {
$results2 = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "boards` WHERE `section` = '" . $line['id'] . "' ORDER BY `order` ASC, `name` ASC");
foreach($results2 AS $line2) {
$boards[$line['id']][$line2['id']]['name'] = htmlspecialchars($line2['name']);
$boards[$line['id']][$line2['id']]['desc'] = htmlspecialchars($line2['desc']);
}
}
} else {
$boards = KU_ROOTDIR . 'boards.html';
}
return $boards;
}
/**
* Display the page footer
*
* @param boolean $noboardlist Force the board list to not be displayed
* @param string $executiontime The time it took the page to be created
* @param boolean $hide_extra Hide extra footer information, and display the manage link
* @return string The generated footer
*/
function Footer($noboardlist = false, $executiontime = '', $hide_extra = false) {
global $tc_db, $dwoo, $dwoo_data;
$footer = '';
if ($hide_extra || $noboardlist) $this->dwoo_data->assign('boardlist', '');
if ($executiontime != '') $this->dwoo_data->assign('executiontime', round($executiontime, 2));
$botads = $tc_db->GetOne("SELECT code FROM `" . KU_DBPREFIX . "ads` WHERE `position` = 'bot' AND `disp` = '1'");
$this->dwoo_data->assign('botads', $botads);
$footer = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_footer.tpl', $this->dwoo_data);
$footer .= $this->dwoo->get(KU_TEMPLATEDIR . '/global_board_footer.tpl', $this->dwoo_data);
return $footer;
}
/**
* Finalize the page and print it to the specified filename
*
* @param string $filename File to print the page to
* @param string $contents Page contents
* @param string $board Board which the file is being generated for
* @return string The page contents, if requested
*/
function PrintPage($filename, $contents, $board) {
if ($board !== true) {
print_page($filename, $contents, $board);
} else {
echo $contents;
}
}
/**
* Initialize the instance of smary which will be used for generating pages
*/
function InitializeDwoo() {
require_once KU_ROOTDIR . 'lib/dwoo.php';
$this->dwoo = new Dwoo();
$this->dwoo_data = new Dwoo_Data();
$this->dwoo_data->assign('cwebpath', getCWebpath());
$this->dwoo_data->assign('boardpath', getCLBoardPath());
}
/**
* Enable/disable archive mode
*
* @param boolean $mode True/false for enabling/disabling archive mode
*/
function ArchiveMode($mode) {
$this->archive_dir = ($mode && $this->board['enablearchiving'] == 1) ? '/arch' : '';
}
}
/**
* Post class
*
* Used for post insertion, deletion, and reporting.
*
* @package kusaba
*/
class Post extends Board {
// Declare the public variables
var $post = Array();
function Post($postid, $board, $boardid, $is_inserting = false) {
global $tc_db;
$results = $tc_db->GetAll("SELECT * FROM `".KU_DBPREFIX."posts` WHERE `boardid` = '" . $boardid . "' AND `id` = ".$tc_db->qstr($postid)." LIMIT 1");
if (count($results)==0&&!$is_inserting) {
exitWithErrorPage('Invalid post ID.');
} elseif ($is_inserting) {
$this->Board($board, false);
} else {
foreach ($results[0] as $key=>$line) {
if (!is_numeric($key)) $this->post[$key] = $line;
}
$results = $tc_db->GetAll("SELECT `cleared` FROM `".KU_DBPREFIX."reports` WHERE `postid` = ".$tc_db->qstr($this->post['id'])." LIMIT 1");
if (count($results)>0) {
foreach($results AS $line) {
$this->post['isreported'] = ($line['cleared'] == 0) ? true : 'cleared';
}
} else {
$this->post['isreported'] = false;
}
$this->post['isthread'] = ($this->post['parentid'] == 0) ? true : false;
if (empty($this->board) || $this->board['name'] != $board) {
$this->Board($board, false);
}
}
}
function Delete($allow_archive = false) {
global $tc_db;
$i = 0;
if ($this->post['isthread'] == true) {
if ($allow_archive && $this->board['enablearchiving'] == 1 && $this->board['loadbalanceurl'] == '') {
$this->ArchiveMode(true);
$this->RegenerateThreads($this->post['id']);
@copy(KU_BOARDSDIR . $this->board['name'] . '/src/' . $this->post['file'] . '.' . $this->post['filetype'], KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/src/' . $this->post['file'] . '.' . $this->post['filetype']);
@copy(KU_BOARDSDIR . $this->board['name'] . '/thumb/' . $this->post['file'] . 's.' . $this->post['filetype'], KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/thumb/' . $this->post['file'] . 's.' . $this->post['filetype']);
}
$results = $tc_db->GetAll("SELECT `id`, `file`, `file_type` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = '" . $this->board['id'] . "' AND `IS_DELETED` = 0 AND `parentid` = ".$tc_db->qstr($this->post['id']));
foreach($results AS $line) {
$i++;
if ($allow_archive && $this->board['enablearchiving'] == 1) {
@copy(KU_BOARDSDIR . $this->board['name'] . '/src/' . $line['file'] . '.' . $line['file_type'], KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/src/' . $line['file'] . '.' . $line['file_type']);
@copy(KU_BOARDSDIR . $this->board['name'] . '/thumb/' . $line['file'] . 's.' . $line['file_type'], KU_BOARDSDIR . $this->board['name'] . $this->archive_dir . '/thumb/' . $line['file'] . 's.' . $line['file_type']);
}
}
if ($allow_archive && $this->board['enablearchiving'] == 1) {
$this->ArchiveMode(false);
}
@unlink(KU_BOARDSDIR.$this->board['name'].'/res/'.$this->post['id'].'.html');
@unlink(KU_BOARDSDIR.$this->board['name'].'/res/'.$this->post['id'].'-100.html');
@unlink(KU_BOARDSDIR.$this->board['name'].'/res/'.$this->post['id'].'+50.html');
$this->DeleteFile(false, true);
foreach($results AS $line) {
$tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `IS_DELETED` = 1 , `deleted_timestamp` = '" . time() . "' WHERE `boardid` = '" . $this->board['id'] . "' AND `id` = '".$line['id']."' AND `parentid` = ".$tc_db->qstr($this->post['id']));
clearPostCache($line['id'], $this->board['name']);
}
$tc_db->Execute("DELETE FROM `".KU_DBPREFIX."watchedthreads` WHERE `threadid` = ".$tc_db->qstr($this->post['id'])." AND `board` = '".$this->board['name']."'");
$tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `IS_DELETED` = 1 , `deleted_timestamp` = '" . time() . "' WHERE `boardid` = '" . $this->board['id'] . "' AND `id` = ".$tc_db->qstr($this->post['id']));
clearPostCache($this->post['id'], $this->board['name']);
return $i.' ';
} else {
$this->DeleteFile(false);
$tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `IS_DELETED` = 1 , `deleted_timestamp` = '" . time() . "' WHERE `boardid` = '" . $this->board['id'] . "' AND `id` = ".$tc_db->qstr($this->post['id']));
clearPostCache($this->post['id'], $this->board['name']);
return true;
}
}
function DeleteFile($update_to_removed = true, $whole_thread = false) {
global $tc_db;
if ($whole_thread && $this->post['isthread']) {
$results = $tc_db->GetAll("SELECT `id`, `file`, `file_type` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $this->board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = ".$tc_db->qstr($this->post['id']));
if (count($results)>0) {
foreach($results AS $line) {
if ($line['file'] != '' && $line['file'] != 'removed') {
if ($this->board['loadbalanceurl'] != '') {
$this->loadbalancer->Delete($line['file'], $line['file_type']);
} else {
@unlink(KU_BOARDSDIR.$this->board['name'].'/src/'.$line['file'].'.'.$line['file_type']);
@unlink(KU_BOARDSDIR.$this->board['name'].'/src/'.$line['file'].'.pch');
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$line['file'].'s.'.$line['file_type']);
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$line['file'].'c.'.$line['file_type']);
if ($line['file_type'] == 'mp3') {
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$line['file'].'s.jpg');
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$line['file'].'s.png');
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$line['file'].'s.gif');
}
}
if ($update_to_removed) {
$tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `file` = 'removed', `file_md5` = '' WHERE `boardid` = '" . $this->board['id'] . "' AND `id` = ".$line['id']);
clearPostCache($line['id'], $this->board['name']);
}
}
}
}
$this->DeleteFile($update_to_removed);
} else {
if ($this->post['file']!=''&&$this->post['file']!='removed') {
if ($this->board['loadbalanceurl'] != '') {
$this->loadbalancer->Delete($this->post['file'], $this->post['filetype']);
} else {
@unlink(KU_BOARDSDIR.$this->board['name'].'/src/'.$this->post['file'].'.'.$this->post['file_type']);
@unlink(KU_BOARDSDIR.$this->board['name'].'/src/'.$this->post['file'].'.pch');
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$this->post['file'].'s.'.$this->post['file_type']);
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$this->post['file'].'c.'.$this->post['file_type']);
if ($this->post['file_type'] == 'mp3') {
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$this->post['file'].'s.jpg');
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$this->post['file'].'s.png');
@unlink(KU_BOARDSDIR.$this->board['name'].'/thumb/'.$this->post['file'].'s.gif');
}
}
if ($update_to_removed) {
$tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `file` = 'removed', `file_md5` = '' WHERE `boardid` = '" . $this->board['id'] . "' AND `id` = ".$tc_db->qstr($this->post['id']));
clearPostCache($this->post['id'], $this->board['name']);
}
}
}
}
function Insert($parentid, $name, $tripcode, $email, $subject, $message, $filename, $file_original, $filetype, $file_md5, $image_w, $image_h, $filesize, $thumb_w, $thumb_h, $password, $timestamp, $bumped, $ip, $posterauthority, $tag, $stickied, $locked, $boardid) {
global $tc_db;
$query = "INSERT INTO `".KU_DBPREFIX."posts` ( `parentid` , `boardid`, `name` , `tripcode` , `email` , `subject` , `message` , `file` , `file_original`, `file_type` , `file_md5` , `image_w` , `image_h` , `file_size` , `file_size_formatted` , `thumb_w` , `thumb_h` , `password` , `timestamp` , `bumped` , `ip` , `ipmd5` , `posterauthority` , `tag` , `stickied` , `locked` ) VALUES ( ".$tc_db->qstr($parentid).", ".$tc_db->qstr($boardid).", ".$tc_db->qstr($name).", ".$tc_db->qstr($tripcode).", ".$tc_db->qstr($email).", ".$tc_db->qstr($subject).", ".$tc_db->qstr($message).", ".$tc_db->qstr($filename).", ".$tc_db->qstr($file_original).", ".$tc_db->qstr($filetype).", ".$tc_db->qstr($file_md5).", ".$tc_db->qstr(intval($image_w)).", ".$tc_db->qstr(intval($image_h)).", ".$tc_db->qstr($filesize).", ".$tc_db->qstr(ConvertBytes($filesize)).", ".$tc_db->qstr($thumb_w).", ".$tc_db->qstr($thumb_h).", ".$tc_db->qstr($password).", ".$tc_db->qstr($timestamp).", ".$tc_db->qstr($bumped).", ".$tc_db->qstr(md5_encrypt($ip, KU_RANDOMSEED)).", '".md5($ip)."', ".$tc_db->qstr($posterauthority).", ".$tc_db->qstr($tag).", ".$tc_db->qstr($stickied).", ".$tc_db->qstr($locked)." )";
$tc_db->Execute($query);
$id = $tc_db->Insert_Id();
if(!$id || KU_DBTYPE == 'sqlite') {
// Non-mysql installs don't return the insert ID after insertion, we need to manually get it.
$id = $tc_db->GetOne("SELECT `id` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = ".$tc_db->qstr($boardid)." AND timestamp = ".$tc_db->qstr($timestamp)." AND `ipmd5` = '".md5($ip)."' LIMIT 1");
}
if ($id == 1 && $this->board['start'] > 1) {
$tc_db->Execute("UPDATE `".KU_DBPREFIX."posts` SET `id` = '".$this->board['start']."' WHERE `boardid` = ".$boardid);
return $this->board['start'];
}
return $id;
}
function Report() {
global $tc_db;
return $tc_db->Execute("INSERT INTO `".KU_DBPREFIX."reports` ( `board` , `postid` , `when` , `ip`, `reason` ) VALUES ( " . $tc_db->qstr($this->board['name']) . " , " . $tc_db->qstr($this->post['id']) . " , ".time()." , '" . md5_encrypt($_SERVER['REMOTE_ADDR'], KU_RANDOMSEED) . "', " . $tc_db->qstr($_POST['reportreason']) . " )");
}
}
?>
+83
View File
@@ -0,0 +1,83 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* +------------------------------------------------------------------------------+
* Load balancer class
* +------------------------------------------------------------------------------+
*/
class Load_Balancer {
var $url;
var $password;
function Send($type, $file, $targetname, $targetthumb = '', $targetthumb_c = '', $checkmime = '', $isreply = false, $handle_errors = false) {
$isreply_formatted = ($isreply) ? '1' : '0';
$ch = curl_init($this->url);
$post = array('password' => $this->password,
'type' => $type,
'isreply' => $isreply_formatted,
'file' => $file,
'targetname' => $targetname,
'targetthumb' => $targetthumb,
'targetthumb_c' => $targetthumb_c,
'checkmime' => $checkmime);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$return = curl_exec($ch);
curl_close($ch);
if ($handle_errors) {
if ($return == 'bad password') die(_gettext('The passwords of the load balancer password in the board configuration and the load receiver script differ.'));
if ($return == 'unable to thumbnail') die(_gettext('The load balancer script was unable to create the thumbnail for that image.'));
if ($return == 'file already exists') die(_gettext('That file already exists on the server.'));
if ($return == 'unable to copy') die(_gettext('The load balancer script was unable to copy the file you uploaded.'));
if ($return == 'bad mime type') die(_gettext('That file does not match up with the required mime type for that format.'));
if ($return == '' || $return == 'failure') die(_gettext('The load balancer script stopped unexpectedly.'));
}
return $return;
}
function Delete($filename, $filetype) {
$ch = curl_init($this->url);
$post = array('password' => $this->password,
'type' => 'delete',
'filename' => $filename,
'filetype' => $filetype);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$return = curl_exec($ch);
curl_close($ch);
return $return;
}
}
?>
File diff suppressed because it is too large. Load diff
+103
View File
@@ -0,0 +1,103 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Menu class
*
* @package kusaba
*/
class Menu {
function GetMenu($savetofile = false, $option = false) {
global $tc_db, $dwoo, $dwoo_data, $kusabaxorg;
require_once KU_ROOTDIR.'lib/dwoo.php';
$dwoo_data->assign('boardpath', getCLBoardPath());
if (KU_MENUTYPE == 'normal') {
$dwoo_data->assign('styles', explode(':', KU_MENUSTYLES));
}
if ($savetofile) {
$files = array('menu.html', 'menu_dirs.html');
} else {
$files = array('menu.php', 'menu.php');
}
$dwoo_data->assign('files', $files);
$sections = Array();
$results_boardsexist = $tc_db->GetAll("SELECT `id` FROM `".KU_DBPREFIX."boards` LIMIT 1");
if (count($results_boardsexist) > 0) {
$sections = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "sections` ORDER BY `order` ASC");
foreach($sections AS $key=>$section) {
$results = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "boards` WHERE `section` = '" . $section['id'] . "' ORDER BY `order` ASC, `name` ASC /* MENU.CLASS.PHP */");
foreach($results AS $line) {
$sections[$key]['boards'][] = $line;
}
}
}
$dwoo_data->assign('boards', $sections);
$tpl_irc = '';
$dwoo_data->assign('irc', $tpl_irc);
for ($i = 0; $i < 2; $i++) {
if ($i == 0) $dwoo_data->assign('showdirs', 0);
else $dwoo_data->assign('showdirs', 1);
if ($savetofile) {
if ($i == 0) {
file_put_contents(KU_ROOTDIR . $files[0], $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data));
} else {
file_put_contents(KU_ROOTDIR . $files[1], $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data));
}
} else {
if ($i == 0) {
$menu_nodirs = $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data);
if ($option == 'nodirs') {
return $menu_nodirs;
}
} else {
if ($option == 'dirs') {
$menu_dirs = $dwoo->get(KU_TEMPLATEDIR . '/menu.tpl', $dwoo_data);
return $menu_dirs;
}
}
}
}
if (isset($menu_nodirs) && isset($menu_dirs)) {
return array($menu_nodirs, $menu_dirs);
}
}
function Generate() {
return $this->GetMenu(true);
}
function PrintMenu($option = false) {
if ($option != false) {
return $this->GetMenu(false, $option);
} else {
return $this->GetMenu(false);
}
}
}
?>
+326
View File
@@ -0,0 +1,326 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* +------------------------------------------------------------------------------+
* Parse class
* +------------------------------------------------------------------------------+
* A post's message text will be passed, which will then be formatted and cleaned
* before being returned.
* +------------------------------------------------------------------------------+
*/
class Parse {
var $boardtype;
var $parentid;
var $id;
var $boardid;
function MakeClickable($txt) {
/* Make http:// urls in posts clickable */
$txt = preg_replace('#(http://|https://|ftp://)([^(\s<)]*)#', '<a href="\\1\\2">\\1\\2</a>', $txt);
return $txt;
}
function BBCode($string){
$patterns = array(
'`\[b\](.+?)\[/b\]`is',
'`\[i\](.+?)\[/i\]`is',
'`\[u\](.+?)\[/u\]`is',
'`\[s\](.+?)\[/s\]`is',
'`\[aa\](.+?)\[/aa\]`is',
'`\[spoiler\](.+?)\[/spoiler\]`is',
);
$replaces = array(
'<b>\\1</b>',
'<i>\\1</i>',
'<span style="border-bottom: 1px solid">\\1</span>',
'<strike>\\1</strike>',
'<div style="font-family: Mona,\'MS PGothic\' !important;">\\1</div>',
'<span class="spoiler" onmouseover="this.style.color=\'white\';" onmouseout="this.style.color=\'black\'">\\1</span>',
);
$string = preg_replace($patterns, $replaces , $string);
$string = preg_replace_callback('`\[code\](.+?)\[/code\]`is', array(&$this, 'code_callback'), $string);
return $string;
}
function code_callback($matches) {
$return = '<div style="white-space: pre !important;font-family: monospace !important;">'
. str_replace('<br />', '', $matches[1]) .
'</div>';
return $return;
}
function ColoredQuote($buffer, $boardtype) {
/* Add a \n to keep regular expressions happy */
if (substr($buffer, -1, 1)!="\n") {
$buffer .= "\n";
}
if ($boardtype==1) {
/* The css for text boards use 'quote' as the class for quotes */
$class = 'quote';
$linechar = '';
} else {
/* The css for imageboards use 'unkfunc' (???) as the class for quotes */
$class = 'unkfunc';
$linechar = "\n";
}
$buffer = preg_replace('/^(&gt;[^>](.*))\n/m', '<span class="'.$class.'">\\1</span>' . $linechar, $buffer);
/* Remove the > from the quoted line if it is a text board */
if ($boardtype==1) {
$buffer = str_replace('<span class="'.$class.'">&gt;', '<span class="'.$class.'">', $buffer);
}
return $buffer;
}
function ClickableQuote($buffer, $board, $boardtype, $parentid, $boardid, $ispage = false) {
global $thread_board_return;
$thread_board_return = $board;
$thread_board_id = $boardid;
/* Add html for links to posts in the board the post was made */
$buffer = preg_replace_callback('/&gt;&gt;([r]?[l]?[f]?[q]?[0-9,\-,\,]+)/', array(&$this, 'InterthreadQuoteCheck'), $buffer);
/* Add html for links to posts made in a different board */
$buffer = preg_replace_callback('/&gt;&gt;\/([a-z]+)\/([0-9]+)/', array(&$this, 'InterboardQuoteCheck'), $buffer);
return $buffer;
}
function InterthreadQuoteCheck($matches) {
global $tc_db, $ispage, $thread_board_return, $thread_board_id;
$lastchar = '';
// If the quote ends with a , or -, cut it off.
if(substr($matches[0], -1) == "," || substr($matches[0], -1) == "-") {
$lastchar = substr($matches[0], -1);
$matches[1] = substr($matches[1], 0, -1);
$matches[0] = substr($matches[0], 0, -1);
}
if ($this->boardtype != 1 && is_numeric($matches[1])) {
$query = "SELECT `parentid` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $this->boardid . " AND `id` = ".$tc_db->qstr($matches[1]);
$result = $tc_db->GetOne($query);
if ($result !== '') {
if ($result == 0) {
$realid = $matches[1];
} else {
$realid = $result;
}
} else {
return $matches[0];
}
$return = '<a href="'.KU_BOARDSFOLDER.$thread_board_return.'/res/'.$realid.'.html#'.$matches[1].'" onclick="return highlight(\'' . $matches[1] . '\', true);" class="ref|' . $thread_board_return . '|' .$realid . '|' . $matches[1] . '">'.$matches[0].'</a>'.$lastchar;
} else {
$return = $matches[0];
$postids = getQuoteIds($matches[1]);
if (count($postids) > 0) {
$realid = $this->parentid;
if ($realid === 0) {
if ($this->id > 0) {
$realid = $this->id;
}
}
if ($realid !== '') {
$return = '<a href="' . KU_BOARDSFOLDER . 'read.php';
if (KU_TRADITIONALREAD) {
$return .= '/' . $thread_board_return . '/' . $realid.'/' . $matches[1];
} else {
$return .= '?b=' . $thread_board_return . '&t=' . $realid.'&p=' . $matches[1];
}
$return .= '">' . $matches[0] . '</a>';
}
}
}
return $return;
}
function InterboardQuoteCheck($matches) {
global $tc_db;
$result = $tc_db->GetAll("SELECT `id`, `type` FROM `".KU_DBPREFIX."boards` WHERE `name` = ".$tc_db->qstr($matches[1])."");
if ($result[0]["type"] != '') {
$result2 = $tc_db->GetOne("SELECT `parentid` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $result[0]['id'] . " AND `id` = ".$tc_db->qstr($matches[2])."");
if ($result2 != '') {
if ($result2 == 0) {
$realid = $matches[2];
} else {
if ($result[0]['type'] != 1) {
$realid = $result2;
}
}
if ($result[0]["type"] != 1) {
return '<a href="'.KU_BOARDSFOLDER.$matches[1].'/res/'.$realid.'.html#'.$matches[2].'" class="ref|' . $matches[1] . '|' . $realid . '|' . $matches[2] . '">'.$matches[0].'</a>';
} else {
return '<a href="'.KU_BOARDSFOLDER.$matches[1].'/res/'.$realid.'.html" class="ref|' . $matches[1] . '|' . $realid . '|' . $realid . '">'.$matches[0].'</a>';
}
}
}
return $matches[0];
}
function Wordfilter($buffer, $board) {
global $tc_db;
$query = "SELECT * FROM `".KU_DBPREFIX."wordfilter`";
$results = $tc_db->GetAll($query);
foreach($results AS $line) {
$array_boards = explode('|', $line['boards']);
if (in_array($board, $array_boards)) {
$replace_word = $line['word'];
$replace_replacedby = $line['replacedby'];
$buffer = ($line['regex'] == 1) ? preg_replace($replace_word, $replace_replacedby, $buffer) : str_ireplace($replace_word, $replace_replacedby, $buffer);
}
}
return $buffer;
}
function CheckNotEmpty($buffer) {
$buffer_temp = str_replace("\n", "", $buffer);
$buffer_temp = str_replace("<br>", "", $buffer_temp);
$buffer_temp = str_replace("<br/>", "", $buffer_temp);
$buffer_temp = str_replace("<br />", "", $buffer_temp);
$buffer_temp = str_replace(" ", "", $buffer_temp);
if ($buffer_temp=="") {
return "";
} else {
return $buffer;
}
}
/* From http://us.php.net/wordwrap */
/*function CutWord($str, $maxLength, $char){
$wordEndChars = array(" ", "\n", "\r", "\f", "\v", "\0");
$count = 0;
$newStr = "";
$openTag = false;
for($i=0; $i<strlen($str); $i++){
$newStr .= $str{$i};
echo 'newstr: ' . $newStr . '<hr>' . "\n";
if($str{$i} == "<"){
$openTag = true;
continue;
}
if(($openTag) && ($str{$i} == ">")){
$openTag = false;
continue;
}
if(!$openTag){
if(!in_array($str{$i}, $wordEndChars)){//If not word ending char
$count++;
if($count==$maxLength){//if current word max length is reached
$newStr .= $char;//insert word break char
$count = 0;
}
}else{//Else char is word ending, reset word char count
$count = 0;
}
}
}//End for
die($newStr);
return $newStr;
}*/
/*function CutWord($txt, $where) {
if (empty($txt)) return false;
for ($c = 0, $a = 0, $g = 0; $c<strlen($txt); $c++) {
$d[$c+$g]=$txt[$c];
if ($txt[$c]!=' '&&$txt[$c]!=chr(10)) $a++;
else if ($txt[$c]==' '||$txt[$c]==chr(10)) $a = 0;
if ($a==$where) {
$g++;
$d[$c+$g]="\n";
$a = 0;
}
}
return implode("", $d);
}*/
function CutWord($txt, $where) {
$txt_split_primary = preg_split('/\n/', $txt);
$txt_processed = '';
$usemb = (function_exists('mb_substr') && function_exists('mb_strlen')) ? true : false;
foreach ($txt_split_primary as $txt_split) {
$txt_split_secondary = preg_split('/ /', $txt_split);
foreach ($txt_split_secondary as $txt_segment) {
$segment_length = ($usemb) ? mb_strlen($txt_segment) : strlen($txt_segment);
while ($segment_length > $where) {
if ($usemb) {
$txt_processed .= mb_substr($txt_segment, 0, $where) . "\n";
$txt_segment = mb_substr($txt_segment, $where);
$segment_length = mb_strlen($txt_segment);
} else {
$txt_processed .= substr($txt_segment, 0, $where) . "\n";
$txt_segment = substr($txt_segment, $where);
$segment_length = strlen($txt_segment);
}
}
$txt_processed .= $txt_segment . ' ';
}
$txt_processed = ($usemb) ? mb_substr($txt_processed, 0, -1) : substr($txt_processed, 0, -1);
$txt_processed .= "\n";
}
return $txt_processed;
}
function ParsePost($message, $board, $boardtype, $parentid, $boardid, $ispage = false) {
$this->boardtype = $boardtype;
$this->parentid = $parentid;
$this->boardid = $boardid;
$message = trim($message);
$message = $this->CutWord($message, (KU_LINELENGTH / 15));
$message = htmlspecialchars($message, ENT_QUOTES);
if (KU_MAKELINKS) {
$message = $this->MakeClickable($message);
}
$message = $this->ClickableQuote($message, $board, $boardtype, $parentid, $boardid, $ispage);
$message = $this->ColoredQuote($message, $boardtype);
/*if (KU_MARKDOWN) {
require KU_ROOTDIR . 'lib/markdown/markdown.php';
$message = Markdown($message);
}*/
$message = str_replace("\n", '<br />', $message);
$message = $this->BBCode($message);
$message = $this->Wordfilter($message, $board);
$message = $this->CheckNotEmpty($message);
return $message;
}
}
?>
+326
View File
@@ -0,0 +1,326 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* +------------------------------------------------------------------------------+
* Posting class
* +------------------------------------------------------------------------------+
*/
class Posting {
function CheckOekaki() {
global $board_class;
/* If oekaki seems to be in the url... */
if (isset($_POST['oekaki'])) {
/* See if it checks out and is a valid oekaki id */
if ($_POST['oekaki'] != '' && is_file(KU_CGIDIR . 'kusabaoek/' . $_POST['oekaki'] . '.png') && $board_class->board['type'] == '2') {
/* Set the variable to tell the script it is handling an oekaki posting, and the oekaki file which will be posted */
return KU_CGIDIR . 'kusabaoek/' . $_POST['oekaki'] . '.png';
}
}
return '';
}
function CheckReplyTime() {
global $tc_db, $board_class;
/* Get the timestamp of the last time a reply was made by this IP address */
$results = $tc_db->GetAll("SELECT MAX(timestamp) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `parentid` != 0 AND `ipmd5` = '" . md5($_SERVER['REMOTE_ADDR']) . "' AND `timestamp` > " . (time() - KU_REPLYDELAY));
/* If they have posted before and it was recorded... */
if (isset($result)) {
/* If the time was shorter than the minimum time distance */
if (time() - $line['timestamp'] <= KU_REPLYDELAY) {
exitWithErrorPage(_gettext('Please wait a moment before posting again.'), _gettext('You are currently posting faster than the configured minimum post delay allows.'));
}
}
}
function CheckNewThreadTime() {
global $tc_db, $board_class;
/* Get the timestamp of the last time a new thread was made by this IP address */
$result = $tc_db->GetOne("SELECT MAX(timestamp) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `parentid` = 0 AND `ipmd5` = '" . md5($_SERVER['REMOTE_ADDR']) . "' AND `timestamp` > " . (time() - KU_NEWTHREADDELAY));
/* If they have posted before and it was recorded... */
if (isset($result)) {
/* If the time was shorter than the minimum time distance */
if (time() - $result <= KU_NEWTHREADDELAY) {
exitWithErrorPage(_gettext('Please wait a moment before posting again.'), _gettext('You are currently posting faster than the configured minimum post delay allows.'));
}
}
}
function UTF8Strings() {
if (function_exists('mb_convert_encoding') && function_exists('mb_check_encoding')) {
if (isset($_POST['name']) && !mb_check_encoding($_POST['name'], 'UTF-8')) {
$_POST['name'] = mb_convert_encoding($_POST['name'], 'UTF-8');
}
if (isset($_POST['em']) && !mb_check_encoding($_POST['em'], 'UTF-8')) {
$_POST['em'] = mb_convert_encoding($_POST['em'], 'UTF-8');
}
if (isset($_POST['subject']) && !mb_check_encoding($_POST['subject'], 'UTF-8')) {
$_POST['subject'] = mb_convert_encoding($_POST['subject'], 'UTF-8');
}
if (isset($_POST['message']) && !mb_check_encoding($_POST['message'], 'UTF-8')) {
$_POST['message'] = mb_convert_encoding($_POST['message'], 'UTF-8');
}
}
}
function CheckValidPost($is_oekaki) {
global $tc_db, $board_class;
if (
( /* A message is set, or an image was provided */
isset($_POST['message']) ||
isset($_FILES['imagefile'])
) || /* It is a validated oekaki posting */
$is_oekaki ||
( /* It is a text board, meaning only a message is required */
$board_class->board['type'] == '1' &&
isset($_POST['message'])
) || (
( /* It has embedding allowed */
$board_class->board['uploadtype'] == '1' ||
$board_class->board['uploadtype'] == '2'
) && ( /* An embed ID was provided, or no file was checked and no ID was supplied */
isset($_POST['embed']) ||
(
$board_class->board['uploadtype'] == '2' &&
!isset($_FILES['imagefile']) &&
isset($_POST['nofile']) &&
$board_class->board['enablenofile'] == true
)
)
)
) {
return true;
} else {
return false;
}
}
function CheckMessageLength() {
global $board_class;
/* If the length of the message is greater than the board's maximum message length... */
if (strlen($_POST['message']) > $board_class->board['messagelength']) {
/* Kill the script, stopping the posting process */
exitWithErrorPage(sprintf(_gettext('Sorry, your message is too long. Message length: %d, maximum allowed length: %d'), strlen($_POST['message']), $board_class->board['messagelength']));
}
}
function CheckCaptcha() {
global $board_class;
/* If the board has captcha's enabled... */
if ($board_class->board['enablecaptcha'] == 1) {
/* Check if they entered the correct code. If not... */
if ($_SESSION['security_code'] != strtolower($_POST['captcha']) || empty($_SESSION['security_code'])) {
/* Kill the script, stopping the posting process */
exitWithErrorPage(_gettext('Incorrect captcha entered.'));
}
}
}
function CheckBannedHash() {
global $tc_db, $board_class, $bans_class;
/* Banned file hash check */
if (isset($_FILES['imagefile'])) {
if ($_FILES['imagefile']['name'] != '') {
$results = $tc_db->GetAll("SELECT `bantime` , `description` FROM `" . KU_DBPREFIX . "bannedhashes` WHERE `md5` = " . $tc_db->qstr(md5_file($_FILES['imagefile']['tmp_name'])) . " LIMIT 1");
if (count($results) > 0) {
$bans_class->BanUser($_SERVER['REMOTE_ADDR'], 'SERVER', '1', $results[0]['bantime'], '', 'Posting a banned file.<br />' . $results[0]['description'], 0, 0, 1);
$bans_class->BanCheck($_SERVER['REMOTE_ADDR'], $board_class->board['name']);
die();
}
}
}
}
function CheckIsReply() {
global $tc_db, $board_class;
/* If it appears this is a reply to a thread, and not a new thread... */
if (isset($_POST['replythread'])) {
if ($_POST['replythread'] != '0') {
/* Check if the thread id supplied really exists */
$results = $tc_db->GetOne("SELECT COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `IS_DELETED` = '0' AND `id` = " . $tc_db->qstr($_POST['replythread']) . " AND `parentid` = '0' LIMIT 1");
/* If it does... */
if ($results > 0) {
return true;
/* If it doesn't... */
} else {
/* Kill the script, stopping the posting process */
exitWithErrorPage(_gettext('Invalid thread ID.'), _gettext('That thread may have been recently deleted.'));
}
}
}
return false;
}
function CheckNotDuplicateSubject($subject) {
global $tc_db, $board_class;
$result = $tc_db->GetOne("SELECT COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `IS_DELETED` = '0' AND `subject` = " . $tc_db->qstr($subject) . " AND `parentid` = '0'");
if ($result > 0) {
exitWithErrorPage(_gettext('Duplicate thread subject'), _gettext('Text boards may have only one thread with a unique subject. Please pick another.'));
}
}
function GetThreadInfo($id) {
global $tc_db, $board_class;
/* Check if the thread id supplied really exists and if it is locked */
$results = $tc_db->GetAll("SELECT `id`,`locked` FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `IS_DELETED` = '0' AND `id` = " . $tc_db->qstr($id) . " AND `parentid` = '0'");
/* If it does... */
if (count($results) > 0) {
/* Get the thread's info */
$thread_locked = $results[0]['locked'];
$thread_replyto = $results[0]['id'];
/* Get the number of replies */
$result = $tc_db->GetOne("SELECT COUNT(id) FROM `" . KU_DBPREFIX ."posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `IS_DELETED` = '0' AND `parentid` = " . $tc_db->qstr($id) . "");
$thread_replies = $result;
return array($thread_replies, $thread_locked, $thread_replyto);
} else {
/* If it doesn't, kill the script, stopping the posting process */
exitWithErrorPage(_gettext('Invalid thread ID.'), _gettext('That thread may have been recently deleted.'));
}
}
function GetFields() {
/* Fetch and process the name, email, and subject fields from the post data */
$post_name = isset($_POST['name']) ? htmlspecialchars($_POST['name'], ENT_QUOTES) : '';
$post_email = isset($_POST['em']) ? str_replace('"', '', strip_tags($_POST['em'])) : '';
/* If the user used a software function, don't store it in the database */
if ($post_email == 'return' || $post_email == 'noko') $post_email = '';
$post_subject = isset($_POST['subject']) ? htmlspecialchars($_POST['subject'], ENT_QUOTES) : '';
return array($post_name, $post_email, $post_subject);
}
function GetUserAuthority() {
global $tc_db, $board_class;
$user_authority = 0;
$flags = '';
if (isset($_POST['modpassword'])) {
$results = $tc_db->GetAll("SELECT `type`, `boards` FROM `" . KU_DBPREFIX . "staff` WHERE `username` = '" . md5_decrypt($_POST['modpassword'], KU_RANDOMSEED) . "' LIMIT 1");
if (count($results) > 0) {
if ($results[0][0] == 1) {
$user_authority = 1; // admin
} elseif ($results[0][0] == 2 && in_array($board_class->board['name'], explode('|', $results[0][1]))) {
$user_authority = 2; // mod
} elseif ($results[0][0] == 2 && $results[0][1] == 'allboards') {
$user_authority = 2;
}/* elseif ($results[0][0] == 3) {
$user_authority = 3; // VIP
}*/
if ($user_authority < 3) { /* set posting flags for mods and admins */
if (isset($_POST['displaystaffstatus'])) $flags .= 'D';
if (isset($_POST['lockonpost'])) $flags .= 'L';
if (isset($_POST['stickyonpost'])) $flags .= 'S';
if (isset($_POST['rawhtml'])) $flags .= 'RH';
if (isset($_POST['usestaffname'])) $flags .= 'N';
}
}
}
return array($user_authority, $flags);
}
function CheckBadUnicode($post_name, $post_email, $post_subject, $post_message) {
/* Check for bad characters which can cause the page to deform (right-to-left markers, etc) */
$bad_ords = array(8235, 8238);
$ords_name = unistr_to_ords($post_name);
$ords_email = unistr_to_ords($post_email);
$ords_subject = unistr_to_ords($post_subject);
$ords_message = unistr_to_ords($post_message);
$ords_filename = isset($_FILES['imagefile']) ? unistr_to_ords($_FILES['imagefile']['name']) : '';
foreach ($bad_ords as $bad_ord) {
if ($ords_name != '') {
if (in_array($bad_ord, $ords_name)) {
exitWithErrorPage(_gettext('Your post contains one or more illegal characters.'));
}
}
if ($ords_email != '') {
if (in_array($bad_ord, $ords_email)) {
exitWithErrorPage(_gettext('Your post contains one or more illegal characters.'));
}
}
if ($ords_subject != '') {
if (in_array($bad_ord, $ords_subject)) {
exitWithErrorPage(_gettext('Your post contains one or more illegal characters.'));
}
}
if ($ords_message != '') {
if (in_array($bad_ord, $ords_message)) {
exitWithErrorPage(_gettext('Your post contains one or more illegal characters.'));
}
}
if ($ords_filename != '') {
if (in_array($bad_ord, $ords_filename)) {
exitWithErrorPage(_gettext('Your post contains one or more illegal characters.'));
}
}
}
}
function GetPostTag() {
global $board_class;
/* Check for and parse tags if one was provided, and they are enabled */
$post_tag = '';
$tags = unserialize(KU_TAGS);
if ($board_class->board['type'] == 3 && $tags != '' && isset($_POST['tag'])) {
if ($_POST['tag'] != '') {
$validtag = false;
while (list($tag, $tag_abbr) = each($tags)) {
if ($tag_abbr == $_POST['tag']) {
$validtag = true;
}
}
if ($validtag) {
$post_tag = $_POST['tag'];
}
}
}
return $post_tag;
}
function CheckBlacklistedText() {
global $bans_class, $tc_db;
$badlinks = array_map('rtrim', file(KU_ROOTDIR . 'spam.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES));
foreach ($badlinks as $badlink) {
if (stripos($_POST['message'], $badlink) !== false) {
/* They included a blacklisted link in their post. Ban them for an hour */
$bans_class->BanUser($_SERVER['REMOTE_ADDR'], 'board.php', 1, 3600, '', $tc_db->qstr(_gettext('Posting a blacklisted link.') . ' (' . $badlink . ')'), $tc_db->qstr($_POST['message']));
exitWithErrorPage(sprintf(_gettext('Blacklisted link ( %s ) detected.'), $badlink));
}
}
}
}
?>
+98
View File
@@ -0,0 +1,98 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/***************************************************************************
*
* Author : Eric Sizemore ( www.secondversion.com & www.phpsociety.com )
* Package : Random Word
* Version : 1.0.1
* Copyright: (C) 2006 - 2007 Eric Sizemore
* Site : www.secondversion.com & www.phpsociety.com
* Email : esizemore05@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
***************************************************************************/
// Slightly inspired by class randomWord by kumar mcmillan
class Rand_Word {
var $vowels = array('a','e','i','o','u');
var $consonants = array('b','c','d','f','g','h','j','k','l','m','n','p','r','s','t','v','w','z','ch','qu','th','xy');
var $word = '';
/**
* Constructor.
*
* @param integer Length of the word
* @param boolean Return the word lowercase?
* @param boolean Reutrn the word with the first letter capitalized?
* @param boolean Return the word uppercase?
* @return string
*/
function rand_word($length = 5, $lower_case = true, $ucfirst = false, $upper_case = false)
{
$done = false;
$const_or_vowel = 1;
while (!$done)
{
switch ($const_or_vowel)
{
case 1:
$this->word .= $this->consonants[array_rand($this->consonants)];
$const_or_vowel = 2;
break;
case 2:
$this->word .= $this->vowels[array_rand($this->vowels)];
$const_or_vowel = 1;
break;
}
if (strlen($this->word) >= $length)
{
$done = true;
}
}
$this->word = substr($this->word, 0, $length);
if ($lower_case)
{
$this->word = strtolower($this->word);
}
else if ($ucfirst)
{
$this->word = ucfirst(strtolower($this->word));
}
else if ($upper_case)
{
$this->word = strtoupper($this->word);
}
return $this->word;
}
}
?>
+50
View File
@@ -0,0 +1,50 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* +------------------------------------------------------------------------------+
* RSS class
* +------------------------------------------------------------------------------+
* Generates latest posts RSS, as well as ModLog RSS
* +------------------------------------------------------------------------------+
*/
class RSS {
function GenerateRSS($rssboard, $rssboardid) {
if (isset($rssboard)) {
global $tc_db;
require_once KU_ROOTDIR.'lib/dwoo.php';
$dwoo = new Dwoo();
$dwoo_data = new Dwoo_Data();
$posts = $tc_db->GetAll("SELECT * FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $rssboardid . " AND `IS_DELETED` = '0' ORDER BY `id` DESC LIMIT 15");
$dwoo_data->assign('posts', $posts);
$dwoo_data->assign('boardname', $rssboard);
$rss = $dwoo->get(KU_TEMPLATEDIR . '/rss_board.tpl', $dwoo_data);
}
return $rss;
}
function GenerateModLogRSS() {
global $tc_db;
require_once KU_ROOTDIR.'lib/dwoo.php';
$dwoo = new Dwoo();
$dwoo_data = new Dwoo_Data();
$entries = $tc_db->GetAll("SELECT * FROM `".KU_DBPREFIX."modlog` ORDER BY `timestamp` DESC LIMIT 15");
$dwoo_data->assign('entries', $entries);
$rss = $dwoo->get(KU_TEMPLATEDIR . '/rss_mod.tpl', $dwoo_data);
return($rss);
}
}
?>
+51
View File
@@ -0,0 +1,51 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* +------------------------------------------------------------------------------+
* SVG parsing class
* +------------------------------------------------------------------------------+
*/
class Svg {
var $width = 0;
var $height = 0;
var $id = '';
var $version = '';
var $namespaces;
var $docname = '';
var $docbase = '';
var $sodipodiversion = '';
var $inkscapeversion = '';
var $output_extension = '';
function Svg($svg){
$xml = new SimpleXMLElement($svg,1,1);
$this->width = (string) $xml['width'];
$this->height = (string) $xml['height'];
$this->id = (string) $xml['id'];
$this->version = (string) $xml['version'];
$this->namespaces = $xml->getNamespaces();
$sodipodi = $xml->attributes($this->namespaces['sodipodi']);
$this->docname = (string) $sodipodi['docname'];
$this->docbase = (string) $sodipodi['docbase'];
$this->sodipodiversion = (string) $sodipodi['version'];
$inkscape = $xml->attributes($this->namespaces['inkscape']);
$this->inkscapeversion = (string) $inkscape['version'];
$this->output_extension = (string) $inkscape['ouput_extension'];
}
}
?>
+407
View File
@@ -0,0 +1,407 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* +------------------------------------------------------------------------------+
* Upload class
* +------------------------------------------------------------------------------+
* Used for image/misc file upload through the post form on board/thread pages
* +------------------------------------------------------------------------------+
*/
class Upload {
var $file_name = '';
var $original_file_name = '';
var $file_type = '';
var $file_md5 = '';
var $file_location = '';
var $file_thumb_location = '';
var $file_is_special = false;
var $imgWidth = 0;
var $imgHeight = 0;
var $file_size = 0;
var $imgWidth_thumb = 0;
var $imgHeight_thumb = 0;
var $isreply = false;
function HandleUpload() {
global $tc_db, $board_class, $is_oekaki, $oekaki;
if (!$is_oekaki) {
if ($board_class->board['type'] == 0 || $board_class->board['type'] == 2 || $board_class->board['type'] == 3) {
$imagefile_name = isset($_FILES['imagefile']) ? $_FILES['imagefile']['name'] : '';
if ($imagefile_name != '') {
if (strpos($_FILES['imagefile']['name'], ',') != false) {
exitWithErrorPage(_gettext('Please select only one image to upload.'));
}
if ($_FILES['imagefile']['size'] > $board_class->board['maximagesize']) {
exitWithErrorPage(sprintf(_gettext('Please make sure your file is smaller than %dB'), $board_class->board['maximagesize']));
}
switch ($_FILES['imagefile']['error']) {
case UPLOAD_ERR_OK:
break;
case UPLOAD_ERR_INI_SIZE:
exitWithErrorPage(sprintf(_gettext('The uploaded file exceeds the upload_max_filesize directive (%s) in php.ini.')), ini_get('upload_max_filesize'));
break;
case UPLOAD_ERR_FORM_SIZE:
exitWithErrorPage(sprintf(_gettext('Please make sure your file is smaller than %dB'), $board_class->board['maximagesize']));
break;
case UPLOAD_ERR_PARTIAL:
exitWithErrorPage(_gettext('The uploaded file was only partially uploaded.'));
break;
case UPLOAD_ERR_NO_FILE:
exitWithErrorPage(_gettext('No file was uploaded.'));
break;
case UPLOAD_ERR_NO_TMP_DIR:
exitWithErrorPage(_gettext('Missing a temporary folder.'));
break;
case UPLOAD_ERR_CANT_WRITE:
exitWithErrorPage(_gettext('Failed to write file to disk'));
break;
default:
exitWithErrorPage(_gettext('Unknown File Error'));
}
$this->file_type = preg_replace('/.*(\..+)/','\1',$_FILES['imagefile']['name']);
if ($this->file_type == '.jpeg') {
/* Fix for the rarely used 4-char format */
$this->file_type = '.jpg';
}
$pass = true;
if (!is_file($_FILES['imagefile']['tmp_name']) || !is_readable($_FILES['imagefile']['tmp_name'])) {
$pass = false;
} else {
if ($this->file_type == '.jpg' || $this->file_type == '.gif' || $this->file_type == '.png') {
if (!@getimagesize($_FILES['imagefile']['tmp_name'])) {
$pass = false;
}
}
}
if (!$pass) {
exitWithErrorPage(_gettext('File transfer failure. Please go back and try again.'));
}
$this->file_name = substr(htmlspecialchars(preg_replace('/(.*)\..+/','\1',$_FILES['imagefile']['name']), ENT_QUOTES), 0, 50);
$this->file_name = str_replace('.','_',$this->file_name);
$this->original_file_name = $this->file_name;
$this->file_md5 = md5_file($_FILES['imagefile']['tmp_name']);
$exists_thread = checkMd5($this->file_md5, $board_class->board['name'], $board_class->board['id']);
if (is_array($exists_thread)) {
exitWithErrorPage(_gettext('Duplicate file entry detected.'), sprintf(_gettext('Already posted %shere%s.'),'<a href="' . KU_BOARDSPATH . '/' . $board_class->board['name'] . '/res/' . $exists_thread[0] . '.html#' . $exists_thread[1] . '">','</a>'));
}
if (strtolower($this->file_type) == 'svg') {
require_once 'svg.class.php';
$svg = new Svg($_FILES['imagefile']['tmp_name']);
$this->imgWidth = $svg->width;
$this->imgHeight = $svg->height;
} else {
$imageDim = getimagesize($_FILES['imagefile']['tmp_name']);
$this->imgWidth = $imageDim[0];
$this->imgHeight = $imageDim[1];
}
$this->file_type = strtolower($this->file_type);
$this->file_size = $_FILES['imagefile']['size'];
$filetype_forcethumb = $tc_db->GetOne("SELECT " . KU_DBPREFIX . "filetypes.force_thumb FROM " . KU_DBPREFIX . "boards, " . KU_DBPREFIX . "filetypes, " . KU_DBPREFIX . "board_filetypes WHERE " . KU_DBPREFIX . "boards.id = " . KU_DBPREFIX . "board_filetypes.boardid AND " . KU_DBPREFIX . "filetypes.id = " . KU_DBPREFIX . "board_filetypes.typeid AND " . KU_DBPREFIX . "boards.name = '" . $board_class->board['name'] . "' and " . KU_DBPREFIX . "filetypes.filetype = '" . substr($this->file_type, 1) . "';");
if ($filetype_forcethumb != '') {
if ($filetype_forcethumb == 0) {
$this->file_name = time() . mt_rand(1, 99);
/* If this board has a load balance url and password configured for it, attempt to use it */
if ($board_class->board['loadbalanceurl'] != '' && $board_class->board['loadbalancepassword'] != '') {
require_once KU_ROOTDIR . 'inc/classes/loadbalancer.class.php';
$loadbalancer = new Load_Balancer;
$loadbalancer->url = $board_class->board['loadbalanceurl'];
$loadbalancer->password = $board_class->board['loadbalancepassword'];
$response = $loadbalancer->Send('thumbnail', base64_encode(file_get_contents($_FILES['imagefile']['tmp_name'])), 'src/' . $this->file_name . $this->file_type, 'thumb/' . $this->file_name . 's' . $this->file_type, 'thumb/' . $this->file_name . 'c' . $this->file_type, '', $this->isreply, true);
if ($response != 'failure' && $response != '') {
$response_unserialized = unserialize($response);
$this->imgWidth_thumb = $response_unserialized['imgw_thumb'];
$this->imgHeight_thumb = $response_unserialized['imgh_thumb'];
$imageused = true;
} else {
exitWithErrorPage(_gettext('File was not properly thumbnailed').': ' . $response);
}
/* Otherwise, use this script alone */
} else {
$this->file_location = KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type;
$this->file_thumb_location = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 's' . $this->file_type;
$this->file_thumb_cat_location = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 'c' . $this->file_type;
if (!move_uploaded_file($_FILES['imagefile']['tmp_name'], $this->file_location)) {
exitWithErrorPage(_gettext('Could not copy uploaded image.'));
}
chmod($this->file_location, 0644);
if ($_FILES['imagefile']['size'] == filesize($this->file_location)) {
if ((!$this->isreply && ($this->imgWidth > KU_THUMBWIDTH || $this->imgHeight > KU_THUMBHEIGHT)) || ($this->isreply && ($this->imgWidth > KU_REPLYTHUMBWIDTH || $this->imgHeight > KU_REPLYTHUMBHEIGHT))) {
if (!$this->isreply) {
if (!createThumbnail($this->file_location, $this->file_thumb_location, KU_THUMBWIDTH, KU_THUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
} else {
if (!createThumbnail($this->file_location, $this->file_thumb_location, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
}
} else {
if (!createThumbnail($this->file_location, $this->file_thumb_location, $this->imgWidth, $this->imgHeight)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
}
if (!createThumbnail($this->file_location, $this->file_thumb_cat_location, KU_CATTHUMBWIDTH, KU_CATTHUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
$imageDim_thumb = getimagesize($this->file_thumb_location);
$this->imgWidth_thumb = $imageDim_thumb[0];
$this->imgHeight_thumb = $imageDim_thumb[1];
$imageused = true;
} else {
exitWithErrorPage(_gettext('File was not fully uploaded. Please go back and try again.'));
}
}
} else {
/* Fetch the mime requirement for this special filetype */
$filetype_required_mime = $tc_db->GetOne("SELECT `mime` FROM `" . KU_DBPREFIX . "filetypes` WHERE `filetype` = " . $tc_db->qstr(substr($this->file_type, 1)));
$this->file_name = htmlspecialchars_decode($this->file_name, ENT_QUOTES);
$this->file_name = stripslashes($this->file_name);
$this->file_name = str_replace("\x80", " ", $this->file_name);
$this->file_name = str_replace(' ', '_', $this->file_name);
$this->file_name = str_replace('#', '(number)', $this->file_name);
$this->file_name = str_replace('@', '(at)', $this->file_name);
$this->file_name = str_replace('/', '(fwslash)', $this->file_name);
$this->file_name = str_replace('\\', '(bkslash)', $this->file_name);
/* If this board has a load balance url and password configured for it, attempt to use it */
if ($board_class->board['loadbalanceurl'] != '' && $board_class->board['loadbalancepassword'] != '') {
require_once KU_ROOTDIR . 'inc/classes/loadbalancer.class.php';
$loadbalancer = new Load_Balancer;
$loadbalancer->url = $board_class->board['loadbalanceurl'];
$loadbalancer->password = $board_class->board['loadbalancepassword'];
if ($filetype_required_mime != '') {
$checkmime = $filetype_required_mime;
} else {
$checkmime = '';
}
$response = $loadbalancer->Send('direct', $_FILES['imagefile']['tmp_name'], 'src/' . $this->file_name . $this->file_type, '', '', $checkmime, false, true);
$this->file_is_special = true;
/* Otherwise, use this script alone */
} else {
$this->file_location = KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type;
if($this->file_type == '.mp3') {
require_once(KU_ROOTDIR . 'lib/getid3/getid3.php');
$getID3 = new getID3;
$getID3->analyze($_FILES['imagefile']['tmp_name']);
if (isset($getID3->info['id3v2']['APIC'][0]['data']) && isset($getID3->info['id3v2']['APIC'][0]['image_mime'])) {
$source_data = $getID3->info['id3v2']['APIC'][0]['data'];
$mime = $getID3->info['id3v2']['APIC'][0]['image_mime'];
}
elseif (isset($getID3->info['id3v2']['PIC'][0]['data']) && isset($getID3->info['id3v2']['PIC'][0]['image_mime'])) {
$source_data = $getID3->info['id3v2']['PIC'][0]['data'];
$mime = $getID3->info['id3v2']['PIC'][0]['image_mime'];
}
if($source_data) {
$im = imagecreatefromstring($source_data);
if (preg_match("/png/", $mime)) {
$ext = ".png";
imagepng($im,$this->file_location.".tmp",0,PNG_ALL_FILTERS);
} else if (preg_match("/jpg|jpeg/", $mime)) {
$ext = ".jpg";
imagejpeg($im, $this->file_location.".tmp");
} else if (preg_match("/gif/", $mime)) {
$ext = ".gif";
imagegif($im, $this->file_location.".tmp");
}
$this->file_thumb_location = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name .'s'. $ext;
if (!$this->isreply) {
if (!createThumbnail($this->file_location.".tmp", $this->file_thumb_location, KU_THUMBWIDTH, KU_THUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
} else {
if (!createThumbnail($this->file_location.".tmp", $this->file_thumb_location, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
}
$imageDim_thumb = getimagesize($this->file_thumb_location);
$this->imgWidth_thumb = $imageDim_thumb[0];
$this->imgHeight_thumb = $imageDim_thumb[1];
$imageused = true;
unlink($this->file_location.".tmp");
}
}
/* Move the file from the post data to the server */
if (!move_uploaded_file($_FILES['imagefile']['tmp_name'], $this->file_location)) {
exitWithErrorPage(_gettext('Could not copy uploaded image.'));
}
/* Check if the filetype provided comes with a MIME restriction */
if ($filetype_required_mime != '') {
/* Check if the MIMEs don't match up */
if (mime_content_type($this->file_location) != $filetype_required_mime) {
/* Delete the file we just uploaded and kill the script */
unlink($this->file_location);
exitWithErrorPage(_gettext('Invalid MIME type for this filetype.'));
}
}
/* Make sure the entire file was uploaded */
if ($_FILES['imagefile']['size'] == filesize($this->file_location)) {
$imageused = true;
} else {
exitWithErrorPage(_gettext('File transfer failure. Please go back and try again.'));
}
/* Flag that the file used isn't an internally supported type */
$this->file_is_special = true;
}
}
} else {
exitWithErrorPage(_gettext('Sorry, that filetype is not allowed on this board.'));
}
} elseif (isset($_POST['embed'])) {
if ($_POST['embed'] != '') {
$_POST['embed'] = strip_tags(substr($_POST['embed'], 0, 20));
$video_id = $_POST['embed'];
$this->file_name = $video_id;
if ($video_id != '' && strpos($video_id, '@') == false && strpos($video_id, '&') == false) {
$embeds = $tc_db->GetAll("SELECT HIGH_PRIORITY * FROM `" . KU_DBPREFIX . "embeds`");
$worked = false;
foreach ($embeds as $line) {
if ((strtolower($_POST['embedtype']) == strtolower($line['name'])) && in_array($line['filetype'], explode(',', $board_class->board['embeds_allowed']))) {
$worked = true;
$videourl_start = $line['videourl'];
$this->file_type = '.' . strtolower($line['filetype']);
}
}
if (!$worked) {
exitWithErrorPage(_gettext('Invalid video type.'));
}
$results = $tc_db->GetOne("SELECT COUNT(*) FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `file` = " . $tc_db->qstr($video_id) . " AND `IS_DELETED` = 0");
if ($results[0] == 0) {
$video_check = check_link($videourl_start . $video_id);
switch ($video_check[1]) {
case 404:
exitWithErrorPage(_gettext('Unable to connect to') .': '. $videourl_start . $video_id);
break;
case 303:
exitWithErrorPage(_gettext('Invalid video ID.'));
break;
case 302:
// Continue
break;
case 301:
// Continue
break;
case 200:
// Continue
break;
default:
exitWithErrorPage(_gettext('Invalid response code ') .':'. $video_check[1]);
break;
}
} else {
$results = $tc_db->GetAll("SELECT `id`,`parentid` FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $board_class->board['id'] . " AND `file` = " . $tc_db->qstr($video_id) . " AND `IS_DELETED` = 0 LIMIT 1");
foreach ($results as $line) {
$real_threadid = ($line[1] == 0) ? $line[0] : $line[1];
exitWithErrorPage(sprintf(_gettext('That video ID has already been posted %shere%s.'),'<a href="' . KU_BOARDSFOLDER . '/' . $board_class->board['name'] . '/res/' . $real_threadid . '.html#' . $line[1] . '">','</a>'));
}
}
} else {
exitWithErrorPage(_gettext('Invalid ID'));
}
}
}
}
} else {
$this->file_name = time() . mt_rand(1, 99);
$this->original_file_name = $this->file_name;
$this->file_md5 = md5_file($oekaki);
$this->file_type = '.png';
$this->file_size = filesize($oekaki);
$imageDim = getimagesize($oekaki);
$this->imgWidth = $imageDim[0];
$this->imgHeight = $imageDim[1];
if (!copy($oekaki, KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type)) {
exitWithErrorPage(_gettext('Could not copy uploaded image.'));
}
$oekaki_animation = substr($oekaki, 0, -4) . '.pch';
if (file_exists($oekaki_animation)) {
if (!copy($oekaki_animation, KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . '.pch')) {
exitWithErrorPage(_gettext('Could not copy animation.'));
}
unlink($oekaki_animation);
}
$thumbpath = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 's' . $this->file_type;
$thumbpath_cat = KU_BOARDSDIR . $board_class->board['name'] . '/thumb/' . $this->file_name . 'c' . $this->file_type;
if (
(!$this->isreply && ($this->imgWidth > KU_THUMBWIDTH || $this->imgHeight > KU_THUMBHEIGHT)) ||
($this->isreply && ($this->imgWidth > KU_REPLYTHUMBWIDTH || $this->imgHeight > KU_REPLYTHUMBHEIGHT))
) {
if (!$this->isreply) {
if (!createThumbnail($oekaki, $thumbpath, KU_THUMBWIDTH, KU_THUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
} else {
if (!createThumbnail($oekaki, $thumbpath, KU_REPLYTHUMBWIDTH, KU_REPLYTHUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
}
} else {
if (!createThumbnail($oekaki, $thumbpath, $this->imgWidth, $this->imgHeight)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
}
if (!createThumbnail($oekaki, $thumbpath_cat, KU_CATTHUMBWIDTH, KU_CATTHUMBHEIGHT)) {
exitWithErrorPage(_gettext('Could not create thumbnail.'));
}
$imgDim_thumb = getimagesize($thumbpath);
$this->imgWidth_thumb = $imgDim_thumb[0];
$this->imgHeight_thumb = $imgDim_thumb[1];
unlink($oekaki);
}
}
}
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

+1
View File
@@ -0,0 +1 @@
If you wish to allow different filetypes to be uploaded than the default which come with TC, place your own images here and add the filetype in the manage panel.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

+22
View File
@@ -0,0 +1,22 @@
<?php
function clearBlotterCache() {
if (KU_APC) {
apc_delete('blotter|all');
apc_delete('blotter|last4');
}
}
/**
* Clear cache for the supplied post ID of the supplied board
*
* @param integer $id Post ID
* @param string $board Board name
*/
function clearPostCache($id, $board) {
global $tc_db;
if (KU_APC) {
apc_delete('post|' . $board . '|' . $id);
}
$tc_db->Execute("DELETE FROM `" . KU_DBPREFIX . "reports` WHERE `postid` = " . $id . " AND `board` = " . $tc_db->qstr($board));
}
?>
+136
View File
@@ -0,0 +1,136 @@
<?php
function getQuoteIds($quote, $replies = false) {
$rangeids_validated = array();
if (strpos($quote, ',') !== false) {
$postids = split(',', $quote);
} else {
$postids = array($quote);
}
$i = 0;
foreach ($postids as $postid) {
if (strpos($postid, 'l') === 0 && $replies !== false) {
if (strlen($postid) > 1) {
$last_posts_to_fetch = substr($postid, 1);
if ($last_posts_to_fetch >= 1) {
$last_posts_to_fetch = min($last_posts_to_fetch, $replies);
$min_posts_to_fetch = max((($replies + 1) - $last_posts_to_fetch), 1);
if ($min_posts_to_fetch > 1) {
$min_posts_to_fetch++;
}
$lastposts = range($min_posts_to_fetch, ($replies + 1));
$key = array_search($postid, $postids, true);
array_insert($postids, $key, $lastposts);
$key = array_search($postid, $postids, true);
if ($key !== false) {
unset($postids[$key]);
}
}
}
}
if (strpos($postid, '-') !== false) {
$range_processed = Array();
$rangeids = split('-', $postid);
if (count($rangeids) == 2) {
if(empty($rangeids[1])){
$postids['BETWEEN'][$i][] = 0;
$postids['BETWEEN'][$i][] = $rangeids[0];
}
else {
$postids['BETWEEN'][$i][] = $rangeids[0];
$postids['BETWEEN'][$i][] = $rangeids[1];
}
$i++;
}
}
if (strpos($postid, 'r') === 0 && $replies !== false) {
if (strlen($postid) > 1) {
$random_posts_to_fetch = substr($postid, 1);
if ($random_posts_to_fetch >= 1) {
$randposts = array();
//$random_posts_to_fetch = min($random_posts_to_fetch, $replies);
for ($i=0;$i<$random_posts_to_fetch;$i++) {
$postinserted = false;
while (!$postinserted) {
$randpost = rand(1, $replies);
//if (!in_array($randpost, $randposts)) {
$randposts[] = $randpost;
$postinserted = true;
//}
}
}
$key = array_search($postid, $postids, true);
array_insert($postids, $key, $randposts);
$key = array_search($postid, $postids, true);
if ($key !== false) {
unset($postids[$key]);
}
}
}
}
}
return $postids;
}
function array_insert(&$array, $position, $insert_array) {
if (!is_int($position)) {
$i = 0;
foreach ($array as $key => $value) {
if ($key == $position) {
$position = $i;
break;
}
$i++;
}
}
$first_array = array_splice($array, 0, $position);
$array = array_merge($first_array, $insert_array, $array);
}
function cleanBoardName($board) {
return trim(str_replace('/', '', str_replace('|', '', str_replace(' ', '', $board))));
}
/**
* Convert a board ID to a board name
*
* @param integer $boardid Board ID
* @return string Board directory
*/
function boardid_to_dir($boardid) {
global $tc_db;
$query = "SELECT `name` FROM `".KU_DBPREFIX."boards` WHERE `id` = ".$tc_db->qstr($boardid)."";
$results = $tc_db->SelectLimit($query, 1);
if (count($results)>0) {
foreach($results AS $line) {
return $line['name'];
}
}
}
/**
* Calculate the number of pages which will be needed for the supplied number of posts
*
* @param integer $boardtype Board type
* @param integer $numposts Number of posts
* @return integer Number of pages required
*/
function calculatenumpages($boardtype, $numposts) {
if ($boardtype==1) {
return (floor($numposts/KU_THREADSTXT));
} elseif ($boardtype==3) {
return (floor($numposts/30));
}
return (floor($numposts/KU_THREADS));
}
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
/* Place any functions you create here. Note that this is not meant for module functions, which should be placed in the module's php file. */
?>
+169
View File
@@ -0,0 +1,169 @@
<?php
/**
* Recursively delete a directory
*
* @param string $path Intial path to delete
*/
function removeDir($path) {
$normal_files = glob($path . "*");
$hidden_files = glob($path . "\.?*");
$all_files = array_merge($normal_files, $hidden_files);
foreach ($all_files as $file) {
/* Skip pseudo links to current and parent dirs (./ and ../). */
if (preg_match("/(\.|\.\.)$/", $file))
{
continue;
}
if (is_file($file) === TRUE) {
/* Remove each file in this Directory */
unlink($file);
echo _gettext('Removed File').': '. $file . "<br />";
}
else if (is_dir($file) === TRUE) {
/* If this Directory contains a Subdirectory, run this Function on it */
removeDir($file);
}
}
/* Remove Directory once Files have been removed (If Exists) */
if (is_dir($path) === TRUE) {
rmdir($path);
echo '<br />'. _gettext('Removed Directory').': ' . $path . "<br /><br />";
}
}
/**
* Remove a board
*
* @param string $dir Directory to remove
* @return boolean Result
*/
function removeBoard($dir){
global $tc_db;
if(!isset($GLOBALS['remerror'])) {
$GLOBALS['remerror'] = false;
}
if($handle = opendir(KU_BOARDSDIR . $dir)){ /* If the folder exploration is sucsessful, continue */
while (false !== ($file = readdir($handle))){ /* As long as storing the next file to $file is successful, continue */
$path = $dir . '/' . $file;
if(is_file(KU_BOARDSDIR . $path)){
if(!unlink(KU_BOARDSDIR . $path)){
echo '<u><font color="red">'.sprintf(_gettext('"%s" could not be deleted. This may be due to a permissions problem.</u><br />Directory cannot be deleted until all files are deleted.'), $path).'</font><br />';
$GLOBALS['remerror'] = true;
return false;
}
} else
if(is_dir(KU_BOARDSDIR . $path) && substr($file, 0, 1) != '.'){
removeBoard($path);
@rmdir(KU_BOARDSDIR . $path);
}
}
closedir($handle); /* Close the folder exploration */
}
if(!$GLOBALS['remerror']) /* If no errors occured, delete the now empty directory */
if(!rmdir(KU_BOARDSDIR . $dir)){
echo '<strong><font color="red">'.sprintf(_gettext('Could not remove directory "%s". This may be due to a permissions problem.'),$dir).'</font></strong><br />'.$GLOBALS['remerror'];
return false;
} else
return true;
return false;
}
/*
------------ lixlpixel recursive PHP functions -------------
recursive_directory_size( directory, human readable format )
expects path to directory and optional TRUE / FALSE
PHP has to have the rights to read the directory you specify
and all files and folders inside the directory to count size
if you choose to get human readable format,
the function returns the filesize in bytes, KB and MB
------------------------------------------------------------
to use this function to get the filesize in bytes, write:
recursive_directory_size('path/to/directory/to/count');
to use this function to get the size in a nice format, write:
recursive_directory_size('path/to/directory/to/count',TRUE);
*/
/**
* Find the size of a directory, including any subdirectories
*
* @param string $directory Directory
* @param boolean $format Format
* @return array Size/number of files
*/
function recursive_directory_size($directory, $format=FALSE)
{
$size = 0;
$files = 0;
/* If the path has a slash at the end we remove it here */
if(substr($directory,-1) == '/')
{
$directory = substr($directory,0,-1);
}
/* If the path is not valid or is not a directory ... */
if(!file_exists($directory) || !is_dir($directory) || !is_readable($directory))
{
/* ... We return -1 and exit the function */
return -1;
}
/* We open the directory */
if($handle = opendir($directory))
{
/* And scan through the items inside */
while(($file = readdir($handle)) !== false)
{
/* We build the new path */
$path = $directory.'/'.$file;
/* If the filepointer is not the current directory or the parent directory */
if($file != '.' && $file != '..')
{
/* If the new path is a file */
if(is_file($path))
{
/* We add the filesize to the total size */
$size += filesize($path);
$files++;
/* If the new path is a directory */
}elseif(is_dir($path))
{
/* If $format is set to true, follow the directory and recalculate from there */
if ($format) {
/* We call this function with the new path */
$handlesize = recursive_directory_size($path);
if (is_int($handlesize)) {
/* If the function returns more than zero */
if($handlesize >= 0)
{
/* We add the result to the total size */
$size += $handlesize;
/* Else we return -1 and exit the function */
}else{
return -1;
}
/* Else we return -1 and exit the function */
}else{
return -1;
}
}
}
}
}
/* Close the directory */
closedir($handle);
}
/* Return the total filesize in bytes */
return array($size,$files);
}
?>
+44
View File
@@ -0,0 +1,44 @@
<?php
/*
* Common encryption functions
*
* Allow for more advanced encryption using the random seed set in the
* configuration.
*/
function get_rnd_iv($iv_len) {
$iv = '';
while ($iv_len-- > 0) {
$iv .= chr(mt_rand() & 0xff);
}
return $iv;
}
function md5_encrypt($plain_text, $password, $iv_len = 16) {
$plain_text .= "\x13";
$n = strlen($plain_text);
if ($n % 16) $plain_text .= str_repeat("\0", 16 - ($n % 16));
$i = 0;
$enc_text = get_rnd_iv($iv_len);
$iv = substr($password ^ $enc_text, 0, 512);
while ($i < $n) {
$block = substr($plain_text, $i, 16) ^ pack('H*', md5($iv));
$enc_text .= $block;
$iv = substr($block . $iv, 0, 512) ^ $password;
$i += 16;
}
return base64_encode($enc_text);
}
function md5_decrypt($enc_text, $password, $iv_len = 16) {
$enc_text = base64_decode($enc_text);
$n = strlen($enc_text);
$i = $iv_len;
$plain_text = '';
$iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512);
while ($i < $n) {
$block = substr($enc_text, $i, 16);
$plain_text .= $block ^ pack('H*', md5($iv));
$iv = substr($block . $iv, 0, 512) ^ $password;
$i += 16;
}
return preg_replace('/\\x13\\x00*$/', '', $plain_text);
}
?>
+107
View File
@@ -0,0 +1,107 @@
<?php
function getBlotter($all = false) {
global $tc_db;
if (KU_APC) {
if ($all) {
$cache_blotter = apc_fetch('blotter|all');
} else {
$cache_blotter = apc_fetch('blotter|last4');
}
if ($cache_blotter !== false) {
return $cache_blotter;
}
}
$output = '';
if ($all) {
$limit = '';
} else {
$limit = ' LIMIT 4';
}
$results = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "blotter` ORDER BY `id` DESC" . $limit);
if (count($results) > 0) {
if ($all) {
$output .= '<pre>';
}
foreach ($results as $line) {
if ($all && $line['important'] == 1) {
$output .= '<font style="color: red;">';
} elseif (!$all) {
$output .= '<li class="blotterentry" style="display: none;">' . "\n";
if ($line['important'] == 1) {
$output .= ' <span style="color: red;">' . "\n" . ' ';
}
$output .= ' ';
}
$output .= date('m/d/y', $line['at']) . ' - ' . $line['message'];
if ($all && $line['important'] == 1) {
$output .= '</font>' . "\n";
} elseif (!$all) {
$output .= "\n";
if ($line['important'] == 1) {
$output .= ' </span>' . "\n";
}
$output .= '</li>';
} else {
$output .= "\n";
}
$output .= "\n";
}
if ($all) {
$output .= '</pre>';
}
}
if (KU_APC) {
if ($all) {
apc_store('blotter|all', $output);
} else {
apc_store('blotter|last4', $output);
}
}
return $output;
}
function getBlotterLastUpdated() {
global $tc_db;
return $tc_db->GetOne("SELECT `at` FROM `" . KU_DBPREFIX . "blotter` ORDER BY `id` DESC LIMIT 1");
}
/**
* Gets information about the filetype provided, which is specified in the manage panel
*
* @param string $filetype Filetype
* @return array Filetype image, width, and height
*/
function getfiletypeinfo($filetype) {
global $tc_db;
$return = '';
if (KU_APC) {
$return = apc_fetch('filetype|' . $filetype);
}
if ($return != '') {
return unserialize($return);
}
$results = $tc_db->GetAll("SELECT `image`, `image_w`, `image_h` FROM `" . KU_DBPREFIX . "filetypes` WHERE `filetype` = " . $tc_db->qstr($filetype) . " LIMIT 1");
if (count($results) > 0) {
foreach($results AS $line) {
$return = array($line['image'],$line['image_w'],$line['image_h']);
}
} else {
/* No info was found, return the generic icon */
$return = array('generic.png',48,48);
}
if (KU_APC) {
apc_store('filetype|' . $filetype, serialize($return), 600);
}
return $return;
}
?>
+91
View File
@@ -0,0 +1,91 @@
<?php
function changeLocale($newlocale) {
global $CURRENTLOCALE, $EMULATEGETTEXT, $text_domains;
$CURRENTLOCALE = $newlocale;
$EMULATEGETTEXT = 1;
_textdomain('kusaba');
_setlocale(LC_ALL, $newlocale);
_bindtextdomain('kusaba', KU_ROOTDIR . 'inc/lang', $newlocale);
_bind_textdomain_codeset('kusaba', KU_CHARSET);
}
function exitWithErrorPage($errormsg, $extended = '') {
global $dwoo, $dwoo_data, $board_class;
if (!isset($dwoo)) {
require_once KU_ROOTDIR . 'lib/dwoo.php';
}
if (!isset($board_class)) {
require_once KU_ROOTDIR . 'inc/classes/board-post.class.php';
$board_class = new Board('');
}
$dwoo_data->assign('styles', explode(':', KU_MENUSTYLES));
$dwoo_data->assign('errormsg', $errormsg);
if ($extended != '') {
$dwoo_data->assign('errormsgext', '<br /><div style="text-align: center;font-size: 1.25em;">' . $extended . '</div>');
} else {
$dwoo_data->assign('errormsgext', $extended);
}
echo $dwoo->get(KU_TEMPLATEDIR . '/error.tpl', $dwoo_data);
die();
}
/**
* Add an entry to the modlog
*
* @param string $entry Entry text
* @param integer $category Category to file under. 0 - No category, 1 - Login, 2 - Cleanup/rebuild boards and html files, 3 - Board adding/deleting, 4 - Board updates, 5 - Locking/stickying, 6 - Staff changes, 7 - Thread deletion/post deletion, 8 - Bans, 9 - News, 10 - Global changes, 11 - Wordfilter
* @param string $forceusername Username to force as the entry username
*/
function management_addlogentry($entry, $category = 0, $forceusername = '') {
global $tc_db;
$username = ($forceusername == '') ? $_SESSION['manageusername'] : $forceusername;
if ($entry != '') {
$tc_db->Execute("INSERT INTO `" . KU_DBPREFIX . "modlog` ( `entry` , `user` , `category` , `timestamp` ) VALUES ( " . $tc_db->qstr($entry) . " , '" . $username . "' , " . $tc_db->qstr($category) . " , '" . time() . "' )");
}
if (KU_RSS) {
require_once(KU_ROOTDIR . 'inc/classes/rss.class.php');
$rss_class = new RSS();
print_page(KU_BOARDSDIR . 'modlogrss.xml', $rss_class->GenerateModLogRSS($entry), '');
}
}
function sendStaffMail($subject, $message) {
$emails = split(':', KU_APPEAL);
$expires = ($line['until'] > 0) ? date("F j, Y, g:i a", $line['until']) : 'never';
foreach ($emails as $email) {
@mail($email, $subject, $message, 'From: "' . KU_NAME . '" <kusaba@noreply' . KU_DOMAIN . '>' . "\r\n" . 'Reply-To: kusaba@noreply' . KU_DOMAIN . "\r\n" . 'X-Mailer: kusaba' . KU_VERSION . '/PHP' . phpversion());
}
}
/* Depending on the configuration, use either a meta refresh or a direct header */
function do_redirect($url, $ispost = false, $file = '') {
global $board_class;
$headermethod = true;
if ($headermethod) {
if ($ispost) {
header('Location: ' . $url);
} else {
die('<meta http-equiv="refresh" content="1;url=' . $url . '">');
}
} else {
if ($ispost && $file != '') {
echo sprintf(_gettext('%s uploaded.'), $file) . ' ' . _gettext('Updating pages.');
} elseif ($ispost) {
echo _gettext('Post added.') . ' ' . _gettext('Updating pages.'); # TEE COME BACK
} else {
echo '---> ---> --->';
}
die('<meta http-equiv="refresh" content="1;url=' . $url . '">');
}
}
?>
+117
View File
@@ -0,0 +1,117 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Module functions
*
* Provides module and hook functionality
*
* @package kusaba
*/
function hook_process($hookname, $data) {
global $hooks;
if (is_array($hooks[$hookname])) {
foreach ($hooks[$hookname] as $hook) {
$data = module_call_function($hook, 'process_' . $hookname, $data);
}
}
return $data;
}
function modules_load_all() {
foreach (modules_list() as $module) {
module_load($module);
}
}
/* Fetch the names of the modules in the inc/modules/ directory */
function modules_list() {
$modules = array();
if ($modules_handle = opendir(KU_ROOTDIR . 'inc/modules')) {
while (false !== ($file = readdir($modules_handle))) {
/* We don't want hidden files, nor . or .. */
if ($file != '.' && $file != '..' && !is_dir($file) && strpos($file, '.php') != false) {
$modules[] = substr($file, 0, -4);
}
}
} else {
echo _gettext('Unable to open the modules directory!');
}
return $modules;
}
/* Load a module's script and call its initialization function */
function module_load($module) {
global $modules_loaded;
if (!in_array($module, $modules_loaded)) {
/* Include the module file */
include(KU_ROOTDIR . 'inc/modules/' . $module . '.php');
/* Call the initialization function */
module_call_function($module, 'init');
/* Add this module to the loaded modules list */
$modules_loaded[] = $module;
/* The module was loaded, return true to show that it was a success */
return true;
}
return false;
}
/* Call a module's function, such as module_init() */
function module_call_function($module, $function, $data = null) {
if (function_exists($module . '_' . $function)) {
if ($data == null) {
return call_user_func($module . '_' . $function);
}
return call_user_func($module . '_' . $function, $data);
}
return false;
}
function module_setting_get($module, $key) {
global $tc_db;
$query = "SELECT `value` FROM `".KU_DBPREFIX."module_settings` WHERE `module` = ".$tc_db->qstr($module)." AND `key` = ".$tc_db->qstr($key)." LIMIT 1";
$result = $tc_db->GetOne($query);
return $result;
}
function module_setting_set($module, $key, $value, $type = 'string') {
global $tc_db;
$exists = $tc_db->GetOne("SELECT COUNT(*) FROM `".KU_DBPREFIX."module_settings` WHERE `module` = ".$tc_db->qstr($module)." AND `key` = ".$tc_db->qstr($key)." LIMIT 1");
if ($exists > 0) {
$result = $tc_db->Execute("UPDATE `".KU_DBPREFIX."module_settings` SET `value` = ".$tc_db->qstr($value).") WHERE `module` = ".$tc_db->qstr($module)." AND `key` = ".$tc_db->qstr($key)."");
} else {
$result = $tc_db->Execute("INSERT INTO `".KU_DBPREFIX."module_settings` (`module` , `key` , `value` , `type`) VALUES (".$tc_db->qstr($module).", ".$tc_db->qstr($key).", ".$tc_db->qstr($value).", ".$tc_db->qstr($type).")");
}
return $result;
}
?>
+81
View File
@@ -0,0 +1,81 @@
<?php
/**
* Format an amount of bytes to a better looking representation of the size
*
* @param integer $number Bytes
* @return string Formatted amount
*/
function ConvertBytes($number) {
$len = strlen($number);
if($len < 4) {
return sprintf("%dB", $number);
} elseif($len <= 6) {
return sprintf("%0.2fKB", $number/1024);
} elseif($len <= 9) {
return sprintf("%0.2fMB", $number/1024/1024);
}
return sprintf("%0.2fGB", $number/1024/1024/1024);
}
function timeDiff($timestamp,$detailed=false, $max_detail_levels=8, $precision_level='second'){
$now = time();
#If the difference is positive "ago" - negative "away"
($timestamp >= $now) ? $action = '' : $action = 'ago';
# Set the periods of time
$periods = array(_gettext('second'), _gettext('minute'), _gettext('hour'), _gettext('day'), _gettext('week'), _gettext('month'), _gettext('year'), _gettext('decade'));
$lengths = array(1, 60, 3600, 86400, 604800, 2630880, 31570560, 315705600);
$diff = ($action == '' ? $timestamp - $now : $now - $timestamp);
$prec_key = array_search($precision_level,$periods);
# round diff to the precision_level
$diff = round(($diff/$lengths[$prec_key]))*$lengths[$prec_key];
# if the diff is very small, display for ex "just seconds ago"
if ($diff <= 10) {
$periodago = max(0,$prec_key-1);
$agotxt = $periods[$periodago].'s';
return "$agotxt $action";
}
# Go from decades backwards to seconds
$time = "";
for ($i = (sizeof($lengths) - 1); $i>=0; $i--) {
if ($i > 0) {
if($diff > $lengths[$i-1] && ($max_detail_levels > 0)) { # if the difference is greater than the length we are checking... continue
$val = floor($diff / $lengths[$i-1]); # 65 / 60 = 1. That means one minute. 130 / 60 = 2. Two minutes.. etc
$time .= $val ." ". $periods[$i-1].($val > 1 ? 's ' : ' '); # The value, then the name associated, then add 's' if plural
$diff -= ($val * $lengths[$i-1]); # subtract the values we just used from the overall diff so we can find the rest of the information
if(!$detailed) { $i = 0; } # if detailed is turn off (default) only show the first set found, else show all information
$max_detail_levels--;
}
}
}
# Basic error checking.
if($time == "") {
return "Error-- Unable to calculate time.";
} else {
if ($action != '') {
return $time.$action;
}
return $time;
}
}
function microtime_float() {
return array_sum(explode(' ', microtime()));
}
function formatJapaneseNumbers($input) {
$patterns = array('/1/', '/2/', '/3/', '/4/', '/5/', '/6/', '/7/', '/8/', '/9/', '/0/');
$replace = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
return preg_replace($patterns, $replace, $input);
}
?>
+29
View File
@@ -0,0 +1,29 @@
<?php
/**
* Generate the list of pages, linking to each
*
* @param integer $boardpage Current board page
* @param integer $pages Number of pages
* @param string $board Board directory
* @return string Generated page list
*/
/* <3 coda for this wonderful snippet
print $contents to $filename by using a temporary file and renaming it */
function print_page($filename, $contents, $board) {
global $tc_db;
$tempfile = tempnam(KU_BOARDSDIR . $board . '/res', 'tmp'); /* Create the temporary file */
$fp = fopen($tempfile, 'w');
fwrite($fp, $contents);
fclose($fp);
/* If we aren't able to use the rename function, try the alternate method */
if (!@rename($tempfile, $filename)) {
copy($tempfile, $filename);
unlink($tempfile);
}
chmod($filename, 0664); /* it was created 0600 */
}
?>
+22
View File
@@ -0,0 +1,22 @@
<?php
function getCWebPath() {
if (KU_WEBCORAL != '') {
return KU_WEBCORAL . '/';
}
return KU_WEBPATH . '/';
}
function getCLBoardPath($board = '', $loadbalanceurl = '', $archivedir = '') {
global $board_class;
if ($loadbalanceurl == '') {
if (KU_BOARDSCORAL != '' && $archivedir == '') {
return KU_BOARDSCORAL . '/' . $board;
} else {
return KU_BOARDSPATH . '/' . $board . $archivedir;
}
} elseif ($board != '') {
return $loadbalanceurl;
}
}
?>
+255
View File
@@ -0,0 +1,255 @@
<?php
/**
* Display the embedded video
*
* @param array $post Post data
* @return string Embedded video
*/
function embeddedVideoBox($post) {
global $tc_db;
$results = $tc_db->GetAll("SELECT HIGH_PRIORITY * FROM `" . KU_DBPREFIX . "embeds`");
$output = '<span style="float: left;">' . "\n";
foreach ($results as $line) {
if ($post['file_type'] == $line['filetype']) {
$code = $line['code'];
/*$width = $line['width'];
$height = $line['height'];*/
$replace = array('SET_HEIGHT', 'SET_WIDTH', 'EMBED_ID');
$trueval = array($line['height'], $line['width'], $post['file']);
$code = str_replace($replace, $trueval, $code);
$output .= $code;
}
}
$output .= '</span>&nbsp;' . "\n";
return $output;
}
/**
* Check if the supplied md5 file hash is currently recorded inside of the database, attached to a non-deleted post
*/
function checkMd5($md5, $board, $boardid) {
global $tc_db;
$matches = $tc_db->GetAll("SELECT `id`, `parentid` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $boardid . " AND `IS_DELETED` = 0 AND `file_md5` = ".$tc_db->qstr($md5)." LIMIT 1");
if (count($matches) > 0) {
$real_parentid = ($matches[0][1] == 0) ? $matches[0][0] : $matches[0][1];
return array($real_parentid, $matches[0][0]);
}
return false;
}
/* Image handling */
/**
* Create a thumbnail
*
* @param string $name File to be thumbnailed
* @param string $filename Path to place the thumbnail
* @param integer $new_w Maximum width
* @param integer $new_h Maximum height
* @return boolean Success/fail
*/
function createThumbnail($name, $filename, $new_w, $new_h) {
if (KU_THUMBMETHOD == 'imagemagick') {
$convert = 'convert ' . escapeshellarg($name);
if (!KU_ANIMATEDTHUMBS) {
$convert .= '[0] ';
}
$convert .= ' -resize ' . $new_w . 'x' . $new_h . ' -quality ';
if (substr($filename, 0, -3) != 'gif') {
$convert .= '70';
} else {
$convert .= '90';
}
$convert .= ' ' . escapeshellarg($filename);
exec($convert);
if (is_file($filename)) {
return true;
} else {
return false;
}
} elseif (KU_THUMBMETHOD == 'gd') {
$system=explode(".", $filename);
$system = array_reverse($system);
if (preg_match("/jpg|jpeg/", $system[0])) {
$src_img=imagecreatefromjpeg($name);
} else if (preg_match("/png/", $system[0])) {
$src_img=imagecreatefrompng($name);
} else if (preg_match("/gif/", $system[0])) {
$src_img=imagecreatefromgif($name);
} else {
return false;
}
if (!$src_img) {
exitWithErrorPage(_gettext('Unable to read uploaded file during thumbnailing.'), _gettext('A common cause for this is an incorrect extension when the file is actually of a different type.'));
}
$old_x = imageSX($src_img);
$old_y = imageSY($src_img);
if ($old_x > $old_y) {
$percent = $new_w / $old_x;
} else {
$percent = $new_h / $old_y;
}
$thumb_w = round($old_x * $percent);
$thumb_h = round($old_y * $percent);
$dst_img = ImageCreateTrueColor($thumb_w, $thumb_h);
fastImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y, $system);
if (preg_match("/png/", $system[0])) {
if (!imagepng($dst_img,$filename,0,PNG_ALL_FILTERS) ) {
echo 'unable to imagepng.';
return false;
}
} else if (preg_match("/jpg|jpeg/", $system[0])) {
if (!imagejpeg($dst_img, $filename, 70)) {
echo 'unable to imagejpg.';
return false;
}
} else if (preg_match("/gif/", $system[0])) {
if (!imagegif($dst_img, $filename)) {
echo 'unable to imagegif.';
return false;
}
}
imagedestroy($dst_img);
imagedestroy($src_img);
return true;
}
return false;
}
/* Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable. */
/**
* Faster method than only calling imagecopyresampled()
*
* @return boolean Success/fail
*/
function fastImageCopyResampled(&$dst_image, &$src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $system, $quality = 3) {
/*
Optional "quality" parameter (defaults is 3). Fractional values are allowed, for example 1.5.
1 = Up to 600 times faster. Poor results, just uses imagecopyresized but removes black edges.
2 = Up to 95 times faster. Images may appear too sharp, some people may prefer it.
3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled.
4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.
5 = No speedup. Just uses imagecopyresampled, highest quality but no advantage over imagecopyresampled.
*/
if (empty($src_image) || empty($dst_image) || $quality <= 0) { return false; }
if (preg_match("/png/", $system[0]) || preg_match("/gif/", $system[0])) {
$colorcount = imagecolorstotal($src_image);
if ($colorcount <= 256 && $colorcount != 0) {
imagetruecolortopalette($dst_image,true,$colorcount);
imagepalettecopy($dst_image,$src_image);
$transparentcolor = imagecolortransparent($src_image);
imagefill($dst_image,0,0,$transparentcolor);
imagecolortransparent($dst_image,$transparentcolor);
}
else {
imageAlphaBlending($dst_image, false);
imageSaveAlpha($dst_image, true); //If the image has Alpha blending, lets save it
}
}
if ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {
$temp = imagecreatetruecolor ($dst_w * $quality + 1, $dst_h * $quality + 1);
if (preg_match("/png/", $system[0])) {
$background = imagecolorallocate($temp, 0, 0, 0);
ImageColorTransparent($temp, $background); // make the new temp image all transparent
imagealphablending($temp, false); // turn off the alpha blending to keep the alpha channel
}
imagecopyresized ($temp, $src_image, 0, 0, $src_x, $src_y, $dst_w * $quality + 1, $dst_h * $quality + 1, $src_w, $src_h);
imagecopyresampled ($dst_image, $temp, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $dst_w * $quality, $dst_h * $quality);
imagedestroy ($temp);
}
else imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
return true;
}
/*
Link validator
Will use cURL to attempt to visit a webpage, and then return based upon how the
request was handled. Used for embedded videos to validate the ID is existant.
Thanks phadeguy - http://www.zend.com/codex.php?id=1256&single=1
expects a link url as string
returns an array of three elements:
return_array[0] = HTTP version
return_array[1] = Returned error number (200, 404, etc)
return_array[2] = Returned error text ("OK", "File Not Found", etc) */
function check_link($link) {
$main = array();
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $link);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt ($ch, CURLOPT_NOBODY, 1);
// curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
ob_start();
curl_exec ($ch);
$stuff = ob_get_contents();
ob_end_clean();
curl_close ($ch);
$parts = split("n",$stuff,2);
$main = split(" ",$parts[0],3);
return $main;
}
/**
* Trim the threads to the page limit and delete posts which are older than limited
*/
function TrimToPageLimit($board) {
global $tc_db;
if ($board['maxage'] != 0) {
// If the maximum thread age setting is not zero (do not delete old threads), find posts which are older than the limit, and delete them
$results = $tc_db->GetAll("SELECT `id`, `timestamp` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = 0 AND `stickied` = 0 AND ((`timestamp` + " . ($board['maxage']*3600) . ") < " . time() . ")");
foreach($results AS $line) {
// If it is older than the limit
$post_class = new Post($line['id'], $board['name'], $board['id']);
$post_class->Delete(true);
}
}
if ($board['maxpages'] != 0) {
// If the maximum pages setting is not zero (do not limit pages), find posts which are over the limit, and delete them
$results = $tc_db->GetAll("SELECT `id`, `stickied` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = 0");
$results_count = count($results);
if (calculatenumpages($board['type'], $results_count) >= $board['maxpages']) {
$board['maxthreads'] = ($board['maxpages'] * KU_THREADS);
$numthreadsover = ($results_count - $board['maxthreads']);
if ($numthreadsover > 0) {
$resultspost = $tc_db->GetAll("SELECT `id`, `stickied` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = 0 AND `stickied` = 0 ORDER BY `bumped` ASC LIMIT " . $numthreadsover);
foreach($resultspost AS $linepost) {
$post_class = new Post($linepost['id'], $board['name'], $board['id']);
$post_class->Delete(true);
}
}
}
}
// If the thread was marked for deletion more than two hours ago, delete it
$results = $tc_db->GetAll("SELECT `id` FROM `".KU_DBPREFIX."posts` WHERE `boardid` = " . $board['id'] . " AND `IS_DELETED` = 0 AND `parentid` = 0 AND `stickied` = 0 AND `deleted_timestamp` > 0 AND (`deleted_timestamp` <= " . time() . ")");
foreach($results AS $line) {
// If it is older than the limit
$post_class = new Post($line['id'], $board['name'], $board['id']);
$post_class->Delete(true);
}
}
?>
+312
View File
@@ -0,0 +1,312 @@
<?php
/**
* Format the display of the name and tripcode of a post
*
* @param string $name Name used in post
* @param string $email Email used in post
* @param string $tripcode Tripcode used in post
* @return string Generated name and tripcode html
*/
function formatDate($timestamp, $type = 'post', $locale = 'en', $email = '') {
$output = '';
if ($email != '') {
$output .= '<a href="mailto:' . $email . '">';
}
if ($type == 'post') {
if ($locale == 'ja') {
/* Format the timestamp japanese style */
$fulldate = strftime ("%Yy%mm%dd(DAYOFWEEK) %HH%MM%SS", $timestamp);
$dayofweek = strftime('%a', $timestamp);
/* I don't like this method, but I can't rely on PHP's locale settings to do it for me... */
switch ($dayofweek) {
case 'Sun':
$dayofweek = '&#26085;';
break;
case 'Mon':
$dayofweek = '&#26376;';
break;
case 'Tue':
$dayofweek = '&#28779;';
break;
case 'Wed':
$dayofweek = '&#27700;';
break;
case 'Thu':
$dayofweek = '&#26408;';
break;
case 'Fri':
$dayofweek = '&#37329;';
break;
case 'Sat':
$dayofweek = '&#22303;';
break;
default:
// The date must be in the correct language already, so let's convert it to unicode if it isn't already.
$dayofweek = mb_convert_encoding($dayofweek, "UTF-8", "JIS, eucjp-win, sjis-win");
break;
}
$fulldate = formatJapaneseNumbers($fulldate);
//Convert the symbols for year, month, etc to unicode equivalents. We couldn't do this above beause the numbers would be formatted to japanese.
$fulldate = str_replace(array("y","m","d","H","M","S"), array("&#24180;","&#26376;","&#26085;","&#26178;","&#20998;","&#31186;"), $fulldate);
$fulldate = str_replace('DAYOFWEEK', $dayofweek, $fulldate);
return $output.$fulldate.(($email != '') ? ('</a>') : (""));
} else {
/* Format the timestamp english style */
return $output.date('y/m/d(D)H:i', $timestamp).(($email != '') ? ('</a>') : (""));
}
}
return $output.date('y/m/d(D)H:i', $timestamp).(($email != '') ? ('</a>') : (""));
}
/**
* Format the provided input into a reflink, which follows the Japanese locale if it is set.
*/
function formatReflink($post_board, $post_thread_start_id, $post_id, $locale = 'en') {
$return = ' ';
$reflink_noquote = '<a href="' . KU_BOARDSFOLDER . $post_board . '/res/' . $post_thread_start_id . '.html#' . $post_id . '" onclick="return highlight(\'' . $post_id . '\');">';
$reflink_quote = '<a href="' . KU_BOARDSFOLDER . $post_board . '/res/' . $post_thread_start_id . '.html#i' . $post_id . '" onclick="return insert(\'>>' . $post_id . '\\n\');">';
if ($locale == 'ja') {
$return .= $reflink_quote . formatJapaneseNumbers($post_id) . '</a>' . $reflink_noquote . '番</a>';
} else {
$return .= $reflink_noquote . 'No.&nbsp;' . '</a>' . $reflink_quote . $post_id . '</a>';
}
return $return . "\n";
}
/**
* Calculate the different name and tripcode for the name field provided
*
* @param string $post_name Text entered in the Name field
* @return array Name and tripcode
*/
function calculateNameAndTripcode($post_name) {
global $tc_db;
if(ereg("(#|!)(.*)", $post_name, $regs)){
$cap = $regs[2];
$cap_full = '#' . $regs[2];
// {{{ Special tripcode check
$trips = unserialize(KU_TRIPS);
if (count($trips) > 0) {
if (isset($trips[$cap_full])) {
$forcedtrip = $trips[$cap_full];
return array(ereg_replace("(#)(.*)", "", $post_name), $forcedtrip);
}
}
// }}}
if (function_exists('mb_convert_encoding')) {
$recoded_cap = mb_convert_encoding($cap, 'SJIS', 'UTF-8');
if ($recoded_cap != '') {
$cap = $recoded_cap;
}
}
if (strpos($post_name, '#') === false) {
$cap_delimiter = '!';
} elseif (strpos($post_name, '!') === false) {
$cap_delimiter = '#';
} else {
$cap_delimiter = (strpos($post_name, '#') < strpos($post_name, '!')) ? '#' : '!';
}
if (ereg("(.*)(" . $cap_delimiter . ")(.*)", $cap, $regs_secure)) {
$cap = $regs_secure[1];
$cap_secure = $regs_secure[3];
$is_secure_trip = true;
} else {
$is_secure_trip = false;
}
$tripcode = '';
if ($cap != '') {
/* From Futabally */
$cap = strtr($cap, "&amp;", "&");
$cap = strtr($cap, "&#44;", ", ");
$salt = substr($cap."H.", 1, 2);
$salt = ereg_replace("[^\.-z]", ".", $salt);
$salt = strtr($salt, ":;<=>?@[\\]^_`", "ABCDEFGabcdef");
$tripcode = substr(crypt($cap, $salt), -10);
}
if ($is_secure_trip) {
if ($cap != '') {
$tripcode .= '!';
}
$secure_tripcode = md5($cap_secure . KU_RANDOMSEED);
if (function_exists('base64_encode')) {
$secure_tripcode = base64_encode($secure_tripcode);
}
if (function_exists('str_rot13')) {
$secure_tripcode = str_rot13($secure_tripcode);
}
$secure_tripcode = substr($secure_tripcode, 2, 10);
$tripcode .= '!' . $secure_tripcode;
}
$name = ereg_replace("(" . $cap_delimiter . ")(.*)", "", $post_name);
return array($name, $tripcode);
}
return $post_name;
}
/**
* Format a long message to be shortened if it exceeds the allowed length on a page
*
* @param string $message Post message
* @param string $board Board directory
* @param integer $threadid Thread ID
* @param boolean $page Is rendering for a page
* @return string The formatted message
*/
function formatLongMessage($message, $board, $threadid, $page) {
$output = '';
if ((strlen($message) > KU_LINELENGTH || count(explode('<br />', $message)) > 15) && $page) {
$message_exploded = explode('<br />', $message);
$message_shortened = '';
for ($i = 0; $i <= 14; $i++) {
if (isset($message_exploded[$i])) {
$message_shortened .= $message_exploded[$i] . '<br />';
}
}
if (strlen($message_shortened) > KU_LINELENGTH) {
$message_shortened = substr($message_shortened, 0, KU_LINELENGTH);
}
$message_shortened = closeOpenTags($message_shortened);
$output = $message_shortened . '<div class="abbrev">' . "\n" .
' ' . sprintf(_gettext('Message too long. Click %shere%s to view the full text.'), '<a href="' . KU_BOARDSFOLDER . $board . '/res/' . $threadid . '.html">', '</a>') . "\n" .
'</div>' . "\n";
} else {
$output .= $message . "\n";
}
return $output;
}
/* Thanks milianw - php.net */
/**
* Closes all HTML tags left open
*
* @param string $html HTML to be checked
* @return string HTML with all tags closed
*/
function closeOpenTags($html){
/* Put all opened tags into an array */
preg_match_all("#<([a-z]+)( .*)?(?!/)>#iU", $html, $result);
$openedtags=$result[1];
/* Put all closed tags into an array */
preg_match_all("#</([a-z]+)>#iU", $html, $result);
$closedtags=$result[1];
$len_opened = count($openedtags);
/* All tags are closed */
if(count($closedtags) == $len_opened){
return $html;
}
$openedtags = array_reverse($openedtags);
/* Close tags */
for($i=0;$i<$len_opened;$i++) {
if ($openedtags[$i]!='br') {
if (!in_array($openedtags[$i], $closedtags)){
$html .= '</'.$openedtags[$i].'>';
} else {
unset($closedtags[array_search($openedtags[$i], $closedtags)]);
}
}
}
return $html;
}
/* By Darien Hager, Jan 2007 */
/**
* Find the string value of a pair of ords
*
* @param string $ords Ords
* @param string $encoding Encoding
* @return string String
*/
function ords_to_unistr($ords, $encoding = 'UTF-8'){
if (!function_exists('mb_convert_encoding')) {
return false;
}
/* Turns an array of ordinal values into a string of unicode characters */
$str = '';
for($i = 0; $i < sizeof($ords); $i++){
/* Pack this number into a 4-byte string
(Or multiple one-byte strings, depending on context.) */
$v = $ords[$i];
$str .= pack("N",$v);
}
$str = mb_convert_encoding($str,$encoding,"UCS-4BE");
return($str);
}
/**
* Find the ord value of a string
*
* @param string $str String
* @param string $encoding Encoding
* @return array Ords
*/
function unistr_to_ords($str, $encoding = 'UTF-8'){
if (!function_exists('mb_convert_encoding')) {
return false;
}
/* Turns a string of unicode characters into an array of ordinal values,
Even if some of those characters are multibyte. */
$str = mb_convert_encoding($str,"UCS-4BE",$encoding);
$ords = array();
/* Visit each unicode character */
for($i = 0; $i < mb_strlen($str,"UCS-4BE"); $i++){
/* Now we have 4 bytes. Find their total numeric value */
$s2 = mb_substr($str,$i,1,"UCS-4BE");
$val = unpack("N",$s2);
$ords[] = $val[1];
}
return($ords);
}
function processPost($id, $newthreadid, $oldthreadid, $board_from, $board_to, $boardid) {
global $tc_db;
$message = $tc_db->GetOne("SELECT `message` FROM " . KU_DBPREFIX . "posts WHERE `boardid` = " . $boardid . " AND `id` = " . $id . " LIMIT 1");
if ($message != '') {
$message_new = str_replace('/read.php/' . $board_from . '/' . $oldthreadid, '/read.php/' . $board_to . '/' . $newthreadid, $message);
if ($message_new != $message) {
$tc_db->GetOne("UPDATE " . KU_DBPREFIX . "posts SET `message` = " . $tc_db->qstr($message) . " WHERE `boardid` = " . $boardid . " AND `id` = " . $id);
}
}
}
?>
+16
View File
@@ -0,0 +1,16 @@
<?php
/**
* Run a greater than zero check on each ID in the array
*
* @param array $ids Array of thread IDs
*/
function isNormalUser($authority) {
if ($authority == 1 || $authority == 2) {
return false;
} else {
return true;
}
}
?>
+42
View File
@@ -0,0 +1,42 @@
<?php
/*
* This file is part of kusaba.
*
* kusaba is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* kusaba is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* kusaba; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Miscellaneous functions used throughout the script.
*
* The functions script has no theme; any and all functions which are used globally
* will be found in this file.
*
* @package kusaba
*/
include KU_ROOTDIR . 'inc/func/apc.php';
include KU_ROOTDIR . 'inc/func/calculations.php';
include KU_ROOTDIR . 'inc/func/directories.php';
include KU_ROOTDIR . 'inc/func/encryption.php';
include KU_ROOTDIR . 'inc/func/fetching.php';
include KU_ROOTDIR . 'inc/func/misc.php';
include KU_ROOTDIR . 'inc/func/module.php';
include KU_ROOTDIR . 'inc/func/numberformatting.php';
include KU_ROOTDIR . 'inc/func/pages.php';
include KU_ROOTDIR . 'inc/func/paths.php';
include KU_ROOTDIR . 'inc/func/posts.php';
include KU_ROOTDIR . 'inc/func/stringformatting.php';
include KU_ROOTDIR . 'inc/func/validation.php';
include KU_ROOTDIR . 'inc/func/custom.php';
?>
+457
View File
@@ -0,0 +1,457 @@
msgid ""
msgstr ""
"Project-Id-Version: kusaba\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2007-12-09 03:10+0000\n"
"PO-Revision-Date: 2008-02-22 13:49+0000\n"
"Last-Translator: pcp <Unknown>\n"
"Language-Team: Czech <cs@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2008-03-12 04:24+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
msgid "Add"
msgstr "Přidat"
msgid "Add board"
msgstr "Přidat nástěnku"
msgid "Add news"
msgstr "Přidat zprávičku"
msgid "Admin"
msgstr "Admin"
msgid "Administration"
msgstr "Administrace"
msgid "Administrator"
msgstr "Administrátor"
msgid "Administrators"
msgstr "Administrátoři"
msgid "All Threads"
msgstr "Všechny vlákna"
msgid "All boards"
msgstr "Všechny nástěnky"
msgid "Ban from"
msgstr "Ban od"
msgid "Ban successfully removed."
msgstr "Ban odstraněn"
msgid "Board"
msgstr "Board"
msgid "Board successfully deleted."
msgstr "Nástěnka smazána"
msgid "Board type:"
msgstr "Typ nástěnky"
msgid "Boards"
msgstr "Nástěnky"
msgid "Can be left blank."
msgstr "Nemusí být vyplněno"
msgid "Can not be left blank."
msgstr "Musí být vyplněno"
msgid "Cancel"
msgstr "Storno"
msgid "Cleanup"
msgstr "Vyčistit"
msgid "Cleanup finished."
msgstr "Čištění dokončeno"
msgid "Click to show/hide"
msgstr "Zobrazit/Skrýt"
msgid "Continue"
msgstr "Pokračovat"
msgid "Date"
msgstr "Datum"
msgid "Default"
msgstr "Výchozí"
msgid "Delete"
msgstr "Odstranit"
msgid "Delete board"
msgstr "Smazat nástěnku"
msgid "Delete posts"
msgstr "Smazat příspěvky"
msgid "Deleted"
msgstr "Smazáno"
msgid "Deleted posts by ip"
msgstr "Smazat příspěvky podle IP"
msgid "Deleting unused images."
msgstr "Mažu nepoužité obrázky"
msgid "Description"
msgstr "Popis"
msgid "Directory"
msgstr "Adresář"
msgid "Does not expire"
msgstr "Nevyprší"
msgid "Edit"
msgstr "Úpravy"
msgid "Email"
msgstr "E-mail"
msgid "Embed"
msgstr "Vloženo"
msgid "Error, it appears your file did not transfer properly. Please go back and try again."
msgstr "Chyba při odesílání souboru. Zkuste to znovu."
msgid "FAQ"
msgstr "FAQ"
msgid "File"
msgstr "Soubor"
msgid "File Only"
msgstr "Pouze soubory"
msgid "File<br>Removed"
msgstr "Soubor odstraněn"
msgid "First 100 posts"
msgstr "Prvních 100 příspěvků"
msgid "From"
msgstr "Od"
msgid "Global options"
msgstr "Globální volby"
msgid "Go"
msgstr "Jdi"
msgid "Height"
msgstr "Výška"
msgid "ID"
msgstr "ID"
msgid "IP"
msgstr "IP"
msgid "Image"
msgstr "Obrázek"
msgid "Image successfully deleted from your post."
msgstr "Obrázek byl z tvého příspěvku úspěšně smazán"
msgid "Images"
msgstr "Obrázky"
msgid "Important"
msgstr "Důležité"
msgid "Improper filetype."
msgstr "Nepodporovaný formát souboru"
msgid "Incorrect password."
msgstr "Nesprávné heslo"
msgid "Incorrect username/password."
msgstr "Nesprávné jméno nebo heslo"
msgid "Index"
msgstr "Index"
msgid "Invalid MIME type for this filetype."
msgstr "Neplatný MIME typ pro tento soubor"
msgid "Invalid thread ID."
msgstr "Neplatné ID vlákna"
msgid "Last Post"
msgstr "Poslední příspěvek"
msgid "Lock"
msgstr "Uzamknout"
msgid "Logged in"
msgstr "Přihlášený"
msgid "Logo"
msgstr "Logo"
msgid "Manage"
msgstr "Spravovat"
msgid "Manage boards"
msgstr "Spravovat nástěnky"
msgid "Maxmimum thumbnail height"
msgstr "Maximální výška náhledu"
msgid "Maxmimum thumbnail width"
msgstr "Maximální šířka náhledu"
msgid "Message"
msgstr "Zpráva"
msgid "Misc"
msgstr "Různé"
msgid "Mod"
msgstr "Mod"
msgid "Moderator"
msgstr "Moderátor"
msgid "Moderators"
msgstr "Moderátoři"
msgid "Modify"
msgstr "Upravit"
msgid "Module settings"
msgstr "Nastavení modulu"
msgid "Modules"
msgstr "Moduly"
msgid "Name"
msgstr "Jméno"
msgid "Never"
msgstr "Nikdy"
msgid "New Thread"
msgstr "Nové vlákno"
msgid "New password"
msgstr "Nové heslo"
msgid "New password again"
msgstr "Heslo znovu"
msgid "News"
msgstr "Zprávy"
msgid "Next"
msgstr "Další"
msgid "No"
msgstr "Ne"
msgid "No File"
msgstr "Žádný soubor"
msgid "No threads."
msgstr "Žádná vlákna"
msgid "None"
msgstr "Nic"
msgid "Normal imageboard"
msgstr "Obrázky"
msgid "Online now"
msgstr "Nyní online"
msgid "Open images in new window"
msgstr "Otevírat obrázky v novém okně"
msgid "Order"
msgstr "Pořadí"
msgid "Password"
msgstr "Heslo"
msgid "Password successfully changed."
msgstr "Heslo bylo úspěšně změněno."
msgid "Please enter a positive amount of seconds, or zero for a permanent ban."
msgstr "Zadejte počet sekund nebo nulu pro permanentní Ban."
msgid "Please select only one image to upload."
msgstr "Prosím zvolte pouze jeden obrázek k odeslání"
msgid "Post"
msgstr "Příspěvek"
msgid "Post preview"
msgstr "Náhled příspěvku"
msgid "Post successfully deleted."
msgstr "Příspěvek smazán"
msgid "Posts"
msgstr "Příspěvky"
msgid "Preview"
msgstr "Náhled"
msgid "Previous"
msgstr "Předchozí"
msgid "Quick Reply"
msgstr "Rychle odpovědět"
msgid "Reason"
msgstr "Důvod"
msgid "Reason:"
msgstr "Důvod:"
msgid "Regular expression"
msgstr "Regulární výraz"
msgid "Remove"
msgstr "Odstranit"
msgid "Replies"
msgstr "Odpovědi"
msgid "Reply"
msgstr "Odpovědět"
msgid "Rules"
msgstr "Pravidla"
msgid "Seconds"
msgstr "sekund"
msgid "Section"
msgstr "Sekce"
msgid "Show All"
msgstr "Zobrazit vše"
msgid "Show Directories"
msgstr "Zobrazit adresáře"
msgid "Show/Hide"
msgstr "Zobrazit/Skrýt"
msgid "Size"
msgstr "Velikost"
msgid "Sorry, that filetype is not allowed on this board."
msgstr "Omlouváme se, ale tento souborový formát není na nástěnce podporován"
msgid "Sorry, this board is locked and can not be posted in."
msgstr "Tato nástěnka je uzamčena a proto není možné přidávat další příspěvky"
msgid "Statistics"
msgstr "Statistika"
msgid "Sticky"
msgstr "Přilepit"
msgid "Subject"
msgstr "Předmět"
msgid "Submit"
msgstr "Odeslat"
msgid "Tag"
msgstr "Tag"
msgid "Text board"
msgstr "Text"
msgid "That IP has already been banned."
msgstr "Tato IP je již blokována"
msgid "There was an error in trying to delete your post"
msgstr "Chyba při mazání příspěvku"
msgid "This post has been deleted."
msgstr "Příspěvek smazán"
msgid "Thread"
msgstr "Vlákno"
msgid "Thread successfully locked."
msgstr "Vlákno uzamčeno"
msgid "Thread successfully unlocked."
msgstr "Vlákno odemčeno"
msgid "Threads"
msgstr "Vlákna"
msgid "To"
msgstr "Do"
msgid "Unable to delete board."
msgstr "Není možné smazat nástěnku"
msgid "Unlock"
msgstr "Odemknout"
msgid "Unsticky"
msgstr "Odlepit"
msgid "Update"
msgstr "Aktualizace"
msgid "Username"
msgstr "Uživatelské jméno"
msgid "Welcome"
msgstr "Vítejte"
msgid "Word"
msgstr "Slovo"
msgid "Yes"
msgstr "Ano"
msgid "Your IP address is"
msgstr "Vaše IP adresa je"
msgid "and"
msgstr "a"
msgid "for the following reason"
msgstr "z důvodu"
msgid "forever"
msgstr "navždy"
msgid "log in"
msgstr "přihlásit se"
msgid "log out"
msgstr "Odhlásit se"
msgid "or"
msgstr "nebo"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" pcp https://launchpad.net/~popcorp86"
msgid "will expire on"
msgstr "vyprší"
msgid "will not expire"
msgstr "nevyprší nikdy"
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+465
View File
@@ -0,0 +1,465 @@
msgid ""
msgstr ""
"Project-Id-Version: trevorchan\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2007-12-09 03:10+0000\n"
"PO-Revision-Date: 2008-02-14 04:34+0000\n"
"Last-Translator: Emanuele Gentili <emgent@emanuele-gentili.com>\n"
"Language-Team: Italian <it@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2008-03-12 04:24+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
msgid "A board with that name already exists."
msgstr "Esiste già una board con questo nome."
msgid "A board with that name does not exist."
msgstr "Non esiste una board con questo nome"
msgid "Add"
msgstr "Aggiungere"
msgid "Add board"
msgstr "Aggiungi board"
msgid "Add news"
msgstr "Aggiungi notizie"
msgid "Add staff member"
msgstr "Aggiungi un membro dello staff"
msgid "Add word"
msgstr "Aggiungi parola"
msgid "Added on"
msgstr "Aggiunto"
msgid "Added staff member"
msgstr "Membro dello staff aggiunto"
msgid "Administration"
msgstr "Amministrazione"
msgid "Administrator"
msgstr "Amministratore"
msgid "Administrators"
msgstr "Amministratori"
msgid "All Threads"
msgstr "Tutti i thread"
msgid "An image, or message, is required for a reply."
msgstr "Per una risposta è richiesta un immagine, o un messaggio."
msgid "Banned"
msgstr "Bannato"
msgid "Board"
msgstr "Board"
msgid "Board successfully added."
msgstr "Board aggiunta con successo."
msgid "Board successfully deleted."
msgstr "Board cancellata con successo"
msgid "Board type:"
msgstr "Tipo di board:"
msgid "Can be left blank."
msgstr "Può essere lasciato in bianco."
msgid "Can not be left blank."
msgstr "Non può essere lasciato in bianco."
msgid "Change account password"
msgstr "Cambia password dell'account"
msgid "Check for new version"
msgstr "Controlla per nuova versione"
msgid "Cleanup"
msgstr "Pulisci"
msgid "Continue"
msgstr "Continuare"
msgid "Current version:"
msgstr "Versione corrente:"
msgid "Default"
msgstr "Predefinito"
msgid "Default style:"
msgstr "Stile predefinito"
msgid "Delete"
msgstr "Cancella"
msgid "Delete all posts by this IP"
msgstr "Cancella tutti i post di questo IP"
msgid "Delete board"
msgstr "Cancella board"
msgid "Delete posts"
msgstr "Cancella i post"
msgid "Deleted staff member"
msgstr "Membro dello staff cancellato"
msgid "Directory"
msgstr "Directory"
msgid "Disk space used"
msgstr "Spazio disco usato"
msgid "Edit"
msgstr "Modifica"
msgid "Email"
msgstr "Email"
msgid "Error, it appears your file did not transfer properly. Please go back and try again."
msgstr "Errore, sembra che il file non sia stato trasferito correttamente. Perfavore tornare indietro e riprovare."
msgid "File"
msgstr "File"
msgid "File was not fully uploaded. Please go back and try again."
msgstr "Il file non è stato completamente caricato. Perfavore tornare indietro e riprovare."
msgid "First 100 posts"
msgstr "Primi 100 post"
msgid "Global options"
msgstr "Opzioni globali"
msgid "Go"
msgstr "Vai"
msgid "ID"
msgstr "ID"
msgid "IP"
msgstr "IP"
msgid "Incorrect password."
msgstr "Password errata."
msgid "Incorrect username/password."
msgstr "nome utente/password errate"
msgid "Index"
msgstr "Indice"
msgid "Invalid ID"
msgstr "ID non valido"
msgid "Invalid session."
msgstr "Sessione non valida."
msgid "Invalid video ID."
msgstr "ID video non valido."
msgid "Invalid video type."
msgstr "Tipo di video non valido."
msgid "Last 50 posts"
msgstr "Ultimi 50 post"
msgid "Last Post"
msgstr "Ultimo post"
msgid "Lock"
msgstr "Blocca"
msgid "Locked"
msgstr "Bloccato"
msgid "Manage"
msgstr "Amministra"
msgid "Manage boards"
msgstr "Amministra le board"
msgid "Maximum image size"
msgstr "Grandezza massima dell'immagine"
msgid "Maximum message length"
msgstr "Lunghezza massima del messaggio"
msgid "Message"
msgstr "Messaggio"
msgid "Misc"
msgstr "Misto"
msgid "Moderates"
msgstr "Moderato"
msgid "Moderation"
msgstr "Moderazione"
msgid "Moderator"
msgstr "Moderatore"
msgid "Moderators"
msgstr "Moderatori"
msgid "Modify staff member"
msgstr "Modifica membro dello staff"
msgid "Module settings"
msgstr "Impostazioni del modulo"
msgid "Modules"
msgstr "Moduli"
msgid "Name"
msgstr "Nome"
msgid "New Thread"
msgstr "Nuovo thread"
msgid "New password"
msgstr "Nuova password"
msgid "New password again"
msgstr "Ripetere nuova password"
msgid "Next"
msgstr "Prossimo"
msgid "No"
msgstr "No"
msgid "No File"
msgstr "Nessun File"
msgid "No boards"
msgstr "Nessuna tavola"
msgid "None"
msgstr "Nessuno"
msgid "Old password"
msgstr "Vecchia password"
msgid "Only moderators of the board and admins can make new posts/replies"
msgstr "Solo i moderatori della board e gli amministratori possono creare nuovi post/risposte"
msgid "Open images in new window"
msgstr "Aprire immagini in una nuova finestra"
msgid "Order"
msgstr "Ordina"
msgid "Password"
msgstr "Password"
msgid "Please make sure your file is smaller than %dB"
msgstr "Perfavore assicurarsi che il file sia più piccolo di %dB"
msgid "Please select a board."
msgstr "Perfavore selezionare una board"
msgid "Please select only one image to upload."
msgstr "Perfavore selezionare solo un immagine da caricare."
msgid "Popular"
msgstr "Popolare"
msgid "Post preview"
msgstr "Anteprima del post"
msgid "Previous"
msgstr "Indietro"
msgid "Quick Reply"
msgstr "Risposta veloce"
msgid "Reason"
msgstr "Motivo"
msgid "Reason:"
msgstr "Motivo:"
msgid "Rebuild all html files"
msgstr "Ripristina tutti i file html"
msgid "Rebuilt all boards and threads"
msgstr "Ripristina tutte le board ed i thread"
msgid "Remove"
msgstr "Rimuovere"
msgid "Replies"
msgstr "Risposte"
msgid "Reply"
msgstr "Risposta"
msgid "Results"
msgstr "Risultati"
msgid "Return"
msgstr "Indietro"
msgid "Search"
msgstr "Ricerca"
msgid "Search posts"
msgstr "Cerca post"
msgid "Seconds"
msgstr "Secondi"
msgid "Section"
msgstr "Sezione"
msgid "Section deleted."
msgstr "Sezione eliminata."
msgid "Show Directories"
msgstr "Mostra cartelle"
msgid "Shown below"
msgstr "Indicato sotto"
msgid "Sorry, a generic error has occurred."
msgstr "Spiacente, si è verificato un errore generico."
msgid "Sorry, that filetype is not allowed on this board."
msgstr "Spiacente, quel tipo di file non è ammesso in questa board"
msgid "Sorry, your message is too long. Message length: %d, maxmimum allowed length: %d"
msgstr "Spiacente, il messaggio è troppo lungo. Lunghezza messaggio: %d, massima lunghezza consentita: %d"
msgid "Sorry, your search returned zero results."
msgstr "Spiacente, la ricerca ha restituito zero risultati."
msgid "Staff"
msgstr "Staff"
msgid "Staff member successfully added."
msgstr "Aggiunto con successo un membro dello staff"
msgid "Staff successfully deleted"
msgstr "Staff cancellatto con successo"
msgid "Staff successfully updated"
msgstr "Staff aggiornato con successo"
msgid "Submit"
msgstr "Invio"
msgid "The name of the board."
msgstr "Il nome della board"
msgid "There are currently no sections."
msgstr "Attualmente non ci sono sezioni."
msgid "There is already a file with that name."
msgstr "C'è già un file con questo nome."
msgid "Thread"
msgstr "Thread"
msgid "Thread successfully locked."
msgstr "Thread bloccato con successo."
msgid "Thread successfully unlocked."
msgstr "Thread sbloccato con successo."
msgid "Threads"
msgstr "Thread"
msgid "Unable to connect to:"
msgstr "Impossibile connetersi a:"
msgid "Unable to delete board."
msgstr "Impossibile cancellare la board."
msgid "Unable to locate a board named"
msgstr "Impossibile localizzare il nome della board"
msgid "Unable to locate a section with that ID."
msgstr "Impossible localizzare una sezione con questo ID."
msgid "Unable to locate that word."
msgstr "Impossibile localizzare questa parola."
msgid "Unlock"
msgstr "Sblocca"
msgid "Unlocked thread"
msgstr "Sblocca thread"
msgid "Update"
msgstr "Aggiornare"
msgid "Update and regenerate board"
msgstr "Aggiornare e rigenerare la board"
msgid "Update successful."
msgstr "Aggiornamento riuscito."
msgid "Update without regenerating board"
msgstr "Aggiornare senza rigenerare la board"
msgid "Updated board configuration"
msgstr "Configurazione board aggiornata"
msgid "Updated global configuration"
msgstr "Configurazione globale aggiornata"
msgid "Updated staff member"
msgstr "Membro dello staff aggiornato"
msgid "Username"
msgstr "Nome utente"
msgid "View catalog"
msgstr "Visualiza catalogo"
msgid "View deleted thread"
msgstr "Visualizza thread cancellati"
msgid "Welcome"
msgstr "Benevenuto"
msgid "Word"
msgstr "Parola"
msgid "Word successfully added."
msgstr "Parola aggiunta con successo."
msgid "YOU ARE BANNED"
msgstr "TU SEI BANNATO"
msgid "Yes"
msgstr "Si"
msgid "You are not a moderator of this board."
msgstr "Non sei un moderatore di questa board."
msgid "You must enter a subject."
msgstr "Devi inserire un oggetto."
msgid "forever"
msgstr "per sempre"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" tj9991 <https://launchpad.net/~tslocum>\n"
"\n"
"Launchpad Contributions:\n"
" Emanuele Gentili https://launchpad.net/~emgent\n"
" Paolo Naldini https://launchpad.net/~hattory\n"
" tj9991 https://launchpad.net/~tslocum"
+210
View File
@@ -0,0 +1,210 @@
msgid ""
msgstr ""
"Project-Id-Version: trevorchan\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2007-12-09 03:10+0000\n"
"PO-Revision-Date: 2008-03-10 04:45+0000\n"
"Last-Translator: tj9991 <tslocum@gmail.com>\n"
"Language-Team: Japanese <ja@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2008-03-12 04:24+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
msgid "(for post and file deletion)"
msgstr "(記事の削除用)"
msgid "Add"
msgstr "追加"
msgid "Administration"
msgstr "管理"
msgid "Administrator"
msgstr "管理者"
msgid "Administrators"
msgstr "管理者"
msgid "All boards"
msgstr "全ての板"
msgid "Board"
msgstr "板"
msgid "Boards"
msgstr "板"
msgid "Captcha"
msgstr "Captcha"
msgid "Catalog Mode"
msgstr "カタログモード"
msgid "Click Reply to view."
msgstr "全て読むには返信ボタンを押してください。"
msgid "Date"
msgstr "日付"
msgid "Delete"
msgstr "削除"
msgid "Delete post"
msgstr "記事削除"
msgid "Email"
msgstr "E-メール"
msgid "Embed"
msgstr "埋め込み"
msgid "File"
msgstr "画像ファイル名"
msgid "Home"
msgstr "ホーム"
msgid "Image"
msgstr "画像"
msgid "Images"
msgstr "画像"
msgid "Incorrect password."
msgstr "パスワードが違います。"
msgid "Incorrect username/password."
msgstr "ユーザー名またはパスワードが違います。"
msgid "Invalid session."
msgstr "無効なセッションです。"
msgid "Lock"
msgstr "ロック"
msgid "Log in again."
msgstr "再度ログインしてください。"
msgid "Manage"
msgstr "管理"
msgid "Message"
msgstr "内容"
msgid "Misc"
msgstr "その他"
msgid "Moderates"
msgstr "モデレート"
msgid "Moderating boards"
msgstr "板をモデレートする"
msgid "Moderation"
msgstr "モデレーション"
msgid "Moderator"
msgstr "モダレータ"
msgid "Moderators"
msgstr "モデレータ"
msgid "Name"
msgstr "名前"
msgid "Next"
msgstr "次に"
msgid "No"
msgstr "いいえ"
msgid "No File"
msgstr "ファイルなし"
msgid "No boards"
msgstr "板無し"
msgid "Password"
msgstr "パスワード"
msgid "Post"
msgstr "投稿"
msgid "Posting mode: Reply"
msgstr "レス送信モード"
msgid "Posts"
msgstr "投稿"
msgid "Preview"
msgstr "プレビュー"
msgid "Previous"
msgstr "前"
msgid "Quick Reply"
msgstr "簡単な返信"
msgid "Remove"
msgstr "削除"
msgid "Replies"
msgstr "返信"
msgid "Reply"
msgstr "返信"
msgid "Return"
msgstr "戻る"
msgid "Size"
msgstr "サイズ"
msgid "Sorry, a generic error has occurred."
msgstr "すいません、一般的なエラーが発生しました。"
msgid "Subject"
msgstr "題名"
msgid "Submit"
msgstr "送信"
msgid "Tag"
msgstr "タグ"
msgid "Thread"
msgstr "スレッド"
msgid "Threads"
msgstr "スレッド"
msgid "Username"
msgstr "ユーザー名"
msgid "Yes"
msgstr "はい"
msgid "and"
msgstr "と"
msgid "log in"
msgstr "ログイン"
msgid "log out"
msgstr "ログアウト"
msgid "omitted"
msgstr "省略"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" p <https://launchpad.net/~p>\n"
" tj9991 <https://launchpad.net/~tslocum>\n"
"\n"
"Launchpad Contributions:\n"
" Nazo https://launchpad.net/~lovesyao\n"
" tj9991 https://launchpad.net/~tslocum"
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+385
View File
@@ -0,0 +1,385 @@
msgid ""
msgstr ""
"Project-Id-Version: kusaba\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2007-12-09 03:10+0000\n"
"PO-Revision-Date: 2008-03-10 18:31+0000\n"
"Last-Translator: Tiago Silva <Unknown>\n"
"Language-Team: Portuguese <pt@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2008-03-12 04:24+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
msgid "Add"
msgstr "Adicionar"
msgid "Add news"
msgstr "Adicionar notícias"
msgid "Add word"
msgstr "Adicionar palavra"
msgid "Administration"
msgstr "Administração"
msgid "Administrator"
msgstr "Administrador"
msgid "Administrators"
msgstr "Administradores"
msgid "All boards"
msgstr "Todos os conselhos"
msgid "An image, or message, is required for a reply."
msgstr "É necessário uma imagem ou mensagem para enviar uma resposta."
msgid "Anonymous"
msgstr "Anónimo"
msgid "Banned"
msgstr "Banido"
msgid "Board"
msgstr "Conselho"
msgid "Boards"
msgstr "Conselhos"
msgid "Cancel"
msgstr "Cancelar"
msgid "Catalog Mode"
msgstr "Modo de Catálogo"
msgid "Change account password"
msgstr "Mudar senha de conta"
msgid "Continue"
msgstr "Continuar"
msgid "Could not create thumbnail."
msgstr "Não foi possível criar uma miniatura."
msgid "Date"
msgstr "Data"
msgid "Description"
msgstr "Descrição"
msgid "Directory"
msgstr "Directório"
msgid "Edit sections"
msgstr "Editar secções"
msgid "Edit word"
msgstr "Editar palavra"
msgid "Email"
msgstr "Correio Electrónico"
msgid "Expand all images"
msgstr "Expandir todas as imagens"
msgid "File"
msgstr "Ficheiro"
msgid "File<br>Removed"
msgstr ""
"Copy text \t\r\n"
"Ficheiro<br>Removido"
msgid "From"
msgstr "De"
msgid "Global options"
msgstr "Opções globais"
msgid "Height"
msgstr "Altura"
msgid "Hide Directories"
msgstr "Ocultar Directórios"
msgid "IP"
msgstr "IP"
msgid "Image"
msgstr "Imagem"
msgid "Images"
msgstr "Imagens"
msgid "Important"
msgstr "Importante"
msgid "Improper filetype."
msgstr "Tipo de ficheiro impróprio."
msgid "Include header"
msgstr "Incluir cabeçalho"
msgid "Incorrect password."
msgstr "Senha incorrecta."
msgid "Incorrect username/password."
msgstr "Nome de utilizador/senha incorrectos."
msgid "Index"
msgstr "Índice"
msgid "Invalid MIME type for this filetype."
msgstr "Tipo MIME inválido para este tipo de ficheiro."
msgid "Invalid response code:"
msgstr "Código de resposta inválido:"
msgid "Invalid session."
msgstr "Sessão inválida."
msgid "Invalid video type."
msgstr "Tipo de vídeo inválido."
msgid "Lock"
msgstr "Bloquear"
msgid "Logo"
msgstr "Logótipo"
msgid "Manage"
msgstr "Gerir"
msgid "Message"
msgstr "Mensagem"
msgid "Message too long. Click %shere%s to view the full text."
msgstr "Mensagem demasiado longa. Pressione %aquis%s para ver o texto na íntegra."
msgid "Misc"
msgstr "Vários"
msgid "Moderates"
msgstr "Modera"
msgid "Moderating boards"
msgstr "Conselhos de moderação"
msgid "Moderation"
msgstr "Moderação"
msgid "Moderator"
msgstr "Moderador"
msgid "Moderators"
msgstr "Moderadores"
msgid "Modify"
msgstr "Modificar"
msgid "Modules"
msgstr "Módulos"
msgid "More"
msgstr "Mais"
msgid "Name"
msgstr "Nome"
msgid "Never"
msgstr "Nunca"
msgid "New image"
msgstr "Nova imagem"
msgid "News"
msgstr "Notícias"
msgid "Next"
msgstr "Seguinte"
msgid "No"
msgstr "Não"
msgid "No boards"
msgstr "Não há conselhos"
msgid "Pages"
msgstr "Páginas"
msgid "Paint with"
msgstr "Pintar com"
msgid "Password"
msgstr "Senha"
msgid "Password successfully changed."
msgstr "Senha alterada com sucesso."
msgid "Please fill in all required fields."
msgstr "Por favor, preencha todos os campos requeridos"
msgid "Popular"
msgstr "Popular"
msgid "Post"
msgstr "Publicar"
msgid "Preview"
msgstr "Previsualizar"
msgid "Previous"
msgstr "Anterior"
msgid "Quick Reply"
msgstr "Resposta Rápida"
msgid "Reason"
msgstr "Motivo"
msgid "Reason:"
msgstr "Motivo:"
msgid "Regular expression"
msgstr "Expressão regular"
msgid "Remove"
msgstr "Remover"
msgid "Replies"
msgstr "Respostas"
msgid "Reply"
msgstr "Resposta"
msgid "Reports"
msgstr "Relatórios"
msgid "Results"
msgstr "Resultados"
msgid "Rules"
msgstr "Regras"
msgid "Seconds"
msgstr "Segundos"
msgid "Section"
msgstr "Secção"
msgid "Section added."
msgstr "Secção adicionada."
msgid "Section deleted."
msgstr "Secção eliminada."
msgid "Section updated."
msgstr "Secção actualizada."
msgid "Show Directories"
msgstr "Mostrar Directórios"
msgid "Size"
msgstr "Tamanho"
msgid "Sorry, a generic error has occurred."
msgstr "Lamento, ocorreu um erro genérico."
msgid "Sorry, your message is too long. Message length: %d, maxmimum allowed length: %d"
msgstr "Lamento, mas a sua mensagem é demasiado extensa: %d, comprimento máximo permitido: %d"
msgid "Statistics"
msgstr "Estatísticas"
msgid "Style"
msgstr "Estilo"
msgid "Styles"
msgstr "Estilos"
msgid "Subject"
msgstr "Assunto"
msgid "Submit"
msgstr "Submeter"
msgid "Tag"
msgstr "Etiqueta"
msgid "That name is for internal use. Please pick another."
msgstr "Este nome é para uso interno. Por favor, escolha outro."
msgid "The second password did not match the first."
msgstr "A segunda senha não coincidiu com a primeira."
msgid "There is already a file with that name."
msgstr "Já existe um ficheiro com esse nome."
msgid "Thread"
msgstr "Tópico"
msgid "Threads"
msgstr "Tópicos"
msgid "To"
msgstr "Para"
msgid "Unlock"
msgstr "Desbloquear"
msgid "Update"
msgstr "Actualizar"
msgid "Use animation?"
msgstr "Usar animação?"
msgid "Username"
msgstr "Nome de utilizador"
msgid "View Reports"
msgstr "Ver Relatórios"
msgid "View animation"
msgstr "Ver animação"
msgid "View catalog"
msgstr "Ver catálogo"
msgid "Width"
msgstr "Largura"
msgid "YOU ARE NOT BANNED!"
msgstr "VOCÊ NÃO ESTÁ BANIDO!"
msgid "Yes"
msgstr "Sim"
msgid "Your IP address is"
msgstr "O seu endereço de IP é"
msgid "Your image"
msgstr "A sua imagem"
msgid "and"
msgstr "e"
msgid "forever"
msgstr "para sempre"
msgid "or"
msgstr "ou"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" André Malafaya Baptista https://launchpad.net/~malafaya\n"
" Tiago Silva https://launchpad.net/~tiagosilva"
msgid "will expire on"
msgstr "irá expirar em"
msgid "will not expire"
msgstr "não irá expirar"
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+542
View File
@@ -0,0 +1,542 @@
msgid ""
msgstr ""
"Project-Id-Version: trevorchan\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2007-12-09 03:10+0000\n"
"PO-Revision-Date: 2007-12-05 18:15+0000\n"
"Last-Translator: Dmitry-Sh <Unknown>\n"
"Language-Team: Russian <ru@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2008-03-12 04:24+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
msgid "(for post and file deletion)"
msgstr "(для удаления постов и файлов)"
msgid "<h2>Add News Post</h2>This message will be displayed as it is written, so make sure you add the proper HTML."
msgstr "<h2>Добавить Новость</h2> Это сообщение будет показано в точности с написанием, поэтому убедитесь, что используете допустимый HTML."
msgid "A staff member with that ID already exists."
msgstr "Участник с таким ID уже существует."
msgid "A staff member with that id does not appear to exist."
msgstr "Участник с таким ID отсутствует."
msgid "Add"
msgstr "Добавить"
msgid "Add staff member"
msgstr "Добавить участника"
msgid "Added on"
msgstr "Добавлено"
msgid "Administration"
msgstr "Администрация"
msgid "Administrator"
msgstr "Администратор"
msgid "Administrators"
msgstr "Администраторы"
msgid "All Threads"
msgstr "Все Нити"
msgid "All boards"
msgstr "Все разделы"
msgid "All threads/posts by that IP in selected boards successfully deleted."
msgstr "Все темы/сообщения с этого IP успешно удалены в выбранных разделах."
msgid "An image, or message, is required for a reply."
msgstr "Чтобы ответить, загрузите изображение или введите текст."
msgid "Banned %d IP addresses using an IP address list."
msgstr "Забанено %d IP-адресов с использованием списка IP-адресов."
msgid "Board"
msgstr "Доска"
msgid "Board type:"
msgstr "Тип доски:"
msgid "Boards"
msgstr "Разделы"
msgid "Can be left blank."
msgstr "Можно оставить пустым."
msgid "Can not be left blank."
msgstr "Нельзя оставить пустым."
msgid "Cancel"
msgstr "Отменить"
msgid "Captcha"
msgstr "Код"
msgid "Continue"
msgstr "Дальше"
msgid "Could not copy uploaded image."
msgstr "Загруженное изображение не удалось сохранить."
msgid "Could not create thumbnail."
msgstr "Не удалось создать эскиз."
msgid "Days to keep modlog entries"
msgstr "Дней до удаления логов действий модераторов"
msgid "Default"
msgstr "По умолчанию"
msgid "Default style:"
msgstr "Стиль по-умолчанию"
msgid "Delete"
msgstr "Удалить"
msgid "Description"
msgstr "Описание"
msgid "Directory"
msgstr "Директория"
msgid "Duplicate file entry detected."
msgstr "Этот файл уже загружен."
msgid "Edit"
msgstr "Редактировать"
msgid "Email"
msgstr "Адрес"
msgid "Error, it appears your file did not transfer properly. Please go back and try again."
msgstr "Ошибка: файл не был загружен. Попробуйте еще раз."
msgid "File"
msgstr "Файл"
msgid "File was not fully uploaded. Please go back and try again."
msgstr "Файл не был загружен целиком. Пожалуйста, повторите попытку."
msgid "First 100 posts"
msgstr "Первые 100 постов"
msgid "First 100 posts shown."
msgstr "Показываются первые 100 постов."
msgid "Forced anonymous"
msgstr "Форсированная анонимность"
msgid "Global configuration succesfully updated."
msgstr "Общие настройки успешно обновлены."
msgid "Go"
msgstr "ОК"
msgid "Header image"
msgstr "Логотип"
msgid "ID"
msgstr "ID"
msgid "IP"
msgstr "IP"
msgid "If set to yes, this board will appear in bold in the menu"
msgstr "Если включено, доска будет выделена полужирным шрифтом в меню."
msgid "If set to yes, this board will appear in italics in the menu"
msgstr "Если включено, доска будет выделена наклонным шрифтом в меню."
msgid "Image"
msgstr "Изображение"
msgid "Image successfully deleted from your post."
msgstr "Изображение из сообщения удалено."
msgid "Images"
msgstr "Изображения"
msgid "Improper filetype."
msgstr "Недопустимый тип файла"
msgid "Include header"
msgstr "Добавить логотип"
msgid "Incorrect captcha entered."
msgstr "Введен неправильный код подтверждения"
msgid "Incorrect password."
msgstr "Неправильный пароль."
msgid "Incorrect username/password."
msgstr "Неправильный логин/пароль."
msgid "Inject"
msgstr "Иньекция"
msgid "Integer values must be entered correctly."
msgstr "Целые значения должны быть введены верно."
msgid "Invalid session."
msgstr "Ошибка сессии."
msgid "Invalid staff ID."
msgstr "Неверный ID участника."
msgid "Invalid thread ID. This may have been caused by the thread recently being deleted."
msgstr "Неверный номер темы. Возможно, она только что была удалена."
msgid "Last 50 posts"
msgstr "Последние 50 постов"
msgid "Last 50 posts shown."
msgstr "Показываются последние 50 постов."
msgid "Last Post"
msgstr "Последний Пост"
msgid "Lock"
msgstr "Заблокировать"
msgid "Locked"
msgstr "Блок"
msgid "Log in again."
msgstr "Требуется повторная авторизация."
msgid "Manage boards"
msgstr "Управление разделами."
msgid "Maximum board pages"
msgstr "Максимальное количество страниц в разделе"
msgid "Maximum image size"
msgstr "Максимальный объем изображения"
msgid "Maximum message length"
msgstr "Максимальная длина сообщения"
msgid "Maximum thread age (Hours)"
msgstr "Максимальный возраст темы (часы)"
msgid "Maximum thread replies"
msgstr "Максимальное количество ответов в тему"
msgid "Maxmimum thumbnail height"
msgstr "Максимальная высота эскиза"
msgid "Maxmimum thumbnail width"
msgstr "Максимальная ширина эскиза"
msgid "Message"
msgstr "Текст"
msgid "Misc"
msgstr "Другое"
msgid "Moderates"
msgstr "Модерирует"
msgid "Moderating boards"
msgstr "Модерируемые разделы"
msgid "Moderation"
msgstr "Модерирование"
msgid "Moderator"
msgstr "Модератор"
msgid "Moderators"
msgstr "Модераторы"
msgid "Modify staff member"
msgstr "Изменить участника"
msgid "Module settings"
msgstr "Настройки модулей"
msgid "Modules"
msgstr "Модули"
msgid "More"
msgstr "Далее"
msgid "NOTICE: You are using the default administrator account. Anyone can log in to this account, so a second administrator account needs to be created. Create another, log in to it, and delete this one."
msgstr "ВНИМАНИЕ: Вы используете стандартную запись администратора! Любой может ею воспользоваться, поэтому настоятельно рекомендуем создать еще одну, удалив эту."
msgid "Name"
msgstr "Ник"
msgid "Never"
msgstr "Никогда"
msgid "New Thread"
msgstr "Новая Нить"
msgid "News entry successfully added."
msgstr "Новая запись успешно добавлена."
msgid "Next"
msgstr "Дальше"
msgid "No"
msgstr "Нет"
msgid "No boards"
msgstr "Разделов нет"
msgid "No threads."
msgstr "Нет нитей."
msgid "None"
msgstr "Нету"
msgid "Normal imageboard"
msgstr "Нормальная доска"
msgid "Oekaki imageboard"
msgstr "Доска оекаки"
msgid "Open images in new window"
msgstr "Открывать изображения в новом окне"
msgid "Order"
msgstr "Последовательность"
msgid "Password"
msgstr "Пaроль"
msgid "Please enter a search query."
msgstr "Пожалуйста, введите поисковый запрос"
msgid "Please make sure your file is smaller than %dB"
msgstr "Файл должен быть меньше %dБ."
msgid "Please select only one image to upload."
msgstr "Пожалуйста, загружайте только одно изображение за раз."
msgid "Popular"
msgstr "Популярная"
msgid "Post"
msgstr "Сообщение"
msgid "Post successfully deleted."
msgstr "Сообщение удалено."
msgid "Postbox notice"
msgstr "Заметка"
msgid "Posting rates (past hour)"
msgstr "Рейтинг сообщений (за последний час)"
msgid "Posts"
msgstr "Сообщение"
msgid "Preview"
msgstr "Предпросмотр"
msgid "Previous"
msgstr "Назад"
msgid "Proxy list"
msgstr "Список прокси"
msgid "Query"
msgstr "Запрос"
msgid "Query executed successfully"
msgstr "Запрос успешно выполнен."
msgid "Quick Reply"
msgstr "Быстрый ответ"
msgid "Read this thread from the beginning"
msgstr "Прочитать эту нить с начала."
msgid "Rebuild complete. Took <b>%d</b> seconds."
msgstr "Пересчет завершен. Он занял <b>%d</b> секунд."
msgid "Redirect to thread"
msgstr "Перенаправить в тему"
msgid "Remove"
msgstr "Удалить"
msgid "Replies"
msgstr "Ответы"
msgid "Reply"
msgstr "Ответ"
msgid "Report"
msgstr "Отчет"
msgid "Reports"
msgstr "Отчеты"
msgid "Results"
msgstr "Результаты"
msgid "Search"
msgstr "Поиск"
msgid "Section"
msgstr "Секция"
msgid "Site Styles"
msgstr "Стили сайта"
msgid "Sorry, a generic error has occurred."
msgstr "Извините, произошла ошибка."
msgid "Sorry, because of your numerous failed logins, you have been locked out from logging in for 20 minutes. Please wait and then try again."
msgstr "Извините, но из-за ряда неудачных попыток входа, Вам будет закрыт доступ на 20 минут. Пожалуйста, подождите и попробуйте еще раз."
msgid "Sorry, that filetype is not allowed on this board."
msgstr "Извините, этот тип файла не разрешен к загрузке в раздел."
msgid "Sorry, this board is locked and can not be posted in."
msgstr "Извините, раздел закрыт для сообщений."
msgid "Sorry, this thread is locked and can not be replied to."
msgstr "Извините, тема закрыта для ответов."
msgid "Sorry, your message is too long. Message length: %d, maxmimum allowed length: %d"
msgstr "Извините, сообщение слишком длинное. %d символов при допустимом лимите в %d"
msgid "Sorry, your search returned zero results."
msgstr "Поиск не дал результатов."
msgid "Staff member successfully added."
msgstr "Участник добавлен"
msgid "Staff rights"
msgstr "Права модераторов"
msgid "Staff successfully deleted"
msgstr "Участник удален"
msgid "Staff successfully updated"
msgstr "Участник обновлен"
msgid "Statistics"
msgstr "Статистика"
msgid "Stickied"
msgstr "Прикреплено"
msgid "Sticky"
msgstr "Прикрепленный"
msgid "Style"
msgstr "Стиль"
msgid "Styles"
msgstr "Стили"
msgid "Subject"
msgstr "Тема"
msgid "Text board"
msgstr "Текстовая доска"
msgid "Text boards only. If enabled, the list of threads displayed on the front page will be formatted differently to be compact."
msgstr "Только текстовые доски. Если включено, список нитей на главной странице будет форматироваться более компактно."
msgid "That ID is a reply, not a thread."
msgstr "Это номер ответа, а не темы."
msgid "That thread has yet to be deleted."
msgstr "Эта тема уже удалена."
msgid "The 5 newest replies are shown below."
msgstr "Последние 5 ответов показаны ниже."
msgid "The style which will be set when the user first visits the board."
msgstr "Стиль, который устанавливается при первом посещении доски."
msgid "There are currently no threads to display."
msgstr "Нити для отображения отсутствуют."
msgid "There was an error in trying to delete your post"
msgstr "Ошибка при попытке удалить сообщение."
msgid "Thread"
msgstr "Thread"
msgid "Threads"
msgstr "Отметить подшивки"
msgid "Trial"
msgstr "Тестовая"
msgid "Unable to locate a board named"
msgstr "Невозможно найти раздел под названием"
msgid "Unlock"
msgstr "Разблокировать"
msgid "Unsticky"
msgstr "Открепленный"
msgid "Update"
msgstr "Обновить"
msgid "Update successful."
msgstr "Успешно обновлено."
msgid "Username"
msgstr "Логин"
msgid "Welcome"
msgstr "Добро пожаловать!"
msgid "Yes"
msgstr "Да"
msgid "You have been successfully logged out."
msgstr "Вы успешно вышли."
msgid "You must enter a subject."
msgstr "Вы должны ввести тему."
msgid "You searched for"
msgstr "Вы искали"
msgid "Your post already doesn't have an image!"
msgstr "В Вашем сообщении нет изображений."
msgid "Your posting password"
msgstr "Пароль для сообщений"
msgid "and"
msgstr "и"
msgid "forever"
msgstr "всегда"
msgid "log out"
msgstr "Выйти"
msgid "or"
msgstr "или"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" 8ch_ru <https://launchpad.net/~stop-reading-this>\n"
" Aleksej Korgenkov <https://launchpad.net/~grimpanto>\n"
" tj9991 <https://launchpad.net/~tslocum>\n"
"\n"
"Launchpad Contributions:\n"
" Aleksej Korgenkov https://launchpad.net/~grimpanto\n"
" Dmitry-Sh https://launchpad.net/~tty01\n"
" Nikolay https://launchpad.net/~nicko4ever"
+11
View File
@@ -0,0 +1,11 @@
<?php
/* Get all of the faq entries */
$results = $tc_db->GetAll("SELECT * FROM `".KU_DBPREFIX."front` WHERE `page` = 1 ORDER BY `order` ASC");
foreach($results AS $line) {
$content .= '<div class="content">' . "\n" .
'<h2><span class="newssub">'.stripslashes($line['subject']).'';
$content .= '</span><span class="permalink"><a href="#' . $line['id'] . '" title="permalink">#</a></span></h2>' . "\n" .
stripslashes($line['message']) . '</div><br />' . "\n";
}
return $content;
?>
+72
View File
@@ -0,0 +1,72 @@
<html>
<head>
<title>Manage - Log In</title>
<script type="text/javascript">function sf(){document.managelogin.username.focus();}</script>
<style type="text/css">
html, body, #wrapper {
height:100%;
margin: 0;
padding: 0;
border: none;
text-align: center;
}
#wrapper {
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
#wrappertr {
height: 25%;
}
input {
width: 100%;
font-size: 2em;
text-align: center;
}
</style>
</head>
<body onload="sf();">
<table id="wrapper" width="100%">
<tr height="33%">
<td colspan="3">
&nbsp;
</td>
</tr>
<tr>
<td width="30%" style="font-size: 15em;font-weight: bold;">
<!--<img src="/css/images/x.png" width="256px" height="256px" />-->
</td>
<td width="40%">
<div style="height: 80%;border: 1px solid;padding: 10px;font-weight: bold;">
<form action="?action=login" method="post" name="managelogin">
<table width="100%" height="100%">
<tr height="33%">
<td>
<input type="text" name="username" />
</td>
</tr>
<tr height="33%">
<td>
<input type="password" name="password" />
</td>
</tr>
<tr height="34%">
<td>
<input type="submit" value="Log in" />
</td>
</tr>
</table>
</form>
</div>
</td>
<td width="30%" style="font-size: 15em;font-weight: bold;">
<!--<img src="/css/images/x.png" width="256px" height="256px" />-->
</td>
</tr>
<tr height="33%">
<td colspan="3">
&nbsp;
</td>
</tr>
</table>
</body>
View File
Whitespace-only changes.
+13
View File
@@ -0,0 +1,13 @@
<?php
/* Get all of the rules entries */
$results = $tc_db->GetAll("SELECT * FROM `".KU_DBPREFIX."front` WHERE `page` = 2 ORDER BY `order` ASC");
if (count($results) > 0) {
foreach($results AS $line) {
$content .= '<div class="content">' . "\n" .
'<h2><span class="newssub">'.stripslashes($line['subject']).'';
$content .= '</span><span class="permalink"><a href="#' . $line['id'] . '" title="permalink">#</a></span></h2>' . "\n" .
stripslashes($line['message']) . '</div><br />' . "\n";
}
}
return $content;
?>
Binary file not shown.