/** * Evaluates location path expression. * * @access private */ function _evalLocationPath() { $offset = $this->_beginPath; $length = $this->_cursor - $this->_beginPath; $path = implode('', array_slice($this->_data, $offset, $length)); $xpath = myXPath::create(&$this->_owner->_dom); $xpath->setErrorHandling(PEAR_ERROR_CALLBACK, array(&$this, '_handleXPathError')); $xpath->setContext($this->_owner->_nodeSet, true); $xpath->debug($this->_debug); $nodeSet = $xpath->evaluate($path); unset($xpath); if ($count = sizeof($nodeSet)) { for ($n = 0; $n < $count; $n++) { $node =& $nodeSet[$n]; if (!($context = $node->_context)) { return $this->raiseError('internal error 001'); } if ($node->nodeType == ELEMENT_NODE && $node->hasChildNodes()) { $value = $this->_concatenationWorm(&$node->firstChild); $values[$context][] = $value ? $value : 'null'; } elseif ($node->nodeType == ATTRIBUTE_NODE) { $values[$context][] = $node->value ? $node->value : 'null'; } elseif ($node->nodeType == TEXT_NODE) { $values[$context][] = $node->data ? $node->data : 'null'; } if (!is_array($values[$context])) { $values[$context][] = '__EXIST__'; } } } else { $values = 'null'; } array_push($this->_expression, $values); $this->_locationPath = false; }
function actionPerform(&$skin, $moduleID) { $skin->main->controlVariables["exceptionViewer"]['exceptionList'] = ""; $skin->main->controlVariables["exceptionViewer"]['link'] = ""; $skin->main->controlVariables["exceptionViewer"]['tabId'] = $skin->main->selectedTab; $skin->main->controlVariables["exceptionViewer"]['logFiles'] = array(); $skin->main->controlVariables["exceptionViewer"]['displayList'] = true; if (isset($_POST["event"]) && $_POST["event"] == "exceptionViewer:SubmitReport") { for ($i = 0; $i < sizeof($_POST["errors"]); $i++) { $errorDetails = split("\\|", $_POST["errors"][$i]); $skin->main->controlVariables["exceptionViewer"]['link'] = $skin->main->logger->submitErrorReport($errorDetails[0], $errorDetails[3], $errorDetails[4], $errorDetails[5]); } } else { if (isset($_POST["event"]) && $_POST["event"] == "exceptionViewer:DeleteLog") { for ($i = 0; $i < sizeof($_POST["logs"]); $i++) { //Validate given file name if (ereg_replace("([0-9]{4})-([0-9]{2})-([0-9]{2})", "", $_POST["logs"][$i]) == "") { $this->deleteLogFile($_POST["logs"][$i]); } else { trigger_error("Unable to delete log file : Given file name '{$_POST['logs'][$i]}' is invalid"); } } } } if (!isset($_GET["log"])) { //Analyze logs directory $logs = array(); $dir = opendir(DIR_APPLICATION_BASE . 'logs'); while (false !== ($file = readdir($dir))) { if ($file != "." && $file != "..") { $file = str_replace(array("error_", ".xml"), "", $file); $logs[$file] = $file; } } closedir($dir); $skin->main->controlVariables["exceptionViewer"]['logFiles'] = $logs; $skin->main->controlVariables["exceptionViewer"]['displayList'] = true; } else { if (ereg_replace("([0-9]{4})-([0-9]{2})-([0-9]{2})", "", $_GET["log"]) == "") { $skin->main->controlVariables["exceptionViewer"]['displayList'] = false; $filename = DIR_APPLICATION_BASE . 'logs' . DIRECTORY_SEPARATOR . 'error_' . $_GET["log"] . '.xml'; if (is_file($filename)) { $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); // Create new DOM documents for input, output and stylesheet data. $oDocument = new Document(); $oStylesheet = new Document(); $oOutDocument = new Document(); // Create object of class XML_Preprocessor. $oXml = XML_Preprocessor::create(&$oDocument); //$oXml->parseFile(DIR_APPLICATION_BASE.'logs'.DIRECTORY_SEPARATOR.'error_'.$_GET["log"].'.xml'); $oXml->parse("<errors>{$contents}</errors>"); $oStylesheet->parseFile(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'exceptionViewer.xsl'); // Create object myXPath. $oXPath =& myXPath::create(&$oDocument); // Create object myXSLT. $oXSLT = myXSLT::create(&$oDocument, &$oOutDocument, &$oStylesheet, &$oXPath); // Start translating. $oXSLT->translate(); $skin->main->controlVariables["exceptionViewer"]['exceptionList'] = $oOutDocument->toString(); } else { trigger_error("Unable to find log file : 'error_{$_GET['log']}.xml'"); } } else { trigger_error("Invalid log file name supplied : '{$_GET['log']}'"); } } }