Exemple #1
0
function PrzetworzXML($akcja, $xml_file)
{
    $dom = new domDocument();
    $dom->loadXML($xml_file);
    $xml = simplexml_import_dom($dom);
    if (isset($xml->Blad)) {
        $numer = $_POST['numer'];
        $przyczyna = $xml->Blad;
        echo 'Błąd ogólny: ' . $przyczyna;
    }
    if ($akcja == "wyslij_sms") {
        if (isset($xml->Odbiorcy->Skolejkowane)) {
            foreach ($xml->Odbiorcy->Skolejkowane->SMS as $sms) {
                echo '
				Zapis wysłanych do bazy - smsid: ' . xml_attribute($sms, 'id') . '; numer: ' . xml_attribute($sms, 'numer') . '; godzina_skolejkowania: ' . xml_attribute($sms, 'godzina_skolejkowania');
            }
        }
        if (isset($xml->Odbiorcy->Niewyslane)) {
            foreach ($xml->Odbiorcy->Niewyslane->SMS as $sms) {
                echo '
				Zapis niewysłanych do bazy - smsid: ' . xml_attribute($sms, 'id') . '; numer: ' . xml_attribute($sms, 'numer') . '; przyczyna: ' . xml_attribute($sms, 'przyczyna');
            }
        }
    }
    if ($akcja == "sprawdz_sms") {
        if (isset($xml->SMS)) {
            foreach ($xml->SMS as $sms) {
                echo '
				Sprawdzanie statusów - smsid: ' . xml_attribute($sms, 'id') . '; numer: ' . xml_attribute($sms, 'numer') . '; stan: ' . xml_attribute($sms, 'stan') . '; przyczyna: ' . xml_attribute($sms, 'przyczyna');
            }
        }
    }
    if ($akcja == "ilosc_sms") {
        if (isset($xml->SMS)) {
            foreach ($xml->SMS as $sms) {
                echo '
				Sprawdzanie limitów - typ: ' . xml_attribute($sms, 'typ') . '; limit: ' . $sms;
            }
        }
    }
    if ($akcja == "sprawdz_odpowiedzi") {
        if (isset($xml->SMS)) {
            foreach ($xml->SMS as $sms) {
                echo '
				Wiadomość przychodząca - id: ' . xml_attribute($sms, 'id') . '; numer: ' . xml_attribute($sms, 'numer') . '; data: ' . xml_attribute($sms, 'data') . '; tresc: ' . xml_attribute($sms, 'tresc') . '; na numer: ' . xml_attribute($sms, 'na_numer');
            }
        }
        if (isset($xml->MMS)) {
            foreach ($xml->MMS as $mms) {
                echo '
                        Wiadomość MMS - id: ' . xml_attribute($mms, 'id') . '; numer: ' . xml_attribute($mms, 'numer') . '; data: ' . xml_attribute($mms, 'data') . '; temat: ' . xml_attribute($mms, 'temat');
                if (isset($xml->MMS->Zalacznik)) {
                    foreach ($xml->MMS->Zalacznik as $zalacznik) {
                        echo '
                                Załącznik - id: ' . xml_attribute($zalacznik, 'id') . '; nazwa: ' . xml_attribute($zalacznik, 'nazwa') . '; contenttype: ' . xml_attribute($zalacznik, 'contenttype') . '; zawartość: ' . $zalacznik;
                    }
                }
            }
        }
    }
    if ($akcja == "pliki") {
        if (isset($xml->Plik)) {
            foreach ($xml->Plik as $plik) {
                echo '
                    Plik - id: ' . xml_attribute($plik, 'id') . '; nazwa: ' . $plik->Nazwa . '; rozmiar: ' . $plik->Rozmiar . '; typ: ' . $plik->Typ . '; data: ' . $plik->Data;
            }
        }
    }
    if ($akcja == "premium_api") {
        if (isset($xml->SMS) and $xml->SMS == "OK") {
            echo '
                    Odpowiedź wysłana - id: ' . xml_attribute($xml->SMS, 'id');
        } elseif (isset($xml->SMS)) {
            foreach ($xml->SMS as $sms) {
                echo '
                    Wiadomość: ' . xml_attribute($sms, 'id') . '; na numer: ' . xml_attribute($sms, 'na_numer') . '; z numeru: ' . xml_attribute($sms, 'z_numeru') . '; data: ' . xml_attribute($sms, 'data') . '; limit: ' . xml_attribute($sms, 'limit') . '; tekst: ' . $sms;
            }
        }
    }
    if ($akcja == "usun_zaplanowane") {
        if (isset($xml->ZAPLANOWANE)) {
            foreach ($xml->ZAPLANOWANE as $zaplanowane) {
                if ($zaplanowane == "OK") {
                    echo '
                            Usunięto sms - smsid:' . xml_attribute($zaplanowane, 'smsid');
                }
                if ($zaplanowane == "ERR") {
                    echo '
                            Nie znaleziono wiadomości - smsid:' . xml_attribute($zaplanowane, 'smsid');
                }
            }
        }
    }
    if ($akcja == "pobierz_mms") {
        if (isset($xml->MMS)) {
            foreach ($xml->MMS as $mms) {
                echo '
                    Wiadomość MMS - id: ' . xml_attribute($mms, 'id') . '; numer: ' . xml_attribute($mms, 'numer') . '; data: ' . xml_attribute($mms, 'data');
                if (isset($mms->Zalacznik)) {
                    foreach ($mms->Zalacznik as $zalacznik) {
                        echo '
                            Załącznik - id: ' . xml_attribute($zalacznik, 'id') . '; nazwa: ' . xml_attribute($zalacznik, 'nazwa') . '; contenttype: ' . xml_attribute($zalacznik, 'contenttype') . '; zawartość: ' . $zalacznik;
                    }
                }
            }
        }
    }
    if ($akcja == "nazwa_nadawcy") {
        if (isset($xml->NADAWCA)) {
            foreach ($xml->NADAWCA as $nadawca) {
                echo '
                    Nadawca - nazwa: ' . xml_attribute($nadawca, 'nazwa') . '; status: ' . $nadawca;
            }
        }
    }
    if ($akcja == "hlr") {
        if (isset($xml->NUMER)) {
            echo '
                Numer: ' . xml_attribute($xml->NUMER, 'numer') . '; status: ' . $xml->NUMER->status . '; imsi: ' . $xml->NUMER->imsi . '; sieć macierzysta: ' . $xml->NUMER->siec_macierzysta . '; przenoszony: ' . $xml->NUMER->przenoszony . '; sieć obecna: ' . $xml->NUMER->siec_obecna;
        }
    }
    if ($akcja == "kontakty") {
        if (isset($xml->GRUPA->KONTAKT)) {
            if (isset($xml->GRUPA->NAZWA)) {
                echo '
                        Nazwa grupy: ' . $xml->GRUPA->NAZWA . '; ID grupy: ' . xml_attribute($xml->GRUPA, 'id') . '; liczba kontaktów: ' . xml_attribute($xml->GRUPA, 'ilosc');
            }
            foreach ($xml->GRUPA->KONTAKT as $kontakt) {
                if (isset($kontakt)) {
                    echo '
                        ID kontaktu: ' . xml_attribute($kontakt, 'id') . '; Telefon: ' . $kontakt->TELEFON . '; E-mail: ' . $kontakt->EMAIL . '; Firma: ' . $kontakt->FIRMA . '; Imie: ' . $kontakt->IMIE . '; Nazwisko: ' . $kontakt->NAZWISKO;
                }
            }
        } elseif (isset($xml->GRUPA->NAZWA)) {
            foreach ($xml as $grupy) {
                if (isset($grupy)) {
                    echo '
                        Nazwa grupy: ' . $grupy->NAZWA . '; ID grupy: ' . xml_attribute($grupy, 'id') . '; liczba kontaktów: ' . xml_attribute($grupy, 'ilosc');
                }
            }
        } elseif (isset($xml->GRUPA)) {
            echo '
                ID grupy: ' . xml_attribute($xml->GRUPA, 'id') . '; Stan: ' . $xml->GRUPA;
        } elseif (isset($xml->KONTAKT)) {
            echo '
                ID kontaktu: ' . xml_attribute($xml->KONTAKT, 'id') . '; Stan: ' . $xml->KONTAKT;
        }
    }
}
        continue;
    }
    if ($cnt > $limit + $offset) {
        break;
    }
    $rule_idref = xml_attribute($select_rule, "idref");
    echo "  rule_idref: {$rule_idref} \n";
    # <rule-result idref="disable_rexec" time="2014-05-25T12:51:50" severity="high" weight="1.000000">
    $xpath_path = "//myns:rule-result[@idref='" . $rule_idref . "']";
    echo "  xpath_path: {$xpath_path}\n";
    $rule_result = $xml->xpath($xpath_path);
    // print_r($rule_result[0]);
    // Apply adjustment
    $adjustment = $adjustment_xml->xpath("//adjustment:Rules/adjustment:Rule[@id='" . $rule_idref . "']/adjustment:adjustments/adjustment:adjustment[@initial='" . $rule_result[0]->result . "']");
    echo "  ident: " . $rule_result[0]->ident . "\n";
    if (xml_attribute(@$adjustment[0], "initial")) {
        echo "  adjusment initial: " . xml_attribute($adjustment[0], "initial") . "\n";
        echo "  adjusment revised: " . xml_attribute($adjustment[0], "revised") . "\n";
        echo "  adjusment detail: " . $adjustment[0] . "\n";
        $revised_result = xml_attribute($adjustment[0], "revised");
        echo "  result: " . $rule_result[0]->result . "\n";
        echo "  revised_result: " . $revised_result . "\n";
        echo "  based on: " . $adjustment[0] . "\n";
    } else {
        $revised_result = $rule_result[0]->result;
        echo "  revised_result: " . $revised_result . "\n";
    }
    echo "\n";
}
echo "\ndone";
exit;
Exemple #3
0
<?php

