예제 #1
0
function cot_get_paytop($area = '', $count = 0, $order = "s.service_id DESC")
{
    global $db, $cfg, $sys, $db_payments_services, $db_users;
    $pt_cfg = cot_cfg_paytop();
    if ($count == 0) {
        $count = $pt_cfg[$area]['count'];
    }
    if (empty($area) && !isset($pt_cfg[$area]['cost'])) {
        return false;
    }
    $t1 = new XTemplate(cot_tplfile(array('paytop', 'list', $area), 'plug'));
    $paytopcount = $db->query("SELECT COUNT(*) FROM {$db_payments_services} as s\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=s.service_userid\n\t\tWHERE u.user_id>0 AND s.service_area='paytop." . $db->prep($area) . "' AND service_expire > " . $sys['now'])->fetchColumn();
    $paytops = $db->query("SELECT * FROM {$db_payments_services} as s\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=s.service_userid\n\t\tWHERE u.user_id>0 AND s.service_area='paytop." . $db->prep($area) . "' AND service_expire > " . $sys['now'] . " ORDER BY {$order} LIMIT " . $count)->fetchAll();
    $jj = 0;
    foreach ($paytops as $tur) {
        $jj++;
        $t1->assign(cot_generate_usertags($tur, 'TOP_ROW_'));
        $t1->assign(array('TOP_ROW_JJ' => $jj, 'TOP_ROW_EXPIRE' => $tur['service_expire']));
        $t1->parse('MAIN.TOP_ROW');
    }
    $t1->assign(array('PAYTOP_BUY_URL' => cot_url('plug', 'e=paytop&area=' . $area), 'PAYTOP_COUNT' => $paytopcount));
    $t1->parse('MAIN');
    return $t1->text('MAIN');
}
예제 #2
0
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=tools
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_langfile('paytop', 'plug');
$pt_cfg = cot_cfg_paytop();
$t = new XTemplate(cot_tplfile('paytop.admin', 'plug', true));
$id = cot_import('id', 'G', 'INT');
if ($a == 'add') {
    $username = cot_import('username', 'P', 'TXT', 100, TRUE);
    $area = cot_import('area', 'P', 'ALP');
    $times = cot_import('times', 'P', 'INT');
    $urr_id = $db->query("SELECT user_id FROM {$db_users} WHERE user_name='" . $username . "'")->fetchColumn();
    cot_check(empty($username), 'paytop_error_username');
    cot_check(empty($urr_id), 'paytop_error_userempty');
    cot_check(empty($times), 'paytop_error_timesempty');
    cot_check(empty($area), 'paytop_error_areaempty');
    if (!cot_error_found()) {
        cot_payments_userservice('paytop.' . $area, $urr_id, $times * $pt_cfg[$area]['period']);
        /* === Hook === */
        foreach (cot_getextplugins('paytop.done') as $pl) {
            include $pl;
        }
        /* ===== */
        /* === Hook === */
        foreach (cot_getextplugins('paytop.' . $area . '.done') as $pl) {
            include $pl;