Example #1
0
 public function updateagentAction()
 {
     $lic = $_REQUEST['lic'];
     if ($lic != $_SESSION['OPENZISKEYHOLE']) {
         $this->view->msg = 'Not Ajax Request';
         $this->_forward('error', 'error');
     } else {
         $auth = Zend_Auth::getInstance();
         if ($auth->hasIdentity()) {
             Zend_Session::regenerateId();
             if (!$this->getRequest()->isXmlHttpRequest()) {
                 $this->view->msg = 'Not Ajax Request';
                 $this->_forward('error', 'error');
             } else {
                 $empty = null;
                 $filterChain = new Zend_Filter();
                 $filterChain->addFilter(new Zend_Filter_StripTags());
                 $filterChain2 = new Zend_Filter();
                 $filterChain2->addFilter(new Zend_Filter_Digits());
                 $desc = $filterChain->filter($_POST['DESCRIPTION']);
                 $agentId = $filterChain->filter($_POST['ID']);
                 $sourceId = $filterChain->filter($_POST['SOURCE_ID']);
                 $password = $filterChain->filter($_POST['PASSWORD']);
                 $username = $filterChain->filter($_POST['USERNAME']);
                 $ipaddress = $empty;
                 $ip = isset($_POST['IPADDRESS']) ? $filterChain->filter($_POST['IPADDRESS']) : $empty;
                 $ip_str = substr($ip, 0, 3);
                 if ($ip_str != "ex:") {
                     $ipaddress = $ip;
                 }
                 $maxbuffer = $empty;
                 $max = isset($_POST['MAXBUFFERSIZE']) ? $filterChain->filter($_POST['MAXBUFFERSIZE']) : $empty;
                 $max_str = substr($max, 0, 3);
                 if ($max_str != "ex:") {
                     $maxbuffer = $filterChain2->filter($max);
                 }
                 $active = $filterChain->filter($_POST['ACTIVE']);
                 Agent::updateAgent($desc, $sourceId, $username, $password, $agentId, $ipaddress, $maxbuffer, $active);
                 $this->render('ajaxsuccessjson');
             }
         } else {
             if (!$this->getRequest()->isXmlHttpRequest()) {
                 $this->view->msg = 'Not Ajax Request';
                 $this->_forward('error', 'error');
             } else {
                 $this->view->msg = 'Invalid User';
                 $this->_forward('error', 'error');
             }
         }
     }
 }