示例#1
0
         if ($reset_filehits == 1) {
             $hits_sql = ', file_hits = 0';
         } else {
             $hits_sql = ", file_hits = {$file_hits}";
         }
         $timestamp_sql = '';
         if ($edit_filetimestamp == 1) {
             $file_timestamp_day = intval(hacklogdm_admin::post('file_timestamp_day'));
             $file_timestamp_month = intval(hacklogdm_admin::post('file_timestamp_month'));
             $file_timestamp_year = intval(hacklogdm_admin::post('file_timestamp_year'));
             $file_timestamp_hour = intval(hacklogdm_admin::post('file_timestamp_hour'));
             $file_timestamp_minute = intval(hacklogdm_admin::post('file_timestamp_minute'));
             $file_timestamp_second = intval(hacklogdm_admin::post('file_timestamp_second'));
             $timestamp_sql = ", file_date = '" . gmmktime($file_timestamp_hour, $file_timestamp_minute, $file_timestamp_second, $file_timestamp_month, $file_timestamp_day, $file_timestamp_year) . "'";
         }
         $file_permission = intval(hacklogdm_admin::post('file_permission'));
         $file_updated_date = current_time('timestamp');
         $editfile = $wpdb->query("UPDATE {$wpdb->downloads} SET {$file_sql} file_name = '{$file_name}', file_des = '{$file_des}', file_hash = '{$file_hash}', {$file_size_sql} file_permission = {$file_permission}, file_updated_date = '{$file_updated_date}' {$timestamp_sql} {$hits_sql} WHERE file_id = {$file_id};");
         if (!$editfile) {
             hacklogdm_admin::add_error(sprintf(__('Error In Editing File \'%s (%s)\'', hacklogdm::textdomain), $file_name, $file));
         } else {
             hacklogdm_admin::add_message(sprintf(__('File \'%s (%s)\' Edited Successfully', hacklogdm::textdomain), $file_name, $file));
         }
     }
     break;
     /*************************************************************************************************
      * action delete
      **************************************************************************************************/
 /*************************************************************************************************
  * action delete
  **************************************************************************************************/
