[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_plugins/login_menu/ -> login_menu.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/login_menu/login_menu.php,v $
  14  |     $Revision: 1.52 $
  15  |     $Date: 2006/12/26 14:49:20 $
  16  |     $Author: mrpete $
  17  +----------------------------------------------------------------------------+
  18  */
  19  
  20  if (!defined('e107_INIT')) { exit; }
  21  
  22  if(defined("FPW_ACTIVE"))
  23  {
  24      return;      // prevent failed login attempts when fpw.php is loaded before this menu.
  25  }
  26  
  27  global $eMenuActive, $e107, $tp, $use_imagecode, $ADMIN_DIRECTORY,$bullet;
  28  require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php");
  29  $ip = $e107->getip();
  30  
  31      if(defined("BULLET"))
  32      {
  33             $bullet = "<img src='".THEME_ABS."images/".BULLET."' alt='' style='vertical-align: middle;' />";
  34      }
  35      elseif(file_exists(THEME."images/bullet2.gif"))
  36      {
  37          $bullet = "<img src='".THEME_ABS."images/bullet2.gif' alt='bullet' style='vertical-align: middle;' />";
  38      }
  39      else
  40      {
  41          $bullet = "";
  42      }
  43  
  44  if (defined('CORRUPT_COOKIE') && CORRUPT_COOKIE == TRUE)
  45  {
  46      $text = "<div style='text-align:center'>".LOGIN_MENU_L7."<br /><br />
  47      ".$bullet." <a href='".e_BASE."index.php?logout'>".LOGIN_MENU_L8."</a></div>";
  48      $ns->tablerender(LOGIN_MENU_L9, $text, 'login');
  49  }
  50  $use_imagecode = ($pref['logcode'] && extension_loaded('gd'));
  51  
  52  if ($use_imagecode)
  53  {
  54      global $sec_img;
  55      include_once(e_HANDLER.'secure_img_handler.php');
  56      $sec_img = new secure_image;
  57  }
  58  $text = '';
  59  if (USER == TRUE || ADMIN == TRUE)
  60  {
  61      if (!isset($LOGIN_MENU_LOGGED)) {
  62          if (file_exists(THEME."login_menu_template.php")){
  63                 require (THEME."login_menu_template.php");
  64          }else{
  65              require(e_PLUGIN."login_menu/login_menu_template.php");
  66          }
  67      }
  68  
  69      if(!$LOGIN_MENU_LOGGED){ // if still doesn't exist in the user template.
  70          require(e_PLUGIN."login_menu/login_menu_template.php");
  71      }
  72  
  73      $text = $tp->parseTemplate($LOGIN_MENU_LOGGED, true, $login_menu_shortcodes);
  74  
  75      if (!$sql->db_Select('online', 'online_ip', "`online_ip` = '{$ip}' AND `online_user_id` = '0' "))
  76      {
  77          $sql->db_Delete('online', "`online_ip` = '{$ip}' AND `online_user_id` = '0' ");
  78      }
  79  
  80      $new_total = 0;
  81      $time = USERLV;
  82  
  83          // ------------ News Stats -----------
  84  
  85          if (isset($menu_pref['login_menu']) && $menu_pref['login_menu']['new_news'] == true)
  86          {
  87              $new_news = $sql->db_Count("news", "(*)", "WHERE `news_datestamp` > {$time} AND news_class REGEXP '".e_CLASS_REGEXP."'");
  88              $new_total += $new_news;
  89              if (!$new_news)
  90              {
  91                  $new_news = LOGIN_MENU_L26;
  92              }
  93              $NewItems[] = $new_news.' '.($new_news == 1 ? LOGIN_MENU_L14 : LOGIN_MENU_L15);
  94          }
  95  
  96          // ------------ Comments Stats -----------
  97  
  98          if (varsettrue($menu_pref['login_menu']['new_comments'], false) == true)
  99          {
 100              $new_comments = 0;
 101              $new_comments = $sql->db_Count('comments', '(*)', 'WHERE `comment_datestamp` > '.$time);
 102              $new_total += $new_comments;
 103              if (!$new_comments)
 104              {
 105                  $new_comments = LOGIN_MENU_L26;
 106              }
 107              $NewItems[] = $new_comments.' '.($new_comments == 1 ? LOGIN_MENU_L18 : LOGIN_MENU_L19);
 108          }
 109  
 110          // ------------ Chatbox Stats -----------
 111  
 112          if (isset($menu_pref['login_menu']['new_chatbox']) && $menu_pref['login_menu']['new_chatbox'] == true) {
 113              $display_chats = TRUE;
 114  
 115              if(in_array('chatbox_menu',$eMenuActive)){
 116                  $new_chat = $sql->db_Count('chatbox', '(*)', 'WHERE `cb_datestamp` > '.$time);
 117                  $new_total += $new_chat;
 118              } else {
 119                  $display_chats = FALSE;
 120              }
 121              if (isset($new_chat) && !$new_chat) {
 122                  $new_chat = ($display_chats ? LOGIN_MENU_L26 : '');
 123              }
 124              if ($display_chats == true) {
 125                  $NewItems[] = $new_chat.' '.($new_chat == 1 ? LOGIN_MENU_L16 : LOGIN_MENU_L17);
 126  
 127              }
 128          }
 129  
 130          // ------------ Forum Stats -----------
 131  
 132          if (isset($menu_pref['login_menu']['new_forum']) && $menu_pref['login_menu']['new_forum'] == true) {
 133              $qry = "
 134              SELECT  count(*) as count FROM #forum_t  as t
 135              LEFT JOIN #forum as f
 136              ON t.thread_forum_id = f.forum_id
 137              WHERE t.thread_datestamp > {$time} and f.forum_class IN (".USERCLASS_LIST.")
 138              ";
 139              if($sql->db_Select_gen($qry))
 140              {
 141                  $row = $sql->db_Fetch();
 142                  $new_forum = $row['count'];
 143                  $new_total += $new_forum;
 144              }
 145              if (!$new_forum) {
 146                  $new_forum = LOGIN_MENU_L26;
 147              }
 148              $NewItems[] = $new_forum.' '.($new_forum == 1 ? LOGIN_MENU_L20 : LOGIN_MENU_L21);
 149          }
 150  
 151          // ------------ Member Stats -----------
 152  
 153          if (isset($menu_pref['login_menu']['new_members']) && $menu_pref['login_menu']['new_members'] == true) {
 154              $new_users = $sql->db_Count('user', '(user_join)', 'WHERE user_join > '.$time);
 155              $new_total += $new_users;
 156              if (!$new_users) {
 157                  $new_users = LOGIN_MENU_L26;
 158              }
 159              $NewItems[] = $new_users.' '.($new_users == 1 ? LOGIN_MENU_L22 : LOGIN_MENU_L23);
 160          }
 161          if (isset($NewItems) && $NewItems) {
 162              $text .= '<br /><br /><span class="smalltext">'.LOGIN_MENU_L25.'<br />'.implode(',<br />', $NewItems).'</span>';
 163              if ($new_total) {
 164                  if ($sql -> db_Select("plugin", "plugin_installflag", "plugin_path='list_new' AND plugin_installflag='1'"))
 165                  {
 166                      $text .= '<br /><a href="'.e_PLUGIN.'list_new/list.php?new">'.LOGIN_MENU_L24.'</a>';
 167                  }
 168              }
 169          }
 170  
 171      if (file_exists(THEME.'images/login_menu.png')) {
 172          $caption = '<img src="'.THEME_ABS.'images/login_menu.png" alt="" />'.LOGIN_MENU_L5.' '.USERNAME;
 173      } else {
 174          $caption = LOGIN_MENU_L5.' '.USERNAME;
 175      }
 176      $ns->tablerender($caption, $text, 'login');
 177  } else {
 178      if (!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE) {
 179          if (file_exists(THEME."login_menu_template.php")){
 180                 require_once (THEME."login_menu_template.php");
 181          }else{
 182              require_once(e_PLUGIN."login_menu/login_menu_template.php");
 183          }
 184      }
 185      if(!$LOGIN_MENU_FORM || !$LOGIN_MENU_MESSAGE){
 186          require(e_PLUGIN."login_menu/login_menu_template.php");
 187      }
 188  
 189      if (strpos(e_SELF, $ADMIN_DIRECTORY) === FALSE)
 190      {
 191  
 192          if (LOGINMESSAGE != '') {
 193              $text = $tp->parseTemplate($LOGIN_MENU_MESSAGE, true, $login_menu_shortcodes);
 194          }
 195  
 196          $text .= '<form method="post" action="'.e_SELF.(e_QUERY ? '?'.e_QUERY : '').'">';
 197          $text .= $tp->parseTemplate($LOGIN_MENU_FORM, true, $login_menu_shortcodes);
 198          $text .= '</form>';
 199      } else {
 200          $text = $tp->parseTemplate("<div style='padding-top: 150px'>{LM_FPW_LINK}</div>", true, $login_menu_shortcodes);
 201      }
 202  
 203  
 204      if (file_exists(THEME.'images/login_menu.png')) {
 205          $caption = '<img src="'.THEME_ABS.'images/login_menu.png" alt="" />'.LOGIN_MENU_L5;
 206      } else {
 207          $caption = LOGIN_MENU_L5;
 208      }
 209      $ns->tablerender($caption, $text, 'login');
 210  }
 211  
 212  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7