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


PHP html_to_bbc函数代码示例

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


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

示例1: EditorMain

function EditorMain()
{
    global $context, $smcFunc;
    checkSession('get');
    if (!isset($_REQUEST['view']) || !isset($_REQUEST['message'])) {
        fatal_lang_error('no_access', false);
    }
    $context['sub_template'] = 'sendbody';
    $context['view'] = (int) $_REQUEST['view'];
    // Return the right thing for the mode.
    if ($context['view']) {
        $_REQUEST['message'] = strtr($_REQUEST['message'], array('#smcol#' => ';', '#smlt#' => '<', '#smgt#' => '>', '#smamp#' => '&'));
        $context['message'] = bbc_to_html($_REQUEST['message']);
    } else {
        $_REQUEST['message'] = un_htmlspecialchars($_REQUEST['message']);
        $_REQUEST['message'] = strtr($_REQUEST['message'], array('#smcol#' => ';', '#smlt#' => '<', '#smgt#' => '>', '#smamp#' => '&'));
        $context['message'] = html_to_bbc($_REQUEST['message']);
    }
    $context['message'] = commonAPI::htmlspecialchars($context['message']);
}
开发者ID:norv,项目名称:EosAlpha,代码行数:20,代码来源:Subs-Editor.php

示例2: EditPost2

