Esempio n. 1
0
 public static function createRequest($url, $method, $data = array(), $headers = array())
 {
     $methods = array(HttpMethod::GET, HttpMethod::POST, HttpMethod::PUT, HttpMethod::DELETE);
     if (!in_array($method, $methods)) {
         $method = HttpMethod::GET;
     }
     return Bin::getInstance()->request($url, $method, $data, $headers);
 }
Esempio n. 2
0
 /**
  * Public constructor
  *
  * @param   string The Src of the image
  * @param   string Alternate text of the image
  * @param   string Border of the image
  * @access  public
  */
 function Image($src, $alt = '', $border = '0', $width = null, $height = null)
 {
     $this->_src = substr($src, 0, 1) == '?' || substr($src, 0, 7) == 'http://' || substr($src, 0, 8) == 'https://' ? $src : Piwi::getVarConf('LINK_PRIFIX') . $src;
     $this->_alt = $alt;
     $this->_border = $border;
     $this->_width = $width;
     $this->_height = $height;
     parent::init();
 }
Esempio n. 3
0
 /**
  * Public constructor
  *
  * @param   string name
  * @param   string src
  * @param   int frameborder {0, 1}  optional)
  * @param   string scrolling type {auto, horizontal, vertical} (optional)
  * @param   int width (optional)
  * @param   int height (optional)
  * @access  public
  */
 function IFrame($name, $src, $border = 0, $scrolling = 'auto', $width = null, $height = null)
 {
     $this->_name = $name;
     $this->_src = substr($src, 0, 1) == '?' || substr($src, 0, 7) == 'http://' || substr($src, 0, 8) == 'https://' ? $src : Piwi::getVarConf('LINK_PRIFIX') . $src;
     $this->_border = $border;
     $this->_scrolling = $scrolling;
     $this->_width = $width;
     $this->_height = $height;
     parent::init();
 }
Esempio n. 4
0
 /**
  * Public constructor
  *
  * @param   string $text  Link Text
  * @param   string $href  Link Reference
  * @param   string $image Link Image
  * @access  public
  */
 function Link($text, $href, $image = '')
 {
     $this->_text = $text;
     $this->_link = $href;
     $this->_image = substr($image, 0, 1) == '?' || substr($image, 0, 7) == 'http://' || substr($image, 0, 8) == 'https://' ? $image : Piwi::getVarConf('LINK_PRIFIX') . $image;
     if (!empty($this->_image)) {
         $this->_hideText = true;
     }
     parent::init();
 }
Esempio n. 5
0
 /**
  * Public constructor
  *
  * @param    string Name of the entry
  * @param    string Value of the entry (optional)
  * @param    string Title of the entry (optional)
  * @param    int    Length of the field (optional)
  * @param   boolean Set the readonly status (optional)
  * @access   public
  */
 function Entry($name, $value = '', $title = '', $length = '', $status = false)
 {
     $this->_name = $name;
     $this->_value = $value;
     $this->_title = $title;
     $this->_maxLength = $length;
     $this->_isReadOnly = $status;
     $this->_type = 'any';
     $this->_availableEvents = array("tabindex", "accesskey", "onfocus", "onblur", "onselect", "onchange", "onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove", "onmouseout", "onkeypress", "onkeydown", "onkeyup");
     parent::init();
 }
Esempio n. 6
0
 /**
  * Public constructor
  *
  * @param  string  $name      Name that will be used in every option
  * @param  string  $direction Direction of the combo (default: horizontal)
  * @param  string  $title     Title of the radio buttons
  * @access public
  */
 function RadioButtons($name, $direction = 'horizontal', $title = '')
 {
     $this->_name = $name;
     $this->_direction = $direction;
     $this->_title = $title;
     $this->_options = array();
     if ($this->_direction != 'horizontal' && $this->_direction != 'vertical') {
         $this->_direction = 'horizontal';
     }
     parent::init();
 }
