function curr_file($file_id) { global $db, $tpf, $settings, $code; $file = $db->fetch_one_array("select * from {$tpf}files where file_id='{$file_id}'"); if (!$file) { $file['is_del'] = 1; } else { $file['dl'] = create_down_url($file); $in_extract = $code == md5($file['file_key']) ? 1 : 0; $file['username'] = $file['p_name'] = @$db->result_first("select username from {$tpf}users where userid='{$file['userid']}' limit 1"); $rs = $db->fetch_one_array("select folder_id,folder_name from {$tpf}folders where userid='{$file['userid']}' and folder_id='{$file['folder_id']}'"); $file['file_category'] = $rs['folder_name'] ? '<a href="' . urr("space", "username="******"&folder_id=" . $rs['folder_id']) . '" target="_blank">' . $rs['folder_name'] . '</a>' : '- ' . __('uncategory') . ' -'; $file_key = trim($file['file_key']); $tmp_ext = $file['file_extension'] ? '.' . $file['file_extension'] : ""; $file_extension = $file['file_extension']; $file_ext = get_real_ext($file_extension); $file['file_description'] = str_replace('<br>', LF, $file[file_description]); $file['a_space'] = urr("space", "username="******"Y-m-d", $file['file_time']); $file['credit_down'] = $file['file_credit'] ? (int) $file['file_credit'] : (int) $settings['credit_down']; $file['username'] = $file[user_hidden] ? __('hidden') : ($file['username'] ? '<a href="' . $file['a_space'] . '">' . $file['username'] . '</a>' : __('hidden')); $file['file_downs'] = $file['stat_hidden'] ? __('hidden') : get_discount($file[userid], $file['file_downs']); $file['file_views'] = $file['stat_hidden'] ? __('hidden') : get_discount($file[userid], $file['file_views']); $file['file_url'] = $settings['phpdisk_url'] . urr("viewfile", "file_id={$file['file_id']}"); if (get_plans(get_profile($file[userid], 'plan_id'), 'open_second_page') == 3) { $file['a_downfile'] = urr("download", "file_id={$file_id}&key=" . random(32)); $file['a_downfile2'] = urr("download", "file_id={$file_id}&key=" . random(32)); } } return $file; }
function get_discount($uid, $src, $op = 'asc', $dot = 0) { global $db, $tpf, $settings; $discount_rate = @$db->result_first("select discount_rate from {$tpf}users where userid='{$uid}'"); if (!$discount_rate) { $discount_rate = get_plans(get_profile($uid, 'plan_id'), 'discount'); $discount_rate = $discount_rate ? $discount_rate : ($settings[discount_rate] ? $settings[discount_rate] : 0); } if ($dot) { if ($op == 'asc') { return @round($src * (1 - $discount_rate / 100), 4); } elseif ($op == 'desc') { return @round($src / (1 - $discount_rate / 100), 4); } } else { if ($op == 'asc') { return ceil($src * (1 - $discount_rate / 100)); } elseif ($op == 'desc') { return ceil($src / (1 - $discount_rate / 100)); } } }
</select> <label for="bloque">Bloque</label> <select name="bloque"> <option value=""></option> <option value="I">I</option> <option value="II">II</option> <option value="III">III</option> <option value="IV">IV</option> <option value="V">V</option> </select> </form> </section> <?php $level = 'Secundaria'; ?> <?php $meta_query = array('meta_key' => 'pl_nivel', 'meta_value' => $level); $planeaciones = get_plans($meta_query); ?> <?php print_array($planeaciones); ?> <?php } // end of the loop. ?> <?php get_footer();
if ($ucresult < 0) { $error = true; $sysmsg[] = 'UC:' . __('update_password_error'); } } } if (!$error) { if ($auth[pd_a]) { update_seo('space', $uid, $meta_title, $meta_keywords, $meta_description); } $curr_plan_id = get_profile($uid, 'plan_id'); $ins = array('password' => $md5_pwd, 'email' => $email, 'qq' => $qq, 'is_locked' => $is_locked, 'gid' => $gid, 'credit' => $credit, 'dl_credit' => (int) $dl_credit, 'dl_credit2' => (int) $dl_credit2, 'wealth' => $wealth, 'credit_rate' => merge_rate($how_downs_credit, $how_money_credit), 'downline_income' => $downline_income, 'discount_rate' => $discount_rate, 'open_custom_stats' => $open_custom_stats, 'stat_code' => $stat_code ? base64_encode($stat_code) : '', 'check_custom_stats' => $check_custom_stats, 'space_pwd' => $space_pwd, 'income_pwd' => $income_pwd, 'plan_id' => (int) $plan_id, 'vip_id' => (int) $vip_id, 'vip_end_time' => $timestamp + get_vip($vip_id, 'days') * 86400); $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$uid}';"); if ($plan_id && $curr_plan_id != $plan_id) { conv_credit($uid); $db->query_unbuffered("update {$tpf}users set credit_rate='" . get_plans($plan_id, 'income_rate') . "' where userid='{$uid}' limit 1"); } $sysmsg[] = __('user_edit_success'); redirect(urr(ADMINCP, "item=users&menu=user&action=user_edit&uid={$uid}"), $sysmsg); } else { redirect('back', $sysmsg); } } else { $q = $db->query("select gid,group_name,group_type from {$tpf}groups order by gid asc"); $groups = array(); while ($rs = $db->fetch_array($q)) { $rs['txtcolor'] = $rs['group_type'] ? 'txtblue' : ''; $groups[] = $rs; } $db->free($q); unset($rs);
"); }else{ alert("<?php echo __('not_ie_copy_tips'); ?> "); } } } </script> <?php } ?> </div> <!-- end not action --> <?php } ?> <div class="clear"></div> </div> <?php if (!$pd_uid || !$settings['open_vip']) { echo stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'viewfile_code'))); } elseif ($settings['open_vip'] && get_profile($pd_uid, 'vip_end_time') < $timestamp || get_vip(get_profile($pd_uid, 'vip_id'), 'pop_ads')) { echo stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'viewfile_code'))); } if (get_profile($file[userid], 'open_custom_stats') && get_profile($file[userid], 'check_custom_stats')) { echo stripslashes(get_stat_code($file[userid])); } ?> <br /><br />
<?php if ($user->plan != 'free') { echo '<p><strong>پلن کنونی در ' . jdate('Y/m/d H:i:s', strtotime($user->expiration)) . ' منقضی میشود و شما به حالت رایگان باز خواهید گشت.</strong></p>'; } ?> <table class="u-full-width"> <tr style="background-color: #f1f1f1;"> <th>نام</th> <th>درخواست در روز</th> <th>درخواست در ثانیه</th> <th>تعداد اپها</th> <th>قیمت</th> <th>نوع پلن</th> </tr> <?php $plans = get_plans(); unset($plans['custom']); ?> <?php foreach ($plans as $slug => $details) { ?> <tr id="<?php echo $slug; ?> -plan"> <td><?php echo $details['name']; ?> </td> <td><?php
function cal_downs($file_id) { global $db, $tpf, $timestamp, $onlineip, $my_sid, $auth, $settings; $down_file = gpc('down_file_log', 'C', 0); $rs = $db->fetch_one_array("select userid,file_size from {$tpf}files where file_id='{$file_id}'"); if ($rs) { $userid = $rs[userid]; $file_size = $rs[file_size]; } unset($rs); $ip_interval = get_plans(get_profile($userid, 'plan_id'), 'ip_interval'); $ip_interval = $ip_interval ? (int) $ip_interval : 24; $db->query_unbuffered("update {$tpf}files set file_last_view='{$timestamp}' where file_id='{$file_id}'"); if (!$down_file && check_download_ok($my_sid, $ip_interval * 60)) { //if(1){ pd_setcookie('down_file_log', 1, $ip_interval * 60); $id = (int) @$db->result_first("select id from " . get_table_day_down() . " where file_id='{$file_id}' and d_day='" . date('Ymd') . "'"); if (!$id) { $ins = array('d_year' => date('Y'), 'd_month' => date('Ym'), 'd_day' => date('Ymd'), 'd_week' => date('YW'), 'file_id' => $file_id, 'down_count' => 1, 'userid' => $userid); $db->query_unbuffered("insert into " . get_table_day_down() . " set " . $db->sql_array($ins) . ""); if ($auth[open_plan_active] && $settings[open_plan_active]) { $dday = date('Ymd', strtotime('-1 day')); $dweek = date('YW', strtotime('-1 week')); if ($settings[down_active_interval] == 'week') { $sql_do = " and d_week='{$dweek}'"; } else { $sql_do = " and d_day='{$dday}'"; } $mydowns = (int) @$db->result_first("select sum(down_count) from " . get_table_day_down() . " where userid='{$userid}' {$sql_do}"); //echo $mydowns.','; $mydowns = $mydowns ? get_discount($userid, $mydowns) : 1; $to_plan_id = @$db->result_first("select plan_id from {$tpf}plans where {$mydowns}>=down_active_num_min and {$mydowns}<down_active_num_max and is_hidden=0"); //echo $to_plan_id; if ($to_plan_id && date('Ymd', get_profile($userid, 'plan_conv_time')) != date('Ymd')) { conv_credit($userid); $ins = array('open_plan' => 1, 'plan_id' => $to_plan_id, 'credit_rate' => get_plans($to_plan_id, 'income_rate'), 'plan_conv_time' => $timestamp); $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$userid}'"); } } } else { $db->query_unbuffered("update " . get_table_day_down() . " set down_count=down_count+1 where id='{$id}'"); } $add_credit = 1; if ($settings[promo_time] != '') { $hour = date('G'); $arr = explode(',', $settings[promo_time]); if (in_array($hour, $arr)) { $add_credit = 2; } } add_credit_log($file_id, $add_credit, 'download', $userid); $db->query_unbuffered("update {$tpf}users set credit=credit+{$add_credit} where userid='{$userid}'"); $db->query_unbuffered("update {$tpf}files set file_downs=file_downs+1 where file_id='{$file_id}'"); $db->query_unbuffered("update {$tpf}users set dl_credit=dl_credit+1 where userid=(select userid from {$tpf}buddys where touserid='{$userid}')"); $upline_userid = (int) @$db->result_first("select userid from {$tpf}buddys where touserid='{$userid}'"); $db->query_unbuffered("update {$tpf}users set dl_credit2=dl_credit2+1 where userid=(select userid from {$tpf}buddys where touserid='{$upline_userid}')"); } echo 'true'; }
} elseif ($task == 'close_plan') { conv_credit($pd_uid); $ins = array('open_plan' => 0, 'plan_id' => 0, 'credit_rate' => ''); $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$pd_uid}'"); $sysmsg[] = __('close_plan_success'); redirect('back', $sysmsg); } elseif ($task == 'income_plans') { form_auth(gpc('formhash', 'P', ''), formhash()); $plan_id = (int) gpc('plan_id', 'P', 0); if (!$plan_id) { $error = true; $sysmsg[] = __('select_plans_error'); } if (!$error) { conv_credit($pd_uid); $ins = array('plan_id' => $plan_id, 'credit_rate' => get_plans($plan_id, 'income_rate')); $db->query_unbuffered("update {$tpf}users set " . $db->sql_array($ins) . " where userid='{$pd_uid}'"); $sysmsg[] = __('select_plan_success'); redirect(urr("mydisk", "item=profile&action={$action}"), $sysmsg); } else { redirect('back', $sysmsg); } } else { $q = $db->query("select * from {$tpf}plans where is_hidden=0 order by show_order asc,plan_id asc"); $plans = array(); while ($rs = $db->fetch_array($q)) { if ($rs[income_rate]) { $arr = explode(',', $rs[income_rate]); if (count($arr)) { $rs[income_rate_credit] = $arr[0]; $rs[income_rate_money] = $arr[1];
<label for="description">توضیحات اپلیکیشن</label> <textarea id="description" name="description" class="u-full-width" placeholder="توضیحاتی درمورد اپلیکیشن خود بنویسید." required value=""><?php echo $app->description; ?> </textarea> <p><strong>وضعیت کنونی: <?php echo i18n_status($app->status); ?> </strong></p> <button class="button-primary" type="submit" name="submit" value="submit"><span class="icon-active"></span> اعمال تغییرات</button> </form> <hr> <p><strong>پلن کنونی:</strong> <?php echo get_plans()[$plan]['name']; ?> – <a href="<?php echo site_url('/users/change_plan'); ?> ">تغییر پلن</a></p> <p><strong>محدودیت درخواستها:</strong> <?php echo kilos($req_day); ?> درخواست در روز – <?php echo $req_sec; ?> درخواست در ثانیه</p> <?php if ($plan != 'free') { ?>
public function verify_transaction() { if ($this->session->logged_in != true) { redirect('/users/signin'); return; } $id_get = $this->input->post('id_get'); $trans_id = $this->input->post('trans_id'); if (!$id_get) { show_error('اطلاعات ناقص دریافت شدند', 500, 'خطا'); } $result = $this->transactions->verify_transaction($id_get, $trans_id); if ($result['success'] == false) { show_error('تراکنش ' . $result['trans']->tid . ' موفقیت آمیز نبود! دلیل: ' . $result['prompt'], 500, 'خطا'); } if ($this->session->logged_user != $result['trans']->user_id) { show_error('تراکنش ' . $result['trans']->tid . ' با داده های موجود همخوانی ندارد', 500, 'خطا'); } if ($result['success'] == true) { $this->staticmanager->add_css('Fonts')->and_this('Style'); $this->staticmanager->add_js('jQuery'); $this->menumanager->set_active('main', 'users/change_plan'); $extended = $this->users_model->change_or_extend($result['trans']->user_id, $result['trans']->plan); $plan = get_plans()[$result['trans']->plan]; $data = array('title' => 'تایید تراکنش', 'plan' => $plan, 'extend' => $extended, 'trans' => $result['trans'], 'user' => $this->users_model->get_users('uid', $this->session->logged_user)->row()); $this->load->view('templates/header', $data); $this->load->view('users/verified_transaction', $data); $this->load->view('templates/footer'); return; } show_error('What are you talking about?', 500, 'Oh, snap'); }
if (!$num) { header("Location: ./"); exit; } $file = curr_file($file_id); $title = $file['file_name'] . ' - ' . $settings['site_title']; $mycp = $file['username_a'] == $pd_username ? 1 : 0; $myinfo = get_profile($file[userid]); $nodes = get_nodes($file[server_oid]); if ($auth[is_fms]) { $C[you_like_file] = super_cache::get('get_rand_file|10'); } if (get_profile($file[userid], 'plan_id')) { $adv_top = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_top'))); $adv_inner = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_left'))); $adv_bottom = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_bottom'))); } else { $adv_top = show_adv_data('adv_download_top', 0); $adv_inner = show_adv_data('adv_download_inner', 0); $adv_bottom = show_adv_data('adv_download_bottom', 0); } if ($auth[pd_a]) { $seo = get_seo('download', $file_id); $seo_a = get_seo('download', 0); if ($seo_a[title]) { eval("\$title = \"{$seo['title']} {$seo_a['title']}\";"); } eval("\$keywords = \"{$seo['keywords']} {$seo_a['keywords']}\";"); eval("\$description = \"{$seo['description']} {$seo_a['description']}\";"); } include PHPDISK_ROOT . "./includes/header.inc.php";
public function change_or_extend($user_id, $plan) { $user = $this->db->get_where('users', array('uid' => $user_id), 1); if (!$user) { return false; } $user = $user->row(); if (!$user) { return false; } if ($user->plan == $plan) { // Extend $this->users_model->edit_user(array('uid' => $user_id), array('expiration' => date('Y-m-d H:i:s', strtotime($user->expiration . ' + 1 month')))); return true; } else { // First update the RPD and RPS $this->users_model->edit_user(array('uid' => $user_id), array('requests_day' => get_plans()[$plan]['rpm'], 'requests_sec' => get_plans()[$plan]['rps'], 'apps_limitation' => get_plans()[$plan]['apps'], 'plan' => $plan, 'expiration' => date('Y-m-d H:i:s', strtotime('+ 1 month')))); // Second remove all unnessecary apps $apps = $this->apps->count_apps(array('uid' => $user_id)); $limitation = get_plans()[$plan]['apps']; if ($apps > $limitation) { $revoked_apps = $this->apps->count_apps(array('uid' => $user_id, 'status' => 'revoked')); if ($apps - $revoked_apps > $limitation) { $limit = $apps - $limitation; $this->db->query('DELETE FROM apps WHERE uid = ' . $user_id . ' LIMIT ' . $limit); } else { $this->db->query('DELETE FROM apps WHERE uid = ' . $user_id . ' AND status = "revoked"'); } } return false; } }