forked from leftypol/leftypol
Merge branch 'master' of https://github.com/asiekierka/Tinyboard
Conflicts: mod.php
This commit is contained in:
commit
c18ed4e51a
11 changed files with 192 additions and 64 deletions
|
@ -651,6 +651,10 @@
|
||||||
array(
|
array(
|
||||||
'/^https?:\/\/video\.google\.com\/videoplay\?docid=(\d+)([&#](.+)?)?$/i',
|
'/^https?:\/\/video\.google\.com\/videoplay\?docid=(\d+)([&#](.+)?)?$/i',
|
||||||
'<embed src="http://video.google.com/googleplayer.swf?docid=$1&hl=en&fs=true" style="width:%%tb_width%%px;height:%%tb_height%%px;float:left;margin:10px 20px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>'
|
'<embed src="http://video.google.com/googleplayer.swf?docid=$1&hl=en&fs=true" style="width:%%tb_width%%px;height:%%tb_height%%px;float:left;margin:10px 20px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'/^https?:\/\/(\w+\.)?vocaroo\.com\/i\/([a-zA-Z0-9]{2,15})$/i',
|
||||||
|
'<object style="float: left;margin: 10px 20px;" width="148" height="44"><param name="movie" value="http://vocaroo.com/player.swf?playMediaID=$2&autoplay=0"></param><param name="wmode" value="transparent"></param><embed src="http://vocaroo.com/player.swf?playMediaID=$2&autoplay=0" width="148" height="44" wmode="transparent" type="application/x-shockwave-flash"></embed></object>'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -949,7 +953,7 @@
|
||||||
// View whether a thread has been bumplocked ("-1" to allow non-mods to see too)
|
// View whether a thread has been bumplocked ("-1" to allow non-mods to see too)
|
||||||
$config['mod']['view_bumplock'] = MOD;
|
$config['mod']['view_bumplock'] = MOD;
|
||||||
// Edit posts (EXPERIMENTAL)
|
// Edit posts (EXPERIMENTAL)
|
||||||
$config['mod']['editpost'] = DISABLED;
|
$config['mod']['editpost'] = MOD;
|
||||||
// "Move" a thread to another board (EXPERIMENTAL; has some known bugs)
|
// "Move" a thread to another board (EXPERIMENTAL; has some known bugs)
|
||||||
$config['mod']['move'] = DISABLED;
|
$config['mod']['move'] = DISABLED;
|
||||||
// Bypass "field_disable_*" (forced anonymity, etc.)
|
// Bypass "field_disable_*" (forced anonymity, etc.)
|
||||||
|
|
|
@ -985,6 +985,54 @@ function mod_ban_post($board, $delete, $post, $token = false) {
|
||||||
mod_page(_('New ban'), 'mod/ban_form.html', $args);
|
mod_page(_('New ban'), 'mod/ban_form.html', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mod_edit_post($board, $post) {
|
||||||
|
global $config, $mod;
|
||||||
|
|
||||||
|
if (!openBoard($board))
|
||||||
|
error($config['error']['noboard']);
|
||||||
|
|
||||||
|
if (!hasPermission($config['mod']['editpost'], $board))
|
||||||
|
error($config['error']['noaccess']);
|
||||||
|
|
||||||
|
$security_token = make_secure_link_token($board . '/ban/' . $post);
|
||||||
|
|
||||||
|
$query = prepare(sprintf('SELECT * FROM `posts_%s` WHERE `id` = :id', $board));
|
||||||
|
$query->bindValue(':id', $post);
|
||||||
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
|
if (!$_post = $query->fetch(PDO::FETCH_ASSOC))
|
||||||
|
error($config['error']['404']);
|
||||||
|
|
||||||
|
if(isset($_POST['mode']) && $_POST['mode'] == "edit")
|
||||||
|
{
|
||||||
|
$query = prepare(sprintf("UPDATE `posts_%s` SET `name` = :name,`email` = :email,`subject` = :subject,`body` = :body WHERE `id` = :id",$board));
|
||||||
|
$query->bindValue(':id', $post);
|
||||||
|
$query->bindValue('name', $_POST['name']);
|
||||||
|
$query->bindValue(':email', $_POST['email']);
|
||||||
|
$query->bindValue(':subject', $_POST['subject']);
|
||||||
|
$query->bindValue(':body', $_POST['body']);
|
||||||
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
|
$thread = $_post['thread'];
|
||||||
|
buildThread($thread ? $thread : $post);
|
||||||
|
modLog("Edited post #{$post}");
|
||||||
|
buildIndex();
|
||||||
|
|
||||||
|
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
|
||||||
|
} else {
|
||||||
|
$args = array(
|
||||||
|
'token' => $security_token,
|
||||||
|
'name' => $_post['name'],
|
||||||
|
'email' => $_post['email'],
|
||||||
|
'subject' => $_post['subject'],
|
||||||
|
'body' => $_post['body'],
|
||||||
|
'mode' => "edit"
|
||||||
|
);
|
||||||
|
|
||||||
|
mod_page(_('Edit post'), 'mod/edit_post_form.html', $args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function mod_delete($board, $post) {
|
function mod_delete($board, $post) {
|
||||||
global $config, $mod;
|
global $config, $mod;
|
||||||
|
|
||||||
|
|
1
mod.php
1
mod.php
|
@ -65,6 +65,7 @@ $pages = array(
|
||||||
'/([\w+.]+)/deletefile/(\d+)' => 'secure deletefile', // delete file from post
|
'/([\w+.]+)/deletefile/(\d+)' => 'secure deletefile', // delete file from post
|
||||||
'/([\w+.]+)/deletebyip/(\d+)(/global)?' => 'secure deletebyip', // delete all posts by IP address
|
'/([\w+.]+)/deletebyip/(\d+)(/global)?' => 'secure deletebyip', // delete all posts by IP address
|
||||||
'/([\w+.]+)/(un)?lock/(\d+)' => 'secure lock', // lock thread
|
'/([\w+.]+)/(un)?lock/(\d+)' => 'secure lock', // lock thread
|
||||||
|
'/([\w+.]+)/edit/(\d+)' => 'secure edit_post', // edit post
|
||||||
'/([\w+.]+)/(un)?sticky/(\d+)' => 'secure sticky', // sticky thread
|
'/([\w+.]+)/(un)?sticky/(\d+)' => 'secure sticky', // sticky thread
|
||||||
'/([\w+.]+)/bump(un)?lock/(\d+)' => 'secure bumplock', // "bumplock" thread
|
'/([\w+.]+)/bump(un)?lock/(\d+)' => 'secure bumplock', // "bumplock" thread
|
||||||
|
|
||||||
|
|
|
@ -2,35 +2,8 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
|
{% include 'header.html' %}
|
||||||
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}">{% endif %}
|
|
||||||
<title>{{ board.url }} - {{ board.name }}</title>
|
<title>{{ board.url }} - {{ board.name }}</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes">
|
|
||||||
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
|
|
||||||
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}
|
|
||||||
<script type="text/javascript">var configRoot="{{ config.root }}";</script>
|
|
||||||
{% if not nojavascript %}
|
|
||||||
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
|
|
||||||
{% if not config.additional_javascript_compile %}
|
|
||||||
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}"></script>{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% if config.recaptcha %}<style type="text/css">{% raw %}
|
|
||||||
.recaptcha_image_cell {
|
|
||||||
background: none !important;
|
|
||||||
}
|
|
||||||
table.recaptchatable {
|
|
||||||
border: none !important;
|
|
||||||
}
|
|
||||||
#recaptcha_logo, #recaptcha_tagline {
|
|
||||||
display: none;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.recaptchatable a {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
{% endraw %}</style>{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
28
templates/header.html
Normal file
28
templates/header.html
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
|
||||||
|
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}">{% endif %}
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=yes">
|
||||||
|
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
|
||||||
|
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}
|
||||||
|
<script type="text/javascript">var configRoot="{{ config.root }}";</script>
|
||||||
|
{% if not nojavascript %}
|
||||||
|
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
|
||||||
|
{% if not config.additional_javascript_compile %}
|
||||||
|
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}"></script>{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if config.recaptcha %}<style type="text/css">{% raw %}
|
||||||
|
.recaptcha_image_cell {
|
||||||
|
background: none !important;
|
||||||
|
}
|
||||||
|
table.recaptchatable {
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
#recaptcha_logo, #recaptcha_tagline {
|
||||||
|
display: none;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.recaptchatable a {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
{% endraw %}</style>{% endif %}
|
|
@ -1,35 +1,9 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
{% include 'header.html' %}
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
|
|
||||||
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}">{% endif %}
|
|
||||||
<title>{{ board.url }} - {{ board.name }}</title>
|
<title>{{ board.url }} - {{ board.name }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
|
|
||||||
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
|
|
||||||
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}
|
|
||||||
<script type="text/javascript">var configRoot="{{ config.root }}";</script>
|
|
||||||
{% if not nojavascript %}
|
|
||||||
<script type="text/javascript" src="{{ config.url_javascript }}"></script>
|
|
||||||
{% if not config.additional_javascript_compile %}
|
|
||||||
{% for javascript in config.additional_javascript %}<script type="text/javascript" src="{{ config.additional_javascript_url }}{{ javascript }}"></script>{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% if config.recaptcha %}<style type="text/css">{% raw %}
|
|
||||||
.recaptcha_image_cell {
|
|
||||||
background: none !important;
|
|
||||||
}
|
|
||||||
table.recaptchatable {
|
|
||||||
border: none !important;
|
|
||||||
}
|
|
||||||
#recaptcha_logo, #recaptcha_tagline {
|
|
||||||
display: none;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.recaptchatable a {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
{% endraw %}</style>{% endif %}
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{ boardlist.top }}
|
{{ boardlist.top }}
|
||||||
|
|
40
templates/mod/edit_post_form.html
Normal file
40
templates/mod/edit_post_form.html
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<form name="post" enctype="multipart/form-data" action="{{ action }}" method="post">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{% trans %}Name{% endtrans %}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="name" size="25" maxlength="35" autocomplete="off" value="{{ name }}">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{% trans %}Email{% endtrans %}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="email" size="25" maxlength="40" autocomplete="off" value="{{ email }}">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{% trans %}Subject{% endtrans %}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input style="float:left;" type="text" name="subject" size="25" maxlength="100" autocomplete="off" value="{{ subject }}">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
{% trans %}Comment{% endtrans %}
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<textarea name="body" id="body" rows="5" cols="35">{{ body }}</textarea>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th><input type="hidden" name="mode" value="{{ mode }}"></th>
|
||||||
|
<td><input name="sub" type="submit" value="{% trans 'Submit' %}"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
|
@ -1,14 +1,9 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
{% include 'header.html' %}
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
|
|
||||||
{% if config.url_favicon %}<link rel="shortcut icon" href="{{ config.url_favicon }}">{% endif %}
|
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
|
|
||||||
{% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %}
|
|
||||||
<script type="text/javascript">var configRoot="{{ config.root }}";</script>
|
|
||||||
{% if not nojavascript %}<script type="text/javascript" src="{{ config.url_javascript }}"></script>{% endif %}
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr>{% endif %}
|
{% if pm %}<div class="top_notice">You have <a href="?/PM/{{ pm.id }}">an unread PM</a>{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.</div><hr>{% endif %}
|
||||||
|
|
|
@ -56,6 +56,14 @@
|
||||||
'comment' => '(eg. "recent.css")'
|
'comment' => '(eg. "recent.css")'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$theme['config'][] = Array(
|
||||||
|
'title' => 'CSS stylesheet name',
|
||||||
|
'name' => 'basecss',
|
||||||
|
'type' => 'text',
|
||||||
|
'default' => 'recent.css',
|
||||||
|
'comment' => '(eg. "recent.css" - see templates/themes/recent for details)'
|
||||||
|
);
|
||||||
|
|
||||||
// Unique function name for building everything
|
// Unique function name for building everything
|
||||||
$theme['build_function'] = 'recentposts_build';
|
$theme['build_function'] = 'recentposts_build';
|
||||||
$theme['install_callback'] = 'recentposts_install';
|
$theme['install_callback'] = 'recentposts_install';
|
||||||
|
|
57
templates/themes/recent/recent_fs.css
Normal file
57
templates/themes/recent/recent_fs.css
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
.box-wrap {
|
||||||
|
max-width: 670px;
|
||||||
|
min-width: 332px;
|
||||||
|
margin: 30px auto;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.box {
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #98E;
|
||||||
|
width: 330px;
|
||||||
|
margin: 8px 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.box ul {
|
||||||
|
padding: 2px 15px;
|
||||||
|
}
|
||||||
|
.box ul li {
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.box.left {
|
||||||
|
background: #FDF6AF;
|
||||||
|
color: #9E914F;
|
||||||
|
border: 1px solid #9E914F;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.box.right {
|
||||||
|
background: #F2DCE5;
|
||||||
|
color: #525;
|
||||||
|
border: 1px solid #CA759E;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box h2 {
|
||||||
|
padding: 3px 7px;
|
||||||
|
font-size: 12pt;
|
||||||
|
}
|
||||||
|
.box img {
|
||||||
|
float: none;
|
||||||
|
margin: 10px auto;
|
||||||
|
}
|
||||||
|
.box.left h2 {
|
||||||
|
background: #FEE78F;
|
||||||
|
color: #9E914F;
|
||||||
|
}
|
||||||
|
.box.right h2 {
|
||||||
|
background: #EB81B4;
|
||||||
|
color: #F8F8F8;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #F7F8F9;
|
||||||
|
}
|
||||||
|
header div.subtitle, h1 {
|
||||||
|
color: #888A8C;
|
||||||
|
}
|
|
@ -18,7 +18,7 @@
|
||||||
global $config, $_theme;
|
global $config, $_theme;
|
||||||
|
|
||||||
if ($action == 'all') {
|
if ($action == 'all') {
|
||||||
copy('templates/themes/recent/recent.css', $config['dir']['home'] . $settings['css']);
|
copy('templates/themes/recent/' . $settings['basecss'], $config['dir']['home'] . $settings['css']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->excluded = explode(' ', $settings['exclude']);
|
$this->excluded = explode(' ', $settings['exclude']);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue