diff --git a/e107_core/shortcodes/batch/user_shortcodes.php b/e107_core/shortcodes/batch/user_shortcodes.php index 54c7bf7b7..23aad23db 100644 --- a/e107_core/shortcodes/batch/user_shortcodes.php +++ b/e107_core/shortcodes/batch/user_shortcodes.php @@ -92,11 +92,11 @@ class user_shortcodes extends e_shortcode $chatposts = 0; // In case plugin not installed if (e107::isInstalled("chatbox_menu")) { - $chatposts = $sql->count("chatbox"); + $chatposts = intval($sql->count("chatbox")); } e107::setRegistry('total_chatposts', $chatposts); } - return ($chatposts!=0) ? round(($this->var['user_chats']/$chatposts) * 100, 2): 0; + return ($chatposts > 0) ? round(($this->var['user_chats']/$chatposts) * 100, 2) : 0; } @@ -106,10 +106,10 @@ class user_shortcodes extends e_shortcode $sql = e107::getDb(); if(!$commentposts = e107::getRegistry('total_commentposts')) { - $commentposts = $sql->count("comments"); + $commentposts = intval($sql->count("comments")); e107::setRegistry('total_commentposts', $commentposts); } - return ($commentposts!=0) ? round(($this->var['user_comments']/$commentposts) * 100, 2): 0; + return ($commentposts > 0) ? round(($this->var['user_comments']/$commentposts) * 100, 2) : 0; } @@ -119,11 +119,11 @@ class user_shortcodes extends e_shortcode $sql = e107::getDb(); if(!$forumposts = e107::getRegistry('total_forumposts')) { - $forumposts = (e107::isInstalled("forum")) ? $sql->count("forum_thread"): 0; + $forumposts = (e107::isInstalled("forum")) ? intval($sql->count("forum_thread")) : 0; e107::setRegistry('total_forumposts', $forumposts); $user_forumposts = $sql->count("forum_thread","(*)","where thread_user=".$this->var['user_id']); } - return ($forumposts!==0) ? round(($user_forumposts/$forumposts) * 100, 2): 0; + return ($forumposts > 0) ? round(($user_forumposts/$forumposts) * 100, 2) : 0; } diff --git a/install.php b/install.php index af959e385..df9b08e08 100644 --- a/install.php +++ b/install.php @@ -386,7 +386,7 @@ class e_install // $page_info = nl2br(LANINS_023); $page_info = "
Please fill in the form below with your MySQL details. If you do not know this information, please contact your hosting provider. You may hover over each field for additional information.
"; $e_forms->start_form("versions", $_SERVER['PHP_SELF'].($_SERVER['QUERY_STRING'] == "debug" ? "?debug" : "")); - $isrequired = (($_SERVER['SERVER_ADDR'] == "127.0.0.1") || ($_SERVER['SERVER_ADDR'] == "localhost")) ? "" : "required='required'"; // + regex for 198.168.x.x + $isrequired = (($_SERVER['SERVER_ADDR'] == "127.0.0.1") || ($_SERVER['SERVER_ADDR'] == "localhost") || ($_SERVER['SERVER_ADDR'] == "::1") || preg_match('^192\.168\.\d{1,3}\.\d{1,3}$',$_SERVER['SERVER_ADDR'])) ? "" : "required='required'"; // Deals with IP V6, and 192.168.x.x address ranges, could be improved to validate x.x to a valid IP but for this use, I dont think its required to be that picky. $output = "