public function handle($request, Clousure $next)
 {
     if (userAuth::check()) {
         return redirect::route('wap.home');
     }
     return $next($request);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $data = array();
     $settings = Sitesetting::find(1);
     if ($request->isMethod('post')) {
         $validator = Validator::make($request->all(), ['site_name' => 'required', 'default_page_title' => 'required', 'default_meta_keywords' => 'required', 'default_meta_description' => 'required', 'contact_email' => 'required']);
         if ($validator->fails()) {
             return redirect::route('site_settings')->withErrors($validator);
         } else {
             $site_name = $request->site_name;
             $default_page_title = $request->default_page_title;
             $default_meta_keywords = $request->default_meta_keywords;
             $default_meta_description = $request->default_meta_description;
             $contact_email = $request->contact_email;
             $settings->site_name = $site_name;
             $settings->default_page_title = $default_page_title;
             $settings->default_meta_keywords = $default_meta_keywords;
             $settings->default_meta_description = $default_meta_description;
             $settings->contact_email = $contact_email;
             $settings->save();
             return redirect::route('site_settings')->with('success', 'Settings updated successfully.');
         }
     }
     $settings = Sitesetting::all()->first();
     $data['settings'] = $settings;
     return view('admin/sitesettings', $data);
 }
Exemple #3
0
 public function handle($request, Clousure $next)
 {
     $wapIsOpen = app::get('sysconf')->getConf('sysconf_setting.wap_isopen');
     if (base_mobiledetect::isMobile() && $_COOKIE['browse'] != 'pc' && $wapIsOpen) {
         return redirect::route('topm');
     }
     return $next($request);
 }
