pun_trim() replaced to trim()
This commit is contained in:
parent
419dd54960
commit
1d15d22a8c
17 changed files with 85 additions and 93 deletions
|
@ -220,7 +220,7 @@ else if ($request->isPost('add_edit_ban'))
|
|||
{
|
||||
$ban_ip = preg_replace('%\s{2,}%S', ' ', $ban_ip);
|
||||
$addresses = explode(' ', $ban_ip);
|
||||
$addresses = array_map('pun_trim', $addresses);
|
||||
$addresses = array_map('trim', $addresses);
|
||||
|
||||
for ($i = 0; $i < count($addresses); ++$i)
|
||||
{
|
||||
|
@ -330,7 +330,7 @@ else if ($request->isGet('find_ban'))
|
|||
$form = $request->get('form', array());
|
||||
|
||||
// trim() all elements in $form
|
||||
$form = array_map('pun_trim', $form);
|
||||
$form = array_map('trim', $form);
|
||||
$conditions = $query_str = array();
|
||||
|
||||
$expire_after = trim($request->getStr('expire_after'));
|
||||
|
|
|
@ -136,8 +136,8 @@ else if ($request->isPost('update')) // Change position and name of the categori
|
|||
|
||||
foreach ($categories as $cat_id => $cur_cat)
|
||||
{
|
||||
$cur_cat['name'] = pun_trim($cur_cat['name']);
|
||||
$cur_cat['order'] = pun_trim($cur_cat['order']);
|
||||
$cur_cat['name'] = trim($cur_cat['name']);
|
||||
$cur_cat['order'] = trim($cur_cat['order']);
|
||||
|
||||
if ($cur_cat['name'] == '')
|
||||
message($lang_admin_categories['Must enter name message']);
|
||||
|
|
|
@ -29,14 +29,14 @@ if ($request->isPost('form_sent'))
|
|||
$data = $request->post('form', array());
|
||||
|
||||
$form = array(
|
||||
'board_title' => pun_trim($data['board_title']),
|
||||
'board_desc' => pun_trim($data['board_desc']),
|
||||
'board_title' => trim($data['board_title']),
|
||||
'board_desc' => trim($data['board_desc']),
|
||||
'default_timezone' => floatval($data['default_timezone']),
|
||||
'default_dst' => $data['default_dst'] != '1' ? '0' : '1',
|
||||
'default_lang' => pun_trim($data['default_lang']),
|
||||
'default_style' => pun_trim($_POST['form']['default_style']),
|
||||
'time_format' => pun_trim($data['time_format']),
|
||||
'date_format' => pun_trim($data['date_format']),
|
||||
'default_lang' => trim($data['default_lang']),
|
||||
'default_style' => trim($_POST['form']['default_style']),
|
||||
'time_format' => trim($data['time_format']),
|
||||
'date_format' => trim($data['date_format']),
|
||||
'timeout_visit' => intval($data['timeout_visit']) > 0 ? intval($data['timeout_visit']) : 1,
|
||||
'timeout_online' => intval($data['timeout_online']) > 0 ? intval($data['timeout_online']) : 1,
|
||||
'redirect_delay' => intval($data['redirect_delay']) >= 0 ? intval($data['redirect_delay']) : 0,
|
||||
|
@ -60,33 +60,33 @@ if ($request->isPost('form_sent'))
|
|||
'quickjump' => $data['quickjump'] != '1' ? '0' : '1',
|
||||
'gzip' => $data['gzip'] != '1' ? '0' : '1',
|
||||
'search_all_forums' => $data['search_all_forums'] != '1' ? '0' : '1',
|
||||
'additional_navlinks' => pun_trim($data['additional_navlinks']),
|
||||
'additional_navlinks' => trim($data['additional_navlinks']),
|
||||
'feed_type' => intval($data['feed_type']),
|
||||
'feed_ttl' => intval($data['feed_ttl']),
|
||||
'report_method' => intval($data['report_method']),
|
||||
'mailing_list' => pun_trim($data['mailing_list']),
|
||||
'mailing_list' => trim($data['mailing_list']),
|
||||
'avatars' => $data['avatars'] != '1' ? '0' : '1',
|
||||
'avatars_dir' => pun_trim($data['avatars_dir']),
|
||||
'avatars_dir' => trim($data['avatars_dir']),
|
||||
'avatars_width' => intval($data['avatars_width']) > 0 ? intval($data['avatars_width']) : 1,
|
||||
'avatars_height' => intval($data['avatars_height']) > 0 ? intval($data['avatars_height']) : 1,
|
||||
'avatars_size' => intval($data['avatars_size']) > 0 ? intval($data['avatars_size']) : 1,
|
||||
'admin_email' => strtolower(pun_trim($data['admin_email'])),
|
||||
'webmaster_email' => strtolower(pun_trim($data['webmaster_email'])),
|
||||
'admin_email' => strtolower(trim($data['admin_email'])),
|
||||
'webmaster_email' => strtolower(trim($data['webmaster_email'])),
|
||||
'forum_subscriptions' => $data['forum_subscriptions'] != '1' ? '0' : '1',
|
||||
'topic_subscriptions' => $data['topic_subscriptions'] != '1' ? '0' : '1',
|
||||
'smtp_host' => pun_trim($data['smtp_host']),
|
||||
'smtp_user' => pun_trim($data['smtp_user']),
|
||||
'smtp_host' => trim($data['smtp_host']),
|
||||
'smtp_user' => trim($data['smtp_user']),
|
||||
'smtp_ssl' => $data['smtp_ssl'] != '1' ? '0' : '1',
|
||||
'regs_allow' => $data['regs_allow'] != '1' ? '0' : '1',
|
||||
'regs_verify' => $data['regs_verify'] != '1' ? '0' : '1',
|
||||
'regs_report' => $data['regs_report'] != '1' ? '0' : '1',
|
||||
'rules' => $data['rules'] != '1' ? '0' : '1',
|
||||
'rules_message' => pun_trim($data['rules_message']),
|
||||
'rules_message' => trim($data['rules_message']),
|
||||
'default_email_setting' => intval($data['default_email_setting']),
|
||||
'announcement' => $data['announcement'] != '1' ? '0' : '1',
|
||||
'announcement_message' => pun_trim($data['announcement_message']),
|
||||
'announcement_message' => trim($data['announcement_message']),
|
||||
'maintenance' => $data['maintenance'] != '1' ? '0' : '1',
|
||||
'maintenance_message' => pun_trim($data['maintenance_message']),
|
||||
'maintenance_message' => trim($data['maintenance_message']),
|
||||
);
|
||||
|
||||
if ($form['board_title'] == '')
|
||||
|
@ -123,13 +123,13 @@ if ($request->isPost('form_sent'))
|
|||
$form['avatars_dir'] = substr($form['avatars_dir'], 0, -1);
|
||||
|
||||
if ($form['additional_navlinks'] != '')
|
||||
$form['additional_navlinks'] = pun_trim(pun_linebreaks($form['additional_navlinks']));
|
||||
$form['additional_navlinks'] = trim(pun_linebreaks($form['additional_navlinks']));
|
||||
|
||||
// Change or enter a SMTP password
|
||||
if (isset($data['smtp_change_pass']))
|
||||
{
|
||||
$smtp_pass1 = isset($data['smtp_pass1']) ? pun_trim($data['smtp_pass1']) : '';
|
||||
$smtp_pass2 = isset($data['smtp_pass2']) ? pun_trim($data['smtp_pass2']) : '';
|
||||
$smtp_pass1 = isset($data['smtp_pass1']) ? trim($data['smtp_pass1']) : '';
|
||||
$smtp_pass2 = isset($data['smtp_pass2']) ? trim($data['smtp_pass2']) : '';
|
||||
|
||||
if ($smtp_pass1 == $smtp_pass2)
|
||||
$form['smtp_pass'] = $smtp_pass1;
|
||||
|
|
|
@ -716,7 +716,7 @@ else if ($request->isGet('find_user'))
|
|||
}
|
||||
|
||||
// trim() all elements in $form
|
||||
$form = array_map('pun_trim', $form);
|
||||
$form = array_map('trim', $form);
|
||||
$conditions = $query_str = array();
|
||||
|
||||
$posts_greater = trim($request->getStr('posts_greater'));
|
||||
|
|
|
@ -590,7 +590,7 @@ $lock_error = false;
|
|||
// Generate or fetch the UID - this confirms we have a valid admin
|
||||
if (isset($_POST['req_db_pass']))
|
||||
{
|
||||
$req_db_pass = strtolower(pun_trim($_POST['req_db_pass']));
|
||||
$req_db_pass = strtolower(trim($_POST['req_db_pass']));
|
||||
|
||||
switch ($db_type)
|
||||
{
|
||||
|
@ -623,7 +623,7 @@ if (isset($_POST['req_db_pass']))
|
|||
|
||||
// Update maintenance message
|
||||
if ($_POST['req_maintenance_message'] != '')
|
||||
$maintenance_message = pun_trim(pun_linebreaks($_POST['req_maintenance_message']));
|
||||
$maintenance_message = trim(pun_linebreaks($_POST['req_maintenance_message']));
|
||||
else
|
||||
{
|
||||
// Load the admin_options.php language file
|
||||
|
@ -643,7 +643,7 @@ if (isset($_POST['req_db_pass']))
|
|||
}
|
||||
else if (isset($_GET['uid']))
|
||||
{
|
||||
$uid = pun_trim($_GET['uid']);
|
||||
$uid = trim($_GET['uid']);
|
||||
if (!$lock || $lock !== $uid) // The lock doesn't exist or doesn't match the given UID
|
||||
$lock_error = true;
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ switch ($stage)
|
|||
{
|
||||
$errors[$id] = array();
|
||||
|
||||
$username = pun_trim($_POST['dupe_users'][$id]);
|
||||
$username = trim($_POST['dupe_users'][$id]);
|
||||
|
||||
if (pun_strlen($username) < 2)
|
||||
$errors[$id][] = $lang_update['Username too short error'];
|
||||
|
|
8
edit.php
8
edit.php
|
@ -75,7 +75,7 @@ if ($request->isPost('form_sent'))
|
|||
$subject = trim($request->postStr('req_subject'));
|
||||
|
||||
if ($pun_config['o_censoring'] == '1')
|
||||
$censored_subject = pun_trim(censor_words($subject));
|
||||
$censored_subject = trim(censor_words($subject));
|
||||
|
||||
if ($subject == '')
|
||||
$errors[] = $lang_post['No subject'];
|
||||
|
@ -93,7 +93,7 @@ if ($request->isPost('form_sent'))
|
|||
}
|
||||
|
||||
// Clean up message from POST
|
||||
$message = pun_linebreaks(pun_trim($request->postStr('req_message')));
|
||||
$message = pun_linebreaks(trim($request->postStr('req_message')));
|
||||
|
||||
// Here we use strlen() not pun_strlen() as we want to limit the post to PUN_MAX_POSTSIZE bytes, not characters
|
||||
if (pun_strlen($message) > PUN_MAX_POSTSIZE)
|
||||
|
@ -115,7 +115,7 @@ if ($request->isPost('form_sent'))
|
|||
else if ($pun_config['o_censoring'] == '1')
|
||||
{
|
||||
// Censor message to see if that causes problems
|
||||
$censored_message = pun_trim(censor_words($message));
|
||||
$censored_message = trim(censor_words($message));
|
||||
|
||||
if ($censored_message == '')
|
||||
$errors[] = $lang_post['No message after censoring'];
|
||||
|
@ -176,7 +176,7 @@ if ($request->isPost('form_sent'))
|
|||
|
||||
if ($is_admmod)
|
||||
{
|
||||
$warning = pun_linebreaks(pun_trim($request->postStr('warning')));
|
||||
$warning = pun_linebreaks(trim($request->postStr('warning')));
|
||||
if ($warning != $cur_post['warning'])
|
||||
{
|
||||
$db->query('DELETE FROM '.$db->prefix.'warnings WHERE id='.$id) or error('Unable to remove warning', __FILE__, __LINE__, $db->error());
|
||||
|
|
|
@ -268,7 +268,7 @@ function output_html($feed)
|
|||
foreach ($feed['items'] as $item)
|
||||
{
|
||||
if (utf8_strlen($item['title']) > FORUM_EXTERN_MAX_SUBJECT_LENGTH)
|
||||
$subject_truncated = pun_htmlspecialchars(pun_trim(utf8_substr($item['title'], 0, (FORUM_EXTERN_MAX_SUBJECT_LENGTH - 5)))).' …';
|
||||
$subject_truncated = pun_htmlspecialchars(trim(utf8_substr($item['title'], 0, (FORUM_EXTERN_MAX_SUBJECT_LENGTH - 5)))).' …';
|
||||
else
|
||||
$subject_truncated = pun_htmlspecialchars($item['title']);
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ function generate_stopwords_cache()
|
|||
$d->close();
|
||||
|
||||
// Tidy up and filter the stopwords
|
||||
$stopwords = array_map('pun_trim', $stopwords);
|
||||
$stopwords = array_map('trim', $stopwords);
|
||||
$stopwords = array_filter($stopwords);
|
||||
|
||||
// Output stopwords as PHP code
|
||||
|
|
|
@ -84,7 +84,7 @@ function bbcode2email($text, $wrap_length = 72, $language = null)
|
|||
if (!isset($base_url))
|
||||
$base_url = get_base_url();
|
||||
|
||||
$text = pun_trim($text, "\t\n ");
|
||||
$text = trim($text, "\t\n ");
|
||||
|
||||
$shortcut_urls = array(
|
||||
'topic' => '/viewtopic.php?id=$1',
|
||||
|
@ -241,12 +241,12 @@ function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name
|
|||
$from_email = $pun_config['o_webmaster_email'];
|
||||
|
||||
// Do a little spring cleaning
|
||||
$to = pun_trim(preg_replace('%[\n\r]+%s', '', $to));
|
||||
$subject = pun_trim(preg_replace('%[\n\r]+%s', '', $subject));
|
||||
$from_email = pun_trim(preg_replace('%[\n\r:]+%s', '', $from_email));
|
||||
$from_name = pun_trim(preg_replace('%[\n\r:]+%s', '', str_replace('"', '', $from_name)));
|
||||
$reply_to_email = pun_trim(preg_replace('%[\n\r:]+%s', '', $reply_to_email));
|
||||
$reply_to_name = pun_trim(preg_replace('%[\n\r:]+%s', '', str_replace('"', '', $reply_to_name)));
|
||||
$to = trim(preg_replace('%[\n\r]+%s', '', $to));
|
||||
$subject = trim(preg_replace('%[\n\r]+%s', '', $subject));
|
||||
$from_email = trim(preg_replace('%[\n\r:]+%s', '', $from_email));
|
||||
$from_name = trim(preg_replace('%[\n\r:]+%s', '', str_replace('"', '', $from_name)));
|
||||
$reply_to_email = trim(preg_replace('%[\n\r:]+%s', '', $reply_to_email));
|
||||
$reply_to_name = trim(preg_replace('%[\n\r:]+%s', '', str_replace('"', '', $reply_to_name)));
|
||||
|
||||
// Set up some headers to take advantage of UTF-8
|
||||
$from = '"'.encode_mail_text($from_name).'" <'.$from_email.'>';
|
||||
|
|
|
@ -1402,14 +1402,6 @@ function pun_linebreaks($str)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// A wrapper for utf8_trim for compatibility
|
||||
//
|
||||
function pun_trim($str, $charlist = false)
|
||||
{
|
||||
return is_string($str) ? utf8_trim($str, $charlist) : '';
|
||||
}
|
||||
|
||||
//
|
||||
// Checks if a string is in all uppercase
|
||||
//
|
||||
|
|
|
@ -143,7 +143,7 @@ function preparse_bbcode($text, &$errors, $is_signature = false)
|
|||
break;
|
||||
}
|
||||
|
||||
return pun_trim($text);
|
||||
return trim($text);
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,7 +275,7 @@ function preparse_tags($text, &$errors, $is_signature = false)
|
|||
$split_current = preg_split('%(\n\n+)%', $current, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
|
||||
$current = '';
|
||||
|
||||
if (!pun_trim($split_current[0], "\n")) // The first part is a linebreak so we need to handle any open tags first
|
||||
if (!trim($split_current[0], "\n")) // The first part is a linebreak so we need to handle any open tags first
|
||||
array_unshift($split_current, '');
|
||||
|
||||
for ($i = 1; $i < count($split_current); $i += 2)
|
||||
|
@ -322,7 +322,7 @@ function preparse_tags($text, &$errors, $is_signature = false)
|
|||
}
|
||||
|
||||
if (in_array($open_tags[$opened_tag], $tags_trim))
|
||||
$new_text .= pun_trim($current);
|
||||
$new_text .= trim($current);
|
||||
else
|
||||
$new_text .= $current;
|
||||
|
||||
|
@ -647,8 +647,8 @@ function preparse_list_tag($content, $type = '*')
|
|||
$content = '';
|
||||
foreach ($items as $item)
|
||||
{
|
||||
if (pun_trim($item) != '')
|
||||
$content .= '[*'."\0".']'.str_replace('[/*]', '', pun_trim($item)).'[/*'."\0".']'."\n";
|
||||
if (trim($item) != '')
|
||||
$content .= '[*'."\0".']'.str_replace('[/*]', '', trim($item)).'[/*'."\0".']'."\n";
|
||||
}
|
||||
|
||||
return '[list='.$type.']'."\n".$content.'[/list]';
|
||||
|
@ -662,7 +662,7 @@ function handle_url_tag($url, $link = '', $bbcode = false)
|
|||
{
|
||||
global $pun_config, $pun_user, $page_js;
|
||||
|
||||
$url = pun_trim($url);
|
||||
$url = trim($url);
|
||||
|
||||
// Deal with [url][img]http://example.com/test.png[/img][/url]
|
||||
if (preg_match('%<img src=\"(.*?)\"%', $url, $matches))
|
||||
|
@ -745,7 +745,7 @@ function handle_list_tag($content, $type = '*')
|
|||
$content = preg_replace_callback($re_list, create_function('$matches', 'return handle_list_tag($matches[2], $matches[1]);'), $content);
|
||||
}
|
||||
|
||||
$content = preg_replace('#\s*\[\*\](.*?)\[/\*\]\s*#s', '<li><p>$1</p></li>', pun_trim($content));
|
||||
$content = preg_replace('#\s*\[\*\](.*?)\[/\*\]\s*#s', '<li><p>$1</p></li>', trim($content));
|
||||
|
||||
if ($type == '*')
|
||||
$content = '<ul>'.$content.'</ul>';
|
||||
|
@ -782,7 +782,7 @@ function handle_time_tag($after_time)
|
|||
if ($merged_sec > 0)
|
||||
$content[] = (($merged_sec < 10) ? '0'.$merged_sec : $merged_sec).$lang_common['After time s'];
|
||||
|
||||
return pun_linebreaks(pun_trim('<span style="color: #808080"><em>'.$lang_common['After time'].' '.implode(' ', $content).':</em></span>'."\n"));
|
||||
return pun_linebreaks(trim('<span style="color: #808080"><em>'.$lang_common['After time'].' '.implode(' ', $content).':</em></span>'."\n"));
|
||||
|
||||
}
|
||||
|
||||
|
@ -994,7 +994,7 @@ function parse_message($text, $hide_smilies)
|
|||
if (isset($inside[$i]))
|
||||
{
|
||||
$num_lines = (substr_count($inside[$i], "\n"));
|
||||
$text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.pun_trim($inside[$i], "\n\r").'</code></pre></div><p>';
|
||||
$text .= '</p><div class="codebox"><pre'.(($num_lines > 28) ? ' class="vscroll"' : '').'><code>'.trim($inside[$i], "\n\r").'</code></pre></div><p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -305,8 +305,8 @@ if ($request->isPost('csrf_hash'))
|
|||
$mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_addressee['language'].'/mail_templates/form_pmsn.tpl'));
|
||||
|
||||
$first_crlf = strpos($mail_tpl, "\n");
|
||||
$mail_subject = pun_trim(substr($mail_tpl, 8, $first_crlf-8));
|
||||
$mail_message = pun_trim(substr($mail_tpl, $first_crlf));
|
||||
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
|
||||
$mail_message = trim(substr($mail_tpl, $first_crlf));
|
||||
|
||||
if (isset($subject))
|
||||
$mail_subject = str_replace('<mail_subject>', $subject, $mail_subject);
|
||||
|
|
|
@ -64,8 +64,8 @@ if ($request->isPost('action2'))
|
|||
$mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_user['language'].'/mail_templates/form_pmsn.tpl'));
|
||||
|
||||
$first_crlf = strpos($mail_tpl, "\n");
|
||||
$mail_subject = pun_trim(substr($mail_tpl, 8, $first_crlf-8));
|
||||
$mail_message = pun_trim(substr($mail_tpl, $first_crlf));
|
||||
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
|
||||
$mail_message = trim(substr($mail_tpl, $first_crlf));
|
||||
|
||||
$mail_subject = str_replace('<mail_subject>', $cur_topic['topic'], $mail_subject);
|
||||
$mail_message = str_replace('<sender>', $pun_user['username'], $mail_message);
|
||||
|
|
|
@ -209,7 +209,7 @@ function poll_form($tid)
|
|||
}
|
||||
}
|
||||
|
||||
$questions = array_map('pun_trim', $questions);
|
||||
$questions = array_map('trim', $questions);
|
||||
$type = array_map('intval', $type);
|
||||
|
||||
if (poll_noedit($tid))
|
||||
|
@ -252,7 +252,7 @@ function poll_form($tid)
|
|||
|
||||
for ($i = 1; $i <= $pun_config['o_poll_max_field'] && $fi; $i++)
|
||||
{
|
||||
$choice = (isset($choices[$k][$i])) ? pun_htmlspecialchars(pun_trim($choices[$k][$i])) : '';
|
||||
$choice = (isset($choices[$k][$i])) ? pun_htmlspecialchars(trim($choices[$k][$i])) : '';
|
||||
if (empty($choice))
|
||||
{
|
||||
$fi = false;
|
||||
|
@ -316,7 +316,7 @@ function poll_form($tid)
|
|||
|
||||
for ($i = 1; $i <= $pun_config['o_poll_max_field']; $i++)
|
||||
{
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? pun_htmlspecialchars(pun_trim($choices[$k][$i])) : '';
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? pun_htmlspecialchars(trim($choices[$k][$i])) : '';
|
||||
|
||||
?>
|
||||
<label><?php printf($lang_poll['Form choice'], $i) ?><br /><input class="longinput" type="text" name="poll_choice[<?php echo $k ?>][<?php echo $i?>]" value="<?php echo $choice ?>" tabindex="<?php echo $cur_index++ ?>" size="80" maxlength="250" onkeyup="ForChoice(<?php echo $k ?>,<?php echo $i?>)" /></label>
|
||||
|
@ -365,7 +365,7 @@ function poll_form_validate($tid, &$errors)
|
|||
$choices = poll_post('poll_choice', array());
|
||||
$type = poll_post('poll_type', array());
|
||||
|
||||
$questions = array_map('pun_trim', $questions);
|
||||
$questions = array_map('trim', $questions);
|
||||
$type = array_map('intval', $type);
|
||||
|
||||
$fk = true;
|
||||
|
@ -385,7 +385,7 @@ function poll_form_validate($tid, &$errors)
|
|||
$fi = $fk;
|
||||
for ($i = 1; $i <= $pun_config['o_poll_max_field'] && $fi; $i++)
|
||||
{
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? pun_trim($choices[$k][$i]) : '';
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? trim($choices[$k][$i]) : '';
|
||||
if ($choice == '')
|
||||
$fi = false;
|
||||
else
|
||||
|
@ -449,7 +449,7 @@ function poll_save($tid)
|
|||
$choices = poll_post('poll_choice', array());
|
||||
$type = poll_post('poll_type', array());
|
||||
|
||||
$questions = array_map('pun_trim', $questions);
|
||||
$questions = array_map('trim', $questions);
|
||||
$type = array_map('intval', $type);
|
||||
|
||||
$cur_ch = array();
|
||||
|
@ -477,7 +477,7 @@ function poll_save($tid)
|
|||
$fi = $fk;
|
||||
for ($i = 1; $i <= $pun_config['o_poll_max_field'] && $fi; $i++)
|
||||
{
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? pun_trim($choices[$k][$i]) : '';
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? trim($choices[$k][$i]) : '';
|
||||
if ($choice == '')
|
||||
$fi = false;
|
||||
else
|
||||
|
@ -557,7 +557,7 @@ function poll_display_post($tid, $uid)
|
|||
$choices = poll_post('poll_choice', array());
|
||||
$type = poll_post('poll_type', array());
|
||||
|
||||
$questions = array_map('pun_trim', $questions);
|
||||
$questions = array_map('trim', $questions);
|
||||
$type = array_map('intval', $type);
|
||||
|
||||
$q = $ch = array();
|
||||
|
@ -575,7 +575,7 @@ function poll_display_post($tid, $uid)
|
|||
$fi = $fk;
|
||||
for ($i = 1; $i <= $pun_config['o_poll_max_field'] && $fi; $i++)
|
||||
{
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? pun_trim($choices[$k][$i]) : '';
|
||||
$choice = (isset($choices[$k][$i]) && $fi) ? trim($choices[$k][$i]) : '';
|
||||
if ($choice == '')
|
||||
$fi = false;
|
||||
else
|
||||
|
|
6
misc.php
6
misc.php
|
@ -155,8 +155,8 @@ else if ($request->isGet('email'))
|
|||
|
||||
// The first row contains the subject
|
||||
$first_crlf = strpos($mail_tpl, "\n");
|
||||
$mail_subject = pun_trim(substr($mail_tpl, 8, $first_crlf-8));
|
||||
$mail_message = pun_trim(substr($mail_tpl, $first_crlf));
|
||||
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
|
||||
$mail_message = trim(substr($mail_tpl, $first_crlf));
|
||||
|
||||
$mail_subject = str_replace('<mail_subject>', $subject, $mail_subject);
|
||||
$mail_message = str_replace('<sender>', $pun_user['username'], $mail_message);
|
||||
|
@ -237,7 +237,7 @@ else if ($request->isGet('report'))
|
|||
confirm_referrer('misc.php');
|
||||
|
||||
// Clean up reason from POST
|
||||
$reason = pun_linebreaks(pun_trim($request->postStr('req_reason')));
|
||||
$reason = pun_linebreaks(trim($request->postStr('req_reason')));
|
||||
if ($reason == '')
|
||||
message($lang_misc['No reason']);
|
||||
else if (strlen($reason) > 65535) // TEXT field can only hold 65535 bytes
|
||||
|
|
6
post.php
6
post.php
|
@ -87,7 +87,7 @@ if ($request->isPost('form_sent'))
|
|||
$subject = trim($request->postStr('req_subject'));
|
||||
|
||||
if ($pun_config['o_censoring'] == '1')
|
||||
$censored_subject = pun_trim(censor_words($subject));
|
||||
$censored_subject = trim(censor_words($subject));
|
||||
|
||||
if ($subject == '')
|
||||
$errors[] = $lang_post['No subject'];
|
||||
|
@ -109,7 +109,7 @@ if ($request->isPost('form_sent'))
|
|||
else
|
||||
{
|
||||
$username = trim($request->postStr('req_username'));
|
||||
$email = strtolower(pun_trim($request->postStr($pun_config['p_force_guest_email'] == '1' ? 'req_email' : 'email')));
|
||||
$email = strtolower(trim($request->postStr($pun_config['p_force_guest_email'] == '1' ? 'req_email' : 'email')));
|
||||
$banned_email = false;
|
||||
|
||||
// Load the register.php/prof_reg.php language files
|
||||
|
@ -160,7 +160,7 @@ if ($request->isPost('form_sent'))
|
|||
else if ($pun_config['o_censoring'] == '1')
|
||||
{
|
||||
// Censor message to see if that causes problems
|
||||
$censored_message = pun_trim(censor_words($message));
|
||||
$censored_message = trim(censor_words($message));
|
||||
|
||||
if ($censored_message == '')
|
||||
$errors[] = $lang_post['No message after censoring'];
|
||||
|
|
32
profile.php
32
profile.php
|
@ -208,7 +208,7 @@ else if ($action === 'change_email')
|
|||
require PUN_ROOT.'include/email.php';
|
||||
|
||||
// Validate the email address
|
||||
$new_email = strtolower(pun_trim($request->postStr('req_new_email')));
|
||||
$new_email = strtolower(trim($request->postStr('req_new_email')));
|
||||
if (!is_valid_email($new_email))
|
||||
message($lang_common['Invalid email']);
|
||||
|
||||
|
@ -783,7 +783,7 @@ else if ($request->isPost('form_sent'))
|
|||
if (isset($data['language']))
|
||||
{
|
||||
$languages = forum_list_langs();
|
||||
$form['language'] = pun_trim($data['language']);
|
||||
$form['language'] = trim($data['language']);
|
||||
if (!in_array($form['language'], $languages))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ else if ($request->isPost('form_sent'))
|
|||
require PUN_ROOT.'include/email.php';
|
||||
|
||||
// Validate the email address
|
||||
$form['email'] = strtolower(pun_trim($request->postStr('req_email')));
|
||||
$form['email'] = strtolower(trim($request->postStr('req_email')));
|
||||
if (!is_valid_email($form['email']))
|
||||
message($lang_common['Invalid email']);
|
||||
}
|
||||
|
@ -834,10 +834,10 @@ else if ($request->isPost('form_sent'))
|
|||
case 'personal':
|
||||
{
|
||||
$form = array(
|
||||
'realname' => isset($data['realname']) ? pun_trim($data['realname']) : '',
|
||||
'gender' => isset($data['gender']) ? pun_trim($data['gender']) : '', // мод пола - Visman
|
||||
'url' => isset($data['url']) ? pun_trim($data['url']) : '',
|
||||
'location' => isset($data['location']) ? pun_trim($data['location']) : '',
|
||||
'realname' => isset($data['realname']) ? trim($data['realname']) : '',
|
||||
'gender' => isset($data['gender']) ? trim($data['gender']) : '', // мод пола - Visman
|
||||
'url' => isset($data['url']) ? trim($data['url']) : '',
|
||||
'location' => isset($data['location']) ? trim($data['location']) : '',
|
||||
);
|
||||
|
||||
// Add http:// if the URL doesn't contain it already (while allowing https://, too)
|
||||
|
@ -884,11 +884,11 @@ else if ($request->isPost('form_sent'))
|
|||
case 'messaging':
|
||||
{
|
||||
$form = array(
|
||||
'jabber' => pun_trim($data['jabber']),
|
||||
'icq' => pun_trim($data['icq']),
|
||||
'msn' => pun_trim($data['msn']),
|
||||
'aim' => pun_trim($data['aim']),
|
||||
'yahoo' => pun_trim($data['yahoo']),
|
||||
'jabber' => trim($data['jabber']),
|
||||
'icq' => trim($data['icq']),
|
||||
'msn' => trim($data['msn']),
|
||||
'aim' => trim($data['aim']),
|
||||
'yahoo' => trim($data['yahoo']),
|
||||
);
|
||||
|
||||
// If the ICQ UIN contains anything other than digits it's invalid
|
||||
|
@ -905,7 +905,7 @@ else if ($request->isPost('form_sent'))
|
|||
// Clean up signature from POST
|
||||
if ($pun_config['o_signatures'] == '1')
|
||||
{
|
||||
$form['signature'] = pun_linebreaks(pun_trim($request->postStr('signature')));
|
||||
$form['signature'] = pun_linebreaks(trim($request->postStr('signature')));
|
||||
|
||||
// Validate signature
|
||||
if (pun_strlen($form['signature']) > $pun_config['p_sig_length'])
|
||||
|
@ -935,8 +935,8 @@ else if ($request->isPost('form_sent'))
|
|||
case 'display':
|
||||
{
|
||||
$form = array(
|
||||
'disp_topics' => pun_trim($data['disp_topics']),
|
||||
'disp_posts' => pun_trim($data['disp_posts']),
|
||||
'disp_topics' => trim($data['disp_topics']),
|
||||
'disp_posts' => trim($data['disp_posts']),
|
||||
);
|
||||
|
||||
if ($form['disp_topics'] != '')
|
||||
|
@ -976,7 +976,7 @@ else if ($request->isPost('form_sent'))
|
|||
if (isset($data['style']))
|
||||
{
|
||||
$styles = forum_list_styles();
|
||||
$form['style'] = pun_trim($data['style']);
|
||||
$form['style'] = trim($data['style']);
|
||||
if (!in_array($form['style'], $styles))
|
||||
message($lang_common['Bad request'], false, '404 Not Found');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue