public function go() { $car = new Transport(); $car->type_of_transport("ground"); $car->engine_type("combustion engine"); $car->move(); }
public function go() { $bike = new Transport(); $bike->type_of_transport("ground"); $bike->engine_type("electric motor"); $bike->move(); }
public function go() { $train = new Transport(); $train->type_of_transport("ground"); $train->engine_type("diesel engine"); $train->move(); }
public function go() { $plane = new Transport(); $plane->type_of_transport("air"); $plane->engine_type("jet engine"); $plane->move(); }
public function go() { $ship = new Transport(); $ship->type_of_transport("water"); $ship->engine_type("steam-turbine"); $ship->move(); }
public function actionOrder_list_load() { $order = new Orders(); $transport = new Transport(); $order_id = $_POST['order_id']; $data['transport'] = $transport->get_transport(); $data['product'] = $order->_get_list_order($order_id); $data['model'] = $order; $data['order_id'] = $order_id; $this->renderPartial("//orders/orders_list_load", $data); }
public function actionData() { $transport_id = (int) Yii::app()->request->getPost('id'); $pass = Yii::app()->request->getPost('pass', ''); $dataRequest = Yii::app()->request->getPost('data', ''); $data = json_decode($dataRequest, false); if ($transport_id && $pass && is_array($data)) { Yii::app()->getModule('cabinet'); $transport = Transport::model()->findByPk($transport_id); if (!is_null($transport)) { $tracking = Tracking::model(); $checkPass = $tracking->getPasswordForAPI($transport); if (0 == strcmp($pass, $checkPass)) { $res = $tracking->saveTrackData($transport_id, $data); echo CJSON::encode(['status' => $res ? 'success' : 'failed']); Yii::log("actionData success", "info"); } else { echo CJSON::encode(['status' => 'failed', 'data' => "wrong pass for transport_id=[{$transport_id}]"]); } } else { echo CJSON::encode(['status' => 'failed', 'data' => "Transport not found [{$transport_id}]"]); } } else { echo CJSON::encode(['status' => 'failed', 'data' => "Wrong params transport_id=[{$transport_id}],pass=[{$pass}]"]); } Yii::app()->end(); }
/** * @param $callback */ public function onMessage($callback) { while (true) { call_user_func_array($callback, [$this->transport->getNewMessages($this->profile->username), $this]); sleep(1); } }
/** С помощью массива $params, помимо текста сообщения, можно передать следующие параметры: action — принимает значения 'send' (отправить СМС, выбрано по-умолчанию) или 'check' (только проверить возможность отправки); datetime — дата и время отправки смс в формате (ГГГГ-ММ-ДД ЧЧ:ММ:СС); source — имя отправителя; onlydelivery (по-умолчанию 0 — платить за все смски, можно задать 1 — платить только за доставленные); regionalTime (по-умолчанию 0 — отправлять по вашему местному времени, можно задать 1 — отправлять по местному времени абонента); stop (по-умолчанию 1 — не отправлять абонентам, находящимся в Стоп-листах); smsid — желаемый id смски; use_alfasource (1 - отправлять через дорогой канал с согласованным именем отправителя. 0 - дешёвый канал.). allowed_opsos - перечисление операторов сотовой связи, которым можно отправлять это сообщение, через запятую, без пробелов. Например: "megafon,beeline". Остальным операторам сообщение отправляться не будет. exclude_opsos - перечисление операторов сотовой связи, которым запрещено отправлять это сообщение, через запятую, без пробелов. Например: "megafon,beeline". Остальным операторам сообщение будет отправлено. */ public function sendsms() { if ($this->phone == null || $this->text == null) { return false; exit; } require_once __DIR__ . '/SmsService/transport.php'; $api = new Transport(); /* $params = array( "text" => $text ); */ //$send = $api->send($params,$phones); $send = $api->send(array('text' => $this->text), $this->phone); return $send; }
function __construct($url) { parent::__construct($url); $this->curl = curl_init($url); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($this->curl, CURLOPT_COOKIEFILE, ''); $this->cookies = array(); }
/** * Create a new Mailer instance. * * @var \Swift_SmtpTransport $transport. * Optionally supply a transport class. If omitted a Transport * object will be created that uses the smtp settings from config.php * * @return Mailer */ public static function newGoInstance($transport = false) { if (!$transport) { $transport = Transport::newGoInstance(); } $mailer = new self($transport); return $mailer; }
public function call($service, $apiName, $params, $opt = array()) { $callback = 'solo'; $request = Request::createRequest(); $request->setApi($service, $apiName, $opt); $request->setParam($params); $response = Transport::exec(array($callback => $request), $opt); return $response[$callback]; }
/** * Given a client id, client secret and a refresh token, request a new access token from the API. * * @return string */ public function getAccessToken() { if ($this->access_token == null) { $post_data = array('client_id' => $this->config->client_id, 'client_secret' => $this->config->client_secret, 'refresh_token' => $this->config->refresh_token, 'grant_type' => 'refresh_token'); $response = Transport::post('https://api.freeagent.com/v2/token_endpoint', array(), $post_data); $response_json = json_decode($response->body); $this->access_token = $response_json->access_token; } return $this->access_token; }
/** * Perform HTTP request * * @param string $method HTTP method * @param string $url Full URL including protocol * @param array $params Any params * @return mixed API response */ protected function doRequest($method, $url, $params, $headers) { $request = $this->transport->createRequest(); $request->setMethod($method); $request->fromUrl($url); $request->addHeaders($headers); $request->setContent($params); if ($this->isAuthenticated() && null !== $this->authenticator) { $request = $this->authenticator->authenticate($request); } return $this->transport->send($request); }
/** * @param string $sid - session id returned by Zaloguj() method * @param array $settings - search params array('Nip' => null, 'Regon' => null, 'Krs' => 'null'} * @param bool $extended - get extended information * @return array * @throws \Exception */ public function daneSzukajDzialalnosc($sid, $settings, $extended = false) { $headers = ['sid' => $sid]; $params = ['pParametryWyszukiwania' => ["Regon" => null, "Krs" => null, "Nip" => null]]; if (isset($settings['Nip'])) { $params['pParametryWyszukiwania']['Nip'] = $settings['Nip']; } if (isset($settings['Regon'])) { $params['pParametryWyszukiwania']['Regon'] = $settings['Regon']; } if (isset($settings['Krs'])) { $params['pParametryWyszukiwania']['Krs'] = $settings['Krs']; } $result = $this->transport->call('daneSzukaj', 'post', $params, $headers); if (!isset($result['d'])) { return false; } if (empty($result['d'])) { $this->error = $this->DaneKomunikat($sid); return false; } $response = json_decode($result['d'], true); if (!$response) { return false; } $response = array_shift($response); if ($extended) { $eparams = ['pNazwaRaportu' => null, 'pRegon' => str_pad($response['Regon'], 14, "0"), 'pSilosID' => 1]; switch ($response['Typ']) { case 'F': $eparams['pNazwaRaportu'] = 'DaneRaportDzialalnosciFizycznejPubl'; break; case 'P': $eparams['pNazwaRaportu'] = 'DaneRaportDzialalnosciPrawnejPubl'; break; default: throw new \Exception("Unknown type!"); } $result = $this->transport->call('DanePobierzPelnyRaport', 'post', $eparams, $headers); if (!isset($result['d'])) { return false; } if (empty($result['d'])) { $this->error = $this->DaneKomunikat($sid); return false; } $data = json_decode($result['d'], true); $data = ['ListaDzialalnosci' => $data]; return array_merge($response, $data); } return $response; }
/** * Send request to Moneybird * * @access protected * @return string * @param string $url * @param string $method (GET|POST|PUT|DELETE) * @param string $data */ protected function request($url, $method, $data = null) { $this->testLogin(); try { $response = $this->transport->send($url, $method, $data, array('Content-Type: ' . $this->mapper->getContentType())); } catch (HttpClient_HttpStatusException $e) { $message = $e->getMessage(); if ($e->getCode() == 403 || $e->getCode() == 422) { $this->errors = $this->mapper->mapFromStorage($this->transport->getLastResponse()); if ($this->errors instanceof Error_Array && count($this->errors) > 0) { $message .= PHP_EOL . 'Errors:' . PHP_EOL . $this->errors; } } if (self::$debug) { printf('Url: %s' . PHP_EOL . 'Method: %s' . PHP_EOL . 'Data: %s', $url, $method, $data); } switch ($e->getCode()) { case 401: throw new NotLoggedInException($message, 0, $e); break; case 403: throw new ForbiddenException($message, 0, $e); break; case 404: throw new NotFoundException($message, 0, $e); break; case 406: case 422: throw new NotValidException($message, 0, $e); break; default: $message = 'Unknown error'; // no break // no break case 500: case 501: throw new ServerErrorException($message, 0, $e); break; } } return $response; }
/** * Parse a DNS answer record and add it to the given response. * * @param Response $response */ protected function parseAnswer(Response $response) : \Generator { $host = (yield from $this->transport->readLabel()); $type = (yield from $this->transport->readShort()); $class = (yield from $this->transport->readShort()); $ttl = (yield from $this->transport->readLong()); $len = (yield from $this->transport->readShort()); switch ($type) { case Message::TYPE_A: case Message::TYPE_AAAA: $data = \inet_ntop(yield from $this->transport->read($len)); break; case Message::TYPE_CNAME: $data = (yield from $this->transport->readLabel()); break; default: $data = (yield from $this->transport->read($len)); } $response->addAnswer($host, $type, $class, $data, $ttl & 0x80000000 ? $ttl - 0xffffffff : $ttl); }
/** * Return all customers. An array indexed by email. Contact objects as values. * * @return array */ public function all() { $customer_map = array(); $customer_page = 1; do { $all_customers = Transport::get(sprintf("%s?per_page=100&page=%d", $this->getFullEndpoint(self::CREATE_ENDPOINT), $customer_page), $this->getAuthHeaders()); $all_customers_json = json_decode($all_customers->body); $page_customer_count = count($all_customers_json->contacts); foreach ($all_customers_json->contacts as $contact) { if (isset($contact->email)) { $contact_data = new \stdClass(); $contact_data->contact = $contact; $contact_obj = new Contact($this->config); $contact_obj->loadData($contact_data); $contact_obj->url = $this->getResourcePathFromUrl($contact->url); $customer_map[$contact->email] = $contact_obj; } } $customer_page++; } while ($page_customer_count > 0); return $customer_map; }
</section> <section class="col-md-6"> <?php echo $form->checkboxListGroup($Transport, 'documents', ['widgetOptions' => ['data' => Cargo::getDocuments()]]); ?> </section> </div> <div class="row"> <section class="col-md-6"> <?php echo $form->checkboxListGroup($Transport, 'load_type', ['widgetOptions' => ['data' => Transport::getTypeLoadUnload()]]); ?> </section> <section class="col-md-6"> <?php echo $form->checkboxListGroup($Transport, 'unload_type', ['widgetOptions' => ['data' => Transport::getTypeLoadUnload()]]); ?> </section> </div> <div class="row"> <section class="col-md-4"> <?php //echo $form->checkboxGroup($Transport,'tracking_on'); ?> </section> <section class="col-md-4 tracking" <?php echo $Transport->tracking_on == 0 ? 'style="display: none"' : ''; ?> > <?php echo $Transport->transport_id ? Yii::t('CabinetModule.default', 'Номер транспорта: ') . $Transport->transport_id : Yii::t('CabinetModule.default', 'Номер не присвоен');
/** * @param string $apiKey */ public function __construct($apiKey) { $this->pricingSessionUrl = self::API_HOST . '/apiservices/pricing/v1.0'; parent::__construct($apiKey); }
public function sms() { // the main sub in our application include_once("model/transport.php"); // connect to the Settings if(!isset($_SESSION)) session_start(); $action = getvariablereq('action'); // get action from the request $data = getvariablereq('data' ); // get JSON data from the request $t = $this->model->getStats('common'); echo "Report date: ".date("Y-m-d H:i:s")."<br>"; $phones_first = array(); $phones_second = array(); $users=$this->model->getUsersSms(); $this->model->resetUsersFirstSms(); // ajax_echo_r ($users); foreach ($users as $user) { if ($user->Phone) { $user->Phone = str_replace("+7", "8", $user->Phone); $user->Phone = str_replace( "-", "", $user->Phone); if ($user->FirstSms) { $phones_first[] .= $user->Phone; } else { $phones_second[] .= $user->Phone; } } } $info = "Всего собственников ".$t->objects_total.", из них новых ".$t->objects_yesterday.". Всего покупателей ".$t->customers_total.", из них новых ".$t->customers_yesterday.". "; // $info.= "Потенциальных сделок ".$t->handshakes_auto.". "; $info.= "Сделок на этой неделе ".$t->handshakes_thisweek." (осталось сделать ".($t->handshakes_thisweek_plan - $t->handshakes_thisweek).")."; echo $info; $api = new Transport($this->settings); $params_first = array( "text" => "Привет, это СМСка от Изума. ".$info ); $params_second = array( "text" => "Доброе утро. Изум-информ сообщает: ".$info ); // $phones_first = array('89376411426'); // $phones_second = array('89276047754'); ajax_echo_r ($phones_first); ajax_echo_r ($phones_second); $send_first = $api->send($params_first ,$phones_first); $send_second = $api->send($params_second ,$phones_second); ajax_echo_r ($send_first); ajax_echo_r ($send_second); if ($send['code'] == 1) { // echo 'Отправлено '.$send['colSendAbonent'].', не отправлено'; } else { // echo $send['descr']; } }
public function call($command, array $params = array()) { return $this->transport->request(json_encode(array('jsonrpc' => '2.0', 'method' => $command, 'params' => $params, 'id' => uniqid()))); }
/** * @param string $apiKey */ public function __construct($apiKey) { $this->pricingSessionUrl = self::API_HOST . '/apiservices/carhire/liveprices/v2'; parent::__construct($apiKey); }
/** * Lists all models. */ public function actionIndex() { $model = new Favorite('search'); $model->unsetAttributes(); // clear any default values if (isset($_REQUEST['Favorite'])) { $model->attributes = $_GET['Favorite']; } // $favorites = Favorite::model()->findAll('modelName LIKE :t ',array(':t' => '%'.$model->modelName.'%')); $favorites = Favorite::model()->findAllBySql(' select f.* FROM Favorite `f` LEFT JOIN Tender ON tenderId = modelId AND modelName=\'Tender\' LEFT JOIN Transport ON transportId = modelId AND modelName=\'Transport\' LEFT JOIN Cargo ON cargoId = modelId AND modelName=\'Cargo\' LEFT JOIN User ON User.userId = modelId AND modelName=\'User\' where f.userId = :u AND modelName LIKE :t AND ( NOT ISNULL( tenderId ) OR NOT ISNULL( cargoId ) OR NOT ISNULL( User.userId ) OR NOT ISNULL( transportId ) )', array(':t' => '%' . $model->modelName . '%', ':u' => Yii::app()->user->id)); $ids = array(); foreach ($favorites as $it) { $ids[$it['modelName']][] = Yii::app()->db->quoteValue($it['modelId']); } /** * Disable all defaults scopes */ Cargo::disableDefaultScope(); Transport::disableDefaultScope(); Tender::disableDefaultScope(); User::disableDefaultScope(); $cargoes = new CActiveDataProvider('Cargo', array('criteria' => array('condition' => 'cargo.cargoId in (' . ($ids['Cargo'] ? implode(',', $ids['Cargo']) : 0) . ')'), 'pagination' => false)); $transports = new CActiveDataProvider('Transport', array('criteria' => array('condition' => 'transport.type = ' . Transport::TRANSPORT . ' AND transport.transportId in (' . ($ids['Transport'] ? implode(',', $ids['Transport']) : 0) . ')'), 'pagination' => false)); $tenders = new CActiveDataProvider('Tender', array('criteria' => array('condition' => 'tender.tenderId in (' . ($ids['Tender'] ? implode(',', $ids['Tender']) : -1) . ')'), 'pagination' => false)); $users = new CActiveDataProvider('User', array('criteria' => array('condition' => 'User.userId in (' . ($ids['User'] ? implode(',', $ids['User']) : -1) . ')'), 'pagination' => false)); $this->render('index', array('cargoes' => $cargoes, 'transports' => $transports, 'tenders' => $tenders, 'users' => $users, 'model' => $model)); }
if ($level == 1) { $message = '<h1>Вы зарегистрировались на сайте www.ladystyle.su!</h1><br><h4>Параметры учетной записи:</h4>Логин: ' . $li . "<br>Пароль: " . $_POST['pw'] . "<br>Ваша учетная запись требует ручной активации. Это проделают наши менеджеры в ближайшие минуты!<br><br>"; } if ($level == 2) { $message = '<h1>Вы зарегистрировались на сайте www.ladystyle.su!</h1><br><h4>Параметры учетной записи:</h4>Логин: ' . $li . "<br>Пароль: " . $_POST['pw'] . "<br>Ваша учетная запись не требует ручной активации. Для просмотра полной версии каталога одежды Lady Style перейдите по следующей ссылке: <a href='http://www.ladystyle.su/im/'>http://www.ladystyle.su/im/</a><br><br>"; } //mail ("*****@*****.**","$theme", "$message",$headers); if (isset($message)) { mail("{$email}", "{$theme}", "{$message}", $headers); } /*отправляем пароль на почту К*/ //отправка смс. http://lcab.smsprofi.ru $tel_mngr = array('+79094107400', '+79287589546'); //$tel_mngr=array('+79043496688'); require_once "sms/transport.php"; $api = new Transport(); if ($level == 1) { $mesg = translit("{$famil} {$name}({$tel}) {$address}"); } if ($level == 2) { $mesg = translit("ODOBREN! {$famil} {$name}({$tel}) {$address}"); } $params = array("text" => $mesg, "source" => "lady style", "use_alfasource " => "1"); $send = $api->send($params, $tel_mngr); unset($name); $name = NULL; unset($_POST['pw']); unset($_POST['name']); unset($_POST['famil']); unset($_POST['email']); unset($_POST['captcha']);
/** * Get the Transport object for this message (Based on the account) * * @return mixed Transport/\GO\Email\Transport */ public function getTransport() { if (!$this->hasAccount()) { return Transport::newGoInstance(); } else { return \GO\Email\Transport::newGoInstance($this->_account); } }
public function delete() { $hash_Str = $this->input->get('hash'); $transportid_Num = $this->input->get('transportid'); //CSRF過濾 if ($hash_Str == $this->security->get_csrf_hash()) { $transport = new Transport(); $transport->construct(array('transportid_Num' => $transportid_Num)); $transport->destroy(); $this->load->model('Message'); $this->Message->show(array('message' => '刪除成功', 'url' => 'admin/shop/transport/transport/tablelist')); } else { $this->load->model('Message'); $this->Message->show(array('message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/shop/transport/transport/tablelist')); } }
public function actionDelete($id) { $model = Transport::model()->findByPk($id); if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $model->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->transport != '1' || $model->user_id != Yii::app()->user->id) || Yii::app()->user->getProfile()->company->active == '0')) { throw new CHttpException(403); } if ($model === null) { throw new CHttpException(404, 'Указанная запись не найдена'); } $model->deleteByPk($id); $this->redirect('/cabinet/avtopark'); throw new CHttpException(404, 'The requested page does not exist.'); }
public function actionLoad_data() { $transport = new Transport(); $data['transport'] = $transport->get_transport(); $this->renderPartial("//backend/transport/view", $data); }
/** * Create a resource through the API. */ public function create() { $response = Transport::post($this->getFullEndpoint(static::CREATE_ENDPOINT), $this->getAuthHeaders(), $this->toJson()); $this->url = $this->getResourcePathFromUrl($response->headers['location']); }