Ejemplo n.º 1
0
 public static function dispatch()
 {
     $path = str_replace(PATH, '', $_SERVER['REQUEST_URI']);
     $method = $_SERVER["REQUEST_METHOD"];
     foreach (self::$routes as $route) {
         if ($route['path'] == $path && $route['method'] == $method) {
             $name = 'controllers\\' . $route['controller'];
             $controller = new $name();
             if ($method == 'POST') {
                 $postdata = file_get_contents("php://input");
                 $request = json_decode($postdata);
                 return $controller->{$route}['action']($request);
             } else {
                 return $controller->{$route}['action']();
             }
         } elseif (strpos($path, $route['path']) !== false && $route['method'] == $method && array_key_exists('param', $route)) {
             $name = 'controllers\\' . $route['controller'];
             $controller = new $name();
             $param = str_replace($route['path'] . '/', '', $path);
             return $controller->{$route}['action']($param);
         }
     }
     $controller = new controllers\BaseController();
     return $controller->notFound();
 }
Ejemplo n.º 2
0
 public function __construct(ImageHandlerInterface $imageHandler, ConfigReaderInterface $reader)
 {
     parent::__construct($imageHandler, $reader);
     $this->imageHandler = $imageHandler;
     $this->reader = $reader;
     $this->config = Config::get("app.config");
 }
Ejemplo n.º 3
0
 /**
  * Create a new BrowseController instance.
  *
  * @param  \Tricks\Repositories\CategoryRepositoryInterface  $categories
  * @param  \Tricks\Repositories\TagRepositoryInterface  $tags
  * @param  \Tricks\Repositories\TrickRepositoryInterface  $tricks
  * @return void
  */
 public function __construct(CategoryRepositoryInterface $categories, TagRepositoryInterface $tags, TrickRepositoryInterface $tricks)
 {
     parent::__construct();
     $this->categories = $categories;
     $this->tags = $tags;
     $this->tricks = $tricks;
 }
Ejemplo n.º 4
0
 /**
  * Create a new UsersController instance.
  *
  * @param  \Tricks\Repositories\UserRepositoryInterface $users
  * @return void
  */
 public function __construct(UserRepositoryInterface $users, TagRepositoryInterface $tags, CategoryRepositoryInterface $categories)
 {
     parent::__construct();
     $this->users = $users;
     $this->tags = $tags;
     $this->categories = $categories;
 }
 /**
  * Create a new TrickController instance.
  *
  * @param  \Tricks\Repositories\TrickRepositoryInterface  $trick
  * @param  \Tricks\Repositories\TagRepositoryInterface  $tags
  * @param  \Tricks\Repositories\CategoryRepositoryInterface  $categories
  * @return void
  */
 public function __construct(TrickRepositoryInterface $trick, TagRepositoryInterface $tags, CategoryRepositoryInterface $categories)
 {
     parent::__construct();
     $this->beforeFilter('auth');
     $this->trick = $trick;
     $this->tags = $tags;
     $this->categories = $categories;
 }
 /**
  * Create a new UserController instance.
  *
  * @param \Tricks\Repositories\TrickRepositoryInterface  $tricks
  * @param \Tricks\Repositories\UserRepositoryInterface  $users
  */
 public function __construct(TrickRepositoryInterface $tricks, UserRepositoryInterface $users)
 {
     parent::__construct();
     $this->beforeFilter('auth', ['except' => 'getPublic']);
     $this->user = Auth::user();
     $this->tricks = $tricks;
     $this->users = $users;
 }
Ejemplo n.º 7
0
 /**
  * Create a new SitemapController instance.
  *
  * @param  \Tricks\Repositories\TrickRepositoryInterface  $tricks
  * @return void
  */
 public function __construct(TrickRepositoryInterface $tricks, CategoryRepositoryInterface $categories, TagRepositoryInterface $tags)
 {
     parent::__construct();
     $this->tricks = $tricks;
     $this->tags = $tags;
     $this->categories = $categories;
     $this->sitemap = App::make("sitemap");
 }
 /**
  * Create a new TrickController instance.
  *
  * @param  \Tricks\Repositories\TrickRepositoryInterface  $trick
  * @param  \Tricks\Repositories\TagRepositoryInterface  $tags
  * @param  \Tricks\Repositories\CategoryRepositoryInterface  $categories
  * @return void
  */
 public function __construct(TrickRepositoryInterface $trick, TagRepositoryInterface $tags, CategoryRepositoryInterface $categories)
 {
     parent::__construct();
     $this->beforeFilter('auth');
     $this->beforeFilter('trick.owner', ['only' => ['getEdit', 'postEdit', 'getDelete']]);
     $this->trick = $trick;
     $this->tags = $tags;
     $this->categories = $categories;
 }
 /**
  * Public constructor
  */
 public function __construct()
 {
     parent::__construct();
     try {
         $this->profileModel = new ProfileModel();
     } catch (DatabaseException $e) {
         (new ErrorsController())->error503();
     }
 }
Ejemplo n.º 10
0
 public function __construct()
 {
     parent::__construct();
     $this->data["userAuthorized"] = false;
     $this->addBefore("update", array("userLogged", "userAuthorized"));
     $this->addBefore("profile", array("userLogged"));
     $this->addBefore("settings", array("userLogged"));
     $this->addBefore("updateAvatar", array("userLogged"));
     $this->addBefore("delete", array("userLogged", "userAuthorized"));
 }
Ejemplo n.º 11
0
 public function __construct()
 {
     parent::__construct();
     $this->addBefore("create", array("userLogged"));
     $this->addBefore("delete", array("userLogged", "load", "loadPermission", "isOwner"));
     $this->addBefore("show", array("userLogged", "load", "loadPermission"));
     $this->addBefore("update", array("userLogged", "load", "loadPermission", "isOwner"));
     $this->addBefore("addUsers", array("userLogged", "load", "loadPermission", "isOwner"));
     $this->addBefore("removeUser", array("userLogged", "load", "loadPermission", "isOwner"));
     $this->addBefore("newGroup", array("userLogged"));
     $this->addBefore("usersList", array("userLogged", "load"));
     $this->data["permission"] = 0;
 }
Ejemplo n.º 12
0
 public function __construct()
 {
     parent::__construct();
     $this->addBefore("new", array("userLogged"));
     $this->addBefore("show", array("load", "loadPermission", "loadComments"));
     $this->addBefore("create", array("userLogged"));
     $this->addBefore("createView", array("userLogged"));
     $this->addBefore("updatePermissions", array("userLogged", "load", "loadPermission"));
     $this->addBefore("delete", array("userLogged", "userAuthorized", "load", "loadPermission"));
     $this->addBefore("addFiles", array("userLogged", "load", "loadPermission"));
     $this->addBefore("addComment", array("userLogged", "load", "loadPermission"));
     $this->addBefore("deleteComment", array("userLogged", "load", "loadPermission"));
     $this->addBefore("comments", array("load", "loadPermission", "loadComments"));
     $this->addBefore("deleteFile", array("userLogged", "load", "loadPermission", "loadFile"));
     $this->addBefore("showFile", array("load", "loadPermission", "loadFile"));
     $this->addBefore("getFileContent", array("load", "loadPermission", "loadFile"));
     $this->addBefore("filesList", array("load", "loadPermission"));
     $this->addBefore("settings", array("userLogged", "load", "loadPermission"));
     $this->addBefore("update", array("userLogged", "load", "loadPermission"));
     $this->addBefore("updateFile", array("userLogged", "load", "loadPermission", "loadFile"));
     $this->data["fileExtensionAccept"] = array("txt", "php", "html", "css", "scss", "phtml", "js", "xml", "json", "yaml", "yml", "htm", "xml", "c", "cpp", "h", "class", "dist");
 }
Ejemplo n.º 13
0
 function __construct()
 {
     parent::__construct();
     $this->authService = App::getContainer()->get('auth');
 }
 public function __construct(IShopData $shopData)
 {
     parent::__construct($shopData);
 }
Ejemplo n.º 15
0
 public function rules()
 {
     return array_merge(parent::rules(), ['index' => ['response_type' => 'text/html', 'roles' => [Controller::ALL]], 'login' => ['response_type' => 'text/html', 'roles' => [Controller::ALL]], 'logout' => ['response_type' => 'text/html', 'roles' => [Controller::ALL], 'methods' => ['post']], 'signUp' => ['response_type' => 'text/html', 'roles' => [Controller::ALL]], 'search' => ['response_type' => 'text/html', 'roles' => [Controller::ALL]], 'ajaxSearch' => ['response_type' => 'application/json', 'roles' => [Controller::ALL]]]);
 }
Ejemplo n.º 16
0
 public function run()
 {
     BaseController::ControllerSeeker(self::$controller, self::$action, self::$parameters);
 }
Ejemplo n.º 17
0
 public function __construct(TagRepositoryInterface $tags)
 {
     parent::__construct();
     $this->beforeFilter('auth');
     $this->tags = $tags;
 }
 public function __construct(IShopData $shopData, IRoleProvider $roleProvider)
 {
     parent::__construct($shopData);
     $this->roleProvider = $roleProvider;
 }
Ejemplo n.º 19
0
 /**
  * Create a new TagsController instance.
  *
  * @param \App\Repositories\TagRepositoryInterface $tags
  */
 public function __construct(TagRepositoryInterface $tags)
 {
     parent::__construct();
     $this->tags = $tags;
 }
Ejemplo n.º 20
0
 /**
  * Construct 
  * 
  * @param Application $app
  */
 public function __construct(Application $app)
 {
     parent::__construct($app);
     $this->twig = $app['twig'];
     $this->debug = $app['debug'];
 }
Ejemplo n.º 21
0
 /**
  * Create a new HomeController instance.
  *
  * @param \Tricks\Repositories\TrickRepositoryInterface $tricks
  *
  * @return void
  */
 public function __construct(TrickRepositoryInterface $tricks)
 {
     parent::__construct();
     $this->tricks = $tricks;
 }
Ejemplo n.º 22
0
 public function __construct()
 {
     parent::__construct();
     $this->postsRepo = App::getContainer()->get("postsRepository");
     $this->ratingService = App::getContainer()->get("rating");
 }
Ejemplo n.º 23
0
 /**
  * Constructor 
  * 
  * @param Application $app
  */
 public function __construct(Application $app)
 {
     parent::__construct($app);
     //        $this->_iniRoutes();
 }
Ejemplo n.º 24
0
 public function __construct()
 {
     parent::__construct();
     $this->data["items"] = null;
 }
Ejemplo n.º 25
0
 /**
  * Create a new UsersController instance.
  *
  * @param \Tricks\Repositories\UserRepositoryInterface $users
  *
  * @return void
  */
 public function __construct(UserRepositoryInterface $users)
 {
     parent::__construct();
     $this->users = $users;
 }
 /**
  * Public constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->filesModel = new FilesModel();
 }
Ejemplo n.º 27
0
 /**
  * Constructor
  * 
  * @param Application $app
  */
 public function __construct(Application $app)
 {
     parent::__construct($app);
 }
 /**
  * Create a BaseController instance.
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->beforeFilter('auth');
 }
Ejemplo n.º 29
0
 /**
  * Create a new CategoriesController instance.
  *
  * @param \App\Repositories\CategoryRepositoryInterface $categories
  */
 public function __construct(CategoryRepositoryInterface $categories)
 {
     parent::__construct();
     $this->categories = $categories;
 }
Ejemplo n.º 30
0
 /**
  * Create a new SitemapController instance.
  *
  * @param \Tricks\Services\Sitemap\Builder $builder
  *
  * @return void
  */
 public function __construct(Builder $builder)
 {
     parent::__construct();
     $this->builder = $builder;
 }