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


PHP phpbb_gmgetdate函数代码示例

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


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

示例1: run_gmgetdate_assertion

 protected function run_gmgetdate_assertion()
 {
     $expected = time();
     $date_array = phpbb_gmgetdate($expected);
     $actual = gmmktime($date_array['hours'], $date_array['minutes'], $date_array['seconds'], $date_array['mon'], $date_array['mday'], $date_array['year']);
     $this->assertEquals($expected, $actual);
 }
开发者ID:josh-js,项目名称:phpbb,代码行数:7,代码来源:gmgetdate_test.php

示例2: main

 public function main()
 {
     $asset_path = $this->sitemaker->asset_path;
     $this->sitemaker->add_assets(array('js' => array('//ajax.googleapis.com/ajax/libs/jqueryui/' . JQUI_VERSION . '/jquery-ui.min.js', $asset_path . 'ext/blitze/sitemaker/components/jquery-knob/js/jquery.knob.min.js', $asset_path . 'ext/blitze/sitemaker/components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.js', $asset_path . 'ext/blitze/sitemaker/components/moment/moment.min.js', $asset_path . 'ext/blitze/sitemaker/components/jquery-rss/dist/jquery.rss.min.js', $asset_path . 'ext/blitze/sitemaker/components/jquery.sparkline/index.min.js', '@blitze_sitemaker/assets/adm/dashboard.min.js'), 'css' => array('//ajax.googleapis.com/ajax/libs/jqueryui/' . JQUI_VERSION . '/themes/smoothness/jquery-ui.css', $asset_path . 'ext/blitze/sitemaker/components/fontawesome/css/font-awesome.min.css', $asset_path . 'ext/blitze/sitemaker/components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css', '@blitze_sitemaker/assets/adm/dashboard.min.css')));
     $time = $this->user->create_datetime();
     $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
     $wday = $now['wday'];
     $weekdays = array();
     while ($wday >= 0) {
         $weekdays[$wday] = 0;
         $wday--;
     }
     for ($i = 6, $size = sizeof($weekdays); $i >= $size; $i--) {
         $weekdays[$i] = 0;
     }
     $weekdays = array_reverse($weekdays, true);
     $count = 0;
     $js_weekdays = array();
     for ($i = 6; $i >= 0; $i--) {
         $js_weekdays[] = "{$count}: '" . $this->user->format_date(strtotime("- {$i} days"), 'l M j', true) . "'";
         $count++;
     }
     $this->template->assign_var('UA_WEEKDAYS', join(', ', $js_weekdays));
     $lookback = $now[0] - 6 * 24 * 3600;
     $boarddays = ($now[0] - $this->config['board_startdate']) / 86400;
     $this->get_stats('users', $weekdays, $lookback, $boarddays);
     $this->get_stats('topics', $weekdays, $lookback, $boarddays);
     $this->get_stats('posts', $weekdays, $lookback, $boarddays);
     $this->get_stats('files', $weekdays, $lookback, $boarddays);
     $this->user_contributions();
     // Set up the page
     $this->tpl_name = 'acp_dashboard';
     $this->page_title = 'SITEMAKER_DASHBOARD';
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:34,代码来源:dashboard_module.php

示例3: get

 /**
  * @param $range date range to get (today, week, month, year)
  * @return array
  */
 public function get($range)
 {
     $time = $this->user->create_datetime($this->time);
     $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
     $method = 'get_' . $range;
     $data = array('start' => 0, 'stop' => 0, 'date' => '');
     if (is_callable(array($this, $method))) {
         $data = call_user_func_array(array($this, $method), array($now));
     }
     return $data;
 }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:15,代码来源:date_range.php

示例4: run

    /**
     * Runs this cron task.
     *
     * @return null
     */
    public function run()
    {
        $time = $this->user->create_datetime();
        $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
        // Display birthdays of 29th february on 28th february in non-leap-years
        $leap_year_birthdays = '';
        if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) {
            $leap_year_birthdays = ' OR user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", 29, 2)) . '%"';
        }
        $sql = 'SELECT user_id, username, user_email, user_lang, 
				YEAR(CURRENT_TIMESTAMP) - YEAR(str_to_date(user_birthday, "%d-%m-%Y")) AS age
				FROM ' . USERS_TABLE . ' 
				WHERE user_birthday <> " 0- 0-   0" AND user_birthday <> "" AND 
				(user_birthday LIKE "' . $this->db->sql_escape(sprintf("%2d-%2d-", $now["mday"], $now["mon"])) . '%"' . $leap_year_birthdays . ') AND 
				email_on_birthday + 15778463 < UNIX_TIMESTAMP(now())';
        $result = $this->db->sql_query($sql);
        $msg_list = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $msg_list[] = array('user_id' => $row['user_id'], 'name' => $row['username'], 'email' => $row['user_email'], 'lang' => $row['user_lang'], 'age' => $this->convertNumber($row['age']) . $this->text_number($row['age']), 'time' => time());
        }
        if (sizeof($msg_list)) {
            if ($this->config['email_enable']) {
                if (!class_exists('messenger')) {
                    include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
                }
                $server_url = generate_board_url();
                $messenger = new \messenger(false);
                foreach ($msg_list as $key => $value) {
                    $messenger->template('@forumhulp_emailonbirthday/emailonbirthday', $value['lang']);
                    $messenger->to($value['email'], $value['name']);
                    $messenger->headers('X-AntiAbuse: Board servername - ' . $this->config['server_name']);
                    $messenger->headers('X-AntiAbuse: User_id - ' . $value['user_id']);
                    $messenger->headers('X-AntiAbuse: Username - ' . $value['name']);
                    $messenger->headers('X-AntiAbuse: User IP - ' . '127.0.0.1');
                    $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($value['name']), 'BIRTHDAY' => $value['age'], 'SITENAME' => $this->config['sitename']));
                    $messenger->send(NOTIFY_EMAIL);
                    $sql = 'UPDATE ' . USERS_TABLE . ' SET email_on_birthday = ' . time() . ' WHERE user_id = ' . $value['user_id'];
                    $this->db->sql_query($sql);
                }
                $userlist = array_map(function ($entry) {
                    return $entry['name'];
                }, $msg_list);
                $this->log->add('admin', $this->user->data['user_id'], $this->user->data['session_ip'], 'BIRTHDAYSEND', false, array(implode(', ', $userlist)));
            }
        }
        $this->config->set('email_on_birthday_last_gc', time());
    }