Esempio n. 7
0
 /**
  * Public constructor
  *
  * @param  string  $name      Name that will be used in every option
  * @param  string  $direction Direction of the combo (default: horizontal)
  * @param  string  $title     Title of the checkbuttons
  * @access public
  */
 function CheckButtons($name, $direction = 'horizontal', $title = '')
 {
     $this->_name = $name;
     $this->_direction = $direction;
     $this->_title = $title;
     $this->_options = array();
     $this->_multiple = true;
     if ($this->_direction != 'horizontal' && $this->_direction != 'vertical') {
         $this->_direction = 'horizontal';
     }
     $this->_columns = 0;
     parent::init();
 }
Esempio n. 8
0
 function Button($name, $value, $stock = '')
 {
     $this->_name = $name;
     $this->_value = $value;
     $this->_title = '';
     $this->_isSubmit = false;
     $this->_isReset = false;
     $this->_availableEvents = array("onfocus", "onblur", "onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove", "onmouseout", "onkeypress", "onkeydown", "onkeyup");
     if (!empty($stock)) {
         $this->SetStock($stock);
     }
     parent::init();
 }
Esempio n. 9
0
 public function run()
 {
     $bin = Bin::getInstance();
     $bin->extend('status', function ($vars = array()) {
         return new HttpStatus($vars);
     });
     $bin->extend('request', function ($url, $method, $data = array(), $headers = array()) {
         return new HttpRequest($url, $method, $data, $headers);
     });
     $bin->extend('response', function ($response, $content) {
         return new HttpResponse($response, $content);
     });
 }
Esempio n. 10
0
 /**
  * Public constructor
  *
  * @param    string  Name of the entry
  * @param    string  Value of the entry (optional)
  * @param    string  Title of the textarea
  * @param    int     Number of rows
  * @param    int     Number of columns
  * @access   public
  */
 function TextArea($name, $value = '', $title = '', $rows = 0, $cols = 0)
 {
     $this->_name = $name;
     $this->_value = $value;
     $this->_title = $title;
     $this->_rows = $rows;
     $this->_cols = $cols;
     $this->_isReadOnly = false;
     $this->_isEnabled = true;
     $this->_isRequired = false;
     $this->_availableEvents = array("onfocus", "onblur", "onselect", "onchange", "onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove", "onmouseout", "onkeypress", "onkeydown", "onkeyup");
     parent::init();
 }
Esempio n. 11
0
 public function test_to_string()
 {
     $string = md5(uniqid());
     $string2 = md5(uniqid());
     $d = new Bin($string);
     $this->assertEquals('@32@' . $string, (string) $d);
     $this->assertEquals('@32@' . $string, $d->toString());
     $this->assertEquals($string, $d->getData());
     $d->setData($string2);
     $this->assertEquals('@32@' . $string2, (string) $d);
     $this->assertEquals('@32@' . $string2, $d->toString());
     $this->assertEquals($string2, $d->getData());
 }
Esempio n. 12
0
 public function send($dataSet = array(), $headers = array())
 {
     $context = array('timeout' => 60, 'max_redirects' => 10, 'protocol_version' => 1.1);
     switch (strtoupper(trim($this->method))) {
         case HttpMethod::GET:
             $context['method'] = HttpMethod::GET;
             break;
         case HttpMethod::POST:
             $context['method'] = HttpMethod::POST;
             $headers['content-type'] = 'application/x-www-form-urlencoded';
             break;
         case HttpMethod::PUT:
             $context['method'] = HttpMethod::POST;
             $dataSet['__method'] = HttpMethod::PUT;
             $headers['content-type'] = 'application/x-www-form-urlencoded';
             break;
         case HttpMethod::DELETE:
             $context['method'] = HttpMethod::POST;
             $dataSet['__method'] = HttpMethod::DELETE;
             break;
         default:
             $context['method'] = HttpMethod::GET;
             break;
     }
     $context['header'] = $this->getNormalizedHeaders($headers);
     $context['content'] = $this->getNormalizedData($dataSet);
     try {
         $url = $this->getNormalizedUrl();
         $context = stream_context_create(array('http' => $context));
         $stream = fopen($url, 'r', false, $context);
         $content = stream_get_contents($stream);
         $response = stream_get_meta_data($stream);
         fclose($stream);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage());
     }
     return Bin::getInstance()->response($response, $content);
 }
