public function get_instagram()
 {
     // make sure user is logged in
     if (!\Auth::user()) {
         return \Redirect::to('/')->withInput()->withErrors('You must be logged in to access the Instagram panel.');
     }
     // configure the API values
     $auth_config = array('client_id' => CLIENT_ID, 'client_secret' => CLIENT_SECRET, 'redirect_uri' => REDIRECT_URI);
     // create a new Auth object using the config values
     $auth = new \Instagram\Auth($auth_config);
     // authorize app if not already authorized
     if (!\Input::get('code')) {
         $auth->authorize();
     }
     // get the code value returned from Instagram
     $code = \Input::get('code');
     $title = 'ImgHost - Instagram';
     // save the access token if not already saved
     if (!\Session::get('instagram_access_token')) {
         \Session::put('instagram_access_token', $auth->getAccessToken($code));
     }
     // create a new Instagram object
     $instagram = new \Instagram\Instagram();
     // set the access token on the newly created Instagram object
     $instagram->setAccessToken(\Session::get('instagram_access_token'));
     // get the ID of the authorized user
     $current_user = $instagram->getCurrentUser();
     // access the media of the authorized user
     $media = $current_user->getMedia();
     $db_images = \DB::table('images')->get();
     return \View::make('instagram')->with('title', $title)->with('instagram_images', $media)->with('db_images', $db_images);
 }
 /**
  * handle data posted by ajax request
  */
 public function create()
 {
     $id = \Auth::user()->id;
     $term = \Session::get('term');
     $subject_id = \Session::get('subject_id');
     $act_name = \Input::get('deletable');
     $query = \DB::table('records')->where('enrollment_faculty_load_id', $subject_id)->where('term', $term)->select('records.id as records_id')->get();
     $recid = json_decode(json_encode($query), true);
     foreach ($recid as $key => $value) {
         $query = \DB::table('grades')->where('records_id', $value)->select('id')->get();
         $gid[] = json_decode(json_encode($query), true);
     }
     foreach ($gid as $key => $data) {
         foreach ($data as $key2 => $data2) {
             $grades_id[] = $data2['id'];
         }
     }
     foreach ($grades_id as $key => $data) {
         \DB::table('grades')->where('id', $data)->where('name', $act_name)->delete();
     }
     \DB::table('selected_activities')->where('load_id', $subject_id)->where('term', $term)->where('act_name', $act_name)->delete();
     \DB::table('activities')->join('records', 'records.id', '=', 'activities.records_id')->where('records.enrollment_faculty_load_id', $subject_id)->where('records.term', $term)->where('act_name', 'LIKE', $act_name . '%')->delete();
     $response = 'The activity named ' . $act_name . ' has been deleted.';
     return \Response::json($response);
 }
 public function getPaymentStatus()
 {
     // Get the payment ID before session clear
     $payment_id = \Session::get('paypal_payment_id');
     // clear the session payment ID
     \Session::forget('paypal_payment_id');
     if (empty(\Input::get('PayerID')) || empty(\Input::get('token'))) {
         return \Redirect::route('original.route')->with('error', 'Payment failed');
     }
     $payment = Payment::get($payment_id, $this->_api_context);
     // PaymentExecution object includes information necessary
     // to execute a PayPal account payment.
     // The payer_id is added to the request query parameters
     // when the user is redirected from paypal back to your site
     $execution = new PaymentExecution();
     $execution->setPayerId(\Input::get('PayerID'));
     //Execute the payment
     $result = $payment->execute($execution, $this->_api_context);
     echo '<pre>';
     print_r($result);
     echo '</pre>';
     exit;
     // DEBUG RESULT, remove it later
     if ($result->getState() == 'approved') {
         // payment made
         return \Redirect::route('original.route')->with('success', 'Payment success');
     }
     return \Redirect::route('original.route')->with('error', 'Payment failed');
 }
Example #4
0
 public function productList()
 {
     $message = \Session::get('message');
     $list = \App\Product::all();
     $dimensions = Arrays::dimensionNames();
     return view('admin.list', compact('list', 'dimensions', 'message'));
 }
Example #5
0
 public function delete(Product $product)
 {
     $cart = \Session::get('cart');
     unset($cart[$product->slug]);
     \Session::put('cart', $cart);
     return redirect()->route('cart-show');
 }
