本文整理汇总了PHP中generate_text_for_display函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_text_for_display函数的具体用法?PHP generate_text_for_display怎么用?PHP generate_text_for_display使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_text_for_display函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page
/**
* Controller for route /paypal
*
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
*/
public function page()
{
$this->user->add_lang_ext('tas2580/paypal', 'common');
$amount_list = '';
$sql = 'SELECT *
FROM ' . $this->table_amount . '
ORDER BY amount_value';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$amount_list .= '<option value="' . number_format($row['amount_value'] / 100, 2) . '">' . number_format($row['amount_value'] / 100, 2) . '</option>';
}
$sql = 'SELECT *
FROM ' . $this->table_items . '
ORDER BY item_name';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('items', array('ITEM_NAME' => $row['item_name'], 'ITEM' => generate_text_for_display($row['item_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'ITEM_ID' => $row['item_id']));
}
$sql = 'SELECT *
FROM ' . $this->table_config;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$this->template->assign_vars(array('PAYPAL_TITLE' => $row['paypal_title'], 'PAYPAL_TEXT' => generate_text_for_display($row['paypal_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], 7), 'PAYPAL_EMAIL' => $row['paypal_email'], 'AMOUNT_LIST' => $amount_list, 'PAYPAL_ACTION' => $row['paypal_sandbox'] == 1 ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', 'S_SANDBOX' => $row['paypal_sandbox'] == 1 ? true : false, 'S_CURL' => function_exists('curl_init'), 'CURRENCY_CODE' => $this->currency_code_select($row['paypal_currency']), 'CURRENCY' => $row['paypal_currency'], 'USER_ID' => $this->user->data['user_id'], 'IPN_URL' => $this->helper->route('tas2580_paypal_ipn', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL), 'RETURN_URL' => $this->helper->route('tas2580_paypal_controller', array(), true, '', \Symfony\Component\Routing\Generator\UrlGeneratorInterface::ABSOLUTE_URL)));
return $this->helper->render('paypal_body.html', $row['paypal_title']);
}
示例2: page_header
public function page_header($event)
{
if ($this->auth->acl_get('u_did_you_know')) {
$sql_layer = $this->db->get_sql_layer();
switch ($sql_layer) {
case 'postgres':
$random = 'RANDOM()';
break;
case 'mssql':
case 'mssql_odbc':
$random = 'NEWID()';
break;
default:
$random = 'RAND()';
break;
}
$sql = 'SELECT word, bbcode_uid, bbcode_bitfield, bbcode_options
FROM ' . $this->did_you_know . "\n\t\t\t\tWHERE lang_iso = '{$this->user->data['user_lang']}'\n\t\t\t\t\tOR lang_iso = 'default'\n\t\t\t\tORDER BY {$random}";
$result = $this->db->sql_query_limit($sql, 1);
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
$word = generate_text_for_display($row['word'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
$this->template->assign_vars(array('DID_YOU_KNOW' => str_replace(""", '"', $word), 'S_DIDYOUKNOW' => !empty($this->user->data['user_didyouknow']) ? true : false, 'U_DYK_HIDE' => $this->helper->route('dmzx_didyouknow_controller', array('mode' => 'hide'))));
}
}
示例3: base
/**
* Controller for route app.php/aboutus.php and /aboutus
*
* @return Symfony\Component\HttpFoundation\Response A Symfony Response object
*/
public function base()
{
// Adding links to the breadcrumbs
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['ABOUTUS'], 'U_VIEW_FORUM' => $this->helper->route('crizzo_aboutus')));
$aboutus_data = $this->config_text->get_array(array('aboutus_info', 'aboutus_info_uid', 'aboutus_info_bitfield', 'aboutus_info_flags'));
$aboutus_text = generate_text_for_display($aboutus_data['aboutus_info'], $aboutus_data['aboutus_info_uid'], $aboutus_data['aboutus_info_bitfield'], $aboutus_data['aboutus_info_flags']);
$this->template->assign_vars(array('ABOUTUS_OUTPUT' => $aboutus_text, 'TERMS_OF_USE' => $this->config['acp_aboutus_termsofuse_enable'], 'PRIVACY' => $this->config['acp_aboutus_privacy_enable'], 'ABOUTUS_ENABLE' => $this->config['acp_aboutus_enable']));
return $this->helper->render('aboutus.html', $this->user->lang('ABOUTUS'));
}
示例4: test_text_formatter
/**
* @dataProvider get_text_formatter_tests
*/
public function test_text_formatter($original, $expected, $censor_text = true, $setup = null)
{
global $phpbb_container;
$phpbb_container = new phpbb_mock_container_builder();
if (isset($setup)) {
$setup($phpbb_container, $this);
}
$this->get_test_case_helpers()->set_s9e_services($phpbb_container);
$this->assertSame($expected, generate_text_for_display($original, '', '', 0, $censor_text));
}
示例5: getMessage
/**
* Set Welcome message
*/
private function getMessage()
{
global $db;
$sql = 'SELECT announcement_msg, bbcode_uid, bbcode_bitfield, bbcode_options FROM ' . RP_RAIDPLAN_ANNOUNCEMENT;
$result = $db->sql_query($sql, 864000);
while ($row = $db->sql_fetchrow($result)) {
$text = $row['announcement_msg'];
$bbcode_uid = $row['bbcode_uid'];
$bbcode_bitfield = $row['bbcode_bitfield'];
$bbcode_options = $row['bbcode_options'];
}
$this->Message = \generate_text_for_display($text, $bbcode_uid, $bbcode_bitfield, $bbcode_options);
}
示例6: titania_generate_text_for_display
/**
* Generate text for display
* Returns the result of generate_text_for_display() from phpBB's functions_content.php file, but has hacks in place to let us use our own bbcode.html file
*
* @param mixed $text
* @param mixed $uid
* @param mixed $bitfield
* @param mixed $flags
* @return mixed
*/
function titania_generate_text_for_display($text, $uid, $bitfield, $flags)
{
if (titania::$hook->call_hook(__FUNCTION__, $text, $uid, $bitfield, $flags)) {
if (titania::$hook->hook_return(__FUNCTION__)) {
return titania::$hook->hook_return_result(__FUNCTION__);
}
}
global $phpbb_root_path;
phpbb::_include('bbcode', false, 'bbcode');
// HAX
$phpbb_root_path = TITANIA_ROOT;
$return = generate_text_for_display($text, $uid, $bitfield, $flags);
// UnHAX
$phpbb_root_path = PHPBB_ROOT_PATH;
return $return;
}
示例7: get_post_data
/**
* Get post data
*
* @param mixed|false $topic_first_or_last_post (first|last)
* @param array $post_ids
* @param bool|false $limit
* @param int $start
* @param array $sql_array
* @return array
*/
public function get_post_data($topic_first_or_last_post = false, $post_ids = array(), $limit = false, $start = 0, $sql_array = array())
{
$sql = $this->db->sql_build_query('SELECT_DISTINCT', $this->_get_posts_sql_array($topic_first_or_last_post, $post_ids, $sql_array));
$result = $this->db->sql_query_limit($sql, $limit, $start, $this->cache_time);
$post_data = array();
while ($row = $this->db->sql_fetchrow($result)) {
$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
$post_data[$row['topic_id']][$row['post_id']] = $row;
$this->store['poster_ids'][] = $row['poster_id'];
$this->store['poster_ids'][] = $row['post_edit_user'];
$this->store['poster_ids'][] = $row['post_delete_user'];
$this->store['attachments'][] = $row['post_id'];
}
$this->db->sql_freeresult($result);
return $post_data;
}
示例8: main
public function main($id, $mode)
{
global $user, $request, $template;
global $config, $phpbb_root_path, $phpEx, $phpbb_container;
$user->add_lang(array('acp/board', 'posting'));
$this->tpl_name = 'acp_contact';
$this->page_title = 'ACP_CONTACT_SETTINGS';
$form_name = 'acp_contact';
add_form_key($form_name);
$error = '';
if (!function_exists('display_custom_bbcodes')) {
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
}
if (!class_exists('parse_message')) {
include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
}
/* @var $config_text \phpbb\config\db_text */
$config_text = $phpbb_container->get('config_text');
$contact_admin_data = $config_text->get_array(array('contact_admin_info', 'contact_admin_info_uid', 'contact_admin_info_bitfield', 'contact_admin_info_flags'));
$contact_admin_info = $contact_admin_data['contact_admin_info'];
$contact_admin_info_uid = $contact_admin_data['contact_admin_info_uid'];
$contact_admin_info_bitfield = $contact_admin_data['contact_admin_info_bitfield'];
$contact_admin_info_flags = $contact_admin_data['contact_admin_info_flags'];
if ($request->is_set_post('submit') || $request->is_set_post('preview')) {
if (!check_form_key($form_name)) {
$error = $user->lang('FORM_INVALID');
}
$contact_admin_info = $request->variable('contact_admin_info', '', true);
generate_text_for_storage($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_bitfield, $contact_admin_info_flags, !$request->variable('disable_bbcode', false), !$request->variable('disable_magic_url', false), !$request->variable('disable_smilies', false));
if (empty($error) && $request->is_set_post('submit')) {
$config->set('contact_admin_form_enable', $request->variable('contact_admin_form_enable', false));
$config_text->set_array(array('contact_admin_info' => $contact_admin_info, 'contact_admin_info_uid' => $contact_admin_info_uid, 'contact_admin_info_bitfield' => $contact_admin_info_bitfield, 'contact_admin_info_flags' => $contact_admin_info_flags));
trigger_error($user->lang['CONTACT_US_INFO_UPDATED'] . adm_back_link($this->u_action));
}
}
$contact_admin_info_preview = '';
if ($request->is_set_post('preview')) {
$contact_admin_info_preview = generate_text_for_display($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_bitfield, $contact_admin_info_flags);
}
$contact_admin_edit = generate_text_for_edit($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_flags);
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');
$template->assign_vars(array('ERRORS' => $error, 'CONTACT_ENABLED' => $config['contact_admin_form_enable'], 'CONTACT_US_INFO' => $contact_admin_edit['text'], 'CONTACT_US_INFO_PREVIEW' => $contact_admin_info_preview, 'S_BBCODE_DISABLE_CHECKED' => !$contact_admin_edit['allow_bbcode'], 'S_SMILIES_DISABLE_CHECKED' => !$contact_admin_edit['allow_smilies'], 'S_MAGIC_URL_DISABLE_CHECKED' => !$contact_admin_edit['allow_urls'], 'BBCODE_STATUS' => $user->lang('BBCODE_IS_ON', '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'SMILIES_STATUS' => $user->lang['SMILIES_ARE_ON'], 'IMG_STATUS' => $user->lang['IMAGES_ARE_ON'], 'FLASH_STATUS' => $user->lang['FLASH_IS_ON'], 'URL_STATUS' => $user->lang['URL_IS_ON'], 'S_BBCODE_ALLOWED' => true, 'S_SMILIES_ALLOWED' => true, 'S_BBCODE_IMG' => true, 'S_BBCODE_FLASH' => true, 'S_LINKS_ALLOWED' => true));
// Assigning custom bbcodes
display_custom_bbcodes();
}
示例9: view_article
/**
* View an article
*
* @param string $article URL of the article
* @param int $id ID of the article
* @return object
*/
public function view_article($article, $id = 0)
{
$where = $id === 0 ? 'article_url = "' . $this->db->sql_escape($article) . '"' : 'article_id = ' . (int) $id;
$sql = 'SELECT *
FROM ' . $this->table_article . '
WHERE ' . $where . '
ORDER BY article_last_edit DESC';
$result = $this->db->sql_query_limit($sql, 1);
$this->data = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!empty($article)) {
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->data['article_title'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_article', array('article' => $article))));
}
// If the article do not exist generate it
if (!$this->data) {
return $this->edit->edit_article($article);
} else {
$this->template->assign_vars(array('S_BBCODE_ALLOWED' => 1, 'ARTICLE_TITLE' => $this->data['article_title'], 'ARTICLE_TEXT' => generate_text_for_display($this->data['article_text'], $this->data['bbcode_uid'], $this->data['bbcode_bitfield'], 3, true), 'LAST_EDIT' => $this->user->format_date($this->data['article_last_edit']), 'S_EDIT' => $this->auth->acl_get('u_wiki_edit'), 'U_EDIT' => $this->helper->route('tas2580_wiki_index', array('article' => $article, 'action' => 'edit')), 'S_VERSIONS' => $this->auth->acl_get('u_wiki_versions'), 'U_VERSIONS' => $this->helper->route('tas2580_wiki_index', array('article' => $article, 'action' => 'versions')), 'VERSION' => $id, 'EDIT_REASON' => $id != 0 ? $this->data['article_edit_reason'] : '', 'U_TOPIC' => $this->data['article_topic_id'] != 0 ? append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, 't=' . $this->data['article_topic_id']) : ''));
}
return $this->helper->render('article_body.html', $this->data['article_title']);
}
示例10: compare_versions
public function compare_versions($article, $from, $to)
{
if ($from == 0 || $to == 0) {
trigger_error('NO_VERSIONS_SELECTED');
}
$sql = 'SELECT article_text, bbcode_uid, bbcode_bitfield
FROM ' . $this->table_article . '
WHERE article_id = ' . (int) $from;
$result = $this->db->sql_query($sql);
$from_row = $this->db->sql_fetchrow($result);
$sql = 'SELECT article_text, bbcode_uid, bbcode_bitfield
FROM ' . $this->table_article . '
WHERE article_id = ' . (int) $to;
$result = $this->db->sql_query($sql);
$to_row = $this->db->sql_fetchrow($result);
$from_article = generate_text_for_display($from_row['article_text'], $from_row['bbcode_uid'], $from_row['bbcode_bitfield'], 3, true);
$to_article = generate_text_for_display($to_row['article_text'], $to_row['bbcode_uid'], $to_row['bbcode_bitfield'], 3, true);
$u_from = $this->helper->route('tas2580_wiki_index', array('id' => $from));
$u_to = $this->helper->route('tas2580_wiki_index', array('id' => $to));
$this->template->assign_vars(array('HEADLINE' => sprintf($this->user->lang['VERSION_COMPARE_HEADLINE'], $from, $to, $u_from, $u_to), 'DIFF' => $this->diffline($to_article, $from_article)));
return $this->helper->render('article_compare.html');
}
示例11: generate_text_for_display
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) {
// A non-existing rowset only happens if there was no user present for the entered poster_id
// This could be a broken posts table.
if (!isset($rowset[$post_list[$i]])) {
continue;
}
$row = $rowset[$post_list[$i]];
$poster_id = $row['user_id'];
// End signature parsing, only if needed
if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) {
$parse_flags = ($user_cache[$poster_id]['sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$user_cache[$poster_id]['sig'] = generate_text_for_display($user_cache[$poster_id]['sig'], $user_cache[$poster_id]['sig_bbcode_uid'], $user_cache[$poster_id]['sig_bbcode_bitfield'], $parse_flags, true);
}
// Parse the message and subject
$parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
$message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
if (!empty($attachments[$row['post_id']])) {
parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
}
// Replace naughty words such as farty pants
$row['post_subject'] = censor_text($row['post_subject']);
// Highlight active words (primarily for search)
if ($highlight_match) {
$message = preg_replace('#(?!<.*)(?<!\\w)(' . $highlight_match . ')(?!\\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">\\1</span>', $message);
$row['post_subject'] = preg_replace('#(?!<.*)(?<!\\w)(' . $highlight_match . ')(?!\\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">\\1</span>', $row['post_subject']);
}
// Editing information
if ($row['post_edit_count'] && $config['display_last_edited'] || $row['post_edit_reason']) {
// Get usernames for all following posts if not already stored
if (!sizeof($post_edit_list) && ($row['post_edit_reason'] || $row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']]))) {
// Remove all post_ids already parsed (we do not have to check them)
示例12: main
function main($id, $mode)
{
global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
//More Complicated Parts of Script
switch ($mode) {
case 'index':
case 'view':
$this->page_title = 'View Website Settings';
$this->tpl_name = 'acp_rcms_settings';
$sql = "SELECT * FROM " . SITE_SETTINGS;
$result = $db->sql_query($sql);
$site_settings = array();
while ($row = $db->sql_fetchrow($result)) {
$site_settings[$row['setting_name']]['value'] = $row['setting_value'];
$site_settings[$row['setting_name']]['type'] = $row['setting_type'];
}
$site_settings['welcome_text']['value'] = generate_text_for_display($site_settings['welcome_text']['value'], $site_settings['welcome_bbcode_uid']['value'], $site_settings['welcome_bbcode_bitfield']['value'], $site_settings['site_bbcode_options']['value']);
$db->sql_freeresult($result);
$keys = array_keys($site_settings);
foreach ($keys as $key) {
$template->assign_vars(array(strtoupper($key) => $site_settings[$key]['type'] == 'BOOL' ? $site_settings[$key]['value'] ? true : false : $site_settings[$key]['value']));
}
$db->sql_freeresult($result);
break;
case 'edit':
$this->page_title = 'Edit Website Settings';
$this->tpl_name = 'acp_rcms_settings_edit';
$sql = "SELECT * FROM " . SITE_SETTINGS;
$result = $db->sql_query($sql);
$site_settings = array();
$vars = array();
while ($row = $db->sql_fetchrow($result)) {
$site_settings[$row['setting_name']] = array('setting_value' => $row['setting_value'], 'setting_type' => $row['setting_type']);
$vars[strtoupper($row['setting_name'])] = $row['setting_value'];
}
$db->sql_freeresult($result);
$forum_list = make_forum_select(false, false, true, true, true, false, true);
// Build forum options
$s_forum_options = '<select name="news_forum">';
foreach ($forum_list as $f_id => $f_row) {
$f_row['selected'] = $site_settings['news_forum']['setting_value'] == $f_id ? true : false;
$s_forum_options .= '<option value="' . $f_id . '"' . ($f_row['selected'] ? ' selected="selected"' : '') . ($f_row['disabled'] ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
$s_forum_options .= '</select>';
decode_message($site_settings['welcome_text']['setting_value'], $site_settings['welcome_bbcode_uid']['setting_value']);
$vars['WELCOME_TEXT'] = $site_settings['welcome_text']['setting_value'];
$vars += array("FORM_ACTION" => $this->u_action, "U_BACK" => append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=rayth_cms'), "NEWS_FORUM_SELECT" => $s_forum_options);
$template->assign_vars($vars);
$db->sql_freeresult($result);
$update = isset($_POST['save_settings']) ? true : false;
if ($update) {
$welcome_text = request_var('welcome_text', 'Some Text Here');
$news_forum = request_var('news_forum', 2);
$news_post_count = request_var('news_post_count', 0);
$welcome_text = utf8_normalize_nfc($welcome_text);
$uid = $bitfield = $options = '';
// will be modified by generate_text_for_storage
$allow_bbcode = $allow_urls = $allow_smilies = true;
$display_sidebar = request_var('display_sidebar', 0);
$sidebar_recent_reply_count = request_var('sidebar_recent_reply_count', 0);
generate_text_for_storage($welcome_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value='{$uid}' WHERE setting_name='welcome_bbcode_uid';");
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value='{$bitfield}' WHERE setting_name='welcome_bbcode_bitfield';");
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$welcome_text}\" WHERE setting_name='welcome_text';");
$site_settings['welcome_text']['setting_value'] = $welcome_text;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$news_forum}\" WHERE setting_name='news_forum';");
$site_settings['news_forum']['setting_value'] = $news_forum;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$news_post_count}\" WHERE setting_name='news_post_count';");
$site_settings['news_post_count']['setting_value'] = $news_post_count;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$display_sidebar}\" WHERE setting_name='display_sidebar';");
$site_settings['display_sidebar']['setting_value'] = $display_sidebar;
$db->sql_query("UPDATE " . SITE_SETTINGS . " SET setting_value=\"{$sidebar_recent_reply_count}\" WHERE setting_name='sidebar_recent_reply_count';");
$site_settings['sidebar_recent_reply_count']['setting_value'] = $sidebar_recent_reply_count;
$message = "Site Settings have been Updated.";
$message .= '<br /><br />';
trigger_error($message . adm_back_link(append_sid("{$phpbb_admin_path}index.{$phpEx}", 'i=rayth_cms')));
}
break;
case 'pages':
$this->page_title = 'Manage Pages';
$this->tpl_name = 'acp_rcms_page_list';
$sql = "SELECT * FROM " . SITE_PAGES . " WHERE parent=0 ORDER BY page_name ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$sql = "SELECT * FROM " . SITE_PAGES . " WHERE parent={$row['page_id']}";
$sub_page_result = $db->sql_query($sql);
$sql = "SELECT COUNT(*) as total_subs FROM " . SITE_PAGES . " WHERE parent={$row['page_id']}";
$sub_page_count_row = $db->sql_fetchrow($db->sql_query($sql));
$subpage_count = $sub_page_count_row['total_subs'];
if ($subpage_count > 0) {
$subpages = "<table cellspacing=\"1\">";
$subpages .= "<col class=\"col1\"/><col class=\"col2\"/><col class=\"col1\"/><col class=\"col2\"/><col class=\"col1\"/>";
$subpages .= "<th>Page Name</th><th>Identifier</th><th>Last Updated</th><th>Edit</th><th>Delete</th>";
while ($sub_row = $db->sql_fetchrow($sub_page_result)) {
$subpages .= "<tr>";
$subpages .= "<td>{$sub_row['page_name']}</td>";
$subpages .= "<td style=\"text-align: center;\">{$sub_row['page_identifier']}</td>";
$subpages .= "<td style=\"text-align: center;\">" . date($user->data['user_dateformat'], $sub_row['last_updated']) . "</td>";
$subpages .= "<td style=\"text-align: center;\"><a href=\"" . append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=rayth_cms&mode=pagemanage&act=edit&id={$sub_row['page_id']}") . "\">Edit</a></td>";
//.........这里部分代码省略.........
示例13: generate_forum_nav
/**
* Create forum navigation links for given forum, create parent
* list if currently null, assign basic forum info to template
*/
function generate_forum_nav(&$forum_data)
{
global $db, $user, $template, $auth, $config;
global $phpEx, $phpbb_root_path;
if (!$auth->acl_get('f_list', $forum_data['forum_id'])) {
return;
}
// Get forum parents
$forum_parents = get_forum_parents($forum_data);
// Build navigation links
if (!empty($forum_parents)) {
foreach ($forum_parents as $parent_forum_id => $parent_data) {
list($parent_name, $parent_type) = array_values($parent_data);
// Skip this parent if the user does not have the permission to view it
if (!$auth->acl_get('f_list', $parent_forum_id)) {
continue;
}
$template->assign_block_vars('navlinks', array('S_IS_CAT' => $parent_type == FORUM_CAT ? true : false, 'S_IS_LINK' => $parent_type == FORUM_LINK ? true : false, 'S_IS_POST' => $parent_type == FORUM_POST ? true : false, 'FORUM_NAME' => $parent_name, 'FORUM_ID' => $parent_forum_id, 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $parent_forum_id)));
}
}
$template->assign_block_vars('navlinks', array('S_IS_CAT' => $forum_data['forum_type'] == FORUM_CAT ? true : false, 'S_IS_LINK' => $forum_data['forum_type'] == FORUM_LINK ? true : false, 'S_IS_POST' => $forum_data['forum_type'] == FORUM_POST ? true : false, 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_ID' => $forum_data['forum_id'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", 'f=' . $forum_data['forum_id'])));
$template->assign_vars(array('FORUM_ID' => $forum_data['forum_id'], 'FORUM_NAME' => $forum_data['forum_name'], 'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']), 'S_ENABLE_FEEDS_FORUM' => $config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options']) ? true : false));
return;
}
示例14: main
//.........这里部分代码省略.........
$s_hidden_fields = array('selected' => $group_id, 'action' => 'demote', 'submit' => true);
confirm_box(false, 'USER_GROUP_DEMOTE', build_hidden_fields($s_hidden_fields));
}
break;
}
}
$sql = 'SELECT g.*, ug.group_leader, ug.user_pending
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ug.user_id = ' . $user->data['user_id'] . '
AND g.group_id = ug.group_id
ORDER BY g.group_type DESC, g.group_name';
$result = $db->sql_query($sql);
$group_id_ary = array();
$leader_count = $member_count = $pending_count = 0;
while ($row = $db->sql_fetchrow($result)) {
$block = $row['group_leader'] ? 'leader' : ($row['user_pending'] ? 'pending' : 'member');
switch ($row['group_type']) {
case GROUP_OPEN:
$group_status = 'OPEN';
break;
case GROUP_CLOSED:
$group_status = 'CLOSED';
break;
case GROUP_HIDDEN:
$group_status = 'HIDDEN';
break;
case GROUP_SPECIAL:
$group_status = 'SPECIAL';
break;
case GROUP_FREE:
$group_status = 'FREE';
break;
}
$template->assign_block_vars($block, array('GROUP_ID' => $row['group_id'], 'GROUP_NAME' => $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name'], 'GROUP_DESC' => $row['group_type'] != GROUP_SPECIAL ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], 'GROUP_SPECIAL' => $row['group_type'] != GROUP_SPECIAL ? false : true, 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], 'GROUP_COLOUR' => $row['group_colour'], 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=group&g=' . $row['group_id']), 'S_GROUP_DEFAULT' => $row['group_id'] == $user->data['group_id'] ? true : false, 'S_ROW_COUNT' => ${$block . '_count'}++));
$group_id_ary[] = (int) $row['group_id'];
}
$db->sql_freeresult($result);
// Hide hidden groups unless user is an admin with group privileges
$sql_and = $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') ? '<> ' . GROUP_SPECIAL : 'NOT IN (' . GROUP_SPECIAL . ', ' . GROUP_HIDDEN . ')';
$sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage
FROM ' . GROUPS_TABLE . '
WHERE ' . (sizeof($group_id_ary) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . "\n\t\t\t\t\t\tgroup_type {$sql_and}\n\t\t\t\t\tORDER BY group_type DESC, group_name";
$result = $db->sql_query($sql);
$nonmember_count = 0;
while ($row = $db->sql_fetchrow($result)) {
switch ($row['group_type']) {
case GROUP_OPEN:
$group_status = 'OPEN';
break;
case GROUP_CLOSED:
$group_status = 'CLOSED';
break;
case GROUP_HIDDEN:
$group_status = 'HIDDEN';
break;
case GROUP_SPECIAL:
$group_status = 'SPECIAL';
break;
case GROUP_FREE:
$group_status = 'FREE';
break;
}
$template->assign_block_vars('nonmember', array('GROUP_ID' => $row['group_id'], 'GROUP_NAME' => $row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $row['group_name']] : $row['group_name'], 'GROUP_DESC' => $row['group_type'] != GROUP_SPECIAL ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], 'GROUP_SPECIAL' => $row['group_type'] != GROUP_SPECIAL ? false : true, 'GROUP_CLOSED' => $row['group_type'] != GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') ? false : true, 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], 'S_CAN_JOIN' => $row['group_type'] == GROUP_OPEN || $row['group_type'] == GROUP_FREE ? true : false, 'GROUP_COLOUR' => $row['group_colour'], 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=group&g=' . $row['group_id']), 'S_ROW_COUNT' => $nonmember_count++));
}
$db->sql_freeresult($result);
$template->assign_vars(array('S_CHANGE_DEFAULT' => $auth->acl_get('u_chggrp') ? true : false, 'S_LEADER_COUNT' => $leader_count, 'S_MEMBER_COUNT' => $member_count, 'S_PENDING_COUNT' => $pending_count, 'S_NONMEMBER_COUNT' => $nonmember_count, 'S_UCP_ACTION' => $this->u_action));
示例15: topic_review
/**
* Topic Review
*/
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
{
global $user, $auth, $db, $template, $cache;
global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
/* @var $phpbb_content_visibility \phpbb\content_visibility */
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
$sql_sort = $mode == 'post_review' ? 'ASC' : 'DESC';
// Go ahead and pull all data for this topic
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p' . "\n\t\tWHERE p.topic_id = {$topic_id}\n\t\t\tAND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . '
' . ($mode == 'post_review' ? " AND p.post_id > {$cur_post_id}" : '') . '
' . ($mode == 'post_review_edit' ? " AND p.post_id = {$cur_post_id}" : '') . '
ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort;
$result = $db->sql_query_limit($sql, $config['posts_per_page']);
$post_list = array();
while ($row = $db->sql_fetchrow($result)) {
$post_list[] = $row['post_id'];
}
$db->sql_freeresult($result);
if (!sizeof($post_list)) {
return false;
}
// Handle 'post_review_edit' like 'post_review' from now on
if ($mode == 'post_review_edit') {
$mode = 'post_review';
}
$sql_ary = array('SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe', 'FROM' => array(USERS_TABLE => 'u', POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(ZEBRA_TABLE => 'z'), 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id')), 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
AND u.user_id = p.poster_id');
$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql);
$rowset = array();
$has_attachments = false;
while ($row = $db->sql_fetchrow($result)) {
$rowset[$row['post_id']] = $row;
if ($row['post_attachment']) {
$has_attachments = true;
}
}
$db->sql_freeresult($result);
// Grab extensions
$extensions = $attachments = array();
if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) {
$extensions = $cache->obtain_attach_extensions($forum_id);
// Get attachments...
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . '
AND in_message = 0
ORDER BY filetime DESC, post_msg_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$attachments[$row['post_msg_id']][] = $row;
}
$db->sql_freeresult($result);
}
for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) {
// A non-existing rowset only happens if there was no user present for the entered poster_id
// This could be a broken posts table.
if (!isset($rowset[$post_list[$i]])) {
continue;
}
$row = $rowset[$post_list[$i]];
$poster_id = $row['user_id'];
$post_subject = $row['post_subject'];
$decoded_message = false;
if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) {
$decoded_message = censor_text($row['post_text']);
decode_message($decoded_message, $row['bbcode_uid']);
$decoded_message = bbcode_nl2br($decoded_message);
}
$parse_flags = $row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0;
$parse_flags |= $row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
$message = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, true);
if (!empty($attachments[$row['post_id']])) {
$update_count = array();
parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);
}
$post_subject = censor_text($post_subject);
$post_anchor = $mode == 'post_review' ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id'];
$u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f={$forum_id}&t={$topic_id}&p={$row['post_id']}&view=show#p{$row['post_id']}");
$post_row = array('POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'S_HAS_ATTACHMENTS' => !empty($attachments[$row['post_id']]) ? true : false, 'S_FRIEND' => $row['friend'] ? true : false, 'S_IGNORE_POST' => $row['foe'] ? true : false, 'L_IGNORE_POST' => $row['foe'] ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "<a href=\"{$u_show_post}\" onclick=\"phpbb.toggleDisplay('{$post_anchor}', 1); return false;\">", '</a>') : '', 'POST_SUBJECT' => $post_subject, 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $user->format_date($row['post_time']), 'MESSAGE' => $message, 'DECODED_MESSAGE' => $decoded_message, 'POST_ID' => $row['post_id'], 'POST_TIME' => $row['post_time'], 'USER_ID' => $row['user_id'], 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", 'p=' . $row['post_id']) . '#p' . $row['post_id'], 'U_MCP_DETAILS' => $auth->acl_get('m_info', $forum_id) ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=main&mode=post_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'POSTER_QUOTE' => $show_quote_button && $auth->acl_get('f_reply', $forum_id) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '');
$current_row_number = $i;
/**
* Event to modify the template data block for topic reviews
*
* @event core.topic_review_modify_row
* @var string mode The review mode
* @var int topic_id The topic that is being reviewed
* @var int forum_id The topic's forum
* @var int cur_post_id Post offset id
* @var int current_row_number Number of the current row being iterated
* @var array post_row Template block array of the current post
* @var array row Array with original post and user data
* @since 3.1.4-RC1
*/
$vars = array('mode', 'topic_id', 'forum_id', 'cur_post_id', 'current_row_number', 'post_row', 'row');
extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_row', compact($vars)));
//.........这里部分代码省略.........