[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/includes/ -> page_header_review.php (source)

   1  <?php
   2  /***************************************************************************
   3   *                              page_header.php
   4   *                            -------------------
   5   *   begin                : Saturday, Feb 13, 2001
   6   *   copyright            : (C) 2001 The phpBB Group
   7   *   email                : support@phpbb.com
   8   *
   9   *   Id: page_header.php,v 1.106.2.4 2002/07/19 16:14:16 psotfx Exp
  10   *
  11   *
  12   ***************************************************************************/
  13  
  14  /***************************************************************************
  15   *   This file is part of the phpBB2 port to Nuke 6.0 (c) copyright 2002
  16   *   by Tom Nitzschner (tom@toms-home.com)
  17   *   http://bbtonuke.sourceforge.net (or http://www.toms-home.com)
  18   *
  19   *   As always, make a backup before messing with anything. All code
  20   *   release by me is considered sample code only. It may be fully
  21   *   functual, but you use it at your own risk, if you break it,
  22   *   you get to fix it too. No waranty is given or implied.
  23   *
  24   *   Please post all questions/request about this port on http://bbtonuke.sourceforge.net first,
  25   *   then on my site. All original header code and copyright messages will be maintained
  26   *   to give credit where credit is due. If you modify this, the only requirement is
  27   *   that you also maintain all original copyright messages. All my work is released
  28   *   under the GNU GENERAL PUBLIC LICENSE. Please see the README for more information.
  29   *
  30   ***************************************************************************/
  31  
  32  /***************************************************************************
  33   *
  34   *   This program is free software; you can redistribute it and/or modify
  35   *   it under the terms of the GNU General Public License as published by
  36   *   the Free Software Foundation; either version 2 of the License, or
  37   *   (at your option) any later version.
  38   *
  39   ***************************************************************************/
  40  
  41  if ( !defined('IN_PHPBB') )
  42  {
  43      die("Hacking attempt");
  44  }
  45  
  46  define('HEADER_INC', TRUE);
  47  
  48  //
  49  // gzip_compression
  50  //
  51  $do_gzip_compress = FALSE;
  52  
  53  //
  54  // Parse and show the overall header.
  55  //
  56  
  57  $template->set_filenames(array(
  58      'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
  59  );
  60  
  61  //
  62  // Generate logged in/logged out status
  63  //
  64  if ( $userdata['session_logged_in'] )
  65  {
  66          $u_login_logout = 'modules.php?name=Your_Account&op=logout&redirect=Forums';
  67          $l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
  68  }
  69  else
  70  {
  71          $u_login_logout = 'modules.php?name=Your_Account&redirect=index';
  72          $l_login_logout = $lang['Login'];
  73  }
  74  
  75  $s_last_visit = ( $userdata['session_logged_in'] ) ? create_date($board_config['default_dateformat'], $userdata['user_lastvisit'], $board_config['board_timezone']) : '';
  76  
  77  //
  78  // Get basic (usernames + totals) online
  79  // situation
  80  //
  81  $user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = " . intval($forum_id) : '';
  82  $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip
  83      FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
  84      WHERE u.user_id = s.session_user_id
  85          AND s.session_time >= ".( time() - 300 ) . "
  86          $user_forum_sql
  87      ORDER BY u.username ASC, s.session_ip ASC";
  88  if( !($result = $db->sql_query($sql)) )
  89  {
  90      message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
  91  }
  92  
  93  $userlist_ary = array();
  94  $userlist_visible = array();
  95  
  96  $logged_visible_online = 0;
  97  $logged_hidden_online = 0;
  98  $guests_online = 0;
  99  $online_userlist = '';
 100  
 101  $prev_user_id = 0;
 102  $prev_user_ip = '';
 103  
 104  while( $row = $db->sql_fetchrow($result) )
 105  {
 106      // User is logged in and therefor not a guest
 107      if ( $row['session_logged_in'] )
 108      {
 109          // Skip multiple sessions for one user
 110          if ( $row['user_id'] != $prev_user_id )
 111          {
 112              $style_color = '';
 113              if ( $row['user_level'] == ADMIN )
 114              {
 115                  $row['username'] = '<b>' . $row['username'] . '</b>';
 116                  $style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
 117              }
 118              else if ( $row['user_level'] == MOD )
 119              {
 120                  $row['username'] = '<b>' . $row['username'] . '</b>';
 121                  $style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
 122              }
 123  
 124              if ( $row['user_allow_viewonline'] )
 125              {
 126                  $user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
 127                  $logged_visible_online++;
 128              }
 129              else
 130              {
 131                  $user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
 132                  $logged_hidden_online++;
 133              }
 134  
 135              if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
 136              {
 137                  $online_userlist .= ( $online_userlist != '' ) ? ', ' . $user_online_link : $user_online_link;
 138              }
 139          }
 140  
 141          $prev_user_id = $row['user_id'];
 142      }
 143      else
 144      {
 145          // Skip multiple sessions for one user
 146          if ( $row['session_ip'] != $prev_session_ip )
 147          {
 148              $guests_online++;
 149          }
 150      }
 151  
 152      $prev_session_ip = $row['session_ip'];
 153  }
 154  
 155  if ( empty($online_userlist) )
 156  {
 157      $online_userlist = $lang['None'];
 158  }
 159  $online_userlist = ( ( isset($forum_id) ) ? $lang['Browsing_forum'] : $lang['Registered_users'] ) . ' ' . $online_userlist;
 160  
 161  $total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
 162  
 163  if ( $total_online_users > $board_config['record_online_users'])
 164  {
 165      $board_config['record_online_users'] = $total_online_users;
 166      $board_config['record_online_date'] = time();
 167  
 168      $sql = "UPDATE " . CONFIG_TABLE . "
 169          SET config_value = '$total_online_users'
 170          WHERE config_name = 'record_online_users'";
 171      if ( !$db->sql_query($sql) )
 172      {
 173          message_die(GENERAL_ERROR, 'Could not update online user record (nr of users)', '', __LINE__, __FILE__, $sql);
 174      }
 175  
 176      $sql = "UPDATE " . CONFIG_TABLE . "
 177          SET config_value = '" . $board_config['record_online_date'] . "'
 178          WHERE config_name = 'record_online_date'";
 179      if ( !$db->sql_query($sql) )
 180      {
 181          message_die(GENERAL_ERROR, 'Could not update online user record (date)', '', __LINE__, __FILE__, $sql);
 182      }
 183  }
 184  
 185  if ( $total_online_users == 0 )
 186  {
 187      $l_t_user_s = $lang['Online_users_zero_total'];
 188  }
 189  else if ( $total_online_users == 1 )
 190  {
 191      $l_t_user_s = $lang['Online_user_total'];
 192  }
 193  else
 194  {
 195      $l_t_user_s = $lang['Online_users_total'];
 196  }
 197  
 198  if ( $logged_visible_online == 0 )
 199  {
 200      $l_r_user_s = $lang['Reg_users_zero_total'];
 201  }
 202  else if ( $logged_visible_online == 1 )
 203  {
 204      $l_r_user_s = $lang['Reg_user_total'];
 205  }
 206  else
 207  {
 208      $l_r_user_s = $lang['Reg_users_total'];
 209  }
 210  
 211  if ( $logged_hidden_online == 0 )
 212  {
 213      $l_h_user_s = $lang['Hidden_users_zero_total'];
 214  }
 215  else if ( $logged_hidden_online == 1 )
 216  {
 217      $l_h_user_s = $lang['Hidden_user_total'];
 218  }
 219  else
 220  {
 221      $l_h_user_s = $lang['Hidden_users_total'];
 222  }
 223  
 224  if ( $guests_online == 0 )
 225  {
 226      $l_g_user_s = $lang['Guest_users_zero_total'];
 227  }
 228  else if ( $guests_online == 1 )
 229  {
 230      $l_g_user_s = $lang['Guest_user_total'];
 231  }
 232  else
 233  {
 234      $l_g_user_s = $lang['Guest_users_total'];
 235  }
 236  
 237  $l_online_users = sprintf($l_t_user_s, $total_online_users);
 238  $l_online_users .= sprintf($l_r_user_s, $logged_visible_online);
 239  $l_online_users .= sprintf($l_h_user_s, $logged_hidden_online);
 240  $l_online_users .= sprintf($l_g_user_s, $guests_online);
 241  
 242  //
 243  // Obtain number of new private messages
 244  // if user is logged in
 245  //
 246  if ( $userdata['session_logged_in'] )
 247  {
 248      if ( $userdata['user_new_privmsg'] )
 249      {
 250          $l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
 251          $l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);
 252  
 253          if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
 254          {
 255              $sql = "UPDATE " . USERS_TABLE . "
 256                  SET user_last_privmsg = " . $userdata['user_lastvisit'] . "
 257                  WHERE user_id = " . $userdata['user_id'];
 258              if ( !$db->sql_query($sql) )
 259              {
 260                  message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql);
 261              }
 262  
 263              $s_privmsg_new = 1;
 264              $icon_pm = $images['pm_new_msg'];
 265          }
 266          else
 267          {
 268              $s_privmsg_new = 0;
 269              $icon_pm = $images['pm_no_new_msg'];
 270          }
 271      }
 272      else
 273      {
 274          $l_privmsgs_text = $lang['No_new_pm'];
 275  
 276          $s_privmsg_new = 0;
 277          $icon_pm = $images['pm_no_new_msg'];
 278      }
 279  
 280      if ( $userdata['user_unread_privmsg'] )
 281      {
 282          $l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
 283          $l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
 284      }
 285      else
 286      {
 287          $l_privmsgs_text_unread = $lang['No_unread_pm'];
 288      }
 289  }
 290  else
 291  {
 292      $icon_pm = $images['pm_no_new_msg'];
 293      $l_privmsgs_text = $lang['Login_check_pm'];
 294      $l_privmsgs_text_unread = '';
 295      $s_privmsg_new = 0;
 296  }
 297  
 298  //
 299  // Generate HTML required for Mozilla Navigation bar
 300  //
 301  $nav_links_html = '';
 302  $nav_link_proto = '<link rel="%s" href="%s" title="%s" />' . "\n";
 303  while( list($nav_item, $nav_array) = @each($nav_links) )
 304  {
 305      if ( !empty($nav_array['url']) )
 306      {
 307          $nav_links_html .= sprintf($nav_link_proto, $nav_item, $nav_array['url'], $nav_array['title']);
 308      }
 309      else
 310      {
 311          // We have a nested array, used for items like <link rel='chapter'> that can occur more than once.
 312          while( list(,$nested_array) = each($nav_array) )
 313          {
 314              $nav_links_html .= sprintf($nav_link_proto, $nav_item, $nested_array['url'], $nested_array['title']);
 315          }
 316      }
 317  }
 318  
 319  //
 320  // The following assigns all _common_ variables that may be used at any point
 321  // in a template.
 322  //
 323  $template->assign_vars(array(
 324      'SITENAME' => $board_config['sitename'],
 325      'SITE_DESCRIPTION' => $board_config['site_desc'],
 326      'PAGE_TITLE' => $page_title,
 327      'LAST_VISIT_DATE' => sprintf($lang['You_last_visit'], $s_last_visit),
 328      'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($board_config['default_dateformat'], time(), $board_config['board_timezone'])),
 329      'TOTAL_USERS_ONLINE' => $l_online_users,
 330      'LOGGED_IN_USER_LIST' => $online_userlist,
 331      'RECORD_USERS' => sprintf($lang['Record_online_users'], $board_config['record_online_users'], create_date($board_config['default_dateformat'], $board_config['record_online_date'], $board_config['board_timezone'])),
 332      'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
 333      'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
 334      'PRIVATE_MESSAGE_NEW_FLAG' => $s_privmsg_new,
 335  
 336      'PRIVMSG_IMG' => $icon_pm,
 337  
 338      'L_USERNAME' => $lang['Username'],
 339      'L_PASSWORD' => $lang['Password'],
 340      'L_LOGIN_LOGOUT' => $l_login_logout,
 341      'L_LOGIN' => $lang['Login'],
 342      'L_LOG_ME_IN' => $lang['Log_me_in'],
 343      'L_AUTO_LOGIN' => $lang['Log_me_in'],
 344      'L_INDEX' => sprintf($lang['Forum_Index'], $board_config['sitename']),
 345      'L_REGISTER' => $lang['Register'],
 346      'L_PROFILE' => $lang['Profile'],
 347      'L_SEARCH' => $lang['Search'],
 348      'L_PRIVATEMSGS' => $lang['Private_Messages'],
 349      'L_WHO_IS_ONLINE' => $lang['Who_is_Online'],
 350      'L_MEMBERLIST' => $lang['Memberlist'],
 351      'L_FAQ' => $lang['FAQ'],
 352      'L_USERGROUPS' => $lang['Usergroups'],
 353      'L_SEARCH_NEW' => $lang['Search_new'],
 354      'L_SEARCH_UNANSWERED' => $lang['Search_unanswered'],
 355      'L_SEARCH_SELF' => $lang['Search_your_posts'],
 356      'L_WHOSONLINE_ADMIN' => sprintf($lang['Admin_online_color'], '<span style="color:#' . $theme['fontcolor3'] . '">', '</span>'),
 357      'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'),
 358  
 359      'U_SEARCH_UNANSWERED' => append_sid('search.'.$phpEx.'?search_id=unanswered'),
 360      'U_SEARCH_SELF' => append_sid('search.'.$phpEx.'?search_id=egosearch'),
 361      'U_SEARCH_NEW' => append_sid('search.'.$phpEx.'?search_id=newposts'),
 362      'U_INDEX' => append_sid('index.'.$phpEx),
 363      'U_REGISTER' => append_sid('profile.'.$phpEx.'?mode=register'),
 364      'U_PROFILE' => append_sid('modules.php?name=Your_Account&op=edituser'),
 365      'U_PRIVATEMSGS' => append_sid('privmsg.'.$phpEx.'?folder=inbox'),
 366      'U_PRIVATEMSGS_POPUP' => append_sid('privmsg.'.$phpEx.'?mode=newpm&popup=1'),
 367      'U_SEARCH' => append_sid('search.'.$phpEx),
 368      'U_MEMBERLIST' => append_sid('memberlist.'.$phpEx),
 369      'U_MODCP' => append_sid('modcp.'.$phpEx),
 370      'U_FAQ' => append_sid('faq.'.$phpEx),
 371      'U_VIEWONLINE' => append_sid('viewonline.'.$phpEx),
 372      'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
 373      'U_MEMBERSLIST' => append_sid('memberlist.'.$phpEx),
 374      'U_GROUP_CP' => append_sid('groupcp.'.$phpEx),
 375  
 376      'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
 377      'S_CONTENT_ENCODING' => $lang['ENCODING'],
 378      'S_CONTENT_DIR_LEFT' => $lang['LEFT'],
 379      'S_CONTENT_DIR_RIGHT' => $lang['RIGHT'],
 380      'S_TIMEZONE' => sprintf($lang['All_times'], $lang[number_format($board_config['board_timezone'])]),
 381      'S_LOGIN_ACTION' => append_sid('login.'.$phpEx),
 382  
 383      'T_HEAD_STYLESHEET' => $theme['head_stylesheet'],
 384      /*
 385      'T_BODY_BACKGROUND' => $theme['body_background'],
 386      'T_BODY_BGCOLOR' => '#'.$theme['body_bgcolor'],
 387      'T_BODY_TEXT' => '#'.$theme['body_text'],
 388      'T_BODY_LINK' => '#'.$theme['body_link'],
 389      'T_BODY_VLINK' => '#'.$theme['body_vlink'],
 390      'T_BODY_ALINK' => '#'.$theme['body_alink'],
 391      'T_BODY_HLINK' => '#'.$theme['body_hlink'],
 392      */
 393      'T_TR_COLOR1' => '#'.$theme['tr_color1'],
 394      'T_TR_COLOR2' => '#'.$theme['tr_color2'],
 395      'T_TR_COLOR3' => '#'.$theme['tr_color3'],
 396      'T_TR_CLASS1' => $theme['tr_class1'],
 397      'T_TR_CLASS2' => $theme['tr_class2'],
 398      'T_TR_CLASS3' => $theme['tr_class3'],
 399      'T_TH_COLOR1' => '#'.$theme['th_color1'],
 400      'T_TH_COLOR2' => '#'.$theme['th_color2'],
 401      'T_TH_COLOR3' => '#'.$theme['th_color3'],
 402      'T_TH_CLASS1' => $theme['th_class1'],
 403      'T_TH_CLASS2' => $theme['th_class2'],
 404      'T_TH_CLASS3' => $theme['th_class3'],
 405      'T_TD_COLOR1' => '#'.$theme['td_color1'],
 406      'T_TD_COLOR2' => '#'.$theme['td_color2'],
 407      'T_TD_COLOR3' => '#'.$theme['td_color3'],
 408      'T_TD_CLASS1' => $theme['td_class1'],
 409      'T_TD_CLASS2' => $theme['td_class2'],
 410      'T_TD_CLASS3' => $theme['td_class3'],
 411      'T_FONTFACE1' => $theme['fontface1'],
 412      'T_FONTFACE2' => $theme['fontface2'],
 413      'T_FONTFACE3' => $theme['fontface3'],
 414      'T_FONTSIZE1' => $theme['fontsize1'],
 415      'T_FONTSIZE2' => $theme['fontsize2'],
 416      'T_FONTSIZE3' => $theme['fontsize3'],
 417      'T_FONTCOLOR1' => '#'.$theme['fontcolor1'],
 418      'T_FONTCOLOR2' => '#'.$theme['fontcolor2'],
 419      'T_FONTCOLOR3' => '#'.$theme['fontcolor3'],
 420      'T_SPAN_CLASS1' => $theme['span_class1'],
 421      'T_SPAN_CLASS2' => $theme['span_class2'],
 422      'T_SPAN_CLASS3' => $theme['span_class3'],
 423  
 424      'NAV_LINKS' => $nav_links_html)
 425  );
 426  
 427  //
 428  // Login box?
 429  //
 430  if ( !$userdata['session_logged_in'] )
 431  {
 432      $template->assign_block_vars('switch_user_logged_out', array());
 433  }
 434  else
 435  {
 436      $template->assign_block_vars('switch_user_logged_in', array());
 437  
 438      if ( !empty($userdata['user_popup_pm']) )
 439      {
 440          $template->assign_block_vars('switch_enable_pm_popup', array());
 441      }
 442  }
 443  
 444  $template->pparse('overall_header');
 445  
 446  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7