开发者ID:Galixte,项目名称:emailonbirthday,代码行数:52,代码来源:birthday.php

示例5: get_template_side

 /**
  * {@inheritdoc}
  */
 public function get_template_side($module_id)
 {
     // Generate birthday list if required ... / borrowed from index.php 3.0.6
     $birthday_list = $birthday_ahead_list = '';
     if ($this->config['load_birthdays'] && $this->config['allow_birthdays']) {
         $time = $this->user->create_datetime();
         $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
         $cache_days = $this->config['board3_birthdays_ahead_' . $module_id];
         $sql_days = '';
         while ($cache_days > 0) {
             $day = phpbb_gmgetdate($time->getTimestamp() + 86400 * $cache_days + $time->getOffset());
             $like_expression = $this->db->sql_like_expression($this->db->get_any_char() . sprintf('%2d-%2d-', $day['mday'], $day['mon']) . $this->db->get_any_char());
             $sql_days .= " OR u.user_birthday " . $like_expression . "";
             $cache_days--;
         }
         switch ($this->db->get_sql_layer()) {
             case 'mssql':
             case 'mssql_odbc':
                 $order_by = 'u.user_birthday ASC';
                 break;
             default:
                 $order_by = 'SUBSTRING(u.user_birthday FROM 4 FOR 2) ASC, SUBSTRING(u.user_birthday FROM 1 FOR 2) ASC, u.username_clean ASC';
                 break;
         }
         $sql_array = array('SELECT' => 'u.user_id, u.username, u.user_colour, u.user_birthday', 'FROM' => array(USERS_TABLE => 'u'), 'LEFT_JOIN' => array(array('FROM' => array(BANLIST_TABLE => 'b'), 'ON' => 'u.user_id = b.ban_userid')), 'WHERE' => "(b.ban_id IS NULL\n\t\t\t\t\t\tOR b.ban_exclude = 1)\n\t\t\t\t\tAND (u.user_birthday " . $this->db->sql_like_expression($this->db->get_any_char() . sprintf('%2d-%2d-', $now['mday'], $now['mon']) . $this->db->get_any_char()) . " {$sql_days})\n\t\t\t\t\tAND " . $this->db->sql_in_set('u.user_type', array(USER_NORMAL, USER_FOUNDER)), 'ORDER BY' => $order_by);
         $sql = $this->db->sql_build_query('SELECT', $sql_array);
         $result = $this->db->sql_query($sql, 3600);
         $today = sprintf('%2d-%2d-', $now['mday'], $now['mon']);
         while ($row = $this->db->sql_fetchrow($result)) {
             if (substr($row['user_birthday'], 0, 6) == $today) {
                 $birthday_list = true;
                 $this->template->assign_block_vars('board3_birthday_list', array('USER' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'AGE' => ($age = (int) substr($row['user_birthday'], -4)) ? ' (' . ($now['year'] - $age) . ')' : ''));
             } else {
                 if ($this->config['board3_birthdays_ahead_' . $module_id] > 0) {
                     $birthday_ahead_list = true;
                     $this->template->assign_block_vars('board3_birthday_ahead_list', array('USER' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'AGE' => ($age = (int) substr($row['user_birthday'], -4)) ? ' (' . ($now['year'] - $age) . ')' : '', 'DATE' => $this->format_birthday($this->user, $row['user_birthday'], 'd M')));
                 }
             }
         }
         $this->db->sql_freeresult($result);
     }
     // Assign index specific vars
     $this->template->assign_vars(array('BIRTHDAY_LIST' => $birthday_list, 'BIRTHDAYS_AHEAD_LIST' => $this->config['board3_birthdays_ahead_' . $module_id] ? $birthday_ahead_list : '', 'L_BIRTHDAYS_AHEAD' => sprintf($this->user->lang['BIRTHDAYS_AHEAD'], $this->config['board3_birthdays_ahead_' . $module_id]), 'S_DISPLAY_BIRTHDAY_LIST' => $this->config['load_birthdays'] ? true : false, 'S_DISPLAY_BIRTHDAY_AHEAD_LIST' => $this->config['board3_birthdays_ahead_' . $module_id] > 0 ? true : false));
     return 'birthdays_side.html';
 }
