Example #1
0
<?php

//wp includes
define('WP_USE_THEMES', false);
require '../../../../wp-load.php';
if (!current_user_can('manage_options')) {
    exit(0);
}
$sql = "SELECT *, file as filename, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->ss_downloads} ORDER BY id";
$downloads = $wpdb->get_results($sql);
$csvoutput = "id\temail\tfile\tip\treferrer\tdate\n";
if ($downloads) {
    foreach ($downloads as $download) {
        $csvoutput .= enclose($download->id) . "\t" . enclose($download->email) . "\t" . enclose($download->filename) . "\t" . enclose($download->ip) . "\t" . enclose($download->referrer) . "\t" . enclose(date("n/d/Y g:i A e", $download->timestamp)) . "\n";
    }
}
$size_in_bytes = strlen($csvoutput);
//header("Content-type: text/csv");
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=downloads_" . date("Y-m-d") . ".xls; size={$size_in_bytes}");
print $csvoutput;
Example #2
0
$dir = null;
$encode_count = 0;
$copy_count = 0;
clearstatcache();
while (count($source_list) > 0) {
    $dir = array_pop($source_list);
    $files = glob($dir . '/*');
    foreach ($files as $file) {
        $file = filter_path($file);
        if (is_file($file)) {
            $target_path = str_replace($source_dir, $target_dir, $file);
            $target_dir = dirname($target_path);
            make_dir($target_dir);
            if (is_encode($file)) {
                $code = php_strip_whitespace($file);
                $code = enclose($code);
                $code = zoeey_encode($code);
                $code = output($code);
                file_put_contents($target_path, $code);
                $encode_count++;
            } else {
                if (is_copy($file)) {
                    copy($file, $target_path);
                    $copy_count++;
                }
            }
        } else {
            if (is_copy($file)) {
                $dir = str_replace($source_dir, $target_dir, $file);
                make_dir($dir);
            }