public function getAllIP($id) { $id = Base_Controller_Action_Helper_IdConvert::hexToStr($id); if ($id > 0) { $model = new WsSaveIP(); $row = $model->findOne($id); return $row->ip; } else { throw new Exception('Brak adresu IP'); } }
/** * @throws Logic_WebService_Element_Environment_Exception * @return void */ public function __construct() { $config = Zend_Registry::get('config'); if ($config['env_type'] == 'production' or $config['env_type'] == 'production_cmd') { $this->_isProduction = true; } if ($this->_isProduction) { $model = new WsSaveIP(); if ($config['env_type'] == 'production_cmd') { $IP = '127.0.0.1'; } else { $IP = Zend_Controller_Action_HelperBroker::getStaticHelper('Currentip')->getCurrentIp(); } if (!$model->getIP($IP)) { throw new Logic_WebService_Element_Environment_Exception('Proba uzycia serwera produkcyjnego przez aplikacje testowa', 415); } } }
public function addip($params) { $validator = new Logic_Validate_Ip(); $ips = array(); foreach ($params as $param) { if ($param['name'] == 'ip') { $ips = explode(PHP_EOL, $param['value']); foreach ($ips as $key => $ip) { list($ip_address, $mask) = explode('/', $ip); $validator->setRange($ip); if (false === $validator->isValid(trim($ip_address))) { unset($ips[$key]); } } } $data[$param['name']] = $param['value']; } if (!empty($ips)) { $model = new WsSaveIP(); $model->addIP($ips, $data['ip_comment']); } else { throw new Logic_Ws_Exception('Niepoprawny format adresu IP'); } }
/** * zwraca tablicę adresów ip klienta * @param integer $id * @return array */ public function getIpList($id = null) { $id = $id ? $id : $this->getClient()->id; $saveIpModel = new WsSaveIP(); $saveIpRowset = $saveIpModel->getIpListByClientId($id); return $saveIpRowset; }