Exemple #1
1
function get($page)
{
    global $pdo;
    $url = "http://demon.tw/page/{$page}?s=vb";
    $doc = new domdocument();
    @$doc->loadhtmlfile($url);
    $x = new domxpath($doc);
    $links = $x->query("//div[@id='content']//h3/a");
    foreach ($links as $link) {
        $title = $link->textContent;
        $page_url = $link->getAttribute("href");
        $page_url = trim($page_url);
        if (!$page_url) {
            continue;
        }
        $doc2 = new domdocument();
        @$doc2->loadhtmlfile($page_url);
        $x2 = new domxpath($doc2);
        $ps = $x2->query("//div[@class='entry']");
        foreach ($ps as $p) {
            $body = $p->textContent;
        }
        $body = fixbody($body);
        $s = $pdo->prepare("insert into vbs(title,body,url) values(:title,:body,:url)");
        $s->execute(array('title' => $title, 'body' => $body, 'url' => $page_url));
    }
}
/** gets array of dmids from DOMDocument 
* now dupped in Exercise... can we drop it?
*/
function dom2set( $set_dom ) {
	$set = array();

	$xpath = new domxpath( $set_dom );
	$nodes = $xpath->query( "//defined-meaning" );

	foreach ( $nodes as $node ) {
		$set[] = (int) $node->getAttribute( "defined-meaning-id" );
	}

	return $set;
}
	/** utility function, returns an array of words in the particular language for this question's defined meaning */
	public function getWordsForLanguages( $languages = null ) {
		if ( $languages === null ) throw new Exception( "No language specified" );
		$words = array();
		$xpath = new domxpath( $this->questionDoc );
		foreach ( $languages as $language ) {
			$nodes = $xpath->query( "//synonyms-translations-list/synonyms-translations/expression[@language=\"$language\"]" );
			foreach ( $nodes as $node ) {
				$words[] = $node->textContent;
			}
		}
		if ( count( $words ) == 0 )
			throw new MissingWordsException( "no words found in this context for languages " . implode( ",", $languages ) );
		return $words;
	}
 public function setDataField($pDataFieldName, $pValue)
 {
     if (!$this->xmlIsLoaded) {
         $this->loadDataFields();
     }
     $xp = new domxpath($this->xml);
     $nodeList = $xp->query("/DataFields/DataField[ @Name = \"" . $pDataFieldName . "\"]");
     if (!$nodeList->item(0)) {
         $df = $this->xml->createElement('DataField');
         $df->setAttribute('Name', $pDataFieldName);
         $this->xml->getElementsByTagName('DataFields')->item(0)->appendChild($df);
         $df->appendChild($this->xml->createCDATASection($pValue));
     } else {
         $nodeList->item(0)->replaceChild($this->xml->createCDATASection($pValue), $nodeList->item(0)->childNodes->item(0));
     }
     $this->setDataFields($this->xml->saveXML());
 }
 public function resume($request)
 {
     // Cargo arbol con la lista xml
     $dom = new DOMDocument('1.0', 'ISO-8859-1');
     $dom->loadXml($this->getParameter('in_lista'));
     // xpath para busqueda en lista inicial
     $xp = new domxpath($dom);
     // Creo nuevo string xml donde ir cargando los objetos seleccionados
     $xml = "<list>";
     foreach ($request->getParameter('ids') as $id) {
         // Obtengo objeto de la lista inicial a partir de su id
         $find = $xp->query("/list/obj[id='" . $id . "']");
         if ($find->length == 1) {
             $xml .= $dom->saveXML($find->item(0));
         }
     }
     $xml .= "</list>";
     $this->setParameter('out_lista', $xml);
     $this->setParameter('out_cantidad', count($request->getParameter('ids')));
 }
Exemple #6
0
function bench2()
{
    global $XML;
    $dom = new domDocument();
    $dom->loadxml($XML);
    $xp = new domxpath($dom);
    $nodes = $xp->query("//title/text()");
    foreach ($nodes as $n) {
        $arr[] = $n->nodeValue;
    }
    return $arr;
    /*
    // simplexml syntax...
    $s = simplexml_load_string($XML);
    $nodes = $s->xpath("//title");
    foreach($nodes as $v) {
    	$arr[] = reset($v);
    }
    return $arr;
    */
}
 /**
  * Recupera el Macro Id del paquete Xpdl parametrizado.
  * El paquete puede ser una url de un archivo o un contenido xml.
  * @param string $pFileXpdl Url del archivo o contenido
  * @return string Id xpdl o false si no lo tiene.
  */
 public static function getFileXpdlMacroId($pFileXpdl)
 {
     $xml = new DOMDocument();
     if (file_exists($pFileXpdl)) {
         $ret = $xml->load($pFileXpdl);
     } else {
         $ret = $xml->loadXML($pFileXpdl);
     }
     if (!$ret) {
         return false;
     }
     $xml = new DOMDocument();
     $ret = $xml->load($pFileXpdl);
     $xp = new domxpath($xml);
     $nodeList = $xp->query("/xpdl2:Package/ExtendedAttributes/ExtendedAttribute[@Name=\"PSDFMacro\"]");
     if ($nodeList->length > 0) {
         $node = $nodeList->item(0);
         return $node->getAttribute('Value');
     }
     return false;
 }
Exemple #8
0
<?php

echo "Test 2: Transform To HTML String";
include "prepare.inc";
// changing output method to html
$xp = new domxpath($xsl);
$res = $xp->query("/xsl:stylesheet/xsl:output/@method");
if ($res->length != 1) {
    print "No or more than one xsl:output/@method found";
    exit;
}
$res->item(0)->value = "html";
$proc->importStylesheet($xsl);
print "\n";
print $proc->transformToXml($dom);
print "\n";
Exemple #9
0
 public function run($str = nULL)
 {
     if (!is_null($str)) {
         $regex = '/<([a-z0-9\\-]+)(.*?)>(?:(.*?)(<\\/\\1>))?/ix';
         if (is_a($str, jqmel)) {
             $str = $str->dom()->get()->lastdom;
         } elseif (is_callable($str)) {
             $str = call_user_func($str, array());
         }
         $str = preg_replace('/\\s+/', ' ', $str);
         if (preg_match($regex, $str, $match)) {
             $match[2] = rtrim($match[2], '/');
         }
         $document = jqm_use($this->node->_parentElement);
         $np = $this->node->next()->get();
         $npp = $this->node->prev()->get();
         $par = $this->node->parent();
         $wrap = $str;
         if (!is_a($par->get(), jqmel)) {
             return;
         }
         $rec = $document->_DOM;
         if ($rec->doctype) {
             $rec->removeChild($rec->doctype);
         }
         $xpath = new domxpath($rec);
         $find = $xpath->query($this->node->_path);
         if ($find->length > 0) {
             $child = new domDocument();
             $child->loadHtml($wrap);
             if ($child->doctype) {
                 $child->removeChild($child->doctype);
             }
             $chf = $child->getElementsByTagName($match[1]);
             $node = $this->node->__toDomElement();
             $frag = $child->importNode($node, true);
             $depth = $this->getDeepest($chf->item(0));
             $save = $depth->appendChild($frag);
             //Import to document
             $frag = $rec->importNode($chf->item(0), true);
             $newsave = $find->item(0)->parentNode->replaceChild($frag, $find->item(0));
             $new_path = explode('/', $frag->getNodePath());
             $p_path = array_filter(explode('/', $save->getNodePath()));
             //$p_path = array_pop($p_path);
             $htm = array_search('html', $p_path);
             if ($htm) {
                 unset($p_path[$htm]);
                 unset($p_path[$htm + 1]);
             }
             $new_path = array_merge($new_path, $p_path);
             $sh = array_pop($new_path);
             array_pop($new_path);
             $ele_path = ltrim($newsave->getNodePath(), '/');
             $this->node->_parent_path = implode('/', $new_path);
             $this->node->_path = $this->node->_parent_path . '/' . $sh;
             $wrap = $rec->saveHtml($frag->parentNode);
             $wrap = substr($wrap, strpos($wrap, '>') + 1);
             if (!empty($par->get()->_localName)) {
                 $wrap = substr($wrap, 0, strripos($wrap, $par->get()->_localName));
                 $par->get()->html($wrap);
             }
             $find = $this->node->getPathById();
             if ($find) {
                 $this->node->_path = $find;
             }
             if ($this->node->trace) {
                 $key = $this->node->trace->key();
                 $this->node->trace->next();
                 $n = $this->node->trace->current();
                 if ($key > 0) {
                     $this->node->trace->seek($key - 1);
                     $p = $this->node->trace->current();
                 }
                 if ($p and is_a($p, jqmel)) {
                     $find = $p->getPathById();
                     if ($find) {
                         $p->_path = $find;
                         //var_dump($key,$p);
                     }
                 }
                 if ($n and is_a($n, jqmel)) {
                     $find = $n->getPathById();
                     if ($find) {
                         $n->_path = $find;
                     }
                 }
                 unset($p);
                 unset($n);
             }
         }
     }
 }
 /**
  * Borra del xpdl el nodo proceso del parametro
  * Esta metodo debe llamarse cada vez que se de de baja un objeto proceso
  * @param $procesoId
  * @return unknown_type
  */
 public function deleteXpdlProcess($procesoXpdlId)
 {
     if (!$this->xpdlLoad()) {
         throw new sfException(sprintf('No se pudo cargar xml/xpdl del paquete ' . $this->getNombre()));
     }
     $xp = new domxpath($this->xml);
     $nodeList = $xp->query("/xpdl2:Package/xpdl2:WorkflowProcesses/xpdl2:WorkflowProcess[ @Id=\"" . $procesoXpdlId . "\"]");
     if ($nodeList->length == 1) {
         $parent = $this->xml->documentElement->getElementsByTagName('WorkflowProcesses');
         $parent->item(0)->removeChild($nodeList->item(0));
     }
 }
 protected function showAlbumContent($userId, $albumName)
 {
     $tmp = array();
     $url = 'http://picasaweb.google.com/data/feed/api/user/' . urlencode($userId) . '/album/' . $albumName . "/";
     $xml = $this->curlit($url);
     $xml = str_replace("xmlns='http://www.w3.org/2005/Atom'", '', $xml);
     if ($xml == "No album found.") {
         DB::alteration_message("{$albumName} NOT FOUND", "deleted");
         return $tmp;
     }
     $dom = new domdocument();
     if ($xml) {
         $dom->loadXml($xml);
         $xpath = new domxpath($dom);
         $nodes = $xpath->query('//entry');
         foreach ($nodes as $node) {
             $tmp[]['src'] = $xpath->query('.//media:thumbnail/@url', $node)->item(0)->textContent;
         }
     }
     return $tmp;
 }
 private function FindService(ServiceAlias $serviceAlias)
 {
     $objXpath = new domxpath($this->xmlNode->ownerDocument);
     $strXpath = "//service[name = '" . $serviceAlias->Alias . "']";
     $objNodeList = $objXpath->query($strXpath);
     $serviceAliasNode = $objNodeList->item(0);
     if ($serviceAliasNode == null) {
         throw new Exception("Alias " . $serviceAlias->Alias . " not found");
     }
     return $serviceAliasNode;
 }
