/**
  * Singleton
  * @static
  */
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 /**
  * Return existing instance of PluginManager, or create it.
  *
  * @return PluginManager instance.
  */
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * Return true if given project has the right to use this plugin.
  *
  * @param string $group_id
  *
  * @return bool
  */
 function isAllowed($group_id)
 {
     if (!isset($this->allowedForProject[$group_id])) {
         $this->allowed_for_project[$group_id] = PluginManager::instance()->isPluginAllowedForProject($this, $group_id);
     }
     return $this->allowed_for_project[$group_id];
 }
Example #4
0
 /**
  * The singleton pattern
  * @static
  * @return IssueCache
  */
 public static function getInstance()
 {
     if (NULL == self::$instance) {
         self::$instance = new PluginManager();
     }
     return self::$instance;
 }
Example #5
0
 public function activatePlugins()
 {
     $this->activatePlugin('docman');
     PluginManager::instance()->invalidateCache();
     PluginManager::instance()->loadPlugins();
     return $this;
 }
 function PluginsAdministrationViews(&$controler, $view = null)
 {
     $this->View($controler, $view);
     $this->plugin_manager = PluginManager::instance();
     $this->dependency_solver = new PluginDependencySolver($this->plugin_manager);
     $this->renderer = TemplateRendererFactory::build()->getRenderer(PLUGINSADMINISTRATION_TEMPLATE_DIR);
 }
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new PluginManager(PluginFactory::instance(), EventManager::instance(), new SiteCache());
     }
     return self::$instance;
 }
 public function __construct(EventManager $event_manager)
 {
     $this->event_manager = $event_manager;
     $this->renderer = TemplateRendererFactory::build()->getRenderer(array(ForgeConfig::get('codendi_dir') . '/src/templates/search'));
     $this->search_types = array(Search_SearchTrackerV3::NAME => new Search_SearchTrackerV3(new ArtifactDao()), Search_SearchProject::NAME => new Search_SearchProject(new ProjectDao()), Search_SearchPeople::NAME => new Search_SearchPeople(UserManager::instance()), Search_SearchForum::NAME => new Search_SearchForum(new ForumDao()), Search_SearchSnippet::NAME => new Search_SearchSnippet(new SnippetDao()), Search_SearchWiki::NAME => new Search_SearchWiki(new WikiDao()));
     $this->plugin_manager = PluginManager::instance();
 }
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new PluginManager(PluginFactory::instance(), EventManager::instance(), new SiteCache(), new ForgeUpgradeConfig(new System_Command()));
     }
     return self::$instance;
 }
Example #10
0
 public function container()
 {
     $id = URI::instance()->segment(3, false);
     $p = ORM::factory('plugin_instance', $id);
     if ($p->loaded) {
         echo PluginManager::instance()->get_plugin($p)->render();
     }
 }
Example #11
0
 public static function instance($dir = false)
 {
     //var_dump(self::$instance);
     if (self::$instance == false) {
         self::$instance = new PluginManager($dir);
     }
     return self::$instance;
 }
 static function getInstance()
 {
     if (!self::$instance) {
         $plugin = self::$instance = new PluginManager();
         $plugin->loadPlugins();
     }
     return self::$instance;
 }
Example #13
0
 /**
  * @return GitConfig
  */
 public static function instance()
 {
     if (!isset(self::$_instance)) {
         $plugin = PluginManager::instance()->getPluginByName('git');
         $driver = new GitDriver();
         self::$_instance = new GitConfig($plugin, $driver);
     }
     return self::$_instance;
 }
Example #14
0
 public function process(HTTPRequest $request)
 {
     if (!PluginManager::instance()->isPluginAllowedForProject($this, $request->getProject()->getId())) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_svn_manage_repository', 'plugin_not_activated'));
         $GLOBALS['Response']->redirect('/projects/' . $request->getProject()->getUnixNameMixedCase() . '/');
     } else {
         $this->getRouter()->route($request);
     }
 }
Example #15
0
 /**
  * Say if the service is restricted
  *
  * @param Project $project
  *
  * @return bool
  */
 public function isRestricted()
 {
     $plugin_manager = PluginManager::instance();
     $p = $plugin_manager->getPluginByName('tracker');
     if ($p && $plugin_manager->isProjectPluginRestricted($p)) {
         return true;
     }
     return false;
 }
