Beispiel #1
0
 function show()
 {
     //        dd(Page::all()->toArray());
     $page = Page::orWhere(function ($query) {
         $query->where('url', '=', Request::path());
     })->orWhere(function ($query) {
         $query->where('url', '=', '/' . Request::path());
     })->orWhere(function ($query) {
         $query->where('url', '=', Request::url());
     })->orWhere(function ($query) {
         $query->where('url', '=', Request::route()->getPath());
     })->orWhere(function ($query) {
         $query->where('url', '=', '/' . Request::route()->getPath());
     })->get()->first();
     $ps = Post::where('page_id', '=', $page->id)->orderBy('sort', 'ASC')->orderBy('id', 'ASC')->get();
     $posts = [];
     foreach ($page->template()->first()->sections() as $sec) {
         $posts[$sec->name] = [];
     }
     foreach ($ps as $p) {
         $posts[$p->section()->first()->name][] = $p;
     }
     $pages = [];
     foreach (Page::all() as $pi) {
         $pages[$pi->name] = $pi;
     }
     $fn = str_replace('.blade.php', '', $page->template()->first()->filename);
     return View::make("aui/templates/" . $fn)->with('posts', $posts)->with('pages', $pages)->with('page', $page);
 }
Beispiel #2
0
 public function current($uri = false)
 {
     if ($uri) {
         return Request::url();
     }
     return Request::fullUrl();
 }
Beispiel #3
0
 public function get($breadcrumbs_data)
 {
     $bakery_data = [];
     foreach ($breadcrumbs_data as $route => $link_text) {
         $obj = new \stdClass();
         if ($route == '*') {
             $obj->url = Request::url();
             $obj->isCurrent = true;
         } else {
             $params = [];
             if (strpos($route, ':') !== false) {
                 list($route, $params) = explode(':', $route);
                 if (strpos($params, ',') !== false) {
                     $params = explode(',', $params);
                 } else {
                     $params = [$params];
                 }
             }
             $obj->url = route($route, $params);
             $obj->isCurrent = false;
         }
         $obj->title = $link_text;
         $bakery_data[] = $obj;
     }
     return $bakery_data;
 }
Beispiel #4
0
 /**
  * Build the Site Map
  */
 protected function buildSiteMap()
 {
     $postsInfo = $this->getPostsInfo();
     $dates = array_values($postsInfo);
     sort($dates);
     $lastmod = last($dates);
     $url = str_finish(Request::url(), '/');
     $xml = [];
     $xml[] = '<?xml version="1.0" encoding="UTF-8"?' . '>';
     $xml[] = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     $xml[] = '  <url>';
     $xml[] = "    <loc>{$url}</loc>";
     $xml[] = "    <lastmod>11.1.1982</lastmod>";
     $xml[] = '    <changefreq>daily</changefreq>';
     $xml[] = '    <priority>0.8</priority>';
     $xml[] = '  </url>';
     foreach ($postsInfo as $slug => $lastmod) {
         $xml[] = '  <url>';
         $xml[] = "    <loc>{$url}haberci/{$slug}</loc>";
         $xml[] = "    <lastmod>11</lastmod>";
         $xml[] = "  </url>";
     }
     $xml[] = '</urlset>';
     return join("\n", $xml);
 }
 public function put(Route $route, Request $request, Response $response)
 {
     $key = $this->makeCacheKey($request->url());
     if (!Cache::has($key)) {
         Cache::put($key, $response->getContent(), 60);
     }
 }
 /**
  * Redirect user to login using OAuth credentials.
  *
  * @return Illuminate\Support\Facades\Redirect $forward_url
  */
 public function redirect()
 {
     $comToken = $this->getNewComToken();
     Session::put('ComToken', $comToken);
     $callback = Request::url();
     $forward_url = $this->loginURL . "?ComToken=" . $comToken . "&callback_url=" . urlencode($callback);
     return Redirect::to($forward_url);
 }
 /**
  * Report an exception.
  *
  * @param Exception $exception
  */
 public function reportException(Exception $exception)
 {
     try {
         $attributes = ['user_id' => $this->getUserId(), 'class' => get_class($exception), 'message' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'trace' => $exception->getTraceAsString(), 'url' => Request::url(), 'ip' => $this->getIpAddress(), 'user_agent' => $this->getUserAgent(), 'created_at' => Carbon::now()];
         $this->getRepository()->insert($attributes);
         event(new ExceptionWasReported($exception));
     } catch (Exception $e) {
     }
 }
Beispiel #8
0
 public function onRun()
 {
     $settings = Settings::instance();
     $this->addCss('/plugins/hariadi/share/assets/css/share.css');
     foreach ($this->providers as $provider) {
         $this->page[$provider] = $settings->{$provider};
     }
     $this->page['url'] = Request::url();
 }
Beispiel #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>';
 }
Beispiel #10
0
 /**
  * @param Exception $e
  */
 private function _trackException(Exception $e)
 {
     $list = Config::get('track.emails', []);
     if (count($list) !== 0) {
         Mail::send('emails.exception', array('url' => Request::url(), 'exception' => $e->getMessage()), function ($message) use($e, $list) {
             foreach ($list as $email) {
                 $message->to($email, '')->subject(Config::get('app.name') . ': Error ' . $e->getCode());
             }
         });
     }
 }
