コード例 #1
0
 /**
  * Handle User Data
  *
  * @param int $user_id The user_id of the user we will setup data for
  */
 public function handle_user_data($user_id)
 {
     global $phpbb_root_path, $phpEx, $user, $auth, $config, $template;
     global $blog_data, $zebra_list;
     if (!isset(self::$user[$user_id])) {
         return array();
     }
     $custom_fields = array();
     if ($config['user_blog_custom_profile_enable']) {
         // output the custom profile fields
         if (isset(self::$user[$user_id]['cp_row']['blockrow'])) {
             foreach (self::$user[$user_id]['cp_row']['blockrow'] as $row) {
                 $custom_fields[] = array('PROFILE_FIELD_NAME' => $row['PROFILE_FIELD_NAME'], 'PROFILE_FIELD_VALUE' => $row['PROFILE_FIELD_VALUE']);
             }
         }
     }
     // add the blog links in the custom fields
     if ($user_id != ANONYMOUS) {
         $custom_fields[] = add_blog_links($user_id, '', self::$user[$user_id], false, true, true);
     }
     $output_data = array('USER_ID' => $user_id, 'AGE' => '', 'AVATAR' => $user->optionget('viewavatars') ? self::$user[$user_id]['avatar'] : '', 'POSTER_FROM' => self::$user[$user_id]['user_from'], 'POSTER_JOINED' => $user->format_date(self::$user[$user_id]['user_regdate']), 'POSTER_POSTS' => self::$user[$user_id]['user_posts'], 'RANK_IMG' => self::$user[$user_id]['rank_img'], 'RANK_IMG_SRC' => self::$user[$user_id]['rank_img_src'], 'RANK_TITLE' => self::$user[$user_id]['rank_title'], 'SIGNATURE' => $config['allow_sig'] && $user->optionget('viewsigs') && self::$user[$user_id]['user_sig'] ? generate_text_for_display(self::$user[$user_id]['user_sig'], self::$user[$user_id]['user_sig_bbcode_uid'], self::$user[$user_id]['user_sig_bbcode_bitfield'], 7) : '', 'STATUS_IMG' => self::$user[$user_id]['status'] ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE'), 'USERNAME' => self::$user[$user_id]['username'], 'USER_COLOUR' => self::$user[$user_id]['user_colour'], 'USER_FULL' => self::$user[$user_id]['username_full'], 'USER_FOE' => isset($zebra_list[$user->data['user_id']]['foe']) && in_array($user_id, $zebra_list[$user->data['user_id']]['foe']) ? true : false, 'L_USER_FOE' => sprintf($user->lang['POSTED_BY_FOE'], self::$user[$user_id]['username_full']), 'U_AIM' => self::$user[$user_id]['aim_url'], 'U_EMAIL' => self::$user[$user_id]['email_url'], 'U_ICQ' => self::$user[$user_id]['icq_url'], 'U_JABBER' => self::$user[$user_id]['jabber_url'], 'U_MSN' => self::$user[$user_id]['msn_url'], 'U_PM' => self::$user[$user_id]['pm_url'], 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u={$user_id}"), 'U_WWW' => self::$user[$user_id]['user_website'], 'U_YIM' => self::$user[$user_id]['yim_url'], 'S_CUSTOM_FIELDS' => isset(self::$user[$user_id]['cp_row']['blockrow']) ? true : false, 'S_ONLINE' => self::$user[$user_id]['status'], 'ONLINE_IMG' => self::$user[$user_id]['status'] ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE'), 'USER_EXTRA' => '', 'custom_fields' => $custom_fields);
     if ($config['allow_birthdays'] && !empty(self::$user[$user_id]['user_birthday'])) {
         list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', self::$user[$user_id]['user_birthday']));
         if ($bday_year) {
             $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
             $diff = $now['mon'] - $bday_month;
             if ($diff == 0) {
                 $diff = $now['mday'] - $bday_day < 0 ? 1 : 0;
             } else {
                 $diff = $diff < 0 ? 1 : 0;
             }
             $output_data['AGE'] = (int) ($now['year'] - $bday_year - $diff);
         }
     }
     blog_plugins::plugin_do_ref('user_handle_data', $output_data);
     return $output_data;
 }
コード例 #2
0
ファイル: header.php プロジェクト: EXreaction/User-Blog-Mod
         $db->sql_freeresult();
         if (!$user_id) {
             return;
         }
     }
     if (!function_exists('url_replace')) {
         include $phpbb_root_path . 'blog/includes/functions.' . $phpEx;
     }
     if (!function_exists('get_attachment_data')) {
         include $phpbb_root_path . 'blog/includes/functions_view.' . $phpEx;
     }
     if (!class_exists('blog_plugins')) {
         include $phpbb_root_path . 'blog/plugins/plugins.' . $phpEx;
         new blog_plugins();
     }
     add_blog_links($user_id, 'custom_fields', false, true);
 }
 /* For viewing a PM (must add the custom profile field output on view pm to display them and enable this code)
   else if (request_var('i', '') == 'pm' && request_var('mode', '') == 'view' && request_var('p', 0))
 	{
 		if (!$user_id)
 		{
 			$sql = 'SELECT author_id
 				FROM ' . PRIVMSGS_TABLE . '
 				WHERE  msg_id = ' . request_var('p', 0);
 			$db->sql_query($sql);
 			$user_id = $db->sql_fetchfield('author_id');
 			$db->sql_freeresult();
 
 			if (!$user_id)
 			{