/** * @param $package * @return string * @usage Generate Google Doc Preview */ public static function docPreview($package) { $files = $package['files']; if (!is_array($files)) { return ""; } $ind = -1; foreach ($files as $i => $sfile) { $ifile = $sfile; $sfile = explode(".", $sfile); if (in_array(end($sfile), array('pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'))) { $ind = \WPDM_Crypt::Encrypt($ifile); break; } } if ($ind == -1) { return ""; } $url = wpdm_download_url($package, 'ind=' . $ind); if (strpos($ifile, "://")) { $url = $ifile; } return \WPDM\FileSystem::docPreview($url); }
/** * return download link after verifying password * data format: json */ function wpdm_getlink() { global $wpdb; if (!isset($_POST['id'])) { return; } $id = (int) $_POST['id']; $password = isset($_POST['password']) ? addslashes($_POST['password']) : ''; $file = get_post($id, ARRAY_A); $file['ID'] = $file['ID']; $file = wpdm_setup_package_data($file); $file1 = $file; // and( password='******' or password like '%[$password]%') $plock = $file['password'] != '' ? 1 : 0; $data = array('error' => '', 'downloadurl' => ''); if ($plock == 1 && $password != $file['password']) { $data['error'] = 'Wrong Password!'; $file = array(); } if ($plock == 1 && $password == '') { $data['error'] = 'Wrong Password!'; $file = array(); } if ($plock == 1 && $data['error'] == '') { $key = uniqid(); update_post_meta($file['ID'], $key, 3); } //if (isset($_COOKIE['unlocked_' . $file['ID']])) { // $data['error'] = ''; // $file = $file1; // } if ($data['error'] == '') { $data['downloadurl'] = wpdm_download_url($file, "_wpdmkey={$key}"); } // home_url('/?downloadkey='.md5($file['files']).'&file='.$id.$ux); $adata = apply_filters("wpdmgetlink", $data, $file); $data = is_array($adata) ? $adata : $data; header("Content-type: application/json"); die(json_encode($data)); }
function wpdm_doc_preview($package) { $files = $package['files']; if (!is_array($files)) { return ""; } $ind = -1; foreach ($files as $i => $sfile) { $sfile = explode(".", $sfile); if (in_array(end($sfile), array('pdf', 'doc', 'docs', 'xls', 'xlsx', 'ppt', 'pptx'))) { $ind = $i; break; } } if ($ind == -1) { return ""; } $url = wpdm_download_url($package, 'ind=' . $ind); if (strpos($files[$ind], "://")) { $url = $files[$ind]; } return '<iframe src="http://docs.google.com/viewer?url=' . urlencode($url) . '&embedded=true" width="100%" height="600" style="border: none;"></iframe>'; }
/** * @usage Generate direct link to download * @param $params * @param string $content * @return string */ function wpdm_direct_link($params, $content = "") { extract($params); global $wpdb; $package = $wpdb->get_row("select * from {$wpdb->prefix}ahm_files where id='{$id}'", ARRAY_A); $url = wpdm_download_url($package); $data_icon = isset($data_icon) ? $data_icon : plugins_url('/download-manager/images/download-now.png'); return "<div class='w3eden aligncenter'><br/><a style='text-align:left;padding:8px 15px;' class='btn {$class}' rel='nofollow' href='{$url}'><img src='{$data_icon}' style='border:0px;box-shadow:none;max-height:40px;width:auto;margin-right:10px;float:left;' /> <span id='mlbl' style='font-size:13pt;font-weight:bold;'>{$link_label}</span><br/><small id='slbl'>{$link_slabel}</small></a><br/><div style='clear:both;'></div></div>"; }
/** * return download link after verifying password * data format: json */ function wpdm_getlink() { global $wpdb; if (!isset($_POST['id'])) { return; } $id = (int) $_POST['id']; $password = isset($_POST['password']) ? addslashes($_POST['password']) : ''; $file = get_post($id, ARRAY_A); //$file['ID'] = $file['ID']; $file = wpdm_setup_package_data($file); $key = uniqid(); $file1 = $file; // and( password='******' or password like '%[$password]%') $plock = isset($file['password']) && $file['password'] != '' ? 1 : 0; $data = array('error' => '', 'downloadurl' => ''); if (isset($_POST['reCaptchaVerify'])) { $ret = remote_post('https://www.google.com/recaptcha/api/siteverify', array('secret' => get_option('_wpdm_recaptcha_secret_key'), 'response' => $_POST['reCaptchaVerify'], 'remoteip' => $_SERVER['REMOTE_ADDR'])); $ret = json_decode($ret); if ($ret->success == 1) { $_SESSION['_wpdm_unlocked_' . $file['ID']] = 1; update_post_meta($file['ID'], "__wpdmkey_" . $key, 3); $download_url = wpdm_download_url($file, "_wpdmkey={$key}"); $data['downloadurl'] = $download_url; } else { $data['error'] = __("Captcha Verification Failed!", "wpmdpro"); } header("Content-type: application/json"); echo json_encode($data); die; } if ($plock == 1 && $password != $file['password'] && !strpos("__" . $file['password'], "[{$password}]")) { $data['error'] = __('Wrong Password!', 'wpdmpro'); $file = array(); } if ($plock == 1 && $password == '') { $data['error'] = __('Wrong Password!', 'wpdmpro'); $file = array(); } $ux = ""; if ($plock == 1 && isset($file['ID'])) { update_post_meta($file['ID'], "__wpdmkey_" . $key, 3); } if (isset($file['ID']) && $file['ID'] != '') { $pu = isset($file['password_usage']) && is_array($file['password_usage']) ? $file['password_usage'] : array(); $pul = $file['password_usage_limit']; if (is_array($pu) && isset($pu[$password]) && $pu[$password] >= $pul && $pul > 0) { $data['error'] = __('Password usages limit exceeded', 'wpdmpro'); } else { if (!is_array($pu)) { $pu = array(); } $pu[$password] = isset($pu[$password]) ? $pu[$password] + 1 : 1; update_post_meta($file['ID'], '__wpdm_password_usage', $pu); } } if (isset($_COOKIE['unlocked_' . $file1['ID']]) && $_COOKIE['unlocked_' . $file1['ID']] == 1) { $data['error'] = ''; $file = $file1; } if ($data['error'] == '') { $_SESSION['_wpdm_unlocked_' . $file['ID']] = 1; $data['downloadurl'] = wpdm_download_url($file, "_wpdmkey={$key}"); } // home_url('/?downloadkey='.md5($file['files']).'&file='.$id.$ux); $adata = apply_filters("wpdmgetlink", $data, $file); $data = is_array($adata) ? $adata : $data; if (!wpdm_is_ajax()) { @setcookie("wpdm_getlink_data_" . $key, json_encode($data)); if (isset($data['downloadurl']) && $data['downloadurl'] != '') { header("location: " . $data['downloadurl']); die; } header("location: " . $_SERVER['HTTP_REFERER'] . "#nojs_popup|ckid:" . $key); die; } header("Content-type: application/json"); die(json_encode($data)); }
function wpdm_embed_tree() { if (wpdm_query_var('task', 'txt') != 'wpdm_tree') { return; } global $wpdb; $cats = get_terms('wpdmcategory', array('hide_empty' => false)); echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">"; // All Cats $scat = wpdm_query_var('dir') == '/' ? '' : wpdm_query_var('dir', 'txt'); foreach ($cats as $id => $cat) { if ($cat->parent == intval($scat)) { echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . $cat->term_id . "\">" . $cat->name . "</a></li>"; } } // All files $params = array('post_type' => 'wpdmpro', 'posts_per_page' => 9999); //if($scat!='') $params['tax_query'] = array(array('taxonomy' => 'wpdmcategory', 'field' => 'term_id', 'terms' => $scat, 'include_children' => false)); $packs = new WP_Query($params); while ($packs->have_posts()) { $packs->the_post(); $files = maybe_unserialize(get_post_meta(get_the_ID(), '__wpdm_files', true)); if (count($files) == 1) { $ext = explode(".", $files[0]); $ext = end($ext); } if (count($files) > 1) { $ext = 'zip'; } if (!is_array($files) || count($files) == 0) { $ext = '_blank'; } if (wpdm_query_var('ddl', 'int') == 0 || wpdm_is_locked(get_the_ID())) { echo "<li class=\"file ext_{$ext}\"><a href='" . get_permalink(get_the_ID()) . "' rel='" . get_permalink(get_the_ID()) . "'>" . get_the_title() . "</a></li>"; } else { echo "<li class=\"file ext_{$ext}\"><a href='" . wpdm_download_url(get_the_ID()) . "' rel='" . wpdm_download_url(get_the_ID()) . "'>" . get_the_title() . "</a></li>"; } } echo "</ul>"; die; }
/** * @usage Callback function for [file_list_extended] tag * @param $file * @return string * @usage Generate file list with preview */ public static function Box($file) { global $current_user; $file['files'] = maybe_unserialize($file['files']); $fhtml = ''; $idvdl = \WPDM\Package::isSingleFileDownloadAllowed($file['ID']); //isset($file['individual_file_download']) ? $file['individual_file_download'] : 0; $pd = isset($file['publish_date']) && $file['publish_date'] != "" ? strtotime($file['publish_date']) : 0; $xd = isset($file['expire_date']) && $file['expire_date'] != "" ? strtotime($file['expire_date']) : 0; $cur = is_user_logged_in() ? $current_user->roles : array('guest'); $_SESSION['wpdmfilelistcd_' . $file['ID']] = 1; if ($xd > 0 && $xd < time() || $pd > 0 && $pd > time()) { $idvdl = 0; } $dir = isset($file['package_dir']) ? $file['package_dir'] : ''; $dfiles = array(); if ($dir != '') { $dfiles = wpdm_get_files($dir, false); } $file['access'] = wpdm_allowed_roles($file['ID']); if (count($file['files']) > 0 || count($dfiles) > 0) { $fileinfo = isset($file['fileinfo']) ? $file['fileinfo'] : array(); $pwdlock = isset($file['password_lock']) ? $file['password_lock'] : 0; //Check if any other lock option apllied for this package $olock = wpdm_is_locked($file['ID']) ? 1 : 0; $swl = 0; if (!isset($file['quota']) || $file['quota'] <= 0) { $file['quota'] = 9999999999999; } if (is_user_logged_in()) { $cur[] = 'guest'; } if (!isset($file['access']) || count($file['access']) == 0 || !wpdm_user_has_access($file['ID']) || wpdm_is_download_limit_exceed($file['ID']) || $file['quota'] <= $file['download_count']) { $olock = 1; } $pwdcol = $dlcol = ''; if ($pwdlock && $idvdl) { $pwdcol = "<th>" . __("Password", "wpdmpro") . "</th>"; } if ($idvdl && ($pwdlock || !$olock)) { $dlcol = "<th align=center>" . __("Download", "wpdmpro") . "</th>"; $swl = 1; } $allfiles = is_array($file['files']) ? $file['files'] : array(); //$allfiles = array_merge($allfiles, $dfiles); $fhtml = "<div class='row' id='xfilelist'>"; if (is_array($allfiles)) { foreach ($allfiles as $fileID => $sfile) { $fhtml .= "<div class='col-md-4 col-sm-6 col-xs-6'><div class='panel panel-default'>"; $ind = \WPDM_Crypt::Encrypt($sfile); if (!isset($fileinfo[$sfile]) || !@is_array($fileinfo[$sfile])) { $fileinfo[$sfile] = array(); } if (!@is_array($fileinfo[$fileID])) { $fileinfo[$fileID] = array(); } $filePass = isset($fileinfo[$sfile]['password']) ? $fileinfo[$sfile]['password'] : (isset($fileinfo[$fileID]['password']) ? $fileinfo[$fileID]['password'] : ''); $fileTitle = isset($fileinfo[$sfile]['title']) && $fileinfo[$sfile]['title'] != '' ? $fileinfo[$sfile]['title'] : (isset($fileinfo[$fileID]['title']) && $fileinfo[$fileID]['title'] != '' ? $fileinfo[$fileID]['title'] : preg_replace("/([0-9]+)_/", "", wpdm_basename($sfile))); if ($filePass == '' && $pwdlock) { $filePass = $file['password']; } $fhtml .= "<div class='panel-heading ttip' title='{$fileTitle}'>{$fileTitle}</div>"; $imgext = array('png', 'jpg', 'jpeg', 'gif'); $ext = explode(".", $sfile); $ext = end($ext); $ext = strtolower($ext); $filepath = file_exists($sfile) ? $sfile : UPLOAD_DIR . $sfile; $thumb = ""; if ($ext == '' || !file_exists(WPDM_BASE_DIR . 'assets/file-type-icons/' . $ext . '.png')) { $ext = '_blank'; } if (in_array($ext, $imgext)) { $thumb = wpdm_dynamic_thumb($filepath, array(88, 88)); } if ($thumb) { $fhtml .= "<div class='panel-body text-center'><img class='file-thumb' src='{$thumb}' alt='{$fileTitle}' /></div><div class='panel-footer footer-info'>" . wpdm_file_size($sfile) . "</div><div class='panel-footer'>"; } else { $fhtml .= "<div class='panel-body text-center'><img class='file-ico' src='" . WPDM_BASE_URL . 'assets/file-type-icons/' . $ext . '.png' . "' alt='{$fileTitle}' /></div><div class='panel-footer footer-info'>" . wpdm_file_size($sfile) . "</div><div class='panel-footer'>"; } if ($swl) { if ($filePass != '' && $pwdlock) { $fhtml .= "<div class='input-group'><input onkeypress='jQuery(this).removeClass(\"input-error\");' size=10 type='password' value='' id='pass_{$file['ID']}_{$ind}' placeholder='Password' name='pass' class='form-control input-sm inddlps' />"; } if ($filePass != '' && $pwdlock) { $fhtml .= "<span class='input-group-btn'><button class='inddl btn btn-primary btn-sm' file='{$sfile}' rel='" . wpdm_download_url($file) . "&ind=" . $ind . "' pass='******'ID']}_{$ind}'><i class='fa fa-download'></i></button></span></div>"; } else { $fhtml .= "<a class='btn btn-primary btn-sm btn-block' href='" . wpdm_download_url($file) . "&ind=" . $ind . "'><span class='pull-left'><i class='fa fa-download'></i></span> " . __("Download", "wpdmpro") . "</a>"; } } $fhtml .= "</div></div></div>"; } } if (is_array($dfiles)) { foreach ($dfiles as $ind => $sfile) { $ind = \WPDM_Crypt::Encrypt($sfile); $fhtml .= "<div class='col-md-4 col-sm-6 col-xs-6'><div class='panel panel-default'>"; if (!isset($fileinfo[$sfile]) || !@is_array($fileinfo[$sfile])) { $fileinfo[$sfile] = array(); } if (!isset($fileinfo[$sfile]['password'])) { $fileinfo[$sfile]['password'] = ""; } if ($fileinfo[$sfile]['password'] == '' && $pwdlock) { $fileinfo[$sfile]['password'] = $file['password']; } $ttl = isset($fileinfo[$sfile]['title']) && $fileinfo[$sfile]['title'] != "" ? $fileinfo[$sfile]['title'] : preg_replace("/([0-9]+)_/", "", wpdm_basename($sfile)); $cttl = is_dir($sfile) ? "<a href='#' class='wpdm-indir' data-dir='{$ttl}' data-pid='{$file['ID']}'>{$ttl}/</a>" : $ttl; $fhtml .= "<div class='panel-heading ttip' title='{$ttl}'>{$cttl}</div>"; $imgext = array('png', 'jpg', 'jpeg', 'gif'); $ext = explode(".", $sfile); $ext = end($ext); $ext = strtolower($ext); if (is_dir($sfile)) { $ext = 'folder'; } $filepath = file_exists($sfile) ? $sfile : UPLOAD_DIR . $sfile; $thumb = ""; $showt = 1; if (in_array($ext, $imgext) && apply_filters('file_list_extended_show_thumbs', $showt)) { $thumb = wpdm_dynamic_thumb($filepath, array(88, 88)); } $fticon = WPDM_BASE_URL . 'assets/file-type-icons/' . $ext . '.png'; if (!file_exists(WPDM_BASE_DIR . 'assets/file-type-icons/' . $ext . '.png')) { $fticon = WPDM_BASE_URL . 'assets/file-type-icons/ini.png'; } if ($thumb) { $fhtml .= "<div class='panel-body text-center'><img class='file-thumb' src='{$thumb}' alt='{$ttl}' /></div><div class='panel-footer footer-info'>" . wpdm_file_size($sfile) . "</div><div class='panel-footer'>"; } else { $fhtml .= "<div class='panel-body text-center'><img class='file-ico' src='" . $fticon . "' alt='{$ttl}' /></div><div class='panel-footer footer-info'>" . wpdm_file_size($sfile) . "</div><div class='panel-footer'>"; } if ($swl) { $fileinfo[$sfile]['password'] = $fileinfo[$sfile]['password'] == '' ? $file['password'] : $fileinfo[$sfile]['password']; if ($fileinfo[$sfile]['password'] != '' && $pwdlock && !is_dir($sfile)) { $fhtml .= "<div class='input-group'><input onkeypress='jQuery(this).removeClass(\"input-error\");' size=10 type='password' value='' id='pass_{$file['ID']}_{$ind}' placeholder='Password' name='pass' class='form-control input-sm inddlps' />"; } if ($fileinfo[$sfile]['password'] != '' && $pwdlock && !is_dir($sfile)) { $fhtml .= "<span class='input-group-btn'><button class='inddl btn btn-primary btn-sm' file='{$sfile}' rel='" . wpdm_download_url($file) . "&ind=" . $ind . "' pass='******'ID']}_{$ind}'><i class='fa fa-download'></i></button></span></div>"; } else { if (!is_dir($sfile)) { $fhtml .= "<a class='btn btn-primary btn-sm btn-block' href='" . wpdm_download_url($file) . "&ind=" . $ind . "'><span class='pull-left'><i class='fa fa-download'></i></span> " . __("Download", "wpdmpro") . "</a>"; } else { $fhtml .= "<a class='btn btn-primary btn-sm btn-block wpdm-indir' href='#' data-dir='{$ttl}' data-pid='{$file['ID']}'><span class='pull-left'><i class='fa fa-folder'></i></span> " . __("Browse", "wpdmpro") . "</a>"; } } } $fhtml .= "</div></div></div>"; } } $fhtml .= "</div>"; $siteurl = home_url('/'); $fhtml .= "<script type='text/javascript' language='JavaScript'> jQuery('.inddl').click(function(){ var tis = this; jQuery.post('{$siteurl}',{wpdmfileid:'{$file['ID']}',wpdmfile:jQuery(this).attr('file'),actioninddlpvr:1,filepass:jQuery(jQuery(this).attr('pass')).val()},function(res){ res = res.split('|'); var ret = res[1]; if(ret=='error') jQuery(jQuery(tis).attr('pass')).addClass('input-error'); if(ret=='ok') location.href=jQuery(tis).attr('rel')+'&_wpdmkey='+res[2];});}); </script> "; } return $fhtml; }
?> </code> <code><input style="border:0px;background: transparent;text-align:center;" type="text" onclick="this.select()" size="20" title="Simply Copy and Paste in post contents" value="[wpdm_package id=<?php echo $media['id']; ?> ]" /></code> <div class="row-actions"><div class="button-group"><a class="button" href="admin.php?page=file-manager&task=EditPackage&id=<?php echo $media['id']; ?> ">Edit</a><a class="button" href="admin.php?page=file-manager/add-new-package&clone=<?php echo $media['id']; ?> " style="color: #336699">Clone</a><a class="button" target="_blank" href='<?php echo get_wpdm_permalink($media); ?> ' style="color: #005500">View</a><a class="button" target="_blank" href='<?php echo wpdm_download_url($media, 'masterkey=' . get_wpdm_meta($media['id'], 'masterkey')); ?> ' style="color: #6E3887">Download</a><a href="admin.php?page=file-manager&task=DeleteFile&id=<?php echo $media['id']; ?> " class="button submitdelete" style="color: #cc0000" rel="<?php echo $media[id]; ?> " title="Permanently">Delete</a></div></div> </td> <td class="author column-author"><?php echo $cats; ?> </td> <td class="author column-author"><?php echo $media['password'];
function wpdm_block_dllink($package) { global $wpdb, $current_user, $wpdm_download_button_class; $uroles = array_keys($current_user->caps); $urole = array_shift($uroles); get_currentuserinfo(); $users = maybe_unserialize(get_post_meta($package['ID'], '__wpdm_user_access', true)); if (!isset($package['access'])) { $package['access'] = array(); } if (!$users || is_user_logged_in() && in_array($current_user->roles[0], $package['access']) || in_array('guest', $package['access'])) { return $package; } if (is_user_logged_in() && in_array($current_user->user_login, $users)) { $dkey = is_array($package['files']) ? md5(serialize($package['files'])) : md5($package['files']); $package['access'] = array('guest'); $package['download_url'] = wpdm_download_url($package, ''); if (wpdm_is_download_limit_exceed($package['ID'])) { $package['download_url'] = '#'; $package['link_label'] = __msg('DOWNLOAD_LIMIT_EXCEED'); } $package['download_link'] = $package['download_link_extended'] = "<a class='wpdm-download-link {$wpdm_download_button_class}' rel='noindex nofollow' href='{$package['download_url']}'>{$package['link_label']}</a>"; return $package; } else { $package['download_url'] = "#"; $package['access'] = array(); $package['download_link'] = $package['download_link_extended'] = stripslashes(get_option('wpdm_permission_msg')); if (get_option('_wpdm_hide_all', 0) == 1) { $package['download_link'] = $package['download_link_extended'] = 'blocked'; } } return $package; }
/** * @usage Handles ajax file list request for dir attachment */ function wpdm_print_file_list() { if (isset($_POST['action']) && $_POST['action'] == 'wpdmfilelistcd') { if (isset($_SESSION['wpdmfilelistcd_' . $_POST['pid']])) { $file = wpdm_get_package((int) $_POST['pid']); $fhtml = ''; $idvdl = \WPDM\Package::isSingleFileDownloadAllowed($file['ID']); //isset($file['individual_file_download']) ? $file['individual_file_download'] : 0; $pd = isset($file['publish_date']) && $file['publish_date'] != "" ? strtotime($file['publish_date']) : 0; $xd = isset($file['expire_date']) && $file['expire_date'] != "" ? strtotime($file['expire_date']) : 0; $fileinfo = isset($file['fileinfo']) ? $file['fileinfo'] : array(); $pwdlock = isset($file['password_lock']) ? $file['password_lock'] : 0; $olock = wpdm_is_locked($file['ID']) ? 1 : 0; $swl = 0; if (!isset($file['quota']) || $file['quota'] <= 0) { $file['quota'] = 9999999999999; } if (is_user_logged_in()) { $cur[] = 'guest'; } if (!wpdm_user_has_access($file['ID']) || wpdm_is_download_limit_exceed($file['ID']) || $file['quota'] <= $file['download_count']) { $olock = 1; } $pwdcol = $dlcol = ''; if ($pwdlock && $idvdl) { $pwdcol = "<th>" . __("Password", "wpdmpro") . "</th>"; } if ($idvdl && ($pwdlock || !$olock)) { $dlcol = "<th align=center>" . __("Download", "wpdmpro") . "</th>"; $swl = 1; } $dir = get_post_meta($_POST['pid'], '__wpdm_package_dir', true); $cd = esc_attr($_POST['cd']); $cd = str_replace(array('../', './'), '', $cd); if ($cd == '/') { $cd = ''; } $dfiles = array(); if ($dir != '') { $realpath = realpath($dir . $cd) . '/'; if (strpos("--" . $realpath, $dir) > 0) { $dfiles = wpdm_get_files($dir . $cd, false); } else { $dfiles = array(); } } $drs = explode('/', $cd); $bcrm[] = "<a href='#' class='wpdm-indir' data-dir='/' data-pid='{$file['ID']}'>" . __('Home', 'wpdmpro') . "</a>"; $brdp = ''; foreach ($drs as $tdir) { $brdp .= $tdir . '/'; if ($tdir != '') { $bcrm[] = "<a href='#' class='wpdm-indir' data-dir='{$brdp}' data-pid='{$file['ID']}'>{$tdir}</a>"; } } $breadcrumb = implode(" <i class='fa fa-angle-right'></i> ", $bcrm); $fhtml = "<div class='breadcrumb'>{$breadcrumb}</div><div class='row' id='xfilelist'>"; if (is_array($dfiles)) { foreach ($dfiles as $ind => $sfile) { $ind = WPDM_Crypt::Encrypt($sfile); $fhtml .= "<div class='col-md-4 col-sm-6 col-xs-6'><div class='panel panel-default'>"; if (!isset($fileinfo[$sfile]) || !@is_array($fileinfo[$sfile])) { $fileinfo[$sfile] = array(); } if (!isset($fileinfo[$sfile]['password'])) { $fileinfo[$sfile]['password'] = ""; } if ($fileinfo[$sfile]['password'] == '' && $pwdlock) { $fileinfo[$sfile]['password'] = $file['password']; } $ttl = isset($fileinfo[$sfile]['title']) && $fileinfo[$sfile]['title'] != "" ? $fileinfo[$sfile]['title'] : preg_replace("/([0-9]+)_/", "", wpdm_basename($sfile)); $cttl = is_dir($sfile) ? "<a href='#' class='wpdm-indir' data-dir='{$cd}/{$ttl}' data-pid='{$file['ID']}'>{$ttl}/</a>" : $ttl; $fhtml .= "<div class='panel-heading ttip' title='{$ttl}'>{$cttl}</div>"; $imgext = array('png', 'jpg', 'jpeg', 'gif'); $ext = explode(".", $sfile); $ext = end($ext); $ext = strtolower($ext); $info = wpdm_file_size($sfile); if (is_dir($sfile)) { $ext = 'folder'; $info = count(scandir($sfile)) . " " . __('files', 'wpdmpro'); } $filepath = file_exists($sfile) ? $sfile : UPLOAD_DIR . $sfile; $thumb = ""; if (in_array($ext, $imgext)) { $thumb = wpdm_dynamic_thumb($filepath, array(88, 88)); } $fticon = WPDM_BASE_URL . 'assets/file-type-icons/' . $ext . '.png'; if (!file_exists(WPDM_BASE_DIR . 'assets/file-type-icons/' . $ext . '.png')) { $fticon = WPDM_BASE_URL . 'assets/file-type-icons/ini.png'; } if ($thumb) { $fhtml .= "<div class='panel-body text-center'><img class='file-thumb' src='{$thumb}' alt='{$ttl}' /></div><div class='panel-footer footer-info'>" . $info . "</div><div class='panel-footer'>"; } else { $fhtml .= "<div class='panel-body text-center'><img class='file-ico' src='" . $fticon . "' alt='{$ttl}' /></div><div class='panel-footer footer-info'>" . $info . " </div><div class='panel-footer'>"; } if ($swl) { $fileinfo[$sfile]['password'] = $fileinfo[$sfile]['password'] == '' ? $file['password'] : $fileinfo[$sfile]['password']; if ($fileinfo[$sfile]['password'] != '' && $pwdlock && !is_dir($sfile)) { $fhtml .= "<div class='input-group'><input onkeypress='jQuery(this).removeClass(\"input-error\");' size=10 type='password' value='' id='pass_{$file['ID']}_{$ind}' placeholder='Password' name='pass' class='form-control input-sm inddlps' />"; } if ($fileinfo[$sfile]['password'] != '' && $pwdlock && !is_dir($sfile)) { $fhtml .= "<span class='input-group-btn'><button class='inddl btn btn-default btn-sm' file='{$sfile}' rel='" . wpdm_download_url($file) . "&ind=" . $ind . "' pass='******'ID']}_{$ind}'><i class='fa fa-download'></i></button></span></div>"; } else { if (!is_dir($sfile)) { $fhtml .= "<a class='btn btn-primary btn-sm btn-block' href='" . wpdm_download_url($file) . "&ind=" . $ind . "'><i class='fa fa-download'></i> " . __("Download", "wpdmpro") . "</a>"; } else { $fhtml .= "<a class='btn btn-primary btn-sm btn-block wpdm-indir' href='#' data-dir='{$cd}/{$ttl}' data-pid='{$file['ID']}'><span class='pull-left'><i class='fa fa-folder'></i></span> " . __("Browse", "wpdmpro") . "</a>"; } } } $fhtml .= "</div></div></div>"; } } $fhtml .= "</div>"; echo $fhtml; } else { die('Session Expired! Please refresh and try again.'); } die; } }