Esempio n. 13
0
 /**
  * Public constructor
  *
  * @param string Name of the combo
  * @param string Title of the combo
  * @param array  Data that will be used in the combo
  * @access  public
  */
 function Combo($name, $title = '', $options = array())
 {
     $this->_name = $name;
     $this->_title = $title;
     $this->_multiple = false;
     if (is_array($options) && !empty($options)) {
         $this->addOptions($options);
     } else {
         $this->_options = array();
     }
     $oddClass = Piwi::getVarConf('CLASS_ODD');
     if (empty($oddClass)) {
         $oddClass = 'piwi_option_odd';
     }
     $this->setOddClass($oddClass);
     $evenClass = Piwi::getVarConf('CLASS_EVEN');
     if (empty($evenClass)) {
         $evenClass = 'piwi_option_even';
     }
     $this->setEvenClass($evenClass);
     $this->_availableEvents = array("onchange", "onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove", "onmouseout", "onkeypress", "onkeydown", "onkeyup");
     parent::init();
 }
Esempio n. 14
0
 /**
  * Constructor
  *
  * @access  public
  * @param   string  $text   Text of ImageButton
  * @param   string  $img    Image to display
  * @param   string  $action
  * @return  void
  */
 function Jaws_Widgets_ImageButton($text, $img, $action = '')
 {
     $this->_ImageSRC = $img;
     $this->_Text = $text;
     $this->_Action = $action;
     $this->_ExtraActions = array();
     $this->_AvailableEvents = array('onfocus', 'onblur', 'onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup');
     parent::Init();
 }
Esempio n. 15
0
 protected function beforePay()
 {
     $profileMethod = ProfileMethod::model()->findByPk(array('profile_id' => $this->campaignModel->profile->profile_id, 'method_id' => $this->paymentMethod->method_id));
     if ($profileMethod && $profileMethod->isFlag(ProfileMethod::FLAG_FILTER) && $this->paymentModel->cc_number) {
         if (!Bin::verificationCreditCard($this->paymentModel->cc_number)) {
             Attempt::setAttemptStatus($this->attemptModel, Attempt::FRAUD_STATUS);
             $this->_paymetnResponse->addError('error_processing_request');
             $this->_paymetnResponse->addAlert('please_use_a_different_card');
             $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
             // log prepaid card attempt
             OrderLog::createLog(0, $this->orderModel->order_id, 28, 'Prepaid Card');
             return false;
         }
     }
     return true;
 }
