From 8962c13f5098a8e9d6b280caad0a118c283b87f9 Mon Sep 17 00:00:00 2001 From: e107steved Date: Mon, 2 Jan 2012 22:06:22 +0000 Subject: [PATCH] Update function calls where moved from e107_class.php to iphandler_class.php --- class2.php | 6 ++-- e107_admin/admin_log.php | 6 ++-- e107_admin/fla.php | 5 ++-- e107_admin/includes/infopanel.php | 2 +- e107_admin/newspost.php | 2 +- e107_admin/users.php | 4 +-- .../shortcodes/batch/comment_shortcodes.php | 2 +- e107_handlers/admin_log_class.php | 6 ++-- e107_handlers/comment_class.php | 2 +- e107_handlers/e107_class.php | 7 +++-- e107_handlers/form_handler.php | 6 ++-- e107_handlers/iphandler_class.php | 28 +++++++++++++++++++ e107_handlers/login.php | 4 +-- e107_handlers/mysql_class.php | 2 +- e107_handlers/notify_class.php | 2 +- e107_handlers/online_class.php | 4 +-- e107_handlers/user_handler.php | 10 +++++-- e107_handlers/user_model.php | 2 +- e107_plugins/banner/banner.php | 2 +- e107_plugins/calendar_menu/ecal_class.php | 2 +- e107_plugins/chatbox_menu/chatbox_menu.php | 2 +- e107_plugins/content/content.php | 2 +- .../core/shortcodes/batch/view_shortcodes.php | 4 +-- e107_plugins/forum/forum_post.php | 2 +- e107_plugins/login_menu/login_menu.php | 2 +- e107_plugins/poll/poll_class.php | 2 +- e107_themes/templates/footer_default.php | 2 +- email.php | 2 +- fpw.php | 4 +-- request.php | 6 ++-- search.php | 2 +- signup.php | 4 +-- submitnews.php | 2 +- 33 files changed, 87 insertions(+), 53 deletions(-) diff --git a/class2.php b/class2.php index 896440360..fd3ca0619 100644 --- a/class2.php +++ b/class2.php @@ -594,7 +594,7 @@ init_session(); //DEPRECATED but necessary. BC Fix. function getip() { - return e107::ipDecode(USERIP); + return e107::getIPHandler()->ipDecode(USERIP); } // for multi-language these definitions needs to come after the language loaded. @@ -832,7 +832,7 @@ if (($_SERVER['QUERY_STRING'] == 'logout')/* || (($pref['user_tracking'] == 'ses } } - $ip = $e107->getip(); + // $ip = e107::getIPHandler()->getIP(FALSE); Appears to not be used, so removed $udata = (USER === true ? USERID.'.'.USERNAME : '0'); // TODO - should be done inside online handler, more core areas need it (session handler for example) @@ -1493,7 +1493,7 @@ function init_session() // New user model $user = e107::getUser(); - define('USERIP', $e107->getip()); + define('USERIP', e107::getIPHandler()->getIP(FALSE)); define('POST_REFERER', md5($user->getToken())); // Check for intruders - outside the model for now diff --git a/e107_admin/admin_log.php b/e107_admin/admin_log.php index 23b03fa81..956a2fdfc 100644 --- a/e107_admin/admin_log.php +++ b/e107_admin/admin_log.php @@ -796,7 +796,7 @@ if(isset($page_title[$action])) $text .= " ".RL_LAN_060." - +
".RL_LAN_061."
"; @@ -981,10 +981,10 @@ if(isset($page_title[$action])) $val = preg_replace_callback("#\[!(\w+?)(=.+?){0,1}!]#", 'log_process', $row['dblog_remarks']); break; case 'dblog_ip': - $val = $e107->ipDecode($row['dblog_ip']); + $val = e107::getIPHandler()->ipDecode($row['dblog_ip']); break; case 'comment_ip': - $val = $e107->ipDecode($row['comment_ip']); + $val = e107::getIPHandler()->ipDecode($row['comment_ip']); /* if (strlen($val) == 8) // New decoder should handle this automatically { $hexip = explode('.', chunk_split($val, 2, '.')); diff --git a/e107_admin/fla.php b/e107_admin/fla.php index 303f307e2..ebaca3d86 100644 --- a/e107_admin/fla.php +++ b/e107_admin/fla.php @@ -88,7 +88,8 @@ if(isset($_POST['delbanSubmit'])) if($sql->db_Select("generic", "*", "gen_id={$ban}")) { $at = $sql->db_Fetch(); - if (!$e107->add_ban(4, FLALAN_4, $at['gen_ip'], ADMINID)) + //if (!$e107->add_ban(4, FLALAN_4, $at['gen_ip'], ADMINID)) + if (!e107::getIPHandler()add_ban(4, FLALAN_4, $at['gen_ip'], ADMINID)) { // IP on whitelist (although possibly we shouldn't get to this stage, but check anyway $emessage->add(str_replace(FLALAN_18,'--IP--',$at['gen_ip']), E_MESSAGE_WARNING); } @@ -184,7 +185,7 @@ else ".$gen->convert_date($gen_datestamp, "forum")." ".$gen_chardata." - ".$e107->ipDecode($fa['gen_ip'])."
{$host} + ".e107::getIPHandler()->ipDecode($fa['gen_ip'])."
{$host} ".$frm->checkbox('fladelete[]', $gen_id)." diff --git a/e107_admin/includes/infopanel.php b/e107_admin/includes/infopanel.php index 21ecc1901..e8e5e56b4 100644 --- a/e107_admin/includes/infopanel.php +++ b/e107_admin/includes/infopanel.php @@ -157,7 +157,7 @@ $text .= " $text .= " ".e107::getDateConvert()->convert_date($val['online_timestamp'],'%H:%M:%S')." ".renderOnlineName($val['online_user_id'])." - ".e107::ipDecode($val['online_ip'])." + ".e107::getIPHandler()->ipDecode($val['online_ip'])." ".$tp->text_truncate($val['online_location'],50,'...')." ".$tp->text_truncate(str_replace("/"," / ",$val['online_agent']),20,'...')." diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 6586b40c9..6a5b38aa8 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -2320,7 +2320,7 @@ class admin_newspost "; $text .= "".date('D jS M, Y, g:ia', $row['submitnews_datestamp'])." - ipDecode($row['submitnews_ip'])."'>".$row['submitnews_name']." + ipDecode($row['submitnews_ip'])."'>".$row['submitnews_name']." ".$newsCat[$row['submitnews_category']]." ".($row['submitnews_auth'] == 0 ? "-" : ADMIN_TRUE_ICON)." diff --git a/e107_admin/users.php b/e107_admin/users.php index c1bd479d8..c683321d3 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -1334,7 +1334,7 @@ class users break; case 'user_ip': - return $e107->ipDecode($row['user_ip']); + return e107::getIPHandler()->ipDecode($row['user_ip']); break; @@ -1775,7 +1775,7 @@ class users } else { - if ($e107->add_ban(6,USRLAN_149.$row['user_name'].'/'.$row['user_loginname'],$row['user_ip'],USERID)) + if (e107::getIPHandler()->add_ban(6,USRLAN_149.$row['user_name'].'/'.$row['user_loginname'],$row['user_ip'],USERID)) { // Successful IP ban $this->show_message(str_replace("{IP}",$row['user_ip'],USRLAN_137)); diff --git a/e107_core/shortcodes/batch/comment_shortcodes.php b/e107_core/shortcodes/batch/comment_shortcodes.php index 13f6f1291..d1c205749 100644 --- a/e107_core/shortcodes/batch/comment_shortcodes.php +++ b/e107_core/shortcodes/batch/comment_shortcodes.php @@ -128,7 +128,7 @@ SC_END SC_BEGIN IPADDRESS global $IPADDRESS, $comrow, $e107; //require_once(e_HANDLER."encrypt_handler.php"); -return (ADMIN ? "".COMLAN_330." ".$e107->ipDecode($comrow['comment_ip'])."" : ""); +return (ADMIN ? "".COMLAN_330." ".e107::getIPHandler()->ipDecode($comrow['comment_ip'])."" : ""); SC_END SC_BEGIN LEVEL diff --git a/e107_handlers/admin_log_class.php b/e107_handlers/admin_log_class.php index b834777a0..838d56708 100644 --- a/e107_handlers/admin_log_class.php +++ b/e107_handlers/admin_log_class.php @@ -205,8 +205,8 @@ class e_admin_log // Calculations common to all logs //--------------------------------------- $userid = (USER === TRUE) ? USERID : 0; - $userstring = (USER === true ? USERNAME : "LAN_ANONYMOUS"); - $userIP = $e107->getip(); + $userstring = (USER === true ? USERNAME : 'LAN_ANONYMOUS'); + $userIP = e107::getIPHandler()->getIP(FALSE); $importance = $tp->toDB($importance, true, false, 'no_html'); $eventcode = $tp->toDB($eventcode, true, false, 'no_html'); @@ -331,7 +331,7 @@ class e_admin_log else $userid = (USER === TRUE) ? USERID : 0; if ($u_name) $userstring = $u_name; else $userstring = (USER === true ? USERNAME : "LAN_ANONYMOUS"); - $userIP = $e107->getip(); + $userIP = e107::getIPHandler()->getIP(FALSE); $eventcode = 'USER_'.$event_type; $title = 'LAN_AUDIT_LOG_0'.$event_type; // This creates a string which will be displayed as a constant diff --git a/e107_handlers/comment_class.php b/e107_handlers/comment_class.php index ae84a12c8..3c34b93b6 100644 --- a/e107_handlers/comment_class.php +++ b/e107_handlers/comment_class.php @@ -239,7 +239,7 @@ class comment $unblock = "[".COMLAN_1."] "; $block = "[".COMLAN_2."] "; $delete = "[".COMLAN_3."] "; - $userinfo = "[".COMLAN_4."]"; + $userinfo = "[".COMLAN_4."]"; if (!$COMMENTSTYLE) { global $THEMES_DIRECTORY; diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 85e9a6bcb..233d6c739 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -2604,15 +2604,16 @@ class e107 * * @return boolean check result */ + /* public function add_ban($bantype, $ban_message = '', $ban_ip = '', $ban_user = 0, $ban_notes = '') { return e107::getIPHandler()->add_ban($bantype, $ban_message, $ban_ip, $ban_user, $ban_notes); - } + } */ /** * Get the current user's IP address * returns the address in internal 'normalised' IPV6 format - so most code should continue to work provided the DB Field is big enougn - * FIXME - call ipHandler directly + * FIXME - call ipHandler directly (done for core - left temporarily for BC) * @return string */ public function getip() @@ -2638,7 +2639,7 @@ class e107 * Set $IP4Legacy TRUE to display 'old' (IPv4) addresses in the familiar dotted format, * FALSE to display in standard IPV6 format * Should handle most things that can be thrown at it. - * FIXME - moved to ipHandler - check for calls elsewhere + * FIXME - moved to ipHandler - check for calls elsewhere - core done; left temporarily for BC * @param string $ip encoded IP * @param boolean $IP4Legacy * @return string decoded IP diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 37e19298a..83286cc72 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1298,8 +1298,8 @@ class e_form break; case 'ip': - $e107 = e107::getInstance(); - $value = $e107->ipDecode($value); + //$e107 = e107::getInstance(); + $value = e107::getIPHandler()->ipDecode($value); // else same break; @@ -1637,7 +1637,7 @@ class e_form break; case 'ip': - return $this->text($key, e107::getInstance()->ipDecode($value), 32, $parms); + return $this->text($key, e107::getIPHandler()->ipDecode($value), 32, $parms); break; case 'url': diff --git a/e107_handlers/iphandler_class.php b/e107_handlers/iphandler_class.php index 0531a174f..cee686518 100644 --- a/e107_handlers/iphandler_class.php +++ b/e107_handlers/iphandler_class.php @@ -743,6 +743,34 @@ class eIPHandler } + + /** + * Split up an email address to check for banned domains. + * @param string $email - email address to process + * @param string $fieldname - name of field being searched in DB + * + * @return bool|string false if invalid address. Otherwise returns a set of values to check + * (Moved in from user_handler.php) + */ + public function makeEmailQuery($email, $fieldname = 'banlist_ip') + { + $tp = e107::getParser(); + $tmp = strtolower($tp -> toDB(trim(substr($email, strrpos($email, "@")+1)))); // Pull out the domain name + if ($tmp == '') return FALSE; + if (strpos($tmp,'.') === FALSE) return FALSE; + $em = array_reverse(explode('.',$tmp)); + $line = ''; + $out = array($fieldname."='*@{$tmp}'"); // First element looks for domain as email address + foreach ($em as $e) + { + $line = '.'.$e.$line; + $out[] = '`'.$fieldname."`='*{$line}'"; + } + return implode(' OR ',$out); + } + + + /** * Routines beyond here are to handle banlist-related tasks which involve the DB * note: Most of these routines already existed; moved in from e107_class.php diff --git a/e107_handlers/login.php b/e107_handlers/login.php index 1fa8ebd74..0b6d42f91 100644 --- a/e107_handlers/login.php +++ b/e107_handlers/login.php @@ -514,8 +514,8 @@ class userlogin $fails = $this->e107->sql->db_Count("generic", "(*)", "WHERE gen_ip='{$this->userIP}' AND gen_type='failed_login' "); if($fails > 10) { - $this->e107->add_ban(4,LAN_LOGIN_18,$this->userIP,1); - $this->e107->sql->db_Insert("generic", "0, 'auto_banned', '".time()."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".$this->e107->tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' "); + e107::getIPHandler()->add_ban(4,LAN_LOGIN_18,$this->userIP,1); + e107::getDb()->db_Insert("generic", "0, 'auto_banned', '".time()."', 0, '{$this->userIP}', '{$extra_text}', '".LAN_LOGIN_20.": ".$this->e107->tp -> toDB($username).", ".LAN_LOGIN_17.": ".md5($ouserpass)."' "); } } } diff --git a/e107_handlers/mysql_class.php b/e107_handlers/mysql_class.php index 5cba3484d..0894ea70f 100644 --- a/e107_handlers/mysql_class.php +++ b/e107_handlers/mysql_class.php @@ -244,7 +244,7 @@ class e_db_mysql list($time_usec, $time_sec) = explode(" ", microtime()); $uid = (USER) ? USERID : '0'; $userstring = ( USER === true ? USERNAME : "LAN_ANONYMOUS"); - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $qry = $tp->toDB($log_query); $this->db_Insert('dblog', "0, {$time_sec}, {$time_usec}, '{$log_type}', 'DBDEBUG', {$uid}, '{$userstring}', '{$ip}', '', '{$log_remark}', '{$qry}'"); } diff --git a/e107_handlers/notify_class.php b/e107_handlers/notify_class.php index 12b788496..fdf44db7f 100644 --- a/e107_handlers/notify_class.php +++ b/e107_handlers/notify_class.php @@ -215,7 +215,7 @@ function notify_userveri($data) global $nt, $e107; $msgtext = NT_LAN_UV_2.$data['user_id']."\n"; $msgtext .= NT_LAN_UV_3.$data['user_loginname']."\n"; - $msgtext .= NT_LAN_UV_4.$e107->getip(); + $msgtext .= NT_LAN_UV_4.e107::getIPHandler()->getIP(FALSE); $nt->send('userveri', NT_LAN_UV_1, $msgtext); } diff --git a/e107_handlers/online_class.php b/e107_handlers/online_class.php index c4bd00663..3b51ce6c8 100755 --- a/e107_handlers/online_class.php +++ b/e107_handlers/online_class.php @@ -94,7 +94,7 @@ class e_online $page = e_REQUEST_URI; // mod rewrite & single entry support // FIXME parse url, trigger registered e_online callbacks $page = $e107->tp->toDB($page, true); /// @todo - try not to use toDB() - triggers prefilter - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $udata = ($user->isUser() ? $user->getId().'.'.$user->getName() : '0'); $agent = $_SERVER['HTTP_USER_AGENT']; @@ -208,7 +208,7 @@ class e_online if ($row['online_pagecount'] > $online_bancount) { include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_banlist.php'); - if ($e107->add_ban(2,str_replace('--HITS--',$row['online_pagecount'],BANLAN_78),$ip,0)) + if (e107::getIPHandler()->add_ban(2,str_replace('--HITS--',$row['online_pagecount'],BANLAN_78),$ip,0)) { e107::getEvent()->trigger('flood', $ip); exit; diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index 123d79e5a..9fb6eed83 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -416,9 +416,13 @@ class UserHandler * @param string $fieldname - name of field being searched in DB * * @return bool|string false if invalid address. Otherwise returns a set of values to check + * Moved to IPHandler */ + /* public function make_email_query($email, $fieldname = 'banlist_ip') { + return e107::getIPHandler()->makeEmailQuery($v, $fieldname); // Valid 'stub' if required + $tp = e107::getParser(); $tmp = strtolower($tp -> toDB(trim(substr($email, strrpos($email, "@")+1)))); // Pull out the domain name if ($tmp == '') return FALSE; @@ -433,7 +437,7 @@ class UserHandler } return implode(' OR ',$out); } - + */ @@ -610,9 +614,9 @@ Following fields auto-filled in code as required: } else { // See if email address banned - $wc = $this->make_email_query($v); // Generate the query for the ban list + $wc = e107::getIPHandler()->makeEmailQuery($v); // Generate the query for the ban list if ($wc) { $wc = "`banlist_ip`='{$v}' OR ".$wc; } - if (($wc === FALSE) || !e107::getInstance()->check_ban($wc, FALSE, TRUE)) + if (($wc === FALSE) || !e107::getIPHandler()->checkBan($wc, FALSE, TRUE)) { // echo "Email banned
"; $errMsg = ERR_BANNED_EMAIL; diff --git a/e107_handlers/user_model.php b/e107_handlers/user_model.php index 694bb63f6..942510fdc 100644 --- a/e107_handlers/user_model.php +++ b/e107_handlers/user_model.php @@ -1229,7 +1229,7 @@ class e_user extends e_user_model { $sql = e107::getDb(); $this->set('last_ip', $this->get('user_ip')); - $current_ip = e107::getInstance()->getip(); + $current_ip = e107::getIPHandler()->getIP(FALSE); $update_ip = $this->get('user_ip' != $current_ip ? ", user_ip = '".$current_ip."'" : ""); $this->set('user_ip', $current_ip); if($this->get('user_currentvisit') + 3600 < time() || !$this->get('user_lastvisit')) diff --git a/e107_plugins/banner/banner.php b/e107_plugins/banner/banner.php index 1b59c21fb..a80f82bdc 100644 --- a/e107_plugins/banner/banner.php +++ b/e107_plugins/banner/banner.php @@ -43,7 +43,7 @@ if (e_QUERY) { $query_string = intval(e_QUERY); $sql->db_Select("banner", "*", "banner_id = '{$query_string}' "); $row = $sql->db_Fetch(); - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $newip = (strpos($row['banner_ip'], "{$ip}^") !== FALSE) ? $row['banner_ip'] : "{$row['banner_ip']}{$ip}^"; $sql->db_Update("banner", "banner_clicks = banner_clicks + 1, `banner_ip` = '{$newip}' WHERE `banner_id` = '{$query_string}'"); header("Location: {$row['banner_clickurl']}"); diff --git a/e107_plugins/calendar_menu/ecal_class.php b/e107_plugins/calendar_menu/ecal_class.php index 10735df6c..a8b076d6d 100644 --- a/e107_plugins/calendar_menu/ecal_class.php +++ b/e107_plugins/calendar_menu/ecal_class.php @@ -316,7 +316,7 @@ class ecal_class } else $cmessage .= "Event Start unknown
"; - $edata_ec = array('cmessage' => $cmessage, 'ip' => $e107->getip()); + $edata_ec = array('cmessage' => $cmessage, 'ip' => e107::getIPHandler()->getIP(FALSE)); switch ($event_type) { case 5 : diff --git a/e107_plugins/chatbox_menu/chatbox_menu.php b/e107_plugins/chatbox_menu/chatbox_menu.php index 464133e21..7ee8d5127 100644 --- a/e107_plugins/chatbox_menu/chatbox_menu.php +++ b/e107_plugins/chatbox_menu/chatbox_menu.php @@ -70,7 +70,7 @@ if(isset($_POST['chat_submit']) && $_POST['cmessage'] != '') else { $datestamp = time(); - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); if(USER) { $nick = USERID.".".USERNAME; diff --git a/e107_plugins/content/content.php b/e107_plugins/content/content.php index dd87c822c..2fb1200d9 100644 --- a/e107_plugins/content/content.php +++ b/e107_plugins/content/content.php @@ -1083,7 +1083,7 @@ function show_content_item() //update refer count outside of cache (count visits ^ count unique ips) if( varsettrue($content_pref["content_log"]) ){ - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $self = e_SELF; $refertmp = explode("^", $row['content_refer']); if(strpos($self, "admin") === FALSE){ diff --git a/e107_plugins/forum/core/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/core/shortcodes/batch/view_shortcodes.php index f7ad23d16..4ecc46c93 100644 --- a/e107_plugins/forum/core/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/core/shortcodes/batch/view_shortcodes.php @@ -118,7 +118,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if($this->postInfo['post_user_anon'] && (ADMIN || MODERATOR)) { - return $this->e107->ipDecode($this->postInfo['post_ip']); + return e107::getIPHandler()->ipDecode($this->postInfo['post_ip']); } } @@ -126,7 +126,7 @@ class plugin_forum_view_shortcodes extends e_shortcode { if((ADMIN || MODERATOR) && !$this->postInfo['user_admin']) { - return $this->e107->ipDecode($this->postInfo['post_ip']); + return e107::getIPHandler()->ipDecode($this->postInfo['post_ip']); } } diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index 59b809b46..59acb0008 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -222,7 +222,7 @@ if (isset($_POST['newthread']) || isset($_POST['reply'])) exit; } $hasPoll = ($action == 'nt' && varset($_POST['poll_title']) && $_POST['poll_option'][0] != '' && $_POST['poll_option'][1] != ''); - $postInfo['post_ip'] = $e107->getip(); + $postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE); if (USER) { diff --git a/e107_plugins/login_menu/login_menu.php b/e107_plugins/login_menu/login_menu.php index 248735c4e..356513e40 100644 --- a/e107_plugins/login_menu/login_menu.php +++ b/e107_plugins/login_menu/login_menu.php @@ -36,7 +36,7 @@ if(defined('FPW_ACTIVE')) global $eMenuActive, $pref, $e107, $sql, $tp, $ns, $use_imagecode, $ADMIN_DIRECTORY, $LOGIN_MENU_MESSAGE, $LOGIN_MENU_STATITEM, $LM_STATITEM_SEPARATOR, $login_menu_shortcodes, $LOGIN_MENU_FORM, $LOGIN_MENU_LOGGED, $LOGIN_MENU_STATS, $LOGIN_MENU_EXTERNAL_LINK; -$ip = $e107->getip(); +$ip = e107::getIPHandler()->getIP(FALSE); //shortcodes require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php"); diff --git a/e107_plugins/poll/poll_class.php b/e107_plugins/poll/poll_class.php index 33c220cbc..5d427a17a 100644 --- a/e107_plugins/poll/poll_class.php +++ b/e107_plugins/poll/poll_class.php @@ -186,7 +186,7 @@ class poll break; case POLL_MODE_IP: - $userid = $e107->getip(); + $userid = e107::getIPHandler()->getIP(FALSE); $voted_ids = explode('^', substr($pollArray['poll_ip'], 0, -1)); if (in_array($userid, $voted_ids)) { diff --git a/e107_themes/templates/footer_default.php b/e107_themes/templates/footer_default.php index aa63670d2..038006608 100644 --- a/e107_themes/templates/footer_default.php +++ b/e107_themes/templates/footer_default.php @@ -81,7 +81,7 @@ if (varset($e107_popup) != 1) $logLine = ''; if ($pref['log_page_accesses']) { // Collect the first batch of data to log - $logLine .= "'".($now = time())."','".gmstrftime('%y-%m-%d %H:%M:%S', $now)."','".$e107->getIP()."','".e_PAGE.'?'.e_QUERY."','".$rendertime."','".$db_time."','".$queryCount."','".$memuse."'"; + $logLine .= "'".($now = time())."','".gmstrftime('%y-%m-%d %H:%M:%S', $now)."','".e107::getIPHandler()->getIP(FALSE)."','".e_PAGE.'?'.e_QUERY."','".$rendertime."','".$db_time."','".$queryCount."','".$memuse."'"; } if (function_exists('getrusage')) diff --git a/email.php b/email.php index 6b3f750ec..d97d10ed3 100644 --- a/email.php +++ b/email.php @@ -103,7 +103,7 @@ if (isset($_POST['emailsubmit'])) { // $message .= $comments."\n"; // Added to message later on } - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $message .= "\n\n".LAN_EMAIL_2." ".$ip."\n\n"; if (substr($source,0,7) == 'plugin:') diff --git a/fpw.php b/fpw.php index 8fc7ee8c9..bb3c1ecad 100644 --- a/fpw.php +++ b/fpw.php @@ -148,7 +148,7 @@ if (isset($_POST['pwsubmit'])) if (($row['user_admin'] == 1) && (($row['user_perms'] == '0') OR ($row['user_perms'] == '0.'))) { // Main admin expected to be competent enough to never forget password! (And its a security check - so warn them) - sendemail($pref['siteadminemail'], LAN_06, LAN_07.' '.$e107->getip().' '.LAN_08); + sendemail($pref['siteadminemail'], LAN_06, LAN_07.' '.e107::getIPHandler()->getIP(FALSE).' '.LAN_08); echo "\n"; die(); } @@ -177,7 +177,7 @@ if (isset($_POST['pwsubmit'])) $rcode = md5($_SERVER['HTTP_USER_AGENT'] . serialize($pref). $rand_num . $datekey); $link = SITEURL.'fpw.php?'.$rcode; - $message = LAN_FPW5.' '.SITENAME.' '.LAN_FPW14.' : '.$e107->getip().".\n\n".LAN_FPW15."\n\n".LAN_FPW16."\n\n".LAN_FPW17."\n\n{$link}"; + $message = LAN_FPW5.' '.SITENAME.' '.LAN_FPW14.' : '.e107::getIPHandler()->getIP(FALSE).".\n\n".LAN_FPW15."\n\n".LAN_FPW16."\n\n".LAN_FPW17."\n\n{$link}"; $deltime = time()+86400 * 2; //Set timestamp two days ahead so it doesn't get auto-deleted $sql->db_Insert('tmp', "'pwreset',{$deltime},'".$row['user_loginname'].FPW_SEPARATOR.$rcode."'"); diff --git a/request.php b/request.php index 8f0ee70ce..7bfa67772 100644 --- a/request.php +++ b/request.php @@ -192,7 +192,7 @@ if ($type == "file") // increment download count $sql->db_Update("download", "download_requested = download_requested + 1 WHERE download_id = '{$id}'"); $user_id = USER ? USERID : 0; - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $request_data = "'0', '{$user_id}', '{$ip}', '{$id}', '".time()."'"; //add request info to db $sql->db_Insert("download_requests", $request_data, FALSE); @@ -452,7 +452,7 @@ function check_download_limits() { $where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_userid = ".USERID; } else { - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_ip = '{$ip}'"; } $qry = "SELECT COUNT(d.download_id) as count FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid"; @@ -478,7 +478,7 @@ function check_download_limits() if(USER) { $where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_userid = ".USERID; } else { - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $where = "dr.download_request_datestamp > {$cutoff} AND dr.download_request_ip = '{$ip}'"; } $qry = "SELECT SUM(d.download_filesize) as total_bw FROM #download_requests as dr LEFT JOIN #download as d ON dr.download_request_download_id = d.download_id AND d.download_active = 1 WHERE {$where} GROUP by dr.download_request_userid"; diff --git a/search.php b/search.php index 4ce3ceb3b..725a410d5 100644 --- a/search.php +++ b/search.php @@ -206,7 +206,7 @@ if (isset($_GET['q']) || isset($_GET['in']) || isset($_GET['ex']) || isset($_GET elseif ($search_prefs['time_restrict']) { $time = time() - $search_prefs['time_secs']; $query_check = $tp -> toDB($full_query); - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); if ($sql -> db_Select("tmp", "tmp_ip, tmp_time, tmp_info", "tmp_info LIKE 'type_search%' AND tmp_ip='".$ip."'")) { $row = $sql -> db_Fetch(); if (($row['tmp_time'] > $time) && ($row['tmp_info'] != 'type_search '.$query_check)) { diff --git a/signup.php b/signup.php index 0e6e16fa5..4dd7753ed 100644 --- a/signup.php +++ b/signup.php @@ -399,7 +399,7 @@ if (isset($_POST['register'])) unset($_POST['password1']); // Restrict the scope of this unset($_POST['password2']); - $allData['user_ip'] = $e107->getip(); + $allData['user_ip'] = e107::getIPHandler()->getIP(FALSE); // check for multiple signups from the same IP address. But ignore localhost @@ -411,7 +411,7 @@ if (isset($_POST['register'])) { $allData['errors']['user_email'] = ERR_GENERIC; $allData['errortext']['user_email'] = LAN_SIGNUP_71; - $admin_log->log_event('USET_15',LAN_SIGNUP_103.$e107->getip(),4); + $admin_log->log_event('USET_15',LAN_SIGNUP_103.e107::getIPHandler()->getIP(FALSE),4); } } } diff --git a/submitnews.php b/submitnews.php index 15abe37c6..e0cd5042d 100644 --- a/submitnews.php +++ b/submitnews.php @@ -36,7 +36,7 @@ if (!check_class($pref['subnews_class'])) if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['submitnews_item']) { - $ip = $e107->getip(); + $ip = e107::getIPHandler()->getIP(FALSE); $fp = new floodprotect; if ($fp->flood("submitnews", "submitnews_datestamp") == FALSE) {