public static function GetUsersHavingIP($p_ipAddress) { global $g_ado_db; $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache'); $cacheKey = $cacheService->getCacheKey(array('GetUsersHavingIP', $p_ipAddress), 'users'); if ($cacheService->contains($cacheKey)) { $users = $cacheService->fetch($cacheKey); } else { $ipObj = new IPAccess(); $intIPAddress = $ipObj->__array2int($ipObj->__string2array($p_ipAddress)); $queryStr = "SELECT DISTINCT(IdUser) FROM SubsByIP WHERE StartIP <= {$intIPAddress} " . "AND {$intIPAddress} <= (StartIP + Addresses - 1)"; $rows = (array) $g_ado_db->GetAll($queryStr); if (empty($rows)) { $cacheService->save($cacheKey, array()); return array(); } $users = array(); foreach ($rows as $row) { $users[] = $GLOBALS['controller']->getHelper('service')->getService('user')->find($row['IdUser']); } $cacheService->save($cacheKey, $users); } return $users; }
public static function GetUsersHavingIP($p_ipAddress) { global $g_ado_db; $ipObj = new IPAccess(); $intIPAddress = $ipObj->__array2int($ipObj->__string2array($p_ipAddress)); $queryStr = "SELECT DISTINCT(IdUser) FROM SubsByIP WHERE StartIP <= $intIPAddress " . "AND $intIPAddress <= (StartIP + Addresses - 1)"; $rows = $g_ado_db->GetAll($queryStr); $users = array(); foreach ($rows as $row) { $users[] = new User($row['IdUser']); } return $users; }
public static function GetUsersHavingIP($p_ipAddress) { global $g_ado_db; $ipObj = new IPAccess(); $intIPAddress = $ipObj->__array2int($ipObj->__string2array($p_ipAddress)); $queryStr = "SELECT DISTINCT(IdUser) FROM SubsByIP WHERE StartIP <= {$intIPAddress} " . "AND {$intIPAddress} <= (StartIP + Addresses - 1)"; $rows = (array) $g_ado_db->GetAll($queryStr); if (empty($rows)) { return array(); } $users = array(); foreach ($rows as $row) { $users[] = $GLOBALS['controller']->getHelper('service')->getService('user')->find($row['IdUser']); } return $users; }