<?php /** * extraWatch - A real-time ajax joomla monitor and live stats * @package extraWatch * @version 2.3 * @revision 2572 * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU General Public License v3 * @copyright (C) 2015 by CodeGravity.com - All rights reserved! * @website http://www.codegravity.com */ defined('_JEXEC') or die('Restricted access: '); $output = $extraWatch->goal->exportGoals(); $xmlFile = "extrawatch-goals-" . date('Ymd') . ".xml"; $filename = ExtraWatchInput::getUploadTmpDir() . DS . $xmlFile; // required for IE, otherwise Content-disposition is ignored if (ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } // addition by Jorg Weske $file_extension = strtolower(substr(strrchr($filename, "."), 1)); //if( $filename == "" ) //{ //echo "<html><title>eLouai's Download Script</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>"; //exit; //} elseif ( ! file_exists( $filename ) ) //{ //echo "<html><title>eLouai's Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>"; //exit; //}; switch ($file_extension) {
/** * Export Goals */ function exportGoals() { $query = "select * from #__extrawatch_goals "; $rows = @$this->database->assocListQuery($query); $output = "<?xml version=\"1.0\" ?>\n"; $output .= "<goals>"; // iterate over each table and return the fields for each table foreach ($rows as $key => $row) { $output .= "<goal>"; foreach ($row as $resultKey => $resultRow) { if ($resultKey != 'id') { $output .= "<" . $resultKey . ">" . $resultRow . "</" . $resultKey . ">"; } } $output .= "</goal>"; } $output .= "</goals>"; $xmlFile = ExtraWatchInput::getUploadTmpDir() . DS . "extrawatch-goals-" . date('Ymd') . ".xml"; $xmlHandle = fopen(ExtraWatchInput::validate(_EW_INPUT_FILE_PATH_TMP, $xmlFile), "w"); //--- write xml to file --- /// fwrite($xmlHandle, $output); /// fclose($xmlHandle); // tell the browser what kind of file is come in return @$output; }