Example #6
0
 protected function send($someData, $headers = [])
 {
     $token = Session::get('token');
     $result = array('token' => $token, 'service' => $this->service, 'data' => $someData);
     $this->_setCorsHeaders($headers);
     return \Response::json($result, $this->getStatusCode(), $headers);
 }
 public function index()
 {
     if (\Session::has("clientid")) {
         $clientid = \Session::get("clientid");
         $data = array();
         $ts = strtotime(date("d.m.Y h:m:i"));
         $params["dt_start"] = date("01.m.Y");
         $params["dt_end"] = date("d.m.Y");
         $query = "SELECT count(DISTINCT a.FOLDERNO) as CNT, count(c.ID) as CNT2 FROM FOLDERS a INNER JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PANELS c ON c.ID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "'";
         $res = $this->DBquery->query($query);
         foreach ($res as $row) {
             $row = (array) $row;
             $data["COUNT"]["FOLDERS"] = $row['CNT'];
             $data["COUNT"]["PANELS"] = $row['CNT2'];
         }
         $query = "SELECT sum(d.COST) AS CNT FROM FOLDERS a LEFT JOIN ORDERS b ON b.FOLDERNO = a.FOLDERNO INNER JOIN PRICES d ON d.PANELID = b.PANELID WHERE a.CLIENTID = " . $clientid . " AND a.LOGDATE >= '" . $params["dt_start"] . "' AND a.LOGDATE <= '" . $params["dt_end"] . "' AND d.PRICELISTID = a.PRICELISTID AND a.PRICELISTID IS NOT NULL";
         $res = $this->DBquery->query($query);
         foreach ($res as $row) {
             $row = (array) $row;
             foreach ($row as $k => $v) {
                 if ($k == 0) {
                     if ($v == null) {
                         $data["COUNT"]["SUMM"] = "N/A";
                     } else {
                         $data["COUNT"]["SUMM"] = $v . " руб.";
                     }
                 }
             }
         }
         return \View::make('stat')->with(['params' => $params, 'ts' => $ts, 'data' => $data]);
     } else {
         return \View::make('mainPage');
     }
 }
Example #8
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['title'] = 'Home';
     $data['home'] = 1;
     $staff = Staff::find(\Session::get('user')->staff_id);
     // dd($staff);
     if ($staff) {
         $classes = array('Please select a class');
         foreach ($staff->classes as $class) {
             $classes[$class->id] = $class->name;
         }
         $data['classes'] = $classes;
     }
     if (session('user')->inRole('coder') || session('user')->inRole('principal')) {
         return view('dashboard', $data);
     } elseif (session('user')->inRole('head_teacher')) {
         return view('dashboard_head_teacher', $data);
     } elseif (session('user')->inRole('billing_officer')) {
         // return view('dashboard_billing_officer', $data);
         return redirect()->route('billing.fee_schedules.index');
     } elseif (session('user')->inRole('admin_dept_officer')) {
         return view('dashboard_head_teacher', $data);
     } else {
         return view('unauthorized', $data);
     }
 }