开发者ID:sgtevmckay,项目名称:Board3-Portal,代码行数:48,代码来源:birthday_list.php

示例6: test_phpbb_gmgetdate

 /**
  * @dataProvider phpbb_gmgetdate_data
  */
 public function test_phpbb_gmgetdate($timezone_identifier)
 {
     if ($timezone_identifier) {
         $current_timezone = date_default_timezone_get();
         date_default_timezone_set($timezone_identifier);
     }
     $expected = time();
     $date_array = phpbb_gmgetdate($expected);
     $actual = gmmktime($date_array['hours'], $date_array['minutes'], $date_array['seconds'], $date_array['mon'], $date_array['mday'], $date_array['year']);
     // Calling second-granularity time functions twice isn't guaranteed to
     // give the same results. As long as they're in the right order, allow
     // a 1 second difference.
     $this->assertGreaterThanOrEqual($expected, $actual, 'Expected second time to be after (or equal to) the previous one');
     $this->assertLessThanOrEqual(1, abs($actual - $expected), "Expected {$actual} to be within 1 second of {$expected}.");
     if (isset($current_timezone)) {
         date_default_timezone_set($current_timezone);
     }
 }
开发者ID:MrAdder,项目名称:phpbb,代码行数:21,代码来源:gmgetdate_test.php

示例7: _find_birthday_users

    /**
     * @return bool
     */
    private function _find_birthday_users()
    {
        $time = $this->user->create_datetime($this->time);
        $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
        $leap_year_birthdays = $this->_adjust_leap_year($now, $time);
        $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday 
				FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)\n\t\t\t\tWHERE (b.ban_id IS NULL\n\t\t\t\t\tOR b.ban_exclude = 1)\n\t\t\t\t\tAND (u.user_birthday LIKE '" . $this->db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' {$leap_year_birthdays})\n\t\t\t\t\tAND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')
				ORDER BY u.username ASC';
        $result = $this->db->sql_query($sql);
        $show_birthday = false;
        while ($row = $this->db->sql_fetchrow($result)) {
            $show_birthday = true;
            $this->ptemplate->assign_block_vars('birthday', array('USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'USER_AGE' => $this->_get_user_age($row['user_birthday'], $now['year'])));
        }
        $this->db->sql_freeresult($result);
        return $show_birthday;
    }
开发者ID:BogusCurry,项目名称:phpBB-ext-sitemaker,代码行数:21,代码来源:birthday.php

示例8: upcoming_birthdays

    public function upcoming_birthdays()
    {
        $time = $this->user->create_datetime();
        $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
        $today = mktime(0, 0, 0, $now['mon'], $now['mday'], $now['year']);
        // Number of seconds per day
        $secs_per_day = 24 * 60 * 60;
        // We will use the timezone offset for our cache name
        $cache_name = $time->getOffset();
        $cache_name = str_replace('-', 'minus_', $cache_name);
        $cache_name = $cache_name . '_ubl';
        if (($upcomingbirthdays = $this->cache->get('_' . $cache_name)) === false) {
            // Only care about dates ahead of today.  Start date is always tomorrow
            $date_start = $now[0] + $secs_per_day;
            $date_end = $date_start + (int) $this->config['allow_birthdays_ahead'] * $secs_per_day;
            $dates = array();
            while ($date_start <= $date_end) {
                $day = date('j', $date_start);
                $month = date('n', $date_start);
                $dates[] = $this->db->sql_escape(sprintf('%2d-%2d-', $day, $month));
                $date_start = $date_start + $secs_per_day;
            }
            $sql_array = array();
            foreach ($dates as $date) {
                $sql_array[] = "u.user_birthday LIKE '" . $date . "%'";
            }
            $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday, b.ban_id
				FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)\n\t\t\t\tWHERE (b.ban_id IS NULL\n\t\t\t\t\tOR b.ban_exclude = 1)\n\t\t\t\t\tAND (" . implode(' OR ', $sql_array) . ")\n\t\t\t\t\tAND " . $this->db->sql_in_set('u.user_type', array(USER_NORMAL, USER_FOUNDER));
            $result = $this->db->sql_query($sql);
            $upcomingbirthdays = array();
            while ($row = $this->db->sql_fetchrow($result)) {
                $bdday = $bdmonth = 0;
                list($bdday, $bdmonth) = array_map('intval', explode('-', $row['user_birthday']));
                $bdcheck = strtotime(gmdate('Y') . '-' . (int) trim($bdmonth) . '-' . (int) trim($bdday) . ' UTC');
                $bdyear = $bdcheck < $today ? (int) gmdate('Y') + 1 : (int) gmdate('Y');
                $bddate = $bdyear . '-' . (int) $bdmonth . '-' . (int) $bdday;
                // re-write those who have feb 29th as a birthday but only on non leap years
                if ((int) trim($bdday) == 29 && (int) trim($bdmonth) == 2) {
                    if (!$this->is_leap_year($bdyear) && !$time->format('L')) {
                        $bdday = 28;
                        $bddate = $bdyear . '-' . (int) trim($bdmonth) . '-' . (int) trim($bdday);
                    }
                }
                $upcomingbirthdays[] = array('user_birthday_tstamp' => strtotime($bddate . ' UTC'), 'username' => $row['username'], 'user_birthdayyear' => $bdyear, 'user_birthday' => $row['user_birthday'], 'user_id' => $row['user_id'], 'user_colour' => $row['user_colour']);
            }
            $this->db->sql_freeresult($result);
            // cache this data for one hour, this improves performance
            $this->cache->put('_' . $cache_name, $upcomingbirthdays, 3600);
        }
        sort($upcomingbirthdays);
        $birthday_ahead_list = '';
        $tomorrow = mktime(0, 0, 0, $now['mon'], $now['mday'] + 1, $now['year']);
        for ($i = 0, $end = sizeof($upcomingbirthdays); $i < $end; $i++) {
            if ($upcomingbirthdays[$i]['user_birthday_tstamp'] >= $tomorrow && $upcomingbirthdays[$i]['user_birthday_tstamp'] <= $today + $this->config['allow_birthdays_ahead'] * $secs_per_day) {
                $user_link = get_username_string('full', $upcomingbirthdays[$i]['user_id'], $upcomingbirthdays[$i]['username'], $upcomingbirthdays[$i]['user_colour']);
                $birthdate = getdate($upcomingbirthdays[$i]['user_birthday_tstamp']);
                //lets add to the birthday_ahead list.
                $birthday_ahead_list .= ($birthday_ahead_list != '' ? $this->user->lang['COMMA_SEPARATOR'] : '') . '<span title="' . $birthdate['mday'] . '-' . $birthdate['mon'] . '-' . $birthdate['year'] . '">' . $user_link . '</span>';
                if ($age = (int) substr($upcomingbirthdays[$i]['user_birthday'], -4)) {
                    $birthday_ahead_list .= ' (' . ($upcomingbirthdays[$i]['user_birthdayyear'] - $age) . ')';
                }
            }
        }
        // Assign index specific vars
        $this->template->assign_vars(array('BIRTHDAYS_AHEAD_LIST' => $birthday_ahead_list, 'L_BIRTHDAYS_AHEAD' => $this->user->lang('BIRTHDAYS_AHEAD', $this->config['allow_birthdays_ahead'])));
    }
