Exemplo n.º 1
0
 public function testIsEqual()
 {
     $a = ['a', 'b', 1, '2'];
     $b = ['a', 'b', '1', '2'];
     static::assertNotTrue(\isEqual($a, $b));
     static::assertNotTrue(\isEqual($b, $a));
     static::assertTrue(\isEqual($a, $a));
     static::assertTrue(\isEqual($b, $b));
 }
Exemplo n.º 2
0
function userMatch($user1, $user2)
{
    $check = isEqual($user1, $user2);
    if (!$check) {
        echo '<td><a href ="#" onclick="deleteUser(' . $user1 . ')">Delete</a></td>';
    } else {
        if ($check) {
            echo '<td> [Unavailable] </td>';
        }
    }
}
Exemplo n.º 3
0
<?php

//Session management
ini_set("session.cookie_secure", 0);
session_start();
if (empty($_SESSION['token'])) {
    $_SESSION['token'] = base64_encode(mcrypt_create_iv(8, MCRYPT_DEV_URANDOM));
}
if (!empty($_POST['action']) and isEqual($_POST['action'], "login") and !empty($_POST['username']) and !empty($_POST['password']) and !empty($_POST['CRSFtoken'])) {
    $user = userLogin($file_db, $_POST['username'], $_POST['password'], $_POST['CRSFtoken']);
    error_log($user);
} elseif (isLoged()) {
    $user = userInfo($file_db, $_SESSION['userId']);
}
Exemplo n.º 4
0
 $userExists = "SELECT userName FROM users WHERE userName='******'";
 $result = mysqli_query($db, $userExists);
 $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
 if (mysqli_num_rows($result) == 1) {
     echo "Sorry...This username already exist...";
     $username_check = true;
 }
 if (!$username_check) {
     //Validation checks
     //Check if passwords match
     if (!isEqual($password, $password2)) {
         $validation_error = true;
         echo "Passwords don't match!";
     }
     //Check if email addreses match
     if (!isEqual($email, $email2)) {
         $validation_error = true;
         echo "Emails don't match!";
     }
     if (!$validation_error) {
         //convert password to md5
         $password = md5($password);
         $defaultImage = "./Res/default-photo.jpg";
         //Finally add users to db
         $insert = "INSERT INTO users (groupID,userName,password, first_Name, last_Name, country, email, bio)VALUES (21,'{$username}','{$password}', '{$FirstName}' , '{$LastName} ',  '{$country}', '{$email}', '{$bio}')";
         $result = mysqli_query($db, $insert);
         $userQuery = "SELECT userID FROM users WHERE userName = '******'";
         $result1 = mysqli_query($db, $userQuery);
         $resultFetchArray = mysqli_fetch_array($result1);
         $userid = $resultFetchArray['userID'];
         $insert1 = "INSERT INTO picture_gallery_users (filePath, photoDesc, userID) VALUES ('{$defaultImage}','default image','{$userid}')";
Exemplo n.º 5
0
    function confirmation()
    {
        global $Shopp;
        $Shopping =& $Shopp->Shopping;
        $Order =& $Shopp->Order;
        require_once SHOPP_ADDONS . '/BillmateCore/BillMate.php';
        include_once SHOPP_ADDONS . "/BillmateCore/lib/xmlrpc.inc";
        include_once SHOPP_ADDONS . "/BillmateCore/lib/xmlrpcs.inc";
        $pno = $this->Order->pno;
        $phone = $this->Order->billmatephone;
        $eid = (int) $this->settings['eid'];
        $key = $this->settings['secretkey'];
        $ssl = true;
        $debug = false;
        $k = new BillMate($eid, $key, $ssl, $debug, $this->settings['testmode'] == 'on');
        $Customer = $this->Order->Customer;
        $Billing = $this->Order->Billing;
        $Shipping = $this->Order->Shipping;
        $country = $zone = $locale = $global = false;
        $country = $Billing->country;
        if (!in_array($country, $this->settings['avail_country'])) {
            new ShoppError(__('Billmate Invoice not available in selected country country code', 'shopp-billmate-invoice') . '(' . $country . ')', 2);
            echo '<script type="text/javascript">window.location.href="' . shoppurl(false, 'checkout') . '";</script>';
            die;
        }
        $country_to_currency = array('NO' => 'NOK', 'SE' => 'SEK', 'FI' => 'EUR', 'DK' => 'DKK', 'DE' => 'EUR', 'NL' => 'EUR');
        try {
            $addr = $k->GetAddress($pno);
            if (empty($addr[0])) {
                new ShoppError(__('Invalid personal number', 'shopp-billmate-invoice'), 2);
                echo '<script type="text/javascript">window.location.href="' . shoppurl(false, 'checkout') . '";</script>';
                die;
            }
            foreach ($addr[0] as $key => $col) {
                $addr[0][$key] = utf8_encode($col);
            }
            if (isset($addr['error'])) {
                new ShoppError(__('Invalid personal number', 'shopp-billmate-invoice'), 2);
                echo '<script type="text/javascript">window.location.href="' . shoppurl(false, 'checkout') . '";</script>';
                die;
            }
        } catch (Exception $e) {
            new ShoppError(__('Invalid personal number', 'shopp-billmate-invoice'), 2);
            echo '<script type="text/javascript">window.location.href="' . shoppurl(false, 'checkout') . '";</script>';
            die;
        }
        $bo = new StdClass();
        $bo->name = "Billmate Invoice Feee";
        $bo->unitprice = 122;
        if (!empty($this->settings['invoice_fee'])) {
            $Product = new Product($this->settings['invoice_fee']);
            $price = new Price($this->settings['invoice_fee'], 'product');
            $NewItem = new Item($Product, $Price, array(), array(), false);
            if (empty($this->Order->feeadded) || !$this->Order->feeadded) {
                $Shopp->Order->Cart->add(1, $Product, $price->id);
                $Shopp->Order->Cart->totals();
                $this->Order->feeadded = true;
            }
        }
        $Customer = $this->Order->Customer;
        $Billing = $Shopp->Order->Billing;
        $Shipping = $Shopp->Order->Shipping;
        foreach ($addr[0] as $key => $col) {
            $addr[0][$key] = Encoding::fixUTF8($col);
        }
        $fullname = $Customer->firstname . ' ' . $Customer->lastname . ' ' . $Customer->company;
        $firstArr = explode(' ', $Customer->firstname);
        $lastArr = explode(' ', $Customer->lastname);
        $apiName = $addr[0][0] . ' ' . $addr[0][1];
        if (empty($addr[0][0])) {
            $apifirst = $firstArr;
            $apilast = $lastArr;
        } else {
            $apifirst = explode(' ', $addr[0][0]);
            $apilast = explode(' ', $addr[0][1]);
        }
        $matchedFirst = array_intersect($apifirst, $firstArr);
        $matchedLast = array_intersect($apilast, $lastArr);
        $apiMatchedName = !empty($matchedFirst) && !empty($matchedLast);
        $addressNotMatched = !isEqual($addr[0][2], $Billing->address) || !isEqual($addr[0][3], $Billing->postcode) || !isEqual($addr[0][4], $Billing->city) || !isEqual($addr[0][5], BillmateCountry::fromCode(strtoupper($Billing->country)));
        $shippingAndBilling = !$apiMatchedName || !isEqual($Shipping->address, $Billing->address) || !isEqual($Shipping->postcode, $Billing->postcode) || !isEqual($Shipping->city, $Billing->city) || !isEqual($Shipping->country, $Billing->country);
        if ($addressNotMatched || $shippingAndBilling) {
            if (empty($this->Order->overritedefaultaddress) || !$this->Order->overritedefaultaddress) {
                $html = '<p style="margin:0px!important;"><b>' . __('Correct Address is :', 'shopp-billmate-invoice') . ': </b></p>' . $addr[0][0] . ' ' . $addr[0][1] . '<br>' . $addr[0][2] . '<br>' . $addr[0][3] . ' ' . $addr[0][4] . '<div style="padding: 17px 0px;"> <i>' . __('Click Yes to continue with new address, No to choose other payment method', 'shopp-billmate-invoice') . '</i></div> <input style="background:#1DA9E7" type="button" value="' . __('Yes', 'shopp-billmate-invoice') . '" onclick="updateAddress();" class="button"/> <input style="background:#1DA9E7" type="button" value="' . __('No', 'shopp-billmate-invoice') . '" onclick="closefunc(this);window.location.reload();" class="button" style="float:right" />';
                $code = '<style type="text/css">
.checkout-heading {
    background: none repeat scroll 0 0 #F8F8F8!important;
    border: 1px solid #DBDEE1!important;
    color: #555555!important;
    font-size: 13px!important;
    font-weight: bold!important;
    margin-bottom: 15px!important;
    padding: 8px!important;
}
#cboxClose{
 display:none!important;
 visibility:hidden!important;
}
.button:hover{
    background:#444444!important;
}
#divOverlay *{
	text-shadow:none!important;
}
#divOverlay table td, #divOverlay table th{
	padding:0px!important;
}
#divOverlay table td, #divOverlay table th, #divOverlay table{
	border:0px!important;
}

.button {
    border: 0 none!important;
    border-radius: 8px!important;
    box-shadow: 2px 2px 2px 1px #EAEAEA!important;
    color: #FFFFFF!important;
    cursor: pointer!important;
    font-family: arial!important;
    font-size: 14px!important;
    font-weight: bold!important;
    padding: 3px 17px!important;
}
#cboxContent{
    margin:0px!important;
}
	            </style><script type="text/javascript">
	            jQuery(document).ready(function(){
    	            jQuery("#billmatephone").attr("checked","checked");
                    jQuery("select[name=paymethod]").removeAttr("selected");
                    jQuery("select[name=paymethod] option[value^=billmate-invoice]").attr("selected","selected");
                    jQuery("select[name=paymethod] option[value^=billmate-faktura]").attr("selected","selected");
                    jQuery("select[name=paymethod]").trigger("change");
	            });
	            function updateAddress(){
    	            jQuery("select[name=paymethod]").after("<input type=\'hidden\' name=\'geturl\' value=\'true\'/>");
    	            jQuery("#checkout").submit();
	            }
	  jQuery(document).ready(function(){
		modalWin.ShowMessage(\'' . $html . '\',300,500,\'' . __('Your Billing address is wrong.', 'shopp-billmate-invoice') . '\');
	  });
	  </script>';
                new ShoppError($code, 2);
                echo '<script type="text/javascript">window.location.href="' . shoppurl(false, 'checkout') . '";</script>';
                die;
            } else {
                if (empty($addr[0][0])) {
                    $Shopp->Order->Customer->company = $addr[0][1];
                } else {
                    $Shopp->Order->Customer->firstname = $addr[0][0];
                    $Shopp->Order->Customer->lastname = $addr[0][1];
                    $Shopp->Order->Customer->company = '';
                }
                $Shipping->address = $addr[0][2];
                $Shipping->postcode = $addr[0][3];
                $Shipping->city = $addr[0][4];
                $Shipping->country = BillmateCountry::getCode($addr[0][5]);
                $Billing->address = $addr[0][2];
                $Billing->postcode = $addr[0][3];
                $Billing->city = $addr[0][4];
                $Billing->country = BillmateCountry::getCode($addr[0][5]);
                $Shopp->Order->Billing = $Billing;
                $Shopp->Order->Shipping = $Shipping;
            }
        }
        return false;
    }
