PHP Method User::find, codiad Code Examples

This page contains top rated real world PHP examples of method User::find from package codiad extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: FacebookRegistrationComponent.php Project: slachiewicz/_mojePanstwo-API-Server
0
 public function register()
 {
     $this->user = $this->Users->find('first', array('conditions' => array('User.email' => $this->facebookUser['email'])));
     if (!$this->user) {
         $this->createNewUser();
     } else {
         if ($this->user['User']['facebook_id'] != $this->facebookUser['id']) {
             $this->setFacebookId();
         }
     }
     $this->updatePhoto();
     $this->updateLoggedAt();
 }
Example #2
Show file File: ILSAuthentication.php Project: victorfcm/VuFind-Plus
0
 private function processILSUser($info)
 {
     require_once ROOT_DIR . "/services/MyResearch/lib/User.php";
     $user = new User();
     //Marmot make sure we are using the username which is the
     //unique patron ID in Millennium.
     $user->username = $info['username'];
     if ($user->find(true)) {
         $insert = false;
     } else {
         //Do one more check based on the patron barcode in case we are converting
         //Clear username temporarily
         $user->username = null;
         global $configArray;
         $barcodeProperty = $configArray['Catalog']['barcodeProperty'];
         $user->{$barcodeProperty} = $info[$barcodeProperty];
         if ($user->find(true)) {
             $insert = false;
         } else {
             $insert = true;
         }
         //Restore username
         $user->username = $info['username'];
     }
     $user->password = $info['cat_password'];
     $user->firstname = $info['firstname'] == null ? " " : $info['firstname'];
     $user->lastname = $info['lastname'] == null ? " " : $info['lastname'];
     $user->cat_username = $info['cat_username'] == null ? " " : $info['cat_username'];
     $user->cat_password = $info['cat_password'] == null ? " " : $info['cat_password'];
     $user->email = $info['email'] == null ? " " : $info['email'];
     $user->major = $info['major'] == null ? " " : $info['major'];
     $user->college = $info['college'] == null ? " " : $info['college'];
     $user->patronType = $info['patronType'] == null ? " " : $info['patronType'];
     $user->web_note = $info['web_note'] == null ? " " : $info['web_note'];
     if (empty($user->displayName)) {
         if (strlen($user->firstname) >= 1) {
             $user->displayName = substr($user->firstname, 0, 1) . '. ' . $user->lastname;
         } else {
             $user->displayName = $user->lastname;
         }
     }
     if ($insert) {
         $user->created = date('Y-m-d');
         $user->insert();
     } else {
         $user->update();
     }
     return $user;
 }
Example #3
Show file File: lost_password.controller.php Project: ItsHaden/epicLanBootstrap
0
 public function index()
 {
     $email = "";
     if ($this->post and !$this->csrf) {
         global $site;
         $site['flash']['error'] = "Invalid form submission";
     } elseif ($this->post) {
         $email = mysql_real_escape_string($_POST['email']);
         $user = User::find("users.email = '{$email}' AND users.suspended = 0 AND users.activated = 1", null, false, 1);
         if ($user) {
             // Disable any active lost password requests
             $lost_passwords = $user->get_lost_passwords();
             if (count($lost_passwords) > 0) {
                 foreach ($lost_passwords as $lost_password) {
                     $lost_password->used = true;
                     $lost_password->save();
                 }
             }
             // Make a new lost password request
             $lost_password = new LostPassword($user);
             if ($lost_password->save()) {
                 Email::send_lost_password($lost_password);
                 Site::flash("notice", "Instructions on how to reset your password have been sent to {$user->email}");
                 Redirect("resetpassword");
             } else {
                 $this->site['flash']['error'] = "Unable to send password reset instructions";
             }
         } else {
             $this->site['flash']['error'] = "Unable to find a user with that email address";
         }
     }
     $this->assign("email", $email);
     $this->title = "Lost Password";
     $this->render("lost_password/index.tpl");
 }
