本文整理汇总了PHP中FeatherBB\Core\Utils::linebreaks方法的典型用法代码示例。如果您正苦于以下问题:PHP Utils::linebreaks方法的具体用法?PHP Utils::linebreaks怎么用?PHP Utils::linebreaks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatherBB\Core\Utils
的用法示例。
在下文中一共展示了Utils::linebreaks方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.forums.edit');
if (Request::isPost()) {
if (Input::post('save') && Input::post('read_forum_old')) {
// Forums parameters / TODO : better handling of wrong parameters
$forum_data = array('forum_name' => Utils::escape(Input::post('forum_name')), 'forum_desc' => Input::post('forum_desc') ? Utils::linebreaks(Utils::trim(Input::post('forum_desc'))) : NULL, 'cat_id' => (int) Input::post('cat_id'), 'sort_by' => (int) Input::post('sort_by'), 'redirect_url' => Url::is_valid(Input::post('redirect_url')) ? Utils::escape(Input::post('redirect_url')) : NULL);
if ($forum_data['forum_name'] == '') {
return Router::redirect(Router::pathFor('editForum', array('id' => $args['id'])), __('Must enter name message'));
}
if ($forum_data['cat_id'] < 1) {
return Router::redirect(Router::pathFor('editForum', array('id' => $args['id'])), __('Must be valid category'));
}
$this->model->update_forum($args['id'], $forum_data);
// Permissions
$permissions = $this->model->get_default_group_permissions(false);
foreach ($permissions as $perm_group) {
$permissions_data = array('group_id' => $perm_group['g_id'], 'forum_id' => $args['id']);
if ($perm_group['g_read_board'] == '1' && isset(Input::post('read_forum_new')[$perm_group['g_id']]) && Input::post('read_forum_new')[$perm_group['g_id']] == '1') {
$permissions_data['read_forum'] = '1';
} else {
$permissions_data['read_forum'] = '0';
}
$permissions_data['post_replies'] = isset(Input::post('post_replies_new')[$perm_group['g_id']]) ? '1' : '0';
$permissions_data['post_topics'] = isset(Input::post('post_topics_new')[$perm_group['g_id']]) ? '1' : '0';
// Check if the new settings differ from the old
if ($permissions_data['read_forum'] != Input::post('read_forum_old')[$perm_group['g_id']] || $permissions_data['post_replies'] != Input::post('post_replies_old')[$perm_group['g_id']] || $permissions_data['post_topics'] != Input::post('post_topics_old')[$perm_group['g_id']]) {
// If there is no group permissions override for this forum
if ($permissions_data['read_forum'] == '1' && $permissions_data['post_replies'] == $perm_group['g_post_replies'] && $permissions_data['post_topics'] == $perm_group['g_post_topics']) {
$this->model->delete_permissions($args['id'], $perm_group['g_id']);
} else {
// Run an UPDATE and see if it affected a row, if not, INSERT
$this->model->update_permissions($permissions_data);
}
}
}
// Regenerate the quick jump cache
Container::get('cache')->store('quickjump', Cache::get_quickjump());
return Router::redirect(Router::pathFor('editForum', array('id' => $args['id'])), __('Forum updated redirect'));
} elseif (Input::post('revert_perms')) {
$this->model->delete_permissions($args['id']);
// Regenerate the quick jump cache
Container::get('cache')->store('quickjump', Cache::get_quickjump());
return Router::redirect(Router::pathFor('editForum', array('id' => $args['id'])), __('Perms reverted redirect'));
}
} else {
AdminUtils::generateAdminMenu('forums');
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Forums')), 'active_page' => 'admin', 'admin_console' => true, 'perm_data' => $this->model->get_permissions($args['id']), 'cur_index' => 7, 'cur_forum' => $this->model->get_forum_info($args['id']), 'forum_data' => $this->model->get_forums()))->addTemplate('admin/forums/permissions.php')->display();
}
}
示例2: insert_report
public function insert_report($post_id)
{
$post_id = $this->hook->fire('insert_report_start', $post_id);
// Clean up reason from POST
$reason = Utils::linebreaks(Utils::trim($this->request->post('req_reason')));
if ($reason == '') {
throw new Error(__('No reason'), 400);
} elseif (strlen($reason) > 65535) {
// TEXT field can only hold 65535 bytes
throw new Error(__('Reason too long'), 400);
}
if ($this->user->last_report_sent != '' && time() - $this->user->last_report_sent < $this->user->g_report_flood && time() - $this->user->last_report_sent >= 0) {
throw new Error(sprintf(__('Report flood'), $this->user->g_report_flood, $this->user->g_report_flood - (time() - $this->user->last_report_sent)), 429);
}
// Get the topic ID
$topic = DB::for_table('posts')->select('topic_id')->where('id', $post_id);
$topic = $this->hook->fireDB('insert_report_topic_id', $topic);
$topic = $topic->find_one();
if (!$topic) {
throw new Error(__('Bad request'), 404);
}
// Get the subject and forum ID
$report['select'] = array('subject', 'forum_id');
$report = DB::for_table('topics')->select_many($report['select'])->where('id', $topic['topic_id']);
$report = $this->hook->fireDB('insert_report_get_subject', $report);
$report = $report->find_one();
if (!$report) {
throw new Error(__('Bad request'), 404);
}
// Should we use the internal report handling?
if ($this->config['o_report_method'] == '0' || $this->config['o_report_method'] == '2') {
// Insert the report
$query['insert'] = array('post_id' => $post_id, 'topic_id' => $topic['topic_id'], 'forum_id' => $report['forum_id'], 'reported_by' => $this->user->id, 'created' => time(), 'message' => $reason);
$query = DB::for_table('reports')->create()->set($query['insert']);
$query = $this->hook->fireDB('insert_report_query', $query);
$query = $query->save();
}
// Should we email the report?
if ($this->config['o_report_method'] == '1' || $this->config['o_report_method'] == '2') {
// We send it to the complete mailing-list in one swoop
if ($this->config['o_mailing_list'] != '') {
// Load the "new report" template
$mail_tpl = trim(file_get_contents($this->feather->forum_env['FEATHER_ROOT'] . 'featherbb/lang/' . $this->user->language . '/mail_templates/new_report.tpl'));
$mail_tpl = $this->hook->fire('insert_report_mail_tpl', $mail_tpl);
// The first row contains the subject
$first_crlf = strpos($mail_tpl, "\n");
$mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
$mail_message = trim(substr($mail_tpl, $first_crlf));
$mail_subject = str_replace('<forum_id>', $report['forum_id'], $mail_subject);
$mail_subject = str_replace('<topic_subject>', $report['subject'], $mail_subject);
$mail_message = str_replace('<username>', $this->user->username, $mail_message);
$mail_message = str_replace('<post_url>', $this->feather->urlFor('viewPost', ['pid' => $post_id]) . '#p' . $post_id, $mail_message);
$mail_message = str_replace('<reason>', $reason, $mail_message);
$mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
$mail_message = $this->hook->fire('insert_report_mail_message', $mail_message);
$this->email->feather_mail($this->config['o_mailing_list'], $mail_subject, $mail_message);
}
}
$last_report_sent = DB::for_table('users')->where('id', $this->user->id)->find_one()->set('last_report_sent', time());
$last_report_sent = $this->hook->fireDB('insert_last_report_sent', $last_report_sent);
$last_report_sent = $last_report_sent->save();
Url::redirect($this->feather->urlFor('viewPost', ['pid' => $post_id]) . '#p' . $post_id, __('Report redirect'));
}
示例3: update_profile
public function update_profile($id, $info, $section)
{
$info = Container::get('hooks')->fire('model.profile.update_profile_start', $info, $id, $section);
$username_updated = false;
$section = Container::get('hooks')->fire('model.profile.update_profile_section', $section, $id, $info);
// Validate input depending on section
switch ($section) {
case 'essentials':
$form = array('timezone' => floatval(Input::post('form_timezone')), 'dst' => Input::post('form_dst') ? '1' : '0', 'time_format' => intval(Input::post('form_time_format')), 'date_format' => intval(Input::post('form_date_format')));
// Make sure we got a valid language string
if (Input::post('form_language')) {
$languages = \FeatherBB\Core\Lister::getLangs();
$form['language'] = Utils::trim(Input::post('form_language'));
if (!in_array($form['language'], $languages)) {
throw new Error(__('Bad request'), 404);
}
}
if (User::get()->is_admmod) {
$form['admin_note'] = Utils::trim(Input::post('admin_note'));
// Are we allowed to change usernames?
if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN') || User::get()->g_moderator == '1' && User::get()->g_mod_rename_users == '1') {
$form['username'] = Utils::trim(Input::post('req_username'));
if ($form['username'] != $info['old_username']) {
$errors = '';
$errors = $this->check_username($form['username'], $errors, $id);
if (!empty($errors)) {
throw new Error($errors[0]);
}
$username_updated = true;
}
}
// We only allow administrators to update the post count
if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN')) {
$form['num_posts'] = intval(Input::post('num_posts'));
}
}
if (ForumSettings::get('o_regs_verify') == '0' || User::get()->is_admmod) {
// Validate the email address
$form['email'] = strtolower(Utils::trim(Input::post('req_email')));
if (!Container::get('email')->is_valid_email($form['email'])) {
throw new Error(__('Invalid email'));
}
}
break;
case 'personal':
$form = array('realname' => Input::post('form_realname') ? Utils::trim(Input::post('form_realname')) : '', 'url' => Input::post('form_url') ? Utils::trim(Input::post('form_url')) : '', 'location' => Input::post('form_location') ? Utils::trim(Input::post('form_location')) : '');
// Add http:// if the URL doesn't contain it already (while allowing https://, too)
if (User::get()->g_post_links == '1') {
if ($form['url'] != '') {
$url = Url::is_valid($form['url']);
if ($url === false) {
throw new Error(__('Invalid website URL'));
}
$form['url'] = $url['url'];
}
} else {
if (!empty($form['url'])) {
throw new Error(__('Website not allowed'));
}
$form['url'] = '';
}
if (User::get()->g_id == ForumEnv::get('FEATHER_ADMIN')) {
$form['title'] = Utils::trim(Input::post('title'));
} elseif (User::get()->g_set_title == '1') {
$form['title'] = Utils::trim(Input::post('title'));
if ($form['title'] != '') {
// A list of words that the title may not contain
// If the language is English, there will be some duplicates, but it's not the end of the world
$forbidden = array('member', 'moderator', 'administrator', 'banned', 'guest', utf8_strtolower(__('Member')), utf8_strtolower(__('Moderator')), utf8_strtolower(__('Administrator')), utf8_strtolower(__('Banned')), utf8_strtolower(__('Guest')));
if (in_array(utf8_strtolower($form['title']), $forbidden)) {
throw new Error(__('Forbidden title'));
}
}
}
break;
case 'messaging':
$form = array('jabber' => Utils::trim(Input::post('form_jabber')), 'icq' => Utils::trim(Input::post('form_icq')), 'msn' => Utils::trim(Input::post('form_msn')), 'aim' => Utils::trim(Input::post('form_aim')), 'yahoo' => Utils::trim(Input::post('form_yahoo')));
// If the ICQ UIN contains anything other than digits it's invalid
if (preg_match('%[^0-9]%', $form['icq'])) {
throw new Error(__('Bad ICQ'));
}
break;
case 'personality':
$form = array();
// Clean up signature from POST
if (ForumSettings::get('o_signatures') == '1') {
$form['signature'] = Utils::linebreaks(Utils::trim(Input::post('signature')));
// Validate signature
if (Utils::strlen($form['signature']) > ForumSettings::get('p_sig_length')) {
throw new Error(sprintf(__('Sig too long'), ForumSettings::get('p_sig_length'), Utils::strlen($form['signature']) - ForumSettings::get('p_sig_length')));
} elseif (substr_count($form['signature'], "\n") > ForumSettings::get('p_sig_lines') - 1) {
throw new Error(sprintf(__('Sig too many lines'), ForumSettings::get('p_sig_lines')));
} elseif ($form['signature'] && ForumSettings::get('p_sig_all_caps') == '0' && Utils::is_all_uppercase($form['signature']) && !User::get()->is_admmod) {
$form['signature'] = utf8_ucwords(utf8_strtolower($form['signature']));
}
// Validate BBCode syntax
if (ForumSettings::get('p_sig_bbcode') == '1') {
$errors = array();
$form['signature'] = Container::get('parser')->preparse_bbcode($form['signature'], $errors, true);
if (count($errors) > 0) {
//.........这里部分代码省略.........
示例4:
" /><br /></label>
<?php
}
?>
<label class="required"><strong><?php
_e('Message');
?>
<span><?php
_e('Required');
?>
</span></strong><br />
<textarea name="req_message" id="req_message" rows="20" cols="95" tabindex="<?php
echo $cur_index++;
?>
"><?php
echo Input::post('req_message') ? Utils::linebreaks(Utils::trim(Utils::escape(Input::post('req_message')))) : (isset($quote) ? $quote : '');
?>
</textarea><br /></label>
<ul class="bblinks">
<li><span><a href="<?php
echo Router::pathFor('help') . '#bbcode';
?>
" onclick="window.open(this.href); return false;"><?php
_e('BBCode');
?>
ok</a> <?php
echo ForumSettings::get('p_message_bbcode') == '1' ? __('on') : __('off');
?>
</span></li>
<li><span><a href="<?php
echo Router::pathFor('help') . '#url';
示例5: update_options
public function update_options()
{
$form = array('board_title' => Utils::trim($this->request->post('form_board_title')), 'board_desc' => Utils::trim($this->request->post('form_board_desc')), 'base_url' => Utils::trim($this->request->post('form_base_url')), 'default_timezone' => floatval($this->request->post('form_default_timezone')), 'default_dst' => $this->request->post('form_default_dst') != '1' ? '0' : '1', 'default_lang' => Utils::trim($this->request->post('form_default_lang')), 'default_style' => Utils::trim($this->request->post('form_default_style')), 'time_format' => Utils::trim($this->request->post('form_time_format')), 'date_format' => Utils::trim($this->request->post('form_date_format')), 'timeout_visit' => intval($this->request->post('form_timeout_visit')) > 0 ? intval($this->request->post('form_timeout_visit')) : 1, 'timeout_online' => intval($this->request->post('form_timeout_online')) > 0 ? intval($this->request->post('form_timeout_online')) : 1, 'redirect_delay' => intval($this->request->post('form_redirect_delay')) >= 0 ? intval($this->request->post('form_redirect_delay')) : 0, 'show_version' => $this->request->post('form_show_version') != '1' ? '0' : '1', 'show_user_info' => $this->request->post('form_show_user_info') != '1' ? '0' : '1', 'show_post_count' => $this->request->post('form_show_post_count') != '1' ? '0' : '1', 'smilies' => $this->request->post('form_smilies') != '1' ? '0' : '1', 'smilies_sig' => $this->request->post('form_smilies_sig') != '1' ? '0' : '1', 'make_links' => $this->request->post('form_make_links') != '1' ? '0' : '1', 'topic_review' => intval($this->request->post('form_topic_review')) >= 0 ? intval($this->request->post('form_topic_review')) : 0, 'disp_topics_default' => intval($this->request->post('form_disp_topics_default')), 'disp_posts_default' => intval($this->request->post('form_disp_posts_default')), 'indent_num_spaces' => intval($this->request->post('form_indent_num_spaces')) >= 0 ? intval($this->request->post('form_indent_num_spaces')) : 0, 'quote_depth' => intval($this->request->post('form_quote_depth')) > 0 ? intval($this->request->post('form_quote_depth')) : 1, 'quickpost' => $this->request->post('form_quickpost') != '1' ? '0' : '1', 'users_online' => $this->request->post('form_users_online') != '1' ? '0' : '1', 'censoring' => $this->request->post('form_censoring') != '1' ? '0' : '1', 'signatures' => $this->request->post('form_signatures') != '1' ? '0' : '1', 'show_dot' => $this->request->post('form_show_dot') != '1' ? '0' : '1', 'topic_views' => $this->request->post('form_topic_views') != '1' ? '0' : '1', 'quickjump' => $this->request->post('form_quickjump') != '1' ? '0' : '1', 'gzip' => $this->request->post('form_gzip') != '1' ? '0' : '1', 'search_all_forums' => $this->request->post('form_search_all_forums') != '1' ? '0' : '1', 'additional_navlinks' => Utils::trim($this->request->post('form_additional_navlinks')), 'feed_type' => intval($this->request->post('form_feed_type')), 'feed_ttl' => intval($this->request->post('form_feed_ttl')), 'report_method' => intval($this->request->post('form_report_method')), 'mailing_list' => Utils::trim($this->request->post('form_mailing_list')), 'avatars' => $this->request->post('form_avatars') != '1' ? '0' : '1', 'avatars_dir' => Utils::trim($this->request->post('form_avatars_dir')), 'avatars_width' => intval($this->request->post('form_avatars_width')) > 0 ? intval($this->request->post('form_avatars_width')) : 1, 'avatars_height' => intval($this->request->post('form_avatars_height')) > 0 ? intval($this->request->post('form_avatars_height')) : 1, 'avatars_size' => intval($this->request->post('form_avatars_size')) > 0 ? intval($this->request->post('form_avatars_size')) : 1, 'admin_email' => strtolower(Utils::trim($this->request->post('form_admin_email'))), 'webmaster_email' => strtolower(Utils::trim($this->request->post('form_webmaster_email'))), 'forum_subscriptions' => $this->request->post('form_forum_subscriptions') != '1' ? '0' : '1', 'topic_subscriptions' => $this->request->post('form_topic_subscriptions') != '1' ? '0' : '1', 'smtp_host' => Utils::trim($this->request->post('form_smtp_host')), 'smtp_user' => Utils::trim($this->request->post('form_smtp_user')), 'smtp_ssl' => $this->request->post('form_smtp_ssl') != '1' ? '0' : '1', 'regs_allow' => $this->request->post('form_regs_allow') != '1' ? '0' : '1', 'regs_verify' => $this->request->post('form_regs_verify') != '1' ? '0' : '1', 'regs_report' => $this->request->post('form_regs_report') != '1' ? '0' : '1', 'rules' => $this->request->post('form_rules') != '1' ? '0' : '1', 'rules_message' => Utils::trim($this->request->post('form_rules_message')), 'default_email_setting' => intval($this->request->post('form_default_email_setting')), 'announcement' => $this->request->post('form_announcement') != '1' ? '0' : '1', 'announcement_message' => Utils::trim($this->request->post('form_announcement_message')), 'maintenance' => $this->request->post('form_maintenance') != '1' ? '0' : '1', 'maintenance_message' => Utils::trim($this->request->post('form_maintenance_message')));
$form = $this->hook->fire('options.update_options.form', $form);
if ($form['board_title'] == '') {
throw new Error(__('Must enter title message'), 400);
}
// Make sure base_url doesn't end with a slash
if (substr($form['base_url'], -1) == '/') {
$form['base_url'] = substr($form['base_url'], 0, -1);
}
// Convert IDN to Punycode if needed
if (preg_match('/[^\\x00-\\x7F]/', $form['base_url'])) {
if (!function_exists('idn_to_ascii')) {
throw new Error(__('Base URL problem'), 400);
} else {
$form['base_url'] = idn_to_ascii($form['base_url']);
}
}
$languages = \FeatherBB\Core\Lister::getLangs();
if (!in_array($form['default_lang'], $languages)) {
throw new Error(__('Bad request'), 404);
}
$styles = \FeatherBB\Core\Lister::getStyles();
if (!in_array($form['default_style'], $styles)) {
throw new Error(__('Bad request'), 404);
}
if ($form['time_format'] == '') {
$form['time_format'] = 'H:i:s';
}
if ($form['date_format'] == '') {
$form['date_format'] = 'Y-m-d';
}
if (!$this->email->is_valid_email($form['admin_email'])) {
throw new Error(__('Invalid e-mail message'), 400);
}
if (!$this->email->is_valid_email($form['webmaster_email'])) {
throw new Error(__('Invalid webmaster e-mail message'), 400);
}
if ($form['mailing_list'] != '') {
$form['mailing_list'] = strtolower(preg_replace('%\\s%S', '', $form['mailing_list']));
}
// Make sure avatars_dir doesn't end with a slash
if (substr($form['avatars_dir'], -1) == '/') {
$form['avatars_dir'] = substr($form['avatars_dir'], 0, -1);
}
if ($form['additional_navlinks'] != '') {
$form['additional_navlinks'] = Utils::trim(Utils::linebreaks($form['additional_navlinks']));
}
// Change or enter a SMTP password
if ($this->request->post('form_smtp_change_pass')) {
$smtp_pass1 = $this->request->post('form_smtp_pass1') ? Utils::trim($this->request->post('form_smtp_pass1')) : '';
$smtp_pass2 = $this->request->post('form_smtp_pass2') ? Utils::trim($this->request->post('form_smtp_pass2')) : '';
if ($smtp_pass1 == $smtp_pass2) {
$form['smtp_pass'] = $smtp_pass1;
} else {
throw new Error(__('SMTP passwords did not match'), 400);
}
}
if ($form['announcement_message'] != '') {
$form['announcement_message'] = Utils::linebreaks($form['announcement_message']);
} else {
$form['announcement_message'] = __('Enter announcement here');
$form['announcement'] = '0';
}
if ($form['rules_message'] != '') {
$form['rules_message'] = Utils::linebreaks($form['rules_message']);
} else {
$form['rules_message'] = __('Enter rules here');
$form['rules'] = '0';
}
if ($form['maintenance_message'] != '') {
$form['maintenance_message'] = Utils::linebreaks($form['maintenance_message']);
} else {
$form['maintenance_message'] = __('Default maintenance message');
$form['maintenance'] = '0';
}
// Make sure the number of displayed topics and posts is between 3 and 75
if ($form['disp_topics_default'] < 3) {
$form['disp_topics_default'] = 3;
} elseif ($form['disp_topics_default'] > 75) {
$form['disp_topics_default'] = 75;
}
if ($form['disp_posts_default'] < 3) {
$form['disp_posts_default'] = 3;
} elseif ($form['disp_posts_default'] > 75) {
$form['disp_posts_default'] = 75;
}
if ($form['feed_type'] < 0 || $form['feed_type'] > 2) {
throw new Error(__('Bad request'), 400);
}
if ($form['feed_ttl'] < 0) {
throw new Error(__('Bad request'), 400);
}
if ($form['report_method'] < 0 || $form['report_method'] > 2) {
throw new Error(__('Bad request'), 400);
}
if ($form['default_email_setting'] < 0 || $form['default_email_setting'] > 2) {
throw new Error(__('Bad request'), 400);
}
//.........这里部分代码省略.........
示例6:
<?php
}
?>
<label class="required"><strong><?php
_e('Message');
?>
<span><?php
_e('Required');
?>
</span></strong><br />
<script>postEditorToolbar('req_message');</script>
<textarea name="req_message" id="req_message" rows="20" cols="95" tabindex="<?php
echo $cur_index++;
?>
"><?php
echo $feather->request->post('req_message') ? Utils::linebreaks(Utils::trim(Utils::escape($feather->request->post('req_message')))) : (isset($quote) ? $quote : '');
?>
</textarea><br /></label>
<ul class="bblinks">
<li>ok</li>
<li><span><a href="<?php
echo $feather->urlFor('help') . '#bbcode';
?>
" onclick="window.open(this.href); return false;"><?php
_e('BBCode');
?>
ok</a> <?php
echo $feather->forum_settings['p_message_bbcode'] == '1' ? __('on') : __('off');
?>
</span></li>
<li><span><a href="<?php
示例7: setup_variables
public function setup_variables($cur_post, $is_admmod, $can_edit_subject, $errors)
{
$this->hook->fire('setup_variables_start');
$post = array();
$post['hide_smilies'] = $this->request->post('hide_smilies') ? '1' : '0';
$post['stick_topic'] = $this->request->post('stick_topic') ? '1' : '0';
if (!$is_admmod) {
$post['stick_topic'] = $cur_post['sticky'];
}
// Clean up message from POST
$post['message'] = Utils::linebreaks(Utils::trim($this->request->post('req_message')));
// Validate BBCode syntax
if ($this->config['p_message_bbcode'] == '1') {
$post['message'] = $this->feather->parser->preparse_bbcode($post['message'], $errors);
}
// Replace four-byte characters (MySQL cannot handle them)
$post['message'] = Utils::strip_bad_multibyte_chars($post['message']);
// Get the subject
if ($can_edit_subject) {
$post['subject'] = Utils::trim($this->request->post('req_subject'));
}
$post = $this->hook->fire('setup_variables_edit', $post);
return $post;
}
示例8: setup_variables
public function setup_variables($errors, $is_admmod)
{
$post = array();
$post = $this->hook->fire('setup_variables_start', $post, $errors, $is_admmod);
if (!$this->user->is_guest) {
$post['username'] = $this->user->username;
$post['email'] = $this->user->email;
} else {
$post['username'] = Utils::trim($this->request->post('req_username'));
$post['email'] = strtolower(Utils::trim($this->config['p_force_guest_email'] == '1' ? $this->request->post('req_email') : $this->request->post('email')));
}
if ($this->request->post('req_subject')) {
$post['subject'] = Utils::trim($this->request->post('req_subject'));
}
$post['hide_smilies'] = $this->request->post('hide_smilies') ? '1' : '0';
$post['subscribe'] = $this->request->post('subscribe') ? '1' : '0';
$post['stick_topic'] = $this->request->post('stick_topic') && $is_admmod ? '1' : '0';
$post['message'] = Utils::linebreaks(Utils::trim($this->request->post('req_message')));
// Validate BBCode syntax
if ($this->config['p_message_bbcode'] == '1') {
$post['message'] = $this->feather->parser->preparse_bbcode($post['message'], $errors);
}
// Replace four-byte characters (MySQL cannot handle them)
$post['message'] = Utils::strip_bad_multibyte_chars($post['message']);
$post['time'] = time();
$post = $this->hook->fire('setup_variables', $post);
return $post;
}