Beispiel #11
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'https://api.tumblr.com/v2/share/stats?url=' . urlencode($this->getOption('url', Request::url()));
     $result = $this->fileGetContents($url);
     $count = isset($matches['response']['note_count']) ? $matches['response']['note_count'] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #12
0
 public static function save()
 {
     $self = strtok(Request::server('REQUEST_URI'), '?');
     $page = self::all();
     $page["back_post"] = Input::all();
     $page["back_url"] = Request::url();
     Session::put('rapyd.' . $self, $page);
     //var_export(Session::all());
     //echo "\n\n..";
     //var_export(Session::get('rapyd.'.$self.".back_post".".nome"));
     //die;
 }
Beispiel #13
0
 public function getSharedCount($url = '')
 {
     if (!$url) {
         $url = Request::url();
     }
     $link = 'https://api.facebook.com/method/links.getStats?format=json&urls=' . urlencode($url);
     $data = file_get_contents($link);
     $data = json_decode($data);
     // share_count
     $count = is_array($data) ? $data[0]->total_count : $data->total_count;
     return intval($count);
 }
Beispiel #14
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::check() === false) {
         Auth::logout();
         Session::put('return_url', Request::url());
         return redirect()->to('/admin-login');
     }
     if (Auth::user()->hasRole('admin') === false) {
         return (new Logout())->getLogout();
     }
     return $next($request);
 }
Beispiel #15
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'https://vk.com/share.php?act=count&index=1&url=' . urlencode($this->getOption('url', Request::url()));
     $result = $this->fileGetContents($url);
     preg_match('~VK\\.Share\\.count\\(\\d+,\\s*(\\d+)\\);~', $result, $matches);
     $count = isset($matches[1]) ? $matches[1] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #16
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'http://graph.facebook.com/?id=' . urlencode($this->getOption('url', Request::url()));
     $result = $this->fileGetContents($url);
     $result = json_decode($result, true);
     $count = isset($result['shares']) ? $result['shares'] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #17
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'https://plusone.google.com/_/+1/fastbutton?url=' . urlencode($this->getOption('url', Request::url())) . '&count=true';
     $result = $this->fileGetContents($url);
     preg_match('~aggregateCount[^>]+>(\\d+)</div>~', $result, $matches);
     $count = isset($matches[1]) ? $matches[1] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #18
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'https://connect.ok.ru/dk?st.cmd=extLike&uid=hai&ref=' . urlencode($this->getOption('url', Request::url()));
     $result = $this->fileGetContents($url);
     preg_match("~^ODKL\\.updateCount\\('hai','(\\d+)'\\);~", $result, $matches);
     $count = isset($matches[1]) ? $matches[1] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #19
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'https://cdn.api.twitter.com/1/urls/count.json?url=' . urlencode($this->getOption('url', Request::url()));
     $result = $this->fileGetContents($url);
     $result = json_decode($result, true);
     $count = isset($result['count']) ? $result['count'] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #20
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'http://www.linkedin.com/countserv/count/share?format=json&url=' . urlencode($this->getOption('url', Request::url()));
     $result = $this->fileGetContents($url);
     $result = json_decode($result, true);
     $count = isset($result['count']) ? $result['count'] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #21
0
 public function getSharedCount($url = '')
 {
     if (!$url) {
         $url = Request::url();
     }
     $link = 'https://vk.com/share.php?act=count&index=1&url=' . urlencode($url);
     $data = file_get_contents($link);
     $data = preg_match('/^VK.Share.count\\(\\d+,\\s+(\\d+)\\);$/i', $data, $matches);
     $count = 0;
     if (isset($matches[1])) {
         $count = $matches[1];
     }
     return intval($count);
 }
Beispiel #22
0
 public function getSharedCount($url = '')
 {
     if (!$url) {
         $url = Request::url();
     }
     $link = 'http://api.pinterest.com/v1/urls/count.json?url=' . urlencode($url);
     $data = file_get_contents($link);
     // fixme:
     $count = 0;
     if ($data) {
         $count = substr($data, 13, -1);
     }
     return intval($count);
 }
Beispiel #23
0
 public function getSharedCount($url = '')
 {
     if (!$url) {
         $url = Request::url();
     }
     $link = 'http://urls.api.twitter.com/1/urls/count.json?url=' . urlencode($url);
     $data = file_get_contents($link);
     $data = json_decode($data);
     $count = 0;
     if (isset($data->count)) {
         $count = $data->count;
     }
     return intval($count);
 }
Beispiel #24
0
 public function getCount()
 {
     $count = $this->getCache();
     if (!is_null($count)) {
         return $count;
     }
     $url = 'http://api.pinterest.com/v1/urls/count.json?callback=_&url=' . urlencode($this->getOption('url', Request::url()));
     $result = $this->fileGetContents($url);
     $result = trim($result, ')_(');
     $result = json_decode($result, true);
     $count = isset($result['count']) ? $result['count'] : 0;
     $this->setCache($count);
     return $count;
 }
Beispiel #25
0
 public function getSharedCount($url = '')
 {
     if (!$url) {
         $url = Request::url();
     }
     $link = 'https://plusone.google.com/_/+1/fastbutton?url=' . urlencode($url);
     $data = file_get_contents($link);
     preg_match('/window\\.__SSR = {c: ([\\d]+)/', $data, $matches);
     $count = 0;
     if (isset($matches[0])) {
         $count = str_replace('window.__SSR = {c: ', '', $matches[0]);
     }
     return $count;
 }
 public function index()
 {
     if (Input::get('l')) {
         LaravelLogViewer::setFile(base64_decode(Input::get('l')));
     }
     if (Input::get('dl')) {
         return Response::download(storage_path() . '/logs/' . base64_decode(Input::get('dl')));
     } elseif (Input::has('del')) {
         File::delete(storage_path() . '/logs/' . base64_decode(Input::get('del')));
         return Redirect::to(Request::url());
     }
     $logs = LaravelLogViewer::all();
     return View::make('log', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
 }
Beispiel #27
0
 static function displayCommons($totalAmount = 0)
 {
     $tester = false == empty($_COOKIE['tester']) && $_COOKIE['tester'] == 'tester' ? true : false;
     $tester = false == empty($_GET['tester']) && $_GET['tester'] == 'tester' ? true : $tester;
     self::addJsFooter('bootstrap/bootstrap-select.js');
     self::addJsFooter('jquery-ui/jquery.ui.autocomplete.js');
     self::addJsFooter('booking/select-autocomplete.js');
     self::addJsFooter('booking/init.js');
     view()->share(['CREDITO_GARBARINO_ID' => 0, 'gastos' => 0, 'datosVendedor' => false, 'osName' => "", 'intereses' => 0, 'bonificacion' => 0, 'cargosGestion' => 0, 'coefDescuento' => 0, 'descCargosGestion' => 0, 'testuser' => $tester, 'totalAmount' => $totalAmount, 'InstallmentsWOinterest' => self::getInstallmentsWOinterest(), 'InstallmentsWinterest' => self::getInstallmentsWinterest(), 'InstallmentsOtherBanks' => self::getInstallmentsOtherBanks(), 'InstallmentsUatp' => self::getInstallmentsUatp(), 'Nationalities' => self::getNationalities(), 'CitiesAutocomplete' => '/compra/CitiesAutocomplete', 'FormAction' => Request::url() . '?' . http_build_query(\Request::all()), 'States' => self::getStates(), 'Months' => self::getMonths()]);
     Controller::addCss('1200.css');
     Controller::addCss('booking.css');
     if (true === $tester) {
         self::addJsFooter('booking/tester.js');
     }
 }
 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()]);
 }
 public function getIndex()
 {
     AssetManager::addScript('admin::default/js/datatables/jquery.dataTables.min.js');
     AssetManager::addScript('admin::default/js/datatables/jquery.dataTables_bootstrap.js');
     AssetManager::addScript('admin::default/js/notify-combined.min.js');
     AssetManager::addStyle('admin::default/css/dataTables.bootstrap.css');
     if (Input::get('l')) {
         LaravelLogViewer::setFile(base64_decode(Input::get('l')));
     }
     if (Input::get('dl')) {
         return Response::download(storage_path() . '/logs/' . base64_decode(Input::get('dl')));
     } elseif (Input::has('del')) {
         File::delete(storage_path() . '/logs/' . base64_decode(Input::get('del')));
         return Redirect::to(Request::url());
     }
     $logs = LaravelLogViewer::all();
     $view = View::make('an-admin::page.log-viewer', ['logs' => $logs, 'files' => LaravelLogViewer::getFiles(true), 'current_file' => LaravelLogViewer::getFileName()]);
     return Admin::view($view, trans('an-admin::lang.log-viewer.title'));
 }
 /**
  * Transform an exception to attachment array for slack post
  *
  * @param E $e
  *
  * @return array
  */
 protected static function exceptionToSlackAttach(E $e)
 {
     $fields = [];
     $addToField = function ($name, $value, $short = false) use(&$fields) {
         if (!empty($value)) {
             $fields[] = ["title" => $name, "value" => $value, "short" => $short];
         }
     };
     $addToField("Exception", get_class($e), true);
     $addToField("Hash", ExceptionHelper::hash($e), true);
     $addToField("Http code", ExceptionHelper::statusCode($e), true);
     $addToField("Code", $e->getCode(), true);
     $addToField("File", $e->getFile(), true);
     $addToField("Line", $e->getLine(), true);
     $addToField("Request url", Request::url(), true);
     $addToField("Request method", Request::method(), true);
     $addToField("Request param", json_encode(Request::all()), true);
     return ["color" => "danger", "title" => $e->getMessage(), "fallback" => !empty($e->getMessage()) ? $e->getMessage() : get_class($e), "fields" => $fields, "text" => $e->getTraceAsString()];
 }