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

PHP openBoard函数代码示例

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

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



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

示例1: build

 public function build($settings, $board_name)
 {
     global $config, $board;
     openBoard($board_name);
     $recent_images = array();
     $recent_posts = array();
     $stats = array();
     $query = query(sprintf("SELECT *, `id` AS `thread_id`,\n\t\t\t\t(SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`,\n\t\t\t\t(SELECT SUM(`num_files`) FROM ``posts_%s`` WHERE `thread` = `thread_id` AND `num_files` IS NOT NULL) AS `image_count`,\n\t\t\t\t'%s' AS `board` FROM ``posts_%s`` WHERE `thread`  IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name, $board_name, $board_name)) or error(db_error());
     while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $post['id']);
         $post['board_name'] = $board['name'];
         if ($post['embed'] && preg_match('/^https?:\\/\\/(\\w+\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9\\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) {
             $post['youtube'] = $matches[2];
         }
         if (isset($post['files'])) {
             $files = json_decode($post['files']);
             if ($files[0]->file == 'deleted') {
                 continue;
             }
             $post['file'] = $config['uri_thumb'] . $files[0]->thumb;
         }
         $recent_posts[] = $post;
     }
     $required_scripts = array('js/jquery.min.js', 'js/jquery.mixitup.min.js', 'js/catalog.js');
     foreach ($required_scripts as $i => $s) {
         if (!in_array($s, $config['additional_javascript'])) {
             $config['additional_javascript'][] = $s;
         }
     }
     file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/catalog/catalog.html', array('settings' => $settings, 'config' => $config, 'boardlist' => createBoardlist(), 'recent_images' => $recent_images, 'recent_posts' => $recent_posts, 'stats' => $stats, 'board' => $board_name, 'link' => $config['root'] . $board['dir'])));
 }
开发者ID:vicentil,项目名称:vichan,代码行数:31,代码来源:theme.php


示例2: build

 public function build($settings, $board_name)
 {
     global $config, $board;
     openBoard($board_name);
     $recent_images = array();
     $recent_posts = array();
     $stats = array();
     $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());
     while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $post['id']);
         $post['board_name'] = $board['name'];
         $post['file'] = $config['uri_thumb'] . $post['thumb'];
         $recent_posts[] = $post;
     }
     file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/catalog/catalog.html', array('settings' => $settings, 'config' => $config, 'boardlist' => createBoardlist(), 'recent_images' => $recent_images, 'recent_posts' => $recent_posts, 'stats' => $stats, 'board' => $board_name, 'link' => $config['root'] . $board['dir'])));
 }
开发者ID:carriercomm,项目名称:Tinyboard,代码行数:16,代码来源:theme.php