Esempio n. 16
0
 /**
  * Process bulk add/remove/etc operations
  *
  * @param Bin    $rec
  * @param string $bulk_op
  * @param array  $data
  * @param string $notes
  */
 protected function run_bulk($rec, $bulk_op, $data, $notes = null)
 {
     // check for write-authz on bin (for everything EXCEPT random)
     if ($bulk_op != 'bulk_random' && !$rec->user_may_write($this->user)) {
         $msg = "Insufficient authz for {$bulk_op}";
         throw new Rframe_Exception(Rframe::BAD_AUTHZ, $msg);
     }
     $this->bulk_op = $bulk_op;
     // rethrow any exceptions as 'data' exceptions
     try {
         if ($bulk_op == 'bulk_add') {
             $this->bulk_rs = AIR2Bin::add_sources($rec, $data, $notes);
         }
         if ($bulk_op == 'bulk_addsub') {
             $this->bulk_rs = AIR2Bin::add_submissions($rec, $data, $notes);
         }
         if ($bulk_op == 'bulk_addsearch') {
             $this->bulk_rs = AIR2Bin::add_search($this->user, $rec, $data, $notes);
         }
         if ($bulk_op == 'bulk_addtank') {
             $tanks = array();
             $data = is_array($data) ? array_unique($data) : array($data);
             foreach ($data as $uuid) {
                 $t = AIR2_Record::find('Tank', $uuid);
                 if (!$t) {
                     throw new Exception("Invalid tank_uuid({$uuid})");
                 }
                 $tanks[] = $t;
             }
             foreach ($tanks as $t) {
                 $counts = AIR2Bin::add_tank($rec, $t, $notes);
                 foreach ($counts as $key => $val) {
                     if (!isset($this->bulk_rs[$key])) {
                         $this->bulk_rs[$key] = 0;
                     }
                     $this->bulk_rs[$key] += $counts[$key];
                 }
             }
         }
         if ($bulk_op == 'bulk_addbin') {
             $bins = array();
             $data = is_array($data) ? array_unique($data) : array($data);
             foreach ($data as $uuid) {
                 $b = AIR2_Record::find('Bin', $uuid);
                 if (!$b) {
                     throw new Exception("Invalid bin_uuid({$uuid})");
                 }
                 if (!$b->user_may_read($this->user)) {
                     throw new Exception("Invalid bin_uuid({$uuid})");
                 }
                 $bins[] = $b;
             }
             foreach ($bins as $b) {
                 $counts = AIR2Bin::add_bin($rec, $b, $notes);
                 foreach ($counts as $key => $val) {
                     if (!isset($this->bulk_rs[$key])) {
                         $this->bulk_rs[$key] = 0;
                     }
                     $this->bulk_rs[$key] += $counts[$key];
                 }
             }
         }
         if ($bulk_op == 'bulk_remove') {
             $this->bulk_rs = AIR2Bin::remove_sources($rec, $data);
         }
         if ($bulk_op == 'bulk_removeall') {
             $this->bulk_rs = AIR2Bin::remove_all_sources($rec, $data);
         }
         if ($bulk_op == 'bulk_random') {
             $this->bulk_rs = AIR2Bin::randomize($this->user, $rec, $data);
         }
         if ($bulk_op == 'bulk_tag') {
             $this->bulk_rs = AIR2Bin::tag_sources($this->user, $rec, $data);
         }
         if ($bulk_op == 'bulk_annot') {
             $this->bulk_rs = AIR2Bin::annotate_sources($this->user, $rec, $data);
         }
     } catch (Rframe_Exception $e) {
         throw $e;
         //re-throw as-is
     } catch (Exception $e) {
         throw new Rframe_Exception(Rframe::BAD_DATA, $e->getMessage());
     }
 }
Esempio n. 17
0
 /**
  * Public constructor
  *
  * @param    string $label Text to use
  * @param    mixed  $bound Bound to element object or ID
  * @access   public
  */
 function Label($label, $bound = '')
 {
     $this->_value = $label;
     $this->_bound = $bound;
     parent::init();
 }
Esempio n. 18
0
 function getpaymentAction()
 {
     $this->checkLogin();
     AF::setJsonHeaders('json');
     $payment_id = AF::get($_POST, 'payment_id', false);
     if (!$payment_id) {
         Message::echoJsonError(__('incorrect_payment_id'));
     }
     $model = new Payment();
     if (!$model->fillFromDbPk($payment_id)) {
         Message::echoJsonError(__('incorrect_campaign_id'));
     }
     $result['cc_number'] = $model->cc_number_formatted;
     $result['cc_type'] = isset($model->num2) && strlen($model->num2) == 6 ? strtoupper(Bin::getCardType($this->num2)) : PaymentSystem::getCardType($model->cc_number);
     $result['exp_date'] = strlen($model->exp_date) == 3 ? '0' . $model->exp_date : $model->exp_date;
     $result['fields_expmonth'] = substr($result['exp_date'], 0, 2);
     $result['fields_expyear'] = '20' . substr($result['exp_date'], 2, 2);
     $result['cc_cvv'] = 'xxx';
     Message::echoJsonSuccess(array('message' => array('data' => $result)));
 }
