forked from GithubBackups/vichan
I don't know what I did.
This commit is contained in:
parent
179df591af
commit
19e864c15c
63
create.php
63
create.php
@ -3,13 +3,33 @@
|
|||||||
include "inc/functions.php";
|
include "inc/functions.php";
|
||||||
include "inc/lib/ayah/ayah.php";
|
include "inc/lib/ayah/ayah.php";
|
||||||
include "inc/mod/auth.php";
|
include "inc/mod/auth.php";
|
||||||
|
$cbRecaptcha = false;
|
||||||
|
//don't load recaptcha LIB unless its enabled!
|
||||||
|
if ($config['cbRecaptcha']){
|
||||||
|
$cbRecaptcha = true;
|
||||||
|
include "inc/lib/recaptcha/recaptchalib.php";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
checkBan('*');
|
checkBan('*');
|
||||||
$bannedWords = array('/^cake$/', '8ch', '/^cp$/', 'child', '/^inc$/', '/^static$/', '/^templates$/', '/^js$/', '/^stylesheets$/', '/^tools$/', '/^pedo$/');
|
$bannedWords = array('/^cake$/', '8ch', '/^cp$/', 'child', '/^inc$/', '/^static$/', '/^templates$/', '/^js$/', '/^stylesheets$/', '/^tools$/', '/^pedo$/');
|
||||||
|
|
||||||
$ayah = new AYAH();
|
$ayah = (($config['ayah_enabled']) ? new AYAH() : false);
|
||||||
|
|
||||||
if (!isset($_POST['uri'], $_POST['title'], $_POST['subtitle'], $_POST['username'], $_POST['password'])) {
|
if (!isset($_POST['uri'], $_POST['title'], $_POST['subtitle'], $_POST['username'], $_POST['password'])) {
|
||||||
$publisher_html = $ayah->getPublisherHTML();
|
if (!$ayah){
|
||||||
|
$game_html = '';
|
||||||
|
} else {
|
||||||
|
$game_html = '<tr><th>Game</th><td>' . $ayah->getPublisherHTML() . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$cbRecaptcha){
|
||||||
|
$recapcha_html = '';
|
||||||
|
} else {
|
||||||
|
$recapcha_html = '<tr><th>reCaptcha</th><td>' . recaptcha_get_html($config['recaptcha_public']) . '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$password = base64_encode(openssl_random_pseudo_bytes(9));
|
$password = base64_encode(openssl_random_pseudo_bytes(9));
|
||||||
|
|
||||||
$body = <<<EOT
|
$body = <<<EOT
|
||||||
@ -21,7 +41,8 @@ $body = <<<EOT
|
|||||||
<tr><th>Subtitle</th><td><input name="subtitle" type="text"> <span class="unimportant">(must be < 200 chars)</td></tr>
|
<tr><th>Subtitle</th><td><input name="subtitle" type="text"> <span class="unimportant">(must be < 200 chars)</td></tr>
|
||||||
<tr><th>Username</th><td><input name="username" type="text"> <span class="unimportant">(must contain only alphanumeric, periods and underscores)</span></td></tr>
|
<tr><th>Username</th><td><input name="username" type="text"> <span class="unimportant">(must contain only alphanumeric, periods and underscores)</span></td></tr>
|
||||||
<tr><th>Password</th><td><input name="password" type="text" value="{$password}" readonly> <span class="unimportant">(write this down)</span></td></tr>
|
<tr><th>Password</th><td><input name="password" type="text" value="{$password}" readonly> <span class="unimportant">(write this down)</span></td></tr>
|
||||||
<tr><th>Game</th><td>{$publisher_html}</td></tr>
|
{$game_html}
|
||||||
|
{$recapcha_html}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<ul style="padding:0;text-align:center;list-style:none"><li><input type="submit" value="Create board"></li></ul>
|
<ul style="padding:0;text-align:center;list-style:none"><li><input type="submit" value="Create board"></li></ul>
|
||||||
@ -38,8 +59,27 @@ $title = $_POST['title'];
|
|||||||
$subtitle = $_POST['subtitle'];
|
$subtitle = $_POST['subtitle'];
|
||||||
$username = $_POST['username'];
|
$username = $_POST['username'];
|
||||||
$password = $_POST['password'];
|
$password = $_POST['password'];
|
||||||
$score = $ayah->scoreResult();
|
|
||||||
|
|
||||||
|
$resp = ($cbRecaptcha) ? recaptcha_check_answer ($config['recaptcha_private'],
|
||||||
|
$_SERVER["REMOTE_ADDR"],
|
||||||
|
$_POST["recaptcha_challenge_field"],
|
||||||
|
$_POST["recaptcha_response_field"]):false;
|
||||||
|
|
||||||
|
if ($resp != false){
|
||||||
|
$passedCaptcha = $resp->is_valid;
|
||||||
|
} else {
|
||||||
|
$passedCaptcha = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$ayah){
|
||||||
|
$score = true;
|
||||||
|
} else {
|
||||||
|
$score = $ayah->scoreResult();
|
||||||
|
}
|
||||||
|
if (!$score)
|
||||||
|
error('You failed the game');
|
||||||
|
if (!$passedCaptcha)
|
||||||
|
error('You failed to enter the reCaptcha correctly');
|
||||||
if (!preg_match('/^[a-z0-9]{1,10}$/', $uri))
|
if (!preg_match('/^[a-z0-9]{1,10}$/', $uri))
|
||||||
error('Invalid URI');
|
error('Invalid URI');
|
||||||
if (!(strlen($title) < 40))
|
if (!(strlen($title) < 40))
|
||||||
@ -48,8 +88,7 @@ if (!(strlen($subtitle) < 200))
|
|||||||
error('Invalid subtitle');
|
error('Invalid subtitle');
|
||||||
if (!preg_match('/^[a-zA-Z0-9._]{1,30}$/', $username))
|
if (!preg_match('/^[a-zA-Z0-9._]{1,30}$/', $username))
|
||||||
error('Invalid username');
|
error('Invalid username');
|
||||||
if (!$score)
|
|
||||||
error('You failed the game');
|
|
||||||
foreach (listBoards() as $i => $board) {
|
foreach (listBoards() as $i => $board) {
|
||||||
if ($board['uri'] == $uri)
|
if ($board['uri'] == $uri)
|
||||||
error('Board already exists!');
|
error('Board already exists!');
|
||||||
@ -64,12 +103,13 @@ foreach ($bannedWords as $i => $w) {
|
|||||||
error("Cannot create board matching banned pattern $w");
|
error("Cannot create board matching banned pattern $w");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$query = prepare('SELECT * FROM ``mods``');
|
$query = prepare('SELECT ``username`` FROM ``mods`` WHERE ``username`` = :username');
|
||||||
|
$query->bindValue(':username', $username);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
$users = $query->fetchAll(PDO::FETCH_ASSOC);
|
$users = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||||
foreach ($users as $i => $user) {
|
|
||||||
if ($user['username'] == $username)
|
if (sizeof($users) > 0){
|
||||||
error('Username taken!');
|
error('The username you\'ve tried to enter already exists!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$salt = generate_salt();
|
$salt = generate_salt();
|
||||||
@ -112,9 +152,10 @@ $body = <<<EOT
|
|||||||
|
|
||||||
<p>Make sure you don't forget your password, <tt>{$_POST['password']}</tt>!</p>
|
<p>Make sure you don't forget your password, <tt>{$_POST['password']}</tt>!</p>
|
||||||
|
|
||||||
<p>You can manage your site at <a href="http://8chan.co/mod.php?/">http://8chan.co/mod.php?/</a>.</p>
|
<p>You can manage your board at <a href="http://8chan.co/mod.php?/">http://8chan.co/mod.php?/</a>.</p>
|
||||||
|
|
||||||
EOT;
|
EOT;
|
||||||
|
|
||||||
echo Element("page.html", array("config" => $config, "body" => $body, "title" => "Success", "subtitle" => "This was a triumph"));
|
echo Element("page.html", array("config" => $config, "body" => $body, "title" => "Success", "subtitle" => "This was a triumph"));
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
@ -130,6 +130,10 @@ foreach($delete as $i => $d){
|
|||||||
// Delete entire board directory
|
// Delete entire board directory
|
||||||
rrmdir($board['uri'] . '/');
|
rrmdir($board['uri'] . '/');
|
||||||
rrmdir('static/banners/' . $board['uri']);
|
rrmdir('static/banners/' . $board['uri']);
|
||||||
|
// HAAAAAX
|
||||||
|
if($config['dir']['img_root'] != '')
|
||||||
|
rrmdir($config['dir']['img_root'] . $board['uri']);
|
||||||
|
|
||||||
cache::delete('board_' . $board['uri']);
|
cache::delete('board_' . $board['uri']);
|
||||||
|
|
||||||
_syslog(LOG_NOTICE, "Board deleted: {$board['uri']}");
|
_syslog(LOG_NOTICE, "Board deleted: {$board['uri']}");
|
||||||
|
@ -41,8 +41,8 @@ class Api {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$this->fileFields = array(
|
$this->fileFields = array(
|
||||||
'thumbheight' => 'tn_w',
|
'thumbheight' => 'tn_h',
|
||||||
'thumbwidth' => 'tn_h',
|
'thumbwidth' => 'tn_w',
|
||||||
'height' => 'w',
|
'height' => 'w',
|
||||||
'width' => 'h',
|
'width' => 'h',
|
||||||
'size' => 'fsize',
|
'size' => 'fsize',
|
||||||
@ -113,6 +113,7 @@ class Api {
|
|||||||
$apiPost['ext'] = substr($file->file, $dotPos);
|
$apiPost['ext'] = substr($file->file, $dotPos);
|
||||||
$dotPos = strrpos($file->file, '.');
|
$dotPos = strrpos($file->file, '.');
|
||||||
$apiPost['tim'] = substr($file->file, 0, $dotPos);
|
$apiPost['tim'] = substr($file->file, 0, $dotPos);
|
||||||
|
//$apiPost['md5'] = base64_encode(md5_file($file->file_path, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $apiPost;
|
return $apiPost;
|
||||||
|
@ -277,8 +277,21 @@
|
|||||||
'no_country'
|
'no_country'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Uses are you a human to stop automated requests to make boards disabled by default
|
||||||
|
* if you wish to use 'are you a human' to block automated board creation requests
|
||||||
|
|
||||||
|
* to use AYAH you must enter your 'AYAH_PUBLISHER_KEY' and your 'AYAH_SCORING_KEY' in
|
||||||
|
* the configuration file for AYAH. The config file for AYAH
|
||||||
|
* is located in the following directory:'/inc/lib/ayah/ayah_config.php'
|
||||||
|
*/
|
||||||
|
$config['ayah_enabled'] = false;
|
||||||
|
|
||||||
// Enable reCaptcha to make spam even harder. Rarely necessary.
|
// Enable reCaptcha to make spam even harder. Rarely necessary.
|
||||||
$config['recaptcha'] = false;
|
$config['recaptcha'] = false;
|
||||||
|
// Enable reCaptcha on create.php to prevent automated requests.
|
||||||
|
$config['cbRecaptcha'] = false;
|
||||||
|
|
||||||
// Public and private key pair from https://www.google.com/recaptcha/admin/create
|
// Public and private key pair from https://www.google.com/recaptcha/admin/create
|
||||||
$config['recaptcha_public'] = '6LcXTcUSAAAAAKBxyFWIt2SO8jwx4W7wcSMRoN3f';
|
$config['recaptcha_public'] = '6LcXTcUSAAAAAKBxyFWIt2SO8jwx4W7wcSMRoN3f';
|
||||||
@ -1119,6 +1132,12 @@
|
|||||||
$config['dir']['thumb'] = 'thumb/';
|
$config['dir']['thumb'] = 'thumb/';
|
||||||
$config['dir']['res'] = 'res/';
|
$config['dir']['res'] = 'res/';
|
||||||
|
|
||||||
|
// Images in a seperate directory - For CDN or media servers
|
||||||
|
// This is a particularly advanced feature - contact ctrlcctrlv or rails unless you
|
||||||
|
// really know what you're doing
|
||||||
|
$config['dir']['img_root'] = '';
|
||||||
|
|
||||||
|
|
||||||
// For load balancing, having a seperate server (and domain/subdomain) for serving static content is
|
// For load balancing, having a seperate server (and domain/subdomain) for serving static content is
|
||||||
// possible. This can either be a directory or a URL. Defaults to $config['root'] . 'static/'.
|
// possible. This can either be a directory or a URL. Defaults to $config['root'] . 'static/'.
|
||||||
// $config['dir']['static'] = 'http://static.example.org/';
|
// $config['dir']['static'] = 'http://static.example.org/';
|
||||||
|
@ -425,12 +425,12 @@ function setupBoard($array) {
|
|||||||
|
|
||||||
if (!file_exists($board['dir']))
|
if (!file_exists($board['dir']))
|
||||||
@mkdir($board['dir'], 0777) or error("Couldn't create " . $board['dir'] . ". Check permissions.", true);
|
@mkdir($board['dir'], 0777) or error("Couldn't create " . $board['dir'] . ". Check permissions.", true);
|
||||||
if (!file_exists($board['dir'] . $config['dir']['img']))
|
if (!file_exists($config['dir']['img_root'] . $board['dir'] . $config['dir']['img']))
|
||||||
@mkdir($board['dir'] . $config['dir']['img'], 0777)
|
@mkdir($config['dir']['img_root'] . $board['dir'] . $config['dir']['img'], 0777)
|
||||||
or error("Couldn't create " . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true);
|
or error("Couldn't create " . $config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true);
|
||||||
if (!file_exists($board['dir'] . $config['dir']['thumb']))
|
if (!file_exists($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb']))
|
||||||
@mkdir($board['dir'] . $config['dir']['thumb'], 0777)
|
@mkdir($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'], 0777)
|
||||||
or error("Couldn't create " . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true);
|
or error("Couldn't create " . $config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true);
|
||||||
if (!file_exists($board['dir'] . $config['dir']['res']))
|
if (!file_exists($board['dir'] . $config['dir']['res']))
|
||||||
@mkdir($board['dir'] . $config['dir']['res'], 0777)
|
@mkdir($board['dir'] . $config['dir']['res'], 0777)
|
||||||
or error("Couldn't create " . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true);
|
or error("Couldn't create " . $board['dir'] . $config['dir']['img'] . ". Check permissions.", true);
|
||||||
@ -997,11 +997,11 @@ function deleteFile($id, $remove_entirely_if_already=true, $file=null) {
|
|||||||
foreach ($files as $i => $f) {
|
foreach ($files as $i => $f) {
|
||||||
if (($file !== false && $i == $file) || $file === null) {
|
if (($file !== false && $i == $file) || $file === null) {
|
||||||
// Delete thumbnail
|
// Delete thumbnail
|
||||||
file_unlink($board['dir'] . $config['dir']['thumb'] . $f->thumb);
|
file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'] . $f->thumb);
|
||||||
unset($files[$i]->thumb);
|
unset($files[$i]->thumb);
|
||||||
|
|
||||||
// Delete file
|
// Delete file
|
||||||
file_unlink($board['dir'] . $config['dir']['img'] . $f->file);
|
file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . $f->file);
|
||||||
$files[$i]->file = 'deleted';
|
$files[$i]->file = 'deleted';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1080,8 +1080,8 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) {
|
|||||||
// Delete file
|
// Delete file
|
||||||
foreach (json_decode($post['files']) as $i => $f) {
|
foreach (json_decode($post['files']) as $i => $f) {
|
||||||
if ($f->file !== 'deleted') {
|
if ($f->file !== 'deleted') {
|
||||||
file_unlink($board['dir'] . $config['dir']['img'] . $f->file);
|
file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . $f->file);
|
||||||
file_unlink($board['dir'] . $config['dir']['thumb'] . $f->thumb);
|
file_unlink($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'] . $f->thumb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
$config['allow_no_country'] = true;
|
$config['allow_no_country'] = true;
|
||||||
$config['thread_subject_in_title'] = true;
|
$config['thread_subject_in_title'] = true;
|
||||||
$config['spam']['hidden_inputs_max_pass'] = 128;
|
$config['spam']['hidden_inputs_max_pass'] = 128;
|
||||||
|
$config['ayah_enabled'] = true;
|
||||||
|
|
||||||
include "secrets.php";
|
include "secrets.php";
|
||||||
|
|
||||||
|
@ -429,6 +429,9 @@ function mod_edit_board($boardName) {
|
|||||||
|
|
||||||
// Delete entire board directory
|
// Delete entire board directory
|
||||||
rrmdir($board['uri'] . '/');
|
rrmdir($board['uri'] . '/');
|
||||||
|
// To reiterate: HAAAAAX
|
||||||
|
if($config['dir']['img_root'] != '')
|
||||||
|
rrmdir($config['dir']['img_root'] . $board['uri']);
|
||||||
} else {
|
} else {
|
||||||
$query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle WHERE `uri` = :uri');
|
$query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle WHERE `uri` = :uri');
|
||||||
$query->bindValue(':uri', $board['uri']);
|
$query->bindValue(':uri', $board['uri']);
|
||||||
@ -1121,8 +1124,8 @@ function mod_move_reply($originBoard, $postID) {
|
|||||||
$post['files'] = json_decode($post['files'], TRUE);
|
$post['files'] = json_decode($post['files'], TRUE);
|
||||||
$post['has_file'] = true;
|
$post['has_file'] = true;
|
||||||
foreach ($post['files'] as $i => &$file) {
|
foreach ($post['files'] as $i => &$file) {
|
||||||
$file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file'];
|
$file['file_path'] = sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['img'] . $file['file'];
|
||||||
$file['thumb_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
|
$file['thumb_path'] = sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$post['has_file'] = false;
|
$post['has_file'] = false;
|
||||||
@ -1140,9 +1143,9 @@ function mod_move_reply($originBoard, $postID) {
|
|||||||
if ($post['has_file']) {
|
if ($post['has_file']) {
|
||||||
foreach ($post['files'] as $i => &$file) {
|
foreach ($post['files'] as $i => &$file) {
|
||||||
// move the image
|
// move the image
|
||||||
rename($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
|
rename($file['file_path'], sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['img'] . $file['file']);
|
||||||
if ($file['thumb'] != 'spoiler') { //trying to move/copy the spoiler thumb raises an error
|
if ($file['thumb'] != 'spoiler') { //trying to move/copy the spoiler thumb raises an error
|
||||||
rename($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
|
rename($file['thumb_path'], sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1222,8 +1225,8 @@ function mod_move($originBoard, $postID) {
|
|||||||
foreach ($post['files'] as $i => &$file) {
|
foreach ($post['files'] as $i => &$file) {
|
||||||
if ($file['file'] === 'deleted')
|
if ($file['file'] === 'deleted')
|
||||||
continue;
|
continue;
|
||||||
$file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file'];
|
$file['file_path'] = sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['img'] . $file['file'];
|
||||||
$file['thumb_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
|
$file['thumb_path'] = sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$post['has_file'] = false;
|
$post['has_file'] = false;
|
||||||
@ -1242,9 +1245,9 @@ function mod_move($originBoard, $postID) {
|
|||||||
// copy image
|
// copy image
|
||||||
foreach ($post['files'] as $i => &$file) {
|
foreach ($post['files'] as $i => &$file) {
|
||||||
if ($file['file'] !== 'deleted')
|
if ($file['file'] !== 'deleted')
|
||||||
$clone($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
|
$clone($file['file_path'], sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['img'] . $file['file']);
|
||||||
if (isset($file['thumb']) && !in_array($file['thumb'], array('spoiler', 'deleted', 'file')))
|
if (isset($file['thumb']) && !in_array($file['thumb'], array('spoiler', 'deleted', 'file')))
|
||||||
$clone($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
|
$clone($file['thumb_path'], sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1265,8 +1268,8 @@ function mod_move($originBoard, $postID) {
|
|||||||
$post['files'] = json_decode($post['files'], TRUE);
|
$post['files'] = json_decode($post['files'], TRUE);
|
||||||
$post['has_file'] = true;
|
$post['has_file'] = true;
|
||||||
foreach ($post['files'] as $i => &$file) {
|
foreach ($post['files'] as $i => &$file) {
|
||||||
$file['file_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file'];
|
$file['file_path'] = sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['img'] . $file['file'];
|
||||||
$file['thumb_path'] = sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
|
$file['thumb_path'] = sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['thumb'] . $file['thumb'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$post['has_file'] = false;
|
$post['has_file'] = false;
|
||||||
@ -1305,8 +1308,8 @@ function mod_move($originBoard, $postID) {
|
|||||||
if ($post['has_file']) {
|
if ($post['has_file']) {
|
||||||
// copy image
|
// copy image
|
||||||
foreach ($post['files'] as $i => &$file) {
|
foreach ($post['files'] as $i => &$file) {
|
||||||
$clone($file['file_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['img'] . $file['file']);
|
$clone($file['file_path'], sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['img'] . $file['file']);
|
||||||
$clone($file['thumb_path'], sprintf($config['board_path'], $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
|
$clone($file['thumb_path'], sprintf($config['board_path'], $config['dir']['img_root'] . $board['uri']) . $config['dir']['thumb'] . $file['thumb']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// insert reply
|
// insert reply
|
||||||
@ -1582,7 +1585,7 @@ function mod_spoiler_image($board, $post, $file) {
|
|||||||
$result = $query->fetch(PDO::FETCH_ASSOC);
|
$result = $query->fetch(PDO::FETCH_ASSOC);
|
||||||
$files = json_decode($result['files']);
|
$files = json_decode($result['files']);
|
||||||
|
|
||||||
file_unlink($board . '/' . $config['dir']['thumb'] . $files[$file]->thumb);
|
file_unlink($config['dir']['img_root'] . $board . '/' . $config['dir']['thumb'] . $files[$file]->thumb);
|
||||||
$files[$file]->thumb = 'spoiler';
|
$files[$file]->thumb = 'spoiler';
|
||||||
$files[$file]->thumbheight = 128;
|
$files[$file]->thumbheight = 128;
|
||||||
$files[$file]->thumbwidth = 128;
|
$files[$file]->thumbwidth = 128;
|
||||||
@ -1799,12 +1802,25 @@ function mod_user($uid) {
|
|||||||
$log = array();
|
$log = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mod['type'] >= ADMIN){
|
||||||
|
$boards = listBoards();
|
||||||
|
} else {
|
||||||
|
$boards2 = explode(',', $user['boards']);
|
||||||
|
|
||||||
|
foreach($boards2 as $string){
|
||||||
|
|
||||||
|
$boards[] = array("uri"=>$string, "title"=>"MY BOARD");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
$user['boards'] = explode(',', $user['boards']);
|
$user['boards'] = explode(',', $user['boards']);
|
||||||
|
|
||||||
mod_page(_('Edit user'), 'mod/user.html', array(
|
mod_page(_('Edit user'), 'mod/user.html', array(
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'logs' => $log,
|
'logs' => $log,
|
||||||
'boards' => listBoards(),
|
'boards' => $boards,
|
||||||
'token' => make_secure_link_token('users/' . $user['id'])
|
'token' => make_secure_link_token('users/' . $user['id'])
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,11 @@ CREATE TABLE IF NOT EXISTS `boards` (
|
|||||||
PRIMARY KEY (`uri`)
|
PRIMARY KEY (`uri`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `board_create` (
|
||||||
|
`time` text NOT NULL,
|
||||||
|
`uri` text NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Dumping data for table `boards`
|
-- Dumping data for table `boards`
|
||||||
--
|
--
|
||||||
@ -220,6 +225,7 @@ CREATE TABLE IF NOT EXISTS `reports` (
|
|||||||
`board` varchar(58) CHARACTER SET utf8 DEFAULT NULL,
|
`board` varchar(58) CHARACTER SET utf8 DEFAULT NULL,
|
||||||
`post` int(11) NOT NULL,
|
`post` int(11) NOT NULL,
|
||||||
`reason` text NOT NULL,
|
`reason` text NOT NULL,
|
||||||
|
`global` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
|
||||||
|
|
||||||
|
@ -16,8 +16,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
au = false;
|
||||||
auto_reload_enabled = true; // for watch.js to interop
|
auto_reload_enabled = true; // for watch.js to interop
|
||||||
|
|
||||||
|
function makeIcon(){
|
||||||
|
if(au) return;
|
||||||
|
au = true;
|
||||||
|
$("link[rel='icon']").attr("href", "../static/favicon_au.png");
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
if($('div.banner').length == 0)
|
if($('div.banner').length == 0)
|
||||||
return; // not index
|
return; // not index
|
||||||
@ -98,6 +106,7 @@ $(document).ready(function(){
|
|||||||
if($('#' + id).length == 0) {
|
if($('#' + id).length == 0) {
|
||||||
if (!new_posts) {
|
if (!new_posts) {
|
||||||
first_new_post = this;
|
first_new_post = this;
|
||||||
|
makeIcon();
|
||||||
}
|
}
|
||||||
$(this).insertAfter($('div.post:last').next()).after('<br class="clear">');
|
$(this).insertAfter($('div.post:last').next()).after('<br class="clear">');
|
||||||
new_posts++;
|
new_posts++;
|
||||||
|
@ -34,6 +34,10 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
'<br>' +
|
'<br>' +
|
||||||
|
|
||||||
|
'[<input title="Global Report" type="checkbox" name="global" id="global_report" />' +
|
||||||
|
'<label for="global_report" title="Report rule violation (CP, etc) to global staff">Global</label>' +
|
||||||
|
']<input type="submit" name="report" value="Report" /> ' +
|
||||||
|
|
||||||
'<label for="reason_' + id + '">'+_('Reason')+'</label>: ' +
|
'<label for="reason_' + id + '">'+_('Reason')+'</label>: ' +
|
||||||
'<input id="reason_' + id + '" type="text" name="reason" size="20" maxlength="100">' +
|
'<input id="reason_' + id + '" type="text" name="reason" size="20" maxlength="100">' +
|
||||||
' <input type="submit" name="report" value="'+_('Report')+'">' +
|
' <input type="submit" name="report" value="'+_('Report')+'">' +
|
||||||
|
8
post.php
8
post.php
@ -445,8 +445,8 @@ if (isset($_POST['delete'])) {
|
|||||||
if (sizeof($_FILES) > 1)
|
if (sizeof($_FILES) > 1)
|
||||||
$file['file_id'] .= "-$i";
|
$file['file_id'] .= "-$i";
|
||||||
|
|
||||||
$file['file'] = $board['dir'] . $config['dir']['img'] . $file['file_id'] . '.' . $file['extension'];
|
$file['file'] = $config['dir']['img_root'] . $board['dir'] . $config['dir']['img'] . $file['file_id'] . '.' . $file['extension'];
|
||||||
$file['thumb'] = $board['dir'] . $config['dir']['thumb'] . $file['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension']);
|
$file['thumb'] = $config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb'] . $file['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension']);
|
||||||
$post['files'][] = $file;
|
$post['files'][] = $file;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -771,9 +771,9 @@ if (isset($_POST['delete'])) {
|
|||||||
foreach ($post['files'] as $key => &$file) {
|
foreach ($post['files'] as $key => &$file) {
|
||||||
$file['file_path'] = $file['file'];
|
$file['file_path'] = $file['file'];
|
||||||
$file['thumb_path'] = $file['thumb'];
|
$file['thumb_path'] = $file['thumb'];
|
||||||
$file['file'] = mb_substr($file['file'], mb_strlen($board['dir'] . $config['dir']['img']));
|
$file['file'] = mb_substr($file['file'], mb_strlen($config['dir']['img_root'] . $board['dir'] . $config['dir']['img']));
|
||||||
if ($file['is_an_image'] && $file['thumb'] != 'spoiler')
|
if ($file['is_an_image'] && $file['thumb'] != 'spoiler')
|
||||||
$file['thumb'] = mb_substr($file['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb']));
|
$file['thumb'] = mb_substr($file['thumb'], mb_strlen($config['dir']['img_root'] . $board['dir'] . $config['dir']['thumb']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
include "inc/functions.php";
|
include "inc/functions.php";
|
||||||
|
|
||||||
$boards = listBoards();
|
$boards = listBoards(true);
|
||||||
$board = array_rand($boards);
|
$board = array_rand($boards);
|
||||||
|
|
||||||
header('Location: /'.$boards[$board]["uri"]);
|
header('Location: /'.$boards[$board]);
|
||||||
|
|
||||||
|
?>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
$boards = listBoards(TRUE);
|
$boards = listBoards(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$body = Element('search_form.html', Array('boards' => $boards, 'board' => isset($_GET['board']) ? $_GET['board'] : false, 'search' => isset($_GET['search']) ? str_replace('"', '"', utf8tohtml($_GET['search'])) : false));
|
$body = Element('search_form.html', Array('boards' => $boards, 'b' => isset($_GET['board']) ? $_GET['board'] : false, 'search' => isset($_GET['search']) ? str_replace('"', '"', utf8tohtml($_GET['search'])) : false));
|
||||||
|
|
||||||
if(isset($_GET['search']) && !empty($_GET['search']) && isset($_GET['board']) && in_array($_GET['board'], $boards)) {
|
if(isset($_GET['search']) && !empty($_GET['search']) && isset($_GET['board']) && in_array($_GET['board'], $boards)) {
|
||||||
$phrase = $_GET['search'];
|
$phrase = $_GET['search'];
|
||||||
|
@ -9,6 +9,6 @@
|
|||||||
<div class="delete" style="clear:both">
|
<div class="delete" style="clear:both">
|
||||||
<label for="reason">{% trans %}Reason{% endtrans %}</label>
|
<label for="reason">{% trans %}Reason{% endtrans %}</label>
|
||||||
<input id="reason" type="text" name="reason" size="20" maxlength="30" />
|
<input id="reason" type="text" name="reason" size="20" maxlength="30" />
|
||||||
[<input title="Delete file only" type="checkbox" name="global" id="global_report" /><label for="global_report" title="Report rule violation (CP, etc) to global staff">{% trans %}Global{% endtrans %}</label>]
|
[<input title="Global Report" type="checkbox" name="global" id="global_report" /><label for="global_report" title="Report rule violation (CP, etc) to global staff">{% trans %}Global{% endtrans %}</label>]
|
||||||
<input type="submit" name="report" value="{% trans %}Report{% endtrans %}" />
|
<input type="submit" name="report" value="{% trans %}Report{% endtrans %}" />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user