Exemple #4
0
 public function index($owner, $project, $commitishPath)
 {
     $repository = $project->getRepository();
     list($branch, $file) = $this->extractReference($repository, $commitishPath, $project->slug);
     $blob = $repository->getBlob("{$branch}:\"{$file}\"");
     $breadcrumbs = app('git_util')->getBreadcrumbs($file);
     $fileType = app('git_util')->getFileType($file);
     if ($fileType !== 'image' && app('git_util')->isBinary($file)) {
         return redirect::route('blob_raw', ['owner' => $owner, 'project' => $project, 'commitishPath' => $commitishPath]);
     }
     return View::make('projects/file')->withOwner($owner)->withProject($project)->withFile($file)->withFileType($fileType)->withBlob($blob->output())->withBranch($branch)->withBreadcrumbs($breadcrumbs)->withBranches($repository->getBranches())->withTags($repository->getTags());
 }
 public function sendFile(Request $request)
 {
     if ($request->hasFile('inputFile')) {
         $pathUplad = 'uploads';
         $fileExtension = $request->file('inputFile')->getClientOriginalExtension();
         $fileName = str_random(15) . '.' . $fileExtension;
         $request->file('inputFile')->move($pathUplad, $fileName);
         $this->savePurchases($this->parseFile($pathUplad, $fileName));
         return redirect::route('home')->with('alert', 'Dados salvos com sucesso!');
     } else {
         return redirect::route('home')->with('error', 'Nenhum dado foi enviado!');
     }
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     if ($request->isMethod('post')) {
         $validator = Validator::make($request->all(), ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email|unique:suppliers', 'password' => 'required']);
         if ($validator->fails()) {
             return redirect::route('add_supplier')->with('errmsg', [$validator->messages()->all()]);
         } else {
             $first_name = $request->first_name;
             $last_name = $request->last_name;
             $phone = $request->phone;
             $password = $request->password;
             $email = $request->email;
             $password = $request->password;
             $insert_arr = array('first_name' => $first_name, 'last_name' => $last_name, 'phone' => $phone, 'email' => $email, 'password' => Hash::make($password));
             Supplier::insert($insert_arr);
             return redirect::route('add_supplier')->with('successmsg', 'Supplier is added successfully');
         }
     }
     return view('supplier/create_supplier');
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(CookieJar $cookieJar, Request $request)
 {
     if (Session::has('ADMIN_ACCESS_ID')) {
         return redirect('admin/dashboard');
     }
     if ($request->isMethod('post')) {
         $admin_email = $request->get('admin_email');
         $admin_password = $request->get('admin_password');
         $checkAgentExists = Admin::where("email", "=", $admin_email);
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('admin_email', $admin_email, 60));
             $cookieJar->queue(Cookie::make('admin_password', $admin_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('admin_email'));
             $cookieJar->queue(Cookie::forget('admin_password'));
         }
         if (count($checkAgentExists) > 0) {
             if (Hash::check($admin_password, $checkAgentExists[0]->password)) {
                 Session::put('ADMIN_ACCESS_ID', $checkAgentExists[0]->id);
                 Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
                 Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
                 return redirect::route('dashboard');
             } else {
                 return redirect::route('admin')->with('errorMessage', 'Invalid password provided.');
             }
         } else {
             return redirect::route('admin')->with('errorMessage', 'Invalid email address or/and password provided.');
         }
     }
     $data = array();
     $data['admin_email'] = '';
     $data['admin_password'] = '';
     $admin_email = Cookie::get('admin_email');
     $admin_password = Cookie::get('admin_password');
     if ($admin_email && $admin_password) {
         $data['admin_email'] = $admin_email;
         $data['admin_password'] = $admin_password;
     }
     return view('admin/login', $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $agent_id = Session::get('AGENT_ACCESS_ID');
     $data = array();
     $data['record'] = Agent::find($agent_id);
     if ($request->isMethod('post')) {
         $first_name = $request->first_name;
         $last_name = $request->last_name;
         $phone = $request->phone;
         $password = $request->password;
         $update_arr = array('first_name' => $first_name, 'last_name' => $last_name, 'phone' => $phone);
         if ($password != '') {
             $update_arr['password'] = md5($password . Config::get('constants.SITENAME'));
         }
         Agent::where('id', '=', $agent_id)->update($update_arr);
         Session::put('ADMIN_ACCESS_FNAME', $first_name);
         Session::put('ADMIN_ACCESS_LNAME', $last_name);
         return redirect::route('agent_profile')->with('successmsg', 'Profile is updated successfully');
     }
     return view('agent/profile', $data);
 }
Exemple #9
0
 public function directory()
 {
     $app_id = input::get('app_id');
     $content_path = input::get('content_path');
     $open_path = trim(input::get('open_path'));
     if (!$this->check($app_id, $content_path)) {
         return redirect::route('shopadmin', array('app' => 'site', 'ctl' => 'admin_explorer_app', 'act' => 'index'));
     }
     $fileObj = kernel::single('site_explorer_file');
     $dir = realpath(APP_DIR . '/' . $app_id . '/' . str_replace('-', '/', $content_path) . '/' . str_replace(array('-', '.'), array('/', '/'), $open_path));
     //open_pathapp::get('site')->_(不允许有)'./'&'../'
     $filter = array('id' => $app_id, 'dir' => $dir, 'show_bak' => false, 'type' => 'all');
     $file = $fileObj->file_list($filter);
     $file = $fileObj->parse_filter($file);
     $pagedata['file'] = array_reverse($file);
     $pagedata['url'] = sprintf('?app=%s&ctl=%s&act=%s&app_id=%s&content_path=%s', input::get('app'), input::get('ctl'), input::get('act'), input::get('app_id'), input::get('content_path'));
     $pagedata['app_id'] = $app_id;
     $pagedata['content_path'] = $content_path;
     $pagedata['open_path'] = $open_path;
     $pagedata['last_path'] = strrpos($open_path, '-') ? substr($open_path, 0, strrpos($open_path, '-')) : ($open_path ? ' ' : '');
     return $this->page('site/admin/explorer/app/directory.html', $pagedata);
 }
 public function change_password(Request $request)
 {
     $admin_id = Session::get('ADMIN_ACCESS_ID');
     $data = array();
     $settings = Admin::find($admin_id);
     if ($request->isMethod('post')) {
         $validator = Validator::make($request->all(), ['current_password' => 'required', 'new_password' => 'required|confirmed', 'new_password_confirmation' => 'required']);
         if ($validator->fails()) {
             return redirect::route('change_password')->withErrors($validator);
         } else {
             $current_password = $request->current_password;
             $new_password = $request->new_password;
             $new_password_confirmation = $request->new_password_confirmation;
             if (\Hash::check($current_password, $settings->password)) {
                 $settings->password = $new_password;
                 $settings->save();
                 return redirect::route('change_password')->with('success', 'Password updated successfully.');
             } else {
                 return redirect::route('change_password')->with('error', 'Invalid current password provided.');
             }
         }
     }
     return view('admin/change_password', $data);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $validator = Validator::make($request->all(), ['first_name' => 'required', 'last_name' => 'required']);
     if ($validator->fails()) {
         $messages = $validator->messages();
         return redirect::route('agent_edit', $id)->withErrors($validator)->withInput();
     } else {
         $agent = Agent::find($id);
         $first_name = $request->input('first_name');
         $last_name = $request->input('last_name');
         $password = $request->input('password');
         $phone = $request->input('phone');
         $agent->first_name = $first_name;
         $agent->last_name = $last_name;
         if ($phone) {
             $agent->phone = $phone;
         }
         if ($password != '') {
             $agent->password = $password;
         }
         if ($request->file('user_image')) {
             $file = Input::file('user_image');
             $imagename = time() . '.' . $file->getClientOriginalExtension();
             if (file_exists(public_path('upload/agentprofile/' . $agent->image)) && $agent->image != '') {
                 $image_path = public_path('upload/agentprofile/' . $agent->image);
                 $image_thumb_path = public_path('upload/agentprofile/thumb/' . $agent->image);
                 \File::Delete($image_path);
                 \File::Delete($image_thumb_path);
             }
             $path = public_path('upload/agentprofile/' . $imagename);
             $image = \Image::make($file->getRealPath())->save($path);
             $th_path = public_path('upload/agentprofile/thumb/' . $imagename);
             $image = \Image::make($file->getRealPath())->resize(128, 128)->save($th_path);
             $agent->image = $imagename;
         }
         $agent->save();
         return redirect::route('agent_management')->with('success', 'Agent updated successfully.');
     }
 }
Exemple #12
0
 public function delRenOsusume($id)
 {
     DB::table('rental_product')->where('id', '=', $id)->update(array('is_deleted' => DELETED));
     Session::flash('success', 'The rental product deleted successfully.');
     return redirect::route('admin.rental.osusume');
 }
Exemple #13
0
 public function switchToPc()
 {
     setcookie('browse', 'pc');
     return redirect::route('topc');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CookieJar $cookieJar, Request $request)
 {
     if ($request->isMethod('post')) {
         $agent_email = $request->get('agent_email');
         $agent_password = $request->get('agent_password');
         $checkAgentExists = Agent::where("email", "=", $agent_email);
         //$checkAgentExists	= $checkAgentExists->where("password", "=", md5($agent_password.\Config::get('constants.SITENAME')));
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('agent_email', $admin_email, 60));
             $cookieJar->queue(Cookie::make('agent_password', $admin_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('agent_email'));
             $cookieJar->queue(Cookie::forget('agent_password'));
         }
         if (count($checkAgentExists) > 0) {
             if (Hash::check($agent_password, $checkAgentExists[0]->password)) {
                 Session::put('AGENT_ACCESS_ID', $checkAgentExists[0]->id);
                 Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
                 Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
                 return redirect::to('agent/dashboard');
             } else {
                 return redirect::route('agent')->with('errorMessage', 'Invalid password provided.');
             }
         } else {
             return redirect::route('agent')->with('errorMessage', 'Invalid email address or/and password provided.');
         }
         //if(count($checkAgentExists) > 0){
         //	Session::put('AGENT_ACCESS_ID', $checkAgentExists[0]->id);
         //	Session::put('ADMIN_ACCESS_FNAME', $checkAgentExists[0]->first_name);
         //	Session::put('ADMIN_ACCESS_LNAME', $checkAgentExists[0]->last_name);
         //	return redirect('agent/dashboard');
         //}else{
         //	return redirect('agent')->with('message', 'Invalid email address or/and password.');
         //}
     }
 }
 public function logout()
 {
     setLogout();
     return redirect::route('clubs');
     //return redirect::route('home');
 }
 public function delRenOsusume($id)
 {
     DB::table('rental_product')->where('id', '=', $id)->update(array('is_deleted' => INACTIVE));
     Session::flash('success', ' 削除が完了しました。');
     return redirect::route('admin.rental.osusume');
 }
Exemple #17
0
 /**
  * Validate and store the new user data, or return an error.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @since [v1.0]
  * @return Redirect
  */
 public function postCreate(SaveUserRequest $request)
 {
     $user = new User();
     //Username, email, and password need to be handled specially because the need to respect config values on an edit.
     $user->email = $data['email'] = e($request->input('email'));
     $user->username = $data['username'] = e($request->input('username'));
     if ($request->has('password')) {
         $user->password = bcrypt($request->input('password'));
         $data['password'] = $request->input('password');
     }
     // Update the user
     $user->first_name = e($request->input('first_name'));
     $user->last_name = e($request->input('last_name'));
     $user->locale = e($request->input('locale'));
     $user->employee_num = e($request->input('employee_num'));
     $user->activated = e($request->input('activated', $user->activated));
     $user->jobtitle = e($request->input('jobtitle'));
     $user->phone = e($request->input('phone'));
     $user->location_id = e($request->input('location_id'));
     $user->company_id = e(Company::getIdForUser($request->input('company_id')));
     $user->manager_id = e($request->input('manager_id'));
     $user->notes = e($request->input('notes'));
     $user->permissions = json_encode($request->input('permission'));
     if ($user->manager_id == "") {
         $user->manager_id = null;
     }
     if ($user->location_id == "") {
         $user->location_id = null;
     }
     if ($user->company_id == "") {
         $user->company_id = null;
     }
     if ($user->save()) {
         if ($request->has('groups')) {
             $user->groups()->sync($request->input('groups'));
         } else {
             $user->groups()->sync(array());
         }
         if ($request->input('email_user') == 1 && $request->has('email')) {
             // Send the credentials through email
             $data = array();
             $data['email'] = e($request->input('email'));
             $data['username'] = e($request->input('username'));
             $data['first_name'] = e($request->input('first_name'));
             $data['password'] = e($request->input('password'));
             Mail::send('emails.send-login', $data, function ($m) use($user) {
                 $m->to($user->email, $user->first_name . ' ' . $user->last_name);
                 $m->subject('Welcome ' . $user->first_name);
             });
         }
         return redirect::route('users')->with('success', trans('admin/users/message.success.create'));
     }
     return redirect()->back()->withInput()->withErrors($user->getErrors());
 }