Example #9
0
 public function upload($project_id, Request $request)
 {
     $user = \Session::get('user');
     if (!$user->can('项目文件管理')) {
         abort(401);
     }
     $project = Project::find($project_id);
     if ($request->hasFile('file')) {
         $path = $request->input('path');
         $file = $request->file('file')->getClientOriginalName();
         $full_path = \App\NFS::full_path($project, $path);
         $full_file = \App\NFS::full_path($project, $path . '/' . $file);
         if (file_exists($full_file)) {
             $dirname = dirname($full_file) . '/';
             $info = \App\NFS::pathinfo($full_file);
             $extension = $info['extension'] ? '.' . $info['extension'] : '';
             $name = substr($file, 0, strrpos($file, '.') ?: strlen($file));
             $suffix_count = 2;
             do {
                 $file_name = $name . '(' . $suffix_count . ')' . $extension;
                 $full_file = $dirname . $file_name;
                 ++$suffix_count;
             } while (file_exists($full_file));
         }
         $file = substr($full_file, strrpos($full_file, '/') + 1);
         \Log::notice(strtr('文件上传: 用户(%name[%id]) 在路径 %path 中上传了文件 %file', ['%name' => $user->name, '%id' => $user->id, '%path' => $full_path, '%file' => $file]));
         $request->file('file')->move($full_path, $file);
         return redirect()->back()->with('message_content', '上传成功!')->with('message_type', 'info');
     } else {
         return redirect()->back()->with('message_content', '上传失败')->with('message_type', 'danger');
     }
 }
 public function edit(Request $request)
 {
     if (!\Session::get('user')->can('硬件管理')) {
         abort(401);
     }
     $hardware = Hardware::find($request->input('id'));
     $old_attributes = $hardware->attributesToArray();
     $hardware->name = $request->input('name');
     $hardware->description = $request->input('description');
     $hardware->model = $request->input('model');
     $hardware->self_produce = (bool) ($request->input('self_produce') == 'on');
     $new_attributes = $hardware->attributesToArray();
     $user = \Session::get('user');
     foreach (array_diff_assoc($old_attributes, $new_attributes) as $key => $value) {
         $old = $old_attributes[$key];
         $new = $new_attributes[$key];
         if ($key == 'self_produce') {
             $old = $old == 'true' ? '自产' : '外采';
             $new = $new == 'true' ? '自产' : '外采';
         }
         \Log::notice(strtr('硬件修改: 用户(%name[%id]) 修改了硬件 (%hardware[%hardware_id]) 的基本信息: [%key] %old --> %new', ['%name' => $user->name, '%id' => $user->id, '%hardware' => $hardware->name, '%hardware_id' => $hardware->id, '%key' => $key, '%old' => $old, '%new' => $new]));
     }
     $hardware->save();
     return redirect()->back()->with('message_content', '修改成功!')->with('message_type', 'info');
 }
Example #11
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $campaign = \Session::get('campaign');
     $campaign->fillRelations();
     foreach ($campaign->getRelations() as $relation) {
         foreach ($relation as $title => $components) {
             //Split it out into human readable terms
             $pieces = explode('\\', $title);
             $title_component = $pieces[count($pieces) - 1];
             $data['objects'][$title_component] = $components;
         }
     }
     $data['campaigns'] = CampaignMembership::where('user_id', \Auth::user()->id)->get();
     foreach ($data['campaigns'] as $campaign) {
         $campaign->details;
     }
     $data['object_count'] = count($data['objects']);
     $data['columns'] = 5;
     $data['logs'] = QuestLog::where('campaign_id', \Session::get('campaign')->id)->orderBy('id', 'desc')->get();
     //Let's remove restricted content for non dms
     foreach ($data['logs'] as $key => $value) {
         foreach ($value as $component) {
             if ($value->restricted == 1 && \Session::get('dm') == 0) {
                 unset($data['logs'][$key]);
             }
         }
     }
     return view('dashboards.index')->with($data);
 }
 public function viewOld()
 {
     $error = \Session::get('error');
     $messages = \Session::get('messages');
     $orders = Order::where('status', '=', Constants::ORDER_VALIDATE)->get();
     return view('manager.orderValidated', ['orders' => $orders, 'error' => $error, 'messages' => $messages]);
 }
 public function indexPost()
 {
     $tsql = "select coalesce(mail_from,clientname,medname,'ЛПУ') from clients c WHERE c.id = '" . \Session::get('clientid') . "'";
     $stmt = $this->DBquery->query($tsql);
     if ($stmt === false) {
         echo "Error in executing query.<br/>";
         die(0);
     }
     $c = (array) $stmt[0];
     $_POST['from'] = str_replace("\"", "'", $c['COALESCE']);
     $_POST['to'] = htmlspecialchars($_POST['to']);
     $_POST['theme'] = str_replace("\"", "'", $_POST['theme']);
     $_POST['body'] = str_replace("\"", "'", $_POST['body']);
     //send_mail($_POST['from'], $_POST['to'], $_POST['theme'], $_POST['body'], "https://nacpp.info/print.php?action=viewreport&id=".$folderno."&logo", $folderno);
     $tsql = "select logo from clients c WHERE c.id = '" . \Session::get('clientid') . "'";
     $stmt = $this->DBquery->query($tsql);
     if ($stmt === false) {
         echo "Error in executing query.<br/>";
         die(0);
     }
     $c = (array) $stmt[0];
     if ($c['LOGO'] == 'Y') {
         $c = "&logo";
     } else {
         $c = "";
     }
     //$r = send_mail($_POST['from'], $_POST['to'], $_POST['theme'], $_POST['body'], "http://192.168.0.17/nreports/report.php?folderno=".$folderno.$c, $folderno);
     $r = FuncControllers::send_mail($_POST['from'], $_POST['to'], $_POST['theme'], $_POST['body'], "http://nacpp.info/print.php?action=viewreport&id=" . \Input::get('folderno') . $c, \Input::get('folderno'));
     if ($r == false) {
         echo "При отправке письма произошла ошибка!<br/><a href=\"request?folderno=" . \Input::get('folderno') . "\">Вернуться назад</a>";
     } else {
         echo "Письмо было успешно отправлено!<br/><a href=\"request?folderno=" . \Input::get('folderno') . "\">Вернуться назад</a>";
     }
 }
 public function spanish()
 {
     $tr = new TranslateClient('en', 'es');
     $text = Session::get('trans');
     $trans = $tr->translate($text);
     return view("imageupload")->with(['success' => $text, 'trans' => $trans]);
 }
