Example #1
0
 public function postUserSettings()
 {
     $error = false;
     if (Request::has('user_id')) {
         $user_id = (int) Auth::user()->user_id;
         $input_id = (int) Request::input('user_id');
         if (Request::input('roles') === null) {
             $roles = [];
         } else {
             $roles = Request::input('roles');
         }
         if ($user_id === $input_id && !in_array(env('ROLE_ADMIN'), $roles, false)) {
             $roles[] = env('ROLE_ADMIN');
             $error = true;
         }
         $editUser = User::find(Request::input('user_id'));
         $editUser->roles()->sync($roles);
         $editUser->save();
         $this->streamingUser->update();
     }
     if ($error) {
         return redirect()->back()->with('error', 'Vous ne pouvez pas enlever le droit admin de votre compte!');
     }
     return redirect()->back();
 }
Example #2
0
 public function anyIndex()
 {
     //获取路由传入的参数
     //echo Route::input('name');
     //获取配置信息
     $value = config('app.timezone');
     //var_dump($value);
     //获取请求输入  http://host-8/web/user?name=dfse  输出:dfse
     $name1 = Request::has('name') ? Request::get('name') : '';
     //取得特定输入数据,若没有则取得默认值
     $name2 = Request::input('name', '默认值');
     $input = Request::all();
     //所有的
     $input = Request::input('products.0.name');
     //重定向
     //return redirect('login');
     //获取cookie
     $value = Request::cookie('name');
     //获取域名
     $url = Request::root();
     //		echo $url;
     $data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
     //响应视图   响应最常用的几个方法:make/view/json/download/redirectTo
     return response()->view('user.user', $data);
 }
Example #3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //$token = Input::post('token');
     if (Request::has('token')) {
         $token = Request::input('token');
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $fullname = Request::input('f');
             $username = Request::input('u');
             $phone = Request::input('pn');
             $email = Request::input('e');
             $password = Request::input('pwd');
             $roles = Request::input('r');
             $field_users = array('name' => $username, 'email' => $email, 'password' => bcrypt($password));
             $count_users = User::where('email', '=', $email)->count();
             if ($count_users <= 0) {
                 $user = User::create($field_users);
                 $user_login = User::where('email', '=', $email)->first();
                 foreach ($user_login as $key => $value) {
                     $id = $user_login->id;
                 }
                 $field_user_detail = array('users_id' => $id, 'users_name' => $username, 'users_fullname' => $fullname, 'users_group_id' => $roles, 'users_email' => $email, 'users_status_id' => '1');
                 $user = table_users_detail::create($field_user_detail);
                 return (new Response(array('status' => true, 'msg' => 'Register successfully'), 200))->header('Content-Type', "json");
             } else {
                 return (new Response(array('status' => false, 'msg' => 'Email already registered'), 200))->header('Content-Type', "json");
             }
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed 2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed 1'), 200))->header('Content-Type', "json");
     }
 }
 public function showForumAction()
 {
     if (Request::has('id')) {
         if (!Request::has('page_number')) {
             $page_number = 1;
         } else {
             $page_number = Request::get('page_number');
         }
         $parent = Page::where('id', '=', Request::input('id'))->first();
         if ($parent->is_sheet) {
             $messages = ForumPageMessage::where('page_id', '=', $parent->id)->take(3)->skip(($page_number - 1) * 3)->get();
             $users = User::all();
             $page_title = $parent->title;
             $messages_count = ForumPageMessage::where('page_id', '=', $parent->id)->count();
             return view('base.forum_page', ['messages' => $messages, 'page_id' => Request::input('id'), 'users' => $users, 'page_title' => $page_title, 'page_number' => $page_number, 'messages_count' => $messages_count]);
         }
         $childs = Page::where('parent_id', '=', $parent->id)->get();
     } else {
         $parent = Page::where('title', '=', 'Форум')->first();
         $childs = Page::where('parent_id', '=', $parent->id)->get();
     }
     $child_messages = null;
     foreach ($childs as $child) {
         if ($child->is_sheet) {
             $child_messages[] = ForumPageMessage::where('page_id', '=', $child->id)->get();
         }
     }
     return view('base.forum', ['topics' => $childs, 'parent_page' => $parent, 'page_messages' => $child_messages]);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (urlRequest::has('setstatus')) {
         $setStatus = (int) urlRequest::get('setstatus');
         $member = Member::find($id);
         $member->status = $setStatus;
         $member->save();
         return redirect()->back();
     }
 }