Exemple #13
0
[expect php]
[file]
<?php 
require 'Phalanger.inc';
echo "Test 5: Checking Indent";
include "prepare.inc";
$xp = new domxpath($xsl);
$res = $xp->query("/xsl:stylesheet/xsl:output/@indent");
if ($res->length != 1) {
    print "No or more than one xsl:output/@indent found";
    exit;
}
$res->item(0)->value = "yes";
$proc->importStylesheet($xsl);
print "\n";
print __xml_norm($proc->transformToXml($dom));
print "\n";
 private function FindNode(ClassMappingItem $classMappingItem)
 {
     $objXpath = new domxpath($this->xmlNode->ownerDocument);
     $strXpath = "//classMapping[clientClass = '" . $classMappingItem->ClientClass . "' and serverClass = '" . $classMappingItem->ServerClass . "']";
     $objNodeList = $objXpath->query($strXpath);
     $classMappingNode = $objNodeList->item(0);
     if ($classMappingNode == null) {
         throw new Exception("Class mapping between '" . $classMappingItem->ClientClass . "' and '" . $classMappingItem->ServerClass . "' not found");
     }
     return $classMappingNode;
 }
	/** retrieve previously stored hides data from dom tree */
	private function retrieve_hides_from_dom() {
		$dom = $this->fullSet;
		$xpath = new domxpath( $dom );
		$nodes = $xpath->query( "/collection/hides/hide" );
		if ( $nodes->length > 0 ) {
			$hides = array();
			foreach ( $nodes as $node ) {
				$hides[] = $node->nodeValue;
			}
		} else {
			$hides = array();
		}

		$this->setHide( $hides );
	}
 public function getNextActivities($process_id, $activity_id)
 {
     $xp2 = new domxpath($this->xml);
     $activities = array();
     // Obtengo transiciones cuyo origen es la actividad actual
     $nodeList = $this->getElementsByQuery("/xpdl2:Package/xpdl2:WorkflowProcesses/xpdl2:WorkflowProcess[ @Id=\"" . $process_id . "\"]" . "/xpdl2:Transitions/xpdl2:Transition[ @From=\"" . $activity_id . "\" ]");
     foreach ($nodeList as $node) {
         // Obtengo el nodo y nombre de la actividad destino
         $nodeList2 = $xp2->query("/xpdl2:Package/xpdl2:WorkflowProcesses/xpdl2:WorkflowProcess[ @Id=\"" . $process_id . "\"]" . "/xpdl2:Activities/xpdl2:Activity[ @Id=\"" . $node->getAttribute("To") . "\" ]");
         $act['id'] = $nodeList2->item(0)->getAttribute('Id');
         $act['name'] = $nodeList2->item(0)->getAttribute('Name');
         $act['type'] = $this->getActivityType($nodeList2->item(0));
         $activities[] = $act;
     }
     return $activities;
 }
