本文整理汇总了PHP中wfu_plugin_encode_string函数的典型用法代码示例。如果您正苦于以下问题:PHP wfu_plugin_encode_string函数的具体用法?PHP wfu_plugin_encode_string怎么用?PHP wfu_plugin_encode_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfu_plugin_encode_string函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfu_ajax_action_read_subfolders
function wfu_ajax_action_read_subfolders()
{
if (!isset($_POST['folder1']) || !isset($_POST['folder2'])) {
die;
}
$temp_params = array('uploadpath' => wfu_plugin_decode_string($_POST['folder1']), 'accessmethod' => 'normal', 'ftpinfo' => '', 'useftpdomain' => 'false');
$path = wfu_upload_plugin_full_path($temp_params);
if (!is_dir($path)) {
die("wfu_read_subfolders:error:Parent folder is not valid! Cannot retrieve subfolder list.");
}
$path2 = wfu_plugin_decode_string($_POST['folder2']);
$dirlist = "";
if ($handle = opendir($path)) {
$blacklist = array('.', '..');
while (false !== ($file = readdir($handle))) {
if (!in_array($file, $blacklist)) {
$filepath = $path . $file;
if (is_dir($filepath)) {
if ($file == $path2) {
$file = '[[' . $file . ']]';
}
$dirlist .= ($dirlist == "" ? "" : ",") . $file;
}
}
}
closedir($handle);
}
if ($path2 != "") {
$dirlist2 = $path2;
$path .= $path2 . "/";
if (is_dir($path)) {
if ($handle = opendir($path)) {
$blacklist = array('.', '..');
while (false !== ($file = readdir($handle))) {
if (!in_array($file, $blacklist)) {
$filepath = $path . $file;
if (is_dir($filepath)) {
$dirlist2 .= ",*" . $file;
}
}
}
closedir($handle);
}
}
$dirlist = str_replace('[[' . $path2 . ']]', $dirlist2, $dirlist);
}
die("wfu_read_subfolders:success:" . wfu_plugin_encode_string($dirlist));
}
示例2: wfu_encode_plugin_options
function wfu_encode_plugin_options($plugin_options)
{
$encoded_options = 'version=' . $plugin_options['version'] . ';';
$encoded_options .= 'shortcode=' . wfu_plugin_encode_string($plugin_options['shortcode']) . ';';
$encoded_options .= 'hashfiles=' . $plugin_options['hashfiles'] . ';';
$encoded_options .= 'basedir=' . wfu_plugin_encode_string($plugin_options['basedir']) . ';';
$encoded_options .= 'postmethod=' . $plugin_options['postmethod'] . ';';
$encoded_options .= 'relaxcss=' . $plugin_options['relaxcss'] . ';';
$encoded_options .= 'captcha_sitekey=' . wfu_plugin_encode_string($plugin_options['captcha_sitekey']) . ';';
$encoded_options .= 'captcha_secretkey=' . wfu_plugin_encode_string($plugin_options['captcha_secretkey']) . ';';
$encoded_options .= 'browser_permissions=' . wfu_encode_array_to_string($plugin_options['browser_permissions']);
return $encoded_options;
}
示例3: wfu_set_javascript_constants
function wfu_set_javascript_constants()
{
$consts = array("nofilemessage" => WFU_ERROR_UPLOAD_NOFILESELECTED, "enable_popups" => WFU_ERROR_ENABLE_POPUPS, "remoteserver_noresult" => WFU_ERROR_REMOTESERVER_NORESULT, "message_header" => WFU_ERRORMESSAGE, "message_failed" => WFU_ERROR_UPLOAD_FAILED_WHILE, "message_cancelled" => WFU_ERROR_UPLOAD_CANCELLED, "message_unknown" => WFU_ERROR_UNKNOWN, "adminmessage_unknown" => WFU_FAILMESSAGE_DETAILS, "message_timelimit" => WFU_ERROR_FILE_PHP_TIME, "message_admin_timelimit" => WFU_ERROR_ADMIN_FILE_PHP_TIME, "cancel_upload_prompt" => WFU_CANCEL_UPLOAD_PROMPT, "file_cancelled" => WFU_ERROR_FILE_CANCELLED, "jsonparse_filemessage" => WFU_ERROR_JSONPARSE_FILEMESSAGE, "jsonparse_message" => WFU_ERROR_JSONPARSE_MESSAGE, "jsonparse_adminmessage" => WFU_ERROR_JSONPARSE_ADMINMESSAGE, "jsonparse_headermessage" => WFU_ERROR_JSONPARSE_HEADERMESSAGE, "jsonparse_headeradminmessage" => WFU_ERROR_JSONPARSE_HEADERADMINMESSAGE, "same_pluginid" => WFU_ERROR_SAME_PLUGINID, "default_colors" => WFU_VAR("WFU_DEFAULTMESSAGECOLORS"), "fail_colors" => WFU_VAR("WFU_FAILMESSAGECOLORS"), "max_time_limit" => WFU_MAX_TIME_LIMIT, "response_url" => WFU_RESPONSE_URL, "ajax_url" => wfu_ajaxurl(), "wfu_pageexit_prompt" => WFU_PAGEEXIT_PROMPT, "wfu_subdir_typedir" => WFU_SUBDIR_TYPEDIR);
$consts_txt = "";
foreach ($consts as $key => $val) {
$consts_txt .= ($consts_txt == "" ? "" : ";") . wfu_plugin_encode_string($key) . ":" . wfu_plugin_encode_string($val);
}
return $consts_txt;
}
示例4: wfu_encode_plugin_options
function wfu_encode_plugin_options($plugin_options)
{
$encoded_options = 'version=' . (isset($plugin_options['version']) ? $plugin_options['version'] : "1.0") . ';';
$encoded_options .= 'shortcode=' . (isset($plugin_options['shortcode']) ? wfu_plugin_encode_string($plugin_options['shortcode']) : "") . ';';
$encoded_options .= 'hashfiles=' . (isset($plugin_options['hashfiles']) ? $plugin_options['hashfiles'] : "") . ';';
$encoded_options .= 'basedir=' . (isset($plugin_options['basedir']) ? wfu_plugin_encode_string($plugin_options['basedir']) : "") . ';';
$encoded_options .= 'postmethod=' . (isset($plugin_options['postmethod']) ? $plugin_options['postmethod'] : "") . ';';
$encoded_options .= 'modsecurity=' . (isset($plugin_options['modsecurity']) ? $plugin_options['modsecurity'] : "") . ';';
$encoded_options .= 'relaxcss=' . (isset($plugin_options['relaxcss']) ? $plugin_options['relaxcss'] : "") . ';';
$encoded_options .= 'admindomain=' . (isset($plugin_options['admindomain']) ? $plugin_options['admindomain'] : "") . ';';
$encoded_options .= 'mediacustom=' . (isset($plugin_options['mediacustom']) ? $plugin_options['mediacustom'] : "") . ';';
$encoded_options .= 'captcha_sitekey=' . (isset($plugin_options['captcha_sitekey']) ? wfu_plugin_encode_string($plugin_options['captcha_sitekey']) : "") . ';';
$encoded_options .= 'captcha_secretkey=' . (isset($plugin_options['captcha_secretkey']) ? wfu_plugin_encode_string($plugin_options['captcha_secretkey']) : "") . ';';
$encoded_options .= 'dropbox_accesstoken=' . (isset($plugin_options['dropbox_accesstoken']) ? wfu_plugin_encode_string($plugin_options['dropbox_accesstoken']) : "") . ';';
$encoded_options .= 'dropbox_defaultpath=' . (isset($plugin_options['dropbox_defaultpath']) ? wfu_plugin_encode_string($plugin_options['dropbox_defaultpath']) : "") . ';';
$encoded_options .= 'browser_permissions=' . (isset($plugin_options['browser_permissions']) ? wfu_encode_array_to_string($plugin_options['browser_permissions']) : "");
return $encoded_options;
}
示例5: wfu_view_log
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';
//.........这里部分代码省略.........
示例6: wfu_prepare_message_block_skeleton
//.........这里部分代码省略.........
$fileheader_message = '[fileheader_message]';
$filesubheadermessage_display = '[filesubheadermessage_display]';
$filesubheader_message = '[filesubheader_message]';
$filesubheaderadminmessage_display = '[filesubheaderadminmessage_display]';
$filesubheader_adminmessage = '[filesubheader_adminmessage]';
}
$messageblock_file[$i++] = "\t" . '<tr id="' . $messageblock_main . '_' . $file_id . '" class="file_messageblock_fileheader_tr" style="display:none;">';
$messageblock_file[$i++] = "\t\t" . '<td id="' . $messageblock_main . '_filenumber_' . $file_id . '" class="file_messageblock_filenumber_td"' . $filenumber_display . '>' . $file_id . '</td>';
$messageblock_file[$i++] = "\t\t" . '<td id="' . $messageblock_header . '_container_' . $file_id . '" class="file_messageblock_fileheader_td">';
$messageblock_file[$i++] = "\t\t\t" . '<div id="' . $messageblock_header . '_' . $file_id . '" class="file_messageblock_fileheader" style="color:' . $fileheader_color . '; background-color:' . $fileheader_bgcolor . '; border:1px solid ' . $fileheader_borcolor . ';">';
$messageblock_file[$i++] = "\t\t\t\t" . '<label id="' . $messageblock_header . '_label_' . $file_id . '" class="file_messageblock_fileheader_label">' . $fileheader_message . '</label>';
/* The following hidden input holds state of arrow (open or close) */
$messageblock_file[$i++] = "\t\t\t\t" . '<input id="' . $messageblock_header . '_state_' . $file_id . '" type="hidden" value="none" />';
$messageblock_file[$i++] = "\t\t\t" . '</div>';
$messageblock_file[$i++] = "\t\t" . '</td>';
/* Add a drop down arrow to the file header (file has always details to be shown) */
$messageblock_file[$i++] = "\t\t" . '<td id="' . $messageblock_arrow . '_' . $file_id . '" class="file_messageblock_filearrow_td" onclick="wfu_filedetails_toggle(' . $sid . ', ' . $file_id . ');">';
$messageblock_file[$i++] = "\t\t\t" . '<div id="' . $messageblock_arrow . '_up_' . $file_id . '" class="file_messageblock_file_arrow_up" style="display:none;"></div>';
$messageblock_file[$i++] = "\t\t\t" . '<div id="' . $messageblock_arrow . '_down_' . $file_id . '" class="file_messageblock_file_arrow_down"></div>';
$messageblock_file[$i++] = "\t\t" . '</td>';
$messageblock_file[$i++] = "\t" . '</tr>';
/* Prepare the files subheader block HTML template */
$messageblock_file[$i++] = "\t" . '<tr id="' . $messageblock_subheader . '_' . $file_id . '" class="file_messageblock_filesubheader_tr" style="display:none;">';
$messageblock_file[$i++] = "\t\t" . '<td id="' . $messageblock_subheader . '_fileempty_' . $file_id . '" class="file_messageblock_filesubheaderempty_td"' . $filenumber_display . '></td>';
$messageblock_file[$i++] = "\t\t" . '<td colspan="2" id="' . $messageblock_subheader . '_container_' . $file_id . '" class="file_messageblock_filesubheader_td">';
$messageblock_file[$i++] = "\t\t\t" . '<div id="' . $messageblock_subheader . '_message_' . $file_id . '" class="file_messageblock_filesubheader_message"' . $filesubheadermessage_display . '>';
$messageblock_file[$i++] = "\t\t\t\t" . '<label id="' . $messageblock_subheader . '_messagelabel_' . $file_id . '" class="file_messageblock_filesubheader_messagelabel">' . $filesubheader_message . '</label>';
$messageblock_file[$i++] = "\t\t\t" . '</div>';
$messageblock_file[$i++] = "\t\t\t" . '<div id="' . $messageblock_subheader . '_adminmessage_' . $file_id . '" class="file_messageblock_filesubheader_adminmessage"' . $filesubheaderadminmessage_display . '>';
$messageblock_file[$i++] = "\t\t\t\t" . '<label id="' . $messageblock_subheader . '_adminmessagelabel_' . $file_id . '" class="file_messageblock_filesubheader_adminmessagelabel">' . $filesubheader_adminmessage . '</label>';
$messageblock_file[$i++] = "\t\t\t" . '</div>';
$messageblock_file[$i++] = "\t\t" . '</td>';
$messageblock_file[$i++] = "\t" . '</tr>';
}
/* Construct the main header block HTML text
/* Construct the header block HTML text */
$i = 1;
$messageblock["msgblock"]["line" . $i++] = '<table id="' . $messageblock_main . '" class="file_messageblock_table"' . $styles . '><tbody>';
$messageblock["msgblock"]["line" . $i++] = "\t" . '<tr id="' . $messageblock_header . '" class="file_messageblock_header_tr"' . ($test ? '' : ' style="display:none;"') . '>';
$messageblock["msgblock"]["line" . $i++] = "\t\t" . '<td colspan="2" id="' . $messageblock_header . '_container" class="file_messageblock_header_td">';
/* Inside this td element the appropriate upload state HTML block is going to be inserted using Javascript
If the plugin is in test mode, then State9 HTML block is inserted now */
if ($test) {
foreach ($messageblock_headers as $messageblock_header_part) {
$messageblock["msgblock"]["line" . $i++] = strtr($messageblock_header_part, array("[header_safe]" => "", "[header_color]" => $header_styles["State9"]["color"], "[header_bgcolor]" => $header_styles["State9"]["bgcolor"], "[header_borcolor]" => $header_styles["State9"]["borcolor"], "[header_message]" => $header_styles["State9"]["message"]));
}
}
$messageblock["msgblock"]["line" . $i++] = "\t\t" . '</td>';
/* Add a drop down arrow to the header */
$messageblock["msgblock"]["line" . $i++] = "\t\t" . '<td id="' . $messageblock_arrow . '" class="file_messageblock_arrow_td"' . ($test ? '' : ' style="display:none;"') . ' onclick="wfu_headerdetails_toggle(' . $sid . ');">';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t" . '<input id="' . $messageblock_header . '_state" type="hidden" value="none" />';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t" . '<div id="' . $messageblock_arrow . '_up" class="file_messageblock_header_arrow_up" style="display:none;"></div>';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t" . '<div id="' . $messageblock_arrow . '_down" class="file_messageblock_header_arrow_down"></div>';
$messageblock["msgblock"]["line" . $i++] = "\t\t" . '</td>';
$messageblock["msgblock"]["line" . $i++] = "\t" . '</tr>';
/* Construct the subheader block HTML text if exists */
$messageblock["msgblock"]["line" . $i++] = "\t" . '<tr id="' . $messageblock_subheader . '" class="file_messageblock_subheader_tr" style="display:none;">';
$messageblock["msgblock"]["line" . $i++] = "\t\t" . '<td colspan="3" id="' . $messageblock_subheader . '_td" class="file_messageblock_subheader_td">';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t" . '<div id="' . $messageblock_subheader . '_message" class="file_messageblock_subheader_message"' . ($test ? '' : ' style="display:none;"') . '>';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t\t" . '<label id="' . $messageblock_subheader . '_messagelabel" class="file_messageblock_subheader_messagelabel">' . ($test ? WFU_TESTMESSAGE_MESSAGE : '') . '</label>';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t" . '</div>';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t" . '<div id="' . $messageblock_subheader . '_adminmessage" class="file_messageblock_subheader_adminmessage"' . ($test ? '' : ' style="display:none;"') . '>';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t\t" . '<label id="' . $messageblock_subheader . '_adminmessagelabel" class="file_messageblock_subheader_adminmessagelabel">' . ($test ? WFU_TESTMESSAGE_ADMINMESSAGE : '') . '</label>';
$messageblock["msgblock"]["line" . $i++] = "\t\t\t" . '</div>';
$messageblock["msgblock"]["line" . $i++] = "\t\t" . '</td>';
$messageblock["msgblock"]["line" . $i++] = "\t" . '</tr>';
/* After the above tr the file blocks are appended by Javascript dynamically as additional tr elements
If the plugin is in test mode, then two test file blocks are appended now */
if ($test) {
foreach ($messageblock_file as $messageblock_file_part) {
$messageblock["msgblock"]["line" . $i++] = $messageblock_file_part;
}
}
$messageblock["msgblock"]["line" . $i++] = '</tbody></table>';
/* Construct a div element that will hold the State10 header and use it in case JSON parse fails and upload results cannot be decoded */
$messageblock["msgblock"]["line" . $i++] = '<div id="' . $messageblock_header . '_safecontainer" style="display:none;">';
foreach ($messageblock_headers as $messageblock_header_part) {
$messageblock["msgblock"]["line" . $i++] = strtr($messageblock_header_part, array("[header_safe]" => "_safe", "[header_color]" => $header_styles["State10"]["color"], "[header_bgcolor]" => $header_styles["State10"]["bgcolor"], "[header_borcolor]" => $header_styles["State10"]["borcolor"], "[header_message]" => $header_styles["State10"]["message"]));
}
$messageblock["msgblock"]["line" . $i++] = '</div>';
/* Construct header HTML text for all upload states and save it to hidden input, to be used later on by Javascript to adjust the upload state dynamically */
$messageblock_header_template = "";
foreach ($messageblock_headers as $messageblock_header_part) {
$messageblock_header_template .= $dlp . $messageblock_header_part;
}
foreach ($ExposedStateIndex as $ii) {
$messageblock["header"]["State" . $ii] = strtr($messageblock_header_template, array("[header_safe]" => "", "[header_color]" => $header_styles["State" . $ii]["color"], "[header_bgcolor]" => $header_styles["State" . $ii]["bgcolor"], "[header_borcolor]" => $header_styles["State" . $ii]["borcolor"], "[header_message]" => $header_styles["State" . $ii]["message"]));
}
$messageblock_header_str = wfu_encode_array_to_string($messageblock["header"]);
$messageblock["msgblock"]["line" . $i++] = '<input id="' . $messageblock_header . '_states" type="hidden" value="' . $messageblock_header_str . '" />';
/* Construct file HTML block template and save it to hidden div to be used later on by Javascript to add file results to the upload message dynamically */
$messageblock_file_str = "";
foreach ($messageblock_file as $messageblock_file_part) {
$messageblock_file_str .= $dlp . $messageblock_file_part;
}
$messageblock_file_str = wfu_plugin_encode_string($messageblock_file_str);
$messageblock["msgblock"]["line" . $i++] = '<input id="' . $messageblock_main . '_filetemplate" type="hidden" value="' . $messageblock_file_str . '" />';
$messageblock["msgblock"]["line" . $i++] = '<div id="' . $messageblock_main . '_door" style="display:none;"></div>';
return $messageblock;
}
示例7: wfu_view_log
function wfu_view_log()
{
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;
}
$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 .= "\n\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px; margin-top: 20px;">History Log</h2>';
$echo_str .= "\n\t" . '<div>';
$echo_str .= "\n\t\t" . '<table class="widefat">';
$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>';
$filerecs = $wpdb->get_results('SELECT * FROM ' . $table_name1 . ' ORDER BY date_from DESC');
$userdatarecs = $wpdb->get_results('SELECT * FROM ' . $table_name2);
$i = 0;
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 == '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->date_from == $filerec->date_from) {
$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;">';
$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=' . $enc_file . '" title="View and edit file details" style="font-weight:normal;">' . $filerec->filepath . '</a>';
$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>';
}
$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;
//.........这里部分代码省略.........
示例8: wfu_ajax_action_get_historylog_page
function wfu_ajax_action_get_historylog_page()
{
if (!isset($_POST['token']) || !isset($_POST['page'])) {
die;
}
check_ajax_referer('wfu-historylog-page', 'token');
if (!current_user_can('manage_options')) {
die;
}
if (WFU_HISTORYLOG_TABLE_MAXROWS <= 0) {
die;
}
$page = wfu_sanitize_int($_POST['page']);
$rows = wfu_view_log($page, true);
die('wfu_historylog_page_success:' . wfu_plugin_encode_string($rows));
}
示例9: wfu_shortcode_composer
//.........这里部分代码省略.........
$ii = max(1, $occurrences) + 1;
while (array_key_exists($attr . $ii, $shortcode_attrs)) {
$defs[$key]['additional_values'][$ii] = $shortcode_attrs[$attr . $ii];
$ii++;
}
}
$key++;
}
$echo_str = '<div id="wfu_wrapper" class="wrap">';
$echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
$echo_str .= "\n\t" . '<div id="wfu_page_obsolete_message" class="error" style="display:none;">';
$echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_PAGE_OBSOLETE . '</p>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div id="wfu_update_rejected_message" class="error" style="display:none;">';
$echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_UPDATE_SHORTCODE_REJECTED . '</p>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div id="wfu_update_failed_message" class="error" style="display:none;">';
$echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_UPDATE_SHORTCODE_FAILED . '</p>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div style="margin-top:20px;">';
if (current_user_can('manage_options')) {
$echo_str .= "\n\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
}
$echo_str .= "\n\t" . '</div>';
if ($widgetid == "") {
$echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px; margin-top: 20px;">' . ($data == "" ? 'Test' : $posttype . ' <strong>' . $postname . '</strong>') . ': Shortcode Composer for ' . $plugin_title . ' <strong>ID ' . $shortcode_id . '</strong></h2>';
} else {
$echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px; margin-top: 20px;">Sidebar <strong>' . $sidebar . '</strong>: Shortcode Composer for Uploader <strong>ID ' . $shortcode_id . '</strong></h2>';
}
$echo_str .= "\n\t" . '<div style="margin-top:10px; display:inline-block;">';
if ($data != "") {
$echo_str .= "\n\t\t" . '<input id="wfu_update_shortcode" type="button" value="Update" class="button-primary" disabled="disabled" onclick="wfu_save_shortcode()" /><span id="wfu_update_shortcode_wait" class="spinner" style="float:right; display:none;"></span>';
}
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_original_enc" type="hidden" value="' . wfu_plugin_encode_string($shortcode_full) . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_tag" type="hidden" value="' . $shortcode_tag . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_postid" type="hidden" value="' . $postid . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_posthash" type="hidden" value="' . $posthash . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_position" type="hidden" value="' . $shortcode_position . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_widgetid" type="hidden" value="' . $widgetid . '" />';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div style="margin-top:20px;">';
$echo_str .= "\n\t\t" . '<div class="wfu_shortcode_container">';
$echo_str .= "\n\t\t\t" . '<span><strong>Generated Shortcode</strong></span>';
$echo_str .= "\n\t\t\t" . '<span id="wfu_save_label" class="wfu_save_label">saved</span>';
$echo_str .= "\n\t\t\t" . '<textarea id="wfu_shortcode" class="wfu_shortcode" rows="5">[' . $shortcode_tag . ']</textarea>';
$echo_str .= "\n\t\t\t" . '<div id="wfu_attribute_defaults" style="display:none;">';
// remove hidden attributes from defs array
foreach ($defs as $key => $def) {
if ($def['type'] == "hidden") {
unset($defs[$key]);
}
}
foreach ($defs as $def) {
$echo_str .= "\n\t\t\t\t" . '<input id="wfu_attribute_default_' . $def['attribute'] . '" type="hidden" value="' . $def['default'] . '" />';
}
$echo_str .= "\n\t\t\t" . '</div>';
$echo_str .= "\n\t\t\t" . '<div id="wfu_attribute_values" style="display:none;">';
foreach ($defs as $def) {
$echo_str .= "\n\t\t\t\t" . '<input id="wfu_attribute_value_' . $def['attribute'] . '" type="hidden" value="' . $def['value'] . '" />';
//add additional values, if exist
foreach ($def['additional_values'] as $key => $val) {
$echo_str .= "\n\t\t\t\t" . '<input id="wfu_attribute_value_' . $def['attribute'] . $key . '" type="hidden" value="' . $val . '" />';
}
}
$echo_str .= "\n\t\t\t" . '</div>';
$echo_str .= "\n\t\t" . '</div>';
示例10: wfu_process_files
//.........这里部分代码省略.........
if ($only_check) {
$params_output_array["general"]['files_count'] = 0;
}
$somefiles_Ok = $warning_count + $success_count > 0;
$allfiles_Ok = $somefiles_Ok && $error_count == 0;
/* Prepare WPFileBase Plugin update url, if this option has been selected and only if at least one file has been successfully uploaded.
Execution will happen only if accumulated $params_output_array["general"]['update_wpfilebase'] is not empty */
if ($params["filebaselink"] == "true") {
if ($somefiles_Ok) {
$filebaseurl = site_url();
if (substr($filebaseurl, -1, 1) == "/") {
$filebaseurl = substr($filebaseurl, 0, strlen($filebaseurl) - 1);
}
/* if the following variable is not empty, then WPFileBase Plugin update must be executed
and any admin messages must be suppressed */
$params_output_array["general"]['update_wpfilebase'] = $filebaseurl;
} else {
$params_output_array["general"]['admin_messages']['wpfilebase'] = WFU_WARNING_WPFILEBASE_NOTUPDATED_NOFILES;
$params_output_array["general"]['errors']['wpfilebase'] = "error";
}
}
/* Prepare email notification parameters if email notification is enabled and only if at least one file has been successfully uploaded
if $method = "no-ajax" then send the email to the recipients
if $method = "ajax" then return the notification parameters to the handler for further processing
In case of ajax, execution will happen only if accumulated notify_only_filename_list is not empty */
if ($params["notify"] == "true") {
/* verify that there are recipients */
$notifyrecipients = trim(preg_replace('/%useremail%/', $user_email, $params["notifyrecipients"]));
if ($notifyrecipients != "") {
if ($somefiles_Ok) {
if ($method == 'no_ajax' && !$ignore_server_actions) {
$send_error = wfu_send_notification_email($user, $notify_only_filename_list, $notify_target_path_list, $notify_attachment_list, $userdata_fields, $params);
if ($send_error != "") {
$params_output_array["general"]['admin_messages']['notify'] = $send_error;
$params_output_array["general"]['errors']['notify'] = "error";
}
} else {
/* if the following variable is not empty, then email notification must be sent
and any admin messages must be suppressed */
$params_output_array["general"]['notify_only_filename_list'] = $notify_only_filename_list;
$params_output_array["general"]['notify_target_path_list'] = $notify_target_path_list;
$params_output_array["general"]['notify_attachment_list'] = $notify_attachment_list;
}
} else {
$params_output_array["general"]['admin_messages']['notify'] = WFU_WARNING_NOTIFY_NOTSENT_NOFILES;
$params_output_array["general"]['errors']['notify'] = "error";
}
} else {
$params_output_array["general"]['admin_messages']['notify'] = WFU_WARNING_NOTIFY_NOTSENT_NORECIPIENTS;
$params_output_array["general"]['errors']['notify'] = "error";
}
}
/* Prepare redirect link if redirection is enabled and only if all files have been successfully uploaded
Execution will happen only if accumulated redirect_link is not empty and accumulated redirect errors are empty */
if ($params["redirect"] == "true") {
if ($params_output_array["general"]['redirect_link'] == "") {
$params_output_array["general"]['admin_messages']['redirect'] = WFU_WARNING_REDIRECT_NOTEXECUTED_EMPTY;
$params_output_array["general"]['errors']['redirect'] = "error";
} elseif (!$allfiles_Ok) {
$params_output_array["general"]['admin_messages']['redirect'] = WFU_WARNING_REDIRECT_NOTEXECUTED_FILESFAILED;
$params_output_array["general"]['errors']['redirect'] = "error";
}
}
/* suppress any admin messages if user is not administrator or adminmessages is not activated */
if ($suppress_admin_messages) {
$params_output_array["general"]['admin_messages']['wpfilebase'] = "";
$params_output_array["general"]['admin_messages']['notify'] = "";
$params_output_array["general"]['admin_messages']['redirect'] = "";
$params_output_array["general"]['admin_messages']['other'] = "";
}
/* Calculate upload state from file results */
if ($allfiles_Ok && $warning_count == 0) {
$params_output_array["general"]['state'] = 4;
} else {
if ($allfiles_Ok) {
$params_output_array["general"]['state'] = 5;
} else {
if ($somefiles_Ok) {
$params_output_array["general"]['state'] = 6;
} else {
if (!$somefiles_Ok && $error_count > 0) {
$params_output_array["general"]['state'] = 7;
} else {
$params_output_array["general"]['state'] = 8;
}
}
}
}
/* construct safe output */
$sout = $params_output_array["general"]['state'] . ";" . WFU_VAR("WFU_DEFAULTMESSAGECOLORS") . ";" . $files_count;
for ($i = 0; $i < $files_count; $i++) {
$sout .= ";" . wfu_plugin_encode_string($file_output['message_type']);
$sout .= "," . wfu_plugin_encode_string($file_output['header']);
$sout .= "," . wfu_plugin_encode_string($file_output['message']);
$sout .= "," . wfu_plugin_encode_string($file_output['admin_messages']);
$sout .= "," . $file_output['uploaded_file_props'];
}
$params_output_array["general"]['safe_output'] = $sout;
return $params_output_array;
}
示例11: wfu_shortcode_composer
function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upload')
{
global $wpdb;
global $wp_roles;
$siteurl = site_url();
$components = wfu_component_definitions();
if ($shortcode_tag == 'wordpress_file_upload') {
$cats = wfu_category_definitions();
$defs = wfu_attribute_definitions();
} else {
$cats = wfu_browser_category_definitions();
$defs = wfu_browser_attribute_definitions();
}
$plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
if ($data == "") {
$shortcode = $plugin_options['shortcode'];
$shortcode_full = '[' . $shortcode_tag . ' ' . $shortcode . ']';
$postid = "";
$postname = "";
$posttype = "";
$posthash = "";
$shortcode_position = -1;
$autosave = true;
} else {
$shortcode = trim(substr($data['shortcode'], strlen('[' . $shortcode_tag), -1));
$shortcode_full = $data['shortcode'];
$postid = $data['post_id'];
$postname = get_the_title($postid);
$posttype = get_post_type($postid);
$posthash = $data['post_hash'];
$shortcode_position = $data['position'];
$autosave = false;
}
$shortcode_attrs = wfu_shortcode_string_to_array($shortcode);
$shortcode_id = '';
foreach ($defs as $key => $def) {
$defs[$key]['default'] = $def['value'];
if (array_key_exists($def['attribute'], $shortcode_attrs)) {
$defs[$key]['value'] = $shortcode_attrs[$def['attribute']];
}
if ($def['attribute'] == 'uploadid' || $def['attribute'] == 'browserid') {
$shortcode_id = $defs[$key]['value'];
}
}
// index $components
$components_indexed = array();
foreach ($components as $component) {
$components_indexed[$component['id']] = $component;
}
// index dependiencies
$governors = array();
$echo_str = '<div id="wfu_wrapper" class="wrap">';
$echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
$echo_str .= "\n\t" . '<div id="wfu_page_obsolete_message" class="error" style="display:none;">';
$echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_PAGE_OBSOLETE . '</p>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div id="wfu_update_rejected_message" class="error" style="display:none;">';
$echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_UPDATE_SHORTCODE_REJECTED . '</p>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div id="wfu_update_failed_message" class="error" style="display:none;">';
$echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_UPDATE_SHORTCODE_FAILED . '</p>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div style="margin-top:20px;">';
if (current_user_can('manage_options')) {
$echo_str .= "\n\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
}
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px; margin-top: 20px;">Shortcode Composer for ' . ($data == "" ? 'Test' : $posttype . ' "' . $postname . '" (' . $postid . ') Position ' . $data['position']) . ' with ID ' . $shortcode_id . '</h2>';
$echo_str .= "\n\t" . '<div style="margin-top:10px; display:inline-block;">';
if ($data != "") {
$echo_str .= "\n\t\t" . '<input id="wfu_update_shortcode" type="button" value="Update" class="button-primary" disabled="disabled" onclick="wfu_save_shortcode()" /><span id="wfu_update_shortcode_wait" class="spinner" style="float:right; display:none;"></span>';
}
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_original_enc" type="hidden" value="' . wfu_plugin_encode_string($shortcode_full) . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_tag" type="hidden" value="' . $shortcode_tag . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_postid" type="hidden" value="' . $postid . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_posthash" type="hidden" value="' . $posthash . '" />';
$echo_str .= "\n\t\t" . '<input id="wfu_shortcode_position" type="hidden" value="' . $shortcode_position . '" />';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<div style="margin-top:20px;">';
$echo_str .= "\n\t\t" . '<div class="wfu_shortcode_container">';
$echo_str .= "\n\t\t\t" . '<span><strong>Generated Shortcode</strong></span>';
$echo_str .= "\n\t\t\t" . '<span id="wfu_save_label" class="wfu_save_label">saved</span>';
$echo_str .= "\n\t\t\t" . '<textarea id="wfu_shortcode" class="wfu_shortcode" rows="5">[' . $shortcode_tag . ']</textarea>';
$echo_str .= "\n\t\t\t" . '<div id="wfu_attribute_defaults" style="display:none;">';
foreach ($defs as $def) {
$echo_str .= "\n\t\t\t\t" . '<input id="wfu_attribute_default_' . $def['attribute'] . '" type="hidden" value="' . $def['default'] . '" />';
}
$echo_str .= "\n\t\t\t" . '</div>';
$echo_str .= "\n\t\t\t" . '<div id="wfu_attribute_values" style="display:none;">';
foreach ($defs as $def) {
$echo_str .= "\n\t\t\t\t" . '<input id="wfu_attribute_value_' . $def['attribute'] . '" type="hidden" value="' . $def['value'] . '" />';
}
$echo_str .= "\n\t\t\t" . '</div>';
$echo_str .= "\n\t\t" . '</div>';
$echo_str .= "\n\t" . '</div>';
$echo_str .= "\n\t" . '<h3 id="wfu_tab_container" class="nav-tab-wrapper">';
$is_first = true;
foreach ($cats as $key => $cat) {
$echo_str .= "\n\t\t" . '<a id="wfu_tab_' . $key . '" class="nav-tab' . ($is_first ? ' nav-tab-active' : '') . '" href="javascript: wfu_admin_activate_tab(\'' . $key . '\');">' . $cat . '</a>';
$is_first = false;
//.........这里部分代码省略.........
示例12: wordpress_file_upload_function
//.........这里部分代码省略.........
array_push($section_array, wfu_prepare_submit_block($params, $additional_params, $occurrence_index));
} elseif ($item_in_section == "subfolders") {
array_push($section_array, wfu_prepare_subfolders_block($params, $additional_params, $occurrence_index));
} elseif ($item_in_section == "progressbar") {
array_push($section_array, wfu_prepare_progressbar_block($params, $additional_params, $occurrence_index));
} elseif ($item_in_section == "message") {
array_push($section_array, wfu_prepare_message_block($params, $additional_params, $occurrence_index));
} elseif ($item_in_section == "userdata" && $params["userdata"] == "true") {
array_push($section_array, wfu_prepare_userdata_block($params, $additional_params, $occurrence_index));
} elseif ($item_in_section == "webcam" && $params["webcam"] == "true") {
array_push($section_array, wfu_prepare_webcam_block($params, $additional_params, $occurrence_index));
}
}
}
$wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
}
/* Append mandatory blocks, if have not been included in placements attribute */
if ($params["userdata"] == "true" && strpos($params["placements"], "userdata") === false) {
$section_array = array($params["fitmode"]);
array_push($section_array, wfu_prepare_userdata_block($params, $additional_params, 0));
$wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
}
if (strpos($params["placements"], "selectbutton") === false) {
$section_array = array($params["fitmode"]);
array_push($section_array, wfu_prepare_uploadform_block($params, $additional_params, 0));
$wordpress_file_upload_output .= call_user_func_array("wfu_add_div", $section_array);
}
/* Pass constants to javascript and run plugin post-load actions */
$consts = wfu_set_javascript_constants();
$handler = 'function() { wfu_Initialize_Consts("' . $consts . '"); wfu_Load_Code_Connectors(' . $sid . '); wfu_plugin_load_action(' . $sid . '); }';
$wordpress_file_upload_output .= "\n\t" . '<script type="text/javascript">if(window.addEventListener) { window.addEventListener("load", ' . $handler . ', false); } else if(window.attachEvent) { window.attachEvent("onload", ' . $handler . '); } else { window["onload"] = ' . $handler . '; }</script>';
$wordpress_file_upload_output .= '</div>';
// $wordpress_file_upload_output .= '<div>';
// $wordpress_file_upload_output .= wfu_test_admin();
// $wordpress_file_upload_output .= '</div>';
// The plugin uses sessions in order to detect if the page was loaded due to file upload or
// because the user pressed the Refresh button (or F5) of the page.
// In the second case we do not want to perform any file upload, so we abort the rest of the script.
if (!isset($_SESSION['wfu_check_refresh_' . $sid]) || $_SESSION['wfu_check_refresh_' . $sid] != "form button pressed") {
$_SESSION['wfu_check_refresh_' . $sid] = 'do not process';
$wordpress_file_upload_output .= wfu_post_plugin_actions($params);
return $wordpress_file_upload_output . "\n";
}
$_SESSION['wfu_check_refresh_' . $sid] = 'do not process';
$params["upload_start_time"] = $_SESSION['wfu_start_time_' . $sid];
// The plugin uses two ways to upload the file:
// - The first one uses classic functionality of an HTML form (highest compatibility with browsers but few capabilities).
// - The second uses ajax (HTML5) functionality (medium compatibility with browsers but many capabilities, like no page refresh and progress bar).
// The plugin loads using ajax functionality by default, however if it detects that ajax functionality is not supported, it will automatically switch to classic functionality.
// The next line checks to see if the form was submitted using ajax or classic functionality.
// If the uploaded file variable stored in $_FILES ends with "_redirected", then it means that ajax functionality is not supported and the plugin must switch to classic functionality.
if (isset($_FILES[$uploadedfile . '_redirected'])) {
$params['forceclassic'] = "true";
}
if ($params['forceclassic'] != "true") {
$wordpress_file_upload_output .= wfu_post_plugin_actions($params);
return $wordpress_file_upload_output . "\n";
}
// The following code is executed in case of non-ajax uploads to process the files.
// Consecutive checks are performed in order to verify and approve the upload of files
$wfu_checkpass = true;
// First we test that WP nonce passes the check
$wfu_checkpass = $wfu_checkpass && isset($_REQUEST["wfu_uploader_nonce"]) && wp_verify_nonce($_REQUEST["wfu_uploader_nonce"], "wfu-uploader-nonce") !== false;
$unique_id = isset($_POST['uniqueuploadid_' . $sid]) ? sanitize_text_field($_POST['uniqueuploadid_' . $sid]) : "";
// Check that upload_id is valid
$wfu_checkpass = $wfu_checkpass && strlen($unique_id) == 10;
if ($wfu_checkpass) {
//process any error messages due to redirection to non-ajax upload
if (isset($_POST[$adminerrorcodes])) {
$code = $_POST[$adminerrorcodes];
if ($code == "") {
$params['adminerrors'] = "";
} elseif ($code == "1" || $code == "2" || $code == "3") {
$params['adminerrors'] = constant('WFU_ERROR_REDIRECTION_ERRORCODE' . $code);
} else {
$params['adminerrors'] = WFU_ERROR_REDIRECTION_ERRORCODE0;
}
}
$params['subdir_selection_index'] = -1;
if (isset($_POST[$hiddeninput])) {
$params['subdir_selection_index'] = sanitize_text_field($_POST[$hiddeninput]);
}
$wfu_process_file_array = wfu_process_files($params, 'no_ajax');
$safe_output = $wfu_process_file_array["general"]['safe_output'];
unset($wfu_process_file_array["general"]['safe_output']);
//javascript code generated from individual wfu_after_upload_filters is not executed in non-ajax uploads
unset($wfu_process_file_array["general"]['js_script']);
$js_script_enc = "";
//execute after upload filters
$ret = wfu_execute_after_upload_filters($sid, $unique_id);
if ($ret["js_script"] != "") {
$js_script_enc = wfu_plugin_encode_string($ret["js_script"]);
}
$wfu_process_file_array_str = wfu_encode_array_to_string($wfu_process_file_array);
$ProcessUploadComplete_functiondef = 'function(){wfu_ProcessUploadComplete(' . $sid . ', 1, "' . $wfu_process_file_array_str . '", "no-ajax", "", "", "' . $safe_output . '", ["false", "", "false"], "fileupload", "' . $js_script_enc . '");}';
$wordpress_file_upload_output .= '<script type="text/javascript">window.onload=' . $ProcessUploadComplete_functiondef . '</script>';
}
$wordpress_file_upload_output .= wfu_post_plugin_actions($params);
return $wordpress_file_upload_output . "\n";
}
示例13: wfu_encode_plugin_options
function wfu_encode_plugin_options($plugin_options)
{
$encoded_options = 'version=' . $plugin_options['version'] . ';';
$encoded_options .= 'shortcode=' . wfu_plugin_encode_string($plugin_options['shortcode']) . ';';
$encoded_options .= 'hashfiles=' . $plugin_options['hashfiles'] . ';';
$encoded_options .= 'basedir=' . wfu_plugin_encode_string($plugin_options['basedir']) . ';';
$encoded_options .= 'captcha_sitekey=' . wfu_plugin_encode_string($plugin_options['captcha_sitekey']) . ';';
$encoded_options .= 'captcha_secretkey=' . wfu_plugin_encode_string($plugin_options['captcha_secretkey']);
return $encoded_options;
}
示例14: wfu_file_details
function wfu_file_details($file, $errorstatus)
{
global $wpdb;
$table_name1 = $wpdb->prefix . "wfu_log";
$siteurl = site_url();
//extract file browser data from $file variable
$dec_file = wfu_plugin_decode_string($file);
$ret = wfu_extract_sortdata_from_path($dec_file);
$filepath = $ret['path'];
//get file data from database with user data
$filedata = wfu_get_file_rec($filepath, true);
if ($filedata == null) {
return;
}
//check if user is allowed to perform this action
$user = wfu_current_user_allowed_action('details', $filepath);
if ($user == null) {
return;
}
//get the username of the uploader
$uploadername = wfu_get_username_by_id($filedata->uploaduserid);
//extract sort info and construct contained dir
$parts = pathinfo($filepath);
$enc_dir = wfu_plugin_encode_string($parts['dirname'] . '[[' . $ret['sort'] . ']]');
$stat = stat($filepath);
$echo_str = '<div class="regev_wrap">';
if ($errorstatus == 'error') {
$echo_str .= "\n\t" . '<div class="error">';
$echo_str .= "\n\t\t" . '<p>' . $_SESSION['wfu_filedetails_error'] . '</p>';
$echo_str .= "\n\t" . '</div>';
}
//show file detais
$echo_str .= "\n\t" . '<h2>Detais of File: ' . $parts['basename'] . '</h2>';
$echo_str .= "\n\t" . '<div style="margin-top:10px;">';
$echo_str .= "\n\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $enc_dir . '" class="button" title="go back">Go back</a>';
$echo_str .= "\n\t\t" . '<form enctype="multipart/form-data" name="editfiledetails" id="editfiledetails" method="post" action="/wp-admin/options-general.php?page=wordpress_file_upload&action=edit_filedetails" class="validate">';
$echo_str .= "\n\t\t\t" . '<h3 style="margin-bottom: 10px; margin-top: 40px;">Upload Details</h3>';
$echo_str .= "\n\t\t\t" . '<input type="hidden" name="action" value="edit_filedetails" />';
$echo_str .= "\n\t\t\t" . '<input type="hidden" name="dir" value="' . $enc_dir . '">';
$echo_str .= "\n\t\t\t" . '<input type="hidden" name="file" value="' . $file . '">';
$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 class="form-field">';
$echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
$echo_str .= "\n\t\t\t\t\t\t\t" . '<label>Full Path</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 type="text" value="' . $filepath . '" readonly="readonly" />';
$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 class="form-field">';
$echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
$echo_str .= "\n\t\t\t\t\t\t\t" . '<label>Uploaded From User</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 type="text" value="' . $uploadername . '" readonly="readonly" style="width:auto;" />';
$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 class="form-field">';
$echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
$echo_str .= "\n\t\t\t\t\t\t\t" . '<label>File Size</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 type="text" value="' . $filedata->filesize . '" readonly="readonly" style="width:auto;" />';
$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 class="form-field">';
$echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
$echo_str .= "\n\t\t\t\t\t\t\t" . '<label>File Date</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 type="text" value="' . date("d/m/Y H:i:s", $stat['mtime']) . '" readonly="readonly" style="width:auto;" />';
$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 class="form-field">';
$echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
$echo_str .= "\n\t\t\t\t\t\t\t" . '<label>Uploaded From Page</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 type="text" value="' . get_the_title($filedata->pageid) . ' (' . $filedata->pageid . ')' . '" readonly="readonly" style="width:50%;" />';
$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 class="form-field">';
$echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
$echo_str .= "\n\t\t\t\t\t\t\t" . '<label>Upload Plugin ID</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 type="text" value="' . $filedata->sid . '" readonly="readonly" style="width:auto;" />';
$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>';
//show history details
$echo_str .= "\n\t\t\t" . '<h3 style="margin-bottom: 10px; margin-top: 40px;">File History</h3>';
$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 class="form-field">';
$echo_str .= "\n\t\t\t\t\t\t" . '<th scope="row">';
$echo_str .= "\n\t\t\t\t\t\t\t" . '<label></label>';
$echo_str .= "\n\t\t\t\t\t\t" . '</th>';
//.........这里部分代码省略.........