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

PHP generate_text_for_edit函数代码示例

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

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



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

示例1: compare_versions

    public function compare_versions($article, $from, $to)
    {
        if ($from == 0 || $to == 0) {
            trigger_error('NO_VERSIONS_SELECTED');
        }
        require $this->phpbb_root_path . 'includes/diff/diff.' . $this->php_ext;
        require $this->phpbb_root_path . 'includes/diff/engine.' . $this->php_ext;
        require $this->phpbb_root_path . 'includes/diff/renderer.' . $this->php_ext;
        $sql = 'SELECT article_text, bbcode_uid, bbcode_bitfield, article_sources, article_description
			FROM ' . $this->article_table . '
			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, article_sources, article_description
			FROM ' . $this->article_table . '
			WHERE article_id = ' . (int) $to;
        $result = $this->db->sql_query($sql);
        $to_row = $this->db->sql_fetchrow($result);
        $from_article = generate_text_for_edit($from_row['article_text'], $from_row['bbcode_uid'], $from_row['bbcode_bitfield'], 3, true);
        $to_article = generate_text_for_edit($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));
        $article_diff = new \diff($from_article['text'], $to_article['text']);
        $article_diff_empty = $article_diff->is_empty();
        $sources_diff = new \diff($from_row['article_sources'], $to_row['article_sources']);
        $sources_diff_empty = $sources_diff->is_empty();
        $description_diff = new \diff($from_row['article_description'], $to_row['article_description']);
        $descriptiondiff_empty = $sources_diff->is_empty();
        $renderer = new \diff_renderer_inline();
        $this->template->assign_vars(array('HEADLINE' => sprintf($this->user->lang['VERSION_COMPARE_HEADLINE'], $from, $to, $u_from, $u_to), 'DIFF' => $article_diff_empty ? '' : $renderer->get_diff_content($article_diff), 'DIFF_SOURCE' => $sources_diff_empty ? '' : $renderer->get_diff_content($sources_diff), 'DIFF_DESCRIPTION' => $descriptiondiff_empty ? '' : $renderer->get_diff_content($description_diff)));
        return $this->helper->render('article_compare.html', $this->user->lang['VERSIONS_OF_ARTICLE']);
    }
开发者ID:tas2580,项目名称:wiki,代码行数:32,代码来源:compare.php


示例2: main

 public function main($id, $mode)
 {
     global $config, $user, $template, $request;
     $user->add_lang_ext('rinsrans/textbox', 'common');
     $this->tpl_name = 'acp_textbox_body';
     $this->page_title = $user->lang('ACP_TEXTBOX_TITLE');
     add_form_key('acp_textbox');
     // Form is submitted
     if ($request->is_set_post('submit')) {
         if (!check_form_key('acp_textbox')) {
             trigger_error($user->lang('FORM_INVALID') . adm_back_link($this->u_action), E_USER_WARNING);
         }
         // Set the new settings to config
         $uid = $bitfield = $options = '';
         $textbox_content = $request->variable('textbox_content', '', true);
         generate_text_for_storage($textbox_content, $uid, $bitfield, $options, true, true, true);
         $config->set('textbox_content', $textbox_content);
         $config->set('textbox_bbcode_uid', $uid);
         $config->set('textbox_bbcode_bitfield', $bitfield);
         trigger_error($user->lang('ACP_TEXTBOX_SAVED') . adm_back_link($this->u_action));
     }
     $textbox_content = generate_text_for_edit($config['textbox_content'], $config['textbox_bbcode_uid'], 3);
     // Send the curent settings to template
     $template->assign_vars(array('U_ACTION' => $this->u_action, 'TEXTBOX_CONTENT' => $textbox_content['text']));
 }
开发者ID:rinsrans,项目名称:phpBB-textbox,代码行数:25,代码来源:textbox_module.php


示例3: test_text_formatter

 /**
  * @dataProvider get_text_formatter_tests
  */
 public function test_text_formatter($original, $expected)
 {
     global $phpbb_dispatcher;
     $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
     $this->get_test_case_helpers()->set_s9e_services();
     $return = generate_text_for_edit($original, '', 0);
     $this->assertSame($expected, $return['text']);
 }
开发者ID:phpbb,项目名称:phpbb,代码行数:11,代码来源:generate_text_for_edit_test.php