Example #6
0
 public static function showLogs($request)
 {
     $categories = Category::all();
     if (Request::has('filter')) {
         $date_filter = explode(' - ', $request->get('filter'));
         $deviceLogs = DeviceLog::with(['owner', 'device', 'user'])->whereBetween('created_at', [$date_filter[0], $date_filter[1]])->paginate(25);
         $deviceLogs->setPath('report');
     }
     return view('device_log.report', compact('deviceLogs', 'categories'));
 }
Example #7
0
 /**
  * This method returns an array of fields parsed from the request. `[*]` is returned by default (all fields).
  * Fields can be written in snake_case or camelCase. They are converted to snake_case automatically.
  *
  * Example: `?fields=column1,column2` is returned as `['column1', 'column2']`
  *
  * @return array
  */
 protected function getFieldsFromRequest($prefix = null)
 {
     if (Request::has('fields')) {
         $prefix = $prefix ? $prefix . '.' : '';
         return array_map(function ($field) use($prefix) {
             return $prefix . snake_case($field);
         }, explode(',', Request::get('fields')));
     }
     return ['*'];
 }
 public function updateToitem($data)
 {
     if (Request::has('detail')) {
         if (isset(Request::get('detail')['id_detail'])) {
             Request::merge(Request::get('detail'));
             $soItem = new $this->detailClass();
             $soItem->putUpdate(Request::get('detail')['id_detail']);
         }
     }
 }
Example #9
0
 private function link($column, $text, $direction)
 {
     $params = $this->_appends + [$this->_keys['order'] => $column, $this->_keys['direction'] => $direction];
     if (Request::has($this->_keys['order']) && Request::input($this->_keys['order']) == $column && Request::input($this->_keys['direction']) == $direction) {
         return $text;
     }
     if (empty($this->_url)) {
         $this->_url = Request::url();
     }
     return '<a href="' . $this->_url . '?' . http_build_query($params) . '">' . $text . '</a>';
 }