Exemple #17
0
 /**
  * function to fetch all images , title and description
  * @return string
  */
 public function getMeta()
 {
     $large_image_width = $this->mg_image_width;
     $large_image_height = $this->mg_image_height;
     // Makes sure we're loaded
     $this->load();
     if ($this->load() == 404) {
         $metaData = array();
         $metaData['status'] = '404 not found';
         return $metaData;
     }
     // Image collection array
     $images = array();
     $xp = new \domxpath($this->document);
     // get all meta tags from document
     $metas = $this->document->getElementsByTagName('meta');
     $metaData = array();
     $metaData['description'] = '';
     // loop throug all meta tags
     foreach ($metas as $meta) {
         $metaData[$meta->getAttribute('property')] = $meta->getAttribute('content');
         if (strtolower($meta->getAttribute('name')) == 'description') {
             $metaData['description'] = $meta->getAttribute('content');
         }
         if (strtolower($meta->getAttribute('itemprop')) == 'image') {
             if (strpos($this->url, 'http://') === false) {
                 $this->url = 'http://' . $this->url;
             }
             $metaData['itempropimage'] = $this->url . "/" . $meta->getAttribute('content');
         }
     }
     // get title
     $title = $this->document->getElementsByTagName('title')->item(0)->textContent;
     $metaData['title'] = trim($title);
     // get description
     if (isset($metaData['og:description'])) {
         $metaData['description'] = $metaData['og:description'];
     } else {
         $metaData['description'] = $metaData['description'];
     }
     if (count($metaData) > 0 && isset($metaData['og:image'])) {
         if (strpos($metaData['og:image'], 'http:') === false) {
             $metaData['image'] = 'http:' . $metaData['og:image'];
         }
         $metaData['image'] = $metaData['og:image'];
     } else {
         if (isset($metaData['itempropimage'])) {
             $metaData['image'] = $metaData['itempropimage'];
         }
     }
     if (isset($metaData['image'])) {
         @($imageString = file_get_contents($metaData['image']));
     }
     if (empty($imageString) || !isset($metaData['image']) || $metaData['image'] == '') {
         $image_list = $xp->query("//img[@src]");
         $images = array();
         //loop all images and find required size image
         for ($i = 0; $i < $image_list->length; $i++) {
             $actualImage = $image_list->item($i)->getAttribute("src");
             $ImageUrlFormatter = new ImageUrlFormatter();
             $img = $ImageUrlFormatter->format($this->url, $actualImage);
             $ext = trim(pathinfo($img, PATHINFO_EXTENSION));
             if ($img && $ext != 'gif') {
                 list($width, $height, $type, $attr) = @getimagesize($img);
                 if ($i > 0) {
                     if ($width > $large_image_width || $height > $large_image_height) {
                         $large_image = $img;
                         $large_image_width = $width;
                         $large_image_height = $height;
                     }
                 } else {
                     $large_image = $img;
                     $large_image_width = $width;
                     $large_image_height = $height;
                 }
                 if ($width < $this->mg_image_width || $height < $this->mg_image_height) {
                     continue;
                 } else {
                     if ($width >= $this->mg_image_width && $height >= $this->mg_image_height) {
                         $large_image = $img;
                         break;
                     }
                 }
             }
         }
     }
     //check if no image data is present assign it to blank
     if (count($images) <= 0 && !isset($metaData['image'])) {
         $metaData['image'] = '';
     }
     if (isset($large_image)) {
         $metaData['image'] = $large_image;
     }
     if (!array_keys($metaData, 'description')) {
         // $metaData['description'] = '';
     }
     //hack for search google link
     if (isset($metaData['image']) && strpos($metaData['image'], 'search')) {
         $rebuildUrl = parse_url($this->url);
         $search = array_values($metaData);
         $metaData['image'] = $rebuildUrl['scheme'] . "://" . $rebuildUrl['host'] . $search[1];
     }
     if ($metaData['title'] == "" || $metaData['description'] == "") {
         $metaData['title'] = ucfirst($this->__extractName($this->url));
     }
     return $metaData;
 }