示例4: 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


示例5: edit_album

    function edit_album()
    {
        global $config, $cache, $db, $template, $user, $phpbb_ext_gallery, $phpbb_ext_gallery_core_album, $phpbb_ext_gallery_core_auth, $albums_table, $phpbb_ext_gallery_core_album_display;
        global $request;
        $phpbb_ext_gallery->url->_include(array('bbcode', 'message_parser'), 'phpbb');
        $album_id = $request->variable('album_id', 0);
        $phpbb_ext_gallery_core_album->check_user($album_id);
        $submit = isset($_POST['submit']) ? true : false;
        $redirect = $request->variable('redirect', '');
        if (!$submit) {
            $album_data = $phpbb_ext_gallery_core_album->get_info($album_id);
            $album_desc_data = generate_text_for_edit($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_options']);
            // Make sure no direct child forums are able to be selected as parents.
            $exclude_albums = array($album_id);
            foreach ($phpbb_ext_gallery_core_album_display->get_branch($album_data['album_user_id'], $album_id, 'children') as $row) {
                $exclude_albums[] = (int) $row['album_id'];
            }
            $parents_list = $phpbb_ext_gallery_core_album->get_albumbox(false, '', $album_data['parent_id'], false, $exclude_albums, $user->data['user_id']);
            $s_access_options = '';
            if ($phpbb_ext_gallery->auth->acl_check('a_restrict', $phpbb_ext_gallery_core_auth::OWN_ALBUM) && $album_data['parent_id']) {
                $access_options = array($phpbb_ext_gallery_core_auth::ACCESS_ALL => 'ALL', $phpbb_ext_gallery_core_auth::ACCESS_REGISTERED => 'REGISTERED', $phpbb_ext_gallery_core_auth::ACCESS_NOT_FOES => 'NOT_FOES', $phpbb_ext_gallery_core_auth::ACCESS_FRIENDS => 'FRIENDS');
                if (isset($config['zebra_enhance_version'])) {
                    $access_options[$phpbb_ext_gallery_core_auth::ACCESS_SPECIAL_FRIENDS] = 'SPECIAL_FRIENDS';
                }
                foreach ($access_options as $value => $lang_key) {
                    $s_access_options .= '<option value="' . $value . ($value == $album_data['album_auth_access'] ? '" selected="selected' : '') . '">' . $user->lang['ACCESS_CONTROL_' . $lang_key] . '</option>';
                }
            }
            $template->assign_vars(array('S_EDIT_SUBALBUM' => true, 'S_PERSONAL_ALBUM' => $album_id == $phpbb_ext_gallery->user->get_data('personal_album_id') ? true : false, 'S_AUTH_ACCESS_OPTIONS' => $s_access_options, 'L_ALBUM_ACCESS_EXPLAIN' => $user->lang('ALBUM_ACCESS_EXPLAIN', '<a href="' . $phpbb_ext_gallery->url->append_sid('phpbb', 'faq') . '#f6r0">', '</a>'), 'L_TITLE' => $user->lang['EDIT_SUBALBUM'], 'L_TITLE_EXPLAIN' => $user->lang['EDIT_SUBALBUM_EXP'], 'S_ALBUM_ACTION' => $this->u_action . '&amp;action=edit&amp;album_id=' . $album_id . ($redirect != '' ? '&amp;redirect=album' : ''), 'S_PARENT_OPTIONS' => '<option value="' . $phpbb_ext_gallery->user->get_data('personal_album_id') . '">' . $user->lang['NO_PARENT_ALBUM'] . '</option>' . $parents_list, 'ALBUM_NAME' => $album_data['album_name'], 'ALBUM_DESC' => $album_desc_data['text'], 'ALBUM_TYPE' => $album_data['album_type'], 'S_DESC_BBCODE_CHECKED' => $album_desc_data['allow_bbcode'] ? true : false, 'S_DESC_SMILIES_CHECKED' => $album_desc_data['allow_smilies'] ? true : false, 'S_DESC_URLS_CHECKED' => $album_desc_data['allow_urls'] ? true : false, 'S_MODE' => 'edit'));
        } else {
            // Is it salty ?
            if (!check_form_key('ucp_gallery')) {
                trigger_error('FORM_INVALID');
            }
            $album_data = array('album_name' => $album_id == $phpbb_ext_gallery->user->get_data('personal_album_id') ? $user->data['username'] : $request->variable('album_name', '', true), 'parent_id' => $request->variable('parent_id', $album_id == $phpbb_ext_gallery->user->get_data('personal_album_id') ? 0 : $phpbb_ext_gallery->user->get_data('personal_album_id')), 'album_parents' => '', 'album_type' => $phpbb_ext_gallery_core_album::TYPE_UPLOAD, 'album_desc_options' => 7, 'album_desc' => utf8_normalize_nfc($request->variable('album_desc', '', true)), 'album_auth_access' => $phpbb_ext_gallery->auth->acl_check('a_restrict', $phpbb_ext_gallery_core_auth::OWN_ALBUM) ? $request->variable('album_auth_access', 0) : 0);
            generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], $request->variable('desc_parse_bbcode', false), $request->variable('desc_parse_urls', false), $request->variable('desc_parse_smilies', false));
            $row = $phpbb_ext_gallery_core_album->get_info($album_id);
            if (!$row['parent_id']) {
                // do not allow to restrict access on the base-album
                $album_data['album_auth_access'] = 0;
            }
            // Ensure that no child is selected as parent
            $exclude_albums = array($album_id);
            foreach ($phpbb_ext_gallery_core_album_display->get_branch($row['album_user_id'], $album_id, 'children') as $loop) {
                $exclude_albums[] = (int) $loop['album_id'];
            }
            if (in_array($album_data['parent_id'], $exclude_albums)) {
                $album_data['parent_id'] = (int) $row['parent_id'];
            }
            // If the parent is different, the left_id and right_id have changed.
            if ($row['parent_id'] != $album_data['parent_id']) {
                if ($album_data['parent_id']) {
                    // Get the parent album now, so it throws an error when it does not exist, before we change the database.
                    $parent = $phpbb_ext_gallery_core_album->get_info($album_data['parent_id']);
                }
                // How many do we have to move and how far.
                $moving_ids = $row['right_id'] - $row['left_id'] + 1;
                $sql = 'SELECT MAX(right_id) right_id
					FROM ' . $albums_table . '
					WHERE album_user_id = ' . $row['album_user_id'];
                $result = $db->sql_query($sql);
                $moving_distance = $db->sql_fetchfield('right_id') - $row['left_id'] + 1;
                $db->sql_freeresult($result);
                $stop_updating = $moving_distance + $row['left_id'];
                // Update the moving albums... move them to the end.
                $sql = 'UPDATE ' . $albums_table . '
					SET right_id = right_id + ' . $moving_distance . ',
						left_id = left_id + ' . $moving_distance . '
					WHERE album_user_id = ' . $row['album_user_id'] . '
						AND left_id >= ' . $row['left_id'] . '
						AND right_id <= ' . $row['right_id'];
                $db->sql_query($sql);
                $new['left_id'] = $row['left_id'] + $moving_distance;
                $new['right_id'] = $row['right_id'] + $moving_distance;
                // Close the gap, we produced through moving.
                if ($album_data['parent_id'] == 0) {
                    $sql = 'UPDATE ' . $albums_table . '
						SET left_id = left_id - ' . $moving_ids . '
						WHERE album_user_id = ' . $row['album_user_id'] . '
							AND left_id >= ' . $row['left_id'];
                    $db->sql_query($sql);
                    $sql = 'UPDATE ' . $albums_table . '
						SET right_id = right_id - ' . $moving_ids . '
						WHERE album_user_id = ' . $row['album_user_id'] . '
							AND right_id >= ' . $row['left_id'];
                    $db->sql_query($sql);
                } else {
                    $sql = 'UPDATE ' . $albums_table . '
						SET left_id = left_id - ' . $moving_ids . '
						WHERE album_user_id = ' . $row['album_user_id'] . '
							AND left_id >= ' . $row['left_id'] . '
							AND right_id <= ' . $stop_updating;
                    $db->sql_query($sql);
                    $sql = 'UPDATE ' . $albums_table . '
						SET right_id = right_id - ' . $moving_ids . '
						WHERE album_user_id = ' . $row['album_user_id'] . '
							AND right_id >= ' . $row['left_id'] . '
							AND right_id <= ' . $stop_updating;
                    $db->sql_query($sql);
                    $sql = 'UPDATE ' . $albums_table . '
//.........这里部分代码省略.........
开发者ID:vodis,项目名称:phpbbgallery,代码行数:101,代码来源:main_module.php


示例6: main


//.........这里部分代码省略.........
                    for ($i = 1; $i < 32; $i++) {
                        $selected = $i == $data['bday_day'] ? ' selected="selected"' : '';
                        $s_birthday_day_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
                    }
                    $s_birthday_month_options = '<option value="0"' . (!$data['bday_month'] ? ' selected="selected"' : '') . '>--</option>';
                    for ($i = 1; $i < 13; $i++) {
                        $selected = $i == $data['bday_month'] ? ' selected="selected"' : '';
                        $s_birthday_month_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
                    }
                    $s_birthday_year_options = '';
                    $now = getdate();
                    $s_birthday_year_options = '<option value="0"' . (!$data['bday_year'] ? ' selected="selected"' : '') . '>--</option>';
                    for ($i = $now['year'] - 100; $i <= $now['year']; $i++) {
                        $selected = $i == $data['bday_year'] ? ' selected="selected"' : '';
                        $s_birthday_year_options .= "<option value=\"{$i}\"{$selected}>{$i}</option>";
                    }
                    unset($now);
                    $template->assign_vars(array('S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, 'S_BIRTHDAYS_ENABLED' => true));
                }
                $template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'S_JABBER_ENABLED' => $config['jab_enable'], 'JABBER' => $data['jabber']));
                // Get additional profile fields and assign them to the template block var 'profile_fields'
                $user->get_profile_fields($user->data['user_id']);
                $cp->generate_profile_fields('profile', $user->get_iso_lang_id());
                break;
            case 'signature':
                if (!$auth->acl_get('u_sig')) {
                    trigger_error('NO_AUTH_SIGNATURE');
                }
                include $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
                include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
                $enable_bbcode = $config['allow_sig_bbcode'] ? $user->optionget('sig_bbcode') : false;
                $enable_smilies = $config['allow_sig_smilies'] ? $user->optionget('sig_smilies') : false;
                $enable_urls = $config['allow_sig_links'] ? $user->optionget('sig_links') : false;
                $decoded_message = generate_text_for_edit($user->data['user_sig'], $user->data['user_sig_bbcode_uid'], $user->data['user_sig_bbcode_bitfield']);
                $signature = $request->variable('signature', $decoded_message['text'], true);
                $signature_preview = '';
                if ($submit || $request->is_set_post('preview')) {
                    $enable_bbcode = $config['allow_sig_bbcode'] ? !$request->variable('disable_bbcode', false) : false;
                    $enable_smilies = $config['allow_sig_smilies'] ? !$request->variable('disable_smilies', false) : false;
                    $enable_urls = $config['allow_sig_links'] ? !$request->variable('disable_magic_url', false) : false;
                    if (!check_form_key('ucp_sig')) {
                        $error[] = 'FORM_INVALID';
                    }
                }
                $bbcode_uid = $bbcode_bitfield = $bbcode_flags = '';
                $warn_msg = generate_text_for_storage($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags, $enable_bbcode, $enable_urls, $enable_smilies);
                if (sizeof($warn_msg)) {
                    $error += $warn_msg;
                }
                if (!$submit) {
                    // Parse it for displaying
                    $signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags);
                } else {
                    if (!sizeof($error)) {
                        $user->optionset('sig_bbcode', $enable_bbcode);
                        $user->optionset('sig_smilies', $enable_smilies);
                        $user->optionset('sig_links', $enable_urls);
                        $sql_ary = array('user_sig' => $signature, 'user_options' => $user->data['user_options'], 'user_sig_bbcode_uid' => $bbcode_uid, 'user_sig_bbcode_bitfield' => $bbcode_bitfield);
                        $sql = 'UPDATE ' . USERS_TABLE . '
							SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
							WHERE user_id = ' . $user->data['user_id'];
                        $db->sql_query($sql);
                        $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
                        trigger_error($message);
                    }
                }
开发者ID:hgchen,项目名称:phpbb,代码行数:67,代码来源:ucp_profile.php


示例7: convert_data

    /**
     * Load the contents of the old tables into the database
     */
    function convert_data($mode, $sub)
    {
        global $db, $gallery_config, $template, $user, $phpbb_root_path, $phpEx;
        function decode_ip($int_ip)
        {
            $hexipbang = explode('.', chunk_split($int_ip, 2, '.'));
            $phpbb3_ip = hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]);
            return $phpbb3_ip;
        }
        $this->page_title = $user->lang['STAGE_IN_PROGRESS'];
        $convert_prefix = request_var('convert_prefix', '');
        $step = request_var('step', 0);
        $next_update_url = $body = '';
        switch ($step) {
            case 0:
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT *
					FROM ' . $convert_prefix . 'album_rate
					ORDER BY rate_pic_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $ary = array('rate_image_id' => $row['rate_pic_id'], 'rate_user_id' => $row['rate_user_id'] < 0 ? ANONYMOUS : $row['rate_user_id'], 'rate_user_ip' => decode_ip($row['rate_user_ip']), 'rate_point' => $row['rate_point']);
                    $batch_ary[$current_batch][] = $ary;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_RATES_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_RATES'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=1");
                break;
            case 1:
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT c.*, u.user_colour
					FROM ' . $convert_prefix . 'album_comment c
					LEFT JOIN ' . USERS_TABLE . ' u
						ON c.comment_user_id = u.user_id
					ORDER BY c.comment_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $row['comment_uid'] = $row['comment_options'] = $row['comment_bitfield'] = '';
                    $row['comment'] = $row['comment_text'];
                    $comment_text_data = generate_text_for_edit($row['comment'], $row['comment_uid'], $row['comment_options']);
                    $comment_data = array('comment_id' => $row['comment_id'], 'comment_image_id' => $row['comment_pic_id'], 'comment_user_id' => $row['comment_user_id'] < 0 ? ANONYMOUS : $row['comment_user_id'], 'comment_username' => $row['comment_username'], 'comment_user_colour' => isset($row['user_colour']) ? $row['user_colour'] : '', 'comment_user_ip' => decode_ip($row['comment_user_ip']), 'comment_time' => $row['comment_time'], 'comment' => $comment_text_data['text'], 'comment_uid' => '', 'comment_bitfield' => '', 'comment_options' => 7, 'comment_edit_time' => isset($row['comment_edit_time']) ? $row['comment_edit_time'] : 0, 'comment_edit_count' => isset($row['comment_edit_count']) ? $row['comment_edit_count'] : 0, 'comment_edit_user_id' => isset($row['comment_edit_user_id']) ? $row['comment_edit_user_id'] < 0 ? ANONYMOUS : $row['comment_edit_user_id'] : 0);
                    generate_text_for_storage($comment_data['comment'], $comment_data['comment_uid'], $comment_data['comment_bitfield'], $comment_data['comment_options'], 1, 1, 1);
                    unset($comment_data['comment_options']);
                    $batch_ary[$current_batch][] = $comment_data;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_COMMENTS_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_COMMENTS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;convert_prefix={$convert_prefix}&amp;step=2");
                break;
            case 2:
                $personal_albums = '0';
                $left_id = 1;
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT *
					FROM ' . $convert_prefix . 'album_cat
					ORDER BY cat_order';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $row['cat_user_id'] = isset($row['cat_user_id']) ? $row['cat_user_id'] : 0;
                    if ($row['cat_user_id'] != 0) {
                        $personal_albums .= '_' . $row['cat_id'];
                    } else {
                        $row['album_desc_uid'] = $row['album_desc_options'] = $row['album_desc_bitfield'] = '';
                        $row['album_desc'] = $row['cat_desc'];
                        $album_desc_data = generate_text_for_edit($row['album_desc'], $row['album_desc_uid'], $row['album_desc_options']);
                        $album_data = array('album_id' => $row['cat_id'], 'album_name' => $row['cat_title'], 'parent_id' => 0, 'left_id' => $left_id, 'right_id' => $left_id + 1, 'album_parents' => '', 'album_type' => ALBUM_CAT, 'album_status' => ITEM_UNLOCKED, 'album_desc' => $album_desc_data['text'], 'album_desc_uid' => '', 'album_desc_bitfield' => '', 'album_desc_options' => 7);
                        generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], true, true, true);
                        $left_id = $left_id + 2;
                        $batch_ary[$current_batch][] = $album_data;
                        $current_batch_size++;
                        if ($current_batch_size = $this->batch_size) {
                            $current_batch_size = 1;
                            $current_batch++;
                        }
                    }
