function openXML($file) { $doc = new DOMIT_Document(); if ($doc->loadXML(CONTENTDIR . $file)) { $xml =& $doc->documentElement; return $xml; } else { echo 'Could not open or read XML file: ' . $file . '<br />' . $doc->getErrorString(); return false; } }
/** * Constructor * * @param String $sourceDirectory * @param object $parentRepositoryImporter * @return object * @access public * @since 7/20/05 */ function XMLAssetIterator($srcDir, $parentRepositoryImporter) { $import = new DOMIT_Document(); if ($import->loadXML($srcDir . "metadata.xml")) { if (!$import->documentElement->hasChildNodes()) { $parentRepositoryImporter->addError("There are no assets to import in: " . $srcDir . "metadata.xml."); } $this->_assetList = $import->documentElement->childNodes; $this->_current = 0; } else { $parentRepositoryImporter->addError("XML parse failed: " . $srcDir . "metadata.xml does not exist or contains poorly formed XML."); } }
/** * (re)write the web.config file to prevent browser access to the log file */ function handleWebConfig() { global $setup_site_log_dir; global $setup_site_log_file; require_once 'include/domit/xml_domit_include.php'; $prefix = $setup_site_log_dir . empty($setup_site_log_dir) ? '' : '/'; $config_array = array(array('1' => $prefix . str_replace('.', '\\.', $setup_site_log_file) . '\\.*', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'install.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'upgradeWizard.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'emailman.log', '2' => 'log_file_restricted.html'), array('1' => 'not_imported_.*.txt', '2' => 'log_file_restricted.html'), array('1' => 'XTemplate/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'data/(.*).php', '2' => 'index.php'), array('1' => 'examples/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*)/(.*)', '2' => 'index.php'), array('1' => 'metadata/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'modules/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'soap/(.*).php', '2' => 'index.php'), array('1' => 'emailmandelivery.php', '2' => 'index.php'), array('1' => 'cron.php', '2' => 'index.php')); $xmldoc = new DOMIT_Document(); //create XML declaration $xmlDecl = $xmldoc->createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8"'); $xmldoc->appendChild($xmlDecl); $rootElement = $xmldoc->createElement('configuration'); $xmldoc->appendChild($rootElement); $system_webserver = $xmldoc->createElement('system.webServer'); $rewrite = $xmldoc->createElement('rewrite'); $rules = $xmldoc->createElement('rules'); for ($i = 0; $i < count($config_array); $i++) { $rule[$i] = $xmldoc->createElement('rule'); $rule[$i]->setAttribute('name', $i); $rule[$i]->setAttribute('stopProcessing', 'true'); $match[$i] = $xmldoc->createElement('match'); $match[$i]->setAttribute('url', $config_array[$i]['1']); $rule[$i]->appendChild($match[$i]); $action[$i] = $xmldoc->createElement('action'); $action[$i]->setAttribute('type', 'Redirect'); $action[$i]->setAttribute('url', $config_array[$i]['2']); $rule[$i]->appendChild($action[$i]); $rules->appendChild($rule[$i]); } $rewrite->appendChild($rules); $system_webserver->appendChild($rewrite); $rootElement->appendChild($system_webserver); // echo $xmldoc->documentElement->toNormalizedString(true); $xmldoc->saveXML('web.config', true); }
<?php //get rss xml from feed "Top Stories from The AT&T Worldnet FeedRoom" $myUrl = "http://www.feedroom.com/rssout/att_rss_1ebaad7be9f5b75e7783f8b495e59bd0f58380b9.xml"; $rss = file_get_contents($myUrl); //create new DOM Document require_once "xml_domit_parser.php"; $rssDoc = new DOMIT_Document(); //parse RSS XML $rssDoc->parseXML($rss, true); $numChannels = count($rssDoc->documentElement->childNodes); echo "<html>\n<head>\n<title>Sample RSS 0.9x Feed Display</title>\n</head>\n\n<body>\n"; for ($i = 0; $i < $numChannels; $i++) { $currentChannel =& $rssDoc->documentElement->childNodes[$i]; $channelTitle = $currentChannel->childNodes[0]->firstChild->nodeValue; $channelDesc = $currentChannel->childNodes[3]->firstChild->nodeValue; $channelPubDate = $currentChannel->childNodes[4]->firstChild->nodeValue; echo "<h2>{$channelTitle}</h2>\n<h4>({$channelDesc} - {$channelPubDate})</h4>\n"; $numChannelNodes = count($currentChannel->childNodes); //parse out items data for ($j = 5; $j < $numChannelNodes; $j++) { $currentItem = $currentChannel->childNodes[$j]; $itemTitle = $currentItem->childNodes[0]->firstChild->nodeValue; $itemDesc = $currentItem->childNodes[1]->firstChild->nodeValue; $itemLink = $currentItem->childNodes[2]->firstChild->nodeValue; echo "<p><a href=\"{$itemLink}\" target=\"_child\">{$itemTitle}</a> - {$itemDesc}</p>\n\n"; } } echo "</body>\n</html>";
/** * Creates a new DOMIT_Document node and appends a documentElement with the specified info * @param string The namespaceURI of the documentElement * @param string The $qualifiedName of the documentElement * @param Object A document type node * @return Object The new document fragment node */ function &createDocument($namespaceURI, $qualifiedName, &$docType) { $xmldoc = new DOMIT_Document(); $documentElement =& $xmldoc->createElementNS($namespaceURI, $qualifiedName); $xmldoc->setDocumentElement($documentElement); if ($docType != null) { $xmldoc->doctype =& $docType; } return $xmldoc; }
/** * process export * @name process_export * @param Filterstatement to select orders * @param db-object * @return bool true/false */ function process_export(&$db) { global $mosConfig_absolute_path, $database; $xmldoc = new DOMIT_Document(); $xmldoc->appendEntityTranslationTable(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES)); //damit sollte htmlspecialchars nicht mehr notwendig sein $xmldoc->expandEmptyElementTags(false); $xmldoc->appendChild($xmldoc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"IS0-8859-1\"")); $xmldoc->setDocumentElement($xmldoc->createElement('OLOrders')); $xmldoc->documentElement->appendChild($xmldoc->createElement('Version1.1')); $order_status = vmGet($_REQUEST, 'status', ''); $order_from = vmGet($_REQUEST, 'from', ''); $order_since = vmGet($_REQUEST, 'since', ''); $order_since = vmGet($_REQUEST, 'since', ''); $order_to = vmGet($_REQUEST, 'to', ''); $order_id = vmGet($_REQUEST, 'order_id', ''); $where = array(); if (!$order_status && !$order_from && !$order_since && !$order_to && !$order_id) { $order_status = 'P'; } if ($order_status) { $where[] = "order_status = '" . $db->getEscaped($order_status) . "'"; } if ($order_from) { $where[] = "order_id >= '" . $db->getEscaped($order_from) . "'"; } elseif ($order_since) { $where[] = "order_id > '" . $db->getEscaped($order_since) . "'"; } elseif ($order_id) { $where[] = "order_id = '" . $db->getEscaped($order_id) . "'"; } if ($order_to && !$order_id) { $where[] = "order_id <= '" . $db->getEscaped($order_to) . "'"; } //select the orders to export $q = 'SELECT * FROM #__{vm}_orders WHERE vendor_id=\'' . $db->f('vendor_id') . '\' AND '; $q .= implode($where); $db->setQuery($q); $orders = $db->loadAssocList(); for ($i = 0; $i < count($orders); $i++) { //get billing and shipping address $q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id='" . $orders[$i]['order_id'] . "'"; $db->setQuery($q); $orders[$i]['user_info'] = $db->loadAssocList(); //get shipping address $q = "SELECT * FROM #__{vm}_order_item WHERE order_id='" . $orders[$i]['order_id'] . "'"; $db->setQuery($q); $orders[$i]['item'] = $db->loadAssocList(); //get payment info $q = "SELECT * FROM #__{vm}_order_payment WHERE order_id='" . $orders[$i]['order_id'] . "'"; $db->setQuery($q); $orders[$i]['payment'] = $db->loadAssocList(); } foreach ($orders as $order) { //print_r($order); $OLWebOrder['OLWebOrder']['TransactionHeader']['TransactionID'] = $order['order_id']; $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['OrderDate'] = date('d.m.Y H:i:s', $order['cdate']); $OLWebOrder['OLWebOrder']['OrderHeader']['HeaderText'] = $order['customer_note']; $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['RefNo'] = str_pad($order['order_id'], 8, 0, STR_PAD_LEFT); for ($i = 0; $i < count($order['user_info']); $i++) { switch ($order['user_info'][$i]['address_type']) { case 'BT': default: if ($order['company']) { $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name1'] = $order['user_info'][$i]['company']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] . ' ' : ' ') . $order['user_info'][$i]['last_name']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Matchcode'] = $order['user_info'][$i]['company'] . ', ' . $order['user_info'][$i]['customers_city']; } else { $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name1'] = $order['user_info'][$i]['last_name']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] : ''); $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Matchcode'] = $order['user_info'][$i]['last_name'] . ', ' . $order['user_info'][$i]['city']; } $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Title'] = $order['user_info'][$i]['title']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Street'] = $order['user_info'][$i]['address_1'] . ($order['user_info'][$i]['address_2'] ? ', ' . $order['user_info'][$i]['address_2'] : ''); $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['ZIPCode'] = $order['user_info'][$i]['zip']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['City'] = $order['user_info'][$i]['city']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['State'] = $order['user_info'][$i]['state']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Country'] = $this->getISOCode2($order['user_info'][$i]['country']); $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['EMail'] = $order['user_info'][$i]['user_email']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['AddrTelefon'] = $order['user_info'][$i]['phone_1']; $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['AddrFax'] = $order['user_info'][$i]['fax']; break; case 'ST': if ($order['company']) { $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName1'] = $order['user_info'][$i]['company']; $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] . ' ' : ' ') . $order['user_info'][$i]['last_name']; } else { $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName1'] = $order['user_info'][$i]['last_name']; $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] : ''); } $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DATitle'] = $order['user_info'][$i]['title']; $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAStreet'] = $order['user_info'][$i]['address_1'] . ($order['user_info'][$i]['address_2'] ? ', ' . $order['user_info'][$i]['address_2'] : ''); $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAZIPCode'] = $order['user_info'][$i]['zip']; $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DACity'] = $order['user_info'][$i]['city']; $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAState'] = $order['user_info'][$i]['state']; $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DACountry'] = $this->getISOCode2($order['user_info'][$i]['country']); break; } } $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['CarrierCode'] = $this->getCarrierCode($order[$i]['ship_method_id']); $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['DeliveryPriceGross'] = 0; $OLWebOrder['OLWebOrder']['OrderHeader']['Payment']['Currency'] = $order['order_currency']; $OLWebOrder['OLWebOrder']['OrderHeader']['Payment']['BelOLPayCond'] = $this->getPaymentCode($order['payment'][0]['payment_method_id']); $this->OLWebOrder[] = $OLWebOrder; $OLWebOrder = array(); } $this->xmldoc =& $xmldoc; return true; }
function moreGranulesFromXML() { if (Services::serviceRunning("Logging")) { $loggingManager = Services::getService("Logging"); $log = $loggingManager->getLogForWriting("Harmoni"); $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified."); $priorityType = new Type("logging", "edu.middlebury", "Error", "Events involving critical system errors."); } $moreXML = $this->_import->documentElement->getElementsByTagName("repositoryfile"); $granules = 0; for ($i = 0; $i < $moreXML->getLength(); $i++) { $element = $moreXML->item($i); $path = $element->getText(); if (!preg_match("#^([a-zA-Z]+://|[a-zA-Z]+:\\|/)#", $path)) { $path = $element->ownerDocument->xmlPath . $path; } $import = new DOMIT_Document(); // attempt to load (parse) the xml file if ($import->loadXML($path)) { if (!$import->documentElement->hasChildNodes()) { $this->addError("There are no Importables in this file"); // log error $item = new AgentNodeEntryItem("XMLImporter Error", "No Importables in the file: " . htmlspecialchars($path) . "."); if (isset($log)) { $log->appendLogWithTypes($item, $formatType, $priorityType); } } else { $nodes = $import->documentElement->getElementsByTagName($this->_granule); $granules += $nodes->getLength(); } } else { // any errors encountered by DOMIT in parsing handled here $this->addError("DOMIT error: " . $import->getErrorCode() . "<br/>\t meaning: " . $import->getErrorString() . "<br/>"); $item = new AgentNodeEntryItem("XMLImporter DOMIT Error", "Error Code: " . $import->getErrorCode() . ", meaning: " . $import->getErrorString() . "."); if (isset($log)) { $log->appendLogWithTypes($item, $formatType, $priorityType); } } } return $granules; }
/** * get parameters for createRecord * * @param mixed input * @return array or false on fatal error * @access public * @since 7/20/05 */ function getSingleAssetRecordList($input) { if (Services::serviceRunning("Logging")) { $loggingManager = Services::getService("Logging"); $log = $loggingManager->getLogForWriting("Harmoni"); $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified."); $priorityType = new Type("logging", "edu.middlebury", "Error", "Events involving critical system errors."); } $idManager = Services::getService("Id"); $this->_fileStructureId = $idManager->getId("FILE"); $fileparts = array("File Name", "Thumbnail Data"); $this->_fileNamePartIds = $this->matchPartStructures($this->_destinationRepository->getRecordStructure($this->_fileStructureId), $fileparts); if (!isset($this->_structureId)) { $import = new DOMIT_Document(); if (!isset($this->_schemaPath)) { $this->_schemaPath = $this->getSchemaPath($this->_srcDir); if (!$this->_schemaPath) { $this->_schemaPath = DEFAULT_EXIF_SCHEMA; } } if ($import->loadXML($this->_schemaPath)) { if (!$import->documentElement->hasChildNodes()) { $this->addError("There are no schemas defined in : " . $this->_schemaPath); if (isset($log)) { $item = new AgentNodeEntryItem("ExifImporter Error", "There are no schemas defined in: " . $this->_schemaPath); $log->appendLogWithTypes($item, $formatType, $priorityType); } return false; } } else { $this->addError("XML parse failed: " . $this->_schemaPath . " does not exist or contains poorly formed XML."); if (isset($log)) { $item = new AgentNodeEntryItem("ExifImporter DOMIT Error", "XML parse failed: " . $this->_schemaPath . " does not exist or contains poorly formed XML."); $log->appendLogWithTypes($item, $formatType, $priorityType); } return false; } $istructuresList = $import->documentElement->childNodes; $this->_structureId = array(); $this->_partsFinal = array(); $this->_valuesFinal = array(); foreach ($istructuresList as $istructure) { $valuesPreFinal = array(); $partStructuresArray = array(); if ($istructure->nodeName == "recordStructure") { //match the structure $ipartStructures = $istructure->childNodes; if ($ipartStructures[0]->getText() != "") { $matchedSchema = $idManager->getId($ipartStructures[0]->getText()); } else { $matchedSchema = $this->matchSchema($ipartStructures[1]->getText(), $this->_destinationRepository); } if ($matchedSchema == false) { $this->addError("Schema: " . $ipartStructures[1]->getText() . " does not exist"); if (isset($log)) { $item = new AgentNodeEntryItem("ExifImporter \n\t\t\t\t\t\t\t\tError", "Schema: " . $ipartStructures[1]->getText() . " does not exist."); $log->appendLogWithTypes($item, $formatType, $priorityType); } return false; } else { $this->_structureId[] = $matchedSchema; } //match the partstructures foreach ($ipartStructures as $ipartStructure) { if ($ipartStructure->nodeName == "partStructure") { $ivaluesArray = $ipartStructure->childNodes; if ($ivaluesArray[0]->getText() != "") { $matchedId = $idManager->getId($ivaluesArray[0]->getText()); } else { $matchedId = $this->getPartIdByName($ivaluesArray[1]->getText(), $matchedSchema); } if ($matchedId == false) { $this->addError("Part " . $ivaluesArray[1]->getText() . " does not exist."); if (isset($log)) { $item = new AgentNodeEntryItem("ExifImporter Error", "Part " . $ivaluesArray[1] . " does not exist."); $log->appendLogWithTypes($item, $formatType, $priorityType); } return false; } $partStructuresArray[] = $matchedId; $repeatableValueArray = array(); foreach ($ivaluesArray as $ivalueField) { if ($ivalueField->nodeName == "value") { $valueArray = array(); $ivaluesChildren = $ivalueField->childNodes; foreach ($ivaluesChildren as $ivalue) { if ($ivalue->nodeName == "exifElement") { $valueArray[] = "exif::" . $ivalue->getText(); } if ($ivalue->nodeName == "text") { $valueArray[] = "text::" . $ivalue->getText(); } } $repeatableValueArray[] = $valueArray; } } $valuesPreFinal[$matchedId->getIdString()] = $repeatableValueArray; } $this->_valuesFinal[$matchedSchema->getIdString()] = $valuesPreFinal; } $this->_partsFinal[$matchedSchema->getIdString()] = $partStructuresArray; } } } $recordList = array(); $recordListElement = array(); $headerData = get_jpeg_header_data($input); $fileMetaData1 = $this->extractPhotoshopMetaData(); $fileMetaData2 = $this->extractExifMetaData($input); $fileMetaData = array_merge($fileMetaData1, $fileMetaData2); $recordListElement['structureId'] = $this->_fileStructureId; $recordListElement['partStructureIds'] = $this->_fileNamePartIds; $recordListElement['parts'] = array($input, ""); $recordList[] = $recordListElement; $recordListElement = array(); foreach ($this->_structureId as $structureId) { $parts = array(); $recordListElement['structureId'] = $structureId; $recordListElement['partStructureIds'] = $this->_partsFinal[$structureId->getIdString()]; $partValuesArray = $this->_valuesFinal[$structureId->getIdString()]; foreach ($partValuesArray as $key => $repeatablePartsArray) { $partValues = array(); foreach ($repeatablePartsArray as $partsComponentsArray) { // If we have a single entry in the value field, create // multiple part values for any repeated source values. if (count($partsComponentsArray) == 1) { $checkExifField = explode("::", $partsComponentsArray[0]); // An Exif Value if ($checkExifField[0] == "exif") { if (isset($fileMetaData[$checkExifField[1]])) { //multi-valued source values if (is_array($fileMetaData[$checkExifField[1]])) { foreach ($fileMetaData[$checkExifField[1]] as $sourceValue) { $partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $sourceValue); } } else { $partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $fileMetaData[$checkExifField[1]]); } } } else { $partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $checkExifField[1]); } } else { $data = ""; foreach ($partsComponentsArray as $partComponent) { $checkExifField = explode("::", $partComponent); // An Exif Value if ($checkExifField[0] == "exif") { if (isset($fileMetaData[$checkExifField[1]])) { if (is_array($fileMetaData[$checkExifField[1]])) { $data .= implode(", ", $fileMetaData[$checkExifField[1]]); } else { $data .= $fileMetaData[$checkExifField[1]]; } } } else { $data .= $checkExifField[1]; } } $partValues[] = $this->getPartObject($structureId, $idManager->getId($key), $data); } } $parts[] = $partValues; } $recordListElement['parts'] = $parts; $recordList[] = $recordListElement; } // printpre($recordList); // exit; return $recordList; }
function read_from_xml() { $tagcnt = array(); if (!file_exists(DIR_FS_CIP . '/' . $this->cip_name . '/' . CONFIG_FILENAME)) { $this->error(ERROR_COULD_NOT_OPEN_XML . $this->cip_name . '/' . CONFIG_FILENAME); return; } require_once DIR_FS_ADMIN_CLASSES . 'xml_domit_parser.php'; $xmlDoc = new DOMIT_Document(); //parse XML $xmlDoc->loadXML(DIR_FS_CIP . '/' . $this->cip_name . '/' . CONFIG_FILENAME); foreach ($xmlDoc->documentElement->childNodes as $id => $tag_data) { // ignore xml comments if ($tag_data->nodeName == '#comment') { continue; } if (array_key_exists($tag_data->nodeName, $tagcnt)) { $tagcnt[$tag_data->nodeName]++; } else { $tagcnt[$tag_data->nodeName] = 0; } if (strtolower($tag_data->nodeName) == 'php') { $this->count_php_tags++; } $clsname = 'Tc_' . strtolower($tag_data->nodeName); if (class_exists($clsname)) { $this->contrib_data[] = new $clsname($this, $tagcnt[$tag_data->nodeName], $tag_data); } else { $this->error('Tag' . $tag_data->nodeName . ' is not supported. Class ' . $clsname . ' does NOT exist.'); return; } if (strtoupper($tag_data->nodeName) == 'DESCRIPTION') { $this->description_id = key($this->contrib_data); } } }
* "Powered by SugarCRM". ********************************************************************************/ global $mod_strings; global $sugar_config; $setup_site_log_dir = isset($_SESSION['setup_site_custom_log_dir']) ? $_SESSION['setup_site_log_dir'] : '.'; $setup_site_log_file = 'sugarcrm.log'; // may be an option later require_once 'include/domit/xml_domit_include.php'; $uploadDir = ''; $uploadHta = ''; if (empty($GLOBALS['sugar_config']['upload_dir'])) { $GLOBALS['sugar_config']['upload_dir'] = 'cache/upload/'; } $prefix = $setup_site_log_dir . empty($setup_site_log_dir) ? '' : '/'; $config_array = array(array('1' => $prefix . str_replace('.', '\\.', $setup_site_log_file) . '\\.*', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'install.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'upgradeWizard.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'emailman.log', '2' => 'log_file_restricted.html'), array('1' => 'not_imported_.*.txt', '2' => 'log_file_restricted.html'), array('1' => 'XTemplate/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'data/(.*).php', '2' => 'index.php'), array('1' => 'examples/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*)/(.*)', '2' => 'index.php'), array('1' => 'metadata/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'modules/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'soap/(.*).php', '2' => 'index.php'), array('1' => 'emailmandelivery.php', '2' => 'index.php'), array('1' => 'cron.php', '2' => 'index.php'), array('1' => $sugar_config['upload_dir'] . '.*', '2' => 'index.php')); $xmldoc = new DOMIT_Document(); //var_dump($config_array); //create XML declaration $xmlDecl = $xmldoc->createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8"'); $xmldoc->appendChild($xmlDecl); $rootElement = $xmldoc->createElement('configuration'); $xmldoc->appendChild($rootElement); $system_webserver = $xmldoc->createElement('system.webServer'); $rewrite = $xmldoc->createElement('rewrite'); $rules = $xmldoc->createElement('rules'); $rule = array(); $match = array(); $rule_action = array(); for ($i = 0; $i < count($config_array); $i++) { $rule[$i] = $xmldoc->createElement('rule'); $rule[$i]->setAttribute('name', $i);