Example #4
Show file File: LotControllerTest.php Project: BaobabHealthTrust/iBLIS
0
 /**
  * Contains the testing sample data for the LotController.
  *
  * @return void
  */
 private function setVariables()
 {
     //Setting the current user
     $this->be(User::find(4));
     $this->input = array('number' => '2015', 'description' => 'kenya yao', 'expiry' => '12-12-2015', 'instrument' => 1);
     $this->inputUpdate = array('number' => '2015', 'description' => 'Kenya yetu', 'expiry' => '12-05-2020', 'instrument' => 2);
 }
Example #5
Show file File: settingsController.php Project: hrshadhin/school-management-system
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function save()
 {
     $rules = ['firstname' => 'required', 'lastname' => 'required', 'login' => 'required', 'address' => 'required', 'cpassword' => 'required', 'npassword' => 'required', 'cnpassword' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/settings')->withinput(Input::all())->withErrors($validator);
     } else {
         if (Input::get('npassword') == Input::get('cnpassword')) {
             // $u = User::select('*')->where('password',Hash::make(Input::get('cpassword')))->first();
             //return Hash::make(Input::get('cpassword'));
             //if(count($u)>0) {
             $user = User::find(Input::get('id'));
             $user->firstname = Input::get('firstname');
             $user->lastname = Input::get('lastname');
             //  $user->login = Input::get('login');
             $user->address = Input::get('address');
             // $user->email = Input::get('email');
             $user->password = Hash::make(Input::get('npassword'));
             $user->save();
             return Redirect::to('/settings')->with('success', 'Settings is changed please relogin the site.');
             /*}
               else
               {
                   $errorMessages = new Illuminate\Support\MessageBag;
                   $errorMessages->add('notmatch', 'Current Password did not match!');
                   return Redirect::to('/settings')->withErrors($errorMessages);
               }*/
         } else {
             $errorMessages = new Illuminate\Support\MessageBag();
             $errorMessages->add('notmatch', 'New Password and confirm password did not match!');
             return Redirect::to('/settings')->withErrors($errorMessages);
         }
     }
 }
Example #6
Show file File: PrivacyHelper.php Project: sh1nu11bi/CloMa
0
 public static function checkPermission($user, $post)
 {
     if ($post->deleted_at) {
         return false;
     }
     $friend = User::find($post->created_by);
     if (Auth::check()) {
         if ($post->created_by != $user->id) {
             switch ($post->privacy_level) {
                 case Post::_PRIVATE:
                     return false;
                     break;
                 case Post::_FRIEND:
                     $can_see = $user->friendship($friend);
                     if ($can_see == Friend::STRANGER) {
                         return false;
                     }
                     break;
                 case Post::_CUSTOM:
                     $can_see = DB::table('friend_post')->where('post_id', $post->id)->where('friend_id', Auth::user()->id)->first();
                     if (is_null($can_see)) {
                         return false;
                     }
                     break;
                 case Post::_PUBLIC:
                 default:
                     break;
             }
         }
     } else {
         return $post->privacy_level == Post::_PUBLIC;
     }
     return true;
 }
Example #7
Show file File: AuthController.php Project: T-SummerStudent/new
0
 function validate()
 {
     if (!Session::has('vatsimauth')) {
         throw new AuthException('Session does not exist');
     }
     $SSO = new SSO(Config::get('vatsim.base'), Config::get('vatsim.key'), Config::get('vatsim.secret'), Config::get('vatsim.method'), Config::get('vatsim.cert'));
     $session = Session::get('vatsimauth');
     if (Input::get('oauth_token') !== $session['key']) {
         throw new AuthException('Returned token does not match');
         return;
     }
     if (!Input::has('oauth_verifier')) {
         throw new AuthException('No verification code provided');
     }
     $user = $SSO->checkLogin($session['key'], $session['secret'], Input::get('oauth_verifier'));
     if ($user) {
         Session::forget('vatsimauth');
         $authUser = User::find($user->user->id);
         if (is_null($authUser)) {
             $authUser = new User();
             $authUser->vatsim_id = $user->user->id;
             $authUser->name = trim($user->user->name_first . ' ' . $user->user->name_last);
         }
         $authUser->last_login = Carbon::now();
         $authUser->save();
         Auth::login($authUser);
         Messages::success('Welcome on board, <strong>' . $authUser->name . '</strong>!');
         return Redirect::intended('/');
     } else {
         $error = $SSO->error();
         throw new AuthException($error['message']);
     }
 }
