function work($scope, $username, $repository, $developer)
{
	// Get some basic data
	$network		= get_network($username, $repository);
	$collaborators	= get_collaborators($username, $repository);

	if ($network === false || $collaborators === false)
	{
		echo "Error: failed to retrieve network or collaborators\n";
		return 1;
	}

	switch ($scope)
	{
		case 'collaborators':
			$remotes = array_intersect_key($network, $collaborators);
		break;

		case 'organisation':
			$remotes = array_intersect_key($network, get_organisation_members($username));
		break;

		case 'contributors':
			$remotes = array_intersect_key($network, get_contributors($username, $repository));
		break;

		case 'network':
			$remotes = $network;
		break;

		default:
			show_usage();
	}

	if (file_exists('.git'))
	{
		add_remote($username, $repository, isset($collaborators[$developer]));
	}
	else
	{
		clone_repository($username, $repository, isset($collaborators[$developer]));
	}

	// Add private security repository for developers
	if ($username == 'phpbb' && $repository == 'phpbb3' && isset($collaborators[$developer]))
	{
		run("git remote add $username-security " . get_repository_url($username, "$repository-security", true));
	}

	// Skip blessed repository.
	unset($remotes[$username]);

	foreach ($remotes as $remote)
	{
		add_remote($remote['username'], $remote['repository'], $remote['username'] == $developer);
	}

	run('git remote update');
}
예제 #2
0
             <div id="users"></div>
             <span class="basic-grey-text">Может изменять этот документ</span>
             <input type="checkbox" name="can_modify" value="1">
             <input type="submit" name="add_con" value="Добавить сотрудника">
         </form>
         </body>
         </html>
 ';
 $users = get_users($_SESSION['ID']);
 $users_string = '<select name="con_id"><option enabled> Выберите сотрудника</option>';
 foreach ($users['ID'] as $i => $user) {
     $users_string .= '<option value="' . $users['ID'][$i] . '">' . $users['SURNAME'][$i] . ' ' . $users['NAME'][$i] . '</option>';
 }
 $users_string .= '</select>';
 set_element_html('users', $users_string);
 $contributors = get_contributors($_GET['document_id']);
 foreach ($contributors['CONTRIBUTOR'] as $i => $contributor) {
     $user = get_user($contributors['CONTRIBUTOR'][$i]);
     if ($contributors['WATCH_ONLY'][$i] == 1) {
         $watch_string = 'просмотр';
     } else {
         if ($contributors['WATCH_ONLY'][$i] == 2) {
             $watch_string = 'просмотр и редактирование';
         } else {
             $watch_string = 'автор';
         }
     }
     echo '<div class="basic-grey">';
     if ($contributors['WATCH_ONLY'][$i] == 3) {
         echo '<b>' . $user['SURNAME'] . ' ' . $user['NAME'] . '</b> (' . $watch_string . ') </br>';
     } else {