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

PHP forum_time函数代码示例

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

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



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

示例1: PrintTopic

function PrintTopic()
{
    global $db_prefix, $topic, $txt, $scripturl, $context;
    global $board_info;
    if (empty($topic)) {
        fatal_lang_error(472, false);
    }
    // Get the topic starter information.
    $request = db_query("\n\t\tSELECT m.posterTime, IFNULL(mem.realName, m.posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE m.ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG\n\t\tLIMIT 1", __FILE__, __LINE__);
    if (mysql_num_rows($request) == 0) {
        fatal_lang_error('smf232');
    }
    $row = mysql_fetch_assoc($request);
    mysql_free_result($request);
    // Lets "output" all that info.
    loadTemplate('Printpage');
    $context['template_layers'] = array('print');
    $context['board_name'] = $board_info['name'];
    $context['category_name'] = $board_info['cat']['name'];
    $context['poster_name'] = $row['posterName'];
    $context['post_time'] = timeformat($row['posterTime'], false);
    // Split the topics up so we can print them.
    $request = db_query("\n\t\tSELECT subject, posterTime, body, IFNULL(mem.realName, posterName) AS posterName\n\t\tFROM {$db_prefix}messages AS m\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)\n\t\tWHERE ID_TOPIC = {$topic}\n\t\tORDER BY ID_MSG", __FILE__, __LINE__);
    $context['posts'] = array();
    while ($row = mysql_fetch_assoc($request)) {
        // Censor the subject and message.
        censorText($row['subject']);
        censorText($row['body']);
        $context['posts'][] = array('subject' => $row['subject'], 'member' => $row['posterName'], 'time' => timeformat($row['posterTime'], false), 'timestamp' => forum_time(true, $row['posterTime']), 'body' => parse_bbc($row['body'], 'print'));
        if (!isset($context['topic_subject'])) {
            $context['topic_subject'] = $row['subject'];
        }
    }
    mysql_free_result($request);
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:35,代码来源:Printpage.php


示例2: getMemberNotices

    public function getMemberNotices($id_member, $groups)
    {
        $request = $this->_db->query('', '
			SELECT n.id_notice, n.body, n.class, n.expire, n.show_to, n.positioning
			FROM {db_prefix}notices AS n
				LEFT JOIN {db_prefix}log_notices AS ln ON (ln.id_notice = n.id_notice AND ln.id_member = {int:current_member})
			WHERE ln.dismissed IS NULL
				AND (n.expire = 0 OR n.expire > {int:time})', array('current_member' => $id_member, 'time' => forum_time(false)));
        $notices = array();
        while ($row = $this->_db->fetch_assoc($request)) {
            $show = (array) json_decode($row['show_to']);
            foreach ($groups as $group) {
                if (in_array($group, $show)) {
                    if (empty($id_member) && !empty($_SESSION['dismissible_notices'][$row['id_notice']])) {
                        continue;
                    }
                    $row['positioning'] = (array) json_decode($row['positioning']);
                    if (empty($row['positioning']['element'])) {
                        $row['positioning']['element'] = 'global';
                    }
                    if (empty($row['positioning']['position'])) {
                        $row['positioning']['position'] = 0;
                    }
                    if (empty($row['positioning']['element_name'])) {
                        $row['positioning']['element_name'] = '';
                    }
                    $row['body'] = parse_bbc($row['body']);
                    $notices[] = $row;
                    break;
                }
            }
        }
        $this->_db->free_result($request);
        return $notices;
    }
开发者ID:emanuele45,项目名称:DismissibleNotices,代码行数:35,代码来源:DismissibleNotices.class.php


示例3: getErrorLogData

/**
 * Gets data from the error log
 *
 * @param int $start
 * @param string $sort_direction
 * @param mixed[]|null $filter
 */
function getErrorLogData($start, $sort_direction = 'DESC', $filter = null)
{
    global $modSettings, $scripturl, $txt;
    $db = database();
    // Find and sort out the errors.
    $request = $db->query('', '
		SELECT id_error, id_member, ip, url, log_time, message, session, error_type, file, line
		FROM {db_prefix}log_errors' . (isset($filter) ? '
		WHERE ' . $filter['variable'] . ' LIKE {string:filter}' : '') . '
		ORDER BY id_error ' . ($sort_direction == 'down' ? 'DESC' : '') . '
		LIMIT ' . $start . ', ' . $modSettings['defaultMaxMessages'], array('filter' => isset($filter) ? $filter['value']['sql'] : ''));
    $log = array();
    for ($i = 0; $row = $db->fetch_assoc($request); $i++) {
        $search_message = preg_replace('~<span class="remove">(.+?)</span>~', '%', $db->escape_wildcard_string($row['message']));
        if ($search_message == $filter['value']['sql']) {
            $search_message = $db->escape_wildcard_string($row['message']);
        }
        $show_message = strtr(strtr(preg_replace('~&lt;span class=&quot;remove&quot;&gt;(.+?)&lt;/span&gt;~', '$1', $row['message']), array("\r" => '', '<br />' => "\n", '<' => '&lt;', '>' => '&gt;', '"' => '&quot;')), array("\n" => '<br />'));
        $log['errors'][$row['id_error']] = array('alternate' => $i % 2 == 0, 'member' => array('id' => $row['id_member'], 'ip' => $row['ip'], 'session' => $row['session']), 'time' => standardTime($row['log_time']), 'html_time' => htmlTime($row['log_time']), 'timestamp' => forum_time(true, $row['log_time']), 'url' => array('html' => htmlspecialchars((substr($row['url'], 0, 1) == '?' ? $scripturl : '') . $row['url'], ENT_COMPAT, 'UTF-8'), 'href' => base64_encode($db->escape_wildcard_string($row['url']))), 'message' => array('html' => $show_message, 'href' => base64_encode($search_message)), 'id' => $row['id_error'], 'error_type' => array('type' => $row['error_type'], 'name' => isset($txt['errortype_' . $row['error_type']]) ? $txt['errortype_' . $row['error_type']] : $row['error_type']), 'file' => array());
        if (!empty($row['file']) && !empty($row['line'])) {
            // Eval'd files rarely point to the right location and cause havoc for linking, so don't link them.
            $linkfile = strpos($row['file'], 'eval') === false || strpos($row['file'], '?') === false;
            // De Morgan's Law.  Want this true unless both are present.
            $log['errors'][$row['id_error']]['file'] = array('file' => $row['file'], 'line' => $row['line'], 'href' => $scripturl . '?action=admin;area=logs;sa=errorlog;activity=file;file=' . base64_encode($row['file']) . ';line=' . $row['line'], 'link' => $linkfile ? '<a href="' . $scripturl . '?action=admin;area=logs;sa=errorlog;activity=file;file=' . base64_encode($row['file']) . ';line=' . $row['line'] . '" onclick="return reqWin(this.href, 600, 480, false);">' . $row['file'] . '</a>' : $row['file'], 'search' => base64_encode($row['file']));
        }
        // Make a list of members to load later.
        $log['members'][$row['id_member']] = $row['id_member'];
    }
    $db->free_result($request);
    return $log;
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:38,代码来源:Error.subs.php


示例4: PrintTopic

function PrintTopic()
{
    global $topic, $txt, $scripturl, $context, $user_info;
    global $board_info, $smcFunc, $modSettings;
    // Redirect to the boardindex if no valid topic id is provided.
    if (empty($topic)) {
        redirectexit();
    }
    // Whatever happens don't index this.
    $context['robot_no_index'] = true;
    // Get the topic starter information.
    $request = $smcFunc['db_query']('', '
		SELECT m.poster_time, IFNULL(mem.real_name, m.poster_name) AS poster_name
		FROM {db_prefix}messages AS m
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_topic = {int:current_topic}
		ORDER BY m.id_msg
		LIMIT 1', array('current_topic' => $topic));
    // Redirect to the boardindex if no valid topic id is provided.
    if ($smcFunc['db_num_rows']($request) == 0) {
        redirectexit();
    }
    $row = $smcFunc['db_fetch_assoc']($request);
    $smcFunc['db_free_result']($request);
    // Lets "output" all that info.
    loadTemplate('Printpage');
    $context['template_layers'] = array('print');
    $context['board_name'] = $board_info['name'];
    $context['category_name'] = $board_info['cat']['name'];
    $context['poster_name'] = $row['poster_name'];
    $context['post_time'] = timeformat($row['poster_time'], false);
    $context['parent_boards'] = array();
    foreach ($board_info['parent_boards'] as $parent) {
        $context['parent_boards'][] = $parent['name'];
    }
    // Split the topics up so we can print them.
    $request = $smcFunc['db_query']('', '
		SELECT subject, poster_time, body, IFNULL(mem.real_name, poster_name) AS poster_name
		FROM {db_prefix}messages AS m
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_topic = {int:current_topic}' . ($modSettings['postmod_active'] && !allowedTo('approve_posts') ? '
			AND (m.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR m.id_member = {int:current_member}') . ')' : '') . '
		ORDER BY m.id_msg', array('current_topic' => $topic, 'is_approved' => 1, 'current_member' => $user_info['id']));
    $context['posts'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Censor the subject and message.
        censorText($row['subject']);
        censorText($row['body']);
        $context['posts'][] = array('subject' => $row['subject'], 'member' => $row['poster_name'], 'time' => timeformat($row['poster_time'], false), 'timestamp' => forum_time(true, $row['poster_time']), 'body' => parse_bbc($row['body'], 'print'));
        if (!isset($context['topic_subject'])) {
            $context['topic_subject'] = $row['subject'];
        }
    }
    $smcFunc['db_free_result']($request);
    // Set a canonical URL for this page.
    $context['canonical_url'] = $scripturl . '?topic=' . $topic . '.0';
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:57,代码来源:Printpage.php


示例5: formatExpireCol

 public static function formatExpireCol($time)
 {
     if ($time == 0) {
         return '<i class="fa fa-check success"></i>';
     } elseif ($time > forum_time(false)) {
         return standardTime($time) . ' <i class="fa fa-clock-o success"></i>';
     } else {
         return '<i class="fa fa-times-circle-o  error"></i>';
     }
 }
开发者ID:emanuele45,项目名称:DismissibleNotices,代码行数:10,代码来源:DismissibleNotices.integrate.php


示例6: getLastPosts

function getLastPosts($latestPostOptions)
{
    global $scripturl, $txt, $user_info, $modSettings, $smcFunc, $context;
    // Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
    // !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
    $request = $smcFunc['db_query']('substring', '
		SELECT
			m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
			SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
		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}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_msg >= {int:likely_max_msg}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND b.id_board != {int:recycle_board}' : '') . '
			AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '
		ORDER BY m.id_msg DESC
		LIMIT ' . $latestPostOptions['number_posts'], array('likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']), 'recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
    $posts = array();
    $context['MemberColor_ID_MEMBER'] = array();
    while ($row = $smcFunc['db_fetch_assoc']($request)) {
        // Censor the subject and post for the preview ;).
        censorText($row['subject']);
        censorText($row['body']);
        $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
        if ($smcFunc['strlen']($row['body']) > 128) {
            $row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';
        }
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', 'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], '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']) ? (!empty($modSettings['MemberColorGuests']) ? '<span style="color:' . $modSettings['MemberColorGuests'] . ';">' : '') . $row['poster_name'] . (!empty($modSettings['MemberColorGuests']) ? '</span>' : '') : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" title="' . $txt['profile_of'] . ' ' . $row['poster_name'] . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 24), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'], 'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#msg' . $row['id_msg'] . '" rel="nofollow">' . $row['subject'] . '</a>');
        //The Last Posters id for the MemberColor.
        if (!empty($modSettings['MemberColorRecentLastPost']) && !empty($row['id_member'])) {
            $context['MemberColor_ID_MEMBER'][$row['id_member']] = $row['id_member'];
        }
    }
    $smcFunc['db_free_result']($request);
    // Know set the colors for the Recent posts...
    if (!empty($context['MemberColor_ID_MEMBER'])) {
        $colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
        //So Let's Color The Recent Posts ;)
        if (!empty($modSettings['MemberColorRecentLastPost']) && is_array($posts)) {
            foreach ($posts as $postkey => $postid_memcolor) {
                if (!empty($colorDatas[$postid_memcolor['poster']['id']]['colored_link'])) {
                    $posts[$postkey]['poster']['link'] = $colorDatas[$postid_memcolor['poster']['id']]['colored_link'];
                }
            }
        }
    }
    return $posts;
}
开发者ID:Kheros,项目名称:MMOver,代码行数:53,代码来源:Subs-Recent.php


示例7: getLastPosts

function getLastPosts($latestPostOptions)
{
    global $scripturl, $txt, $user_info, $modSettings, $smcFunc, $context;
    // Find all the posts.  Newer ones will have higher IDs.  (assuming the last 20 * number are accessable...)
    // !!!SLOW This query is now slow, NEEDS to be fixed.  Maybe break into two?
    $request = smf_db_query('
		SELECT
			m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg, b.name, m1.subject AS first_subject,
			IFNULL(mem.real_name, m.poster_name) AS poster_name, t.id_board, b.name AS board_name,
			SUBSTRING(m.body, 1, 385) AS body, m.smileys_enabled
		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)
			INNER JOIN {db_prefix}messages AS m1 ON (m1.id_msg = t.id_first_msg)
			LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)
		WHERE m.id_msg >= {int:likely_max_msg}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
			AND b.id_board != {int:recycle_board}' : '') . '
			AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
			AND t.approved = {int:is_approved}
			AND m.approved = {int:is_approved}' : '') . '
		ORDER BY m.id_msg DESC
		LIMIT ' . $latestPostOptions['number_posts'], array('likely_max_msg' => max(0, $modSettings['maxMsgID'] - 50 * $latestPostOptions['number_posts']), 'recycle_board' => $modSettings['recycle_board'], 'is_approved' => 1));
    $posts = array();
    while ($row = mysql_fetch_assoc($request)) {
        // Censor the subject and post for the preview ;).
        censorText($row['subject']);
        censorText($row['body']);
        $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
        if (commonAPI::strlen($row['body']) > 128) {
            $row['body'] = commonAPI::substr($row['body'], 0, 128) . '...';
        }
        $bhref = URL::board($row['id_board'], $row['board_name'], 0, true);
        $mhref = URL::user($row['id_member'], $row['poster_name']);
        $thref = URL::topic($row['id_topic'], $row['first_subject'], 0, false, '.msg' . $row['id_msg'], ';topicseen#msg' . $row['id_msg']);
        // Build the array.
        $posts[] = array('board' => array('id' => $row['id_board'], 'name' => $row['board_name'], 'href' => $bhref, 'link' => '<a href="' . $bhref . '">' . $row['board_name'] . '</a>'), 'topic' => $row['id_topic'], 'poster' => array('id' => $row['id_member'], 'name' => $row['poster_name'], 'href' => empty($row['id_member']) ? '' : $mhref, 'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $mhref . '">' . $row['poster_name'] . '</a>'), 'subject' => $row['subject'], 'short_subject' => shorten_subject($row['subject'], 35), 'preview' => $row['body'], 'time' => timeformat($row['poster_time']), 'timestamp' => forum_time(true, $row['poster_time']), 'raw_timestamp' => $row['poster_time'], 'href' => $thref, 'link' => '<a href="' . $thref . '" rel="nofollow">' . $row['first_subject'] . '</a>');
    }
    mysql_free_result($request);
    return $posts;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:40,代码来源:Subs-Recent.php


示例8: CalendarMain

function CalendarMain()
{
    global $txt, $context, $modSettings, $scripturl, $options;
    // If we are posting a new event defect to the posting function.
    if (isset($_GET['sa']) && $_GET['sa'] == 'post') {
        return CalendarPost();
    }
    // This is gonna be needed...
    loadTemplate('Calendar');
    // Permissions, permissions, permissions.
    isAllowedTo('calendar_view');
    // You can't do anything if the calendar is off.
    if (empty($modSettings['cal_enabled'])) {
        fatal_lang_error('calendar_off', false);
    }
    // Set the page title to mention the calendar ;).
    $context['page_title'] = $context['forum_name'] . ': ' . $txt['calendar24'];
    // Get the current day of month...
    $today = array('day' => (int) strftime('%d', forum_time()), 'month' => (int) strftime('%m', forum_time()), 'year' => (int) strftime('%Y', forum_time()));
    $today['date'] = sprintf('%04d-%02d-%02d', $today['year'], $today['month'], $today['day']);
    // If the month and year are not passed in, use today's date as a starting point.
    $curPage = array('month' => isset($_REQUEST['month']) ? (int) $_REQUEST['month'] : $today['month'], 'year' => isset($_REQUEST['year']) ? (int) $_REQUEST['year'] : $today['year']);
    // Make sure the year and month are in valid ranges.
    if ($curPage['month'] < 1 || $curPage['month'] > 12) {
        fatal_lang_error('calendar1', false);
    }
    if ($curPage['year'] < $modSettings['cal_minyear'] || $curPage['year'] > $modSettings['cal_maxyear']) {
        fatal_lang_error('calendar2', false);
    }
    // Get information about the first day of this month.
    $firstDayOfMonth = array('dayOfWeek' => (int) strftime('%w', mktime(0, 0, 0, $curPage['month'], 1, $curPage['year'])), 'weekNum' => (int) strftime('%U', mktime(0, 0, 0, $curPage['month'], 1, $curPage['year'])));
    // Find the last day of the month.
    $nLastDay = (int) strftime('%d', mktime(0, 0, 0, $curPage['month'] == 12 ? 1 : $curPage['month'] + 1, 0, $curPage['month'] == 12 ? $curPage['year'] + 1 : $curPage['year']));
    // The number of days the first row is shifted to the right for the starting day.
    $nShift = $firstDayOfMonth['dayOfWeek'];
    // Calendar start day- default Sunday.
    $nStartDay = !empty($options['calendar_start_day']) ? $options['calendar_start_day'] : 0;
    // Starting any day other than Sunday means a shift...
    if ($nStartDay) {
        $nShift -= $nStartDay;
        if ($nShift < 0) {
            $nShift = 7 + $nShift;
        }
    }
    // Number of rows required to fit the month.
    $nRows = floor(($nLastDay + $nShift) / 7);
    if (($nLastDay + $nShift) % 7) {
        $nRows++;
    }
    // Get the lowest and highest days of this month, in YYYY-MM-DD format. ($nLastDay is always 2 digits.)
    $low = $curPage['year'] . '-' . sprintf('%02d', $curPage['month']) . '-01';
    $high = $curPage['year'] . '-' . sprintf('%02d', $curPage['month']) . '-' . $nLastDay;
    // Fetch the arrays for birthdays, posted events, and holidays.
    $bday = !empty($modSettings['cal_showbdaysoncalendar']) ? calendarBirthdayArray($low, $high) : array();
    $events = !empty($modSettings['cal_showeventsoncalendar']) ? calendarEventArray($low, $high) : array();
    $holidays = !empty($modSettings['cal_showholidaysoncalendar']) ? calendarHolidayArray($low, $high) : array();
    // Days of the week taking into consideration that they may want it to start on any day.
    $context['week_days'] = array();
    $count = $nStartDay;
    for ($i = 0; $i < 7; $i++) {
        $context['week_days'][] = $count;
        $count++;
        if ($count == 7) {
            $count = 0;
        }
    }
    // An adjustment value to apply to all calculated week numbers.
    if (!empty($modSettings['cal_showweeknum'])) {
        // Need to know what day the first of the year was on.
        $foy = (int) strftime('%w', mktime(0, 0, 0, 1, 1, $curPage['year']));
        // If the first day of the year is a Sunday, then there is no adjustment
        // to be made. However, if the first day of the year is not a Sunday, then there is a partial
        // week at the start of the year that needs to be accounted for.
        if ($nStartDay == 0) {
            $nWeekAdjust = $foy == 0 ? 0 : 1;
        } else {
            $nWeekAdjust = $nStartDay > $foy && $foy != 0 ? 2 : 1;
        }
        // If our week starts on a day greater than the day the month starts on, then our week numbers will be one too high.
        // So we need to reduce it by one - all these thoughts of offsets makes my head hurt...
        if ($firstDayOfMonth['dayOfWeek'] < $nStartDay) {
            $nWeekAdjust--;
        }
    } else {
        $nWeekAdjust = 0;
    }
    // Basic template stuff.
    $context['can_post'] = allowedTo('calendar_post');
    $context['last_day'] = $nLastDay;
    $context['current_month'] = $curPage['month'];
    $context['current_year'] = $curPage['year'];
    // Load up the linktree!
    $context['linktree'][] = array('url' => $scripturl . '?action=calendar;year=' . $context['current_year'] . ';month=' . $context['current_month'], 'name' => $txt['months'][$context['current_month']] . ' ' . $context['current_year']);
    // Iterate through each week.
    $context['weeks'] = array();
    for ($nRow = 0; $nRow < $nRows; $nRow++) {
        // Start off the week - and don't let it go above 52, since that's the number of weeks in a year.
        $context['weeks'][$nRow] = array('days' => array(), 'number' => $firstDayOfMonth['weekNum'] + $nRow + $nWeekAdjust);
        // Handle the dreaded "week 53", it can happen, but only once in a blue moon ;)
        if ($context['weeks'][$nRow]['number'] == 53 && $nShift != 4) {
//.........这里部分代码省略.........
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:101,代码来源:Calendar.php


示例9: messagePostError

/**
 * An error in the message...
 *
 * @param $error_types
 * @param $named_recipients
 * @param $recipient_ids
 */
function messagePostError($error_types, $named_recipients, $recipient_ids = array())
{
    global $txt, $context, $scripturl, $modSettings;
    global $smcFunc, $user_info, $sourcedir;
    if (!isset($_REQUEST['xml'])) {
        $context['menu_data_' . $context['pm_menu_id']]['current_area'] = 'send';
    }
    if (!WIRELESS && !isset($_REQUEST['xml'])) {
        $context['sub_template'] = 'send';
    } elseif (isset($_REQUEST['xml'])) {
        $context['sub_template'] = 'pm';
    }
    $context['page_title'] = $txt['send_message'];
    // Got some known members?
    $context['recipients'] = array('to' => array(), 'bcc' => array());
    if (!empty($recipient_ids['to']) || !empty($recipient_ids['bcc'])) {
        $allRecipients = array_merge($recipient_ids['to'], $recipient_ids['bcc']);
        $request = $smcFunc['db_query']('', '
			SELECT id_member, real_name
			FROM {db_prefix}members
			WHERE id_member IN ({array_int:member_list})', array('member_list' => $allRecipients));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            $recipientType = in_array($row['id_member'], $recipient_ids['bcc']) ? 'bcc' : 'to';
            $context['recipients'][$recipientType][] = array('id' => $row['id_member'], 'name' => $row['real_name']);
        }
        $smcFunc['db_free_result']($request);
    }
    // Set everything up like before....
    $context['subject'] = isset($_REQUEST['subject']) ? $smcFunc['htmlspecialchars']($_REQUEST['subject']) : '';
    $context['message'] = isset($_REQUEST['message']) ? str_replace(array('  '), array('&nbsp; '), $smcFunc['htmlspecialchars']($_REQUEST['message'])) : '';
    $context['copy_to_outbox'] = !empty($_REQUEST['outbox']);
    $context['reply'] = !empty($_REQUEST['replied_to']);
    if ($context['reply']) {
        $_REQUEST['replied_to'] = (int) $_REQUEST['replied_to'];
        $request = $smcFunc['db_query']('', '
			SELECT
				pm.id_pm, CASE WHEN pm.id_pm_head = {int:no_id_pm_head} THEN pm.id_pm ELSE pm.id_pm_head END AS pm_head,
				pm.body, pm.subject, pm.msgtime, mem.member_name, IFNULL(mem.id_member, 0) AS id_member,
				IFNULL(mem.real_name, pm.from_name) AS real_name
			FROM {db_prefix}personal_messages AS pm' . ($context['folder'] == 'sent' ? '' : '
				INNER JOIN {db_prefix}pm_recipients AS pmr ON (pmr.id_pm = {int:replied_to})') . '
				LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = pm.id_member_from)
			WHERE pm.id_pm = {int:replied_to}' . ($context['folder'] == 'sent' ? '
				AND pm.id_member_from = {int:current_member}' : '
				AND pmr.id_member = {int:current_member}') . '
			LIMIT 1', array('current_member' => $user_info['id'], 'no_id_pm_head' => 0, 'replied_to' => $_REQUEST['replied_to']));
        if ($smcFunc['db_num_rows']($request) == 0) {
            if (!isset($_REQUEST['xml'])) {
                fatal_lang_error('pm_not_yours', false);
            } else {
                $error_types[] = 'pm_not_yours';
            }
        }
        $row_quoted = $smcFunc['db_fetch_assoc']($request);
        $smcFunc['db_free_result']($request);
        censorText($row_quoted['subject']);
        censorText($row_quoted['body']);
        $context['quoted_message'] = array('id' => $row_quoted['id_pm'], 'pm_head' => $row_quoted['pm_head'], 'member' => array('name' => $row_quoted['real_name'], 'username' => $row_quoted['member_name'], 'id' => $row_quoted['id_member'], 'href' => !empty($row_quoted['id_member']) ? $scripturl . '?action=profile;u=' . $row_quoted['id_member'] : '', 'link' => !empty($row_quoted['id_member']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row_quoted['id_member'] . '">' . $row_quoted['real_name'] . '</a>' : $row_quoted['real_name']), 'subject' => $row_quoted['subject'], 'time' => timeformat($row_quoted['msgtime']), 'timestamp' => forum_time(true, $row_quoted['msgtime']), 'body' => parse_bbc($row_quoted['body'], true, 'pm' . $row_quoted['id_pm']));
    }
    // Build the link tree....
    $context['linktree'][] = array('url' => $scripturl . '?action=pm;sa=send', 'name' => $txt['new_message']);
    // Set each of the errors for the template.
    loadLanguage('Errors');
    $context['error_type'] = 'minor';
    $context['post_error'] = array('messages' => array(), 'error_type' => '');
    foreach ($error_types as $error_type) {
        $context['post_error'][$error_type] = true;
        if (isset($txt['error_' . $error_type])) {
            if ($error_type == 'long_message') {
                $txt['error_' . $error_type] = sprintf($txt['error_' . $error_type], $modSettings['max_messageLength']);
            }
            $context['post_error']['messages'][] = $txt['error_' . $error_type];
        }
        // If it's not a minor error flag it as such.
        if (!in_array($error_type, array('new_reply', 'not_approved', 'new_replies', 'old_topic', 'need_qr_verification', 'no_subject'))) {
            $context['error_type'] = 'serious';
        }
    }
    // Need to reset draft capability once again
    $context['drafts_pm_save'] = !empty($modSettings['drafts_pm_enabled']) && allowedTo('pm_draft');
    $context['drafts_autosave'] = !empty($context['drafts_pm_save']) && !empty($modSettings['drafts_autosave_enabled']) && allowedTo('pm_autosave_draft');
    // We need to load the editor once more.
    require_once $sourcedir . '/Subs-Editor.php';
    // Create it...
    $editorOptions = array('id' => 'message', 'value' => $context['message'], 'width' => '90%', 'labels' => array('post_button' => $txt['send_message']), 'preview_type' => 2);
    create_control_richedit($editorOptions);
    // ... and store the ID again...
    $context['post_box_name'] = $editorOptions['id'];
    // Check whether we need to show the code again.
    $context['require_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
    if ($context['require_verification'] && !isset($_REQUEST['xml'])) {
        require_once $sourcedir . '/Subs-Editor.php';
        $verificationOptions = array('id' => 'pm');
//.........这里部分代码省略.........
开发者ID:Glyph13,项目名称:SMF2.1,代码行数:101,代码来源:PersonalMessage.php


示例10: Who

function Who()
{
    global $db_prefix, $context, $scripturl, $user_info, $txt, $modSettings, $ID_MEMBER, $memberContext;
    // Permissions, permissions, permissions.
    isAllowedTo('who_view');
    // You can't do anything if this is off.
    if (empty($modSettings['who_enabled'])) {
        fatal_lang_error('who_off', false);
    }
    // Load the 'Who' template.
    loadTemplate('Who');
    // Sort out... the column sorting.
    $sort_methods = array('user' => 'mem.realName', 'time' => 'lo.logTime');
    // By default order by last time online.
    if (!isset($_REQUEST['sort']) || !isset($sort_methods[$_REQUEST['sort']])) {
        $context['sort_by'] = 'time';
        $_REQUEST['sort'] = 'lo.logTime';
    } else {
        $context['sort_by'] = $_REQUEST['sort'];
        $_REQUEST['sort'] = $sort_methods[$_REQUEST['sort']];
    }
    $context['sort_direction'] = isset($_REQUEST['asc']) ? 'up' : 'down';
    // Get the total amount of members online.
    $request = db_query("\n\t\tSELECT COUNT(*)\n\t\tFROM {$db_prefix}log_online AS lo\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID_MEMBER)" . (!allowedTo('moderate_forum') ? "\n\t\tWHERE IFNULL(mem.showOnline, 1) = 1" : ''), __FILE__, __LINE__);
    list($totalMembers) = mysql_fetch_row($request);
    mysql_free_result($request);
    // Prepare some page index variables.
    $context['page_index'] = constructPageIndex($scripturl . '?action=who;sort=' . $context['sort_by'] . (isset($_REQUEST['asc']) ? ';asc' : ''), $_REQUEST['start'], $totalMembers, $modSettings['defaultMaxMembers']);
    $context['start'] = $_REQUEST['start'];
    // Look for people online, provided they don't mind if you see they are.
    $request = db_query("\n\t\tSELECT\n\t\t\t(UNIX_TIMESTAMP(lo.logTime) - UNIX_TIMESTAMP() + " . time() . ") AS logTime,\n\t\t\tlo.ID_MEMBER, lo.url, INET_NTOA(lo.ip) AS ip, mem.realName, lo.session,\n\t\t\tmg.onlineColor, IFNULL(mem.showOnline, 1) AS showOnline\n\t\tFROM {$db_prefix}log_online AS lo\n\t\t\tLEFT JOIN {$db_prefix}members AS mem ON (lo.ID_MEMBER = mem.ID_MEMBER)\n\t\t\tLEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))" . (!allowedTo('moderate_forum') ? "\n\t\tWHERE IFNULL(mem.showOnline, 1) = 1" : '') . "\n\t\tORDER BY {$_REQUEST['sort']} " . (isset($_REQUEST['asc']) ? 'ASC' : 'DESC') . "\n\t\tLIMIT {$context['start']}, {$modSettings['defaultMaxMembers']}", __FILE__, __LINE__);
    $context['members'] = array();
    $member_ids = array();
    $url_data = array();
    while ($row = mysql_fetch_assoc($request)) {
        $actions = @unserialize($row['url']);
        if ($actions === false) {
            continue;
        }
        // Send the information to the template.
        $context['members'][$row['session']] = array('id' => $row['ID_MEMBER'], 'ip' => allowedTo('moderate_forum') ? $row['ip'] : '', 'time' => strtr(timeformat($row['logTime']), array($txt['smf10'] => '', $txt['smf10b'] => '')), 'timestamp' => forum_time(true, $row['logTime']), 'query' => $actions, 'is_hidden' => $row['showOnline'] == 0, 'color' => empty($row['onlineColor']) ? '' : $row['onlineColor']);
        $url_data[$row['session']] = array($row['url'], $row['ID_MEMBER']);
        $member_ids[] = $row['ID_MEMBER'];
    }
    mysql_free_result($request);
    // Load the user data for these members.
    loadMemberData($member_ids);
    // Load up the guest user.
    $memberContext[0] = array('id' => 0, 'name' => $txt[28], 'group' => $txt[28], 'href' => '', 'link' => $txt[28], 'email' => $txt[28], 'is_guest' => true);
    $url_data = determineActions($url_data);
    // Setup the linktree and page title (do it down here because the language files are now loaded..)
    $context['page_title'] = $txt['who_title'];
    $context['linktree'][] = array('url' => $scripturl . '?action=who', 'name' => $txt['who_title']);
    // Put it in the context variables.
    foreach ($context['members'] as $i => $member) {
        if ($member['id'] != 0) {
            $member['id'] = loadMemberContext($member['id']) ? $member['id'] : 0;
        }
        // Keep the IP that came from the database.
        $memberContext[$member['id']]['ip'] = $member['ip'];
        $context['members'][$i]['action'] = isset($url_data[$i]) ? $url_data[$i] : $txt['who_hidden'];
        $context['members'][$i] += $memberContext[$member['id']];
    }
    // Some people can't send personal messages...
    $context['can_send_pm'] = allowedTo('pm_send');
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:66,代码来源:Who.php


示例11: pmxc_InitContent

 /**
  * InitContent.
  * Checks the cache status and create the content.
  */
 function pmxc_InitContent()
 {
     global $sourcedir, $pmxCacheFunc, $options;
     // if visible init the content
     if ($this->visible) {
         $this->today = array('day' => (int) strftime('%d', forum_time()), 'month' => (int) strftime('%m', forum_time()), 'year' => (int) strftime('%Y', forum_time()), 'date' => strftime('%Y-%m-%d', forum_time()));
         $this->cal_startday = isset($options['calendar_start_day']) ? $options['calendar_start_day'] : $this->cfg['config']['settings']['firstday'];
         $this->cache_key .= '-' . $this->cal_startday;
         $cachedata = null;
         if (!empty($this->cfg['cache'])) {
             if (($cachedata = $pmxCacheFunc['get']($this->cache_key, $this->cache_mode)) !== null) {
                 list($curday, $this->calgrid, $this->calbirthdays, $this->calholidays, $this->calevents) = $cachedata;
                 if ($curday != $this->today['date']) {
                     $pmxCacheFunc['clear']($this->cache_key, $this->cache_mode);
                     $cachedata = null;
                 }
             }
         }
         if (empty($cachedata)) {
             include_once $sourcedir . '/Subs-Calendar.php';
             $calendarOptions = array('start_day' => $this->cal_startday, 'show_birthdays' => false, 'show_events' => false, 'show_holidays' => false, 'show_week_num' => false, 'short_day_titles' => true, 'show_next_prev' => false, 'show_week_links' => false, 'size' => 'small');
             $this->calgrid = getCalendarGrid($this->today['month'], $this->today['year'], $calendarOptions);
             $this->calbirthdays = array();
             if (!empty($this->cfg['config']['settings']['birthdays']['show'])) {
                 $start_data = isset($this->cfg['config']['settings']['birthdays']['before']) ? date('Y-m-d', time() - 86400 * intval($this->cfg['config']['settings']['birthdays']['after'])) : date('Y-m-d');
                 $end_data = isset($this->cfg['config']['settings']['birthdays']['after']) ? date('Y-m-d', time() + 86400 * intval($this->cfg['config']['settings']['birthdays']['before'])) : date('Y-m-d');
                 $temp = getBirthdayRange($start_data, $end_data);
                 foreach ($temp as $key => $val) {
                     $mnt = intval(substr($key, 5, 2));
                     if (in_array($mnt, array(11, 12)) && in_array($this->today['month'], array(1, 12))) {
                         $nkey = strval($this->today['year'] - 1) . substr($key, 4);
                     } else {
                         $nkey = strval($this->today['year']) . substr($key, 4);
                     }
                     $this->calbirthdays[$nkey] = $val;
                 }
                 ksort($this->calbirthdays);
             }
             $this->calholidays = array();
             if (!empty($this->cfg['config']['settings']['holidays']['show'])) {
                 $start_data = isset($this->cfg['config']['settings']['holidays']['before']) ? date('Y-m-d', time() - 86400 * intval($this->cfg['config']['settings']['holidays']['after'])) : date('Y-m-d');
                 $end_data = isset($this->cfg['config']['settings']['holidays']['after']) ? date('Y-m-d', time() + 86400 * intval($this->cfg['config']['settings']['holidays']['before'])) : date('Y-m-d');
                 $this->calholidays = getHolidayRange($start_data, $end_data);
                 ksort($this->calholidays);
             }
             $this->calevents = array();
             if (!empty($this->cfg['config']['settings']['events']['show'])) {
                 $start_data = isset($this->cfg['config']['settings']['events']['before']) ? date('Y-m-d', time() - 86400 * intval($this->cfg['config']['settings']['events']['after'])) : date('Y-m-d');
                 $end_data = isset($this->cfg['config']['settings']['events']['after']) ? date('Y-m-d', time() + 86400 * intval($this->cfg['config']['settings']['events']['before'])) : date('Y-m-d');
                 $events = getEventRange($start_data, $end_data);
                 ksort($events);
                 foreach ($events as $event) {
                     foreach ($event as $data) {
                         if (!array_key_exists($data['id'], $this->calevents)) {
                             $this->calevents[$data['id']] = $data;
                         }
                     }
                 }
             }
             if (!empty($this->cfg['cache'])) {
                 $cachedata = array($this->today['date'], $this->calgrid, $this->calbirthdays, $this->calholidays, $this->calevents);
                 $pmxCacheFunc['put']($this->cache_key, $cachedata, $this->cache_time, $this->cache_mode);
                 unset($cachedata);
             }
         }
     }
     return $this->visible;
 }
开发者ID:thunderamur,项目名称:PortaMx-Virgo-2.0-Beta-2,代码行数:72,代码来源:mini_calendar.php


示例12: list_getModLogEntries


//.........这里部分代码省略.........
        }
        if (isset($row['extra']['board_from'])) {
            $boards[(int) $row['extra']['board_from']][] = $row['id_action'];
        }
        if (isset($row['extra']['board'])) {
            $boards[(int) $row['extra']['board']][] = $row['id_action'];
        }
        // A message?
        if (isset($row['extra']['message'])) {
            $messages[(int) $row['extra']['message']][] = $row['id_action'];
        }
        // IP Info?
        if (isset($row['extra']['ip_range'])) {
            if ($seeIP) {
                $row['extra']['ip_range'] = '<a href="' . $scripturl . '?action=trackip;searchip=' . $row['extra']['ip_range'] . '">' . $row['extra']['ip_range'] . '</a>';
            } else {
                $row['extra']['ip_range'] = $txt['logged'];
            }
        }
        // Email?
        if (isset($row['extra']['email'])) {
            $row['extra']['email'] = '<a href="mailto:' . $row['extra']['email'] . '">' . $row['extra']['email'] . '</a>';
        }
        // Bans are complex.
        if ($row['action'] == 'ban') {
            $row['action_text'] = $txt['modlog_ac_ban'];
            foreach (array('member', 'email', 'ip_range', 'hostname') as $type) {
                if (isset($row['extra'][$type])) {
                    $row['action_text'] .= $txt['modlog_ac_ban_trigger_' . $type];
                }
            }
        }
        // The array to go to the template. Note here that action is set to a "default" value of the action doesn't match anything in the descriptions. Allows easy adding of logging events with basic details.
        $entries[$row['id_action']] = array('id' => $row['id_action'], 'ip' => $seeIP ? $row['ip'] : $txt['logged'], 'position' => empty($row['real_name']) && empty($row['group_name']) ? $txt['guest'] : $row['group_name'], 'moderator_link' => $row['id_member'] ? '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>' : (empty($row['real_name']) ? $txt['guest'] . (!empty($row['extra']['member_acted']) ? ' (' . $row['extra']['member_acted'] . ')' : '') : $row['real_name']), 'time' => timeformat($row['log_time']), 'timestamp' => forum_time(true, $row['log_time']), 'editable' => time() > $row['log_time'] + $context['hoursdisable'] * 3600, 'extra' => $row['extra'], 'action' => $row['action'], 'action_text' => isset($row['action_text']) ? $row['action_text'] : '');
    }
    $smcFunc['db_free_result']($result);
    if (!empty($boards)) {
        $request = $smcFunc['db_query']('', '
			SELECT id_board, name
			FROM {db_prefix}boards
			WHERE id_board IN ({array_int:board_list})
			LIMIT ' . count(array_keys($boards)), array('board_list' => array_keys($boards)));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            foreach ($boards[$row['id_board']] as $action) {
                // Make the board number into a link - dealing with moving too.
                if (isset($entries[$action]['extra']['board_to']) && $entries[$action]['extra']['board_to'] == $row['id_board']) {
                    $entries[$action]['extra']['board_to'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
                } elseif (isset($entries[$action]['extra']['board_from']) && $entries[$action]['extra']['board_from'] == $row['id_board']) {
                    $entries[$action]['extra']['board_from'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
                } elseif (isset($entries[$action]['extra']['board']) && $entries[$action]['extra']['board'] == $row['id_board']) {
                    $entries[$action]['extra']['board'] = '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['name'] . '</a>';
                }
            }
        }
        $smcFunc['db_free_result']($request);
    }
    if (!empty($topics)) {
        $request = $smcFunc['db_query']('', '
			SELECT ms.subject, t.id_topic
			FROM {db_prefix}topics AS t
				INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
			WHERE t.id_topic IN ({array_int:topic_list})
			LIMIT ' . count(array_keys($topics)), array('topic_list' => array_keys($topics)));
        while ($row = $smcFunc['db_fetch_assoc']($request)) {
            foreach ($topics[$row['id_topic']] as $action) {
                $this_action =& $entries[$action];
开发者ID:valek0972,项目名称:hackits,代码行数:67,代码来源:Modlog.php


示例13: PortaMx_AdminArticles


//.........这里部分代码省略.........
                        // load the article for edit/clone
                        $request = $smcFunc['db_query']('', '
							SELECT *
							FROM {db_prefix}portamx_articles
							WHERE id = {int:id}', array('id' => $id));
                        $row = $smcFunc['db_fetch_assoc']($request);
                        $article = array('id' => $row['id'], 'name' => $row['name'], 'catid' => $row['catid'], 'acsgrp' => $row['acsgrp'], 'ctype' => $row['ctype'], 'config' => $row['config'], 'content' => $row['content'], 'active' => $row['active'], 'owner' => $row['owner'], 'created' => $row['created'], 'approved' => $row['approved'], 'approvedby' => $row['approvedby'], 'updated' => $row['updated'], 'updatedby' => $row['updatedby']);
                        $smcFunc['db_free_result']($request);
                        if (!empty($_POST['clone_article'])) {
                            $article['id'] = 0;
                            $article['active'] = 0;
                        

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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