public function __construct() { if (!function_exists('gd_info')) { if (!$this->_isInternal()) { page_not_found(); } else { // TODO: improve this Flash::set('error', 'Image - ' . __('GD Library is either not installed or not enabled, check your phpinfo().')); } exit; } parent::__construct(); if ($this->_isInternal()) { $this->setLayout('backend'); $this->assignToLayout('sidebar', new View('../../plugins/image/views/sidebar')); } // get setting from db $src = Plugin::getSetting('path', 'image'); if ($src !== '/') { $src = '/' . $src; } if (substr($src, strlen($src) - 1) !== '/') { $src = $src . '/'; } $this->_image_root = CMS_ROOT . $src; }
public function __construct() { // Check if logged in parent::__construct(); if (defined('CMS_BACKEND')) { $this->setLayout('backend'); } else { $this->setLayout(null); } }
public function __construct(GitPlugin $plugin) { parent::__construct(); $this->userManager = UserManager::instance(); $this->projectManager = ProjectManager::instance(); $this->factory = new GitRepositoryFactory(new GitDao(), $this->projectManager); $matches = array(); if (preg_match_all('/^\\/plugins\\/git\\/index.php\\/(\\d+)\\/([^\\/][a-zA-Z]+)\\/([a-zA-Z\\-\\_0-9]+)\\/\\?{0,1}.*/', $_SERVER['REQUEST_URI'], $matches)) { $this->request->set('group_id', $matches[1][0]); $this->request->set('action', $matches[2][0]); $repo_id = 0; //repository id is passed if (preg_match('/^([0-9]+)$/', $matches[3][0]) === 1) { $repo_id = $matches[3][0]; } else { //get repository by name and group id to retrieve repo id $repo = new GitRepository(); $repo->setName($matches[3][0]); $repo->setProject($this->projectManager->getProject($matches[1][0])); try { $repo->load(); } catch (Exception $e) { $this->addError('Bad request'); $this->redirect('/'); } $repo_id = $repo->getId(); } $this->request->set('repo_id', $repo_id); } $this->plugin = $plugin; $valid = new Valid_GroupId('group_id'); $valid->required(); if ($this->request->valid($valid)) { $this->groupId = (int) $this->request->get('group_id'); } $valid = new Valid_String('action'); $valid->required(); if ($this->request->valid($valid)) { $this->action = $this->request->get('action'); } if (empty($this->action)) { $this->action = 'index'; } if (empty($this->groupId)) { $this->addError('Bad request'); $this->redirect('/'); } $this->projectName = $this->projectManager->getProject($this->groupId)->getUnixName(); if (!PluginManager::instance()->isPluginAllowedForProject($this->plugin, $this->groupId)) { $this->addError($this->getText('project_service_not_available')); $this->redirect('/projects/' . $this->projectName . '/'); } $this->permittedActions = array(); }
public function __construct(GitPlugin $plugin, Git_RemoteServer_GerritServerFactory $gerrit_server_factory, Git_Driver_Gerrit_GerritDriverFactory $driver_factory, GitRepositoryManager $repository_manager, Git_SystemEventManager $system_event_manager, Git_Driver_Gerrit_UserAccountManager $gerrit_usermanager, GitRepositoryFactory $git_repository_factory, UserManager $user_manager, ProjectManager $project_manager, PluginManager $plugin_manager, Codendi_Request $request, Git_Driver_Gerrit_ProjectCreator $project_creator, Git_Driver_Gerrit_Template_TemplateFactory $template_factory, GitPermissionsManager $permissions_manager, Git_GitRepositoryUrlManager $url_manager, Logger $logger, Git_Backend_Gitolite $backend_gitolite, Git_Mirror_MirrorDataMapper $mirror_data_mapper) { parent::__construct($user_manager, $request); $this->userManager = $user_manager; $this->projectManager = $project_manager; $this->factory = $git_repository_factory; $this->gerrit_server_factory = $gerrit_server_factory; $this->driver_factory = $driver_factory; $this->repository_manager = $repository_manager; $this->git_system_event_manager = $system_event_manager; $this->gerrit_usermanager = $gerrit_usermanager; $this->plugin_manager = $plugin_manager; $this->project_creator = $project_creator; $this->template_factory = $template_factory; $this->permissions_manager = $permissions_manager; $this->plugin = $plugin; $this->url_manager = $url_manager; $this->logger = $logger; $this->backend_gitolite = $backend_gitolite; $this->mirror_data_mapper = $mirror_data_mapper; $url = new Git_URL($this->projectManager, $this->factory, $_SERVER['REQUEST_URI']); $this->routeGitSmartHTTP($url); $this->routeUsingFriendlyURLs($url); $this->routeUsingStandardURLs($url); $valid = new Valid_GroupId('group_id'); $valid->required(); if ($this->request->valid($valid)) { $this->groupId = (int) $this->request->get('group_id'); } $valid = new Valid_String('action'); $valid->required(); if ($this->request->valid($valid)) { $this->action = $this->request->get('action'); } if (empty($this->action)) { $this->action = 'index'; } if (empty($this->groupId)) { $this->addError('Bad request'); $this->redirect('/'); } $this->project = $this->projectManager->getProject($this->groupId); $this->projectName = $this->project->getUnixName(); if (!$this->plugin_manager->isPluginAllowedForProject($this->plugin, $this->groupId)) { $this->addError($this->getText('project_service_not_available')); $this->redirect('/projects/' . $this->projectName . '/'); } $this->permittedActions = array(); }