Esempio n. 19
0
 /**
  * @param $ccNumber
  * @return Bin the static model class
  */
 public static function getFullCardInfo($ccNumber)
 {
     if (!$ccNumber || strlen($ccNumber) < 6) {
         return false;
     }
     $bin = substr($ccNumber, 0, 6);
     $binModel = Bin::model()->with('binLevel')->with('bank')->with('country')->findByPk($bin);
     return $binModel;
 }
Esempio n. 20
0
 /**
  * Set the id of the widget
  *
  * @access   public
  */
 function setID($id)
 {
     $this->_entry->setID($id);
     $this->_button->setID($id . '_button');
     parent::setID($id . '_table');
 }
Esempio n. 21
0
 /**
  * [getCharID description]
  * @param  string $name
  * @return int
  */
 public static function getCharID($name)
 {
     if (Bin::get("s:{$name}", null) != null) {
         return Bin::get("s:{$name}", null);
     }
     $id = (int) Db::queryField("select characterID from zz_characters where name = :name order by corporationID desc", "characterID", array(":name" => $name), 3600);
     if ($id == 0 || $id == NULL) {
         try {
             $pheal = Util::getPheal();
             $pheal->scope = "eve";
             $charInfo = $pheal->CharacterID(array("names" => $name));
             foreach ($charInfo->characters as $char) {
                 $id = $char->characterID;
                 if ($id != 0) {
                     // Verify that this is indeed a character
                     $charInfo = $pheal->CharacterInfo(array("characterid" => $id));
                     // If not a character an error would have been thrown and caught by the catch
                     $name = $charInfo->characterName;
                     Db::execute("insert ignore into zz_characters (characterID, name) values (:id, :name)", array(":id" => $id, ":name" => $name));
                 }
             }
         } catch (Exception $ex) {
             $id = 0;
         }
     }
     Bin::set("s:{$name}", $id);
     return $id;
 }
Esempio n. 22
0
 /**
  * @param $key
  * @return array
  */
 private function requestArray($key)
 {
     if (!$this->_requestArray) {
         //check address
         if (strlen($this->shippingAddressModel->address1) < 2) {
             $this->shippingAddressModel->address1 = 'Address ' . $this->shippingAddressModel->address1;
         }
         if (strlen($this->billingAddressModel->address1) < 2) {
             $this->billingAddressModel->address1 = 'Address ' . $this->billingAddressModel->address1;
         }
         if (strlen($this->shippingAddressModel->city) < 2) {
             $this->shippingAddressModel->city = 'City ' . $this->shippingAddressModel->city;
         }
         if (strlen($this->billingAddressModel->city) < 2) {
             $this->billingAddressModel->city = 'City ' . $this->billingAddressModel->city;
         }
         // Check fname and lname
         if (strlen($this->shippingAddressModel->fname) < 2) {
             $this->shippingAddressModel->fname = 'Name ' . $this->shippingAddressModel->fname;
         }
         if (strlen($this->shippingAddressModel->lname) < 2) {
             $this->shippingAddressModel->lname = 'Last Name ' . $this->shippingAddressModel->lname;
         }
         if (strlen($this->billingAddressModel->fname) < 2) {
             $this->billingAddressModel->fname = 'Name ' . $this->billingAddressModel->fname;
         }
         if (strlen($this->billingAddressModel->lname) < 2) {
             $this->billingAddressModel->lname = 'Last Name ' . $this->billingAddressModel->lname;
         }
         $this->shippingAddressModel->fname = substr($this->shippingAddressModel->fname, 0, 42);
         $this->shippingAddressModel->lname = substr($this->shippingAddressModel->lname, 0, 42);
         $this->billingAddressModel->fname = substr($this->billingAddressModel->fname, 0, 42);
         $this->billingAddressModel->lname = substr($this->billingAddressModel->lname, 0, 42);
         $this->_requestArray = array('shopper-contact-info' => array('first-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->fname), 'last-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->lname), 'email' => $this->customerModel->email, 'address1' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->address1), 0, 42), 'city' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->city), 0, 42), 'state' => in_array($this->shippingAddressModel->country_id, array('ca', 'us')) ? $this->shippingAddressModel->state_id : '', 'zip' => $this->shippingAddressModel->zip, 'country' => $this->shippingAddressModel->country_id, 'phone' => $this->shippingAddressModel->phone), 'invoice-contact-info' => array('default' => 'true', 'first-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->fname), 'last-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->lname), 'email' => $this->customerModel->email, 'address1' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->address1), 0, 42), 'city' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->shippingAddressModel->city), 0, 42), 'state' => in_array($this->shippingAddressModel->country_id, array('ca', 'us')) ? $this->shippingAddressModel->state_id : '', 'zip' => $this->shippingAddressModel->zip, 'country' => $this->shippingAddressModel->country_id, 'phone' => $this->shippingAddressModel->phone), 'billing-contact-info' => array('first-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->fname), 'last-name' => preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->lname), 'address1' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->address1), 0, 42), 'city' => substr(preg_replace('/[^\\p{L}0-9\\- ]/u', '', $this->billingAddressModel->city), 0, 42), 'state' => in_array($this->billingAddressModel->country_id, array('ca', 'us')) ? $this->billingAddressModel->state_id : '', 'zip' => $this->billingAddressModel->zip, 'country' => $this->billingAddressModel->country_id), 'credit-card' => array('encrypted-card-number' => $this->paymentModel->txt3 ? $this->paymentModel->txt3 : $this->paymentModel->cc_number_encrypt, 'encrypted-security-code' => $this->paymentModel->txt4 ? $this->paymentModel->txt4 : $this->paymentModel->cc_cvv_encrypt, 'card-type' => strtoupper(Bin::getCardType($this->paymentModel->num2)), 'expiration-month' => $this->paymentModel->exp_date_month_formatted, 'expiration-year' => $this->paymentModel->exp_date_year_formatted), 'web-info' => array('ip' => $this->orderModel->ip_formatted, 'remote-host' => gethostbyname($this->orderModel->ip_formatted), 'user-agent' => 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)'));
     }
     if (self::$isTest && in_array($key, array('credit-card')) && isset($this->_requestArray[$key])) {
         fb($this->_requestArray[$key]);
     }
     return isset($this->_requestArray[$key]) ? $this->_requestArray[$key] : array();
 }
Esempio n. 23
0
 /**
  * Public constrcutor
  *
  * @param   string   $name   Color picker field name
  * @param   string   $value  Value of field
  * @param   string   $text   Text in the button
  * @param   string   $stock  Stock image (the button image)
  * @access  public
  */
 function ColorPicker($name, $value = '', $text = '', $stock = '')
 {
     $this->_name = $name;
     $this->_value = $value;
     $this->_button = new Button($name . '_button', $text, $stock);
     $this->_entry = new Entry($name, $value);
     $this->setButtonText($text);
     $this->setButtonIcon($stock);
     $this->setColorFontStyle('10px Helvetica');
     $this->_availableEvents = array('onselect');
     parent::init();
 }