示例3: news

 public static function news($settings)
 {
     global $config, $board;
     // HTML5
     $body = '<!DOCTYPE html><html>' . '<head>' . '<meta charset="utf-8">' . '<link rel="stylesheet" href="frontpage.css" />' . '<link rel="stylesheet" media="screen" id="stylesheet" href="/stylesheets/style.css">' . '<script type="text/javascript" src="/styleswitch-sidebar.js"></script>' . '<title>' . $settings['title'] . ' - News</title>' . '</head><body>';
     $boardlist = createBoardlist();
     $body .= $boardlist['top'] . '<br />';
     $boards = listBoards();
     $body .= '<div id="maintable"><div id="logo"></div><div id="announcement">Don\'t touch the lights!</div><table style="margin-bottom: 4px; width: 100%;"><tr>';
     // Recent Posts
     $body .= '<td style="width: 100%;"><div class="post_wrap"><div class="post_header"><b>Recent Posts</b></div><div class="post_body"><div class="post_content" style="padding-bottom: 10px;">';
     $query = '';
     foreach ($boards as &$_board) {
         // Block Board
         if ($_board['uri'] != "aurora") {
             $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` UNION ALL ", $_board['uri'], $_board['uri']);
         }
     }
     $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT 15', $query);
     $query = query($query) or error(db_error());
     while ($post = $query->fetch()) {
         openBoard($post['board']);
         $body .= '<strong>' . $board['name'] . '</strong>: <a href="' . $config['root'] . $board['dir'] . $config['dir']['res'] . ($post['thread'] ? $post['thread'] : $post['id']) . '.html#' . $post['id'] . '">';
         $snip = pm_snippet($post['body'], 95);
         if ($snip === "<em></em>") {
             $body .= '&lt;empty&gt;';
         } else {
             $body .= $snip;
         }
         $body .= '</a><br />';
     }
     // News
     $body .= '</div></div></div></td></tr></table>';
     $query = query("SELECT * FROM `news` ORDER BY `time` DESC LIMIT 5") or error(db_error());
     if ($query->rowCount() == 0) {
         $body .= '<p style="text-align:center" class="unimportant">(No news to show.)</p>';
     } else {
         // List news
         while ($news = $query->fetch()) {
             $body .= '<div class="post_wrap"><div class="post_header">' . (time() - $news['time'] <= 432000 ? '<em><b><span style="color: #D03030;">*NEW*</span></b></em> ' : '') . ($news['subject'] ? $news['subject'] : '<em>no subject</em>') . ' &mdash; by ' . $news['name'] . ' at ' . strftime($config['post_date'], $news['time']) . '</div><div class="post_body"><div class="post_content">' . $news['body'] . '</div></div></div>';
         }
     }
     // Finish page
     $body .= '<br />';
     $body .= '</div></body></html>';
     return $body;
 }
开发者ID:anastiel,项目名称:lainchan,代码行数:47,代码来源:theme.php


示例4: build

 public function build($settings, $board_name)
 {
     global $config, $board;
     openBoard($board_name);
     $recent_images = array();
     $recent_posts = array();
     $stats = array();
     $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error());
     while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $post['id']);
         $post['board_name'] = $board['name'];
         $post['file'] = $config['uri_thumb'] . $post['thumb'];
         if ($post['embed'] && preg_match('/^https?:\\/\\/(\\w+\\.)?(?:youtube\\.com\\/watch\\?v=|youtu\\.be\\/)([a-zA-Z0-9\\-_]{10,11})(&.+)?$/i', $post['embed'], $matches)) {
             $post['youtube'] = $matches[2];
         }
         $recent_posts[] = $post;
     }
     file_write($config['dir']['home'] . $board_name . '/catalog.html', Element('themes/catalog/catalog.html', array('settings' => $settings, 'config' => $config, 'boardlist' => createBoardlist(), 'recent_images' => $recent_images, 'recent_posts' => $recent_posts, 'stats' => $stats, 'board' => $board_name, 'link' => $config['root'] . $board['dir'])));
 }
开发者ID:2Rainbow,项目名称:fukuro,代码行数:19,代码来源:theme.php


示例5: doboard

function doboard($board)
{
    global $global_locale, $config, $main_js, $options;
    $config['mask_db_error'] = false;
    if (!$options['api']) {
        $config['api']['enabled'] = false;
    }
    echo "Opening board /{$board['uri']}/...\n";
    // Reset locale to global locale
    $config['locale'] = $global_locale;
    init_locale($config['locale'], 'error');
    openBoard($board['uri']);
    $config['try_smarter'] = false;
    if ($config['file_script'] != $main_js && $options['js']) {
        // different javascript file
        echo "(/{$board['uri']}/) Generating Javascript file...\n";
        buildJavascript();
    }
    if ($options['indexes']) {
        echo "(/{$board['uri']}/) Creating index pages...\n";
        buildIndex();
    }
    if ($options['postmarkup']) {
        $query = query(sprintf("SELECT `id` FROM ``posts_%s``", $board['uri'])) or error(db_error());
        while ($post = $query->fetch()) {
            echo "(/{$board['uri']}/) Rebuilding #{$post['id']}...\n";
            rebuildPost($post['id']);
        }
    }
    if ($options['threads']) {
        $query = query(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL", $board['uri'])) or error(db_error());
        while ($post = $query->fetch()) {
            echo "(/{$board['uri']}/) Rebuilding #{$post['id']}...\n";
            @buildThread($post['id']);
        }
    }
}
开发者ID:0151n,项目名称:vichan,代码行数:37,代码来源:rebuild2.php


示例6: markup


//.........这里部分代码省略.........
        }
        $skip_chars = 0;
        $body_tmp = $body;
        if (isset($cited_posts)) {
            // Carry found posts from local board >>X links
            foreach ($cited_posts as $cite => $thread) {
                $cited_posts[$cite] = $config['root'] . $board['dir'] . $config['dir']['res'] . ($thread ? $thread : $cite) . '.html#' . $cite;
            }
            $cited_posts = array($board['uri'] => $cited_posts);
        } else {
            $cited_posts = array();
        }
        $crossboard_indexes = array();
        $search_cites_boards = array();
        foreach ($cites as $matches) {
            $_board = $matches[2][0];
            $cite = @$matches[3][0];
            if (!isset($search_cites_boards[$_board])) {
                $search_cites_boards[$_board] = array();
            }
            $search_cites_boards[$_board][] = $cite;
        }
        $tmp_board = $board['uri'];
        foreach ($search_cites_boards as $_board => $search_cites) {
            $clauses = array();
            foreach ($search_cites as $cite) {
                if (!$cite || isset($cited_posts[$_board][$cite])) {
                    continue;
                }
                $clauses[] = '`id` = ' . $cite;
            }
            $clauses = array_unique($clauses);
            if ($board['uri'] != $_board) {
                if (!openBoard($_board)) {
                    continue;
                }
                // Unknown board
            }
            if (!empty($clauses)) {
                $cited_posts[$_board] = array();
                $query = query(sprintf('SELECT `thread`, `id`, `slug` FROM ``posts_%s`` WHERE ' . implode(' OR ', $clauses), $board['uri'])) or error(db_error());
                while ($cite = $query->fetch(PDO::FETCH_ASSOC)) {
                    $cited_posts[$_board][$cite['id']] = $config['root'] . $board['dir'] . $config['dir']['res'] . link_for($cite) . '#' . $cite['id'];
                }
            }
            $crossboard_indexes[$_board] = $config['root'] . $board['dir'] . $config['file_index'];
        }
        // Restore old board
        if ($board['uri'] != $tmp_board) {
            openBoard($tmp_board);
        }
        foreach ($cites as $matches) {
            $_board = $matches[2][0];
            $cite = @$matches[3][0];
            // preg_match_all is not multibyte-safe
            foreach ($matches as &$match) {
                $match[1] = mb_strlen(substr($body_tmp, 0, $match[1]));
            }
            if ($cite) {
                if (isset($cited_posts[$_board][$cite])) {
                    $link = $cited_posts[$_board][$cite];
                    $replacement = '<a ' . ($_board == $board['uri'] ? 'onclick="highlightReply(\'' . $cite . '\');" ' : '') . 'href="' . $link . '">' . '&gt;&gt;&gt;/' . $_board . '/' . $cite . '</a>';
                    $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0]));
                    $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]);
                    if ($track_cites && $config['track_cites']) {
                        $tracked_cites[] = array($_board, $cite);
开发者ID:jejechan,项目名称:jejechan,代码行数:67,代码来源:functions.php


示例7: isset

    $is_mod = isset($_POST['mod']) && $_POST['mod'];
    $root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root'];
    if (!isset($_POST['json_response'])) {
        $index = $root . $board['dir'] . $config['file_index'];
        echo Element('page.html', array('config' => $config, 'body' => '<div style="text-align:center"><a href="javascript:window.close()">[ ' . _('Close window') . " ]</a> <a href='{$index}'>[ " . _('Return') . ' ]</a></div>', 'title' => _('Report submitted!')));
    } else {
        header('Content-Type: text/json');
        echo json_encode(array('success' => true));
    }
} elseif (isset($_POST['post'])) {
    if (!isset($_POST['body'], $_POST['board'], $_POST['message']) || $_POST['message'] != '') {
        error($config['error']['bot']);
    }
    $post = array('board' => $_POST['board'], 'files' => array(), 'time' => time());
    // Check if board exists
    if (!openBoard($post['board'])) {
        error($config['error']['noboard']);
    }
    if (!isset($_POST['name'])) {
        $_POST['name'] = $config['anonymous'];
    }
    if (!isset($_POST['email'])) {
        $_POST['email'] = '';
    }
    if (!isset($_POST['subject'])) {
        $_POST['subject'] = '';
    }
    if (!isset($_POST['password'])) {
        $_POST['password'] = '';
    }
    if (isset($_POST['thread'])) {
开发者ID:fugeris,项目名称:8chan,代码行数:31,代码来源:post.php


示例8: sb_catalog

function sb_catalog($b)
{
    if (!openBoard($b)) {
        return false;
    }
    rebuildTheme("catalog", "post-thread", $b);
    return true;
}
开发者ID:0151n,项目名称:vichan,代码行数:8,代码来源:smart_build.php


示例9: http_response_code

<?php

include 'inc/functions.php';
include 'inc/mod/pages.php';
if (!isset($_GET['board']) || !preg_match("/{$config['board_regex']}/u", $_GET['board'])) {
    http_response_code(400);
    error('Bad board.');
}
if (!openBoard($_GET['board'])) {
    http_response_code(404);
    error('No board.');
}
if ($board['public_logs'] == 0) {
    error('This board has public logs disabled. Ask the board owner to enable it.');
}
if ($board['public_logs'] == 1) {
    $hide_names = false;
}
if ($board['public_logs'] == 2) {
    $hide_names = true;
}
if (!isset($_GET['page'])) {
    $page = 1;
} else {
    $page = (int) $_GET['page'];
}
mod_board_log($board['uri'], $page, $hide_names, true);
开发者ID:odilitime,项目名称:infinity,代码行数:27,代码来源:log.php


示例10: mod_config

function mod_config($board_config = false)
{
    global $config, $mod, $board;
    if ($board_config && !openBoard($board_config)) {
        error($config['error']['noboard']);
    }
    if (!hasPermission($config['mod']['edit_config'], $board_config)) {
        error($config['error']['noaccess']);
    }
    $config_file = $board_config ? $board['dir'] . 'config.php' : 'inc/instance-config.php';
    if ($config['mod']['config_editor_php']) {
        $readonly = !(is_file($config_file) ? is_writable($config_file) : is_writable(dirname($config_file)));
        if (!$readonly && isset($_POST['code'])) {
            $code = $_POST['code'];
            // Save previous instance_config if php_check_syntax fails
            $old_code = file_get_contents($config_file);
            file_put_contents($config_file, $code);
            $resp = shell_exec_error('php -l ' . $config_file);
            if (preg_match('/No syntax errors detected/', $resp)) {
                header('Location: ?/config' . ($board_config ? '/' . $board_config : ''), true, $config['redirect_http']);
                return;
            } else {
                file_put_contents($config_file, $old_code);
                error($config['error']['badsyntax'] . $resp);
            }
        }
        $instance_config = @file_get_contents($config_file);
        if ($instance_config === false) {
            $instance_config = "<?php\n\n// This file does not exist yet. You are creating it.";
        }
        $instance_config = str_replace("\n", '&#010;', utf8tohtml($instance_config));
        mod_page(_('Config editor'), 'mod/config-editor-php.html', array('php' => $instance_config, 'readonly' => $readonly, 'boards' => listBoards(), 'board' => $board_config, 'file' => $config_file, 'token' => make_secure_link_token('config' . ($board_config ? '/' . $board_config : ''))));
        return;
    }
    require_once 'inc/mod/config-editor.php';
    $conf = config_vars();
    foreach ($conf as &$var) {
        if (is_array($var['name'])) {
            $c =& $config;
            foreach ($var['name'] as $n) {
                $c =& $c[$n];
            }
        } else {
            $c = @$config[$var['name']];
        }
        $var['value'] = $c;
    }
    unset($var);
    if (isset($_POST['save'])) {
        $config_append = '';
        foreach ($conf as $var) {
            $field_name = 'cf_' . (is_array($var['name']) ? implode('/', $var['name']) : $var['name']);
            if ($var['type'] == 'boolean') {
                $value = isset($_POST[$field_name]);
            } elseif (isset($_POST[$field_name])) {
                $value = $_POST[$field_name];
            } else {
                continue;
            }
            // ???
            if (!settype($value, $var['type'])) {
                continue;
            }
            // invalid
            if ($value != $var['value']) {
                // This value has been changed.
                $config_append .= '$config';
                if (is_array($var['name'])) {
                    foreach ($var['name'] as $name) {
                        $config_append .= '[' . var_export($name, true) . ']';
                    }
                } else {
                    $config_append .= '[' . var_export($var['name'], true) . ']';
                }
                $config_append .= ' = ';
                if (@$var['permissions'] && isset($config['mod']['groups'][$value])) {
                    $config_append .= $config['mod']['groups'][$value];
                } else {
                    $config_append .= var_export($value, true);
                }
                $config_append .= ";\n";
            }
        }
        if (!empty($config_append)) {
            $config_append = "\n// Changes made via web editor by \"" . $mod['username'] . "\" @ " . date('r') . ":\n" . $config_append . "\n";
            if (!is_file($config_file)) {
                $config_append = "<?php\n\n{$config_append}";
            }
            if (!@file_put_contents($config_file, $config_append, FILE_APPEND)) {
                $config_append = htmlentities($config_append);
                if ($config['minify_html']) {
                    $config_append = str_replace("\n", '&#010;', $config_append);
                }
                $page = array();
                $page['title'] = 'Cannot write to file!';
                $page['config'] = $config;
                $page['body'] = '
					<p style="text-align:center">Tinyboard could not write to <strong>' . $config_file . '</strong> with the ammended configuration, probably due to a permissions error.</p>
					<p style="text-align:center">You may proceed with these changes manually by copying and pasting the following code to the end of <strong>' . $config_file . '</strong>:</p>
					<textarea style="width:700px;height:370px;margin:auto;display:block;background:white;color:black" readonly>' . $config_append . '</textarea>
//.........这里部分代码省略.........
开发者ID:vicentil,项目名称:vichan,代码行数:101,代码来源:pages.php


示例11: markup

function markup(&$body, $track_cites = false)
{
    global $board, $config, $markup_urls;
    $body = utf8tohtml($body);
    if ($config['wiki_markup']) {
        $body = preg_replace("/(^|\n)==(.+?)==\n?/m", "<span class=\"heading\">\$2</span>", $body);
        $body = preg_replace("/'''(.+?)'''/m", "<strong>\$1</strong>", $body);
        $body = preg_replace("/''(.+?)''/m", "<em>\$1</em>", $body);
        $body = preg_replace("/\\*\\*(.+?)\\*\\*/m", "<span class=\"spoiler\">\$1</span>", $body);
    }
    if ($config['markup_urls']) {
        $markup_urls = array();
        $body = preg_replace_callback($config['url_regex'], 'markup_url', $body, -1, $num_links);
        if ($num_links > $config['max_links']) {
            error($config['error']['toomanylinks']);
        }
    }
    if ($config['auto_unicode']) {
        $body = unicodify($body);
        foreach ($markup_urls as &$url) {
            $body = str_replace(unicodify($url), $url, $body);
        }
    }
    // replace tabs with 8 spaces
    $body = str_replace("\t", '        ', $body);
    $tracked_cites = array();
    // Cites
    if (isset($board) && preg_match_all('/(^|\\s)&gt;&gt;(\\d+?)([\\s,.)?]|$)/', $body, $cites)) {
        if (count($cites[0]) > $config['max_cites']) {
            error($config['error']['toomanycites']);
        }
        for ($index = 0; $index < count($cites[0]); $index++) {
            $cite = $cites[2][$index];
            $query = prepare(sprintf("SELECT `thread`,`id` FROM `posts_%s` WHERE `id` = :id LIMIT 1", $board['uri']));
            $query->bindValue(':id', $cite);
            $query->execute() or error(db_error($query));
            if ($post = $query->fetch()) {
                $replacement = '<a onclick="highlightReply(\'' . $cite . '\');" href="' . $config['root'] . $board['dir'] . $config['dir']['res'] . ($post['thread'] ? $post['thread'] : $post['id']) . '.html#' . $cite . '">' . '&gt;&gt;' . $cite . '</a>';
                $body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[3][$index], $body);
                if ($track_cites && $config['track_cites']) {
                    $tracked_cites[] = array($board['uri'], $post['id']);
                }
            }
        }
    }
    // Cross-board linking
    if (preg_match_all('/(^|\\s)&gt;&gt;&gt;\\/(\\w+?)\\/(\\d+)?([\\s,.)?]|$)/', $body, $cites)) {
        if (count($cites[0]) > $config['max_cites']) {
            error($config['error']['toomanycross']);
        }
        for ($index = 0; $index < count($cites[0]); $index++) {
            $_board = $cites[2][$index];
            $cite = @$cites[3][$index];
            // Temporarily store board information because it will be overwritten
            $tmp_board = $board['uri'];
            // Check if the board exists, and load settings
            if (openBoard($_board)) {
                if ($cite) {
                    $query = prepare(sprintf("SELECT `thread`,`id` FROM `posts_%s` WHERE `id` = :id LIMIT 1", $board['uri']));
                    $query->bindValue(':id', $cite);
                    $query->execute() or error(db_error($query));
                    if ($post = $query->fetch()) {
                        $replacement = '<a onclick="highlightReply(\'' . $cite . '\');" href="' . $config['root'] . $board['dir'] . $config['dir']['res'] . ($post['thread'] ? $post['thread'] : $post['id']) . '.html#' . $cite . '">' . '&gt;&gt;&gt;/' . $_board . '/' . $cite . '</a>';
                        $body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[4][$index], $body);
                        if ($track_cites && $config['track_cites']) {
                            $tracked_cites[] = array($board['uri'], $post['id']);
                        }
                    }
                } else {
                    $replacement = '<a href="' . $config['root'] . $board['dir'] . $config['file_index'] . '">' . '&gt;&gt;&gt;/' . $_board . '/' . '</a>';
                    $body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[4][$index], $body);
                }
            }
            // Restore main board settings
            openBoard($tmp_board);
        }
    }
    $body = str_replace("\r", '', $body);
    $body = preg_replace("/(^|\n)([\\s]+)?(&gt;)([^\n]+)?(\$|\n)/m", '$1$2<span class="quote">$3$4</span>$5', $body);
    if ($config['strip_superfluous_returns']) {
        $body = preg_replace('/\\s+$/', '', $body);
    }
    $body = preg_replace("/\n/", '<br/>', $body);
    return $tracked_cites;
}
开发者ID:nabm,项目名称:Tinyboard,代码行数:85,代码来源:functions.php


示例12: mod_8_settings

function mod_8_settings($b)
{
    global $config, $mod;
    //if ($b === 'infinity' && $mod['type'] !== ADMIN)
    //	error('Settings temporarily disabled for this board.');
    if (!in_array($b, $mod['boards']) and $mod['boards'][0] != '*') {
        error($config['error']['noaccess']);
    }
    if (!hasPermission($config['mod']['edit_settings'], $b)) {
        error($config['error']['noaccess']);
    }
    if (!openBoard($b)) {
        error("Could not open board!");
    }
    $possible_languages = array_diff(scandir('inc/locale/'), array('..', '.', '.tx', 'README.md'));
    if ($_SERVER['REQUEST_METHOD'] == 'POST') {
        $board_type = $_POST['board_type'];
        $imgboard = $board_type == 'imgboard';
        $txtboard = $board_type == 'txtboard';
        $fileboard = $board_type == 'fileboard';
        $title = $_POST['title'];
        $subtitle = $_POST['subtitle'];
        $country_flags = isset($_POST['country_flags']) ? 'true' : 'false';
        $field_disable_name = isset($_POST['field_disable_name']) ? 'true' : 'false';
        $enable_embedding = isset($_POST['enable_embedding']) ? 'true' : 'false';
        $force_image_op = $imgboard && isset($_POST['force_image_op']) ? 'true' : 'false';
        $disable_images = $txtboard ? 'true' : 'false';
        $poster_ids = isset($_POST['poster_ids']) ? 'true' : 'false';
        $show_sages = isset($_POST['show_sages']) ? 'true' : 'false';
        $auto_unicode = isset($_POST['auto_unicode']) ? 'true' : 'false';
        $strip_combining_chars = isset($_POST['strip_combining_chars']) ? 'true' : 'false';
        $allow_roll = isset($_POST['allow_roll']) ? 'true' : 'false';
        $image_reject_repost = isset($_POST['image_reject_repost']) ? 'true' : 'false';
        $image_reject_repost_in_thread = isset($_POST['image_reject_repost_in_thread']) ? 'true' : 'false';
        $early_404 = isset($_POST['early_404']) ? 'true' : 'false';
        $allow_delete = isset($_POST['allow_delete']) ? 'true' : 'false';
        $allow_flash = $imgboard && isset($_POST['allow_flash']) ? '$config[\'allowed_ext_files\'][] = \'swf\';' : '';
        $allow_pdf = $imgboard && isset($_POST['allow_pdf']) ? '$config[\'allowed_ext_files\'][] = \'pdf\';' : '';
        $code_tags = isset($_POST['code_tags']) ? '$config[\'additional_javascript\'][] = \'js/code_tags/run_prettify.js\';$config[\'markup\'][] = array("/\\[code\\](.+?)\\[\\/code\\]/ms", "<code><pre class=\'prettyprint\' style=\'display:inline-block\'>\\$1</pre></code>");' : '';
        $katex = isset($_POST['katex']) ? '$config[\'katex\'] = true;$config[\'additional_javascript\'][] = \'js/katex/katex.min.js\'; $config[\'markup\'][] = array("/\\[tex\\](.+?)\\[\\/tex\\]/ms", "<span class=\'tex\'>\\$1</span>"); $config[\'additional_javascript\'][] = \'js/katex-enable.js\';' : '';
        $user_flags = isset($_POST['user_flags']) ? "if (file_exists('{$b}/flags.php')) { include 'flags.php'; }\n" : '';
        $captcha = isset($_POST['captcha']) ? 'true' : 'false';
        $force_subject_op = isset($_POST['force_subject_op']) ? 'true' : 'false';
        $force_flag = isset($_POST['force_flag']) ? 'true' : 'false';
        $tor_posting = isset($_POST['tor_posting']) ? 'true' : 'false';
        $tor_image_posting = isset($_POST['tor_image_posting']) ? 'true' : 'false';
        $robot_enable = isset($_POST['robot_enable']) ? 'true' : 'false';
        $new_thread_capt = isset($_POST['new_thread_capt']) ? 'true' : 'false';
        $oekaki = ($imgboard || $fileboard) && isset($_POST['oekaki']) ? 'true' : 'false';
        $view_bumplock = isset($_POST['view_bumplock']) ? '-1' : 'MOD';
        if ($tor_image_posting === 'true' && isset($_POST['meta_noindex'])) {
            error('Please index your board to enable this.');
        }
        if ($_POST['locale'] !== 'en' && in_array($_POST['locale'], $possible_languages)) {
            $locale = "\$config['locale'] = '{$_POST['locale']}.UTF-8';";
        } else {
            $locale = '';
        }
        if (isset($_POST['max_images']) && (int) $_POST['max_images'] && (int) $_POST['max_images'] <= 5) {
            $_POST['max_images'] = (int) $_POST['max_images'];
            $multiimage = "\$config['max_images'] = {$_POST['max_images']};\n\t\t\t\t\t   \$config['additional_javascript'][] = 'js/multi-image.js';";
        } else {
            $multiimage = '';
        }
        if (isset($_POST['custom_assets'])) {
            $assets = "\$config['custom_assets'] = true;\n\t\t\t\t           \$config['spoiler_image'] = 'static/assets/{$b}/spoiler.png';\n\t\t\t\t           \$config['image_deleted'] = 'static/assets/{$b}/deleted.png';\n\t\t\t\t           \$config['no_file_image'] = 'static/assets/{$b}/no-file.png';\n\t\t\t\t";
        } else {
            $assets = '';
        }
        $file_board = '';
        if ($fileboard) {
            $force_image_op = true;
            $file_board = "\$config['threads_per_page'] = 30;\n\t\t\t\t\t       \$config['file_board'] = true;\n\t\t\t\t\t       \$config['threads_preview'] = 0;\n\t\t\t\t               \$config['threads_preview_sticky'] = 0;\n\t\t\t\t\t       \$config['allowed_ext_files'] = array();\n";
            if (isset($_POST['allowed_type'])) {
                foreach ($_POST['allowed_type'] as $val) {
                    if (in_array($val, $config['fileboard_allowed_types'])) {
                        $file_board .= "\$config['allowed_ext_files'][] = '{$val}';\n";
                    }
                }
            }
            if (isset($_POST['allowed_ext_op'])) {
                $file_board .= "\$config['allowed_ext_op'] = \$config['allowed_ext_files'];\n";
                if (isset($_POST['allowed_ext_op_video'])) {
                    $file_board .= "\$config['allowed_ext_op'][] = 'webm';\n\t\t\t\t\t\t\t\t\$config['allowed_ext_op'][] = 'mp4';\n";
                }
            }
            if (isset($_POST['tag_id'])) {
                $file_board .= "\$config['allowed_tags'] = array();\n";
                foreach ($_POST['tag_id'] as $id => $v) {
                    $file_board .= "\$config['allowed_tags'][";
                    $file_board .= 'base64_decode("';
                    $file_board .= base64_encode($_POST['tag_id'][$id]);
                    $file_board .= '")';
                    $file_board .= "] = ";
                    $file_board .= 'base64_decode("';
                    $file_board .= base64_encode($_POST['tag_desc'][$id]);
                    $file_board .= '")';
                    $file_board .= ";\n";
                }
            }
//.........这里部分代码省略.........
开发者ID:ringtech,项目名称:infinity,代码行数:101,代码来源:8chan-mod-pages.php


示例13: buildJavascript

if (!$options['quiet']) {
    echo "Generating Javascript file...\n";
}
buildJavascript();
$main_js = $config['file_script'];
$boards = listBoards();
foreach ($boards as &$board) {
    if ($options['board'] && $board['uri'] != $options['board']) {
        continue;
    }
    if (!$options['quiet']) {
        echo "Opening board /{$board['uri']}/...\n";
    }
    // Reset locale to global locale
    $config['locale'] = $global_locale;
    openBoard($board['uri']);
    $config['try_smarter'] = false;
    if ($config['file_script'] != $main_js) {
        // different javascript file
        if (!$options['quiet']) {
            echo "Generating Javascript file...\n";
        }
        buildJavascript();
    }
    if (!$options['quiet']) {
        echo "Creating index pages...\n";
    }
    buildIndex();
    if ($options['quick']) {
        continue;
    }
开发者ID:ringtech,项目名称:infinity,代码行数:31,代码来源:rebuild.php


示例14: markup


//.........这里部分代码省略.........
        }
        $skip_chars = 0;
        $body_tmp = $body;
        if (isset($cited_posts)) {
            // Carry found posts from local board >>X links
            foreach ($cited_posts as $cite => $thread) {
                $cited_posts[$cite] = $config['root'] . $board['dir'] . $config['dir']['res'] . ($thread ? $thread : $cite) . '.html#' . $cite;
            }
            $cited_posts = array($board['uri'] => $cited_posts);
        } else {
            $cited_posts = array();
        }
        $crossboard_indexes = array();
        $search_cites_boards = array();
        foreach ($cites as $matches) {
            $_board = $matches[2][0];
            $cite = @$matches[3][0];
            if (!isset($search_cites_boards[$_board])) {
                $search_cites_boards[$_board] = array();
            }
            $search_cites_boards[$_board][] = $cite;
        }
        $tmp_board = $board['uri'];
        foreach ($search_cites_boards as $_board => $search_cites) {
            $clauses = array();
            foreach ($search_cites as $cite) {
                if (!$cite || isset($cited_posts[$_board][$cite])) {
                    continue;
                }
                $clauses[] = '`id` = ' . $cite;
            }
            $clauses = array_unique($clauses);
            if ($board['uri'] != $_board) {
                if (!openBoard($_board)) {
                    continue;
                }
                // Unknown board
            }
            if (!empty($clauses)) {
                $cited_posts[$_board] = array();
                $query = query(sprintf('SELECT `thread`, `id` FROM ``posts_%s`` WHERE ' . implode(' OR ', $clauses), $board['uri'])) or error(db_error());
                while ($cite = $query->fetch(PDO::FETCH_ASSOC)) {
                    $cited_posts[$_board][$cite['id']] = $config['root'] . $board['dir'] . $config['dir']['res'] . ($cite['thread'] ? $cite['thread'] : $cite['id']) . '.html#' . $cite['id'];
                }
            }
            $crossboard_indexes[$_board] = $config['root'] . $board['dir'] . $config['file_index'];
        }
        // Restore old board
        if (!$tmp_board) {
            unset($GLOBALS['board']);
        } elseif ($board['uri'] != $tmp_board) {
            openBoard($tmp_board);
        }
        foreach ($cites as $matches) {
            $_board = $matches[2][0];
            $cite = @$matches[3][0];
            // preg_match_all is not multibyte-safe
            foreach ($matches as &$match) {
                $match[1] = mb_strlen(substr($body_tmp, 0, $match[1]));
            }
            if ($cite) {
                if (isset($cited_posts[$_board][$cite])) {
                    $link = $cited_posts[$_board][$cite];
                    $replacement = '<a ' . ($_board == $board['uri'] ? 'onclick="highlightReply(\'' . $cite . '\', event);" ' : '') . 'href="' . $link . '">' . '&gt;&gt;&gt;/' . $_board . '/' . $cite . '</a>';
                    $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0]));
                    $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]);
开发者ID:Cipherwraith,项目名称:infinity,代码行数:67,代码来源:functions.php


示例15: removeBan

     removeBan($_POST['ban_id']);
     header('Location: ?/IP/' . $ip, true, $config['redirect_http']);
 } elseif (hasPermission($config['mod']['create_notes']) && isset($_POST['note'])) {
     $query = prepare("INSERT INTO `ip_notes` VALUES(NULL, :ip, :mod, :time, :body)");
     $query->bindValue(':ip', $ip);
     $query->bindValue(':mod', $mod['id'], PDO::PARAM_INT);
     $query->bindValue(':time', time(), PDO::PARAM_INT);
     markup($_POST['note']);
     $query->bindValue(':body', $_POST['note']);
     $query->execute() or error(db_error($query));
     header('Location: ?/IP/' . $ip, true, $config['redirect_http']);
 } else {
     $body = '';
     $boards = listBoards();
     foreach ($boards as &$_board) {
         openBoard($_board['uri']);
         $temp = '';
         $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `ip` = :ip ORDER BY `sticky` DESC, `time` DESC LIMIT :limit", $_board['uri']));
         $query->bindValue(':ip', $ip);
         $query->bindValue(':limit', $config['mod']['ip_recentposts'], PDO::PARAM_INT);
         $query->execute() or error(db_error($query));
         while ($post = $query->fetch()) {
             if (!$post['thread']) {
                 $po = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], '?/', $mod, false);
             } else {
                 $po = new Post($post['id'], $post['thread'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], '?/', $mod);
             }
             $temp .= $po->build(true) . '<hr/>';
         }
         if (!empty($temp)) {
             $body .= '<fieldset><legend>Last ' . $query->rowCount() . ' posts on <a href="?/' . sprintf($config['board_path'], $_board['uri']) . $config['file_index'] . '">' . sprintf($config['board_abbreviation'], $_board['uri']) . ' - ' . $_board['title'] . '</a></legend>' . $temp . '</fieldset>';
开发者ID:niksfish,项目名称:Tinyboard,代码行数:31,代码来源:mod.php


示例16: homepage

 public function homepage($settings)
 {
     global $config, $board;
     $recent_images = array();
     $recent_posts = array();
     $stats = array();
     $boards = listBoards();
     $query = '';
     foreach ($boards as &$_board) {
         if (in_array($_board['uri'], $this->excluded)) {
             continue;
         }
         $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE `file` IS NOT NULL AND `file` != 'deleted' AND `thumb` != 'spoiler' UNION ALL ", $_board['uri'], $_board['uri']);
     }
     $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int) $settings['limit_images'], $query);
     $query = query($query) or error(db_error());
     while ($post = $query->fetch()) {
         openBoard($post['board']);
         // board settings won't be available in the template file, so generate links now
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $post['id']) . '#' . $post['id'];
         $post['src'] = $config['uri_thumb'] . $post['thumb'];
         $recent_images[] = $post;
     }
     $query = '';
     foreach ($boards as &$_board) {
         if (in_array($_board['uri'], $this->excluded)) {
             continue;
         }
         $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` UNION ALL ", $_board['uri'], $_board['uri']);
     }
     $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int) $settings['limit_posts'], $query);
     $query = query($query) or error(db_error());
     while ($post = $query->fetch()) {
         openBoard($post['board']);
         $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $post['id']) . '#' . $post['id'];
         $post['snippet'] = pm_snippet($post['body'], 30);
         $post['board_name'] = $board['name'];
         $recent_posts[] = $post;
     }
     // Total posts
     $query = 'SELECT SUM(`top`) AS `count` FROM (';
     foreach ($boards as &$_board) {
         if (in_array($_board['uri'], $this->excluded)) {
             continue;
         }
         $query .= sprintf("SELECT MAX(`id`) AS `top` FROM `posts_%s` UNION ALL ", $_board['uri']);
     }
     $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query);
     $query = query($query) or error(db_error());
     $res = $query->fetch();
     $stats['total_posts'] = number_format($res['count']);
     // Unique IPs
     $query = 'SELECT COUNT(DISTINCT(`ip`)) AS `count` FROM (';
     foreach ($boards as &$_board) {
         if (in_array($_board['uri'], $this->excluded)) {
             continue;
         }
         $query .= sprintf("SELECT `ip` FROM `posts_%s` UNION ALL ", $_board['uri']);
     }
     $query = pre 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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