function EditPost2()
{
    global $txt, $smcFunc, $sourcedir;
    checkSession('post');
    // Get the ID
    $id = (int) $_REQUEST['id'];
    if (empty($id)) {
        fatal_error($txt['postscheduler_nopostselected'], false);
    }
    // If we came from WYSIWYG then turn it back into BBC regardless.
    if (!empty($_REQUEST['message_mode']) && isset($_REQUEST['message'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $_REQUEST['message'] = html_to_bbc($_REQUEST['message']);
        // We need to unhtml it now as it gets done shortly.
        $_REQUEST['message'] = un_htmlspecialchars($_REQUEST['message']);
    }
    $subject = $smcFunc['htmlspecialchars']($_REQUEST['subject'], ENT_QUOTES);
    $boardselect = (int) $_REQUEST['boardselect'];
    $postername = str_replace('"', '', $_REQUEST['postername']);
    $postername = str_replace("'", '', $postername);
    $postername = str_replace('\\', '', $postername);
    $postername = $smcFunc['htmlspecialchars']($postername, ENT_QUOTES);
    $msgicon = $smcFunc['htmlspecialchars']($_REQUEST['msgicon'], ENT_QUOTES);
    $message = $smcFunc['htmlspecialchars']($_REQUEST['message'], ENT_QUOTES);
    $topicid = (int) $_REQUEST['topicid'];
    if ($subject == '') {
        fatal_error($txt['postscheduler_err_subject'], false);
    }
    if ($postername == '') {
        fatal_error($txt['postscheduler_err_postername'], false);
    }
    if ($boardselect == 0) {
        fatal_error($txt['postscheduler_err_forum'], false);
    }
    if ($message == '') {
        fatal_error($txt['postscheduler_err_message'], false);
    }
    $topiclocked = isset($_REQUEST['topiclocked']) ? 1 : 0;
    $month = (int) $_REQUEST['month'];
    $day = (int) $_REQUEST['day'];
    $year = (int) $_REQUEST['year'];
    $hour = (int) $_REQUEST['hour'];
    $minute = (int) $_REQUEST['minute'];
    $ampm = $_REQUEST['ampm'];
    $minute = str_pad($minute, 2, "0", STR_PAD_LEFT);
    $time_in_24_hour_format = DATE("H", STRTOTIME("{$hour}:{$minute} {$ampm}"));
    if (!empty($month) && !empty($day) && !empty($year)) {
        $post_time = mktime($time_in_24_hour_format, $minute, 0, $month, $day, $year);
    } else {
        fatal_error($txt['postscheduler_err_date'], false);
    }
    // Lookup the Memeber ID of the postername
    $memid = 0;
    $dbresult = $smcFunc['db_query']('', "\n\tSELECT \n\t\treal_name, ID_MEMBER \n\tFROM {db_prefix}members \n\tWHERE real_name = '{$postername}' OR member_name = '{$postername}'  LIMIT 1");
    $row = $smcFunc['db_fetch_assoc']($dbresult);
    $smcFunc['db_free_result']($dbresult);
    if ($smcFunc['db_affected_rows']() != 0) {
        $memid = $row['ID_MEMBER'];
    }
    $smcFunc['db_query']('', "\n\t\tUPDATE {db_prefix}postscheduler \n\t\tSET \n\t\t\tID_BOARD = {$boardselect}, subject = '{$subject}', postername  = '{$postername}', ID_MEMBER = {$memid}, locked = '{$topiclocked}', \n\t\t\tbody = '{$message}',id_topic = '{$topicid}',post_time = '{$post_time}',\n\t\t\tmsgicon  = '{$msgicon}'\n\n\t    WHERE ID_POST = {$id} LIMIT 1");
    // Redirect to the Admin
    redirectexit('action=admin;area=postscheduler;sa=admin');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:63,代码来源:PostScheduler2.php

示例3: TPortalDLAdmin


//.........这里部分代码省略.........
				SET filesize = {int:size}
				WHERE id = {int:item}', array('size' => $value, 'item' => $sid));
            $myid = $sid;
            $go = 2;
        }
        // get all values from forms
        foreach ($_POST as $what => $value) {
            if (substr($what, 0, 12) == 'dladmin_name') {
                $id = substr($what, 12);
                // no html here
                $value = strip_tags($value);
                if (empty($value)) {
                    $value = '-no title-';
                }
                $smcFunc['db_query']('', '
					UPDATE {db_prefix}tp_dlmanager 
					SET name = {string:name} 
					WHERE id = {int:item}', array('name' => $value, 'item' => $id));
            } elseif (substr($what, 0, 12) == 'dladmin_icon') {
                $id = substr($what, 12);
                if ($value != '') {
                    $val = $boardurl . '/tp-downloads/icons/' . $value;
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_dlmanager 
						SET icon = {string:icon} 
						WHERE id = {int:item}', array('icon' => $val, 'item' => $id));
                }
            } elseif (substr($what, 0, 12) == 'dladmin_text') {
                $id = substr($what, 12);
                if (is_numeric($id)) {
                    // If we came from WYSIWYG then turn it back into BBC regardless.
                    if (!empty($_REQUEST[$what . '_mode']) && isset($_REQUEST[$what])) {
                        require_once $sourcedir . '/Subs-Editor.php';
                        $_REQUEST[$what] = html_to_bbc($_REQUEST[$what]);
                        // We need to unhtml it now as it gets done shortly.
                        $_REQUEST[$what] = un_htmlspecialchars($_REQUEST[$what]);
                        // We need this for everything else.
                        $value = $_POST[$what] = $_REQUEST[$what];
                    }
                    if (isset($_POST['dladmin_text' . $id . '_pure']) && isset($_POST['dladmin_text' . $id . '_choice'])) {
                        if ($_POST['dladmin_text' . $id . '_choice'] == 1) {
                            $value = $_POST['dladmin_text' . $id];
                        } else {
                            $value = $_POST['dladmin_text' . $id . '_pure'];
                        }
                    }
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_dlmanager 
						SET description = {string:desc} 
						WHERE id = {int:item}', array('desc' => $value, 'item' => $id));
                }
            } elseif (substr($what, 0, 14) == 'dladmin_delete') {
                $id = substr($what, 14);
                $request = $smcFunc['db_query']('', '
						SELECT * FROM {db_prefix}tp_dlmanager 
						WHERE id = {int:item}', array('item' => $id));
                if ($smcFunc['db_num_rows']($request) > 0) {
                    $row = $smcFunc['db_fetch_assoc']($request);
                    if ($row['type'] == 'dlitem') {
                        $category = $row['category'];
                        if ($category > 0) {
                            $smcFunc['db_query']('', '
									UPDATE {db_prefix}tp_dlmanager 
									SET downloads = downloads - 1 
									WHERE id = {int:cat} LIMIT 1', array('cat' => $category));
                        }
开发者ID:rhodefey,项目名称:TinyPortal-SMF2.1,代码行数:67,代码来源:TPdlmanager.php

示例4: Post2

function Post2()
{
    global $board, $topic, $txt, $modSettings, $sourcedir, $context;
    global $user_info, $board_info, $options, $smcFunc;
    // Sneaking off, are we?
    if (empty($_POST) && empty($topic)) {
        redirectexit('action=post;board=' . $board . '.0');
    } elseif (empty($_POST) && !empty($topic)) {
        redirectexit('action=post;topic=' . $topic . '.0');
    }
    // No need!
    $context['robot_no_index'] = true;
    // If we came from WYSIWYG then turn it back into BBC regardless.
    if (!empty($_REQUEST['message_mode']) && isset($_REQUEST['message'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $_REQUEST['message'] = html_to_bbc($_REQUEST['message']);
        // We need to unhtml it now as it gets done shortly.
        $_REQUEST['message'] = un_htmlspecialchars($_REQUEST['message']);
        // We need this for everything else.
        $_POST['message'] = $_REQUEST['message'];
    }
    // Previewing? Go back to start.
    if (isset($_REQUEST['preview'])) {
        return Post();
    }
    // Prevent double submission of this form.
    checkSubmitOnce('check');
    // No errors as yet.
    $post_errors = array();
    // If the session has timed out, let the user re-submit their form.
    if (checkSession('post', '', false) != '') {
        $post_errors[] = 'session_timeout';
    }
    // Wrong verification code?
    if (!$user_info['is_admin'] && !$user_info['is_mod'] && !empty($modSettings['posts_require_captcha']) && ($user_info['posts'] < $modSettings['posts_require_captcha'] || $user_info['is_guest'] && $modSettings['posts_require_captcha'] == -1)) {
        require_once $sourcedir . '/Subs-Editor.php';
        $verificationOptions = array('id' => 'post');
        $context['require_verification'] = create_control_verification($verificationOptions, true);
        if (is_array($context['require_verification'])) {
            $post_errors = array_merge($post_errors, $context['require_verification']);
        }
    }
    require_once $sourcedir . '/Subs-Post.php';
    loadLanguage('Post');
    // If this isn't a new topic load the topic info that we need.
    if (!empty($topic)) {
        $request = $smcFunc['db_query']('', '
			SELECT locked, is_sticky, id_poll, approved, id_first_msg, id_last_msg, id_member_started, id_board
			FROM {db_prefix}topics
			WHERE id_topic = {int:current_topic}
			LIMIT 1', array('current_topic' => $topic));
        $topic_info = $smcFunc['db_fetch_assoc']($request);
        $smcFunc['db_free_result']($request);
        // Though the topic should be there, it might have vanished.
        if (!is_array($topic_info)) {
            fatal_lang_error('topic_doesnt_exist');
        }
        // Did this topic suddenly move? Just checking...
        if ($topic_info['id_board'] != $board) {
            fatal_lang_error('not_a_topic');
        }
    }
    // Replying to a topic?
    if (!empty($topic) && !isset($_REQUEST['msg'])) {
        // Don't allow a post if it's locked.
        if ($topic_info['locked'] != 0 && !allowedTo('moderate_board')) {
            fatal_lang_error('topic_locked', false);
        }
        // Sorry, multiple polls aren't allowed... yet.  You should stop giving me ideas :P.
        if (isset($_REQUEST['poll']) && $topic_info['id_poll'] > 0) {
            unset($_REQUEST['poll']);
        }
        // Do the permissions and approval stuff...
        $becomesApproved = true;
        if ($topic_info['id_member_started'] != $user_info['id']) {
            if ($modSettings['postmod_active'] && allowedTo('post_unapproved_replies_any') && !allowedTo('post_reply_any')) {
                $becomesApproved = false;
            } else {
                isAllowedTo('post_reply_any');
            }
        } elseif (!allowedTo('post_reply_any')) {
            if ($modSettings['postmod_active'] && allowedTo('post_unapproved_replies_own') && !allowedTo('post_reply_own')) {
                $becomesApproved = false;
            } else {
                isAllowedTo('post_reply_own');
            }
        }
        if (isset($_POST['lock'])) {
            // Nothing is changed to the lock.
            if (empty($topic_info['locked']) && empty($_POST['lock']) || !empty($_POST['lock']) && !empty($topic_info['locked'])) {
                unset($_POST['lock']);
            } elseif (!allowedTo(array('lock_any', 'lock_own')) || !allowedTo('lock_any') && $user_info['id'] != $topic_info['id_member_started']) {
                unset($_POST['lock']);
            } elseif (!allowedTo('lock_any')) {
                // You cannot override a moderator lock.
                if ($topic_info['locked'] == 1) {
                    unset($_POST['lock']);
                } else {
                    $_POST['lock'] = empty($_POST['lock']) ? 0 : 2;
                }
//.........这里部分代码省略.........
开发者ID:valek0972,项目名称:hackits,代码行数:101,代码来源:Post.php

示例5: cleanEditor

function cleanEditor()
{
    global $sourcedir;
    if (!empty($_REQUEST['descript_mode']) && isset($_REQUEST['descript'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $_REQUEST['descript'] = html_to_bbc($_REQUEST['descript']);
        // We need to unhtml it now as it gets done shortly.
        $_REQUEST['descript'] = un_CleanAdkStrings($_REQUEST['descript']);
    }
}
开发者ID:lucasruroken,项目名称:adkportal,代码行数:10,代码来源:Subs-adkfunction.php

示例6: EditLink2

function EditLink2()
{
    global $smcFunc, $txt, $user_info, $sourcedir;
    is_not_guest();
    checkSession('post');
    // Link ID; Required
    if (!empty($_REQUEST['id'])) {
        $id = (int) $_REQUEST['id'];
    }
    if (empty($id)) {
        fatal_error($txt['smflinks_nolinkselected']);
    }
    // Attempt to get the member id for this link.
    $dbresult = $smcFunc['db_query']('', '
		SELECT ID_MEMBER
		FROM {db_prefix}links
		WHERE ID_LINK = {int:this_id}
		LIMIT 1', array('this_id' => $id));
    // If we didn't get a row, it's an invalid ID.
    if ($smcFunc['db_num_rows']($dbresult) == 0) {
        fatal_error($txt['smflinks_nolinkselected'], false);
    } else {
        $row = $smcFunc['db_fetch_assoc']($dbresult);
    }
    // Free the result.
    $smcFunc['db_free_result']($dbresult);
    // If we can't edit this for some reason...
    if (!allowedTo('edit_links_any') && (!allowedTo('edit_links_own') || $row['ID_MEMBER'] != $user_info['id'])) {
        fatal_error($txt['smflinks_perm_link_no_edit']);
    }
    // If we came from WYSIWYG then turn it back into BBC regardless.
    if (!empty($_REQUEST['descript_mode']) && isset($_REQUEST['descript'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $_REQUEST['descript'] = un_htmlspecialchars(html_to_bbc($_REQUEST['descript']));
    }
    // Category ID; Required
    if (!empty($_REQUEST['catid'])) {
        $catid = (int) $_REQUEST['catid'];
    }
    if (empty($catid)) {
        fatal_error($txt['smflinks_nocatselected'], false);
    }
    // Link Title; Required
    if (!empty($_POST['title'])) {
        $title = $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['title'], ENT_QUOTES));
    }
    if (empty($title)) {
        fatal_error($txt['smflinks_nolinktitle'], false);
    }
    // Link Description; Optional
    if (!empty($_REQUEST['descript'])) {
        $description = $smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_REQUEST['descript'], ENT_QUOTES));
    }
    if (empty($description)) {
        fatal_error($txt['smflinks_nolinkdesc'], false);
    }
    // Link URL; Required
    if (!empty($_POST['url'])) {
        $url = addslashes($smcFunc['htmltrim']($_POST['url']));
    }
    if (empty($url)) {
        fatal_error($txt['smflinks_nolinkurl'], false);
    }
    // Pull our link information.
    $dbresult = $smcFunc['db_query']('', '
		SELECT ID_CAT, title, description, image, ID_PARENT 
		FROM {db_prefix}links_cat 
		WHERE ID_CAT = {int:this_cat}', array('this_cat' => $catid));
    // Invalid ID, huh? Tryin' to be sneaky.
    if ($smcFunc['db_num_rows']($dbresult) == 0) {
        fatal_error($txt['smflinks_nocatselected'], false);
    } else {
        $row = $smcFunc['db_fetch_assoc']($dbresult);
    }
    GetCatPermission($catid, 'editlink');
    $alexa = 0;
    $pagerank = 0;
    // Update the link
    $smcFunc['db_query']('', '
		UPDATE {db_prefix}links
		SET
			title = {string:title},
			url = {string:url},
			description = {string:description},
			alexa = {int:alexa},
			pagerank = {int:pagerank},
			ID_CAT = {int:this_cat}
		WHERE ID_LINK = {int:this_id}
		LIMIT 1', array('title' => $title, 'url' => $url, 'description' => $description, 'alexa' => $alexa, 'pagerank' => $pagerank, 'this_cat' => $catid, 'this_id' => $id));
    // Redirect back to category
    redirectexit('action=links;cat=' . $catid);
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:92,代码来源:Links2.php

示例7: shd_load_custom_fields

/**
 *	Loads any custom fields that are active
 *
 *	@param bool $is_ticket (default true) Whether to load custom fields based on editing a ticket or a message.
 *	@param int $ticketContext The appropriate value to load for; if editing a ticket this represents the ticket id, if editing a reply this represents the message id, if empty this is a new instance of either so no need to attempt loading data.
 *
 *	@since 2.0
*/
function shd_load_custom_fields($is_ticket = true, $ticketContext = 0, $dept = 0)
{
    global $sourcedir, $context, $smcFunc;
    $field_values = array();
    if (!empty($ticketContext)) {
        $query = shd_db_query('', '
			SELECT cfv.id_field, cfv.value
			FROM {db_prefix}helpdesk_custom_fields_values AS cfv
			WHERE cfv.id_post = {int:ticketContext}
				AND cfv.post_type = {int:field_type}', array('ticketContext' => $ticketContext, 'field_type' => $is_ticket ? CFIELD_TICKET : CFIELD_REPLY));
        while ($row = $smcFunc['db_fetch_assoc']($query)) {
            $field_values[$row['id_field']] = $row['value'];
        }
        $smcFunc['db_free_result']($query);
    }
    // Load up our custom field defintions from the database
    $custom_fields = shd_db_query('', '
		SELECT cf.id_field, cf.active, cf.field_order, cf.field_name, cf.field_desc, cf.field_loc, cf.icon,
			cf.field_type, cf.field_options, cf.default_value, cf.bbc, cf.can_see, cf.can_edit, cf.field_length,
			cf.display_empty, cfd.required, cf.placement, cfd.id_dept
		FROM {db_prefix}helpdesk_custom_fields AS cf
			INNER JOIN {db_prefix}helpdesk_custom_fields_depts AS cfd ON (cf.id_field = cfd.id_field' . (!empty($dept) ? ' AND cfd.id_dept = {int:dept}' : '') . ')
		WHERE cf.active = 1
			AND cf.field_loc IN ({array_int:visibility})
		ORDER BY cf.field_order', array('visibility' => $is_ticket ? array(CFIELD_TICKET, CFIELD_REPLY | CFIELD_TICKET) : array(CFIELD_REPLY, CFIELD_REPLY | CFIELD_TICKET), 'dept' => $dept));
    $context['ticket_form']['custom_fields'] = array();
    $loc = $is_ticket ? 'ticket' : $ticketContext;
    $is_staff = shd_allowed_to('shd_staff', $dept);
    $is_admin = shd_allowed_to('admin_helpdesk', $dept);
    // this includes forum admins
    // Loop through all fields and figure out where they should be.
    while ($row = $smcFunc['db_fetch_assoc']($custom_fields)) {
        // Can the user even see this field? If we can't see the field, it doesn't exist to us for posting purposes.
        list($user_see, $staff_see) = explode(',', $row['can_see']);
        list($user_edit, $staff_edit) = explode(',', $row['can_edit']);
        if ($is_admin) {
            $editable = true;
        } elseif ($is_staff) {
            if ($staff_see == 0) {
                continue;
            }
            $editable = $staff_edit == 1;
        } elseif ($user_see == 1) {
            $editable = $user_edit == 1;
        } else {
            continue;
        }
        // Load up the fields and do some extra parsing
        if (!isset($context['ticket_form']['custom_fields'][$loc][$row['id_field']])) {
            $context['ticket_form']['custom_fields'][$loc][$row['id_field']] = array('id' => $row['id_field'], 'order' => $row['field_order'], 'location' => $row['field_loc'], 'length' => $row['field_length'], 'name' => $row['field_name'], 'desc' => parse_bbc($row['field_desc'], false), 'icon' => $row['icon'], 'options' => !empty($row['field_options']) ? unserialize($row['field_options']) : array(), 'type' => $row['field_type'], 'default_value' => $row['field_type'] == CFIELD_TYPE_LARGETEXT ? explode(',', $row['default_value']) : $row['default_value'], 'display_empty' => !empty($row['required']) ? 1 : $row['display_empty'], 'bbc' => !empty($row['bbc']), 'is_required' => $row['field_type'] == CFIELD_TYPE_MULTI ? (int) $row['required'] : !empty($row['required']), 'visible' => array($user_see, $staff_see), 'editable' => !empty($editable), 'depts' => array());
            if ($row['field_type'] == CFIELD_TYPE_RADIO || $row['field_type'] == CFIELD_TYPE_MULTI) {
                foreach ($context['ticket_form']['custom_fields'][$loc][$row['id_field']]['options'] as $k => $v) {
                    if ($k != 'inactive') {
                        $context['ticket_form']['custom_fields'][$loc][$row['id_field']]['options'][$k] = strpos($v, '[') !== false ? parse_bbc($v) : $v;
                    }
                }
            } elseif ($row['field_type'] == CFIELD_TYPE_SELECT) {
                foreach ($context['ticket_form']['custom_fields'][$loc][$row['id_field']]['options'] as $k => $v) {
                    if ($k != 'inactive') {
                        $context['ticket_form']['custom_fields'][$loc][$row['id_field']]['options'][$k] = strpos($v, '[') !== false ? trim(strip_tags(parse_bbc($v))) : trim($v);
                    }
                }
            }
        }
        $context['ticket_form']['custom_fields'][$loc][$row['id_field']]['depts'][] = $row['id_dept'];
        if (!empty($context['ticket_form']['custom_fields'][$loc][$row['id_field']]['options']) && empty($context['ticket_form']['custom_fields'][$loc][$row['id_field']]['options']['inactive'])) {
            $context['ticket_form']['custom_fields'][$loc][$row['id_field']]['options']['inactive'] = array();
        }
        if (isset($field_values[$row['id_field']])) {
            if ($context['ticket_form']['custom_fields'][$loc][$row['id_field']]['type'] == CFIELD_TYPE_MULTI) {
                $field_values[$row['id_field']] = explode(',', $field_values[$row['id_field']]);
            }
            // Large text boxes may need fixing.
            if ($context['ticket_form']['custom_fields'][$loc][$row['id_field']]['type'] == CFIELD_TYPE_LARGETEXT) {
                require_once $sourcedir . '/Subs-Editor.php';
                $field_values[$row['id_field']] = html_to_bbc($field_values[$row['id_field']]);
            }
            $context['ticket_form']['custom_fields'][$loc][$row['id_field']]['value'] = $field_values[$row['id_field']];
        }
    }
    $context['ticket_form']['custom_fields_context'] = $loc;
}
开发者ID:jdarwood007,项目名称:SimpleDesk,代码行数:90,代码来源:Subs-SimpleDeskPost.php

示例8: EditLink2

function EditLink2()
{
    global $smcFunc, $txt, $user_info, $sourcedir;
    is_not_guest();
    checkSession('post');
    $id = (int) $_REQUEST['id'];
    $dbresult = $smcFunc['db_query']('', "\n\tSELECT\n\t\tID_MEMBER\n\tFROM {db_prefix}links\n\tWHERE ID_LINK = {$id} LIMIT 1");
    $row = $smcFunc['db_fetch_assoc']($dbresult);
    $smcFunc['db_free_result']($dbresult);
    if (!allowedTo('edit_links_any') && (!allowedTo('edit_links_own') || $row['ID_MEMBER'] != $user_info['id'])) {
        fatal_error($txt['smflinks_perm_link_no_edit']);
    }
    // If we came from WYSIWYG then turn it back into BBC regardless.
    if (!empty($_REQUEST['descript_mode']) && isset($_REQUEST['descript'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $_REQUEST['descript'] = html_to_bbc($_REQUEST['descript']);
        // We need to unhtml it now as it gets done shortly.
        $_REQUEST['descript'] = un_htmlspecialchars($_REQUEST['descript']);
    }
    // Clean the input
    $title = $smcFunc['htmlspecialchars'](trim($_POST['title']), ENT_QUOTES);
    $description = $smcFunc['htmlspecialchars']($_REQUEST['descript'], ENT_QUOTES);
    $url = addslashes(trim($_POST['url']));
    $catid = (int) $_REQUEST['catid'];
    $dbresult = $smcFunc['db_query']('', "\n\tSELECT \n\t\tID_CAT, title, description, image, ID_PARENT \n\tFROM {db_prefix}links_cat \n\tWHERE ID_CAT = {$catid}");
    $row = $smcFunc['db_fetch_assoc']($dbresult);
    if (empty($row['ID_CAT'])) {
        fatal_error($txt['smflinks_nocatselected'], false);
    }
    GetCatPermission($catid, 'editlink');
    if ($title == '') {
        fatal_error($txt['smflinks_nolinktitle'], false);
    }
    if ($url == '') {
        fatal_error($txt['smflinks_nolinkurl'], false);
    }
    $alexa = 0;
    $pagerank = 0;
    // Update the link
    $smcFunc['db_query']('', "UPDATE {db_prefix}links\n\t\tSET title = '{$title}',url= '{$url}', description = '{$description}', alexa = {$alexa}, pagerank = {$pagerank}, ID_CAT = {$catid} WHERE ID_LINK = {$id} LIMIT 1");
    // Redirect back to category
    redirectexit('action=links');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:43,代码来源:Links2.php

示例9: EditLink2

function EditLink2()
{
    global $smcFunc, $txt, $user_info, $sourcedir;
    is_not_guest();
    checkSession('post');
    if (!empty($_REQUEST['id'])) {
        $id = (int) $_REQUEST['id'];
    }
    if (empty($_REQUEST['id'])) {
        fatal_error($txt['smflinks_nolinkselected']);
    }
    $dbresult = $smcFunc['db_query']('', '
		SELECT ID_MEMBER
		FROM {db_prefix}links
		WHERE ID_LINK = {int:this_id}
		LIMIT 1', array('this_id' => $id));
    $row = $smcFunc['db_fetch_assoc']($dbresult);
    $smcFunc['db_free_result']($dbresult);
    if (!allowedTo('edit_links_any') && (!allowedTo('edit_links_own') || $row['ID_MEMBER'] != $user_info['id'])) {
        fatal_error($txt['smflinks_perm_link_no_edit']);
    }
    // If we came from WYSIWYG then turn it back into BBC regardless.
    if (!empty($_REQUEST['descript_mode']) && isset($_REQUEST['descript'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $_REQUEST['descript'] = un_htmlspecialchars(html_to_bbc($_REQUEST['descript']));
    }
    // Clean the input
    if (!empty($_POST['title'])) {
        $title = $smcFunc['htmlspecialchars'](trim($_POST['title']), ENT_QUOTES);
    } else {
        $title = '';
    }
    if (!empty($_REQUEST['descript'])) {
        $description = $smcFunc['htmlspecialchars']($_REQUEST['descript'], ENT_QUOTES);
    } else {
        $description = '';
    }
    if (!empty($_POST['url'])) {
        $url = addslashes(trim($_POST['url']));
    } else {
        $url = '';
    }
    if (!empty($_REQUEST['catid'])) {
        $catid = (int) $_REQUEST['catid'];
    } else {
        $catid = 0;
    }
    if (empty($catid)) {
        fatal_error($txt['smflinks_nocatselected']);
    }
    $dbresult = $smcFunc['db_query']('', '
		SELECT ID_CAT, title, description, image, ID_PARENT 
		FROM {db_prefix}links_cat 
		WHERE ID_CAT = {int:this_cat}', array('this_cat' => $catid));
    $row = $smcFunc['db_fetch_assoc']($dbresult);
    if (empty($row['ID_CAT'])) {
        fatal_error($txt['smflinks_nocatselected'], false);
    }
    GetCatPermission($catid, 'editlink');
    if (empty($title)) {
        fatal_error($txt['smflinks_nolinktitle'], false);
    } elseif (empty($url)) {
        fatal_error($txt['smflinks_nolinkurl'], false);
    }
    $alexa = 0;
    $pagerank = 0;
    // Update the link
    $smcFunc['db_query']('', '
		UPDATE {db_prefix}links
		SET
			title = {string:title},
			url = {string:url},
			description = {string:description},
			alexa = {int:alexa},
			pagerank = {int:pagerank},
			ID_CAT = {int:this_cat}
		WHERE ID_LINK = {int:this_id}
		LIMIT 1', array('title' => $title, 'url' => $url, 'description' => $description, 'alexa' => $alexa, 'pagerank' => $pagerank, 'this_cat' => $catid, 'this_id' => $id));
    // Redirect back to category
    redirectexit('action=links');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:81,代码来源:Links2.php

示例10: sportal_admin_block_edit

function sportal_admin_block_edit()
{
    global $txt, $context, $modSettings, $smcFunc, $sourcedir, $boarddir, $boards;
    // Just in case, the admin could be doing something silly like editing a SP block while SP it disabled. ;)
    require_once $sourcedir . '/PortalBlocks.php';
    $context['SPortal']['is_new'] = empty($_REQUEST['block_id']);
    // BBC Fix move the parameter to the correct position.
    if (!empty($_POST['bbc_name'])) {
        $_POST['parameters'][$_POST['bbc_name']] = !empty($_POST[$_POST['bbc_parameter']]) ? $_POST[$_POST['bbc_parameter']] : '';
        // If we came from WYSIWYG then turn it back into BBC regardless.
        if (!empty($_REQUEST['bbc_' . $_POST['bbc_name'] . '_mode']) && isset($_POST['parameters'][$_POST['bbc_name']])) {
            require_once $sourcedir . '/Subs-Editor.php';
            $_POST['parameters'][$_POST['bbc_name']] = html_to_bbc($_POST['parameters'][$_POST['bbc_name']]);
            // We need to unhtml it now as it gets done shortly.
            $_POST['parameters'][$_POST['bbc_name']] = un_htmlspecialchars($_POST['parameters'][$_POST['bbc_name']]);
            // We need this for everything else.
            $_POST['parameters'][$_POST['bbc_name']] = $_POST['parameters'][$_POST['bbc_name']];
        }
    }
    // Passing the selected type via $_GET instead of $_POST?
    $start_parameters = array();
    if (!empty($_GET['selected_type']) && empty($_POST['selected_type'])) {
        $_POST['selected_type'] = array($_GET['selected_type']);
        if (!empty($_GET['parameters'])) {
            foreach ($_GET['parameters'] as $param) {
                if (isset($_GET[$param])) {
                    $start_parameters[$param] = $_GET[$param];
                }
            }
        }
    }
    if ($context['SPortal']['is_new'] && empty($_POST['selected_type']) && empty($_POST['add_block'])) {
        $context['SPortal']['block_types'] = getFunctionInfo();
        if (!empty($_REQUEST['col'])) {
            $context['SPortal']['block']['column'] = $_REQUEST['col'];
        }
        $context['sub_template'] = 'block_select_type';
        $context['page_title'] = $txt['sp-blocksAdd'];
    } elseif ($context['SPortal']['is_new'] && !empty($_POST['selected_type'])) {
        $context['SPortal']['block'] = array('id' => 0, 'label' => $txt['sp-blocksDefaultLabel'], 'type' => $_POST['selected_type'][0], 'type_text' => !empty($txt['sp_function_' . $_POST['selected_type'][0] . '_label']) ? $txt['sp_function_' . $_POST['selected_type'][0] . '_label'] : $txt['sp_function_unknown_label'], 'column' => !empty($_POST['block_column']) ? $_POST['block_column'] : 0, 'row' => 0, 'permission_set' => 3, 'groups_allowed' => array(), 'groups_denied' => array(), 'state' => 1, 'force_view' => 0, 'display' => '', 'display_custom' => '', 'style' => '', 'parameters' => !empty($start_parameters) ? $start_parameters : array(), 'options' => $_POST['selected_type'][0](array(), false, true), 'list_blocks' => !empty($_POST['block_column']) ? getBlockInfo($_POST['block_column']) : array());
    } elseif (!$context['SPortal']['is_new'] && empty($_POST['add_block'])) {
        $_REQUEST['block_id'] = (int) $_REQUEST['block_id'];
        $context['SPortal']['block'] = current(getBlockInfo(null, $_REQUEST['block_id']));
        $context['SPortal']['block'] += array('options' => $context['SPortal']['block']['type'](array(), false, true), 'list_blocks' => getBlockInfo($context['SPortal']['block']['column']));
    }
    if (!empty($_POST['preview_block'])) {
        // Just in case, the admin could be doing something silly like editing a SP block while SP it disabled. ;)
        require_once $boarddir . '/SSI.php';
        sportal_init_headers();
        loadTemplate('Portal');
        $type_parameters = $_POST['block_type'](array(), 0, true);
        if (!empty($_POST['parameters']) && is_array($_POST['parameters']) && !empty($type_parameters)) {
            foreach ($type_parameters as $name => $type) {
                if (isset($_POST['parameters'][$name])) {
                    if ($type == 'bbc') {
                        $parameter['value'] = $_POST['parameters'][$name];
                        require_once $sourcedir . '/Subs-Post.php';
                        $parameter['value'] = $smcFunc['htmlspecialchars']($parameter['value'], ENT_QUOTES);
                        preparsecode($parameter['value']);
                        $_POST['parameters'][$name] = $parameter['value'];
                    } elseif ($type == 'boards' || $type == 'board_select') {
                        $_POST['parameters'][$name] = is_array($_POST['parameters'][$name]) ? implode('|', $_POST['parameters'][$name]) : $_POST['parameters'][$name];
                    } elseif ($type == 'int' || $type == 'select') {
                        $_POST['parameters'][$name] = (int) $_POST['parameters'][$name];
                    } elseif ($type == 'text' || $type == 'textarea' || is_array($type)) {
                        $_POST['parameters'][$name] = $smcFunc['htmlspecialchars']($_POST['parameters'][$name], ENT_QUOTES);
                    } elseif ($type == 'check') {
                        $_POST['parameters'][$name] = !empty($_POST['parameters'][$name]) ? 1 : 0;
                    }
                }
            }
        } else {
            $_POST['parameters'] = array();
        }
        if (empty($_POST['display_advanced'])) {
            if (!empty($_POST['display_simple']) && in_array($_POST['display_simple'], array('all', 'sportal', 'sforum', 'allaction', 'allboard', 'allpages'))) {
                $display = $_POST['display_simple'];
            } else {
                $display = '';
            }
            $custom = '';
        } else {
            $display = array();
            $custom = array();
            if (!empty($_POST['display_actions'])) {
                foreach ($_POST['display_actions'] as $action) {
                    $display[] = $smcFunc['htmlspecialchars']($action, ENT_QUOTES);
                }
            }
            if (!empty($_POST['display_boards'])) {
                foreach ($_POST['display_boards'] as $board) {
                    $display[] = 'b' . (int) substr($board, 1);
                }
            }
            if (!empty($_POST['display_pages'])) {
                foreach ($_POST['display_pages'] as $page) {
                    $display[] = 'p' . (int) substr($page, 1);
                }
            }
            if (!empty($_POST['display_custom'])) {
//.........这里部分代码省略.........
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:101,代码来源:PortalAdminBlocks.php

示例11: TPmodules


//.........这里部分代码省略.........
        redirectexit('topic=' . $t . '.0');
    } elseif (substr($tpsub, 0, 9) == 'saveblock') {
        $whatID = substr($tpsub, 9);
        if (!is_numeric($whatID)) {
            fatal_error($txt['tp-notablock']);
        }
        $request = $smcFunc['db_query']('', '
			SELECT editgroups FROM {db_prefix}tp_blocks 
			WHERE id = {int:blockid} LIMIT 1', array('blockid' => $whatID));
        if ($smcFunc['db_num_rows']($request) > 0) {
            $row = $smcFunc['db_fetch_assoc']($request);
            // check permission
            if (allowedTo('tp_blocks') || get_perm($row['editgroups'])) {
                $ok = true;
            } else {
                fatal_error($txt['tp-blocknotallowed']);
            }
            $smcFunc['db_free_result']($request);
            // loop through the values and save them
            foreach ($_POST as $what => $value) {
                if (substr($what, 0, 10) == 'blocktitle') {
                    // make sure special charachters can't be done
                    $value = strip_tags($value);
                    $value = preg_replace('~&#\\d+$~', '', $value);
                    $val = substr($what, 10);
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_blocks 
						SET title = {string:title} 
						WHERE id = {int:blockid}', array('title' => $value, 'blockid' => $val));
                } elseif (substr($what, 0, 9) == 'blockbody' && substr($what, -4) != 'mode') {
                    // If we came from WYSIWYG then turn it back into BBC regardless.
                    if (!empty($_REQUEST[$what . '_mode']) && isset($_REQUEST[$what])) {
                        require_once $sourcedir . '/Subs-Editor.php';
                        $_REQUEST[$what] = html_to_bbc($_REQUEST[$what]);
                        // We need to unhtml it now as it gets done shortly.
                        $_REQUEST[$what] = un_htmlspecialchars($_REQUEST[$what]);
                        // We need this for everything else.
                        $value = $_POST[$what] = $_REQUEST[$what];
                    }
                    $val = (int) substr($what, 9);
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_blocks 
						SET body = {string:body} 
						WHERE id = {int:blockid}', array('body' => $value, 'blockid' => $val));
                } elseif (substr($what, 0, 10) == 'blockframe') {
                    $val = substr($what, 10);
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_blocks 
						SET frame = {string:frame}
						WHERE id = {int:blockid}', array('frame' => $value, 'blockid' => $val));
                } elseif (substr($what, 0, 12) == 'blockvisible') {
                    $val = substr($what, 12);
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_blocks 
						SET visible = {string:vis}
						WHERE id = {int:blockid}', array('vis' => $value, 'blockid' => $val));
                } elseif (substr($what, 0, 9) == 'blockvar1') {
                    $val = substr($what, 9);
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_blocks 
						SET var1 = {string:var1}
						WHERE id = {int:blockid}', array('var1' => $value, 'blockid' => $val));
                } elseif (substr($what, 0, 9) == 'blockvar2') {
                    $val = substr($what, 9);
                    $smcFunc['db_query']('', '
						UPDATE {db_prefix}tp_blocks 
开发者ID:DiegoCortes,项目名称:TinyPortal,代码行数:67,代码来源:TPmodules.php

示例12: EditTopic2

function EditTopic2()
{
    global $smcFunc, $txt, $sourcedir;
    $id = (int) $_REQUEST['id'];
    // If we came from WYSIWYG then turn it back into BBC regardless.
    if (!empty($_REQUEST['topicbody_mode']) && isset($_REQUEST['topicbody'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $_REQUEST['topicbody'] = html_to_bbc($_REQUEST['topicbody']);
        // We need to unhtml it now as it gets done shortly.
        $_REQUEST['topicbody'] = un_htmlspecialchars($_REQUEST['topicbody']);
    }
    $topicsubject = $smcFunc['htmlspecialchars']($_REQUEST['topicsubject'], ENT_QUOTES);
    $topicbody = $smcFunc['htmlspecialchars']($_REQUEST['topicbody'], ENT_QUOTES);
    if ($topicsubject == '') {
        fatal_error($txt['welcome_err_nosubject'], false);
    }
    if ($topicbody == '') {
        fatal_error($txt['welcome_err_nobody'], false);
    }
    // Update the Topic
    $smcFunc['db_query']('', "UPDATE {db_prefix}welcome \n\t\tSET welcomesubject = {string:topicsubject}, welcomebody = {string:topicbody} \n\t\tWHERE ID = {$id} LIMIT 1", array('topicsubject' => $topicsubject, 'topicbody' => $topicbody));
    // Redirect to the main settings
    redirectexit('action=admin;area=welcome;sa=admin');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:24,代码来源:WelcomeTopic2.php

示例13: PortaMx_AdminBlocks


//.........这里部分代码省略.........
                    }
                }
                // edit block canceled ?
                if (!empty($_POST['cancel_edit'])) {
                    $context['pmx']['function'] = 'overview';
                } elseif (empty($_POST['edit_block']) && empty($_POST['add_new_block']) && ($context['pmx']['function'] == 'editnew' || $context['pmx']['function'] == 'edit')) {
                    // check defined numeric vars (check_num_vars holds the posted array to check like [varname][varname] ...)
                    if (isset($_POST['check_num_vars'])) {
                        foreach ($_POST['check_num_vars'] as $val) {
                            $data = explode(',', $val);
                            $post = '$_POST' . str_replace(array('[', ']'), array('[\'', '\']'), $data[0]);
                            if (eval("return isset({$post});") && eval("return !is_numeric({$post});")) {
                                eval("{$post} = {$data['1']};");
                            }
                        }
                    }
                    // add a change date to config array
                    $_POST['config']['created'] = time();
                    // blocktype change?
                    if (!empty($_POST['chg_blocktype'])) {
                        if (isset($_POST['content']) && PortaMx_makeSafeContent($_POST['content']) != '') {
                            // convert html/script to bbc
                            if ($_POST['blocktype'] == 'bbc_script' && in_array($_POST['contenttype'], array('html', 'script'))) {
                                $_POST['content'] = PortaMx_SmileyToBBC($_POST['content']);
                                if (preg_match_all('/<img.*(style[^\\"]*\\"([^\\"]*\\"))[^>]*>/U', $_POST['content'], $match) > 0) {
                                    foreach ($match[0] as $key => $val) {
                                        $repl = ' ' . str_replace(array('"', ': ', ':', 'px;'), array('', '="', '="', '" '), $match[2][$key]);
                                        $_POST['content'] = str_replace($val, str_replace($match[1][$key], $repl, $val), $_POST['content']);
                                    }
                                }
                                require_once $sourcedir . '/Subs-Editor.php';
                                $modSettings['smiley_enable'] = true;
                                $user_info['smiley_set'] = 'PortaMx';
                                $_POST['content'] = html_to_bbc($_POST['content']);
                            } elseif ($_POST['contenttype'] == 'bbc_script' && in_array($_POST['blocktype'], array('html', 'script'))) {
                                $_POST['content'] = PortaMx_BBCsmileys(parse_bbc(PortaMx_makeSafeContent($_POST['content'], $_POST['contenttype']), false));
                                $_POST['content'] = str_replace(array('<hr>', '<br>'), array('<hr />', '<br />'), $_POST['content']);
                                $_POST['content'] = preg_replace_callback('/<\\/[^>]*>|<[^\\/]*\\/>|<ul[^>]*>|<ol[^>]*>/', create_function('$matches', 'return $matches[0] ."\\n";'), $_POST['content']);
                                if (preg_match_all('/<img[^w]*(width=\\"([0-9]+)\\")(\\sheight=\\"([\\s0-9]+)\\")[^>]*>/', $_POST['content'], $match) > 0) {
                                    foreach ($match[0] as $key => $val) {
                                        $_POST['content'] = str_replace($match[1][$key], '', $_POST['content']);
                                        $_POST['content'] = str_replace($match[3][$key], 'style="width: ' . $match[2][$key] . 'px;height: ' . $match[4][$key] . 'px;"', $_POST['content']);
                                    }
                                    $_POST['content'] = preg_replace('/px;"[^c]*class=/', 'px;" class=', $_POST['content']);
                                }
                            } elseif ($_POST['blocktype'] == 'php') {
                                if ($_POST['contenttype'] == 'php') {
                                    pmxPHP_convert();
                                }
                            }
                        }
                        $id = $_POST['id'];
                    }
                    // save data
                    if (empty($_POST['move_block']) && (!empty($_POST['save_edit']) || !empty($_POST['save_edit_continue']) || !empty($_POST['chg_blocktype']))) {
                        if ($_POST['blocktype'] == 'php' && $_POST['contenttype'] == 'php') {
                            pmxPHP_convert();
                        } elseif ($_POST['blocktype'] == 'html') {
                            $_POST['content'] = str_replace('/ckeditor/../Smileys/', '/Smileys/', $_POST['content']);
                            if (preg_match_all('~<img.*(class[^r]*resized[^\\"]*\\")[^>]*>~', $_POST['content'], $match) > 0) {
                                foreach ($match[0] as $key => $val) {
                                    $endChr = substr($val, -2) !== '/>' ? array('>', ' />') : array(' />', '/>');
                                    $repl = str_replace($match[1][$key], '', $val);
                                    $_POST['content'] = str_replace($val, str_replace($endChr[0], ' class="bbc_img resized"' . $endChr[1], $repl), $_POST['content']);
                                }
                            } elseif (preg_match_all('~<img[^>]*>~', $_POST['content'], $match) > 0) {
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:67,代码来源:AdminBlocks.php

示例14: KB_wysig_descript

function KB_wysig_descript()
{
    global $sourcedir;
    require_once $sourcedir . '/Subs-Editor.php';
    if (!empty($_REQUEST['description_mode']) && isset($_REQUEST['description'])) {
        $_REQUEST['description'] = html_to_bbc($_REQUEST['description']);
        $_REQUEST['description'] = un_htmlspecialchars($_REQUEST['description']);
        $_POST['description'] = $_REQUEST['description'];
    }
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:10,代码来源:KBSubs.php

示例15: do_postchecks


//.........这里部分代码省略.........
            }
            if (isset($od['code'])) {
                $body = tp_convertphp($od['code']);
                $type = 10;
            } else {
                $body = '';
            }
            if (isset($cp)) {
                $smcFunc['db_insert']('INSERT', '{db_prefix}tp_blocks', array('type' => 'int', 'frame' => 'string', 'title' => 'string', 'body' => 'string', 'access' => 'string', 'bar' => 'int', 'pos' => 'int', 'off' => 'int', 'visible' => 'string', 'var1' => 'int', 'var2' => 'int', 'lang' => 'string', 'access2' => 'string', 'editgroups' => 'string'), array($cp['type'], $cp['frame'], $title, $cp['body'], $cp['access'], $panel, 0, 1, 1, $cp['var1'], $cp['var2'], $cp['lang'], $cp['access2'], $cp['editgroups']), array('id'));
            } else {
                $smcFunc['db_insert']('INSERT', '{db_prefix}tp_blocks', array('type' => 'int', 'frame' => 'string', 'title' => 'string', 'body' => 'string', 'access' => 'string', 'bar' => 'int', 'pos' => 'int', 'off' => 'int', 'visible' => 'string', 'var1' => 'int', 'var2' => 'int', 'lang' => 'string', 'access2' => 'string', 'editgroups' => 'string'), array($type, 'theme', $title, $body, '-1,0,1', $panel, 0, 1, 1, 0, 0, '', 'actio=allpages', ''), array('id'));
            }
            $where = $smcFunc['db_insert_id']('{db_prefix}tp_blocks', 'id');
            if (!empty($where)) {
                redirectexit('action=tpadmin;blockedit=' . $where . ';sesc=' . $context['session_id']);
            } else {
                redirectexit('action=tpadmin;sa=blocks');
            }
        } elseif ($from == 'blockedit') {
            checkSession('post');
            isAllowedTo('tp_blocks');
            $where = is_numeric($_POST['tpadmin_form_id']) ? $_POST['tpadmin_form_id'] : 0;
            $tpgroups = array();
            $editgroups = array();
            $access = array();
            $lang = array();
            foreach ($_POST as $what => $value) {
                if (substr($what, 0, 9) == 'tp_block_') {
                    $setting = substr($what, 9);
                    if ($setting == 'body') {
                        // If we came from WYSIWYG then turn it back into BBC regardless.
                        if (!empty($_REQUEST['tp_block_body_mode']) && isset($_REQUEST['tp_block_body'])) {
                            require_once $sourcedir . '/Subs-Editor.php';
                            $_REQUEST['tp_block_body'] = html_to_bbc($_REQUEST['tp_block_body']);
                            // We need to unhtml it now as it gets done shortly.
                            $_REQUEST['tp_block_body'] = un_htmlspecialchars($_REQUEST['tp_block_body']);
                            // We need this for everything else.
                            $value = $_POST['tp_block_body'] = $_REQUEST['tp_block_body'];
                        }
                        // PHP block?
                        if ($_POST['tp_block_type'] == 10) {
                            $value = tp_convertphp($value);
                        }
                        $smcFunc['db_query']('', '
							UPDATE {db_prefix}tp_blocks 
							SET ' . $setting . ' = {string:value} 
							WHERE id = {int:blockid}', array('value' => $value, 'blockid' => $where));
                    } elseif ($setting == 'title') {
                        $smcFunc['db_query']('', '
							UPDATE {db_prefix}tp_blocks 
							SET title = {string:title} 
							WHERE id = {int:blockid}', array('title' => $value, 'blockid' => $where));
                    } elseif ($setting == 'body_mode' || $setting == 'body_choice' || $setting == 'body_pure') {
                        $go = '';
                    } elseif ($setting == 'frame') {
                        $smcFunc['db_query']('', '
							UPDATE {db_prefix}tp_blocks 
							SET frame = {string:val}
							WHERE id = {int:blockid}', array('val' => $value, 'blockid' => $where));
                    } else {
                        $smcFunc['db_query']('', '
							UPDATE {db_prefix}tp_blocks 
							SET ' . $setting . ' = {raw:val}
							WHERE id = {int:blockid}', array('val' => $value, 'blockid' => $where));
                    }
                } elseif (substr($what, 0, 8) == 'tp_group') {
开发者ID:rhodefey,项目名称:TinyPortal-SMF2.1,代码行数:67,代码来源:TPortalAdmin.php


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