Add default name (or names) setting for anonymous posters
Resolves #171.
This commit is contained in:
parent
5fb30d1c3a
commit
066613d55c
5 changed files with 16 additions and 3 deletions
|
@ -237,7 +237,7 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
|
|||
}
|
||||
|
||||
$post = newPost(setParent());
|
||||
|
||||
|
||||
if (!$loggedin) {
|
||||
if ($post['parent'] == TINYIB_NEWTHREAD && TINYIB_DISALLOWTHREADS != '') {
|
||||
fancyDie(TINYIB_DISALLOWTHREADS);
|
||||
|
@ -257,7 +257,13 @@ if (!isset($_GET['delete']) && !isset($_GET['manage']) && (isset($_POST['name'])
|
|||
}
|
||||
}
|
||||
|
||||
if ($post['name'] == '' && $post['tripcode'] == '') {
|
||||
global $tinyib_anonymous;
|
||||
$post['name'] = $tinyib_anonymous[array_rand($tinyib_anonymous)];
|
||||
}
|
||||
|
||||
$post['ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
if ($rawpost || !in_array('name', $hide_fields)) {
|
||||
list($post['name'], $post['tripcode']) = nameAndTripcode($_POST['name']);
|
||||
$post['name'] = cleanString(substr($post['name'], 0, 75));
|
||||
|
|
|
@ -137,6 +137,9 @@ if (!isset($tinyib_embeds)) {
|
|||
$tinyib_embeds['YouTube'] = 'https://www.youtube.com/oembed?url=TINYIBEMBED&format=json';
|
||||
}
|
||||
}
|
||||
if (!isset($tinyib_anonymous)) {
|
||||
$tinyib_anonymous = array('Anonymous');
|
||||
}
|
||||
if (!isset($tinyib_capcodes)) {
|
||||
$tinyib_capcodes = array(array('Admin', 'red'), array('Mod', 'purple'));
|
||||
}
|
||||
|
|
|
@ -131,8 +131,11 @@ function nameAndTripcode($name) {
|
|||
}
|
||||
|
||||
function nameBlock($name, $tripcode, $email, $timestamp, $rawposttext) {
|
||||
global $tinyib_anonymous;
|
||||
$anonymous = $tinyib_anonymous[array_rand($tinyib_anonymous)];
|
||||
|
||||
$output = '<span class="postername">';
|
||||
$output .= ($name == '' && $tripcode == '') ? __('Anonymous') : $name;
|
||||
$output .= ($name == '' && $tripcode == '') ? $anonymous : $name;
|
||||
|
||||
if ($tripcode != '') {
|
||||
$output .= '</span><span class="postertrip">!' . $tripcode;
|
||||
|
|
|
@ -1236,7 +1236,7 @@ function encodeJSON($array) {
|
|||
function buildSinglePostJSON($post) {
|
||||
$name = $post['name'];
|
||||
if ($name == '') {
|
||||
$name = __('Anonymous');
|
||||
$name = 'Anonymous';
|
||||
}
|
||||
|
||||
$output = array('id' => $post['id'], 'parent' => $post['parent'], 'timestamp' => $post['timestamp'], 'bumped' => $post['bumped'], 'name' => $name, 'tripcode' => $post['tripcode'], 'subject' => $post['subject'], 'message' => $post['message'], 'file' => $post['file'], 'file_hex' => $post['file_hex'], 'file_original' => $post['file_original'], 'file_size' => $post['file_size'], 'file_size_formated' => $post['file_size_formatted'], 'image_width' => $post['image_width'], 'image_height' => $post['image_height'], 'thumb' => $post['thumb'], 'thumb_width' => $post['thumb_width'], 'thumb_height' => $post['thumb_height']);
|
||||
|
|
|
@ -43,6 +43,7 @@ define('TINYIB_JSON', true); // Generate JSON files
|
|||
define('TINYIB_DATEFMT', '%g/%m/%d(%a)%H:%M:%S'); // Date and time format (see php.net/strftime)
|
||||
$tinyib_hidefieldsop = array(); // Fields to hide when creating a new thread - e.g. array('name', 'email', 'subject', 'message', 'file', 'embed', 'password')
|
||||
$tinyib_hidefields = array(); // Fields to hide when replying
|
||||
$tinyib_anonymous = array('Anonymous'); // Default name (or names)
|
||||
$tinyib_capcodes = array(array('Admin', 'red'), array('Mod', 'purple')); // Administrator and moderator capcode label and color
|
||||
|
||||
// Post control
|
||||
|
|
Loading…
Reference in a new issue