<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=users.profile.update.first, users.edit.update.first, users.register.add.first
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('usercategories', 'plug');
$catslimit = cot_cfg_usercategories();
$rcats = cot_import('rcats', 'P', 'ARR');
if (is_array($rcats)) {
    $rcats = array_filter($rcats);
    $ruser['user_cats'] = implode(',', $rcats);
    if ($m == 'edit' || $m == 'profile') {
        $groupid = $urr['user_maingrp'];
    } else {
        $groupid = cot_import('ruserusergroup', 'P', 'INT');
    }
    if (!cot_plugin_active('paypro') || cot_plugin_active('paypro') && !cot_getuserpro($urr)) {
        cot_check($catslimit[$groupid] > 0 && count($rcats) > $catslimit[$groupid], cot_rc($L['usercategories_error_catslimit'], array('limit' => $catslimit[$groupid])), 'rcats');
    }
}
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=header.tags,header.user.tags
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('paypro', 'plug');
$t1 = new XTemplate(cot_tplfile('paypro.header', 'plug'));
$upro = cot_getuserpro();
$t1->assign(array('USER_ISPRO' => $upro ? TRUE : FALSE, 'USER_PROEXPIRE' => $upro));
$t1->parse('MAIN');
$t->assign('HEADER_PAYPRO', $t1->text('MAIN'));
$t->assign('HEADER_USER_PROEXPIRE', $upro);
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=projects.addofferform.main
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('paypro', 'plug');
if (!cot_getuserpro() && $item['item_userid'] != $usr['id'] && !$usr['isadmin']) {
    if ($cfg['plugin']['paypro']['offerslimit'] > 0) {
        $countoffersofuser = cot_getcountoffersofuser($usr['id']);
        if ($countoffersofuser >= $cfg['plugin']['paypro']['offerslimit']) {
            $addoffer_enabled = false;
            $t_o->parse("MAIN.OFFERSLIMITEMPTY");
        }
    }
    if ($item['item_forpro']) {
        $addoffer_enabled = false;
        $t_o->parse("MAIN.PROJECTFORPRO");
    }
}
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=projects.add.first
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('paypro', 'plug');
if (!cot_getuserpro() && $cfg['plugin']['paypro']['projectslimit'] > 0 && $cfg['plugin']['paypro']['projectslimit'] <= cot_getcountprjofuser($usr['id'])) {
    cot_block();
}
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=global
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('paypro', 'plug');
require_once cot_incfile('payments', 'module');
// Проверяем платежки на оплату услуги PRO. Если есть то включаем услугу или продлеваем ее.
if ($propays = cot_payments_getallpays('pro', 'paid')) {
    foreach ($propays as $pay) {
        $userid = !empty($pay['pay_code']) ? $pay['pay_code'] : $pay['pay_userid'];
        $upro = cot_getuserpro($userid);
        $initialtime = $upro > $sys['now'] ? $upro : $sys['now'];
        $rproexpire = $initialtime + $pay['pay_time'];
        if (cot_payments_updatestatus($pay['pay_id'], 'done')) {
            $db->update($db_users, array('user_pro' => (int) $rproexpire), "user_id=" . (int) $userid);
            /* === Hook === */
            foreach (cot_getextplugins('paypro.done') as $pl) {
                include $pl;
            }
            /* ===== */
        }
    }
}
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=usertags.main
 * [END_COT_EXT]
 */
/**
 * PayPro plugin
 *
 * @package paypro
 * @version 1.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('paypro', 'plug');
$temp_array['ISPRO'] = !empty($user_data) ? cot_getuserpro($user_data) : false;
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=users.profile.update.first, users.edit.update.first, users.register.add.first
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('usercategories', 'plug');
$catslimit = cot_cfg_usercategories();
$rcats = cot_import('rcats', 'P', 'ARR');
if (is_array($rcats)) {
    $rcats = array_filter($rcats);
    $ruser['user_cats'] = implode(',', $rcats);
    if ($m == 'edit' || $m == 'profile') {
        $groupid = $urr['user_maingrp'];
    } else {
        $groupid = cot_import('ruserusergroup', 'P', 'INT');
    }
    if (!cot_plugin_active('paypro') || cot_plugin_active('paypro') && !cot_getuserpro($urr)) {
        cot_check($catslimit[$groupid]['default'] > 0 && count($rcats) > $catslimit[$groupid]['default'], cot_rc($L['usercategories_error_catslimit'], array('limit' => $catslimit[$groupid]['default'])), 'rcats');
    } elseif (cot_plugin_active('paypro') && cot_getuserpro($urr)) {
        cot_check($catslimit[$groupid]['pro'] > 0 && count($rcats) > $catslimit[$groupid]['pro'], cot_rc($L['usercategories_error_catslimit'], array('limit' => $catslimit[$groupid]['pro'])), 'rcats');
    }
}