Example #16
0
 /**
  * Some files might have been generated as root but should be owned by codendiadm
  */
 public function restoreOwnership()
 {
     $backend = Backend::instance();
     $this->logger->debug("Restore ownership to " . $GLOBALS['Language']->getCacheDirectory());
     $backend->recurseChownChgrp($GLOBALS['Language']->getCacheDirectory(), ForgeConfig::get('sys_http_user'), ForgeConfig::get('sys_http_user'));
     $plugin_manager = PluginManager::instance();
     $this->logger->debug("Restore ownership to " . $plugin_manager->getCacheFile());
     $backend->changeOwnerGroupMode($plugin_manager->getCacheFile(), ForgeConfig::get('sys_http_user'), ForgeConfig::get('sys_http_user'), 0600);
 }
 /**
  * Action method
  *
  * @return void
  * @author Dan Chadwick
  */
 public function action()
 {
     $act = $this->input->post('action');
     if ($act == false) {
         url::redirect('plugins');
     }
     PluginManager::instance()->{$act}($this->input->post('name'));
     url::redirect('plugins');
 }
 function adminToolbarConfiguration($params)
 {
     $pM = PluginManager::instance();
     if ($pM->isPluginAllowedForProject($this, $params['group_id'])) {
         // only if allowed for this project...
         $url = $this->_adminURI() . '?group_id=' . $params['group_id'];
         $html = '<A HREF="' . $url . '">' . $GLOBALS['Language']->getText('plugin_plinks', 'project_links_admin') . '</A>';
         print ' | ' . $html . "\n";
     }
 }
Example #19
0
 /**
  * Return true if current project has the right to use this plugin.
  */
 function isAllowed()
 {
     $request =& HTTPRequest::instance();
     $group_id = (int) $request->get('group_id');
     if (!isset($this->allowedForProject[$group_id])) {
         $pM =& PluginManager::instance();
         $this->allowedForProject[$group_id] = $pM->isPluginAllowedForProject($this, $group_id);
     }
     return $this->allowedForProject[$group_id];
 }
Example #20
0
 public function activatePlugins()
 {
     $this->activatePlugin('tracker');
     $this->activatePlugin('agiledashboard');
     $this->activatePlugin('cardwall');
     PluginManager::instance()->loadPlugins();
     $this->tracker_artifact_factory = Tracker_ArtifactFactory::instance();
     $this->tracker_formelement_factory = Tracker_FormElementFactory::instance();
     $this->tracker_factory = TrackerFactory::instance();
     return $this;
 }
Example #21
0
 protected function __construct()
 {
     $this->gitRootPath = '';
     $this->driver = new GitDriver();
     $this->packagesFile = 'etc/packages.ini';
     $this->configFile = 'etc/config.ini';
     $this->dao = new GitDao();
     //WARN : this is much safer to set it to an absolute path
     $this->gitRootPath = Git_Backend_Interface::GIT_ROOT_PATH;
     $this->gitBackupDir = PluginManager::instance()->getPluginByName('git')->getPluginInfo()->getPropVal('git_backup_dir');
 }
Example #22
0
 public function activatePlugins()
 {
     $this->activatePlugin('tracker');
     $this->activatePlugin('agiledashboard');
     $this->activatePlugin('cardwall');
     PluginManager::instance()->invalidateCache();
     PluginManager::instance()->loadPlugins();
     $this->tracker_artifact_factory = Tracker_ArtifactFactory::instance();
     $this->tracker_formelement_factory = Tracker_FormElementFactory::instance();
     $this->tracker_factory = TrackerFactory::instance();
     $this->hierarchy_checker = new AgileDashboard_HierarchyChecker(PlanningFactory::build(), new AgileDashboard_KanbanFactory($this->tracker_factory, new AgileDashboard_KanbanDao()), $this->tracker_factory);
     return $this;
 }
 /**
  * Compute the content of the widget
  *
  * @return string html
  */
 public function getContent()
 {
     $request = HTTPRequest::instance();
     $groupId = $request->get('group_id');
     $plugin = PluginManager::instance()->getPluginByName('git');
     $weeksNumber = $request->get('weeks_number');
     if (empty($weeksNumber)) {
         $weeksNumber = $plugin->getPluginInfo()->getPropVal('weeks_number');
     }
     $content = '<div style="text-align:center"><p>
                     <img src="' . $this->pluginPath . '/index.php?group_id=' . $groupId . '&weeks_number=' . $weeksNumber . '&action=view_last_git_pushes" title="' . $GLOBALS['Language']->getText('plugin_git', 'widget_project_pushes_title') . '" />
                 </div>';
     return $content;
 }
 function init()
 {
     if (isset($this) && $this instanceof PluginManager) {
         $this->included = array();
         $this->filter_table = array();
         $activated_plugins = Plugins::getActivatedPlugins();
         // now load each plugin
         foreach (array_keys($activated_plugins) as $name) {
             include_once 'plugins/' . $name . '/init.php';
         }
         // foreach
         // TODO : cleanup up old activated plugins without valid file??
     } else {
         PluginManager::instance()->init();
     }
     // if
 }
Example #25
0
/**
 * Copyright (c) Enalean, 2012. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap 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 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap 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 Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */
function forge_get_config($key, $scope = 'core')
{
    $conf_variables_mapping = array('web_host' => 'sys_default_domain', 'use_ssl' => 'sys_force_ssl', 'forge_name' => 'sys_name', 'database_host' => 'sys_dbhost', 'database_user' => 'sys_dbuser', 'database_name' => 'sys_dbname', 'database_password' => 'sys_dbpasswd');
    if (isset($conf_variables_mapping[$key])) {
        $key = $conf_variables_mapping[$key];
    } else {
        if ($scope !== 'core') {
            $plugin_manager = PluginManager::instance();
            $plugin = $plugin_manager->getPluginByName($scope);
            if (!$plugin || !$plugin_manager->isPluginAvailable($plugin)) {
                return null;
            }
            return $plugin->getPluginInfo()->getPropertyValueForName($key);
        }
    }
    return ForgeConfig::get($key);
}
Example #26
0
 public function tearDown()
 {
     ForgeConfig::restore();
     $this->mysqli->query('DELETE FROM groups WHERE unix_group_name = "short-name"');
     unset($GLOBALS['svn_prefix']);
     unset($GLOBALS['cvs_prefix']);
     unset($GLOBALS['grpdir_prefix']);
     unset($GLOBALS['ftp_frs_dir_prefix']);
     unset($GLOBALS['ftp_anon_dir_prefix']);
     unset($GLOBALS['sys_default_domain']);
     unset($GLOBALS['sys_cookie_prefix']);
     unset($GLOBALS['sys_force_ssl']);
     $GLOBALS['sys_pluginsroot'] = $this->old_sys_pluginsroot;
     $GLOBALS['sys_custompluginsroot'] = $this->old_sys_custompluginsroot;
     EventManager::clearInstance();
     PluginManager::instance()->invalidateCache();
     PluginFactory::clearInstance();
     $GLOBALS = $this->old_globals;
     parent::tearDown();
 }
Example #27
0
if (!IS_SCRIPT) {
    // Prevent "Pragma: no-cache" to be sent to user (break https & IE)
    session_cache_limiter(false);
    session_start();
    $GLOBALS['session_hash'] = $cookie_manager->isCookie('session_hash') ? $cookie_manager->getCookie('session_hash') : false;
}
//}}}
// Create cache directory if needed
if (!file_exists($GLOBALS['codendi_cache_dir'])) {
    // This directory must be world reachable, but writable only by the web-server
    mkdir($GLOBALS['codendi_cache_dir'], 0755);
}
// Instantiate System Event listener
$system_event_manager = SystemEventManager::instance();
//Load plugins
$plugin_manager =& PluginManager::instance();
$plugin_manager->loadPlugins();
$feedback = '';
// Initialize global var
//library to determine browser settings
if (!IS_SCRIPT) {
    require_once 'browser.php';
}
//Language
if (!$GLOBALS['sys_lang']) {
    $GLOBALS['sys_lang'] = "en_US";
}
$Language = new BaseLanguage($GLOBALS['sys_supported_languages'], $GLOBALS['sys_lang']);
//various html utilities
require_once 'utils.php';
//database abstraction
Example #28
0
 /**
  * Wrapper for PluginManager
  *
  * @return PluginManager
  */
 protected function _getPluginManager()
 {
     $pm = PluginManager::instance();
     return $pm;
 }
 function __construct()
 {
     // Singleton instance
     self::$instance = $this;
 }
Example #30
0
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Codendi 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 Codendi; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require 'pre.php';
require_once dirname(__FILE__) . '/../include/Statistics_DiskUsageHtml.class.php';
// First, check plugin availability
$pluginManager = PluginManager::instance();
$p = $pluginManager->getPluginByName('statistics');
if (!$p || !$pluginManager->isPluginAvailable($p)) {
    header('Location: ' . get_server_url());
}
// Grant access only to site admin
if (!UserManager::instance()->getCurrentUser()->isSuperUser()) {
    header('Location: ' . get_server_url());
}
$duMgr = new Statistics_DiskUsageManager();
$duHtml = new Statistics_DiskUsageHtml($duMgr);
$vFunc = new Valid_WhiteList('func', array('show_one_project', 'show_top_projects', 'show_service', 'show_top_users', 'show_one_user'));
$vFunc->required();
if ($request->valid($vFunc)) {
    $func = $request->get('func');
} else {