$x = 0;
while ($x != count($feeds)) {
    $doc = new DOMDocument();
    $z->open($feeds[$x]->feed_url);
    while ($z->read() && $z->name !== 'entry') {
    }
    while ($z->name === 'entry') {
        $node = new SimpleXMLElement($z->readOuterXML());
        $link = $node->link[4];
        $feeds[$x]->addPost($node->title, xml_attribute($link, 'href'));
        $z->next('entry');
    }
    $x++;
}
   }
   if ($cnt > $limit + $offset) {
       break;
   }
   echo "{$cnt} " . $Rule->title . "\n";
   echo "    id: " . xml_attribute($Rule, "id") . "\n";
   $severity = xml_attribute($Rule, "severity");
   echo "    ident: " . $Rule->ident . "\n";
   // get parent node, which is a Group
   $Group = $Rule->xpath("./..");
   $Group_id = xml_attribute($Group[0], "id");
   $Group_title = $Group[0]->title;
   $Group_title_lc = strtolower($Group_title);
   $Group_Rule_cnt = count($Group[0]->Rule);
   $Group_Rule_other_cnt = $Group_Rule_cnt - 1;
   $rule_id = xml_attribute($Rule, "id");
   $rule_title_lc = strtolower($Rule->title);
   $file = FILE_PATH . FILE_SEP . FILE_OUTPUT;
   // IMPORTANT: $Rule->description has inline tags with different name space so we need to strip tags or replace in xml string
   // $description = strip_tags($Rule->description->asXML());
   $description = $Rule->description->asXML();
   $rationale = $Rule->rationale->asXML();
   echo "    file: " . $file . "\n";
   echo "\n";
   $text_warnings = array("low" => "info", "medium" => "warning", "high" => "danger");
   $scap_xml = $Rule->asXML();
   // Write each rule to a file.
   $content = <<<FM
 <Profile id="{$rule_id}">
   <title xml:lang="en-US">{$rule_id}</title>
   <description xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="en-US">This is an unbundled profile for {$rule_id}</description>
