113 lines
3.3 KiB
PHP
113 lines
3.3 KiB
PHP
<?php
|
|
$page = "admin_subscriber_userhistory";
|
|
include "../admin/admin_header.php";
|
|
|
|
$p = semods::getpost('p', 1);
|
|
$task = semods::getpost('task', "main");
|
|
$user_id = semods::getpost('user_id', 0);
|
|
|
|
// VALIDATE USER ID OR RETURN TO VIEW USERS
|
|
$user = new se_user(Array($user_id));
|
|
if($user->user_exists == 0) { header("Location: admin_subscriber_viewusers.php?s=$s&p=$p&f_user=$f_user&f_email=$f_email&f_level=$f_level&f_enabled=$f_enabled"); exit(); }
|
|
|
|
|
|
|
|
$p = semods::getpost('p', 1);
|
|
$s = semods::getpost('s', 'dd');
|
|
$search = semods::getpost('search');
|
|
|
|
$success_message = semods::getpost('success_message');
|
|
$error_message = semods::getpost('error_message');
|
|
|
|
// ENSURE POINTS ARE ENABLED FOR THIS USER (?)
|
|
// if($user->level_info['level_userpoints_allow'] == 0) { header("Location: user_home.php"); exit(); }
|
|
|
|
|
|
// SET ENTRY SORT-BY VARIABLES FOR HEADING LINKS
|
|
$d = "d"; // Date
|
|
$st = "st"; // Status
|
|
$a = "a"; // Amount
|
|
|
|
// SET SORT VARIABLE FOR DATABASE QUERY
|
|
if($s == "d") {
|
|
$sort = "userpaymenthistory_date";
|
|
$d = "dd";
|
|
} elseif($s == "dd") {
|
|
$sort = "userpaymenthistory_date DESC";
|
|
$d = "d";
|
|
} elseif($s == "st") {
|
|
$sort = "userpaymenthistory_state";
|
|
$st = "std";
|
|
} elseif($s == "std") {
|
|
$sort = "userpaymenthistory_state DESC";
|
|
$st = "st";
|
|
} elseif($s == "a") {
|
|
$sort = "userpaymenthistory_amount";
|
|
$a = "ad";
|
|
} elseif($s == "ad") {
|
|
$sort = "userpaymenthistory_amount DESC";
|
|
$a = "a";
|
|
} else {
|
|
$sort = "userpaymenthistory_id DESC";
|
|
$d = "d";
|
|
}
|
|
|
|
$sql_head = "SELECT * ";
|
|
|
|
$sql_body = "FROM se_semods_userpaymenthistory";
|
|
|
|
$filters = array();
|
|
$filters[] = "userpaymenthistory_user_id = $user_id";
|
|
$search != "" ? $filters[] = "userpaymenthistory_text LIKE '%$search%'" :0;
|
|
|
|
!empty($filters) ? $sql_body .= " WHERE " . implode( " AND ", $filters):0;
|
|
|
|
|
|
$items_per_page = 10;
|
|
|
|
|
|
// GET TOTAL ITEMS
|
|
$sql_count = "SELECT COUNT(*) " . $sql_body;
|
|
$total_items = semods::db_query_count( $sql_count );
|
|
|
|
|
|
// MAKE PAGES
|
|
$page_vars = make_page($total_items, $items_per_page, $p);
|
|
|
|
$sql = $sql_head . $sql_body . " ORDER BY $sort LIMIT {$page_vars[0]}, $items_per_page";
|
|
|
|
|
|
$rows = $database->database_query( $sql );
|
|
while($row = $database->database_fetch_assoc($rows) ) {
|
|
|
|
$items[] = array(
|
|
'transaction_date' => $row['userpaymenthistory_date'],
|
|
'transaction_desc' => $row['userpaymenthistory_text'],
|
|
'transaction_status' => $payment_states[$row['userpaymenthistory_state']],
|
|
'transaction_amount' => $row['userpaymenthistory_amount']
|
|
);
|
|
|
|
SE_Language::_preload( $payment_states[$row['userpaymenthistory_state']] );
|
|
}
|
|
|
|
// ASSIGN VARIABLES AND SHOW VIEW ENTRIES PAGE
|
|
|
|
$smarty->assign('success_message', $success_message);
|
|
$smarty->assign('error_message', $error_message);
|
|
|
|
$smarty->assign('user_id', $user_id);
|
|
$smarty->assign('user_username', $setting['setting_username'] ? $user->user_info['user_username'] : $user->user_displayname );
|
|
|
|
$smarty->assign('s', $s);
|
|
$smarty->assign('d', $d);
|
|
$smarty->assign('st', $st);
|
|
$smarty->assign('a', $a);
|
|
$smarty->assign('search', $search);
|
|
$smarty->assign('total_items', $total_items);
|
|
$smarty->assign('items', $items);
|
|
$smarty->assign('p', $page_vars[1]);
|
|
$smarty->assign('maxpage', $page_vars[2]);
|
|
$smarty->assign('p_start', $page_vars[0]+1);
|
|
$smarty->assign('p_end', $page_vars[0]+count($items));
|
|
include "../admin/admin_footer.php";
|
|
?>
|