Exemplo n.º 1
0
$action = 'post_registeruser';
$parms = array();
$parms['username'] = $username;
$parms['email'] = $email;
$expires = '';
$docreatefeu = 1;
if ($this->GetPreference('allowpaidregistration')) {
    // we're doing paid registration.
    // first, get the package info.
    $pkgid = $params['pkg'];
    $query = 'SELECT * FROM ' . cms_db_prefix() . 'module_selfreg_paidpkgs WHERE gid = ? AND id = ?';
    $pkg = $db->GetRow($query, array($params['group_id'], $pkgid));
    $expires = selfreg_utils::pkg_subscr_to_expirydate($pkg);
    if ($pkg && $pkg['cost'] > 0) {
        // this package costs money.
        $cart = cg_ecomm::get_cart_module();
        if ($cart) {
            $redirect_pref = 'redirect_paidpkg';
            // now we gotta add an item to the cart.
            $item = new cg_ecomm_cartitem('', $tmpuid, 1, $this->GetName());
            $item->set_type(cg_ecomm_cartitem::TYPE_SERVICE);
            $item->set_base_price($pkg['cost']);
            $smarty->assign('tmpuid', $tmpuid);
            $smarty->assign('username', $username);
            $smarty->assign('pkg', $pkg);
            $sku = 'sr-' . sprintf('%03d-%05d', $pkg['id'], $tmpuid);
            $smarty->assign('sku', $sku);
            $tmp = '{sitename} membership {$tmpuid}';
            $tpl = $this->GetPreference('cartitem_summary_tpl');
            if (!$tpl) {
                $tpl = $tmp;