当前位置: 首页>>代码示例>>PHP>>正文


PHP display_custom_bbcodes函数代码示例

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


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

示例1: viewtopic_modify_data

 /**
  * Show bbcodes and smilies in the quickreply
  * Template data for Ajax submit
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function viewtopic_modify_data($event)
 {
     $forum_id = $event['forum_id'];
     $topic_data = $event['topic_data'];
     $post_list = $event['post_list'];
     $topic_id = $topic_data['topic_id'];
     $s_quick_reply = false;
     if (($this->user->data['is_registered'] || $this->config['qr_allow_for_guests']) && $this->config['allow_quick_reply'] && $topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY && $this->auth->acl_get('f_reply', $forum_id)) {
         // Quick reply enabled forum
         $s_quick_reply = $topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED || $this->auth->acl_get('m_edit', $forum_id) ? true : false;
     }
     if (!$this->user->data['is_registered'] && $s_quick_reply) {
         add_form_key('posting');
         $s_attach_sig = $this->config['allow_sig'] && $this->user->optionget('attachsig') && $this->auth->acl_get('f_sigs', $forum_id) && $this->auth->acl_get('u_sig');
         $s_smilies = $this->config['allow_smilies'] && $this->user->optionget('smilies') && $this->auth->acl_get('f_smilies', $forum_id);
         $s_bbcode = $this->config['allow_bbcode'] && $this->user->optionget('bbcode') && $this->auth->acl_get('f_bbcode', $forum_id);
         $s_notify = false;
         $qr_hidden_fields = array('topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], 'lastclick' => (int) time(), 'topic_id' => (int) $topic_data['topic_id'], 'forum_id' => (int) $forum_id);
         // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked
         !$s_bbcode ? $qr_hidden_fields['disable_bbcode'] = 1 : true;
         !$s_smilies ? $qr_hidden_fields['disable_smilies'] = 1 : true;
         !$this->config['allow_post_links'] ? $qr_hidden_fields['disable_magic_url'] = 1 : true;
         $s_attach_sig ? $qr_hidden_fields['attach_sig'] = 1 : true;
         $s_notify ? $qr_hidden_fields['notify'] = 1 : true;
         $topic_data['topic_status'] == ITEM_LOCKED ? $qr_hidden_fields['lock_topic'] = 1 : true;
         $this->template->assign_vars(array('S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'USERNAME' => $this->request->variable('username', '', true)));
         if ($this->config['enable_post_confirm']) {
             $captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
             $captcha->init(CONFIRM_POST);
         }
         if ($this->config['enable_post_confirm'] && (isset($captcha) && $captcha->is_solved() === false)) {
             $this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
         }
         // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
         if (isset($captcha) && $captcha->is_solved() !== false) {
             $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
         }
     }
     // Ajaxify viewtopic data
     if ($this->request->is_ajax() && $this->request->is_set('qr_request')) {
         if (!$this->user->data['is_registered'] && $this->config['enable_post_confirm']) {
             $captcha = $this->captcha->get_instance($this->config['captcha_plugin']);
             $captcha->init(CONFIRM_POST);
             // Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
             if (isset($captcha) && $captcha->is_solved() !== false) {
                 $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields($captcha->get_hidden_fields()));
             }
         }
         // Fix issues if the inserted post is not the first.
         if ($this->qr_insert && !$this->qr_first) {
             $this->template->alter_block_array('postrow', array('S_FIRST_ROW' => false), false, 'change');
         }
         $page_title = $event['page_title'];
         $this->template->assign_vars(array('S_QUICKREPLY_REQUEST' => true, 'S_QR_NO_FIRST_POST' => $this->qr_insert, 'S_QR_FULL_QUOTE' => $this->config['qr_full_quote']));
         $this->template->append_var('QR_HIDDEN_FIELDS', build_hidden_fields(array('qr' => 1, 'qr_cur_post_id' => (int) max($post_list))));
         // Output the page
         page_header($page_title, false, $forum_id);
         page_footer(false, false, false);
         $json_response = new \phpbb\json_response();
         $json_response->send(array('success' => true, 'result' => $this->template->assign_display('@tatiana5_quickreply/quickreply_template.html', '', true), 'insert' => $this->qr_insert));
     }
     if ($s_quick_reply) {
         include_once $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
         // HTML, BBCode, Smilies, Images and Flash status
         $bbcode_status = $this->config['allow_bbcode'] && $this->config['qr_bbcode'] && $this->auth->acl_get('f_bbcode', $forum_id) ? true : false;
         $smilies_status = $this->config['allow_smilies'] && $this->config['qr_smilies'] && $this->auth->acl_get('f_smilies', $forum_id) ? true : false;
         $img_status = $bbcode_status && $this->auth->acl_get('f_img', $forum_id) ? true : false;
         $url_status = $this->config['allow_post_links'] ? true : false;
         $flash_status = $bbcode_status && $this->auth->acl_get('f_flash', $forum_id) && $this->config['allow_post_flash'] ? true : false;
         $quote_status = true;
         // Build custom bbcodes array
         if ($bbcode_status) {
             display_custom_bbcodes();
         }
         // Generate smiley listing
         if ($smilies_status) {
             generate_smilies('inline', $forum_id);
         }
         // Show attachment box for adding attachments if true
         $form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$this->config['allow_attachments'] || !$this->auth->acl_get('u_attach') || !$this->auth->acl_get('f_attach', $forum_id) ? '' : '" enctype="multipart/form-data';
         $allowed = $this->auth->acl_get('f_attach', $forum_id) && $this->auth->acl_get('u_attach') && $this->config['allow_attachments'] && $form_enctype;
         $attachment_data = false;
         if ($bbcode_status || $smilies_status || $this->config['qr_attach'] && $allowed) {
             $this->user->add_lang('posting');
         }
         if ($this->config['qr_attach'] && $allowed) {
             $this->template->assign_vars(array('U_QR_ACTION' => append_sid("{$this->phpbb_root_path}posting.{$this->php_ext}", "mode=reply&f={$forum_id}&t={$topic_id}") . $form_enctype));
             include_once $this->phpbb_root_path . 'includes/message_parser.' . $this->php_ext;
             $message_parser = new \parse_message();
             $message_parser->set_plupload($this->plupload);
             $message_parser->set_mimetype_guesser($this->mimetype_guesser);
             $message_parser->get_submitted_attachment_data($this->user->data['user_id']);
//.........这里部分代码省略.........
开发者ID:edipdincer,项目名称:QuickReply,代码行数:101,代码来源:listener.php

示例2: display_edit_form

 /**
  * Display the edit form
  *
  * @param bool $preview
  */
 protected function display_edit_form($preview = false)
 {
     generate_smilies('inline', 0);
     display_custom_bbcodes();
     add_form_key('article');
     $this->template->assign_vars(array('S_PREVIEW' => $preview, 'TITLE' => $this->data['article_title'], 'MESSAGE' => $preview ? $this->data['article_text'] : $this->message_parser->message, 'PREVIEW_MESSAGE' => $this->message_parser->message, 'SOURCES' => $this->data['article_sources'], 'S_BBCODE_ALLOWED' => $this->option['bbcode'], 'S_LINKS_ALLOWED' => $this->option['url'], 'S_BBCODE_IMG' => $this->option['img'], 'S_BBCODE_FLASH' => $this->option['flash'], 'S_BBCODE_QUOTE' => $this->option['quote'], 'BBCODE_STATUS' => $this->option['bbcode'] ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $this->option['img'] ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $this->option['flash'] ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $this->option['smilies'] ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $this->option['bbcode'] && $this->option['url'] ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'EDIT_REASON' => $this->data['article_edit_reason'], 'TOPIC_ID' => (int) $this->data['article_topic_id'], 'S_AUTH_ACTIVATE' => $this->auth->acl_get('u_wiki_set_active'), 'S_AUTH_EDIT_TOPIC' => $this->auth->acl_get('u_wiki_edit_topic'), 'S_AUTH_REDIRECT' => $this->auth->acl_get('u_wiki_set_redirect'), 'S_AUTH_STICKY' => $this->auth->acl_get('u_wiki_set_sticky'), 'S_ACTIVE' => $preview ? $this->data['article_approved'] : 1, 'S_STICKY' => $this->data['article_sticky'], 'ARTICLE_REDIRECT' => $this->data['article_redirect'], 'ARTICLE_DESCRIPTION' => $this->data['article_description']));
 }
开发者ID:tas2580,项目名称:wiki,代码行数:12,代码来源:functions.php

示例3: 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();
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:46,代码来源:acp_contact.php