开发者ID:alhitary,项目名称:phpBB-3.1-upcomingbirthdays,代码行数:67,代码来源:main_listener.php

示例9: display_brithdays

    protected function display_brithdays()
    {
        // Generate birthday list if required ...
        if ($this->config['load_birthdays'] && $this->config['allow_birthdays'] && $this->config['phpbb_gallery_disp_birthdays'] && $this->auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) {
            $this->template->assign_vars(array('S_DISPLAY_BIRTHDAY_LIST' => true));
            $time = $this->user->create_datetime();
            $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset());
            // Display birthdays of 29th february on 28th february in non-leap-years
            $leap_year_birthdays = '';
            if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) {
                $leap_year_birthdays = " OR u.user_birthday LIKE '" . $this->db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
            }
            $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
				FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)\n\t\t\t\tWHERE (b.ban_id IS NULL\n\t\t\t\t\tOR b.ban_exclude = 1)\n\t\t\t\t\tAND (u.user_birthday LIKE '" . $this->db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' {$leap_year_birthdays})\n\t\t\t\t\tAND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
            $result = $this->db->sql_query($sql);
            while ($row = $this->db->sql_fetchrow($result)) {
                $birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
                $birthday_year = (int) substr($row['user_birthday'], -4);
                $birthday_age = $birthday_year ? max(0, $now['year'] - $birthday_year) : '';
                $this->template->assign_block_vars('birthdays', array('USERNAME' => $birthday_username, 'AGE' => $birthday_age));
            }
            $this->db->sql_freeresult($result);
        }
    }
开发者ID:here-we-go,项目名称:phpbbgallery,代码行数:25,代码来源:index.php

示例10: memberlist_view_profile

 public function memberlist_view_profile($event)
 {
     $reg_date = phpbb_gmgetdate($event['member']['user_regdate']);
     $member_for = $reg_date['mday'] . ' ' . $reg_date['month'] . ' ' . $reg_date['year'] . ', ' . $reg_date['hours'] . ':' . $reg_date['minutes'] . ':' . $reg_date['seconds'];
     $this->template->assign_vars(array('MEMBER_FOR' => $member_for));
 }
开发者ID:Galixte,项目名称:Member-time-counter,代码行数:6,代码来源:listener.php

示例11: phpbb_show_profile

