本文整理汇总了PHP中url_friendly函数的典型用法代码示例。如果您正苦于以下问题:PHP url_friendly函数的具体用法?PHP url_friendly怎么用?PHP url_friendly使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了url_friendly函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($id = null, $name = null, $page = null, $pid = null)
{
global $lang_common, $lang_post, $lang_topic, $lang_bbeditor, $pd;
if ($this->user->g_read_board == '0') {
message($lang_common['No view'], '403');
}
// Load the viewtopic.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/topic.php';
// Load the post.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/post.php';
// Antispam feature
require FEATHER_ROOT . 'lang/' . $this->user->language . '/antispam.php';
$index_questions = rand(0, count($lang_antispam_questions) - 1);
// BBcode toolbar feature
require FEATHER_ROOT . 'lang/' . $this->user['language'] . '/bbeditor.php';
// Load the viewtopic.php model file
require_once FEATHER_ROOT . 'model/viewtopic.php';
// Fetch some informations about the topic TODO
$cur_topic = $this->model->get_info_topic($id);
// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = $cur_topic['moderators'] != '' ? unserialize($cur_topic['moderators']) : array();
$is_admmod = $this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false;
if ($is_admmod) {
$admin_ids = get_admin_ids();
}
// Can we or can we not post replies?
$post_link = $this->model->get_post_link($id, $cur_topic['closed'], $cur_topic['post_replies'], $is_admmod);
// Add/update this topic in our list of tracked topics
if (!$this->user->is_guest) {
$tracked_topics = get_tracked_topics();
$tracked_topics['topics'][$id] = time();
set_tracked_topics($tracked_topics);
}
// Determine the post offset (based on $_GET['p'])
$num_pages = ceil(($cur_topic['num_replies'] + 1) / $this->user->disp_posts);
$p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
$start_from = $this->user->disp_posts * ($p - 1);
$url_topic = url_friendly($cur_topic['subject']);
$url_forum = url_friendly($cur_topic['forum_name']);
// Generate paging links
$paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'topic/' . $id . '/' . $url_topic . '/#');
if ($this->config['o_censoring'] == '1') {
$cur_topic['subject'] = censor_words($cur_topic['subject']);
}
$quickpost = $this->model->is_quickpost($cur_topic['post_replies'], $cur_topic['closed'], $is_admmod);
$subscraction = $this->model->get_subscraction($cur_topic['is_subscribed'], $id);
// Add relationship meta tags
$page_head = $this->model->get_page_head($id, $num_pages, $p, $url_topic);
$page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_topic['forum_name']), feather_escape($cur_topic['subject']));
define('FEATHER_ALLOW_INDEX', 1);
define('FEATHER_ACTIVE_PAGE', 'viewtopic');
$this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->setPageHead($page_head)->display();
$forum_id = $cur_topic['forum_id'];
require FEATHER_ROOT . 'include/parser.php';
$this->feather->render('viewtopic.php', array('id' => $id, 'p' => $p, 'post_data' => $this->model->print_posts($id, $start_from, $cur_topic, $is_admmod), 'lang_common' => $lang_common, 'lang_topic' => $lang_topic, 'lang_post' => $lang_post, 'lang_bbeditor' => $lang_bbeditor, 'cur_topic' => $cur_topic, 'subscraction' => $subscraction, 'is_admmod' => $is_admmod, 'feather_config' => $this->config, 'paging_links' => $paging_links, 'post_link' => $post_link, 'start_from' => $start_from, 'lang_antispam' => $lang_antispam, 'pid' => $pid, 'quickpost' => $quickpost, 'index_questions' => $index_questions, 'lang_antispam_questions' => $lang_antispam_questions, 'url_forum' => $url_forum, 'url_topic' => $url_topic, 'feather' => $this->feather));
// Increment "num_views" for topic
$this->model->increment_views($id);
$this->footer->display('viewtopic', $id, $p, $pid, $cur_topic['forum_id'], $num_pages);
}
示例2: generate_quickjump_cache
function generate_quickjump_cache($group_id = false)
{
global $lang_common;
$groups = array();
// If a group_id was supplied, we generate the quick jump cache for that group only
if ($group_id !== false) {
// Is this group even allowed to read forums?
$read_board = \DB::for_table('groups')->where('g_id', $group_id)->find_one_col('g_read_board');
$groups[$group_id] = $read_board;
} else {
// A group_id was not supplied, so we generate the quick jump cache for all groups
$select_quickjump_all_groups = array('g_id', 'g_read_board');
$result = \DB::for_table('groups')->select_many($select_quickjump_all_groups)->find_many();
foreach ($result as $row) {
$groups[$row['g_id']] = $row['g_read_board'];
}
}
// Loop through the groups in $groups and output the cache for each of them
foreach ($groups as $group_id => $read_board) {
// Output quick jump as PHP code
$output = '<?php' . "\n\n" . 'if (!defined(\'FEATHER\')) exit;' . "\n" . 'define(\'FEATHER_QJ_LOADED\', 1);' . "\n" . '$forum_id = isset($forum_id) ? $forum_id : 0;' . "\n\n" . '?>';
if ($read_board == '1') {
$select_generate_quickjump_cache = array('cid' => 'c.id', 'c.cat_name', 'fid' => 'f.id', 'f.forum_name', 'f.redirect_url');
$where_generate_quickjump_cache = array(array('fp.read_forum' => 'IS NULL'), array('fp.read_forum' => '1'));
$order_by_generate_quickjump_cache = array('c.disp_position', 'c.id', 'f.disp_position');
$result = \DB::for_table('categories')->table_alias('c')->select_many($select_generate_quickjump_cache)->inner_join('forums', array('c.id', '=', 'f.cat_id'), 'f')->left_outer_join('forum_perms', array('fp.forum_id', '=', 'f.id'), 'fp')->left_outer_join('forum_perms', array('fp.group_id', '=', $group_id), null, true)->where_any_is($where_generate_quickjump_cache)->where_null('f.redirect_url')->order_by_many($order_by_generate_quickjump_cache)->find_many();
if ($result) {
$output .= "\t\t\t\t" . '<form id="qjump" method="get" action="">' . "\n\t\t\t\t\t" . '<div><label><span><?php echo $lang_common[\'Jump to\'] ?>' . '<br /></span>' . "\n\t\t\t\t\t" . '<select name="id" onchange="window.location=(\'' . get_link('forum/') . '\'+this.options[this.selectedIndex].value)">' . "\n";
$cur_category = 0;
foreach ($result as $cur_forum) {
if ($cur_forum['cid'] != $cur_category) {
// A new category since last iteration?
if ($cur_category) {
$output .= "\t\t\t\t\t\t" . '</optgroup>' . "\n";
}
$output .= "\t\t\t\t\t\t" . '<optgroup label="' . feather_escape($cur_forum['cat_name']) . '">' . "\n";
$cur_category = $cur_forum['cid'];
}
$redirect_tag = $cur_forum['redirect_url'] != '' ? ' >>>' : '';
$output .= "\t\t\t\t\t\t\t" . '<option value="' . $cur_forum['fid'] . '/' . url_friendly($cur_forum['forum_name']) . '/' . '"<?php echo ($forum_id == ' . $cur_forum['fid'] . ') ? \' selected="selected"\' : \'\' ?>>' . feather_escape($cur_forum['forum_name']) . $redirect_tag . '</option>' . "\n";
}
$output .= "\t\t\t\t\t\t" . '</optgroup>' . "\n\t\t\t\t\t" . '</select></label>' . "\n\t\t\t\t\t" . '<input type="submit" value="<?php echo $lang_common[\'Go\'] ?>" accesskey="g" />' . "\n\t\t\t\t\t" . '</div>' . "\n\t\t\t\t" . '</form>' . "\n";
}
}
featherbb_write_cache_file('cache_quickjump_' . $group_id . '.php', $output);
}
}
示例3: display
public function display($id, $name = null, $page = null)
{
global $lang_common, $lang_forum;
if ($this->user->g_read_board == '0') {
message($lang_common['No view'], '403');
}
if ($id < 1) {
message($lang_common['Bad request'], '404');
}
// Load the viewforum.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/forum.php';
// Fetch some informations about the forum
$cur_forum = $this->model->get_info_forum($id);
// Is this a redirect forum? In that case, redirect!
if ($cur_forum['redirect_url'] != '') {
header('Location: ' . $cur_forum['redirect_url']);
exit;
}
// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
$is_admmod = $this->user->g_id == FEATHER_ADMIN || $this->user->g_moderator == '1' && array_key_exists($this->user->username, $mods_array) ? true : false;
$sort_by = $this->model->sort_forum_by($cur_forum['sort_by']);
// Can we or can we not post new topics?
if ($cur_forum['post_topics'] == '' && $this->user->g_post_topics == '1' || $cur_forum['post_topics'] == '1' || $is_admmod) {
$post_link = "\t\t\t" . '<p class="postlink conr"><a href="' . get_link('post/new-topic/' . $id . '/') . '">' . $lang_forum['Post topic'] . '</a></p>' . "\n";
} else {
$post_link = '';
}
// Determine the topic offset (based on $page)
$num_pages = ceil($cur_forum['num_topics'] / $this->user->disp_topics);
$p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
$start_from = $this->user->disp_topics * ($p - 1);
$url_forum = url_friendly($cur_forum['forum_name']);
// Generate paging links
$paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'forum/' . $id . '/' . $url_forum . '/#');
$forum_actions = $this->model->get_forum_actions($id, $this->config['o_forum_subscriptions'], $cur_forum['is_subscribed']);
$page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_forum['forum_name']));
define('FEATHER_ALLOW_INDEX', 1);
define('FEATHER_ACTIVE_PAGE', 'viewforum');
$page_head = $this->model->get_page_head($id, $num_pages, $p, $url_forum);
$this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->setPageHead($page_head)->display();
$this->feather->render('viewforum.php', array('id' => $id, 'forum_data' => $this->model->print_topics($id, $sort_by, $start_from), 'lang_common' => $lang_common, 'lang_forum' => $lang_forum, 'cur_forum' => $cur_forum, 'paging_links' => $paging_links, 'post_link' => $post_link, 'is_admmod' => $is_admmod, 'start_from' => $start_from, 'url_forum' => $url_forum, 'forum_actions' => $forum_actions));
$this->footer->display('viewforum', $id, $p, '', $id, $num_pages);
}
示例4: display
public function display($id, $name = null, $page = null)
{
global $lang_common, $lang_forum, $lang_misc;
if ($this->user->g_read_board == '0') {
message($lang_common['No view'], '403');
}
// Load the viewforum.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/forum.php';
// Load the misc.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/misc.php';
// Make sure that only admmods allowed access this page
$moderators = $this->model->get_moderators($id);
$mods_array = $moderators != '' ? unserialize($moderators) : array();
if ($this->user->g_id != FEATHER_ADMIN && ($this->user->g_moderator == '0' || !array_key_exists($this->user->username, $mods_array))) {
message($lang_common['No permission'], '403');
}
// Fetch some info about the forum
$cur_forum = $this->model->get_forum_info($id);
// Is this a redirect forum? In that case, abort!
if ($cur_forum['redirect_url'] != '') {
message($lang_common['Bad request'], '404');
}
$sort_by = $this->model->forum_sort_by($cur_forum['sort_by']);
// Determine the topic offset (based on $_GET['p'])
$num_pages = ceil($cur_forum['num_topics'] / $this->user->disp_topics);
$p = !isset($page) || $page <= 1 || $page > $num_pages ? 1 : intval($page);
$start_from = $this->user->disp_topics * ($p - 1);
$url_forum = url_friendly($cur_forum['forum_name']);
// Generate paging links
$paging_links = '<span class="pages-label">' . $lang_common['Pages'] . ' </span>' . paginate($num_pages, $p, 'moderate/forum/' . $id . '/#');
$page_title = array(feather_escape($this->config['o_board_title']), feather_escape($cur_forum['forum_name']));
define('FEATHER_ACTIVE_PAGE', 'moderate');
$this->header->setTitle($page_title)->setPage($p)->setPagingLinks($paging_links)->display();
$this->feather->render('moderate/moderator_forum.php', array('lang_common' => $lang_common, 'lang_misc' => $lang_misc, 'id' => $id, 'p' => $p, 'url_forum' => $url_forum, 'cur_forum' => $cur_forum, 'paging_links' => $paging_links, 'feather_config' => $this->config, 'lang_forum' => $lang_forum, 'topic_data' => $this->model->display_topics($id, $sort_by, $start_from), 'start_from' => $start_from));
$this->footer->display();
}
示例5: get_extensions
$db->update('topics', $update, 'id=:id', $data);
($hook = get_extensions('delete_poll_after_deletion')) ? eval($hook) : null;
redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll deleted redirect']);
}
($hook = get_extensions('delete_poll_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $lang_poll['Delete poll']);
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$tpl = load_template('delete_poll.tpl');
echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_delete'], array($id)), 'csrf_token' => generate_csrf_token()));
} else {
if (isset($_GET['reset'])) {
if (isset($_POST['form_sent'])) {
confirm_referrer('poll_misc.php');
$update = array('voters' => '', 'votes' => '');
$data = array(':id' => $cur_topic['pid']);
$db->update('polls', $update, 'id=:id', $data);
redirect(panther_link($panther_url['topic'], array($id, url_friendly($cur_topic['subject']))), $lang_poll['Poll reset redirect']);
}
$page_title = array($panther_config['o_board_title'], $lang_poll['Reset poll']);
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
($hook = get_extensions('reset_poll_before_display')) ? eval($hook) : null;
$tpl = load_template('reset_poll.tpl');
echo $tpl->render(array('lang_poll' => $lang_poll, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['poll_reset'], array($id)), 'csrf_token' => generate_csrf_token()));
} else {
message($lang_common['Bad request']);
}
}
}
require PANTHER_ROOT . 'footer.php';
示例6: array
$results = array();
foreach ($search_set as $cur_search) {
if ($panther_config['o_censoring'] == '1') {
$cur_search['subject'] = censor_words($cur_search['subject']);
}
if ($show_as == 'posts') {
++$post_count;
if ($panther_config['o_censoring'] == '1') {
$cur_search['message'] = censor_words($cur_search['message']);
}
$results[] = array('pid' => $cur_search, 'message' => $parser->parse_message($cur_search['message'], $cur_search['hide_smilies']), 'posted' => format_time($cur_search['pposted']), 'topic_url' => panther_link($panther_url['topic'], array($cur_search['tid'], url_friendly($cur_search['subject']))), 'post_url' => panther_link($panther_url['post'], array($cur_search['pid'])), 'post_no' => $start_from + $post_count, 'post_count' => $post_count, 'forum' => array('url' => panther_link($panther_url['forum'], array($cur_search['forum_id'], url_friendly($cur_search['forum_name']))), 'name' => $cur_search['forum_name']), 'subject' => $cur_search['subject'], 'poster' => $cur_search['poster_id'] > 1 ? colourize_group($cur_search['pposter'], $cur_search['group_id'], $cur_search['poster_id']) : '', 'post_id' => $cur_search['pid'], 'first_post_id' => $cur_search['first_post_id'], 'num_replies' => forum_number_format($cur_search['num_replies']), 'viewed' => !$panther_user['is_guest'] && $cur_search['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']) ? false : true);
} else {
++$topic_count;
$url_subject = url_friendly($cur_search['subject']);
$num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $panther_user['disp_posts']);
$results[$cur_search['tid']] = array('count' => ++$topic_count, 'topic_count' => forum_number_format($topic_count + $start_from), 'cur_search' => $cur_search, 'topic_poster' => $cur_search['up_id'] > 1 ? colourize_group($cur_search['poster'], $cur_search['up_group_id'], $cur_search['up_id']) : colourize_group($cur_search['poster'], PANTHER_GUEST), 'subject' => $cur_search['subject'], 'sticky' => $cur_search['sticky'], 'closed' => $cur_search['closed'], 'question' => $cur_search['question'], 'topic_link' => panther_link($panther_url['topic'], array($cur_search['tid'], $url_subject)), 'num_pages' => $num_pages_topic, 'pagination' => paginate($num_pages_topic, -1, $panther_url['topic_paginate'], array($cur_search['tid'], $url_subject)), 'new' => !$panther_user['is_guest'] && $cur_search['last_post'] > $panther_user['last_visit'] && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post']) ? '1' : '0', 'last_post_avatar' => generate_avatar_markup($cur_search['uid'], $cur_search['email'], $cur_search['use_gravatar'], array(32, 32)), 'last_post_link' => panther_link($panther_url['post'], array($cur_search['last_post_id'])), 'last_post' => format_time($cur_search['last_post']), 'last_poster' => $cur_search['uid'] > 1 ? colourize_group($cur_search['last_poster'], $cur_search['group_id'], $cur_search['uid']) : colourize_group($cur_search['last_poster'], PANTHER_GUEST), 'num_replies' => forum_number_format($cur_search['num_replies']), 'forum' => array('url' => panther_link($panther_url['forum'], array($cur_search['forum_id'], url_friendly($cur_search['forum_name']))), 'name' => $cur_search['forum_name']));
if ($results[$cur_search['tid']]['new'] == '1') {
$results[$cur_search['tid']]['new_link'] = panther_link($panther_url['topic_new_posts'], array($cur_search['tid'], $url_subject));
}
}
}
$tpl = load_template('search_results.tpl');
echo $tpl->render(array('forum_actions' => $forum_actions, 'index_link' => panther_link($panther_url['index']), 'lang_common' => $lang_common, 'search_link' => panther_link($panther_url['search']), 'show_as' => $show_as, 'lang_search' => $lang_search, 'lang_topic' => $lang_topic, 'lang_forum' => $lang_forum, 'pagination' => paginate($num_pages, $p, $panther_url['search_pagination'], array($search_id)), 'crumbs_text' => $crumbs_text, 'results' => $results, 'panther_config' => $panther_config));
require PANTHER_ROOT . 'footer.php';
} else {
message($lang_search['No hits']);
}
}
($hook = get_extensions('search_form_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $lang_search['Search']);
$focus_element = array('search', 'keywords');
示例7: message
//Reporting now made fun =)
if (!stopforumspam_report($panther_config['o_sfs_api'], $cur_post['poster_ip'], $email, $cur_post['poster'], $cur_post['message'])) {
message($lang_common['Unable to add spam data']);
}
}
}
if ($is_topic_post) {
// Delete the topic and all of its posts
delete_topic($cur_post['tid']);
update_forum($cur_post['fid']);
($hook = get_extensions('delete_after_delete')) ? eval($hook) : null;
redirect(panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), $lang_delete['Topic del redirect']);
} else {
// Delete just this one post
delete_post($id, $cur_post['tid']);
update_forum($cur_post['fid']);
// Redirect towards the previous post
$data = array(':tid' => $cur_post['tid'], ':id' => $id);
$ps = $db->select('posts', 'id', $data, 'topic_id=:tid AND id < :id', 'id DESC LIMIT 1');
$post_id = $ps->fetchColumn();
($hook = get_extensions('delete_after_delete')) ? eval($hook) : null;
redirect(panther_link($panther_url['post'], array($post_id)), $lang_delete['Post del redirect']);
}
}
require PANTHER_ROOT . 'include/parser.php';
$page_title = array($panther_config['o_board_title'], $lang_delete['Delete post']);
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$tpl = load_template('delete.tpl');
echo $tpl->render(array('lang_common' => $lang_common, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), 'post_link' => panther_link($panther_url['post'], array($id)), 'cur_post' => $cur_post, 'lang_delete' => $lang_delete, 'form_action' => panther_link($panther_url['delete'], array($id)), 'csrf_token' => generate_csrf_token(), 'is_topic_post' => $is_topic_post, 'posted' => format_time($cur_post['posted']), 'is_admmod' => $is_admmod, 'panther_config' => $panther_config, 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies'])));
require PANTHER_ROOT . 'footer.php';
示例8: foreach
foreach ($ps as $attachment) {
$attachments[] = array('id' => $attachment['id'], 'icon' => attach_icon($attachment['extension']), 'link' => panther_link($panther_url['attachment'], array($attachment['id'])), 'name' => $attachment['filename'], 'size' => sprintf($lang_post['Attachment size'], file_size($attachment['size'])), 'downloads' => sprintf($lang_post['Attachment downloads'], forum_number_format($attachment['downloads'])));
}
}
($hook = get_extensions('edit_before_header')) ? eval($hook) : null;
$page_title = array($panther_config['o_board_title'], $lang_post['Edit post']);
$required_fields = array('req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
$focus_element = array('edit', 'req_message');
define('PANTHER_ACTIVE_PAGE', 'index');
require PANTHER_ROOT . 'header.php';
$checkboxes = array();
if ($can_edit_subject && $is_admmod) {
$checkboxes[] = array('name' => 'stick_topic', 'title' => $lang_common['Stick topic'], 'checked' => isset($_POST['form_sent']) && isset($_POST['stick_topic']) || !isset($_POST['form_sent']) && $cur_post['sticky'] == '1' ? true : false);
}
if ($can_edit_subject && $cur_post['post_polls'] != '0' && $panther_user['g_post_polls'] == '1' && $panther_config['o_polls'] == '1') {
$checkboxes[] = array('name' => 'add_poll', 'title' => $lang_post['Add poll'], 'checked' => isset($_POST['add_poll']) ? true : false);
}
if ($panther_config['o_smilies'] == '1') {
$checkboxes[] = array('name' => 'hide_smilies', 'title' => $lang_post['Hide smilies'], 'checked' => isset($_POST['form_sent']) && isset($_POST['hide_smilies']) || !isset($_POST['form_sent']) && $cur_post['hide_smilies'] == '1' ? true : false);
}
if ($is_admmod) {
$checkboxes[] = array('id' => 'silent_edit', 'name' => 'silent', 'title' => $lang_post['Silent edit'], 'checked' => isset($_POST['form_sent']) && isset($_POST['silent']) || !isset($_POST['form_sent']) ? true : false);
}
$render = array('errors' => $errors, 'lang_post' => $lang_post, 'lang_common' => $lang_common, 'preview' => isset($_POST['preview']) ? true : false, 'can_edit_subject' => $can_edit_subject, 'subject' => isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject'], 'can_upload' => $can_upload, 'can_delete' => $can_delete, 'panther_user' => $panther_user, 'max_size' => $max_size, 'attachments' => $attachments, 'is_admmod' => $is_admmod, 'edit_reason' => isset($_POST['edit_reason']) ? $_POST['edit_reason'] : $cur_post['edit_reason'], 'checkboxes' => $checkboxes, 'index_link' => panther_link($panther_url['index']), 'forum_link' => panther_link($panther_url['forum'], array($cur_post['fid'], url_friendly($cur_post['forum_name']))), 'cur_post' => $cur_post, 'topic_link' => panther_link($panther_url['topic'], array($cur_post['tid'], url_friendly($cur_post['subject']))), 'form_action' => panther_link($panther_url['edit_edit'], array($id)), 'csrf_token' => generate_csrf_token(), 'message' => isset($_POST['req_message']) ? $message : $cur_post['message'], 'panther_config' => $panther_config, 'quickpost_links' => array('form_action' => panther_link($panther_url['new_reply'], array($id)), 'csrf_token' => generate_csrf_token('post.php'), 'bbcode' => panther_link($panther_url['help'], array('bbcode')), 'url' => panther_link($panther_url['help'], array('url')), 'img' => panther_link($panther_url['help'], array('img')), 'smilies' => panther_link($panther_url['help'], array('smilies'))));
if (isset($_POST['preview'])) {
require_once PANTHER_ROOT . 'include/parser.php';
$render['preview'] = $parser->parse_message($message, $hide_smilies);
}
$tpl = load_template('edit.tpl');
echo $tpl->render($render);
require PANTHER_ROOT . 'footer.php';
示例9: array
$ps = $db->select('topics', 'num_replies', $topic_data, 'id=:id');
$num_replies = $ps->fetchColumn();
$update = array('num_replies' => $num_replies + 1, 'last_post' => $posted, 'last_post_id' => $last_id, 'last_poster' => $poster);
$db->update('topics', $update, 'id=:id', $topic_data);
update_search_index('post', $post_id, $post['message']);
update_forum($post['forum_id']);
redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post approved redirect']);
}
} else {
if ($is_topic_post) {
permanently_delete_topic($post['topic_id']);
redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Topic deleted redirect']);
} else {
permanently_delete_post($post_id);
redirect(panther_link($panther_url['admin_deleted']), $lang_admin_deleted['Post deleted redirect']);
}
}
}
$ps = $db->run('SELECT t.id AS topic_id, t.forum_id, p.poster, p.poster_id, p.posted, p.message, p.id AS pid, p.hide_smilies, t.subject, f.forum_name FROM ' . $db->prefix . 'posts AS p LEFT JOIN ' . $db->prefix . 'topics AS t ON p.topic_id=t.id LEFT JOIN ' . $db->prefix . 'forums AS f ON t.forum_id=f.id WHERE p.deleted=1 OR t.deleted=1 ORDER BY p.posted DESC');
require PANTHER_ROOT . 'include/parser.php';
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Deleted']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
generate_admin_menu('deleted');
$posts = array();
foreach ($ps as $cur_post) {
$posts[] = array('id' => $cur_post['pid'], 'posted' => format_time($cur_post['posted']), 'message' => $parser->parse_message($cur_post['message'], $cur_post['hide_smilies']), 'poster' => $cur_post['poster'] != '' ? array('href' => panther_link($panther_url['profile'], array($cur_post['poster_id'], url_friendly($cur_post['poster']))), 'poster' => $cur_post['poster']) : '', 'forum' => $cur_post['forum_name'] != '' ? array('href' => panther_link($panther_url['forum'], array($cur_post['forum_id'], url_friendly($cur_post['forum_name']))), 'forum_name' => $cur_post['forum_name']) : '', 'topic' => $cur_post['subject'] != '' ? array('href' => panther_link($panther_url['topic'], array($cur_post['topic_id'], url_friendly($cur_post['subject']))), 'subject' => $cur_post['subject']) : '', 'post' => $cur_post['pid'] != '' ? array('href' => panther_link($panther_url['post'], array($cur_post['pid'])), 'post' => sprintf($lang_admin_deleted['Post ID'], $cur_post['pid'])) : '');
}
$tpl = load_template('admin_deleted.tpl');
echo $tpl->render(array('lang_admin_common' => $lang_admin_common, 'lang_admin_deleted' => $lang_admin_deleted, 'lang_common' => $lang_common, 'form_action' => panther_link($panther_url['admin_deleted']), 'csrf_token' => generate_csrf_token(PANTHER_ADMIN_DIR . '/deleted.php'), 'posts' => $posts));
require PANTHER_ROOT . 'footer.php';
示例10: message
$db->insert('announcements', $insert);
$id = $db->lastInsertId($db->prefix . 'announcements');
$redirect_msg = $lang_admin_announcements['added redirect'];
} else {
if ($id < 1) {
message($lang_common['Bad request']);
}
$data = array(':id' => $id);
$db->update('announcements', $insert, 'id=:id', $data);
$redirect_msg = $lang_admin_announcements['edit redirect'];
}
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require PANTHER_ROOT . 'include/cache.php';
}
generate_announcements_cache();
redirect(panther_link($panther_url['announcement_fid'], array($id, $forums[0], url_friendly($title))), $redirect_msg);
} else {
if ($action == 'delete') {
$id = isset($_POST['id']) ? intval($_POST['id']) : 0;
if ($id < 1) {
message($lang_common['Bad request']);
}
$data = array(':id' => $id);
$db->delete('announcements', 'id=:id', $data);
if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
require PANTHER_ROOT . 'include/cache.php';
}
redirect(panther_link($panther_url['admin_announcements']), $lang_admin_announcements['delete redirect']);
} else {
message($lang_common['Bad request']);
}
示例11: define
* License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
*/
if (!defined('PANTHER')) {
define('PANTHER_ROOT', __DIR__ . '/');
require PANTHER_ROOT . 'include/common.php';
}
if ($panther_user['g_read_board'] == '0') {
message($lang_common['No view'], false, '403 Forbidden');
}
// Load the help.php language file
require PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/help.php';
$page_title = array($panther_config['o_board_title'], $lang_help['Help']);
define('PANTHER_ACTIVE_PAGE', 'help');
require PANTHER_ROOT . 'header.php';
// Display the smiley set
require PANTHER_ROOT . 'include/parser.php';
$smiley_groups = array();
foreach ($parser->smilies as $smiley_text => $smiley_img) {
$smiley_groups[$smiley_img][] = $smiley_text;
}
($hook = get_extensions('help_before_display')) ? eval($hook) : null;
$ps = $db->select('topics', 'subject, id', array(), '', 'id ASC LIMIT 1');
$cur_topic = $ps->fetch();
$ps = $db->select('posts', 'id', array(), '', 'id ASC LIMIT 1');
$cur_post = $ps->fetchColumn();
$ps = $db->select('users', 'id, username, group_id', array(), 'id>1', 'id ASC LIMIT 1');
$user = $ps->fetch();
$forum = $panther_forums[key($panther_forums)];
$tpl = load_template('help.tpl');
echo $tpl->render(array('lang_help' => $lang_help, 'panther_config' => $panther_config, 'lang_common' => $lang_common, 'base_url' => panther_link($panther_url['index']), 'help_page' => panther_link($panther_url['help'], array('url')), 'topic_link' => panther_link($panther_url['topic'], array($cur_topic['id'], url_friendly($cur_topic['subject']))), 'topic_id' => $cur_topic['id'], 'post_id' => $cur_post, 'post_link' => panther_link($panther_url['post'], array($cur_post)), 'forum_id' => $forum['id'], 'forum_link' => panther_link($panther_url['forum'], array($forum['id'], url_friendly($forum['forum_name']))), 'formatted_username' => colourize_group($user['username'], $user['group_id'], $user['id']), 'username' => $user['username'], 'smiley_path' => $panther_config['o_smilies_dir'] != '' ? $panther_config['o_smilies_dir'] : get_base_url() . '/' . $panther_config['o_smilies_path'] . '/', 'smiley_groups' => $smiley_groups));
$db->end_transaction();
示例12: display_search_results
public function display_search_results($search)
{
global $lang_forum, $lang_common, $lang_topic, $lang_search, $pd;
// Get topic/forum tracking data
if (!$this->user->is_guest) {
$tracked_topics = get_tracked_topics();
}
$post_count = $topic_count = 0;
foreach ($search['search_set'] as $cur_search) {
$forum = '<a href="' . get_link('forum/' . $cur_search['forum_id'] . '/' . url_friendly($cur_search['forum_name']) . '/') . '">' . feather_escape($cur_search['forum_name']) . '</a>';
$url_topic = url_friendly($cur_search['subject']);
if ($this->config['o_censoring'] == '1') {
$cur_search['subject'] = censor_words($cur_search['subject']);
}
if ($search['show_as'] == 'posts') {
++$post_count;
$cur_search['icon_type'] = 'icon';
if (!$this->user->is_guest && $cur_search['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post'])) {
$cur_search['item_status'] = 'inew';
$cur_search['icon_type'] = 'icon icon-new';
$cur_search['icon_text'] = $lang_topic['New icon'];
} else {
$cur_search['item_status'] = '';
$cur_search['icon_text'] = '<!-- -->';
}
if ($this->config['o_censoring'] == '1') {
$cur_search['message'] = censor_words($cur_search['message']);
}
$cur_search['message'] = parse_message($cur_search['message'], $cur_search['hide_smilies']);
$pposter = feather_escape($cur_search['pposter']);
if ($cur_search['poster_id'] > 1 && $this->user->g_view_users == '1') {
$cur_search['pposter_disp'] = '<strong><a href="' . get_link('user/' . $cur_search['poster_id'] . '/') . '">' . $pposter . '</a></strong>';
} else {
$cur_search['pposter_disp'] = '<strong>' . $pposter . '</strong>';
}
$this->feather->render('search/posts.php', array('post_count' => $post_count, 'url_topic' => $url_topic, 'cur_search' => $cur_search, 'forum' => $forum, 'lang_common' => $lang_common, 'lang_search' => $lang_search, 'lang_topic' => $lang_topic));
} else {
++$topic_count;
$status_text = array();
$cur_search['item_status'] = $topic_count % 2 == 0 ? 'roweven' : 'rowodd';
$cur_search['icon_type'] = 'icon';
$subject = '<a href="' . get_link('topic/' . $cur_search['tid'] . '/' . $url_topic . '/') . '">' . feather_escape($cur_search['subject']) . '</a> <span class="byuser">' . $lang_common['by'] . ' ' . feather_escape($cur_search['poster']) . '</span>';
if ($cur_search['sticky'] == '1') {
$cur_search['item_status'] .= ' isticky';
$status_text[] = '<span class="stickytext">' . $lang_forum['Sticky'] . '</span>';
}
if ($cur_search['closed'] != '0') {
$status_text[] = '<span class="closedtext">' . $lang_forum['Closed'] . '</span>';
$cur_search['item_status'] .= ' iclosed';
}
if (!$this->user->is_guest && $cur_search['last_post'] > $this->user->last_visit && (!isset($tracked_topics['topics'][$cur_search['tid']]) || $tracked_topics['topics'][$cur_search['tid']] < $cur_search['last_post']) && (!isset($tracked_topics['forums'][$cur_search['forum_id']]) || $tracked_topics['forums'][$cur_search['forum_id']] < $cur_search['last_post'])) {
$cur_search['item_status'] .= ' inew';
$cur_search['icon_type'] = 'icon icon-new';
$subject = '<strong>' . $subject . '</strong>';
$subject_new_posts = '<span class="newtext">[ <a href="' . get_link('topic/' . $cur_search['tid'] . '/action/new/') . '" title="' . $lang_common['New posts info'] . '">' . $lang_common['New posts'] . '</a> ]</span>';
} else {
$subject_new_posts = null;
}
// Insert the status text before the subject
$subject = implode(' ', $status_text) . ' ' . $subject;
$num_pages_topic = ceil(($cur_search['num_replies'] + 1) / $this->user->disp_posts);
if ($num_pages_topic > 1) {
$subject_multipage = '<span class="pagestext">[ ' . paginate($num_pages_topic, -1, 'topic/' . $cur_search['tid'] . '/' . $url_topic . '/#') . ' ]</span>';
} else {
$subject_multipage = null;
}
// Should we show the "New posts" and/or the multipage links?
if (!empty($subject_new_posts) || !empty($subject_multipage)) {
$subject .= !empty($subject_new_posts) ? ' ' . $subject_new_posts : '';
$subject .= !empty($subject_multipage) ? ' ' . $subject_multipage : '';
}
if (!isset($cur_search['start_from'])) {
$start_from = 0;
} else {
$start_from = $cur_search['start_from'];
}
$this->feather->render('search/topics.php', array('cur_search' => $cur_search, 'start_from' => $start_from, 'topic_count' => $topic_count, 'subject' => $subject, 'forum' => $forum, 'lang_common' => $lang_common));
}
}
}
示例13: check_errors_before_post
public function check_errors_before_post($fid, $tid, $qid, $pid, $page, $errors)
{
global $lang_post, $lang_common, $lang_prof_reg, $lang_register, $lang_antispam, $lang_antispam_questions, $pd;
// Antispam feature
if ($this->user->is_guest) {
// It's a guest, so we have to validate the username
$errors = check_username(feather_trim($this->request->post('req_username')), $errors);
$question = $this->request->post('captcha_q') ? trim($this->request->post('captcha_q')) : '';
$answer = $this->request->post('captcha') ? strtoupper(trim($this->request->post('captcha'))) : '';
$lang_antispam_questions_array = array();
foreach ($lang_antispam_questions as $k => $v) {
$lang_antispam_questions_array[md5($k)] = strtoupper($v);
}
if (empty($lang_antispam_questions_array[$question]) || $lang_antispam_questions_array[$question] != $answer) {
$errors[] = $lang_antispam['Robot test fail'];
}
}
// Flood protection
if ($this->request->post('preview') != '' && $this->user->last_post != '' && time() - $this->user->last_post < $this->user->g_post_flood) {
$errors[] = sprintf($lang_post['Flood start'], $this->user->g_post_flood, $this->user->g_post_flood - (time() - $this->user->last_post));
}
if ($tid) {
$subject_tid = DB::for_table('topics')->where('id', $tid)->find_one_col('subject');
if (!$subject_tid) {
message($lang_common['Bad request'], '404');
}
$url_subject = url_friendly($subject_tid);
} else {
$url_subject = '';
}
// If it's a new topic
if ($fid) {
$subject = feather_trim($this->request->post('req_subject'));
if ($this->config['o_censoring'] == '1') {
$censored_subject = feather_trim(censor_words($subject));
}
if ($subject == '') {
$errors[] = $lang_post['No subject'];
} elseif ($this->config['o_censoring'] == '1' && $censored_subject == '') {
$errors[] = $lang_post['No subject after censoring'];
} elseif (feather_strlen($subject) > 70) {
$errors[] = $lang_post['Too long subject'];
} elseif ($this->config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$this->user->is_admmod) {
$errors[] = $lang_post['All caps subject'];
}
}
if ($this->user->is_guest) {
$email = strtolower(feather_trim($this->config['p_force_guest_email'] == '1' ? $this->request->post('req_email') : $this->request->post('email')));
// Load the register.php/prof_reg.php language files
require FEATHER_ROOT . 'lang/' . $this->user->language . '/prof_reg.php';
require FEATHER_ROOT . 'lang/' . $this->user->language . '/register.php';
if ($this->config['p_force_guest_email'] == '1' || $email != '') {
require FEATHER_ROOT . 'include/email.php';
if (!is_valid_email($email)) {
$errors[] = $lang_common['Invalid email'];
}
// Check if it's a banned email address
// we should only check guests because members' addresses are already verified
if ($this->user->is_guest && is_banned_email($email)) {
if ($this->config['p_allow_banned_email'] == '0') {
$errors[] = $lang_prof_reg['Banned email'];
}
$errors['banned_email'] = 1;
// Used later when we send an alert email
}
}
}
// Clean up message from POST
$message = feather_linebreaks(feather_trim($this->request->post('req_message')));
// Here we use strlen() not feather_strlen() as we want to limit the post to FEATHER_MAX_POSTSIZE bytes, not characters
if (strlen($message) > FEATHER_MAX_POSTSIZE) {
$errors[] = sprintf($lang_post['Too long message'], forum_number_format(FEATHER_MAX_POSTSIZE));
} elseif ($this->config['p_message_all_caps'] == '0' && is_all_uppercase($message) && !$this->user->is_admmod) {
$errors[] = $lang_post['All caps message'];
}
// Validate BBCode syntax
if ($this->config['p_message_bbcode'] == '1') {
require FEATHER_ROOT . 'include/parser.php';
$message = preparse_bbcode($message, $errors);
}
if (empty($errors)) {
if ($message == '') {
$errors[] = $lang_post['No message'];
} elseif ($this->config['o_censoring'] == '1') {
// Censor message to see if that causes problems
$censored_message = feather_trim(censor_words($message));
if ($censored_message == '') {
$errors[] = $lang_post['No message after censoring'];
}
}
}
return $errors;
}
示例14: get_base_url
exit;
}
?>
<div class="linkst">
<div class="inbox">
<ul class="crumbs">
<li><a href="<?php
echo get_base_url();
?>
"><?php
echo $lang_common['Index'];
?>
</a></li>
<li><span>» </span><a href="<?php
echo get_link('forum/' . $cur_post['fid'] . '/' . url_friendly($cur_post['forum_name']) . '/');
?>
"><?php
echo feather_escape($cur_post['forum_name']);
?>
</a></li>
<li><span>» </span><a href="<?php
echo get_link('post/' . $id . '/#p' . $id);
?>
"><?php
echo feather_escape($cur_post['subject']);
?>
</a></li>
<li><span>» </span><strong><?php
echo $lang_misc['Report post'];
?>
示例15: newpost
//.........这里部分代码省略.........
// Load the post.php language file
require FEATHER_ROOT . 'lang/' . $this->user->language . '/post.php';
// Start with a clean slate
$errors = array();
$post = '';
if (!$this->user->is_guest) {
$focus_element[] = $fid ? 'req_subject' : 'req_message';
} else {
$required_fields['req_username'] = $lang_post['Guest name'];
$focus_element[] = 'req_username';
}
// Did someone just hit "Submit" or "Preview"?
if ($this->feather->request()->isPost()) {
// Include $pid and $page if needed for confirm_referrer function called in check_errors_before_post()
if ($this->request->post('pid')) {
$pid = $this->request->post('pid');
} else {
$pid = '';
}
if ($this->request->post('page')) {
$page = $this->request->post('page');
} else {
$page = '';
}
// Let's see if everything went right
$errors = $this->model->check_errors_before_post($fid, $tid, $qid, $pid, $page, $errors);
// Setup some variables before post
$post = $this->model->setup_variables($errors, $is_admmod);
// Did everything go according to plan?
if (empty($errors) && !$this->request->post('preview')) {
require FEATHER_ROOT . 'include/search_idx.php';
// If it's a reply
if ($tid) {
// Insert the reply, get the new_pid
$new = $this->model->insert_reply($post, $tid, $cur_posting, $is_subscribed);
// Should we send out notifications?
if ($this->config['o_topic_subscriptions'] == '1') {
$this->model->send_notifications_reply($tid, $cur_posting, $new['pid'], $post);
}
} elseif ($fid) {
// Insert the topic, get the new_pid
$new = $this->model->insert_topic($post, $fid);
// Should we send out notifications?
if ($this->config['o_forum_subscriptions'] == '1') {
$this->model->send_notifications_new_topic($post, $cur_posting, $new['tid']);
}
}
// If we previously found out that the email was banned
if ($this->user->is_guest && isset($errors['banned_email']) && $this->config['o_mailing_list'] != '') {
$this->model->warn_banned_user($post, $new['pid']);
}
// If the posting user is logged in, increment his/her post count
if (!$this->user->is_guest) {
$this->model->increment_post_count($post, $new['tid']);
}
redirect(get_link('post/' . $new['pid'] . '/#p' . $new['pid']), $lang_post['Post redirect']);
}
}
$quote = '';
// If a topic ID was specified in the url (it's a reply)
if ($tid) {
$action = $lang_post['Post a reply'];
$form = '<form id="post" method="post" action="' . get_link('post/reply/' . $tid . '/') . '" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
// If a quote ID was specified in the url
if (isset($qid)) {
$quote = $this->model->get_quote_message($qid, $tid);
$form = '<form id="post" method="post" action="' . get_link('post/reply/' . $tid . '/quote/' . $qid . '/') . '" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';
}
} elseif ($fid) {
$action = $lang_post['Post new topic'];
$form = '<form id="post" method="post" action="' . get_link('post/new-topic/' . $fid . '/') . '" onsubmit="return process_form(this)">';
} else {
message($lang_common['Bad request'], '404');
}
$url_forum = url_friendly($cur_posting['forum_name']);
$is_subscribed = $tid && $cur_posting['is_subscribed'];
if (isset($cur_posting['subject'])) {
$url_topic = url_friendly($cur_posting['subject']);
} else {
$url_topic = '';
}
$page_title = array(feather_escape($this->config['o_board_title']), $action);
$required_fields = array('req_email' => $lang_common['Email'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
if ($this->user->is_guest) {
$required_fields['captcha'] = $lang_antispam['Robot title'];
}
$focus_element = array('post');
define('FEATHER_ACTIVE_PAGE', 'post');
$this->header->setTitle($page_title)->setFocusElement($focus_element)->setRequiredFields($required_fields)->display();
// Get the current state of checkboxes
$checkboxes = $this->model->get_checkboxes($fid, $is_admmod, $is_subscribed);
// Check to see if the topic review is to be displayed
if ($tid && $this->config['o_topic_review'] != '0') {
$post_data = $this->model->topic_review($tid);
} else {
$post_data = '';
}
$this->feather->render('post.php', array('post' => $post, 'tid' => $tid, 'fid' => $fid, 'feather_config' => $this->config, 'feather_user' => $this->user, 'cur_posting' => $cur_posting, 'lang_common' => $lang_common, 'lang_post' => $lang_post, 'lang_antispam' => $lang_antispam, 'lang_antispam_questions' => $lang_antispam_questions, 'lang_bbeditor' => $lang_bbeditor, 'index_questions' => $index_questions, 'checkboxes' => $checkboxes, 'cur_posting' => $cur_posting, 'feather' => $this->feather, 'action' => $action, 'form' => $form, 'post_data' => $post_data, 'url_forum' => $url_forum, 'url_topic' => $url_topic, 'quote' => $quote, 'errors' => $errors, 'lang_bbeditor' => $lang_bbeditor));
$this->footer->display();
}