Example #1
0
function check_main_config()
{
    $vars = get_input_vars();
    $errors = array();
    if (!strlen($vars['@ROOT_URL@'])) {
        $errors[] = "Please enter root url of script";
    }
    if (!strlen($vars['@ROOT_SURL@'])) {
        $errors[] = "Please enter secure root url of script (or keep DEFAULT VALUE - set it equal to Not-secure root URL - it will work anyway)";
    }
    if (!strlen($vars['@ADMIN_EMAIL@'])) {
        $errors[] = "Please enter admin email";
    }
    if (!strlen($vars['@ADMIN_LOGIN@'])) {
        $errors[] = "Please enter admin login";
    }
    if (!strlen($vars['@ADMIN_PASS@'])) {
        $errors[] = "Please enter admin password";
    }
    if ('@TRIAL@' == '@' . 'TRIAL@') {
        if (!strlen($vars['@LICENSE@'])) {
            $errors[] = "Please enter license code";
        }
        if (!preg_match('/===== .+?===== EN(F|D) OF LICENSE =====/s', $vars['@LICENSE@'])) {
            $errors[] = "Please enter full license code (it should start and end with ======)";
        }
        if (preg_match('/===== .+? \\((.+?), (.+?), valid thru (.+?)\\) =====/', $vars['@LICENSE@'], $regs)) {
            $d = preg_quote($regs[1]);
            $sd = preg_quote($regs[2]);
            $exp = $regs[3];
            $u1 = parse_url($url = $vars['@ROOT_URL@']);
            $u2 = parse_url($surl = $vars['@ROOT_SURL@']);
            if (!preg_match($x = "/({$d}|{$sd})\$/", $u1['host'])) {
                $errors[] = "Root URL '{$url}' doesn't match license domain";
            }
            if (!preg_match("/({$d}|{$sd})\$/", $u2['host'])) {
                $errors[] = "Secure Root URL '{$surl}' doesn't match license domain";
            }
        }
    }
    if ($errors) {
        display_errors($errors);
        print <<<EOF
        Please <a href="javascript: history.back(-1)">return</a> and fix these errors.
    <br><br>
EOF;
        display_footer();
        exit;
    }
}
Example #2
0
<?php

/*
*
*
*     Author: Alex Scott
*      Email: alex@cgi-central.net
*        Web: http://www.cgi-central.net
*    Details: Revecom Payment Plugin IPN
*    FileName $RCSfile: ipn.php,v $
*    Release: 3.1.9PRO ($Revision: 1.1.2.1 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
*
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*
*/
require_once "../../../config.inc.php";
$pl =& instantiate_plugin('payment', 'itransact');
$pl->handle_postback(get_input_vars());
Example #3
0
<?php

