Example #1
0
function mx_mnsignin($page, $option, $action)
{
    global $me, $mxuser, $signerrors;
    $redir = mx_secureredir(urldecode($_GET['r']));
    if ($action == 'register') {
        mx_mnregister($page, 'register', $action);
        return;
    }
    //error_log('mnsignin:'.$action);
    if ($action == 'forgot' && array_key_exists('user', $signerrors)) {
        $buttons = array();
        $setupform = array('lostpwd', 0, _('Check your email...'), '', $buttons, array('label' => array(-1, _('Just one more step'), _('<p>As a secuity measure, <b>we just sent you an email to confirm the password reset operation</b>.</p>' . '<p>We know this is a bit of an annoyance,' . ' but we want to prevent people from playing with our members\' nerves and trying to reset their' . ' passwords regularly.</p><p>So, <u>please check your email for a message from us</u>: you will have to' . ' follow a special link to a new login page where <b>you will be able to set up a new password</b> AND to' . ' eventually sign in.</p>' . '<p>See you in a few moments...</p>') . sprintf('<span class="pwdretry"><a href="' . mx_optionurl('account', 'signin') . '">%s</a></span>', _('Try Again'))), 'a' => array(1, 'done', 'hidden')));
        mx_showform($setupform, array(), false, true);
        return;
    } else {
        if ($action == "confirmation" && $mxuser->id || $action == "update" && array_key_exists('password', $signerrors)) {
            $buttons = array('update' => _('Update Password'), 'clear' => _('Clear'));
            $signinform = array('signin', 0, _('Password Update'), _('Please enter your new password in the fields below.<br/><br/>'), $buttons, array('credentials' => array(-1, _('Authentication'), _('Choose a new password...')), 'password' => array(1, _('Password:'******'newpassword', 20), 'a' => array(1, 'update', 'hidden'), 'r' => array(1, $redir, 'hidden')));
            mx_showform($signinform, $signvalues, true, true, $signerrors);
            return;
        } else {
            if ($action == "update") {
                $buttons = array();
                $setupform = array('lostpwd', 0, _('We\'re done!'), '', $buttons, array('label' => array(-1, _('You did it!'), sprintf(_('<p>Great!</p><p>Your password is now updated.</p>' . '<p>If you need to change it again, please visit %s.</p>' . '<p>Enjoy!</p>'), mx_optionlink('account', 'profile'))), 'a' => array(1, 'done', 'hidden')));
                mx_showform($setupform, array(), false, true);
                return;
            }
        }
    }
    if ($me) {
        switch (mx_checkfbuser(false)) {
            case -1:
            case 0:
                echo _('Sorry, you cannot sign in without registering first<br/>' . 'and we only accept new registrations through invites at this time...');
                break;
            case 1:
                echo sprintf(_('Welcome back, %s. You just signed using your facebook account.'), $me['name']);
                break;
            case 2:
                echo sprintf(_('Welcome on board, %s'), $me['name']);
                break;
        }
    } else {
        if ($mxuser->id) {
            echo sprintf(_('Welcome back, %s'), $mxuser->firstname ? $mxuser->firstname : _('New User'));
        }
    }
    //die(phpinfo());
    if ($me || $mxuser->id) {
        echo '<script src="http://www.surveymonkey.com/jsPop.aspx?sm=EUbzy4cmf97dTX9rXGrsmQ_3d_3d"></script>';
        return;
    }
    $signlogin = mx_securestring($_REQUEST['email']);
    $redir = mx_secureredir($_GET['r']);
    $buttons = array('+signin' => _('Sign-in'), 'forgot' => _('I forgot my password'));
    $signinform = array('signin', 0, _('Sign In'), sprintf(_('To authentify using facebook, use the Facebook button here: %s'), mx_fbloginbutton(_('Sign-in'), 'account', 'signin', 'fb', $redir)), $buttons, array('credentials' => array(-1, _('Authentication'), sprintf(_('If you have no Facebook account or don\'t want ' . ' to use it with MusXpand, please fill in your information below instead.<br/><br/>' . '<b>If you haven\'t created an account on MusXpand yet, please %s first</b>.'), mx_optionlink('account', 'register'))), 'email' => array(1, _('Account or Email:'), 'text', 40), 'password' => array(1, _('Password:'******'password', 20), 'a' => array(1, 'signin', 'hidden'), 'r' => array(1, $redir, 'hidden')));
    //echo _('Welcome to the sign-in page...').'<br/>';
    $signvalues = array('email' => $signlogin);
    if ($signerrors['email'] || $signerrors['captcha']) {
        $signinform[5]['captcha'] = array(1, _('Confirm you\'re a person'), 'captcha');
    }
    if (!(MXDEFFEATURES & MXFTNEWLOGIN)) {
        mx_showform($signinform, $signvalues, true, true, $signerrors);
    } else {
        $passwdclass = '';
        $loginclass = '';
        if ($signerrors['email']) {
            $loginclass = 'class="signerror"';
            if ($action == 'confirmation') {
                $signerrormsg = _('Invalid confirmation code');
            } else {
                if (!$signlogin) {
                    $signerrormsg = _('I need an email or a username');
                } else {
                    $signerrormsg = _('Email/username not found');
                }
            }
        }
        if ($signerrors['password']) {
            $passwdclass = 'class="signerror"';
            if ($action == 'signin') {
                $signerrormsg = _('Wrong email/password');
            }
        }
        $terms = mx_windowedpage('terms', _('Terms'), true);
        //echo $terms['div'];
        $priv = mx_windowedpage('privacy', _('Privacy'), true);
        //echo $priv['div'];
        ?>
	<div class="loginwrapper"><div>
		<div class="loginbutton"><?php 
        echo $term['div'] . $priv['div'];
        ?>
			<div class="loginbg"></div>
			<div class="loginform">
				<img src="<?php 
        echo mx_option('siteurl') . '/images/general/musxpand-logo-200x200.png';
        ?>
"/>
				<br/>
				<?php 
        echo mx_fbloginbutton('Login with Facebook', 'account', 'register', 'fb');
        ?>
				<form class="loginform" method="POST" action="<?php 
        echo mx_optionurl_secure('account', 'signin');
        ?>
">
				<ul>
				<li><input <?php 
        echo $loginclass;
        ?>
 id="email" type="text" name="email" size="25" placeholder="<?php 
        __('Email Address');
        ?>
" value="<?php 
        echo $signlogin;
        ?>
"></li>
				<li><input <?php 
        echo $passwdclass;
        ?>
 id="pass" type="password" name="password" size="25"  placeholder="<?php 
        __('Password');
        ?>
"></li>
				<li><div class="signerror"><?php 
        echo $signerrormsg;
        ?>
</div></li>
				</ul>
				<input type="hidden" name="a" value="signin">
				<input type="submit" name="signin" value="<?php 
        __('Sign in');
        ?>
" onclick="this.form['a'].value='signin';blackout('<?php 
        __('Please wait...');
        ?>
');submit();">
				<input type="button" name="register" value="<?php 
        __('Sign up');
        ?>
" onclick="this.form['a'].value='register';blackout('<?php 
        __('Please wait...');
        ?>
');submit();">
				<br/>
				<input class="forgot" type="button" name="forgot" value="<?php 
        __('I forgot my password');
        ?>
" onclick="this.form['a'].value='forgot';submit();">
				</form>
				<div class="logincopy"><?php 
        echo '&copy; 2010-2012, MusXpand.';
        ?>
</div>
				<div class="loginterms"><?php 
        echo $terms['str'] . ' / ' . $priv['str'];
        ?>
</div>
			</div>
		</div>
	</div></div>
	<?php 
    }
}
Example #2
0
function mx_showformstr($form, $values, $cansubmit = true, $secure = false, $errors = null, $subsubmit = false, $nofieldset = false)
{
    $page = mx_secureword($_GET['p']);
    $option = mx_secureword($_GET['o']);
    $str = '<div class="form">';
    $str .= '<form name="' . $form[0] . '" method="POST" enctype="multipart/form-data"' . ' onsubmit="return checkform(\'' . $form[0] . '\');"';
    if ($secure) {
        $str .= ' action="' . mx_optionurl_secure($page, $option) . '"';
    } else {
        $str .= ' action="' . mx_optionurl_normal($page, $option) . '"';
    }
    $str .= '>';
    $str .= '<table><tr><th>' . $form[2] . '</th></tr>';
    $str .= '<tr><td class="title">' . $form[3] . '</td></tr>';
    $str .= '<tr><td>';
    $str .= mx_fieldsetstr($form, $values, $cansubmit, $errors, $nofieldset);
    $str .= '</td></tr>';
    if ($cansubmit && is_array($form[4])) {
        $spacer = '';
        $str .= '<tr><td class="buttons">';
        $spacer = '';
        foreach ($form[4] as $btnname => $btnlabel) {
            if (!is_array($btnlabel)) {
                $str .= $spacer . mx_formfield($btnname, $btnlabel, 'button', null, true);
            } else {
                $str .= $spacer . $btnlabel[0];
            }
            $spacer = '&nbsp;';
        }
        //$str.=mx_formfield('submit',$form[4],'submit').'&nbsp;';
        //$str.=mx_formfield('clear',$form[6],'reset');
        $str .= '</td></tr>';
    }
    $str .= '</table>';
    $str .= '</form>';
    $str .= '</div>';
    return $str;
}
Example #3
0
function mx_checkout($cart)
{
    global $mxuser;
    // ==================================
    // PayPal Express Checkout Module
    // ==================================
    //'------------------------------------
    //' The paymentAmount is the total value of
    //' the shopping cart, that was set
    //' earlier in a session variable
    //' by the shopping cart page
    //'------------------------------------
    $paymentAmount = $cart->total + $cart->taxes;
    $_SESSION["Payment_Amount"] = $paymentAmount;
    //'------------------------------------
    //' The currencyCodeType and paymentType
    //' are set to the selections made on the Integration Assistant
    //'------------------------------------
    $currencyCodeType = "USD";
    $paymentType = "Sale";
    //'------------------------------------
    //' The returnURL is the location where buyers return to when a
    //' payment has been succesfully authorized.
    //'
    //' This is set to the value entered on the Integration Assistant
    //'------------------------------------
    $returnURL = mx_optionurl_secure('cart', '');
    //'------------------------------------
    //' The cancelURL is the location buyers are sent to when they hit the
    //' cancel button during authorization of payment during the PayPal flow
    //'
    //' This is set to the value entered on the Integration Assistant
    //'------------------------------------
    $cancelURL = mx_actionurl('cart', '', 'ppcancel');
    // callback URL to calculate taxes (and shipping fees)
    $callbackURL = mx_option('secure_siteurl') . '/paypal.php';
    //'------------------------------------
    //' Calls the SetExpressCheckout API call
    //'
    //' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.php,
    //' it is included at the top of this file.
    //'-------------------------------------------------
    $resArray = CallShortcutExpressCheckout($cart, $currencyCodeType, $paymentType, $returnURL, $cancelURL, $callbackURL);
    $ack = strtoupper($resArray["ACK"]);
    if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
        $mxuser->setcart($cart->id, 'token', $resArray['TOKEN']);
        $mxuser->setcart($cart->id, 'ordertime', preg_replace('%[^0-9]%', '', $resArray['TIMESTAMP']));
        RedirectToPayPal($resArray["TOKEN"]);
    } else {
        //Display a user friendly Error on the page using any of the following error information returned by PayPal
        $ErrorCode = urldecode($resArray["L_ERRORCODE0"]);
        $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]);
        $ErrorLongMsg = urldecode($resArray["L_LONGMESSAGE0"]);
        $ErrorSeverityCode = urldecode($resArray["L_SEVERITYCODE0"]);
        //echo "SetExpressCheckout API call failed. <br/>"
        //."Detailed Error Message: " . $ErrorLongMsg.'<br/>'
        //."Short Error Message: " . $ErrorShortMsg.'<br/>'
        //."Error Code: " . $ErrorCode.'<br/>'
        //."Error Severity Code: " . $ErrorSeverityCode;
    }
    return $resArray;
}