• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pun_trim函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中pun_trim函数的典型用法代码示例。如果您正苦于以下问题:PHP pun_trim函数的具体用法?PHP pun_trim怎么用?PHP pun_trim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pun_trim函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: pun_mail

function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '')
{
    global $pun_config, $lang_common;
    // Default sender/return address
    $from_name = str_replace('"', '', $pun_config['o_board_title'] . ' ' . $lang_common['Mailer']);
    $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)));
    // Set up some headers to take advantage of UTF-8
    $from = "=?UTF-8?B?" . base64_encode($from_name) . "?=" . ' <' . $from_email . '>';
    $subject = "=?UTF-8?B?" . base64_encode($subject) . "?=";
    $headers = 'From: ' . $from . "\r\n" . 'Date: ' . gmdate('r') . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-transfer-encoding: 8bit' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n" . 'X-Mailer: FluxBB Mailer';
    // If we specified a reply-to email, we deal with it here
    if (!empty($reply_to_email)) {
        $reply_to = "=?UTF-8?B?" . base64_encode($reply_to_name) . "?=" . ' <' . $reply_to_email . '>';
        $headers .= "\r\n" . 'Reply-To: ' . $reply_to;
    }
    // Make sure all linebreaks are CRLF in message (and strip out any NULL bytes)
    $message = str_replace(array("\n", ""), array("\r\n", ''), pun_linebreaks($message));
    if ($pun_config['o_smtp_host'] != '') {
        smtp_mail($to, $subject, $message, $headers);
    } else {
        // Change the linebreaks used in the headers according to OS
        if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') {
            $headers = str_replace("\r\n", "\r", $headers);
        } else {
            if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
                $headers = str_replace("\r\n", "\n", $headers);
            }
        }
        mail($to, $subject, $message, $headers);
    }
}
开发者ID:highpictv,项目名称:forum,代码行数:38,代码来源:email.php


示例2: error

     }
     $db->query('DELETE FROM ' . $db->prefix . 'bans WHERE id=' . $ban_id) or error('Unable to delete ban', __FILE__, __LINE__, $db->error());
     // Regenerate the bans cache
     if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
         require PUN_ROOT . 'include/cache.php';
     }
     generate_bans_cache();
     redirect('admin_bans.php', $lang_admin_bans['Ban removed redirect']);
 } else {
     if (isset($_GET['find_ban'])) {
         $form = isset($_GET['form']) ? $_GET['form'] : array();
         // trim() all elements in $form
         $form = array_map('pun_trim', $form);
         $conditions = $query_str = array();
         $expire_after = isset($_GET['expire_after']) ? pun_trim($_GET['expire_after']) : '';
         $expire_before = isset($_GET['expire_before']) ? pun_trim($_GET['expire_before']) : '';
         $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'ip', 'email', 'expire')) ? 'b.' . $_GET['order_by'] : 'b.username';
         $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC';
         $query_str[] = 'order_by=' . $order_by;
         $query_str[] = 'direction=' . $direction;
         // Try to convert date/time to timestamps
         if ($expire_after != '') {
             $query_str[] = 'expire_after=' . $expire_after;
             $expire_after = strtotime($expire_after);
             if ($expire_after === false || $expire_after == -1) {
                 message($lang_admin_bans['Invalid date message']);
             }
             $conditions[] = 'b.expire>' . $expire_after;
         }
         if ($expire_before != '') {
             $query_str[] = 'expire_before=' . $expire_before;
开发者ID:HawesDomingue,项目名称:mechanic-watson,代码行数:31,代码来源:admin_bans.php


示例3: message

     message($lang_common['Bad request']);
 }
 if ($num_post == 1) {
     $del_old_topic = TRUE;
 }
 // Load the movepost.php language file
 require PUN_ROOT . 'lang/' . $pun_user['language'] . '/movepost.php';
 if (isset($_POST['form_sent'])) {
     $form_sent = intval($_POST['form_sent']);
     $new_topic_id = $_POST['topic_to_move'];
     if ($new_topic_id == '' && $form_sent != 2) {
         message($lang_movepost['Bad topic']);
     }
     // If it's a creation of a new topic
     if ($form_sent == 2) {
         $new_subject = pun_trim($_POST['create_topic']);
         if ($new_subject == '') {
             message($form_sent . $lang_movepost['Bad new topic']);
         }
         if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($new_subject) == $new_subject && $pun_user['g_id'] > PUN_MOD) {
         }
         $new_subject = ucwords(strtolower($new_subject));
         // Create the topic
         $db->query('INSERT INTO ' . $db->prefix . 'topics (subject, forum_id) VALUES(\'' . $db->escape($new_subject) . '\', ' . $fid . ')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
         $new_topic_id = $db->insert_id();
     }
     // If all the posts move
     if (isset($_POST['move_all_post'])) {
         // Create the list of the post
         $result = $db->query('SELECT id FROM ' . $db->prefix . 'posts WHERE topic_id=' . $old_topic_id) or error('Unable to update user last visit data', __FILE__, __LINE__, $db->error());
         if ($db->num_rows($result)) {
开发者ID:neofutur,项目名称:MyBestBB,代码行数:31,代码来源:movepost.php


示例4: pun_mail

function pun_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '')
{
    global $pun_config, $lang;
    // Default sender/return address
    $from_name = $lang->t('Mailer', $pun_config['o_board_title']);
    $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)));
    // Set up some headers to take advantage of UTF-8
    $from = '"' . encode_mail_text($from_name) . '" <' . $from_email . '>';
    $subject = encode_mail_text($subject);
    $headers = 'From: ' . $from . "\r\n" . 'Date: ' . gmdate('r') . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-transfer-encoding: 8bit' . "\r\n" . 'Content-type: text/plain; charset=utf-8' . "\r\n" . 'X-Mailer: FluxBB Mailer';
    // If we specified a reply-to email, we deal with it here
    if (!empty($reply_to_email)) {
        $reply_to = '"' . encode_mail_text($reply_to_name) . '" <' . $reply_to_email . '>';
        $headers .= "\r\n" . 'Reply-To: ' . $reply_to;
    }
    // Make sure all linebreaks are LF in message (and strip out any NULL bytes)
    $message = str_replace("", '', pun_linebreaks($message));
    if ($pun_config['o_smtp_host'] != '') {
        // Headers should be \r\n
        // Message should be ??
        $message = str_replace("\n", "\r\n", $message);
        smtp_mail($to, $subject, $message, $headers);
    } else {
        // Headers should be \r\n
        // Message should be \n
        mail($to, $subject, $message, $headers);
    }
}
开发者ID:rakete,项目名称:affenbande-fluxbb,代码行数:35,代码来源:email.php