function getCamConfigValues_FromXML($s_span, $s_filename_xml)
{
    global $a_tilepaths;
    global $s_dat_start;
    //, $a_dat_tile_master;
    global $i_stitch_tiledepth;
    global $s_tilemaster_default;
    $xml = simplexml_load_file($s_filename_xml);
    //$s_test =  $xml->getName() ;
    foreach ($xml->children() as $config) {
        //$a_attributes = $child->attributes();
        $s_name = xml_attribute($config, "name");
        if ($s_name == $s_span) {
            $s_dat_start = xml_attribute($config, "date_start");
            $i_stitch_tiledepth = xml_attribute($config, "stitch_tiledepth");
            $s_tilepaths = xml_attribute($config, "tilepaths");
            $a_tilepaths = explode(",", $s_tilepaths);
            $s_tilemaster_default = xml_attribute($config, "tilemaster_default");
            /*CLZ.2012.08.18 Disabling this - it was too complicated to work with hours.
            			foreach($config->children() as $tilemaster)
            			{
            				$i_hour = intval(xml_attribute($tilemaster,"hour"));
            				$s_keyframe = xml_attribute($tilemaster,"keyframe");
            				$a_dat_tile_master[$i_hour] = $s_keyframe;
            
            			}
                        */
            break;
        }
        //echo $child->getName() . ": " . $child . "<br />";
    }
}