private function getListMemberInfo() { $memberinfo = array(); $customers = OSS_Array::reindexObjects(OSS_Array::reorderObjects($this->getD2R('\\Entities\\Customer')->getConnected(false, false, true), 'getAutsys', SORT_NUMERIC), 'getId'); foreach ($customers as $c) { $ixp = $this->getD2R('\\Entities\\IXP')->getDefault(); $conn = array(); $connlist = array(); foreach ($c->getVirtualInterfaces() as $vi) { $iflist = array(); foreach ($vi->getPhysicalInterfaces() as $pi) { if ($pi->getStatus() == \Entities\PhysicalInterface::STATUS_CONNECTED) { $iflist[] = array('switch_id' => $pi->getSwitchPort()->getSwitcher()->getID(), 'if_speed' => $pi->getSpeed()); } } $vlanentry = array(); foreach ($vi->getVlanInterfaces() as $vli) { $vlanentry['vlan_id'] = $vli->getVlan()->getId(); if ($vli->getIpv4enabled()) { $vlanentry['ipv4']['address'] = $vli->getIPv4Address()->getAddress(); $vlanentry['ipv4']['routeserver'] = $vli->getRsclient(); $vlanentry['ipv4']['max_prefix'] = $vi->getCustomer()->getMaxprefixes(); $vlanentry['ipv4']['as_macro'] = $vi->getCustomer()->resolveAsMacro(4, "AS"); } if ($vli->getIpv6enabled()) { $vlanentry['ipv6']['address'] = $vli->getIPv6Address()->getAddress(); $vlanentry['ipv6']['routeserver'] = $vli->getRsclient(); $vlanentry['ipv6']['max_prefix'] = $vi->getCustomer()->getMaxprefixes(); $vlanentry['ipv6']['as_macro'] = $vi->getCustomer()->resolveAsMacro(6, "AS"); } } $conn = array(); $conn['state'] = 'active'; $conn['if_list'] = $iflist; $conn['vlan_list'][] = $vlanentry; $connlist[] = $conn; } $memberinfo[] = ['asnum' => $c->getAutsys(), 'name' => $c->getName(), 'url' => $c->getCorpwww(), 'contact_email' => array($c->getPeeringemail()), 'contact_phone' => array($c->getNocphone()), 'contact_hours' => $c->getNochours(), 'peering_policy' => $c->getPeeringpolicy(), 'peering_policy_url' => $c->getNocwww(), 'member_since' => $c->getDatejoin()->format('Y-m-d') . 'T00:00:00Z', 'connection_list' => $connlist]; } return $memberinfo; }
/** * @see https://github.com/inex/IXP-Manager/wiki/RIR-Objects * @throws Zend_Controller_Action_Exception */ public function updateObjectAction() { if (!($tmpl = $this->getParam('tmpl', false))) { throw new Zend_Controller_Action_Exception('You must specify a RIR template to update', 412); } // sanitise template name $tmpl = preg_replace('/[^\\da-z_\\-]/i', '', $tmpl); if (!$this->view->templateExists('rir/tmpl/' . $tmpl . '.tpl')) { throw new Zend_Controller_Action_Exception('The specified RIR template does not exist', 412); } $email = $this->getParam('email', false); // populate the template variables $this->view->customers = $customers = OSS_Array::reindexObjects(OSS_Array::reorderObjects($this->getD2R('\\Entities\\Customer')->getConnected(false, false, true), 'getAutsys', SORT_NUMERIC), 'getId'); $this->view->asns = $this->generateASNs($customers); $this->view->rsclients = $this->generateRouteServerClientDetails($customers); $this->view->protocols = [4, 6]; $content = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $this->view->render('rir/tmpl/' . $tmpl . '.tpl')); if ($email) { $this->emailRIR($tmpl, $content, $email, $this->getParam('force', false)); } else { echo $content; } }
/** * Set data * * Please note that it overwrites (extends with data) the URL in GET requests. * * * @param array $data * @return void */ public function setData($data) { // convert $pData to string if it is array or object, that step takes care of urlencode()-ing, too if ($data === null) { $data = ''; } // IMPORTANT! if (is_object($data)) { $pData = OSS_Array::objectToArray($data); } if (is_array($data)) { $data = self::httpBuildQuery($data); } //OSS_Debug::prr( $pData ); die(); if ($this->getMethod() == self::HTTP_POST) { // we need that even if there is no data to make cURL to create the "Content-Type: application/x-www-form-urlencoded" header for us if (is_string($data)) { curl_setopt($this->_curlHandler, CURLOPT_POSTFIELDS, $data); } } elseif ($this->getMethod() == self::HTTP_GET) { if (is_string($data)) { curl_setopt($this->_curlHandler, CURLOPT_URL, $this->getUrl() . '?' . $data); } } }
/** * Parse the XML response from Realex and update the transaction object * * This function: * * - transforms the XML response to an array * - validates the response hash * - updates the authcode, pasref, state and response fields of the \Entities\RealexTransaction object * * @param string $xml The XML response from Realex for processing * @param \Entities\RealexTransaction $rtrans An instance of the \Entities\RealexTransaciton object * @return \Entities\ReleaxTransaction The updated $rtrans object for fluent interface * @throws OSS_PaymentProcessor_Realex_Receipt_Exception */ private function _parseResponse($xml, $rtrans) { $resp = OSS_Array::objectToArray(OSS_Utils::parseXML($xml)); $rtrans->setResult($this->_checkResponse($resp)); if (isset($resp['authcode'])) { $rtrans->setAuthcode($resp['authcode']); } //if( isset( $resp['pasref'] ) ) // $rtrans['pasref'] = $resp['pasref']; $rtrans->setState(\Entities\RealexTransaction::STATE_COMPLETE); $this->_log("[RTRANS: {$rtrans->getId()}] Realex::_parseResponse() - Realex result: {$rtrans->getResult()}"); //FIXME: Barry if ($rtrans->isSuccessful() && !$this->_keep_request_data) { $rtrans->setRequest(''); } $rtrans->setUpdated(new \DateTime()); $this->getD2EM()->flush(); //FIXME Transaction stats. //if( !CreditcardTransactionStatsTable::update( $cctrans['request_type'], $cctrans['result'], $cctrans['amount'] ) ) //$this->_log( "CreditcardTrasactionStatTable::update() failed for [CCTRANS: {$cctrans['id']}].", OSS_Log::ALERT ); if (in_array($rtrans->getRequestType(), array('receipt-in', 'payment-out')) && !$rtrans->isSuccessful()) { throw new OSS_PaymentProcessor_Realex_Receipt_Exception($rtrans, $resp['message']); } return $rtrans; }