示例5: seconds_st

     $_POST['merge'] = 1;
 } else {
     $_POST['merge'] = 0;
 }
 if (!$pun_user['is_guest'] && !$fid && (($is_admmod && $_POST['merge']) == 1 || !$is_admmod) && $cur_posting['poster_id'] && $cur_posting['message'] && $_SERVER['REQUEST_TIME'] - $cur_posting['posted'] < $pun_config['o_timeout_merge']) {
     // Preparing separator
     $merged_after = $_SERVER['REQUEST_TIME'] - $cur_posting['posted'];
     $merged_sec = $merged_after % 60;
     $merged_min = $merged_after / 60 % 60;
     $merged_hours = $merged_after / 3600 % 24;
     $merged_days = $merged_after / 86400 % 31;
     $s_st = $merged_sec ? seconds_st($merged_sec) : '';
     $m_st = $merged_min ? minutes_st($merged_min) : '';
     $h_st = $merged_hours ? hours_st($merged_hours) : '';
     $d_st = $merged_days ? days_st($merged_days) : '';
     $message = pun_linebreaks(pun_trim('[color=#bbb][i]' . $lang_post['Added'] . $d_st . ' ' . $h_st . ' ' . $m_st . ' ' . $s_st . ': [/i][/color]')) . "\n" . $message;
     $merged = true;
 }
 // MERGE POSTS END
 // If it's a reply
 if ($tid) {
     if (!$pun_user['is_guest']) {
         // Insert the new post
         if ($merged) {
             $message = $cur_posting['message'] . "\n" . $message;
             $db->query('UPDATE ' . $db->prefix . 'posts SET message=\'' . $db->escape($message) . '\' WHERE id=' . $cur_posting['post_id']) or error('Unable to merge post', __FILE__, __LINE__, $db->error());
             $new_pid = $cur_posting['post_id'];
         } else {
             // Insert the new post
             $db->query('INSERT INTO ' . $db->prefix . 'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id) VALUES(\'' . $db->escape($username) . '\', ' . $pun_user['id'] . ', \'' . get_remote_address() . '\', \'' . $db->escape($message) . '\', \'' . $hide_smilies . '\', ' . $_SERVER['REQUEST_TIME'] . ', ' . $tid . ')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
             $new_pid = $db->insert_id();
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:31,代码来源:post.php


示例6: intval

             }
         }
         if ($form['disp_posts'] != '') {
             $form['disp_posts'] = intval($form['disp_posts']);
             if ($form['disp_posts'] < 3) {
                 $form['disp_posts'] = 3;
             } else {
                 if ($form['disp_posts'] > 75) {
                     $form['disp_posts'] = 75;
                 }
             }
         }
         // Make sure we got a valid style string
         if (isset($_POST['form']['style'])) {
             $styles = forum_list_styles();
             $form['style'] = pun_trim($_POST['form']['style']);
             if (!in_array($form['style'], $styles)) {
                 message($lang_common['Bad request']);
             }
         }
         break;
     case 'privacy':
         $form = array('email_setting' => intval($_POST['form']['email_setting']), 'notify_with_post' => isset($_POST['form']['notify_with_post']) ? '1' : '0', 'auto_notify' => isset($_POST['form']['auto_notify']) ? '1' : '0');
         if ($form['email_setting'] < 0 || $form['email_setting'] > 2) {
             $form['email_setting'] = $pun_config['o_default_email_setting'];
         }
         break;
     default:
         message($lang_common['Bad request']);
 }
 // Single quotes around non-empty values and NULL for empty values
开发者ID:highpictv,项目名称:forum,代码行数:31,代码来源:profile.php


示例7: array_intersect_assoc

                 $author_results[$temp['post_id']] = $temp['topic_id'];
             }
             $db->free_result($result);
         }
     }
     // If we searched for both keywords and author name we want the intersection between the results
     if ($author && $keywords) {
         $search_ids = array_intersect_assoc($keyword_results, $author_results);
         $search_type = array('both', array($keywords, pun_trim($_GET['author'])), implode(',', $forums), $search_in);
     } else {
         if ($keywords) {
             $search_ids = $keyword_results;
             $search_type = array('keywords', $keywords, implode(',', $forums), $search_in);
         } else {
             $search_ids = $author_results;
             $search_type = array('author', pun_trim($_GET['author']), implode(',', $forums), $search_in);
         }
     }
     unset($keyword_results, $author_results);
     if ($show_as == 'topics') {
         $search_ids = array_values($search_ids);
     } else {
         $search_ids = array_keys($search_ids);
     }
     $search_ids = array_unique($search_ids);
     $num_hits = count($search_ids);
     if (!$num_hits) {
         message($lang_search['No hits']);
     }
 } else {
     if ($action == 'show_new' || $action == 'show_recent' || $action == 'show_replies' || $action == 'show_user_posts' || $action == 'show_user_topics' || $action == 'show_subscriptions' || $action == 'show_unanswered') {
开发者ID:HawesDomingue,项目名称:mechanic-watson,代码行数:31,代码来源:search.php


示例8: confirm_referrer

    ?>
" tabindex="6" /></p>
			</form>
		</div>
	</div>
	<div class="clearer"></div>
</div>
<?php 
    require PUN_ROOT . 'footer.php';
} else {
    if (isset($_POST['add_edit_ban'])) {
        confirm_referrer('admin_bans.php');
        $ban_user = pun_trim($_POST['ban_user']);
        $ban_ip = trim($_POST['ban_ip']);
        $ban_email = strtolower(trim($_POST['ban_email']));
        $ban_message = pun_trim($_POST['ban_message']);
        $ban_expire = trim($_POST['ban_expire']);
        if ($ban_user == '' && $ban_ip == '' && $ban_email == '') {
            message($lang_admin_bans['Must enter message']);
        } else {
            if (strtolower($ban_user) == 'guest') {
                message($lang_admin_bans['Cannot ban guest message']);
            }
        }
        // Validate IP/IP range (it's overkill, I know)
        if ($ban_ip != '') {
            $ban_ip = preg_replace('/\\s{2,}/S', ' ', $ban_ip);
            $addresses = explode(' ', $ban_ip);
            $addresses = array_map('pun_trim', $addresses);
            for ($i = 0; $i < count($addresses); ++$i) {
                if (strpos($addresses[$i], ':') !== false) {
开发者ID:highpictv,项目名称:forum,代码行数:31,代码来源:admin_bans.php


示例9: setMessage

 /**
  * setMessage
  *
  * @param array $args
  * @return array
  * @throws Exception
  */
 public function setMessage($args)
 {
     $message = $args['message'];
     $topicId = $args['topicId'];
     $hideSmiles = $args['hideSmiles'];
     $topicId = intval($topicId);
     if ($topicId <= 0) {
         throw new Exception($this->_lang['Bad request']);
     }
     if ($this->_pun_user['is_guest']) {
         throw new Exception($this->_lang['Bad request']);
     }
     if ($this->_pun_user['last_post'] && $_SERVER['REQUEST_TIME'] - $this->_pun_user['last_post'] < $this->_pun_user['g_post_flood']) {
         throw new Exception($this->_lang['Bad request']);
     }
     // Clean up message
     $message = pun_linebreaks(pun_trim($message));
     if (!$message) {
         throw new Exception($this->_lang['Bad request']);
     } else {
         if (mb_strlen($message) > 65535) {
             throw new Exception($this->_lang['Bad request']);
         } else {
             if (!$this->_pun_config['p_message_all_caps'] && mb_strtoupper($message) == $message && $this->_pun_user['g_id'] > PUN_MOD) {
                 $message = ucwords(mb_strtolower($message));
             }
         }
     }
     convert_forum_url($message);
     // Insert the new post
     $r = $this->_db->query('
         INSERT INTO ' . $this->_db->prefix . 'posts (
             poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id
         ) VALUES (
             \'' . $this->_db->escape($this->_pun_user['username']) . '\',
             ' . $this->_pun_user['id'] . ',
             \'' . get_remote_address() . '\',
             \'' . $this->_db->escape($message) . '\',
             \'' . intval($hideSmiles) . '\',
             ' . $_SERVER['REQUEST_TIME'] . ',
             ' . $topicId . '
         )
     ');
     if (!$r) {
         throw new Exception($this->_db->error());
     }
     if (!$this->_db->affected_rows()) {
         throw new Exception($this->_lang['Bad request']);
     }
     $id = $this->_db->insert_id();
     // Count number of replies in the topic
     $result = $this->_db->query('
         SELECT COUNT(1)
         FROM ' . $this->_db->prefix . 'posts
         WHERE topic_id=' . $topicId);
     $num_replies = $this->_db->result($result, 0) - 1;
     // Update topic
     $this->_db->query('
         UPDATE ' . $this->_db->prefix . 'topics
         SET num_replies=' . $num_replies . ',
         last_post=' . $_SERVER['REQUEST_TIME'] . ',
         last_post_id=' . $id . ',
         last_poster=\'' . $this->_db->escape($this->_pun_user['username']) . '\'
         WHERE id=' . $topicId);
     //update_search_index('post', $id, $message);
     $result = $this->_db->query('
         SELECT f.id
         FROM ' . $this->_db->prefix . 'topics AS t
         INNER JOIN ' . $this->_db->prefix . 'forums AS f ON f.id=t.forum_id
         LEFT JOIN ' . $this->_db->prefix . 'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $this->_pun_user['g_id'] . ')
         WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=' . $topicId);
     $forumId = $this->_db->result($result, 0);
     update_forum($forumId);
     generate_rss();
     return array('message' => $this->_parseMessage($message, $hideSmiles), 'poster' => $this->_pun_user['username'], 'posted' => $_SERVER['REQUEST_TIME']);
 }
开发者ID:tipsun91,项目名称:punbb-mod,代码行数:83,代码来源:Informer.inc.php


示例10: isset

<?php

$skill = isset($_GET['skill']) ? strtolower(pun_trim($_GET['skill'])) : 'combat';
$username = isset($_GET['username']) ? pun_trim($_GET['username']) : '';
$show_group = !isset($_GET['show_group']) || intval($_GET['show_group']) < -1 && intval($_GET['show_group']) > 2 ? -1 : intval($_GET['show_group']);
$sort_by = !isset($_GET['sort_by']) || $_GET['sort_by'] != 'username' && $_GET['sort_by'] != 'owner' && $_GET['sort_by'] != $skill && $_GET['sort_by'] != 'skill_total' && $_GET['sort_by'] != 'creation_date' ? isset($_GET['skill']) ? 'skl_' . $skill : 'skill_total' : trim($_GET['sort_by']);
$sort_dir = !isset($_GET['sort_dir']) || $_GET['sort_dir'] != 'ASC' && $_GET['sort_dir'] != 'DESC' ? 'DESC' : strtoupper($_GET['sort_dir']);
$country = isset($_GET['country']) ? pun_trim($_GET['country']) : false;
$char = isset($_GET['sort_char']) ? trim($_GET['sort_char']) : false;
$sort_friends = isset($_GET['sort_friends']);
$sort_kills = isset($_GET['sort_kills']);
if ($char) {
    $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'rscd_players WHERE user=' . $db->escape($char) . ' AND owner=' . $pun_user['id']) or error('Unable to check characters owner', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result)) {
        message('Invalid character (or maybe not yours!)');
    }
}
function extract_value($user)
{
    global $skill;
    if ($skill == 'combat') {
        return $user['combat'];
    } else {
        if ($skill == 'kills') {
            return $user['kills'];
        }
    }
    return experience_to_level($user['exp_' . $skill]);
}
function extract_exp($user)
{
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:31,代码来源:highscores.php


示例11: pun_trim

} else {
    $db_type = $_POST['req_db_type'];
    $db_host = pun_trim($_POST['req_db_host']);
    $db_name = pun_trim($_POST['req_db_name']);
    $db_username = pun_trim($_POST['db_username']);
    $db_password = pun_trim($_POST['db_password']);
    $db_prefix = pun_trim($_POST['db_prefix']);
    $username = pun_trim($_POST['req_username']);
    $email = strtolower(pun_trim($_POST['req_email']));
    $password1 = pun_trim($_POST['req_password1']);
    $password2 = pun_trim($_POST['req_password2']);
    $title = pun_trim($_POST['req_title']);
    $description = pun_trim($_POST['desc']);
    $base_url = pun_trim($_POST['req_base_url']);
    $default_lang = pun_trim($_POST['req_default_lang']);
    $default_style = pun_trim($_POST['req_default_style']);
    $alerts = array();
    // Make sure base_url doesn't end with a slash
    if (substr($base_url, -1) == '/') {
        $base_url = substr($base_url, 0, -1);
    }
    // Validate username and passwords
    if (pun_strlen($username) < 2) {
        $alerts[] = $lang_install['Username 1'];
    } else {
        if (pun_strlen($username) > 25) {
            // This usually doesn't happen since the form element only accepts 25 characters
            $alerts[] = $lang_install['Username 2'];
        } else {
            if (!strcasecmp($username, 'Guest')) {
                $alerts[] = $lang_install['Username 3'];
开发者ID:ArchLinuxJP,项目名称:archbbs-jp,代码行数:31,代码来源:install.php


示例12: parse_message

function parse_message($text, $hide_smilies)
{
    global $pun_config, $lang_common, $pun_user;
    if ($pun_config['o_censoring'] == '1') {
        $text = censor_words($text);
    }
    // Convert applicable characters to HTML entities
    $text = pun_htmlspecialchars($text);
    // If the message contains a code tag we have to split it up (text within [code][/code] shouldn't be touched)
    if (strpos($text, '[code]') !== false && strpos($text, '[/code]') !== false) {
        list($inside, $text) = extract_blocks($text, '[code]', '[/code]');
    }
    if ($pun_config['p_message_bbcode'] == '1' && strpos($text, '[') !== false && strpos($text, ']') !== false) {
        $text = do_bbcode($text);
    }
    if ($pun_config['o_smilies'] == '1' && $pun_user['show_smilies'] == '1' && $hide_smilies == '0') {
        $text = do_smilies($text);
    }
    // Deal with newlines, tabs and multiple spaces
    $pattern = array("\n", "\t", '  ', '  ');
    $replace = array('<br />', '&#160; &#160; ', '&#160; ', ' &#160;');
    $text = str_replace($pattern, $replace, $text);
    // If we split up the message before we have to concatenate it together again (code tags)
    if (isset($inside)) {
        $parts = explode("", $text);
        $text = '';
        foreach ($parts as $i => $part) {
            $text .= $part;
            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>';
            }
        }
    }
    return clean_paragraphs($text);
}
开发者ID:raphaelh,项目名称:ardechelibre.org,代码行数:36,代码来源:parser.php


示例13: message

    if ($search_for == '') {
        message($lang_admin_censoring['Must enter word message']);
    }
    $db->query('INSERT INTO ' . $db->prefix . 'censoring (search_for, replace_with) VALUES (\'' . $db->escape($search_for) . '\', \'' . $db->escape($replace_with) . '\')') or error('Unable to add censor word', __FILE__, __LINE__, $db->error());
    // Regenerate the censoring cache
    if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
        require PUN_ROOT . 'include/cache.php';
    }
    generate_censoring_cache();
    redirect('admin_censoring.php', $lang_admin_censoring['Word added redirect']);
} else {
    if (isset($_POST['update'])) {
        confirm_referrer('admin_censoring.php');
        $id = intval(key($_POST['update']));
        $search_for = pun_trim($_POST['search_for'][$id]);
        $replace_with = pun_trim($_POST['replace_with'][$id]);
        if ($search_for == '') {
            message($lang_admin_censoring['Must enter word message']);
        }
        $db->query('UPDATE ' . $db->prefix . 'censoring SET search_for=\'' . $db->escape($search_for) . '\', replace_with=\'' . $db->escape($replace_with) . '\' WHERE id=' . $id) or error('Unable to update censor word', __FILE__, __LINE__, $db->error());
        // Regenerate the censoring cache
        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
            require PUN_ROOT . 'include/cache.php';
        }
        generate_censoring_cache();
        redirect('admin_censoring.php', $lang_admin_censoring['Word updated redirect']);
    } else {
        if (isset($_POST['remove'])) {
            confirm_referrer('admin_censoring.php');
            $id = intval(key($_POST['remove']));
            $db->query('DELETE FROM ' . $db->prefix . 'censoring WHERE id=' . $id) or error('Unable to delete censor word', __FILE__, __LINE__, $db->error());
开发者ID:HawesDomingue,项目名称:mechanic-watson,代码行数:31,代码来源:admin_censoring.php


示例14: error

         $db->query('UPDATE ' . $db->prefix . 'users SET last_visit=' . $pun_user['logged'] . ' WHERE id=' . $pun_user['id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error());
     }
     pun_setcookie(1, pun_hash(uniqid(rand(), true)), time() + 31536000);
     redirect('index.php', $lang_login['Logout redirect']);
 } else {
     if ($action == 'forget' || $action == 'forget_2') {
         if (!$pun_user['is_guest']) {
             header('Location: index.php');
             exit;
         }
         if (isset($_POST['form_sent'])) {
             // Start with a clean slate
             $errors = array();
             require PUN_ROOT . 'include/email.php';
             // Validate the email address
             $email = strtolower(pun_trim($_POST['req_email']));
             if (!is_valid_email($email)) {
                 $errors[] = $lang_common['Invalid email'];
             }
             // Did everything go according to plan?
             if (empty($errors)) {
                 $result = $db->query('SELECT id, username, last_email_sent FROM ' . $db->prefix . 'users WHERE email=\'' . $db->escape($email) . '\'') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
                 if ($db->num_rows($result)) {
                     // Load the "activate password" template
                     $mail_tpl = trim(file_get_contents(PUN_ROOT . 'lang/' . $pun_user['language'] . '/mail_templates/activate_password.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));
                     // Do the generic replacements first (they apply to all emails sent out here)
                     $mail_message = str_replace('<base_url>', get_base_url() . '/', $mail_message);
开发者ID:beyondkeysystem,项目名称:testone,代码行数:31,代码来源:login.php


示例15: elseif

    if ($_POST['verified'] == 1) {
        $verified = '';
    } elseif ($_POST['verified'] == 0) {
        $verified = 'AND (group_id < 32000)';
    } else {
        $verified = 'AND (group_id = 32000)';
    }
    $prune = $_POST['prune_by'] == 1 ? 'registered' : 'last_visit';
    $user_time = time() - $_POST['days'] * 86400;
    $result = $db->query('DELETE FROM ' . $db->prefix . 'users WHERE (num_posts < ' . intval($_POST['posts']) . ') AND (' . $prune . ' < ' . intval($user_time) . ') AND (id > 2) AND (' . $admod_delete . ')' . $verified, true) or error('Unable to delete users', __FILE__, __LINE__, $db->error());
    $users_pruned = $db->affected_rows();
    message('Pruning complete. Users pruned ' . $users_pruned . '.');
} elseif (isset($_POST['add_user'])) {
    require PUN_ROOT . 'lang/' . $pun_user['language'] . '/prof_reg.php';
    require PUN_ROOT . 'lang/' . $pun_user['language'] . '/register.php';
    $username = pun_trim($_POST['username']);
    $email1 = strtolower(trim($_POST['email']));
    $email2 = strtolower(trim($_POST['email']));
    if ($_POST['random_pass'] == '1') {
        $password1 = random_pass(8);
        $password2 = $password1;
    } else {
        $password1 = trim($_POST['password']);
        $password2 = trim($_POST['password']);
    }
    // Convert multiple whitespace characters into one (to prevent people from registering with indistinguishable usernames)
    $username = preg_replace('#\\s+#s', ' ', $username);
    // Validate username and passwords
    if (strlen($username) < 2) {
        message($lang_prof_reg['Username too short']);
    } else {
开发者ID:neofutur,项目名称:MyBestBB,代码行数:31,代码来源:AP_User_management.php


示例16: redirect

     redirect('admin_forums.php', $lang_admin_forums['Forums updated redirect']);
 } else {
     if (isset($_GET['edit_forum'])) {
         $forum_id = intval($_GET['edit_forum']);
         if ($forum_id < 1) {
             message($lang_common['Bad request'], false, '404 Not Found');
         }
         // Update group permissions for $forum_id
         if (isset($_POST['save'])) {
             confirm_referrer('admin_forums.php');
             // Start with the forum details
             $forum_name = pun_trim($_POST['forum_name']);
             $forum_desc = pun_linebreaks(pun_trim($_POST['forum_desc']));
             $cat_id = intval($_POST['cat_id']);
             $sort_by = intval($_POST['sort_by']);
             $redirect_url = isset($_POST['redirect_url']) ? pun_trim($_POST['redirect_url']) : null;
             if ($forum_name == '') {
                 message($lang_admin_forums['Must enter name message']);
             }
             if ($cat_id < 1) {
                 message($lang_common['Bad request'], false, '404 Not Found');
             }
             $forum_desc = $forum_desc != '' ? '\'' . $db->escape($forum_desc) . '\'' : 'NULL';
             $redirect_url = $redirect_url != '' ? '\'' . $db->escape($redirect_url) . '\'' : 'NULL';
             $db->query('UPDATE ' . $db->prefix . 'forums SET forum_name=\'' . $db->escape($forum_name) . '\', forum_desc=' . $forum_desc . ', redirect_url=' . $redirect_url . ', sort_by=' . $sort_by . ', cat_id=' . $cat_id . ' WHERE id=' . $forum_id) or error('Unable to update forum', __FILE__, __LINE__, $db->error());
             // Now let's deal with the permissions
             if (isset($_POST['read_forum_old'])) {
                 $result = $db->query('SELECT g_id, g_read_board, g_post_replies, g_post_topics FROM ' . $db->prefix . 'groups WHERE g_id!=' . PUN_ADMIN) or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
                 while ($cur_group = $db->fetch_assoc($result)) {
                     $read_forum_new = $cur_group['g_read_board'] == '1' ? isset($_POST['read_forum_new'][$cur_group['g_id']]) ? '1' : '0' : intval($_POST['read_forum_old'][$cur_group['g_id']]);
                     $post_replies_new = isset($_POST['post_replies_new'][$cur_group['g_id']]) ? '1' : '0';
开发者ID:beyondkeysystem,项目名称:testone,代码行数:31,代码来源:admin_forums.php


示例17: message

     message($lang->t('Invalid webmaster email message'));
 }
 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'] = pun_trim(pun_linebreaks($form['additional_navlinks']));
 }
 // Change or enter a SMTP password
 if (isset($_POST['form']['smtp_change_pass'])) {
     $smtp_pass1 = isset($_POST['form']['smtp_pass1']) ? pun_trim($_POST['form']['smtp_pass1']) : '';
     $smtp_pass2 = isset($_POST['form']['smtp_pass2']) ? pun_trim($_POST['form']['smtp_pass2']) : '';
     if ($smtp_pass1 == $smtp_pass2) {
         $form['smtp_pass'] = $smtp_pass1;
     } else {
         message($lang->t('SMTP passwords did not match'));
     }
 }
 if ($form['announcement_message'] != '') {
     $form['announcement_message'] = pun_linebreaks($form['announcement_message']);
 } else {
     $form['announcement_message'] = $lang->t('Enter announcement here');
     $form['announcement'] = '0';
 }
 if ($form['rules_message'] != '') {
     $form['rules_message'] = pun_linebreaks($form['rules_message']);
 } else {
开发者ID:rakete,项目名称:affenbande-fluxbb,代码行数:31,代码来源:admin_options.php


示例18: error

    $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'ranks WHERE min_posts=' . $min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result)) {
        message(sprintf($lang_admin_ranks['Dupe min posts message'], $min_posts));
    }
    $db->query('INSERT INTO ' . $db->prefix . 'ranks (rank, min_posts) VALUES(\'' . $db->escape($rank) . '\', ' . $min_posts . ')') or error('Unable to add rank', __FILE__, __LINE__, $db->error());
    // Regenerate the ranks cache
    if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
        require PUN_ROOT . 'include/cache.php';
    }
    generate_ranks_cache();
    redirect('admin_ranks.php', $lang_admin_ranks['Rank added redirect']);
} else {
    if (isset($_POST['update'])) {
        confirm_referrer('admin_ranks.php');
        $id = intval(key($_POST['update']));
        $rank = pun_trim($_POST['rank'][$id]);
        $min_posts = trim($_POST['min_posts'][$id]);
        if ($rank == '') {
            message($lang_admin_ranks['Must enter title message']);
        }
        if ($min_posts == '' || preg_match('/[^0-9]/', $min_posts)) {
            message($lang_admin_ranks['Must be integer message']);
        }
        // Make sure there isn't already a rank with the same min_posts value
        $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'ranks WHERE id!=' . $id . ' AND min_posts=' . $min_posts) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());
        if ($db->num_rows($result)) {
            message(sprintf($lang_admin_ranks['Dupe min posts message'], $min_posts));
        }
        $db->query('UPDATE ' . $db->prefix . 'ranks SET rank=\'' . $db->escape($rank) . '\', min_posts=' . $min_posts . ' WHERE id=' . $id) or error('Unable to update rank', __FILE__, __LINE__, $db->error());
        // Regenerate the ranks cache
        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
开发者ID:highpictv,项目名称:forum,代码行数:31,代码来源:admin_ranks.php


示例19: message

	</div>
</div>
<?php 
                    require PUN_ROOT . 'footer.php';
                } else {
                    if (isset($_GET['report'])) {
                        if ($pun_user['is_guest']) {
                            message($lang_common['No permission']);
                        }
                        $post_id = intval($_GET['report']);
                        if ($post_id < 1) {
                            message($lang_common['Bad request']);
                        }
                        if (isset($_POST['form_sent'])) {
                            // Clean up reason from POST
                            $reason = pun_linebreaks(pun_trim($_POST['req_reason']));
                            if ($reason == '') {
                                message($lang_misc['No reason']);
                            }
                            // Get the topic ID
                            $result = $db->query('SELECT topic_id FROM ' . $db->prefix . 'posts WHERE id=' . $post_id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
                            if (!$db->num_rows($result)) {
                                message($lang_common['Bad request']);
                            }
                            $topic_id = $db->result($result);
                            // Get the subject and forum ID
                            $result = $db->query('SELECT subject, forum_id FROM ' . $db->prefix . 'topics WHERE id=' . $topic_id) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
                            if (!$db->num_rows($result)) {
                                message($lang_common['Bad request']);
                            }
                            list($subject, $forum_id) = $db->fetch_row($result);
开发者ID:tetratec,项目名称:runescape-classic-dump,代码行数:31,代码来源:misc.php


示例20: output_html

function output_html($feed)
{
    // Send the Content-type header in case the web server is setup to send something else
    header('Content-type: text/html; charset=utf-8');
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    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))) . ' …';
        } else {
            $subject_truncated = pun_htmlspecialchars($item['title']);
        }
        echo '<li><a href="' . pun_htmlspecialchars($item['link']) . '" title="' . pun_htmlspecialchars($item['title']) . '">' . $subject_truncated . '</a></li>' . "\n";
    }
}
开发者ID:rakete,项目名称:affenbande-fluxbb,代码行数:16,代码来源:extern.php



注:本文中的pun_trim函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pupe_query函数代码示例发布时间:2022-05-15
下一篇:
PHP pun_strlen函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap