public function action_updateuserroles($user_id) { $user = User::find($user_id); $user->roles()->sync(Input::get('roles')); $url = URL::to_action('panel::site@editusers', array($user_id)) . '#roles'; return Redirect::to($url)->with('role_success', '1'); }
/** * Test the URL::to_action method. * * @group laravel */ public function testToActionMethodGeneratesURLToControllerAction() { Route::get('foo/bar/(:any?)', 'foo@baz'); $this->assertEquals('http://localhost/index.php/x/y', URL::to_action('x@y')); $this->assertEquals('http://localhost/index.php/x/y/Taylor', URL::to_action('x@y', array('Taylor'))); $this->assertEquals('http://localhost/index.php/foo/bar', URL::to_action('foo@baz')); $this->assertEquals('http://localhost/index.php/foo/bar/Taylor', URL::to_action('foo@baz', array('Taylor'))); }
public function action_index($folder = null) { //if ( ! Request::ajax()) //return; //Bundle::start('juploader'); $uploader = IoC::resolve('Uploader'); $uploader->with_uploader('Uploader\\DatabaseUploadHandler')->with_argument('1')->with_option('script_url', URL::to_action('juploader::dbupload@index'))->Start(); return $uploader->get_response(); }
public static function link_icon($action, $icon, $title = null, $parameters = array(), $attributes = array()) { $url = URL::to_action($action, $parameters); if (is_null($title)) { $title = $url; } $icon_tag = '<i class="icon-' . $icon . '"></i>'; return '<a href="' . $url . '"' . HTML::attributes($attributes) . ' title="' . $title . '">' . $icon_tag . '</a>'; }
public function get_index() { $view = View::make('appeal.index'); $view->url = URL::to_action('appeal@new'); $view->title = "Appeals Dashboard"; return $view; // echo "Hello! Welcome to the user management page!"; // $url = URL::to_action('appeal@new'); // echo "\nIf you would like to submit a new parking ticket appeal, please go here: <a href='{$url}'>New Appeal</a> }
public function get_index() { $openAppeals = Appeal::where('appealStatus', '=', '0')->count(); $closedAppeals = Appeal::where('appealStatus', '=', '1')->count(); $view = View::make('jboard.index'); $view->url = URL::to_action('appeal@new'); $view->openAppeals = $openAppeals; $view->closedAppeals = $closedAppeals; $view->title = "JBoard Dashboard"; return $view; }
@section('content') <h2>Pay attention!!</h2> <h3>This demo uses the DatabaseUploadHandler!</h3> <h4>in order to play with this demo you MUST migrate the bundle</h4> <pre>php artisan migrate juploader</pre> </br> <form id="dbfileupload" action="<?php echo URL::to_action('juploader::dbupload@index'); ?> " method="POST" enctype="multipart/form-data"> <?php echo Uploader\ButtonBar::create()->with_button(Uploader\Button::BUTTON_FILE, null, null, 'btn-inverse')->with_button(Uploader\Button::BUTTON_START, null, null, 'btn-inverse')->with_button(Uploader\Button::BUTTON_CANCEL, null, null, 'btn-inverse')->with_button(Uploader\Button::BUTTON_DELETE, null, null, 'btn-inverse')->with_button(Uploader\Button::BUTTON_SELECTALL, null, 'icon-check icon-white', 'btn-inverse'); ?> </form> {{ Uploader\Templater::showAll() }} <hr> <h3>View's Code:</h3> <pre class="prettyprint"> <form id="fileupload" action="<?php echo URL::to_action('juploader::dbupload@index'); ?>" method="POST" enctype="multipart/form-data"> <? $buttonFile = \Uploader\Button::fileButton()->with_label('Select File'); $buttonStart = new \Uploader\Button('Upload Now', "icon-upload icon-white", Uploader\Button::BUTTON_START, 'btn-success'); echo Uploader\ButtonBar::create() ->with_button(Uploader\Button::BUTTON_FILE, null, null, 'btn-inverse') ->with_button(Uploader\Button::BUTTON_START, null, null, 'btn-inverse') ->with_button(Uploader\Button::BUTTON_CANCEL, null, null, 'btn-inverse') ->with_button(Uploader\Button::BUTTON_DELETE, null, null, 'btn-inverse') ->with_button(Uploader\Button::BUTTON_SELECTALL, null, 'icon-check icon-white', 'btn-inverse'); ?>
/** * Extract image from text * * @param string * @return string */ function TEXT2IMG($text, $w = 320, $h = 200, $key = 0) { $tmp_text = trim($text); $tmp_text = Marker::decode($tmp_text); preg_match_all('/src="([^"]*)"/i', $tmp_text, $matches); if (!empty($matches[1])) { $file = PATH2FILE($matches[1][$key]); $thumbs = Config::get('cms::theme.thumb'); foreach ($thumbs as $val) { $file = str_replace($val['suffix'], '', $file); } $url = URL::to_action('cms::image@thumb', array($w, $h, $file)); return HTML::image($url, '', array('width' => $w, 'height' => $h)); } else { $thumbs = Config::get('cms::theme.thumb'); $url = URL::to_action('cms::image@thumb', array($w, $h, 'img_default.jpg')); return HTML::image($url, '', array('width' => $w, 'height' => $h)); } }
<?php echo render('partial.head'); ?> <h3 class="titlePart">Chansons</h3> <a class="linkAdd" href="<?php echo URL::to_action('song/add'); ?> " ><button class="buttonAdd"> Ajouter une nouvelle chanson </button></a> <table class="toSeek_result" id="tableContent"> <tr id="lineTitle"> <th class="toSeek_title"> Titre </th> <th class="toSeek_band"> Artiste </th> <th class="toSeek_album"> Album </th> <th class="toSeek_length"> Durée </th> <th class="toSeek_add"> Ajouter </th> <th class="toSeek_msg"> </th>
">Chansons</a></li> <li><a href="<?php echo URL::to_action('upload'); ?> ">Importer</a></li> </ul> <div class="clear"></div> </li> <li> <a href="#"><?php echo $user->get_username_user_lif(); ?> </a> <ul> <li><a href="">Mon profil</a></li> <li><a href="<?php echo URL::to_action('login@logout'); ?> ">Se déconnecter</a></li> </ul> </ul> </h3> <?php } ?>
public function get_logout() { Auth::logout(); return Redirect::to(URL::to_action('dojo::home@index')); }
/** * Generate an HTML link to a controller action. * * An array of parameters may be specified to fill in URI segment wildcards. * * <code> * // Generate a link to the "home@index" action * echo HTML::link_to_action('home@index', 'Home'); * * // Generate a link to the "user@profile" route and add some parameters * echo HTML::link_to_action('user@profile', 'Profile', array('taylor')); * </code> * * @param string $action * @param string $title * @param array $parameters * @param array $attributes * @return string */ public static function link_to_action($action, $title = null, $parameters = array(), $attributes = array()) { return static::link(URL::to_action($action, $parameters), $title, $attributes); }
echo HTML::script("http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"); ?> <?php echo HTML::script("js/master.js"); ?> <!--[if lte IE 8]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div id="container"> <div id="info"> <p>by <a href="http://ashic.us">ash white</a></p> <p>data from <a href="http://en.wikipedia.org/wiki/List_of_dates_predicted_for_apocalyptic_events">wikipedia</a></p> <div id="social"> <div id="twitter"> <a href="https://twitter.com/share" class="twitter-share-button" data-url="http://thegoddamnapocalypse.com" data-text="<?php echo Services\Twitter::tweetText($past_apocalypses); ?> " data-dnt="true">Tweet</a> </div> </div> </div> <h1><a href="<?php echo URL::to_action("/"); ?> ">THE GODDAMN APOCALYPSE</a></h1>
public function generatePermalink() { return \URL::to_action('blog::home@resolve', array($this->get_attribute('id'))); }
Route::post('/(:bundle)/articles/edit/update', array('as' => 'dojo::updated_article', 'uses' => 'Dojo::article@edit')); Route::put('/(:bundle)/articles/quick_edit/update', array('as' => 'dojo::update_mass', 'uses' => 'Dojo::article@update')); Route::any('/(:bundle)/articles/delete/(:any)', array('as' => 'dojo::delete_article', 'uses' => 'Dojo::article@erase')); Route::any('/(:bundle)/articles/new', array('as' => 'dojo::new_article', 'uses' => 'Dojo::article@new')); Route::any('/(:bundle)/articles/(:any?)/(:any?)/(:any?)', array('as' => 'dojo::index_article', 'uses' => 'Dojo::article@index')); Route::post('/(:bundle)/articles/search', array('uses' => 'Dojo::article@search')); Route::get('/(:bundle)/articles/results/(:all)', array('as' => 'dojo::results_article', 'uses' => 'Dojo::article@results')); //projects routes Route::any('/(:bundle)/projects/new/redactor', array('as' => 'dojo::new_image_project', 'uses' => 'Dojo::project@redactorupload')); Route::get('/(:bundle)/projects/edit/(:any)', array('as' => 'dojo::edit_project', 'uses' => 'Dojo::project@edit')); Route::post('/(:bundle)/projects/edit/update', array('as' => 'dojo::update_project', 'uses' => 'Dojo::project@edit')); Route::any('/(:bundle)/projects/delete/(:any)', array('as' => 'dojo::delete_project', 'uses' => 'Dojo::project@erase')); Route::any('/(:bundle)/projects/new', array('as' => 'dojo::new_project', 'uses' => 'Dojo::project@new')); Route::any('/(:bundle)/projects/(:any?)/(:any?)/(:any?)', array('as' => 'dojo::index_project', 'uses' => 'Dojo::project@index')); Route::post('/(:bundle)/projects/search', array('uses' => 'Dojo::project@search')); Route::get('/(:bundle)/projects/results/(:all)', array('as' => 'dojo::results_project', 'uses' => 'Dojo::project@results')); Route::put('/(:bundle)/projects/edit/update', array('as' => 'dojo::update_project', 'uses' => 'Dojo::project@update')); //settings Route::any('/(:bundle)/settings', array('uses' => 'Dojo::setting@index')); Route::any('/(:bundle)/settings/social', array('uses' => 'Dojo::setting@social')); Route::controller(Controller::detect('dojo')); Route::filter('auth', function () { if (Auth::guest()) { return Redirect::to(URL::to_action('dojo::login')); } }); Route::filter('csrf', function () { if (Request::forged()) { return Response::error('500'); } });
/** * FluxBB - fast, light, user-friendly PHP forum software * Copyright (C) 2008-2012 FluxBB.org * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public license for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * @category FluxBB * @package Core * @copyright Copyright (c) 2008-2012 FluxBB (http://fluxbb.org) * @license http://www.gnu.org/licenses/gpl.html GNU General Public License */ View::composer('fluxbb::layout.main', function ($view) { $view->with('language', 'en')->with('direction', 'ltr')->with('head', '')->with('page', 'index')->with('title', 'My FluxBB Forum')->with('desc', '<p><span>Unfortunately no one can be told what FluxBB is - you have to see it for yourself.</span></p>')->with('navlinks', '<ul><li><a href="#">Home</a></li></ul>')->with('status', 'You are not logged in.')->with('announcement', ''); }); View::composer('fluxbb::auth.login', function ($view) { $redirect_url = Session::get('fluxbb::login_redirect', URL::to_action('fluxbb::home@index')); $view->with('redirect_url', $redirect_url); });
<?php return array('login' => 'login', 'callback' => 'oneauth/callback', 'registered' => function () { $from_url = Session::get('from_url', URL::to_action('forums::home@index')); Session::forget('from_url'); return $from_url; }, 'logged_in' => function () { $from_url = Session::get('from_url', URL::to_action('forums::home@index')); Session::forget('from_url'); return $from_url; });
Route::get('profile/(:any)', 'panel::profile@index'); Route::get('profile/(:any)/github', 'panel::profile@github'); Route::group(array('before' => 'isGuest'), function () { Route::get('login', function () { return View::make('panel::login.login'); }); Route::get('login/special', function () { return View::make('panel::login.login_special'); }); Route::post('login', function () { $from_url = Session::get('from_url', URL::to_action('forums::home@index')); try { Auth::attempt(array('username' => Input::get('username'), 'password' => Input::get('password'), 'remember' => true), true); Session::forget('from_url'); return Redirect::to($from_url ? $from_url : URL::to_action('forums::home@index')); } catch (Exception $e) { return Redirect::to('login')->with('login_errors', true); } }); }); Route::group(array('before' => 'auth'), function () { Route::get('logout', function () { Auth::logout(); return Redirect::to('login'); }); Route::get('panel', function () { return View::make('panel::panel.index'); }); Route::get('panel/application', 'panel::applications@show'); Route::get('panel/avatar', 'panel::avatar@show');
<div class="span3"> <div class="image-place"> <div class="image-bar"> <div class="image-stat"><i class="icon-eye-open"></i> <?php echo $image->views; ?> </div> <div class="image-stat"><i class="icon-heart"></i> <?php echo $image->likes; ?> </div> </div> <div class="image-holder"> <a href="<?php echo URL::to_action('home@image', array($galleryID, $image->id)); ?> "> <img src="<?php echo URL::to_asset('images/' . $galleryID . '/thumbs/' . $image->name); ?> "> </a> </div> </div> </div> <?php if ($i != 0 && $i % 4 == 0) { echo '</div><div class="row">'; } $i++;
$alt = ''; if (!empty($attr[$key]->filetexts)) { $titles[$key] = ($caption and strlen($attr[$key]->filetexts[0]->caption) > 0) ? '#' . Str::random(10, 'alpha') : ''; $title = strlen($attr[$key]->filetexts[0]->title) > 0 ? ' title="' . $attr[$key]->filetexts[0]->title . '"' : ''; $alt = strlen($attr[$key]->filetexts[0]->alt) > 0 ? $attr[$key]->filetexts[0]->alt : ''; } else { $titles[$key] = ''; } ?> @if(strlen($image->pivot->url) > 0) <a href="{{SLUG($image->pivot->url)}}"{{$target}}{{$title}}> @endif <?php $img = $wm ? URL::to_action('cms::image@resize', array($image->w, $image->h, 'wm', $image->name)) : MEDIA_NAME($image->path, $thumb); ?> {{HTML::image($img, $alt, array('title' => $titles[$key]))}} @if(strlen($image->pivot->url) > 0) </a> @endif @endforeach </div> @if($caption and !empty($titles)) @foreach($images as $key => $image)
/** * THUMB Marker - Show a pre-config or on-the-fly resized thumb image linked to original * * [$THUMB[{ * "file":"<filename>", * "type":"<type of crop>" => (default: resize | available: resize || crop) * "thumb":"<type of thumb>", => (default: thumb | available as mapped in theme.php thumb array) * "path":"img_path | !img_path" => (point to full image path or $caption || $alt slug - default: img_path) * "caption":"false" => (default: false) * "w":"100", => OPTIONAL (overrides thumb) * "h":"100", => OPTIONAL (overrides thumb) * "x":"0", => OPTIONAL (if type crop, crop start x) * "y":"0", => OPTIONAL (if type crop, crop start y) * "wm":"true | false", => OPTIONAL * "id":"<id>", => OPTIONAL (id of <a>) * "class":"<class>", => OPTIONAL * "tpl":"<tpl_name>" => OPTIONAL (in /partials/markers) * }]] * * @param array * @return string */ public static function THUMB($vars = array()) { //Get variables from array $vars if (!empty($vars)) { extract($vars); } //Bind variables $_file = ''; if (isset($file) and !empty($file)) { $_file = $file; } $_type = 'resize'; if (isset($type) and !empty($type)) { $_type = $type; } $_thumb = 'thumb'; if (isset($thumb) and !empty($thumb)) { $_thumb = $thumb; } $_path = 'img_path'; if (isset($path) and !empty($path)) { $_path = $path; } $_caption = false; if (isset($caption) and !empty($caption) and $caption == 'true') { $_caption = true; } $_w = ''; if (isset($w) and !empty($w)) { $_w = $w; } $_h = ''; if (isset($h) and !empty($h)) { $_h = $h; } $_x = 0; if (isset($x) and !empty($x)) { $_x = $x; } $_y = 0; if (isset($y) and !empty($y)) { $_y = $y; } $_wm = 'no'; if (isset($wm) and !empty($wm) and $wm == 'true') { $_wm = 'wm'; } $_id = null; if (isset($id) and !empty($id)) { $_id = $id; } $_class = null; if (isset($class) and !empty($class)) { $_class = $class; } $_tpl = 'thumb'; if (isset($tpl) and !empty($tpl)) { $_tpl = $tpl; } //Get DB information if (!empty($_file)) { //CACHE DATA if (CACHE) { $file = Cache::remember('img_' . MEDIA_NOPOINT($_file) . '_' . SITE_LANG, function () use($_file) { return CmsFile::with(array('filetexts' => function ($query) { $query->where('lang', '=', SITE_LANG); }))->where_name($_file)->first(); }, 1440); } else { $file = CmsFile::with(array('filetexts' => function ($query) { $query->where('lang', '=', SITE_LANG); }))->where_name($_file)->first(); } //Get img dimension if (!empty($file) and !empty($_type)) { if ($_path == 'img_path') { //LOAD FANCYBOX LIBS Asset::container('header')->add('fancyboxcss', 'bundles/cms/css/fancybox.css', 'site_css'); Asset::container('footer')->add('fancybox', 'bundles/cms/js/jquery.fancybox.js', 'jquery_lib'); Asset::container('footer')->add('thumb', 'js/markers/thumb.js', 'site_js'); } if ($_type == 'resize') { // GET W OR H if (!empty($_w) or !empty($_h)) { $_filename = $file->name; $dim = MEDIA_DIM($file->w, $file->h, $_w, $_h); $url = URL::to_action('cms::image@resize', array($dim['w'], $dim['h'], $_wm, $_filename)); // GET THUMB, DEFAULT THUMB IF NONE } else { $_filename = MEDIA_NAME($_file, Config::get('cms::theme.thumb.' . $_thumb . '.suffix')); $dim['w'] = Config::get('cms::theme.thumb.' . $_thumb . '.width'); $dim['h'] = Config::get('cms::theme.thumb.' . $_thumb . '.height'); $url = MEDIA_NAME($file->path, Config::get('cms::theme.thumb.' . $_thumb . '.suffix')); } } if ($_type == 'crop') { $_filename = $file->name; $dim = array('w' => $_w, 'h' => $_h); $url = URL::to_action('cms::image@crop', array($_x, $_y, $_w, $_h, $_wm, $_filename)); } $full_path = $file->path; // Apply watermark if required if ($_wm == 'wm') { $full_path = URL::to_action('cms::image@resize', array($file->w, $file->h, $_wm, $file->name)); } } else { $_filename = ''; $dim['w'] = ''; $dim['h'] = ''; } //Load file alt and title if (!empty($file->filetexts)) { $title = $file->filetexts[0]->title; $alt = $file->filetexts[0]->alt; $caption = $file->filetexts[0]->caption; } else { $title = ''; $alt = ''; $caption = ''; } } else { $full_path = ''; $title = ''; $alt = ''; $caption = ''; $url = ''; $dim['w'] = ''; $dim['h'] = ''; } $img = HTML::image($url, $alt, array('id' => $_id, 'class' => $_class)); $options = array('id' => $_id, 'class' => $_class, 'title' => $title); if ($_path == 'img_path') { $options['rel'] = 'fancybox'; } else { $full_path = SLUG_FULL . '/' . Str::slug($alt != '' ? $alt : $caption); } $view = LOAD_VIEW($_tpl); $view['path'] = $full_path; $view['img'] = $img; $view['options'] = HTML::attributes($options); $view['caption'] = $_caption; $view['caption_text'] = $caption; return $view; }
<?php echo render('partial.head'); ?> <h3 class="titlePart">Groupes</h3> <a href="<?php echo URL::to_action('band/add'); ?> " ><button class="buttonAdd"> Ajouter un nouveau groupe </button></a> <table id="tableContent"> <tr id="lineTitle"> <th> Nom du groupe </th> <th> Date de formation </th> </tr> <?php foreach ($band as $value) { ?> <tr> <td> <?php echo $value->name_band; ?> </td> <td> <?php
<a <?php if ($id) { ?> id="<?php echo "{$action}_{$id}"; ?> " <?php } ?> class="autolist-action <?php echo $action; ?> " title="<?php echo $title; ?> " href="<?php echo URL::to_action($controller_action, array($id)); ?> "> <?php echo $text; ?> </a>
<?php echo render('partial.head'); ?> <?php ?> <h3 class="titlePart">Albums</h3> <a href="<?php echo URL::to_action('album/add'); ?> " ><button class="buttonAdd"> Ajouter un nouvel album </button></a> <table id="tableContent"> <tr id="lineTitle"> <th> Groupe </th> <th> Nom de l'album </th> <th> Date de production </th> </tr> <?php foreach ($album as $value) { ?>
<?php echo render('partial.head'); ?> <table id="addContentTable"> <tr> <td><strong>Ajout de contenu</strong></td> </tr> <tr> <td> <a href="<?php echo URL::to_action('band@index'); ?> " > <div class="addContentButton">Ajouter un groupe</div></a> </td> <td> <a href="<?php echo URL::to_action('album@index'); ?> " > <div class="addContentButton">Ajouter un album</div></a> </td> <td> <a href="<?php echo URL::to_action('song'); ?> " > <div class="addContentButton">Ajouter une chanson</div></a> </td> </tr> </table> <?php echo render('partial.foot');
private function _get_attribute_value($item, $attribute_details, $detail_view_action) { $value_store = $item; $raw_value = NULL; $attribute_parts = explode('.', $attribute_details['attribute']); foreach ($attribute_parts as $part) { $raw_value = $value_store->{$part}; if (!is_object($raw_value)) { break; } $value_store = $raw_value; } if ($attribute_details['decoder']) { $raw_value = $attribute_details['decoder']($raw_value); } $value = $attribute_details['auto_escape'] ? e($raw_value) : $raw_value; if ($attribute_details['linkify'] && !empty($raw_value)) { $linked_model = $value_store; $linked_model_class = get_class($linked_model); $link_url = false; if (is_callable($attribute_details['linkify'])) { $link_url = call_user_func($attribute_details['linkify'], $linked_model); } else { if (!empty($attribute_details['relation_config'])) { $permission_check = isset($attribute_details['relation_config']['permission_check']) && is_callable($attribute_details['relation_config']['permission_check']) ? $attribute_details['relation_config']['permission_check'] : Config::get('autolist::autolist.permission_check'); list($related_detail_view_action, $related_detail_view_permission_check) = $this->_get_detail_view_action_details($attribute_details['relation_config']); $link_url = URL::to_action($attribute_details['relation_config']['action_controller'] . "@{$related_detail_view_action}", array($linked_model->{$linked_model_class::$key})); if (!is_null($related_detail_view_permission_check) && !$related_detail_view_permission_check($linked_model, $linked_model->{$linked_model_class::$key}) || $permission_check && is_callable($permission_check) && !$permission_check($related_detail_view_action, $linked_model, $linked_model->{$linked_model_class::$key})) { $link_url = FALSE; } } else { $link_url = URL::to_action($this->config['action_controller'] . "@{$detail_view_action}", array($item->{$this->model_key})); } } if (!empty($link_url)) { $value = render(Config::get('autolist::autolist.views.detail_link'), array('id' => $item->{$this->model_key}, 'attribute' => $attribute_details['attribute'], 'action' => $detail_view_action, 'raw_value' => $raw_value, 'value' => $value, 'url' => $link_url)); } } return $value; }
$alt = ''; if (!empty($attr[$key]->filetexts)) { $titles[$key] = ($caption and strlen($attr[$key]->filetexts[0]->caption) > 0) ? '#' . Str::random(10, 'alpha') : ''; $title = strlen($attr[$key]->filetexts[0]->title) > 0 ? ' title="' . $attr[$key]->filetexts[0]->title . '"' : ''; $alt = strlen($attr[$key]->filetexts[0]->alt) > 0 ? $attr[$key]->filetexts[0]->alt : ''; } else { $titles[$key] = ''; } // CHECK IF W AND H $width = (is_null($w) and is_null($h)) ? $image->w : $w; $height = (is_null($h) and is_null($w)) ? $image->h : $h; // RESIZE IMAGE IF W AND H if (is_null($w) and is_null($h)) { $img = (strlen($thumb) > 0 and $wm == 'no') ? MEDIA_NAME($image->name, $thumb, true) : URL::to_action('cms::image@resize', array($width, $height, $wm, $image->name)); } else { $img = URL::to_action('cms::image@thumb', array($width, $height, $wm, $image->name)); } // CHECK LINK EXISTS $is_link = strlen($image->pivot->url) > 0 ? true : false; ?> @if($is_link) <a href="{{SLUG($image->pivot->url)}}"{{$target}}{{$title}}> @endif {{HTML::image($img, $alt, array('title' => $titles[$key]))}} @if($is_link) </a> @endif
public function action_postedit($topic_slug, $topic_id, $message_id) { $topic = Forumtopic::find($topic_id); if (is_null($topic)) { return Event::first('404'); } $category = $topic->category; $message = Forummessage::find($message_id); if (is_null($message)) { return Event::first('404'); } if ($message->user->id != Auth::user()->id && !Auth::user()->is('Forumer')) { return Event::first('404'); } $rules = array('content' => 'required|min:30'); $content = trim(Input::get('content')); $toValidate = compact('content'); $editTitle = false; if ($topic->messages[0]->id == $message->id && trim(Input::get('title')) != $topic->title) { $editTitle = true; $rules['title'] = 'required|min:2'; $title = trim(Input::get('title')); $toValidate['title'] = $title; } $validator = Validator::make($toValidate, $rules); if ($validator->fails()) { return Redirect::back()->with_errors($validator)->with_input(); } if ($editTitle) { $topic->title = $toValidate['title']; $topic->slug = Str::slug($toValidate['title']); $originalSlug = $topic->slug; $incSlug = 0; do { try { $topic->save(); $incSlug = 0; } catch (Exception $e) { if ($e->getCode() == 23000) { $incSlug++; } $topic->slug = $originalSlug . '-' . $incSlug; } } while ($incSlug != 0); } $message->content = BBCodeParser::parse($content); $message->content_bbcode = $content; $message->save(); $topic->touch(); $topic_id = $topic->id; $topic_slug = $topic->slug; $url = URL::to_action('forums::topic@index', compact('topic_slug', 'topic_id')) . '?page=last#message' . $message->id; return Redirect::to($url); }
Route::any('(:bundle)/role/search', 'cms::search@search_role'); Route::any('(:bundle)/tag/search', 'cms::search@search_tag'); Route::any('(:bundle)/user/search', 'cms::search@search_user'); //CMS CONTROLLERS Route::controller(Controller::detect('cms')); //CMS FILTER BACKEND Route::filter('cms_no_auth', function () { //FORCE LOGOUT IF NOT ROLE if (Auth::check() and ROLE < Config::get('cms::settings.roles.editor')) { return Redirect::to_action('cms::login'); } if (Auth::guest()) { return Redirect::to_action('cms::login'); } }); Route::filter('cms_is_auth', function () { if (Auth::check() and URL::current() != URL::to_action('cms::logout') and ROLE >= Config::get('cms::settings.roles.editor')) { return Redirect::to_action('cms::dashboard'); } }); Route::filter('save_session_credentials', function () { //Save session credentials if (Auth::check()) { Session::put('USERNAME', Auth::user()->username); Session::put('AUTHORID', Auth::user()->id); Session::put('ROLE', Auth::user()->role_level); Session::put('CMSLANG', Auth::user()->lang); Session::put('LANG', Config::get('cms::settings.language')); Session::put('EDITOR', Auth::user()->editor); } });
<?php Route::controller(Controller::detect('admin')); Route::filter('auth', function () { if (Auth::guest()) { return Redirect::to(URL::to_action('admin::login')); } });