Example #8
Show file File: ReporteCNController.php Project: ktakayama91/GTSlaravel
0
 public function render_create_reporte_cn($id = null)
 {
     if (Auth::check()) {
         $data["inside_url"] = Config::get('app.inside_url');
         $data["user"] = Session::get('user');
         // Verifico si el usuario es un Webmaster
         if ($data["user"]->idrol == 1 || $data["user"]->idrol == 2 || $data["user"]->idrol == 3 || $data["user"]->idrol == 4) {
             $data["areas"] = Area::lists('nombre', 'idarea');
             $data["servicios"] = Servicio::lists('nombre', 'idservicio');
             $data["tipo_reporte_cn"] = TipoReporteCN::lists('nombre', 'idtipo_reporte_CN');
             $data["programaciones_reporte_cn"] = ProgramacionReporteCN::where('idestado_programacion_reportes', 1)->where('iduser', $data["user"]->id)->orwhere('idestado_programacion_reportes', 3)->lists('nombre_reporte', 'idprogramacion_reporte_cn');
             $data["programacion_reporte_cn_id"] = $id;
             $data["programacion_reporte_cn"] = null;
             $data["responsable"] = null;
             if ($id) {
                 $data["programacion_reporte_cn"] = ProgramacionReporteCN::where('idprogramacion_reporte_cn', '=', $id)->get()[0];
                 $data["responsable"] = User::find($data["programacion_reporte_cn"]->iduser);
             }
             $data["reporte_cn_info"] = null;
             return View::make('reportes_CN/createReportesCN', $data);
         } else {
             return View::make('error/error', $data);
         }
     } else {
         return View::make('error/error', $data);
     }
 }
Example #9
Show file File: UsersTask.php Project: stecman/passnote
0
 /**
  * List all users
  */
 public function listAction()
 {
     $users = User::find();
     foreach ($users as $user) {
         echo "{$user->email}\n";
     }
 }
Example #10
Show file File: UsersController.php Project: romulobonifacio/blog-posts
0
    /**
     * Exibe o form para edição de usuário.
     *
     * Exibe o form para editar o usuário a partir do ID passado pela URL
     * Se o usuário não existir é exibo uma mensagem de erro e não apresentamos
     * o form.
     *
     * @return void|false
     */
    public function editAction()
    {
        $id      = (int) $this->_getParam('id');
        $result  = $this->_model->find($id);
        $data    = $result->current();

        if ( null === $data )
        {
            $this->view->message = "Usu&aacute;rio n&atilde;o encontrado!";
            return false;
        }

        $form = new Application_Form_User();
        $form->setAsEditForm($data);

        if ( $this->_request->isPost() )
        {
            $data = array(
                'name'  => $this->_request->getPost('name'),
                'email' => $this->_request->getPost('email')
            );

            if ( $form->isValid($data) )
            {
                $this->_model->update($data, "id = $id");
                $this->_redirect('/users');
            }
        }

        $this->view->form = $form; 
    }
Example #11
Show file File: HomeController.php Project: armandolazarte/cartera
0
 public function getShowWelcome()
 {
     $user = User::find(1);
     $user->password = Hash::make('123');
     $user->save();
     return View::make('hello');
 }
Example #12
Show file File: UserController.php Project: nvizero/beautifulbuild
0
 public function edit($id)
 {
     $data["_title"] = array("top" => "編輯使用者", "main" => "Home", "sub" => "user");
     $data["active"] = "users";
     $data["user"] = User::find($id);
     return View::make('admin.users.edit', $data);
 }
