예제 #1
0
파일: Router.php 프로젝트: fant0m/VAII
 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();
 }
예제 #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");
 }
예제 #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;
 }
예제 #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;
 }
예제 #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();
     }
 }
예제 #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"));
 }
예제 #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;
 }
예제 #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");
 }
예제 #13
0
 function __construct()
 {
     parent::__construct();
     $this->authService = App::getContainer()->get('auth');
 }
 public function __construct(IShopData $shopData)
 {
     parent::__construct($shopData);
 }
예제 #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]]]);
 }
예제 #16
0
파일: app.php 프로젝트: phkolarov/algaivel
 public function run()
 {
     BaseController::ControllerSeeker(self::$controller, self::$action, self::$parameters);
 }
예제 #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;
 }
예제 #19
0
 /**
  * Create a new TagsController instance.
  *
  * @param \App\Repositories\TagRepositoryInterface $tags
  */
 public function __construct(TagRepositoryInterface $tags)
 {
     parent::__construct();
     $this->tags = $tags;
 }
예제 #20
0
 /**
  * Construct 
  * 
  * @param Application $app
  */
 public function __construct(Application $app)
 {
     parent::__construct($app);
     $this->twig = $app['twig'];
     $this->debug = $app['debug'];
 }
예제 #21
0
 /**
  * Create a new HomeController instance.
  *
  * @param \Tricks\Repositories\TrickRepositoryInterface $tricks
  *
  * @return void
  */
 public function __construct(TrickRepositoryInterface $tricks)
 {
     parent::__construct();
     $this->tricks = $tricks;
 }
예제 #22
0
 public function __construct()
 {
     parent::__construct();
     $this->postsRepo = App::getContainer()->get("postsRepository");
     $this->ratingService = App::getContainer()->get("rating");
 }
예제 #23
0
 /**
  * Constructor 
  * 
  * @param Application $app
  */
 public function __construct(Application $app)
 {
     parent::__construct($app);
     //        $this->_iniRoutes();
 }
예제 #24
0
 public function __construct()
 {
     parent::__construct();
     $this->data["items"] = null;
 }
예제 #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();
 }
예제 #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');
 }
예제 #29
0
 /**
  * Create a new CategoriesController instance.
  *
  * @param \App\Repositories\CategoryRepositoryInterface $categories
  */
 public function __construct(CategoryRepositoryInterface $categories)
 {
     parent::__construct();
     $this->categories = $categories;
 }
예제 #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;
 }