Esempio n. 1
0
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;
        }
        /* ===== */
    }
    cot_redirect(cot_url('admin', 'm=other&p=paytop', '', true));
}
if ($a == 'delete') {
    $db->delete($db_payments_services, "service_id=?", array($id));
Esempio n. 2
0
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=global
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('paytop', 'plug');
require_once cot_incfile('payments', 'module');
// Проверяем платежки на оплату услуги TOP. Если есть то включаем услугу или продлеваем ее.
$pt_cfg = cot_cfg_paytop();
foreach ($pt_cfg as $area => $opt) {
    if ($toppays = cot_payments_getallpays('paytop.' . $area, 'paid')) {
        foreach ($toppays as $pay) {
            if (cot_payments_userservice('paytop.' . $area, $pay['pay_userid'], $pay['pay_time'])) {
                if (cot_payments_updatestatus($pay['pay_id'], 'done')) {
                    /* === Hook === */
                    foreach (cot_getextplugins('paytop.done') as $pl) {
                        include $pl;
                    }
                    /* ===== */
                    /* === Hook === */
                    foreach (cot_getextplugins('paytop.' . $area . '.done') as $pl) {
                        include $pl;
                    }
                    /* ===== */
                }
            }
        }
    }