/**
* Prepare profile data
*/
function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false, $check_can_receive_pm = true)
{
    global $config, $auth, $user, $phpEx, $phpbb_root_path, $phpbb_dispatcher;
    $username = $data['username'];
    $user_id = $data['user_id'];
    $user_rank_data = phpbb_get_user_rank($data, $user_id == ANONYMOUS ? false : $data['user_posts']);
    if (!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail') || $auth->acl_get('a_user')) {
        $email = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=email&amp;u=' . $user_id) : ($config['board_hide_emails'] && !$auth->acl_get('a_user') ? '' : 'mailto:' . $data['user_email']);
    } else {
        $email = '';
    }
    if ($config['load_onlinetrack']) {
        $update_time = $config['load_online_time'] * 60;
        $online = time() - $update_time < $data['session_time'] && (isset($data['session_viewonline']) && $data['session_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
    } else {
        $online = false;
    }
    if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) {
        $last_active = !empty($data['session_time']) ? $data['session_time'] : $data['user_lastvisit'];
    } else {
        $last_active = '';
    }
    $age = '';
    if ($config['allow_birthdays'] && $data['user_birthday']) {
        list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday']));
        if ($bday_year) {
            $now = $user->create_datetime();
            $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset());
            $diff = $now['mon'] - $bday_month;
            if ($diff == 0) {
                $diff = $now['mday'] - $bday_day < 0 ? 1 : 0;
            } else {
                $diff = $diff < 0 ? 1 : 0;
            }
            $age = max(0, (int) ($now['year'] - $bday_year - $diff));
        }
    }
    if (!function_exists('phpbb_get_banned_user_ids')) {
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
    }
    // Can this user receive a Private Message?
    $can_receive_pm = $check_can_receive_pm && ($data['user_type'] != USER_IGNORE && ($data['user_type'] != USER_INACTIVE || $data['user_inactive_reason'] != INACTIVE_MANUAL) && sizeof($auth->acl_get_list($user_id, 'u_readpm')) && !sizeof(phpbb_get_banned_user_ids($user_id, false)) && ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_') || $data['user_allow_pm']));
    // Dump it out to the template
    $template_data = array('AGE' => $age, 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($data['user_regdate']), 'LAST_ACTIVE' => empty($last_active) ? ' - ' : $user->format_date($last_active), 'POSTS' => $data['user_posts'] ? $data['user_posts'] : 0, 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), 'AVATAR_IMG' => phpbb_get_user_avatar($data), 'ONLINE_IMG' => !$config['load_onlinetrack'] ? '' : ($online ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => $config['load_onlinetrack'] && $online ? true : false, 'RANK_IMG' => $user_rank_data['img'], 'RANK_IMG_SRC' => $user_rank_data['img_src'], 'S_JABBER_ENABLED' => $config['jab_enable'] ? true : false, 'S_WARNINGS' => $auth->acl_getf_global('m_') || $auth->acl_get('m_warn') ? true : false, 'U_SEARCH_USER' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", "author_id={$user_id}&amp;sr=posts") : '', 'U_NOTES' => $user_notes_enabled && $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&amp;mode=user_notes&amp;u=' . $user_id, true, $user->session_id) : '', 'U_WARN' => $warn_user_enabled && $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&amp;mode=warn_user&amp;u=' . $user_id, true, $user->session_id) : '', 'U_PM' => $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;mode=compose&amp;u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_JABBER' => $data['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&amp;action=jabber&amp;u=' . $user_id) : '', 'USER_JABBER' => $config['jab_enable'] ? $data['user_jabber'] : '', 'USER_JABBER_IMG' => $config['jab_enable'] && $data['user_jabber'] ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $username), 'L_CONTACT_USER' => $user->lang('CONTACT_USER', $username), 'L_VIEWING_PROFILE' => $user->lang('VIEWING_PROFILE', $username));
    /**
     * Preparing a user's data before displaying it in profile and memberlist
     *
     * @event core.memberlist_prepare_profile_data
     * @var	array	data				Array with user's data
     * @var	array	template_data		Template array with user's data
     * @since 3.1.0-a1
     */
    $vars = array('data', 'template_data');
    extract($phpbb_dispatcher->trigger_event('core.memberlist_prepare_profile_data', compact($vars)));
    return $template_data;
}
开发者ID:hgchen,项目名称:phpbb,代码行数:59,代码来源:functions_display.php

示例12: age

 public function age($user_birthday)
 {
     list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $user_birthday));
     if ($bday_year) {
         $now = $this->user->create_datetime();
         $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset());
         $diff = $now['mon'] - $bday_month;
         if ($diff == 0) {
             $diff = $now['mday'] - $bday_day < 0 ? 1 : 0;
         } else {
             $diff = $diff < 0 ? 1 : 0;
         }
         $age = max(0, (int) ($now['year'] - $bday_year - $diff));
     }
     return $age;
 }
开发者ID:everflux,项目名称:nb-255227,代码行数:16,代码来源:mainlistener.php

示例13: show_profile