示例4: post

 /**
  * Controller for /post
  *
  * @throws http_exception
  * @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
  */
 public function post()
 {
     if (!$this->is_available()) {
         throw new http_exception(404, 'IDEAS_NOT_AVAILABLE');
     }
     if ($this->user->data['user_id'] == ANONYMOUS) {
         throw new http_exception(404, 'LOGGED_OUT');
     }
     $this->language->add_lang('posting');
     if (!function_exists('submit_post')) {
         include $this->root_path . 'includes/functions_posting.' . $this->php_ext;
     }
     if (!function_exists('display_custom_bbcodes')) {
         include $this->root_path . 'includes/functions_display.' . $this->php_ext;
     }
     $mode = $this->request->variable('mode', '');
     $title = $this->request->variable('title', '', true);
     $message = $this->request->variable('message', '', true);
     if ($mode === 'submit') {
         $submit = $this->ideas->submit($title, $message, $this->user->data['user_id']);
         if (is_array($submit)) {
             $this->template->assign_vars(array('ERROR' => implode('<br />', $submit), 'MESSAGE' => $message));
         } else {
             return new RedirectResponse($this->helper->route('phpbb_ideas_idea_controller', array('idea_id' => $submit)));
         }
     }
     display_custom_bbcodes();
     generate_smilies('inline', 0);
     // BBCode, Smilies, Images URL, and Flash statuses
     $bbcode_status = (bool) $this->config['allow_bbcode'] && $this->auth->acl_get('f_bbcode', $this->config['ideas_forum_id']);
     $smilies_status = (bool) $this->config['allow_smilies'] && $this->auth->acl_get('f_smilies', $this->config['ideas_forum_id']);
     $img_status = (bool) $bbcode_status && $this->auth->acl_get('f_img', $this->config['ideas_forum_id']);
     $url_status = (bool) $this->config['allow_post_links'];
     $flash_status = (bool) $bbcode_status && $this->auth->acl_get('f_flash', $this->config['ideas_forum_id']) && $this->config['allow_post_flash'];
     $this->template->assign_vars(array('TITLE' => $title, 'S_POST_ACTION' => $this->helper->route('phpbb_ideas_post_controller', array('mode' => 'submit')), 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => true, 'BBCODE_STATUS' => $this->language->lang($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF', '<a href="' . $this->helper->route('phpbb_help_bbcode_controller') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->language->lang('IMAGES_ARE_ON') : $this->language->lang('IMAGES_ARE_OFF'), 'FLASH_STATUS' => $flash_status ? $this->language->lang('FLASH_IS_ON') : $this->language->lang('FLASH_IS_OFF'), 'URL_STATUS' => $bbcode_status && $url_status ? $this->language->lang('URL_IS_ON') : $this->language->lang('URL_IS_OFF'), 'SMILIES_STATUS' => $smilies_status ? $this->language->lang('SMILIES_ARE_ON') : $this->language->lang('SMILIES_ARE_OFF')));
     // Assign breadcrumb template vars
     $this->template->assign_block_vars_array('navlinks', array(array('U_VIEW_FORUM' => $this->helper->route('phpbb_ideas_index_controller'), 'FORUM_NAME' => $this->language->lang('IDEAS')), array('U_VIEW_FORUM' => $this->helper->route('phpbb_ideas_post_controller'), 'FORUM_NAME' => $this->language->lang('NEW_IDEA'))));
     return $this->helper->render('idea_new.html', $this->language->lang('NEW_IDEA'));
 }
开发者ID:VSEphpbb,项目名称:phpbb-ideas,代码行数:45,代码来源:post_controller.php

示例5: handle_video


//.........这里部分代码省略.........
                            $this->db->sql_query('INSERT INTO ' . $this->video_table . ' ' . $this->db->sql_build_array('INSERT', $sql_ary));
                            $u_action = $this->helper->route('dmzx_youtubegallery_controller');
                            $meta_info = $this->helper->route('dmzx_youtubegallery_controller');
                            $message = $this->user->lang['VIDEO_CREATED'];
                            meta_refresh(3, $meta_info);
                            $message .= '<br /><br />' . sprintf($this->user->lang['PAGE_RETURN'], '<a href="' . $meta_info . '">', '</a>');
                            trigger_error($message);
                        }
                        break;
                }
                break;
            case 'comment':
                $l_title = $this->user->lang['VIDEO_CMNT_SUBMIT'];
                $template_html = '@dmzx_youtubegallery/video_cmnt_editor.html';
                if (!$this->config['enable_comments']) {
                    trigger_error($this->user->lang['COMMENTS_DISABLED']);
                }
                // User is a bot?!
                if ($this->user->data['is_bot']) {
                    redirect(append_sid("{$this->phpbb_root_path}index.{$this->phpEx}"));
                }
                // Can post?!
                if (!$this->auth->acl_get('u_video_comment')) {
                    trigger_error($this->user->lang['UNAUTHED']);
                }
                $redirect_url = $this->helper->route('dmzx_youtubegallery_controller', array('mode' => 'comment', 'v' => (int) $video_id));
                // Is a guest?!
                if ($this->user->data['user_id'] == ANONYMOUS) {
                    login_box($redirect_url);
                }
                if (!function_exists('generate_smilies')) {
                    include $this->phpbb_root_path . 'includes/functions_posting.' . $this->phpEx;
                }
                if (!function_exists('display_custom_bbcodes')) {
                    include $this->phpbb_root_path . 'includes/functions_display.' . $this->phpEx;
                }
                //Settings for comments
                $this->user->setup('posting');
                display_custom_bbcodes();
                generate_smilies('inline', 0);
                $bbcode_status = $this->config['allow_bbcode'] ? true : false;
                $smilies_status = $this->config['allow_smilies'] ? true : false;
                $img_status = $bbcode_status ? true : false;
                $url_status = $this->config['allow_post_links'] ? true : false;
                $flash_status = $bbcode_status && $this->config['allow_post_flash'] ? true : false;
                $quote_status = true;
                $video_id = $this->request->variable('v', 0);
                $uid = $bitfield = $options = '';
                $allow_bbcode = $allow_urls = $allow_smilies = true;
                $s_action = $this->helper->route('dmzx_youtubegallery_controller', array('mode' => 'comment', 'v' => (int) $video_id));
                $s_hidden_fields = '';
                $form_enctype = '';
                add_form_key('postform');
                // Start assigning vars for main posting page ...
                $this->template->assign_vars(array('VIDEO_ID' => (int) $video_id, 'S_FORM_ENCTYPE' => $form_enctype, 'S_POST_ACTION' => $s_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'S_BBCODE_ALLOWED' => $bbcode_status ? 1 : 0, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_URL' => $url_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_QUOTE' => $quote_status));
                if (isset($_POST['submit'])) {
                    if (!check_form_key('postform')) {
                        trigger_error('FORM_INVALID');
                    }
                    $video_id = $this->request->variable('v', 0);
                    // Get video to redirect :D
                    $message = $this->request->variable('cmnt_text', '', true);
                    generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
                    $data = array('cmnt_video_id' => $this->request->variable('cmnt_video_id', 0), 'cmnt_poster_id' => $this->user->data['user_id'], 'cmnt_text' => $message, 'create_time' => time(), 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'bbcode_options' => $options);
                    if ($message == '') {
                        $meta_info = $this->helper->route('dmzx_youtubegallery_controller', array('mode' => 'comment', 'v' => (int) $video_id));
开发者ID:newbeetle,项目名称:youtubegallery,代码行数:67,代码来源:youtubegallery.php

示例6: handle_basic_posting_data

/**
* Handle basic posting setup and some basic checks
*/
function handle_basic_posting_data($check = false, $page = 'blog', $mode = 'add')
{
    global $auth, $blog_attachment, $blog_id, $config, $db, $template, $user, $phpbb_root_path, $phpEx, $category_ary;
    $submit = isset($_POST['submit']) ? true : false;
    $preview = isset($_POST['preview']) ? true : false;
    $refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) ? true : false;
    $submitted = $submit || $preview || $refresh ? true : false;
    // shortcut for any of the 3 above
    if ($check) {
        $error = array();
        // check the captcha
        if ($mode == 'add') {
            if (!handle_captcha('check')) {
                $error[] = $user->lang['CONFIRM_CODE_WRONG'];
            }
        }
        // check the form key
        if (!check_form_key('postform')) {
            $error[] = $user->lang['FORM_INVALID'];
        }
        return $error;
    } else {
        $above_subject = $above_message = $above_submit = $panel_data = '';
        $panels = array('options-panel' => $user->lang['OPTIONS']);
        if ($page == 'blog') {
            $category_list = make_category_select($category_ary);
            if ($category_list) {
                $panels['categories-panel'] = $user->lang['CATEGORIES'];
            }
            $panels['poll-panel'] = $user->lang['ADD_POLL'];
            if ($user->data['is_registered']) {
                // Build permissions box
                permission_settings_builder(true, $mode);
                $panels['permissions-panel'] = $user->lang['PERMISSIONS'];
            }
            // Some variables
            $template->assign_vars(array('CATEGORY_LIST' => $category_list, 'S_CAT_0_SELECTED' => is_array($category_ary) && in_array(0, $category_ary), 'S_SHOW_POLL_BOX' => true));
        }
        if ($mode == 'add') {
            // setup the captcha
            handle_captcha('build');
        }
        // Subscriptions
        if ($config['user_blog_subscription_enabled'] && $user->data['is_registered']) {
            $panels['subscriptions-panel'] = $user->lang['SUBSCRIPTION'];
            $subscription_types = get_blog_subscription_types();
            $subscribed = array();
            if ($page == 'blog' && $mode == 'add' && !$submitted) {
                // check default subscription settings from user_settings
                global $user_settings;
                get_user_settings($user->data['user_id']);
                if (isset($user_settings[$user->data['user_id']])) {
                    foreach ($subscription_types as $type => $name) {
                        // Bitwise check
                        if ($user_settings[$user->data['user_id']]['blog_subscription_default'] & $type) {
                            $subscribed[$type] = true;
                        }
                    }
                }
            } else {
                if (!$submitted) {
                    // check set subscription settings
                    $sql = 'SELECT * FROM ' . BLOGS_SUBSCRIPTION_TABLE . '
					WHERE sub_user_id = ' . $user->data['user_id'] . '
						AND blog_id = ' . intval($blog_id);
                    $result = $db->sql_query($sql);
                    while ($row = $db->sql_fetchrow($result)) {
                        $subscribed[$row['sub_type']] = true;
                    }
                }
            }
            foreach ($subscription_types as $type => $name) {
                $template->assign_block_vars('subscriptions', array('TYPE' => 'subscription_' . $type, 'NAME' => isset($user->lang[$name]) ? $user->lang[$name] : $name, 'S_CHECKED' => $submitted && request_var('subscription_' . $type, false) || isset($subscribed[$type]) ? true : false));
            }
        }
        // Attachments
        $attachment_data = $blog_attachment->attachment_data;
        $filename_data = $blog_attachment->filename_data;
        $form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || @ini_get('file_uploads') == '0' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') ? '' : ' enctype="multipart/form-data"';
        posting_gen_inline_attachments($attachment_data);
        if ($auth->acl_get('u_blogattach') && $config['allow_attachments'] && $form_enctype) {
            $allowed_extensions = $blog_attachment->obtain_blog_attach_extensions();
            if (sizeof($allowed_extensions['_allowed_'])) {
                $blog_attachment->posting_gen_attachment_entry($attachment_data, $filename_data);
                $panels['attach-panel'] = $user->lang['ADD_ATTACHMENT'];
            }
        }
        // Add the forum key
        add_form_key('postform');
        // Generate smiley listing
        generate_smilies('inline', false);
        // Build custom bbcodes array
        display_custom_bbcodes();
        $temp = compact('page', 'mode', 'panels', 'panel_data', 'above_subject', 'above_message', 'above_submit');
        blog_plugins::plugin_do_ref('function_handle_basic_posting_data', $temp);
        extract($temp);
        $template->assign_vars(array('EXTRA_ABOVE_SUBJECT' => $above_subject, 'EXTRA_ABOVE_MESSAGE' => $above_message, 'EXTRA_ABOVE_SUBMIT' => $above_submit, 'EXTRA_PANELS' => $panel_data, 'JS_PANELS_LIST' => "'" . implode("', '", array_keys($panels)) . "'", 'UA_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.{$phpEx}", "mode=popup", false), 'S_BLOG' => $page == 'blog' ? true : false, 'S_REPLY' => $page == 'reply' ? true : false, 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']) ? true : false, 'S_FORM_ENCTYPE' => $form_enctype));
//.........这里部分代码省略.........
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:101,代码来源:functions_posting.php

示例7: isset

$s_hidden_fields = $mode == 'reply' || $mode == 'quote' ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : '';
$s_hidden_fields .= '<input type="hidden" name="lastclick" value="' . $current_time . '" />';
$s_hidden_fields .= $draft_id || isset($_REQUEST['draft_loaded']) ? '<input type="hidden" name="draft_loaded" value="' . request_var('draft_loaded', $draft_id) . '" />' : '';
if ($mode == 'edit') {
    $s_hidden_fields .= build_hidden_fields(array('edit_post_message_checksum' => $post_data['post_checksum'], 'edit_post_subject_checksum' => $post_data['post_subject_md5']));
}
// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
if (isset($captcha) && $captcha->is_solved() !== false) {
    $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields());
}
$form_enctype = @ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id) ? '' : ' enctype="multipart/form-data"';
add_form_key('posting');
// Start assigning vars for main posting page ...
$template->assign_vars(array('L_POST_A' => $page_title, 'L_ICON' => $mode == 'reply' || $mode == 'quote' || $mode == 'edit' && $post_id != $post_data['topic_first_post_id'] ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'], 'L_MESSAGE_BODY_EXPLAIN' => intval($config['max_post_chars']) ? sprintf($user->lang['MESSAGE_BODY_EXPLAIN'], intval($config['max_post_chars'])) : '', 'FORUM_NAME' => $post_data['forum_name'], 'FORUM_DESC' => $post_data['forum_desc'] ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', 'TOPIC_TITLE' => censor_text($post_data['topic_title']), 'MODERATORS' => sizeof($moderators) ? implode(', ', $moderators[$forum_id]) : '', 'USERNAME' => !$preview && $mode != 'quote' || $preview ? $post_data['username'] : '', 'SUBJECT' => $post_data['post_subject'], 'MESSAGE' => $post_data['post_text'], 'BBCODE_STATUS' => $bbcode_status ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.{$phpEx}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), 'POST_DATE' => $post_data['post_time'] ? $user->format_date($post_data['post_time']) : '', 'ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], 'EDIT_REASON' => $post_data['post_edit_reason'], 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.{$phpEx}", "f={$forum_id}"), 'U_VIEW_TOPIC' => $mode != 'post' ? append_sid("{$phpbb_root_path}viewtopic.{$phpEx}", "f={$forum_id}&amp;t={$topic_id}") : '', 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.{$phpEx}", "f={$forum_id}&amp;mode=popup"), 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.{$phpEx}", "f={$forum_id}&amp;mode=popup")), 'S_PRIVMSGS' => false, 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']) ? true : false, 'S_EDIT_POST' => $mode == 'edit' ? true : false, 'S_EDIT_REASON' => $mode == 'edit' && $auth->acl_get('m_edit', $forum_id) ? true : false, 'S_DISPLAY_USERNAME' => !$user->data['is_registered'] || $mode == 'edit' && $post_data['poster_id'] == ANONYMOUS ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_DELETE_ALLOWED' => $mode == 'edit' && ($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - $config['delete_time'] * 60 || !$config['delete_time']) || $auth->acl_get('m_delete', $forum_id)) ? true : false, 'S_BBCODE_ALLOWED' => $bbcode_status ? 1 : 0, 'S_BBCODE_CHECKED' => $bbcode_checked ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_CHECKED' => $smilies_checked ? ' checked="checked"' : '', 'S_SIG_ALLOWED' => $auth->acl_get('f_sigs', $forum_id) && $config['allow_sig'] && $user->data['is_registered'] ? true : false, 'S_SIGNATURE_CHECKED' => $sig_checked ? ' checked="checked"' : '', 'S_NOTIFY_ALLOWED' => !$user->data['is_registered'] || $mode == 'edit' && $user->data['user_id'] != $post_data['poster_id'] || !$config['allow_topic_notify'] || !$config['email_enable'] ? false : true, 'S_NOTIFY_CHECKED' => $notify_checked ? ' checked="checked"' : '', 'S_LOCK_TOPIC_ALLOWED' => ($mode == 'edit' || $mode == 'reply' || $mode == 'quote') && ($auth->acl_get('m_lock', $forum_id) || $auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED) ? true : false, 'S_LOCK_TOPIC_CHECKED' => $lock_topic_checked ? ' checked="checked"' : '', 'S_LOCK_POST_ALLOWED' => $mode == 'edit' && $auth->acl_get('m_edit', $forum_id) ? true : false, 'S_LOCK_POST_CHECKED' => $lock_post_checked ? ' checked="checked"' : '', 'S_LINKS_ALLOWED' => $url_status, 'S_MAGIC_URL_CHECKED' => $urls_checked ? ' checked="checked"' : '', 'S_TYPE_TOGGLE' => $topic_type_toggle, 'S_SAVE_ALLOWED' => $auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $mode != 'edit' ? true : false, 'S_HAS_DRAFTS' => $auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $post_data['drafts'] ? true : false, 'S_FORM_ENCTYPE' => $form_enctype, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_URL' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'S_POST_ACTION' => $s_action, 'S_HIDDEN_FIELDS' => $s_hidden_fields));
// Build custom bbcodes array
display_custom_bbcodes();
// Poll entry
if (($mode == 'post' || $mode == 'edit' && $post_id == $post_data['topic_first_post_id']) && $auth->acl_get('f_poll', $forum_id)) {
    $template->assign_vars(array('S_SHOW_POLL_BOX' => true, 'S_POLL_VOTE_CHANGE' => $auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id), 'S_POLL_DELETE' => $mode == 'edit' && sizeof($post_data['poll_options']) && (!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) || $auth->acl_get('m_delete', $forum_id)), 'S_POLL_DELETE_CHECKED' => !empty($poll_delete) ? true : false, 'L_POLL_OPTIONS_EXPLAIN' => sprintf($user->lang['POLL_OPTIONS_' . ($mode == 'edit' ? 'EDIT_' : '') . 'EXPLAIN'], $config['max_poll_options']), 'VOTE_CHANGE_CHECKED' => !empty($post_data['poll_vote_change']) ? ' checked="checked"' : '', 'POLL_TITLE' => isset($post_data['poll_title']) ? $post_data['poll_title'] : '', 'POLL_OPTIONS' => !empty($post_data['poll_options']) ? implode("\n", $post_data['poll_options']) : '', 'POLL_MAX_OPTIONS' => isset($post_data['poll_max_options']) ? (int) $post_data['poll_max_options'] : 1, 'POLL_LENGTH' => $post_data['poll_length']));
}
// Show attachment box for adding attachments if true
$allowed = $auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype;
// Attachment entry
posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);
// Output page ...
page_header($page_title, false);
$template->set_filenames(array('body' => 'posting_body.html'));
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.{$phpEx}"));
// Topic review
if ($mode == 'reply' || $mode == 'quote') {
    if (topic_review($topic_id, $forum_id)) {
开发者ID:PetsFundation,项目名称:Pets,代码行数:31,代码来源:posting.php

示例8: main

    public function main($id, $mode)
    {
        global $cache, $config, $db, $phpbb_log, $request, $template, $user, $phpbb_root_path, $phpEx, $phpbb_container;
        $this->cache = $cache;
        $this->config = $config;
        $this->config_text = $phpbb_container->get('config_text');
        $this->db = $db;
        $this->log = $phpbb_log;
        $this->request = $request;
        $this->template = $template;
        $this->user = $user;
        $this->phpbb_root_path = $phpbb_root_path;
        $this->php_ext = $phpEx;
        // Add the posting lang file needed by BBCodes
        $this->user->add_lang(array('posting'));
        // Add the board announcements ACP lang file
        $this->user->add_lang_ext('phpbb/boardannouncements', 'boardannouncements_acp');
        // Load a template from adm/style for our ACP page
        $this->tpl_name = 'board_announcements';
        // Set the page title for our ACP page
        $this->page_title = 'ACP_BOARD_ANNOUNCEMENTS_SETTINGS';
        // Define the name of the form for use as a form key
        $form_name = 'acp_board_announcements';
        add_form_key($form_name);
        // Set an empty error string
        $error = '';
        // Include files needed for displaying BBCodes
        if (!function_exists('display_custom_bbcodes')) {
            include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
        }
        // Get all board announcement data from the config_text table in the database
        $data = $this->config_text->get_array(array('announcement_text', 'announcement_uid', 'announcement_bitfield', 'announcement_options', 'announcement_bgcolor'));
        // If form is submitted or previewed
        if ($this->request->is_set_post('submit') || $this->request->is_set_post('preview')) {
            // Test if form key is valid
            if (!check_form_key($form_name)) {
                $error = $this->user->lang('FORM_INVALID');
            }
            // Get new announcement text and bgcolor values from the form
            $data['announcement_text'] = $this->request->variable('board_announcements_text', '', true);
            $data['announcement_bgcolor'] = $this->request->variable('board_announcements_bgcolor', '', true);
            // Get config options from the form
            $enable_announcements = $this->request->variable('board_announcements_enable', false);
            $allow_guests = $this->request->variable('board_announcements_guests', false);
            $dismiss_announcements = $this->request->variable('board_announcements_dismiss', false);
            // Prepare announcement text for storage
            generate_text_for_storage($data['announcement_text'], $data['announcement_uid'], $data['announcement_bitfield'], $data['announcement_options'], !$this->request->variable('disable_bbcode', false), !$this->request->variable('disable_magic_url', false), !$this->request->variable('disable_smilies', false));
            // Store the announcement text and settings if submitted with no errors
            if (empty($error) && $this->request->is_set_post('submit')) {
                // Store the config enable/disable state
                $this->config->set('board_announcements_enable', $enable_announcements);
                $this->config->set('board_announcements_guests', $allow_guests);
                $this->config->set('board_announcements_dismiss', $dismiss_announcements);
                // Store the announcement settings to the config_table in the database
                $this->config_text->set_array(array('announcement_text' => $data['announcement_text'], 'announcement_uid' => $data['announcement_uid'], 'announcement_bitfield' => $data['announcement_bitfield'], 'announcement_options' => $data['announcement_options'], 'announcement_bgcolor' => $data['announcement_bgcolor'], 'announcement_timestamp' => time()));
                // Set the board_announcements_status for all normal users
                // to 1 when an announcement is created, or 0 when announcement is empty
                $announcement_status = !empty($data['announcement_text']) ? 1 : 0;
                $sql = 'UPDATE ' . USERS_TABLE . '
					SET board_announcements_status = ' . $announcement_status . '
					WHERE user_type <> ' . USER_IGNORE;
                $this->db->sql_query($sql);
                // Set the board_announcement status for guests if they are allowed
                // We do this separately for guests to make sure it is always set to
                // the correct value every time.
                $sql = 'UPDATE ' . USERS_TABLE . '
					SET board_announcements_status = ' . ($allow_guests && $announcement_status ? 1 : 0) . '
					WHERE user_id = ' . ANONYMOUS;
                $this->db->sql_query($sql);
                // Log the announcement update
                $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'BOARD_ANNOUNCEMENTS_UPDATED_LOG');
                // Destroy any cached board announcement data
                $this->cache->destroy('_board_announcement_data');
                // Output message to user for the announcement update
                trigger_error($this->user->lang('BOARD_ANNOUNCEMENTS_UPDATED') . adm_back_link($this->u_action));
            }
        }
        // Prepare a fresh announcement preview
        $announcement_text_preview = '';
        if ($this->request->is_set_post('preview')) {
            $announcement_text_preview = generate_text_for_display($data['announcement_text'], $data['announcement_uid'], $data['announcement_bitfield'], $data['announcement_options']);
        }
        // prepare the announcement text for editing inside the textbox
        $announcement_text_edit = generate_text_for_edit($data['announcement_text'], $data['announcement_uid'], $data['announcement_options']);
        // Output data to the template
        $this->template->assign_vars(array('ERRORS' => $error, 'BOARD_ANNOUNCEMENTS_ENABLED' => isset($enable_announcements) ? $enable_announcements : $this->config['board_announcements_enable'], 'BOARD_ANNOUNCEMENTS_GUESTS' => isset($allow_guests) ? $allow_guests : $this->config['board_announcements_guests'], 'BOARD_ANNOUNCEMENTS_DISMISS' => isset($dismiss_announcements) ? $dismiss_announcements : $this->config['board_announcements_dismiss'], 'BOARD_ANNOUNCEMENTS_TEXT' => $announcement_text_edit['text'], 'BOARD_ANNOUNCEMENTS_PREVIEW' => $announcement_text_preview, 'BOARD_ANNOUNCEMENTS_BGCOLOR' => $data['announcement_bgcolor'], 'S_BBCODE_DISABLE_CHECKED' => !$announcement_text_edit['allow_bbcode'], 'S_SMILIES_DISABLE_CHECKED' => !$announcement_text_edit['allow_smilies'], 'S_MAGIC_URL_DISABLE_CHECKED' => !$announcement_text_edit['allow_urls'], 'BBCODE_STATUS' => $this->user->lang('BBCODE_IS_ON', '<a href="' . append_sid("{$this->phpbb_root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'SMILIES_STATUS' => $this->user->lang('SMILIES_ARE_ON'), 'IMG_STATUS' => $this->user->lang('IMAGES_ARE_ON'), 'FLASH_STATUS' => $this->user->lang('FLASH_IS_ON'), 'URL_STATUS' => $this->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, 'S_BOARD_ANNOUNCEMENTS' => true, 'U_ACTION' => $this->u_action));
        // Build custom bbcodes array
        display_custom_bbcodes();
    }
开发者ID:harsha-sira,项目名称:Online-Forum,代码行数:89,代码来源:board_announcements_module.php

示例9: main


//.........这里部分代码省略.........
					// Now parse it for displaying
					$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
					unset($message_parser);
				}

				decode_message($signature, $user_row['user_sig_bbcode_uid']);

				$template->assign_vars(array(
					'S_SIGNATURE'		=> true,

					'SIGNATURE'			=> $signature,
					'SIGNATURE_PREVIEW'	=> $signature_preview,

					'S_BBCODE_CHECKED'		=> (!$enable_bbcode) ? ' checked="checked"' : '',
					'S_SMILIES_CHECKED'		=> (!$enable_smilies) ? ' checked="checked"' : '',
					'S_MAGIC_URL_CHECKED'	=> (!$enable_urls) ? ' checked="checked"' : '',

					'BBCODE_STATUS'			=> ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
					'SMILIES_STATUS'		=> ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
					'IMG_STATUS'			=> ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
					'FLASH_STATUS'			=> ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
					'URL_STATUS'			=> ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],

					'L_SIGNATURE_EXPLAIN'	=> sprintf($user->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']),

					'S_BBCODE_ALLOWED'		=> $config['allow_sig_bbcode'],
					'S_SMILIES_ALLOWED'		=> $config['allow_sig_smilies'],
					'S_BBCODE_IMG'			=> ($config['allow_sig_img']) ? true : false,
					'S_BBCODE_FLASH'		=> ($config['allow_sig_flash']) ? true : false,
					'S_LINKS_ALLOWED'		=> ($config['allow_sig_links']) ? true : false)
				);

				// Assigning custom bbcodes
				display_custom_bbcodes();

			break;

			case 'attach':

				$start		= request_var('start', 0);
				$deletemark = (isset($_POST['delmarked'])) ? true : false;
				$marked		= request_var('mark', array(0));

				// Sort keys
				$sort_key	= request_var('sk', 'a');
				$sort_dir	= request_var('sd', 'd');

				if ($deletemark && sizeof($marked))
				{
					$sql = 'SELECT attach_id
						FROM ' . ATTACHMENTS_TABLE . '
						WHERE poster_id = ' . $user_id . '
							AND is_orphan = 0
							AND ' . $db->sql_in_set('attach_id', $marked);
					$result = $db->sql_query($sql);

					$marked = array();
					while ($row = $db->sql_fetchrow($result))
					{
						$marked[] = $row['attach_id'];
					}
					$db->sql_freeresult($result);
				}

				if ($deletemark && sizeof($marked))
				{
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:acp_users.php

示例10: edit_article

    /**
     * Edit an article
     *
     * @param	string	$article	URL of the article
     * @return	object
     */
    public function edit_article($article)
    {
        // If no auth to edit display error message
        if (!$this->auth->acl_get('u_wiki_edit')) {
            trigger_error('NO_ARTICLE');
        }
        $this->user->add_lang('posting');
        $preview = $this->request->is_set_post('preview');
        $submit = $this->request->is_set_post('submit');
        $error = array();
        if ($preview || $submit) {
            $title = $this->request->variable('title', '', true);
            $message = $this->request->variable('message', '', true);
            $edit_reason = $this->request->variable('edit_reason', '', true);
            $topic_id = $this->request->variable('topic_id', '', true);
            $message_length = utf8_strlen($message);
            if (utf8_clean_string($title) === '') {
                $error[] = $this->user->lang['EMPTY_SUBJECT'];
            }
            if (utf8_clean_string($message) === '') {
                $error[] = $this->user->lang['TOO_FEW_CHARS'];
            }
            // Maximum message length check. 0 disables this check completely.
            if ((int) $this->config['max_post_chars'] > 0 && $message_length > (int) $this->config['max_post_chars']) {
                $error[] = $this->user->lang('CHARS_POST_CONTAINS', $message_length) . '<br />' . $this->user->lang('TOO_MANY_CHARS_LIMIT', (int) $this->config['max_post_chars']);
            }
            // Minimum message length check
            if (!$message_length || $message_length < (int) $this->config['min_post_chars']) {
                $error[] = !$message_length ? $this->user->lang['TOO_FEW_CHARS'] : $this->user->lang('CHARS_POST_CONTAINS', $message_length) . '<br />' . $this->user->lang('TOO_FEW_CHARS_LIMIT', (int) $this->config['min_post_chars']);
            }
        }
        if (sizeof($error)) {
            $this->template->assign_vars(array('ERROR' => implode('<br />', $error), 'TITLE' => $title, 'MESSAGE' => $message));
        } else {
            if ($preview) {
                $preview_text = $message;
                $uid = $bitfield = $options = '';
                generate_smilies('inline', 0);
                display_custom_bbcodes();
                add_form_key('article');
                $allowed_bbcode = $allowed_smilies = $allowed_urls = true;
                generate_text_for_storage($preview_text, $uid, $bitfield, $options, true, true, true);
                $preview_text = generate_text_for_display($preview_text, $uid, $bitfield, $options);
                $this->template->assign_vars(array('S_PREVIEW' => true, 'S_BBCODE_ALLOWED' => 1, 'TITLE' => $title, 'PREVIEW_MESSAGE' => $preview_text, 'MESSAGE' => $message, 'EDIT_REASON' => $edit_reason, 'TOPIC_ID' => $topic_id));
            } else {
                if ($submit) {
                    generate_text_for_storage($message, $uid, $bitfield, $options, true, true, true);
                    $sql_data = array('article_title' => $title, 'article_url' => $article, 'article_text' => $message, 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'article_approved' => 1, 'article_user_id' => $this->user->data['user_id'], 'article_last_edit' => time(), 'article_edit_reason' => $edit_reason, 'article_topic_id' => (int) $topic_id);
                    $sql = 'INSERT INTO ' . $this->table_article . '
				' . $this->db->sql_build_array('INSERT', $sql_data);
                    $this->db->sql_query($sql);
                    $back_url = empty($article) ? $this->helper->route('tas2580_wiki_index', array()) : $this->helper->route('tas2580_wiki_article', array('article' => $article));
                    trigger_error($this->user->lang['EDIT_ARTICLE_SUCCESS'] . '<br /><br /><a href="' . $back_url . '">' . $this->user->lang['BACK_TO_ARTICLE'] . '</a>');
                } else {
                    $sql = 'SELECT *
				FROM ' . $this->table_article . '
					WHERE article_url = "' . $this->db->sql_escape($article) . '"
				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);
                    generate_smilies('inline', 0);
                    display_custom_bbcodes();
                    add_form_key('article');
                    $message = generate_text_for_edit($this->data['article_text'], $this->data['bbcode_uid'], 3);
                    $this->template->assign_vars(array('TITLE' => $this->data['article_title'], 'MESSAGE' => $message['text'], 'S_BBCODE_ALLOWED' => 1, 'TOPIC_ID' => $this->data['article_topic_id']));
                    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))));
                    }
                }
            }
        }
        return $this->helper->render('article_edit.html', $this->user->lang['EDIT_WIKI']);
    }