Exemple #18
0
<?php

include "../http.class.php";
# our HTTP lib lets us keep a presistant connection
$http = new http();
$html = $http->get("http://www.shazam.com/");
$dom = new DOMDocument();
# hide some XML errors.
libxml_use_internal_errors(true);
$dom->loadHTML($html);
$xp = new domxpath($dom);
$elements = $xp->query("/html/head/title");
#$elements = $xp->query("/html/body/div/div/div[2]/div[2]/ul");
if (!is_null($elements)) {
    foreach ($elements as $element) {
        echo $element->nodeName;
        $nodes = $element->childNodes;
        foreach ($nodes as $node) {
            echo $node->nodeValue . "\n";
        }
    }
}
Exemple #19
0
 public static function picasaweb_ListAlbums($userName, $key, $thumbsize = 666)
 {
     $url = 'http://picasaweb.google.com/data/feed/api/user/' . urlencode($userName) . '?authKey=' . $key . '&kind=album';
     $xml = file_get_contents($url);
     $xml = str_replace("xmlns='http://www.w3.org/2005/Atom'", '', $xml);
     $albums = array();
     $dom = new domdocument();
     $dom->loadXml($xml);
     $xpath = new domxpath($dom);
     $nodes = $xpath->query('//entry');
     foreach ($nodes as $node) {
         $imageUrl = $xpath->query('.//media:thumbnail/@url', $node)->item(0)->textContent;
         $imageUrl = str_replace('?imgmax=160', '?imgmax=' . $thumbsize, $imageUrl);
         $albumId = $xpath->query('.//gphoto:id', $node)->item(0)->textContent;
         $albumName = $xpath->query('.//gphoto:name', $node)->item(0)->textContent;
         $albumTitle = $xpath->query('.//media:title', $node)->item(0)->textContent;
         $imageCount = $xpath->query('.//gphoto:numphotos', $node)->item(0)->textContent;
         $published = $xpath->query('.//published', $node)->item(0)->textContent;
         $album = array();
         $album['folder'] = "{$userName}@{$albumId}";
         $album['name'] = $albumName;
         $album['description'] = $albumTitle;
         $album['image'] = $imageUrl;
         $album['date'] = $published;
         $album['overallCount'] = $imageCount;
         $album['url'] = 'http://picasaweb.google.com/' . urlencode($userName) . '/' . urlencode($album['name']);
         $albums[] = (object) $album;
         unset($album);
     }
     return $albums;
 }
Exemple #20
0
 function getBody($html)
 {
     $d = new DomDocument();
     $html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>' . $html . '</body>';
     @$d->loadHTML($html);
     $xp = new domxpath($d);
     $res = $xp->query("/html/body/node()");
     $body = "";
     foreach ($res as $node) {
         $body .= $d->saveXML($node);
     }
     return $body;
 }