示例#2
0
    if (file_exists('../../../../wp-load.php')) {
        require_once "../../../../wp-load.php";
    } else {
        die('<p>Failed to load bootstrap.</p>');
    }
}
require dirname(__FILE__) . '/../../includes/hacklogdm_admin.class.php';
//Check Whether User Can Manage Downloads
if (!current_user_can('manage_downloads')) {
    wp_die('Access Denied');
}
//init the variables for safe reasons.
$root = '';
$dir = '';
$root = hacklogdm_admin::get_opt('download_path');
$dir = urldecode(hacklogdm_admin::post('dir'));
if (file_exists($root . $dir)) {
    $files = scandir($root . $dir);
    natcasesort($files);
    if (count($files) > 2) {
        /* The 2 accounts for . and .. */
        echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
        // All dirs
        foreach ($files as $file) {
            if (hacklogdm_admin::is_normal_file($root . $dir, $file) && is_dir($root . $dir . $file)) {
                echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlspecialchars($dir . $file) . "/\">" . htmlspecialchars($file) . "</a></li>";
            }
        }
        // All files
        foreach ($files as $file) {
            if (hacklogdm_admin::is_normal_file($root . $dir, $file) && !is_dir($root . $dir . $file)) {
示例#3
0
            break;
            // upload local file to server
        // upload local file to server
        case 1:
            $data = hacklogdm_admin::upload_local_file(hacklogdm_admin::post('file_upload_to'));
            break;
            // add remote file
        // add remote file
        case 2:
            $data = hacklogdm_admin::add_remote_file(addslashes(trim(hacklogdm_admin::post('file_remote'))), hacklogdm_admin::post('file_save_to'), hacklogdm_admin::post('save_to_local'));
            break;
    }
    //end inner switch (add file )
    if (!$data) {
        $die = 1;
    } else {
        // duplicated file check
        if (hacklogdm_admin::check_duplicate_file(hacklogdm_admin::post('file_type'), $data['file'], $data['file_hash'])) {
            $die = 1;
        }
    }
    if (!$die) {
        $do_tab = 0;
        $current_file_base_name = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF'];
        if (basename($current_file_base_name) == 'download-upload-or-add.php') {
            $do_tab = 1;
        }
        hacklogdm_admin::add_new_file($data, $do_tab);
    }
}
hacklogdm_admin::show_message_or_error();
示例#4
0
}
//load the admin class
require dirname(__FILE__) . '/includes/hacklogdm_admin.class.php';
### Variables Variables Variables
$base_name = plugin_basename('hacklog-downloadmanager/download-manager.php');
$base_page = 'admin.php?page=' . $base_name;
$mode = trim(hacklogdm_admin::get('mode'));
$downloads_tables = array($wpdb->downloads);
$downloads_settings = hacklogdm::get_opt_keys();
### Form Processing
if (isset($_POST['do'])) {
    // Decide What To Do
    switch (hacklogdm_admin::post('do')) {
        //  Uninstall Hacklog-DownloadManager
        case __('UNINSTALL Hacklog-DownloadManager', hacklogdm::textdomain):
            if (trim(hacklogdm_admin::post('uninstall_download_yes')) == 'yes') {
                echo '<div id="message" class="updated fade">';
                echo '<p>';
                foreach ($downloads_tables as $table) {
                    $wpdb->query("DROP TABLE {$table}");
                    echo '<span style="color: green;">';
                    printf(__('Table \'%s\' has been deleted.', hacklogdm::textdomain), "<strong><em>{$table}</em></strong>");
                    echo '</span><br />';
                }
                echo '</p>';
                echo '<p>';
                foreach ($downloads_settings as $setting) {
                    $delete_setting = delete_option($setting);
                    if ($delete_setting) {
                        echo '<span style="color:green;">';
                        printf(__('Setting Key \'%s\' has been deleted.', hacklogdm::textdomain), "<strong><em>{$setting}</em></strong>");
示例#5
0
if (isset($_POST['Submit'])) {
    $download_path = trim(hacklogdm_admin::post('download_path'));
    $download_path_url = trim(hacklogdm_admin::post('download_path_url'));
    $download_options_nice_permalink = intval(hacklogdm_admin::post('download_options_nice_permalink'));
    $download_options_use_filename = intval(hacklogdm_admin::post('download_options_use_filename'));
    $download_options_download_slug = trim(hacklogdm_admin::post('download_options_download_slug'));
    $download_options_time_limit = trim(hacklogdm_admin::post('download_options_time_limit')) * 60;
    $download_options_hash_func = trim(hacklogdm_admin::post('download_options_hash_func'));
    $download_options_check_referer = trim(hacklogdm_admin::post('download_options_check_referer'));
    $download_method = intval(hacklogdm_admin::post('download_method'));
    $download_display_type = intval($_POST['download_display_type']);
    $download_template_custom_css = trim(hacklogdm_admin::post('download_template_custom_css'));
    $download_template_popup[] = trim(hacklogdm_admin::post('download_template_popup'));
    $download_template_popup[] = trim(hacklogdm_admin::post('download_template_popup_2'));
    $download_template_embedded[] = trim(hacklogdm_admin::post('download_template_embedded'));
    $download_template_embedded[] = trim(hacklogdm_admin::post('download_template_embedded_2'));
    $download_options = array('use_filename' => $download_options_use_filename, 'download_slug' => $download_options_download_slug, 'nice_permalink' => $download_options_nice_permalink, 'time_limit' => $download_options_time_limit, 'hash_func' => $download_options_hash_func, 'check_referer' => $download_options_check_referer);
    $update_download_queries = array();
    $update_download_text = array();
    if (is_dir($download_path)) {
        $update_download_queries[] = update_option('download_path', untrailingslashit($download_path));
    } else {
        // if the site has moved to another SERVER and the dir is not exists anymore ...
        if (function_exists('is_site_admin')) {
            global $blog_id;
            $update_download_queries[] = update_option('download_path', str_replace("\\", '/', WP_CONTENT_DIR) . '/blogs.dir/' . $blog_id . '/files');
        } else {
            $update_download_queries[] = update_option('download_path', str_replace("\\", '/', WP_CONTENT_DIR) . '/files');
        }
    }
    $update_download_queries[] = update_option('download_path_url', untrailingslashit($download_path_url));