/** * sends a backup of flux-installation to a client * * @param $filename the file with the backup * @param $delete boolean if file should be deleted. */ function backupSend($filename, $delete = false) { global $cfg; $backupFile = $cfg["path"] . _DIR_BACKUP . '/' . $filename; if ($delete) { session_write_close(); ob_end_clean(); if (connection_status() != 0) { return false; } set_time_limit(0); } if (!is_file($backupFile)) { return false; } // log before we screw up the file-name AuditAction($cfg["constants"]["admin"], "FluxBackup Sent : " . $filename); // filenames in IE containing dots will screw up the filename if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $filename = preg_replace('/\\./', '%2e', $filename, substr_count($filename, '.') - 1); } // send data header("Cache-Control: "); header("Pragma: "); header("Content-Type: application/octet-stream"); header("Content-Length: " . (string) filesize($backupFile)); header('Content-Disposition: attachment; filename="' . $filename . '"'); header("Content-Transfer-Encoding: binary\n"); if ($delete) { // read data to mem, delete file and send complete $data = getDataFromFile($backupFile); @unlink($backupFile); echo $data; } else { // read / write file with 8kb-buffer if ($handle = fopen($backupFile, 'rb')) { while (!feof($handle) && connection_status() == 0) { print fread($handle, 8192); flush(); } fclose($handle); } } // return if ($delete) { return true; } else { return connection_status() == 0 and !connection_aborted(); } }
} } else { bailOut(true); } exit; } } else { bailOut(false); } } // standard-action $action = @trim($_REQUEST["a"]); switch ($action) { case "0": // news outputData(rewriteNews(getDataFromFile(_FILE_NEWS))); exit; case "1": // changelog outputData(getDataFromFile(_FILE_CHANGELOG)); exit; case "2": // issues outputData(getDataFromFile(_FILE_ISSUES)); exit; default: header("Content-Type: text/plain"); echo trim(getDataFromFile(_FILE_VERSION_CURRENT)); exit; } exit;
function getData($directory) { if (file_exists($directory . DIRECTORY_SEPARATOR . "attendances.dat")) { $info = getDataFromFile($directory . DIRECTORY_SEPARATOR . "attendances.dat"); return $info; } elseif (file_exists($directory . DIRECTORY_SEPARATOR . "data.dat")) { $info = getDataFromFile($directory . DIRECTORY_SEPARATOR . "data.dat"); return $info; } else { return null; } }
/** * prints page "changelog" */ function printPageChangelog() { ?> <div class="subcontent"> <h1 id="changelog">Changelog</h1> <pre class="changelog"><?php echo htmlentities(trim(getDataFromFile(_FILE_CHANGELOG)), ENT_QUOTES); ?> </pre> </div> <?php }
/** * Fetch the list of authors from the current svn webserver AUTHORS file. * Parse the list and create an HTML list with obfuscated (via javascript) links * to each authors mail address * * @return string authors */ function getAuthors() { $authors_html = ""; $authors = array_slice(preg_split("/\n\n/", getDataFromFile(_FILE_AUTHORS)), 2); // $authors array size will be just one entry if the authors file couldn't be fetched for some reason: if (count($authors) > 1) { $authors_list = ""; foreach ($authors as $author) { if (preg_match("/^\\*\\s(.*)\\s<(.*)>\$/", $author, $matches)) { $username = trim($matches[1]); $mailAd = trim($matches[2]); $mailAd = str_replace('@', '[AT]', $mailAd); $mailAd = str_replace('.', '[DOT]', $mailAd); $authors_list .= "<li>"; $authors_list .= "<script language=\"javascript\" type=\"text/javascript\">printMailLink('" . $mailAd . "', '" . $username . "');</script>"; $authors_list .= "<noscript>" . $mailAd . "</noscript>"; $authors_list .= "</li>\n"; } } if (strlen($authors_list) > 0) { $authors_html = "<ul>\n" . $authors_list . "</ul>\n"; } } return $authors_html; }