Exemple #21
0
 }
 $startTime = strtotime($start[$i]);
 $endTime = strtotime($stop[$i]);
 $TIMEINTERVAL = timeInterval2Days($endTime - $startTime);
 $STARTTIME = startTime2Days($startTime);
 fwrite($fileS, $STARTTIME . PHP_EOL . $TIMEINTERVAL . PHP_EOL);
 fclose($fileS);
 $myParamBuilder = new ParamBuilder();
 //  Process   Local Params without codes if they exist
 if (file_exists(XML_BASE_DIR . "LocalParamsList.xml")) {
     $localParams = new DomDocument('1.0');
     $localParams->load(XML_BASE_DIR . "LocalParamsList.xml");
     $xp = new domxpath($localParams);
     foreach ($params as $param) {
         $var = $param->getAttribute('name');
         $paramTag = $xp->query('//PARAM[.="' . $var . '"]');
         if ($paramTag->length !== 0) {
             $myParamBuilder->paramLocalBuild($var);
         }
     }
 }
 // Run command
 if ($isMulti) {
     $DD_cmd = 'DD_PS';
 } else {
     $DD_cmd = 'DD_Plot';
 }
 $cmd = DDBIN . $DD_cmd . " request.list " . $user . " " . $IP . " " . DDPROJECT . " " . DDPROJLIB;
 $cmdResult = system($cmd);
 if ($cmdResult === false) {
     errorProcessing($ID, $cmdResult);
Exemple #22
0
<?php

echo "Test 4: Checking UTF8 Output";
include "prepare.inc";
$xp = new domxpath($xsl);
$res = $xp->query("/xsl:stylesheet/xsl:output/@encoding");
if ($res->length != 1) {
    print "No or more than one xsl:output/@encoding found";
    exit;
}
$res->item(0)->value = "utf-8";
$proc->importStylesheet($xsl);
print "\n";
print $proc->transformToXml($dom);
print "\n";
Exemple #23
0
<?php

$part_id = $_GET['part_id'];
$default_target = '';
$xmldom = new DomDocument();
$xmldom->load('menu.xml');
$xpath = new domxpath($xmldom);
$part_node = $xpath->query("/menu/part[@id='{$part_id}']/item");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" media="all" href="css/admin.css" />
<style type="text/css">html{overflow:hidden;}body{overflow:hidden;}</style>
</head>
<body>
<ul id="submenu" class="submenu">
<?php 
foreach ($part_node as $rs) {
    $is_default = $rs->attributes->item(2)->value;
    if ($is_default === 'true') {
        $default_target = $rs->attributes->item(1)->value;
    }
    echo '<li ' . ($is_default === 'true' ? ' class="active" ' : '') . ' onClick="changeLeftMenu(this);"><a hidefocus="true" href="' . $rs->attributes->item(1)->value . '" target="right">' . $rs->attributes->item(0)->value . '</a></li>';
}
?>
</ul>
<script type="text/javascript" language="javascript">
	parent.document.getElementById('BoardTitle').style.width = '200px';
	parent.document.getElementById('separator').className = 'menu_fold';
 /**
  * Dinamically sets a proprety on runtime.
  *
  * Assuming that we have
  * <code>
  *   <property name="application_path" value="/wwwroot/htdocs/locknet7/app" />
  * </code>  
  * To change the value of application_path property:
  * <code>
  *   $config->setProperty('application_path', 'C:\\Fast\\www\\medick\\app');
  * </code>
  *
  * @param string, name, the name of the property.
  * @param string, value, the value of the property.
  * @throws ConfiguratorException if the property that we want to set don't exists in the xml file/string
  */
 public function setProperty($name, $value)
 {
     $xp = new domxpath($dom = $this->toDom());
     $property = $xp->query("//application/property[@name=\"" . $name . "\"]");
     if ($property->length != 1) {
         throw new ConfiguratorException('Cannot set the property name: ' . $name . 'Property don\'t exist or there are two propreties with the same name');
     }
     $property->item(0)->setAttribute('value', $value);
     // save the new xml tree
     $this->sxe = simplexml_import_dom($dom, 'SimpleXMLIterator');
 }
Exemple #25
0
 // Down to working directory
 chdir(resultDir . $ID . "/RES");
 $fileInfo = $chain . '    ' . $vars;
 $fileResult = 'search.res';
 $fileRes = fopen($fileResult, "w");
 fwrite($fileRes, $fileContents);
 fclose($fileRes);
 // create IDL PARAMCALCUL PROCEDURE
 $myParamBuilder = new ParamBuilder();
 //  Process   Local Params without codes if they exist
 if (file_exists(XML_BASE_DIR . "LocalParamsList.xml")) {
     $localParams = new DomDocument('1.0');
     $localParams->load(XML_BASE_DIR . "LocalParamsList.xml");
     $xp = new domxpath($localParams);
     foreach ($vars as $var) {
         if ($xp->query('//PARAM[.="' . $var . '"]') != null) {
             $myParamBuilder->paramLocalBuild($var);
         }
     }
 }
 $myParamBuilder->makeParamCalcul($chain, $vars, "");
 // File creation and Get PID and STATUT
 $cmd = DDBIN . "DD_Search " . $user . " " . $IP . " " . DDPROJECT . " " . DDPROJLIB;
 $cmdResult = system($cmd);
 if ($cmdResult === false) {
     errorProcessing($ID, $cmdResult);
 }
 //	    system($cmd);
 chdir(resultDir . $ID . "/TT");
 if (file_exists('helio.xml')) {
     rename('helio.xml', 'helio' . $i . '.xml');