/** * Displays the login page */ public function actionLogin() { if (Yii::app()->user->isGuest) { $model = new UserLogin(); // collect user input data if (isset($_POST['UserLogin'])) { $model->attributes = $_POST['UserLogin']; // validate user input and redirect to previous page if valid if ($model->validate()) { $this->lastViset(); //LOG THE uSER $userRequestOjb = new UserRequest(); $userRequestOjb->user_agent = @$_SERVER['HTTP_USER_AGENT']; $userRequestOjb->ip_address = @$_SERVER['REMOTE_ADDR']; $userRequestOjb->url_refferer = @Yii::app()->user->returnUrl; $userRequestOjb->save(); //END OF USER LOG if (Yii::app()->user->returnUrl == '/index.php') { $this->redirect(Yii::app()->controller->module->returnUrl); } else { $this->redirect(Yii::app()->user->returnUrl); } } } // display the login form $this->render('/user/login', array('model' => $model)); } else { $this->redirect(Yii::app()->controller->module->returnUrl); } }
/** * Handle a registration request for the application. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function postRegister(UserRequest $request) { $validator = $this->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } Auth::login($this->create($request->all())); return redirect($this->redirectPath()); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(UserRequest $request) { $input = $request->all(); $article = Article::create(['title' => $input['title'], 'body' => $input['body'], 'excerpt' => $input['excerpt']]); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($user); } flash()->success('salvato con successo!'); return redirect('articles'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(UserRequest $request, Article $article) { $input = $request->all(); $article->update(['title' => $input['titolo'], 'text' => $input['Descrizione']]); if ($request->ajax() || $request->wantsJson()) { return new JsonResponse($user); } flash()->success('aggiornato con successo!'); return redirect('article'); }
protected function PerformTest() { // Create the site object $superuser = API::Site('superuser'); // Use the /me route (we have a user request returned) $request = $superuser->Me('dummyvalue'); $this->CompareOutput($request->URL(), 'https://api.stackexchange.com/2.0/me?filter=' . urlencode(Filter::$default_filter) . '&key=' . urlencode(API::$key) . '&site=superuser&access_token=dummyvalue'); // Get the user's inbox $request = $request->Inbox(); $this->CompareOutput($request->URL(), 'https://api.stackexchange.com/2.0/me/inbox?filter=' . urlencode(Filter::$default_filter) . '&key=' . urlencode(API::$key) . '&site=superuser&access_token=dummyvalue'); // Create a user request for user number 1 $request = new UserRequest('serverfault'); $this->CompareOutput($request->URL(), 'http://api.stackexchange.com/2.0/users?filter=' . urlencode(Filter::$default_filter) . '&key=' . urlencode(API::$key) . '&site=serverfault'); // Try /me/associated $request = $superuser->Me('access_token')->Associated(); $this->CompareOutput($request->URL(), 'https://api.stackexchange.com/2.0/me/associated?filter=' . urlencode(Filter::$default_filter) . '&key=' . urlencode(API::$key) . '&site=superuser&access_token=access_token'); }
public function parseRequest() { $return = []; $return['params'] = UserRequest::get('params', 'array', []); $item = UserRequest::get('modelName', 'string', ''); if (!$item) { $item = UserRequest::get('item', 'string', ''); } if (strpos($item, ':')) { $raw = explode(':', $item); $return['modelName'] = $raw[0]; $return['model'] = $return['modelName']::get($raw[1], $return['modelName']::index(), $return['params']); } else { $return['modelName'] = $item; $return['model'] = null; } if (!empty($return['params']['relation'])) { $relation = $return['modelName']::getRelation($return['params']['relation']); if (!empty($relation['type']) && $relation['type'] == 'relModel') { $return['modelName'] = $relation['relModel']; } else { $return['modelName'] = $relation['model']; } } $return['params']['filters'] = UserRequest::get('filters', 'array', []); $return['params']['sortered'] = UserRequest::get('sortered', 'array', []); $return['params']['mode'] = UserRequest::get('mode', 'string', ''); $return['params']['all'] = UserRequest::get('all', 'bool', false); $return['key'] = UserRequest::get('key', 'int', 0); $return['col'] = UserRequest::get('col', 'string', ''); $return['col_value'] = UserRequest::get('col_value', 'string', ''); $return['action'] = UserRequest::get('action', 'string', ''); $return['ids'] = trim(UserRequest::get('ids', 'string', ''), ','); $return['adInfo'] = UserRequest::get('adInfo', 'array', []); $return['download'] = UserRequest::get('download', 'bool', false); $return['silence'] = UserRequest::get('silence', 'bool', false); $return['managerName'] = UserRequest::get('managerName', 'string', 'manager'); if (!$return['managerName']) { $return['managerName'] = 'manager'; } return $return; }
/** * \param $id either a user ID or an array of user IDs * \return a UserRequest object * * This method is used for retrieving users and data from those users on * the site. Other data, such as questions and answers from the user(s) can * be retrieved by chaining method calls and then calling Exec() to make the * request. * * <b>Example:</b> <kbd>$response = $site->Users(12)->Questions()->Unanswered()->Exec();</kbd> */ public function Users($id = null) { $request = new UserRequest($this->api_domain); // Add the IDs if supplied if ($id !== null) { $request->ID($id); } return $request; }
delete </a> </td> </tr> </tbody> </table> <hr> <button ng-hide="true" ng-disabled="globalUpdateText === 'Updating data...' || globalUpdateText === 'Loading data...' " ng-cloak type="button" class="btn btn-default" ng-click="indexCtrl.globalUpdate()"> <i class="fa fa-spinner fa-spin" ng-show="globalUpdateText === 'Updating data...' || globalUpdateText === 'Loading data...' "></i> {{globalUpdateText}} {{updateDataReport}} </button> </div> </div> <br> <?php $this->beginWidget('zii.widgets.CPortlet', array('title' => 'Recent Logins')); $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => UserRequest::model()->getRecentLogins(), 'template' => "{summary}\n{items}\n{pager}", 'columns' => array(array('name' => 'ip_address', 'header' => 'IP Address', 'type' => 'raw', 'value' => '$data->ip_address'), array('header' => 'Location', 'type' => 'raw', 'value' => '$data->getFlagImageLabel()'), array('name' => 'date_created', 'header' => 'Last access', 'type' => 'raw', 'value' => 'date("F j, Y, g:i a",strtotime("$data->date_created"))')))); $this->endWidget(); ?> <div class="clearfix"></div> <hr> <br> <br> <br> <br> <br>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return UserRequest the loaded model * @throws CHttpException */ public function loadModel($id) { $model = UserRequest::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Create a User Request ticket from the basic information retrieved from an email * @param string $sSenderEmail eMail address of the sender (From), used to lookup a contact in iTop * @param string $sSubject eMail's subject, will be turned into the title of the ticket * @param string $sBody Body of the email, will be fitted into the ticket's description * @return UserRequest The created ticket, or null if the creation failed for some reason... */ function CreateTicket($sSenderEmail, $sSubject, $sBody) { $oTicket = null; try { $oContactSearch = new DBObjectSearch('Contact'); // Can be either a Person or a Team, but must be a valid Contact $oContactSearch->AddCondition('email', $sSenderEmail, '='); $oSet = new DBObjectSet($oContactSearch); if ($oSet->Count() == 1) { $oContact = $oSet->Fetch(); $oOrganization = MetaModel::GetObject('Organization', $oContact->Get('org_id')); $oTicket = new UserRequest(); $oTicket->Set('title', $sSubject); $oTicket->Set('description', $sBody); $oTicket->Set('org_id', $oOrganization->GetKey()); $oTicket->Set('caller_id', $oContact->GetKey()); $oTicket->Set('impact', DEFAULT_IMPACT); $oTicket->Set('urgency', DEFAULT_URGENCY); $oTicket->Set('product', DEFAULT_PRODUCT); $oTicket->Set('service_id', DEFAULT_SERVICE_ID); // Can be replaced by a search for a valid service for this 'org_id' $oTicket->Set('servicesubcategory_id', DEFAULT_SUBSERVICE_ID); // Same as above... $oTicket->Set('workgroup_id', DEFAULT_WORKGROUP_ID); // Same as above... // Record the change information about the object $oMyChange = MetaModel::NewObject("CMDBChange"); $oMyChange->Set("date", time()); $sUserString = $oContact->GetName() . ', submitted by email'; $oMyChange->Set("userinfo", $sUserString); $iChangeId = $oMyChange->DBInsert(); $oTicket->DBInsertTracked($oMyChange); } else { echo "No contact found in iTop having the email: {$sSenderEmail}, email message ignored.\n"; } } catch (Exception $e) { echo "Error: exception " . $e->getMessage(); $oTicket = null; } return $oTicket; }