예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('private' => 'numeric|required', 'title' => 'max:46|required', 'paste' => 'required', 'expire' => 'required|numeric', 'private' => 'required|numeric', 'tags' => 'max:6|alpha');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $messages = $validator->messages();
         return View::make('paste.form')->withErrors($messages);
     }
     $new_paste = new Paste();
     $new_paste->title = Input::get('title');
     $new_paste->token = Str::random(40);
     $new_paste->delete_token = Str::random(40);
     $new_paste->paste = Input::get('paste');
     $new_paste->private = Input::get('private');
     date_default_timezone_set('UTC');
     $expire_time = date('Y-m-d H:i:s', strtotime(sprintf('now + %s minutes', Input::get('expire'))));
     $new_paste->expire = $expire_time;
     if (!$new_paste->save()) {
         Debugbar::error('Saving failed!');
     }
     // Check if tags are set
     if (Input::has('hidden-tags')) {
         $tags = explode(' ', Input::get('hidden-tags'));
         foreach ($tags as $key => $tag) {
             $tag_model = new Tag();
             $tag_model->tag = $tag;
             $tag_model->paste_id = $new_paste->id;
             $new_paste->tags()->save($tag_model);
         }
     }
     if ($new_paste->id) {
         return Redirect::route('paste.show', $new_paste->token)->withCookie(Cookie::make('edittoken', $new_paste->token, 30));
     }
     return view::make('paste.form', array('page_title' => 'Create a paste'));
 }
예제 #2
0
 function traitEntityEdit()
 {
     //соберем форму
     $this->traitEntityEdit_formBuild();
     $this->form->initValues($this->model->toForm());
     $this->traitEntityEdit_formBuildAfter();
     if ($this->form->isSubmitted()) {
         $model_class = static::getClassModel();
         $data = $this->form->getValue();
         $data['id'] = $this->model->id;
         $validator = $model_class::getDataValidator($data, $this->form);
         //            dd($data);
         if ($validator->validate()) {
             //запись успешно сохранена
             $this->traitEntity_save($validator);
             //выведем сообщение об успешной вставке
             return $this->traitEntityEdit_success();
         } else {
             \Debugbar::addMessage($validator->getErrors());
             $this->form->setErrors($validator->getErrors());
             //$this->form->putTbStatic(\HtmlDiv::addClass('alert alert-danger')->setContent($validator->getErrors(true)));
         }
         //запись успешно сохранена
         //            $this->traitEntity_save();
         //            выведем сообщение об успешной вставке
         //            return $this->traitEntityEdit_success();
     }
     //форма показана в первый раз или с ошибками
     if (\Request::ajax()) {
         return $this->traitEntityEditJson();
     }
     return $this->traitEntityEditHtml();
 }
예제 #3
0
 public function get($key)
 {
     $val = \App\Config::where('key', $key)->pluck('value');
     \Debugbar::info($key . ' : ' . $val);
     $val = unserialize($val);
     return $val;
 }
예제 #4
0
 function traitEntityAdd()
 {
     //соберем форму
     $this->traitEntityAdd_formBuild();
     $this->traitEntityAdd_formBuildAfter();
     /** @var Model $model_class */
     $model_class = static::getClassModel();
     if ($this->form->isSubmitted()) {
         $validator = $model_class::getDataValidator($this->form->getValue(), $this->form);
         if ($validator->validate()) {
             //запись успешно сохранена
             $this->traitEntity_save($validator);
             //выведем сообщение об успешной вставке
             return $this->traitEntityAdd_success();
         } else {
             //                dd($validator->getErrors());
             \Debugbar::addMessage($validator->getErrors());
             $this->form->setErrors($validator->getErrors());
         }
     } else {
         $fill_labels = $this->model->getFillable();
         foreach ($fill_labels as $fillable) {
             if (null !== \Input::get($fillable)) {
                 $this->form->initValues([$fillable => \Input::get($fillable)]);
             }
         }
     }
     //форма показана в первый раз или с ошибками
     if (\Request::ajax()) {
         return $this->traitEntityAddJson();
     } else {
         return $this->traitEntityAddHtml();
     }
 }
