/** * Constructor * * @param object HierarchicalRadioMatrix $property * @param object Agent $agent * @return void * @access public * @since 11/14/07 */ public function __construct(HierarchicalRadioMatrix $property, Agent $agent) { $this->property = $property; $this->agent = $agent; $this->agentId = $agent->getId(); $this->siteImplicitRole = new NoAccess_SegueRole(); $this->siteImplicitRoleMessage = ''; }
private function processEvent() { $dom = $this->dom; $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0); $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue; $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue; $originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue; $validSourceId = Agent::checkSourceId($originalSourceId); if (!$validSourceId) { RegisterError::invalidSourceId($agent->sourceId, $originalMsgId); } else { $agent = new Agent($originalSourceId); if ($agent->isRegistered()) { $eventObjectNode = $dom->getElementsByTagName('SIF_EventObject')->item(0); $objectName = $eventObjectNode->getAttribute('ObjectName'); $objectAction = $eventObjectNode->getAttribute('Action'); $objectAction = strtolower($objectAction); if (!DataObject::objectExists($objectName)) { ProvisionError::invalidObject($originalSourceId, $originalMsgId, $objectName); exit; } else { $allowed = $this->hasPermission($objectName, $objectAction, $agent->agentId); if ($allowed) { $provider = DataObject::isProvider($objectName, $agent->agentId); if ($provider) { $this->publishEvent($agent->agentId, $objectName, $objectAction, $_SESSION['ZONE_VERSION'], $dom->saveXml($headerNode)); $timestamp = Utility::createTimestamp(); $msgId = Utility::createMessageId(); $sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0); XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 0, $originalMsg = null, $desc = null); } else { ProvisionError::notProviderError($originalSourceId, $originalMsgId); } } else { switch ($objectAction) { case 'add': ProvisionError::invalidPermissionToPublishAdd($originalSourceId, $originalMsgId, $objectName); break; case 'change': ProvisionError::invalidPermissionToPublishChange($originalSourceId, $originalMsgId, $objectName); break; case 'delete': ProvisionError::invalidPermissionToPublishDelete($originalSourceId, $originalMsgId, $objectName); break; } //switch for error message } //allowed } //object exist } else { RegisterError::notRegisteredError($originalSourceId, $originalMsgId); } //not registered } //valid sourceId }
/** * @dataProvider agents * @test * @param Agent $agent * @param type $name * @param type $isNowAgent */ public function onlySmithCanReplicate(Agent $agent, $name, $shouldReplicate) { $victim = new Program(); $replication = new AgentReplication(); $agent->setName($name); $replication->replicate($agent, $victim); if ($shouldReplicate) { $this->assertEquals('Agent', get_class($victim)); } else { $this->assertEquals('Program', get_class($victim)); } }
function Create($email, $firstname, $lastname, $phone, $password, $repassword, $sendButton = null) { $repassword = $repassword == "null" ? null : $repassword; $agent = new Agent(); $agent->set($firstname, $lastname, $email, $phone, $password); $agentModel = new AgentModel($agent); $list = $agentModel->GetUsers(); $this->agentModelView->agent = $agent; $this->agentModelView->agentList = $list; if ($agent->validated()) { if ($password != $repassword) { Session::set("warning", " Password mis-matched, re-enter passwords again!"); return $this->View($this->agentModelView, "Agent", "Create"); } else { $this->agentModelView->agentDbModel = $agentModel; if ($agentModel->Exists()) { Session::set("warning", "The user with the given email address [{$email}] already exists!"); } else { try { //else create the user if ($agentModel->Create()) { $sessionID = Validator::UniqueKey(20); $agentModel->SaveVerificationCode($email, $sessionID); //create a barcode $param = new ArrayIterator(); $param->offsetSet("username", $agent->email); $param->offsetSet("verificationCode", $sessionID); $url = ContextManager::CreateURL("Agent", "Login", $param); $imgPath = ContextManager::CreateQRBarcode($url, $agent->agentId); if ($this->_sendVerificationEmail($agent, $sessionID, $imgPath)) { //navigate to comfirmation page return $this->View($agent, "Agent", "Confirmation"); } else { Session::set("warning", "could not send mail "); $agentModel->DeleteAgent($email); } } } catch (Exception $err) { Session::set("warning", $err->getMessage()); } } } // create a database record here } else { Session::set("warning", $agent->getError()); } return $this->View($this->agentModelView, "Agent", "Create"); }
public function detail($idLook, $categoria, $name) { $producto = DB::table('looks')->where('looks.idlook', $idLook)->where('looks.estado', '>=', 1)->join('lookbook', 'lookbook.idlookbook', '=', 'looks.idlookbook')->select('looks.*', 'lookbook.nombre')->get(); $subcate = $producto[0]->subcategoria; $ordensuperior = $producto[0]->orden2 + 1; $ordeninferior = $producto[0]->orden2 - 1; $numregistros = DB::table('looks')->where('looks.idlookbook', $categoria)->count(); if ($ordensuperior > $numregistros) { $ordensuperior = 1; } if ($ordeninferior <= 1) { $ordeninferior = $numregistros; } $prodsiguiente = DB::table('looks')->where('looks.orden2', $ordensuperior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get(); $prodanterior = DB::table('looks')->where('looks.orden2', $ordeninferior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get(); /*$similares = DB::table('looks') ->where('looks.idlookbook', '=', $categoria) ->where('looks.estado', '=', 1) ->where('looks.idlook', '!=', $idLook) ->select('looks.*') ->orderBy('looks.orden2') ->take(4) ->get();*/ $similares = DB::table('looks')->where('looks.idlookbook', '=', $categoria)->where('looks.estado', '>=', 1)->where('looks.idlook', '!=', $idLook)->where('looks.subcategoria', $subcate)->select('looks.*')->orderBy(DB::raw('RAND()'))->get(); $isMobile = Agent::isMobile(); if ($isMobile) { return View::make('mobile/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior); } else { return View::make('desktop/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior); } }
public function store() { $prospect = new Prospect(); $fullAddress = Input::get('prospect-address'); $addressPieces = explode(", ", $fullAddress); $prospect->prospect_address = $addressPieces[0]; $prospect->prospect_city = $addressPieces[1]; $prospect->prospect_state = $addressPieces[2]; $prospect->prospect_address_lat = Input::get('latitude'); $prospect->prospect_address_lng = Input::get('longitude'); $prospect->prospect_zip = Input::get('zipcode'); if (Input::has('prospect-unit-number')) { $prospect->prospect_apt_unit = Input::get('prospect-unit-number'); } $prospect->agent_id = Agent::findOrFail(1)->id; //formula to determine agent $prospect->broker_id = Broker::findOrFail(1)->id; if ($prospect->save()) { //true returns true or false return Redirect::action('HomeController@edit', array('prospect' => $prospect->id)); } else { Session::flash('errorMessage', 'Unable to locate property!'); return Redirect::back()->withInput(); } }
protected function validateIdentifiers($used_identifiers) { $members = $this->getPropValue('member'); $hasOneIdent = parent::validateIdentifiers($used_identifiers); $hasMembers = !is_null($members) && count($members) > 0; return $hasOneIdent || !$hasOneIdent && $hasMembers; }
public static function getCreditLimit($agent_id) { if (Entrust::hasRole('Agent')) { return Agent::where('user_id', $agent_id)->first()->credit_limit; } return false; }
public function getcomboboxesAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { if (!$this->getRequest()->isXmlHttpRequest()) { $this->view->msg = 'Not Ajax Request'; $this->_forward('error', 'error'); } else { $zones = Zone::getAllZones(); $contexts = Context::getAllContexts(); $agents = Agent::getAllAgents(); $this->view->zones = $zones; $this->view->agents = $agents; $this->view->contexts = $contexts; $this->render('aclcomboboxes'); } } else { if (!$this->getRequest()->isXmlHttpRequest()) { $this->view->msg = 'Not Ajax Request'; $this->_forward('error', 'error'); } else { $this->view->msg = 'Invalid User'; $this->_forward('error', 'error'); } } }
public function index() { Log::debug(__METHOD__); if (Input::has('book_id')) { $this->setCurrentBook(Input::get('book_id')); } if (Input::has('layout')) { $this->setLayout(Input::get('layout')); } if (Agent::isMobile()) { $user_name = Auth::user()->username; $get_task_counts = $this->getTaskCounts(); $book_name = $this->getBookName(); $current_book_id = $this->currentBook() ? $this->currentBook()->id : 0; $prefix = $this->getPrefix(); $recent_done_now = 10; $books = $this->getAllBookCounts(); $tasks = $this->getTasks('', $recent_done_now); return View::make('tasks.index', compact('user_name', 'book_name', 'current_book_id', 'prefix', 'recent_done_now', 'tasks', 'books')); } else { $this->tasks = $this->currentTasks(); // respond_to do |format| // format.html // format.csv { send_data(current_tasks.csv) } // format.xls // end return View::make('tasks.index'); } }
public function checkForUpdate($gamertag = '') { if ($this->request->ajax() && !\Agent::isRobot()) { try { $account = Account::with('destiny.characters')->where('seo', Text::seoGamertag($gamertag))->firstOrFail(); // We don't care about non-panda members if (!$account->isPandaLove()) { $this->inactiveCounter = 1; } // check for 10 inactive checks if ($account->destiny->inactiveCounter >= $this->inactiveCounter) { return response()->json(['updated' => false, 'frozen' => true, 'last_update' => 'This account hasn\'t had new data in awhile. - <a href="' . URL::action('Destiny\\ProfileController@manualUpdate', [$account->seo]) . '" class="ui horizontal green label no_underline">Update Manually</a>']); } $char = $account->destiny->firstCharacter(); if ($char->updated_at->diffInMinutes() >= $this->refreshRateInMinutes) { // update this $this->dispatch(new UpdateAccount($account)); return response()->json(['updated' => true, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]); } return response()->json(['updated' => false, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]); } catch (ModelNotFoundException $e) { return response()->json(['error' => 'Gamertag not found']); } } }
protected function validateIdentifiers($used_identifiers) { $members = $this->getPropValue('member') ?: null; $validateIdentifiers = parent::validateIdentifiers($used_identifiers); $validateMembers = $members === null || count($members) === 0; return $validateIdentifiers && $validateMembers; }
public function __construct() { if (Agent::isMobile()) { $this->_vista = 'mobile'; } else { $this->_vista = 'index'; } $this->_imagesInstagram = array(); $this->_imagesTwitter = array(); $instagram = new instagram(array('apiKey' => '09fd60952ea742d5abb761b6c6a137aa', 'apiSecret' => 'ee25063e91e74d6c9f257be054a44ec3', 'apiCallback' => 'http://viernesdezapatillas.pe/')); $tagInstagram = 'viernesdezapatillas'; $numphotosInstagram = 15; $media = $instagram->getTagMedia($tagInstagram, $auth = false, array('count' => $numphotosInstagram)); $response = json_decode(json_encode($media)); foreach ($response->data as $data) { $this->_imagesInstagram[] = $data->images->thumbnail->url; } $max_id = 0; $totalTweets = 15; $responset = Twitter::getSearch(array('q' => '#viernesdezapatillas since:2015-07-01 filter:images', 'count' => $totalTweets, 'max_id' => $max_id, 'since_id' => 0)); foreach ($responset->statuses as $tweet) { foreach ($tweet->entities->media as $url) { $this->_imagesTwitter[] = $url->media_url; // . ':thumb'; } } }
public function processAck($m) { $dom = $this->dom; $headerNode = $m->headerNode; $msgId = $m->msgId; $agentSourceId = $m->sourceId; # $msgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue; # $agentSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue; $originalMsgId = $dom->getElementsByTagName('SIF_OriginalMsgId')->item(0)->nodeValue; $timestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue; $status = $dom->getElementsByTagName('SIF_Status'); $status = $status->item(0)->nodeValue; $validSourceId = Agent::checkSourceId($agentSourceId); if (!$validSourceId) { RegisterError::invalidSourceId($agentSourceId, $msgId); } else { $agent = new Agent($agentSourceId); if ($agent->isRegistered()) { if ($status == 1) { $agent->unFreezeAgent(); $this->updateMessageQueue($agent, $originalMsgId, $msgId); } else { if ($status == 3) { //done processing if ($originalMsgId == $agent->frozenMsgId) { $agent->unFreezeAgent(); $this->updateMessageQueue($agent, $originalMsgId, $msgId); } else { GeneralError::EventACKError($this->xml); } } else { if ($status == 2) { //Intermediate wait for final $agent->freezeAgent(); $agent->setFrozenMsgId($originalMsgId); $timestamp = Utility::createTimestamp(); $msgId_u = Utility::createMessageId(); XmlHelper::buildSuccessMessage($msgId_u, $timestamp, $agent->sourceId, $msgId, 0, $originalMsg = null, $desc = null); } } } } else { RegisterError::notRegisteredError($agentSourceId, $msgId); } } }
public function removeIdentity() { if (!empty($this->getPrivateKeyFile()) && Agent::identityLoaded($this->getPrivateKeyFile())) { // echo "Removing identity {$this->unlockedPrivateKeyFile}\n"; Agent::deleteIdentity($this->getPrivateKeyFile()); } return $this; }
public function index() { if (!Owner::isAuthenticated() && !Agent::isAuthenticated()) { $this->redirect('/'); } else { $this->view('dashboard/index'); } }
public function create_object($data) { $data = \Core\Dict::create($data); $assassin = Agent::mapper()->create_object(array('id' => $data->assassin, 'alias' => $data->assassin_agent_alias)); $target = Agent::mapper()->create_object(array('id' => $data->target, 'alias' => $data->target_agent_alias)); $weapon = Weapon::mapper()->create_object(array('id' => $data->weapon_id, 'name' => $data->weapon_name)); return Kill::create(array('id' => $data->id, 'description' => $data->description, 'assassin' => $assassin, 'target' => $target, 'weapon' => $weapon, 'game' => $game, 'when_happened' => new \DateTime($data->when_happened)), True); }
public function main($id) { if (is_null(Agent::find($id))) { return Redirect::to('admin'); } $commissions = Commission::where('agent_id', $id)->orderBy('created_at', 'desc')->get(); $agent = Agent::find($id); View::make('admin.commission.list', compact('commissions', 'agent')); }
public function destroy(Request $request, $id) { empty($id) && !empty($request->input('id')) && ($id = $request->input('id')); $id = (array) $id; foreach ($id as $v) { $agent = Agent::destroy($v); } return $this->success('', count($id) > 5, compact('id')); }
public static function userHasAgent() { if (Entrust::hasRole('Agent')) { if ($x = User::getAgentOfUser(Auth::user())) { return Agent::with('market')->find($x->agent_id); } } return false; }
public static function dropdown() { $locations = Agent::orderBy('last_name')->get(); $array = array(); foreach ($locations as $l) { $key = $l->id; $array[$key] = ucwords($l->last_name . ', ' . $l->first_name); } return $array; }
public static function filter_by_request() { $routes = Main::get_instance()->routes; if (!$routes) { return; } return \_u::find($routes, function ($route) { return $route->method->equalsCurrent() && ($route->path->equalsCurrent() || $route->path->matchParams()) && Agent::matchesCurrent($route->agent); }); }
public function index() { $isMobile = Agent::isMobile(); //$isMobile=true; if ($isMobile) { return View::make('mobile/home'); } else { return View::make('desktop/home'); } }
public function asVersion($version) { $result = parent::asVersion($version); if (count($this->member) > 0) { $result['member'] = array(); foreach ($this->member as $v) { array_push($result['member'], $v->asVersion($version)); } } return $result; }
public function action_index($pr1 = null, $pr2 = null) { //パラメータが付いていた場合はリダイレクト if ($pr1 != null || $pr2 != null) { return Response::forge(Uri::base()); } $msg = Session::get('errorMsg'); Session::delete('errorMsg'); /* //ログインフォーム作成 $loginFieldSet = Fieldset::forge('loginForm'); $loginFieldSet->add('username','',array('type'=>'text','size'=>20)); $loginFieldSet->add('password','',array('type'=>'password','size'=>20)); $loginFieldSet->repopulate(); //送信ボタン追加 $loginFieldSet->add('submit','',array('type'=>'submit','width'=>80,'value'=>' ログイン ')); */ $content = ''; if (Agent::is_mobiledevice()) { $content = View::forge('index/index_mobile'); } else { $content = View::forge('index/index_pc'); } //掲示板全体の最新画像 $query = Model_Attach::query(); $query->select('id', 'bbsId'); $query->limit(12); $query->order_by('created_at', 'desc'); $images = $query->get(); //最新の書き込み掲示板(10個) $query2 = Model_Board::query(); $query2->select('id', 'shortName', 'title', 'updated_at'); $query2->limit(10); $query2->order_by('updated_at', 'desc'); $update = $query2->get(); //投稿数順 Model_Board::clear_cache(); $query3 = Model_Board::query(); $query3->select('id', 'shortName', 'title', 'postCount'); $query3->limit(10); $query3->order_by('postCount', 'desc'); $postCount = $query3->get(); $this->setBoardTitle(); // $content->set('loginForm',$loginFieldSet->build('index/login'),false); $content->set('newestImages', $images); $content->set('updateBoards', $update); $content->set('postCount', $postCount); //エラーメッセージ設定 if ($msg != null) { $content->set('msg', $msg, false); } $this->template->content = $content; }
/** * Get the fully qualified location of the view. * * @param string $name * @return string */ public function find($name) { // Log::info('View Hook!! ' . $name); if (Agent::isMobile()) { try { return parent::find($name . '@phone'); } catch (Exception $e) { Log::debug(__METHOD__ . ": not find {$name}@phone"); } } return parent::find($name); }
/** * A single function for searching Agents and Areas * * @param string $path */ public function find($path) { // split the input supplied into module, function, and param $split_path = explode('/', $path); if (isset($split_path[0])) { $module = $split_path[0]; } if (isset($split_path[1])) { $function = $split_path[1]; } if (isset($split_path[2])) { $param = $split_path[2]; } // break down the input to specific module, function, and param if (isset($module) and isset($function)) { switch ($module) { case 'area': $area = new Area($this->appUri); if ($function == 'arealist') { $area->areaList(); } break; case 'agent': $agent = new Agent(); if ($function == 'agentlistbyarea' and !empty($param)) { $agent->agentListByArea($param); } break; default: $data = ["status" => 500, "message" => "Invalid Request"]; header('Content-Type: application/json'); echo json_encode($data); break; } } else { $data = ["status" => 500, "message" => "Invalid Request"]; header('Content-Type: application/json'); echo json_encode($data); } }
public function logout() { if (Session::has('process_id')) { $process = ProcessModel::find(Session::get('process_id')); $process->end_time = date('H:i:s'); $process->save(); Session::forget('process_id'); } $agent = AgentModel::find(Session::get('agent_id')); $agent->is_active = false; $agent->save(); Session::forget('agent_id'); return Redirect::route('agent.auth.login'); }
public function processUnregistration() { $dom = $this->xmlDom; $headerNode = $dom->getElementsByTagName('SIF_Header')->item(0); $originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue; $originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue; $originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue; $validSourceId = Agent::checkSourceId($originalSourceId); if (!$validSourceId) { RegisterError::invalidSourceId($agent->sourceId, $originalMsgId); } else { $agent = new Agent($originalSourceId); if ($agent->isRegistered()) { if ($agent->unRegister()) { XmlHelper::buildSuccessMessage(Utility::createMessageId(), Utility::createTimestamp(), $agent->sourceId, $originalMsgId, 0); } else { RegisterError::genericError($agent->sourceId, $originalMsgId); } } else { RegisterError::notRegisteredError($originalSourceId, $originalMsgId); } } }
public function before() { if (Agent::is_mobiledevice()) { \Response::redirect('mobile/index.html'); } parent::before(); foreach (\Auth::verified() as $driver) { if (($id = $driver->get_user_id()) !== false) { $this->current_user = Model\Auth_User::find($id[1]); } break; } // Set a global variable so views can use it View::set_global('current_user', $this->current_user); }