本文整理汇总了PHP中create_control_richedit函数的典型用法代码示例。如果您正苦于以下问题:PHP create_control_richedit函数的具体用法?PHP create_control_richedit怎么用?PHP create_control_richedit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_control_richedit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kbPreview
function kbPreview($sub)
{
global $context, $smcFunc, $sourcedir;
require_once $sourcedir . '/Subs-Editor.php';
$context['title'] = isset($_REQUEST['title']) ? $smcFunc['htmlspecialchars']($_REQUEST['title']) : '';
$context['body'] = isset($_REQUEST['description']) ? str_replace(array(' '), array(' '), $smcFunc['htmlspecialchars']($_REQUEST['description'])) : '';
$editorOptions = array('id' => 'description', 'value' => !empty($context['body']) ? $context['body'] : '', 'width' => '90%');
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];
$context['sub_template'] = $sub;
}
示例2: ShowAnnouncements
function ShowAnnouncements()
{
global $context, $txt, $sourcedir, $ultimateportalSettings;
if (!isset($_POST['save'])) {
checkSession('get');
}
if (isset($_POST['save'])) {
checkSession('post');
$configUltimatePortalVar['up_news_global_announcement'] = censorText($_POST['up_news_global_announcement']);
updateUltimatePortalSettings($configUltimatePortalVar, 'config_up_news');
}
// Needed for the editor and message icons.
require_once $sourcedir . '/Subs-Editor.php';
// Now create the editor.
$editorOptions = array('id' => 'up_news_global_announcement', 'value' => $ultimateportalSettings['up_news_global_announcement'], 'form' => 'newsform');
create_control_richedit($editorOptions);
// Store the ID.
$context['post_box_name'] = $editorOptions['id'];
$context['sub_template'] = 'announcement';
$context['page_title'] = $txt['ultport_admin_news_title'] . ' - ' . $txt['ultport_admin_announcements_title'] . ' - ' . $txt['ultport_admin_module_title2'];
}
示例3: ComposeMailing
/**
* Shows a form to edit a forum mailing and its recipients.
* Called by ?action=admin;area=news;sa=mailingcompose.
* Requires the send_mail permission.
* Form is submitted to ?action=admin;area=news;sa=mailingsend.
*
* @uses ManageNews template, email_members_compose sub-template.
*/
function ComposeMailing()
{
global $txt, $sourcedir, $context, $smcFunc, $scripturl, $modSettings;
// Setup the template!
$context['page_title'] = $txt['admin_newsletters'];
$context['sub_template'] = 'email_members_compose';
$context['subject'] = !empty($_POST['subject']) ? $_POST['subject'] : htmlspecialchars($context['forum_name'] . ': ' . $txt['subject']);
$context['message'] = !empty($_POST['message']) ? $_POST['message'] : htmlspecialchars($txt['message'] . "\n\n" . $txt['regards_team'] . "\n\n" . '{$board_url}');
// Needed for the WYSIWYG editor.
require_once $sourcedir . '/Subs-Editor.php';
// Now create the editor.
$editorOptions = array('id' => 'message', 'value' => $context['message'], 'height' => '175px', 'width' => '100%', 'labels' => array('post_button' => $txt['sendtopic_send']), 'preview_type' => 2);
create_control_richedit($editorOptions);
// Store the ID for old compatibility.
$context['post_box_name'] = $editorOptions['id'];
if (isset($context['preview'])) {
require_once $sourcedir . '/Subs-Post.php';
$context['recipients']['members'] = !empty($_POST['members']) ? explode(',', $_POST['members']) : array();
$context['recipients']['exclude_members'] = !empty($_POST['exclude_members']) ? explode(',', $_POST['exclude_members']) : array();
$context['recipients']['groups'] = !empty($_POST['groups']) ? explode(',', $_POST['groups']) : array();
$context['recipients']['exclude_groups'] = !empty($_POST['exclude_groups']) ? explode(',', $_POST['exclude_groups']) : array();
$context['recipients']['emails'] = !empty($_POST['emails']) ? explode(';', $_POST['emails']) : array();
$context['email_force'] = !empty($_POST['email_force']) ? 1 : 0;
$context['total_emails'] = !empty($_POST['total_emails']) ? (int) $_POST['total_emails'] : 0;
$context['max_id_member'] = !empty($_POST['max_id_member']) ? (int) $_POST['max_id_member'] : 0;
$context['send_pm'] = !empty($_POST['send_pm']) ? 1 : 0;
$context['send_html'] = !empty($_POST['send_html']) ? '1' : '0';
return prepareMailingForPreview();
}
// Start by finding any members!
$toClean = array();
if (!empty($_POST['members'])) {
$toClean[] = 'members';
}
if (!empty($_POST['exclude_members'])) {
$toClean[] = 'exclude_members';
}
if (!empty($toClean)) {
require_once $sourcedir . '/Subs-Auth.php';
foreach ($toClean as $type) {
// Remove the quotes.
$_POST[$type] = strtr($_POST[$type], array('\\"' => '"'));
preg_match_all('~"([^"]+)"~', $_POST[$type], $matches);
$_POST[$type] = array_unique(array_merge($matches[1], explode(',', preg_replace('~"[^"]+"~', '', $_POST[$type]))));
foreach ($_POST[$type] as $index => $member) {
if (strlen(trim($member)) > 0) {
$_POST[$type][$index] = $smcFunc['htmlspecialchars']($smcFunc['strtolower'](trim($member)));
} else {
unset($_POST[$type][$index]);
}
}
// Find the members
$_POST[$type] = implode(',', array_keys(findMembers($_POST[$type])));
}
}
if (isset($_POST['member_list']) && is_array($_POST['member_list'])) {
$members = array();
foreach ($_POST['member_list'] as $member_id) {
$members[] = (int) $member_id;
}
$_POST['members'] = implode(',', $members);
}
if (isset($_POST['exclude_member_list']) && is_array($_POST['exclude_member_list'])) {
$members = array();
foreach ($_POST['exclude_member_list'] as $member_id) {
$members[] = (int) $member_id;
}
$_POST['exclude_members'] = implode(',', $members);
}
// Clean the other vars.
SendMailing(true);
// We need a couple strings from the email template file
loadLanguage('EmailTemplates');
// Get a list of all full banned users. Use their Username and email to find them. Only get the ones that can't login to turn off notification.
$request = $smcFunc['db_query']('', '
SELECT DISTINCT mem.id_member
FROM {db_prefix}ban_groups AS bg
INNER JOIN {db_prefix}ban_items AS bi ON (bg.id_ban_group = bi.id_ban_group)
INNER JOIN {db_prefix}members AS mem ON (bi.id_member = mem.id_member)
WHERE (bg.cannot_access = {int:cannot_access} OR bg.cannot_login = {int:cannot_login})
AND (bg.expire_time IS NULL OR bg.expire_time > {int:current_time})', array('cannot_access' => 1, 'cannot_login' => 1, 'current_time' => time()));
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$context['recipients']['exclude_members'][] = $row['id_member'];
}
$smcFunc['db_free_result']($request);
$request = $smcFunc['db_query']('', '
SELECT DISTINCT bi.email_address
FROM {db_prefix}ban_items AS bi
INNER JOIN {db_prefix}ban_groups AS bg ON (bg.id_ban_group = bi.id_ban_group)
WHERE (bg.cannot_access = {int:cannot_access} OR bg.cannot_login = {int:cannot_login})
AND (COALESCE(bg.expire_time, 1=1) OR bg.expire_time > {int:current_time})
AND bi.email_address != {string:blank_string}', array('cannot_access' => 1, 'cannot_login' => 1, 'current_time' => time(), 'blank_string' => ''));
//.........这里部分代码省略.........
示例4: messagePostError
/**
* An error in the message...
*
* @param $error_types
* @param $named_recipients
* @param $recipient_ids
*/
function messagePostError($error_types, $named_recipients, $recipient_ids = array())
{
global $txt, $context, $scripturl, $modSettings;
global $smcFunc, $user_info, $sourcedir;
if (!isset($_REQUEST['xml'])) {
$context['menu_data_' . $context['pm_menu_id']]['current_area'] = 'send';
}
if (!WIRELESS && !isset($_REQUEST['xml'])) {
$context['sub_template'] = 'send';
} elseif (isset($_REQUEST['xml'])) {
$context['sub_template'] = 'pm';
}
$context['page_title'] = $txt['send_message'];
// Got some known members?
$context['recipients'] = array('to' => array(), 'bcc' => array());
if (!empty($recipient_ids['to']) || !empty($recipient_ids['bcc'])) {
$allRecipients = array_merge($recipient_ids['to'], $recipient_ids['bcc']);
$request = $smcFunc['db_query']('', '
SELECT id_member, real_name
FROM {db_prefix}members
WHERE id_member IN ({array_int:member_list})', array('member_list' => $allRecipients));
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$recipientType = in_array($row['id_member'], $recipient_ids['bcc']) ? 'bcc' : 'to';
$context['recipients'][$recipientType][] = array('id' => $row['id_member'], 'name' => $row['real_name']);
}
$smcFunc['db_free_result']($request);
}
// Set everything up like before....
$context['subject'] = isset($_REQUEST['subject']) ? $smcFunc['htmlspecialchars']($_REQUEST['subject']) : '';
$context['message'] = isset($_REQUEST['message']) ? str_replace(array(' '), array(' '), $smcFunc['htmlspecialchars']($_REQUEST['message'])) : '';
$context['copy_to_outbox'] = !empty($_REQUEST['outbox']);
$context['reply'] = !empty($_REQUEST['replied_to']);
if ($context['reply']) {
$_REQUEST['replied_to'] = (int) $_REQUEST['replied_to'];
$request = $smcFunc['db_query']('', '
SELECT
pm.id_pm, CASE WHEN pm.id_pm_head = {int:no_id_pm_head} THEN pm.id_pm ELSE pm.id_pm_head END AS pm_head,
pm.body, pm.subject, pm.msgtime, mem.member_name, IFNULL(mem.id_member, 0) AS id_member,
IFNULL(mem.real_name, pm.from_name) AS real_name
FROM {db_prefix}personal_messages AS pm' . ($context['folder'] == 'sent' ? '' : '
INNER JOIN {db_prefix}pm_recipients AS pmr ON (pmr.id_pm = {int:replied_to})') . '
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = pm.id_member_from)
WHERE pm.id_pm = {int:replied_to}' . ($context['folder'] == 'sent' ? '
AND pm.id_member_from = {int:current_member}' : '
AND pmr.id_member = {int:current_member}') . '
LIMIT 1', array('current_member' => $user_info['id'], 'no_id_pm_head' => 0, 'replied_to' => $_REQUEST['replied_to']));
if ($smcFunc['db_num_rows']($request) == 0) {
if (!isset($_REQUEST['xml'])) {
fatal_lang_error('pm_not_yours', false);
} else {
$error_types[] = 'pm_not_yours';
}
}
$row_quoted = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);
censorText($row_quoted['subject']);
censorText($row_quoted['body']);
$context['quoted_message'] = array('id' => $row_quoted['id_pm'], 'pm_head' => $row_quoted['pm_head'], 'member' => array('name' => $row_quoted['real_name'], 'username' => $row_quoted['member_name'], 'id' => $row_quoted['id_member'], 'href' => !empty($row_quoted['id_member']) ? $scripturl . '?action=profile;u=' . $row_quoted['id_member'] : '', 'link' => !empty($row_quoted['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_quoted['id_member'] . '">' . $row_quoted['real_name'] . '</a>' : $row_quoted['real_name']), 'subject' => $row_quoted['subject'], 'time' => timeformat($row_quoted['msgtime']), 'timestamp' => forum_time(true, $row_quoted['msgtime']), 'body' => parse_bbc($row_quoted['body'], true, 'pm' . $row_quoted['id_pm']));
}
// Build the link tree....
$context['linktree'][] = array('url' => $scripturl . '?action=pm;sa=send', 'name' => $txt['new_message']);
// Set each of the errors for the template.
loadLanguage('Errors');
$context['error_type'] = 'minor';
$context['post_error'] = array('messages' => array(), 'error_type' => '');
foreach ($error_types as $error_type) {
$context['post_error'][$error_type] = true;
if (isset($txt['error_' . $error_type])) {
if ($error_type == 'long_message') {
$txt['error_' . $error_type] = sprintf($txt['error_' . $error_type], $modSettings['max_messageLength']);
}
$context['post_error']['messages'][] = $txt['error_' . $error_type];
}
// If it's not a minor error flag it as such.
if (!in_array($error_type, array('new_reply', 'not_approved', 'new_replies', 'old_topic', 'need_qr_verification', 'no_subject'))) {
$context['error_type'] = 'serious';
}
}
// Need to reset draft capability once again
$context['drafts_pm_save'] = !empty($modSettings['drafts_pm_enabled']) && allowedTo('pm_draft');
$context['drafts_autosave'] = !empty($context['drafts_pm_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('pm_autosave_draft');
// We need to load the editor once more.
require_once $sourcedir . '/Subs-Editor.php';
// Create it...
$editorOptions = array('id' => 'message', 'value' => $context['message'], 'width' => '90%', 'labels' => array('post_button' => $txt['send_message']), 'preview_type' => 2);
create_control_richedit($editorOptions);
// ... and store the ID again...
$context['post_box_name'] = $editorOptions['id'];
// Check whether we need to show the code again.
$context['require_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
if ($context['require_verification'] && !isset($_REQUEST['xml'])) {
require_once $sourcedir . '/Subs-Editor.php';
$verificationOptions = array('id' => 'pm');
//.........这里部分代码省略.........
示例5: TP_prebbcbox
function TP_prebbcbox($id, $body = '')
{
global $sourcedir;
require_once $sourcedir . '/Subs-Editor.php';
$editorOptions = array('id' => $id, 'value' => $body, 'preview_type' => 2, 'height' => '300px', 'width' => '100%');
create_control_richedit($editorOptions);
}
示例6: getEditor
function getEditor($description = '')
{
global $sourcedir, $context;
// Needed for the WYSIWYG editor.
require_once $sourcedir . '/Subs-Editor.php';
// Now create the editor.
$editorOptions = array('id' => 'descript', 'value' => $description, 'width' => '97%', 'form' => 'picform', 'labels' => array('post_button' => ''));
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];
}
示例7: PortaMx_EditArticle
/**
* load the article editor by article type.
* field: name of a input element.
* content: the content in the editor or empty.
*/
function PortaMx_EditArticle($type, $field, $content)
{
global $context, $sourcedir, $boardurl, $modSettings, $user_info, $options, $smcFunc, $txt;
// for html blocks
if ($type == 'html') {
loadJavascriptFile($boardurl . '/ckeditor/ckeditor.js', array('external' => true));
$context['pmx']['htmledit'] = array('id' => 'content', 'content' => $content);
} else {
if ($type == 'script') {
addInlineCss('
textarea{min-height:100px;resize:vertical;}');
$context['pmx']['script'] = array('id' => 'content', 'value' => !empty($content) ? $content : '', 'width' => '100%', 'height' => '150px');
} elseif ($type == 'php') {
addInlineCss('
textarea{min-height:100px;}');
if (preg_match('~\\[\\?pmx_initphp(.*)pmx_initphp\\?\\]~is', $content, $match)) {
$cont = trim($match[1]);
} else {
$cont = '';
}
$context['pmx']['phpInit'] = array('id' => 'content_init', 'value' => $smcFunc['htmlspecialchars']($cont, ENT_NOQUOTES), 'width' => '100%', 'height' => '150px', 'havecont' => !empty($cont));
if (preg_match('~\\[\\?pmx_showphp(.*)pmx_showphp\\?\\]~is', $content, $match)) {
$cont = trim($match[1]);
} else {
$cont = $content;
}
$context['pmx']['phpShow'] = array('id' => 'content', 'value' => $smcFunc['htmlspecialchars']($cont, ENT_NOQUOTES), 'width' => '100%', 'height' => '150px', 'havecont' => !empty($cont));
} else {
// Let's load the SMF editor.
require_once $sourcedir . '/Subs-Editor.php';
$user_info['smiley_set'] = 'PortaMx';
$modSettings['smiley_enable'] = true;
$options['wysiwyg_default'] = true;
$editorOptions = array('id' => 'content', 'value' => !empty($content) ? $content : '', 'width' => '100%', 'height' => '200px', 'labels' => array(), 'preview_type' => 0, 'bbc_level' => 'full', 'disable_smiley_box' => 0, 'locale' => !empty($txt['lang_locale']) && substr($txt['lang_locale'], 0, 5) != 'en_US' ? $txt['lang_locale'] : '', 'form' => 'pxmedit');
create_control_richedit($editorOptions);
$context['pmx']['editorID'] = $editorOptions['id'];
}
}
}
示例8: char_template_edit
function char_template_edit()
{
global $context, $txt, $sourcedir, $smcFunc;
require_once $sourcedir . '/Subs-Post.php';
require_once $sourcedir . '/Subs-Editor.php';
$template_id = isset($_GET['template_id']) ? (int) $_GET['template_id'] : 0;
$request = $smcFunc['db_query']('', '
SELECT id_template, template_name, template
FROM {db_prefix}character_sheet_templates
WHERE id_template = {int:template}', ['template' => $template_id]);
$row = $smcFunc['db_fetch_assoc']($request);
if (empty($row)) {
redirectexit('action=admin;area=templates');
}
$context['template_id'] = $template_id;
$context['template_name'] = $row['template_name'];
// Now create the editor.
$editorOptions = ['id' => 'message', 'value' => un_preparsecode($row['template']), 'labels' => ['post_button' => $txt['save']], 'height' => '500px', 'width' => '100%', 'preview_type' => 0, 'required' => true];
create_control_richedit($editorOptions);
$context['page_title'] = $txt['char_templates_edit'];
$context['sub_template'] = 'char_template_edit';
loadTemplate('Admin-Chars');
}
示例9: action_post
//.........这里部分代码省略.........
obExit();
}
// Build the link tree.
if (empty($topic)) {
$context['linktree'][] = array('name' => '<em>' . $txt['start_new_topic'] . '</em>');
} else {
$context['linktree'][] = array('url' => $scripturl . '?topic=' . $topic . '.' . $_REQUEST['start'], 'name' => $form_subject, 'extra_before' => '<span><strong class="nav">' . $context['page_title'] . ' ( </strong></span>', 'extra_after' => '<span><strong class="nav"> )</strong></span>');
}
$context['subject'] = addcslashes($form_subject, '"');
$context['message'] = str_replace(array('"', '<', '>', ' '), array('"', '<', '>', ' '), $form_message);
// Are post drafts enabled?
$context['drafts_save'] = !empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_post_enabled']) && allowedTo('post_draft');
$context['drafts_autosave'] = !empty($context['drafts_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('post_autosave_draft');
if (!empty($modSettings['mentions_enabled'])) {
$context['mentions_enabled'] = true;
loadCSSFile('jquery.atwho.css');
addInlineJavascript('
$(document).ready(function () {
for (var i = 0, count = all_elk_mentions.length; i < count; i++)
all_elk_mentions[i].oMention = new elk_mentions(all_elk_mentions[i].oOptions);
});');
}
// Build a list of drafts that they can load into the editor
if (!empty($context['drafts_save'])) {
$this->_prepareDraftsContext($user_info['id'], $topic);
if (!empty($context['drafts'])) {
$template_layers->add('load_drafts', 100);
}
}
// Needed for the editor and message icons.
require_once SUBSDIR . '/Editor.subs.php';
// Now create the editor.
$editorOptions = array('id' => 'message', 'value' => $context['message'], 'labels' => array('post_button' => $context['submit_label']), 'height' => '275px', 'width' => '100%', 'preview_type' => 2);
create_control_richedit($editorOptions);
$context['attached'] = '';
$context['make_poll'] = isset($_REQUEST['poll']);
if ($context['make_poll']) {
loadTemplate('Poll');
$template_layers->add('poll_edit');
}
// Message icons - customized or not, retrieve them...
$context['icons'] = getMessageIcons($board);
$context['icon_url'] = '';
if (!empty($context['icons'])) {
$context['icons'][count($context['icons']) - 1]['is_last'] = true;
$context['icons'][0]['selected'] = true;
// $context['icon'] is set when editing a message
if (!isset($context['icon'])) {
$context['icon'] = $context['icons'][0]['value'];
}
$found = false;
foreach ($context['icons'] as $icon) {
if ($icon['value'] === $context['icon']) {
$found = true;
$context['icon_url'] = $icon['url'];
break;
}
}
// Failsafe
if (!$found) {
$context['icon'] = $context['icons'][0]['value'];
$context['icon_url'] = $context['icons'][0]['url'];
}
}
// Are we starting a poll? if set the poll icon as selected if its available
if (isset($_REQUEST['poll'])) {
示例10: BlogViewPost
function BlogViewPost()
{
global $boarddir, $context, $smcFunc, $modSettings, $scripturl, $sourcedir, $txt;
// No ID? Redirect back to the main blog page.
if (empty($_GET['id'])) {
redirectexit('action=blog');
}
// Make sure it's numeric.
$_GET['id'] = (int) $_GET['id'];
// We need the postbox functions.
require_once $sourcedir . '/Subs-Post.php';
require_once $sourcedir . '/Subs-Editor.php';
// Now create the editor.
$editorOptions = array('id' => 'message', 'value' => '', 'width' => '90%', 'form' => 'postmodify', 'labels' => array('post_button' => ''));
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];
// Register the comment form in the session variables.
checkSubmitOnce('register');
// Make sure we have a posts per page value. If not, use a default.
if (empty($modSettings['blog_comments_perpage'])) {
$modSettings['blog_comments_perpage'] = 10;
}
// Grab the post and its replies.
$context['blog_post'] = BlogTopic($_GET['id'], $modSettings['blog_comments_perpage'], null, 'array');
// Construct a page index
// !!! ssi_topic() should be fixed! :P
$context['blog_post']['pageindex'] = constructPageIndex($scripturl . '?action=blog;sa=view_post;id=' . $_GET['id'] . (!empty($modSettings['blog_enable_rewrite']) ? ';blog_name=' . $_GET['blog_name'] : '') . ';start=%d#comments', $_REQUEST['start'], $context['blog_post']['reply_count'], $modSettings['blog_comments_perpage'], true);
// If the blog name is passed...
if (!empty($_GET['blog_name'])) {
$context['blog_name'] = $_GET['blog_name'];
}
// Use the "view_post" template.
$context['sub_template'] = 'view_post';
}
示例11: action_send
//.........这里部分代码省略.........
// Get the quoted message (and make sure you're allowed to see this quote!).
$row_quoted = loadPMQuote($pmsg, $isReceived);
if ($row_quoted === false) {
fatal_lang_error('pm_not_yours', false);
}
// Censor the message.
censorText($row_quoted['subject']);
censorText($row_quoted['body']);
// Lets make sure we mark this one as read
markMessages($pmsg);
// Figure out which flavor or 'Re: ' to use
$context['response_prefix'] = response_prefix();
$form_subject = $row_quoted['subject'];
// Add 'Re: ' to it....
if ($context['reply'] && trim($context['response_prefix']) != '' && Util::strpos($form_subject, trim($context['response_prefix'])) !== 0) {
$form_subject = $context['response_prefix'] . $form_subject;
}
// If quoting, lets clean up some things and set the quote header for the pm body
if (isset($_REQUEST['quote'])) {
// Remove any nested quotes and <br />...
$form_message = preg_replace('~<br ?/?' . '>~i', "\n", $row_quoted['body']);
if (!empty($modSettings['removeNestedQuotes'])) {
$form_message = preg_replace(array('~\\n?\\[quote.*?\\].+?\\[/quote\\]\\n?~is', '~^\\n~', '~\\[/quote\\]~'), '', $form_message);
}
if (empty($row_quoted['id_member'])) {
$form_message = '[quote author="' . $row_quoted['real_name'] . '"]' . "\n" . $form_message . "\n" . '[/quote]';
} else {
$form_message = '[quote author=' . $row_quoted['real_name'] . ' link=action=profile;u=' . $row_quoted['id_member'] . ' date=' . $row_quoted['msgtime'] . ']' . "\n" . $form_message . "\n" . '[/quote]';
}
} else {
$form_message = '';
}
// Do the BBC thang on the message.
$row_quoted['body'] = parse_bbc($row_quoted['body'], true, 'pm' . $row_quoted['id_pm']);
// Set up the quoted message array.
$context['quoted_message'] = array('id' => $row_quoted['id_pm'], 'pm_head' => $row_quoted['pm_head'], 'member' => array('name' => $row_quoted['real_name'], 'username' => $row_quoted['member_name'], 'id' => $row_quoted['id_member'], 'href' => !empty($row_quoted['id_member']) ? $scripturl . '?action=profile;u=' . $row_quoted['id_member'] : '', 'link' => !empty($row_quoted['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_quoted['id_member'] . '">' . $row_quoted['real_name'] . '</a>' : $row_quoted['real_name']), 'subject' => $row_quoted['subject'], 'time' => standardTime($row_quoted['msgtime']), 'html_time' => htmlTime($row_quoted['msgtime']), 'timestamp' => forum_time(true, $row_quoted['msgtime']), 'body' => $row_quoted['body']);
} else {
$context['quoted_message'] = false;
$form_subject = '';
$form_message = '';
}
// Start of like we don't know where this is going
$context['recipients'] = array('to' => array(), 'bcc' => array());
// Sending by ID? Replying to all? Fetch the real_name(s).
if (isset($_REQUEST['u'])) {
// If the user is replying to all, get all the other members this was sent to..
if ($_REQUEST['u'] == 'all' && isset($row_quoted)) {
// Firstly, to reply to all we clearly already have $row_quoted - so have the original member from.
if ($row_quoted['id_member'] != $user_info['id']) {
$context['recipients']['to'][] = array('id' => $row_quoted['id_member'], 'name' => htmlspecialchars($row_quoted['real_name'], ENT_COMPAT, 'UTF-8'));
}
// Now to get all the others.
$context['recipients']['to'] = array_merge($context['recipients']['to'], isset($pmsg) ? loadPMRecipientsAll($pmsg) : array());
} else {
$users = array_map('intval', explode(',', $_REQUEST['u']));
$users = array_unique($users);
// For all the member's this is going to, get their display name.
require_once SUBSDIR . '/Members.subs.php';
$result = getBasicMemberData($users);
foreach ($result as $row) {
$context['recipients']['to'][] = array('id' => $row['id_member'], 'name' => $row['real_name']);
}
}
// Get a literal name list in case the user has JavaScript disabled.
$names = array();
foreach ($context['recipients']['to'] as $to) {
$names[] = $to['name'];
}
$context['to_value'] = empty($names) ? '' : '"' . implode('", "', $names) . '"';
} else {
$context['to_value'] = '';
}
// Set the defaults...
$context['subject'] = $form_subject;
$context['message'] = str_replace(array('"', '<', '>', ' '), array('"', '<', '>', ' '), $form_message);
// And build the link tree.
$context['linktree'][] = array('url' => $scripturl . '?action=pm;sa=send', 'name' => $txt['new_message']);
// If drafts are enabled, lets generate a list of drafts that they can load in to the editor
if (!empty($context['drafts_pm_save'])) {
$pm_seed = isset($_REQUEST['pmsg']) ? $_REQUEST['pmsg'] : (isset($_REQUEST['quote']) ? $_REQUEST['quote'] : 0);
prepareDraftsContext($user_info['id'], $pm_seed);
}
// Needed for the editor.
require_once SUBSDIR . '/Editor.subs.php';
// Now create the editor.
$editorOptions = array('id' => 'message', 'value' => $context['message'], 'height' => '250px', 'width' => '100%', 'labels' => array('post_button' => $txt['send_message']), 'preview_type' => 2);
create_control_richedit($editorOptions);
// No one is bcc'ed just yet
$context['bcc_value'] = '';
// Verification control needed for this PM?
$context['require_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
if ($context['require_verification']) {
require_once SUBSDIR . '/VerificationControls.class.php';
$verificationOptions = array('id' => 'pm');
$context['require_verification'] = create_control_verification($verificationOptions);
$context['visual_verification_id'] = $verificationOptions['id'];
}
// Register this form and get a sequence number in $context.
checkSubmitOnce('register');
}
示例12: shd_frontpage_options
function shd_frontpage_options($return_config)
{
global $context, $modSettings, $txt, $sourcedir, $smcFunc;
// Since this is potentially dangerous, real admins only, thanks.
isAllowedTo('admin_forum');
$config_vars = array(array('select', 'shdp_frontpage_appear', array('always' => $txt['shdp_frontpage_appear_always'], 'firstload' => $txt['shdp_frontpage_appear_firstload'], 'firstdefault' => $txt['shdp_frontpage_appear_firstdefault'])), '', array('select', 'shdp_frontpage_type', array('php' => $txt['shdp_frontpage_type_php'], 'bbcode' => $txt['shdp_frontpage_type_bbcode'])), array('large_text', 'shdp_frontpage_content', 'size' => 30));
$context['settings_title'] = $txt['shdp_frontpage'];
$context['settings_icon'] = 'frontpage.png';
// Are we actually going to display this, or bouncing it back just for admin search?
if (!$return_config) {
require_once $sourcedir . '/Subs-Post.php';
require_once $sourcedir . '/Subs-Editor.php';
loadTemplate('sd_plugins_template/SDPluginFrontPage');
$context['sub_template'] = 'shd_frontpage_admin';
$context['shdp_frontpage_content'] = !empty($modSettings['shdp_frontpage_content']) ? un_preparsecode($modSettings['shdp_frontpage_content']) : '';
if (isset($_GET['save'])) {
$_POST['shdp_frontpage_content'] = isset($_POST['shdp_frontpage_content']) ? $_POST['shdp_frontpage_content'] : '';
if (!empty($_POST['shdp_frontpage_type']) && $_POST['shdp_frontpage_type'] == 'php') {
$context['shdp_frontpage_content'] = $smcFunc['htmlspecialchars']($_POST['shdp_frontpage_content'], ENT_QUOTES);
} else {
$_POST['shdp_frontpage_content'] = $smcFunc['htmlspecialchars']($_POST['shdp_frontpage_content'], ENT_QUOTES);
preparsecode($_POST['shdp_frontpage_content']);
$context['shdp_frontpage_content'] = un_preparsecode($_POST['shdp_frontpage_content']);
// So it's a known safe version.
}
}
$modSettings['disable_wysiwyg'] = true;
$editorOptions = array('id' => 'shdp_frontpage_content', 'value' => $context['shdp_frontpage_content'], 'labels' => array('post_button' => $txt['save']), 'preview_type' => 0, 'width' => '70%', 'disable_smiley_box' => false);
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];
}
return $config_vars;
}
示例13: action_sportal_admin_block_edit
//.........这里部分代码省略.........
// Create the list for this Item
foreach ($boards as $board) {
// Ignore the redirected boards :)
if (!empty($board['redirect'])) {
continue;
}
$context['SPortal']['block']['board_options'][$name][$board['id']] = array('value' => $board['id'], 'text' => $board['name'], 'selected' => in_array($board['id'], $config_variable));
}
} elseif ($type === 'bbc') {
// ELK support only one bbc correct, multiple bbc do not work at the moment
if (!$firstBBCFound) {
$firstBBCFound = true;
// Start Elk BBC System :)
require_once SUBSDIR . '/Editor.subs.php';
// Prepare the output :D
$form_message = !empty($context['SPortal']['block']['parameters'][$name]) ? $context['SPortal']['block']['parameters'][$name] : '';
// But if it's in HTML world, turn them into htmlspecialchar's so they can be edited!
if (strpos($form_message, '[html]') !== false) {
$parts = preg_split('~(\\[/code\\]|\\[code(?:=[^\\]]+)?\\])~i', $form_message, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0, $n = count($parts); $i < $n; $i++) {
// It goes 0 = outside, 1 = begin tag, 2 = inside, 3 = close tag, repeat.
if ($i % 4 == 0) {
$parts[$i] = preg_replace_callback('~\\[html\\](.+?)\\[/html\\]~is', create_function('$m', 'return "[html]" . preg_replace(\'~<br\\s?/?>~i\', \'<br /><br />\', "$m[1]") . "[/html]";'), $parts[$i]);
}
}
$form_message = implode('', $parts);
}
$form_message = preg_replace('~<br(?: /)?' . '>~i', "\n", $form_message);
// Prepare the data before i want them inside the textarea
$form_message = str_replace(array('"', '<', '>', ' '), array('"', '<', '>', ' '), $form_message);
$context['SPortal']['bbc'] = 'bbc_' . $name;
$message_data = array('id' => $context['SPortal']['bbc'], 'width' => '95%', 'height' => '200px', 'value' => $form_message, 'form' => 'sp_block');
// Run the ELK bbc editor routine
create_control_richedit($message_data);
// Store the updated data on the parameters
$context['SPortal']['block']['parameters'][$name] = $form_message;
} else {
$context['SPortal']['block']['options'][$name] = 'textarea';
}
}
}
loadJavascriptFile('portal.js?sp24');
$context['sub_template'] = 'block_edit';
$context['page_title'] = $context['SPortal']['is_new'] ? $txt['sp-blocksAdd'] : $txt['sp-blocksEdit'];
}
// Want to add / edit a block oo the portal
if (!empty($_POST['add_block'])) {
checkSession();
// Only the admin can do php here
if ($_POST['block_type'] == 'sp_php' && !allowedTo('admin_forum')) {
fatal_lang_error('cannot_admin_forum', false);
}
// Make sure the block name is something safe
if (!isset($_POST['block_name']) || Util::htmltrim(Util::htmlspecialchars($_POST['block_name']), ENT_QUOTES) === '') {
fatal_lang_error('error_sp_name_empty', false);
}
if ($_POST['block_type'] == 'sp_php' && !empty($_POST['parameters']['content']) && empty($modSettings['sp_disable_php_validation'])) {
require_once SUBSDIR . '/DataValidator.class.php';
$validator = new Data_Validator();
$validator->validation_rules(array('content' => 'php_syntax'));
$validator->validate(array('content' => $_POST['parameters']['content']));
$error = $validator->validation_errors();
if ($error) {
$_SESSION['sp_error'] = $error[0];
$_SESSION['sp_error_post'] = $_POST;
redirectexit('action=admin;area=portalblocks;sa=' . $_REQUEST['sa'] . (!empty($_REQUEST['block_id']) ? ';block_id=' . $_REQUEST['block_id'] : ''));
示例14: shd_admin_canned_editreply
function shd_admin_canned_editreply()
{
global $context, $smcFunc, $txt, $sourcedir, $scripturl;
require_once $sourcedir . '/Subs-Editor.php';
require_once $sourcedir . '/Subs-Post.php';
$context['page_title'] = $txt['shd_admin_cannedreplies_editreply'];
$context['sub_template'] = 'shd_edit_canned_reply';
$_REQUEST['reply'] = isset($_REQUEST['reply']) ? (int) $_REQUEST['reply'] : 0;
$query = $smcFunc['db_query']('', '
SELECT hdcr.title, hdcr.body, hdcr.vis_user, hdcr.vis_staff, hdcr.active, hdcr.id_cat
FROM {db_prefix}helpdesk_cannedreplies AS hdcr
WHERE id_reply = {int:reply}', array('reply' => $_REQUEST['reply']));
if ($smcFunc['db_num_rows']($query) == 0) {
$smcFunc['db_free_result']($query);
fatal_lang_error('shd_admin_cannedreplies_thereplyisalie', false);
}
$row = $smcFunc['db_fetch_assoc']($query);
$smcFunc['db_free_result']($query);
$context['canned_reply'] = array('id' => $_REQUEST['reply'], 'title' => $row['title'], 'body' => un_preparsecode($row['body']), 'active' => !empty($row['active']), 'vis_user' => !empty($row['vis_user']), 'vis_staff' => !empty($row['vis_staff']), 'cat' => $row['id_cat'], 'depts_selected' => array(), 'depts_available' => array());
// Now we need to get the possible departments.
$query = $smcFunc['db_query']('', '
SELECT id_dept, dept_name
FROM {db_prefix}helpdesk_depts
ORDER BY dept_order');
while ($row = $smcFunc['db_fetch_assoc']($query)) {
$context['canned_reply']['depts_available'][$row['id_dept']] = $row['dept_name'];
}
$smcFunc['db_free_result']($query);
// Now any departments this reply is attached to.
$query = $smcFunc['db_query']('', '
SELECT hdcrd.id_dept
FROM {db_prefix}helpdesk_cannedreplies_depts AS hdcrd
WHERE hdcrd.id_reply = {int:reply}', array('reply' => $_REQUEST['reply']));
while ($row = $smcFunc['db_fetch_assoc']($query)) {
$context['canned_reply']['depts_selected'][] = $row['id_dept'];
}
$smcFunc['db_free_result']($query);
checkSubmitOnce('register');
$editorOptions = array('id' => 'shd_canned_reply', 'value' => $context['canned_reply']['body'], 'labels' => array('post_button' => $txt['shd_admin_cannedreplies_editreply']), 'preview_type' => 0, 'width' => '70%', 'disable_smiley_box' => false);
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];
}
示例15: action_sportal_admin_page_edit
/**
* Interface for adding/editing a page
*/
public function action_sportal_admin_page_edit()
{
global $txt, $context, $options;
$context['SPortal']['is_new'] = empty($_REQUEST['page_id']);
$pages_errors = Error_Context::context('pages', 0);
// Some help will be needed
require_once SUBSDIR . '/Editor.subs.php';
require_once SUBSDIR . '/Post.subs.php';
// Convert this to BBC?
if (!empty($_REQUEST['content_mode']) && $_POST['type'] === 'bbc') {
require_once SUBSDIR . 'Html2BBC.class.php';
$bbc_converter = new Convert_BBC($_REQUEST['content']);
$_REQUEST['content'] = $bbc_converter->get_bbc();
$_REQUEST['content'] = un_htmlspecialchars($_REQUEST['content']);
$_POST['content'] = $_REQUEST['content'];
}
// Load in the blocks that can be used on a page
$this->blocks = getBlockInfo();
$context['page_blocks'] = $this->_sportal_admin_page_load_blocks();
// Saving the work?
if (!empty($_POST['submit']) && !$pages_errors->hasErrors()) {
checkSession();
$this->_sportal_admin_page_edit_save();
}
// Doing a quick look before you save or you messed up?
if (!empty($_POST['preview']) || $pages_errors->hasErrors()) {
$context['SPortal']['page'] = array('id' => $_POST['page_id'], 'page_id' => $_POST['namespace'], 'title' => Util::htmlspecialchars($_POST['title'], ENT_QUOTES), 'body' => Util::htmlspecialchars($_POST['content'], ENT_QUOTES), 'type' => $_POST['type'], 'permissions' => $_POST['permissions'], 'style' => sportal_parse_style('implode'), 'status' => !empty($_POST['status']));
// Fix up bbc errors before we go to the preview
if ($context['SPortal']['page']['type'] == 'bbc') {
preparsecode($context['SPortal']['page']['body']);
}
loadTemplate('PortalPages');
// Showing errors or a preview?
if ($pages_errors->hasErrors()) {
$context['pages_errors'] = array('errors' => $pages_errors->prepareErrors(), 'type' => $pages_errors->getErrorType() == 0 ? 'minor' : 'serious', 'title' => $txt['sp_form_errors_detected']);
} else {
$context['SPortal']['preview'] = true;
}
} elseif ($context['SPortal']['is_new']) {
$context['SPortal']['page'] = array('id' => 0, 'page_id' => 'page' . mt_rand(1, 5000), 'title' => $txt['sp_pages_default_title'], 'body' => '', 'type' => 'bbc', 'permissions' => 3, 'style' => '', 'status' => 1);
} else {
$_REQUEST['page_id'] = (int) $_REQUEST['page_id'];
$context['SPortal']['page'] = sportal_get_pages($_REQUEST['page_id']);
}
if ($context['SPortal']['page']['type'] === 'bbc') {
$context['SPortal']['page']['body'] = str_replace(array('"', '<', '>', ' '), array('"', '<', '>', ' '), un_preparsecode($context['SPortal']['page']['body']));
}
// Set up the editor, values, initial state, etc
if ($context['SPortal']['page']['type'] !== 'bbc') {
// No wizzy mode if they don't need it
$temp_editor = !empty($options['wysiwyg_default']);
$options['wysiwyg_default'] = false;
}
$editorOptions = array('id' => 'content', 'value' => $context['SPortal']['page']['body'], 'width' => '100%', 'height' => '225px', 'preview_type' => 2);
create_control_richedit($editorOptions);
$context['post_box_name'] = $editorOptions['id'];
if (isset($temp_editor)) {
$options['wysiwyg_default'] = $temp_editor;
}
// Set the editor box as needed (editor or textbox, etc)
addInlineJavascript('
$(window).load(function() {
diewithfire = window.setTimeout(function() {sp_update_editor("' . $context['SPortal']['page']['type'] . '", "");}, 200);
});
');
// Permissions
$context['SPortal']['page']['permission_profiles'] = sportal_get_profiles(null, 1, 'name');
if (empty($context['SPortal']['page']['permission_profiles'])) {
fatal_lang_error('error_sp_no_permission_profiles', false);
}
// And for the template
$context['SPortal']['page']['style'] = sportal_parse_style('explode', $context['SPortal']['page']['style'], !empty($context['SPortal']['preview']));
$context['SPortal']['page']['body'] = sportal_parse_content($context['SPortal']['page']['body'], $context['SPortal']['page']['type'], 'return');
$context['page_title'] = $context['SPortal']['is_new'] ? $txt['sp_admin_pages_add'] : $txt['sp_admin_pages_edit'];
$context['sub_template'] = 'pages_edit';
}