Example #13
Show file File: EwayController.php Project: Roc4rdho/app
0
 /**
  * Make a EWAY payment to the destined user from the main business account.
  *
  * @return void
  */
 protected function makePayment()
 {
     $receiver = Input::get('number');
     $amounttosend = Input::get('amount');
     $currency = Input::get('currency');
     $destinationProvider = Input::get('target');
     $charges = new PlatformCharges($amounttosend, $currency, $destinationProvider);
     $desc = $charges->getReceiverType($destinationProvider);
     $user = User::find(Auth::user()->id);
     $transaction = ['Customer' => ['FirstName' => Auth::user()->name, 'Street1' => 'Level 5', 'Country' => 'US', 'Mobile' => Auth::user()->number, 'Email' => Auth::user()->email], 'Items' => [['SKU' => mt_rand(), 'Description' => 'Hybrid Transfer from EWAY to ' . $desc . ' user', 'Quantity' => 1, 'UnitCost' => $charges->convertCurrency($currency, 'AUD', $charges->getDueAmount('ew', $destinationProvider)), 'Tax' => 100]], 'Options' => [['Value' => $desc], ['Value' => $receiver], ['Value' => 'AUD'], ['Value' => 0.01 * $amounttosend]], 'Payment' => ['TotalAmount' => $charges->convertCurrency($currency, 'AUD', $charges->getDueAmount('ew', $destinationProvider)) * 100, 'CurrencyCode' => 'AUD'], 'Method' => 'ProcessPayment', 'RedirectUrl' => URL::route('dashboard') . '/ewayconfirm', 'CancelUrl' => URL::route('dashboard') . '/ewaycancel', 'PartnerID' => EwayController::$_EWAY_CUSTOMER_ID, 'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE, 'Capture' => true, 'LogoUrl' => 'https://izepay.iceteck.com/public/images/logo.png', 'HeaderText' => 'Izepay Money Transfer', 'Language' => 'EN', 'CustomView' => 'BootstrapCerulean', 'VerifyCustomerEmail' => true, 'Capture' => true, 'CustomerReadOnly' => false];
     try {
         $response = $this->client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);
         //var_dump($response);
         //                echo $response->SharedPaymentUrl;
         //sleep(20);
     } catch (Exception $ex) {
         return Redirect::route('dashboard')->with('alertError', 'Debug Error: ' . $ex->getMessage());
     }
     //manage response
     if (!$response->getErrors()) {
         // Redirect to the Responsive Shared Page
         header('Location: ' . $response->SharedPaymentUrl);
         //die();
     } else {
         foreach ($response->getErrors() as $error) {
             //echo "Response Error: ".\Eway\Rapid::getMessage($error)."<br>";
             return Redirect::route('dashboard')->with('alertError', 'Error! ' . \Eway\Rapid::getMessage($error));
         }
     }
 }
Example #14
Show file File: fleximport_semiro_participant_import.php Project: Krassmus/Fleximport
0
 public function checkLine($line)
 {
     $errors = "";
     if (!FleximportTable::findOneByName("fleximport_semiro_course_import")) {
         return "Tabelle fleximport_semiro_course_import existiert nicht. ";
     }
     $dilp_kennung_feld = FleximportConfig::get("SEMIRO_DILP_KENNUNG_FIELD");
     if (!$dilp_kennung_feld) {
         $dilp_kennung_feld = "dilp_teilnehmer";
     }
     if (!$line[$dilp_kennung_feld]) {
         $errors .= "Teilnehmer hat keinen Wert für '{$dilp_kennung_feld}''. ";
     } else {
         $datafield = Datafield::findOneByName(FleximportConfig::get("SEMIRO_USER_DATAFIELD_NAME"));
         if (!$datafield) {
             $errors .= "System hat kein Datenfeld " . FleximportConfig::get("SEMIRO_USER_DATAFIELD_NAME") . ", womit die Nutzer identifiziert werden. ";
         } else {
             $entry = DatafieldEntryModel::findOneBySQL("datafield_id = ? AND content = ? ", array($datafield->getId(), $line[$dilp_kennung_feld]));
             if (!$entry || !User::find($entry['range_id'])) {
                 $errors .= "Nutzer konnte nicht durch id_teilnehmer identifiziert werden. ";
             }
         }
     }
     if (!$line['teilnehmergruppe']) {
         $errors .= "Keine Teilnehmergruppe. ";
     } else {
         $statement = DBManager::get()->prepare("\n                SELECT 1\n                FROM fleximport_semiro_course_import\n                WHERE teilnehmergruppe = ?\n            ");
         $statement->execute(array($line['teilnehmergruppe']));
         if (!$statement->fetch()) {
             $errors .= "Nicht verwendete Teilnehmergruppe. ";
         }
     }
     return $errors;
 }