Esempio n. 24
0
 public function getRow()
 {
     //$date = DateTime::CreateFromFormat("Y-m-d H:m:s", $this->orders[$this->main_order_id]->created);
     $date = new DateTime($this->orders[$this->main_order_id]->created);
     $now = new DateTime();
     $cc_expires_28 = DateTime::CreateFromFormat("d/m/Y", '28/' . $this->payment->getexp_date_formatted());
     $products = array();
     $this->products2 = array();
     //for($i=0;$i<count($this->products);$i++) {
     $s = 0;
     foreach ($this->products as $p) {
         $s++;
         $productSKU = '';
         if (isset($p->product_sku)) {
             if ($s == 1) {
                 $productSKU = $p->product_sku;
             } else {
                 $productSKU = $p->product_shipping_sku ? $p->product_shipping_sku : $p->product_sku;
             }
         }
         $productCat = isset($p->prodcat_id) && $p->prodcat_id > 1 ? $p->prodcat->name : '';
         $this->products2[] = $productSKU;
         $products = array_merge($products, array('Product ' . $s . ' Name' => isset($p->product_name) ? $p->product_name : '', 'Product ' . $s . ' Price' => isset($p->product_price) ? $p->product_price : '', 'Product ' . $s . ' SKU #' => $productSKU, 'Product ' . $s . ' Category' => $productCat, 'Product ' . $s . ' Description' => isset($p->product_name) ? $p->product_name : '', 'Product ' . $s . ' Quantity' => isset($p) ? 1 : '', 'Product ' . $s . ' Weight' => isset($p->product_weight) ? $p->product_weight : '', 'Product ' . $s . ' Declared Value' => ''));
     }
     // DEFAULT EXPORT COLUMNS.  If you add a new column here it needs to be added to the fulfillment_fields table
     // as well, with fulfillment_id = 0
     $array = array('Order Id' => $this->main_order_id, 'Bill First' => $this->billingAddress->fname, 'Bill Last' => $this->billingAddress->lname, 'Bill Address1' => $this->billingAddress->address1, 'Bill Address2' => $this->billingAddress->address2, 'Bill Address1and2' => $this->billingAddress->address1 . ' ' . $this->billingAddress->address2, 'Bill City' => $this->billingAddress->city, 'Bill State' => $this->billingAddress->state_name, 'Bill Zip' => $this->billingAddress->zip, 'Bill Country' => $this->billingAddress->country_name, 'Bill Phone' => $this->billingAddress->phone, 'Bill Email' => $this->customer->email, 'Ship First' => $this->shippingAddress->fname, 'Ship Last' => $this->shippingAddress->lname, 'Ship Address1' => $this->shippingAddress->address1, 'Ship Address2' => $this->shippingAddress->address2, 'Ship Address1and2' => $this->shippingAddress->address1 . ' ' . $this->shippingAddress->address2, 'Ship City' => $this->shippingAddress->city, 'Ship State' => $this->shippingAddress->state_name, 'Ship Zip' => $this->shippingAddress->zip, 'Ship Country' => $this->shippingAddress->country_name, 'Ship Phone' => $this->shippingAddress->phone, 'Ship Email' => $this->customer->email, 'Ship Method Name' => $this->shipMethodName, 'Ship Method Description' => '', 'Ship Group Name' => $this->shipGroupName, 'Ship Group Code' => $this->shipGroupCode, 'Total Weight' => 0, 'Delivery Confirmation' => 'Yes', 'Signature Confirmation' => 'No', 'Ship Price' => sprintf("%.2f", $this->shippingPrice), 'Non Taxable Total' => sprintf("%.2f", $this->total), 'Taxable Total' => sprintf("%.2f", '0'), 'Sub Total' => sprintf("%.2f", $this->total), 'Sales Tax Percent' => sprintf("%.2f", '0'), 'Sales Tax Factor' => sprintf("%.2f", '0'), 'Order Total' => sprintf("%.2f", $this->total), 'Date of Sale' => $date->format($this->dateFormat), 'Time of Sale' => $date->format('H:i:s'), 'Tracking Number' => '', 'Payment' => !$this->payment->payment_id ? '' : ucwords(Bin::getCardType($this->payment->num2)), 'Last 4 of CC' => !$this->payment->payment_id ? '' : $this->payment->num3, 'Credit Card Expiration' => !$this->payment->payment_id ? '' : $this->payment->num1, 'IP Address' => $this->orders[$this->main_order_id]->ip_formatted, 'Customer Number' => '', 'Gateway Id' => $this->gateway->gateway_id, 'Gateway Alias' => $this->gateway->alias, 'Confirmation' => '', 'Confirmation Date/Time' => '', 'Export Date' => $now->format($this->dateFormat), 'CC Expire 28/mm/yyyy' => !$this->payment->payment_id ? '' : $cc_expires_28->format($this->dateFormat), 'Currency' => $this->campaign->currency_id, 'Package Id' => $this->package_id);
     return array_merge($array, $products);
 }
