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


PHP boardsAllowedTo函数代码示例

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


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

示例1: loadRelated

function loadRelated($topic)
{
    global $modSettings, $context, $smcFunc;
    $context['can_approve_posts_boards'] = boardsAllowedTo('approve_posts', false);
    // Otherwise use customized fulltext index
    $request = $smcFunc['db_query']('', '
		SELECT IF(rt.id_topic_first = {int:topic}, rt.id_topic_second, rt.id_topic_first) AS id_topic
		FROM {db_prefix}related_topics AS rt
			JOIN {db_prefix}topics AS t ON (t.id_topic = IF(rt.id_topic_first = {int:topic}, rt.id_topic_second, rt.id_topic_first))
			JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
		WHERE (id_topic_first = {int:topic} OR id_topic_second = {int:topic})
			AND {query_see_board}
		ORDER BY rt.score DESC
		LIMIT {int:limit}', array('topic' => $topic, 'limit' => $modSettings['relatedTopicsCount']));
    if ($smcFunc['db_num_rows']($request) == 0) {
        $smcFunc['db_free_result']($request);
        return false;
    }
    $topics_ids = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $topics_ids[] = $row['id_topic'];
    }
    $smcFunc['db_free_result']($request);
    return prepareTopicArray($topics_ids);
}
开发者ID:ahrasis,项目名称:Related-Topics,代码行数:25,代码来源:Subs-Related.php

示例2: action_attachapprove

 /**
  * Called from a mouse click,
  * works out what we want to do with attachments and actions it.
  * Accessed by ?action=attachapprove
  */
 public function action_attachapprove()
 {
     global $user_info;
     // Security is our primary concern...
     checkSession('get');
     // If it approve or delete?
     $is_approve = !isset($_GET['sa']) || $_GET['sa'] != 'reject' ? true : false;
     $attachments = array();
     require_once SUBSDIR . '/ManageAttachments.subs.php';
     // If we are approving all ID's in a message , get the ID's.
     if ($_GET['sa'] == 'all' && !empty($_GET['mid'])) {
         $id_msg = (int) $_GET['mid'];
         $attachments = attachmentsOfMessage($id_msg);
     } elseif (!empty($_GET['aid'])) {
         $attachments[] = (int) $_GET['aid'];
     }
     if (empty($attachments)) {
         fatal_lang_error('no_access', false);
     }
     // @todo nb: this requires permission to approve posts, not manage attachments
     // Now we have some ID's cleaned and ready to approve, but first - let's check we have permission!
     $allowed_boards = !empty($user_info['mod_cache']['ap']) ? $user_info['mod_cache']['ap'] : boardsAllowedTo('approve_posts');
     if ($allowed_boards == array(0)) {
         $approve_query = '';
     } elseif (!empty($allowed_boards)) {
         $approve_query = ' AND m.id_board IN (' . implode(',', $allowed_boards) . ')';
     } else {
         $approve_query = ' AND 0';
     }
     // Validate the attachments exist and have the right approval state.
     $attachments = validateAttachments($attachments, $approve_query);
     // Set up a return link based off one of the attachments for this message
     $attach_home = attachmentBelongsTo($attachments[0]);
     $redirect = 'topic=' . $attach_home['id_topic'] . '.msg' . $attach_home['id_msg'] . '#msg' . $attach_home['id_msg'];
     if (empty($attachments)) {
         fatal_lang_error('no_access', false);
     }
     // Finally, we are there. Follow through!
     if ($is_approve) {
         // Checked and deemed worthy.
         approveAttachments($attachments);
     } else {
         removeAttachments(array('id_attach' => $attachments, 'do_logging' => true));
     }
     // We approved or removed, either way we reset those numbers
     cache_put_data('num_menu_errors', null, 900);
     // Return to the topic....
     redirectexit($redirect);
 }
开发者ID:KeiroD,项目名称:Elkarte,代码行数:54,代码来源:ModerateAttachments.controller.php

示例3: LikesByUser

/**
 * @param $memID 		int id_member
 *
 * fetch all likes received by the given user and display them
 * part of the profile -> show content area.
 */