//.........这里部分代码省略.........
开发者ID:phpbbgallery,项目名称:phpbb-gallery,代码行数:101,代码来源:install_convert.php


示例8: main


//.........这里部分代码省略.........
                                }
                            }
                            if (!check_form_key('ucp_groups')) {
                                $error[] = $user->lang['FORM_INVALID'];
                            }
                            if (!sizeof($error)) {
                                // Only set the rank, colour, etc. if it's changed or if we're adding a new
                                // group. This prevents existing group members being updated if no changes
                                // were made.
                                $group_attributes = array();
                                $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients');
                                foreach ($test_variables as $test) {
                                    if ($action == 'add' || isset($submit_ary[$test]) && $group_row['group_' . $test] != $submit_ary[$test]) {
                                        $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
                                    }
                                }
                                if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) {
                                    $cache->destroy('sql', GROUPS_TABLE);
                                    $message = $action == 'edit' ? 'GROUP_UPDATED' : 'GROUP_CREATED';
                                    trigger_error($user->lang[$message] . $return_page);
                                }
                            }
                            if (sizeof($error)) {
                                $group_rank = $submit_ary['rank'];
                                $group_desc_data = array('text' => $group_desc, 'allow_bbcode' => $allow_desc_bbcode, 'allow_smilies' => $allow_desc_smilies, 'allow_urls' => $allow_desc_urls);
                            }
                        } else {
                            if (!$group_id) {
                                $group_name = utf8_normalize_nfc(request_var('group_name', '', true));
                                $group_desc_data = array('text' => '', 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
                                $group_rank = 0;
                                $group_type = GROUP_OPEN;
                            } else {
                                $group_desc_data = generate_text_for_edit($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_options']);
                                $group_rank = $group_row['group_rank'];
                            }
                        }
                        $sql = 'SELECT *
							FROM ' . RANKS_TABLE . '
							WHERE rank_special = 1
							ORDER BY rank_title';
                        $result = $db->sql_query($sql);
                        $rank_options = '<option value="0"' . (!$group_rank ? ' selected="selected"' : '') . '>' . $user->lang['USER_DEFAULT'] . '</option>';
                        while ($row = $db->sql_fetchrow($result)) {
                            $selected = $group_rank && $row['rank_id'] == $group_rank ? ' selected="selected"' : '';
                            $rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>';
                        }
                        $db->sql_freeresult($result);
                        $type_free = $group_type == GROUP_FREE ? ' checked="checked"' : '';
                        $type_open = $group_type == GROUP_OPEN ? ' checked="checked"' : '';
                        $type_closed = $group_type == GROUP_CLOSED ? ' checked="checked"' : '';
                        $type_hidden = $group_type == GROUP_HIDDEN ? ' checked="checked"' : '';
                        $display_gallery = isset($_POST['display_gallery']) ? true : false;
                        if ($config['allow_avatar_local'] && $display_gallery) {
                            avatar_gallery($category, $avatar_select, 4);
                        }
                        $avatars_enabled = $can_upload || ($config['allow_avatar_local'] || $config['allow_avatar_remote']) ? true : false;
                        $template->assign_vars(array('S_EDIT' => true, 'S_INCLUDE_SWATCH' => true, 'S_CAN_UPLOAD' => $can_upload, 'S_FORM_ENCTYPE' => $can_upload ? ' enctype="multipart/form-data"' : '', 'S_ERROR' => sizeof($error) ? true : false, 'S_SPECIAL_GROUP' => $group_type == GROUP_SPECIAL ? true : false, 'S_AVATARS_ENABLED' => $avatars_enabled, 'S_DISPLAY_GALLERY' => $config['allow_avatar_local'] && !$display_gallery ? true : false, 'S_IN_GALLERY' => $config['allow_avatar_local'] && $display_gallery ? true : false, 'ERROR_MSG' => sizeof($error) ? implode('<br />', $error) : '', 'GROUP_RECEIVE_PM' => isset($group_row['group_receive_pm']) && $group_row['group_receive_pm'] ? ' checked="checked"' : '', 'GROUP_MESSAGE_LIMIT' => isset($group_row['group_message_limit']) ? $group_row['group_message_limit'] : 0, 'GROUP_MAX_RECIPIENTS' => isset($group_row['group_max_recipients']) ? $group_row['group_max_recipients'] : 0, 'GROUP_DESC' => $group_desc_data['text'], 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], 'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'], 'S_DESC_SMILIES_CHECKED' => $group_desc_data['allow_smilies'], 'S_RANK_OPTIONS' => $rank_options, 'AVATAR_MAX_FILESIZE' => $config['avatar_filesize'], 'GROUP_TYPE_FREE' => GROUP_FREE, 'GROUP_TYPE_OPEN' => GROUP_OPEN, 'GROUP_TYPE_CLOSED' => GROUP_CLOSED, 'GROUP_TYPE_HIDDEN' => GROUP_HIDDEN, 'GROUP_TYPE_SPECIAL' => GROUP_SPECIAL, 'GROUP_FREE' => $type_free, 'GROUP_OPEN' => $type_open, 'GROUP_CLOSED' => $type_closed, 'GROUP_HIDDEN' => $type_hidden, 'U_SWATCH' => append_sid("{$phpbb_root_path}adm/swatch.{$phpEx}", 'form=ucp&amp;name=group_colour'), 'S_UCP_ACTION' => $this->u_action . "&amp;action={$action}&amp;g={$group_id}", 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024)));
                        break;
                    case 'list':
                        if (!$group_id) {
                            trigger_error($user->lang['NO_GROUP'] . $return_page);
                        }
                        if (!($row = group_memberships($group_id, $user->data['user_id']))) {
                            trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page);
                        }
