public function __construct() { $this->userdata = $this->checkUserdata(); // apply authorization filter $this->beforeFilter(function () { if (!$this->userdata && Request::segment(1) !== 'login') { return Redirect::to('/login'); } }); // templates for app errors App::missing(function ($exception) { return Response::view('errors.404_cms', array(), 404); }); App::error(function (Exception $exception, $code) { Log::error($exception); if ($code == 403) { return Response::view('/errors/error_403', array(), 403); } }); // shared assets Orchestra\Asset::add("bootstrap-css", "assets/css/bootstrap.min.css"); Orchestra\Asset::add("bootstrap-theme", "assets/css/bootstrap-theme.min.css"); Orchestra\Asset::add("font-awesome", "assets/css/font-awesome.min.css"); Orchestra\Asset::add("cms-css", "assets/css/cms.css"); Orchestra\Asset::add("jquery", "assets/js/jquery.js"); Orchestra\Asset::add("bootstrap-js", "assets/js/bootstrap.min.js"); Orchestra\Asset::add("handlers-js", "assets/js/handlers.js"); // shared views View::share("active_menu_id", 1); View::share("userdata", $this->userdata); // configuration Config::set("view.pagination", "common/pagination"); }
/** * Setup the layout used by the controller. * * @return void */ protected function setupLayout() { if (!is_null($this->layout)) { $this->layout = View::make($this->layout); } View::share('currentUser', Auth::user()); }
public function getIndex($location = '') { $loading_arr = Config::get('loading'); $loading = $loading_arr[array_rand($loading_arr)]; View::share('location', $location); $this->layout->content = View::make('index', compact('loading')); }
public function __construct() { $this->locales = Config::get('app.locales'); $this->module = array('name' => self::$name, 'group' => self::$group, 'rest' => self::$group, 'tpl' => static::returnTpl('admin/dicvals'), 'gtpl' => static::returnTpl(), 'entity' => self::$entity, 'entity_name' => self::$entity_name); View::share('module', $this->module); View::share('CLASS', __CLASS__); }
function index() { View::share('big_title', 'Edit Content Template'); // $getdata = $this->html->get_id($ids); // // $view['arr_action'] = ['#'=>'Choose An Action','/blast/template/draf'=>'Save As Draft','/blast/template/receiver'=>'Send Blast']; // // $view['action'] = ""; if (Input::has('id')) { $id = Input::get('id'); $getjson = $this->html->get_id($id); } else { $getjson = $this->html->get_last(); } $jsonform = json_decode($getjson->form); $view['template'] = $this->html->get_all(); $view['json'] = $getjson->form; // $view['form'] = $this->cform; foreach ($jsonform as $key => $value) { $view['html'][] = $this->cform->generate($key, $value->element, $value->label, Session::get($key)); $view['label'][] = $value->label; } $view['mail_name'] = Session::get('mail_name'); // $view['header'] = Session::get('header'); // $view['content'] = Session::get('content'); $view['twitter'] = Session::get('twitter'); $view['email'] = Session::get('email'); $view['facebook'] = Session::get('facebook'); $view['linkedin'] = Session::get('linkedin'); $view['notip'] = Session::get('notip'); $this->layout->content = View::make('blast_email/index', $view); }
public function doMeta() { $error = false; // Set our metadata Metadata::set(Input::except(['user', 'pass', '_token'])); Metadata::set('theme', 'default'); // Check the Stripe API key is valid try { Stripe::setApiKey(Metadata::item('stripe_key')); Stripe\Balance::retrieve(); } catch (Exception $e) { $error = 'That Stripe key doesn’t look valid!'; } // Create the user if (User::whereEmail(Input::get('user'))->exists()) { // We're installing, can't have users already (I think) // $error = 'Somebody’s already signed up with that email address!'; } else { User::create(['username' => 'admin', 'name' => 'Administrator', 'level' => User::level('admin'), 'email' => Input::get('user'), 'password' => Input::get('pass')]); } if ($error === false) { return Redirect::to('install/done'); } View::share('error', $error); return self::showMeta(); }
/** * __construct * * @return void */ public function __construct() { parent::__construct(); API::$component = 'admin'; $this->url = Config::get('layla.admin.url_prefix') . '/'; View::share('base_url', URL::base()); }
/** * add/update agency * @param integer $id */ function showUpdate($id = 0) { $this->data['id'] = $id; View::share('jsTag', HTML::script("{$this->assetURL}js/select.js")); // get list Category $categoryModel = new CategoryBaseModel(); $this->data['listCategory'] = $categoryModel->getAllForm(0, 0, 'Run of Network'); // get list Flight Objective $this->data['listFlightObjective'] = Config::get('data.flight_objective'); $this->loadLeftMenu('menu.flightList'); // WHEN UPDATE SHOW CURRENT INFOMATION if ($id != 0) { $this->loadLeftMenu('menu.flightUpdate'); $item = $this->model->with('category', 'campaign', 'publisher', 'publisherSite', 'publisher_ad_zone')->find($id); if ($item) { $this->data['item'] = $item; } else { return Redirect::to($this->moduleURL . 'show-list'); } } if (Request::isMethod('post')) { if ($this->postUpdate($id, $this->data)) { return $this->redirectAfterSave(Input::get('save')); } } $this->layout->content = View::make('showUpdate', $this->data); }
public function __construct() { $this->currentUser = \Auth::user(); \View::share('currentUser', $this->currentUser); $this->routesNamespace = config('authcluster.login_name_space') . '.'; $this->viewsNamespace = config('authcluster.views_name_space') . '::'; }
/** * Initializer. * * @access public * @return BaseController */ public function __construct() { $is_admin = Request::is('admin*'); $is_backend = Request::is('backend*'); /* Set middleware(s) based on route URLs */ if ($is_admin || $is_backend) { $this->middleware('auth'); if ($is_backend) { // Backend specific middleware $this->middleware('auth.backend'); } $this->middleware('auth.permissions'); if (!Request::is('*users/change-password')) { // No validation for stale password if password is being changed $this->middleware('auth.pw_6_months'); } } list($this->link_type, $this->link, $this->layout, $this->current_theme) = current_section(); View::share('link_type', $this->link_type); View::share('current_theme', $this->current_theme); $website_settings = Setting::lists('value', 'name')->all(); View::share('website_settings', $website_settings); $locale = Setting::value('language'); App::setLocale($locale); Lang::setLocale($locale); $this->user = current_user(); View::share('current_user', $this->user); View::share('current_user_companies', current_user_companies()); }
public static function returnRoutes($prefix = null) { $dics_for_cache = ['projects', 'types']; foreach ($dics_for_cache as $dic_name) { ## Refresh dics cache #Cache::forget('dic_' . $dic_name); $dic_[$dic_name] = Cache::get('dic_' . $dic_name); if (!$dic_[$dic_name]) { Cache::forget('dic_' . $dic_name); $dic_[$dic_name] = Dic::valuesBySlug($dic_name, function ($query) { $query->orderBy('lft', 'ASC'); }, ['allfields', 'alltextfields'], true, true, true); #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); #die; $dic_[$dic_name] = DicLib::loadImages($dic_[$dic_name], ['avatar', 'image', 'logo', 'photo', 'header_img']); #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); #die; Cache::add('dic_' . $dic_name, $dic_[$dic_name], self::$global_cache_min); } View::share('dic_' . $dic_name, $dic_[$dic_name]); #Helper::d($dic_name); Helper::ta($dic_{$dic_name}); } #Helper::tad($dic_{'city'}); #die; Route::group(array('prefix' => '{lang}'), function () { Route::any('/project/{slug}', array('as' => 'app.project', 'uses' => __CLASS__ . '@appProject')); #Route::any('/ajax/send-message', array('as' => 'ajax.send-message', 'uses' => __CLASS__.'@postSendMessage')); #Route::any('/ajax/some-action', array('as' => 'ajax.some-action', 'uses' => __CLASS__.'@postSomeAction')); }); Route::group(array(), function () { #Route::any('/ajax/send-message', array('as' => 'ajax.send-message', 'uses' => __CLASS__.'@postSendMessage')); #Route::any('/ajax/some-action', array('as' => 'ajax.some-action', 'uses' => __CLASS__.'@postSomeAction')); }); }
/** * Setup the layout used by the controller. * * @return void */ protected function setupLayout() { View::share("h4ss2_groups", Sentry::findAllGroups()); if (!is_null($this->layout)) { $this->layout = View::make($this->layout); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function error() { $list_language = AppLanguage::all(); dd($list_language); View::share('list_language', $list_language); return view('errors.404'); }
public function __construct() { View::share('active', ''); View::share('account', Session::get('account')); View::share('character_name', Session::get('character_name', '')); View::share('server', Session::get('server', '')); }
public function getEdit($custom_field_id) { $customfield = CustomField::find($custom_field_id); View::share('campoextra', $customfield); View::share('fieldtypes', $this->customFieldsMangaer->getTypes()); $this->layout->content = View::make('backend.camposextra.layout')->nest('content', 'backend.camposextra.form'); }
/** * add/update agency * @param integer $id */ function showUpdate($id = 0) { $this->data['id'] = $id; View::share('jsTag', HTML::script("{$this->assetURL}js/select.js")); // get list Category $categoryModel = new CategoryBaseModel(); $this->data['listCategory'] = $categoryModel->getAllForm(0); // get list Ad Format $AdFormatModel = new AdFormatBaseModel(); $this->data['listAdFormat'] = $AdFormatModel->getAllForm(); // get list Type $this->data['listAdType'] = Config::get('data.ad_type'); // get list Wmode $this->data['listWmode'] = Config::get('data.wmode'); // WHEN UPDATE SHOW CURRENT INFOMATION if ($id != 0) { $item = $this->model->with('campaign', 'adFormat')->find($id); if ($item) { $this->data['item'] = $item; } else { return Redirect::to($this->moduleURL . 'show-list'); } } if (Request::isMethod('post')) { if ($this->postUpdate($id, $this->data)) { return $this->redirectAfterSave(Input::get('save')); } } $this->layout->content = View::make('showUpdate', $this->data); }
public function __construct() { $viTypes = Common::getObjectLanguage('TypeNew', LANG_VI, 'position'); $enTypes = Common::getObjectLanguage('TypeNew', LANG_EN, 'position'); View::share('viTypes', $viTypes); View::share('enTypes', $enTypes); }
private function getMasterDatas() { $data['categories'] = Category::orderBy('title')->get(); View::share('categories', $data['categories']); $data['locations'] = Location::all(); View::share('locations', $data['locations']); }
public function loadEvent($id) { $squeeb = Lecture::where('id', '=', $id)->first(); View::share('squeeb', $squeeb); view::share('model', 'Event'); return View::make('guest.squeeb'); }
/** * Prepare admin CRUD vars */ private static function prepare_data_vars() { /** * Default controller */ $data['default_controller'] = Config::get('admin/_config.default_controller', 'dashboard'); /** * Section */ $data['section'] = Request::segment(2) ? strtolower((string) Request::segment(2)) : $data['default_controller']; /** * action */ $data['action'] = Request::segment(3) ? strtolower((string) Request::segment(3)) : 'index'; /** * ID */ $data['id'] = Request::segment(4) ? strtolower((int) Request::segment(4)) : 0; /** * Parent ID */ $data['parent'] = Request::segment(5) ? strtolower((int) Request::segment(5)) : 0; /** * Push data */ self::$_data += $data; // pr($data); /** * Share data to view */ View::share($data); }
public function __construct() { parent::__construct(); $db = Config::get('database.default'); if ($db != null) { View::share('navLinks', Admin_Menu::menuGenerator()); View::share('sidebar', Navigator::sidebar()); View::share('breadcrumb', Navigator::breadcrumb()); } $class = get_called_class(); if (!Request::ajax()) { switch ($class) { case 'Home_Controller': $this->filter('before', 'nonauth'); break; case 'Setup_Controller': $this->filter('before', 'nonauth'); break; case 'Admin_Auth_Controller': $this->filter('before', 'auth')->except(array('authenticate', 'verifyupdate', 'logout')); break; default: $this->filter('before', 'auth'); break; } } }
public function __construct() { $sites = (new WebSite())->getList(); $user = GithubLogin::getLoginUser(); $validSites = array(); $adminSites = array(); foreach ($sites as $m) { if (!empty($user->permissions[$m['siteId']])) { $validSites[] = $m; if (DeployPermissions::havePermission(DeployPermissions::WRITE, $user->permissions[$m['siteId']])) { $adminSites[] = $m['siteId']; } } } $isSuperUser = false; $i = 0; while (!empty($_ENV["SUPER_USERS.{$i}"])) { if ($_ENV["SUPER_USERS.{$i}"] == $user->login) { $isSuperUser = true; break; } $i++; } $this->validSites = $validSites; View::share('sites', $validSites); View::share('isSuperUser', $isSuperUser); View::share('adminSites', $adminSites); }
protected function setUp() { $this->current_route = Route::getCurrentRoute()->getName(); $this->logged_user = Sentry::getUser(); View::share('logged_user', $this->logged_user); View::share('current_route', $this->current_route); }
function index() { $path = base_path() . '/aset/upload/'; if (Input::has('id_template')) { $ids = Input::get('id_template'); $allform = $_POST; $allimage = $_FILES; View::share('idstemp', $ids); foreach ($allimage as $keyfile => $valuefile) { if ($valuefile['name'] != "") { $fname = explode(".", $valuefile['name']); $ext = end($fname); $filename = $keyfile . strtotime(date('Y-m-d H:i:s')) . '.' . $ext; $tempname = $valuefile['tmp_name']; move_uploaded_file($tempname, $path . $filename); $allform[$keyfile] = $filename; Session::flash($keyfile, $filename); } } $gettemplate = $this->template->get_id($ids); foreach ($allform as $keyform => $valueform) { Session::flash($keyform, $valueform); $view[$keyform] = $valueform; } $view['template'] = $gettemplate->file; $this->layout->content = View::make('mail.' . $view['template'] . '.preview', $view); } else { Session::flash('notip', '<div class="alert alert-warning">Tidak ada template yang dipilih</div>'); return Redirect::to('/blast/create'); } }
/** * Check for added admin menu's */ public function __construct() { // Get loaded providers $providers = array_keys(\App::getLoadedProviders()); // Get Tdt matches, but not core $packages = preg_grep('/^Tdt[\\\\](?!Core)/i', $providers); $menu = $this->core_menu; // Check for UI controller foreach ($packages as $package) { // Get package namespace $reflector = new \ReflectionClass($package); $namespace = $reflector->getNamespaceName(); // Check for a UI controller $controller = $namespace . "\\Ui\\UiController"; if (class_exists($controller)) { // Create controller instance $controller = \App::make($controller); $package_menu = @$controller->menu(); // Check for added menu items if (!empty($package_menu)) { $menu = array_merge($menu, $package_menu); } // Push for future use array_push($this->package_controllers, $controller); } } // Sort menu's usort($menu, function ($a, $b) { return $a['priority'] - $b['priority']; }); // Share menu with views \View::share('menu', $menu); }
public function __construct() { View::share(array('theme' => get_current_theme(), 'pages' => array('products', 'categories', 'pages', 'purchases'), 'results' => array('Users' => admin_path('users'), 'Settings' => admin_path('settings'), 'Log out' => admin_path('logout')), 'welcome_message' => Plugin::fire('admin.welcome_message', 'Welcome to Aviate!')->last())); // Don't use Bootstrap-style inputs Former::framework('Nude'); return $this->beforeFilter('auth|install'); }
/** * Initializer. * * @access public * @return \BaseController */ public function __construct() { $this->beforeFilter('csrf', array('on' => 'post')); $action = explode('@', Route::current()->getAction()['controller'])[1]; Log::info($action); View::share('action', $action); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { // $banner = Banner::all(); View::share('selected_option', 'Agregar Banner'); return View::make('banner.add')->with('banner', $banner); }
/** * Display the specified resource. * GET /frontend/publiccontact/{id} * * @param int $id * @return Response */ public function show($id) { try { $contact = Contact::findOrFail($id); $articles = News::inCategories(Config::get('settings.homepage'))->where('published', '=', 2)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(10)->get(); $featured = News::where('published', '=', 2)->where('featured', '=', 1)->where('post_type', '=', 1)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->orderBy('created_at', 'desc')->take(3)->get(); $results = News::inCategories(Config::get('settings.results'))->distinct('permalink')->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('published', '=', 2)->where('post_type', '=', 1)->groupBy('permalink')->orderBy('news.created_at', 'desc')->take(10)->get(); $featuredImage = News::inCategories(array(25))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(3)->get(); $didYouKnow = News::inCategories(array(30))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(3)->get(); $magazine = News::inCategories(Config::get('settings.magazine'))->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('published', '=', 2)->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get(); $ourComment = News::inCategories(array(17))->where('published', '=', 2)->where('news.created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->where('post_type', '=', 1)->distinct('permalink')->groupBy('news.id')->orderBy('news.created_at', 'desc')->take(4)->get(); $feed = getFeed('http://bazaznanja.puskice.org/feed/qa.rss', 4); $poll = null; $poll = Poll::where('published', '=', '1')->where('end_date', '>', date("Y-m-d H:i:s", strtotime('now')))->where('created_at', '<', date("Y-m-d H:i:s", strtotime('now')))->first(); if (isset($poll->id)) { $poll->pollOptions; } View::share('title', $contact->title . " " . $contact->first_name . " " . $contact->last_name . " | Пушкице | Тачка спајања студената ФОН-а"); $ogimage = Puskice::firstContactImage($contact); $meta = "\t<meta property='og:image' content='" . $ogimage . "'/>\n\t\t\t\t\t\t<meta property='og:title' content='" . __($contact->title . " " . $contact->first_name . " " . $contact->last_name . " | Пушкице | Тачка спајања студената ФОН-а") . "'/>\n\t\t\t\t\t\t<meta property='fb:app_id' content='355697367892039'/>\n\t\t\t\t\t\t<meta property='og:site_name' content='" . __("Пушкице - ФОН Андерграунд") . "'/>\n\t\t\t\t\t\t<meta property='og:type' content='article'/>\n\t\t\t\t\t\t<meta property='og:url' content='" . _l(Request::root() . "/ljudi/" . $contact->id) . "'/>\n\t\t\t\t\t\t<meta property='og:description' content='" . __($contact->description) . "' />\n\t\t\t\t\t\t<meta name='twitter:card' content='summary_large_image'>\n\t\t\t\t\t\t<meta name='twitter:site' content='" . __("Пушкице - ФОН Андерграунд") . "'>\n\t\t\t\t\t\t<meta name='twitter:creator' content='@puskice'>\n\t\t\t\t\t\t<meta name='twitter:domain' content='puskice.org'>\n\t\t\t\t\t\t<meta name='twitter:app:name:iphone' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:app:name:ipad' content='" . __("Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:title' content='" . __($contact->title . " " . $contact->first_name . " " . $contact->last_name . " | Пушкице") . "'>\n\t\t\t\t\t\t<meta name='twitter:description' content='" . __($contact->description) . "'>\n\t\t\t\t\t\t<meta name='twitter:image' content='" . $ogimage . "'>"; $data = array('articles' => $articles, 'featured' => $featured, 'results' => $results, 'ourComment' => $ourComment, 'magazine' => $magazine, 'featuredImage' => $featuredImage, 'didYouKnow' => $didYouKnow, 'feed' => $feed, 'poll' => $poll, 'meta' => $meta, 'contact' => $contact); $this->setLayout($data); $this->layout->center = View::make('frontend.content.contact', $data); } catch (Exception $e) { App::abort(404); } }
public function getIndex() { $minigraph_data = array(); $minigraph_data['account_created'] = $this->graphDataBuild('account_created'); $minigraph_data['login'] = $this->graphDataBuild('login'); $minigraph_data['activity'] = $this->graphDataBuild('activity'); $minigraph_data['activity_unique'] = $this->graphDataBuild('activity', '5', true); View::share('minigraph_data', $minigraph_data); View::share('minigraph_json', json_encode($minigraph_data)); $widgets = $this->widgets(); View::share('widgets', $widgets); $results = DB::select('SELECT email FROM users WHERE UNIX_TIMESTAMP(`last_activity`) > ?', array(time() - 600)); View::share('whosonline', $results); $stocksTable = Lava::DataTable('Stocks'); $stocksTable->addColumn('string', 'Week', 'count'); $stocksTable->addColumn('number', 'Hits', 'projected'); $stocksTable->addColumn('number', 'Unique', 'projected'); foreach (array_reverse($minigraph_data['activity']['data'], true) as $i => $d) { $data[0] = $i == 0 ? "This week" : Carbon::now()->subWeeks($i)->diffForHumans(); $data[1] = $d; $data[2] = $minigraph_data['activity_unique']['data'][$i]; $stocksTable->addRow($data); } Lava::LineChart('Stocks')->setConfig(); return Theme::make('admin/dashboard'); }