include '../../../config.inc.php';
$t =& new_smarty();
$error = '';
$vars =& get_input_vars();
$t->display(dirname(__FILE__) . "/templates/cancel.html");
Example #4
0
function add_guest()
{
    global $db, $config, $t;
    settype($vars, 'array');
    $errors = array();
    $vars = get_input_vars();
    //check member
    if (!$vars['e'] && $vars['s']) {
        $member_code = split(":", $vars['s']);
        $member_code = intval($member_code[0]);
        $q = $db->query($s = "\n            SELECT guest_email\n            FROM {$db->config[prefix]}newsletter_guest\n            WHERE guest_id='" . $member_code . "'\n        ");
        $row = mysql_fetch_assoc($q);
        if ($row['guest_email']) {
            $vars['e'] = $row['guest_email'];
        }
    }
    $is_member = $db->users_find_by_string($vars['e'], 'email', 1) ? true : false;
    if ($vars['e'] && $is_member) {
        $t->display('add_guest_failed_email.html');
        exit;
    } else {
        $security_code = '';
        $securitycode_expire = '';
        if (!$config['dont_confirm_guests'] && $vars['s'] == '') {
            //generate a security code
            $acceptedChars = 'azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN0123456789';
            $max = strlen($acceptedChars) - 1;
            $security_code = "";
            for ($i = 0; $i < 16; $i++) {
                $security_code .= $acceptedChars[mt_rand(0, $max)];
            }
            $security_code = $security_code . time();
            $security_code = md5($security_code);
            $security_code = substr($security_code, 0, 16);
            $hours = 48;
            $securitycode_expire = date("Y-m-d H:i:s", time() + $hours * 60 * 60);
        }
        if (!$config['dont_confirm_guests'] && $vars['s'] != '') {
            //check security_code
            $security_code = $vars['s'];
            $member_code = split(":", $security_code);
            $security_code = $member_code[1];
            $member_code = intval($member_code[0]);
            $unix_timestamp = time();
            $q = $db->query($s = "\n                SELECT guest_id, security_code, UNIX_TIMESTAMP(securitycode_expire)\n                FROM {$db->config[prefix]}newsletter_guest\n                WHERE guest_id='" . $member_code . "'\n                ");
            list($guest_id, $guest_code, $guest_expire) = mysql_fetch_row($q);
            if (!$guest_id || $guest_code != '' && $guest_code != $security_code || $guest_expire > 0 && $guest_expire - $unix_timestamp < 0) {
                //if wrong security code
                $t->assign('guest_page', 'newsletter.php');
                $t->display('add_guest_failed.html');
                exit;
            } else {
                $q = $db->query("\n                    UPDATE {$db->config[prefix]}newsletter_guest\n                    SET security_code='', securitycode_expire=''\n                    WHERE guest_id='" . $guest_id . "'\n                    ");
            }
            $q = $db->query("\n                SELECT COUNT(*)\n                FROM {$db->config[prefix]}newsletter_guest_subscriptions\n                WHERE guest_id='" . $member_code . "'\n                AND security_code='" . $db->escape($security_code) . "'\n                AND (UNIX_TIMESTAMP(securitycode_expire) - {$unix_timestamp}) > 0\n                ");
            $r = mysql_fetch_row($q);
            if ($r[0] > 0) {
                //delete old (confirmed) subscriptions
                $q = $db->query("\n                    DELETE FROM {$db->config[prefix]}newsletter_guest_subscriptions\n                    WHERE guest_id='" . $member_code . "'\n                    AND (security_code='' OR security_code IS NULL)\n                    ");
                //activate new subscriptions
                $q = $db->query("\n                    UPDATE {$db->config[prefix]}newsletter_guest_subscriptions\n                    SET security_code='', securitycode_expire=''\n                    WHERE guest_id='" . $member_code . "'\n                    AND security_code='" . $db->escape($security_code) . "'\n                    AND (UNIX_TIMESTAMP(securitycode_expire) - {$unix_timestamp}) > 0\n                    ");
            }
            $t->display('add_guest_complete.html');
            //html_redirect("newsletter.php", false, _TPL_NEWSLETTER_INFO_SAVED, _TPL_NEWSLETTER_INFO_UPDATED);
            exit;
        }
        //check guest
        $guest = $db->get_guest_by_email($vars['e']);
        if (count($guest) == 0 || !$guest['guest_id']) {
            //check required input vars
            if (count($vars['tr']) == 0) {
                $errors[] = _TPL_NEWSLETTER_REQUIRED_THREAD;
            }
            if (!strlen($vars['n'])) {
                $errors[] = _TPL_NEWSLETTER_REQUIRED_NAME;
            }
            if (!strlen($vars['e']) || !check_email($vars['e'])) {
                $errors[] = _TPL_NEWSLETTER_REQUIRED_EMAIL;
            }
            if ($errors) {
                $t->assign('error', $errors);
                show_guest_form($vars);
                return;
            }
            //add guest
            $q = $db->query($s = "\n                INSERT INTO {$db->config['prefix']}newsletter_guest\n                (guest_id,guest_name,guest_email,security_code,securitycode_expire)\n                VALUES (null, '" . $db->escape($vars['n']) . "', '" . $db->escape($vars['e']) . "', '" . $db->escape($security_code) . "', '{$securitycode_expire}')\n            ");
            $guest_id = mysql_insert_id($db->conn);
        } else {
            $guest_id = $guest['guest_id'];
            if ($security_code) {
                $db->query($s = "\n                UPDATE {$db->config['prefix']}newsletter_guest\n                set guest_name='" . $db->escape($vars['n']) . "',security_code='" . $db->escape($security_code) . "',securitycode_expire='{$securitycode_expire}'\n                WHERE\n                guest_id='{$guest_id}'");
            }
        }
        if (count($vars['tr']) > 0) {
            if ($config['dont_confirm_guests']) {
                $db->delete_guest_threads($guest_id);
            }
            $db->add_guest_threads($guest_id, $vars['tr'], $security_code, $securitycode_expire);
        }
        if (!$config['dont_confirm_guests'] && $vars['s'] == '') {
            //send a confirmation email
            $t->assign('name', htmlentities($vars['n']));
            $t->assign('link', "{$config['root_url']}/newsletter.php?a=add_guest&s=" . $guest_id . ":" . $security_code);
            $et =& new aMemberEmailTemplate();
            $et->name = "verify_guest";
            $t->assign('config', $config);
            $et->lang = guess_language();
            // load and find templated
            if (!$et->find_applicable()) {
                trigger_error("Cannot find applicable e-mail template for [{$et->name},{$et->lang},{$et->product_id},{$et->day}]", E_USER_WARNING);
                exit;
            }
            global $_AMEMBER_TEMPLATE;
            $_AMEMBER_TEMPLATE['text'] = $et->get_smarty_template();
            $parsed_mail = $t->fetch('memory:text');
            unset($_AMEMBER_TEMPLATE['text']);
            mail_customer($vars['e'], $parsed_mail, null, null, null, false, $vars['n']);
            $t->display('add_guest_ok.html');
            exit;
        }
    }
    $t->display('add_guest_complete.html');
    //html_redirect("newsletter.php", false, _TPL_NEWSLETTER_INFO_SAVED, _TPL_NEWSLETTER_INFO_UPDATED);
    exit;
}
Example #5
0
function php_include_remember_login($user)
{
    global $plugin_config;
    $this_config = $plugin_config['protect']['php_include'];
    if (!$this_config['remember_login']) {
        return;
    }
    $need = 0;
    if ($this_config['remember_auto']) {
        $need++;
    } else {
        $vars = get_input_vars();
        if ($vars['remember_login']) {
            $need++;
        }
    }
    if (!$need) {
        return;
    }
    setcookie('_amember_ru', $user['login'], time() + $this_config['remember_period'] * 3600 * 24, '/');
    setcookie('_amember_rp', md5($user['pass']), time() + $this_config['remember_period'] * 3600 * 24, '/');
}
Example #6
0
<?php

