mirror of
https://github.com/lubuntu-team/lubuntu.me.git
synced 2025-07-23 21:01:28 +00:00
39 lines
1013 B
PHP
39 lines
1013 B
PHP
<?php
|
|
function wp_statistics_download_manual() {
|
|
GLOBAL $WP_Statistics, $wpdb; // this is how you get access to the database
|
|
|
|
$manage_cap = wp_statistics_validate_capability( $WP_Statistics->get_option( 'manage_capability', 'manage_options') );
|
|
|
|
if( current_user_can( $manage_cap ) ) {
|
|
|
|
$type = $_GET['type'];
|
|
|
|
if( $type == 'odt' || $type == 'html' ) {
|
|
|
|
$filepath = $WP_Statistics->plugin_dir . '/manual';
|
|
$filename = '';
|
|
$ext = '.' . $type;
|
|
|
|
// open this directory
|
|
$dir = opendir( $filepath );
|
|
|
|
// get each entry
|
|
while( $entry = readdir( $dir ) ) {
|
|
if( substr( $entry, -strlen( $ext ) ) == $ext ) {
|
|
$filename = $entry;
|
|
}
|
|
}
|
|
|
|
// close directory
|
|
closedir( $dir );
|
|
|
|
if( $filename != '' ) {
|
|
header('Content-Type: application/octet-stream;');
|
|
header('Content-Disposition: attachment; filename="' . $filename . '"');
|
|
|
|
readfile( $filepath . '/' . $filename );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
?>
|