Example #15
Show file File: ProfileModel.php Project: ratbird/hope
0
 /**
  * Get informations on depending selected user
  * @param String $current_user
  * @param String $user
  */
 function __construct($current_user, $user)
 {
     $this->current_user = User::find($current_user);
     $this->user = User::find($user);
     $this->visibilities = $this->getHomepageVisibilities();
     $this->perm = $GLOBALS['perm'];
 }
Example #16
Show file File: Contact.php Project: arbuuuud/gnt-aops
0
 public function insertPoolingSchedule($contact_id, $member_id, $template_id)
 {
     $contactTarget = Contact::find($contact_id);
     $memberTarget = User::find($member_id);
     $templateTarget = EmailTemplate::where('sequence', $template_id)->first();
     // return $templateTarget->id;
     if (!$contactTarget || !$memberTarget || !$templateTarget) {
         return null;
     }
     $stag = new EmailSchedullerPool();
     $stag->contact_id = $contact_id;
     $stag->member_id = $member_id;
     $stag->template_id = $template_id;
     // $configurationMember = MemberConfiguration::where('member_id',$member_id)->where('param_code',MemberConfiguration::FOLLOW_UP_SEQUENCE)->first();
     // if(!$configurationMember){
     //       	return null ;
     // }
     // $followUpSequence = $configurationMember->param_value;
     $followUpSequence = Sysparam::getValue('conf_follow_up_date');
     $stag->execution_date = date('Y-m-d H:i:s', strtotime("+" . $followUpSequence . " day"));
     $emailSchedullerPool = EmailSchedullerPool::where('member_id', $member_id)->where('contact_id', $contact_id)->where('template_id', $template_id)->first();
     if ($emailSchedullerPool) {
         //save history
         $this->saveHistory("canceled", $emailSchedullerPool->member_id, $emailSchedullerPool->template_id);
         //delete pool
         $emailSchedullerPool->delete();
     }
     //add entry
     if ($contactTarget->active && $memberTarget->active) {
         $stag->save();
         return $stag->toJson();
     } else {
         return null;
     }
 }
Example #17
Show file File: OrderController.php Project: emrys96/sizzle-pizza
0
 public function getUserOrders()
 {
     //
     $user = User::find(Auth::user()->id);
     $orders = DB::table('orders')->where('user_id', '=', $user->id)->orderBy('created_at', 'desc')->paginate(10);
     return View::make('users.userOrders')->with('orders', $orders);
 }
Example #18
Show file File: users.php Project: victoroliveira1605/Laravel-Bootstrap
0
 public function post_edit()
 {
     $rules = array('id' => 'required|exists:users', 'username' => 'required|max:255', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'email' => 'required|email');
     $validation = Validator::make(Input::all(), $rules);
     if ($validation->fails()) {
         Messages::add('error', $validation->errors->all());
         return Redirect::to('admin/' . $this->views . '/edit')->with_input();
     } else {
         $usr = User::find(Input::get('id'));
         $usr->username = Input::get('username');
         $usr->email = Input::get('email');
         $usr->first_name = Input::get('first_name');
         $usr->last_name = Input::get('last_name');
         $usr->admin = Input::get('admin') ? 1 : 0;
         $usr->active = 1;
         if (Input::get('password')) {
             $usr->password = Input::get('password');
         }
         $usr->roles()->delete();
         if (Input::get('roles')) {
             foreach (Input::get('roles') as $rolekey => $val) {
                 $usr->roles()->attach($rolekey);
             }
         }
         $usr->save();
         Messages::add('success', 'User updated');
         return Redirect::to('admin/' . $this->views . '');
     }
 }
Example #19
Show file File: RegisterController.php Project: shankargiri/taylor_latest
0
 public function update($id)
 {
     $name = User::find($id);
     $name->is_admin = Input::get('is_admin') ? Input::get('is_admin') : 0;
     $name->save();
     return Redirect::to('/users');
 }
Example #20
Show file File: BaseTest.php Project: GoatEli/TechnicSolder
0
 public function testDashboard()
 {
     $user = User::find(1);
     $this->be($user);
     $this->call('GET', '/dashboard');
     $this->assertResponseOk();
 }
Example #21
Show file File: Control.php Project: Max201/nanocore
0
 public function pages_list($request)
 {
     // Delete page
     if ($request->get('delete')) {
         $page = \Page::find_by_id(intval($request->get('delete')));
         if ($page && $page->delete()) {
             $this->view->assign('message', $this->lang->translate('form.deleted'));
         }
     }
     // Filter
     $filter = [];
     if ($request->get('author')) {
         $author = \User::find($request->get('author'));
         if ($author) {
             $filter['conditions'] = ['author_id = ?', $author->id];
         }
     }
     $filter['order'] = 'id DESC';
     if ($request->order) {
         $filter['order'] = $request->order;
     }
     /** @var Listing $paginator */
     $paginator = NCService::load('Paginator.Listing', [$request->page, \Page::count('all')]);
     $filter = array_merge($filter, $paginator->limit());
     // Filter users
     $pages = \Page::all($filter);
     $pages = array_map(function ($i) {
         return $i->to_array();
     }, $pages);
     return $this->view->render('pages/list.twig', ['title' => $this->lang->translate('page.list'), 'pages_list' => $pages, 'listing' => $paginator->pages(), 'page' => $paginator->cur_page]);
 }
Example #22
Show file File: EmergencyController.php Project: qnck/qingnianchuangke
0
 public function sendOrders()
 {
     set_time_limit(60000);
     try {
         $user = User::find(5);
         if ($user->u_priase_count == 0) {
             throw new Exception("已经执行过了", 30001);
         } else {
             $user->u_priase_count = 0;
             $user->save();
         }
         $str_text = '恭喜“双11不怕剁手”众筹活动已成功,您被众筹发起者选中,请于12日18时前凭此信息到零栋铺子领取众筹回报。4006680550';
         $str_push = '恭喜“双11不怕剁手”众筹活动已成功,您被众筹发起者选中,请于12日18时前凭此信息到零栋铺子领取众筹回报。4006680550';
         $orders = Order::selectRaw('right(`t_orders`.`o_number`, 4) AS seed, `t_orders`.*')->join('carts', function ($q) {
             $q->on('orders.o_id', '=', 'carts.o_id');
         })->where('carts.c_type', '=', 2)->where('carts.p_id', '=', 4)->orderBy('seed', 'DESC')->limit(111)->get();
         foreach ($orders as $key => $order) {
             if (empty($order)) {
                 continue;
             }
             $phones = $order->o_shipping_phone;
             $pushObj = new PushMessage($order->u_id);
             $pushObj->pushMessage($str_push);
             echo 'pushed to ' . $order->u_id . ' </br>';
             $phoneObj = new Phone($order->o_shipping_phone);
             $phoneObj->sendText($str_text);
             echo 'texted to ' . $order->o_shipping_phone . ' </br>';
         }
         File::put('/var/www/qingnianchuangke/phones', implode(',', $phones));
         $re = Tools::reTrue('发送中奖信息成功');
     } catch (Exception $e) {
         $re = Tools::reFalse($e->getCode(), '发送中奖信息失败:' . $e->getMessage());
     }
     return Response::json($re);
 }
Example #23
Show file File: FileMaintenanceController.php Project: jhunel2389/baeyaya-dev
0
 public function getEditInfo()
 {
     $id = Input::get('id');
     $allReserve = UserInfo::where('user_id', '=', $id)->first();
     $userInfo = User::find($id);
     return $response[] = array("reserve_id" => $allReserve['id'], "fname" => $allReserve['firstname'], "lname" => $allReserve['lastname'], "mname" => $allReserve['middleInitial'], "address" => $allReserve['address'], "contact" => $allReserve['contactNo'], "email" => $allReserve['email'], "isAdmin" => $userInfo['isAdmin']);
 }
Example #24
Show file File: UpdateUser.php Project: ankitbhatia870/ankit_test
0
 public function UpdateUserInfo($job, $data)
 {
     if ($job->attempts() > 3) {
         $job->delete();
     }
     $user_id = $data['id'];
     $user_data = User::find($user_id);
     $token = $user_data->token;
     $InsConnection = KarmaHelper::insertUserConnection($user_data);
     $updateMeetingRequest = KarmaHelper::updateRequestAndKarmaNote($user_data);
     $user = User::find($user_id);
     $tos = $user->termsofuse;
     $userstatus = $user->userstatus;
     if ($tos == 1 && $userstatus == 'ready for approval') {
         $user->userstatus = 'ready for approval';
         $user->save();
     }
     if ($tos == 0) {
         $user->userstatus = 'TOS not accepted';
         $user->save();
     }
     if ($tos == 1 && $userstatus == 'approved') {
         $user->userstatus = 'approved';
         $user->save();
     }
     if ($userstatus == 'hidden') {
         $user->userstatus = 'hidden';
         $user->save();
     }
     $job->delete();
 }
Example #25
Show file File: Administrators.php Project: bryandease/VuFind-Plus
0
 function processNewAdministrator()
 {
     global $interface;
     global $configArray;
     $login = $_REQUEST['login'];
     $newAdmin = new User();
     $barcodeProperty = $configArray['Catalog']['barcodeProperty'];
     $newAdmin->{$barcodeProperty} = $login;
     $newAdmin->find();
     if ($newAdmin->N == 1) {
         global $logger;
         $logger->log(print_r($_REQUEST['roles'], TRUE));
         if (isset($_REQUEST['roles'])) {
             $newAdmin->fetch();
             $newAdmin->roles = $_REQUEST['roles'];
             $newAdmin->update();
         } else {
             $newAdmin->fetch();
             $newAdmin->query('DELETE FROM user_roles where user_roles.userId = ' . $newAdmin->id);
         }
         global $configArray;
         header("Location: {$configArray['Site']['path']}/Admin/{$this->getToolName()}");
         die;
     } else {
         $interface->assign('error', 'Could not find a user with that barcode.');
         $interface->setTemplate('addAdministrator.tpl');
     }
 }
Example #26
Show file File: AuthController.php Project: andrewchng/cSystem
0
 public function get()
 {
     $user_id = false;
     if (Auth::check()) {
         // Authenticating A User And "Remembering" Them
         Session::regenerate();
         $user_id = Auth::user()->id;
         if (Auth::user()->accountType == 1) {
             if (Session::has('admin_session')) {
                 Log::info("admin_session already created before - " . Session::get('admin_session'));
             } else {
                 Session::put('admin_session', $user_id);
                 Log::info("admin_session created");
             }
         }
         //            Log::info("Session cre8 - " . Session::get('admin_session'));
     }
     //        else if (Auth::viaRemember()) {
     //            // Determining If User Authed Via Remember
     //            $user_id = Auth::user()->id;
     //        }
     if (!$user_id) {
         $error_response = array('error' => array('message' => 'User not logged in.', 'type' => 'OAuthException', 'code' => 400));
         Log::info("User not logged in");
         return Response::json($error_response, 400)->setCallback(Input::get('callback'));
     }
     $user = User::find(Auth::user()->id);
     return Response::json($user)->setCallback(Input::get('callback'));
 }
