Ejemplo n.º 1
0
/**
 * Validates product data.
 * @param  array   $ritem Imported product data
 * @return boolean        TRUE if validation is passed or FALSE if errors were found
 */
function cot_market_validate($ritem)
{
    global $cfg, $structure;
    cot_check(empty($ritem['item_cat']), 'market_select_cat', 'rcat');
    if ($structure['market'][$ritem['item_cat']]['locked']) {
        cot_error('market_locked_cat', 'rcat');
    }
    cot_check(mb_strlen($ritem['item_title']) < 2, 'market_empty_title', 'rtitle');
    cot_check(!empty($ritem['item_alias']) && preg_match('`[+/?%#&]`', $ritem['item_alias']), 'market_aliascharacters', 'ralias');
    $allowemptytext = isset($cfg['market']['cat_' . $ritem['item_cat']]['allowemptytext']) ? $cfg['market']['cat_' . $ritem['item_cat']]['allowemptytext'] : $cfg['market']['cat___default']['allowemptytext'];
    cot_check(!$allowemptytext && empty($ritem['item_text']), 'market_empty_text', 'rtext');
    return !cot_error_found();
}
Ejemplo n.º 2
0
        /* === Hook === */
        foreach (cot_getextplugins('reviews.add.add.done') as $pl) {
            include $pl;
        }
        /* ===== */
    }
} elseif ($a == 'update') {
    $sql = $db->query("SELECT * FROM {$db_reviews} as r LEFT JOIN {$db_users} as u ON u.user_id=r.item_touserid WHERE item_id='{$itemid}' LIMIT 1");
    cot_die($sql->rowCount() == 0);
    $item = $sql->fetch();
    cot_block($usr['isadmin'] || $usr['id'] == $item['item_userid']);
    $delete = cot_import('rdelete', 'P', 'BOL');
    $ritem['item_text'] = cot_import('rtext', 'P', 'TXT');
    $ritem['item_score'] = (int) cot_import('rscore', 'P', 'INT');
    cot_check(empty($ritem['item_text']), 'reviews_error_emptytext');
    cot_check(empty($ritem['item_score']), 'review_error_emptyscore');
    if (!cot_error_found()) {
        $db->update($db_reviews, $ritem, "item_id='" . (int) $itemid . "'");
        /* === Hook === */
        foreach (cot_getextplugins('reviews.edit.update.done') as $pl) {
            include $pl;
        }
        /* ===== */
    }
} elseif ($a == 'delete') {
    $sql = $db->query("SELECT * FROM {$db_reviews} as r\n\t\tLEFT JOIN {$db_users} as u ON u.user_id=r.item_touserid WHERE item_id='{$itemid}' LIMIT 1");
    cot_die($sql->rowCount() == 0);
    $item = $sql->fetch();
    cot_block($usr['id'] == $item['item_userid'] || $usr['isadmin']);
    $db->delete($db_reviews, "item_id='{$itemid}'");
    /* === Hook === */
Ejemplo n.º 3
0
/**
 * Validates product data.
 * @param  array   $ritem Imported product data
 * @return boolean        TRUE if validation is passed or FALSE if errors were found
 */
function cot_folio_validate($ritem)
{
    global $cfg, $structure;
    cot_check(empty($ritem['item_cat']), 'folio_select_cat', 'rcat');
    if ($structure['folio'][$ritem['item_cat']]['locked']) {
        global $L;
        require_once cot_langfile('message', 'core');
        cot_error('msg602_body', 'rcat');
    }
    cot_check(mb_strlen($ritem['item_title']) < 2, 'folio_empty_title', 'rtitle');
    cot_check(!empty($ritem['item_alias']) && preg_match('`[+/?%#&]`', $ritem['item_alias']), 'folio_aliascharacters', 'ralias');
    $allowemptytext = isset($cfg['folio']['cat_' . $ritem['item_cat']]['allowemptytext']) ? $cfg['folio']['cat_' . $ritem['item_cat']]['allowemptytext'] : $cfg['folio']['cat___default']['allowemptytext'];
    cot_check(!$allowemptytext && empty($ritem['item_text']), 'folio_empty_text', 'rtext');
    return !cot_error_found();
}
}
/* ===== */
if ($a == 'add') {
    cot_shield_protect();
    /* === Hook === */
    foreach (cot_getextplugins('marketorders.addclaim.add.first') as $pl) {
        include $pl;
    }
    /* ===== */
    $rorder['order_claimtext'] = cot_import('rclaimtext', 'P', 'TXT');
    /* === Hook === */
    foreach (cot_getextplugins('marketorders.addclaim.add.import') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_check(empty($rorder['order_claimtext']), 'marketorders_order_error_claimtext', 'rclaimtext');
    /* === Hook === */
    foreach (cot_getextplugins('marketorders.addclaim.add.error') as $pl) {
        include $pl;
    }
    /* ===== */
    if (!cot_error_found()) {
        $rorder['order_claim'] = $sys['now'];
        $rorder['order_status'] = 'claim';
        $db->update($db_market_orders, $rorder, 'order_id=' . $id);
        $seller = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $marketorder['order_seller'])->fetch();
        $customer = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $marketorder['order_userid'])->fetch();
        // Уведопляем продавца о том, что подана жалоба по этому заказу
        $rsubject = cot_rc($L['marketorders_addclaim_mail_toseller_header'], array('order_id' => $marketorder['order_id'], 'product_title' => $marketorder['item_title']));
        $rbody = cot_rc($L['marketorders_addclaim_mail_toseller_body'], array('product_title' => $marketorder['item_title'], 'order_id' => $marketorder['order_id'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('marketorders', "id=" . $marketorder['order_id'], '', true)));
        cot_mail($seller['user_email'], $rsubject, $rbody);
Ejemplo n.º 5
0
/**
 * Validates page data.
 * @param  array   $rpage Imported page data
 * @return boolean        TRUE if validation is passed or FALSE if errors were found
 */
function cot_page_validate($rpage)
{
    global $cfg, $structure;
    cot_check(empty($rpage['page_cat']), 'page_catmissing', 'rpagecat');
    if ($structure['page'][$rpage['page_cat']]['locked']) {
        global $L;
        require_once cot_langfile('message', 'core');
        cot_error('msg602_body', 'rpagecat');
    }
    cot_check(mb_strlen($rpage['page_title']) < 2, 'page_titletooshort', 'rpagetitle');
    cot_check(!empty($rpage['page_alias']) && preg_match('`[+/?%#&]`', $rpage['page_alias']), 'page_aliascharacters', 'rpagealias');
    $allowemptytext = isset($cfg['page']['cat_' . $rpage['page_cat']]['allowemptytext']) ? $cfg['page']['cat_' . $rpage['page_cat']]['allowemptytext'] : $cfg['page']['cat___default']['allowemptytext'];
    cot_check(!$allowemptytext && empty($rpage['page_text']), 'page_textmissing', 'rpagetext');
    return !cot_error_found();
}
Ejemplo n.º 6
0
     $rgroups['grp_name'] = cot_import('rname', 'P', 'TXT');
     $rgroups['grp_title'] = cot_import('rtitle', 'P', 'TXT');
     $rgroups['grp_desc'] = cot_import('rdesc', 'P', 'TXT');
     $rgroups['grp_icon'] = cot_import('ricon', 'P', 'TXT');
     $rgroups['grp_alias'] = cot_import('ralias', 'P', 'TXT');
     $rgroups['grp_level'] = (int) cot_import('rlevel', 'P', 'INT');
     $rgroups['grp_disabled'] = cot_import('rdisabled', 'P', 'BOL') ? 1 : 0;
     $rgroups['grp_maintenance'] = cot_import('rmtmode', 'P', 'BOL') ? 1 : 0;
     $rgroups['grp_skiprights'] = cot_import('rskiprights', 'P', 'BOL') ? 1 : 0;
     /* === Hook === */
     foreach (cot_getextplugins('admin.users.update') as $pl) {
         include $pl;
     }
     /* ===== */
     cot_check(empty($rgroups['grp_name']), 'adm_groups_name_empty', 'rname');
     cot_check(empty($rgroups['grp_title']), 'adm_groups_title_empty', 'rtitle');
     if (!cot_error_found()) {
         $db->update($db_groups, $rgroups, "grp_id={$g}");
         $was_rightless = $db->query("SELECT grp_skiprights FROM {$db_groups} WHERE grp_id = {$g}")->fetchColumn();
         if ($was_rightless && !$rgroups['grp_skiprights']) {
             // Add missing rights from default group
             cot_auth_add_group($grp_id, COT_GROUP_MEMBERS);
         } elseif (!$was_rightless && $rgroups['grp_skiprights']) {
             // Remove rights
             cot_auth_remove_group($g);
         }
         $cache && $cache->db->remove('cot_groups', 'system');
         cot_message('Updated');
     }
     cot_redirect(cot_url('admin', array('m' => 'users', 'n' => 'edit', 'g' => $g), '', true));
 } elseif ($a == 'delete' && $g > 5) {
Ejemplo n.º 7
0
     $sendersumm = $summ;
     $recipientsumm = $summ - $taxsumm;
 } else {
     $sendersumm = $summ + $taxsumm;
     $recipientsumm = $summ;
 }
 $ubalance = cot_payments_getuserbalance($usr['id']);
 $recipient = $db->query("SELECT * FROM {$db_users} WHERE user_name = ? LIMIT 1", array($username))->fetch();
 cot_check(empty($recipient), 'payments_balance_transfer_error_username');
 cot_check(!empty($recipient) && $username == $usr['name'], 'payments_balance_transfer_error_yourself');
 cot_check(empty($comment), 'payments_balance_transfer_error_comment');
 cot_check(empty($summ), 'payments_balance_transfer_error_emptysumm');
 cot_check(!empty($summ) && $summ < 0, 'payments_balance_transfer_error_wrongsumm');
 cot_check($sendersumm > $ubalance, 'payments_balance_transfer_error_balance');
 cot_check($cfg['payments']['transfermin'] > 0 && $summ < $cfg['payments']['transfermin'], sprintf($L['payments_balance_transfer_error_min'], $cfg['payments']['transfermin'], $cfg['payments']['valuta']));
 cot_check($cfg['payments']['transfermax'] > 0 && $summ > $cfg['payments']['transfermax'], sprintf($L['payments_balance_transfer_error_max'], $cfg['payments']['transfermax'], $cfg['payments']['valuta']));
 if (!cot_error_found()) {
     $payinfo['pay_userid'] = $usr['id'];
     $payinfo['pay_area'] = 'transfer';
     $payinfo['pay_code'] = $recipient['user_id'];
     $payinfo['pay_summ'] = $sendersumm;
     $payinfo['pay_cdate'] = $sys['now'];
     $payinfo['pay_pdate'] = $sys['now'];
     $payinfo['pay_adate'] = $sys['now'];
     $payinfo['pay_status'] = 'done';
     $payinfo['pay_desc'] = sprintf($L['payments_balance_transfer_desc'], $usr['name'], $recipient['user_name'], $comment);
     $db->insert($db_payments, $payinfo);
     $pid = $db->lastInsertId();
     cot_payments_updateuserbalance($usr['id'], -$sendersumm, $pid);
     $payinfo['pay_userid'] = $recipient['user_id'];
     $payinfo['pay_area'] = 'balance';
Ejemplo n.º 8
0
            cot_redirect(cot_url('sbr', 'id=' . $id . '&num=' . $num, '', true));
        }
    }
    cot_redirect(cot_url('sbr', 'id=' . $id . '&num=' . $num . '&action=decision', '', true));
}
if ($a == 'addpost') {
    cot_shield_protect();
    $rposttext = cot_import('rposttext', 'P', 'HTM');
    $to = cot_import('to', 'P', 'ALP');
    /* === Hook === */
    foreach (cot_getextplugins('sbr.post.add.import') as $pl) {
        include $pl;
    }
    /* ===== */
    if (empty($_FILES)) {
        cot_check(empty($rposttext), $L['sbr_posts_error_textempty'], 'rposttext');
    }
    if (!cot_error_found()) {
        if ($usr['isadmin']) {
            if ($to != 'all') {
                $recipient = $to == 'employer' ? $sbr['sbr_employer'] : $sbr['sbr_performer'];
            } else {
                $recipient = 0;
                $post_type = 'info';
            }
        } else {
            $recipient = $role == 'employer' ? $sbr['sbr_performer'] : $sbr['sbr_employer'];
        }
        $postid = cot_sbr_sendpost($id, $rposttext, $recipient, $usr['id'], $post_type, true, $_FILES['rpostfiles']);
    }
    cot_redirect(cot_url('sbr', 'id=' . $id . '&num=' . $num, '#addpost', true));
Ejemplo n.º 9
0
<?php

/* ====================
  [BEGIN_COT_EXT]
 * Hooks=standalone
  [END_COT_EXT]
  ==================== */
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
require_once cot_incfile('payprjbold', 'plug');
list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'payprjbold');
cot_block($auth_write);
$id = cot_import('id', 'G', 'INT');
if ($a == 'buy' && !empty($id)) {
    $days = cot_import('days', 'P', 'INT');
    cot_check(empty($days), 'payprjbold_error_days');
    if (!cot_error_found()) {
        $summ = $days * $cfg['plugin']['payprjbold']['cost'];
        $options['time'] = $days * 24 * 60 * 60;
        $options['code'] = $id;
        $options['desc'] = $L['payprjbold_buy_paydesc'];
        if ($db->fieldExists($db_payments, "pay_redirect")) {
            $options['redirect'] = $cfg['mainurl'] . '/' . cot_url('payments', 'm=balance', '', true);
        }
        cot_payments_create_order('prj.bold', $summ, $options);
    }
}
$t = new XTemplate(cot_tplfile('payprjbold', 'plug'));
cot_display_messages($t);
$t->assign(array('PAY_FORM_ACTION' => cot_url('plug', 'e=payprjbold&a=buy&id=' . $id), 'PAY_FORM_PERIOD' => cot_selectbox('', 'days', range(1, 30), range(1, 30), false)));
Ejemplo n.º 10
0
/**
 * [BEGIN_COT_EXT]
 * Hooks=tools
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_langfile('paypro', 'plug');
$t = new XTemplate(cot_tplfile('paypro.admin', 'plug', true));
$id = cot_import('id', 'G', 'INT');
if ($a == 'add') {
    $username = cot_import('username', 'P', 'TXT', 100, TRUE);
    $months = cot_import('months', 'P', 'INT');
    $urr = $db->query("SELECT * FROM {$db_users} WHERE user_name='" . $username . "'")->fetch();
    cot_check(empty($username), 'paypro_error_username');
    cot_check(empty($urr['user_id']), 'paypro_error_userempty');
    cot_check(empty($months), 'paypro_error_monthsempty');
    if (!cot_error_found()) {
        $rpro['user_pro'] = $urr['user_pro'] > $sys['now'] ? $urr['user_pro'] + $months * 30 * 24 * 60 * 60 : $sys['now'] + $months * 30 * 24 * 60 * 60;
        $db->update($db_users, $rpro, "user_id=" . $urr['user_id']);
    }
    cot_redirect(cot_url('admin', 'm=other&p=paypro', '', true));
}
if ($a == 'delete') {
    $db->update($db_users, array("user_pro" => 0), "user_id=?", array($id));
    cot_redirect(cot_url('admin', 'm=other&p=paypro', '', true));
}
$prousers = $db->query("SELECT * FROM {$db_users} AS u WHERE user_maingrp>3 ORDER BY user_pro DESC, user_name ASC")->fetchAll();
foreach ($prousers as $urr) {
    if ($id == $urr['user_id']) {
        $username = $urr['user_name'];
    }
Ejemplo n.º 11
0
/* ====================
  [BEGIN_COT_EXT]
 * Hooks=standalone
  [END_COT_EXT]
  ==================== */
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
require_once cot_incfile('paypro', 'plug');
list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'paypro');
cot_block($auth_write);
$id = cot_import('id', 'G', 'INT');
if ($a == 'buy') {
    $months = cot_import('months', 'P', 'INT');
    cot_check(empty($months), 'paypro_error_months');
    if (!empty($id) && $usr['id'] != $id) {
        $user = $db->query("SELECT * FROM {$db_users} WHERE user_id = ? LIMIT 1", array($id))->fetch();
        cot_check(empty($user), 'paypro_error_user');
    }
    if (!cot_error_found()) {
        $summ = $months * $cfg['plugin']['paypro']['cost'];
        $options['time'] = $months * 30 * 24 * 60 * 60;
        $options['desc'] = !empty($id) ? $L['paypro_giftpro_paydesc'] . $user['user_name'] : $L['paypro_buypro_paydesc'];
        $options['code'] = !empty($id) && $usr['id'] != $id ? $id : $usr['id'];
        if ($db->fieldExists($db_payments, "pay_redirect")) {
            $options['redirect'] = $cfg['mainurl'] . '/' . cot_url('payments', 'm=balance', '', true);
        }
        cot_payments_create_order('pro', $summ, $options);
    }
}
$t = new XTemplate(cot_tplfile('paypro', 'plug'));
cot_display_messages($t);
$t->assign(array('PRO_FORM_ACTION' => cot_url('plug', 'e=paypro&a=buy&id=' . $id), 'PRO_FORM_PERIOD' => cot_selectbox('', 'months', range(1, 12), range(1, 12), false)));
Ejemplo n.º 12
0
<?php

/* ====================
  [BEGIN_COT_EXT]
 * Hooks=standalone
  [END_COT_EXT]
  ==================== */
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
require_once cot_incfile('payprjtop', 'plug');
list($auth_read, $auth_write, $auth_admin) = cot_auth('plug', 'payprjtop');
cot_block($auth_write);
$id = cot_import('id', 'G', 'INT');
if ($a == 'buy' && !empty($id)) {
    $days = cot_import('days', 'P', 'INT');
    cot_check(empty($days), 'payprjtop_error_days');
    if (!cot_error_found()) {
        $summ = $days * $cfg['plugin']['payprjtop']['cost'];
        $options['time'] = $days * 24 * 60 * 60;
        $options['code'] = $id;
        $options['desc'] = $L['payprjtop_buy_paydesc'];
        if ($db->fieldExists($db_payments, "pay_redirect")) {
            $options['redirect'] = $cfg['mainurl'] . '/' . cot_url('payments', 'm=balance', '', true);
        }
        cot_payments_create_order('prj.top', $summ, $options);
    }
}
$t = new XTemplate(cot_tplfile('payprjtop', 'plug'));
cot_display_messages($t);
$t->assign(array('PAY_FORM_ACTION' => cot_url('plug', 'e=payprjtop&a=buy&id=' . $id), 'PAY_FORM_PERIOD' => cot_selectbox('', 'days', range(1, 30), range(1, 30), false)));
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=users.profile.update.first, users.edit.update.first, users.register.add.first
 * [END_COT_EXT]
 */
