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

PHP luna_trim函数代码示例

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

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



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

示例1: define

<?php

/*
 * Copyright (C) 2013-2015 Luna
 * Based on code by FluxBB copyright (C) 2008-2012 FluxBB
 * Based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
 * Licensed under GPLv2 (http://getluna.org/license.php)
 */
define('LUNA_ROOT', '../');
require LUNA_ROOT . 'include/common.php';
if (!$is_admin) {
    header("Location: login.php");
}
if (isset($_POST['form_sent'])) {
    confirm_referrer('backstage/features.php', __('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.', 'luna'));
    $form = array('users_online' => isset($_POST['form']['users_online']) ? '1' : '0', 'censoring' => isset($_POST['form']['censoring']) ? '1' : '0', 'signatures' => isset($_POST['form']['signatures']) ? '1' : '0', 'ranks' => isset($_POST['form']['ranks']) ? '1' : '0', 'thread_views' => isset($_POST['form']['thread_views']) ? '1' : '0', 'has_commented' => isset($_POST['form']['has_commented']) ? '1' : '0', 'show_first_run' => isset($_POST['form']['show_first_run']) ? '1' : '0', 'first_run_guests' => isset($_POST['form']['first_run_guests']) ? '1' : '0', 'first_run_message' => luna_trim($_POST['form']['first_run_message']), 'smilies_sig' => isset($_POST['form']['smilies_sig']) ? '1' : '0', 'make_links' => isset($_POST['form']['make_links']) ? '1' : '0', 'allow_center' => isset($_POST['form']['allow_center']) ? '1' : '0', 'allow_size' => isset($_POST['form']['allow_size']) ? '1' : '0', 'indent_num_spaces' => intval($_POST['form']['indent_num_spaces']) >= 0 ? intval($_POST['form']['indent_num_spaces']) : 0, 'quote_depth' => intval($_POST['form']['quote_depth']) > 0 ? intval($_POST['form']['quote_depth']) : 1, 'gzip' => isset($_POST['form']['gzip']) ? '1' : '0', 'search_all_forums' => isset($_POST['form']['search_all_forums']) ? '1' : '0', 'enable_advanced_search' => isset($_POST['form']['enable_advanced_search']) ? '1' : '0', 'inbox_enabled' => isset($_POST['form']['inbox_enabled']) ? '1' : '0', 'inbox_notification' => isset($_POST['form']['inbox_notification']) ? '1' : '0', 'inbox_max_receiver' => intval($_POST['form']['inbox_max_receiver']) > 0 ? intval($_POST['form']['inbox_max_receiver']) : 5);
    foreach ($form as $key => $input) {
        // Only update values that have changed
        if (array_key_exists('o_' . $key, $luna_config) && $luna_config['o_' . $key] != $input) {
            if ($input != '' || is_int($input)) {
                $value = '\'' . $db->escape($input) . '\'';
            } else {
                $value = 'NULL';
            }
            $db->query('UPDATE ' . $db->prefix . 'config SET conf_value=' . $value . ' WHERE conf_name=\'o_' . $db->escape($key) . '\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
        }
    }
    // Regenerate the config cache
    if (!defined('LUNA_CACHE_FUNCTIONS_LOADED')) {
        require LUNA_ROOT . 'include/cache.php';
    }
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:features.php


示例2: error

    if (isset($luna_user['logged'])) {
        $db->query('UPDATE ' . $db->prefix . 'users SET last_visit=' . $luna_user['logged'] . ' WHERE id=' . $luna_user['id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error());
    }
    luna_setcookie(1, luna_hash(uniqid(rand(), true)), time() + 31536000);
    redirect('index.php');
} elseif ($action == 'forget' || $action == 'forget_2') {
    if (!$luna_user['is_guest']) {
        header('Location: index.php');
        exit;
    }
    if (isset($_POST['form_sent'])) {
        // Start with a clean slate
        $errors = array();
        require FORUM_ROOT . 'include/email.php';
        // Validate the email address
        $email = strtolower(luna_trim($_POST['req_email']));
        if (!is_valid_email($email)) {
            message(__('The email address you entered is invalid.', 'luna'));
            exit;
        }
        // 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(__('Subject: New password requested

Hello <username>,

You have requested to have a new password assigned to your account in the discussion forum at <base_url>. If you did not request this or if you do not want to change your password you should just ignore this message. Only if you visit the activation page below will your password be changed.
开发者ID:istrwei,项目名称:Luna,代码行数:30,代码来源:login.php


示例3: 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: ' . date('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']) > LUNA_EXTERN_MAX_SUBJECT_LENGTH) {
            $subject_truncated = luna_htmlspecialchars(luna_trim(utf8_substr($item['title'], 0, LUNA_EXTERN_MAX_SUBJECT_LENGTH - 5))) . ' …';
        } else {
            $subject_truncated = luna_htmlspecialchars($item['title']);
        }
        echo '<li><a href="' . luna_htmlspecialchars($item['link']) . '" title="' . luna_htmlspecialchars($item['title']) . '">' . $subject_truncated . '</a></li>' . "\n";
    }
}
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:16,代码来源:extern.php


示例4: luna_mail

function luna_mail($to, $subject, $message, $reply_to_email = '', $reply_to_name = '')
{
    global $luna_config;
    // Default sender/return address
    $from_name = sprintf(__('%s Mailer', 'luna'), $luna_config['o_board_title']);
    $from_email = $luna_config['o_webmaster_email'];
    // Do a little spring cleaning
    $to = luna_trim(preg_replace('%[\\n\\r]+%s', '', $to));
    $subject = luna_trim(preg_replace('%[\\n\\r]+%s', '', $subject));
    $from_email = luna_trim(preg_replace('%[\\n\\r:]+%s', '', $from_email));
    $from_name = luna_trim(preg_replace('%[\\n\\r:]+%s', '', str_replace('"', '', $from_name)));
    $reply_to_email = luna_trim(preg_replace('%[\\n\\r:]+%s', '', $reply_to_email));
    $reply_to_name = luna_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 . FORUM_EOL . 'Date: ' . gmdate('r') . FORUM_EOL . 'MIME-Version: 1.0' . FORUM_EOL . 'Content-transfer-encoding: 8bit' . FORUM_EOL . 'Content-type: text/plain; charset=utf-8' . FORUM_EOL . 'X-Mailer: Luna 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 .= FORUM_EOL . 'Reply-To: ' . $reply_to;
    }
    // Make sure all linebreaks are LF in message (and strip out any NULL bytes)
    $message = str_replace("", '', luna_linebreaks($message));
    if ($luna_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:BogusCurry,项目名称:Luna,代码行数:35,代码来源:email.php


示例5: luna_linebreaks

 $orig_message = $message = luna_linebreaks(luna_trim($_POST['req_message']));
 // Here we use strlen() not luna_strlen() as we want to limit the comment to FORUM_MAX_POSTSIZE bytes, not characters
 if (strlen($message) > FORUM_MAX_POSTSIZE) {
     $errors[] = sprintf(__('Comments cannot be longer than %s bytes.', 'luna'), forum_number_format(FORUM_MAX_POSTSIZE));
 } elseif ($luna_config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$luna_user['is_admmod']) {
     $errors[] = __('Comments cannot contain only capital letters.', 'luna');
 }
 // Validate BBCode syntax
 require FORUM_ROOT . 'include/parser.php';
 $message = preparse_bbcode($message, $errors);
 if (empty($errors)) {
     if ($message == '') {
         $errors[] = __('You must enter a message.', 'luna');
     } elseif ($luna_config['o_censoring'] == '1') {
         // Censor message to see if that causes problems
         $censored_message = luna_trim(censor_words($message));
         if ($censored_message == '') {
             $errors[] = __('You must enter a message. After applying censoring filters, your message was empty.', 'luna');
         }
     }
 }
 $hide_smilies = isset($_POST['hide_smilies']) ? '1' : '0';
 $subscribe = isset($_POST['subscribe']) ? '1' : '0';
 $stick_topic = isset($_POST['stick_topic']) && $is_admmod ? '1' : '0';
 // Replace four-byte characters (MySQL cannot handle them)
 $message = strip_bad_multibyte_chars($message);
 $now = time();
 // Did everything go according to plan?
 if (empty($errors) && !isset($_POST['preview'])) {
     require FORUM_ROOT . 'include/search_idx.php';
     // If it's a reply
开发者ID:istrwei,项目名称:Luna,代码行数:31,代码来源:post.php


示例6: parse_message

function parse_message($text)
{
    global $luna_config, $luna_user;
    if ($luna_config['o_censoring'] == '1') {
        $text = censor_words($text);
    }
    // Convert applicable characters to HTML entities
    $text = luna_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 (strpos($text, '[') !== false && strpos($text, ']') !== false) {
        $text = do_bbcode($text);
    }
    $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");
                $code_line = explode("\n", $inside[$i]);
                $first_line = trim($code_line[1]);
                if (strpos($first_line, '[[') !== false && strpos($first_line, ']]') !== false) {
                    // fetching the language name
                    $language = strtolower(trim(str_replace(array('[[', ']]'), '', $first_line)));
                    if ($language == 'html' || $language == 'xhtml' || $language == 'xml') {
                        // Markup case
                        $h_class = ' class="language-markup"';
                    } elseif ($language == 'php' || $language == 'c++' || $language == 'perl') {
                        // C-like languages case
                        $h_class = ' class="language-clike"';
                    } elseif ($language == 'javascript') {
                        // JavaScript case
                        $h_class = ' class="language-javascript"';
                    } elseif ($language == 'php') {
                        // C-like languages case
                        $h_class = ' class="language-php"';
                    } else {
                        // Other cases
                        $h_class = '';
                    }
                    // Deleting the line giving the code name
                    $inside[$i] = str_replace($first_line, '', $inside[$i]);
                    // Generating the the HTML code block
                    $text .= '</p><div class="codebox"><pre' . ($num_lines > 28 ? ' class="vscroll"' : '') . '><code' . $h_class . '>' . luna_trim($inside[$i], "\n\r") . '</code></pre></div><p>';
                } else {
                    $text .= '</p><div class="codebox"><pre' . ($num_lines > 28 ? ' class="vscroll"' : '') . '><code>' . luna_trim($inside[$i], "\n\r") . '</code></pre></div><p>';
                }
            }
        }
    }
    return clean_paragraphs($text);
}
开发者ID:BogusCurry,项目名称:Luna,代码行数:61,代码来源:parser.php


示例7: define

<?php

/*
 * Copyright (C) 2013-2015 Luna
 * Based on code by FluxBB copyright (C) 2008-2012 FluxBB
 * Based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
 * Licensed under GPLv2 (http://getluna.org/license.php)
 */
define('LUNA_ROOT', '../');
require LUNA_ROOT . 'include/common.php';
if (!$is_admin) {
    header("Location: login.php");
}
// Create new user
if (isset($_POST['add_user'])) {
    $username = luna_trim($_POST['username']);
    $email1 = strtolower(trim($_POST['email']));
    $email2 = strtolower(trim($_POST['email']));
    $trimpassword = trim($_POST['password']);
    if (isset($_POST['random_pass'])) {
        $password = random_pass(8);
    } elseif (!empty($trimpassword)) {
        $password = trim($_POST['password']);
    } else {
        redirect('backstage/users.php?user_failed=true');
    }
    $errors = array();
    // 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) {
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:tools.php


示例8: define

/*
 * Copyright (C) 2013-2015 Luna
 * Based on code by FluxBB copyright (C) 2008-2012 FluxBB
 * Based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
 * Licensed under GPLv2 (http://getluna.org/license.php)
 */
define('LUNA_ROOT', dirname(__FILE__) . '/');
require LUNA_ROOT . 'include/common.php';
if ($luna_user['g_read_board'] == '0') {
    message(__('You do not have permission to view this page.', 'luna'), false, '403 Forbidden');
} elseif ($luna_user['g_view_users'] == '0') {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
// Determine if we are allowed to view comment counts
$show_comment_count = $luna_config['o_show_comment_count'] == '1' || $luna_user['is_admmod'] ? true : false;
$username = isset($_GET['username']) && $luna_user['g_search_users'] == '1' ? luna_trim($_GET['username']) : '';
if (isset($_GET['sort'])) {
    if ($_GET['sort'] == 'username') {
        $sort_query = 'username ASC';
    } elseif ($_GET['sort'] == 'registered') {
        $sort_query = 'registered ASC';
    } else {
        $sort_query = 'num_comments DESC';
    }
    $sort_by = $_GET['sort'];
} else {
    $sort_query = 'username ASC';
    $sort_by = '';
}
// Create any SQL for the WHERE clause
$where_sql = array();
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:userlist.php


示例9: ob_end_clean

    }
    $db->end_transaction();
    $db->close();
    ob_end_clean();
    ob_start();
    header('Location: backstage/maintenance.php' . $query_str);
    exit;
}
// Get the first comment ID from the db
$result = $db->query('SELECT id FROM ' . $db->prefix . 'comments ORDER BY id ASC LIMIT 1') or error('Unable to fetch thread info', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result)) {
    $first_id = $db->result($result);
}
if (isset($_POST['form_sent'])) {
    confirm_referrer('backstage/maintenance.php');
    $form = array('maintenance' => isset($_POST['form']['maintenance']) ? '1' : '0', 'maintenance_message' => luna_trim($_POST['form']['maintenance_message']));
    if ($form['maintenance_message'] != '') {
        $form['maintenance_message'] = luna_linebreaks($form['maintenance_message']);
    } else {
        $form['maintenance_message'] = __('The forums are temporarily down for maintenance. Please try again in a few minutes.', 'luna');
        $form['maintenance'] = '0';
    }
    foreach ($form as $key => $input) {
        // Only update values that have changed
        if (array_key_exists('o_' . $key, $luna_config) && $luna_config['o_' . $key] != $input) {
            if ($input != '' || is_int($input)) {
                $value = '\'' . $db->escape($input) . '\'';
            } else {
                $value = 'NULL';
            }
            $db->query('UPDATE ' . $db->prefix . 'config SET conf_value=' . $value . ' WHERE conf_name=\'o_' . $db->escape($key) . '\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:maintenance.php


示例10: error

 // Generate an array with all categories
 $result = $db->query('SELECT id, cat_name, disp_position FROM ' . $db->prefix . 'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error());
 $num_cats = $db->num_rows($result);
 for ($i = 0; $i < $num_cats; ++$i) {
     $cat_list[] = $db->fetch_assoc($result);
 }
 if (isset($_POST['update'])) {
     // Change position and name of the categories
     confirm_referrer('backstage/board.php');
     $categories = $_POST['cat'];
     if (empty($categories)) {
         message_backstage(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
     }
     foreach ($categories as $cat_id => $cur_cat) {
         $cur_cat['name'] = luna_trim($cur_cat['name']);
         $cur_cat['order'] = luna_trim($cur_cat['order']);
         if ($cur_cat['name'] == '') {
             message_backstage(__('You must enter a name', 'luna'));
         }
         if ($cur_cat['order'] == '' || preg_match('%[^0-9]%', $cur_cat['order'])) {
             message_backstage(__('Position must be a positive integer value.', 'luna'));
         }
         $db->query('UPDATE ' . $db->prefix . 'categories SET cat_name=\'' . $db->escape($cur_cat['name']) . '\', disp_position=' . $cur_cat['order'] . ' WHERE id=' . intval($cat_id)) or error('Unable to update category', __FILE__, __LINE__, $db->error());
     }
     redirect('backstage/board.php?saved=true');
 }
 $page_title = array(luna_htmlspecialchars($luna_config['o_board_title']), __('Admin', 'luna'), __('Board', 'luna'));
 define('FORUM_ACTIVE_PAGE', 'admin');
 require 'header.php';
 load_admin_nav('content', 'board');
 if (isset($_GET['saved'])) {
开发者ID:istrwei,项目名称:Luna,代码行数:31,代码来源:board.php


示例11: elseif

     } elseif ($form['disp_posts'] > 75) {
         $form['disp_posts'] = 75;
     }
 }
 // Make sure we got a valid language string
 if (isset($_POST['form']['language'])) {
     $languages = forum_list_langs();
     $form['language'] = luna_trim($_POST['form']['language']);
     if (!in_array($form['language'], $languages)) {
         message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
     }
 }
 // Make sure we got a valid style string
 if (isset($_POST['form']['style'])) {
     $styles = forum_list_styles();
     $form['style'] = luna_trim($_POST['form']['style']);
     if (!in_array($form['style'], $styles)) {
         message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
     }
 }
 if ($form['email_setting'] < 0 || $form['email_setting'] > 2) {
     $form['email_setting'] = $luna_config['o_default_email_setting'];
 }
 // Single quotes around non-empty values and NULL for empty values
 $temp = array();
 foreach ($form as $key => $input) {
     $value = $input !== '' ? '\'' . $db->escape($input) . '\'' : 'NULL';
     $temp[] = $key . '=' . $value;
 }
 if (empty($temp)) {
     message(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
开发者ID:KristopherGBaker,项目名称:Luna,代码行数:31,代码来源:settings.php


示例12: define

<?php

/*
 * Copyright (C) 2013-2015 Luna
 * Based on code by FluxBB copyright (C) 2008-2012 FluxBB
 * Based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
 * Licensed under GPLv3 (http://getluna.org/license.php)
 */
define('FORUM_ROOT', '../');
require FORUM_ROOT . 'include/common.php';
if (!$is_admin) {
    header("Location: login.php");
}
if (isset($_POST['form_sent'])) {
    confirm_referrer('backstage/features.php', __('Bad HTTP_REFERER. If you have moved these forums from one location to another or switched domains, you need to update the Base URL manually in the database (look for o_base_url in the config table) and then clear the cache by deleting all .php files in the /cache directory.', 'luna'));
    $form = array('users_online' => isset($_POST['form']['users_online']) ? '1' : '0', 'censoring' => isset($_POST['form']['censoring']) ? '1' : '0', 'signatures' => isset($_POST['form']['signatures']) ? '1' : '0', 'ranks' => isset($_POST['form']['ranks']) ? '1' : '0', 'topic_views' => isset($_POST['form']['topic_views']) ? '1' : '0', 'has_posted' => isset($_POST['form']['has_posted']) ? '1' : '0', 'show_first_run' => isset($_POST['form']['show_first_run']) ? '1' : '0', 'first_run_guests' => isset($_POST['form']['first_run_guests']) ? '1' : '0', 'first_run_message' => luna_trim($_POST['form']['first_run_message']), 'smilies_sig' => isset($_POST['form']['smilies_sig']) ? '1' : '0', 'make_links' => isset($_POST['form']['make_links']) ? '1' : '0', 'indent_num_spaces' => intval($_POST['form']['indent_num_spaces']) >= 0 ? intval($_POST['form']['indent_num_spaces']) : 0, 'quote_depth' => intval($_POST['form']['quote_depth']) > 0 ? intval($_POST['form']['quote_depth']) : 1, 'video_width' => intval($_POST['form']['video_width']) > 0 ? intval($_POST['form']['video_width']) : 640, 'video_height' => intval($_POST['form']['video_height']) > 0 ? intval($_POST['form']['video_height']) : 360, 'gzip' => isset($_POST['form']['gzip']) ? '1' : '0', 'search_all_forums' => isset($_POST['form']['search_all_forums']) ? '1' : '0', 'enable_advanced_search' => isset($_POST['form']['enable_advanced_search']) ? '1' : '0', 'pms_enabled' => isset($_POST['form']['pms_enabled']) ? '1' : '0', 'pms_notification' => isset($_POST['form']['pms_notification']) ? '1' : '0', 'pms_max_receiver' => intval($_POST['form']['pms_max_receiver']) > 0 ? intval($_POST['form']['pms_max_receiver']) : 5);
    foreach ($form as $key => $input) {
        // Only update values that have changed
        if (array_key_exists('o_' . $key, $luna_config) && $luna_config['o_' . $key] != $input) {
            if ($input != '' || is_int($input)) {
                $value = '\'' . $db->escape($input) . '\'';
            } else {
                $value = 'NULL';
            }
            $db->query('UPDATE ' . $db->prefix . 'config SET conf_value=' . $value . ' WHERE conf_name=\'o_' . $db->escape($key) . '\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
        }
    }
    // Regenerate the config cache
    if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
        require FORUM_ROOT . 'include/cache.php';
    }
开发者ID:BogusCurry,项目名称:Luna,代码行数:31,代码来源:features.php


示例13: VALUES

    $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 FORUM_ROOT . 'include/cache.php';
    }
    generate_ranks_cache();
    redirect('backstage/ranks.php');
} elseif (isset($_POST['update'])) {
    confirm_referrer('backstage/ranks.php');
    $rank = $_POST['rank'];
    if (empty($rank)) {
        message_backstage(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
    }
    foreach ($rank as $item_id => $cur_rank) {
        $cur_rank['rank'] = luna_trim($cur_rank['rank']);
        $cur_rank['min_posts'] = luna_trim($cur_rank['min_posts']);
        if ($cur_rank['rank'] == '') {
            message_backstage(__('You must enter a title.', 'luna'));
        } elseif ($cur_rank['min_posts'] == '' || preg_match('%[^0-9]%', $cur_rank['min_posts'])) {
            message_backstage(__('Minimum posts must be a positive integer value.', 'luna'));
        } else {
            $rank_check = $db->query('SELECT 1 FROM ' . $db->prefix . 'ranks WHERE id!=' . intval($item_id) . ' AND min_posts=' . $cur_rank['min_posts']) or error('Unable to fetch rank info', __FILE__, __LINE__, $db->error());
            if ($db->num_rows($rank_check) != 0) {
                message_backstage(sprintf(__('There is already a rank with a minimum posts value of %s.', 'luna'), $cur_rank['min_posts']));
            }
        }
        $db->query('UPDATE ' . $db->prefix . 'ranks SET rank=\'' . $db->escape($cur_rank['rank']) . '\', min_posts=\'' . $cur_rank['min_posts'] . '\' WHERE id=' . intval($item_id)) or error('Unable to update ranks', __FILE__, __LINE__, $db->error());
    }
    redirect('backstage/ranks.php');
} elseif (isset($_POST['remove'])) {
    $id = intval(key($_POST['remove']));
开发者ID:BogusCurry,项目名称:Luna,代码行数:31,代码来源:ranks.php


示例14: luna_trim

} else {
    $db_type = $_POST['req_db_type'];
    $db_host = luna_trim($_POST['req_db_host']);
    $db_name = luna_trim($_POST['req_db_name']);
    $db_username = luna_trim($_POST['db_username']);
    $db_password = luna_trim($_POST['db_password']);
    $db_prefix = luna_trim($_POST['db_prefix']);
    $username = luna_trim($_POST['req_username']);
    $email = strtolower(luna_trim($_POST['req_email']));
    $password1 = luna_trim($_POST['req_password1']);
    $password2 = luna_trim($_POST['req_password2']);
    $title = luna_trim($_POST['req_title']);
    $description = luna_trim($_POST['desc']);
    $base_url = luna_trim($_POST['req_base_url']);
    $default_lang = luna_trim($_POST['req_default_lang']);
    $default_style = luna_trim($_POST['req_default_style']);
    // Make sure base_url doesn't end with a slash
    if (substr($base_url, -1) == '/') {
        $base_url = substr($base_url, 0, -1);
    }
    $alerts = Installer::validate_config($username, $password1, $password2, $email, $title, $default_lang, $default_style);
}
// Check if the cache directory is writable
if (!forum_is_writable(FORUM_CACHE_DIR)) {
    $alerts[] = sprintf(__('<strong>The cache directory is currently not writable!</strong> In order for Luna to function properly, the directory <em>%s</em> must be writable by PHP. Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.', 'luna'), FORUM_CACHE_DIR);
}
// Check if default avatar directory is writable
if (!forum_is_writable(FORUM_ROOT . 'img/avatars/')) {
    $alerts[] = sprintf(__('<strong>The avatar directory is currently not writable!</strong> If you want users to be able to upload their own avatar images you must see to it that the directory <em>%s</em> is writable by PHP. You can later choose to save avatar images in a different directory (see Admin/Options). Use chmod to set the appropriate directory permissions. If in doubt, chmod to 0777.', 'luna'), FORUM_ROOT . 'img/avatars/');
}
if (!isset($_POST['form_sent']) || !empty($alerts)) {
开发者ID:istrwei,项目名称:Luna,代码行数:31,代码来源:install.php


示例15: while

             while ($temp = $db->fetch_assoc($result)) {
                 $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, luna_trim($_GET['author'])), implode(',', $forums), $search_in);
     } elseif ($keywords) {
         $search_ids = $keyword_results;
         $search_type = array('keywords', $keywords, implode(',', $forums), $search_in);
     } else {
         $search_ids = $author_results;
         $search_type = array('author', luna_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(__('Your search returned no hits.', 'luna'));
     }
 } elseif ($action == 'show_new' || $action == 'show_recent' || $action == 'show_user_posts' || $action == 'show_user_topics' || $action == 'show_subscriptions' || $action == 'show_unanswered') {
     $search_type = array('action', $action);
     $show_as = 'topics';
开发者ID:BogusCurry,项目名称:Luna,代码行数:31,代码来源:search.php


示例16: intval

    $item_id = intval($_GET['del_item']);
    if ($item_id < 4) {
        message_backstage(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
    }
    $db->query('DELETE FROM ' . $db->prefix . 'menu WHERE id=' . $item_id) or error('Unable to delete menu item', __FILE__, __LINE__, $db->error());
    redirect('backstage/menu.php');
} elseif (isset($_POST['update'])) {
    confirm_referrer('backstage/menu.php');
    $menu_items = $_POST['item'];
    if (empty($menu_items)) {
        message_backstage(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
    }
    foreach ($menu_items as $item_id => $cur_item) {
        $cur_item['url'] = luna_trim($cur_item['url']);
        $cur_item['name'] = luna_trim($cur_item['name']);
        $cur_item['order'] = luna_trim($cur_item['order']);
        if (!isset($cur_item['visible'])) {
            $cur_item['visible'] = 0;
        }
        if ($cur_item['name'] == '') {
            message_backstage(__('You must give your menu item a title.', 'luna'));
        } elseif ($cur_item['url'] == '') {
            message_backstage(__('You must give your menu item an URL.', 'luna'));
        } elseif ($cur_item['order'] == '' || preg_match('%[^0-9]%', $cur_item['order'])) {
            message_backstage(__('Position must be a positive integer value.', 'luna'));
        } else {
            $db->query('UPDATE ' . $db->prefix . 'menu SET url=\'' . $db->escape($cur_item['url']) . '\', name=\'' . $db->escape($cur_item['name']) . '\', disp_position=' . $cur_item['order'] . ', visible=\'' . $cur_item['visible'] . '\' WHERE id=' . intval($item_id)) or error('Unable to update menu', __FILE__, __LINE__, $db->error());
        }
    }
    redirect('backstage/menu.php');
}
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:menu.php


示例17: intval

         $prune_from = intval($prune_from);
         prune($prune_from, $prune_pinned, $prune_date);
         update_forum($prune_from);
     }
     // Locate any "orphaned redirect threads" and delete them
     $result = $db->query('SELECT t1.id FROM ' . $db->prefix . 'threads AS t1 LEFT JOIN ' . $db->prefix . 'threads AS t2 ON t1.moved_to=t2.id WHERE t2.id IS NULL AND t1.moved_to IS NOT NULL') or error('Unable to fetch redirect threads', __FILE__, __LINE__, $db->error());
     $num_orphans = $db->num_rows($result);
     if ($num_orphans) {
         for ($i = 0; $i < $num_orphans; ++$i) {
             $orphans[] = $db->result($result, $i);
         }
         $db->query('DELETE FROM ' . $db->prefix . 'threads WHERE id IN(' . implode(',', $orphans) . ')') or error('Unable to delete redirect threads', __FILE__, __LINE__, $db->error());
     }
     redirect('backstage/prune.php');
 }
 $prune_days = luna_trim($_POST['req_prune_days']);
 if ($prune_days == '' || preg_match('%[^0-9]%', $prune_days)) {
     message_backstage(__('Days to prune must be a positive integer value.', 'luna'));
 }
 $prune_date = time() - $prune_days * 86400;
 // Concatenate together the query for counting number of threads to prune
 $sql = 'SELECT COUNT(id) FROM ' . $db->prefix . 'threads WHERE last_comment<' . $prune_date . ' AND moved_to IS NULL';
 if ($prune_pinned == '0') {
     $sql .= ' AND pinned=0';
 }
 if ($prune_from != 'all') {
     $prune_from = intval($prune_from);
     $sql .= ' AND forum_id=' . $prune_from;
     // Fetch the forum name (just for cosmetic reasons)
     $result = $db->query('SELECT forum_name FROM ' . $db->prefix . 'forums WHERE id=' . $prune_from) or error('Unable to fetch forum name', __FILE__, __LINE__, $db->error());
     $forum = '"' . luna_htmlspecialchars($db->result($result)) . '"';
开发者ID:BlitzFirePlayz,项目名称:Luna,代码行数:31,代码来源:prune.php


示例18: message_backstage

     message_backstage(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
 }
 // How many posts did we just split off?
 $num_posts_splitted = substr_count($posts, ',') + 1;
 // Verify that the comment IDs are valid
 $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'posts WHERE id IN(' . $posts . ') AND topic_id=' . $tid) or error('Unable to check posts', __FILE__, __LINE__, $db->error());
 if ($db->num_rows($result) != $num_posts_splitted) {
     message_backstage(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
 }
 // Verify that the move to forum ID is valid
 $result = $db->query('SELECT 1 FROM ' . $db->prefix . 'forums AS f LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (fp.group_id=' . $luna_user['g_id'] . ' AND fp.forum_id=' . $move_to_forum . ') WHERE (fp.post_topics IS NULL OR fp.post_topics=1)') or error('Unable to fetch forum permissions', __FILE__, __LINE__, $db->error());
 if (!$db->num_rows($result)) {
     message_backstage(__('Bad request. The link you followed is incorrect, outdated or you are simply not allowed to hang around here.', 'luna'), false, '404 Not Found');
 }
 // Check subject
 $new_subject = isset($_POST['new_subject']) ? luna_trim($_POST['new_subject']) : '';
 if ($new_subject == '') {
     message_backstage(__('Threads must contain a subject.', 'luna'));
 } elseif (luna_strlen($new_subject) > 70) {
     message_backstage(__('Subjects cannot be longer than 70 characters.', 'luna'));
 }
 // Get data from the new first post
 $result = $db->query('SELECT p.id, p.poster, p.posted FROM ' . $db->prefix . 'posts AS p WHERE id IN(' . $posts . ') ORDER BY p.id ASC LIMIT 1') or error('Unable to get first post', __FILE__, __LINE__, $db->error());
 $first_post_data = $db->fetch_assoc($result);
 // Create the new thread
 $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, first_post_id, forum_id) VALUES (\'' . $db->escape($first_post_data['poster']) . '\', \'' . $db->escape($new_subject) . '\', ' . $first_post_data['posted'] . ', ' . $first_post_data['id'] . ', ' . $move_to_forum . ')') or error('Unable to create new thread', __FILE__, __LINE__, $db->error());
 $new_tid = $db->insert_id();
 // Move the comments to the new thread
 $db->query('UPDATE ' . $db->prefix . 'posts SET topic_id=' . $new_tid . ' WHERE id IN(' . $posts . ')') or error('Unable to move posts into new thread', __FILE__, __LINE__, $db->error());
 // Apply every subscription to both topics
 $db->query('INSERT INTO ' . $db->prefix . 'topic_subscriptions (user_id, topic_id) SELECT user_id, ' . $new_tid . ' FROM ' . $db->prefix . 'topic_subscriptions WHERE topic_id=' . $tid) or error('Unable to copy existing subscriptions', __FILE__, __LINE__, $db->error());
开发者ID:istrwei,项目名称:Luna,代码行数:31,代码来源:moderate.php


示例19: elseif

</form>
<?php 
    require 'footer.php';
} elseif (isset($_GET['find_user'])) {
    $form = isset($_GET['form']) ? $_GET['form'] : array();
    // trim() all elements in $form
    $form = array_map('luna_trim', $form);
    $conditions = $query_str = array();
    $posts_greater = isset($_GET['posts_greater']) ? luna_trim($_GET['posts_greater']) : '';
    $posts_less = isset($_GET['posts_less']) ? luna_trim($_GET['posts_less']) : '';
    $last_post_after = isset($_GET['last_post_after']) ? luna_trim($_GET['last_post_after']) : '';
    $last_post_before = isset($_GET['last_post_before']) ? luna_trim($_GET['last_post_before']) : '';
    $last_visit_after = isset($_GET['last_visit_after']) ? luna_trim($_GET['last_visit_after']) : '';
    $last_visit_before = isset($_GET['last_visit_before']) ? luna_trim($_GET['last_visit_before']) : '';
    $registered_after = isset($_GET['registered_after']) ? luna_trim($_GET['registered_after']) : '';
    $registered_before = isset($_GET['registered_before']) ? luna_trim($_GET['registered_before']) : '';
    $order_by = isset($_GET['order_by']) && in_array($_GET['order_by'], array('username', 'email', 'num_posts', 'last_post', 'last_visit', 'registered')) ? $_GET['order_by'] : 'username';
    $direction = isset($_GET['direction']) && $_GET['direction'] == 'DESC' ? 'DESC' : 'ASC';
    $user_group = isset($_GET['user_group']) ? intval($_GET['user_group']) : -1;
    $query_str[] = 'order_by=' . $order_by;
    $query_str[] = 'direction=' . $direction;
    $query_str[] = 'user_group=' . $user_group;
    if (preg_match('%[^0-9]%', $posts_greater . $posts_less)) {
        message_backstage(__('You entered a non-numeric value into a numeric only column.', 'luna'));
    }
    // Try to convert date/time to timestamps
    if ($last_post_after != '') {
        $query_str[] = 'last_post_after=' . $last_post_after;
        $last_post_after = strtotime($last_post_after);
        if ($last_post_after === false || $last_post_after == -1) {
            message_backstage(__('You entered an invalid date/time.', 'luna'));
开发者ID:BogusCurry,项目名称:Luna,代码行数:31,代码来源:users.php


示例20: array

<

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP lunlink函数代码示例发布时间:2022-05-15
下一篇:
PHP luna_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