public function ajax() { if (!wp_verify_nonce($_POST['nonce'], 'fileaway-stats-nonce')) { die('Go directly to jail. Do not pass GO. Do not collect $200 dollars.'); } extract($this->pathoptions); $action = $_POST['act']; if ($_POST['type'] == 's2member') { list($trash, $file) = explode("?s2member_file_download=", $_POST['file']); $pre = fileaway_utility::replacefirst(WP_PLUGIN_DIR . '/s2member-files', $rootpath, ''); $file = $pre . '/' . fileaway_utility::urlesc($file, true); $file = str_replace('&s2member_skip_confirmation', '', $file); $response = $_POST['file']; } elseif ($_POST['type'] == 'encrypted') { list($trash, $file) = explode("fileaway_downloader.php?", $_POST['file']); parse_str($file); $file = fileaway_utility::replacefirst($this->decrypt($fileaway), $rootpath, ''); $response = $_POST['file']; } else { $crypt = new fileaway_encrypted(); $file = fileaway_utility::urlesc(fileaway_utility::replacefirst($_POST['file'], rtrim($this->ops['baseurl'], '/') . '/', ''), true); $response = fileaway_url . '/lib/cls/class.fileaway_downloader.php?fileaway=' . $crypt->encrypt($rootpath . $file) . '&nonce=' . wp_create_nonce('fileaway-download'); } if ($action == 'insert') { $response = $this->insert($file) ? $response : 'error'; } $response = json_encode($response); header("Content-Type: application/json"); echo $response; exit; }
private function paths() { $home = fileaway_utility::replacefirst(get_option('home'), 'https:', 'http:'); $wpurl = fileaway_utility::replacefirst(get_bloginfo('wpurl'), 'https:', 'http:'); $install = trim($home, '/') === trim($wpurl, '/') ? false : str_replace('//', '/', ltrim(str_replace(rtrim($home, '/'), '', rtrim($wpurl, '/')), '/') . '/'); $install = $install === '/' ? false : $install; $installpath = ABSPATH; $rootpath = $install ? substr_replace(ABSPATH, '', strrpos(ABSPATH, $install), strlen($install)) : ABSPATH; $chosenpath = $this->options['rootdirectory'] === 'siteurl' ? $rootpath : ABSPATH; $problemchild = $install && $this->options['rootdirectory'] !== 'siteurl' ? true : false; $playback_url = $this->options['rootdirectory'] === 'siteurl' ? rtrim(get_option('home'), '/') . '/' : rtrim(get_bloginfo('wpurl'), '/') . '/'; $this->pathoptions = array('install' => $install, 'installpath' => $installpath, 'rootpath' => $rootpath, 'chosenpath' => $chosenpath, 'problemchild' => $problemchild, 'playback_url' => $playback_url); }
$mfile = null; $mfiles = array(); $has_sample = 0; $has_multiple = 0; $samples = array('mp3', 'ogg', 'wav'); foreach ($samples as $sample) { if (!in_array($sample, $sources) && in_array($oext, $samples) && !in_array($oext, $sources)) { $skipthis = 1; } } if (!$skipthis && in_array($oext, $sources)) { $pbdir = $install ? rtrim(fileaway_utility::replacefirst($dir, $install, ''), '/') . '/' : rtrim($dir, '/') . '/'; if ($playbackpath) { $pbpath = $install ? rtrim(fileaway_utility::replacefirst($playbackpath, $install, ''), '/') . '/' : rtrim($playbackpath, '/') . '/'; } else { $pbpath = $install ? rtrim(fileaway_utility::replacefirst($dir, $install, ''), '/') . '/' : rtrim($dir, '/') . '/'; } $samplefile = $playback_url . $pbpath . $rawname; $mfilepath = $chosenpath . $pbpath . $rawname; foreach ($samples as $x => $sample) { if (is_file($mfilepath . '.' . $sample)) { $mfiles[$sample] = $samplefile . '.' . $sample; $has_sample = 1; } } $player = null; if (is_array($mfiles) && count($mfiles) > 0) { if ($playback == 'compact') { $audiocorrect = "style='display:block; margin-bottom:5px;'"; $loopaudio = $loopaudio == 'true' ? 'true' : 'false'; $mfile = implode('|', $mfiles);
<?php defined('fileaway') or die('Water, water everywhere, but not a drop to drink.'); if ($type == 'table' && !$recursive && isset($this->op['feeds']) && $this->op['feeds'] && trim($this->op['feeds']) != '') { $getrss = true; if (is_file($rootpath . $dir . '/_fa.feed.id.ini')) { $ini = parse_ini_file($rootpath . $dir . '/_fa.feed.id.ini'); $feedid = $ini['id']; $feedfile = $rootpath . trim($this->op['feeds'], '/') . '/_feed_' . $feedid . '.xml'; if (is_file($feedfile)) { $feedurl = fileaway_utility::replacefirst($feedfile, $rootpath, rtrim($this->op['baseurl'], '/') . '/'); $rsslink = '<a href="' . $feedurl . '" target="_blank" class="ssfa-rsslink"><span class="ssfa-icon-feed ssfa-rsslink"></span></a>'; } } }
public function sc($atts) { $uid = rand(0, 9999); $get = new fileaway_definitions(); if (isset($atts['style'])) { $atts['theme'] = $atts['style']; } // legacy if (isset($atts['uploader']) && $atts['uploader'] === 'true') { $atts['uploader'] = 'name'; } // legacy extract($get->pathoptions); extract($this->correct(wp_parse_args($atts, $this->fileup), $this->shortcodes['fileup'])); if ($devices == 'mobile' && !$get->is_mobile) { return; } elseif ($devices == 'desktop' && $get->is_mobile) { return; } if (!fileaway_utility::visibility($hidefrom, $showto)) { return; } if ($this->op['javascript'] == 'footer') { $GLOBALS['fileaway_add_scripts'] = true; } if ($this->op['stylesheet'] == 'footer') { $GLOBALS['fileaway_add_styles'] = true; } // Build Initial Directory $base = $base == 's2member-files' ? fileaway_utility::replacefirst(WP_PLUGIN_DIR . '/s2member-files', $chosenpath, '') : $this->op['base' . $base]; $base = trim($base, '/'); $base = trim($base, '/'); $sub = $sub ? trim($sub, '/') : false; $dir = $sub ? $base . '/' . $sub : $base; extract(fileaway_utility::dynamicpaths($dir)); $dir = str_replace('//', '/', "{$dir}"); $debugpath = $chosenpath . $dir; $dir = $problemchild ? $install . $dir : $dir; if (!is_dir("{$dir}") && $makedir && (!$private_content || $private_content && $logged_in && stripos($dir, 'fa-nullmeta') === false)) { if (mkdir($rootpath . $dir, 0775, true)) { fileaway_utility::indexmulti($rootpath . $dir, $chosenpath); } } if ($private_content && !is_dir("{$dir}")) { return; } $start = "{$dir}"; if ($matchdrawer) { $fixedlocation = true; $drawerid = $matchdrawer && $matchdrawer !== 'true' ? $matchdrawer : null; include fileaway_dir . '/lib/inc/inc.open-drawer.php'; $start = "{$dir}"; } $pathparts = explode('/', $start); $basename = end($pathparts); $fixed = $start; $fixed = $fixedlocation ? $problemchild ? fileaway_utility::replacefirst($fixed, $install, '') : $fixed : null; $path = '<input type="hidden" id="ssfa-upload-actionpath-' . $uid . '" value="' . $fixed . '" data-basename="' . $basename . '" data-start="' . $start . '" />'; // File Type Permissions $types = array(); if ($filetypes) { $filetypes = preg_split('/(, |,)/', $filetypes, -1, PREG_SPLIT_NO_EMPTY); if (is_array($filetypes)) { foreach ($filetypes as $type) { $types[] = strtolower(str_replace(array('.', ' '), '', $type)); } } } if ($filegroups) { $groups = preg_split('/(, |,)/', strtolower(str_replace(' ', '', $filegroups)), -1, PREG_SPLIT_NO_EMPTY); foreach ($get->filegroups as $group => $discard) { if (in_array($group, $groups)) { $types = array_merge($types, $get->filegroups[$group][2]); } } } if (count($types) > 0) { $types = array_unique($types); asort($types); $filetypes = '["' . implode('", "', $types) . '"]'; } else { $filetypes = false; } $permitted = ($filetypes || $filegroups) && $action == 'permit' ? $filetypes : 'false'; $prohibited = ($filetypes || $filegroups) && $action == 'prohibit' ? $filetypes : 'false'; // Configure Settings $name = $name ? $name : "ssfa-meta-container-{$uid}"; $width = is_numeric(preg_replace('[\\D]', '', $width)) ? preg_replace('[\\D]', '', $width) : '100'; $width = "width:{$width}{$perpx};"; if ($width == '100' && $perpx == '%') { $align = 'none'; } $clearfix = $align == 'none' ? '<div class="ssfa-clearfix"></div>' : null; $float = ' float:' . $align . ';'; $margin = $width !== 'width:100%;' ? $align === 'right' ? ' margin-left:15px;' : ' margin-right:15px;' : null; $inlinestyle = $width . $float . $margin; $multiple = $single ? '' : ' multiple=multiple'; $addfiles = $single ? __('+ Add File', 'file-away') : __('+ Add Files', 'file-away'); $overwrite = $overwrite == 'true' ? 'true' : 'false'; $uploadlabel = $uploadlabel ? $uploadlabel : __('File Up ➚', 'file-away'); $pathcheck = $problemchild ? fileaway_utility::replacefirst($start, $install, '') : $start; $uploadedby = $uploader ? get_current_user_id() : 0; $uploadtype = $uploader ? $uploader : 'false'; // Configure Max File Size Setting $max_file_size = trim(preg_replace('[\\D]', '', $maxsize)); $max_size_type = trim(strtolower($maxsizetype)); $max_file_size = is_numeric($max_file_size) ? $max_file_size : 10; $max_size_type = in_array($max_size_type, array('k', 'm', 'g')) ? $max_size_type : 'm'; $ms = $max_file_size . $max_size_type; $ms = fileaway_utility::ini(false, true, false, $ms); $pms = fileaway_utility::ini('post_max_size'); $ums = fileaway_utility::ini('upload_max_filesize'); $maxsize = $pms < $ms ? $pms : $ms; $maxsize = $ums < $maxsize ? $ums : $maxsize; // Initialize Settings $fixedsetting = $fixedlocation ? '"' . $fixed . '"' : 'false'; $initialize = '<script> ' . 'FileUpConfig[' . $uid . '] = { ' . 'form_id: "ssfa_fileup_form_' . $uid . '", ' . 'uid: ' . $uid . ', ' . 'nonce: "' . wp_create_nonce('fileaway-fileup-nonce') . '", ' . 'container: "' . $name . '", ' . 'table: "' . $theme . '", ' . 'iconcolor: "' . $iconcolor . '", ' . 'maxsize: ' . $maxsize . ', ' . 'permitted: ' . $permitted . ', ' . 'prohibited: ' . $prohibited . ', ' . 'fixed: ' . $fixedsetting . ', ' . 'pathcheck: "' . $pathcheck . '", ' . 'uploader: ' . $uploadedby . ', ' . 'identby: "' . $uploadtype . '", ' . 'overwrite: "' . $overwrite . '", ' . 'loading: "' . fileaway_url . '/lib/img/ajax.gif" ' . '}; ' . '</script>'; $fadeit = $fadein ? $fadein == 'opacity' ? 'opacity:0;' : 'display:none;' : null; if ($fadein) { $fadescript = $fadein == 'opacity' ? '.animate({opacity:"1"}, ' . $fadetime . ');' : '.fadeIn(' . $fadetime . ');'; $initialize .= '<script> jQuery(document).ready(function($){ setTimeout(function(){ $("div#ssfa_fileup_container_' . $uid . '")' . $fadescript . ' }, 1000); }); </script>'; } // Form Output if (!is_dir($debugpath)) { return current_user_can('administrator') ? __('File Up Admin Notice: The initial directory specified does not exist:', 'file-away') . '<br>' . $debugpath : null; } $dropdown = $fixedlocation ? null : '<div id="ssfa-fileup-path-container-' . $uid . '" style="display:inline-block; float:left;">' . '<div id="ssfa-fileup-directories-select-container-' . $uid . '">' . '<label for="ssfa-fileup-directories-select-' . $uid . '" ' . 'style="display:block!important; margin-bottom:5px!important; text-align:left;">' . __('Destination Directory', 'file-away') . '</label>' . '<select name="ssfa-fileup-directories-select-' . $uid . '" id="ssfa-fileup-directories-select-' . $uid . '" ' . 'class="chozed-select ssfa-fileup-directories-select" data-placeholder=" ">' . '<option></option>' . '<option value="' . $start . '">' . $basename . '</option>' . '</select>' . '<br>' . '<div id="ssfa-fileup-action-path-' . $uid . '" style="margin-top:5px; min-height:25px;">' . '<img id="ssfa-fileup-action-ajax-loading-' . $uid . '" src="' . fileaway_url . '/lib/img/ajax.gif" ' . 'style="width:15px; margin:0 0 0 5px!important; box-shadow:none!important; display:none;">' . '</div>' . '</div>' . '</div>'; $form = $clearfix . '<div id="ssfa_fileup_container_' . $uid . '" class="ssfa_fileup_container ' . $class . '" data-uid="' . $uid . '" data-mn="' . wp_create_nonce('fileaway-manager-nonce') . '" style="' . $inlinestyle . ' ' . $fadeit . '">' . '<form name="ssfa_fileup_form_' . $uid . '" id="ssfa_fileup_form_' . $uid . '" action="javascript:void(0);" enctype="multipart/form-data">' . $path . $dropdown . '<div class="ssfa_fileup_buttons_container" style="text-align:right;">' . '<span class="ssfa_fileup_wrapper" style="text-align:left;">' . '<input type="file" name="ssfa_fileup_files_' . $uid . '[]" id="ssfa_fileup_files_' . $uid . '" ' . 'class="ssfa_hidden_browse"' . $multiple . ' data-uid="' . $uid . '" />' . '<span class="ssfa_add_files">' . $addfiles . '</span>' . '<span id="ssfa_submit_upload_' . $uid . '" data-uid="' . $uid . '">' . $uploadlabel . '</span>' . '</span>' . '</div>' . '</form>' . '<div id="ssfa_fileup_files_container_' . $uid . '" class="ssfa_fileup_files_container"></div>' . '<span id="ssfa_rf_' . $uid . '" style="display:none;"></span>' . '</div>' . $clearfix; return $initialize . $form; }
public function feeds() { extract($this->definitions->pathoptions); $basedirs = fileaway_utility::feeds(); $excluded_dirs = fileaway_utility::feeds(true); $wp_excludes = array('wp-admin', 'wp-includes', 'wp-content/themes', 'wp-content/upgrade'); $startswith = array('fa-feed-logo', '_thumb_', 'fileaway-url-parser', 'fileaway-banner-parser', 'index.htm', 'index.php', '.ht'); $endswith = array('ini', 'php'); if (isset($this->options['feed_excluded_exts']) && !empty($this->options['feed_excluded_exts'])) { $endswith = array_unique(array_merge($endswith, preg_split('/(, |,)/', trim($this->options['feed_excluded_exts']), -1, PREG_SPLIT_NO_EMPTY))); } $excludestrings = array(); if (isset($this->options['feed_excluded_files']) && !empty($this->options['feed_excluded_files'])) { $excludestrings = preg_split('/(, |,)/', trim($this->options['feed_excluded_files']), -1, PREG_SPLIT_NO_EMPTY); } if (!isset($this->options['feeds']) || !$this->options['feeds'] || trim($this->options['feeds']) == '' || trim($this->options['feeds']) == '/') { return; } fileaway_utility::timezone(); $storage = $rootpath . trim(trim($this->options['feeds']), '/'); if (!is_dir($storage)) { if (mkdir($storage, 0775, true)) { fileaway_utility::indexmulti($storage, $chosenpath); } } $globallogo = false; if (is_file($storage . '/fa-feed-logo.png')) { $globallogo = $storage . '/fa-feed-logo.png'; } elseif (is_file($storage . '/fa-feed-logo.jpg')) { $globallogo = $storage . '/fa-feed-logo.jpg'; } elseif (is_file($storage . '/fa-feed-logo.gif')) { $globallogo = $storage . '/fa-feed-logo.gif'; } if ($globallogo) { $globallogo = fileaway_utility::urlesc(fileaway_utility::replacefirst($globallogo, rtrim($rootpath, '/'), rtrim($this->options['baseurl'], '/') . '/')); } $feedlimit = isset($this->options['feedlimit']) && is_numeric($this->options['feedlimit']) ? round($this->options['feedlimit'], 0) : false; $hardlinks = array(); $map = is_file($storage . '/fa-directory-map.csv') ? new fileaway_csv($storage . '/fa-directory-map.csv') : false; $now = time(); foreach ($basedirs as $basedir) { $basedir = $rootpath . trim(trim($basedir), '/'); $dirs = fileaway_utility::recursivedirs($basedir); array_unshift($dirs, $basedir); $datestring = $this->options['daymonth'] == 'md' ? 'm/d/Y H:i' : 'd/m/Y H:i'; foreach ($dirs as $k => $dir) { foreach ($wp_excludes as $wp) { if (stripos($dir, $wp) !== false) { continue 2; } } $feedfile = $dir . '/_fa.feed.id.ini'; if (!is_file($feedfile)) { $feedid = uniqid(true); $feedfile_contents = "; Do not move or delete this file, nor alter its contents \n" . "id = " . $feedid; file_put_contents($feedfile, $feedfile_contents); } else { $ini = parse_ini_file($feedfile); $feedid = $ini['id']; } $feed = $storage . '/_feed_' . $feedid . '.xml'; if (fileaway_utility::startswith(fileaway_utility::replacefirst($dir, $rootpath, ''), $excluded_dirs)) { if (is_file($feed)) { unlink($feed); } continue; } $feedlogo = false; if (is_file($dir . '/fa-feed-logo.png')) { $feedlogo = $dir . '/fa-feed-logo.png'; } elseif (is_file($dir . '/fa-feed-logo.jpg')) { $feedlogo = $dir . '/fa-feed-logo.jpg'; } elseif (is_file($dir . '/fa-feed-logo.gif')) { $feedlogo = $dir . '/fa-feed-logo.gif'; } $feedlogo = $feedlogo ? fileaway_utility::urlesc(fileaway_utility::replacefirst($feedlogo, rtrim($rootpath, '/'), rtrim($this->options['baseurl'], '/') . '/')) : $globallogo; $files = array(); $subxml = array(); $initfiles = array_filter(glob("{$dir}/*"), 'is_file'); if ($this->options['recursivefeeds'] == 'true') { $initdirs = glob("{$dir}/*", GLOB_ONLYDIR); if (is_array($initdirs) && count($initdirs) > 0) { foreach ($initdirs as $subdir) { if (in_array(fileaway_utility::replacefirst($subdir, $rootpath, ''), $excluded_dirs)) { continue; } $subfeedfile = $subdir . '/_fa.feed.id.ini'; if (!is_file($subfeedfile)) { continue; } $subini = parse_ini_file($subfeedfile); $subfeedid = $subini['id']; $subfeed = $storage . '/_feed_' . $subfeedid . '.xml'; if (!is_file($subfeed)) { continue; } $sublink = $map ? $this->csvsearch($map->data, $map->titles, trim(fileaway_utility::replacefirst($subdir, $rootpath, ''), '/')) : false; $sublink = $sublink ? $sublink : fileaway_utility::replacefirst($subfeed, $rootpath, rtrim($this->options['baseurl'], '/') . '/'); $subPubDate = $this->options['feeddates'] == 'false' ? null : "<pubDate>" . date($datestring, filemtime($subdir)) . "</pubDate>\n" . ($subxml[] = "<item>\n" . "<title>" . fileaway_utility::basename($subdir) . "</title>\n" . "<link>" . $sublink . "</link>\n" . "<description>RSS Feed</description>\n" . $subPubDate . "</item>\n"); } } } if (is_array($initfiles)) { foreach ($initfiles as $i => $file) { if (fileaway_utility::startswith(fileaway_utility::basename($file), $startswith)) { unset($initfiles[$i]); continue; } if (fileaway_utility::endswith(strtolower(fileaway_utility::basename($file)), $endswith)) { unset($initfiles[$i]); continue; } foreach ($excludestrings as $str) { if (strpos(fileaway_utility::basename($file), $str) !== false) { unset($initfiles[$i]); continue 2; } } $mime = false; $parts = fileaway_utility::pathinfo($file); $ext = strtolower($parts['extension']); if ($this->options['feedlinks'] != 'false') { if (in_array($ext, array('mp3', 'wav', 'ogg'))) { $mime = $ext == 'mp3' ? 'audio/mpeg' : ($ext == 'wav' ? 'audio/vnd.wave' : 'audio/ogg'); } elseif (in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) { $mime = $ext == 'png' ? 'image/png' : ($ext == 'gif' ? 'image/gif' : 'image/jpeg'); } elseif (in_array($ext, array('avi', 'mpeg', 'mp4', 'ogv', 'mov', 'webm', 'flv', 'wmv', 'mkv'))) { $mime = $ext == 'avi' ? 'video/avi' : ($ext == 'mp4' ? 'video/mp4' : ($ext == 'flv' ? 'video/x-flv' : ($ext == 'mpeg' ? 'video/mpeg' : ($ext == 'ogv' ? 'video/ogg' : ($ext == 'mov' ? 'video/quicktime' : ($ext == 'webm' ? 'video/webm' : ($ext == 'wmv' ? 'video/x-ms-wmv' : 'video/x-matroska'))))))); } if (stripos($file, 's2member-files/')) { $getsub = explode('s2member-files/', fileaway_utility::urlesc($file)); $fileurl = rtrim($this->options['baseurl'], '/') . '/?s2member_file_download=' . $getsub[1]; } else { $fileurl = fileaway_utility::urlesc(fileaway_utility::replacefirst($file, $rootpath, rtrim($this->options['baseurl'], '/') . '/')); } } else { $fileurl = false; } $files['dirname'][] = $parts['dirname']; $files['basename'][] = $parts['basename']; $files['filename'][] = $parts['filename']; $files['extension'][] = $parts['extension']; $files['mime'][] = $mime; $files['datemodified'][] = $this->options['feeddates'] != 'false' ? filemtime($file) : $now; $files['filesize'][] = $this->options['feedsize'] != 'false' ? filesize($file) : false; $files['url'][] = $fileurl; } if (isset($files['datemodified']) && count($files['datemodified']) > 0) { array_multisort($files['datemodified'], SORT_DESC, SORT_NUMERIC, $files['dirname'], $files['basename'], $files['filename'], $files['extension'], $files['mime'], $files['filesize'], $files['url']); } $directory = explode('/', $dir); $directory = array_pop($directory); $stripped_url = str_ireplace(array('http:', 'https:', 'www.', 'ww2.', '//'), '', rtrim($this->options['baseurl'], '/')); $ttl = $this->options['feedinterval'] == 'fifteenminutes' ? 15 : ($this->options['feedinterval'] == 'thirtyminutes' ? 30 : ($this->options['feedinterval'] == 'fortyfiveminutes' ? 45 : 60)); $channellink = $map ? $this->csvsearch($map->data, $map->titles, trim(fileaway_utility::replacefirst($dir, $rootpath, ''), '/')) : $this->options['baseurl']; $description = $channellink ? $channellink : fileaway_utility::replacefirst($dir, $rootpath, rtrim($this->options['baseurl'], '/') . '/'); $channellink = $channellink ? $channellink : $this->options['baseurl']; $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" . "<rss version=\"2.0\">\n" . "<channel>\n" . "<title>" . $stripped_url . " > " . $directory . "</title>\n" . "<link>" . $channellink . "</link>\n" . "<description>" . $description . "</description>\n" . "<lastBuildDate>" . date($datestring) . "</lastBuildDate>\n" . "<pubDate>" . date($datestring) . "</pubDate>\n" . "<ttl>" . $ttl . "</ttl>\n" . "<generator>File Away</generator>\n"; if ($feedlogo) { $xml .= "<image>\n" . "<url>" . $feedlogo . "</url>\n" . "<title>" . str_replace(array('http://', 'https://', 'www.'), '', $this->options['baseurl']) . " > " . $directory . "</title>\n" . "<link>" . $this->options['baseurl'] . "</link>\n" . "</image>\n"; } if (count($subxml > 0)) { $xml .= implode($subxml); } if (isset($files['datemodified']) && count($files['datemodified']) > 0) { foreach ($files['datemodified'] as $k => $file) { if ($feedlimit && $k >= $feedlimit) { break; } $rawname = str_replace('&', 'and', $files['filename'][$k]); if (preg_match('/\\[([^\\]]+)\\]/', $rawname)) { list($thename, $customvalue) = preg_split("/[\\[\\]]/", $rawname); $customvalue = str_replace(array('~', '--', '_', '.', '*'), ' ', $customvalue); $customvalue = preg_replace('/(?<=\\D)-(?=\\D)/', ' ', "{$customvalue}"); $customvalue = preg_replace('/(?<=\\d)-(?=\\D)/', ' ', "{$customvalue}"); $customvalue = preg_replace('/(?<=\\D)-(?=\\d)/', ' ', "{$customvalue}"); $thename = str_replace(array('~', '--', '_', '.', '*'), ' ', $thename); } else { $customvalue = false; $thename = str_replace(array('~', '--', '_', '.', '*'), ' ', $rawname); } $thename = preg_replace('/(?<=\\D)-(?=\\D)/', ' ', "{$thename}"); $thename = preg_replace('/(?<=\\d)-(?=\\D)/', ' ', "{$thename}"); $thename = preg_replace('/(?<=\\D)-(?=\\d)/', ' ', "{$thename}"); $showsize = $this->options['feedsize'] == 'false' ? null : "Size: " . fileaway_utility::formatBytes($files['filesize'][$k]) . "."; $filedescription = $customvalue ? $customvalue . ' (' . $files['extension'][$k] . " file. " . $showsize : $files['extension'][$k] . " file. " . $showsize; $pubDate = $this->options['feeddates'] == 'false' ? null : "<pubDate>" . date($datestring, $file) . "</pubDate>\n"; $filelink = $files['url'][$k] ? $files['url'][$k] : $channellink; $xml .= "<item>\n" . "<title>" . $thename . "</title>\n" . "<link>" . $filelink . "</link>\n" . "<description>" . $filedescription . "</description>\n" . $pubDate; if ($files['mime'][$k]) { $xml .= "<enclosure url=\"" . $files['url'][$k] . "\" length=\"" . $files['filesize'][$k] . "\" type=\"" . $files['mime'][$k] . "\" />\n"; } $xml .= "</item>\n"; } } $xml .= "</channel>\n" . "</rss>"; $oldfeed = file_get_contents($feed); if ($xml != $oldfeed) { file_put_contents($feed, $xml); } } } } date_default_timezone_set('UTC'); exit; }
public function manager() { $dm = 'Go directly to jail. Do not pass GO. Do not collect $200 dollars.'; if (!wp_verify_nonce($_POST['nonce'], 'fileaway-nonce')) { die($dm); } $li = is_user_logged_in(); extract($this->pathoptions); $action = $_POST['act']; // Flightbox if ($action === 'flightbox') { if (!wp_verify_nonce($_POST['flightbox_nonce'], 'fileaway-flightbox-nonce')) { die($dm); } list($url, $query) = explode('?boxtype=', $_POST['url']); $src = $url; $query = 'boxtype=' . $query; parse_str($query); if (($s2 == 'true' || $s2 == 'skip') && $g == 'false') { $s2skip = $s2 == 'skip' ? '&s2member_skip_confirmation' : ''; $init = fileaway_utility::replacefirst($url, rtrim($this->settings['baseurl'], '/') . '/', $rootpath); $sub = fileaway_utility::replacefirst($init, WP_PLUGIN_DIR . '/s2member-files/', ''); $url = rtrim($this->settings['baseurl'], '/') . '/?s2member_file_download=' . $sub . $s2skip; } $url = $g == 'true' ? $this->settings['redirect'] : $url; $statstatus = $s == 'true' ? ' data-stat="true"' : ' data-stat="false"'; $linktype = $g == 'true' || $GLOBALS['is_IE'] || $GLOBALS['is_safari'] ? 'target="_blank"' : 'download'; $uid = (string) $_POST['uid']; $icons = (string) $_POST['icons']; $next = stripslashes($_POST['next']); $prev = stripslashes($_POST['prev']); $current = stripslashes($_POST['current']); $nolinks = $_POST['nolinks'] == 'true' ? true : false; $wh = $_POST['wh']; $ww = $_POST['ww']; if ($wh > 1000) { $font = 20; $bar = 40; $mrg = 20; } elseif ($wh > 800) { $font = 16; $bar = 32; $mrg = 16; } elseif ($wh > 600) { $font = 14; $bar = 28; $mrg = 14; } elseif ($wh > 400) { $font = 12; $bar = 24; $mrg = 12; } else { $font = 8; $bar = 20; $mrg = 8; } if ($boxtype == 'image') { if ($wh < $mh + 150) { $mh = $wh - 150; } if ($ww < $mw) { $mw = $ww - 150; } if ($d == 'width') { $ratio = $w / $h; $width = $w < $mw ? $w : $mw; $height = round($width / $ratio, 0); if ($height > $mh) { $d = 'height'; } } if ($d == 'height') { $ratio = $h / $w; $height = $h < $mh ? $h : $mh; $width = round($height / $ratio, 0); } if ($width < 200) { $offset = ($ww - 230) / 2; $cwidth = 200 + 30; $cheight = $height + $bar + 30; } else { $offset = ($ww - ($width + 30)) / 2; $cwidth = $width + 30; $cheight = $height + $bar + 30; } $csize = 'width:' . $cwidth . 'px; height:' . $cheight . 'px;'; $isize = 'width:' . $width . 'px; height:' . $height . 'px;'; $top = $wh < $height + $bar + 30 ? '0' : ($wh - ($height + $bar + 30)) / 2; $download_link = $nolinks ? null : '<a href="' . $url . '" class="ssfa-flightbox-download" ' . $linktype . $statstatus . '>' . '<span class="ssfa-icon-arrow-down-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>'; $response = array('html' => '<div id="ssfa-flightbox" class="' . $_POST['theme'] . '" style="display:inline-block; ' . $csize . ' left:' . $offset . 'px; top:' . $top . 'px; padding:0px!important;">' . '<div id="ssfa-flightbox-inner" style="opacity:0; margin: 15px 15px 0!important;">' . '<a href="' . $_POST['nexturl'] . '" onclick="' . $next . '"><img src="' . $src . '" style="' . $isize . '"></a>' . '</div>' . '<div class="ssfa-flightbox-controls ' . $icons . '" style="margin:' . $mrg . 'px 15px!important; display:block; text-align:right;">' . '<a href="' . $_POST['prevurl'] . '" onclick="' . $prev . '">' . '<span class="ssfa-icon-arrow-left-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>' . '<a href="' . $_POST['nexturl'] . '" onclick="' . $next . '">' . '<span class="ssfa-icon-arrow-right-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>' . $download_link . '<a href="javascript:" onclick="Xflightbox();">' . '<span class="ssfa-icon-console-2" style="font-size:' . $font . 'px; margin-right:0; display:inline-block;"></span>' . '</a>' . '</div>' . '</div>', 'width' => $cwidth . 'px', 'height' => $cheight . 'px', 'top' => $top . 'px', 'offset' => $offset . 'px', 'iframe' => 'false'); } elseif ($boxtype == 'video') { $is_iframe = 'true'; $ratio = 1920 / 1080; $height = round($w / $ratio, 0); if ($wh < $height + 150) { $height = $wh - 150; $w = round($height * $ratio, 0); } $csize = 'width:' . ($w + 30) . 'px; height:' . ($height + $bar + 30) . 'px;'; $top = $wh < $height + $bar + 30 ? '0' : ($wh - ($height + $bar + 30)) / 2; $offset = ($ww - ($w + 30)) / 2; if ($e == 'vmeo') { $download = null; $vimeo = explode('vimeo.com/', $src); $vid_id = $vimeo[1]; $video = '<iframe src="//player.vimeo.com/video/' . $vid_id . '?title=0&byline=0&portrait=0&color=ffffff&autoplay=0" ' . 'width="' . $w . '" height="' . $height . '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; } elseif ($e == 'tube') { $download = null; if (stripos($src, 'youtu.be/') !== false) { $youtube = explode('youtu.be/', $src); $yt = explode('?', $youtube[1]); $vid_id = $yt[0]; } else { $youtube = explode('?', $src); parse_str($youtube[1], $yt); $vid_id = $yt['v']; } $video = '<iframe width="' . $w . '" height="' . $height . '" src="//www.youtube.com/embed/' . $vid_id . '?rel=0" frameborder="0" allowfullscreen></iframe>'; } elseif ($e == 'flv') { $is_iframe = 'false'; $download = $nolinks ? null : '<a href="' . $url . '" class="ssfa-flightbox-download" ' . $linktype . $statstatus . '>' . '<span class="ssfa-icon-arrow-down-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>'; $video = '<object type="application/x-shockwave-flash" data="' . fileaway_url . '/lib/swf/player_flv_maxi.swf" width="' . $w . '" height="' . $height . '">' . '<param name="movie" value="' . fileaway_url . '/lib/swf/player_flv_maxi.swf" />' . '<param name="allowFullScreen" value="true" />' . '<param name="FlashVars" ' . 'value="flv=' . $src . '&margin=0' . '&bgcolor=000000&' . 'amp;bgcolor1=000000' . '&bgcolor2=000000' . '&showstop=1' . '&showvolume=1' . '&showtime=1' . '&showfullscreen=1' . '&buttonovercolor=ffffff' . '&sliderovercolor=ffffff' . '&showiconplay=1' . '&showmouse=autohide" ' . '/>' . '</object>'; } else { $is_iframe = 'false'; $download = $nolinks ? null : '<a href="' . $url . '" class="ssfa-flightbox-download" ' . $linktype . $statstatus . '>' . '<span class="ssfa-icon-arrow-down-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>'; $video = fileaway_utility::video(array('src' => $src, 'height' => $height, 'width' => $w, 'class' => 'ssfa-flightbox-video-player', 'preload' => 'none', 'id' => uniqid('flightbox-video-'))); } $response = array('html' => '<div id="ssfa-flightbox" class="' . $_POST['theme'] . '" style="display:inline-block; ' . $csize . ' left:' . $offset . 'px; top:' . $top . 'px; padding:0!important;">' . '<div id="ssfa-flightbox-inner" style="opacity:0; margin: 15px 15px 0!important;">' . $video . '</div>' . '<div class="ssfa-flightbox-controls ' . $icons . '" style="margin:' . $mrg . 'px 15px!important; display:block; text-align:right;">' . '<a href="' . $_POST['prevurl'] . '" onclick="' . $prev . '">' . '<span class="ssfa-icon-arrow-left-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>' . '<a href="' . $_POST['nexturl'] . '" onclick="' . $next . '">' . '<span class="ssfa-icon-arrow-right-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>' . $download . '<a href="javascript:" onclick="Xflightbox();">' . '<span class="ssfa-icon-console-2" style="font-size:' . $font . 'px; margin-right:0; display:inline-block;"></span>' . '</a>' . '</div>' . '</div>', 'width' => $w + 30 . 'px', 'height' => $height + $bar + 30 . 'px', 'top' => $top . 'px', 'offset' => $offset . 'px', 'iframe' => $is_iframe, 'iwidth' => $w, 'iheight' => $height); } elseif ($boxtype == 'pdf') { $of = $wh < 720 ? 100 : ($wh < 400 ? 50 : 200); if ($r == 'tall') { $ratio = 22 / 17; $height = $wh - $of; $width = round($height / $ratio, 0); $rotate = 'expand'; $current = str_replace('&r=tall', '&r=wide', $current); $currenturl = str_replace('&r=tall', '&r=wide', $_POST['currenturl']); } else { $ratio = 22 / (17 / 1.5); $height = $wh - $of; $width = round($height * $ratio, 0); while ($width > $ww - $of) { $width = $width - 10; } $rotate = 'contract'; $current = str_replace('&r=wide', '&r=tall', $current); $currenturl = str_replace('&r=wide', '&r=tall', $_POST['currenturl']); } if ($width < 200) { $width = 200; } $csize = 'width:' . ($width + 30) . 'px; height:' . ($height + $bar + 30) . 'px;'; $top = $wh < $height + $bar + 30 ? '0' : ($wh - ($height + $bar + 30)) / 2; $offset = ($ww - ($width + 30)) / 2; $download_link = $nolinks ? null : '<a href="' . $url . '" class="ssfa-flightbox-download" ' . $linktype . $statstatus . '>' . '<span class="ssfa-icon-arrow-down-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>'; $response = array('html' => '<div id="ssfa-flightbox" class="' . $_POST['theme'] . '" style="display:inline-block; ' . $csize . ' left:' . $offset . 'px; top:' . $top . 'px; padding:0!important;">' . '<div id="ssfa-flightbox-inner" style="opacity:0; margin: 15px 15px 0!important;">' . '<iframe src="' . $src . '" frameborder=0 height="' . $height . '" width="' . $width . '" name="' . fileaway_utility::basename($src) . '" scrolling="no" seamless>' . 'Your browser does not support iframes.' . '</iframe>' . '</div>' . '<div class="ssfa-flightbox-controls ' . $icons . '" style="margin:' . $mrg . 'px 15px!important; display:block; text-align:right;">' . '<a href="' . $_POST['prevurl'] . '" onclick="' . $prev . '">' . '<span class="ssfa-icon-arrow-left-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>' . '<a href="' . $_POST['nexturl'] . '" onclick="' . $next . '">' . '<span class="ssfa-icon-arrow-right-2" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>' . '<a href="' . $currenturl . '" onclick="' . $current . '">' . '<span class="ssfa-icon-' . $rotate . '" style="font-size:' . $font . 'px; margin-right:5px; display:inline-block;"></span>' . '</a>' . $download_link . '<a href="javascript:" onclick="Xflightbox();">' . '<span class="ssfa-icon-console-2" style="font-size:' . $font . 'px; margin-right:0; display:inline-block;"></span>' . '</a>' . '</div>' . '</div>', 'width' => $width + 30 . 'px', 'height' => $height + $bar + 30 . 'px', 'top' => $top . 'px', 'offset' => $offset . 'px', 'iframe' => 'true', 'iwidth' => $width, 'iheight' => $height); } } elseif ($action === 'createdir') { if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } $parents = stripslashes(trim(str_replace('..', '', $_POST['parents']), '/')); $newsub = stripslashes(trim(str_replace('..', '', $_POST['newsub']), '/')); $uid = $_POST['uid']; $count = $_POST['count']; $page = $_POST['pg']; $querystring = ltrim($_POST['querystring'], '?'); $drawericon = $_POST['drawer']; $drawerid = $_POST['drawerid']; $cells = $_POST['cells']; $class = $_POST['cls']; $base = $_POST['base']; $subs = explode('/', $newsub); $first = $subs[0]; $last = $subs[count($subs) - 1]; $start = trim(fileaway_utility::replacefirst($parents, $base, '') . '/' . $first, '/'); $drawer = str_replace('/', '*', $start); $final = $rootpath . $parents . '/' . $newsub; $prettyfolder = str_replace(array('~', '--', '_', '.', '*'), ' ', "{$first}"); $prettyfolder = preg_replace('/(?<=\\D)-(?=\\D)/', ' ', "{$prettyfolder}"); $prettyfolder = preg_replace('/(?<=\\D)-(?=\\d)/', ' ', "{$prettyfolder}"); $prettyfolder = preg_replace('/(?<=\\d)-(?=\\D)/', ' ', "{$prettyfolder}"); $prettyfolder = fileaway_utility::strtotitle($prettyfolder); if (is_dir($final)) { $response = array('status' => 'error', 'message' => __('That directory name already exists in this location.', 'file-away')); } else { $first_exists = is_dir($rootpath . $parents . '/' . $first) ? true : false; if (mkdir($final, 0755, true)) { fileaway_utility::indexmulti($rootpath . $parents . '/' . $newsub, $rootpath . $parents . '/'); if (!$first_exists) { $status = "insert"; $message = "<tr id='ssfa-dir-{$uid}-{$count}' class='ssfa-drawers'>" . "<td id='folder-ssfa-dir-{$uid}-{$count}' data-value=\"# # # # # {$first}\" class='ssfa-sorttype {$class}-first-column'>" . "<a href=\"" . fileaway_utility::querystring(get_permalink($page), $querystring, array($drawerid => $drawer)) . "\" data-name=\"" . $first . "\" data-path=\"" . $start . "\">" . "<span style='font-size:20px; margin-left:3px;' class='ssfa-faminicon ssfa-icon-{$drawericon} ssfa-classic' aria-hidden='true'></span>" . "<br>" . _x('dir', 'abbrv. of *directory*', 'file-away') . "</a>" . "</td>" . "<td id='name-ssfa-dir-{$uid}-{$count}' data-value='# # # # # {$first}' class='ssfa-sortname'>" . "<a class='ssfa-classic' href=\"" . fileaway_utility::querystring(get_permalink($page), $querystring, array($drawerid => $drawer)) . "\">" . "<span class='ssfa-filename' style='text-transform:uppercase;'>{$prettyfolder}</span>" . "</a>" . "<input type='text' id='rename-ssfa-dir-{$uid}-{$count}' type='text' value=\"{$first}\" " . "style='width:90%; text-align:center; display:none'>" . "</td>"; $icell = 1; while ($icell < $cells) { $message .= "<td class='{$class}' data-value=\"# # # # # {$first}\"> </td>"; $icell++; } $message .= "<td id='manager-ssfa-dir-{$uid}-{$count}' class=\"{$class}\" data-value=\"# # # # # {$first}\">" . "<a href='' id='rename-ssfa-dir-{$uid}-{$count}'>" . __('Rename', 'file-away') . "</a><br>" . "<a href='' id='delete-ssfa-dir-{$uid}-{$count}'>" . __('Delete', 'file-away') . "</a>" . "</td>"; $message .= "</tr>"; } else { $status = "success"; $message = __('Your sub-directories have been successfully created.', 'file-away'); } $response = array('status' => $status, 'message' => $message, 'uid' => $uid); } else { $response = array('status' => 'error', 'message' => __('Sorry, there was a problem creating that directory for you.', 'file-away')); } } } elseif ($action === 'renamedir') { global $wpdb; if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } $table = fileaway_stats::$db; $table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$table}'") != $table ? false : true; $meta_table = fileaway_metadata::$db; $meta_table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$meta_table}'") != $meta_table ? false : true; $metadata = $_POST['metadata'] == 'true' ? true : false; $oldpath = stripslashes(trim(str_replace('..', '', $_POST['oldpath']), '/')); $newname = stripslashes(str_replace(array('..', '/'), '', $_POST['newname'])); $pp = explode('/', $oldpath); $newpath = fileaway_utility::replacelast($oldpath, end($pp), $newname); $olddata = $_POST['datapath']; $datapp = explode('/', $olddata); $newdata = fileaway_utility::replacelast($olddata, end($datapp), $newname); $parents = stripslashes($_POST['parents']); $old = $parents . '/' . end($pp); $dst = $rootpath . $newpath; $src = $rootpath . $old; $check_path = trim(str_replace('/', '', $newpath)); if ($rootpath . $check_path == $rootpath || $rootpath . $check_path == $rootpath . 'wp-content' || strpos($check_path, 'wp-admin') !== false || strpos($check_path, 'wp-includes') !== false) { die($dm); } $page = $_POST['pg']; $querystring = ltrim($_POST['querystring'], '?'); $drawer = str_replace('/', '*', $newdata); $drawerid = $_POST['drawerid']; $newurl = fileaway_utility::querystring(get_permalink($page), $querystring, array($drawerid => $drawer)); $response = false; if (is_dir($dst)) { $response = array('status' => 'error', 'message' => __('That directory already exists.', 'file-away')); } elseif (!is_dir($src)) { $response = array('status' => 'error', 'message' => __('The directory you\'re trying to rename could not be found.', 'file-away')); } else { if (!is_dir("{$dst}")) { mkdir("{$dst}", 0755, true); } $dirs = fileaway_utility::recursivedirs($src); if (is_array($dirs)) { $dirs = array_reverse($dirs); $fcount = 0; $fscount = 0; $dcount = 1; $dscount = 0; foreach ($dirs as $dir) { $dcount++; $files = false; $filedest = str_replace("{$src}", "{$dst}", "{$dir}"); if (!is_dir($filedest)) { mkdir("{$filedest}", 0755, true); } $files = array_filter(glob("{$dir}" . "/*"), 'is_file'); if (is_array($files)) { foreach ($files as $file) { $fcount++; $filename = fileaway_utility::basename($file); if (rename("{$file}", "{$filedest}" . "/" . "{$filename}")) { $fscount++; if ($table_exists) { fileaway_utility::updatestats('file', fileaway_utility::replacefirst($file, $rootpath, ''), fileaway_utility::replacefirst($filedest . '/' . $filename, $rootpath, '')); } if ($metadata && $meta_table_exists) { fileaway_utility::updatemetadata(false, fileaway_utility::replacefirst($file, $rootpath, ''), fileaway_utility::replacefirst($filedest . '/' . $filename, $rootpath, '')); } } } } if (rmdir($dir)) { $dscount++; } } } $basefiles = array_filter(glob("{$src}" . "/*"), 'is_file'); if (is_array($basefiles)) { foreach ($basefiles as $file) { $fcount++; $filename = fileaway_utility::basename($file); if (rename("{$file}", "{$dst}" . "/" . "{$filename}")) { $fscount++; if ($table_exists) { fileaway_utility::updatestats('file', fileaway_utility::replacefirst($file, $rootpath, ''), fileaway_utility::replacefirst($dst . '/' . $filename, $rootpath, '')); } if ($metadata && $meta_table_exists) { fileaway_utility::updatemetadata(false, fileaway_utility::replacefirst($file, $rootpath, ''), fileaway_utility::replacefirst($dst . '/' . $filename, $rootpath, '')); } } } } if (rmdir($src)) { $dscount++; } if ($fcount > 0 && !$fscount) { $response = array('status' => 'error', 'message' => __('We tried to move the files into the newly-named directory but none of them would budge.', 'file-away')); } elseif ($fcount > 0 && $fcount > $fscount) { $response = array('status' => 'error', 'message' => __('We tried to move the files into the newly-named directory, but there were some stragglers, so we couldn\'t remove the old directory.', 'file-away')); } elseif (!is_dir($src)) { $response = array('status' => 'success', 'url' => $newurl, 'newdata' => $newdata, 'newname' => $newname); } else { $response = array('status' => 'error', 'message' => __('An unspecified error occurred.', 'file-away')); } } } elseif ($action === 'deletedir') { if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } $status = $_POST['status']; $path1 = $_POST['path1']; $path2 = $_POST['path2']; $path = stripslashes($path1 . '/' . $path2); $src = $rootpath . $path; if ($src == $rootpath || $src == $rootpath . 'wp-content' || strpos($src, 'wp-admin') !== false || strpos($src, 'wp-includes') !== false) { die($dm); } $response = false; if (!is_dir("{$src}")) { $response = array('status' => 'error', 'message' => __('The directory marked for deletion could not be found.', 'file-away') . ' ' . $path); } else { $dirs = fileaway_utility::recursivedirs($src); $dirs = is_array($dirs) ? array_reverse($dirs) : $dirs; if ($status === 'life') { $dcount = 0; $fcount = 0; if (is_array($dirs)) { foreach ($dirs as $dir) { $dcount++; $files = false; $files = array_filter(glob("{$dir}" . "/*"), 'is_file'); if (is_array($files)) { foreach ($files as $file) { $fcount++; } } } } $basefiles = array_filter(glob("{$src}" . "/*"), 'is_file'); if (is_array($basefiles)) { foreach ($basefiles as $file) { $fcount++; } } if ($fcount == 0) { $status = 'death'; } else { $filemsg = null; if ($fcount >= 1) { $plufiles = $fcount > 1 ? _x('files', 'plural', 'file-away') : _x('file', 'singular', 'file-away'); $filemsg = ' ' . __('and', 'file-away') . ' ' . $fcount . ' ' . $plufiles; } $dirmsg = null; if ($dcount >= 1) { $pludirs = $dcount > 1 ? _x('sub-directories', 'plural', 'file-away') : _x('sub-directory', 'singular', 'file-away'); $dirmsg = ', ' . $dcount . ' ' . $pludirs; } $message = sprintf(_x('You are about to delete 1 directory%s from the server. ' . 'This action is permanent and cannot be undone. Are you sure you wish to proceed?', 'Do not put a space between *directory* and the %s variable', 'file-away'), $dirmsg . $filemsg); $response = array('status' => 'confirm', 'message' => $message); } } if ($status === 'death') { $pcount = 1; $pscount = 0; $dcount = 0; $dscount = 0; $fcount = 0; $fscount = 0; if (is_array($dirs)) { foreach ($dirs as $dir) { $dcount++; $files = false; $files = array_filter(glob("{$dir}" . "/*"), 'is_file'); if (is_array($files)) { foreach ($files as $file) { $fcount++; $file = realpath($file); if (is_readable($file)) { if (unlink($file)) { $fscount++; } } } } if (rmdir($dir)) { $dscount++; } } } $basefiles = array_filter(glob("{$src}" . "/*"), 'is_file'); if (is_array($basefiles)) { foreach ($basefiles as $file) { $fcount++; $file = realpath($file); if (is_readable($file)) { if (unlink($file)) { $fscount++; } } } } if (rmdir($src)) { $pscount++; } if ($pscount && $fscount || $pscount && !$fcount) { $success = $pscount == $pcount && $dscount == $dcount && $fscount == $fcount ? 'success' : 'partial'; $success = $fscount == $fcount && !$fcount ? 'success-single' : $success; $filemsg = null; if ($fcount >= 1) { $plufiles = $fcount > 1 ? _x('files', 'plural', 'file-away') : _x('file', 'singular', 'file-away'); $filemsg = ' ' . __('and', 'file-away') . ' ' . $fscount . ' ' . __('of', 'file-away') . ' ' . $fcount . ' ' . $plufiles; } else { $filemsg = ' ' . sprintf(__('and %d files', 'file-away'), $fcount); } $dirmsg = null; if ($dcount >= 1) { $pludirs = $dcount > 1 ? _x('sub-directories', 'plural', 'file-away') : _x('sub-directory', 'singular', 'file-away'); $dirmsg = ', ' . $dscount . ' ' . __('of', 'file-away') . ' ' . $dcount . ' ' . $pludirs; } $message = sprintf(_x('%d of 1 directory%s have been removed from the server.', 'Do not put a space between *directory* and the %s variable', 'file-away'), $pscount, $dirmsg . $filemsg); $response = array('status' => $success, 'message' => $message); } else { $response = array('status' => 'error', 'message' => __('Sorry, but there was an error attempting to remove this directory.', 'file-away')); } } } } elseif ($action === 'rename') { if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } global $wpdb; $table = fileaway_stats::$db; $table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$table}'") != $table ? false : true; $meta_table = fileaway_metadata::$db; $meta_table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$meta_table}'") != $meta_table ? false : true; $metadata = $_POST['metadata'] == 'true' ? true : false; $url = stripslashes($_POST['url']); $pp = $problemchild ? fileaway_utility::replacefirst(stripslashes($_POST['pp']), $install, '') : stripslashes($_POST['pp']); $oldname = stripslashes($_POST['oldname']); $rawname = stripslashes($_POST['rawname']); $ext = $_POST['ext']; if (strpos(strtolower($ext), 'php') !== false) { die($dm); } if (strpos($url, '.' . $ext . '?type=') !== false) { list($url, $querystring) = explode('?', $url); $querystring = '?' . $querystring; } else { $querystring = ''; } $oldfile = $chosenpath . "{$pp}/{$oldname}.{$ext}"; $customdata = isset($_POST['customdata']) ? $_POST['customdata'] : array(); if (!$metadata) { $not_empty = false; if (is_array($customdata)) { $customd = array(); foreach ($customdata as $datum) { $customd[] = stripslashes($datum); if (stripslashes($datum) != '') { $not_empty = true; } } } $customd = $not_empty ? stripslashes(implode(',', $customdata)) : ''; if ($customd !== '') { $customd = " [{$customd}]"; } else { $customd = ''; } $newfile = $chosenpath . "{$pp}/{$rawname}{$customd}.{$ext}"; if ($newfile !== $oldfile) { $i = 1; while (is_file($newfile)) { if ($i == 1) { $rawname = "{$rawname}" . " ({$i})"; } else { $j = $i - 1; $rawname = rtrim("{$rawname}", " ({$j})"); $rawname = "{$rawname}" . " ({$i})"; } $i++; $newfile = $chosenpath . "{$pp}/{$rawname}{$customd}.{$ext}"; } } if ($customd !== '') { $customd = " [" . trim(ltrim(rtrim("{$customd}", "]"), " ["), " ") . "]"; } $newfile = $chosenpath . "{$pp}/" . trim("{$rawname}", ' ') . "{$customd}.{$ext}"; $newurl = str_replace("{$pp}/{$oldname}.{$ext}", "", fileaway_utility::urlesc("{$url}", true)); $newurl = fileaway_utility::urlesc("{$newurl}{$pp}/" . trim("{$rawname}") . "{$customd}.{$ext}"); $newoldname = trim("{$rawname}", ' ') . "{$customd}"; $download = trim("{$rawname}", ' ') . "{$customd}.{$ext}"; if (is_file("{$oldfile}")) { rename("{$oldfile}", "{$newfile}"); } $errors = is_file("{$newfile}") ? '' : __('The file was not renamed.', 'file-away'); if (is_file($newfile) && $table_exists) { fileaway_utility::updatestats('file', fileaway_utility::replacefirst($oldfile, $rootpath, ''), fileaway_utility::replacefirst($newfile, $rootpath, '')); } } else { $not_empty = false; if (is_array($customdata)) { $customd = array(); foreach ($customdata as $datum) { $customd[] = stripslashes($datum); if (stripslashes($datum) != '') { $not_empty = true; } } } $customdata = $not_empty ? $customd : ''; $newfile = $chosenpath . "{$pp}/{$rawname}.{$ext}"; if ($newfile !== $oldfile) { $i = 1; while (is_file($newfile)) { if ($i == 1) { $rawname = "{$rawname}" . " ({$i})"; } else { $j = $i - 1; $rawname = rtrim("{$rawname}", " ({$j})"); $rawname = "{$rawname}" . " ({$i})"; } $i++; $newfile = $chosenpath . "{$pp}/{$rawname}.{$ext}"; } } $newfile = $chosenpath . "{$pp}/" . trim("{$rawname}", ' ') . ".{$ext}"; $newurl = str_replace("{$pp}/{$oldname}.{$ext}", "", fileaway_utility::urlesc("{$url}", true)); $newurl = fileaway_utility::urlesc("{$newurl}{$pp}/" . trim("{$rawname}") . ".{$ext}"); $newoldname = trim("{$rawname}", ' '); $download = trim("{$rawname}", ' ') . ".{$ext}"; if (is_file("{$oldfile}")) { rename("{$oldfile}", "{$newfile}"); } $errors = is_file("{$newfile}") ? '' : __('The file was not renamed.', 'file-away'); if (is_file($newfile) && $table_exists) { fileaway_utility::updatestats('file', fileaway_utility::replacefirst($oldfile, $rootpath, ''), fileaway_utility::replacefirst($newfile, $rootpath, '')); } if (is_file($newfile) && $meta_table_exists) { fileaway_utility::updatemetadata($customdata, fileaway_utility::replacefirst($oldfile, $rootpath, ''), fileaway_utility::replacefirst($newfile, $rootpath, '')); } if ($customdata === '') { $customdata = array(); } } $response = array("errors" => $errors, "download" => $download, "pp" => $pp, "newurl" => $newurl . $querystring, "extension" => $ext, "oldfile" => $oldfile, "newfile" => $newfile, "rawname" => $rawname, "customdata" => $customdata, "newoldname" => $newoldname); } elseif ($action === 'delete') { if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } $pp = $_POST["pp"]; $oldname = $_POST["oldname"]; $ext = $_POST["ext"]; if (!in_array($ext, array('php', 'htaccess', 'htpasswd')) && strpos($oldname, 'wp-admin') === false && strpos($oldname, 'wp-config') === false && strpos($oldname, 'wp-includes') === false) { $oldfile = "{$rootpath}{$pp}/{$oldname}.{$ext}"; if (!is_file("{$oldfile}")) { $oldfile = stripslashes("{$oldfile}"); } if (is_file("{$oldfile}")) { if (unlink("{$oldfile}")) { $response = "success"; } else { $response = "error"; } } else { $response = "error"; } } else { $response = 'error'; } } elseif ($action == 'bulkdownload') { if (!wp_verify_nonce($_POST['bulkdownload_nonce'], 'fileaway-bulk-download-nonce')) { die($dm); } $files = $_POST["files"]; $stats = $_POST['stats']; $zipfiles = array(); $values = array(); if (is_array($files)) { foreach ($files as $file) { if (strpos($file, '..') !== false) { continue; } if (strpos($file, '/') === false) { continue; } if (strpos($file, '.php') !== false) { continue; } if (strpos($file, 'wp-config') !== false) { continue; } if (strpos($file, 'wp-admin') !== false) { continue; } if (strpos($file, 'wp-includes') !== false) { continue; } $file = $rootpath . stripslashes($file); if (file_exists($file)) { $zipfiles[] = $file; $values[] = fileaway_utility::basename($file); } } } $numvals = array_count_values($values); $prefix = isset($this->settings['download_prefix']) ? $this->settings['download_prefix'] : false; $prefix = $prefix && $prefix !== '' ? $prefix : date('Y-m-d', current_time('timestamp')); $time = uniqid(); $destination = fileaway_dir . '/temp'; if (!is_dir($destination)) { mkdir($destination); } $filename = stripslashes($prefix) . ' ' . $time . '.zip'; $link = fileaway_url . '/temp/' . $filename; $filename = $destination . '/' . $filename; if (count($zipfiles)) { $zip = new ZipArchive(); $zip->open($filename, ZipArchive::CREATE); foreach ($zipfiles as $k => $zipfile) { $zip->addFile($zipfile, fileaway_utility::basename($zipfile)); if ($numvals[fileaway_utility::basename($zipfile)] > 1) { $parts = fileaway_utility::pathinfo($zipfile); $zip->renameName(fileaway_utility::basename($zipfile), $parts['filename'] . '_' . $k . '.' . $parts['extension']); } } $zip->close(); } if ($stats == 'true' && count($zipfiles) > 0) { $stat = new fileaway_stats(); $ifiles = array(); foreach ($zipfiles as $zfile) { $zfile = fileaway_utility::replacefirst($zfile, $rootpath, ''); $ifiles[] = $zfile; $stat->insert($zfile, false); } $current = wp_get_current_user(); if ($this->settings['instant_stats'] == 'true') { $data = array('timestamp' => date('Y-m-d H:i:s', current_time('timestamp')), 'file' => count($ifiles) . ' ' . strtolower(_x('files', 'plural', 'file-away')), 'files' => "\r\n" . implode("\r\n", $ifiles), 'uid' => $current->ID, 'email' => $current->user_email, 'ip' => $_SERVER['REMOTE_ADDR'], 'agent' => $_SERVER['HTTP_USER_AGENT']); $stat->imail($data); } } $response = is_file($filename) ? $link : "Error"; } elseif ($action == 'bulkcopy') { if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } $from = $_POST['from']; $to = $_POST['to']; $ext = $_POST['exts']; $destination = $problemchild ? fileaway_utility::replacefirst(stripslashes($_POST['destination']), $install, '') : stripslashes($_POST['destination']); $success = 0; $total = 0; $renamers = 0; foreach ($from as $k => $fro) { $fro = stripslashes($fro); $to[$k] = stripslashes($to[$k]); $fro = $problemchild ? fileaway_utility::replacefirst("{$fro}", $install, '') : "{$fro}"; $to[$k] = $problemchild ? fileaway_utility::replacefirst("{$to[$k]}", $install, '') : "{$to[$k]}"; $total++; $newfile = $chosenpath . "{$to[$k]}"; if (is_file($chosenpath . "{$fro}") && is_file("{$newfile}")) { $i = 1; $noext = fileaway_utility::replacelast("{$newfile}", '.' . $ext[$k], ''); while (is_file("{$newfile}")) { if ($i == 1) { $noext = "{$noext}" . " ({$i})"; } else { $j = $i - 1; $noext = rtrim("{$noext}", " ({$j})"); $noext = "{$noext}" . " ({$i})"; } $i++; $newfile = "{$noext}" . '.' . $ext[$k]; } $renamers++; } if (is_file($chosenpath . "{$fro}") && !is_file("{$newfile}")) { copy($chosenpath . "{$fro}", "{$newfile}"); } if (is_file("{$newfile}")) { $success++; } } $response = $success == 0 ? __('There was a problem copying the files. Please consult your local pharmacist.', 'file-away') : ($success == 1 ? sprintf(__('One file was copied to %s and it no longer feels special.', 'file-away'), $destination) : ($success > 1 ? sprintf(__('%d of %d files were successfully cloned and delivered in a black caravan to %s.', 'file-away'), $success, $total, $destination) : null)); } elseif ($action == 'bulkmove') { if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } global $wpdb; $table = fileaway_stats::$db; $table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$table}'") != $table ? false : true; $meta_table = fileaway_metadata::$db; $meta_table_exists = $wpdb->get_var("SHOW TABLES LIKE '{$meta_table}'") != $meta_table ? false : true; $metadata = $_POST['metadata'] == 'true' ? true : false; $from = $_POST["from"]; $to = $_POST["to"]; $ext = $_POST['exts']; $destination = $problemchild ? fileaway_utility::replacefirst(stripslashes($_POST["destination"]), $install, '') : stripslashes($_POST["destination"]); $success = 0; $total = 0; $renamers = 0; foreach ($from as $k => $fro) { $fro = stripslashes($fro); $to[$k] = stripslashes($to[$k]); $fro = $problemchild ? fileaway_utility::replacefirst("{$fro}", $install, '') : "{$fro}"; $to[$k] = $problemchild ? fileaway_utility::replacefirst("{$to[$k]}", $install, '') : "{$to[$k]}"; $total++; $newfile = $chosenpath . "{$to[$k]}"; if (is_file($chosenpath . "{$fro}") && is_file("{$newfile}")) { $i = 1; $noext = fileaway_utility::replacelast("{$newfile}", '.' . $ext[$k], ''); while (is_file("{$newfile}")) { if ($i == 1) { $noext = "{$noext}" . " ({$i})"; } else { $j = $i - 1; $noext = rtrim("{$noext}", " ({$j})"); $noext = "{$noext}" . " ({$i})"; } $i++; $newfile = "{$noext}" . '.' . $ext[$k]; } $renamers++; } if (is_file($chosenpath . "{$fro}") && !is_file("{$newfile}")) { rename($chosenpath . "{$fro}", "{$newfile}"); } if (is_file("{$newfile}")) { $success++; if ($table_exists) { fileaway_utility::updatestats('file', fileaway_utility::replacefirst($chosenpath . $fro, $rootpath, ''), fileaway_utility::replacefirst($newfile, $rootpath, '')); } if ($metadata && $meta_table_exists) { fileaway_utility::updatemetadata(false, fileaway_utility::replacefirst($chosenpath . $fro, $rootpath, ''), fileaway_utility::replacefirst($newfile, $rootpath, '')); } } } $response = $success == 0 ? __('There was a problem moving the files. Please consult your local ouija specialist.', 'file-away') : ($success == 1 ? sprintf(__('One lonesome file was forced to leave all it knew and move to %s.', 'file-away'), $destination) : ($success > 1 ? sprintf(__('%d of %d files were magically transported to %s.', 'file-away'), $success, $total, $destination) : null)); } elseif ($action == 'bulkdelete') { if (!$li) { die($dm); } if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } $files = $_POST['files']; $success = 0; $total = 0; foreach ($files as $k => $file) { $file = stripslashes($file); if (strpos($file, '.php') === false && strpos($file, 'htaccess') === false && strpos($file, 'htpasswd') === false && strpos($file, 'wp-admin') === false && strpos($file, 'wp-config') === false && strpos($file, 'wp-includes') === false) { $total++; if (is_file($rootpath . $file)) { unlink($rootpath . $file); } if (!is_file($rootpath . $file)) { $success++; } } } $response = $success == 0 ? __('There was a problem deleting the files. Please try pressing your delete button emphatically and repeatedly.', 'file-away') : ($success == 1 ? __('A million fewer files in the world is a victory. One less file, a tragedy. Farewell, file. Au revoir. Auf Wiedersehen. Adieu.', 'file-away') : ($success > 1 ? sprintf(__('%d of %d files were sent plummeting to the nether regions of cyberspace.', 'file-away'), $success, $total) : null)); } elseif ($action == 'upload') { if (isset($_POST) && $_SERVER['REQUEST_METHOD'] == "POST") { if (!wp_verify_nonce($_POST['upload_nonce'], 'fileaway-fileup-nonce')) { echo 'system_error'; exit; } $file_name = strip_tags(stripslashes($_FILES['upload_file']['name'])); $new_name = strip_tags(stripslashes($_POST['new_name'])); $extension = $_POST['extension']; $check_ext = str_replace('/', '', $extension); $check_name = str_replace('/', '', $new_name); if (empty($check_ext) || empty($check_name)) { echo 'system_error'; exit; } $uploader = stripslashes($_POST['uploader']); $file_id = strip_tags($_POST['upload_file_id']); $file_size = $_FILES['upload_file']['size']; $max_file_size = (int) $_POST['max_file_size']; $file_path = trim($_POST['upload_path'], '/'); if ($uploader) { $user = new WP_User($uploader); $uploadedby = $_POST['identby'] == 'id' ? $user->ID : $user->display_name; if (preg_match('/\\[([^\\]]+)\\]/', $new_name)) { $new_name = fileaway_utility::replacelast($new_name, ']', ',' . $uploadedby . ']'); } else { $new_name = fileaway_utility::replacelast($new_name, '.' . $extension, ' [' . $uploadedby . '].' . $extension); } } $location = str_replace('//', '/', $chosenpath . $file_path . '/' . $new_name); $location = stripslashes($location); $dir = fileaway_utility::dirname($location); $_POST['size_check'] = $file_size > $max_file_size ? 'true' : 'false'; if ($file_size > $max_file_size) { echo 'system_error'; } elseif (strpos($location, 'wp-admin') !== false) { echo 'system_error'; } elseif (strpos($location, 'wp-config') !== false) { echo 'system_error'; } elseif (strpos($location, '.php') !== false) { echo 'system_error'; } elseif (strpos($extension, 'php') !== false) { echo 'system_error'; } elseif (strpos($dir, '..') !== false) { echo 'system_error'; } else { if (!is_dir($dir)) { mkdir($dir, 0755, true); } $p = fileaway_utility::pathinfo($location); $filename = $p['filename']; $i = 1; $overwrite = $li && stripslashes($_POST['overwrite']) == 'true' ? true : false; if (!$overwrite) { while (is_file($location)) { if ($i == 1) { $filename = $filename . " ({$i})"; } else { $j = $i - 1; $filename = rtrim($filename, " ({$j})"); $filename = $filename . " ({$i})"; } $i++; $name = $filename . '.' . $p['extension']; $location = $p['dirname'] . '/' . $name; } } $name = $filename . '.' . $p['extension']; $location = $p['dirname'] . '/' . $name; if (move_uploaded_file(strip_tags($_FILES['upload_file']['tmp_name']), $location)) { echo $file_id; } else { echo 'system_error'; } } exit; } else { echo 'system_error'; exit; } } elseif ($action == 'actionpath') { if (!wp_verify_nonce($_POST['manager_nonce'], 'fileaway-manager-nonce')) { die($dm); } $fileup = $_POST['uploadaction'] === 'true' ? 'fileup-' : ''; $build = null; if ($problemchild) { $pathparts = fileaway_utility::replacefirst($_POST['pathparts'], $install, ''); $start = trim(fileaway_utility::replacefirst($_POST['start'], $install, ''), '/'); } else { $pathparts = $_POST['pathparts']; $start = trim($_POST['start'], '/'); } if ($pathparts === '/') { $pathparts = $start; } $pathparts = trim($pathparts, '/'); $basename = trim($_POST['basename'], '/'); if (!fileaway_utility::startswith($pathparts, $start)) { $pathparts = $start; } $security = $basename === $start ? false : true; $nocrumbs = $security ? trim(fileaway_utility::replacelast("{$start}", "{$basename}", ''), '/') : null; if (strpos($pathparts, '..') !== false) { $pathparts = $start; } $dir = $chosenpath . $pathparts; $build .= "<option></option>"; $directories = glob($dir . "/*", GLOB_ONLYDIR); if ($directories && is_array($directories)) { foreach ($directories as $k => $folder) { $direxcluded = 0; if ($this->settings['direxclusions']) { $direxes = preg_split('/(, |,)/', $this->settings['direxclusions'], -1, PREG_SPLIT_NO_EMPTY); if (is_array($direxes)) { foreach ($direxes as $direx) { $check = strripos($folder, $direx); if ($check !== false) { $direxcluded = 1; break; } } } } if (!$direxcluded) { $folder = str_replace($chosenpath, '', $folder); $dirname = explode('/', $folder); $dirname = end($dirname); $build .= '<option value="' . $folder . '">' . $dirname . '</option>'; } } } else { $build .= ''; } if ($security) { $pieces = explode('/', trim(trim(fileaway_utility::replacefirst("{$pathparts}", "{$nocrumbs}", ''), '/'), '/')); } else { $pieces = explode('/', trim("{$pathparts}", '/')); } $piecelink = array(); $breadcrumbs = null; foreach ($pieces as $k => $piece) { $i = 0; $piecelink[$k] = $security ? "{$nocrumbs}/" : null; while ($i <= $k) { $piecelink[$k] .= "{$pieces[$i]}/"; $i++; } $breadcrumbs .= '<a href="javascript:" data-target="' . trim($piecelink[$k], '/') . '" id="ssfa-' . $fileup . 'action-pathpart-' . $k . '">' . fileaway_utility::strtotitle($piece) . '</a> / '; } $breadcrumbs = stripslashes($breadcrumbs); $pathparts = stripslashes($pathparts); $build = stripslashes($build); $response = array("ops" => $build, "crumbs" => $breadcrumbs, "pathparts" => $pathparts); } elseif ($action == 'deletecsv') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $src = base64_decode($_POST['src']); if (is_file($rootpath . $src)) { if (unlink($rootpath . $src)) { $response = array('status' => 'success'); } else { $response = array('status' => 'error', 'message' => __('There was a problem deleting the files. Please try pressing your delete button emphatically and repeatedly.', 'file-away')); } } else { $response = array('status' => 'error', 'message' => __('The file specified does not exist in this location.', 'file-away')); } } elseif ($action == 'makecsv') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $dir = base64_decode($_POST['path']); $filename = trim($_POST['name'], '/'); if (!fileaway_utility::endswith(strtolower($filename), '.csv')) { $filename = $filename . '.csv'; } if (is_file($rootpath . $dir . '/' . $filename)) { $response = array('status' => 'error', 'message' => __('A file by that name already exists in this directory.', 'file-away')); } else { if (strpos($filename, '/') !== false && !is_dir($rootpath . $dir . '/' . fileaway_utility::dirname($filename))) { mkdir($rootpath . $dir . '/' . fileaway_utility::dirname($filename), 0775, true); } $csv = new fileaway_csv(); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); $rows = array(); $cols = array(); $csv->titles = preg_split('/(, |,)/', $_POST['cols'], -1, PREG_SPLIT_NO_EMPTY); foreach ($csv->titles as $header) { $cols[$header] = ''; } $rows[0] = $cols; $csv->data = $rows; $csv->save($rootpath . $dir . '/' . $filename); if (is_file($rootpath . $dir . '/' . $filename)) { $recursive = $_POST['recursive'] == 'true' ? true : false; $fullpath = $rootpath . $dir; $querystring = ltrim($_POST['querystring'], '?'); $files = $recursive ? fileaway_utility::recursefiles($fullpath, array(), array(), '[cC][sS][vV]') : glob("{$fullpath}/*.[cC][sS][vV]"); $file_index = array_search($rootpath . $dir . '/' . $filename, $files); $link = fileaway_utility::querystring(get_permalink($_POST['pg']), $querystring, array('fa_csv' => base64_encode(fileaway_utility::basename($filename)), 'fa_index' => $file_index)); $response = array('status' => 'success', 'redirect' => $link); } else { $reponse = array('status' => 'error', 'message' => sprintf(__('Sorry. There was a problem creating %s', 'file-away'), $filename)); } } } elseif ($action == 'values') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $src = $rootpath . base64_decode($_POST['src']); $csv = new fileaway_csv(); $csv->sort_by = 'id'; $csv->auto($src); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); $csv->data[$_POST['row']][$_POST['col']] = $_POST['newvalue']; if ($csv->save()) { $response = array('status' => 'success'); } else { $csv->data[$_POST['row']][$_POST['col']] = $_POST['oldvalue']; if ($csv->save()) { $response = array('status' => 'error', 'message' => __('Sorry about that, but your changes could not be saved.', 'file-away')); } else { $response = array('status' => 'error', 'message' => __('Sorry about that, but your changes could not be saved.', 'file-away')); } } } elseif ($action == 'newrow') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $response = array(); $src = $rootpath . base64_decode($_POST['src']); $data = array('test', 'test'); $csv = new fileaway_csv(); $csv->sort_by = 'id'; $csv->auto($src); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); foreach ($csv->titles as $col) { $csv->data[$_POST['numrows']][$col] = ''; } if ($csv->save()) { $response['status'] = 'success'; $k = $_POST['numrows']; $uid = $_POST['uid']; $theme = $_POST['theme']; $headers = $csv->titles; $html = "<tr id='ssfa-values-{$uid}-{$k}' class='ssfa-values-context' data-row='{$k}'>"; foreach ($headers as $key => $header) { $col1class = $key < 1 ? "class='{$theme}-first-column'" : null; $html .= '<td id="cell-ssfa-values-' . $uid . '-' . $k . '-' . $key . '" ' . $col1class . ' style="cursor:cell">' . '<span id="value-ssfa-values-' . $uid . '-' . $k . '-' . $key . '" data-row="' . $k . '" data-col="' . $header . '" data-colnum="' . $key . '"></span> ' . '<input type="text" id="input-ssfa-values-' . $uid . '-' . $k . '-' . $key . '" data-row="' . $k . '" data-col="' . $header . '" data-colnum="' . $key . '" ' . 'value="" style="display:none; width:90%">' . '</td>'; } $html .= "</tr>"; $response['html'] = $html; } else { $response = array('status' => 'error', 'message' => __('Sorry about that, but your changes could not be saved.', 'file-away')); } } elseif ($action == 'deleterow') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $src = $rootpath . base64_decode($_POST['src']); $csv = new fileaway_csv(); $csv->sort_by = 'id'; $csv->auto($src); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); unset($csv->data[$_POST['row']]); if ($csv->save()) { $response = array('status' => 'success'); } else { $response = array('status' => 'error', 'message' => __('Sorry about that, but your changes could not be saved.', 'file-away')); } } elseif ($action == 'createcol') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $src = $rootpath . base64_decode($_POST['src']); $csv = new fileaway_csv(); $csv->sort_by = 'id'; $csv->auto($src); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); $headers = $csv->titles; $rows = $csv->data; if (count($headers) < 2) { $csv->delimiter = ","; } foreach ($rows as $k => $v) { fileaway_utility::recreatecol($rows[$k], $_POST['colnum'], 0, $_POST['col']); } array_splice($headers, $_POST['colnum'], 0, $_POST['col']); $csv->titles = $headers; $csv->data = $rows; if ($csv->save()) { $response = array('status' => 'success'); } else { $response = array('status' => 'error', 'message' => __('Sorry about that, but your changes could not be saved.', 'file-away')); } } elseif ($action == 'colrename') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $src = $rootpath . base64_decode($_POST['src']); $csv = new fileaway_csv(); $csv->sort_by = 'id'; $csv->auto($src); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); $headers = $csv->titles; $rows = $csv->data; foreach ($rows as $k => $v) { fileaway_utility::recreatecol($rows[$k], $_POST['colnum'], 0, $_POST['newname'], $rows[$k][$_POST['oldname']]); unset($rows[$k][$_POST['oldname']]); } $headers[$_POST['colnum']] = $_POST['newname']; $csv->titles = $headers; $csv->data = $rows; if ($csv->save()) { $response = array('status' => 'success'); } else { $response = array('status' => 'error', 'message' => __('Sorry about that, but your changes could not be saved.', 'file-away')); } } elseif ($action == 'coldelete') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $src = $rootpath . base64_decode($_POST['src']); $csv = new fileaway_csv(); $csv->sort_by = 'id'; $csv->auto($src); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); $del_val = $_POST['col']; $del_key = $_POST['colnum']; $headers = $csv->titles; $rows = $csv->data; unset($headers[$_POST['colnum']]); $headers = array_values($headers); foreach ($rows as $k => $v) { unset($rows[$k][$_POST['col']]); } $rows = array_values($rows); $csv->titles = $headers; $csv->data = $rows; if ($csv->save()) { $response = array('status' => 'success'); } else { $response = array('status' => 'error', 'message' => __('Sorry about that, but your changes could not be saved.', 'file-away')); } } elseif ($action == 'backupcsv') { if (!wp_verify_nonce($_POST['values_nonce'], 'fileaway-values-nonce')) { die($dm); } $src = $rootpath . base64_decode($_POST['src']); $csv = new fileaway_csv(); $csv->auto($src); $read = $_POST['read']; $write = $_POST['writ']; $csv->encoding($read, $write); $bits = fileaway_utility::pathinfo($src); $newfile = str_replace('.' . $bits['extension'], ' [' . date('Y-m-d H-i-s', current_time('timestamp')) . '].' . $bits['extension'], $src); if ($csv->save($newfile)) { $response = array('status' => 'success'); } else { $response = array('status' => 'error', 'message' => __('Sorry about that, but a backup could not be successfully saved.', 'file-away')); } } $response = json_encode($response); header("Content-Type: application/json"); echo $response; exit; }
$crumbs = array(); } $crumblink = array(); $addclass = !$heading ? ' ssfa-crumbs-noheading' : null; $crumbies = "<div class='ssfa-clearfix ssfa-crumbs{$addclass}'>{$rsslink}"; $rsslink = null; foreach ($crumbs as $k => $crumb) { $crumblink[$k] = ''; $prettycrumb = str_replace(array('~', '--', '_', '.', '*'), ' ', $crumb); $prettycrumb = preg_replace('/(?<=\\D)-(?=\\D)/', ' ', $prettycrumb); $prettycrumb = preg_replace('/(?<=\\d)-(?=\\D)/', ' ', $prettycrumb); $prettycrumb = preg_replace('/(?<=\\D)-(?=\\d)/', ' ', $prettycrumb); $prettycrumb = fileaway_utility::strtotitle($prettycrumb); if ($crumb !== '') { $i = 0; while ($i <= $k) { if ($i == 0) { $comma = ''; } else { $comma = "*"; } $crumblink[$k] .= $comma . "{$crumbs[$i]}"; $i++; } if ($basebase === $basecheck) { $crumblink[$k] = ltrim(fileaway_utility::replacefirst("{$crumblink[$k]}", "{$basebase}", ''), '*'); } $crumbies .= '<a href="' . fileaway_utility::querystring(get_permalink(), $_SERVER["QUERY_STRING"], array("drawer" . $drawerid => $crumblink[$k])) . '">' . $prettycrumb . '</a> / '; } } $crumbies .= "</div>";
public function sc($atts) { if (isset($atts['style'])) { $atts['theme'] = $atts['style']; } $get = new fileaway_definitions(); extract($get->pathoptions); extract($this->correct(wp_parse_args($atts, $this->fileaway_values), $this->shortcodes['fileaway_values'])); if ($devices == 'mobile' && !$get->is_mobile) { return; } elseif ($devices == 'desktop' && $get->is_mobile) { return; } if (!fileaway_utility::visibility($hidefrom, $showto)) { return; } if ($this->op['javascript'] == 'footer') { $GLOBALS['fileaway_add_scripts'] = true; } if ($this->op['stylesheet'] == 'footer') { $GLOBALS['fileaway_add_styles'] = true; } include fileaway_dir . '/lib/inc/inc.values-declarations.php'; global $is_IE, $is_safari; $uid = rand(0, 9999); $name = "ssfa-meta-container-{$uid}"; $randcolor = array("red", "green", "blue", "brown", "black", "orange", "silver", "purple", "pink"); $paginated = $paginate ? " data-page-navigation='.ssfa-pagination'" : null; $pagearea = $paginate ? "<div class='ssfa-pagination ssfa-pagination-centered hide-if-no-paging'></div>" : null; $pagesized = $paginate ? " data-page-size='{$pagesize}'" : null; $page = $paginate ? $paginated . $pagesized : "{$paginated} data-page-size='100000'"; $theme = "ssfa-{$theme}"; $textalign = $textalign ? ' ssfa-' . $textalign : null; $width = preg_replace('[\\D]', '', $width); $width = $width ? "width:{$width}{$perpx};" : null; $float = " float:{$align};"; $margin = $width !== 'width:100%;' ? $align === 'right' ? ' margin-left:15px;' : ' margin-right:15px;' : null; $howshouldiputit = $width . $float . $margin; if ($width == '100' && $perpx == '%') { $align = 'none'; } $clearfix = $align == 'none' ? "<div class='ssfa-clearfix'></div>" : null; include fileaway_dir . '/lib/inc/inc.base.php'; extract(fileaway_utility::dynamicpaths($dir, $playbackpath)); $makedir = $makecsv ? true : $makedir; $dir = rtrim($dir, '/'); if (!is_dir("{$dir}") && $makedir && (!$private_content || $private_content && $logged_in)) { if (mkdir($rootpath . $dir, 0775, true)) { fileaway_utility::indexmulti($rootpath . $dir, $chosenpath); } } if (!is_dir("{$dir}")) { return; } $nonce = wp_create_nonce('fileaway-values-nonce'); $start = "{$dir}"; if ($filename) { if (!fileaway_utility::endswith(strtolower($filename), '.csv')) { $filename = $filename . '.csv'; } $filename = str_replace('fa-userid', $fa_userid, $filename); $filename = str_replace('fa-userrole', $fa_userrole, $filename); $filename = str_replace('fa-firstlast', $fa_firstlast, $filename); $filename = str_replace('fa-username', $fa_username, $filename); if (stripos($filename, 'fa-usermeta(') !== false) { $umetas = array(); $countmetas = preg_match_all('/\\((.*)\\)/U', $filename, $umetas); if (is_array($umetas[1])) { foreach ($umetas[1] as $umeta) { $metavalue = get_user_meta($fa_userid, $umeta, true); if (!$metavalue || $metavalue == '') { $makecsv = false; } $filename = str_ireplace('fa-usermeta(' . $umeta . ')', $metavalue, $filename); } } } $showoptions = false; if (!is_file($rootpath . $dir . '/' . $filename) && $makecsv) { $csv = new fileaway_csv(); $csv->encoding($read, $write); $rows = array(); $cols = array(); $csv->titles = preg_split('/(, |,)/', $makecsv, -1, PREG_SPLIT_NO_EMPTY); foreach ($csv->titles as $header) { $cols[$header] = ''; } $rows[0] = $cols; $csv->data = $rows; $csv->save($rootpath . $dir . '/' . $filename); } } else { if ($recursive) { $globaldirexes = array(); $localdirexes = array(); if ($excludedirs) { $localdirexes = preg_split('/(, |,)/', $excludedirs, -1, PREG_SPLIT_NO_EMPTY); } if ($this->op['direxclusions']) { $globaldirexes = preg_split('/(, |,)/', $this->op['direxclusions'], -1, PREG_SPLIT_NO_EMPTY); } if (!is_array($globaldirexes)) { $globaldirexes = array(); } if (!is_array($localdirexes)) { $localdirexes = array(); } $direxes = array_unique(array_merge($localdirexes, $globaldirexes)); $excludedirs = count($direxes) > 0 ? $direxes : false; if ($onlydirs) { $onlydirs = $dir . ',' . rtrim($onlydirs); } $justthesedirs = $onlydirs ? preg_split('/(, |,)/', $onlydirs, -1, PREG_SPLIT_NO_EMPTY) : 0; $onlydirs = is_array($justthesedirs) && count($justthesedirs) > 0 ? $justthesedirs : 0; } $selected = false; $showoptions = false; if (isset($_REQUEST['fa_csv']) && isset($_REQUEST['fa_index'])) { $selected = $_GET['fa_csv']; $filename = base64_decode($selected); $file_index = $_GET['fa_index']; $selected = fileaway_utility::querystring(get_permalink(), $_SERVER['QUERY_STRING'], array('fa_csv' => $selected, 'fa_index' => $file_index)); } $dir = rtrim($dir, '/'); $files = $recursive ? fileaway_utility::recursefiles($dir, $onlydirs, $excludedirs, '[cC][sS][vV]') : glob("{$dir}/*.[cC][sS][vV]"); if (!$editor && !is_array($files)) { return; } $count = count($files); if ($count !== 1) { $showoptions = true; } elseif ($count === 1) { $showoptions = false; $filename = fileaway_utility::basename($files[0]); $file_index = 0; $dir = $recursive ? str_replace($filename, '', $files[0]) : $dir; $dir = rtrim($dir, '/'); } if ($showoptions) { $options = array(); $original_url = fileaway_utility::querystring(get_permalink(), $_SERVER['QUERY_STRING'], array('fa_csv', 'fa_index'), true); if (is_array($files)) { foreach ($files as $key => $file) { if (isset($file_index) && $file_index == $key) { $dir = $recursive ? str_replace(fileaway_utility::basename($file), '', $file) : $dir; $dir = rtrim($dir, '/'); } $is_selected = $file === $dir . '/' . $filename ? 'selected' : null; $link = fileaway_utility::querystring(get_permalink(), $_SERVER['QUERY_STRING'], array('fa_csv' => base64_encode(fileaway_utility::basename($file)), 'fa_index' => $key)); $option_display = $recursive ? $install ? fileaway_utility::replacefirst($file, $install, '') : $file : preg_replace('/.csv$/i', '', fileaway_utility::basename($file)); $option_display = $recursive ? str_replace('/', ' > ', $option_display) : $option_display; $options[] = '<option value="' . $link . '" ' . $is_selected . '>' . trim($option_display, '/') . '</option>'; } } $download_link = $filename && isset($file_index) && array_key_exists($file_index, $files) ? '<a href="' . fileaway_utility::urlesc($url . '/' . $dir . '/' . $filename) . '" ' . 'style="text-decoration:none!important; position:relative; top:4px; left:10px;" ' . 'class="ssfa-csv-download" download="' . $filename . '">' . '<span class="ssfa-icon-arrow-down-2" style="font-size:18px; color: #AAA;"></span>' . '</a>' : null; $is_recursive = $recursive ? 'true' : 'false'; $deletecsv = $editor && isset($file_index) && array_key_exists($file_index, $files) ? '<span id="ssfa-delete-csv-' . $uid . '" style="font-size:18px; position:relative; top:4px; left:20px; color:#AAA; cursor:pointer;" ' . 'class="ssfa-icon-remove" aria-hidden="true" data-uid="' . $uid . '"></span>' : null; $newcsvspace = $deletecsv == null ? 10 : 30; $newcsv = $editor ? '<span id="ssfa-new-csv-' . $uid . '" style="font-size:18px; position:relative; top:4px; left:' . $newcsvspace . 'px; color:#AAA; cursor:pointer;" ' . 'class="ssfa-icon-file-4" aria-hidden="true" data-uid="' . $uid . '" data-pg="' . $GLOBALS['post']->ID . '" data-path="' . base64_encode($dir) . '" ' . 'data-recurse="' . $is_recursive . '" data-read="' . $read . '" data-write="' . $write . '"></span>' : null; $select = "<div class='ssfa-clearfix' style='float:left; margin-bottom:15px;'>" . "<div id='ssfa-fileaway-values-{$uid}' style='text-align:left;'>" . "<div style='text-align:left; margin-top:5px;'>" . "<select class='chozed-select ssfa-fileaway-values-select' id='ssfa-fileaway-values-select-{$uid}' " . "data-placeholder=\"{$placeholder}\">" . "<option></option>" . implode(' ', $options) . "</select>" . $download_link . $deletecsv . $newcsv . "</div>" . "</div>" . "</div>"; $selectscript = "<script>" . "jQuery(document).ready(function(\$){ " . "var select = \$('select#ssfa-fileaway-values-select-{$uid}'); " . "\$(select).chozed({ " . "allow_single_deselect:true, " . "width: '300px', " . "inherit_select_classes:true, " . "no_results_text: fileaway_mgmt.no_results, " . "search_contains: true " . "}); " . "\$(select).on('change', function(){ " . "var shadow = \$('<div id=\"ssfa-values-shadow\" style=\"display:none;\" />'); " . "\$('body').append(shadow); " . "shadow.fadeIn(1000); " . "\$('body').css('cursor', 'progress'); " . "if(\$(this).val() == '') window.location.href = \"" . $original_url . "\"; " . "else window.location.href = \$(this).val(); " . "}); " . "}); " . "</script>"; } } if (!$filename && !$showoptions) { return 'No file found.'; } $edit = $editor ? 'true' : 'false'; $mobileclass = $get->is_mobile ? 'ssfa-mobile' : null; $thefiles .= $clearfix . "<div id='{$name}' class='ssfa-meta-container ssfa-fileaway-values {$mobileclass}' data-editor='{$edit}' data-uid='{$uid}' data-fvn=\"" . $nonce . "\" style='opacity:0; margin: 10px 0 20px; {$howshouldiputit}'>"; if ($filename && is_file($rootpath . $dir . '/' . $filename)) { $disablesort = $sorting ? false : "data-sort='false'"; $heading = $showoptions ? $select : '<a href="' . fileaway_utility::urlesc($url . '/' . $dir . '/' . $filename) . '" download="' . $filename . '" ' . 'style="text-decoration:none; color:inherit!important;">' . $filename . '</a>'; include fileaway_dir . '/lib/inc/inc.precontent.php'; $thefiles .= "<script type='text/javascript'>jQuery(function(){ jQuery('.footable').footable();});</script>" . "<table id='ssfa-table-{$uid}' class='ssfa-values-table footable ssfa-sortable {$theme} {$textalign}' data-filter='#filter-{$uid}' data-uid='{$uid}' " . "data-theme=\"{$theme}\" data-src=\"" . base64_encode($dir . '/' . $filename) . "\" data-filename=\"" . fileaway_utility::basename($filename) . "\" " . "data-read=\"{$read}\" data-write=\"{$write}\" {$disablesort} {$page}>" . "<thead><tr>"; ini_set('auto_detect_line_endings', TRUE); $filename = $rootpath . $dir . '/' . $filename; if (file_exists($filename) && is_readable($filename)) { $csv = new fileaway_csv(); $csv->encoding($read, $write); $csv->auto($filename); $rows = $csv->data; $headers = $csv->titles; $editorcursor = $editor ? 'style="cursor:cell"' : null; $editorcontext = $editor ? 'class="ssfa-values-context"' : null; foreach ($headers as $key => $header) { $sortinitial = $key < 1 ? " data-sort-initial='true'" : null; $initialclass = $key < 1 ? 'class="' . $theme . '-first-column"' : null; $thefiles .= "<th id='ssfa-values-header-{$uid}-{$key}' {$initialclass} data-colnum=\"{$key}\" data-col=\"{$header}\" {$sortinitial}>" . $header . "</th>"; } $thefiles .= "</tr></thead><tfoot><tr><td colspan='100'>{$pagearea}</td></tr></tfoot><tbody>"; foreach ($rows as $k => $row) { $thefiles .= "<tr id='ssfa-values-{$uid}-{$k}' {$editorcontext} data-row='{$k}'>"; foreach ($headers as $key => $header) { $col1class = $key < 1 ? "class='{$theme}-first-column'" : null; $input = $editor ? '<input type="text" id="input-ssfa-values-' . $uid . '-' . $k . '-' . $key . '" data-row="' . $k . '" data-col="' . $header . '" data-colnum="' . $key . '" ' . 'value="' . $row[$header] . '" style="display:none; width:90%">' : null; $thefiles .= '<td id="cell-ssfa-values-' . $uid . '-' . $k . '-' . $key . '" ' . $col1class . ' ' . $editorcursor . '>' . '<span id="value-ssfa-values-' . $uid . '-' . $k . '-' . $key . '" data-row="' . $k . '" data-col="' . $header . '" data-colnum="' . $key . '">' . $row[$header] . '</span> ' . $input . '</td>'; } $thefiles .= "</tr>"; } $thefiles .= "</tbody></table></div>"; } } elseif ($showoptions) { $thefiles .= $select; } $thefiles .= $showoptions ? $selectscript : null; $thefiles .= "<script> jQuery(document).ready(function(\$){ setTimeout(function(){ \$('div#" . $name . "').animate({opacity:'1'},1000); }, 1000 ); }); </script>"; $thefiles .= "</div>{$clearfix}"; return $thefiles; }
$dir = trim($dirs[$k], '/'); $thetime = $times[$k]; $file = $full; $total = $totals[$k]; $iss2 = false; include fileaway_dir . '/lib/inc/inc.prettify.php'; if ($thename == '') { continue; } include fileaway_dir . '/lib/inc/inc.colors.php'; $datemodified = $mod == 'yes' ? "<div class='ssfa-datemodified'>" . sprintf(_x('Last modified %s at %s', 'For List Types: *Date* at *Time*', 'file-away'), $date, $time) . "</div>" : null; $listfilesize = $size != 'no' ? $theme == 'ssfa-minimal-list' ? "<span class='ssfa-listfilesize'>({$fsize})</span>" : "<span class='ssfa-listfilesize'>{$fsize}</span>" : null; if ($s2mem && strpos($dir, 's2member-files') !== false) { $iss2 = true; $s2skip = $s2skipconfirm ? '&s2member_skip_confirmation' : ''; $sub = fileaway_utility::replacefirst($rootpath . $dir, WP_PLUGIN_DIR . '/s2member-files/', ''); $link = $s2mem && strpos($dir, 's2member-files') !== false ? $url . '/?s2member_file_download=' . $sub . $file . $s2skip : $link; } $link = $encryption && !$iss2 ? $encrypt->url($rootpath . $dir . '/' . $file) : $link; $fulllink = 'href="' . $link . '"'; $statstatus = $stats ? 'true' : 'false'; $fulllink = $redirect ? 'href="' . $this->op['redirect'] . '"' : $fulllink; include fileaway_dir . '/lib/inc/inc.icons.php'; $linktype = $iss2 || $encryption ? '' : $linktype; $linktype = $redirect ? 'target="_blank"' : $linktype; if ($flightbox && !fileaway_utility::startswith($file, '_thumb_')) { include fileaway_dir . '/lib/inc/inc.flightbox.php'; } $thename = "<span class='ssfa-filename'>" . fileaway_utility::strtotitle($thename) . "</span>"; $count++; $thefiles .= "<a id='ssfa-{$uid}-{$count}' class='{$display}{$noicons}{$colors}' {$fulllink} {$linktype} data-stat='{$statstatus}'>" . "<div class='ssfa-listitem {$ellipsis}'>" . "<span class='ssfa-topline'>{$icon} {$thename} {$listfilesize}</span> " . "{$total}" . "{$datemodified}" . "</div>" . "</a>";
<?php defined('fileaway') or die('Water, water everywhere, but not a drop to drink.'); $url = $this->op['baseurl']; $s2mem = fileaway_definitions::$s2member && ($base == 's2member-files' || stripos($this->op['base' . $base], 'plugins/s2member-files') !== false) ? true : false; $base = $s2mem ? fileaway_utility::replacefirst(WP_PLUGIN_DIR . '/s2member-files', $chosenpath, '') : $this->op['base' . $base]; $base = trim($base, '/'); $base = trim($base, '/'); if ($base == '' || $base == null) { echo 'Your Base Directory is not set.'; return 2; } $sub = $sub ? trim($sub, '/') : false; $dir = $sub ? $base . '/' . $sub : $base; $dir = str_replace('//', '/', "{$dir}"); $dir = $problemchild ? $install . $dir : $dir; $plabackpath = $playback ? $playbackpath : false; if ($s2mem) { $iss2 = true; $s2skip = $s2skipconfirm ? '&s2member_skip_confirmation' : ''; }