Exemplo n.º 1
0
function makeList()
{
    global $serverUrl;
    $rn = chr(13) . chr(10);
    $list = '<list>' . $rn;
    $cats = array("chartlisting", "topiclisting");
    foreach ($cats as $cat) {
        $c_url = $serverUrl . $cat . "dir?cat=song&output=xml";
        $c_str = getContents($c_url);
        $c_doc = new DOMDocument();
        @$c_doc->loadXML($c_str);
        $nodes = $c_doc->getElementsByTagName("node");
        if ($nodes->length == 0) {
            continue;
        }
        foreach ($nodes as $node) {
            $c_name = getNodeValue($node, "name");
            $list .= '<m label="' . htmlspecialchars($c_name) . '">' . $rn;
            $c_id = getNodeValue($node, "id");
            $s_url = $serverUrl . $cat . "?cat=song&output=xml&q=" . urlencode($c_id);
            $s_str = getContents($s_url);
            $s_doc = new DOMDocument();
            @$s_doc->loadXML($s_str);
            $songs = $s_doc->getElementsByTagName("song");
            if ($songs->length == 0) {
                $list .= '</m>' . $rn;
                continue;
            }
            foreach ($songs as $song) {
                $s_id = getNodeValue($song, "id");
                $s_name = getNodeValue($song, "name");
                $s_artist = getNodeValue($song, "artist");
                $s_duration = (int) getNodeValue($song, "duration");
                $list .= '<m type="1" id="' . $s_id . '" label="' . htmlspecialchars($s_artist . " - " . $s_name) . '" duration="' . htmlspecialchars($s_duration) . '" />' . $rn;
            }
            $list .= '</m>' . $rn;
        }
    }
    $list .= '</list>';
    header("Content-Type: text/xml");
    echo $list;
}
Exemplo n.º 2
0
function getTotal(&$node)
{
    getNodeValue($node);
    if ($node['children']) {
        for ($i = 0; $i < sizeof($node['children']); $i++) {
            $children = $node['children'][$i];
            if ($children['tipo'] == "T") {
                getNodeValue($children);
                if ($children['children']) {
                    getTotal($children);
                }
            }
        }
    }
}
Exemplo n.º 3
0
  public static function xml2news_image($image_xml) {
    $image = new self();

    if($image_xml->getElementsByTagname('thumbURL')->length > 0) {
      $image->thumb_url = $image_xml->getElementsByTagname('thumbURL')->item(0)->nodeValue;
    }

    if($image_xml->getElementsByTagname('smallURL')->length > 0) {
      $small_url_xml = $image_xml->getElementsByTagname('smallURL')->item(0);
      $image->small_url = $small_url_xml->nodeValue;
      $image->small_dimensions = array(
        'width' => $small_url_xml->getAttribute('width'),
        'height' => $small_url_xml->getAttribute('height'),
      );
    }

    if($image_xml->getElementsByTagname('fullURL')->length > 0) {
      $full_url_xml = $image_xml->getElementsByTagname('fullURL')->item(0);
      $image->full_url= $full_url_xml->nodeValue;
      $image->full_dimensions = array(
	'width'=> $full_url_xml->getAttribute('width'),
	'height' => $full_url_xml->getAttribute('height'),
      );
    }
      
    $image->credits = getNodeValue($image_xml,'imageCredits');
    $image->caption = getNodeValue($image_xml,'imageCaption');

    return $image;
  }