function LikesByUser($memID)
{
    global $context, $user_info, $scripturl, $memberContext, $txt, $modSettings, $options;
    if ($memID != $user_info['id']) {
        isAllowedTo('can_view_ratings');
    }
    // let us use the same value as for topics per page here.
    $perpage = empty($modSettings['disableCustomPerPage']) && !empty($options['topics_per_page']) ? $options['topics_per_page'] : $modSettings['defaultMaxTopics'];
    $out = $_GET['sa'] === 'likesout';
    // display likes *given* instead of received ones
    $is_owner = $user_info['id'] == $memID;
    // we are the owner of this profile, this is important for proper formatting (you/yours etc.)
    $boards_like_see = boardsAllowedTo('like_see');
    // respect permissions
    $start = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
    if (!($user_info['is_admin'] || allowedTo('moderate_forum'))) {
        // admins and global mods can see everything
        $bq = ' AND b.id_board IN({array_int:boards})';
    } else {
        $bq = '';
    }
    $q = $out ? 'l.id_user = {int:id_user}' : 'l.id_receiver = {int:id_user}';
    $request = smf_db_query('SELECT count(l.id_msg) FROM {db_prefix}likes AS l
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = l.id_msg)
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			WHERE ' . $q . ' AND {query_see_board}' . $bq, array('id_user' => $memID, 'boards' => $boards_like_see));
    list($context['total_likes']) = mysql_fetch_row($request);
    mysql_free_result($request);
    $request = smf_db_query('SELECT m.subject, m.id_topic, l.id_user, l.id_receiver, l.updated, l.id_msg, l.rtype, mfirst.subject AS first_subject, SUBSTRING(m.body, 1, 150) AS body FROM {db_prefix}likes AS l
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = l.id_msg)
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			INNER JOIN {db_prefix}messages AS mfirst ON (mfirst.id_msg = t.id_first_msg)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			WHERE ' . $q . ' AND {query_see_board} ' . $bq . ' ORDER BY l.id_like DESC LIMIT {int:startwith}, {int:perpage}', array('id_user' => $memID, 'startwith' => $start, 'perpage' => $perpage, 'boards' => $boards_like_see));
    $context['results_count'] = 0;
    $context['likes'] = array();
    $context['displaymode'] = $out ? true : false;
    $context['pages'] = '';
    if ($context['total_likes'] > $perpage) {
        $context['pages'] = constructPageIndex($scripturl . '?action=profile;area=showposts;sa=' . $_GET['sa'] . ';u=' . trim($memID), $start, $context['total_likes'], $perpage);
    }
    $users = array();
    while ($row = mysql_fetch_assoc($request)) {
        $context['results_count']++;
        $thref = URL::topic($row['id_topic'], $row['first_subject'], 0);
        $phref = URL::topic($row['id_topic'], $row['subject'], 0, false, '.msg' . $row['id_msg'], '#msg' . $row['id_msg']);
        $users[] = $out ? $row['id_receiver'] : $row['id_user'];
        $context['likes'][] = array('id_user' => $out ? $row['id_receiver'] : $row['id_user'], 'time' => timeformat($row['updated']), 'topic' => array('href' => $thref, 'link' => '<a href="' . $thref . '">' . $row['first_subject'] . '</a>', 'subject' => $row['first_subject']), 'post' => array('href' => $phref, 'link' => '<a href="' . $phref . '">' . $row['subject'] . '</a>', 'subject' => $row['subject'], 'id' => $row['id_msg']), 'rtype' => $row['rtype'], 'teaser' => strip_tags(preg_replace('~[[\\/\\!]*?[^\\[\\]]*?]~si', '', $row['body'])) . '...', 'morelink' => URL::parse('?msg=' . $row['id_msg'] . ';perma'));
    }
    loadMemberData(array_unique($users));
    foreach ($context['likes'] as &$like) {
        loadMemberContext($like['id_user']);
        $like['member'] =& $memberContext[$like['id_user']];
        $like['text'] = $out ? $is_owner ? sprintf($txt['liked_a_post'], $is_owner ? $txt['you_liker'] : $memberContext[$memID]['name'], $memberContext[$like['id_user']]['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : sprintf($txt['liked_a_post'], $is_owner ? $txt['you_liker'] : $memberContext[$memID]['name'], $memberContext[$like['id_user']]['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : ($is_owner ? sprintf($txt['liked_your_post'], $like['id_user'] == $user_info['id'] ? $txt['you_liker'] : $like['member']['link'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']) : sprintf($txt['liked_a_post'], $like['id_user'] == $user_info['id'] ? $txt['you_liker'] : $like['member']['link'], $memberContext[$memID]['name'], $like['post']['href'], $like['topic']['link'], $modSettings['ratings'][$like['rtype']]['text']));
    }
    mysql_free_result($request);
    EoS_Smarty::getConfigInstance()->registerHookTemplate('profile_content_area', 'ratings/profile_display');
}
开发者ID:norv,项目名称:EosAlpha,代码行数:65,代码来源:Ratings.php

示例4: MoveTopic2

function MoveTopic2()
{
    global $txt, $board, $topic, $scripturl, $sourcedir, $modSettings, $context;
    global $board, $language, $user_info, $smcFunc;
    if (empty($topic)) {
        fatal_lang_error('no_access', false);
    }
    // You can't choose to have a redirection topic and use an empty reason.
    if (isset($_POST['postRedirect']) && (!isset($_POST['reason']) || trim($_POST['reason']) == '')) {
        fatal_lang_error('movetopic_no_reason', false);
    }
    // Make sure this form hasn't been submitted before.
    checkSubmitOnce('check');
    $request = $smcFunc['db_query']('', '
		SELECT id_member_started, id_first_msg, approved
		FROM {db_prefix}topics
		WHERE id_topic = {int:current_topic}
		LIMIT 1', array('current_topic' => $topic));
    list($id_member_started, $id_first_msg, $context['is_approved']) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    // Can they see it?
    if (!$context['is_approved']) {
        isAllowedTo('approve_posts');
    }
    // Can they move topics on this board?
    if (!allowedTo('move_any')) {
        if ($id_member_started == $user_info['id']) {
            isAllowedTo('move_own');
            $boards = array_merge(boardsAllowedTo('move_own'), boardsAllowedTo('move_any'));
        } else {
            isAllowedTo('move_any');
        }
    } else {
        $boards = boardsAllowedTo('move_any');
    }
    // If this topic isn't approved don't let them move it if they can't approve it!
    if ($modSettings['postmod_active'] && !$context['is_approved'] && !allowedTo('approve_posts')) {
        // Only allow them to move it to other boards they can't approve it in.
        $can_approve = boardsAllowedTo('approve_posts');
        $boards = array_intersect($boards, $can_approve);
    }
    checkSession();
    require_once $sourcedir . '/Subs-Post.php';
    // The destination board must be numeric.
    $_POST['toboard'] = (int) $_POST['toboard'];
    // Make sure they can see the board they are trying to move to (and get whether posts count in the target board).
    $request = $smcFunc['db_query']('', '
		SELECT b.count_posts, b.name, m.subject
		FROM {db_prefix}boards AS b
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = {int:current_topic})
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
		WHERE {query_see_board}
			AND b.id_board = {int:to_board}
			AND b.redirect = {string:blank_redirect}
		LIMIT 1', array('current_topic' => $topic, 'to_board' => $_POST['toboard'], 'blank_redirect' => ''));
    if ($smcFunc['db_num_rows']($request) == 0) {
        fatal_lang_error('no_board');
    }
    list($pcounter, $board_name, $subject) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    // Remember this for later.
    $_SESSION['move_to_topic'] = $_POST['toboard'];
    // Rename the topic...
    if (isset($_POST['reset_subject'], $_POST['custom_subject']) && $_POST['custom_subject'] != '') {
        $_POST['custom_subject'] = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['custom_subject'])), array("\r" => '', "\n" => '', "\t" => ''));
        // Keep checking the length.
        if ($smcFunc['strlen']($_POST['custom_subject']) > 100) {
            $_POST['custom_subject'] = $smcFunc['substr']($_POST['custom_subject'], 0, 100);
        }
        // If it's still valid move onwards and upwards.
        if ($_POST['custom_subject'] != '') {
            if (isset($_POST['enforce_subject'])) {
                // Get a response prefix, but in the forum's default language.
                if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) {
                    if ($language === $user_info['language']) {
                        $context['response_prefix'] = $txt['response_prefix'];
                    } else {
                        loadLanguage('index', $language, false);
                        $context['response_prefix'] = $txt['response_prefix'];
                        loadLanguage('index');
                    }
                    cache_put_data('response_prefix', $context['response_prefix'], 600);
                }
                $smcFunc['db_query']('', '
					UPDATE {db_prefix}messages
					SET subject = {string:subject}
					WHERE id_topic = {int:current_topic}', array('current_topic' => $topic, 'subject' => $context['response_prefix'] . $_POST['custom_subject']));
            }
            $smcFunc['db_query']('', '
				UPDATE {db_prefix}messages
				SET subject = {string:custom_subject}
				WHERE id_msg = {int:id_first_msg}', array('id_first_msg' => $id_first_msg, 'custom_subject' => $_POST['custom_subject']));
            // Fix the subject cache.
            updateStats('subject', $topic, $_POST['custom_subject']);
        }
    }
    // Create a link to this in the old board.
    //!!! Does this make sense if the topic was unapproved before? I'd just about say so.
    if (isset($_POST['postRedirect'])) {
        // Should be in the boardwide language.
//.........这里部分代码省略.........
开发者ID:Kheros,项目名称:MMOver,代码行数:101,代码来源:MoveTopic.php

示例5: rebuildModCache

/**
 * Quickly find out what moderation authority this user has
 * - builds the moderator, group and board level querys for the user
 * - stores the information on the current users moderation powers in $user_info['mod_cache'] and $_SESSION['mc']
 */
function rebuildModCache()
{
    global $user_info, $smcFunc;
    // What groups can they moderate?
    $group_query = allowedTo('manage_membergroups') ? '1=1' : '0=1';
    if ($group_query == '0=1') {
        $request = $smcFunc['db_query']('', '
			SELECT id_group
			FROM {db_prefix}group_moderators
			WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
        $groups = array();
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $groups[] = $row['id_group'];
        }
        $smcFunc['db_free_result']($request);
        if (empty($groups)) {
            $group_query = '0=1';
        } else {
            $group_query = 'id_group IN (' . implode(',', $groups) . ')';
        }
    }
    // Then, same again, just the boards this time!
    $board_query = allowedTo('moderate_forum') ? '1=1' : '0=1';
    if ($board_query == '0=1') {
        $boards = boardsAllowedTo('moderate_board', true);
        if (empty($boards)) {
            $board_query = '0=1';
        } else {
            $board_query = 'id_board IN (' . implode(',', $boards) . ')';
        }
    }
    // What boards are they the moderator of?
    $boards_mod = array();
    if (!$user_info['is_guest']) {
        $request = $smcFunc['db_query']('', '
			SELECT id_board
			FROM {db_prefix}moderators
			WHERE id_member = {int:current_member}', array('current_member' => $user_info['id']));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $boards_mod[] = $row['id_board'];
        }
        $smcFunc['db_free_result']($request);
    }
    $mod_query = empty($boards_mod) ? '0=1' : 'b.id_board IN (' . implode(',', $boards_mod) . ')';
    $_SESSION['mc'] = array('time' => time(), 'id' => $user_info['id'] && $user_info['name'] ? $user_info['id'] : 0, 'gq' => $group_query, 'bq' => $board_query, 'ap' => boardsAllowedTo('approve_posts'), 'mb' => $boards_mod, 'mq' => $mod_query);
    call_integration_hook('integrate_mod_cache');
    $user_info['mod_cache'] = $_SESSION['mc'];
    // Might as well clean up some tokens while we are at it.
    cleanTokens();
}
开发者ID:albertlast,项目名称:SMF2.1,代码行数:55,代码来源:Subs-Auth.php

示例6: ViewWatchedUsers

function ViewWatchedUsers()
{
    global $smcFunc, $modSettings, $context, $txt, $scripturl, $user_info, $sourcedir;
    // Some important context!
    $context['page_title'] = $txt['mc_watched_users_title'];
    $context['view_posts'] = isset($_GET['sa']) && $_GET['sa'] == 'post';
    $context['start'] = isset($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
    loadTemplate('ModerationCenter');
    // Get some key settings!
    $modSettings['warning_watch'] = empty($modSettings['warning_watch']) ? 1 : $modSettings['warning_watch'];
    // Put some pretty tabs on cause we're gonna be doing hot stuff here...
    $context[$context['moderation_menu_name']]['tab_data'] = array('title' => $txt['mc_watched_users_title'], 'help' => '', 'description' => $txt['mc_watched_users_desc']);
    // First off - are we deleting?
    if (!empty($_REQUEST['delete'])) {
        checkSession(!is_array($_REQUEST['delete']) ? 'get' : 'post');
        $toDelete = array();
        if (!is_array($_REQUEST['delete'])) {
            $toDelete[] = (int) $_REQUEST['delete'];
        } else {
            foreach ($_REQUEST['delete'] as $did) {
                $toDelete[] = (int) $did;
            }
        }
        if (!empty($toDelete)) {
            require_once $sourcedir . '/RemoveTopic.php';
            // If they don't have permission we'll let it error - either way no chance of a security slip here!
            foreach ($toDelete as $did) {
                removeMessage($did);
            }
        }
    }
    // Start preparing the list by grabbing relevant permissions.
    if (!$context['view_posts']) {
        $approve_query = '';
        $delete_boards = array();
    } else {
        // Still obey permissions!
        $approve_boards = boardsAllowedTo('approve_posts');
        $delete_boards = boardsAllowedTo('delete_any');
        if ($approve_boards == array(0)) {
            $approve_query = '';
        } elseif (!empty($approve_boards)) {
            $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
        } else {
            $approve_query = ' AND 0';
        }
    }
    require_once $sourcedir . '/Subs-List.php';
    // This is all the information required for a watched user listing.
    $listOptions = array('id' => 'watch_user_list', 'title' => $txt['mc_watched_users_title'] . ' - ' . ($context['view_posts'] ? $txt['mc_watched_users_post'] : $txt['mc_watched_users_member']), 'width' => '100%', 'items_per_page' => $modSettings['defaultMaxMessages'], 'no_items_label' => $context['view_posts'] ? $txt['mc_watched_users_no_posts'] : $txt['mc_watched_users_none'], 'base_href' => $scripturl . '?action=moderate;area=userwatch;sa=' . ($context['view_posts'] ? 'post' : 'member'), 'default_sort_col' => $context['view_posts'] ? '' : 'member', 'get_items' => array('function' => $context['view_posts'] ? 'list_getWatchedUserPosts' : 'list_getWatchedUsers', 'params' => array($approve_query, $delete_boards)), 'get_count' => array('function' => $context['view_posts'] ? 'list_getWatchedUserPostsCount' : 'list_getWatchedUserCount', 'params' => array($approve_query)), 'columns' => array('member' => array('header' => array('value' => $txt['mc_watched_users_member']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=profile;u=%1$d">%2$s</a>', 'params' => array('id' => false, 'name' => false))), 'sort' => array('default' => 'real_name', 'reverse' => 'real_name DESC')), 'warning' => array('header' => array('value' => $txt['mc_watched_users_warning']), 'data' => array('function' => create_function('$member', '
						global $scripturl;

						return allowedTo(\'issue_warning\') ? \'<a href="\' . $scripturl . \'?action=profile;area=issuewarning;u=\' . $member[\'id\'] . \'">\' . $member[\'warning\'] . \'%</a>\' : $member[\'warning\'] . \'%\';
					')), 'sort' => array('default' => 'warning', 'reverse' => 'warning DESC')), 'posts' => array('header' => array('value' => $txt['posts']), 'data' => array('sprintf' => array('format' => '<a href="' . $scripturl . '?action=profile;u=%1$d;area=showposts;sa=messages">%2$s</a>', 'params' => array('id' => false, 'posts' => false))), 'sort' => array('default' => 'posts', 'reverse' => 'posts DESC')), 'last_login' => array('header' => array('value' => $txt['mc_watched_users_last_login']), 'data' => array('db' => 'last_login'), 'sort' => array('default' => 'last_login', 'reverse' => 'last_login DESC')), 'last_post' => array('header' => array('value' => $txt['mc_watched_users_last_post']), 'data' => array('function' => create_function('$member', '
						global $scripturl;

						if ($member[\'last_post_id\'])
							return \'<a href="\' . $scripturl . \'?msg=\' . $member[\'last_post_id\'] . \'">\' . $member[\'last_post\'] . \'</a>\';
						else
							return $member[\'last_post\'];
					')))), 'form' => array('href' => $scripturl . '?action=moderate;area=userwatch;sa=post', 'include_sort' => true, 'include_start' => true, 'hidden_fields' => array($context['session_var'] => $context['session_id'])), 'additional_rows' => array($context['view_posts'] ? array('position' => 'bottom_of_list', 'value' => '
					<input type="submit" name="delete_selected" value="' . $txt['quickmod_delete_selected'] . '" class="button_submit" />', 'align' => 'right') : array()));
    // If this is being viewed by posts we actually change the columns to call a template each time.
    if ($context['view_posts']) {
        $listOptions['columns'] = array('posts' => array('data' => array('function' => create_function('$post', '
						return template_user_watch_post_callback($post);
					'))));
    }
    // Create the watched user list.
    createList($listOptions);
    $context['sub_template'] = 'show_list';
    $context['default_list'] = 'watch_user_list';
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:73,代码来源:ModerationCenter.php

示例7: CalendarPost

function CalendarPost()
{
    global $context, $txt, $user_info, $sourcedir, $scripturl;
    global $modSettings, $topic, $smcFunc;
    // Well - can they?
    isAllowedTo('calendar_post');
    // We need this for all kinds of useful functions.
    require_once $sourcedir . '/Subs-Calendar.php';
    // Cast this for safety...
    if (isset($_REQUEST['eventid'])) {
        $_REQUEST['eventid'] = (int) $_REQUEST['eventid'];
    }
    // Submitting?
    if (isset($_POST[$context['session_var']], $_REQUEST['eventid'])) {
        checkSession();
        // Validate the post...
        if (!isset($_POST['link_to_board'])) {
            validateEventPost();
        }
        // If you're not allowed to edit any events, you have to be the poster.
        if ($_REQUEST['eventid'] > 0 && !allowedTo('calendar_edit_any')) {
            isAllowedTo('calendar_edit_' . (!empty($user_info['id']) && getEventPoster($_REQUEST['eventid']) == $user_info['id'] ? 'own' : 'any'));
        }
        // New - and directing?
        if ($_REQUEST['eventid'] == -1 && isset($_POST['link_to_board'])) {
            $_REQUEST['calendar'] = 1;
            require_once $sourcedir . '/Post.php';
            return Post();
        } elseif ($_REQUEST['eventid'] == -1) {
            $eventOptions = array('board' => 0, 'topic' => 0, 'title' => substr($_REQUEST['evtitle'], 0, 60), 'member' => $user_info['id'], 'start_date' => sprintf('%04d-%02d-%02d', $_POST['year'], $_POST['month'], $_POST['day']), 'span' => isset($_POST['span']) && $_POST['span'] > 0 ? min((int) $modSettings['cal_maxspan'], (int) $_POST['span'] - 1) : 0);
            insertEvent($eventOptions);
        } elseif (isset($_REQUEST['deleteevent'])) {
            removeEvent($_REQUEST['eventid']);
        } else {
            $eventOptions = array('title' => substr($_REQUEST['evtitle'], 0, 60), 'span' => empty($modSettings['cal_allowspan']) || empty($_POST['span']) || $_POST['span'] == 1 || empty($modSettings['cal_maxspan']) || $_POST['span'] > $modSettings['cal_maxspan'] ? 0 : min((int) $modSettings['cal_maxspan'], (int) $_POST['span'] - 1), 'start_date' => strftime('%Y-%m-%d', mktime(0, 0, 0, (int) $_REQUEST['month'], (int) $_REQUEST['day'], (int) $_REQUEST['year'])));
            modifyEvent($_REQUEST['eventid'], $eventOptions);
        }
        updateSettings(array('calendar_updated' => time()));
        // No point hanging around here now...
        redirectexit($scripturl . '?action=calendar;month=' . $_POST['month'] . ';year=' . $_POST['year']);
    }
    // If we are not enabled... we are not enabled.
    if (empty($modSettings['cal_allow_unlinked']) && empty($_REQUEST['eventid'])) {
        $_REQUEST['calendar'] = 1;
        require_once $sourcedir . '/Post.php';
        return Post();
    }
    // New?
    if (!isset($_REQUEST['eventid'])) {
        $today = getdate();
        $context['event'] = array('boards' => array(), 'board' => 0, 'new' => 1, 'eventid' => -1, 'year' => isset($_REQUEST['year']) ? $_REQUEST['year'] : $today['year'], 'month' => isset($_REQUEST['month']) ? $_REQUEST['month'] : $today['mon'], 'day' => isset($_REQUEST['day']) ? $_REQUEST['day'] : $today['mday'], 'title' => '', 'span' => 1);
        $context['event']['last_day'] = (int) strftime('%d', mktime(0, 0, 0, $context['event']['month'] == 12 ? 1 : $context['event']['month'] + 1, 0, $context['event']['month'] == 12 ? $context['event']['year'] + 1 : $context['event']['year']));
        // Get list of boards that can be posted in.
        $boards = boardsAllowedTo('post_new');
        if (empty($boards)) {
            fatal_lang_error('cannot_post_new', 'permission');
        }
        // Load the list of boards and categories in the context.
        require_once $sourcedir . '/Subs-MessageIndex.php';
        $boardListOptions = array('included_boards' => in_array(0, $boards) ? null : $boards, 'not_redirection' => true, 'use_permissions' => true, 'selected_board' => $modSettings['cal_defaultboard']);
        $context['event']['categories'] = getBoardList($boardListOptions);
    } else {
        $context['event'] = getEventProperties($_REQUEST['eventid']);
        if ($context['event'] === false) {
            fatal_lang_error('no_access', false);
        }
        // If it has a board, then they should be editing it within the topic.
        if (!empty($context['event']['topic']['id']) && !empty($context['event']['topic']['first_msg'])) {
            // We load the board up, for a check on the board access rights...
            $topic = $context['event']['topic']['id'];
            loadBoard();
        }
        // Make sure the user is allowed to edit this event.
        if ($context['event']['member'] != $user_info['id']) {
            isAllowedTo('calendar_edit_any');
        } elseif (!allowedTo('calendar_edit_any')) {
            isAllowedTo('calendar_edit_own');
        }
    }
    // Template, sub template, etc.
    loadTemplate('Calendar');
    $context['sub_template'] = 'event_post';
    $context['page_title'] = isset($_REQUEST['eventid']) ? $txt['calendar_edit'] : $txt['calendar_post_event'];
    $context['linktree'][] = array('name' => $context['page_title']);
}
开发者ID:valek0972,项目名称:hackits,代码行数:85,代码来源:Calendar.php

示例8: ssi_recentAttachments

/**
 * We want to show the recent attachments outside of the forum.
 *
 * @param int $num_attachments = 10
 * @param string[] $attachment_ext = array()
 * @param string $output_method = 'echo'
 */
function ssi_recentAttachments($num_attachments = 10, $attachment_ext = array(), $output_method = 'echo')
{
    global $modSettings, $scripturl, $txt, $settings;
    // We want to make sure that we only get attachments for boards that we can see *if* any.
    $attachments_boards = boardsAllowedTo('view_attachments');
    // No boards?  Adios amigo.
    if (empty($attachments_boards)) {
        return array();
    }
    $db = database();
    // Is it an array?
    if (!is_array($attachment_ext)) {
        $attachment_ext = array($attachment_ext);
    }
    // Lets build the query.
    $request = $db->query('', '
		SELECT
			att.id_attach, att.id_msg, att.filename, IFNULL(att.size, 0) AS filesize, att.downloads, mem.id_member,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, m.id_topic, m.subject, t.id_board, m.poster_time,
			att.width, att.height' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : ', IFNULL(thumb.id_attach, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height') . '
		FROM {db_prefix}attachments AS att
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = att.id_msg)
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? '' : '
			LEFT JOIN {db_prefix}attachments AS thumb ON (thumb.id_attach = att.id_thumb)') . '
		WHERE att.attachment_type = 0' . ($attachments_boards === array(0) ? '' : '
			AND m.id_board IN ({array_int:boards_can_see})') . (!empty($attachment_ext) ? '
			AND att.fileext IN ({array_string:attachment_ext})' : '') . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}
			AND att.approved = {int:is_approved}') . '
		ORDER BY att.id_attach DESC
		LIMIT {int:num_attachments}', array('boards_can_see' => $attachments_boards, 'attachment_ext' => $attachment_ext, 'num_attachments' => $num_attachments, 'is_approved' => 1));
    // We have something.
    $attachments = array();
    while ($row = $db->fetch_assoc($request)) {
        $filename = preg_replace('~&amp;#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', htmlspecialchars($row['filename'], ENT_COMPAT, 'UTF-8'));
        // Is it an image?
        $attachments[$row['id_attach']] = array('member' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'), 'file' => array('filename' => $filename, 'filesize' => round($row['filesize'] / 1024, 2) . $txt['kilobyte'], 'downloads' => $row['downloads'], 'href' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'], 'link' => '<img src="' . $settings['images_url'] . '/icons/clip.png" alt="" /> <a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . '">' . $filename . '</a>', 'is_image' => !empty($row['width']) && !empty($row['height']) && !empty($modSettings['attachmentShowImages'])), 'topic' => array('id' => $row['id_topic'], 'subject' => $row['subject'], 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '">' . $row['subject'] . '</a>', 'time' => standardTime($row['poster_time']), 'html_time' => htmlTime($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time'])));
        // Images.
        if ($attachments[$row['id_attach']]['file']['is_image']) {
            $id_thumb = empty($row['id_thumb']) ? $row['id_attach'] : $row['id_thumb'];
            $attachments[$row['id_attach']]['file']['image'] = array('id' => $id_thumb, 'width' => $row['width'], 'height' => $row['height'], 'img' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . ';image" alt="' . $filename . '" />', 'thumb' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image" alt="' . $filename . '" />', 'href' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image', 'link' => '<a href="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['id_attach'] . ';image"><img src="' . $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $id_thumb . ';image" alt="' . $filename . '" /></a>');
        }
    }
    $db->free_result($request);
    // So you just want an array?  Here you can have it.
    if ($output_method == 'array' || empty($attachments)) {
        return $attachments;
    }
    // Give them the default.
    echo '
		<table class="ssi_downloads" cellpadding="2">
			<tr>
				<th align="left">', $txt['file'], '</th>
				<th align="left">', $txt['posted_by'], '</th>
				<th align="left">', $txt['downloads'], '</th>
				<th align="left">', $txt['filesize'], '</th>
			</tr>';
    foreach ($attachments as $attach) {
        echo '
			<tr>
				<td>', $attach['file']['link'], '</td>
				<td>', $attach['member']['link'], '</td>
				<td align="center">', $attach['file']['downloads'], '</td>
				<td>', $attach['file']['filesize'], '</td>
			</tr>';
    }
    echo '
		</table>';
}
开发者ID:scripple,项目名称:Elkarte,代码行数:78,代码来源:SSI.php

示例9: UnapprovedAttachments

function UnapprovedAttachments()
{
    global $txt, $scripturl, $context, $user_info, $sourcedir, $smcFunc;
    $context['page_title'] = $txt['mc_unapproved_attachments'];
    // Once again, permissions are king!
    $approve_boards = boardsAllowedTo('approve_posts');
    if ($approve_boards == array(0)) {
        $approve_query = '';
    } elseif (!empty($approve_boards)) {
        $approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
    } else {
        $approve_query = ' AND 0';
    }
    // Get together the array of things to act on, if any.
    $attachments = array();
    if (isset($_GET['approve'])) {
        $attachments[] = (int) $_GET['approve'];
    } elseif (isset($_GET['delete'])) {
        $attachments[] = (int) $_GET['delete'];
    } elseif (isset($_POST['item'])) {
        foreach ($_POST['item'] as $item) {
            $attachments[] = (int) $item;
        }
    }
    // Are we approving or deleting?
    if (isset($_GET['approve']) || isset($_POST['do']) && $_POST['do'] == 'approve') {
        $curAction = 'approve';
    } elseif (isset($_GET['delete']) || isset($_POST['do']) && $_POST['do'] == 'delete') {
        $curAction = 'delete';
    }
    // Something to do, let's do it!
    if (!empty($attachments) && isset($curAction)) {
        checkSession('request');
        // This will be handy.
        require_once $sourcedir . '/ManageAttachments.php';
        // Confirm the attachments are eligible for changing!
        $request = $smcFunc['db_query']('', '
			SELECT a.id_attach
			FROM {db_prefix}attachments AS a
				INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg)
				LEFT JOIN {db_prefix}boards AS b ON (m.id_board = b.id_board)
			WHERE a.id_attach IN ({array_int:attachments})
				AND a.approved = {int:not_approved}
				AND a.attachment_type = {int:attachment_type}
				AND {query_see_board}
				' . $approve_query, array('attachments' => $attachments, 'not_approved' => 0, 'attachment_type' => 0));
        $attachments = array();
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $attachments[] = $row['id_attach'];
        }
        $smcFunc['db_free_result']($request);
        // Assuming it wasn't all like, proper illegal, we can do the approving.
        if (!empty($attachments)) {
            if ($curAction == 'approve') {
                ApproveAttachments($attachments);
            } else {
                removeAttachments(array('id_attach' => $attachments));
            }
        }
    }
    // How many unapproved attachments in total?
    $request = $smcFunc['db_query']('', '
		SELECT COUNT(*)
		FROM {db_prefix}attachments AS a
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
		WHERE a.approved = {int:not_approved}
			AND a.attachment_type = {int:attachment_type}
			AND {query_see_board}
			' . $approve_query, array('not_approved' => 0, 'attachment_type' => 0));
    list($context['total_unapproved_attachments']) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    $context['page_index'] = constructPageIndex($scripturl . '?action=moderate;area=attachmod;sa=attachments', $_GET['start'], $context['total_unapproved_attachments'], 10);
    $context['start'] = $_GET['start'];
    // Get all unapproved attachments.
    $request = $smcFunc['db_query']('', '
		SELECT a.id_attach, a.filename, a.size, m.id_msg, m.id_topic, m.id_board, m.subject, m.body, m.id_member,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time,
			t.id_member_started, t.id_first_msg, b.name AS board_name, c.id_cat, c.name AS cat_name
		FROM {db_prefix}attachments AS a
			INNER JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg)
			INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
			INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
			LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
		WHERE a.approved = {int:not_approved}
			AND a.attachment_type = {int:attachment_type}
			AND {query_see_board}
			' . $approve_query . '
		LIMIT ' . $context['start'] . ', 10', array('not_approved' => 0, 'attachment_type' => 0));
    $context['unapproved_items'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        $context['unapproved_items'][] = array('id' => $row['id_attach'], 'filename' => $row['filename'], 'size' => round($row['size'] / 1024, 2), 'time' => timeformat($row['poster_time']), 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'link' => $row['id_member'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>' : $row['poster_name'], 'href' => $scripturl . '?action=profile;u=' . $row['id_member']), 'message' => array('id' => $row['id_msg'], 'subject' => $row['subject'], 'body' => parse_bbc($row['body']), 'time' => timeformat($row['poster_time']), 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg']), 'topic' => array('id' => $row['id_topic']), 'board' => array('id' => $row['id_board'], 'name' => $row['board_name']), 'category' => array('id' => $row['id_cat'], 'name' => $row['cat_name']));
    }
    $smcFunc['db_free_result']($request);
    $context['sub_template'] = 'unapproved_attachments';
}
开发者ID:Kheros,项目名称:MMOver,代码行数:97,代码来源:PostModeration.php

示例10: fetch_data

    /**
     * fetch_data.
     * Fetch Boards, Topics, Messages and Attaches.
     */
    function fetch_data()
    {
        global $context, $smcFunc, $modSettings, $boardurl, $txt;
        $this->boards = null;
        $this->attaches = null;
        $this->imgName = '';
        if (isset($this->cfg['config']['settings']['board']) && !empty($this->cfg['config']['settings']['board'])) {
            $this->posts = ssi_boardNews($this->cfg['config']['settings']['board'], $this->cfg['config']['settings']['total'], null, null, '');
            if (!empty($this->posts)) {
                $topics = null;
                $msgids = null;
                foreach ($this->posts as $id => $post) {
                    $topics[] = $post['id'];
                    $msgids[] = $post['message_id'];
                    // Rescale inline Images ?
                    if (!empty($this->cfg['config']['settings']['rescale']) || empty($this->cfg['config']['settings']['rescale']) && !is_numeric($this->cfg['config']['settings']['rescale'])) {
                        // find all images
                        if (preg_match_all('~<img[^>]*>~iS', $this->posts[$id]['body'], $matches) > 0) {
                            // remove smileys
                            foreach ($matches[0] as $i => $data) {
                                if (strpos($data, $modSettings['smileys_url']) !== false) {
                                    unset($matches[0][$i]);
                                }
                            }
                            // images found?
                            if (count($matches[0]) > 0) {
                                $this->imgName = $this->cfg['blocktype'] . '-' . $this->cfg['id'];
                                if (empty($this->cfg['config']['settings']['rescale'])) {
                                    $fnd = array('~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
                                } else {
                                    $fnd = array('~ width?=?"\\d+"~', '~ height?=?"\\d+"~', '~ class?=?"[^"]*"~', '~ alt?=?"[^"]*"~', '~ title?=?"[^"]*"~');
                                }
                                // modify the images for highslide
                                foreach ($matches[0] as $i => $data) {
                                    $datlen = strlen($data);
                                    preg_match('~src?=?"([^\\"]*\\")~i', $data, $src);
                                    $alt = substr(strrchr($src[1], '/'), 1);
                                    $alt = str_replace(array('_', '-'), ' ', strtoupper(substr($alt, 0, strrpos($alt, '.'))));
                                    $tmp = str_replace($src[0], ' class="' . $this->imgName . '" alt="' . $alt . '" ' . $src[0], preg_replace($fnd, '', $data));
                                    // highslide disabled?
                                    if (!empty($context['pmx']['settings']['disableHS']) || !empty($context['pmx']['settings']['disableHSonfront'])) {
                                        $this->posts[$id]['body'] = substr_replace($this->posts[$id]['body'], $tmp, strpos($this->posts[$id]['body'], $data), $datlen);
                                    } elseif (empty($this->cfg['config']['settings']['disableHSimg']) && empty($context['pmx']['settings']['disableHSonfront'])) {
                                        $this->posts[$id]['body'] = substr_replace($this->posts[$id]['body'], '<a href="' . $boardurl . '" class="' . $this->imgName . ' highslide" title="' . $txt['pmx_hs_expand'] . '" onclick="return hs.expand(this, {src: \'' . str_replace('"', '', $src[1]) . '\', align: \'center\', headingEval: \'this.thumb.alt\'})">' . $tmp . '</a>', strpos($this->posts[$id]['body'], $data), $datlen);
                                    } else {
                                        $this->posts[$id]['body'] = substr_replace($this->posts[$id]['body'], $tmp, strpos($this->posts[$id]['body'], $data), $datlen);
                                    }
                                }
                            }
                        }
                    } elseif (is_numeric($this->cfg['config']['settings']['rescale'])) {
                        $this->posts[$id]['body'] = PortaMx_revoveLinks($this->posts[$id]['body'], false, true);
                    }
                    // teaser enabled ?
                    if (!empty($this->cfg['config']['settings']['teaser'])) {
                        $this->posts[$id]['body'] = PortaMx_Tease_posts($this->posts[$id]['body'], $this->cfg['config']['settings']['teaser']);
                    }
                }
                // get attachments if show thumnails set
                $allow_boards = boardsAllowedTo('view_attachments');
                if (!empty($this->cfg['config']['settings']['thumbs']) && !empty($allow_boards)) {
                    $request = $smcFunc['db_query']('', '
						SELECT a.id_msg, a.id_attach, a.id_thumb, a.filename, m.id_topic
						FROM {db_prefix}attachments AS a
						LEFT JOIN {db_prefix}messages AS m ON (a.id_msg = m.id_msg)
						WHERE a.id_msg IN({array_int:messages}) AND a.mime_type LIKE {string:like}' . ($allow_boards === array(0) ? '' : (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : ' AND m.approved = 1 AND a.approved = 1') . ' AND m.id_board IN ({array_int:boards})') . '
						ORDER BY a.id_msg DESC, a.id_attach ASC', array('messages' => $msgids, 'like' => 'IMAGE%', 'boards' => $allow_boards));
                    $thumbs = array();
                    $msgcnt = array();
                    $saved = !empty($this->cfg['config']['settings']['thumbcnt']) ? $this->cfg['config']['settings']['thumbcnt'] : 0;
                    while ($row = $smcFunc['db_fetch_assoc']($request)) {
                        if (!in_array($row['id_attach'], $thumbs)) {
                            if (!empty($this->cfg['config']['settings']['thumbcnt'])) {
                                if (!in_array($row['id_msg'], $msgcnt)) {
                                    $saved = $this->cfg['config']['settings']['thumbcnt'];
                                } elseif (in_array($row['id_msg'], $msgcnt) && empty($saved)) {
                                    continue;
                                }
                            }
                            $saved--;
                            $msgcnt[] = $row['id_msg'];
                            $thumbs[] = $row['id_thumb'];
                            $this->attaches[$row['id_msg']][] = array('topic' => $row['id_topic'], 'image' => $row['id_attach'], 'thumb' => empty($row['id_thumb']) ? $row['id_attach'] : $row['id_thumb'], 'fname' => str_replace('_thumb', '', $row['filename']));
                        }
                    }
                    $smcFunc['db_free_result']($request);
                }
                // get boards and views
                $request = $smcFunc['db_query']('', '
					SELECT b.id_board, b.name, t.id_topic, t.num_views
						FROM {db_prefix}boards b
						LEFT JOIN {db_prefix}topics t ON (t.id_board = b.id_board)
					WHERE t.id_topic IN ({array_int:topics})
						AND t.approved = 1', array('topics' => $topics));
                $this->boards = null;
                while ($row = $smcFunc['db_fetch_assoc']($request)) {
//.........这里部分代码省略.........
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:101,代码来源:boardnews.php

示例11: boardnewslide


//.........这里部分代码省略.........
            $last_open = strrpos($row['body'], '<');
            $last_close = strrpos($row['body'], '>');
            if (empty($last_space) || $last_space == $last_open + 3 && (empty($last_close) || !empty($last_close) && $last_close < $last_open) || $last_space < $last_open || $last_open == $length - 6) {
                $cutoff = $last_open;
            } elseif (empty($last_close) || $last_close < $last_open) {
                $cutoff = $last_space;
            }
            if ($cutoff !== false) {
                $row['body'] = $smcFunc['substr']($row['body'], 0, $cutoff);
            }
            $row['body'] .= '...';
        }
        $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
        if (!empty($recycle_board) && $row['id_board'] == $recycle_board) {
            $row['icon'] = 'recycled';
        }
        // Check that this message icon is there...
        if (!empty($modSettings['messageIconChecks_enable']) && !isset($icon_sources[$row['icon']])) {
            $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.png') ? 'images_url' : 'default_images_url';
        }
        // Censor everything.
        censorText($row['body']);
        censorText($row['subject']);
        // BBC-atize the message.
        $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
        $secimyap = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $row['body'], $sonuc);
        // src="" içindekini al.
        if (!empty($sonuc[0]) && !empty($sonuc[1])) {
            $ilkresim = $sonuc[1][0];
        } else {
            // Resim bulunmazsa default resim ekle
            $ilkresim = $settings['theme_url'] . '/images/konusaldefault.png';
        }
        // And build the array.
        $context['posts'][$row['id_msg']] = array('id' => $row['id_msg'], 'counter' => $counter++, 'alternate' => $counter % 2, 'category' => array('id' => $row['id_cat'], 'name' => $row['cname'], 'href' => $scripturl . '#c' . $row['id_cat'], 'link' => '<a href="' . $scripturl . '#c' . $row['id_cat'] . '">' . $row['cname'] . '</a>'), 'board' => array('id' => $row['id_board'], 'name' => $row['bname'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>'), 'topic' => $row['id_topic'], 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>', 'start' => $row['num_replies'], 'subject' => $row['subject'], 'resim' => $ilkresim, 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'first_poster' => array('id' => $row['id_first_member'], 'name' => $row['first_poster_name'], 'href' => empty($row['id_first_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_first_member'], 'link' => empty($row['id_first_member']) ? $row['first_poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_first_member'] . '">' . $row['first_poster_name'] . '</a>'), 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'], 'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'), 'message' => $row['body'], 'can_reply' => false, 'can_mark_notify' => false, 'can_delete' => false, 'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['poster_time'] + $modSettings['edit_disable_time'] * 60 >= time()));
        if ($user_info['id'] == $row['id_first_member']) {
            $board_ids['own'][$row['id_board']][] = $row['id_msg'];
        }
        $board_ids['any'][$row['id_board']][] = $row['id_msg'];
    }
    $smcFunc['db_free_result']($request);
    // There might be - and are - different permissions between any and own.
    $permissions = array('own' => array('post_reply_own' => 'can_reply', 'delete_own' => 'can_delete'), 'any' => array('post_reply_any' => 'can_reply', 'mark_any_notify' => 'can_mark_notify', 'delete_any' => 'can_delete'));
    // Now go through all the permissions, looking for boards they can do it on.
    foreach ($permissions as $type => $list) {
        foreach ($list as $permission => $allowed) {
            // They can do it on these boards...
            $boards = boardsAllowedTo($permission);
            // If 0 is the only thing in the array, they can do it everywhere!
            if (!empty($boards) && $boards[0] == 0) {
                $boards = array_keys($board_ids[$type]);
            }
            // Go through the boards, and look for posts they can do this on.
            foreach ($boards as $board_id) {
                // Hmm, they have permission, but there are no topics from that board on this page.
                if (!isset($board_ids[$type][$board_id])) {
                    continue;
                }
                // Okay, looks like they can do it for these posts.
                foreach ($board_ids[$type][$board_id] as $counter) {
                    if ($type == 'any' || $context['posts'][$counter]['poster']['id'] == $user_info['id']) {
                        $context['posts'][$counter][$allowed] = true;
                    }
                }
            }
        }
    }
    $quote_enabled = empty($modSettings['disabledBBC']) || !in_array('quote', explode(',', $modSettings['disabledBBC']));
    foreach ($context['posts'] as $counter => $dummy) {
        // Some posts - the first posts - can't just be deleted.
        $context['posts'][$counter]['can_delete'] &= $context['posts'][$counter]['delete_possible'];
        // And some cannot be quoted...
        $context['posts'][$counter]['can_quote'] = $context['posts'][$counter]['can_reply'] && $quote_enabled;
    }
    global $context, $settings, $options, $txt, $scripturl;
    echo '<script type="text/javascript" src="', $settings['theme_url'], '/scripts/modernizr.custom.28468.js"></script>
		<div id="da-slider" class="da-slider">';
    foreach ($context['posts'] as $post) {
        echo '
				<div class="da-slide">
				<h2><a href="', $post['href'], '">', $post['subject'], '</a></h2>
				<p>', temizle($post['message']), ' </p>
				<a href="', $post['href'], '" class="da-link">', $txt['Read'], '</a>
				<div class="da-img"><a href="', $post['href'], '"> <img width="120px" src="', $post['resim'], '" alt="', $post['subject'], '" class="haber_resmi" /></a></div>
				</div>';
    }
    echo '
			</div>
		<script type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery.cslider.js"></script>
		<script type="text/javascript">
			$(function() {
			
				$(\'#da-slider\').cslider({
					autoplay	: true,
					bgincrement	: 450
				});
			
			});
		</script>';
}
开发者ID:snrj,项目名称:konusal-m-theme,代码行数:101,代码来源:konusal-com.php

示例12: char_posts


//.........这里部分代码省略.........
        if ($context['is_topics']) {
            $request = $smcFunc['db_query']('', '
				SELECT
					b.id_board, b.name AS bname, c.id_cat, c.name AS cname, t.id_member_started, t.id_first_msg, t.id_last_msg,
					t.approved, m.body, m.smileys_enabled, m.subject, m.poster_time, m.id_topic, m.id_msg
				FROM {db_prefix}topics AS t
					INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
					LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
					INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
				WHERE m.id_character = {int:current_member}' . (!empty($board) ? '
					AND t.id_board = {int:board}' : '') . (empty($range_limit) ? '' : '
					AND ' . $range_limit) . '
					AND {query_see_board}' . (!$modSettings['postmod_active'] || $context['user']['is_owner'] ? '' : '
					AND t.approved = {int:is_approved} AND m.approved = {int:is_approved}') . '
				ORDER BY t.id_first_msg ' . ($reverse ? 'ASC' : 'DESC') . '
				LIMIT ' . $start . ', ' . $maxIndex, array('current_member' => $context['character']['id_character'], 'is_approved' => 1, 'board' => $board));
        } else {
            $request = $smcFunc['db_query']('', '
				SELECT
					b.id_board, b.name AS bname, c.id_cat, c.name AS cname, m.id_topic, m.id_msg,
					t.id_member_started, t.id_first_msg, t.id_last_msg, m.body, m.smileys_enabled,
					m.subject, m.poster_time, m.approved
				FROM {db_prefix}messages AS m
					INNER JOIN {db_prefix}topics AS t ON (t.id_topic = m.id_topic)
					INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
					LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
				WHERE m.id_character = {int:current_member}' . (!empty($board) ? '
					AND b.id_board = {int:board}' : '') . (empty($range_limit) ? '' : '
					AND ' . $range_limit) . '
					AND {query_see_board}' . (!$modSettings['postmod_active'] || $context['user']['is_owner'] ? '' : '
					AND t.approved = {int:is_approved} AND m.approved = {int:is_approved}') . '
				ORDER BY m.id_msg ' . ($reverse ? 'ASC' : 'DESC') . '
				LIMIT ' . $start . ', ' . $maxIndex, array('current_member' => $context['character']['id_character'], 'is_approved' => 1, 'board' => $board));
        }
        // Make sure we quit this loop.
        if ($smcFunc['db_num_rows']($request) === $maxIndex || $looped) {
            break;
        }
        $looped = true;
        $range_limit = '';
    }
    // Start counting at the number of the first message displayed.
    $counter = $reverse ? $context['start'] + $maxIndex + 1 : $context['start'];
    $context['posts'] = [];
    $board_ids = array('own' => [], 'any' => []);
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Censor....
        censorText($row['body']);
        censorText($row['subject']);
        // Do the code.
        $row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);
        // And the array...
        $context['posts'][$counter += $reverse ? -1 : 1] = array('body' => $row['body'], 'counter' => $counter, 'category' => array('name' => $row['cname'], 'id' => $row['id_cat']), 'board' => array('name' => $row['bname'], 'id' => $row['id_board']), 'topic' => $row['id_topic'], 'subject' => $row['subject'], 'start' => 'msg' . $row['id_msg'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'id' => $row['id_msg'], 'can_reply' => false, 'can_mark_notify' => !$context['user']['is_guest'], 'can_delete' => false, 'delete_possible' => ($row['id_first_msg'] != $row['id_msg'] || $row['id_last_msg'] == $row['id_msg']) && (empty($modSettings['edit_disable_time']) || $row['poster_time'] + $modSettings['edit_disable_time'] * 60 >= time()), 'approved' => $row['approved'], 'css_class' => $row['approved'] ? 'windowbg' : 'approvebg');
        if ($user_info['id'] == $row['id_member_started']) {
            $board_ids['own'][$row['id_board']][] = $counter;
        }
        $board_ids['any'][$row['id_board']][] = $counter;
    }
    $smcFunc['db_free_result']($request);
    // All posts were retrieved in reverse order, get them right again.
    if ($reverse) {
        $context['posts'] = array_reverse($context['posts'], true);
    }
    // These are all the permissions that are different from board to board..
    if ($context['is_topics']) {
        $permissions = array('own' => array('post_reply_own' => 'can_reply'), 'any' => array('post_reply_any' => 'can_reply'));
    } else {
        $permissions = array('own' => array('post_reply_own' => 'can_reply', 'delete_own' => 'can_delete'), 'any' => array('post_reply_any' => 'can_reply', 'delete_any' => 'can_delete'));
    }
    // For every permission in the own/any lists...
    foreach ($permissions as $type => $list) {
        foreach ($list as $permission => $allowed) {
            // Get the boards they can do this on...
            $boards = boardsAllowedTo($permission);
            // Hmm, they can do it on all boards, can they?
            if (!empty($boards) && $boards[0] == 0) {
                $boards = array_keys($board_ids[$type]);
            }
            // Now go through each board they can do the permission on.
            foreach ($boards as $board_id) {
                // There aren't any posts displayed from this board.
                if (!isset($board_ids[$type][$board_id])) {
                    continue;
                }
                // Set the permission to true ;).
                foreach ($board_ids[$type][$board_id] as $counter) {
                    $context['posts'][$counter][$allowed] = true;
                }
            }
        }
    }
    // Clean up after posts that cannot be deleted and quoted.
    $quote_enabled = empty($modSettings['disabledBBC']) || !in_array('quote', explode(',', $modSettings['disabledBBC']));
    foreach ($context['posts'] as $counter => $dummy) {
        $context['posts'][$counter]['can_delete'] &= $context['posts'][$counter]['delete_possible'];
        $context['posts'][$counter]['can_quote'] = $context['posts'][$counter]['can_reply'] && $quote_enabled;
    }
    // Allow last minute changes.
    call_integration_hook('integrate_profile_showPosts');
}
开发者ID:Arantor,项目名称:smf-characters,代码行数:101,代码来源:Profile-Chars.php

示例13: action_m_rename_topic

function action_m_rename_topic()
{
    global $smcFunc, $context, $user_info, $topic, $modSettings, $txt;
    if (empty($topic)) {
        fatal_lang_error('no_access', false);
    }
    $_POST['custom_subject'] = mobiquo_encode($_POST['custom_subject']);
    $request = $smcFunc['db_query']('', '
        SELECT id_member_started, id_first_msg, approved
        FROM {db_prefix}topics
        WHERE id_topic = {int:current_topic}
        LIMIT 1', array('current_topic' => $topic));
    list($id_member_started, $id_first_msg, $context['is_approved']) = $smcFunc['db_fetch_row']($request);
    $smcFunc['db_free_result']($request);
    // Can they see it?
    if (!$context['is_approved']) {
        isAllowedTo('approve_posts');
    }
    // Can they move topics on this board?
    if (!allowedTo('move_any')) {
        if ($id_member_started == $user_info['id']) {
            isAllowedTo('move_own');
            $boards = array_merge(boardsAllowedTo('move_own'), boardsAllowedTo('move_any'));
        } else {
            isAllowedTo('move_any');
        }
    } else {
        $boards = boardsAllowedTo('move_any');
    }
    // If this topic isn't approved don't let them move it if they can't approve it!
    if ($modSettings['postmod_active'] && !$context['is_approved'] && !allowedTo('approve_posts')) {
        // Only allow them to move it to other boards they can't approve it in.
        $can_approve = boardsAllowedTo('approve_posts');
        $boards = array_intersect($boards, $can_approve);
    }
    checkSession();
    if (isset($_POST['custom_subject']) && $_POST['custom_subject'] != '') {
        $_POST['custom_subject'] = strtr($smcFunc['htmltrim']($smcFunc['htmlspecialchars']($_POST['custom_subject'])), array("\r" => '', "\n" => '', "\t" => ''));
        // Keep checking the length.
        if ($smcFunc['strlen']($_POST['custom_subject']) > 100) {
            $_POST['custom_subject'] = $smcFunc['substr']($_POST['custom_subject'], 0, 100);
        }
        // If it's still valid move onwards and upwards.
        if ($_POST['custom_subject'] != '') {
            if (isset($_POST['enforce_subject'])) {
                // Get a response prefix, but in the forum's default language.
                if (!isset($context['response_prefix']) && !($context['response_prefix'] = cache_get_data('response_prefix'))) {
                    if ($language === $user_info['language']) {
                        $context['response_prefix'] = $txt['response_prefix'];
                    } else {
                        loadLanguage('index', $language, false);
                        $context['response_prefix'] = $txt['response_prefix'];
                        loadLanguage('index');
                    }
                    cache_put_data('response_prefix', $context['response_prefix'], 600);
                }
                $smcFunc['db_query']('', '
                    UPDATE {db_prefix}messages
                    SET subject = {string:subject}
                    WHERE id_topic = {int:current_topic}', array('current_topic' => $topic, 'subject' => $context['response_prefix'] . $_POST['custom_subject']));
            }
            $smcFunc['db_query']('', '
                UPDATE {db_prefix}messages
                SET subject = {string:custom_subject}
                WHERE id_msg = {int:id_first_msg}', array('id_first_msg' => $id_first_msg, 'custom_subject' => $_POST['custom_subject']));
            // Fix the subject cache.
            updateStats('subject', $topic, $_POST['custom_subject']);
            return;
        }
    }
    get_error($txt['error_no_subject']);
}
开发者ID:keweiliu6,项目名称:test-smf2,代码行数:72,代码来源:mobiquo_action.php

示例14: PlushSearch2


//.........这里部分代码省略.........
                        $smcFunc['db_free_result']($ignoreRequest);
                        // Now put them in!
                        if (!empty($inserts)) {
                            $smcFunc['db_insert']('', '{db_prefix}log_search_results', array('id_search' => 'int', 'id_topic' => 'int', 'relevance' => 'float', 'id_msg' => 'int', 'num_matches' => 'int'), $inserts, array('id_search', 'id_topic'));
                        }
                        $_SESSION['search_cache']['num_results'] += count($inserts);
                    } else {
                        $_SESSION['search_cache']['num_results'] += $smcFunc['db_affected_rows']();
                    }
                } else {
                    $_SESSION['search_cache']['num_results'] = 0;
                }
            }
        }
        // *** Retrieve the results to be shown on the page
        $participants = array();
        $request = $smcFunc['db_search_query']('', '
			SELECT ' . (empty($search_params['topic']) ? 'lsr.id_topic' : $search_params['topic'] . ' AS id_topic') . ', lsr.id_msg, lsr.relevance, lsr.num_matches
			FROM {db_prefix}log_search_results AS lsr' . ($search_params['sort'] == 'num_replies' ? '
				INNER JOIN {db_prefix}topics AS t ON (t.id_topic = lsr.id_topic)' : '') . '
			WHERE lsr.id_search = {int:id_search}
			ORDER BY ' . $search_params['sort'] . ' ' . $search_params['sort_dir'] . '
			LIMIT ' . (int) $_REQUEST['start'] . ', ' . $modSettings['search_results_per_page'], array('id_search' => $_SESSION['search_cache']['id_search']));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $context['topics'][$row['id_msg']] = array('relevance' => round($row['relevance'] / 10, 1) . '%', 'num_matches' => $row['num_matches'], 'matches' => array());
            // By default they didn't participate in the topic!
            $participants[$row['id_topic']] = false;
        }
        $smcFunc['db_free_result']($request);
        $num_results = $_SESSION['search_cache']['num_results'];
    }
    if (!empty($context['topics'])) {
        // Create an array for the permissions.
        $boards_can = array('post_reply_own' => boardsAllowedTo('post_reply_own'), 'post_reply_any' => boardsAllowedTo('post_reply_any'), 'mark_any_notify' => boardsAllowedTo('mark_any_notify'));
        // How's about some quick moderation?
        if (!empty($options['display_quick_mod'])) {
            $boards_can['lock_any'] = boardsAllowedTo('lock_any');
            $boards_can['lock_own'] = boardsAllowedTo('lock_own');
            $boards_can['make_sticky'] = boardsAllowedTo('make_sticky');
            $boards_can['move_any'] = boardsAllowedTo('move_any');
            $boards_can['move_own'] = boardsAllowedTo('move_own');
            $boards_can['remove_any'] = boardsAllowedTo('remove_any');
            $boards_can['remove_own'] = boardsAllowedTo('remove_own');
            $boards_can['merge_any'] = boardsAllowedTo('merge_any');
            $context['can_lock'] = in_array(0, $boards_can['lock_any']);
            $context['can_sticky'] = in_array(0, $boards_can['make_sticky']) && !empty($modSettings['enableStickyTopics']);
            $context['can_move'] = in_array(0, $boards_can['move_any']);
            $context['can_remove'] = in_array(0, $boards_can['remove_any']);
            $context['can_merge'] = in_array(0, $boards_can['merge_any']);
        }
        // What messages are we using?
        $msg_list = array_keys($context['topics']);
        // Load the posters...
        $request = $smcFunc['db_query']('', '
			SELECT id_member
			FROM {db_prefix}messages
			WHERE id_member != {int:no_member}
				AND id_msg IN ({array_int:message_list})
			LIMIT ' . count($context['topics']), array('message_list' => $msg_list, 'no_member' => 0));
        $posters = array();
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $posters[] = $row['id_member'];
        }
        $smcFunc['db_free_result']($request);
        if (!empty($posters)) {
            loadMemberData(array_unique($posters));
开发者ID:chenhao6593,项目名称:smf,代码行数:67,代码来源:Search.php

示例15: sp_showPoll

function sp_showPoll($parameters, $id, $return_parameters = false)
{
    global $smcFunc, $context, $scripturl, $modSettings, $boardurl, $txt;
    $block_parameters = array('topic' => 'int', 'type' => 'select');
    if ($return_parameters) {
        return $block_parameters;
    }
    $topic = !empty($parameters['topic']) ? $parameters['topic'] : null;
    $type = !empty($parameters['type']) ? (int) $parameters['type'] : 0;
    $boardsAllowed = boardsAllowedTo('poll_view');
    if (empty($boardsAllowed)) {
        loadLanguage('Errors');
        echo '
								', $txt['cannot_poll_view'];
        return;
    }
    if (!empty($type)) {
        $request = $smcFunc['db_query']('', '
			SELECT t.id_topic
			FROM {db_prefix}polls AS p
				INNER JOIN {db_prefix}topics AS t ON (t.id_poll = p.id_poll' . ($modSettings['postmod_active'] ? ' AND t.approved = {int:is_approved}' : '') . ')
				INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
			WHERE {query_wanna_see_board}
				AND p.voting_locked = {int:not_locked}' . (!in_array(0, $boardsAllowed) ? '
				AND b.id_board IN ({array_int:boards_allowed_list})' : '') . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
				AND b.id_board != {int:recycle_enable}' : '') . '
			ORDER BY {raw:type}
			LIMIT 1', array('boards_allowed_list' => $boardsAllowed, 'not_locked' => 0, 'is_approved' => 1, 'recycle_enable' => $modSettings['recycle_board'], 'type' => $type == 1 ? 'p.id_poll DESC' : 'RAND()'));
        list($topic) = $smcFunc['db_fetch_row']($request);
        $smcFunc['db_free_result']($request);
    }
    if (empty($topic) || $topic < 0) {
        loadLanguage('Errors');
        echo '
								', $txt['topic_doesnt_exist'];
        return;
    }
    $poll = ssi_showPoll($topic, 'array');
    if ($poll['allow_vote']) {
        echo '
								<form action="', $boardurl, '/SSI.php?ssi_function=pollVote" method="post" accept-charset="', $context['character_set'], '">
									<ul class="sp_list">
										<li><strong>', $poll['question'], '</strong></li>
										<li>', $poll['allowed_warning'], '</li>';
        foreach ($poll['options'] as $option) {
            echo '
										<li><label for="', $option['id'], '">', $option['vote_button'], ' ', $option['option'], '</label></li>';
        }
        echo '
										<li class="sp_center"><input type="submit" value="', $txt['poll_vote'], '" class="button_submit" /></li>
										<li class="sp_center"><a href="', $scripturl, '?topic=', $poll['topic'], '.0">', $txt['sp-pollViewTopic'], '</a></li>
									</ul>
									<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
									<input type="hidden" name="poll" value="', $poll['id'], '" />
								</form>';
    } elseif ($poll['allow_view_results']) {
        echo '
								<ul class="sp_list">
									<li><strong>', $poll['question'], '</strong></li>';
        foreach ($poll['options'] as $option) {
            echo '
									<li>', sp_embed_image('dot'), ' ', $option['option'], '</li>
									<li class="sp_list_indent"><strong>', $option['votes'], '</strong> (', $option['percent'], '%)</li>';
        }
        echo '
									<li><strong>', $txt['poll_total_voters'], ': ', $poll['total_votes'], '</strong></li>
									<li class="sp_center"><a href="', $scripturl, '?topic=', $poll['topic'], '.0">', $txt['sp-pollViewTopic'], '</a></li>
								</ul>';
    } else {
        echo '
								', $txt['poll_cannot_see'];
    }
}
开发者ID:sk8rdude461,项目名称:moparscape.org-smf,代码行数:73,代码来源:PortalBlocks.php


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