Example #10
0
 /**
  * Order by columns based on parameters
  *
  * @param \Illuminate\Database\Eloquent\Builder $query
  * @param string $orderBy
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public static function orderByColumns(Builder $query, $orderBy)
 {
     if (Request::has('orderbycolumn') == TRUE && Request::has('orderbytype') == TRUE) {
         $query->orderBy(Request::input('orderbycolumn'), Request::input('orderbytype'));
     } else {
         foreach ($orderBy as $orderByColumn => $orderByType) {
             $query->orderBy($orderByColumn, $orderByType);
         }
     }
     return $query;
 }
Example #11
0
 /**
  * handle image upload route
  */
 public function image()
 {
     if (Request::hasFile('image') && Request::has('table_name') && Request::has('field_name')) {
         return json_encode(self::saveImage(Request::input('table_name'), Request::input('field_name'), Request::file('image'), null, Request::file('image')->getClientOriginalExtension()));
     } elseif (!Request::hasFile('image')) {
         return 'no image';
     } elseif (!Request::hasFile('table_name')) {
         return 'no table_name';
     } elseif (!Request::hasFile('field_name')) {
         return 'no field_name';
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (urlRequest::has('setstatus')) {
         $setStatus = (int) urlRequest::get('setstatus');
         $member = Member::find($id);
         $member->status = $setStatus;
         $member->save();
         return redirect()->back();
     }
     $data = $this->member->whereId((int) $id)->with('person.contacts', 'person.files', 'person.education')->first();
     return view('admin.show', compact('data'));
 }
 public function postAdminDelete()
 {
     session_start();
     Request::setTrustedProxies(array('192.0.0.1', '10.0.0.0/8'));
     if (isset($_SESSION["logged_in"]) && isset($_SESSION["logged_in_ip"]) && $_SESSION["logged_in_ip"] == Request::getClientIp()) {
         if (Request::has("id")) {
             $id = Request::input("id");
             DB::table("contestants")->where(array("id" => $id))->delete();
         }
     }
     return redirect()->action("AdminController@getAdminDelete");
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $location = new Location();
     if (Request::has('location') && Request::input('location') != "") {
         $location->location = Request::input('location');
         $location->save();
         return Response::make("Success", 201);
     } else {
         // Bad request, missing parameters
         return Response::make("Please provide a time and location.", 400);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $notification = new Notification();
     if (Request::has('text') && Request::input('text') != "") {
         $notification->text = Request::input('text');
         $notification->save();
         return Response::make("Success", 201);
     } else {
         // Bad request, missing parameters
         return Response::make("Please provide a notification.", 400);
     }
 }
Example #16
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     if (!Request::has('name')) {
         return redirect()->back()->withInput();
     }
     $role = new Role();
     $role->name = Request::get('name');
     $role->description = Request::get('description');
     $role->save();
     $perms = is_array(Request::get('permissions')) ? Request::get('permissions') : [];
     $role->permissions()->sync($perms);
     return redirect(route(config('larbac.routes.routeRoles') . '.index'));
 }
Example #17
0
 /**
  * @param \Illuminate\Database\Query\Builder $query
  * @param array|null $defaultSortParameters
  *
  * @return \Illuminate\Database\Query\Builder
  */
 public function scopeSortable($query, $defaultSortParameters = null)
 {
     if (Request::has('sort') && Request::has('order')) {
         return $this->queryOrderBuilder($query, Request::only(['sort', 'order']));
     } elseif (!is_null($defaultSortParameters)) {
         $defaultSortArray = $this->formatToSortParameters($defaultSortParameters);
         if (Config::get('columnsortable.allow_request_modification', true) && !empty($defaultSortArray)) {
             Request::merge($defaultSortArray);
         }
         return $this->queryOrderBuilder($query, $defaultSortArray);
     } else {
         return $query;
     }
 }
 public function index()
 {
     if (Request::input('l')) {
         LaravelLogViewer::setFile(base64_decode(Request::input('l')));
     }
     if (Request::input('dl')) {
         return Response::download(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('dl'))));
     } elseif (Request::has('del')) {
         File::delete(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('del'))));
         return Redirect::to(Request::url());
     }
     $logs = LaravelLogViewer::all();
     return View::make('laravel-log-viewer::log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
 }
 protected function filtersMapping()
 {
     if (Request::has('searchText') && Request::has('searchCol')) {
         if (strtolower(Request::get('searchCol')) == 'login') {
             if (strtolower(Request::get('searchText')) == 'online') {
                 Request::merge(['searchText' => '1']);
             } else {
                 if (strtolower(Request::get('searchText')) == 'offline') {
                     Request::merge(['searchText' => '0']);
                 }
             }
         }
     }
 }
 public function postImage(\Prehistorical\ImageFileLogic\ImageFileLogic $ifl)
 {
     if (Request::hasFile('imagefile') && Request::has('name')) {
         //id - это айди элемента группы, картинки принадлежащие непосредственно блоку проходят с адйди=0
         if (Request::has('id')) {
             $id = Request::input('id');
         } else {
             $id = 0;
         }
         $result = $ifl->storeImage(Request::input('name'), $id, Request::file('imagefile'), false);
         return $result;
     } else {
         return ['status' => 'Не хватает параметров (файла или имени сущности) для сохранения.'];
     }
 }
 public function postNom()
 {
     if (Request::has('nom')) {
         $nom = Request::input('nom');
         if (strlen($nom) > 0) {
             $this->save_nom($nom);
             Session::flash('flash_success', 'Le nom de votre école est à présent "' . $nom . '"');
         } else {
             Session::flash('flash_error', 'Votre nom d\'école n\'est pas valide');
         }
     } else {
         Session::flash('flash_error', 'Le nom de l\'école n\'a pas été envoyé');
     }
     return redirect(route('admin_identite_ecole_get', ['nom' => $nom, 'logo' => $this->filename]));
 }
Example #22
0
 public function streamSearch()
 {
     if (Request::has('query')) {
         $query = Request::input('query');
     } else {
         return redirect(route('streams'));
     }
     if (Request::input('all') !== null) {
         // $data = $this->streamingUser->searchAll($query);
         $data = $this->streamingUser->searchStreaming($query);
     } else {
         $data = $this->streamingUser->searchStreaming($query);
     }
     return view('stream.all', ['streams' => $data])->with(['search' => $query]);
 }
 public function postContest()
 {
     session_start();
     if (Request::has("code") && isset($_SESSION["user_id"]) && $_SESSION["user_verified"] == 1) {
         $code = Request::input("code");
         $winningCodeId = DB::table("codes")->where(array("code" => $code))->value("id");
         if ($winningCodeId != null) {
             $data = array("messageTitle" => "Gefeliciteerd! ", "message" => "U heeft gewonnen! Zodadelijk krijgt u een e-mail met informatie over hoe u moet verdergaan om uw prijs te verkrijgen.");
             DB::table("codes")->where(array("id" => $winningCodeId))->delete();
             DB::table("winners")->insert(array("contestants_id" => $_SESSION["user_id"], "win_date" => date("Y-m-d H:i:s")));
         } else {
             $data = array("messageTitle" => "Spijtig!", "message" => "Uw ingevoerde code was geen winnende code, jammer.");
         }
         return view("contest.result", $data);
     }
     return redirect()->action("HomeController@getRegister");
 }