예제 #5
0
 /**
  * [getData]
  * @return [type] [description]
  */
 public function getData()
 {
     $Model = $this->modelName;
     $all_reminders = $Model::all($this->dataTableColumns);
     $data = [];
     foreach ($all_reminders as $reminder) {
         // load relations
         $load_curr_project = $reminder->project;
         $load_curr_user = $reminder->user;
         $curr_reminder = $reminder;
         Debugbar::info($reminder);
         if (isset($reminder->user_id) && isset($reminder->project_id)) {
             $curr_proj = (object) ['id' => $reminder->reminder_id, 'name' => $reminder->project->name];
             $curr_user = (object) ['id' => $reminder->user_id, 'username' => $reminder->user->username];
             $curr_entry = (object) ['DT_RowId' => 'row_' . $reminder->id, 'reminders' => $curr_reminder, 'users' => $curr_user, 'projects' => $curr_proj];
             $data[] = $curr_entry;
         }
     }
     $all_projects = Project::orderBy('name', 'DESC')->get(['id', 'name']);
     $projects = [];
     foreach ($all_projects as $project) {
         $tmp_project = (object) ['value' => $project->id, 'label' => $project->name];
         $projects[] = $tmp_project;
     }
     $all_users = User::all(['id', 'username']);
     $users = [];
     foreach ($all_users as $user) {
         $tmp_user = (object) ['value' => $user->id, 'label' => $user->username];
         $users[] = $tmp_user;
     }
     $ret = ['data' => $data, 'projects' => $projects, 'users' => $users];
     return Response::json($ret);
 }
예제 #6
0
 /**
  * @param $password
  * @param $loginName
  * @param bool $flag
  * @return Users
  */
 public function getUserByCredential($password, $loginName, $flag = null)
 {
     if ($flag == null) {
         $flag = false;
     }
     \Debugbar::info($flag);
     // TODO: Implement getUserByCredential() method.
     if (!$flag) {
         $user = $this->model->newQuery()->with('getGroup')->where('email', '=', $loginName)->where('ugroup', '!=', 2)->where('Active', '=', 1)->first();
         if ($user != null) {
             if (\Hash::check($password, $user->getPassword())) {
                 \Debugbar::addMessage('hash matches - ' . Hash::make($password));
                 return $user;
             } else {
                 \Debugbar::addMessage('hash dose not match');
                 return null;
             }
         } else {
             return null;
         }
     } else {
         $user = $this->model->newQuery()->with('getGroup')->where('Password', '=', $password)->where('email', '=', $loginName)->where('Active', '=', 1)->first();
         if ($user != null) {
             return $user;
         } else {
             return null;
         }
     }
 }
 public function index()
 {
     $this->data['personales'] = Personal::where('tipoPersonal', '=', 'Voluntario')->get();
     $this->data['personalVoluntarioActive'] = 'active';
     Debugbar::info($this->data['personales']);
     return View::make('admin.personalVoluntario.index', $this->data);
 }
예제 #8
0
 public function update($id)
 {
     $user = User::find($id);
     if (!$user) {
         return $this->store();
     }
     $data = Input::all();
     if (!isset($data['username'])) {
         $data['username'] = $data['gebruikersnaam'];
     }
     if ($data['username'] == $user->username) {
         unset($data['username']);
     }
     $validator = Validator::make($data, User::$rulesUpdate);
     $validator->sometimes('function', 'unique:users', function ($input) {
         return $input->function != "";
     });
     if ($validator->fails()) {
         Session::flash('error', 'Er waren fouten met het opslaan');
         Debugbar::log($validator->messages());
         return Redirect::action('user.edit', $id)->withErrors($validator)->withInput();
     } else {
         $user->username = Input::get('username');
         $user->function = Input::get('function');
         $user->save();
         Session::flash('success', 'Gebruiker is aangepast!');
         return Redirect::action('user.edit', $id);
     }
 }
예제 #9
0
파일: Debug.php 프로젝트: xLink/Portfolio
 public static function console($var)
 {
     if (!class_exists('Debugbar') || app()->environment() === 'testing') {
         return;
     }
     \Debugbar::addMessage($var);
 }
예제 #10
0
 public function boot()
 {
     $this->loadViewsFrom(realpath(__DIR__ . '/../views'), 'maikblog');
     $this->publishes([realpath(__DIR__ . '/../views') => base_path('resources/views/vendor/maikblog')]);
     $this->setupRoutes($this->app->router);
     // this  for conig
     $this->publishes([__DIR__ . '/config/maikblog.php' => config_path('maikblog.php')], 'config');
     //this for migrations
     $this->publishes([__DIR__ . '/database/migrations/' => database_path('migrations')], 'migrations');
     //this for css and js
     $this->publishes([realpath(__DIR__ . '/../assets') => public_path('maiklez/maikblog')], 'public');
     \Validator::extend('tag_rule', function ($attribute, $value, $parameters) {
         $tags = explode(',', $value);
         // remove empty items from array
         $tags = array_filter($tags);
         // trim all the items in array
         $tags = array_map('trim', $tags);
         \Debugbar::info($tags);
         foreach ($tags as $tag) {
             if ($tag === "") {
                 return false;
             }
         }
         return true;
     });
     \Validator::replacer('tag_rule', function ($message, $attribute, $rule, $parameters) {
         return str_replace("no white spaces are allow");
     });
 }
예제 #11
0
 public function index()
 {
     $this->data['personales'] = Personal::all();
     $this->data['personalActive'] = 'active';
     Debugbar::info($this->data['personales']);
     return View::make('admin.personal.index', $this->data);
 }
예제 #12
0
 /**
  * Display a list of all blog post to admin.
  *
  * @param  Request  $request
  * @return Response
  */
 public function index(Request $request)
 {
     $posts = Post::all();
     $bestTag = Tag::with('postCount')->get()->sortByDesc('postCount');
     $bestCat = Category::with('postCount')->get()->sortByDesc('postCount');
     \Debugbar::info($bestTag);
     return view('maikblog::table', ['posts' => $posts, 'best_tag' => $bestTag, 'best_cat' => $bestCat]);
 }
 /**
  * Method for upload files
  *
  * @param Request $request
  * @param MediaRepositoryInterface $repositoryInterface
  * @return string
  */
 public function upload(Request $request, MediaRepositoryInterface $repositoryInterface)
 {
     \Debugbar::disable();
     $id = $repositoryInterface->create($request->file('file'), null, null);
     $answer = array('answer' => 'File transfer completed', 'id' => $id);
     $json = json_encode($answer);
     return $json;
 }
예제 #14
0
 public function index()
 {
     $this->data['beneficiarios'] = Beneficiario::all();
     $this->data['responsables'] = Personal::where('tipoPersonal', '=', '');
     Debugbar::info($this->data['beneficiarios']);
     $this->data['beneficiariosActive'] = 'active';
     return View::make('admin.beneficiarios.index', $this->data);
 }
 public function subtest()
 {
     $localeCode = LaravelLocalization::getCurrentLocale();
     $urltrans = trans('test::routes.subtest');
     \Debugbar::info($urltrans);
     $test = LaravelLocalization::getLocalizedURL($localeCode, route('test'));
     \Debugbar::info($test);
     return '<p>Sub-test</p><p><b>Language</b>: ' . $localeCode . '</p><p>Our translation url: ' . $urltrans . '</p>';
 }
예제 #16
0
 public function show($teamID, $year)
 {
     $team = Team::leftJoin('league', 'lgID', '=', 'league.id')->leftJoin('division', 'divID', '=', 'division.id')->where('teamID', '=', $teamID)->where('yearID', '=', $year)->first();
     \Debugbar::info($team);
     $battingGrids = BattingController::team($teamID, $year);
     $pitchingGrids = PitchingController::team($teamID, $year);
     $fieldingGrids = FieldingController::team($teamID, $year);
     return view('teams.show')->with(['team' => $team, 'year' => $year, 'battingGrids' => $battingGrids, 'pitchingGrids' => $pitchingGrids, 'fieldingGrids' => $fieldingGrids]);
 }
예제 #17
0
 public function login()
 {
     $credential = array('password' => \Input::get('password'), 'login' => \Input::get('email'));
     \Debugbar::info($credential);
     if (\Dobby::login($credential)) {
         return \Redirect::to('admin');
     }
     return view("admin.login");
 }