if (!$_REQUEST['VendedorEmail']) {
    $paysys_id = 'pagseguro';
    include "../../../thanks.php";
} else {
    require_once "../../../config.inc.php";
    $pl =& instantiate_plugin('payment', 'pagseguro');
    $pl->process_postback(get_input_vars());
}
Example #7
0
function do_rebill()
{
    global $config, $db;
    $t = new_smarty();
    $vars = get_input_vars();
    if ($vars['dat'] == '') {
        die('[dat] cannot be empty');
    }
    $dat = $vars['dat'];
    if (time() - strtotime($dat) > 3600 * 24 * 30) {
        die("Rebill cannot be called for periods longer than 30 days from nows");
    }
    if (time() - strtotime($dat) < 0) {
        die("Rebill cannot be called for future dates - please wait the date ");
    }
    $t->display('admin/header.inc.html');
    $hdat = strftime($config['date_format'], strtotime($dat));
    if (!$vars['paysys_id']) {
        print "\n\t<h2>Manual CC Rebill {$hdat}</h2>\n\t<br><br><p>Are you sure you want to run rebill process for date {$hdat} ?\n\t<a href='rebill_log.php?do=rebill_stats'>Click here to cancel and back to rebill reports</a>\n\t</p>";
        print "<p><b>Make sure to do not close browser windows and do not start any new rebill processes until it is finished, else it may result to double billing of customers</p></b>";
        $options = "";
        foreach (cc_core_get_plugins(true) as $p) {
            $options .= "<option value='{$p}'>{$p}</option>\n";
        }
        $dat = htmlentities($vars['dat']);
        print "<form method='post' action='rebill_log.php'>\n\t<select name='paysys_id'>\n\t<option value=''>*** Select a Payment System to continue ***</option>\n\t{$options}</select> <br />\n\t<label><input type='checkbox' name='repeat_declined' value='1' />\n\tRe-process payments that were marked as declined\n\t</label><br />\n\t<input type='submit' value='Continue'>\n\t<input type='hidden' name='dat' value='{$dat}'>\n\t<input type='hidden' name='do' value='rebill'>\n\t</form>\n\t";
    } else {
        // do rebill
        print "\n\t\t<h2>Manual CC Rebill {$hdat} - {$vars['paysys_id']}</h2>";
        print "<p><b>Please do not stop/exit your browser, do not run other payment processes until this process is finished!</b></p>";
        for ($i = 0; $i < 100; $i++) {
            print "          \n";
        }
        // to flush browser/apache buffer for sure
        print " Rebilling Process started at " . strftime($config['time_format']) . "....<br />\n";
        ob_end_flush();
        $dat = date('Y-m-d', strtotime($vars['dat']));
        $was = $db->query_one("SELECT COUNT(*) FROM {$db->config[prefix]}rebill_log");
        cc_core_rebill($vars['paysys_id'], $dat, $from_cron = false, intval($vars['repeat_declined']));
        $now = $db->query_one("SELECT COUNT(*) FROM {$db->config[prefix]}rebill_log");
        $added = $now - $was;
        print " Rebilling Process finished at " . strftime($config['time_format']) . ".<br />\n\t\t <b>{$added}</b> transactions processed. <br />\n";
        print "<br /><a href='rebill_log.php?do=rebill_stats'>Go back to Rebilling Stats</a>";
    }
    $t->display('admin/footer.inc.html');
}
Example #8
0
function add_save()
{
    global $db, $t;
    $vars = get_input_vars();
    $vars['renewal_group'] = preg_replace('|\\(keep default if not sure\\)|', '', $vars['renewal_group']);
    $p = new product($vars);
    convert_period_fields($p);
    $error = validate_product_fields($p);
    if ($error) {
        add_product($error);
        return false;
    }
    $product_id = $db->add_product($p->config);
    if (!$product_id) {
        $error = "Cannot insert product. INTERNAL ERROR";
    }
    admin_log("Product added {$product_id}");
    $t->assign('url', "products.php");
    $t->display("admin/product_saved.html");
}
Example #9
0
function email_to_user_from_admin()
{
    global $db, $config, $t, $_AMEMBER_TEMPLATE;
    check_demo();
    $vars = get_input_vars();
    $u = $db->get_user($vars['member_id']);
    $tmp =& new_smarty();
    $tmp->assign('user', $u);
    $_AMEMBER_TEMPLATE['text'] = $vars['text'];
    $vars['text'] = $tmp->fetch('memory:text');
    $_AMEMBER_TEMPLATE['text'] = $vars['subject'];
    $vars['subject'] = $tmp->fetch('memory:text');
    mail_customer($u['email'], $vars['text'], $vars['subject'], 0, '', 0, $u['name_f'] . ' ' . $u['name_l']);
    $t->assign('member_id', $vars['member_id']);
    $t->assign('msg', "EMail Sent to customer");
    $t->assign('link', "users.php?action=actions&member_id={$vars['member_id']}");
    $t->display("admin/user_saved.html");
}
 function cc_bill($cc_info, $member, $amount, $currency, $product_description, $charge_type, $invoice, $payment)
 {
     global $db, $config, $plugin_config;
     $input_vars =& get_input_vars();
     $this_config = $plugin_config['payment']['safecharge3d'];
     $product = $db->get_product($payment['product_id']);
     $log = array();
     //////////////////////// cc_bill /////////////////////////
     srand(time());
     $auth_type = 'Sale';
     if ($charge_type == CC_CHARGE_TYPE_TEST) {
         $amount = "1.00";
         $auth_type = 'Auth';
     }
     if ($cc_info['cc_name_f'] == '') {
         $cc_info['cc_name_f'] = $member['name_f'];
         $cc_info['cc_name_l'] = $member['name_l'];
     }
     $vars = array('sg_TransType' => $auth_type, 'sg_ClientLoginID' => $this_config['login'], 'sg_ClientPassword' => $this_config['password'], 'sg_ClientUniqueID' => $payment['payment_id'] . '-' . rand(100, 999), 'sg_CustomData' => $payment['payment_id'], 'sg_Amount' => $amount, 'sg_Currency' => $currency ? $currency : 'GBP', 'sg_NameOnCard' => $cc_info['cc_name_f'] . " " . $cc_info['cc_name_l'], 'sg_CardNumber' => $cc_info['cc_number'], 'sg_CVV2' => $cc_info['cc_code'], 'sg_ExpMonth' => substr($cc_info['cc-expire'], 0, 2), 'sg_ExpYear' => substr($cc_info['cc-expire'], 2, 2), 'sg_ResponseFormat' => 4, 'sg_ProductID' => $product['title'], 'sg_FirstName' => $cc_info['cc_name_f'], 'sg_LastName' => $cc_info['cc_name_l'], 'sg_Address' => $cc_info['cc_street'], 'sg_City' => $cc_info['cc_city'], 'sg_Zip' => $cc_info['cc_zip'], 'sg_Country' => $cc_info['cc_country'], 'sg_State' => $cc_info['cc_state'], 'sg_Phone' => $cc_info['cc_phone'], 'sg_IPAddress' => $member['remote_addr'] ? $member['remote_addr'] : $_SERVER['REMOTE_ADDR'], 'sg_Email' => $member['email']);
     if ($charge_type != CC_CHARGE_TYPE_RECURRING && !$input_vars['PARes']) {
         $vars['sg_TransType'] = 'Auth3D';
         $vars['sg_Version'] = '1.8.2';
     }
     if ($input_vars['PARes']) {
         $vars['sg_TransactionID'] = $payment['data']['transaction_id'];
         $vars['sg_PARes'] = $input_vars['PARes'];
     }
     if ($cc_info['cc_issuenum']) {
         $vars['sg_DC_Issue'] = intval(substr($cc_info['cc_issuenum'], 0, 2));
     }
     if ($cc_info['cc_startdate']) {
         $vars['sg_DC_StartMon'] = substr($cc_info['cc_startdate'], 0, 2);
         $vars['sg_DC_StartYear'] = substr($cc_info['cc_startdate'], 2, 2);
     }
     //        if ($cc_info['cc_type'])
     //            $vars['sg_NameOnCard'] = $cc_info['cc_type'];
     // prepare log record
     $vars_l = $vars;
     $vars_l['sg_CardNumber'] = $cc_info['cc'];
     if ($vars['sg_CVV2']) {
         $vars_l['sg_CVV2'] = preg_replace('/./', '*', $vars['sg_CVV2']);
     }
     if ($vars['sg_ClientPassword']) {
         $vars_l['sg_ClientPassword'] = preg_replace('/./', '*', $vars['sg_ClientPassword']);
     }
     $log[] = $vars_l;
     /////
     $db->log_error("SafeCharge 3D DEBUG:<br />" . safecharge3d_get_dump($vars_l));
     $res = $this->run_transaction($vars);
     $log[] = $res;
     if (preg_match("/Approved/i", $res['RESULT'])) {
         if ($charge_type == CC_CHARGE_TYPE_TEST) {
             //$this->void_transaction($res['PNREF'], $log, $res['TRANSID'], $vars, $cc_info['cc']);
         }
         return array(CC_RESULT_SUCCESS, "", $res['PNREF'], $log);
     } elseif (preg_match("/Declined/i", $res['RESULT'])) {
         return array(CC_RESULT_DECLINE_PERM, $res['RESPMSG'] ? $res['RESPMSG'] : $res['RESULT'], "", $log);
     } else {
         return array(CC_RESULT_INTERNAL_ERROR, $res['RESPMSG'] ? $res['RESPMSG'] : $res['RESULT'], "", $log);
     }
 }