Example #15
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $usuario = \App\User::find($id);
     $compania = \App\Compania::All()->lists('nombreCompania', 'idCompania');
     $rol = \App\Rol::All()->lists('nombreRol', 'idRol');
     $tercero = \App\Tercero::where('Compania_idCompania', '=', \Session::get('idCompania'))->lists('nombreCompletoTercero', 'idTercero');
     return view('users', compact('compania', 'rol', 'tercero'), ['usuario' => $usuario]);
 }
 public function error403()
 {
     $error = null;
     if (\Session::has('error')) {
         $error = \Session::get('error');
     }
     return response(view("errors.403", compact('error')), 403);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $Ciudad = \App\Ciudad::All()->lists('nombreCiudad', 'idCiudad');
     $entrevista = \App\Entrevista::find($id);
     $Tercero = \App\Tercero::where('Tercero_idEmpleadorContratista', "=", \Session::get('idTercero'))->lists('nombreCompletoTercero', 'idTercero');
     $cargo = \App\Cargo::where('Compania_idCompania', "=", \Session::get('idCompania'))->lists('nombreCargo', 'idCargo');
     return view('entrevista', compact('cargo', 'Tercero', 'Ciudad'), ['entrevista' => $entrevista]);
 }
Example #18
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public static function index()
 {
     // $pageViews= \Tracker::sessions(60*24);
     $pageViews = \Tracker::sessions(60 * 24);
     $count = count($pageViews);
     $range = \Tracker::pageViews(60 * 24 * \Session::get('tracker.stats.days'));
     return View::make('admin.admin-content')->with('pageViews', $pageViews)->with('range', $range)->with('count', $count);
 }
 public function index()
 {
     $cvId = DB::table('CV')->where('employeeId', \Session::get('employeeId'))->select('employeeId')->get();
     if ($cvId) {
         \session::flash('cvId', $cvId);
     }
     return \View::make("index");
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $evento = new Calendario($request->all());
     $evento->company_id = \Session::get('id_empresa');
     $evento->user_id = \Auth::user()->id;
     $evento->save();
     return response()->json(['id' => $evento->getKey()]);
 }