开发者ID:html,项目名称:PI,代码行数:67,代码来源:ucp_groups.php


示例9: reparse_record

 /**
  * Reparse given record
  *
  * @param array $record Associative array containing the record's data
  */
 protected function reparse_record(array $record)
 {
     $record = $this->add_missing_fields($record);
     $flags = $record['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0;
     $flags |= $record['enable_smilies'] ? OPTION_FLAG_SMILIES : 0;
     $flags |= $record['enable_magic_url'] ? OPTION_FLAG_LINKS : 0;
     $unparsed = array_merge($record, generate_text_for_edit($record['text'], $record['bbcode_uid'], $flags));
     // generate_text_for_edit() and decode_message() actually return the text as HTML. It has to
     // be decoded to plain text before it can be reparsed
     $text = html_entity_decode($unparsed['text'], ENT_QUOTES, 'UTF-8');
     $bitfield = $flags = null;
     generate_text_for_storage($text, $unparsed['bbcode_uid'], $bitfield, $flags, $unparsed['enable_bbcode'], $unparsed['enable_magic_url'], $unparsed['enable_smilies'], $unparsed['enable_img_bbcode'], $unparsed['enable_flash_bbcode'], $unparsed['enable_quote_bbcode'], $unparsed['enable_url_bbcode'], 'reparse');
     // Save the new text if it has changed and it's not a dry run
     if ($text !== $record['text'] && $this->save_changes) {
         $record['text'] = $text;
         $this->save_record($record);
     }
 }
开发者ID:phpbb,项目名称:phpbb-core,代码行数:23,代码来源:base.php


示例10: convert_data

    /**
     * Load the contents of the old tables into the database
     */
    function convert_data($mode, $sub)
    {
        global $db, $gallery_config, $table_prefix, $template, $user, $phpbb_root_path, $phpEx;
        $this->page_title = $user->lang['STAGE_IN_PROGRESS'];
        $step = request_var('step', 0);
        $next_update_url = $body = '';
        switch ($step) {
            case 0:
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = 'SELECT *
					FROM ' . $table_prefix . 'gallery_rate
					ORDER BY rate_pic_id';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $ary = array('rate_image_id' => $row['rate_pic_id'], 'rate_user_id' => $row['rate_user_id'], 'rate_user_ip' => $row['rate_user_ip'], 'rate_point' => $row['rate_point']);
                    $batch_ary[$current_batch][] = $ary;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_RATES_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_RATES'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;step=1");
                break;
            case 1:
                $batch_ary = array();
                $current_batch = 1;
                $current_batch_size = 1;
                $sql = $db->sql_build_query('SELECT', array('SELECT' => 'c.*, u.user_colour', 'FROM' => array($table_prefix . 'gallery_comment' => 'c'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'c.comment_user_id = u.user_id')), 'ORDER_BY' => 'c.comment_id ASC'));
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $row['comment'] = $row['comment_text'];
                    $row['comment_bbcode_options'] = 7;
                    $comment_text_data = generate_text_for_edit($row['comment'], $row['comment_bbcode_uid'], $row['comment_bbcode_options']);
                    $comment_data = array('comment_id' => $row['comment_id'], 'comment_image_id' => $row['comment_pic_id'], 'comment_user_id' => $row['comment_user_id'], 'comment_username' => $row['comment_username'], 'comment_user_colour' => isset($row['user_colour']) ? $row['user_colour'] : '', 'comment_user_ip' => $row['comment_user_ip'], 'comment_time' => $row['comment_time'], 'comment' => $comment_text_data['text'], 'comment_uid' => '', 'comment_bitfield' => '', 'comment_options' => 7, 'comment_edit_time' => isset($row['comment_edit_time']) ? $row['comment_edit_time'] : 0, 'comment_edit_count' => isset($row['comment_edit_count']) ? $row['comment_edit_count'] : 0, 'comment_edit_user_id' => isset($row['comment_edit_user_id']) ? $row['comment_edit_user_id'] : 0);
                    generate_text_for_storage($comment_data['comment'], $comment_data['comment_uid'], $comment_data['comment_bitfield'], $comment_data['comment_options'], 1, 1, 1);
                    unset($comment_data['comment_options']);
                    $batch_ary[$current_batch][] = $comment_data;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_COMMENTS_TABLE, $ary);
                }
                $body = $user->lang['CONVERTED_COMMENTS'];
                $next_update_url = append_sid("{$phpbb_root_path}install/index.{$phpEx}", "mode={$mode}&amp;sub=in_progress&amp;step=2");
                break;
            case 2:
                $personal_albums = 0;
                $batch_ary = $batch2_ary = array();
                $current_batch = $current_batch2 = 1;
                $current_batch_size = $current_batch2_size = 1;
                $sql = 'SELECT *
					FROM ' . $table_prefix . 'gallery_copyts_albums';
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $row['album_desc_uid'] = $row['album_desc_options'] = $row['album_desc_bitfield'] = '';
                    $row['album_desc'] = $row['album_desc'];
                    $album_desc_data = generate_text_for_edit($row['album_desc'], $row['album_desc_uid'], $row['album_desc_options']);
                    $album_data = array('album_id' => $row['album_id'], 'album_name' => $row['album_name'], 'parent_id' => $row['parent_id'], 'left_id' => $row['left_id'], 'right_id' => $row['right_id'], 'album_parents' => '', 'album_type' => $row['album_user_id'] ? ALBUM_UPLOAD : ALBUM_CAT, 'album_status' => ITEM_UNLOCKED, 'album_desc' => $album_desc_data['text'], 'album_desc_uid' => '', 'album_desc_bitfield' => '', 'album_desc_options' => 7, 'album_user_id' => $row['album_user_id']);
                    generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], true, true, true);
                    $batch_ary[$current_batch][] = $album_data;
                    $current_batch_size++;
                    if ($current_batch_size = $this->batch_size) {
                        $current_batch_size = 1;
                        $current_batch++;
                    }
                    if ($row['left_id'] == 1 && $row['album_user_id']) {
                        $ary = array('user_id' => $row['album_user_id'], 'personal_album_id' => $row['album_id']);
                        $batch2_ary[$current_batch2][] = $ary;
                        $current_batch2_size++;
                        if ($current_batch2_size = $this->batch_size) {
                            $current_batch2_size = 1;
                            $current_batch2++;
                        }
                        $personal_albums++;
                    }
                }
                $db->sql_freeresult($result);
                foreach ($batch_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_ALBUMS_TABLE, $ary);
                }
                foreach ($batch2_ary as $batch => $ary) {
                    $db->sql_multi_insert(GALLERY_USERS_TABLE, $ary);
                }
                // Update the config for the statistic on the index
//.........这里部分代码省略.........
开发者ID:phpbbgallery,项目名称:phpbb-gallery,代码行数:101,代码来源:install_convert_ts.php


示例11: 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 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP generate_text_for_storage函数代码示例发布时间:2022-05-15
下一篇:
PHP generate_text_for_display函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap