コード例 #1
0
ファイル: Guest.php プロジェクト: pingpongcms/core
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (auth()->check()) {
         return cms()->redirect('/');
     }
     return $next($request);
 }
コード例 #2
0
 protected function listenRoutes()
 {
     $this->app->booted(function ($app) {
         $router = $app['router'];
         $router->group(['prefix' => cms()->prefix(), 'middleware' => config('cms.middleware')], function () use($router) {
             event('backend.routes', $router);
         });
     });
 }
コード例 #3
0
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     View::addNamespace("theme", cms('theme'));
     require __DIR__ . '/../menu.php';
     $this->publishesConfig();
     $this->publishesRoutes();
     $this->publishesThemeFolder();
     $this->publishesAssets();
 }
コード例 #4
0
ファイル: PostsController.php プロジェクト: pingpongcms/post
 public function store(Request $request)
 {
     $data = $request->all();
     $data['user_id'] = $request->user()->id;
     if ($request->has('save_as_draft')) {
         $data['published_at'] = null;
     } else {
         $data['published_at'] = Carbon::now();
     }
     $post = $this->repository->create($data);
     return cms()->redirect('posts');
 }
コード例 #5
0
ファイル: global.php プロジェクト: rmolodyko/cms_api
/**
 * Получить материал
 * @see CMS::material
 * @param string 		$selector	Значение для поиска материала
 * @param CMSMaterial 	$cmsmat		Переменная в коротую будет возвращен найденный материал
 * @param string 		$field		Имя поля по которому выполняется поиск
 * @return boolean Найден ли материал или нет
 */
function ifcmsmat($selector, &$cmsmat = NULL, $field = 'Url')
{
    // Get CMS reference and make it static
    static $_c;
    $_c = isset($_c) ? $_c : cms();
    // Get material
    $cmsmat = $_c->material($selector, $field);
    // If we did not get cmsmaterial
    if ($cmsmat === null) {
        return false;
    }
    // Everything is ok
    return true;
}
コード例 #6
0
 /**
  * Override to report to CMS log
  *
  * {@inheritdoc}
  */
 public function report(Exception $e)
 {
     if ($this->shouldReport($e)) {
         cms()->log($e);
     }
 }
コード例 #7
0
ファイル: routes.php プロジェクト: pingpongcms/core
<?php