开发者ID:TWEagle,项目名称:wiki,代码行数:80,代码来源:edit.php

示例11: base


//.........这里部分代码省略.........
        $next = $prev = false;
        if (count($images_array) > $cur + 1) {
            $next = array('image_id' => $images_array[$cur + 1]['image_id'], 'image_name' => $images_array[$cur + 1]['image_name']);
        }
        if ($cur > 0) {
            $prev = array('image_id' => $images_array[$cur - 1]['image_id'], 'image_name' => $images_array[$cur - 1]['image_name']);
        }
        $this->db->sql_freeresult($result);
        $this->template->assign_vars(array('UC_NEXT_IMAGE' => $next ? $this->gallery_config->get('disp_nextprev_thumbnail') ? '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id'])) . '"><img style="max-width: 70px; max-height: 70px;" src="' . $this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $next['image_id'])) . '" alt="' . $next['image_name'] . '"></a>' : '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id'])) . '">' . $next['image_name'] . ' &raquo;&raquo; </a>' : '', 'UC_PREV_IMAGE' => $prev ? $this->gallery_config->get('disp_nextprev_thumbnail') ? '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $prev['image_id'])) . '"><img style="max-width: 70px; max-height: 70px;" src="' . $this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $prev['image_id'])) . '" alt="' . $prev['image_name'] . '"></a>' : '<a href="' . $this->helper->route('phpbbgallery_image', array('image_id' => $prev['image_id'])) . '">&laquo;&laquo; ' . $prev['image_name'] . '</a>' : '', 'U_VIEW_ALBUM' => $this->helper->route('phpbbgallery_album', array('album_id' => $album_id)), 'UC_IMAGE' => $this->helper->route('phpbbgallery_image_file_medium', array('image_id' => $image_id)), 'U_DELETE' => $s_allowed_delete ? $this->helper->route('phpbbgallery_image_delete', array('image_id' => $image_id)) : '', 'U_EDIT' => $s_allowed_edit ? $this->helper->route('phpbbgallery_image_edit', array('image_id' => $image_id)) : '', 'U_REPORT' => $this->gallery_auth->acl_check('i_report', $album_id, $album_data['album_user_id']) && $this->data['image_user_id'] != $this->user->data['user_id'] ? $this->helper->route('phpbbgallery_image_report', array('image_id' => $image_id)) : '', 'U_STATUS' => $s_allowed_status ? $this->helper->route('phpbbgallery_moderate_image', array('image_id' => $image_id)) : '', 'CONTEST_RANK' => $this->data['image_contest_rank'] ? $this->user->lang('CONTEST_RESULT_' . $this->data['image_contest_rank']) : '', 'IMAGE_NAME' => $this->data['image_name'], 'IMAGE_DESC' => $image_desc, 'IMAGE_BBCODE' => $this->config['allow_bbcode'] ? '[image]' . $image_id . '[/image]' : '', 'IMAGE_IMGURL_BBCODE' => $this->config['phpbb_gallery_disp_image_url'] ? '[url=' . $this->url->get_uri($this->helper->route('phpbbgallery_image', array('image_id' => $image_id))) . '][img]' . $this->url->get_uri($this->helper->route('phpbbgallery_image_file_mini', array('image_id' => $image_id))) . '[/img][/url]' : '', 'IMAGE_URL' => $this->config['phpbb_gallery_disp_image_url'] ? $this->url->get_uri($this->helper->route('phpbbgallery_image', array('image_id' => $image_id))) : '', 'IMAGE_TIME' => $this->user->format_date($this->data['image_time']), 'IMAGE_VIEW' => $this->data['image_view_count'], 'POSTER_IP' => $this->auth->acl_get('a_') ? $this->data['image_user_ip'] : '', 'U_POSTER_WHOIS' => $this->auth->acl_get('a_') ? append_sid('mcp', 'mode=whois&amp;ip=' . $this->data['image_user_ip']) : '', 'S_ALBUM_ACTION' => $this->helper->route('phpbbgallery_image', array('image_id' => $image_id)), 'U_RETURN_LINK' => $this->helper->route('phpbbgallery_album', array('album_id' => $album_id)), 'S_RETURN_LINK' => $this->user->lang('RETURN_TO', $album_data['album_name'])));
        switch ($this->gallery_config->get('link_imagepage')) {
            case 'image':
                $this->template->assign_vars(array('UC_IMAGE_ACTION' => $this->helper->route('phpbbgallery_image_file_source', array('image_id' => $image_id))));
                break;
            case 'next':
                if ($next) {
                    $this->template->assign_vars(array('UC_IMAGE_ACTION' => $this->helper->route('phpbbgallery_image', array('image_id' => $next['image_id']))));
                }
                break;
        }
        $image_data = $this->data;
        /**
         * Event view image
         *
         * @event phpbbgallery.core.viewimage
         * @var	int		image_id		id of the image we are viewing
         * @var	array	image_data		All the data related to the image
         * @var	array	album_data		All the data related to the album image is part of
         * @var	string	page_title		Page title
         * @since 1.2.0
         */
        $vars = array('image_id', 'image_data', 'album_data', 'page_title');
        extract($this->dispatcher->trigger_event('phpbbgallery.core.viewimage', compact($vars)));
        $this->data = $image_data;
        $user_id = $this->data['image_user_id'];
        $sql = $this->db->sql_build_query('SELECT', array('SELECT' => 'u.*, gu.personal_album_id, gu.user_images', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array($this->table_users => 'gu'), 'ON' => 'gu.user_id = u.user_id')), 'WHERE' => 'u.user_id = ' . $this->data['image_user_id']));
        $result = $this->db->sql_query($sql);
        $user_cache = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            \phpbbgallery\core\user::add_user_to_cache($user_cache, $row);
        }
        $this->db->sql_freeresult($result);
        $user_cache[$user_id]['username'] = $this->data['image_username'] ? $this->data['image_username'] : $this->user->lang['GUEST'];
        $this->template->assign_vars(array('POSTER_FULL' => get_username_string('full', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_COLOUR' => get_username_string('colour', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_USERNAME' => get_username_string('username', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'U_POSTER' => get_username_string('profile', $user_id, $user_cache[$user_id]['username'], $user_cache[$user_id]['user_colour']), 'POSTER_SIGNATURE' => $user_cache[$user_id]['sig'], 'POSTER_RANK_TITLE' => $user_cache[$user_id]['rank_title'], 'POSTER_RANK_IMG' => $user_cache[$user_id]['rank_image'], 'POSTER_RANK_IMG_SRC' => $user_cache[$user_id]['rank_image_src'], 'POSTER_JOINED' => $user_cache[$user_id]['joined'], 'POSTER_POSTS' => $user_cache[$user_id]['posts'], 'POSTER_AVATAR' => $user_cache[$user_id]['avatar'], 'POSTER_WARNINGS' => $user_cache[$user_id]['warnings'], 'POSTER_AGE' => $user_cache[$user_id]['age'], 'POSTER_ONLINE_IMG' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? '' : ($user_cache[$user_id]['online'] ? $this->user->img('icon_user_online', 'ONLINE') : $this->user->img('icon_user_offline', 'OFFLINE')), 'S_POSTER_ONLINE' => $user_id == ANONYMOUS || !$this->config['load_onlinetrack'] ? false : ($user_cache[$user_id]['online'] ? true : false), 'U_POSTER_PROFILE' => $user_cache[$user_id]['profile'], 'U_POSTER_SEARCH' => $user_cache[$user_id]['search'], 'U_POSTER_PM' => $user_id != ANONYMOUS && $this->config['allow_privmsg'] && $this->auth->acl_get('u_sendpm') && ($user_cache[$user_id]['allow_pm'] || $this->auth->acl_gets('a_', 'm_')) ? append_sid('./ucp.php', 'i=pm&amp;mode=compose&amp;u=' . $user_id) : '', 'U_POSTER_EMAIL' => $this->auth->acl_gets('a_') || !$this->config['board_hide_emails'] ? $user_cache[$user_id]['email'] : false, 'U_POSTER_JABBER' => $user_cache[$user_id]['jabber'], 'U_POSTER_GALLERY' => $user_cache[$user_id]['gallery_album'], 'POSTER_GALLERY_IMAGES' => $user_cache[$user_id]['gallery_images'], 'U_POSTER_GALLERY_SEARCH' => $user_cache[$user_id]['gallery_search']));
        // Add ratings
        if ($this->gallery_config->get('allow_rates')) {
            $rating = new \phpbbgallery\core\rating($image_id, $image_data, $album_data);
            $user_rating = $rating->get_user_rating($this->user->data['user_id']);
            // Check: User didn't rate yet, has permissions, it's not the users own image and the user is logged in
            if (!$user_rating && $rating->is_allowed()) {
                $rating->display_box();
            }
            $this->template->assign_vars(array('IMAGE_RATING' => $rating->get_image_rating($user_rating), 'S_ALLOWED_TO_RATE' => !$user_rating && $rating->is_allowed(), 'S_VIEW_RATE' => $this->gallery_auth->acl_check('i_rate', $album_id, $album_data['album_user_id']) ? true : false, 'S_RATE_ACTION' => $this->helper->route('phpbbgallery_image_rate', array('image_id' => $image_id))));
            unset($rating);
        }
        /**
         * Posting comment
         */
        $comments_disabled = !$this->gallery_config->get('allow_comments') || $this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments'];
        if (!$comments_disabled && $this->gallery_auth->acl_check('c_post', $album_id, $album_data['album_user_id']) && $album_data['album_status'] != $this->album->get_status_locked() && ($image_data['image_status'] != $this->image->get_status_locked() || $this->gallery_auth->acl_check('m_status', $album_id, $album_data['album_user_id']))) {
            add_form_key('gallery');
            $this->user->add_lang('posting');
            $this->url->_include('functions_posting', 'phpbb');
            $bbcode_status = $this->config['allow_bbcode'] ? true : false;
            $smilies_status = $this->config['allow_smilies'] ? true : false;
            $img_status = $bbcode_status ? true : false;
            $url_status = $this->config['allow_post_links'] ? true : false;
            $flash_status = false;
            $quote_status = true;
            include_once $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
            // Build custom bbcodes array
            display_custom_bbcodes();
            // Build smilies array
            generate_smilies('inline', 0);
            //$s_hide_comment_input = (time() < ($album_data['contest_start'] + $album_data['contest_end'])) ? true : false;
            $s_hide_comment_input = false;
            $this->template->assign_vars(array('S_ALLOWED_TO_COMMENT' => true, 'S_HIDE_COMMENT_INPUT' => $s_hide_comment_input, 'BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . $this->url->append_sid('phpbb', 'faq', 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . $this->url->append_sid('phpbb', 'faq', 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $bbcode_status && $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_SIGNATURE_CHECKED' => $this->user->optionget('attachsig') ? ' checked="checked"' : '', 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_LINKS_ALLOWED' => $url_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_URL' => $url_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'L_COMMENT_LENGTH' => sprintf($this->user->lang['COMMENT_LENGTH'], $this->gallery_config->get('comment_length'))));
            if ($this->misc->display_captcha('comment')) {
                global $phpbb_container;
                $captcha = $phpbb_container->get('captcha.factory')->get_instance($this->config['captcha_plugin']);
                $captcha->init(CONFIRM_POST);
                $this->template->assign_vars(array('S_CONFIRM_CODE' => true, 'CAPTCHA_TEMPLATE' => $captcha->get_template()));
            }
            // Different link, when we rate and dont comment
            if (!$s_hide_comment_input) {
                //$this->template->assign_var('S_COMMENT_ACTION', append_sid($this->url->path('full') . 'comment/' . $image_id . '/add/0'));
                $this->template->assign_var('S_COMMENT_ACTION', $this->helper->route('phpbbgallery_comment_add', array('image_id' => $image_id, 'comment_id' => 0)));
            }
        } else {
            if ($this->gallery_config->get('comment_user_control') && !$image_data['image_allow_comments']) {
                $this->template->assign_var('S_COMMENTS_DISABLED', true);
            }
        }
        /**
         * Listing comment
         */
        if ($this->gallery_config->get('allow_comments') && $this->gallery_auth->acl_check('c_read', $album_id, $album_data['album_user_id'])) {
            $this->display_comments($image_id, $this->data, $album_id, $album_data, ($page - 1) * $this->gallery_config->get('items_per_page'), $this->gallery_config->get('items_per_page'));
        }
        return $this->helper->render('gallery/viewimage_body.html', $page_title);
    }
开发者ID:vodis,项目名称:phpbbgallery,代码行数:101,代码来源:image.php

示例12: index

 public function index()
 {
     // sets a few variables before the actions
     $this->mode = $this->request->variable('mode', 'default');
     $this->last_id = $this->request->variable('last_id', 0);
     $this->last_time = $this->request->variable('last_time', 0);
     $this->post_time = $this->request->variable('last_post', 0);
     $this->read_interval = $this->request->variable('read_interval', 5000);
     // Grabs the right Action depending on ajax requested mode
     if ($this->mode === 'default') {
         $this->defaultAction();
     } else {
         if ($this->mode === 'read') {
             $this->readAction();
         } else {
             if ($this->mode === 'smilies') {
                 $this->smiliesAction();
             } else {
                 if ($this->mode === 'delete') {
                     $this->delAction();
                 }
             }
         }
     }
     // Sets a few variables
     $bbcode_status = $this->config['allow_bbcode'] && $this->config['auth_bbcode_pm'] && $this->auth->acl_get('u_ajaxchat_bbcode') ? true : false;
     $smilies_status = $this->config['allow_smilies'] && $this->config['auth_smilies_pm'] && $this->auth->acl_get('u_pm_smilies') ? true : false;
     $img_status = $this->config['auth_img_pm'] && $this->auth->acl_get('u_pm_img') ? true : false;
     $flash_status = $this->config['auth_flash_pm'] && $this->auth->acl_get('u_pm_flash') ? true : false;
     $url_status = $this->config['allow_post_links'] ? true : false;
     $quote_status = true;
     $this->mode = strtoupper($this->mode);
     $sql = 'SELECT `user_lastpost` FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$this->user->data['user_id']}";
     $result = $this->db->sql_query($sql);
     $row = $this->db->sql_fetchrow($result);
     $this->db->sql_freeresult($result);
     if ($this->get_status($row['user_lastpost']) === 'online') {
         $refresh = $this->config['refresh_online_chat'];
     } else {
         if ($this->user->data['user_id'] === ANONYMOUS || $this->get_status($row['user_lastpost']) === 'offline') {
             $refresh = $this->config['refresh_offline_chat'];
         } else {
             $refresh = $this->config['refresh_offline_chat'];
         }
     }
     if ($this->user->data['user_id'] === ANONYMOUS || $row['user_lastpost'] === null) {
         $last_post = 0;
     } else {
         $last_post = $row['user_lastpost'];
     }
     $details = base64_decode('Jm5ic3A7PGEgaHJlZj0iaHR0cDovL3d3dy5saXZlbWVtYmVyc29ubHkuY29tIiBzdHlsZT0iZm9udC13ZWlnaHQ6IGJvbGQ7Ij5BSkFYJm5ic3A7Q2hhdCZuYnNwOyZjb3B5OyZuYnNwOzIwMTU8L2E+Jm5ic3A7PHN0cm9uZz5MaXZlJm5ic3A7TWVtYmVycyZuYnNwO09ubHk8L3N0cm9uZz4=');
     //Assign the features template variable
     $this->template->assign_vars(['BBCODE_STATUS' => $bbcode_status ? sprintf($this->user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$this->root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>') : sprintf($this->user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$this->root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'IMG_STATUS' => $img_status ? $this->user->lang['IMAGES_ARE_ON'] : $this->user->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $flash_status ? $this->user->lang['FLASH_IS_ON'] : $this->user->lang['FLASH_IS_OFF'], 'SMILIES_STATUS' => $smilies_status ? $this->user->lang['SMILIES_ARE_ON'] : $this->user->lang['SMILIES_ARE_OFF'], 'URL_STATUS' => $url_status ? $this->user->lang['URL_IS_ON'] : $this->user->lang['URL_IS_OFF'], 'S_LINKS_ALLOWED' => $url_status, 'S_COMPOSE_PM' => true, 'S_BBCODE_ALLOWED' => $bbcode_status, 'S_SMILIES_ALLOWED' => $smilies_status, 'S_BBCODE_IMG' => $img_status, 'S_BBCODE_FLASH' => $flash_status, 'S_BBCODE_QUOTE' => $quote_status, 'S_BBCODE_URL' => $url_status, 'L_DETAILS' => $details, 'REFRESH_TIME' => $refresh, 'LAST_ID' => $this->last_id, 'LAST_POST' => $last_post, 'TIME' => time(), 'L_VERSION' => '3.0.9-BETA', 'STYLE_PATH' => generate_board_url() . '/styles/' . $this->user->style['style_path'], 'EXT_STYLE_PATH' => '' . $this->ext_path_web . 'styles/', 'FILENAME' => $this->helper->route('spaceace_ajaxchat_chat'), 'S_ARCHIVE' => !$this->get ? true : false, 'S_GET_CHAT' => $this->get ? true : false, 'S_' . $this->mode => true]);
     // Generate smiley listing
     \generate_smilies('inline', 0);
     // Build custom bbcodes array
     \display_custom_bbcodes();
     $this->whois_online();
     return $this->helper->render('chat_body.html', $this->user->lang['CHAT_ARCHIVE_EXPLAIN']);
 }
开发者ID:MrGoldy,项目名称:ajaxchat,代码行数:60,代码来源:archive.php

示例13: add_edit_page_data

 /**
  * Process page data to be added or edited
  *
  * @param object $entity The page entity object
  * @return null
  * @access protected
  */
 protected function add_edit_page_data($entity)
 {
     // Create an array to collect errors that will be output to the user
     $errors = array();
     // Is the form submitted
     $submit = $this->request->is_set_post('submit');
     // Load posting language file for the BBCode editor
     $this->user->add_lang('posting');
     // Add form key for form validation checks
     add_form_key('add_edit_page');
     // Collect form data
     $data = array('page_title' => $this->request->variable('page_title', '', true), 'page_route' => $this->request->variable('page_route', ''), 'page_description' => $this->request->variable('page_description', '', true), 'page_content' => $this->request->variable('page_content', '', true), 'bbcode' => $this->request->variable('parse_bbcode', false), 'magic_url' => $this->request->variable('parse_magic_url', false), 'smilies' => $this->request->variable('parse_smilies', false), 'html' => $this->request->variable('parse_html', false), 'page_template' => $this->request->variable('page_template', ''), 'page_links' => $this->request->variable('page_links', array(0)), 'page_order' => $this->request->variable('page_order', 0), 'page_display' => $this->request->variable('page_display', 0), 'page_display_to_guests' => $this->request->variable('page_guest_display', 0));
     // Grab the form data's message parsing options (possible values: 1 or 0)
     // If submit use the data from the form
     // If page edit use data stored in the entity
     // If page add use default values
     $content_parse_options = array('bbcode' => $submit ? $data['bbcode'] : ($entity->get_id() ? $entity->content_bbcode_enabled() : 1), 'magic_url' => $submit ? $data['magic_url'] : ($entity->get_id() ? $entity->content_magic_url_enabled() : 1), 'smilies' => $submit ? $data['smilies'] : ($entity->get_id() ? $entity->content_smilies_enabled() : 1), 'html' => $submit ? $data['html'] : ($entity->get_id() ? $entity->content_html_enabled() : 0));
     // Set the content parse options in the entity
     foreach ($content_parse_options as $function => $enabled) {
         call_user_func(array($entity, ($enabled ? 'content_enable_' : 'content_disable_') . $function));
     }
     // Purge temporary variable
     unset($content_parse_options);
     // If the form has been submitted, set all data and save it
     if ($submit) {
         // Test if the form is valid
         // Use -1 to allow unlimited time to submit form
         if (!check_form_key('add_edit_page', -1)) {
             $errors[] = $this->user->lang('FORM_INVALID');
         }
         // Map the form's page data fields to setters
         $map_fields = array('set_title' => $data['page_title'], 'set_route' => $data['page_route'], 'set_description' => $data['page_description'], 'set_content' => $data['page_content'], 'set_template' => $data['page_template'], 'set_order' => $data['page_order'], 'set_page_display' => $data['page_display'], 'set_page_display_to_guests' => $data['page_display_to_guests']);
         // Set the mapped page data in the entity
         foreach ($map_fields as $entity_function => $page_data) {
             try {
                 // Calling the $entity_function on the entity and passing it $page_data
                 call_user_func_array(array($entity, $entity_function), array($page_data));
             } catch (\phpbb\pages\exception\base $e) {
                 // Catch exceptions and add them to errors array
                 $errors[] = $e->get_message($this->user);
             }
         }
         // Purge temporary variable
         unset($map_fields);
         // Insert or update page
         if (empty($errors)) {
             if ($entity->get_id()) {
                 // Save the edited page entity to the database
                 $entity->save();
                 // Save the page link location data
                 $this->page_operator->insert_page_links($entity->get_id(), $data['page_links']);
                 // Log the action
                 $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_PAGES_EDITED_LOG', time(), array($entity->get_title()));
                 // Show user confirmation of the saved page and provide link back to the previous screen
                 trigger_error($this->user->lang('ACP_PAGES_EDIT_SUCCESS') . adm_back_link($this->u_action));
             } else {
                 // Add the new page entity to the database
                 /* @var $entity \phpbb\pages\entity\page */
                 $entity = $this->page_operator->add_page($entity);
                 // Save the page link location data (now that we can access the new id)
                 $this->page_operator->insert_page_links($entity->get_id(), $data['page_links']);
                 // Log the action
                 $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'ACP_PAGES_ADDED_LOG', time(), array($entity->get_title()));
                 // Show user confirmation of the added page and provide link back to the previous screen
                 trigger_error($this->user->lang('ACP_PAGES_ADD_SUCCESS') . adm_back_link($this->u_action));
             }
         }
     }
     /**
      * Event to add to Pages ACP add/edit pages
      *
      * @event phpbb.pages.acp_add_edit_page
      * @since 1.0.0-RC1
      */
     $this->dispatcher->dispatch('phpbb.pages.acp_add_edit_page');
     // Set template vars for Page Template select menu
     $this->create_page_template_options($entity->get_template());
     // Set template vars for Page Link Locations select menu
     $this->create_page_link_options($entity->get_id(), $data['page_links']);
     // Set output vars for display in the template
     $this->template->assign_vars(array('S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => sizeof($errors) ? implode('<br />', $errors) : '', 'PAGES_TITLE' => $entity->get_title(), 'PAGES_ROUTE' => $entity->get_route(), 'PAGES_CONTENT' => $entity->get_content_for_edit(), 'PAGES_DESCRIPTION' => $entity->get_description(), 'PAGES_ORDER' => $entity->get_order(), 'S_PAGES_DISPLAY' => $entity->get_page_display(), 'S_PAGES_GUEST_DISPLAY' => $entity->get_page_display_to_guests(), 'S_PARSE_BBCODE_CHECKED' => $entity->content_bbcode_enabled(), 'S_PARSE_SMILIES_CHECKED' => $entity->content_smilies_enabled(), 'S_PARSE_MAGIC_URL_CHECKED' => $entity->content_magic_url_enabled(), 'S_PARSE_HTML_CHECKED' => $entity->content_html_enabled(), 'BBCODE_STATUS' => $this->user->lang('BBCODE_IS_ON', '<a href="' . append_sid("{$this->root_path}faq.{$this->php_ext}", 'mode=bbcode') . '">', '</a>'), 'SMILIES_STATUS' => $this->user->lang('SMILIES_ARE_ON'), 'IMG_STATUS' => $this->user->lang('IMAGES_ARE_ON'), 'FLASH_STATUS' => $this->user->lang('FLASH_IS_ON'), 'URL_STATUS' => $this->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, 'U_BACK' => $this->u_action));
     // Build custom bbcodes array
     include_once $this->root_path . 'includes/functions_display.' . $this->php_ext;
     display_custom_bbcodes();
 }
开发者ID:R3gi,项目名称:pages,代码行数:92,代码来源:admin_controller.php

示例14: main


//.........这里部分代码省略.........
									ORDER BY left_id ASC';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $url = $this->u_action . "&amp;id={$row['id']}";
                    $template->assign_block_vars('cat', array('NAME' => $row['name'], 'ID' => $row['id'], 'EDIT_CAT' => $this->u_action . '&amp;action=editcat&amp;id=' . $row['id'], 'PURGE_CAT' => $this->u_action . '&amp;action=purgecat&amp;id=' . $row['id'], 'DELETE_PARENT_CAT' => $this->u_action . '&amp;action=deletecat&amp;id=' . $row['id'] . '&amp;delete_parent=1', 'DELETE_CAT' => $this->u_action . '&amp;action=deletecat&amp;id=' . $row['id'] . '&amp;delete_cat=' . $delete_cat, 'U_MOVE_UP' => $url . '&amp;action=move_up', 'U_MOVE_DOWN' => $url . '&amp;action=move_down', 'PARENT' => $row['parent'], 'PARENT_ID' => $row['parent_id'], 'PARENT_CAT' => get_category_parent($row['parent_id'])));
                }
                $template->assign_vars(array('U_NEW_CAT' => $this->u_action . '&amp;action=newcat'));
                break;
            case 'rules':
                $this->page_title = 'ACP_CLASSIFIEDS_RULES_TITLE';
                $this->tpl_name = 'acp_classifieds_rules';
                $user->add_lang('posting');
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                include $phpbb_root_path . 'includes/message_parser.' . $phpEx;
                $rules = request_var('rules', '');
                $template->assign_vars(array('RULES' => $rules, 'GENERAL_RULES' => append_sid($this->u_action, "rules=general"), 'BUYER_RULES' => append_sid($this->u_action, "rules=buyer"), 'SELLER_RULES' => append_sid($this->u_action, "rules=seller")));
                if (!empty($rules)) {
                    if ($rules == 'general') {
                        $id = 1;
                    } elseif ($rules == 'buyer') {
                        $id = 2;
                    } elseif ($rules == 'seller') {
                        $id = 3;
                    }
                    // select rules data
                    $sql = 'SELECT *
                    FROM ' . CLASSIFIEDS_RULES_TABLE . '
                      WHERE rules_id = ' . $id . '
										    ORDER BY rules_id ASC';
                    $result = $db->sql_query($sql);
                    $row = $db->sql_fetchrow($result);
                    $template->assign_vars(array('RULES_ID' => $row['rules_id'], 'RULES_TITLE' => $row['rules_title'], 'RULES_TEXT' => $row['rules_text'], 'DISPLAY_RULES' => $row['display_rules'], 'MUST_AGREE' => $row['must_agree'], 'DISPLAY_AS_LINK' => $row['display_as_link'], 'L_ACP_CLASSIFIEDS_RULES' => $user->lang('ACP_CLASSIFIEDS_RULES' . $id), 'L_RULES_TITLE' => $user->lang('RULES_TITLE' . $id), 'L_RULES_DISPLAY' => $user->lang('RULES_DISPLAY' . $id), 'L_MUST_AGREE' => $user->lang('MUST_AGREE' . $id), 'L_MUST_AGREE_EXPLAIN' => $user->lang('MUST_AGREE_EXPLAIN' . $id), 'L_DISPLAY_AS_LINK' => $user->lang('DISPLAY_AS_LINK' . $id), 'L_DISPLAY_AS_LINK_EXPLAIN' => $user->lang('DISPLAY_AS_LINK_EXPLAIN' . $id)));
                    $db->sql_freeresult($result);
                    display_custom_bbcodes();
                    $submit = isset($_POST['submit']) ? true : false;
                    $preview = isset($_POST['preview']) ? true : false;
                    if ($submit) {
                        $rules_id = request_var('rules_id', 0);
                        $rules_title = utf8_normalize_nfc(request_var('rules_title', '', true));
                        $display_rules = request_var('display_rules', 0);
                        $must_agree = request_var('must_agree', 0);
                        $rules_text = utf8_normalize_nfc(request_var('rules_text', '', true));
                        $display_as_link = request_var('display_as_link', 0);
                        $sql_ary = array('rules_id' => $rules_id, 'rules_title' => $rules_title, 'display_rules' => $display_rules, 'must_agree' => $must_agree, 'rules_text' => $rules_text, 'display_as_link' => $display_as_link);
                        $sql = 'UPDATE ' . CLASSIFIEDS_RULES_TABLE . '
											SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
											WHERE rules_id = ' . $rules_id;
                        $db->sql_query($sql);
                        trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action . '&amp;rules=' . $rules));
                    }
                    if ($preview == true) {
                        $rules_text = utf8_normalize_nfc(request_var('rules_text', '', true));
                        $rules_text2 = $rules_text;
                        $uid = $bitfield = $options = '';
                        $allow_bbcode = $allow_smilies = $allow_urls = true;
                        generate_text_for_storage($rules_text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
                        $preview_text = generate_text_for_display($rules_text, $uid, $bitfield, $options);
                        $template->assign_vars(array('RULES_TEXT' => $rules_text2));
                    }
                    $template->assign_vars(array('U_ACTION' => $this->u_action . '&amp;rules=' . $rules, 'S_BBCODE_ALLOWED' => true, 'S_BBCODE_QUOTE' => true, 'S_BBCODE_IMG' => true, 'S_LINKS_ALLOWED' => true, 'S_BBCODE_FLASH' => false, 'PREVIEW_TEXT' => $preview ? $preview_text : '', 'S_PREVIEW' => $preview));
                }
                break;
            case 'prefixes':
                $this->page_title = 'ACP_CLASSIFIEDS_PREFIXES_TITLE';
                $this->tpl_name = 'acp_classifieds_prefixes';
                $action = request_var('action', '');
开发者ID:RU-RELEASE,项目名称:phpBB-Classifieds-MOD,代码行数:67,代码来源:acp_classifieds.php

示例15: assign_bbcodes_smilies

 /**
  * Assigns BBCodes and smilies to the template
  */
 protected function assign_bbcodes_smilies()
 {
     // Display custom bbcodes
     if ($this->config['allow_bbcode'] && $this->auth->acl_get('u_mchat_bbcode')) {
         $default_bbcodes = array('B', 'I', 'U', 'QUOTE', 'CODE', 'LIST', 'IMG', 'URL', 'SIZE', 'COLOR', 'EMAIL', 'FLASH');
         // Let's remove the default bbcodes
         $disallowed_bbcode_array = explode('|', strtoupper($this->config['mchat_bbcode_disallowed']));
         foreach ($default_bbcodes as $default_bbcode) {
             if (!in_array($default_bbcode, $disallowed_bbcode_array)) {
                 $this->template->assign_vars(array('S_MCHAT_BBCODE_' . $default_bbcode => true));
             }
         }
         if (!function_exists('display_custom_bbcodes')) {
             include $this->root_path . 'includes/functions_display.' . $this->php_ext;
         }
         display_custom_bbcodes();
     }
     // Smile row
     if ($this->config['allow_smilies'] && $this->auth->acl_get('u_mchat_smilies')) {
         if (!function_exists('generate_smilies')) {
             include $this->root_path . 'includes/functions_posting.' . $this->php_ext;
         }
         generate_smilies('inline', 0);
     }
 }
开发者ID:EntropyRy,项目名称:mChat-Extension,代码行数:28,代码来源:mchat.php


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