0) $forced_size.=" WIDTH =\"$pict_w\""; if ($pict_h>0) $forced_size.=" HEIGHT =\"$pict_h\""; if (!$mask){ if (!file_exists($pict_dir.$actual_im_name)) return $no_pict; if (empty($GLOBAL_CONFIG_DATA['MODEREWRITEON']) || ($site_protocol=='https')) return "\"$hint\""; else return "\"$hint\""; } //////////////////Code below this point should never be used in WebCart Anymore return ''; $do_adj = false; if ($picts_preview_rule<2) { if (!should_be_adjusted($pict_dir.$actual_im_name, $wished_width, $wished_height, $picts_preview_rule)) return "\"$hint\"$forced_size"; } $actual_im_name = get_masked_filename($filename, $mask); $actual_im_name = $filename; $file_existed = file_exists($pict_dir.$actual_im_name); if (!$file_existed && file_exists($pict_dir.$filename)) copy($pict_dir.$filename, $pict_dir.$actual_im_name); if (!file_exists($pict_dir.$actual_im_name)) return $no_pict; $do_adj = should_be_adjusted($pict_dir.$actual_im_name, $wished_width, $wished_height, $picts_preview_rule); if ((!$do_adj) && $file_existed) return "\"$hint\"$forced_size"; resizeImage($pict_dir.$filename, $pict_dir.$actual_im_name, $wished_width, $wished_height); return "\"$hint\"$forced_size"; } FUNCTION move_file_4upload($src_fname, $src_tn_fname, $src_dir, $dest_dir) { global $pict_dir, $image_rules, $fr_mask; if (!file_exists($src_dir.$src_fname)) die('Fatal error: Image file '.$src_dir.$src_fname.' not found, but specified.'); copy($src_dir.$src_fname, $dest_dir.$src_fname); //if (file_exists($dest_dir.$src_fname)) //chmod($dest_dir.$src_fname, 0777); $filename = get_masked_filename($src_fname, $fr_mask); if (file_exists($src_dir.$src_tn_fname)) { copy($src_dir.$src_tn_fname, $dest_dir.$filename); chmod($dest_dir.$filename, 0666); } return $src_fname; } ?>error = $v; return false; } private function set_basic_token($user, $pass){ $this->basic_token = base64_encode("$user:$pass"); } function __construct($user, $pass, $company_code, $live=false, $TAXABLE_AMOUNT, $ZIP, $STATE, $CITY, $ADDRESS, $COUNTRY_TAG='US', $SHIPPING = 0, $SHIPPING_TAX_CODE='FR'){ $this->set_basic_token($user, $pass); $this->company_code = $company_code; $this->url = $live?$this->live_url:$this->sandbox_url; $this->AMOUNT = $TAXABLE_AMOUNT; $this->ZIP = $ZIP; $this->STATE = $STATE; $this->CITY = $CITY; $this->ADDRESS = $ADDRESS; $this->SHIPPING = $SHIPPING; $this->SHIPPING_TAX_CODE = $SHIPPING_TAX_CODE; if ($COUNTRY_TAG=='USA') $COUNTRY_TAG = 'US'; $this->COUNTRY_TAG = strtoupper($COUNTRY_TAG); } private function get_from_address(){ if (empty($GLOBALS['GLOBAL_CONFIG'])) $GLOBALS['GLOBAL_CONFIG'] = get_settings_array('tbl_config', 1, DATASET_ASSOC); $GLOBAL_CONFIG = $GLOBALS['GLOBAL_CONFIG']; return array( "line1"=> $GLOBAL_CONFIG['compaddr1'],"city"=>$GLOBAL_CONFIG['CITY'], "region"=> $GLOBAL_CONFIG['STATE'], "country"=>'US', "postalCode" => $GLOBAL_CONFIG['ZIP']); } private function get_to_address(){ $addr1 = substr($this->ADDRESS, 0, 30); $addr2 = substr($this->ADDRESS, 30, 30); return array( "line1"=> $addr1, "line2"=>$addr2, "city"=>$this->CITY, "region"=> $this->STATE, "country"=>$this->COUNTRY_TAG, "postalCode" => $this->ZIP); } private function form_shipping_line(){ if (empty($this->SHIPPING)) return false; $line = new stdClass(); $line->number = '2'; $line->quantity = 1; $line->amount = $this->SHIPPING; $line->itemCode = $this->SHIPPING_TAX_CODE; $line->itemCode = 'SHIPPING'; $line->description = 'Shipping charge'; return $line; } private function form_transaction(){ $FROM_ADDRESS = $this->get_from_address(); $TO_ADDRESS = $this->get_to_address(); $line = new stdClass(); $line->number = '1'; $line->quantity = 1; $line->amount = $this->AMOUNT; $line->itemCode = 'CALC_TAX'; $transaction = new stdClass(); $transaction->lines = array($line); if ($shipping_line = $this->form_shipping_line()) $transaction->lines[] = $shipping_line; $transaction->addresses = array('shipFrom'=>$FROM_ADDRESS, 'shipTo'=>$TO_ADDRESS); $transaction->currencyCode = 'USD'; $transaction->date = date('Y-m-d'); $transaction->companyCode = $this->company_code; $transaction->customerCode = 'default'; return json_encode($transaction); } /** *Save log into the database users order id or quote id from the Avalara object * * @param string $REQUEST * @param string $RESPONSE * @param string $ERROR //Should be empty unless error should be logged * @return null */ private function save2log($REQUEST, $RESPONSE, $ERROR= ''){ perform_plain_insert('tbl_avalara_log', array('REQUEST', 'RESPONSE', 'ORDER_ID', 'QUOTE_ID', 'ERROR'), array($REQUEST, $RESPONSE, $this->ORDER_ID, $this->QUOTE_ID, $ERROR)); } private function callAPI(){ $data = $this->form_transaction(); $curl = curl_init(); // OPTIONS: curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_URL, $this->url.'transactions/create'); curl_setopt($curl, CURLOPT_HTTPHEADER, array( 'Authorization: Basic '.$this->basic_token, 'X-Avalara-Client: Adrecom ECM;v 12.2019;php;'.phpversion().';SERVER', 'Content-Type: application/json', )); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // EXECUTE: $result = curl_exec($curl); if(!$result){ $this->save2log($data, '', 'Empty response'); return false; } curl_close($curl); $this->save2log($data, $result); return $result; } private function get_free_query($zip_only = false){ $ZIP = substr($this->ZIP,0,5); $COUNTRY_TAG = strtoupper(substr($this->COUNTRY_TAG,0, 2)); if ($zip_only) return http_build_query(array('postalCode'=>$ZIP, 'country'=>$COUNTRY_TAG)); return http_build_query(array('line1'=>$this->ADDRESS, 'city'=>$this->CITY, 'state'=>$this->STATE, 'postalCode'=>$ZIP, 'country'=>$COUNTRY_TAG)); } private function get_tax_percet4address_free(){ $REQUEST = $this->get_free_query(); $URL = $this->url.'taxrates/byaddress?'.$REQUEST; /*my_printr($URL); view($this->basic_token);*/ $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: application/json', 'Authorization: Basic '.$this->basic_token )); curl_setopt ($ch, CURLOPT_FAILONERROR, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt ($ch, CURLOPT_TIMEOUT, 3); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $exec_result = curl_exec ($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($http_code!=200){ $this->save2log($REQUEST, $exec_result, 'Wrong http code from Avalara. Code:'.$http_code); return $this->set_error('Wrong http code from Avalara. Code:'.$http_code); } return $exec_result; } private function get_tax_percet4zip_free(){ $URL = $this->url.'taxrates/bypostalcode?'.$this->get_free_query(true); /*my_printr($URL); view($this->basic_token);*/ $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Accept: application/json', 'Authorization: Basic '.$this->basic_token )); curl_setopt ($ch, CURLOPT_FAILONERROR, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt ($ch, CURLOPT_TIMEOUT, 3); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $exec_result = curl_exec ($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($http_code!=200){ return $this->set_error('Wrong http code from Avalara. Code:'.$http_code); } return $exec_result; } public function get_error(){ return $this->error; } public function get_tax(){ if (!empty($GLOBALS['AVALARA_STATES']) && is_array($GLOBALS['AVALARA_STATES']) && !in_array($this->STATE, $GLOBALS['AVALARA_STATES']) ) return 0; $res = $this->callAPI(); if (empty($res)){ if (!empty($this->error)) return false; return $this->set_error('Connection to Avalara server refused.'); } $res = json_decode($res, true); if (!is_array($res)) return $this->set_error('Avalara has returned an invalid response'); if (!empty($res['error'])) return $this->set_error('Avalara error: '.$res['error']['message']); if (array_key_exists('totalTax', $res)) return $res['totalTax']; return $this->set_error('Avalara has returned an invalid response'); } public function get_tax_percent4address(){ $res = $this->get_tax_percet4address_free(); if (empty($res) && !empty($this->error) && !empty($this->ZIP)) $res = $this->get_tax_percet4zip_free(); if (empty($res)){ if (!empty($this->error)){ return false; } return $this->set_error('Connection to Avalara server refused or timed out or timed out for '.$this->url.'taxrates/byaddress?'.$this->get_free_query()); } $res = json_decode($res, true); if (!is_array($res)) return $this->set_error('Avalara has returned an invalid response'); if (!empty($res['error'])) return $this->set_error('Avalara error: '.$res['error']['message']); if (array_key_exists('totalRate', $res)) return $res['totalRate'] * 100; return $this->set_error('Avalara has returned an invalid response'); } /** * @param int $ORDER_ID * order ID to be reflected in teh logs */ public function set_order_id($ORDER_ID = -1){ $this->ORDER_ID = $ORDER_ID; } /** * @param int $QUOTE_ID * quote ID to be reflected in teh logs */ public function set_quote_id($QUOTE_ID = -1){ $this->QUOTE_ID = $QUOTE_ID; } } ?>fatal_error('CUSTOMERS or DEFAULT type of users is not found'); return $res; } private function get_avatar($URL, $UNIQUEID){ if (empty($URL)) return ''; $filename = $UNIQUEID; $tmp = file_get_contents($URL); if (empty($tmp)) return ''; file_put_contents('./picts/members/'.$filename, $tmp); $ext = get_image_type_exif('./picts/members/'.$UNIQUEID); if ($ext=='unknown' && $filename){ unlink('./picts/members/'.$filename); return ''; } $filename = $filename.".$ext"; rename('./picts/members/'.$UNIQUEID, './picts/members/'.$filename); return $filename; } private function login($LOGIN_RECORD){ $reg_obj = new Taccount_registraion($LOGIN_RECORD); $reg_obj->set_ignore_reference(true); return $reg_obj->login(empty($GLOBALS['users_path'])?'':$GLOBALS['users_path']); } private function prepare_login_record(){ $ENCODING = defined('ENFORSE_ENCODING')?ENFORSE_ENCODING:'windows-1252'; if (strtolower($ENCODING) == 'utf-8' || (strtolower(ENFORSE_ENCODING)=='utf-8')) return; $this->user_data['nickname'] = mb_convert_encoding($this->user_data['nickname'], $ENCODING, 'UTF-8'); $this->user_data['first_name'] = mb_convert_encoding($this->user_data['first_name'], $ENCODING, 'UTF-8'); $this->user_data['last_name'] = mb_convert_encoding($this->user_data['last_name'], $ENCODING, 'UTF-8'); } private function get_user_unique_id(){ return $this->user_data['network'].'-'.$this->user_data['uid']; } private function get_current_user_record($ACC_TPY_ID){ $search_field = empty($this->user_data['email'])?'UNIQUEID':'EMAIL'; $search_value = empty($this->user_data['email'])?$this->get_user_unique_id():$this->user_data['email']; return get_dataset_array(bind_params2sql('SELECT * FROM `tbl_accounts` WHERE `'.$search_field.'`= $VALUE AND `ACC_TPY` = $ACC_TPY_ID', array('VALUE'=>$search_value,'ACC_TPY_ID' =>$ACC_TPY_ID)), DATASET_ASSOC); } private function userdata2acc_record($skip_email_uniqueid = false){ $ULOGIN_RECORD = $this->user_data; $UNIQUEID = $this->get_user_unique_id(); $URL = $ULOGIN_RECORD['identity']; $EMAIL = $ULOGIN_RECORD['email']; $OFFLINEMEMBERID = $ULOGIN_RECORD['nickname']; $FNAME = $ULOGIN_RECORD['first_name']; $LNAME = $ULOGIN_RECORD['last_name']; $NETWORK = $ULOGIN_RECORD['network']; $AVATAR = $this->get_avatar($ULOGIN_RECORD['photo'], $UNIQUEID); if ($skip_email_uniqueid) return array('OFFLINEMEMBERID'=>$OFFLINEMEMBERID, 'FNAME'=>$FNAME, 'LNAME'=>$LNAME, 'AVATAR'=>$AVATAR, 'URL'=>$URL, 'MISC1'=>$NETWORK); return array('UNIQUEID'=>$UNIQUEID, 'EMAIL' =>$EMAIL, 'OFFLINEMEMBERID'=>$OFFLINEMEMBERID, 'FNAME'=>$FNAME, 'LNAME'=>$LNAME, 'AVATAR'=>$AVATAR, 'URL'=>$URL, 'MISC1'=>$NETWORK); } private function register($ACC_TPY_ID){ $real_user_data = $this->userdata2acc_record(); if (empty($real_user_data['EMAIL'])){ my_printr($real_user_data); $this->fatal_error('Email is missing'); } $real_user_data['PASSWORD1'] = $real_user_data['PASSWORD2'] = substr(md5(rand().'ZAPTA'),0, 7); $real_user_data['ACC_TPY'] = $ACC_TPY_ID; return perform_plain_insert('tbl_accounts', array_keys($real_user_data), array_values($real_user_data)); } private function update($ACC_ID){ $real_user_data = $this->userdata2acc_record(true); perform_plain_update('tbl_accounts', array_keys($real_user_data), array_values($real_user_data), $ACC_ID); return $ACC_ID; } private function register_update_record(){ $ACC_TPY_ID =$this->get_acc_tpy_id(); $real_user_data = $this->get_current_user_record($ACC_TPY_ID); if (empty($real_user_data)) return $this->register($ACC_TPY_ID); if (empty($real_user_data[0]['ID'])) $this->fatal_error('Unknown error: ACC_ID is gone'); return $this->update($real_user_data[0]['ID']); } private function perform_cms_login(){ if (empty($this->user_data) || !is_array($this->user_data)) $this->fatal_error('Wrong user data'); $this->prepare_login_record(); $ACC_ID = $this->register_update_record(); set_session_var("LOGIN_REC", array('ACC_ID'=>$ACC_ID, 'AUTOLOGIN'=>get_name_by_id('tbl_accounts', 'AUTOLOGIN', $ACC_ID))); $acc_data = get_settings_array('view_all_accounts', $ACC_ID, DATASET_ASSOC); $acc_data['ACC_TPY'] = 'CUSTOMERS'; $err_code = $this->login($acc_data); if (!$err_code){ //set_session_var("LOGIN_REC", array('ACC_ID'=>$ACC_ID, 'AUTOLOGIN'=>get_name_by_id('tbl_accounts', 'AUTOLOGIN', $ACC_ID))); set_session_var("ULOGIN_NETWORK", $this->user_data['network']); set_session_var("ULOGIN_NAME", $this->user_data['first_name']. ' ' . $this->user_data['last_name']); } save_current_session(); } private function get_user_data_from_ulogin(){ $token = ''; if (!var_is_submitted('token', $token)) $this->fatal_error('Token is missing'); if (empty($token)) $this->fatal_error('Token is empty'); $ULOGIN_URL = empty($GLOBALS['ULOGIN_URL'])?'http://ulogin.ru/token.php':$GLOBALS['ULOGIN_URL']; $s = file_get_contents($ULOGIN_URL.'?token='.$token.'&host='.$_SERVER["HTTP_HOST"]); $this->user_data = json_decode($s, true); if (!empty($this->user_data['error'])){ $this->fatal_error('Ulogin error: '.$this->user_data['error']); } return true; } private function redirect2uri(){ $url_parts = parse_url($_SERVER['HTTP_REFERER']); parse_str($url_parts['query'], $tmp); $delim = '?'; if (!empty($tmp['redirect_uri'])) $delim = '?'; if (strpos($tmp['redirect_uri'], '?')!==false) $delim = '&'; $rand = rand(); $tmp['redirect_uri'] = str_replace('ac=ulogin', '', $tmp['redirect_uri']); redirect2URL($tmp['redirect_uri'].$delim.'params[login_ok]=1&r='.$rand, '#COMMENTS_START'); return true; } function process(Tsettings &$settings){ $this->settings = &$settings; if ($_SERVER['REQUEST_METHOD'] !='POST') $this->fatal_error('Restricted area'); $this->get_user_data_from_ulogin(); $this->perform_cms_login(); $this->redirect2uri(); return false; } } function ulogin_validate_token(){ if ($_SERVER['REQUEST_METHOD'] !='POST') return false; $token = ''; if (!var_is_submitted('token', $token) || empty($token)) return false; make_var_submitted('ac', 'ulogin'); return true; } //error_reporting(E_ALL); if (ulogin_validate_token() && var_is_submitted('ac', $ac) && $ac=='ulogin'){ $ulogin_processor = new TUlogin_processor(); } ?> Convenience Kits International, Ltd https://www.conveniencekits.com/

With the world's best known brands as our partners, our personal hygiene, amenity kits and travel kits are helping people and organizations across the country.

clietns
  • colgate
  • unilever
  • sileil
  • perio
  • beriersdorf
  • pg
City relief
Our goal is to gather 5,000 hygiene kits for our neighbors experiencing homelessness. We’ve partnered with a very cool company that has pre-packaged kits and all you have to do is select the quantity you would like to donate. Those items get shipped to us and we can hand them out at our outreaches, click here to gather hygiene kits.

A note to say thank you for all your help gathering the products needed for our Secret Santa gifts. We anonymously give holiday gifts to Veterans and the homeless during the holiday season.

It was a seamless process, with you guiding us to products that best serve the needs of the population we try to brighten. After researching the market, we came to find your pricing to be not only competitive, but more than fair. The company certainly carries an extensive list of name brand products, and a variety that covers everything from hygiene products, to socks, laundry products, to emergency blankets to name a few.

We look forward to a long term relationship, in helping those that deserve our respect and need a healthy dose of humanity.

Phoenix medical billing and consultant services inc.