Example #27
Show file File: HttpController.php Project: eufelipemartins/edlara
0
 public function assessmentupdateget($dash, $id)
 {
     $assessment = Assessments::find($id);
     $user = User::find($assessment->teacherid);
     if (Sentry::getUser()->id == $user->id) {
         $theme = Theme::uses('dashboard')->layout('default');
         $view = array('name' => 'Dashboard Assessment Update', 'id' => $id);
         $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Assessments', 'url' => Setting::get('system.dashurl') . '/assessments'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/assessment/' . $id]]);
         $theme->appendTitle(' - Assessment Update');
         $theme->asset()->container('datatable')->writeScript('inline-script', '$(document).ready(function(){
             $(\'#attachments\').dataTable({
                 "sDom": "<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'l><\'col-xs-5 col-sm-5 col-md-5\'f>r>t<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'i><\'col-xs-5 col-sm-5 col-md-5\'p>>",
                     "oLanguage": {
                     "sLengthMenu": "_MENU_ ' . ' Attachments per page"
                     },
                     "sPagination":"bootstrap"
                
             });
         });$(document).ready(function(){
             $(\'#questionfail\').dataTable({
                 "sDom": "<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'l><\'col-xs-5 col-sm-5 col-md-5\'f>r>t<\'row\'<\'col-xs-5 col-sm-5 col-md-5\'i><\'col-xs-5 col-sm-5 col-md-5\'p>>",
                     "oLanguage": {
                     "sLengthMenu": "_MENU_ ' . ' Failures per page"
                     },
                     "sPagination":"bootstrap"
                
             });
         });');
         $theme->asset()->container('footer')->writeScript('inline-script', '$(document).ready(function(){
             $("#examsheader").hide();
             $("div#exams").hide();
             $("div#examslock").hide();
             $(".hidequestions").hide();
             $(".hidequestions").click(function(){
                 $("div#exams").hide(2000);
                  $(\'html, body\').animate({
                     scrollTop: $("#top").offset().top
                 }, 2000);
                 $("#examsheader").hide(1200);
                 $("#examslock").hide(1200);
                 $(".hidequestions").hide(1000);
                 $("#showquestions").show(1000);
             });
             $("#showquestions").click(function(){
                 $("div#exams").show(2000);
                 $("div#examslock").show(100);
                 $(\'html, body\').animate({
                     scrollTop: $("#examslock").offset().top
                 }, 2000);
                 $("#examsheader").show(1000);
                 $(".hidequestions").show(1000);
                 $("#showquestions").hide(1000);
             });
         });');
         return $theme->scope('assessment.update', $view)->render();
         // return View::make('dashboard.assessments.update')->with('id',$id);
     } else {
         return "UPDATE NOT AUTHORISED";
     }
 }
Example #28
Show file File: BuildTest.php Project: NorthPL/Solder-for-NorthLauncher
0
 public function setUp()
 {
     parent::setUp();
     Route::enableFilters();
     $user = User::find(1);
     $this->be($user);
 }
Example #29
Show file File: message.php Project: bencochran/yeti
0
 public function actionSend($name = null)
 {
     if (defined('DISABLE_MESSAGING') && DISABLE_MESSAGING) {
         throw new Lvc_Exception('Messaging disabled', 404);
     }
     $active_user = User::require_active_user();
     $this->setLayoutVar('active_user', $active_user);
     if (is_null($name)) {
         throw new Lvc_Exception('Null username on send action');
     }
     if ($user = User::find(array('name' => $name))) {
         if (!empty($this->post['submit'])) {
             $subject = $this->post['subject'];
             $body = $this->post['body'];
             $result = Message::send($user, $subject, $body, $active_user);
             if ($result['status']) {
                 Flash::set('success', $result['message']);
                 $this->redirect('/message/inbox');
                 die;
             } else {
                 Flash::set('failure', $result['message']);
             }
             $this->setVar('subject', $subject);
             $this->setVar('body', $body);
         }
         $this->setVar('to_user', $user);
     } else {
         throw new Lvc_Exception('User Not Found: ' . $name);
     }
 }
Example #30
Show file File: IndexController.php Project: stylenic/phalcon
0
 public function indexAction()
 {
     header("Content-type: text/html; charset=utf-8");
     //查询条件
     $condition = '';
     $data_count = User::count($condition);
     $page_num = 5;
     $current_page = (int) $_GET["page"];
     //分页处理
     $pagination = Tools::pagination($data_count, $page_num, $current_page);
     //分页条件
     $limit = array("limit" => array("number" => $page_num, "offset" => $pagination->offset));
     //获取数据
     $list = User::find($limit);
     //结果展示
     foreach ($list as $item) {
         echo $item->id . ':' . $item->name . '<br/>';
     }
     //数字分页展示
     for ($i = 1; $i <= $pagination->maxPage; $i++) {
         echo "<a href='?page={$i}'>{$i}</a> ";
     }
     //翻页展示
     echo "<a href='?page=1'>首页</a> ";
     echo "<a href='?page={$pagination->prePage}'>上一页</a> ";
     echo "<a href='?page={$pagination->nextPage}'>下一页</a> ";
     echo "<a href='?page={$pagination->maxPage}'>尾页</a> ";
     //TODO 当前页为首页或尾页时A标签的状态处理
     die;
 }