function generate()
 {
     global $Language;
     $request =& HTTPRequest::instance();
     if ($data = $request->get('data')) {
         if (isset($data['users']['generate']) && $data['users']['generate']) {
             $um = UserManager::instance();
             $nb_wanted = isset($data['users']['nb']) ? (int) $data['users']['nb'] : 1;
             $users = $this->_getUsersData();
             reset($users);
             $nb_done = 0;
             while ((list(, $user) = each($users)) && $nb_wanted > $nb_done) {
                 if (!$um->getUserByUserName($user['name'])) {
                     require_once 'account.php';
                     account_create($user['name'], 'codendi', '', $user['realname'], '', '*****@*****.**', 'A', '', 0, 0, 'Europe/Paris', 'en_US', 'A');
                     $nb_done++;
                 }
             }
         }
         if (isset($data['projects']['generate']) && $data['projects']['generate']) {
             $nb_wanted = isset($data['projects']['nb']) ? (int) $data['projects']['nb'] : 1;
             $projects = $this->_getProjectsData();
             reset($projects);
             $nb_done = 0;
             while ((list(, $project) = each($projects)) && $nb_wanted > $nb_done) {
                 if (!group_get_object_by_name($project['name'])) {
                     $projectCreator = new ProjectCreator(ProjectManager::instance(), ReferenceManager::instance());
                     $projectCreator->create(array('project' => array('form_unix_name' => $project['name'], 'form_full_name' => $project['name'], 'form_short_description' => $project['description'], 'form_purpose' => $project['description'], 'form_required_sw' => '', 'form_patents' => '', 'form_comments' => '', 'built_from_template' => 100, 'is_test' => false, 'is_public' => true, 'trove' => array())));
                     $nb_done++;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 function setupTemplate($classname, $repository = false, $cache_dir = false)
 {
     $tc = new $classname();
     $tc->params = array();
     if ($tc->project = $project = group_get_object_by_name($GLOBALS['fusionforgeproject'])) {
         $tc->params['group'] = $GLOBALS['group_id'] = $project->getID();
         $tc->params['toptab'] = 'plugin_mediawiki';
         //$page_name = substr($_SERVER['REQUEST_URI'], (strpos($_SERVER['REQUEST_URI'], 'index.php/') + strlen('index.php/')), strlen($_SERVER['REQUEST_URI']));
         $page_name = preg_replace(self::MEDIAWIKI_URL, '', $_SERVER['REQUEST_URI']);
         $tc->params['title'] = 'Mediawiki-' . $page_name;
     }
     return $tc;
 }
 public function getFusionForgeProject($fusionforgeproject)
 {
     if (!$fusionforgeproject) {
         $administration_project = new Group(1);
         $fusionforgeproject = $administration_project->getUnixName();
     }
     $exppath = explode('/', $_SERVER['PHP_SELF']);
     # determine $fusionforgeproject from the URL
     while (count($exppath) >= 4) {
         if ($exppath[0] == 'plugins' && $exppath[1] == 'mediawiki' && $exppath[2] == 'wiki' && in_array($exppath[4], array('api.php', 'index.php', 'load.php'))) {
             $fusionforgeproject = $exppath[3];
             break;
         } else {
             array_shift($exppath);
         }
     }
     return group_get_object_by_name($fusionforgeproject);
 }
Ejemplo n.º 4
0
/**
 * Checks if the commit it's possible and parse arguments
 * Checks if repository, group and user_name are right.
 *  It extract group from cvsroot, and check if the plugin
 *  is availabe. It checks if the user exists.
 *
 * @param   array    $Config Config
 *
 * @return  array    Returns 'check'=true if check passed, group, group_id
 */
function parseConfig($Config)
{
    global $sys_cvsroot_path, $cvs_tracker_debug;
    $Result = array();
    $Result['check'] = true;
    $Repository = $Config['Repository'];
    $UserName = $Config['UserName'];
    // add a trailing / if needed
    if ($sys_cvsroot_path[strlen($sys_cvsroot_path) - 1] != '/') {
        $sys_cvsroot_path .= '/';
    }
    if (strncmp($Repository, $sys_cvsroot_path, strlen($sys_cvsroot_path)) == 0) {
        $GroupName = substr($Repository, strlen($sys_cvsroot_path));
    } else {
        $GroupName = $Repository;
    }
    if ($cvs_tracker_debug) {
        echo "GroupName = " . $GroupName . "\n";
        echo "CVSRootPath = " . $sys_cvsroot_path . "\n";
    }
    $Result['user'] = user_get_object_by_name($UserName);
    if (!$Result['user'] || !is_object($Result['user']) || $Result['user']->isError() || !$Result['user']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Invalid User';
        return $Result;
    }
    session_set_new($Result['user']->getID());
    $Result['group'] = group_get_object_by_name($GroupName);
    if (!$Result['group'] || !is_object($Result['group']) || $Result['group']->isError() || !$Result['group']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Group Not Found';
    } else {
        $Result['group_id'] = $Result['group']->getID();
        if (!$Result['group']->usesPlugin('cvstracker')) {
            $Result['check'] = false;
            $Result['error'] = 'Plugin not enabled for this Group';
        }
    }
    return $Result;
}
Ejemplo n.º 5
0
} else {
    $queryString = getStringFromServer('QUERY_STRING');
    if (preg_match_all('/[;]?([^\\?;=]+)=([^;]+)/', $queryString, $matches, PREG_SET_ORDER)) {
        for ($i = 0, $size = sizeof($matches); $i < $size; $i++) {
            $query[$matches[$i][1]] = urldecode($matches[$i][2]);
        }
        $projectName = $query['root'];
    }
}
// Remove eventual leading /root/ or root/
$projectName = ereg_replace('^..[^/]*/', '', $projectName);
if (!$projectName) {
    exit_no_group();
}
// Check permissions
$Group =& group_get_object_by_name($projectName);
if (!$Group || !is_object($Group) || $Group->isError()) {
    exit_no_group();
}
if (!$Group->usesSCM()) {
    exit_error(_('Error'), _('Error - This project has turned off SCM.'));
}
// check if the scm_box is located in another server
$scm_box = $Group->getSCMBox();
//$external_scm = (gethostbyname($sys_default_domain) != gethostbyname($scm_box));
$external_scm = !$sys_scm_single_host;
if (session_loggedin()) {
    if (user_ismember($Group->getID())) {
        $perm =& $Group->getPermission(session_get_user());
        if (!($perm && is_object($perm) && $perm->isCVSReader()) && !$Group->enableAnonSCM()) {
            exit_permission_denied();
Ejemplo n.º 6
0
 * along with GForge; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once '../env.inc.php';
require_once $gfwww . 'include/pre.php';
require_once $gfwww . 'admin/admin_utils.php';
if (!$sys_use_project_database) {
    exit_disabled();
}
session_require(array('group' => '1', 'admin_flags' => 'A'));
if (getStringFromRequest('submit')) {
    $group_id = getIntFromRequest('group_id');
    $groupname = getStringFromRequest('groupname');
    $dbname = getStringFromRequest('dbname');
    if ($groupname) {
        $group =& group_get_object_by_name($groupname);
        if (!$group || !is_object($group)) {
            exit_error('Error', 'Could Not Get Group');
        } elseif ($group->isError()) {
            exit_error('Error', $group->getErrorMessage());
        }
        $group_id = $group->getID();
        $user =& session_get_user();
        if (!$user || !is_object($user)) {
            exit_error('Error', 'Could Not Get User');
        } elseif ($user->isError()) {
            exit_error('Error', $u->getErrorMessage());
        }
        $res = db_query("\n\t\t\tINSERT INTO prdb_dbs(group_id, dbname, dbusername, dbuserpass, requestdate, dbtype, created_by, state)\n\t\t\tVALUES ({$group_id},'{$dbname}','{$dbname}','xxx'," . time() . ",1," . $user->getID() . ",1)\n\t\t");
        if (!$res || db_affected_rows($res) < 1) {
            $feedback .= _('Error Adding Database') . db_error();
Ejemplo n.º 7
0
/**
 * Checks if the commit it's possible and parse arguments
 * Checks if repository, group and user_name are right.
 *  It extract group from svnroot, and check if the plugin
 *  is availabe. It checks if the user exists.
 *
 * @param   array    $Config Config
 *
 * @return  array    Returns 'check'=true if check passed, group, group_id
 */
function parseConfig(&$Config)
{
    global $sys_svnroot_path, $svn_tracker_debug, $file;
    $Result = array();
    $Result['check'] = true;
    $Repository = $Config['Repository'];
    $UserName = $Config['UserName'];
    if ($sys_svnroot_path[strlen($sys_svnroot_path) - 1] != '/') {
        $sys_svnroot_path .= '/';
    }
    $repo_root = substr($Repository, 0, strrpos($Repository, "/") + 1);
    //we get the directory of the repository root (with trailing slash)
    if (fileinode($sys_svnroot_path) == fileinode($repo_root)) {
        // since the $sys_svnroot_path is usually $sys_svnroot, and that one is a symlink, we check that the inode is the same for both
        $GroupName = substr($Repository, strrpos($Repository, "/") + 1);
        $Config['FileName'] = substr($Config['FileName'], strlen($Repository));
        //get only the filename relative to the repo
    } else {
        $GroupName = $Repository;
        $Config['FileName'] = $Config['FileName'];
    }
    if ($svn_tracker_debug) {
        echo "GroupName = " . $GroupName . "\n";
        echo "SVNRootPath = " . $sys_svnroot_path . "\n";
    }
    if ($svn_tracker_debug) {
        fwrite($file, $GroupName . "\n");
    }
    $Result['group'] = group_get_object_by_name($GroupName);
    $Result['user'] = user_get_object_by_name($UserName);
    if (!$Result['group'] || !is_object($Result['group']) || $Result['group']->isError() || !$Result['group']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Group Not Found';
    } else {
        $Result['group_id'] = $Result['group']->getID();
        if (!$Result['group']->usesPlugin('svntracker')) {
            $Result['check'] = false;
            $Result['error'] = 'Plugin not enabled for this Group';
        }
    }
    if (!$Result['user'] || !is_object($Result['user']) || $Result['user']->isError() || !$Result['user']->isActive()) {
        $Result['check'] = false;
        $Result['error'] = 'Invalid User';
    }
    return $Result;
}
Ejemplo n.º 8
0
    /**
     * Template filter callback for GForge skin.
     * Takes an associative array of data set from a SkinTemplate-based
     * class, and a wrapper for MediaWiki's localization database, and
     * outputs a formatted page.
     *
     * @access private
     */
    function execute()
    {
        // Suppress warnings to prevent notices about missing indexes in $this->data
        wfSuppressWarnings();
        $project = group_get_object_by_name(strtolower($this->data['skin']->mTitle->mTextform));
        if ($project) {
            $params['group'] = $project->getID();
            $params['toptab'] = 'mediawiki';
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php 
        $this->text('lang');
        ?>
" lang="<?php 
        $this->text('lang');
        ?>
" dir="<?php 
        $this->text('dir');
        ?>
">
<head>
	<meta http-equiv="Content-Type" content="<?php 
        $this->text('mimetype');
        ?>
; charset=<?php 
        $this->text('charset');
        ?>
" />
	<?php 
        $this->html('headlinks');
        ?>
	<title><?php 
        $this->text('pagetitle');
        ?>
</title>
	<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php 
        $this->text('stylepath');
        ?>
/<?php 
        $this->text('stylename');
        ?>
/main.css?9"; /*]]>*/</style>
	<link rel="stylesheet" type="text/css" <?php 
        if (empty($this->data['printable'])) {
            ?>
media="print"<?php 
        }
        ?>
 href="<?php 
        $this->text('stylepath');
        ?>
/common/commonPrint.css" />
	<!--[if lt IE 5.5000]><style type="text/css">@import "<?php 
        $this->text('stylepath');
        ?>
/<?php 
        $this->text('stylename');
        ?>
/IE50Fixes.css";</style><![endif]-->
	<!--[if IE 5.5000]><style type="text/css">@import "<?php 
        $this->text('stylepath');
        ?>
/<?php 
        $this->text('stylename');
        ?>
/IE55Fixes.css";</style><![endif]-->
	<!--[if IE 6]><style type="text/css">@import "<?php 
        $this->text('stylepath');
        ?>
/<?php 
        $this->text('stylename');
        ?>
/IE60Fixes.css";</style><![endif]-->
	<!--[if IE 7]><style type="text/css">@import "<?php 
        $this->text('stylepath');
        ?>
/<?php 
        $this->text('stylename');
        ?>
/IE70Fixes.css?1";</style><![endif]-->
	<!--[if lt IE 7]><script type="<?php 
        $this->text('jsmimetype');
        ?>
" src="<?php 
        $this->text('stylepath');
        ?>
/common/IEFixes.js"></script>
	<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
	<script type="<?php 
        $this->text('jsmimetype');
        ?>
">var skin = '<?php 
        $this->text('skinname');
        ?>
';var stylepath = '<?php 
        $this->text('stylepath');
        ?>
';</script>
	<script type="<?php 
        $this->text('jsmimetype');
        ?>
" src="<?php 
        $this->text('stylepath');
        ?>
/common/wikibits.js?1"><!-- wikibits js --></script>
		<?php 
        if ($this->data['jsvarurl']) {
            ?>
	<script type="<?php 
            $this->text('jsmimetype');
            ?>
" src="<?php 
            $this->text('jsvarurl');
            ?>
"><!-- site js --></script>
		<?php 
        }
        ?>
		<?php 
        if ($this->data['pagecss']) {
            ?>
	<style type="text/css"><?php 
            $this->html('pagecss');
            ?>
</style>
		<?php 
        }
        if ($this->data['usercss']) {
            ?>
	<style type="text/css"><?php 
            $this->html('usercss');
            ?>
</style>
		<?php 
        }
        if ($this->data['userjs']) {
            ?>
	<script type="<?php 
            $this->text('jsmimetype');
            ?>
" src="<?php 
            $this->text('userjs');
            ?>
"></script>
		<?php 
        }
        if ($this->data['userjsprev']) {
            ?>
	<script type="<?php 
            $this->text('jsmimetype');
            ?>
"><?php 
            $this->html('userjsprev');
            ?>
</script>
		<?php 
        }
        if ($this->data['trackbackhtml']) {
            print $this->data['trackbackhtml'];
        }
        ?>
	<!-- Head Scripts -->
		<?php 
        $this->html('headscripts');
        ?>

	<!-- GFORGE Stylesheet BEGIN -->
	<?php 
        $GLOBALS['HTML']->headerCSS();
        ?>
	<!-- GFORGE Stylesheet END -->
</head>

<body <?php 
        if ($this->data['body_ondblclick']) {
            ?>
ondblclick="<?php 
            $this->text('body_ondblclick');
            ?>
"<?php 
        }
        if ($this->data['body_onload']) {
            ?>
onload="<?php 
            $this->text('body_onload');
            ?>
"<?php 
        }
        ?>
 class="<?php 
        $this->text('nsclass');
        ?>
 <?php 
        $this->text('dir');
        ?>
">

	<!-- GFORGE BodyHeader BEGIN -->
	<?php 
        $GLOBALS['HTML']->bodyHeader($params);
        ?>
	<!-- GFORGE BodyHeader END -->

	<div id="globalWrapper">
		<div id="column-content">
	<div id="content">
		<a name="top" id="top"></a>
		<?php 
        if ($this->data['sitenotice']) {
            ?>
<div id="siteNotice"><?php 
            $this->html('sitenotice');
            ?>
</div><?php 
        }
        ?>
		<h1 class="firstHeading"><?php 
        $this->data['displaytitle'] != "" ? $this->text('title') : $this->html('title');
        ?>
</h1>
		<div id="bodyContent">
			<h3 id="siteSub"><?php 
        $this->msg('tagline');
        ?>
</h3>
			<div id="contentSub"><?php 
        $this->html('subtitle');
        ?>
</div>
			<?php 
        if ($this->data['undelete']) {
            ?>
<div id="contentSub2"><?php 
            $this->html('undelete');
            ?>
</div><?php 
        }
        ?>
			<?php 
        if ($this->data['newtalk']) {
            ?>
<div class="usermessage"><?php 
            $this->html('newtalk');
            ?>
</div><?php 
        }
        ?>
			<?php 
        if ($this->data['showjumplinks']) {
            ?>
<div id="jump-to-nav"><?php 
            $this->msg('jumpto');
            ?>
 <a href="#column-one"><?php 
            $this->msg('jumptonavigation');
            ?>
</a>, <a href="#searchInput"><?php 
            $this->msg('jumptosearch');
            ?>
</a></div><?php 
        }
        ?>
			<!-- start content -->
			<?php 
        $this->html('bodytext');
        ?>
			<?php 
        if ($this->data['catlinks']) {
            ?>
<div id="catlinks"><?php 
            $this->html('catlinks');
            ?>
</div><?php 
        }
        ?>
			<!-- end content -->
			<div class="visualClear"></div>
		</div>
	</div>
		</div>
		<div id="column-one">
	<div class="portlet" id="p-personal">
		<h5><?php 
        $this->msg('personaltools');
        ?>
</h5>
		<div class="pBody">
			<ul>
<?php 
        // XXXXXX CB don't display login as it's done by GForge
        $this->data['personal_urls']['login'] = array();
        $this->data['personal_urls']['logout'] = array();
        foreach ($this->data['personal_urls'] as $key => $item) {
            ?>
				<li id="pt-<?php 
            echo htmlspecialchars($key);
            ?>
"<?php 
            if ($item['active']) {
                ?>
 class="active"<?php 
            }
            ?>
><a href="<?php 
            echo htmlspecialchars($item['href']);
            ?>
"<?php 
            if (!empty($item['class'])) {
                ?>
 class="<?php 
                echo htmlspecialchars($item['class']);
                ?>
"<?php 
            }
            ?>
><?php 
            echo htmlspecialchars($item['text']);
            ?>
</a></li>
<?php 
        }
        ?>
			</ul>
		</div>
	</div>
	<div id="p-cactions" class="portlet">
		<h5><?php 
        $this->msg('views');
        ?>
</h5>
		<ul>
<?php 
        foreach ($this->data['content_actions'] as $key => $tab) {
            ?>
				 <li id="ca-<?php 
            echo htmlspecialchars($key);
            ?>
"<?php 
            if ($tab['class']) {
                ?>
 class="<?php 
                echo htmlspecialchars($tab['class']);
                ?>
"<?php 
            }
            ?>
><a href="<?php 
            echo htmlspecialchars($tab['href']);
            ?>
"><?php 
            echo htmlspecialchars($tab['text']);
            ?>
</a></li>
<?php 
        }
        ?>
		</ul>
	</div>
	<div class="portlet" id="p-logo">
		<a style="background-image: url(<?php 
        $this->text('logopath');
        ?>
);" <?php 
        ?>
href="<?php 
        echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']);
        ?>
" <?php 
        ?>
title="<?php 
        $this->msg('mainpage');
        ?>
"></a>
	</div>
	<script type="<?php 
        $this->text('jsmimetype');
        ?>
"> if (window.isMSIE55) fixalpha(); </script>
	<?php 
        foreach ($this->data['sidebar'] as $bar => $cont) {
            ?>
	<div class='portlet' id='p-<?php 
            echo htmlspecialchars($bar);
            ?>
'>
		<h5><?php 
            $out = wfMsg($bar);
            if (wfEmptyMsg($bar, $out)) {
                echo $bar;
            } else {
                echo $out;
            }
            ?>
</h5>
		<div class='pBody'>
			<ul>
<?php 
            foreach ($cont as $key => $val) {
                ?>
				<li id="<?php 
                echo htmlspecialchars($val['id']);
                ?>
"<?php 
                if ($val['active']) {
                    ?>
 class="active" <?php 
                }
                ?>
><a href="<?php 
                echo htmlspecialchars($val['href']);
                ?>
"><?php 
                echo htmlspecialchars($val['text']);
                ?>
</a></li>
<?php 
            }
            ?>
			</ul>
		</div>
	</div>
	<?php 
        }
        ?>
	<div id="p-search" class="portlet">
		<h5><label for="searchInput"><?php 
        $this->msg('search');
        ?>
</label></h5>
		<div id="searchBody" class="pBody">
			<form action="<?php 
        $this->text('searchaction');
        ?>
" id="searchform">
			<div>
				<input id="searchInput" name="search" type="text" <?php 
        if ($this->haveMsg('accesskey-search')) {
            ?>
accesskey="<?php 
            $this->msg('accesskey-search');
            ?>
"<?php 
        }
        if (isset($this->data['search'])) {
            ?>
 value="<?php 
            $this->text('search');
            ?>
"<?php 
        }
        ?>
 />
				<input type='submit' name="go" class="searchButton" id="searchGoButton"	value="<?php 
        $this->msg('go');
        ?>
" />&nbsp;
				<input type='submit' name="fulltext" class="searchButton" value="<?php 
        $this->msg('search');
        ?>
" />
			</div>
			</form>
		</div>
	</div>
	<div class="portlet" id="p-tbx">
		<h5><?php 
        $this->msg('toolbox');
        ?>
</h5>
		<div class="pBody">
			<ul>
<?php 
        if ($this->data['notspecialpage']) {
            ?>
				<li id="t-whatlinkshere"><a href="<?php 
            echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href']);
            ?>
"><?php 
            $this->msg('whatlinkshere');
            ?>
</a></li>
<?php 
            if ($this->data['nav_urls']['recentchangeslinked']) {
                ?>
				<li id="t-recentchangeslinked"><a href="<?php 
                echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href']);
                ?>
"><?php 
                $this->msg('recentchangeslinked');
                ?>
</a></li>
<?php 
            }
        }
        if (isset($this->data['nav_urls']['trackbacklink'])) {
            ?>
			<li id="t-trackbacklink"><a href="<?php 
            echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href']);
            ?>
"><?php 
            $this->msg('trackbacklink');
            ?>
</a></li>
<?php 
        }
        if ($this->data['feeds']) {
            ?>
			<li id="feedlinks"><?php 
            foreach ($this->data['feeds'] as $key => $feed) {
                ?>
<span id="feed-<?php 
                echo htmlspecialchars($key);
                ?>
"><a href="<?php 
                echo htmlspecialchars($feed['href']);
                ?>
"><?php 
                echo htmlspecialchars($feed['text']);
                ?>
</a>&nbsp;</span>
					<?php 
            }
            ?>
</li><?php 
        }
        foreach (array('contributions', 'blockip', 'emailuser', 'upload', 'specialpages') as $special) {
            if ($this->data['nav_urls'][$special]) {
                ?>
<li id="t-<?php 
                echo $special;
                ?>
"><a href="<?php 
                echo htmlspecialchars($this->data['nav_urls'][$special]['href']);
                ?>
"><?php 
                $this->msg($special);
                ?>
</a></li>
<?php 
            }
        }
        if (!empty($this->data['nav_urls']['print']['href'])) {
            ?>
				<li id="t-print"><a href="<?php 
            echo htmlspecialchars($this->data['nav_urls']['print']['href']);
            ?>
"><?php 
            $this->msg('printableversion');
            ?>
</a></li><?php 
        }
        if (!empty($this->data['nav_urls']['permalink']['href'])) {
            ?>
				<li id="t-permalink"><a href="<?php 
            echo htmlspecialchars($this->data['nav_urls']['permalink']['href']);
            ?>
"><?php 
            $this->msg('permalink');
            ?>
</a></li><?php 
        } elseif ($this->data['nav_urls']['permalink']['href'] === '') {
            ?>
				<li id="t-ispermalink"><?php 
            $this->msg('permalink');
            ?>
</li><?php 
        }
        wfRunHooks('GForgeTemplateToolboxEnd', array(&$this));
        ?>
			</ul>
		</div>
	</div>
<?php 
        if ($this->data['language_urls']) {
            ?>
	<div id="p-lang" class="portlet">
		<h5><?php 
            $this->msg('otherlanguages');
            ?>
</h5>
		<div class="pBody">
			<ul>
<?php 
            foreach ($this->data['language_urls'] as $langlink) {
                ?>
				<li class="<?php 
                echo htmlspecialchars($langlink['class']);
                ?>
"><?php 
                ?>
<a href="<?php 
                echo htmlspecialchars($langlink['href']);
                ?>
"><?php 
                echo $langlink['text'];
                ?>
</a></li>
<?php 
            }
            ?>
			</ul>
		</div>
	</div>
<?php 
        }
        ?>
		</div><!-- end of the left (by default at least) column -->
			<div class="visualClear"></div>
			<div id="footer">
<?php 
        if ($this->data['poweredbyico']) {
            ?>
				<div id="f-poweredbyico"><?php 
            $this->html('poweredbyico');
            ?>
</div>
<?php 
        }
        if ($this->data['copyrightico']) {
            ?>
				<div id="f-copyrightico"><?php 
            $this->html('copyrightico');
            ?>
</div>
<?php 
        }
        // Generate additional footer links
        ?>
			<ul id="f-list">
<?php 
        $footerlinks = array('lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', 'privacy', 'about', 'disclaimer', 'tagline');
        foreach ($footerlinks as $aLink) {
            if ($this->data[$aLink]) {
                ?>
				<li id="<?php 
                echo $aLink;
                ?>
"><?php 
                $this->html($aLink);
                ?>
</li>
<?php 
            }
        }
        ?>
			</ul>
		</div>
	<script type="text/javascript"> if (window.runOnloadHook) runOnloadHook();</script>
</div>
<?php 
        $this->html('reporttime');
        ?>

<?php 
        $GLOBALS['HTML']->footer($params);
        wfRestoreWarnings();
    }
Ejemplo n.º 9
0
 function addWritePermissionForUser(PFUser $tuleap_user, MediawikiManager $manager, $fusionforgeproject, array $wgGroupPermissions, array $write_permissions)
 {
     $group = group_get_object_by_name($fusionforgeproject);
     if (!$manager->userCanWrite($tuleap_user, $group)) {
         return $wgGroupPermissions;
     }
     foreach ($write_permissions as $write_permission) {
         $wgGroupPermissions['*'][$write_permission] = true;
     }
     return $wgGroupPermissions;
 }
Ejemplo n.º 10
0
} else {
    /*
     * saves some warnings
     * works if the mwscript includes e.g. commandLine.inc
     */
    $preload_localsettings = false;
}
$mwscript = array_shift($argv);
require_once dirname(__FILE__) . '/../../../common/include/env.inc.php';
require_once $gfcommon . 'include/pre.php';
require_once $gfcommon . 'include/cron_utils.php';
// Plugins subsystem
require_once $gfcommon . 'include/Plugin.class.php';
require_once $gfcommon . 'include/PluginManager.class.php';
setup_plugin_manager();
$group = group_get_object_by_name($fusionforgeproject);
if (!$group || $group->isError()) {
    die("Wrong group! " . ($group ? $group->getErrorMessage() : "") . "\n");
}
if (!$group->usesPlugin('mediawiki')) {
    die("Project doesn't use the Mediawiki plugin\n");
}
function ffmw_wrapper_fixup_searchpath($username)
{
    db_query_params("ALTER ROLE {$username} SET search_path = public", array());
}
register_shutdown_function('ffmw_wrapper_fixup_searchpath', forge_get_config('database_user'));
$ff_localsettings = forge_get_config('source_path') . '/www/plugins/mediawiki/LocalSettings.php';
if ($preload_localsettings) {
    define("MEDIAWIKI", true);
    require_once $ff_localsettings;
Ejemplo n.º 11
0
 //test if the FTP upload dir exists and create it if not
 if (!is_dir($sys_ftp_upload_dir)) {
     @mkdir($sys_ftp_upload_dir, 0755, true);
 }
 //create an FTP upload dir for this project
 if ($sys_use_ftpuploads) {
     if (!is_dir($sys_ftp_upload_dir . '/' . $group)) {
         @mkdir($sys_ftp_upload_dir . '/' . $group);
     }
 }
 if (is_dir($groupdir_prefix . "/" . $group)) {
 } else {
     @mkdir($groupdir_prefix . "/" . $group);
     @mkdir($groupdir_prefix . "/" . $group . "/htdocs");
     @mkdir($groupdir_prefix . "/" . $group . "/cgi-bin");
     $g =& group_get_object_by_name($group);
     //
     //	Read in the template file
     //
     $fo = fopen(dirname(__FILE__) . '/../utils/default_page.php', 'r');
     $contents = '';
     if (!$fo) {
         $err .= 'Default Page Not Found';
     } else {
         while (!feof($fo)) {
             $contents .= fread($fo, 8192);
         }
         fclose($fo);
     }
     //
     //	Change some defaults in the template file
Ejemplo n.º 12
0
    /**
     * Template filter callback for FusionForge skin.
     * Takes an associative array of data set from a SkinTemplate-based
     * class, and a wrapper for MediaWiki's localization database, and
     * outputs a formatted page.
     *
     * @access private
     */
    function execute()
    {
        global $wgRequest, $sysDTDs;
        $this->skin = $skin = $this->data['skin'];
        $action = $wgRequest->getText('action');
        // Suppress warnings to prevent notices about missing indexes in $this->data
        wfSuppressWarnings();
        echo $sysDTDs['transitional']['doctype'];
        ?>
<html xmlns="<?php 
        $this->text('xhtmldefaultnamespace');
        ?>
" <?php 
        foreach ($this->data['xhtmlnamespaces'] as $tag => $ns) {
            ?>
xmlns:<?php 
            echo "{$tag}=\"{$ns}\" ";
        }
        ?>
xml:lang="<?php 
        $this->text('lang');
        ?>
" lang="<?php 
        $this->text('lang');
        ?>
" dir="<?php 
        $this->text('dir');
        ?>
">
	<head>
		<meta http-equiv="Content-Type" content="<?php 
        $this->text('mimetype');
        ?>
; charset=<?php 
        $this->text('charset');
        ?>
" />
		<?php 
        $this->html('headlinks');
        ?>
		<title><?php 
        $this->text('pagetitle');
        ?>
</title>
		<?php 
        $this->html('csslinks');
        ?>

		<!--[if lt IE 7]><script type="<?php 
        $this->text('jsmimetype');
        ?>
" src="<?php 
        $this->text('stylepath');
        ?>
/common/IEFixes.js?<?php 
        echo $GLOBALS['wgStyleVersion'];
        ?>
"></script>
		<meta http-equiv="imagetoolbar" content="no" /><![endif]-->

		<?php 
        print Skin::makeGlobalVariablesScript($this->data);
        ?>

		<script type="<?php 
        $this->text('jsmimetype');
        ?>
" src="<?php 
        $this->text('stylepath');
        ?>
/common/wikibits.js?<?php 
        echo $GLOBALS['wgStyleVersion'];
        ?>
"><!-- wikibits js --></script>
		<!-- Head Scripts -->
<?php 
        $this->html('headscripts');
        if ($this->data['jsvarurl']) {
            ?>
		<script type="<?php 
            $this->text('jsmimetype');
            ?>
" src="<?php 
            $this->text('jsvarurl');
            ?>
"><!-- site js --></script>
<?php 
        }
        if ($this->data['pagecss']) {
            ?>
		<style type="text/css"><?php 
            $this->html('pagecss');
            ?>
</style>
<?php 
        }
        if ($this->data['usercss']) {
            ?>
		<style type="text/css"><?php 
            $this->html('usercss');
            ?>
</style>
<?php 
        }
        if ($this->data['userjs']) {
            ?>
		<script type="<?php 
            $this->text('jsmimetype');
            ?>
" src="<?php 
            $this->text('userjs');
            ?>
"></script>
<?php 
        }
        if ($this->data['userjsprev']) {
            ?>
		<script type="<?php 
            $this->text('jsmimetype');
            ?>
"><?php 
            $this->html('userjsprev');
            ?>
</script>
<?php 
        }
        if ($this->data['trackbackhtml']) {
            print $this->data['trackbackhtml'];
        }
        ?>
        	<!-- FUSIONFORGE Stylesheet BEGIN -->
		<?php 
        if (!$GLOBALS['sys_use_mwframe']) {
            $GLOBALS['HTML']->displayStylesheetElements();
        }
        ?>
        	<!-- FUSIONFORGE Stylesheet END -->
	</head>
<body id="mydoc" <?php 
        if ($this->data['body_ondblclick']) {
            ?>
 ondblclick="<?php 
            $this->text('body_ondblclick');
            ?>
"<?php 
        }
        if ($this->data['body_onload']) {
            ?>
 onload="<?php 
            $this->text('body_onload');
            ?>
"<?php 
        }
        ?>
 class="mediawiki <?php 
        $this->text('dir');
        ?>
 <?php 
        $this->text('pageclass');
        ?>
 <?php 
        $this->text('skinnameclass');
        ?>
">
        <!-- FUSIONFORGE BodyHeader BEGIN -->
        <?php 
        if (!$GLOBALS['sys_use_mwframe']) {
            $project = group_get_object_by_name($GLOBALS['fusionforgeproject']);
            if ($project) {
                $GLOBALS['group_id'] = $project->getID();
                $params['group'] = $GLOBALS['group_id'];
                $params['toptab'] = 'mediawiki';
                $GLOBALS['HTML']->bodyHeader($params);
            }
        }
        ?>
        <!-- FUSIONFORGE BodyHeader END -->
	<div id="globalWrapper">
		<div id="column-content">
	<div id="content">
		<a name="top" id="top"></a>
		<?php 
        if ($this->data['sitenotice']) {
            ?>
<div id="siteNotice"><?php 
            $this->html('sitenotice');
            ?>
</div><?php 
        }
        ?>
		<h1 id="firstHeading" class="firstHeading"><?php 
        $this->data['displaytitle'] != "" ? $this->html('title') : $this->text('title');
        ?>
</h1>
		<div id="bodyContent">
			<h3 id="siteSub"><?php 
        $this->msg('tagline');
        ?>
</h3>
			<div id="contentSub"><?php 
        $this->html('subtitle');
        ?>
</div>
			<?php 
        if ($this->data['undelete']) {
            ?>
<div id="contentSub2"><?php 
            $this->html('undelete');
            ?>
</div><?php 
        }
        ?>
			<?php 
        if ($this->data['newtalk']) {
            ?>
<div class="usermessage"><?php 
            $this->html('newtalk');
            ?>
</div><?php 
        }
        ?>
			<?php 
        if ($this->data['showjumplinks']) {
            ?>
<div id="jump-to-nav"><?php 
            $this->msg('jumpto');
            ?>
 <a href="#column-one"><?php 
            $this->msg('jumptonavigation');
            ?>
</a>, <a href="#searchInput"><?php 
            $this->msg('jumptosearch');
            ?>
</a></div><?php 
        }
        ?>
			<!-- start content -->
			<?php 
        $this->html('bodytext');
        ?>
			<?php 
        if ($this->data['catlinks']) {
            $this->html('catlinks');
        }
        ?>
			<!-- end content -->
			<?php 
        if ($this->data['dataAfterContent']) {
            $this->html('dataAfterContent');
        }
        ?>
			<div class="visualClear"></div>
		</div>
	</div>
		</div>
		<div id="column-one">
	<div id="p-cactions" class="portlet">
		<h5><?php 
        $this->msg('views');
        ?>
</h5>
		<div class="pBody">
			<ul>
	<?php 
        foreach ($this->data['content_actions'] as $key => $tab) {
            echo '
				 <li id="' . Sanitizer::escapeId("ca-{$key}") . '"';
            if ($tab['class']) {
                echo ' class="' . htmlspecialchars($tab['class']) . '"';
            }
            echo '><a href="' . htmlspecialchars($tab['href']) . '"';
            # We don't want to give the watch tab an accesskey if the
            # page is being edited, because that conflicts with the
            # accesskey on the watch checkbox.  We also don't want to
            # give the edit tab an accesskey, because that's fairly su-
            # perfluous and conflicts with an accesskey (Ctrl-E) often
            # used for editing in Safari.
            if (in_array($action, array('edit', 'submit')) && in_array($key, array('edit', 'watch', 'unwatch'))) {
                echo $skin->tooltip("ca-{$key}");
            } else {
                echo $skin->tooltipAndAccesskey("ca-{$key}");
            }
            echo '>' . htmlspecialchars($tab['text']) . '</a></li>';
        }
        ?>
			</ul>
		</div>
	</div>
	<div class="portlet" id="p-personal">
		<h5><?php 
        $this->msg('personaltools');
        ?>
</h5>
		<div class="pBody">
			<ul>
<?php 
        foreach ($this->data['personal_urls'] as $key => $item) {
            ?>
				<li id="<?php 
            echo Sanitizer::escapeId("pt-{$key}");
            ?>
"<?php 
            if (isset($item['active']) && $item['active']) {
                ?>
 class="active"<?php 
            }
            ?>
><a href="<?php 
            echo htmlspecialchars($item['href']);
            ?>
"<?php 
            echo $skin->tooltipAndAccesskey('pt-' . $key);
            if (!empty($item['class'])) {
                ?>
 class="<?php 
                echo htmlspecialchars($item['class']);
                ?>
"<?php 
            }
            ?>
><?php 
            echo htmlspecialchars($item['text']);
            ?>
</a></li>
<?php 
        }
        ?>
			</ul>
		</div>
	</div>
	<div class="portlet" id="p-logo">
		<a style="background-image: url(<?php 
        $this->text('logopath');
        ?>
);" <?php 
        ?>
href="<?php 
        echo htmlspecialchars($this->data['nav_urls']['mainpage']['href']);
        ?>
"<?php 
        echo $skin->tooltipAndAccesskey('p-logo');
        ?>
></a>
	</div>
	<script type="<?php 
        $this->text('jsmimetype');
        ?>
"> if (window.isMSIE55) fixalpha(); </script>
<?php 
        $sidebar = $this->data['sidebar'];
        if (!isset($sidebar['SEARCH'])) {
            $sidebar['SEARCH'] = true;
        }
        if (!isset($sidebar['TOOLBOX'])) {
            $sidebar['TOOLBOX'] = true;
        }
        if (!isset($sidebar['LANGUAGES'])) {
            $sidebar['LANGUAGES'] = true;
        }
        foreach ($sidebar as $boxName => $cont) {
            if ($boxName == 'SEARCH') {
                $this->searchBox();
            } elseif ($boxName == 'TOOLBOX') {
                $this->toolbox();
            } elseif ($boxName == 'LANGUAGES') {
                $this->languageBox();
            } else {
                $this->customBox($boxName, $cont);
            }
        }
        ?>
		</div><!-- end of the left (by default at least) column -->
			<div class="visualClear"></div>
			<div id="footer">
<?php 
        if ($this->data['poweredbyico']) {
            ?>
				<div id="f-poweredbyico"><?php 
            $this->html('poweredbyico');
            ?>
</div>
<?php 
        }
        if ($this->data['copyrightico']) {
            ?>
				<div id="f-copyrightico"><?php 
            $this->html('copyrightico');
            ?>
</div>
<?php 
        }
        // Generate additional footer links
        $footerlinks = array('lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright', 'privacy', 'about', 'disclaimer', 'tagline');
        $validFooterLinks = array();
        foreach ($footerlinks as $aLink) {
            if (isset($this->data[$aLink]) && $this->data[$aLink]) {
                $validFooterLinks[] = $aLink;
            }
        }
        if (count($validFooterLinks) > 0) {
            ?>
			<ul id="f-list">
<?php 
            foreach ($validFooterLinks as $aLink) {
                if (isset($this->data[$aLink]) && $this->data[$aLink]) {
                    ?>
					<li id="<?php 
                    echo $aLink;
                    ?>
"><?php 
                    $this->html($aLink);
                    ?>
</li>
<?php 
                }
            }
            ?>
			</ul>
<?php 
        }
        ?>
		</div>
</div>
<?php 
        $this->html('bottomscripts');
        /* JS call to runBodyOnloadHook */
        $this->html('reporttime');
        if ($this->data['debug']) {
            ?>
<!-- Debug output:
<?php 
            $this->text('debug');
            ?>

-->
<?php 
        }
        ?>
        <!-- FUSIONFORGE Footer BEGIN -->
<?php 
        if (!$GLOBALS['sys_use_mwframe']) {
            $GLOBALS['HTML']->footer($params);
        } else {
            ?>
</body></html>
<?php 
        }
        wfRestoreWarnings();
    }
Ejemplo n.º 13
0
 function &getForum()
 {
     global $argv;
     if ($this->Forum == -1) {
         $Group =& group_get_object_by_name($argv[1]);
         if (!$Group || !is_object($Group)) {
             $this->setError('Could Not Get Group Object');
             return false;
         } elseif ($Group->isError()) {
             $this->setError('Getting Group Object: ' . $Group->getErrorMessage());
             return false;
         }
         if ($this->Parent) {
             //
             // Find Forum id by parent
             //
             $sql = "SELECT group_forum_id,thread_id \n\t\t\t\t\tFROM forum\n\t\t\t\t\tWHERE msg_id='{$this->Parent}'";
         } else {
             //
             //	Find forum by arguments passed by aliases file
             //
             $sql = "SELECT group_forum_id, 0 AS thread_id \n\t\t\t\t\tFROM forum_group_list\n\t\t\t\t\tWHERE forum_name='{$argv['2']}'\n\t\t\t\t\tAND group_id='" . $Group->getID() . "'";
         }
         $res = db_query($sql);
         if (!$res || db_numrows($res) < 1) {
             $this->setError('Getting Forum IDs: ' . db_error());
             return false;
         }
         $this->ForumId = db_result($res, 0, 'group_forum_id');
         $this->ThreadId = db_result($res, 0, 'thread_id');
         db_free_result($res);
         $this->Forum = new Forum($Group, $this->ForumId);
     }
     return $this->Forum;
 }
Ejemplo n.º 14
0
 function &getArtifact()
 {
     global $argv;
     // $Group not needed, but let the code here to support
     // tracker additions in the Future
     $Group =& group_get_object_by_name($argv[1]);
     if (!$Group || !is_object($Group)) {
         $this->setError('Could Not Get Group Object');
         return false;
     } elseif ($Group->isError()) {
         $this->setError('Getting Group Object: ' . $Group->getErrorMessage());
         return false;
     }
     // DBG("Artifact_get_object(".$this->ArtifactId.");");
     $this->Artifact =& artifact_get_object($this->ArtifactId);
     return $this->Artifact;
 }
Ejemplo n.º 15
0
 function TuleapMediawikiAuthentication($user, &$result)
 {
     global $fusionforgeproject, $wgGroupPermissions;
     session_set();
     if (session_loggedin()) {
         $tuleap_user = session_get_user();
         $group = group_get_object_by_name($fusionforgeproject);
         $madiawiki_name = ucfirst($tuleap_user->getUnixName());
         $mediawiki_user = User::newFromName($madiawiki_name);
         if ($mediawiki_user->getID() == 0) {
             $mediawiki_user->addToDatabase();
             $mediawiki_user->setPassword(User::randomPassword());
             $mediawiki_user->setRealName($tuleap_user->getRealName());
             $mediawiki_user->setToken();
             $mediawiki_user->loadFromDatabase();
         }
         $user->mId = $mediawiki_user->getID();
         $user->loadFromId();
         $user = manageMediawikiGroupsForUser($user, $tuleap_user, $group);
         $user->setCookies();
         $user->saveSettings();
         wfSetupSession();
     } else {
         $user->logout();
     }
     $result = true;
     return true;
 }
Ejemplo n.º 16
0
            $feed .= urlencode($Language->getText('tracker_gotoid', 'art_is_a', array($art_name, $atn)));
        }
    }
    $location .= "/tracker/?func=detail&aid=" . (int) $aid . "&group_id=" . (int) $art_group_id . "&atid=" . (int) $atid . $feed;
    header($location);
    exit;
}
// Start of main code
$location = "Location: " . get_server_url();
// $atn is the "artifact type name" i.e. the tracker short name detected in the text
// Detected: 'xxx #nnn', transformed to  '$atn #$aid'
$atn = strtolower($request->get('atn'));
// If group_name given as argument then infer group_id first
$group_name = $request->get('group_name');
if ($group_name && !$group_id) {
    $grp = group_get_object_by_name($group_name);
    $group_id = $grp->getGroupId();
}
// Commit and patch are not ambiguous (not trackers)
$svn_loc = "/svn/?func=detailrevision&rev_id=" . (int) $aid . "&group_id=" . (int) $group_id;
$cvs_loc = "/cvs/?func=detailcommit&commit_id=" . (int) $aid . "&group_id=" . (int) $group_id;
if ($atn == 'rev' || $atn == 'revision') {
    $location .= $svn_loc;
    header($location);
    exit;
}
if ($atn == 'commit') {
    // when commit is used see if it revision exists in SVN else redirect to CVS
    $res = svn_data_get_revision_detail($group_id, 0, $aid);
    $feed = '';
    if ($res && db_numrows($res) > 0) {