Example #21
0
 public function __construct()
 {
     $this->middleware('auth');
     //Validação de permissão de acesso a pagina
     if (Gate::allows('verifica_permissao', [\Config::get('app.grupos'), 'acessar'])) {
         $this->dados_login = \Session::get('dados_login');
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $tercero = \App\Tercero::where('Compania_idCompania', '=', \Session::get('idCompania'))->lists('nombreCompletoTercero', 'idTercero');
     $idTercero = \App\Tercero::where('Compania_idCompania', '=', \Session::get('idCompania'))->lists('idTercero');
     $nombreCompletoTercero = \App\Tercero::where('Compania_idCompania', '=', \Session::get('idCompania'))->lists('nombreCompletoTercero');
     $planCapacitacion = \App\PlanCapacitacion::find($id);
     return view('plancapacitacion', compact('tercero', 'idTercero', 'nombreCompletoTercero'), ['planCapacitacion' => $planCapacitacion]);
 }
Example #23
0
 public function articlesbytag($id)
 {
     $choosenLang = \Session::get('locale');
     $tags = Tag::where('lang', '=', $choosenLang)->get();
     $tag = Tag::findOrFail($id);
     $articles = $tag->articles()->paginate(2);
     return view('index', compact('articles', 'tags'));
 }
Example #24
0
 public function getIdEjeEstrategico()
 {
     $get_eje = \DB::table('eje_estrategico')->select('id')->where('id_plan_de_desarrollo', '=', \Session::get('id_plan'))->get();
     $id_eje = array_map(function ($get_id_eje) {
         return $get_id_eje->id;
     }, $get_eje);
     return $id_eje;
 }
 public function edit($id)
 {
     $country_list = Countries::all();
     $user = User::find($id);
     $errors = \Session::get('msg');
     $timezones = Timezones::all();
     return view('auth.display_user', compact('user', 'country_list', 'errors', 'timezones'));
 }
Example #26
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     if (CNF_FRONT == 'false' && $request->segment(1) == '') {
         return Redirect::to('dashboard');
     }
     $page = $request->segment(1);
     if ($page != '') {
         $content = \DB::table('tb_pages')->where('alias', '=', $page)->where('status', '=', 'enable')->get();
         //print_r($content);
         //return '';
         if (count($content) >= 1) {
             $row = $content[0];
             $this->data['pageTitle'] = $row->title;
             $this->data['pageNote'] = $row->note;
             $this->data['pageMetakey'] = $row->metakey != '' ? $row->metakey : CNF_METAKEY;
             $this->data['pageMetadesc'] = $row->metadesc != '' ? $row->metadesc : CNF_METADESC;
             $this->data['breadcrumb'] = 'active';
             if ($row->access != '') {
                 $access = json_decode($row->access, true);
             } else {
                 $access = array();
             }
             // If guest not allowed
             if ($row->allow_guest != 1) {
                 $group_id = \Session::get('gid');
                 $isValid = isset($access[$group_id]) && $access[$group_id] == 1 ? 1 : 0;
                 if ($isValid == 0) {
                     return Redirect::to('')->with('message', \SiteHelpers::alert('error', Lang::get('core.note_restric')));
                 }
             }
             if ($row->template == 'backend') {
                 $page = 'pages.' . $row->filename;
             } else {
                 $page = 'layouts.' . CNF_THEME . '.index';
             }
             //print_r($this->data);exit;
             $filename = base_path() . "/resources/views/pages/" . $row->filename . ".blade.php";
             if (file_exists($filename)) {
                 $this->data['pages'] = 'pages.' . $row->filename;
                 //	print_r($this->data);exit;
                 return view($page, $this->data);
             } else {
                 return Redirect::to('')->with('message', \SiteHelpers::alert('error', \Lang::get('core.note_noexists')));
             }
         } else {
             return Redirect::to('')->with('message', \SiteHelpers::alert('error', \Lang::get('core.note_noexists')));
         }
     } else {
         $this->data['pageTitle'] = 'Home';
         $this->data['pageNote'] = 'Welcome To Our Site';
         $this->data['breadcrumb'] = 'inactive';
         $this->data['pageMetakey'] = CNF_METAKEY;
         $this->data['pageMetadesc'] = CNF_METADESC;
         $this->data['pages'] = 'pages.home';
         $page = 'layouts.' . CNF_THEME . '.index';
         return view($page, $this->data);
     }
 }
Example #27
0
 public function orderDetail()
 {
     if (count(\Session::get('cart')) <= 0) {
         return redirect()->route('home');
     }
     $cart = \Session::get('cart');
     $total = $this->total();
     return view('store.order-detail', compact('cart', 'total'));
 }
Example #28
0
 public function view(Request $request)
 {
     if (!\Session::get('user')->is_admin()) {
         abort(401);
     }
     $id = $request->input('id');
     $user = User::find($id);
     return response()->json(['id' => $user->id, 'view' => (string) view('users/view', ['user' => $user])]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $account = new Accounts();
     $account->name = $request->name;
     $account->account_code = $request->code;
     $account->company_id = \Session::get('id_empresa');
     $account->save();
     return redirect('list_accounts');
 }
Example #30
0
 public function delete($id)
 {
     if (\Session::has('product8')) {
         \Session::forget('product8.' . $id);
         $kol = \Session::get('addToBasket');
         \Session::forget('addToBasket', $kol - 1);
     }
     return redirect('basket');
 }