/**
* Prepare profile data
*/
function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false)
{
	global $config, $auth, $template, $user, $phpEx, $phpbb_root_path;

	$username = $data['username'];
	$user_id = $data['user_id'];

	$rank_title = $rank_img = $rank_img_src = '';
	get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src);

	if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user'))
	{
		$email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&amp;u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']);
	}
	else
	{
		$email = '';
	}

	if ($config['load_onlinetrack'])
	{
		$update_time = $config['load_online_time'] * 60;
		$online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
	}
	else
	{
		$online = false;
	}

	if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline'))
	{
		$last_visit = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit'];
	}
	else
	{
		$last_visit = '';
	}

	$age = '';

	if ($config['allow_birthdays'] && $data['user_birthday'])
	{
		list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday']));

		if ($bday_year)
		{
			$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);

			$diff = $now['mon'] - $bday_month;
			if ($diff == 0)
			{
				$diff = ($now['mday'] - $bday_day < 0) ? 1 : 0;
			}
			else
			{
				$diff = ($diff < 0) ? 1 : 0;
			}

			$age = max(0, (int) ($now['year'] - $bday_year - $diff));
		}
	}




	// BEGIN PBWoW 2 MOD
	$posts_rank_title = $posts_rank_image = $posts_rank_image_src = $user_special_styling = $user_special_color = '';
	
	get_user_rank(0, (($user_id == ANONYMOUS) ? false : $data['user_posts']), $posts_rank_title, $posts_rank_image, $posts_rank_image_src);
	
	check_rank_special_styling($data['user_rank'], $user_special_styling, $user_special_color);
	$avatar_src = get_user_avatar_src($data['user_avatar'], $data['user_avatar_type']);

	$template->assign_vars(array(
		'AVATAR_SRC'			=> $avatar_src,
		'POSTS_RANK_TITLE'		=> $posts_rank_title,
		'POSTS_RANK_IMG'		=> $posts_rank_image,
		'POSTS_RANK_IMG_SRC'	=> $posts_rank_image_src,
		'USER_SPECIAL_STYLING'	=> $user_special_styling,
		'USER_SPECIAL_COLOR'	=> $user_special_color,
	));
	// END PBWoW 2 MOD
	// Dump it out to the template
	return array(
		'AGE'			=> $age,
		'RANK_TITLE'	=> $rank_title,
		'JOINED'		=> $user->format_date($data['user_regdate']),
		'VISITED'		=> (empty($last_visit)) ? ' - ' : $user->format_date($last_visit),
		'POSTS'			=> ($data['user_posts']) ? $data['user_posts'] : 0,
		'WARNINGS'		=> isset($data['user_warnings']) ? $data['user_warnings'] : 0,

		'USERNAME_FULL'		=> get_username_string('full', $user_id, $username, $data['user_colour']),
		'USERNAME'			=> get_username_string('username', $user_id, $username, $data['user_colour']),
		'USER_COLOR'		=> get_username_string('colour', $user_id, $username, $data['user_colour']),
		'U_VIEW_PROFILE'	=> get_username_string('profile', $user_id, $username, $data['user_colour']),

		'A_USERNAME'		=> addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])),
//.........这里部分代码省略.........
开发者ID:gonzo1247,项目名称:hitman_roa,代码行数:101,代码来源:memberlist.php

