function document_start() { if (!defined('RECURSIVE_MELLEL')) { define('RECURSIVE_MELLEL', TRUE); if (!defined('DEBUG')) { define('DEBUG', TRUE); } set_time_limit(60 * 5); if (isset($_REQUEST['list'])) { $dirs = glob('/var/www/kolchose.org/inge/wiki/data/pages/*'); echo '<h1>No files</h1>'; foreach ($dirs as $dir) { if (is_file($dir)) { $new_dir = $dir; // $new_dir = str_replace('/var/www/kolchose.org/inge/wiki/data/pages/', '', $new_dir); // $new_dir = str_replace('.txt', '', $new_dir); $new_dirs[] = $new_dir; } else { echo $dir . '<br />'; } } unset($dirs); echo '<h1>Formatation ok?</h1>'; // $test_file = $new_dirs[1]; // // echo $test_file.'<br />'; #var_dump( #self::render(file_get_contents($test_file), 'mellelexport'); #); $i = 0; foreach ($new_dirs as $file) { echo $file . '<br />'; self::render(file_get_contents($file), 'mellelexport'); ob_flush(); $i++; if ($i > 50) { exit; } } exit; } } plugin_disable('highlight'); if (in_array('highlight', plugin_list())) { die('ERROR: highlight loaded 1'); } global $ID; parent::document_start(); // If older or equal to 2007-06-26, we need to disable caching $dw_version = preg_replace('/[^\\d]/', '', getversion()); if (version_compare($dw_version, "20070626", "<=")) { $this->info["cache"] = false; } $contentType = class_exists('ZipArchive') ? 'application/zip' : 'text/xml'; $contentFileName = class_exists('ZipArchive') ? noNS($ID) . '.mellel' : 'main.xml'; // TODO configuration if (class_exists('ZipArchive') and true) { $contentFileName = date('Y-m-d_') . $contentFileName; } // send the content type header, new method after 2007-06-26 (handles caching) if (!DEBUG) { if (version_compare($dw_version, "20070626")) { // store the content type headers in metadata $headers = array('Content-Type' => $contentType, 'Content-Disposition' => 'attachment; filename="' . $contentFileName . '";'); p_set_metadata($ID, array('format' => array('mellelexport' => $headers))); } else { // older method header('Content-Type: ' . $contentType); header('Content-Disposition: attachment; filename="' . $contentFileName . '";'); } } else { header('Content-Type: text/html; charset=utf-8'); echo '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>'; #<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> echo '<table>'; echo '<tr><th></th><th>Tag<br />(Wiki)</th><th></th><th>Type</th><th></th><th>Args</th><th>Output<br />(Mellel)</th></tr>'; } }