function wpdm_new_file_form_sc() { global $wpdb, $current_user, $wp_query; wp_reset_query(); $currentAccess = maybe_unserialize(get_option('__wpdm_front_end_access', array())); if (!array_intersect($currentAccess, $current_user->roles) && is_user_logged_in()) { return "<div class='w3eden'><div class='alert alert-danger'>" . wpautop(stripslashes(get_option('__wpdm_front_end_access_blocked'))) . "</div></div>"; } $cond_uid = wpdm_multi_user("and uid='{$current_user->ID}'"); $id = wpdm_query_var('ID'); $task = wpdm_query_var('task'); $tabs = array(); $tabs = apply_filters('wpdm_frontend', $tabs); $burl = get_permalink(); $sap = strpos($burl, '?') ? '&' : '?'; ob_start(); ?> <div class="w3eden"> <ul id="tabs" class="nav nav-tabs" style="margin: 0px !important;padding: 0px;"> <?php if (is_user_logged_in()) { ?> <li <?php if ($task == '' || $task == 'edit-package') { ?> class="active"<?php } ?> > <a href="<?php echo $burl; ?> ">All Packages</a></li> <li <?php if ($task == 'addnew') { ?> class="active"<?php } ?> ><a href="<?php echo $burl . $sap; ?> task=addnew">Create New Package</a></li> <?php foreach ($tabs as $tid => $tab) { ?> <li <?php if ($task == $tid) { ?> class="active"<?php } ?> ><a href="<?php echo $burl . $sap; ?> task=<?php echo $tid; ?> "><?php echo $tab['label']; ?> </a></li> <?php } ?> <li <?php if ($task == 'editprofile') { ?> class="active"<?php } ?> ><a href="<?php echo $burl . $sap; ?> task=editprofile">Edit Profile</a></li> <li><a href="<?php echo $burl . $sap; ?> task=logout">Logout</a></li> <?php } else { ?> <li class="active"><a href="<?php echo $burl; ?> ">Signup or Signin</a></li> <?php } ?> </ul><div class="tab-content"> <?php if (is_user_logged_in()) { if ($task == 'addnew' || $task == 'edit-package') { include 'wpdm-add-new-file-front.php'; } else { if ($task == 'editprofile') { include 'wpdm-edit-user-profile.php'; } else { if ($task != '' && $tabs[$task]['shortcode'] != '') { do_shortcode($tabs[$task]['shortcode']); } else { include 'wpdm-list-files-front.php'; } } } } else { include 'wpdm-be-member.php'; } echo '</div></div><script>jQuery(function($){ $("#tabs > li > a").click(function(){ location.href=this.href; }); });</script>'; $data = ob_get_clean(); return $data; }
<?php global $wpdb, $current_user; $limit = 10; get_currentuserinfo(); if (wpdm_multi_user() && !wpdm_is_custom_admin()) { $cond[] = "uid='{$current_user->ID}'"; } $_REQUEST['q'] = isset($_POST['q']) && $_POST['q'] != '' ? $_POST['q'] : $_GET['q']; $_GET['paged'] = $_GET['paged'] ? $_GET['paged'] : 1; $q = explode(" ", $_REQUEST['q']); foreach ($q as $st) { $squery[] = "(`title` LIKE '%{$st}%' or `description` LIKE '%{$st}%')"; } //mysql_escape_string(trim($_REQUEST[q])); if ($_REQUEST['q'] != '') { $cond[] = "(" . implode(" and ", $squery) . ")"; } if ($_REQUEST['cat'] != '') { $cond[] = "category like '%\"{$_REQUEST['cat']}\"%'"; } $cond = count($cond) > 0 ? "where " . implode(" and ", $cond) : ''; $start = $_GET['paged'] ? ($_GET['paged'] - 1) * $limit : 0; $field = $_GET['sfield'] ? $_GET['sfield'] : 'id'; $ord = $_GET['sorder'] ? $_GET['sorder'] : 'desc'; if ($_REQUEST['q']) { $qr = "&q={$_REQUEST['q']}"; } else { $qr = ''; } $res = $wpdb->get_results("select * from {$wpdb->prefix}ahm_files {$cond} order by {$field} {$ord} limit {$start}, {$limit}", ARRAY_A);
function EditPackage() { global $wpdb, $current_user; get_currentuserinfo(); $cond_uid = wpdm_multi_user() && !wpdm_is_custom_admin() ? "and uid='{$current_user->ID}'" : ""; $id = $_GET['id']; $table_name = "{$wpdb->prefix}ahm_files"; $file = $wpdb->get_row("SELECT * FROM {$table_name} WHERE `id` = {$id} {$cond_uid}", ARRAY_A); if (!$file[id]) { $error = "Sorry, You don't have permission to edit that file!"; include "error-page.php"; return; } include 'add-new-file.php'; }
public function EditProfile() { global $wpdb, $current_user, $wp_query; wp_reset_query(); $currentAccess = maybe_unserialize(get_option('__wpdm_front_end_access', array())); if (!array_intersect($currentAccess, $current_user->roles) && is_user_logged_in()) { return WPDM_Messages::Error(wpautop(stripslashes(get_option('__wpdm_front_end_access_blocked'))), -1); } $cond_uid = wpdm_multi_user("and uid='{$current_user->ID}'"); $id = wpdm_query_var('ID'); ob_start(); if (is_user_logged_in()) { include wpdm_tpl_path('wpdm-edit-user-profile.php'); } else { include wpdm_tpl_path('wpdm-be-member.php'); } $data = ob_get_clean(); return $data; }