Exemplo n.º 6
0
/**
 * @param $compare
 * @return \Closure
 */
function isNotEqual($compare)
{
    return negate(isEqual($compare));
}
Exemplo n.º 7
0
 function init($update = false)
 {
     $payment = Mage::app()->getRequest()->getPost('payment');
     $methodname = $payment['method'];
     $k = Mage::helper('billmateinvoice')->getBillmate(true, false);
     $quote = Mage::getSingleton('checkout/session')->getQuote();
     $Billing = $quote->getBillingAddress();
     $Shipping = $quote->getShippingAddress();
     $pno = empty($payment[$methodname . '_pno']) ? $payment['person_number'] : $payment[$methodname . '_pno'];
     try {
         $addr = $k->getAddress(array('pno' => $pno));
         if (!is_array($addr)) {
             Mage::throwException(Mage::helper('payment')->__(utf8_encode($addr)));
         }
         if (isset($addr['code'])) {
             Mage::throwException($addr['message']);
         }
         foreach ($addr as $key => $col) {
             $addr[$key] = mb_convert_encoding($col, 'UTF-8', 'auto');
         }
         if (empty($addr['firstname'])) {
             $this->firstname = $Billing->getFirstname();
             $this->lastname = $Billing->getLastname();
             $this->company = $addr['company'];
         } else {
             $this->firstname = $addr['firstname'];
             $this->lastname = $addr['lastname'];
             $this->company = '';
         }
         $this->street = $addr['street'];
         $this->postcode = $addr['zip'];
         $this->city = $addr['city'];
         if (Mage::getSingleton('customer/session')->isLoggedIn()) {
             $this->telephone = $Billing->getTelephone();
         }
         $this->country = $addr['country'];
         $this->country_name = Mage::getModel('directory/country')->loadByCode($this->country)->getName();
     } catch (Exception $ex) {
         Mage::logException($ex);
         die('alert("' . utf8_encode($ex->getMessage()) . '");');
     }
     $fullname = $Billing->getFirstname() . ' ' . $Billing->getLastname() . ' ' . $Billing->getCompany();
     if (empty($addr['firstname'])) {
         $apiName = $Billing->getFirstname() . ' ' . $Billing->getLastname() . ' ' . $Billing->getCompany();
     } else {
         $apiName = $addr['firstname'] . ' ' . $addr['lastname'];
     }
     $billingStreet = $Billing->getStreet();
     $addressNotMatched = !isEqual($addr['street'], $billingStreet[0]) || !isEqual($addr['zip'], $Billing->getPostcode()) || !isEqual($addr['city'], $Billing->getCity()) || !isEqual(strtolower($addr['country']), $Billing->getCountryId());
     $shippingStreet = $Shipping->getStreet();
     $shippingAndBilling = !match_usernamevp($fullname, $apiName) || !isEqual($shippingStreet[0], $billingStreet[0]) || !isEqual($Shipping->getPostcode(), $Billing->getPostcode()) || !isEqual($Shipping->getCity(), $Billing->getCity()) || !isEqual($Shipping->getCountryId(), $Billing->getCountryId());
     if ($addressNotMatched || $shippingAndBilling) {
         $this->isMatched = false;
     }
     if ($update) {
         $this->isMatched = true;
         $data = array('firstname' => $this->firstname, 'lastname' => $this->lastname, 'street' => $this->street, 'company' => $this->company, 'postcode' => $this->postcode, 'city' => $this->city, 'country_id' => strtoupper($this->country), 'telephone' => $Billing->getTelephone());
         if (Mage::getStoreConfig('firecheckout/general/enabled')) {
             $data['person_number'] = $pno;
         }
         $Billing->addData($data)->save();
         $Shipping->addData($data)->save();
         Mage::getModel('checkout/session')->loadCustomerQuote();
     }
 }