Ejemplo n.º 1
0
function wfu_maintenance_actions($message = '')
{
    if (!current_user_can('manage_options')) {
        return wfu_manage_mainmenu();
    }
    $siteurl = site_url();
    $echo_str = '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    if ($message != '') {
        $echo_str .= "\n\t" . '<div class="updated">';
        $echo_str .= "\n\t\t" . '<p>' . $message . '</p>';
        $echo_str .= "\n\t" . '</div>';
    }
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "Maintenance Actions");
    //maintenance actions
    $echo_str .= "\n\t\t" . '<h3 style="margin-bottom: 10px;">Maintenance Actions</h3>';
    $echo_str .= "\n\t\t" . '<table class="form-table">';
    $echo_str .= "\n\t\t\t" . '<tbody>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=sync_db" class="button" title="Update database to reflect current status of files">Sync Database</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>Update database to reflect current status of files.</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=clean_log_ask" class="button" title="Clean all database log">Clean Log</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>Clean-up all database log, including file information and user data (files will not be affected).</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t" . '</tbody>';
    $echo_str .= "\n\t\t" . '</table>';
    $echo_str .= "\n\t" . '</div>';
    //export actions
    $echo_str .= "\n\t\t" . '<h3 style="margin-bottom: 10px; margin-top: 20px;">Export Actions</h3>';
    $echo_str .= "\n\t\t" . '<table class="form-table">';
    $echo_str .= "\n\t\t\t" . '<tbody>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="javascript:wfu_download_file(\'exportdata\', 1, \'' . wp_create_nonce('wfu_download_file_invoker') . '\');" class="button" title="Export uploaded file data">Export Uploaded File Data</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>Export uploaded valid file data, together with any userdata fields, to a comma-separated text file.</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<div id="wfu_file_download_container_1" style="display: none;"></div>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t" . '</tbody>';
    $echo_str .= "\n\t\t" . '</table>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n" . '</div>';
    echo $echo_str;
}
Ejemplo n.º 2
0
function wfu_view_log($page = 1, $only_table_rows = false)
{
    global $wpdb;
    $siteurl = site_url();
    $table_name1 = $wpdb->prefix . "wfu_log";
    $table_name2 = $wpdb->prefix . "wfu_userdata";
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if (!current_user_can('manage_options')) {
        return;
    }
    //get log data from database
    $files_total = $wpdb->get_var('SELECT COUNT(idlog) FROM ' . $table_name1);
    $filerecs = $wpdb->get_results('SELECT * FROM ' . $table_name1 . ' ORDER BY date_from DESC' . (WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") > 0 ? ' LIMIT ' . WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") . ' OFFSET ' . ($page - 1) * (int) WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") : ''));
    $echo_str = "";
    if (!$only_table_rows) {
        $echo_str .= "\n" . '<div class="wrap">';
        $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
        $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
        $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "View Log");
        $echo_str .= "\n\t" . '<div style="position:relative;">';
        $echo_str .= wfu_add_loading_overlay("\n\t\t", "historylog");
        $echo_str .= "\n\t\t" . '<div class="wfu_historylog_header" style="width: 100%;">';
        if (WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") > 0) {
            $pages = ceil($files_total / WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS"));
            $echo_str .= wfu_add_pagination_header("\n\t\t\t", "historylog", 1, $pages);
        }
        $echo_str .= "\n\t\t" . '</div>';
        $echo_str .= "\n\t\t" . '<table id="wfu_historylog_table" class="wp-list-table widefat fixed striped">';
        $echo_str .= "\n\t\t\t" . '<thead>';
        $echo_str .= "\n\t\t\t\t" . '<tr>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="5%" style="text-align:center;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>#</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="15%" style="text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>Date</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="10%" style="text-align:center;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>Action</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="30%" style="text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>File</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="15%" style="text-align:center;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>User</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="25%" style="text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>Remarks</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t" . '</tr>';
        $echo_str .= "\n\t\t\t" . '</thead>';
        $echo_str .= "\n\t\t\t" . '<tbody>';
    }
    $userdatarecs = $wpdb->get_results('SELECT * FROM ' . $table_name2);
    $deletedfiles = array();
    $filecodes = array();
    $time0 = strtotime("0000-00-00 00:00:00");
    $i = ($page - 1) * (int) WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS");
    foreach ($filerecs as $filerec) {
        $remarks = '';
        $filepath = ABSPATH;
        if (substr($filepath, -1) == '/') {
            $filepath = substr($filepath, 0, -1);
        }
        $filepath .= $filerec->filepath;
        $enc_file = wfu_plugin_encode_string($filepath . '[[name]]');
        if ($filerec->action == 'delete') {
            array_push($deletedfiles, $filerec->linkedto);
        } elseif ($filerec->action == 'rename') {
            $prevfilepath = '';
            foreach ($filerecs as $key => $prevfilerec) {
                if ($prevfilerec->idlog == $filerec->linkedto) {
                    $prevfilepath = $prevfilerec->filepath;
                    break;
                }
            }
            if ($prevfilepath != '') {
                $remarks = "\n\t\t\t\t\t\t" . '<label>Previous filepath: ' . $prevfilepath . '</label>';
            }
        } elseif ($filerec->action == 'upload' || $filerec->action == 'modify') {
            foreach ($userdatarecs as $userdata) {
                if ($userdata->uploadid == $filerec->uploadid) {
                    $userdata_datefrom = strtotime($userdata->date_from);
                    $userdata_dateto = strtotime($userdata->date_to);
                    $filerec_datefrom = strtotime($filerec->date_from);
                    if ($filerec_datefrom >= $userdata_datefrom && ($userdata_dateto == $time0 || $filerec_datefrom < $userdata_dateto)) {
                        $remarks .= "\n\t\t\t\t\t\t\t" . '<option>' . $userdata->property . ': ' . $userdata->propvalue . '</option>';
                    }
                }
            }
            if ($remarks != '') {
                $remarks = "\n\t\t\t\t\t\t" . '<select multiple="multiple" style="width:100%; height:40px; background:none; font-size:small;">' . $remarks;
                $remarks .= "\n\t\t\t\t\t\t" . '</select>';
            }
        } elseif ($filerec->action == 'other') {
            $info = $filerec->filepath;
            $filerec->filepath = '';
            $remarks = "\n\t\t\t\t\t\t" . '<textarea style="width:100%; resize:vertical; background:none;" readonly="readonly">' . $info . '</textarea>';
        }
        $i++;
        $otheraction = $filerec->action == 'other';
        $echo_str .= "\n\t\t\t\t" . '<tr>';
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:center;">' . $i . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:left;">' . $filerec->date_from . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:center;">' . $filerec->action . '</td>';
        if (!$otheraction) {
            $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:left;">';
            if (in_array($filerec->linkedto, $deletedfiles) || in_array($filerec->idlog, $deletedfiles)) {
                $echo_str .= "\n\t\t\t\t\t\t" . '<span>' . $filerec->filepath . '</span>';
            } else {
                $lid = 0;
                if ($filerec->action == 'upload' || $filerec->action == 'include') {
                    $lid = $filerec->idlog;
                } elseif ($filerec->linkedto > 0) {
                    $lid = $filerec->linkedto;
                }
                if ($lid > 0) {
                    if (!isset($filecodes[$lid])) {
                        $filecodes[$lid] = wfu_safe_store_filepath($filerec->filepath);
                    }
                    $echo_str .= "\n\t\t\t\t\t\t" . '<a class="row-title" href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file=' . $filecodes[$lid] . '" title="View and edit file details" style="font-weight:normal;">' . $filerec->filepath . '</a>';
                } else {
                    $echo_str .= "\n\t\t\t\t\t\t" . '<span>' . $filerec->filepath . '</span>';
                }
            }
            $echo_str .= "\n\t\t\t\t\t" . '</td>';
            $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:center;">' . wfu_get_username_by_id($filerec->userid) . '</td>';
        }
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:left;"' . ($otheraction ? ' colspan="3"' : '') . '>';
        $echo_str .= $remarks;
        $echo_str .= "\n\t\t\t\t\t" . '</td>';
        $echo_str .= "\n\t\t\t\t" . '</tr>';
    }
    if (!$only_table_rows) {
        $echo_str .= "\n\t\t\t" . '</tbody>';
        $echo_str .= "\n\t\t" . '</table>';
        $echo_str .= "\n\t" . '</div>';
        $echo_str .= "\n" . '</div>';
    }
    return $echo_str;
}
Ejemplo n.º 3
0
function wfu_browse_files($basedir_code)
{
    $siteurl = site_url();
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $user = wp_get_current_user();
    //store session variables for use from the downloader
    if (!current_user_can('manage_options')) {
        return;
    }
    //first decode basedir_code
    $basedir = wfu_get_filepath_from_safe($basedir_code);
    //clean session array holding dir and file paths if it is too big
    if (isset($_SESSION['wfu_filepath_safe_storage']) && count($_SESSION['wfu_filepath_safe_storage']) > WFU_PHP_ARRAY_MAXLEN) {
        $_SESSION['wfu_filepath_safe_storage'] = array();
    }
    //extract sort info from basedir
    $sort = "";
    if ($basedir !== false) {
        $ret = wfu_extract_sortdata_from_path($basedir);
        $basedir = $ret['path'];
        $sort = $ret['sort'];
    }
    if ($sort == "") {
        $sort = 'name';
    }
    if (substr($sort, 0, 1) == '-') {
        $order = SORT_DESC;
    } else {
        $order = SORT_ASC;
    }
    //adjust basedir to have a standard format
    if ($basedir !== false) {
        if (substr($basedir, -1) != '/') {
            $basedir .= '/';
        }
        if (substr($basedir, 0, 1) == '/') {
            $basedir = substr($basedir, 1);
        }
        //calculate the absolute path of basedir knowing that basedir is relative to website root
        $basedir = wfu_path_rel2abs($basedir);
        if (!file_exists($basedir)) {
            $basedir = false;
        }
    }
    //set basedit to default value if empty
    if ($basedir === false) {
        $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
        $basedir = isset($plugin_options['basedir']) ? $plugin_options['basedir'] : "";
        $temp_params = array('uploadpath' => $basedir, 'accessmethod' => 'normal', 'ftpinfo' => '', 'useftpdomain' => 'false');
        $basedir = wfu_upload_plugin_full_path($temp_params);
    }
    //find relative dir
    $reldir = str_replace(ABSPATH, "root/", $basedir);
    //save dir route to an array
    $parts = explode('/', $reldir);
    $route = array();
    $prev = "";
    foreach ($parts as $part) {
        $part = trim($part);
        if ($part != "") {
            //			if ( $part == 'root' && $prev == "" ) $prev = ABSPATH;
            if ($part == 'root' && $prev == "") {
                $prev = "";
            } else {
                $prev .= $part . '/';
            }
            array_push($route, array('item' => $part, 'path' => $prev));
        }
    }
    //calculate upper directory
    $updir = substr($basedir, 0, -1);
    $delim_pos = strrpos($updir, '/');
    if ($delim_pos !== false) {
        $updir = substr($updir, 0, $delim_pos + 1);
    }
    $echo_str = "\n" . '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "File Browser");
    $echo_str .= "\n\t" . '<div>';
    $echo_str .= "\n\t\t" . '<span><strong>Location:</strong> </span>';
    foreach ($route as $item) {
        // store dir path that we need to pass to other functions in session, instead of exposing it in the url
        $dir_code = wfu_safe_store_filepath($item['path']);
        $echo_str .= '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '">' . $item['item'] . '</a>';
        $echo_str .= '<span>/</span>';
    }
    //file browser header
    $echo_str .= "\n\t" . '</div>';
    //	$dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.$sort.']]');
    //	$echo_str .= "\n\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=create_dir&dir='.$dir_code.'" class="button" title="create folder" style="margin-top:6px">Create folder</a>';
    $echo_str .= "\n\t" . '<div style="margin-top:10px;">';
    $echo_str .= "\n\t\t" . '<table class="wp-list-table widefat fixed striped">';
    $echo_str .= "\n\t\t\t" . '<thead>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="30%" style="text-align:left;">';
    $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir) . '[[' . (substr($sort, -4) == 'name' ? $order == SORT_ASC ? '-name' : 'name' : 'name') . ']]');
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '">Name' . (substr($sort, -4) == 'name' ? $order == SORT_ASC ? ' &uarr;' : ' &darr;' : '') . '</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="10%" style="text-align:right;">';
    $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir) . '[[' . (substr($sort, -4) == 'size' ? $order == SORT_ASC ? '-size' : 'size' : 'size') . ']]');
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '">Size' . (substr($sort, -4) == 'size' ? $order == SORT_ASC ? ' &uarr;' : ' &darr;' : '') . '</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="20%" style="text-align:left;">';
    $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir) . '[[' . (substr($sort, -4) == 'date' ? $order == SORT_ASC ? '-date' : 'date' : 'date') . ']]');
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '">Date' . (substr($sort, -4) == 'date' ? $order == SORT_ASC ? ' &uarr;' : ' &darr;' : '') . '</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="10%" style="text-align:center;">';
    $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir) . '[[' . (substr($sort, -4) == 'user' ? $order == SORT_ASC ? '-user' : 'user' : 'user') . ']]');
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '">Uploaded By' . (substr($sort, -4) == 'user' ? $order == SORT_ASC ? ' &uarr;' : ' &darr;' : '') . '</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="30%" style="text-align:left;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>User Data</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t" . '</thead>';
    $echo_str .= "\n\t\t\t" . '<tbody>';
    //find contents of current folder
    $dirlist = array();
    $filelist = array();
    if ($handle = opendir($basedir)) {
        $blacklist = array('.', '..');
        while (false !== ($file = readdir($handle))) {
            if (!in_array($file, $blacklist)) {
                $filepath = $basedir . $file;
                $stat = stat($filepath);
                if (is_dir($filepath)) {
                    array_push($dirlist, array('name' => $file, 'fullpath' => $filepath, 'mdate' => $stat['mtime']));
                } else {
                    //find relative file record in database together with user data;
                    //if the file is php, then file record is null meaning that the file can only be viewed
                    //if file record is not found then the file can only be viewed
                    if (preg_match("/\\.php\$/", $filepath)) {
                        $filerec = null;
                    } else {
                        $filerec = wfu_get_file_rec($filepath, true);
                    }
                    //find user who uploaded the file
                    $username = '';
                    if ($filerec != null) {
                        $username = wfu_get_username_by_id($filerec->uploaduserid);
                    }
                    array_push($filelist, array('name' => $file, 'fullpath' => $filepath, 'size' => $stat['size'], 'mdate' => $stat['mtime'], 'user' => $username, 'filedata' => $filerec));
                }
            }
        }
        closedir($handle);
    }
    $dirsort = substr($sort, -4) == 'date' ? 'mdate' : substr($sort, -4);
    $filesort = $dirsort;
    $dirorder = $order;
    if ($dirsort == 'size') {
        $dirsort = 'name';
        $dirorder = SORT_ASC;
    }
    if ($dirsort == 'user') {
        $dirsort = 'name';
        $dirorder = SORT_ASC;
    }
    $dirlist = wfu_array_sort($dirlist, $dirsort, $dirorder);
    $filelist = wfu_array_sort($filelist, $filesort, $order);
    //show subfolders first
    if ($reldir != "root/") {
        $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($updir));
        $echo_str .= "\n\t\t\t\t" . '<tr>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<a class="row-title" href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '" title="go up">..</a>';
        $echo_str .= "\n\t\t\t\t\t" . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="10%" style="padding: 5px 5px 5px 10px; text-align:right;"> </td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="20%" style="padding: 5px 5px 5px 10px; text-align:left;"> </td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="10%" style="padding: 5px 5px 5px 10px; text-align:center;"> </td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;"> </td>';
        $echo_str .= "\n\t\t\t\t" . '</tr>';
    }
    $ii = 1;
    foreach ($dirlist as $dir) {
        $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($dir['fullpath']) . '[[' . $sort . ']]');
        $echo_str .= "\n\t\t\t\t" . '<tr onmouseover="var actions=document.getElementsByName(\'wfu_dir_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';} document.getElementById(\'wfu_dir_actions_' . $ii . '\').style.visibility=\'visible\'" onmouseout="var actions=document.getElementsByName(\'wfu_dir_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';}">';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<a class="row-title" href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '" title="' . $dir['name'] . '">' . $dir['name'] . '</a>';
        $echo_str .= "\n\t\t\t\t\t\t" . '<div id="wfu_dir_actions_' . $ii . '" name="wfu_dir_actions" style="visibility:hidden;">';
        $echo_str .= "\n\t\t\t\t\t\t\t" . '<span style="visibility:hidden;">';
        $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=">Noaction</a>';
        $echo_str .= "\n\t\t\t\t\t\t\t\t" . ' | ';
        $echo_str .= "\n\t\t\t\t\t\t\t" . '</span>';
        //		$echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
        //		$echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=rename_dir&file='.$dir_code.'" title="Rename this folder">Rename</a>';
        //		$echo_str .= "\n\t\t\t\t\t\t\t\t".' | ';
        //		$echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
        //		$echo_str .= "\n\t\t\t\t\t\t\t".'<span>';
        //		$echo_str .= "\n\t\t\t\t\t\t\t\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&action=delete_dir&file='.$dir_code.'" title="Delete this folder">Delete</a>';
        //		$echo_str .= "\n\t\t\t\t\t\t\t".'</span>';
        $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
        $echo_str .= "\n\t\t\t\t\t" . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="10%" style="padding: 5px 5px 5px 10px; text-align:right;"> </td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="20%" style="padding: 5px 5px 5px 10px; text-align:left;">' . date("d/m/Y H:i:s", $dir['mdate']) . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="10%" style="padding: 5px 5px 5px 10px; text-align:center;"> </td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;"> </td>';
        $echo_str .= "\n\t\t\t\t" . '</tr>';
        $ii++;
    }
    //show contained files
    foreach ($filelist as $file) {
        if ($file['filedata'] != null) {
            $file_code = wfu_safe_store_filepath(wfu_path_abs2rel($file['fullpath']) . '[[' . $sort . ']]');
        }
        $echo_str .= "\n\t\t\t\t" . '<tr onmouseover="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';} document.getElementById(\'wfu_file_actions_' . $ii . '\').style.visibility=\'visible\'" onmouseout="var actions=document.getElementsByName(\'wfu_file_actions\'); for (var i=0; i<actions.length; i++) {actions[i].style.visibility=\'hidden\';}">';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
        if ($file['filedata'] != null) {
            $echo_str .= "\n\t\t\t\t\t\t" . '<a class="row-title" href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file=' . $file_code . '" title="View and edit file details" style="font-weight:normal;">' . $file['name'] . '</a>';
        } else {
            $echo_str .= "\n\t\t\t\t\t\t" . '<span>' . $file['name'] . '</span>';
        }
        $echo_str .= "\n\t\t\t\t\t\t" . '<div id="wfu_file_actions_' . $ii . '" name="wfu_file_actions" style="visibility:hidden;">';
        if ($file['filedata'] != null) {
            $echo_str .= "\n\t\t\t\t\t\t\t" . '<span>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file=' . $file_code . '" title="View and edit file details">Details</a>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . ' | ';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '</span>';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '<span>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=rename_file&file=' . $file_code . '" title="Rename this file">Rename</a>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . ' | ';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '</span>';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '<span>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=delete_file&file=' . $file_code . '" title="Delete this file">Delete</a>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . ' | ';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '</span>';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '<span>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<a href="javascript:wfu_download_file(\'' . $file_code . '\', ' . $ii . ', \'' . wp_create_nonce('wfu_download_file_invoker') . '\');" title="Download this file">Download</a>';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '</span>';
        } else {
            $echo_str .= "\n\t\t\t\t\t\t\t" . '<span style="visibility:hidden;">';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=">Noaction</a>';
            $echo_str .= "\n\t\t\t\t\t\t\t\t" . ' | ';
            $echo_str .= "\n\t\t\t\t\t\t\t" . '</span>';
        }
        $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
        $echo_str .= "\n\t\t\t\t\t\t" . '<div id="wfu_file_download_container_' . $ii . '" style="display: none;"></div>';
        $echo_str .= "\n\t\t\t\t\t" . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="10%" style="padding: 5px 5px 5px 10px; text-align:right;">' . $file['size'] . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="20%" style="padding: 5px 5px 5px 10px; text-align:left;">' . date("d/m/Y H:i:s", $file['mdate']) . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="10%" style="padding: 5px 5px 5px 10px; text-align:center;">' . $file['user'] . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td width="30%" style="padding: 5px 5px 5px 10px; text-align:left;">';
        if ($file['filedata'] != null) {
            if (count($file['filedata']->userdata) > 0) {
                $echo_str .= "\n\t\t\t\t\t\t" . '<select multiple="multiple" style="width:100%; height:40px; background:none; font-size:small;">';
                foreach ($file['filedata']->userdata as $userdata) {
                    $echo_str .= "\n\t\t\t\t\t\t\t" . '<option>' . $userdata->property . ': ' . $userdata->propvalue . '</option>';
                }
                $echo_str .= "\n\t\t\t\t\t\t" . '</select>';
            }
        }
        $echo_str .= "\n\t\t\t\t\t" . '</td>';
        $echo_str .= "\n\t\t\t\t" . '</tr>';
        $ii++;
    }
    $echo_str .= "\n\t\t\t" . '</tbody>';
    $echo_str .= "\n\t\t" . '</table>';
    $echo_str .= "\n\t\t" . '<iframe id="wfu_download_frame" style="display: none;"></iframe>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n" . '</div>';
    return $echo_str;
}
Ejemplo n.º 4
0
function wfu_manage_mainmenu($message = '')
{
    if (!current_user_can('manage_options')) {
        return;
    }
    //get php version
    $php_version = preg_replace("/-.*/", "", phpversion());
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $echo_str = '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    if ($message != '') {
        $echo_str .= "\n\t" . '<div class="updated">';
        $echo_str .= "\n\t\t" . '<p>' . $message . '</p>';
        $echo_str .= "\n\t" . '</div>';
    }
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "Main");
    $echo_str .= "\n\t\t" . '<h3 style="margin-bottom: 10px;">Status</h3>';
    $echo_str .= "\n\t\t" . '<table class="form-table">';
    $echo_str .= "\n\t\t\t" . '<tbody>';
    //plugin edition
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Edition</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px; vertical-align:top;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">Free</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<div style="display:inline-block; background-color:bisque; padding:0 0 0 4px; border-left:3px solid lightcoral;">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label style="cursor:default;">Consider </label><a href="' . WFU_PRO_VERSION_URL . '">Upgrading</a><label style="cursor:default;"> to the Professional Version. </label>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<button onclick="if (this.innerText == \'See why >>\') {this.innerText = \'<< Close\'; document.getElementById(\'wfu_version_comparison\').style.display = \'inline-block\';} else {this.innerText = \'See why >>\'; document.getElementById(\'wfu_version_comparison\').style.display = \'none\';}">See why >></button>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<br /><div id="wfu_version_comparison" style="display:none; background-color:lightyellow; border:1px solid yellow; margin:10px 0; padding:10px;">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<img src="' . WFU_IMAGE_VERSION_COMPARISON . '" style="display:block; margin-bottom:6px;" />';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<a class="button-primary" href="' . WFU_PRO_VERSION_URL . '">Go for the PRO version</a>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    //plugin version
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Version</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px;">';
    $cur_version = wfu_get_plugin_version();
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">' . $cur_version . '</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $lat_version = wfu_get_latest_version();
    $ret = wfu_compare_versions($cur_version, $lat_version);
    if ($ret['status'] && $ret['result'] == 'lower') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<div style="display:inline-block; background-color:bisque; padding:0 0 0 4px; border-left:3px solid lightcoral;">';
        $echo_str .= "\n\t\t\t\t\t\t\t" . '<label style="cursor:default;">Version <strong>' . $lat_version . '</strong> of the plugin is available. Go to Plugins page of your Dashboard to update to the latest version.</label>';
        if ($ret['custom']) {
            $echo_str .= '<label style="cursor:default; color: purple;"> <em>Please note that you are using a custom version of the plugin. If you upgrade to the newest version, custom changes will be lost.</em></label>';
        }
        $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    } elseif ($ret['status'] && $ret['result'] == 'equal') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<div style="display:inline-block; background-color:rgb(220,255,220); padding:0 0 0 4px; border-left:3px solid limegreen;">';
        $echo_str .= "\n\t\t\t\t\t\t\t" . '<label style="cursor:default;">You have the latest version.</label>';
        if ($ret['custom']) {
            $echo_str .= '<label style="cursor:default; color: purple;"> <em>(Please note that your version is custom)</em></label>';
        }
        $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    }
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    //server environment
    $php_env = wfu_get_server_environment();
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Server Environment</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px;">';
    if ($php_env == '64bit') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">64bit</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server supports files up to 1 Exabyte, practically unlimited)</label>';
    }
    if ($php_env == '32bit') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">32bit</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server does not support files larger than 2GB)</label>';
    }
    if ($php_env == '') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">Unknown</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(The maximum file size supported by the server cannot be determined)</label>';
    }
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">PHP Version</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px;">';
    $cur_version = wfu_get_plugin_version();
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">' . $php_version . '</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Release Notes</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td colspan="2" style="width:100px;">';
    $rel_path = ABSWPFILEUPLOAD_DIR . 'release_notes.txt';
    $rel_notes = '';
    if (file_exists($rel_path)) {
        $rel_notes = file_get_contents($rel_path);
    }
    $echo_str .= "\n\t\t\t\t\t\t" . '<div style="text-align:justify;">' . $rel_notes . '</div>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t" . '</tbody>';
    $echo_str .= "\n\t\t" . '</table>';
    $echo_str .= wfu_manage_instances();
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n" . '</div>';
    echo $echo_str;
}
function wfu_manage_settings($message = '')
{
    if (!current_user_can('manage_options')) {
        return;
    }
    $siteurl = site_url();
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $echo_str = '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "Settings");
    $echo_str .= "\n\t\t" . '<form enctype="multipart/form-data" name="editsettings" id="editsettings" method="post" action="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=edit_settings" class="validate">';
    $nonce = wp_nonce_field('wfu_edit_admin_settings', '_wpnonce', false, false);
    $nonce_ref = wp_referer_field(false);
    $echo_str .= "\n\t\t\t" . $nonce;
    $echo_str .= "\n\t\t\t" . $nonce_ref;
    $echo_str .= "\n\t\t\t" . '<input type="hidden" name="action" value="edit_settings">';
    $echo_str .= "\n\t\t\t" . '<table class="form-table">';
    $echo_str .= "\n\t\t\t\t" . '<tbody>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_hashfiles">Hash Files</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_hashfiles" id="wfu_hashfiles" type="checkbox"' . ($plugin_options['hashfiles'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" /> Enables better control of uploaded files, but slows down performance when uploaded files are larger than 100MBytes';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['hashfiles'] == '1' ? 'Yes' : 'No') . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_basedir">Base Directory</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_basedir" id="wfu_basedir" type="text" value="' . $plugin_options['basedir'] . '" />';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . $plugin_options['basedir'] . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_postmethod">Post Method</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<select name="wfu_postmethod" id="wfu_postmethod" value="' . $plugin_options['postmethod'] . '">';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="fopen"' . ($plugin_options['postmethod'] == 'fopen' || $plugin_options['postmethod'] == '' ? ' selected="selected"' : '') . '>Using fopen (default)</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="curl"' . ($plugin_options['postmethod'] == 'curl' ? ' selected="selected"' : '') . '>Using cURL</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="socket"' . ($plugin_options['postmethod'] == 'socket' ? ' selected="selected"' : '') . '>Using Sockets</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '</select>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['postmethod'] == 'fopen' || $plugin_options['postmethod'] == '' ? 'Using fopen' : ($plugin_options['postmethod'] == 'curl' ? 'Using cURL' : 'Using Sockets')) . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_relaxcss">Relax CSS Rules</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_relaxcss" id="wfu_relaxcss" type="checkbox"' . ($plugin_options['relaxcss'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" /> If enabled then the textboxes and the buttons of the plugin will inherit the theme\'s styling';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['relaxcss'] == '1' ? 'Yes' : 'No') . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_admindomain">Admin Domain</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<select name="wfu_admindomain" id="wfu_admindomain" value="' . $plugin_options['admindomain'] . '">';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="siteurl"' . ($plugin_options['admindomain'] == 'siteurl' || $plugin_options['admindomain'] == '' ? ' selected="selected"' : '') . '>Using site_url (default)</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="adminurl"' . ($plugin_options['admindomain'] == 'adminurl' ? ' selected="selected"' : '') . '>Using admin_url</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t\t" . '<option value="homeurl"' . ($plugin_options['admindomain'] == 'homeurl' ? ' selected="selected"' : '') . '>Using home_url</option>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '</select>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['admindomain'] == 'siteurl' || $plugin_options['admindomain'] == '' ? 'Using site_url' : ($plugin_options['admindomain'] == 'adminurl' ? 'Using admin_url' : 'Using home_url')) . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label for="wfu_mediacustom">Show Custom Fields in Media Library</label>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<input name="wfu_mediacustom" id="wfu_mediacustom" type="checkbox"' . ($plugin_options['mediacustom'] == '1' ? ' checked="checked"' : '') . ' style="width:auto;" /> If enabled and the uploaded files are added to Media Library then any user fields submitted together with the files will be shown in Media Library';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<p style="cursor: text; font-size:9px; padding: 0px; margin: 0px; width: 95%; color: #AAAAAA;">Current value: <strong>' . ($plugin_options['mediacustom'] == '1' ? 'Yes' : 'No') . '</strong></p>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t" . '</tbody>';
    $echo_str .= "\n\t\t\t" . '</table>';
    $echo_str .= "\n\t\t\t" . '<p class="submit">';
    $echo_str .= "\n\t\t\t\t" . '<input type="submit" class="button-primary" name="submitform" value="Update" />';
    $echo_str .= "\n\t\t\t" . '</p>';
    $echo_str .= "\n\t\t" . '</form>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n" . '</div>';
    echo $echo_str;
}