function doInstall()
 {
     loadCoreFile('obj_xml.php');
     $parser = new xml_doc(file_get_contents(CUSTOMER_ACCOUNT_INSTALL_DATA_XML));
     $parser->parse();
     $groups_ids = array();
     $attrs_ids = array();
     foreach ($parser->xml_index as $tag) {
         if ($tag->name == 'CUSTOMER_ACCOUNT_INSTALL_DATA') {
             foreach ($tag->children as $id_child) {
                 switch ($id_child->name) {
                     case 'PERSON_INFO_GROUPS':
                         $groups_ids = $this->__install_ProcessPersonInfoGroups($id_child);
                         break;
                     case 'PERSON_INFO_ATTRS':
                         $attrs_ids = $this->__install_ProcessPersonInfoAttrs($id_child);
                         break;
                     case 'ATTRS_TO_GROUPS':
                         $this->__install_ProcessAttrsToGroups($id_child, $groups_ids, $attrs_ids);
                         break;
                     case 'SETTINGS':
                         $this->__install_ProcessSettings($id_child);
                         break;
                 }
             }
         }
     }
     $this->__install_AddAttrsVisibleNames();
     $this->__install_addEventsHandlers();
     return;
 }
 function doInstall()
 {
     loadCoreFile('obj_xml.php');
     $parser = new xml_doc(file_get_contents(NOTIFICATIONS_INSTALL_DATA_XML_FILE));
     $parser->parse();
     foreach ($parser->xml_index as $tag) {
         if ($tag->name == 'NOTIFICATIONS_INSTALL_DATA') {
             foreach ($tag->children as $id_child) {
                 switch ($id_child->name) {
                     case 'INFOTAGS':
                         $this->__install_ProcessInfotags($id_child);
                         break;
                     case 'BLOCKTAGS':
                         $this->__install_ProcessBlocktags($id_child);
                         break;
                     case 'ACTIONS':
                         $this->__install_ProcessActions($id_child);
                         break;
                     case 'NOTIFICATIONS':
                         $this->__install_ProcessNotifications($id_child);
                         break;
                 }
             }
         }
     }
     $this->__install_addEventsHandlers();
     return;
 }
 function _process_request(&$xml_request, &$default_response)
 {
     $xml_request = urlencode($xml_request);
     loadCoreFile('bouncer.php');
     $bnc = new Bouncer();
     $bnc->setMethod(UPDATESERVER_METHOD);
     $bnc->setURL(UPDATESERVER_PROTO . '://' . UPDATESERVER_HOST_PATH . '?xml=' . $xml_request);
     switch (UPDATESERVER_METHOD) {
         case "GET":
             $bnc->setURL(UPDATESERVER_PROTO . '://' . UPDATESERVER_HOST_PATH . '?xml=' . $xml_request);
             break;
         case "POST":
             $bnc->setURL(UPDATESERVER_PROTO . '://' . UPDATESERVER_HOST_PATH);
             $bnc->setPOSTstring($bnc->prepareDATAstring(array("xml" => $xml_request)));
             break;
     }
     $result = $bnc->RunRequest();
     if ($result == false) {
         return false;
     }
     //die(print_r($result['body'], true));
     loadCoreFile('obj_xml.php');
     $xml = new xml_doc($result['body']);
     //die(print_r($result['body'], true));
     $xml->parse();
     if (!is_object($xml->document)) {
         return false;
     }
     //die(print_r($xml->document,true));
     foreach ($default_response as $key => $val) {
         $xml_tag = $xml->document->findChild($key);
         if ($xml_tag != FALSE) {
             $default_response[$key] = $xml_tag->contents;
         }
     }
     //die(print_r($default_response,true));
     return $default_response;
 }
 function __getRateFromWebServiceX($from, $to)
 {
     loadCoreFile('bouncer.php');
     $bnc = new Bouncer();
     $bnc->setHTTPversion("1.0");
     $bnc->setMethod("GET");
     $bnc->setURL("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate");
     $bnc->setSocketReadTimeout(10);
     $get_params = array("FromCurrency" => $from, "ToCurrency" => $to);
     $bnc->setGETstring($bnc->prepareDATAstring($get_params));
     $res = $bnc->RunRequest();
     if ($res != false) {
         $xml = $res["body"];
         loadCoreFile('obj_xml.php');
         $parser = new xml_doc($xml);
         $parser->parse();
         foreach ($parser->xml_index as $node) {
             if ($node->name = "DOUBLE") {
                 $rate = $node->contents;
                 if ($rate == 0) {
                     $rate = false;
                 }
                 $this->__addRequestToTimeline('www.webservicex.net', $from, $to, $rate, $bnc, $res);
                 return $rate;
             }
         }
     }
     $this->__addRequestToTimeline('www.webservicex.net', $from, $to, false, $bnc, $res);
     return false;
 }