$namespace = 'Pingpong\\Cms\\Core\\Http\\Controllers';
Route::group(['namespace' => $namespace . '\\Auth'], function () {
    Route::controller('auth', 'AuthController', ['getLogin' => 'login.index', 'postLogin' => 'login.store', 'getRegister' => 'register.index', 'postRegister' => 'register.store', 'getLogout' => 'logout', 'getConfirmation' => 'user.confirmation']);
    Route::controller('password', 'PasswordController', ['getEmail' => 'password.email.index', 'postEmail' => 'password.email.store', 'getReset' => 'password.reset.index', 'postReset' => 'password.reset.store']);
});
Route::group(['prefix' => cms()->prefix(), 'middleware' => config('cms.middleware'), 'namespace' => $namespace], function () {
    Route::get('/', ['as' => 'admin.index', 'uses' => 'CoreController@index']);
});
コード例 #8
0
ファイル: Table.php プロジェクト: samsonos/cms_app_material
 /**
  * Constructor
  * @param Navigation $nav Parent CMSNav to filter materials
  * @param string $search Keywords to search in materials
  * @param string $page Current table page number
  * @param \samson\core\IViewable $renderer Table renderer
  */
 public function __construct(Navigation &$nav = null, $search = null, $page = null, $renderer = null)
 {
     // Save parent cmsnav
     $this->nav =& $nav;
     // Set current module or use passed renderer
     $this->renderer = isset($renderer) ? $renderer : m();
     // Save search keywords
     $this->search = $search;
     $prefix = $this->setPagerPrefix();
     // Create pager
     $this->pager = new \samson\pager\Pager($page, self::ROWS_COUNT, $prefix);
     // Collection of filtered material identifiers
     $filteredIDs = array();
     $searchOrStructureFlag = false;
     // If search filter is set - add search condition to query
     if (isset($this->search[0]) && $this->search != '0') {
         // Create additional fields query
         $searchQuery = dbQuery('materialfield')->join('material');
         // Create or condition
         $searchCondition = new Condition('OR');
         // Iterate all possible material fields
         foreach (cms()->material_fields as $f) {
             // Create special condition for additional field
             $cg = new Condition('AND');
             $cg->add(new Argument('FieldID', $f->FieldID))->add(new Argument('Value', '%' . $search . '%', dbRelation::LIKE));
             // Add new condition to group
             $searchCondition->add($cg);
         }
         // Add all search conditions from material table
         foreach ($this->search_fields as $item) {
             $searchCondition->add(new Argument('material_' . $item, '%' . $search . '%', dbRelation::LIKE));
         }
         // Set condition
         $searchQuery->cond($searchCondition);
         // Get filtered identifiers
         $filteredIDs = $searchQuery->fieldsNew('MaterialID');
         $searchOrStructureFlag = true;
     }
     // Create DB query object
     $this->query = dbQuery('\\samson\\activerecord\\material')->cond('parent_id', 0)->cond('Draft', 0)->cond('Active', 1)->own_order_by('Modyfied', 'DESC');
     // Perform query by structure-material and get material ids
     $ids = array();
     if (isset($nav) && dbQuery('samson\\cms\\CMSNavMaterial')->cond('StructureID', $nav->id)->cond('Active', 1)->fields('MaterialID', $ids)) {
         // Set corresponding material ids related to specified navigation
         if (sizeof($filteredIDs)) {
             $filteredIDs = array_intersect($filteredIDs, $ids);
         } else {
             $filteredIDs = $ids;
         }
         $searchOrStructureFlag = true;
     }
     // If we have filtration identifiers
     if (sizeof($filteredIDs)) {
         // Add the, to query
         $this->query->id($filteredIDs);
     } elseif ($searchOrStructureFlag) {
         $this->query->id(0);
     }
     $this->queryHandler();
     // Call parent constructor
     parent::__construct($this->query, $this->pager, $this->renderer);
 }
コード例 #9
0
ファイル: web.php プロジェクト: artisancms/core
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
Route::get('/', cms('routes.root'));
Route::get('post', function () {
    return view('theme::post');
});
Route::get('about', function () {
    return view('theme::about');
});
Route::get('contact', function () {
    return view('theme::contact');
});
Route::get('/home', 'HomeController@index');
コード例 #10
0
ファイル: menus.php プロジェクト: pingpongcms/core
<?php

Menu::create('sidebar', function ($menu) {
    $menu->setPresenter('Pingpong\\Cms\\Core\\Presenters\\Menus\\SidebarPresenter');
    $menu->setPrefixUrl(cms()->prefix());
    $menu->enableOrdering();
    $menu->header('MAIN NAVIGATION');
    $menu->url('/', 'Dashboard', 1, ['icon' => 'fa fa-dashboard']);
});
コード例 #11
0
ファイル: CMSMaterial.php プロジェクト: rmolodyko/cms_api
 /**
  * Get array of CMSNavigation object for this material
  * @return array Collection of CMSNav objects
  */
 public function cmsnavs()
 {
     // Perfrom DB request to get all connected cmsnavs
     $cmsnavs = array();
     if (dbQuery('samson\\cms\\CMSNavMaterial')->MaterialID($this->id)->exec($db_nms)) {
         // Gather CMSNavs object to array
         foreach ($db_nms as $db_nm) {
             $cmsnavs[] = cms()->navigation($db_nm->StructureID, 'id');
         }
     }
     return $cmsnavs;
 }
コード例 #12
0
 /**
  * @param ModuleInterface $module
  * @return array
  */
 public function transform(ModuleInterface $module)
 {
     return ['key' => $module->getKey(), 'name' => $module->getName(), 'version' => $module->getVersion(), 'class' => $module->getAssociatedClass(), 'links' => [['rel' => 'self', 'uri' => cms()->apiRoute('modules.show', [$module->getKey()])]]];
 }