Example #24
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if (Request::has('token')) {
         $token = Request::input('token', '');
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $this->middleware('guest', ['except' => 'getLogout']);
             $email = Request::input('u', '');
             $password = Request::input('pwd', '');
             if (Auth::attempt(array('email' => $email, 'password' => $password))) {
                 $users_detail = table_users_detail::where('users_email', '=', $email)->first();
                 $users_default = User::where('email', '=', $email)->first();
                 $status = $users_detail->users_status_id;
                 if ($status == "2") {
                     //return (new Response(array('status' => true,'msg' => 'You are Logged in'),200))->header('Content-Type', "json");
                     $field_users = array();
                     $field_users['id'] = $users_default->id;
                     $field_users['ids'] = $users_detail->users_detail_id;
                     $field_users['users_name'] = $users_detail->users_name;
                     $field_users['users_email'] = $email;
                     $field_users['users_group_id'] = $users_detail->users_group_id;
                     $field_users['users_fullname'] = $users_detail->users_fullname;
                     $field_users = (object) $field_users;
                     $token = GlobalLibrary::tokenGenerator($field_users);
                     $js = array();
                     $js = (object) $js;
                     $js->i = $users_detail->users_detail_id;
                     $js->n = $users_detail->users_name;
                     $js->fu = $users_detail->users_fullname;
                     $js->d = $users_detail->users_description;
                     $js->ugid = $users_detail->users_group_id;
                     $js->token = $token;
                     return (new Response(array('status' => true, 'msg' => 'You are Logged in', 'data' => $js), 200))->header('Content-Type', "json");
                 } else {
                     return (new Response(array('status' => true, 'msg' => 'You are still pending verification'), 200))->header('Content-Type', "json");
                 }
             } else {
                 return (new Response(array('status' => false, 'msg' => 'Authentication Failed '), 200))->header('Content-Type', "json");
             }
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed2'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed1'), 200))->header('Content-Type', "json");
     }
 }
Example #25
0
 /**
  * post Login to Api
  *
  * @param  array  $data
  * @return \Illuminate\Contracts\Validation\Validator
  */
 public function postSetcompany()
 {
     $response = $this->call('/api/set_company', 'post');
     if ($response['status'] == 200) {
         \Session::put('id_company', Request::get('id_company'));
         if (isset($response['newToken'])) {
             \Session::put('token', $response['newToken']);
         }
     }
     if (Request::has('url')) {
         $arrUrl = explode('/', Request::get('url'));
         $url = '/' . $arrUrl[0];
         $url = isset($url[1]) ? $url . '/' . $arrUrl[1] : $url;
         return redirect($url);
     }
     return redirect('/');
 }
 public function index()
 {
     if (Request::input('l')) {
         LaravelLogViewer::setFile(base64_decode(Request::input('l')));
     }
     if (Request::input('dl')) {
         Log::notice('perm.log.site.download - SiteLog downloaded', ['user_id' => Request::user()->user_id]);
         return Response::download(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('dl'))));
     } elseif (Request::has('del')) {
         File::delete(LaravelLogViewer::pathToLogFile(base64_decode(Request::input('del'))));
         Log::notice('perm.log.site.delete - SiteLog deleted', ['user_id' => Request::user()->user_id]);
         return Redirect::to(Request::url());
     }
     $logs = LaravelLogViewer::all();
     Log::notice('perm.log.site.view - SiteLog opened', ['user_id' => Request::user()->user_id]);
     return View::make('laravel-log-viewer::log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
 }
 protected function filtersMapping()
 {
     if (Request::has('searchText') && Request::has('searchCol')) {
         if (strtolower(Request::get('searchCol')) == 'status') {
             if (strtolower(Request::get('searchText')) == 'confirm') {
                 Request::merge(['searchText' => '1']);
             } else {
                 if (strtolower(Request::get('searchText')) == 'open') {
                     Request::merge(['searchText' => '0']);
                 } else {
                     if (strtolower(Request::get('searchText')) == 'void') {
                         Request::merge(['searchText' => '2']);
                     }
                 }
             }
         }
     }
 }