Exemplo n.º 4
0
function traverse($sys_id, $path, $node, $level, $id, $ix, $expand, $expand2, $father)
{
    global $par, $a3pr;
    $sel = $a3pr[$sys_id]['a3_object'];
    $from = $a3pr[$sys_id]['a3_from'];
    $from_father = $a3pr[$sys_id]['a3_from_father'];
    $to = $a3pr[$sys_id]['a3_to'];
    $user = $par['user'];
    $link_from_sid = $par['a3_link_from_sid'];
    $link_from_object = $par['a3_link_from_object'];
    $db_name = $a3pr[$sys_id]['a3_db'];
    $show_all = $a3pr[$sys_id]['a3_show_all'];
    if ($node->hasChildNodes()) {
        $level++;
        $id = 0;
        $childs = $node->childNodes;
        foreach ($childs as $child) {
            $attr_type = $child->attributes->getNamedItem("type")->nodeValue;
            if ($attr_type == 'node') {
                //if($child->hasChildNodes())echo("...");
                for ($ii = 1; $ii < $level; $ii++) {
                    echo "-";
                }
                $attr_name = $child->attributes->getNamedItem("name")->nodeValue;
                $attr_id = $child->attributes->getNamedItem("id")->nodeValue;
                $id++;
                $ix[$level] = $id;
                $index = "";
                for ($ii = 1; $ii <= $level; $ii++) {
                    $index = $index . $ix[$ii] . ".";
                }
                echo "{$index} <a href=\"{$path}&a3_sid={$sys_id}&a3_object_id={$attr_id}&index={$index}&p2={$father}\">{$attr_name}</a>";
                if ($user) {
                    echo " ({$attr_id})";
                }
                if ($user && $sel == $attr_id) {
                    if (!$from) {
                        echo "<a href=\"{$path}&a3_sid={$sys_id}&a3_object_id={$attr_id}&index={$index}&p1=select&p2={$father}\"> ?</a>";
                    }
                }
                if ($link_from_object == $attr_id && $link_from_sid == $sys_id) {
                    echo " F";
                }
                if ($user && $sel == $attr_id && $from && $from != $sel) {
                    echo "<a href=\"{$path}&a3_sid={$sys_id}&a3_object_id={$attr_id}&index={$index}&p1=to&p2={$attr_id}\"> M</a>";
                }
                if ($from == $attr_id || $link == $attr_id) {
                    echo "<a href=\"{$path}&a3_sid={$sys_id}&a3_object_id={$attr_id}&index={$index}&p1=cancel\"> *</a>";
                    //if($from == $attr_id)echo("<a href=\"$path&sid=$sys_id&a3_object_id=$attr_id&index=$index&p1=delete\"> D</a>");
                }
                if ($show_all == '<') {
                    $image = getNodeValue($db_name, $attr_id, 'type', 'image');
                    if ($image) {
                        echo "<br><img src=\"{$image}\" height=\"50\" alt=\"image error\"/>";
                    }
                    $text = getNodeValue($db_name, $attr_id, 'type', 'text');
                    if ($text) {
                        echo "{$text}";
                    }
                }
                echo "<br>";
                if ($expand[$level] == $ix[$level] || $expand2[$level] == $ix[$level]) {
                    traverse($sys_id, $path, $child, $level, $id, $ix, $expand, $expand2, $attr_id);
                }
            }
        }
        $level--;
    }
}
Exemplo n.º 5
0
function showObject($app, $db_name, $object_id)
{
    global $par;
    $path = $par['path'];
    $open_file = $par['p1'];
    //echo("showObject: $db_name,$object_id<br/>");
    //if($object_id == 1)echo("$db_name<br/>");
    $file = getXmlFileName($db_name);
    $dom = new DOMDocument();
    $dom->load($file);
    $xpath = new DOMXPath($dom);
    $question = "//object";
    $objects = $xpath->query($question);
    foreach ($objects as $object) {
        $id = $object->getAttribute('id');
        $name = $object->getAttribute('name');
        $type = $object->getAttribute('type');
        //echo("Aid= $id $object_id<br/>");
        if ($id == $object_id && $type == 'node') {
            echo "<b>{$name} {$id}</b><br/>";
            $childs = $object->childNodes;
            foreach ($childs as $child) {
                $attr_name = $child->attributes->getNamedItem("name")->nodeValue;
                $attr_id = $child->attributes->getNamedItem("id")->nodeValue;
                $attr_type = $child->attributes->getNamedItem("type")->nodeValue;
                //$attr_lid  = $child->attributes->getNamedItem("lid")->nodeValue;
                //if($attr_type != 'node')echo("Show: $attr_name $attr_id $attr_type<br/>");
                if ($attr_type == 'linkOut') {
                    $temp = getObjectName($attr_name, $attr_id);
                    //$temp = getNodeValue($db_name,$attr_id,$attr_lid,'type','linkFrom');
                    if ($temp) {
                        $sid = $par[$attr_name];
                        displayLinkOut($app, $db_name, $object_id, $attr_name, $attr_id, $temp, $sid);
                    }
                }
                if ($attr_type == 'linkIn') {
                    $temp = getObjectName($attr_name, $attr_id);
                    //$temp = getNodeValue($db_name,$attr_id,$attr_lid,'type','linkTo');
                    if ($temp) {
                        $sid = $par[$attr_name];
                        displayLinkIn($app, $db_name, $object_id, $attr_name, $attr_id, $temp, $sid);
                    }
                }
                if ($attr_type == 'text') {
                    $temp = getNodeValue($db_name, $attr_id, 'type', 'text');
                    if ($temp) {
                        displayObjectText($temp);
                    }
                }
                if ($attr_type == 'image') {
                    $temp = getNodeValue($db_name, $attr_id, 'type', 'image');
                    //if($temp)echo("Image: $temp<br/>");
                    //$image_name = getObjectImageName($db_name,$object_id);
                    //if($temp == $image_name)
                    $image_name = $temp;
                    if ($temp) {
                        displayObjectImage($image_name);
                    }
                }
                if ($attr_type == 'file') {
                    $temp = getNodeValue($db_name, $attr_id, 'type', 'file');
                    $file_name = $temp;
                    if ($temp) {
                        if ($open_file == "open_file") {
                            echo "<a href={$path}&a3_sid={$sys_id}&p1=close_file>" . FILE_CLOSE . "</a><br/>";
                            displayObjectFile($file_name);
                        } else {
                            echo "<a href={$path}&a3_sid={$sys_id}&p1=open_file>" . FILE_OPEN . "</a><br/>";
                        }
                    }
                }
            }
        }
    }
    echo "<hr>";
}