Example #11
0
function do_export()
{
    global $vars;
    global $db;
    if ($vars['date_check'] == "on") {
        $dt = get_input_vars();
        $start_date = set_date_from_smarty('range_start', $dt);
        $end_date = set_date_from_smarty('range_end', $dt);
    } else {
        $start_date = '0000-00-00';
        $end_date = '2099-12-31';
    }
    $members = array();
    if ($vars['send_file']) {
        header('Cache-Control: maxage=3600');
        header('Pragma: public');
        header("Content-type: application/csv");
        $dat = date('Ymd');
        header("Content-Disposition: attachment; filename=amember-{$dat}.csv");
    } else {
        header("Content-type: text/plain");
    }
    define('REC_LIMIT', 1024);
    if (count($vars['product_name']) > 0) {
        $prod = join(",", $vars['product_name']);
    } else {
        $prod = '';
    }
    foreach ($vars['subscr_type'] as $subscr_type) {
        switch ($subscr_type) {
            case 'any':
                if ($subscr_type == 'any') {
                    $cmpl = 0;
                }
            case 'completed':
                if ($subscr_type == 'completed') {
                    $cmpl = 1;
                }
            case 'not_completed':
                if ($subscr_type == 'not_completed') {
                    $cmpl = -1;
                }
                list($count, $sumx) = $db->get_payments_c($start_date, $end_date, $cmpl, 'add', $prod);
                $used_member_id = array();
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $list1 = $db->get_payments($start_date, $end_date, $cmpl, $i, REC_LIMIT, 'add', $prod);
                    foreach ($list1 as $l) {
                        if ($vars['multi_type'] == 'discard' && $used_member_id[$l['member_id']]++) {
                            continue;
                        }
                        if (!isset($members[$l['member_id']])) {
                            $members[$l['member_id']] = $db->get_user($l['member_id']);
                        }
                        $members[$l['member_id']]['PAYMENTS'][$l['payment_id']] = $l;
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            case 'active':
                $yesterday = date('Y-m-d', time() - 3600 * 24);
                $count = $db->users_find_by_date_c($yesterday, 'date_range', $start_date, $end_date, $prod);
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $members1 = $db->users_find_by_date($yesterday, 'date_range', $i, REC_LIMIT, $start_date, $end_date, $prod);
                    $dat = date('Y-m-d');
                    foreach ($members1 as $u) {
                        $members[$u['member_id']] = $u;
                        $list = $db->get_user_payments($u['member_id'], 1);
                        foreach ($list as $l) {
                            $tmadd = explode(' ', $l['tm_added']);
                            if ($l['begin_date'] > $dat || $l['expire_date'] < $dat || $tmadd[0] < $start_date || $tmadd[0] > $end_date) {
                                continue;
                            }
                            if (count($vars['product_name']) > 0 && !in_array($l['product_id'], $vars['product_name'])) {
                                continue;
                            }
                            $members[$u['member_id']]['PAYMENTS'][$l['payment_id']] = $l;
                        }
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            case 'expired':
                $today = date('Y-m-d', time());
                $count = $db->users_find_by_date_c($today, 'expire_date_range', $start_date, $end_date, $prod);
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $members1 = $db->users_find_by_date($today, 'expire_date_range', $i, REC_LIMIT, $start_date, $end_date, $prod);
                    $dat = date('Y-m-d');
                    foreach ($members1 as $u) {
                        $members[$u['member_id']] = $u;
                        $list = $db->get_user_payments($u['member_id'], 1);
                        foreach ($list as $l) {
                            $tmadd = explode(' ', $l['tm_added']);
                            if ($l['begin_date'] > $dat || $l['expire_date'] > $dat || $tmadd[0] < $start_date || $tmadd[0] > $end_date) {
                                continue;
                            }
                            if (count($vars['product_name']) > 0 && !in_array($l['product_id'], $vars['product_name'])) {
                                continue;
                            }
                            $members[$u['member_id']]['PAYMENTS'][$l['payment_id']] = $l;
                        }
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            case 'expired_users':
                $count = $db->get_users_list_c("%", 2);
                for ($i = 0; $i < $count; $i += REC_LIMIT) {
                    $members1 = $db->get_users_list("%", 2, $i, $REC_LIMIT);
                    foreach ($members1 as $u) {
                        $members[$u['member_id']] = $u;
                    }
                    print_rows($members);
                    $members = array();
                }
                break;
            default:
                fatal_error("Unknown Subscription Type: Please select one", 0);
        }
        if ($subscr_type == 'all') {
            break;
        }
    }
}
function update_thread($vars = '')
{
    global $db, $config, $t;
    settype($vars, 'array');
    $errors = array();
    $vars = get_input_vars();
    if (!strlen($vars['thread_title'])) {
        $errors[] = "'Title' is a required field";
    }
    if (!count($vars['available_to'])) {
        $errors[] = "'Available to' is a required field";
    }
    if ($res = $db->test_autosubscribe($vars['available_to'], $vars['auto_subscribe'])) {
        $errors[] = "'Auto Subscribe' field not correspond to 'Available to' field";
        foreach ($res as $err) {
            $errors[] = $err;
        }
    }
    if ($errors) {
        $t->assign('errors', $errors);
        return display_edit_form();
    }
    $vars['available_to'] = $db->escape_array($vars['available_to']);
    $vars['auto_subscribe'] = $db->escape_array($vars['auto_subscribe']);
    $available_to = implode(",", $vars['available_to']);
    $auto_subscribe = implode(",", $vars['auto_subscribe']);
    $q = $db->query($s = "\n            UPDATE {$db->config['prefix']}newsletter_thread SET\n            title='" . $db->escape($vars['thread_title']) . "',\n            description='" . $db->escape($vars['thread_description']) . "',\n            is_active='" . intval($vars['is_active']) . "',\n            blob_available_to='{$available_to}',\n            blob_auto_subscribe='{$auto_subscribe}'\n            WHERE thread_id = '" . intval($vars['thread_id']) . "'\n        ");
    $t->assign('link', "newsletter_threads.php");
    $t->display("admin/newsletter_thread_saved.html");
}
 function cc_bill($cc_info, $member, $amount, $currency, $product_description, $charge_type, $invoice, $payment)
 {
     global $config;
     $log = array();
     //////////////////////// cc_bill /////////////////////////
     if ($charge_type == CC_CHARGE_TYPE_TEST) {
         return array(CC_RESULT_SUCCESS, "", "", array('test transaction' => 'no validation'));
     }
     $vars = array('requestType' => 'BACKEND', 'errorPage' => $config['root_surl'] . "/cancel.php?payment_id={$payment[payment_id]}", 'merchant_id' => $this->config['merchant_id'], 'username' => $this->config['username'], 'password' => $this->config['password'], 'trnCardOwner' => $cc_info['cc_name_f'] . " " . $cc_info['cc_name_l'], 'trnCardNumber' => $cc_info['cc_number'], 'trnExpMonth' => substr($cc_info['cc-expire'], 0, 2), 'trnExpYear' => substr($cc_info['cc-expire'], 2, 2), 'trnOrderNumber' => $invoice, 'trnAmount' => $amount, 'ordEmailAddress' => $member['email'], 'ordName' => $member['name_f'] . " " . $member['name_l'], 'ordPhoneNumber' => $cc_info['cc_phone'], 'ordAddress1' => $cc_info['cc_street'], 'ordCity' => $cc_info['cc_city'], 'ordProvince' => $cc_info['cc_state'], 'ordPostalCode' => $cc_info['cc_zip'], 'ordCountry' => $cc_info['cc_country'], 'trnComments' => $product_description, 'vbvEnabled' => 0);
     // VBV
     if ($charge_type != CC_CHARGE_TYPE_RECURRING) {
         $vars['TermURL'] = $config['root_surl'] . "/plugins/payment/beanstream/vbv.php?payment_id={$invoice}";
         $vars['vbvEnabled'] = 1;
     }
     if ($cc_info['cc_code']) {
         $vars['trnCardCvd'] = $cc_info['cc_code'];
     }
     // prepare log record
     $vars_l = $vars;
     $vars_l['trnCardNumber'] = $cc_info['cc'];
     if ($vars['trnCardCvd']) {
         $vars_l['trnCardCvd'] = preg_replace('/./', '*', $vars['trnCardCvd']);
     }
     $vars_l['password'] = preg_replace('/./', '*', $vars['password']);
     $log[] = $vars_l;
     /////
     foreach ($vars as $kk => $vv) {
         $v = urlencode($vv);
         $k = urlencode($kk);
         $vars1[] = "{$k}={$v}";
     }
     $vars1 = join('&', $vars1);
     $ret = cc_core_get_url("https://www.beanstream.com/scripts/process_transaction.asp?{$vars1}");
     parse_str($ret, $res);
     $log[] = $res;
     if ($res['trnApproved']) {
         return array(CC_RESULT_SUCCESS, "", $res['trnId'], $log);
     } else {
         if ($res['responseType'] == 'R') {
             if ($charge_type == CC_CHARGE_TYPE_RECURRING) {
                 return array(CC_RESULT_INTERNAL_ERROR, "VBV response returned for recurring transaction", "", $log);
             }
             global $db;
             $res['pageContents'] = str_replace('\\"', '"', $res['pageContents']);
             echo $res['pageContents'];
             $payment = $db->get_payment(intval($invoice));
             $log[count($log) - 1]['pageContents'] = str_replace(array('<', '>'), array('&lt;', '&gt;'), $log[count($log) - 1]['pageContents']);
             foreach ($log as $v) {
                 $payment['data'][] = $v;
             }
             $payment['data']['vbv_redirect'] = 1;
             $db->update_payment(intval($invoice), $payment);
             $vars = get_input_vars();
             $member = $db->get_user($payment['member_id']);
             if ($charge_type != CC_CHARGE_TYPE_REGULAR && $charge_type != CC_CHARGE_TYPE_RECURRING) {
                 save_cc_info($vars, $member, $payment['paysys_id']);
             }
             exit;
         } elseif ($res['errorType'] == 'S') {
             return array(CC_RESULT_INTERNAL_ERROR, $res['messageText'], "", $log);
         } else {
             return array(CC_RESULT_DECLINE_PERM, $res['messageText'], "", $log);
         }
     }
 }
Example #14
0
 /**
  * The SendNotificationAcknowledgment function responds to a Google Checkout 
  * notification with a <notification-acknowledgment> message. If you do 
  * not send a <notification-acknowledgment> in response to a Google Checkout 
  * notification, Google Checkout will resend the notification multiple times.
  */
 function SendNotificationAcknowledgment($sn = '')
 {
     $vars = get_input_vars();
     if (!$sn && $vars['serial-number']) {
         $sn = $vars['serial-number'];
     }
     if ($sn) {
         $sn = " serial-number=\"" . $sn . "\"";
     }
     $acknowledgment = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<notification-acknowledgment xmlns=\"http://checkout.google.com/schema/2\"" . $sn . " />";
     header("Content-Type: application/xml; charset=UTF-8");
     echo $acknowledgment;
     $this->LogMessage("Google Checkout: Ack sent: {$acknowledgment}", $debug_only_msg = true);
     // don't work for unknown reason:
     // Error parsing XML; message from parser is: Unexpected element (notification-acknowledgment) encountered: notification-acknowledgment
     //
     //$response = $this->SendRequest($acknowledgment, 'request');
 }
function update_guest($vars = '')
{
    global $db, $config, $t;
    settype($vars, 'array');
    $errors = array();
    $vars = get_input_vars();
    if (!strlen($vars['guest_name'])) {
        $errors[] = "'Name' is a required field";
    }
    if (!strlen($vars['guest_email'])) {
        $errors[] = "'Email' is a required field";
    }
    if ($errors) {
        $t->assign('errors', $errors);
        return display_edit_form();
    }
    //check member
    $is_member = $db->users_find_by_string($vars['guest_email'], 'email', 1) ? true : false;
    if (!$is_member) {
        $q = $db->query($s = "\n\t            UPDATE {$db->config['prefix']}newsletter_guest SET\n\t            guest_name='" . $db->escape($vars['guest_name']) . "',\n\t            guest_email='" . $db->escape($vars['guest_email']) . "'\n\t            WHERE guest_id = '" . intval($vars['guest_id']) . "'\n\t        ");
        if (count($vars['threads']) > 0) {
            $db->delete_guest_threads($vars['guest_id']);
            $db->add_guest_threads($vars['guest_id'], $vars['threads']);
        }
    }
    $t->assign('link', "newsletter_guests.php");
    $t->display("admin/newsletter_guest_saved.html");
}
Example #16
0
*        Web: http://www.cgi-central.net
*    Details: Affiliate commission
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 2029 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
admin_check_permissions('affiliates');
$vars = get_input_vars();
function display_banners()
{
    global $db, $t, $config;
    /////
    $links = array();
    foreach ((array) $config['aff']['links'] as $i => $l) {
        $l['url'] = aff_make_url($l['url'], 'l' . $i, -1);
        $l['code'] = "<a href=\"{$l['url']}\">{$l['title']}</a>";
        $links[$i] = $l;
    }
    $t->assign('links', $links);
    /////////
    foreach ((array) $config['aff']['banners'] as $i => $l) {
        $l['url'] = aff_make_url($l['url'], 'b' . $i, -1);
        $alt = htmlspecialchars($l['alt']);
function update_newsletter($vars = '')
{
    global $db, $config, $t;
    settype($vars, 'array');
    $errors = array();
    $vars = get_input_vars();
    if (!strlen($vars['subject'])) {
        $errors[] = "'Subject' is a required field";
    }
    if (!strlen($vars['message'])) {
        $errors[] = "'Message' is a required field";
    }
    if ($errors) {
        $t->assign('errors', $errors);
        return display_edit_form();
    }
    $vars['threads'] = $db->escape_array($vars['threads']);
    $threads = "," . implode(",", $vars['threads']) . ",";
    $q = $db->query($s = "\n            UPDATE {$db->config['prefix']}newsletter_archive SET\n            subject='" . $db->escape($vars['subject']) . "',\n            message='" . $db->escape($vars['message']) . "',\n            threads='" . $db->escape($threads) . "'\n            WHERE archive_id = '" . intval($vars['archive_id']) . "'\n        ");
    $t->assign('link', "newsletter_archive.php");
    $t->display("admin/newsletter_archive_saved.html");
}