コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function editSave(Request $request)
 {
     $allowed = array('png', 'jpg', 'gif');
     $hasil = false;
     $image = 'holder.js/180x180';
     $results = new \StdClass();
     $validator = \Validator::make($request->all(), ['nama' => 'required', 'mode' => 'required']);
     $destination = ParentFrontpage::UPLOAD_PATH;
     $result = '';
     if ($validator->passes()) {
         if ($request->has('id') && $request->input('id') != 'xxx') {
             $result = ParentFrontpage::find($request->input('id'));
             $results->info = 'menu frontpage update';
             $results->status = 1;
         } else {
             $result = new ParentFrontpage();
             $results->info = 'menu frontpage create';
             $results->status = 1;
         }
         $results->message = 'Proses Pengubahan Menu Sukses!';
         $result->nama = $request->input('nama');
         $result->mode = $request->input('mode');
         $result->redirect = $request->input('redirect');
         $result->publicKey = $request->input('puKey');
         $result->privateKey = $request->input('prKey');
         if ($request->hasFile('image')) {
             if ($request->file('image')->isValid()) {
                 $filename = date('YmdHis') . str_pad(rand(0, 1000), 4, 0, STR_PAD_LEFT) . '.' . $request->file('image')->guessExtension();
                 $img = \Image::make($request->file('image'))->fit(180, 180)->save($destination . $filename);
                 $result->image = $filename;
             }
         }
         $result->save();
     } else {
         $results->info = 'menu frontpage';
         $results->status = 0;
         $results->message = 'Proses Pengubahan Menu Gagal!';
     }
     $results->result = $result;
     return response()->json($results);
 }
コード例 #2
0
ファイル: ApiAuth.php プロジェクト: k1m0ch1/egor
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $application = Application::find($request->get('application_id'));
     $time = $request->get('time', 0);
     $key = $request->get('key');
     if ($time < time() - API_TOKEN_EXPIRATION_TIME) {
         $response = ['response' => 'FAILED', 'statusCode' => 403, 'message' => 'Request token expired', 'time' => time()];
         return response()->json($response);
     }
     if (!$application) {
         $response = ['response' => 'FAILED', 'statusCode' => 403, 'message' => 'Unauthorized access: Unknown application_id'];
         return response()->json($response);
     }
     if (hash('sha256', APP_API_KEY . $application->private_key . $time) != $key) {
         $response = ['response' => 'FAILED', 'statusCode' => 403, 'message' => 'Unauthorized access'];
         return response()->json($response);
     }
     return $next($request);
 }
コード例 #3
0
ファイル: GridController.php プロジェクト: k1m0ch1/egor
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function savePosition(Request $request)
 {
     $data = $request->input('dataWaw');
     $jumlahData = $request->input('size');
     $table = array();
     foreach ($data as $d) {
         $result = ParentFrontpage::find($d[0]);
         if (is_null($result)) {
             dd($d[0]);
         }
         $result->position = $d[1];
         $result->save();
         array_push($table, $result);
     }
     $results = new \StdClass();
     $results->success = 1;
     $results->info = 'grid position store';
     $results->message = ' Proses perpindahan grid sukses. ';
     $results->result = $table;
     return response()->json($results);
 }
コード例 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $result1 = DB::table('parent_menu')->get();
     $siteTitle = Setting::where('name', 'title')->get();
     if (count($siteTitle) > 0) {
         $bah = $siteTitle->first()->value;
     } else {
         $bah = 'Website';
     }
     $datanyah = ParentFrontpage::orderBy('position')->get();
     // Atur Grid Menu
     $h = Setting::where('name', 'grid_height')->get();
     if (count($h) > 0) {
         $h = $h->first()->value;
     } else {
         $h = 3;
     }
     $w = Setting::where('name', 'grid_width')->get();
     if (count($w) > 0) {
         $w = $w->first()->value;
     } else {
         $w = 3;
     }
     $bg = Setting::where('name', 'background')->get();
     if (count($bg) > 0) {
         $bg = asset('/uploads/background/') . '/' . $bg->first()->value;
     } else {
         $bg = 'assets/img/bg.jpg';
     }
     $footer = Setting::where('name', 'footer')->get();
     if (count($footer) > 0) {
         $footer = $footer->first()->value;
     } else {
         $footer = '(c) 2015, Ordent, All Right Reserved.';
     }
     return view('frontend.index', compact('result1', 'bah', 'datanyah', 'h', 'w', 'bg', 'footer'));
 }
コード例 #5
0
ファイル: PagesController.php プロジェクト: k1m0ch1/egor
 public function index()
 {
     if (Auth::check() != 1) {
         Auth::attempt(['email' => '*****@*****.**', 'password' => 'guestguest']);
     }
     $result1 = DB::table('parent_menu')->get();
     $siteTitle = Setting::where('name', 'title')->get();
     if (count($siteTitle) > 0) {
         $bah = $siteTitle->first()->value;
     } else {
         $bah = 'Website';
     }
     $datanyah = ParentFrontpage::orderBy('position')->get();
     // Atur Grid Menu
     $h = Setting::where('name', 'grid_height')->get();
     if (count($h) > 0) {
         $h = $h->first()->value;
     } else {
         $h = 3;
     }
     $w = Setting::where('name', 'grid_width')->get();
     if (count($w) > 0) {
         $w = $w->first()->value;
     } else {
         $w = 3;
     }
     $bg = Setting::where('name', 'background')->get();
     if (count($bg) > 0) {
         $bg = asset('/uploads/background/') . '/' . $bg->first()->value;
     } else {
         $bg = 'assets/img/bg.jpg';
     }
     $logo = Setting::where('name', 'logo')->get();
     if (count($logo) > 0) {
         $logo = asset('/uploads/logo/') . '/' . $logo->first()->value;
         $logo = preg_replace('/\\s+/', '', $logo);
     } else {
         $logo = '#';
     }
     $footer = Setting::where('name', 'footer')->get();
     if (count($footer) > 0) {
         $footer = $footer->first()->value;
     } else {
         $footer = '(c) 2015, Ordent, All Right Reserved.';
     }
     if (Auth::check()) {
         $roles = Auth::user()->roles->first();
         $resultPermission = $roles->perms;
     } else {
         $resultPermission = array();
     }
     //ParentFrontpage::find($permissions->action)
     //DB::table('parent_frontpage')->where('id', $permissions->action)->orderBy('position', 'asc')->get()
     $datanyah = array();
     foreach ($resultPermission as $permissions) {
         if ($permissions->type == 'app') {
             //echo count(ParentFrontpage::find($permissions->action));
             if (count(ParentFrontpage::find($permissions->action)) > 0) {
                 array_push($datanyah, ParentFrontpage::find($permissions->action));
             }
         }
     }
     $datanyah = $this->array_msort($datanyah, array('position' => SORT_ASC));
     return view('frontend.index', compact('result1', 'bah', 'datanyah', 'h', 'w', 'bg', 'footer', 'resultPermission', 'logo'));
 }
コード例 #6
0
ファイル: DashboardController.php プロジェクト: k1m0ch1/egor
 public function delete(Request $request)
 {
     $del = ParentFrontpage::find($request->input('id'));
     $permission = Permission::where('name', $del->name)->get();
     if (count($permission) > 0) {
         foreach ($permission as $key => $p) {
             $p->delete();
         }
     }
     $del->delete();
     return $del == true ? 'success' : 'fail';
 }