Example #28
0
 /**
  * [postKonversi description]
  * @return view konversi form
  */
 public function putKonversi()
 {
     if (!Request::has('id_unit')) {
         Request::merge(['id_unit' => '0']);
     }
     $response = $this->call('/api/' . $this->url . '/' . Request::get('id'), 'put');
     if ($response['status'] == 201) {
         $data = !empty($response['content']['data']) ? $response['content']['data'] : '';
     } else {
         $data = Request::all();
     }
     $data = ['data' => $data, 'label' => $this->label, 'url' => $this->url, 'view' => $this->view];
     if (method_exists($this, 'formApi')) {
         $data += $this->formApi();
     }
     $this->setflashSuccess($response);
     return redirect('/master/items/konversi/' . Request::get('id'));
 }
Example #29
0
 /**
  * Displays the explore page.
  *
  * @return \Illuminate\View\View
  */
 public function indexAction()
 {
     $this->subMenu['explore']['active'] = true;
     $today = Date::now();
     $startDate = Date::now();
     // Check if we have another starting date
     if (Request::has('start_date')) {
         try {
             // If date provided is valid
             $oldDate = Date::createFromFormat('Y-m-d', Request::get('start_date'));
             // If trying to get a future date fallback to today
             if ($today->gt($oldDate)) {
                 $startDate = $oldDate;
             }
         } catch (Exception $e) {
             // Fallback to today
         }
     }
     $daysToShow = Setting::get('app_issue_days', 0) - 1;
     if ($daysToShow < 0) {
         $daysToShow = 0;
         $issueDays = [];
     } else {
         $issueDays = range(0, $daysToShow);
     }
     $dateTimeZone = Setting::get('app_timezone');
     $issueVisiblity = Auth::check() ? 0 : 1;
     $allIssues = Issue::whereBetween('created_at', [$startDate->copy()->subDays($daysToShow)->format('Y-m-d') . ' 00:00:00', $startDate->format('Y-m-d') . ' 23:59:59'])->orderBy('created_at', 'desc')->get()->groupBy(function (Issue $issue) use($dateTimeZone) {
         return (new Date($issue->created_at))->setTimezone($dateTimeZone)->toDateString();
     });
     // Add in days that have no issues
     foreach ($issueDays as $i) {
         $date = (new Date($startDate))->setTimezone($dateTimeZone)->subDays($i);
         if (!isset($allIssues[$date->toDateString()])) {
             $allIssues[$date->toDateString()] = [];
         }
     }
     // Sort the array so it takes into account the added days
     $allIssues = $allIssues->sortBy(function ($value, $key) {
         return strtotime($key);
     }, SORT_REGULAR, true)->all();
     return View::make('explore.index')->withPageTitle(trans('dashboard.explore'))->withProjects([])->withSubMenu($this->subMenu)->withDaysToShow($daysToShow)->withAllIssues($allIssues)->withCanPageForward((bool) $today->gt($startDate))->withCanPageBackward(Issue::where('created_at', '<', $startDate->format('Y-m-d'))->count() > 0)->withPreviousDate($startDate->copy()->subDays($daysToShow)->toDateString())->withNextDate($startDate->copy()->addDays($daysToShow)->toDateString());
 }
Example #30
0
 public function saveGroupItem()
 {
     if (Request::has('entity') && Request::has('block') && Request::has('id')) {
         $dataobj = Request::all();
         if ($dataobj['entity'] == 'groupitem') {
             try {
                 $groupitem = Group::findOrFail($dataobj['id']);
                 $result = $groupitem->saveGroupItem($dataobj);
                 return ['status' => $result];
             } catch (Exception $exception) {
                 return ['status' => 'Что-то пошло не так. ' . $exception->getMessage()];
             }
         } else {
             return ['status' => 'Имя сохраняемой сущности не равно group (' . $dataobj['entity'] . ').'];
         }
     } else {
         return ['status' => 'Не хватает параметров для сохранения.'];
     }
 }