/**
 * plugin User Group Selector for Cotonti Siena
 * 
 * @package usergroupselector
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 *  */
defined('COT_CODE') or die('Wrong URL');
require_once cot_langfile('usergroupselector', 'plug');
if (($cfg['plugin']['usergroupselector']['allowchange'] || $cfg['plugin']['usergroupselector']['required']) && !empty($cfg['plugin']['usergroupselector']['groups']) && $urr['user_maingrp'] != COT_GROUP_SUPERADMINS && $urr['user_maingrp'] != COT_GROUP_MODERATORS) {
    $groupstoselect = explode(',', $cfg['plugin']['usergroupselector']['groups']);
    $ruser['user_usergroup'] = cot_import('ruserusergroup', 'P', 'INT');
    if ($cfg['plugin']['usergroupselector']['required']) {
        cot_check(empty($ruser['user_usergroup']) || !in_array($ruser['user_usergroup'], $groupstoselect), $L['usergroupselector_error_emptygroup'], 'rusergroup');
    }
}
Ejemplo n.º 14
0
 /* ===== */
 if ($cfg['payments']['transfertaxfromrecipient']) {
     $sendersumm = $summ;
 } else {
     $sendersumm = $summ + $taxsumm;
 }
 $ubalance = cot_payments_getuserbalance($usr['id']);
 $recipient = $db->query("SELECT * FROM {$db_users} WHERE user_name='" . $db->prep($username) . "' LIMIT 1")->fetch();
 cot_check(empty($recipient), 'payments_balance_transfer_error_username', 'username');
 cot_check(!empty($recipient) && $username == $usr['name'], 'payments_balance_transfer_error_yourself', 'username');
 cot_check(empty($summ), 'payments_balance_transfer_error_emptysumm', 'summ');
 cot_check(!empty($summ) && $summ < 0, 'payments_balance_transfer_error_wrongsumm', 'summ');
 cot_check($sendersumm > $ubalance, 'payments_balance_transfer_error_balance', 'summ');
 cot_check($cfg['payments']['transfermin'] > 0 && $summ < $cfg['payments']['transfermin'], sprintf($L['payments_balance_transfer_error_min'], $cfg['payments']['transfermin'], $cfg['payments']['valuta']), 'summ');
 cot_check($cfg['payments']['transfermax'] > 0 && $summ > $cfg['payments']['transfermax'], sprintf($L['payments_balance_transfer_error_max'], $cfg['payments']['transfermax'], $cfg['payments']['valuta']), 'summ');
 cot_check(empty($comment), 'payments_balance_transfer_error_comment', 'comment');
 /* === Hook === */
 foreach (cot_getextplugins('payments.balance.transfers.validate') as $pl) {
     include $pl;
 }
 /* ===== */
 if (!cot_error_found()) {
     $rtransfer['trn_from'] = $usr['id'];
     $rtransfer['trn_to'] = $recipient['user_id'];
     $rtransfer['trn_summ'] = $summ;
     $rtransfer['trn_comment'] = $comment;
     $rtransfer['trn_status'] = 'process';
     $rtransfer['trn_date'] = $sys['now'];
     /* === Hook === */
     foreach (cot_getextplugins('payments.balance.transfers.options') as $pl) {
         include $pl;
Ejemplo n.º 15
0
 $roffer['offer_time_type'] = (int) cot_import('timetype', 'P', 'INT');
 $roffer['offer_hidden'] = (int) cot_import('hidden', 'P', 'BOL');
 $roffer['offer_text'] = cot_import('offertext', 'P', 'HTM');
 $roffer['offer_pid'] = (int) $id;
 $roffer['offer_userid'] = (int) $usr['id'];
 $roffer['offer_date'] = (int) $sys['now'];
 // Extra fields
 foreach ($cot_extrafields[$db_projects_offers] as $exfld) {
     $roffer['offer_' . $exfld['field_name']] = cot_import_extrafields('roffer' . $exfld['field_name'], $exfld, 'P', $roffer['offer_' . $exfld['field_name']]);
 }
 /* === Hook === */
 foreach (cot_getextplugins('projects.offers.add.import') as $pl) {
     include $pl;
 }
 /* ===== */
 cot_check(empty($roffer['offer_text']), $L['offers_empty_text']);
 /* === Hook === */
 foreach (cot_getextplugins('projects.offers.add.error') as $pl) {
     include $pl;
 }
 /* ===== */
 if (!cot_error_found()) {
     $db->insert($db_projects_offers, $roffer);
     $offerid = $db->lastInsertId();
     $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
     $rsubject = cot_rc($L['project_added_offer_header'], array('prtitle' => $item['item_title']));
     $rbody = cot_rc($L['project_added_offer_body'], array('user_name' => $item['user_name'], 'offeruser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
     cot_mail($item['user_email'], $rsubject, $rbody);
     $offerscount = $db->query("SELECT COUNT(*) FROM {$db_projects_offers} WHERE offer_pid=" . (int) $id . "")->fetchColumn();
     $db->update($db_projects, array("item_offerscount" => (int) $offerscount), "item_id=" . (int) $id);
     /* === Hook === */
<?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');
    }
}
Ejemplo n.º 17
0
 * [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;
        }
        /* ===== */
    }
    cot_redirect(cot_url('admin', 'm=other&p=paytop', '', true));
}
Ejemplo n.º 18
0
     }
     if ($rsbr['sbr_performer'] == $usr['id']) {
         cot_error('sbr_error_rsbrperformernotyou', 'rsbrperformer');
     }
 } else {
     $rsbr['sbr_performer'] = $uid;
 }
 cot_check(empty($rsbrtitle), $L['sbr_error_rsbrtitle'], 'rsbrtitle');
 for ($i = 1; $i <= $stagescount; $i++) {
     cot_check(empty($rstagetitle[$i]), $L['sbr_error_rstagetitle'], 'rstagetitle[' . $i . ']');
     cot_check(empty($rstagetext[$i]), $L['sbr_error_rstagetext'], 'rstagetext[' . $i . ']');
     cot_check(empty($rstagecost[$i]), $L['sbr_error_rstagecost'], 'rstagecost[' . $i . ']');
     cot_check(!empty($rstagecost[$i]) && $rstagecost[$i] < $cfg['plugin']['sbr']['mincost'] && $cfg['plugin']['sbr']['mincost'] > 0, $L['sbr_error_rstagecostmin'], 'rstagecost[' . $i . ']');
     cot_check(!empty($rstagecost[$i]) && $rstagecost[$i] > $cfg['plugin']['sbr']['maxcost'] && $cfg['plugin']['sbr']['maxcost'] > 0, $L['sbr_error_rstagecostmax'], 'rstagecost[' . $i . ']');
     cot_check(empty($rstagedays[$i]), $L['sbr_error_rstagedays'], 'rstagedays[' . $i . ']');
     cot_check(!empty($rstagedays[$i]) && $rstagedays[$i] > $cfg['plugin']['sbr']['maxdays'] && $cfg['plugin']['sbr']['maxdays'] > 0, $L['sbr_error_rstagedaysmax'], 'rstagedays[' . $i . ']');
     /* === Hook === */
     foreach (cot_getextplugins('sbr.add.add.stages.error') as $pl) {
         include $pl;
     }
     /* ===== */
     $rsbr['sbr_cost'] += $rstagecost[$i];
 }
 $rsbr['sbr_tax'] = $rsbr['sbr_cost'] * $cfg['plugin']['sbr']['tax'] / 100;
 $rsbr['sbr_title'] = $rsbrtitle;
 $rsbr['sbr_pid'] = $pid;
 $rsbr['sbr_employer'] = $usr['id'];
 /* === Hook === */
 foreach (cot_getextplugins('sbr.add.add.error') as $pl) {
     include $pl;
 }