Example #5
0
 /**
  * Parse the RSS-tape.
  */
 function parseRSS($xml_code)
 {
     loadCoreFile('obj_xml.php');
     $last_news_date = $this->getLastNewsDate();
     $xml = new xml_doc($xml_code);
     $xml->parse();
     $channel = $xml->document->findChild('channel');
     # the <channel> tag contents
     $this->channelContents = array();
     $itemContents = array();
     foreach ($channel->children as $channelChild) {
         if (_ml_strtolower($channelChild->name) == 'item') {
             $pubDate = $channelChild->findChild('pubdate');
             $itemContents['NewsDate'] = strtotime($pubDate->contents, 0);
             if ($itemContents['NewsDate'] <= $last_news_date) {
                 # an old piece of news, skip it
                 continue;
             }
             foreach ($channelChild->children as $itemChild) {
                 switch (_ml_strtolower($itemChild->name)) {
                     case 'title':
                         $itemContents['NewsTitle'] = $itemChild->contents;
                         break;
                     case 'link':
                         $itemContents['NewsLink'] = $itemChild->contents;
                         break;
                     case 'description':
                         $itemContents['NewsContent'] = $itemChild->contents;
                         break;
                     case 'category':
                         $itemContents['NewsCategory'] = $itemChild->contents;
                         break;
                     default:
                         break;
                 }
             }
             $itemContents['NewsType'] = 'avactis';
             $this->addNews($itemContents);
             # add the latest piece of news to the database
         } else {
             $this->channelContents[$channelChild->name] = $channelChild->contents;
         }
     }
     # update NEWS_LAST_BUILD_DATE and NEWS_TTL parameters
     $this->setValue(NEWS_LAST_BUILD_DATE, strtotime($this->channelContents['LASTBUILDDATE'], 0));
     $this->setValue(NEWS_TTL, $this->channelContents['TTL']);
 }
 function _process_request(&$data, $response_required = false)
 {
     $xml_request = urlencode($data);
     loadCoreFile('bouncer.php');
     $bnc = new Bouncer();
     $bnc->setHTTPversion("1.0");
     $bnc->setMethod(LICENSESERVER_METHOD);
     $bnc->setURL(LICENSESERVER_PROTO . '://' . ACCOUNTSERVER_URL . '?xml=' . $xml_request);
     $result = $bnc->RunRequest();
     if ($result == false) {
         return false;
     }
     if ($response_required) {
         loadCoreFile('obj_xml.php');
         $xml = new xml_doc($result['body']);
         $res = $xml->parse();
         if ($res !== true) {
             return false;
         }
         if (!is_object($xml->document)) {
             return false;
         }
         // general check
         // response data
         $response = array("CODE" => "not_set", "MESSAGE" => "not_set", "CERT" => "not_set");
         foreach ($response as $key => $val) {
             $xml_tag = $xml->findTag($key);
             if ($xml_tag != FALSE) {
                 $response[$key] = $xml_tag->contents;
             }
         }
         return $response;
     } else {
         return true;
     }
 }
 function __readScriptsDefinition()
 {
     loadCoreFile('obj_xml.php');
     $parser = new xml_doc(file_get_contents(DC_SCRIPTS_DEFINITION_FILE));
     $parser->parse();
     foreach ($parser->xml_index as $tag) {
         if ($tag->name == 'SCRIPTS') {
             foreach ($tag->children as $scripts_child) {
                 if ($scripts_child->name == 'SCRIPT') {
                     $script_info = array('steps' => array());
                     $script_code = '';
                     foreach ($scripts_child->children as $script_child) {
                         switch ($script_child->name) {
                             case 'CODE':
                                 $script_code = $script_child->contents;
                                 break;
                             case 'NAME':
                                 $script_info[_ml_strtolower($script_child->name)] = $script_child->contents;
                                 break;
                             case 'STEPS':
                                 $script_info['steps_count'] = $script_child->contents;
                                 break;
                             case 'STEP':
                                 $step_info = array();
                                 $step_number = 0;
                                 foreach ($script_child->children as $step_child) {
                                     switch ($step_child->name) {
                                         case 'NUMBER':
                                             $step_number = $step_child->contents;
                                             break;
                                         case 'READER':
                                         case 'FILTER':
                                         case 'WRITER':
                                             $step_info[_ml_strtolower($step_child->name)] = $step_child->contents;
                                             break;
                                     }
                                 }
                                 if ($step_number > 0) {
                                     $script_info['steps'][$step_number] = $step_info;
                                 }
                                 break;
                         }
                     }
                     if ($script_code != '') {
                         $this->_scripts_definition[$script_code] = $script_info;
                     }
                 }
             }
         }
     }
 }