Esempio n. 25
0
 public function crmFormat()
 {
     if (!$this->method_id) {
         return array();
     }
     if (stripos($this->method->method_ref, 'cc_') !== false) {
         // CC Methods
         return array('Payment ID' => $this->payment_id, 'Card Type' => strtoupper(Bin::getCardType($this->num2)), 'Card Number' => substr($this->num2, 0, 4) . str_pad('', $this->num4 - 8, 'X', STR_PAD_LEFT) . str_pad($this->num3, 4, '0', STR_PAD_LEFT), 'Expiration' => $this->exp_date_formatted);
     } else {
         //return $this->getDataArray();
         return array('Payment ID' => $this->payment_id, 'Card Type' => $this->method->method_name, 'Card Number' => $this->txt1 . ' ' . $this->txt2 . ' ' . $this->txt3 . ' ' . $this->txt4, 'Expiration' => '');
     }
 }
 /**
  * Create new bins, with random content from an original bin
  *
  * @param  User   $u
  * @param  Bin    $bin
  * @param  array  $params
  * @return array  $counts
  */
 public static function randomize($u, $bin, $params)
 {
     $stats = self::init_stats($stats = array('total', 'insert', 'duplicate', 'invalid'));
     $stats['bin_uuids'] = array();
     $num = isset($params['num']) ? $params['num'] : 1;
     $size = isset($params['size']) ? $params['size'] : null;
     // sanity checking
     $conn = AIR2_DBManager::get_master_connection();
     $q = "select count(*) from bin_source where bsrc_bin_id = ?";
     $total = $conn->fetchOne($q, array($bin->bin_id), 0);
     if ($num < 0 || $num > 20 || $num > $total) {
         throw new Exception("Invalid num {$num} for randomize!");
     }
     if ($size && ($size < 1 || $size * $num > $total)) {
         throw new Exception("Invalid size {$size} for randomize (total={$total} num={$num})!");
     }
     // calculate size of each bin
     $bin_sizes = array_fill(0, $num, $size ? $size : 0);
     if (!$size) {
         $sz_idx = 0;
         for ($i = 0; $i < $total; $i++) {
             $bin_sizes[$sz_idx]++;
             $sz_idx = ($sz_idx + 1) % $num;
         }
     }
     // select in random order (mysql does this faster now than previous versions)
     $q = "select bsrc_src_id from bin_source where bsrc_bin_id = ? order by RAND()";
     if ($size) {
         $q .= " limit " . $num * $size;
     }
     $src_ids = $conn->fetchColumn($q, array($bin->bin_id), 0);
     // create bins, and insert items
     $curr_offset = 0;
     foreach ($bin_sizes as $bidx => $bsize) {
         $b = new Bin();
         $b->bin_user_id = $u->user_id;
         $b->bin_name = "{$bin->bin_name} - Random " . ($bidx + 1);
         $b->bin_desc = "Random output from bin: '{$bin->bin_name}'";
         $b->save();
         $stats['bin_uuids'][] = $b->bin_uuid;
         $add_ids = array_slice($src_ids, $curr_offset, $bsize);
         $curr_offset += $bsize;
         $bstats = AIR2Bin::add_sources($b, $add_ids);
         $stats['insert'] += $bstats['insert'];
         $stats['total'] += $bstats['total'];
     }
     return $stats;
 }
Esempio n. 27
0
 function StaticEntry($value, $title = '')
 {
     $this->_value = $value;
     $this->_title = $title;
     parent::init();
 }