示例14: display_posts

    function display_posts(&$master)
    {
        global $user, $template, $config, $phpEx, $db, $auth, $phpbb_root_path, $cache;
        static $bbcode;
        static $display_orders = array('first' => 't.topic_id', 'last' => 't.topic_last_post_time');
        global $phpbb_seo;
        // Usefull for multi bb topic & forum tracking
        // Leave default for single forum eg : '_track'
        $tracking_cookie_name = (defined('XLANG_AKEY') ? XLANG_AKEY : '') . '_track';
        $forum_read_auth =& $master->actions['auth_view_read'];
        // Specific options
        $display_file =& $master->call['display_file'];
        $display_user_info =& $master->call['display_user_info'];
        $display_user_link = !empty($master->call['display_user_link']) ? true : false;
        $display_user_link_key = $display_user_link ? 'full' : 'no_profile';
        $display_link =& $master->call['display_link'];
        $display_pagination =& $master->call['display_pagination'];
        $display_tracking =& $master->call['display_tracking'];
        $display_sig = !empty($master->call['display_sig']) ? (bool) ($config['allow_sig'] && $user->optionget('viewsigs')) : false;
        $display_order = isset($display_orders[$master->call['display_order']]) ? $display_orders[$master->call['display_order']] : $display_orders['first'];
        $display_post_buttons =& $master->call['display_post_buttons'];
        $display_sumarize =& $master->call['display_sumarize'];
        $limit_time_sql = !empty($master->call['limit_time']) ? ' AND t.topic_last_post_time > ' . ($user->time_now - $master->call['limit_time']) : '';
        $order_sql = @$master->call['sort'] == 'ASC' ? ' ASC' : ' DESC';
        if (!$display_tracking) {
            $load_db_lastread = $load_anon_lastread = false;
        } else {
            $load_db_lastread = (bool) ($config['load_db_lastread'] && $user->data['is_registered']);
            $load_anon_lastread = (bool) ($config['load_anon_lastread'] || $user->data['is_registered']);
        }
        // hanlde options
        $limit = $master->call['limit'] >= 1 ? (int) $master->call['limit'] : 5;
        $start =& $master->start;
        if (!$display_pagination || empty($display_file)) {
            $start = 0;
            $display_pagination = false;
        }
        $total_topics = 0;
        $topic_sql = $master->call['topic_sql'];
        $forum_sql = $master->call['forum_sql'];
        $s_global = $master->call['s_global'];
        $bbcode_bitfield = '';
        // Do some reset
        $topic_datas = $topic_ids = $forum_ids = $user_cache = $id_cache = $post_datas = $forum_datas = array();
        $forum_id = $master->call['forum_id'];
        $now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
        // Get The Data, first forums
        if (!$s_global && !$master->call['single_forum'] || $master->call['single_forum'] && empty($master->forum_datas[$master->call['forum_id']])) {
            $sql_array = array('SELECT' => 'f.*', 'FROM' => array(FORUMS_TABLE => 'f'), 'LEFT_JOIN' => array());
            if ($load_db_lastread) {
                $sql_array['SELECT'] .= ', ft.mark_time as forum_mark_time';
                $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id');
            }
            $sql_array['WHERE'] = $forum_sql ? str_replace('t.forum_id', 'f.forum_id', $forum_sql) : '';
            $sql = $db->sql_build_query('SELECT', $sql_array);
            unset($sql_array);
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $forum_id = (int) $row['forum_id'];
                $forum_datas[$forum_id] = $row;
            }
            $db->sql_freeresult($result);
        }
        // Now the topics
        $sql_array = array('SELECT' => 't.*', 'FROM' => array(TOPICS_TABLE => 't'), 'LEFT_JOIN' => array());
        if ($load_db_lastread) {
            $sql_array['SELECT'] .= ', tt.mark_time';
            $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND tt.topic_id = t.topic_id');
        } elseif ($load_anon_lastread && empty($master->tracking_topics)) {
            $master->tracking_topics = isset($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) ? STRIP ? stripslashes($_COOKIE[$config['cookie_name'] . $tracking_cookie_name]) : $_COOKIE[$config['cookie_name'] . $tracking_cookie_name] : '';
            $master->tracking_topics = $master->tracking_topics ? tracking_unserialize($master->tracking_topics) : array();
            if (!$user->data['is_registered']) {
                $user->data['user_lastmark'] = isset($master->tracking_topics['l']) ? (int) (base_convert($master->tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0;
            }
        }
        $sql_where = ($forum_sql ? $forum_sql : '') . $limit_time_sql;
        $sql_where .= $topic_sql ? ($sql_where ? ' AND ' : '') . $topic_sql : '';
        $sql_where .= ($sql_where ? ' AND ' : '') . 't.topic_status <> ' . ITEM_MOVED;
        if ($master->call['single_forum']) {
            $sql_where .= $auth->acl_get('m_approve', $master->call['forum_id']) ? '' : ' AND t.topic_approved = 1';
        } else {
            // only admins and global moderators will see un-approved topics
            // in the forum they have access to.
            $sql_where .= $auth->acl_gets('a_') || $auth->acl_getf_global('m_') ? '' : ' AND t.topic_approved = 1';
        }
        // obtain correct topic count if we display pagination
        if ($display_pagination) {
            $sql = "SELECT COUNT(t.topic_id) AS num_topics\n\t\t\t\tFROM " . TOPICS_TABLE . " t\n\t\t\t\tWHERE {$sql_where}";
            $result = $db->sql_query($sql);
            $total_topics = (int) $db->sql_fetchfield('num_topics');
            $db->sql_freeresult($result);
            // Make sure $start is set to the last page if it exceeds the amount
            if ($start < 0 || $start > $total_topics) {
                $start = $start < 0 ? 0 : floor(($total_topics - 1) / $limit) * $limit;
                // Since we've reached here, $start is not set proper, kill the dupe!
                $url = $display_file . $master->gym_master->html_add_start($start);
                $master->gym_master->seo_kill_dupes($url);
            }
        }
        $sql_array['WHERE'] = $sql_where;
//.........这里部分代码省略.........
开发者ID:Ibrahim-Abdelkader,项目名称:phpbb3,代码行数:101,代码来源:display_posts.php

示例15: html_output


//.........这里部分代码省略.........
                trigger_error('GYM_ERROR_401');
            }
            login_box('', $user->lang['GYM_LOGIN']);
        }
        // Let's kill duplicate now !
        if (!empty($this->url_config['current'])) {
            $this->seo_kill_dupes(append_sid($this->url_config['current']));
        }
        $template->set_filenames(array('body' => 'gym_sitemaps/index_body.html'));
        $this->cache_config['do_cache_main'] = (bool) ($this->cache_config['do_cache_main'] && $this->actions['is_public']);
        $this->cache_config['do_cache_opt'] = (bool) ($this->cache_config['do_cache_opt'] && $this->actions['is_public']);
        $cache_find = array('`(\\?|&amp;|&)sid\\=[a-z0-9]+`i', '`[\\s]+`');
        $cache_replace = array('', ' ');
        $ssl_bit = $phpbb_seo->ssl['use'] ? 'ssl_' : '';
        // Main output
        if (!empty($this->output_data['left_col_tpl'])) {
            $template->set_filenames(array('left_col' => $this->output_data['left_col_tpl']));
            if ($this->cache_config['do_cache_main'] && !empty($this->output_data['left_col_cache_file'])) {
                $cache_file = '_gym_html_' . $this->output_data['left_col_cache_file'] . '_' . $ssl_bit . $user->data['user_lang'] . '_' . $this->start;
                if (($left_col = $cache->get($cache_file)) === false) {
                    $module_obj->html_main();
                    $left_col = $template->assign_display('left_col', '', true);
                    // Strip whitespaces and sids
                    $left_col = preg_replace($cache_find, $cache_replace, $left_col);
                    $cache->put($cache_file, $left_col, $this->cache_config['main_cache_ttl']);
                }
            }
            if (!$left_col) {
                $module_obj->html_main();
                $left_col = $template->assign_display('left_col', '', true);
            }
        }
        // Optional output
        if (!empty($this->output_data['right_col'])) {
            if ($this->cache_config['do_cache_opt'] && !empty($this->output_data['right_col_cache_file'])) {
                $cache_file = '_gym_html_' . $this->output_data['right_col_cache_file'] . '_' . $ssl_bit . $user->data['user_lang'];
                if (($right_col = $cache->get($cache_file)) === false) {
                    $module_obj->html_module();
                    $template->set_filenames(array('right_col' => $this->output_data['right_col_tpl']));
                    $right_col = $template->assign_display('right_col', '', true);
                    // Strip whitespaces and sids
                    $right_col = preg_replace($cache_find, $cache_replace, $right_col);
                    $cache->put($cache_file, $right_col, $this->cache_config['opt_cache_ttl']);
                }
            }
            if (!$right_col) {
                $module_obj->html_module();
                $template->set_filenames(array('right_col' => $this->output_data['right_col_tpl']));
                $right_col = $template->assign_display('right_col', '', true);
            }
        }
        unset($module_obj);
        $tpl_data = array();
        if ($this->actions['display_stats']) {
            // Set some stats, get posts count from forums data if we... hum... retrieve all forums data
            $total_posts = $config['num_posts'];
            $total_topics = $config['num_topics'];
            $total_users = $config['num_users'];
            $l_total_user_s = $total_users == 0 ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
            $l_total_post_s = $total_posts == 0 ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
            $l_total_topic_s = $total_topics == 0 ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
            $tpl_data += array('TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts), 'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics), 'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users));
            if ($this->html_config['html_allow_profile']) {
                $tpl_data += array('NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string($this->html_config['html_allow_profile_links'] ? 'full' : 'no_profile', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])));
            }
        }
        // Generate birthday list if required ...
        if ($this->actions['display_birthdays']) {
            $birthday_list = '';
            $now = phpbb_gmgetdate(time() + $user->timezone + $user->dst);
            // Display birthdays of 29th february on 28th february in non-leap-years
            $leap_year_birthdays = '';
            if ($now['mday'] == 28 && $now['mon'] == 2 && !$user->format_date(time(), 'L')) {
                $leap_year_birthdays = " OR user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'";
            }
            $sql = 'SELECT u.user_id, u.username, u.user_colour, u.user_birthday
				FROM ' . USERS_TABLE . ' u
				LEFT JOIN ' . BANLIST_TABLE . " b ON (u.user_id = b.ban_userid)\n\t\t\t\tWHERE (b.ban_id IS NULL\n\t\t\t\t\tOR b.ban_exclude = 1)\n\t\t\t\t\tAND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' {$leap_year_birthdays})\n\t\t\t\t\tAND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                $birthday_list .= ($birthday_list != '' ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
                if ($age = (int) substr($row['user_birthday'], -4)) {
                    $birthday_list .= ' (' . ($now['year'] - $age) . ')';
                }
            }
            $db->sql_freeresult($result);
            $tpl_data += array('BIRTHDAY_LIST' => $birthday_list, 'S_DISPLAY_BIRTHDAY_LIST' => !empty($birthday_list));
        }
        $template->assign_vars($tpl_data + array('S_SINGLE_TRAKING' => !empty($this->output_data['single_traking']) ? true : false, 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'mode=login'), 'S_SEO_FORUM' => strpos($config['default_lang'], 'fr') !== false ? 'fr/' : 'en/', 'LEFT_COL' => $left_col, 'RIGHT_COL' => $right_col));
        if ($this->actions['pagination_limit'] > 0) {
            // Add page number to title
            $page_title .= $this->start > 0 ? ' - ' . $user->lang['HTML_PAGE'] . ' ' . (floor($this->start / $this->actions['pagination_limit']) + 1) : '';
        }
        page_header($page_title, $this->html_config['html_disp_online']);
        if (!empty($this->html_config['html_logo_url'])) {
            $template->assign_vars(array('SITE_LOGO_IMG' => '<img src="' . $this->path_config['gym_img_url'] . $this->html_config['html_logo_url'] . '" alt="' . $this->output_data['page_title'] . '" />'));
        }
        page_footer();
        return;
    }
开发者ID:Ibrahim-Abdelkader,项目名称:phpbb3,代码行数:101,代码来源:gym_html.php


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