예제 #18
0
 public function getData()
 {
     $models = TaskTemplate::select($this->dataTableColumns);
     return Datatables::of($models)->addColumn('Group', function ($m) {
         $ret = TaskGroup::find($m->group_id)->name;
         Debugbar::info($ret);
         return $ret;
     })->removeColumn('group_id')->add_column('actions', '<a href="{{{ URL::to(\'/admin/tasktemplates/\' . $id . \'/edit\' ) }}}" class="iframe btn btn-xs btn-default cboxElement">{{{ Lang::get(\'button.edit\') }}}</a>
                                  <a href="{{{ URL::to(\'/admin/tasktemplates/\' . $id . \'/delete\' ) }}}" class="iframe btn btn-xs btn-danger cboxElement">{{{ Lang::get(\'button.delete\') }}}</a>')->make();
 }
예제 #19
0
 private static function checkLaravelCookie()
 {
     $cv = Request::cookie('laravel-remember');
     \Debugbar::error("laravel cookie: {$cv}");
     $uc = UserCookie::where('cookie', '=', $cv)->get()->first();
     if ($uc != null) {
         $user = User::where('id', '=', $uc->user_id)->get()->first();
         Auth::login($user);
     }
 }
예제 #20
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function pay()
 {
     \Pingpp\Pingpp::setApiKey('sk_test_urT4i5iPOCiHPmj5K0uLO0GK');
     $res = \Pingpp\Charge::create(array('order_no' => '0123456789', 'amount' => '100', 'app' => array('id' => 'app_9iLSeP8Oi5SGznbj'), 'channel' => 'upacp_pc', 'currency' => 'cny', 'client_ip' => '127.0.0.1', 'subject' => 'Your Subject', 'body' => 'Your Body', 'extra' => array('success_url' => 'http://www.jindanlan.com/')));
     \Debugbar::info($res);
     $content = $res;
     $status = 200;
     $value = "text/json";
     return response($content, $status)->header('Content-Type', $value);
 }
예제 #21
0
 /**
  *  Store a new DMCA notice.
  *
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(Request $request)
 {
     \Debugbar::debug($request->request);
     // debug($request);
     $notice = $this->createNotice($request);
     Mail::queue(['text' => 'emails.dmca'], compact('notice'), function ($message) use($notice) {
         $message->from($notice->getOwnerEmail())->to($notice->getRecipientEmail())->subject('DMCA Notice');
     });
     flash('Your DMCA notice has been delivered!');
     return redirect('notices');
 }
 public function getTemplate()
 {
     \Debugbar::disable();
     if (\App::environment() != 'prod') {
         $content = \File::get(base_path() . '/angular/app/views/modules' . \Input::get('tmp'));
     } else {
         $content = \File::get(base_path() . '/public/app/views/modules' . \Input::get('tmp'));
     }
     $response = \Response::make($content);
     return $response;
 }
예제 #23
0
 public function checkEmailExists(Request $request)
 {
     $email = $request->get('email');
     \Debugbar::info("comprovant email " . $email);
     //TODO comprovar email correctament
     if ($this->checkEmail($email)) {
         return "true";
     } else {
         return "false";
     }
 }
예제 #24
0
 public function root()
 {
     $items = ['Pack luggage', 'Go to airport', 'Arrive in San Juan'];
     // return $items;
     // \Log::debug($items);
     // 1 \Log::info('Just an informational message.');
     // 2 \Log::warning('Something may be going wrong.');
     // 3 \Log::error('Something is definitely going wrong.');
     // 4 \Log::critical('Danger, Will Robinson! Danger!');
     \Debugbar::error('Something is definitely going wrong.');
     return view('welcome');
 }
예제 #25
0
 function getSongs($perPage = 5)
 {
     Debugbar::log(isVoteRunning());
     global $artist;
     $artist = Input::get("artist");
     $title = Input::get("title");
     $data = Song::where(function ($q) {
         global $artist;
         $q->where('artist', 'LIKE', "%{$artist}%");
     })->where('title', 'LIKE', "%{$title}%", 'AND')->orderBy('updated_at', 'DESC')->paginate($perPage);
     return Response::json($data);
 }
예제 #26
0
 public function getActor($id)
 {
     $url = html_entity_decode("http://api.themoviedb.org/3/person/" . $id . "/movie_credits?");
     $options = array("api_key" => "af5b30b8759307d572388fceb9fa4331", "sort_by" => "release_date.desc");
     $url .= http_build_query($options, '', '&');
     $myData = file_get_contents($url) or die(print_r(error_get_last()));
     $movies = json_decode($myData);
     foreach ($movies->cast as $i => $v) {
         \Debugbar::info($v);
     }
     return view('index')->with('data', $movies->cast);
 }
예제 #27
0
 protected function view($view = null, $data = array(), $mergeData = array())
 {
     if (array_search('Barryvdh\\Debugbar\\LaravelDebugbar', get_declared_classes()) !== FALSE) {
         \Debugbar::startMeasure('admin_view', 'Admin view generation');
     }
     $this->loadBaseComposer();
     $content = view($view, array_merge($data, ['_ctrl' => $this]), $mergeData)->render();
     $content = view('admin::layout.base', ['content' => $content, '_ctrl' => $this]);
     if (array_search('Barryvdh\\Debugbar\\LaravelDebugbar', get_declared_classes()) !== FALSE) {
         \Debugbar::stopMeasure('admin_view');
     }
     return $content;
 }
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     \Debugbar::disable();
     //Get a list of allDuo Users subscribed to the DuoRegisteredUsersReport
     $users = User::whereHas('reports', function ($query) {
         $query->where('name', 'DuoRegisteredUsersReport');
     })->get();
     //Loop each user to generate report
     foreach ($users as $recipient) {
         $this->dispatch(new GenerateRegisteredDuoUsersReport($recipient));
         //            \Log::debug('Message will be sent to:',[$recipient->email]);
     }
 }
예제 #29
0
 public function index()
 {
     $items = array('items' => ['Pack luggage', 'Go to airport', 'Arrive in San Juan']);
     //dd($items);
     //\Log::error($items);
     /*
      $monolog = \Log::getMonolog();
      $monolog->pushHandler(new \Monolog\Handler\FirePHPHandler());
      $monolog->addInfo('Log Message',  $items);
     */
     \Debugbar::info('Something is wrong');
     return view('home');
 }
 /**
  * @param $path
  * @param array $data
  * @return string
  */
 protected function evaluatePath($path, array $data = [])
 {
     $preferences = $this->XSLTSimple->addChild('Preferences');
     $url = $preferences->addChild('url');
     $url->addAttribute('isHttps', Request::secure());
     $url->addAttribute('currentUrl', Request::url());
     $url->addAttribute('baseUrl', URL::to(''));
     $url->addAttribute('previousUrl', URL::previous());
     $server = $preferences->addChild('server');
     $server->addAttribute('curretnYear', date('Y'));
     $server->addAttribute('curretnMonth', date('m'));
     $server->addAttribute('curretnDay', date('d'));
     $server->addAttribute('currentDateTime', date('Y-m-d H:i:s'));
     $language = $preferences->addChild('language');
     $language->addAttribute('current', App::getLocale());
     $default_language = \Config::get('app.default_language');
     if (isset($default_language)) {
         $language->addAttribute('default', $default_language);
     }
     $languages = \Config::get('app.available_languages');
     if (is_array($languages)) {
         foreach ($languages as $lang) {
             $language->addChild('item', $lang);
         }
     }
     // from form generator
     if (isset($data['form'])) {
         $this->XSLTSimple->addChild('Form', form($data['form']));
     }
     // adding form errors to xml
     if (isset($data['errors'])) {
         $this->XSLTSimple->addData($data['errors']->all(), 'FormErrors', false);
     }
     // "barryvdh/laravel-debugbar":
     // adding XML tab
     if (true === class_exists('Debugbar')) {
         $dom = dom_import_simplexml($this->XSLTSimple)->ownerDocument;
         $dom->preserveWhiteSpace = false;
         $dom->formatOutput = true;
         $prettyXml = $dom->saveXML();
         // add new tab and append xml to it
         if (false === \Debugbar::hasCollector('XML')) {
             \Debugbar::addCollector(new \DebugBar\DataCollector\MessagesCollector('XML'));
         }
         \Debugbar::getCollector('XML')->addMessage($prettyXml, 'info', false);
     }
     $xsl_processor = new \XsltProcessor();
     $xsl_processor->registerPHPFunctions();
     $xsl_processor->importStylesheet(simplexml_load_file($path));
     return $xsl_processor->transformToXML($this->XSLTSimple);
 }