function price_format($price) { return \site\utils::money_format($price); }
public static function while_invoices($category = array()) { global $db; $categories = \site\utils::validate_user_data($category); $where = $orderby = $limit = array(); if (isset($categories['max'])) { if (!empty($categories['max'])) { $limit[] = $categories['max']; } } else { $page = !empty($_GET['page']) ? (int) $_GET['page'] : 1; $per_page = isset($categories['per_page']) ? (int) $categories['per_page'] : \query\main::get_option('items_per_page'); $offset = isset($page) && $page > 1 ? ($page - 1) * $per_page : 0; $limit[] = $offset; $limit[] = $per_page; } /* WHERE / ORDER BY */ if (!empty($categories['search'])) { $search = implode('.*', explode(' ', trim($categories['search']))); $where[] = 'CONCAT(t.gateway, t.transaction_id, t.details) REGEXP "' . \site\utils::dbp($search) . '"'; } if (isset($categories['show'])) { switch ($categories['show']) { case 'paid': $where[] = 'paid > 0'; break; case 'unpaid': $where[] = 'paid = 0'; break; case 'delivered': $where[] = 'delivered > 0'; break; case 'undelivered': $where[] = 'delivered = 0'; break; case 'undeliveredpayments': $where[] = 'paid > 0 AND delivered = 0'; } } if (!empty($categories['date'])) { $date = array_map('trim', explode(',', $categories['date'])); $where[] = 't.date >= FROM_UNIXTIME(' . \site\utils::dbp($date[0]) . ')'; if (isset($date[1])) { $where[] = 't.date <= FROM_UNIXTIME(' . \site\utils::dbp($date[1]) . ')'; } } if (isset($categories['orderby'])) { $order = array_map('trim', explode(',', strtolower($categories['orderby']))); foreach ($order as $v) { switch ($v) { case 'rand': $orderby[] = 'RAND()'; break; case 'date': $orderby[] = 't.date'; break; case 'date desc': $orderby[] = 't.date DESC'; break; case 'price': $orderby[] = 't.price'; break; case 'price desc': $orderby[] = 't.price DESC'; break; } } } /* */ $stmt = $db->stmt_init(); $stmt->prepare("SELECT t.id, t.user, u.name, u.avatar, t.gateway, t.price, t.transaction_id, t.state, t.details, t.lastupdate, t.paid, t.delivered, t.date FROM " . DB_TABLE_PREFIX . "p_transactions t LEFT JOIN " . DB_TABLE_PREFIX . "users u ON (u.id = t.user)" . (empty($where) ? '' : ' WHERE ' . implode(' AND ', $where)) . (empty($orderby) ? '' : ' ORDER BY ' . implode(', ', array_filter($orderby))) . (empty($limit) ? '' : ' LIMIT ' . implode(',', $limit))); $stmt->execute(); $stmt->bind_result($id, $user, $user_name, $user_avatar, $gateway, $price, $transaction_id, $state, $details, $last_update, $paid, $delivered, $date); $data = array(); while ($stmt->fetch()) { $data[] = (object) array('ID' => $id, 'user' => $user, 'user_name' => $user_name, 'user_avatar' => $user_avatar, 'gateway' => htmlspecialchars($gateway), 'price' => $price, 'price_format' => sprintf(PRICE_FORMAT, \site\utils::money_format($price)), 'transaction_id' => htmlspecialchars($transaction_id), 'state' => htmlspecialchars($state), 'details' => htmlspecialchars($details), 'last_update' => $last_update, 'paid' => $paid, 'delivered' => $delivered, 'date' => $date); } $stmt->close(); return $data; }
</div> </section>'; } if ($GLOBALS['me']->is_admin) { echo '<section class="el-row"> <h2>' . $LANG['payments'] . ' <a href="#" class="updown" data-set="payments">' . (isset($_SESSION['ses_set']['payments']) && ($show_payments = $_SESSION['ses_set']['payments']) ? 'S' : 'R') . '</a></h2> <div class="el-row-body"' . (!empty($show_payments) ? ' style="display: none;"' : '') . '> <ul class="announce-box abdash"> <li>' . $LANG['today'] . ':<b>' . sprintf(PRICE_FORMAT, \site\utils::money_format((double) \query\payments::payments(array('show' => 'paid', 'date' => strtotime('today')))['sum'])) . '</b></li> <li>' . $LANG['yesterday'] . ':<b>' . sprintf(PRICE_FORMAT, \site\utils::money_format((double) \query\payments::payments(array('show' => 'paid', 'date' => strtotime('-2 days 00:00:00') . ',' . strtotime('today')))['sum'])) . '</b></li> <li>' . $LANG['this_week'] . ':<b>' . sprintf(PRICE_FORMAT, \site\utils::money_format((double) \query\payments::payments(array('show' => 'paid', 'date' => strtotime('last week 00:00:00')))['sum'])) . '</b></li> <li>' . $LANG['this_month'] . ':<b>' . sprintf(PRICE_FORMAT, \site\utils::money_format((double) \query\payments::payments(array('show' => 'paid', 'date' => strtotime('first day of this month 00:00:00')))['sum'])) . '</b></li> </ul> </section>'; } echo '<ul class="elements-list">'; if (ab_to(array('stores' => 'view'))) { echo '<li> <div class="info-div"><b>' . \query\main::stores() . '</b> ' . strtolower($LANG['stores']) . '</div> <div class="options"> <a href="?route=stores.php&action=list">' . $LANG['view'] . '</a> <a href="?route=stores.php&action=add">' . $LANG['add'] . '</a> </div> </li>'; } if (ab_to(array('coupons' => 'view'))) {
$info->image = ''; echo '<div class="a-success">' . $LANG['msg_deleted'] . '</div>'; } else { echo '<div class="a-error">' . $LANG['msg_error'] . '</div>'; } } } } } $_SESSION['payments_csrf'] = $csrf; echo '<div class="form-table"> <form action="#" method="POST" enctype="multipart/form-data"> <div class="row"><span>' . $LANG['form_name'] . ':</span><div><input type="text" name="name" value="' . $info->name . '" /></div></div> <div class="row"><span>' . $LANG['form_price'] . ':</span><div><input type="text" name="price" value="' . $info->price_format . '" placeholder="' . sprintf(PRICE_FORMAT, \site\utils::money_format(0.0)) . '" /></div> </div> <div class="row"><span>' . $LANG['form_credits'] . ':</span><div><input type="number" name="credits" min="0" value="' . $info->credits . '" /></div> </div> <div class="row"><span>' . $LANG['form_image'] . ':</span> <div> <div style="display: table; margin-bottom: 2px;"><img src="' . \query\main::payment_plan_avatar($info->image) . '" class="avt" alt="" style="display: table-cell; width:80px; height:80px; margin: 0 20px 5px 0;" /> <div style="display: table-cell; vertical-align: middle; margin-left: 25px;">'; if (!empty($info->image)) { echo '<a href="' . \site\utils::update_uri('', array('type' => 'delete_image', 'token' => $csrf)) . '" class="btn" data-delete-msg="' . $LANG['delete_msg'] . '">' . $LANG['delete'] . '</a>'; } echo '</div> </div> <input type="file" name="logo" /></div> </div> <div class="row"><span>' . $LANG['form_description'] . ':</span><div><textarea name="text" style="min-height:100px;">' . $info->description . '</textarea></div></div>
<form action="#" method="POST" enctype="multipart/form-data" autocomplete="off"> <div class="row"><span>' . $LANG['form_store_id'] . ':</span><div data-search="store"><input type="text" name="store" value="' . $info->storeID . '" required /><a href="#">S</a></div></div> <div class="row"><span>' . $LANG['form_category'] . ':</span> <div><select name="category">'; $categories_while = \query\main::while_categories(array('max' => 0, 'show' => 'subcats')); foreach ($categories_while as $cat) { echo '<option value="' . $cat->ID . '"' . ($info->catID == $cat->ID ? ' selected' : '') . '>' . $cat->name . '</option>'; } echo '</select></div></div> <div class="row"><span>' . $LANG['form_name'] . ':</span><div><input type="text" name="name" value="' . $info->title . '" /></div></div> <div class="row"><span>' . $LANG['form_price'] . ':</span><div><input type="text" name="price" value="' . (empty($info->price) ? '' : \site\utils::money_format($info->price)) . '" placeholder="' . \site\utils::money_format(0.0) . '" /></div></div> <div class="row"><span>' . $LANG['form_old_price'] . ':</span><div><input type="text" name="old_price" value="' . (empty($info->old_price) ? '' : \site\utils::money_format($info->old_price)) . '" placeholder="' . \site\utils::money_format(0.0) . '" /></div></div> <div class="row"><span>' . $LANG['form_currency'] . ':</span><div><input type="text" name="currency" value="' . $info->currency . '" /></div></div> <div class="row"><span>' . $LANG['form_product_url'] . ':</span><div><input type="checkbox" name="product_ownlink" value="1" id="ownlink"' . (empty($info->original_url) ? ' checked' : '') . ' /> <label for="ownlink">' . $LANG['products_use_link'] . '</label> <br /> <input type="text" name="link" value="' . (!empty($info->original_url) ? $info->original_url : 'http://') . '"' . (empty($info->original_url) ? ' style="display: none;"' : '') . ' /> </div></div> <div class="row"><span>' . $LANG['form_description'] . ':</span><div><textarea name="description">' . $info->description . '</textarea></div></div> <div class="row"><span>' . $LANG['form_tags'] . ':</span><div><input type="text" name="tags" value="' . $info->tags . '" /></div></div> <div class="row"><span>' . $LANG['form_image'] . ':</span> <div> <div style="display: table; margin-bottom: 2px;"><img src="' . \query\main::product_avatar($info->image) . '" class="avt" alt="" style="display: table-cell; width:100px; height:100px; margin: 0 20px 5px 0;" /> <div style="display: table-cell; vertical-align: middle; margin-left: 25px;">'; if (!empty($info->image)) { echo '<a href="' . \site\utils::update_uri('', array('type' => 'delete_image', 'token' => $csrf)) . '" class="btn" data-delete-msg="' . $LANG['delete_msg'] . '">' . $LANG['delete'] . '</a>'; }