@ -1,338 +0,0 @@ |
|||
<?php |
|||
set_time_limit(0); |
|||
$kusabaxc = Array(); |
|||
|
|||
|
|||
/* Config */ |
|||
|
|||
// Path to KusabaX configuration file (config.php) |
|||
// Warning: This script will ignore anything past the first `require`. This is only a problem if you've extensively modified your config.php |
|||
$kusabaxc['config'] = ''; |
|||
|
|||
/* End config */ |
|||
|
|||
|
|||
require 'inc/functions.php'; |
|||
require 'inc/display.php'; |
|||
require 'inc/template.php'; |
|||
require 'inc/database.php'; |
|||
require 'inc/user.php'; |
|||
|
|||
if(!isset($kusabaxc['config']) || empty($kusabaxc['config'])) |
|||
error('Did you forget to configure the script?'); |
|||
|
|||
if(!file_exists($kusabaxc['config']) || !is_readable($kusabaxc['config'])) |
|||
error('Kusaba X config file doesn\'t exist or I can\'t read it.'); |
|||
|
|||
$temp = tempnam($config['tmp'], 'kusabax'); |
|||
|
|||
$raw_config = file_get_contents($kusabaxc['config']); |
|||
|
|||
// replace __FILE__ with the actual filename |
|||
$raw_config = str_replace('__FILE__', '\'' . addslashes(realpath($kusabaxc['config'])) . '\'', $raw_config); |
|||
|
|||
// remove anything after the first `require` |
|||
$raw_config = substr($raw_config, 0, strpos($raw_config, 'require KU_ROOTDIR')); |
|||
|
|||
file_put_contents($temp, $raw_config); |
|||
|
|||
// Load KusabaX config |
|||
require $temp; |
|||
|
|||
unlink($temp); |
|||
|
|||
if(KU_DBTYPE != 'mysql' && KU_DBTYPE != 'mysqli') |
|||
error('Database type <strong>' . KU_DBTYPE . '</strong> not supported!'); |
|||
|
|||
$kusabaxc['db']['type'] = 'mysql'; |
|||
$kusabaxc['db']['server'] = KU_DBHOST; |
|||
$kusabaxc['db']['user'] = KU_DBUSERNAME; |
|||
$kusabaxc['db']['password'] = KU_DBPASSWORD; |
|||
$kusabaxc['db']['database'] = KU_DBDATABASE; |
|||
$kusabaxc['db']['dsn'] = ''; |
|||
$kusabaxc['db']['timeout'] = 5; |
|||
$kusabaxc['db']['persistent'] = false; |
|||
|
|||
|
|||
// KusabaX functions |
|||
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); |
|||
} |
|||
|
|||
// KusabaX -> Tinyboard HTML |
|||
function convert_markup($body) { |
|||
global $config; |
|||
$body = stripslashes($body); |
|||
|
|||
// >quotes |
|||
$body = str_replace('"unkfunc"', '"quote"', $body); |
|||
|
|||
// >>cites |
|||
$body = preg_replace('/<a href="[^"]+?\/(\w+)\/res\/(\d+).html#(\d+)" onclick="return highlight\(\'\d+\', true\);" class="[^"]+">/', '<a onclick="highlightReply(\'$3\');" href="' . $config['root'] . '$1/res/$2.html#$3">', $body); |
|||
|
|||
// Public bans |
|||
$body = preg_replace('/<br \/><font color="#FF0000"><b>\((.+?)\)<\/b><\/font>/', '<span class="public_ban">($1)</span>', $body); |
|||
|
|||
return $body; |
|||
} |
|||
|
|||
$step = isset($_GET['step']) ? round($_GET['step']) : 0; |
|||
$page = Array( |
|||
'config' => $config, |
|||
'title' => 'KusabaX Database Migration', |
|||
'body' => '' |
|||
); |
|||
|
|||
$log = Array(); |
|||
|
|||
// Trick Tinyboard into opening the KusabaX databse instead |
|||
$__temp = $config['db']; |
|||
$config['db'] = $kusabaxc['db']; |
|||
|
|||
sql_open(); |
|||
|
|||
// Get databse link |
|||
$kusabax = $pdo; |
|||
// Clear |
|||
unset($pdo); |
|||
|
|||
// Open Tinyboard database |
|||
$config['db'] = $__temp; |
|||
unset($__temp); |
|||
|
|||
$k_query = $kusabax->query('SELECT * FROM `' . KU_DBPREFIX . 'boards`'); |
|||
$boards = listBoards(); |
|||
|
|||
// Copy boards table, briefly |
|||
$kusabax_boards = Array(); |
|||
while($board = $k_query->fetch()) { |
|||
// For later use... |
|||
$kusabax_boards[(int)$board['id']] = $board['name']; |
|||
|
|||
$already_exists = false; |
|||
foreach($boards as &$_board) { |
|||
if($_board['uri'] == $board['name']) { |
|||
// Board already exists in Tinyboard... |
|||
$log[] = 'Board /' . $board['name'] . '/ already exists.'; |
|||
$already_exists = true; |
|||
break; |
|||
} |
|||
} |
|||
if($already_exists) |
|||
continue; |
|||
|
|||
$log[] = 'Creating board: <strong>/' . $board['name'] . '/</strong>'; |
|||
|
|||
// Go ahead and create this new board... |
|||
$query = prepare('INSERT INTO `boards` VALUES (NULL, :uri, :title, :subtitle)'); |
|||
$query->bindValue(':uri', $board['name']); |
|||
$query->bindValue(':title', $board['desc']); |
|||
$query->bindValue(':subtitle', null, PDO::PARAM_NULL); |
|||
$query->execute() or error(db_error($query)); |
|||
|
|||
// Posting table |
|||
query(Element('posts.sql', Array('board' => $board['name']))) or error(db_error()); |
|||
|
|||
// Set up board (create directories, etc.) by opening it |
|||
openBoard($board['name']); |
|||
} |
|||
|
|||
$k_query = $kusabax->query('SELECT `' . KU_DBPREFIX . 'posts`.*, `' . KU_DBPREFIX . '`.`type` FROM `' . KU_DBPREFIX . 'posts` LEFT JOIN `' . KU_DBPREFIX . 'staff` ON `posterauthority` = `' . KU_DBPREFIX . 'staff`.`id` WHERE `IS_DELETED` = 0') or error(db_error($kusabax)); |
|||
while($post = $k_query->fetch(PDO::FETCH_ASSOC)) { |
|||
if(!isset($kusabax_boards[(int)$post['boardid']])) { |
|||
// Board doesn't exist... |
|||
continue; |
|||
} |
|||
$board = $kusabax_boards[(int)$post['boardid']]; |
|||
|
|||
$log[] = 'Replicating post <strong>' . $post['id'] . '</strong> on /' . $board . '/'; |
|||
|
|||
$query = prepare(sprintf("INSERT INTO `posts_%s` VALUES |
|||
( |
|||
:id, :thread, :subject, :email, :name, :trip, :capcode, :body, NULL, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed |
|||
)", $board)); |
|||
|
|||
// Post ID |
|||
$query->bindValue(':id', $post['id'], PDO::PARAM_INT); |
|||
|
|||
// Thread (`parentid`) |
|||
if($post['parentid'] == 0) |
|||
$query->bindValue(':thread', null, PDO::PARAM_NULL); |
|||
else |
|||
$query->bindValue(':thread', (int)$post['parentid'], PDO::PARAM_INT); |
|||
|
|||
// Name |
|||
if(empty($post['name'])) |
|||
$post['name'] = $config['anonymous']; |
|||
$query->bindValue(':name', trim($post['name']), PDO::PARAM_STR); |
|||
|
|||
// Trip |
|||
if(empty($post['tripcode'])) |
|||
$query->bindValue(':trip', null, PDO::PARAM_NULL); |
|||
else |
|||
$query->bindValue(':trip', $post['tripcode'], PDO::PARAM_STR); |
|||
|
|||
// Email |
|||
$query->bindValue(':email', trim($post['email']), PDO::PARAM_STR); |
|||
|
|||
// Subject |
|||
$query->bindValue(':subject', trim($post['subject']), PDO::PARAM_STR); |
|||
|
|||
// Body (`message`) |
|||
$query->bindValue(':body', convert_markup($post['message']), PDO::PARAM_STR); |
|||
|
|||
$embed_code = false; |
|||
|
|||
// File |
|||
if(empty($post['file']) || $post['file'] == 'removed') { |
|||
if($post['file'] == 'removed') |
|||
$query->bindValue(':file', 'deleted', PDO::PARAM_STR); |
|||
else |
|||
$query->bindValue(':file', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':width', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':height', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':filesize', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':filename', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':filehash', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':thumb', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':thumbwidth', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':thumbheight', null, PDO::PARAM_NULL); |
|||
} elseif($post['file_size'] == 0 && empty($post['file_md5'])) { |
|||
// embed |
|||
$query->bindValue(':file', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':width', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':height', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':filesize', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':filename', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':filehash', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':thumb', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':thumbwidth', null, PDO::PARAM_NULL); |
|||
$query->bindValue(':thumbheight', null, PDO::PARAM_NULL); |
|||
|
|||
if($post['file_type'] == 'you') { |
|||
// youtube |
|||
|
|||
foreach($config['embedding'] as $embed) { |
|||
if(strpos($embed[0], 'youtube\.com') !== false) { |
|||
$embed_code = preg_replace($embed[0], $embed[1], 'http://youtube.com/watch?v=' . $post['file']); |
|||
$embed_code = str_replace('%%tb_width%%', $config['embed_width'], $embed_code); |
|||
$embed_code = str_replace('%%tb_height%%', $config['embed_height'], $embed_code); |
|||
|
|||
$query->bindValue(':embed', $embed_code, PDO::PARAM_STR); |
|||
} |
|||
} |
|||
} |
|||
} else { |
|||
$query->bindValue(':file', $post['file'] . '.' . $post['file_type'], PDO::PARAM_STR); |
|||
$query->bindValue(':width', $post['image_w'], PDO::PARAM_INT); |
|||
$query->bindValue(':height', $post['image_h'], PDO::PARAM_INT); |
|||
$query->bindValue(':filesize', $post['file_size'], PDO::PARAM_INT); |
|||
$query->bindValue(':filename', $post['file_original'] . '.' . $post['file_type'], PDO::PARAM_STR); |
|||
// They use MD5; we use SHA1 by default. |
|||
$query->bindValue(':filehash', null, PDO::PARAM_NULL); |
|||
|
|||
$query->bindValue(':thumb', $post['file'] . '.' . $post['file_type'], PDO::PARAM_STR); |
|||
$query->bindValue(':thumbwidth', $post['thumb_w'], PDO::PARAM_INT); |
|||
$query->bindValue(':thumbheight', $post['thumb_h'], PDO::PARAM_INT); |
|||
|
|||
// Copy file |
|||
$file_path = KU_BOARDSDIR . $board . '/src/' . $post['file'] . '.' . $post['file_type']; |
|||
$thumb_path = KU_BOARDSDIR . $board . '/thumb/' . $post['file'] . 's.' . $post['file_type']; |
|||
|
|||
$to_file_path = sprintf($config['board_path'], $board) . $config['dir']['img'] . $post['file'] . '.' . $post['file_type']; |
|||
$to_thumb_path = sprintf($config['board_path'], $board) . $config['dir']['thumb'] . $post['file'] . '.' . $post['file_type']; |
|||
|
|||
if(!file_exists($to_file_path)) { |
|||
$log[] = 'Copying file: <strong>' . $file_path . '</strong>'; |
|||
if(!@copy($file_path, $to_file_path)) { |
|||
$err = error_get_last(); |
|||
$log[] = 'Could not copy <strong>' . $file_path . '</strong>: ' . $err['message']; |
|||
} |
|||
} |
|||
|
|||
if(!file_exists($to_thumb_path)) { |
|||
$log[] = 'Copying file: <strong>' . $thumb_path . '</strong>'; |
|||
if(!@copy($thumb_path, $to_thumb_path)) { |
|||
$err = error_get_last(); |
|||
$log[] = 'Could not copy <strong>' . $thumb_path. '</strong>: ' . $err['message']; |
|||
} |
|||
} |
|||
} |
|||
|
|||
if(!$embed_code) |
|||
$query->bindValue(':embed', null, PDO::PARAM_NULL); |
|||
|
|||
// IP |
|||
$ip = md5_decrypt($post['ip'], KU_RANDOMSEED); |
|||
if(!preg_match('/^\d+\.\d+\.\d+\.\d+$/', $ip)) { |
|||
// Invalid IP address. Wrong KU_RANDOMSEED? |
|||
|
|||
$log[] = 'Invalid IP address returned after decryption. Wrong KU_RANDOMSEED?'; |
|||
$ip = '0.0.0.0'; // just set it to something valid and continue |
|||
} |
|||
$query->bindValue(':ip', $ip, PDO::PARAM_STR); |
|||
|
|||
// Time (`timestamp`) |
|||
$query->bindValue(':time', $post['timestamp'], PDO::PARAM_INT); |
|||
|
|||
// Bump (`bumped`) |
|||
$query->bindValue(':bump', $post['bumped'], PDO::PARAM_INT); |
|||
|
|||
// Locked |
|||
$query->bindValue(':locked', $post['locked'], PDO::PARAM_INT); |
|||
|
|||
// Sticky |
|||
$query->bindValue(':sticky', $post['stickied'], PDO::PARAM_INT); |
|||
|
|||
// Impossible |
|||
$query->bindValue(':password', null, PDO::PARAM_NULL); |
|||
|
|||
if($post['posterauthority']) { |
|||
$query->bindValue(':capcode', $post['type'] == 1 ? 'Admin' : 'Mod', PDO::PARAM_STR); |
|||
} else { |
|||
$query->bindValue(':capcode', null, PDO::PARAM_NULL); |
|||
} |
|||
|
|||
// Insert post |
|||
$query->execute() or $log[] = 'Error: ' . db_error($query); |
|||
} |
|||
|
|||
// News |
|||
$k_query = $kusabax->query('SELECT * FROM `' . KU_DBPREFIX . 'front` WHERE `page` = 0'); |
|||
while($news = $k_query->fetch()) { |
|||
// Check if already exists |
|||
$query = prepare("SELECT 1 FROM `news` WHERE `body` = :body AND `time` = :time"); |
|||
$query->bindValue(':time', $news['timestamp'], PDO::PARAM_INT); |
|||
$query->bindValue(':body', $news['message'], PDO::PARAM_STR); |
|||
$query->execute() or error(db_error($query)); |
|||
if($query->fetch()) |
|||
continue; |
|||
|
|||
$query = prepare("INSERT INTO `news` VALUES (NULL, :name, :time, :subject, :body)"); |
|||
$query->bindValue(':name', $news['poster'], PDO::PARAM_STR); |
|||
$query->bindValue(':time', $news['timestamp'], PDO::PARAM_INT); |
|||
$query->bindValue(':subject', $news['subject'], PDO::PARAM_STR); |
|||
$query->bindValue(':body', $news['message'], PDO::PARAM_STR); |
|||
$query->execute() or $log[] = 'Error: ' . db_error($query); |
|||
} |
|||
|
|||
$page['body'] = '<div class="ban"><h2>Migrating…</h2><p>'; |
|||
foreach($log as &$l) { |
|||
$page['body'] .= $l . '<br/>'; |
|||
} |
|||
$page['body'] .= '</p></div>'; |
|||
|
|||
echo Element('page.html', $page); |
|||
|
|||
|
@ -1,150 +0,0 @@ |
|||
/** |
|||
* dark.css |
|||
* For AwsumChan by Circlepuller |
|||
*/ |
|||
body { |
|||
background: #1E1E1E; |
|||
color: #999999; |
|||
font-family: sans-serif; |
|||
font-size: 12px; |
|||
} |
|||
h1 { |
|||
font-size: 20pt; |
|||
text-align: center; |
|||
letter-spacing: 0px; |
|||
} |
|||
div.title, h1 { |
|||
color: lime; |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
} |
|||
div.title p { |
|||
font-size: 10px; |
|||
} |
|||
a:link, a:visited, p.intro a.email span.name { |
|||
color: #CCCCCC; |
|||
text-decoration: underline; |
|||
font-family: sans-serif; |
|||
} |
|||
a:link:hover, a:visited:hover { |
|||
color: #FF0000; |
|||
font-family: sans-serif; |
|||
text-decoration: underline overline; |
|||
} |
|||
a.post_no { |
|||
color: #AAAAAA; |
|||
text-decoration: none; |
|||
} |
|||
a.post_no:hover { |
|||
color: maroon; |
|||
text-decoration: underline overline; |
|||
} |
|||
div.post.reply { |
|||
background: #333333; |
|||
border: #555555 1px solid; |
|||
} |
|||
div.post.reply.highlighted { |
|||
background: transparent; |
|||
border: transparent 0px solid; |
|||
} |
|||
div.post.reply p.body a:link, div.post.reply p.body a:visited { |
|||
color: #CCCCCC; |
|||
} |
|||
div.post.reply p.body a:link:hover, div.post.reply p.body a:visited:hover { |
|||
color: #FF0000; |
|||
} |
|||
p.intro span.subject { |
|||
font-size: 12px; |
|||
font-family: sans-serif; |
|||
color: #446655; |
|||
font-weight: 800; |
|||
} |
|||
p.intro span.name { |
|||
color: #00CC00; |
|||
font-weight: 800; |
|||
} |
|||
p.intro a.capcode, p.intro a.nametag { |
|||
color: magenta; |
|||
margin-left: 0; |
|||
} |
|||
p.intro a.email, p.intro a.email span.name, p.intro a.email:hover, p.intro a.email:hover span.name { |
|||
color: #00CCCC; |
|||
} |
|||
input[type="text"], textarea, select { |
|||
background: #333333; |
|||
color: #CCCCCC; |
|||
border: #666666 1px solid; |
|||
padding-left: 5px; |
|||
padding-right: -5px; |
|||
font-family: sans-serif; |
|||
font-size: 10pt; |
|||
} |
|||
input[type="password"] { |
|||
background: #333333; |
|||
color: #CCCCCC; |
|||
border: #666666 1px solid; |
|||
} |
|||
form table tr th { |
|||
background: #333333; |
|||
color: #AAAAAA; |
|||
font-weight: 800; |
|||
text-align: left; |
|||
padding: 0; |
|||
} |
|||
div.banner { |
|||
background: #00AA00; |
|||
color: #FFFFFF; |
|||
text-align: center; |
|||
width: 250px; |
|||
padding: 4px; |
|||
padding-left: 12px; |
|||
padding-right: 12px; |
|||
margin-left: auto; |
|||
margin-right: auto; |
|||
font-size: 12px; |
|||
} |
|||
input[type="submit"] { |
|||
background: #333333; |
|||
border: #888888 1px solid; |
|||
color: #CCCCCC; |
|||
} |
|||
input[type="submit"]:hover { |
|||
background: #555555; |
|||
border: #888888 1px solid; |
|||
color: #FF0000; |
|||
} |
|||
p.fileinfo a:hover { |
|||
text-decoration: underline; |
|||
} |
|||
span.trip { |
|||
color: #AAAAAA; |
|||
} |
|||
div.pages { |
|||
color: #AAAAAA; |
|||
background: #333333; |
|||
border: #666666 1px solid; |
|||
font-family: sans-serif; |
|||
font-size: 10pt; |
|||
} |
|||
div.pages a.selected { |
|||
color: #CCCCCC; |
|||
} |
|||
hr { |
|||
height: 1px; |
|||
border: #333333 1px solid; |
|||
} |
|||
div.boardlist { |
|||
color: #999999; |
|||
} |
|||
div.ban { |
|||
background-color: transparent; |
|||
border: transparent 0px solid; |
|||
} |
|||
div.ban h2 { |
|||
background: transparent; |
|||
color: lime; |
|||
font-size: 12px; |
|||
} |
|||
table.modlog tr th { |
|||
background: #333333; |
|||
color: #AAAAAA; |
|||
} |
@ -1,88 +0,0 @@ |
|||
/* +piwnichan style, based on futaba.css of Tinyboard */ |
|||
|
|||
body { |
|||
background: #ffe; |
|||
color: #800000; |
|||
font-family: sans-serif; |
|||
font-size: 13px; |
|||
} |
|||
div.title h1 { |
|||
font-size: 24px; |
|||
} |
|||
div.title p { |
|||
font-size: 10px; |
|||
} |
|||
div.pages { |
|||
font-size: 13px !important; |
|||
} |
|||
a:link, a:visited, p.intro a.email span.name { |
|||
color: #0000ff; |
|||
font-size: inherit; |
|||
text-decoration: inherit; |
|||
} |
|||
a:link:hover { |
|||
color: #d00; |
|||
text-decoration: inherit; |
|||
} |
|||
span.omitted { |
|||
color: gray; |
|||
} |
|||
a.post_no { |
|||
color: #800000; |
|||
} |
|||
div.post.reply { |
|||
border: 0px; |
|||
background: #f0e0d6; |
|||
} |
|||
div.post.reply.highlighted { |
|||
background: #f0c0b0; |
|||
border-color: #d9bfb7; |
|||
} |
|||
div.post.reply p.body a { |
|||
color: navy; |
|||
} |
|||
p.intro span.subject { |
|||
color: #d00; |
|||
} |
|||
form table tr th { |
|||
background: #EA8; |
|||
} |
|||
div.ban h2 { |
|||
background: #FCA; |
|||
color: inherit; |
|||
} |
|||
div.ban { |
|||
border-color: #800; |
|||
} |
|||
div.ban p { |
|||
color: black; |
|||
} |
|||
div.pages { |
|||
padding: 7px 5px; |
|||
color: maroon; |
|||
font-size: 12pt; |
|||
|
|||
background: none; |
|||
border-width: 1px; |
|||
border-style: inset; |
|||
|
|||
} |
|||
div.pages a.selected { |
|||
color: #800; |
|||
} |
|||
hr { |
|||
border-width: 1px; |
|||
border-style: inset; |
|||
} |
|||
div.boardlist { |
|||
color: #B86; |
|||
} |
|||
div.boardlist a { |
|||
color: #800; |
|||
} |
|||
unimportant, .unimportant * { |
|||
font-size: 13px; |
|||
} |
|||
table.modlog tr th { |
|||
background: #EA8; |
|||
} |
Before Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 6.4 KiB |
@ -1,87 +0,0 @@ |
|||
/** |
|||
* miku.css |
|||
* For AwsumChan by Circlepuller |
|||
*/ |
|||
body { |
|||
background: #D2FFEE url('img/fade-miku.png') top repeat-x; |
|||
} |
|||
|
|||
a:link, a:visited { |
|||
text-decoration: none; |
|||
color: #0093AB; |
|||
} |
|||
|
|||
a:link:hover, a:visited:hover { |
|||
color: #DD0000; |
|||
} |
|||
|
|||
a.post_no { |
|||
color: #000033; |
|||
} |
|||
|
|||
p.intro a.email span.name { |
|||
color: #0093AB; |
|||
} |
|||
|
|||
p.intro a.email:hover span.name { |
|||
color: #DD0000; |
|||
} |
|||
|
|||
h2, div.title, h1 { |
|||
color: #800000; |
|||
} |
|||
|
|||
form table tr th { |
|||
background: #95D2D3; |
|||
} |
|||
|
|||
div.banner { |
|||
background-color: #E04000; |
|||
} |
|||
|
|||
div.post.op hr { |
|||
border-color: #B7C9D5; |
|||
} |
|||
|
|||
p.intro span.subject { |
|||
color: #117743; |
|||
font-weight: 800; |
|||
} |
|||
|
|||
p.intro span.name { |
|||
color: #117743; |
|||
font-weight: 800; |
|||
} |
|||
|
|||
div.post.reply.highlighted { |
|||
background: #9988EE; |
|||
} |
|||
|
|||
div.post.reply { |
|||
background: #B6DDDE; |
|||
border-color: #8FCCCD; |
|||
} |
|||
|
|||
div.ban { |
|||
border: 1px solid #0093AB; |
|||
} |
|||
|
|||
div.ban h2 { |
|||
background: #B6DDDE; |
|||
color: #0093AB; |
|||
} |
|||
|
|||
div.pages { |
|||
color: #8899AA; |
|||
background: #B6DDDE; |
|||
border-right: 1px solid #8FCCCD; |
|||
border-bottom: 1px solid #8FCCCD; |
|||
} |
|||
|
|||
hr { |
|||
border-color: #B7D9C5; |
|||
} |
|||
|
|||
div.boardlist { |
|||
color: #0093AB; |
|||
} |
@ -1,208 +0,0 @@ |
|||
/* +piwnichan style, based on testorange.css from Karachan */ |
|||
|
|||
body { |
|||
font-family: sans-serif; |
|||
font-size: 12px; |
|||
color:#bebebe; |
|||
|
|||
background-color: #1e1e1e; |
|||
background-image: url('img/testorange_testo.png'), url('img/testorange_top_bg.gif'), url('img/testorange_bg.gif'); |
|||
background-repeat: no-repeat, repeat-x, repeat; |
|||
background-attachment: fixed, scroll, scroll; |
|||
background-position: right bottom, 0% 0%, 0% 0%; |
|||
} |
|||
|
|||
a:link, a:visited, div.post.reply p.body a { |
|||
color:#ff9100; |
|||
text-decoration: none; |
|||
} |
|||
a:link:hover, a:visited:hover, div.post.reply p.body a:hover { |
|||
color:#ffff00; |
|||
} |
|||
|
|||
a.email span.name { |
|||
color:#ff9100 !important; |
|||
|
|||
} |
|||
|
|||
input { |
|||
color: #000; |
|||
background: #fff; |
|||
} |
|||
textarea { |
|||
background: #dedede url('img/testorange_textarea_bg.gif') repeat-x; |
|||
} |
|||
input, textarea { |
|||
border: 1px #fff solid; |
|||
} |
|||
|
|||
hr { |
|||
width: 100%; |
|||
height: 1px; |
|||
border: none; |
|||
background: #707070; |
|||
overflow: hidden; |
|||
} |
|||
|
|||
.reflink a:hover{ |
|||
font-weight: bold; |
|||
} |
|||
.adminbar { |
|||
text-align:right; |
|||
clear:both; |
|||
float:right; |
|||
} |
|||
h1 { |
|||
clear:both; |
|||
text-align:center; |
|||
font-size: 2.5em; |
|||
color:#ff9100; |
|||
width:100%; |
|||
} |
|||
div.title { |
|||
color:#ff9100; |
|||
} |
|||
div.banner, .replymode, .catalogmode { |
|||
text-align:center; |
|||
margin: 5px 0 5px 0; |
|||
padding: 5px 2px 5px 2px; |
|||
color:#000; |
|||
font-weight: bold; |
|||
width:100%; |
|||
} |
|||
.postblock, form table th { |
|||
color: #000; |
|||
font-size: 11px; |
|||
font-weight: bold; |
|||
text-align: center !important; |
|||
} |
|||
|
|||
.postarea { |
|||
} |
|||
.rules { |
|||
width: 468px; |
|||
font-size: 10px; |
|||
} |
|||
.rules li { |
|||
margin-left: 1em; |
|||
} |
|||
.footer { |
|||
text-align:center; |
|||
font-size:12px; |
|||
} |
|||
.passvalid { |
|||
text-align:center; |
|||
width:100%; |
|||
color:#ffffff; |
|||
} |
|||
.dellist { |
|||
font-weight: bold; |
|||
text-align:center; |
|||
} |
|||
.delbuttons { |
|||
text-align:center; |
|||
padding-bottom:4px; |
|||
|
|||
} |
|||
.managehead { |
|||
background-color: #1e1e1e; |
|||
color: #bebebe; |
|||
padding:0px; |
|||
} |
|||
.postlists { |
|||
background: #000; |
|||
width:100%; |
|||
padding:0px; |
|||
color: #bebebe; |
|||
} |
|||
.row1 { |
|||
background-color: #1e1e1e; |
|||
color: #bebebe; |
|||
} |
|||
.row2 { |
|||
background: #1e1e1e; |
|||
color: #bebebe; |
|||
} |
|||
.unkfunc { |
|||
background:inherit; |
|||
color:#789922; |
|||
} |
|||
.filesize { |
|||
text-decoration:none; |
|||
} |
|||
.filetitle { |
|||
background:inherit; |
|||
font-size:1.2em; |
|||
color: #bebebe; |
|||
font-weight:800; |
|||
} |
|||
span.name, .postername { |
|||
color:#fff !important; |
|||
font-weight:bold; |
|||
} |
|||
span.trip, .postertrip { |
|||
color:#707070; |
|||
} |
|||
.oldpost { |
|||
color:#CC1105; |
|||
font-weight:800; |
|||
} |
|||
.omittedposts { |
|||
color:#707070; |
|||
} |
|||
.reply { |
|||
padding: 5px; |
|||
border: 1px #707070 solid !important; |
|||
background: #282828 !important; |
|||
|
|||
-webkit-border-radius: 10px; |
|||
-khtml-border-radius: 10px; |
|||
-moz-border-radius: 10px; |
|||
border-radius: 10px; |
|||
} |
|||
.replyhl { |
|||
background-color: #1e1e1e; |
|||
color: #bebebe; |
|||
} |
|||
.doubledash { |
|||
vertical-align:top; |
|||
clear:both; |
|||
float:left; |
|||
} |
|||
.replytitle { |
|||
font-size: 1.2em; |
|||
color:#fff; |
|||
font-weight:800; |
|||
} |
|||
.commentpostername { |
|||
color: #fff; |
|||
font-weight:800; |
|||
} |
|||
.thumbnailmsg { |
|||
font-size: small; |
|||
color: #bebebe; |
|||
} |
|||
form table th, div.banner, div.pages, .replymode, .postblock, .passvalid, .catalogmode { |
|||
background: #ff9100 url('img/testorange_f_bg.gif') repeat-x !important; |
|||
} |
|||
div.pages { |
|||
color: black; |
|||
border: 0; |
|||
} |
|||
|
|||
.abbrev { |
|||
color:#707070; |
|||
} |
|||
.highlight { |
|||
background:#000; |
|||
border: 1px dashed #ff9100; |
|||
} |
|||
|
|||
#watchedthreads { |
|||
background-color: #282828 !important; |
|||
} |
|||
|
|||
.reflinkpreview { |
|||
background-color: #282828 !important; |
|||
} |
|||
|
@ -1,390 +0,0 @@ |
|||
/** |
|||
* wasabi.css |
|||
* For AwsumChan by Circlepuller |
|||
*/ |
|||
body { |
|||
background: #F7F9B0 url('img/fade-yellow.png') repeat-x 50% 0%; |
|||
color: black; |
|||
font-family: arial, helvetica, sans-serif; |
|||
font-size: 10pt; |
|||
margin: 0 8px; |
|||
padding-left: 5px; |
|||
padding-right: 5px; |
|||
} |
|||
table * { |
|||
margin: 0; |
|||
} |
|||
a:link, a:visited { |
|||
text-decoration: underline; |
|||
color: #400040; |
|||
} |
|||
a:link:hover, a:visited:hover { |
|||
color: limegreen; |
|||
} |
|||
a.post_no { |
|||
color: black; |
|||
text-decoration: none; |
|||
margin: 0; |
|||
padding: 0; |
|||
} |
|||
p.intro a.post_no, p.intro a.email { |
|||
margin: 0; |
|||
} |
|||
p.intro a.email span.name { |
|||
color: #34345C; |
|||
} |
|||
p.intro a.email:hover span.name { |
|||
color: #ff0000; |
|||
} |
|||
p.intro label { |
|||
display: inline; |
|||
} |
|||
h2 { |
|||
color: #AF0A0F; |
|||
font-size: 11pt; |
|||
margin: 0px; |
|||
padding: 0px; |
|||
} |
|||
h1 { |
|||
font-family: tahoma; |
|||
letter-spacing: -2px; |
|||
font-size: 20pt; |
|||
margin-bottom: 0; |
|||
} |
|||
h1.logo img { |
|||
display: inline; |
|||
float: none; |
|||
background-image: url('/static/logo_bg.gif'); |
|||
background-repeat: no-repeat; |
|||
background-position: center; |
|||
} |
|||
div.title, h1 { |
|||
color: #AF0A0F; |
|||
text-align: center; |
|||
} |
|||
div.title { |
|||
font-size: 8pt; |
|||
margin-bottom: 2em; |
|||
} |
|||
form { |
|||
margin-bottom: 4em; |
|||
} |
|||
form table { |
|||
margin: auto; |
|||
} |
|||
form table input { |
|||
height: auto; |
|||
} |
|||
input[type="text"], input[type="password"], textarea { |
|||
border: 1px solid #a9a9a9; |
|||
text-indent: 0px; |
|||
text-shadow: none; |
|||
text-transform: none; |
|||
word-spacing: normal; |
|||
} |
|||
form table tr td { |
|||
text-align: left; |
|||
margin: 0px; |
|||
padding: 0px; |
|||
} |
|||
form table tr th { |
|||
text-align: left; |
|||
padding: 4px; |
|||
} |
|||
form table tr th { |
|||
background: #D7FE85; |
|||
} |
|||
form table tr td div { |
|||
text-align: center; |
|||
float: left; |
|||
padding-left: 3px; |
|||
} |
|||
form table tr td div input { |
|||
display: block; |
|||
margin: 2px auto 0 auto; |
|||
} |
|||
form table tr td div label { |
|||
font-size: 10px; |
|||
} |
|||
.unimportant, .unimportant * { |
|||
font-size: 10px; |
|||
} |
|||
p.fileinfo { |
|||
display: block; |
|||
margin: 0px; |
|||
padding-right: 7em; |
|||
} |
|||
div.banner { |
|||
background-color: #400040; |
|||
font-size: 12pt; |
|||
font-weight: bold; |
|||
text-align: center; |
|||
margin: 1em 0; |
|||
} |
|||
div.banner, div.banner a { |
|||
color: white; |
|||
} |
|||
div.banner a:hover { |
|||
color: #EEF2FF; |
|||
text-decoration: none; |
|||
} |
|||
img.banner { |
|||
float: none; |
|||
margin: 4px auto 0 auto; |
|||
} |
|||
img { |
|||
display: block; |
|||
float: left; |
|||
margin: 10px 20px; |
|||
border: none; |
|||
} |
|||
div.post img { |
|||
padding: 5px; |
|||
margin: 5px 20px 0 0; |
|||
} |
|||
div.post img.icon { |
|||
display: inline; |
|||
float: none; |
|||
margin: 0 5px; |
|||
padding: 0; |
|||
} |
|||
div.post.op { |
|||
margin-right: 20px; |
|||
margin-bottom: 5px; |
|||
} |
|||
div.post.op hr { |
|||
border-color: #D9BFB7; |
|||
} |
|||
p.intro { |
|||
margin: 0.5em 0; |
|||
padding: 0; |
|||
padding-bottom: 0.2em; |
|||
} |
|||
input.delete { |
|||
float: left; |
|||
margin: 1px 6px 0 0; |
|||
} |
|||
p.intro span.subject { |
|||
color: #0F0C5D; |
|||
font-weight: bold; |
|||
} |
|||
p.intro span.name { |
|||
color: #117743; |
|||
font-weight: bold; |
|||
} |
|||
p.intro a.capcode, p.intro a.nametag { |
|||
color: #F00000; |
|||
margin-left: 0; |
|||
} |
|||
p.intro a { |
|||
margin-left: 8px; |
|||
} |
|||
div.delete { |
|||
float: right; |
|||
} |
|||
div.post.reply p { |
|||
margin: 0.3em 0 0 0; |
|||
} |
|||
div.post.reply p.body { |
|||
margin-left: 1.8em; |
|||
margin-top: 0.8em; |
|||
padding-right: 3em; |
|||
padding-bottom: 0.3em; |
|||
} |
|||
div.post.reply.highlighted { |
|||
background: greenyellow; |
|||
} |
|||
div.post.reply p.body a { |
|||
color: #D00; |
|||
} |
|||
div.post { |
|||
max-width: 97%; |
|||
} |
|||
div.post p.body { |
|||
word-wrap: break-word; |
|||
} |
|||
div.post.reply { |
|||
background: #D7FE85; |
|||
margin: 0.2em 16px; |
|||
padding: 0.2em 0.3em 0.5em 0.6em; |
|||
border-width: 1px; |
|||
border-style: none solid solid none; |
|||
border-color: lightgreen; |
|||
display: inline-block; |
|||
} |
|||
span.trip { |
|||
color: #228854; |
|||
} |
|||
span.quote { |
|||
color: #789922; |
|||
} |
|||
span.omitted { |
|||
display: block; |
|||
margin-top: 1em; |
|||
} |
|||
br.clear { |
|||
clear: left; |
|||
} |
|||
span.controls { |
|||
float: right; |
|||
margin: 0; |
|||
padding: 0; |
|||
font-size: 80%; |
|||
} |
|||
span.controls.op { |
|||
float: none; |
|||
margin-left: 10px; |
|||
} |
|||
span.controls a { |
|||
margin: 0; |
|||
} |
|||
div#wrap { |
|||
width: 900px; |
|||
margin:0 auto; |
|||
} |
|||
div.ban { |
|||
background-color: white; |
|||
border: 1px solid #400040; |
|||
max-width: 700px; |
|||
margin: 30px auto; |
|||
} |
|||
div.ban p, div.ban h2 { |
|||
padding: 3px 7px; |
|||
} |
|||
div.ban h2 { |
|||
background: #D7FE85; |
|||
color: #400040; |
|||
font-size: 12pt; |
|||
} |
|||
div.ban p { |
|||
font-size: 12px; |
|||
margin-bottom: 12px; |
|||
} |
|||
div.ban p.reason { |
|||
font-weight: bold; |
|||
} |
|||
span.heading { |
|||
color: #AF0A0F; |
|||
font-size: 11pt; |
|||
font-weight: bold; |
|||
display: block; |
|||
} |
|||
span.spoiler { |
|||
background: black; |
|||
color: black; |
|||
} |
|||
div.post.reply p.body span.spoiler a { |
|||
color: black; |
|||
} |
|||
span.spoiler:hover, div.post.reply p.body span.spoiler:hover a { |
|||
color: white; |
|||
} |
|||
div.styles { |
|||
float: right; |
|||
padding-bottom: 20px; |
|||
} |
|||
div.styles a { |
|||
margin: 0 10px; |
|||
} |
|||
div.styles a.selected { |
|||
text-decoration: none; |
|||
} |
|||
table.test { |
|||
width: 100%; |
|||
} |
|||
table.test td, table.test th { |
|||
text-align: left; |
|||
padding: 5px; |
|||
} |
|||
table.test tr.h th { |
|||
background: #98E; |
|||
} |
|||
table.test td img { |
|||
margin: 0; |
|||
} |
|||
fieldset label { |
|||
display: block; |
|||
} |
|||
div.pages { |
|||
color: limegreen; |
|||
background: #D7FE85; |
|||
display: inline; |
|||
padding: 8px; |
|||
border-right: 1px solid limegreen; |
|||
border-bottom: 1px solid limegreen; |
|||
} |
|||
div.pages a.selected { |
|||
color: black; |
|||
font-weight: bolder; |
|||
} |
|||
div.pages a:link { |
|||
text-decoration: none; |
|||
} |
|||
div.pages form { |
|||
margin: 0; |
|||
padding: 0; |
|||
display: inline; |
|||
} |
|||
div.pages form input { |
|||
margin: 0 5px; |
|||
display: inline; |
|||
} |
|||
hr { |
|||
border: none; |
|||
border-top: 1px solid limegreen; |
|||
height: 0px; |
|||
} |
|||
div.boardlist { |
|||
color: limegreen; |
|||
font-size: 9pt; |
|||
margin-top: 3px; |
|||
} |
|||
div.boardlist.bottom { |
|||
margin-top: 20px; |
|||
} |
|||
div.boardlist a { |
|||
text-decoration: none; |
|||
} |
|||
div.report { |
|||
color: #333; |
|||
} |
|||
table.modlog { |
|||
margin: auto; |
|||
width: 100%; |
|||
} |
|||
table.modlog tr td { |
|||
text-align: left; |
|||
margin: 0px; |
|||
padding: 4px 15px 0 0; |
|||
} |
|||
table.modlog tr th { |
|||
text-align: left; |
|||
padding: 4px 15px 5px 5px; |
|||
white-space: nowrap; |
|||
} |
|||
table.modlog tr th { |
|||
background: #D7FE85; |
|||
} |
|||
td.minimal, th.minimal { |
|||
width: 1%; |
|||
white-space: nowrap; |
|||
} |
|||
div.top_notice { |
|||
text-align: center; |
|||
margin: 5px auto; |
|||
} |
|||
span.public_ban { |
|||
display: block; |
|||
color: red; |
|||
font-weight: bold; |
|||
margin-top: 15px; |
|||
} |
|||
span.toolong { |
|||
display: block; |
|||
margin-top: 15px; |
|||
} |
|||
div.blotter { |
|||
color: red; |
|||
font-weight: bold; |
|||
text-align: center; |
|||
} |
@ -1,52 +0,0 @@ |
|||
#!/usr/bin/php |
|||
<?php |
|||
/* |
|||
* benchmark.php - benchmarks thumbnailing methods |
|||
* |
|||
*/ |
|||
|
|||
require dirname(__FILE__) . '/inc/cli.php'; |
|||
require 'inc/image.php'; |
|||
|
|||
// move back to this directory |
|||
chdir(dirname(__FILE__)); |
|||
|
|||
if(count($argv) != 2) |
|||
die("Usage: {$argv[0]} [file]\n"); |
|||
|
|||
$file = $argv[1]; |
|||
$extension = strtolower(substr($file, strrpos($file, '.') + 1)); |
|||
$out = tempnam($config['tmp'], 'thumb'); |
|||
$count = 300; |
|||
|
|||
function benchmark($method) { |
|||
global $config, $file, $extension, $out, $count; |
|||
|
|||
$config['thumb_method'] = $method; |
|||
|
|||
printf("Method: %s\nThumbnailing %d times... ", $method, $count); |
|||
|
|||
$start = microtime(true); |
|||
for($i = 0; $i < $count; $i++) { |
|||
$image = new Image($file, $extension); |
|||
$thumb = $image->resize( |
|||
$config['thumb_ext'] ? $config['thumb_ext'] : $extension, |
|||
$config['thumb_width'], |
|||
$config['thumb_height'] |
|||
); |
|||
|
|||
$thumb->to($out); |
|||
$thumb->_destroy(); |
|||
$image->destroy(); |
|||
} |
|||
$end = microtime(true); |
|||
|
|||
printf("Took %.2f seconds (%.2f/second; %.2f ms)\n", $end - $start, $rate = ($count / ($end - $start)), 1000 / $rate); |
|||
|
|||
unlink($out); |
|||
} |
|||
|
|||
benchmark('gd'); |
|||
benchmark('imagick'); |
|||
benchmark('convert'); |
|||
|
@ -1,104 +0,0 @@ |
|||
<?php |
|||
|
|||
/* |
|||
* This script will look for Tinyboard in the following places (in order): |
|||
* - $TINYBOARD_PATH environment varaible |
|||
* - ./ |
|||
* - ./Tinyboard/ |
|||
* - ../ |
|||
*/ |
|||
|
|||
set_time_limit(0); |
|||
$shell_path = getcwd(); |
|||
|
|||
if(getenv('TINYBOARD_PATH') !== false) |
|||
$dir = getenv('TINYBOARD_PATH'); |
|||
elseif(file_exists('inc/functions.php')) |
|||
$dir = false; |
|||
elseif(file_exists('Tinyboard') && is_dir('Tinyboard') && file_exists('Tinyboard/inc/functions.php')) |
|||
$dir = 'Tinyboard'; |
|||
elseif(file_exists('../inc/functions.php')) |
|||
$dir = '..'; |
|||
else |
|||
die("Could not locate Tinyboard directory!\n"); |
|||
|
|||
if($dir && !chdir($dir)) |
|||
die("Could not change directory to {$dir}\n"); |
|||
|
|||
if(!getenv('TINYBOARD_PATH')) { |
|||
// follow symlink |
|||
chdir(realpath('inc') . '/..'); |
|||
} |
|||
|
|||
putenv('TINYBOARD_PATH=' . getcwd()); |
|||
|
|||
require 'inc/functions.php'; |
|||
require 'inc/display.php'; |
|||
require 'inc/template.php'; |
|||
require 'inc/database.php'; |
|||
require 'inc/user.php'; |
|||
require 'inc/mod.php'; |
|||
|
|||
$mod = Array( |
|||
'id' => -1, |
|||
'type' => ADMIN, |
|||
'username' => '?', |
|||
'boards' => Array('*') |
|||
); |
|||
|
|||
function get_httpd_privileges() { |
|||
global $config, $shell_path, $argv; |
|||
|
|||
if(php_sapi_name() != 'cli') |
|||
die("get_httpd_privileges(): invoked from HTTP client.\n"); |
|||
|
|||
echo "Dropping priviledges...\n"; |
|||
|
|||
if(!is_writable('.')) |
|||
die("get_httpd_privileges(): web directory is not writable\n"); |
|||
|
|||
$filename = '.' . md5(rand()) . '.php'; |
|||
$inc_filename = '.' . md5(rand()) . '.php'; |
|||
|
|||
echo "Copying rebuilder to web directory...\n"; |
|||
|
|||
// replace "/inc/cli.php" with its new filename |
|||
passthru("cat " . escapeshellarg($shell_path . '/' . $_SERVER['PHP_SELF']) . " | sed \"s/'\/inc\/cli\.php'/'\/{$inc_filename}'/\" > {$filename}"); |
|||
|
|||
$inc_header = "<?php\n";
|
|||
|
|||
// copy environment |
|||
$env = explode("\n", shell_exec('printenv | grep ^TINYBOARD')); |
|||
foreach($env as $line) { |
|||
if(!empty($line)) |
|||
$inc_header .= "putenv('" . addslashes($line) . "');\n"; |
|||
} |
|||
|
|||
// copy command line arguments |
|||
$inc_header .= "\$argv = " . var_export($argv, true) . ";\n"; |
|||
|
|||
// copy this file |
|||
file_put_contents($inc_filename, $inc_header . substr($inc = file_get_contents(__FILE__), strpos($inc, "\n"))); |
|||
|
|||
chmod($filename, 0666); |
|||
chmod($inc_filename, 0666); |
|||
|
|||
if(preg_match('/^https?:\/\//', $config['root'])) { |
|||
$url = $config['root'] . $filename; |
|||
} elseif($host = getenv('TINYBOARD_HOST')) { |
|||
$url = 'http://' . $host . $config['root'] . $filename; |
|||
} else { |
|||
// assume localhost |
|||
$url = 'http://localhost' . $config['root'] . $filename; |
|||
} |
|||
|
|||
echo "Downloading $url\n"; |
|||
|
|||
passthru('curl -s -N ' . escapeshellarg($url)); |
|||
|
|||
unlink($filename); |
|||
unlink($inc_filename); |
|||
|
|||
exit(0); |
|||
} |
|||
|
@ -1,105 +0,0 @@ |
|||
#!/usr/bin/php |
|||
<?php |
|||
/* |
|||
* rebuild.php - rebuilds all static files |
|||
* |
|||
* Command line arguments: |
|||
* -q, --quiet |
|||
* Suppress output. |
|||
* |
|||
* --quick |
|||
* Do not rebuild posts. |
|||
* |
|||
* -b, --board <string> |
|||
* Rebuild only the specified board. |
|||
* |
|||
* -f, --full |
|||
* Rebuild replies as well as threads (re-markup). |
|||
* |
|||
*/ |
|||
|
|||
require dirname(__FILE__) . '/inc/cli.php'; |
|||
|
|||
if(!is_writable($config['file_script'])) { |
|||
get_httpd_privileges(); |
|||
} |
|||
|
|||
$start = microtime(true); |
|||
|
|||
// parse command line |
|||
$opts = getopt('qfb:', Array('board:', 'quick', 'full', 'quiet')); |
|||
$options = Array(); |
|||
|
|||
$options['board'] = isset($opts['board']) ? $opts['board'] : (isset($opts['b']) ? $opts['b'] : false); |
|||
$options['quiet'] = isset($opts['q']) || isset($opts['quiet']); |
|||
$options['quick'] = isset($opts['quick']); |
|||
$options['full'] = isset($opts['full']) || isset($opts['f']); |
|||
|
|||
if(!$options['quiet']) |
|||
echo "== Tinyboard {$config['version']} ==\n"; |
|||
|
|||
if(!$options['quiet']) |
|||
echo "Clearing template cache...\n"; |
|||
$twig = new Twig_Environment($loader, Array( |
|||
'cache' => "{$config['dir']['template']}/cache" |
|||
)); |
|||
$twig->clearCacheFiles(); |
|||
|
|||
if(!$options['quiet']) |
|||
echo "Regenerating theme files...\n"; |
|||
rebuildThemes('all'); |
|||
|
|||
if(!$options['quiet']) |
|||
echo "Generating Javascript file...\n"; |
|||
buildJavascript(); |
|||
|
|||
$main_js = $config['file_script']; |
|||
|
|||
$boards = listBoards(); |
|||
|
|||
foreach($boards as &$board) { |
|||
if($options['board'] && $board['uri'] != $options['board']) |
|||
continue; |
|||
|
|||
if(!$options['quiet']) |
|||
echo "Opening board /{$board['uri']}/...\n"; |
|||
openBoard($board['uri']); |
|||
|
|||
if($config['file_script'] != $main_js) { |
|||
// different javascript file |
|||
if(!$options['quiet']) |
|||
echo "Generating Javascript file...\n"; |
|||
buildJavascript(); |
|||
} |
|||
|
|||
|
|||
if(!$options['quiet']) |
|||
echo "Creating index pages...\n"; |
|||
buildIndex(); |
|||
|
|||
if($options['quick']) |
|||
continue; // do no more |
|||
|
|||
if($options['full']) { |
|||
$query = query(sprintf("SELECT `id` FROM `posts_%s`", $board['uri'])) or error(db_error()); |
|||
while($post = $query->fetch()) { |
|||
if(!$options['quiet']) |
|||
echo "Rebuilding #{$post['id']}...\n"; |
|||
rebuildPost($post['id']); |
|||
} |
|||
} |
|||
|
|||
$query = query(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); |
|||
while($post = $query->fetch()) { |
|||
if(!$options['quiet']) |
|||
echo "Rebuilding #{$post['id']}...\n"; |
|||
buildThread($post['id']); |
|||
} |
|||
} |
|||
|
|||
if(!$options['quiet']) |
|||
printf("Complete! Took %g seconds\n", microtime(true) - $start); |
|||
|
|||
unset($board); |
|||
modLog('Rebuilt everything using tools/rebuild.php'); |
|||
|