コード例 #1
0
 * (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, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once 'pre.php';
require_once 'common/user/GenericUserFactory.class.php';
require_once 'common/include/CSRFSynchronizerToken.class.php';
// Valid group id
$valid_groupid = new Valid_GroupId();
$valid_groupid->required();
if (!$request->valid($valid_groupid)) {
    exit_error($Language->getText('project_admin_index', 'invalid_p'), $Language->getText('project_admin_index', 'p_not_found'));
}
$group_id = $request->get('group_id');
//must be a project admin
session_require(array('group' => $group_id, 'admin_flags' => 'A'));
$user_manager = UserManager::instance();
$generic_user_factory = new GenericUserFactory($user_manager, ProjectManager::instance(), new GenericUserDao());
$generic_user = $generic_user_factory->fetch($group_id);
$redirect_url = '/project/admin/editgenericmember.php?group_id=' . (int) $group_id;
$token = new CSRFSynchronizerToken($redirect_url);
if ($request->get('update_generic_user')) {
    $token->check();
    $password = $request->getValidated('password');
コード例 #2
0
ファイル: index.php プロジェクト: pombredanne/tuleap
<?php

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
//
require_once 'pre.php';
require_once '../forum_utils.php';
$is_admin_page = 'y';
$request =& HTTPRequest::instance();
$vGroupId = new Valid_GroupId();
$vGroupId->required();
if ($request->valid($vGroupId) && user_ismember($request->get('group_id'), 'F2')) {
    $group_id = $request->get('group_id');
    $vPostChanges = new Valid_WhiteList('post_changes', array('y'));
    $vPostChanges->required();
    if ($request->isPost() && $request->valid($vPostChanges)) {
        /*
         Update the DB to reflect the changes
        */
        //
        // Prepare validators
        //
        // Forum Name
        $vForumName = new Valid_String('forum_name');
        $vForumName->setErrorMessage($Language->getText('forum_admin_index', 'params_missing'));
        $vForumName->required();
        // Description
        $vDescription = new Valid_String('description');
コード例 #3
0
<?php

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
//
$vGroupId = new Valid_GroupId();
$vGroupId->required();
if (!$request->valid($vGroupId)) {
    exit_no_group();
    // need a group_id !!!
} else {
    $group_id = $request->get('group_id');
    $hp =& Codendi_HTMLPurifier::instance();
    svn_header(array('title' => $Language->getText('svn_browse_revision', 'browsing'), 'help' => 'svn.html#the-subversion-browsing-interface'));
    $vOffset = new Valid_UInt('offset');
    $vOffset->required();
    if ($request->valid($vOffset)) {
        $offset = $request->get('offset');
    } else {
        $offset = 0;
    }
    $vChunksz = new Valid_UInt('chunksz');
    $vChunksz->required();
    if ($request->valid($vChunksz)) {
        $chunksz = $request->get('chunksz');
    } else {
        $chunksz = 15;
    }
コード例 #4
0
ファイル: Git.class.php プロジェクト: LouisRenWeiWei/tuleap
 public function _dispatchActionAndView($action, $repoId, $repositoryName, $user)
 {
     $pane = $this->request->get('pane');
     switch ($action) {
         #CREATE REF
         case 'create':
             $this->addView('create');
             break;
             #admin
         #admin
         case 'view':
             $this->addAction('getRepositoryDetails', array($this->groupId, $repoId));
             $this->addView('view');
             break;
             #ADD REF
         #ADD REF
         case 'add':
             $this->addAction('createReference', array($this->groupId, $repositoryName));
             $this->addView('index');
             break;
             #DELETE a repository
         #DELETE a repository
         case 'del':
             $this->addAction('deleteRepository', array($this->groupId, $repoId));
             $this->addView('index');
             break;
             #EDIT
         #EDIT
         case 'edit':
             $repository = $this->factory->getRepositoryById($repoId);
             if (empty($repository)) {
                 $this->addError($this->getText('actions_params_error'));
                 $this->redirect('/plugins/git/?action=index&group_id=' . $this->groupId);
                 return false;
             }
             if ($this->isAPermittedAction('clone') && $this->request->get('clone')) {
                 $valid = new Valid_UInt('parent_id');
                 $valid->required();
                 if ($this->request->valid($valid)) {
                     $parentId = (int) $this->request->get('parent_id');
                 }
                 $this->addAction('cloneRepository', array($this->groupId, $repositoryName, $parentId));
                 $this->addAction('getRepositoryDetails', array($this->groupId, $parentId));
                 $this->addView('view');
             } else {
                 if ($this->isAPermittedAction('save') && $this->request->get('save')) {
                     $repoDesc = null;
                     if ($this->request->exist('repo_desc')) {
                         $repoDesc = GitRepository::DEFAULT_DESCRIPTION;
                         $valid = new Valid_Text('repo_desc');
                         $valid->required();
                         if ($this->request->valid($valid)) {
                             $repoDesc = $this->request->get('repo_desc');
                         }
                     }
                     $repoAccess = null;
                     $valid = new Valid_String('repo_access');
                     $valid->required();
                     if ($this->request->valid($valid) || is_array($this->request->get('repo_access'))) {
                         $repoAccess = $this->request->get('repo_access');
                     }
                     $this->addAction('save', array($this->groupId, $repoId, $repoAccess, $repoDesc, $pane));
                     $this->addView('view');
                 } else {
                     $this->addError($this->getText('controller_access_denied'));
                     $this->redirect('/plugins/git/?group_id=' . $this->groupId);
                 }
             }
             break;
             #repo_management
         #repo_management
         case 'repo_management':
             $repository = $this->factory->getRepositoryById($repoId);
             if (empty($repository)) {
                 $this->addError($this->getText('actions_repo_not_found'));
                 $this->redirect('/plugins/git/?action=index&group_id=' . $this->groupId);
                 return false;
             }
             $this->addAction('repoManagement', array($repository));
             $this->addView('repoManagement');
             break;
         case 'mail':
             $this->processRepoManagementNotifications($pane, $repoId, $repositoryName, $user);
             break;
             #fork
         #fork
         case 'fork':
             $this->addAction('repoManagement', array($this->groupId, $repoId));
             $this->addView('forkRepositories');
             break;
             #confirm_private
         #confirm_private
         case 'confirm_private':
             if ($this->isAPermittedAction('confirm_deletion') && $this->request->get('confirm_deletion')) {
                 $repository = $this->factory->getRepositoryById($repoId);
                 $this->addAction('confirmDeletion', array($this->groupId, $repository));
                 $this->addView('confirm_deletion', array(0 => array('repo_id' => $repoId)));
             } else {
                 if ($this->isAPermittedAction('save') && $this->request->get('save')) {
                     $valid = new Valid_Text('repo_desc');
                     $valid->required();
                     if ($this->request->valid($valid)) {
                         $repoDesc = $this->request->get('repo_desc');
                     }
                     $valid = new Valid_String('repo_access');
                     $valid->required();
                     if ($this->request->valid($valid)) {
                         $repoAccess = $this->request->get('repo_access');
                     }
                     $this->addAction('confirmPrivate', array($this->groupId, $repoId, $repoAccess, $repoDesc));
                     $this->addView('confirmPrivate');
                 }
             }
             break;
             #SET TO PRIVATE
         #SET TO PRIVATE
         case 'set_private':
             $this->addAction('setPrivate', array($this->groupId, $repoId));
             $this->addView('view');
             break;
         case 'fork_repositories':
             $this->addAction('getProjectRepositoryList', array($this->groupId));
             $this->addView('forkRepositories');
             break;
         case 'admin-git-admins':
             if ($this->request->get('submit')) {
                 $valid = new Valid_Numeric(GitPresenters_AdminGitAdminsPresenter::GIT_ADMIN_SELECTBOX_NAME);
                 $project = $this->projectManager->getProject($this->groupId);
                 if ($this->request->validArray($valid)) {
                     $select_project_ids = $this->request->get(GitPresenters_AdminGitAdminsPresenter::GIT_ADMIN_SELECTBOX_NAME);
                     if ($select_project_ids) {
                         $this->addAction('updateGitAdminGroups', array($project, $user, $select_project_ids));
                     } else {
                         $this->addError($this->getText('no_data_retrieved'));
                     }
                 } else {
                     $this->addError($this->getText('not_valid_request'));
                 }
             }
             $this->addView('adminGitAdminsView', array($this->areMirrorsEnabledForProject()));
             break;
         case 'admin':
         case 'admin-gerrit-templates':
             $project = $this->projectManager->getProject($this->groupId);
             if ($this->request->get('save')) {
                 $template_content = $this->request->getValidated('git_admin_config_data', 'text');
                 if ($this->request->getValidated('git_admin_template_id', 'uint')) {
                     $template_id = $this->request->get('git_admin_template_id');
                     $this->addAction('updateTemplate', array($project, $user, $template_content, $template_id));
                 } else {
                     $template_name = $this->request->getValidated('git_admin_file_name', 'string');
                     $this->addAction('createTemplate', array($project, $user, $template_content, $template_name));
                 }
             }
             if ($this->request->get('delete')) {
                 if ($this->request->getValidated('git_admin_template_id', 'uint')) {
                     $template_id = $this->request->get('git_admin_template_id');
                     $this->addAction('deleteGerritTemplate', array($template_id, $project, $user));
                 }
             }
             if ($this->permissions_manager->userIsGitAdmin($user, $project)) {
                 $this->addAction('generateGerritRepositoryAndTemplateList', array($project, $user));
                 $this->addView('adminGerritTemplatesView', array($this->areMirrorsEnabledForProject()));
             } else {
                 $this->addError($this->getText('controller_access_denied'));
                 $this->redirect('/plugins/git/?action=index&group_id=' . $this->groupId);
                 return false;
             }
             break;
         case 'admin-mass-update':
             if ($this->request->get('save-mass-change') || $this->request->get('go-to-mass-change')) {
                 $this->checkSynchronizerToken('/plugins/git/?group_id=' . (int) $this->groupId . '&action=admin-mass-update');
                 $repositories = $this->getRepositoriesFromIds($this->request->get('repository_ids'));
                 if (!$repositories) {
                     $this->addError($this->getText('actions_repo_not_found'));
                     $this->redirect('/plugins/git/?action=index&group_id=' . $this->groupId);
                 }
             }
             if ($this->request->get('go-to-mass-change')) {
                 $this->addAction('setSelectedRepositories', array($repositories));
                 $this->addView('adminMassUpdateView');
                 return;
             }
             if ($this->request->get('save-mass-change')) {
                 $this->addAction('updateMirroring', array($this->request->getProject(), $repositories, $this->request->get('selected_mirror_ids')));
             }
             $this->addView('adminMassUpdateSelectRepositoriesView');
             break;
         case 'admin-default-settings':
             $this->addView('adminDefaultSettings', array($this->areMirrorsEnabledForProject()));
             break;
         case 'fetch_git_config':
             $project = $this->projectManager->getProject($this->groupId);
             $this->setDefaultPageRendering(false);
             $this->addAction('fetchGitConfig', array($repoId, $user, $project));
             break;
         case 'fetch_git_template':
             $project = $this->projectManager->getProject($this->groupId);
             $template_id = $this->request->getValidated('template_id', 'uint');
             $this->setDefaultPageRendering(false);
             $this->addAction('fetchGitTemplate', array($template_id, $user, $project));
             break;
         case 'fork_repositories_permissions':
             $scope = self::SCOPE_PERSONAL;
             $valid = new Valid_UInt('repos');
             $valid->required();
             if ($this->request->validArray($valid)) {
                 $repos = $this->request->get('repos');
             }
             $valid = new Valid_UInt('to_project');
             if ($this->request->valid($valid)) {
                 $toProject = $this->request->get('to_project');
             }
             $valid = new Valid_String('path');
             $valid->required();
             $path = '';
             if ($this->request->valid($valid)) {
                 $path = $this->request->get('path');
             }
             $valid = new Valid_String('choose_destination');
             $valid->required();
             if ($this->request->valid($valid)) {
                 $scope = $this->request->get('choose_destination');
             }
             if (!empty($repos)) {
                 $this->addAction('forkRepositoriesPermissions', array($repos, $toProject, $path, $scope));
                 $this->addView('forkRepositoriesPermissions');
             } else {
                 $this->addError($this->getText('actions_params_error'));
                 $this->addAction('getProjectRepositoryList', array($this->groupId));
                 $this->addView('forkRepositories');
             }
             break;
         case 'do_fork_repositories':
             try {
                 if ($this->request->get('choose_destination') == self::SCOPE_PERSONAL) {
                     if ($this->user->isMember($this->groupId)) {
                         $this->_doDispatchForkRepositories($this->request, $user);
                     } else {
                         $this->addError($this->getText('controller_access_denied'));
                     }
                 } else {
                     $this->_doDispatchForkCrossProject($this->request, $user);
                 }
             } catch (MalformedPathException $e) {
                 $this->addError($this->getText('fork_malformed_path'));
             }
             $this->addAction('getProjectRepositoryList', array($this->groupId));
             $this->addView('forkRepositories');
             break;
         case "view_last_git_pushes":
             $vGroupId = new Valid_GroupId();
             $vGroupId->required();
             if ($this->request->valid($vGroupId)) {
                 $groupId = $this->request->get('group_id');
             }
             $vWeeksNumber = new Valid_UInt('weeks_number');
             if ($this->request->valid($vWeeksNumber)) {
                 $weeksNumber = $this->request->get('weeks_number');
             }
             if (empty($weeksNumber) || $weeksNumber > Git_LastPushesGraph::MAX_WEEKSNUMBER) {
                 $weeksNumber = 12;
             }
             $imageRenderer = new Git_LastPushesGraph($groupId, $weeksNumber);
             $imageRenderer->display();
             break;
         case 'migrate_to_gerrit':
             if (ForgeConfig::get('sys_auth_type') !== ForgeConfig::AUTH_TYPE_LDAP) {
                 $this->redirect('/plugins/git/?group_id=' . $this->groupId);
                 break;
             }
             $repo = $this->factory->getRepositoryById($repoId);
             $remote_server_id = $this->request->getValidated('remote_server_id', 'uint');
             $gerrit_template_id = $this->getValidatedGerritTemplateId($repo);
             if (empty($repo) || empty($remote_server_id) || empty($gerrit_template_id)) {
                 $this->addError($this->getText('actions_params_error'));
                 $this->redirect('/plugins/git/?group_id=' . $this->groupId);
             } else {
                 try {
                     $project_exists = $this->gerritProjectAlreadyExists($remote_server_id, $repo);
                     if ($project_exists) {
                         $this->addError($this->getText('gerrit_project_exists'));
                     } else {
                         $this->addAction('migrateToGerrit', array($repo, $remote_server_id, $gerrit_template_id));
                     }
                 } catch (Git_Driver_Gerrit_Exception $e) {
                     $this->addError($this->getText('gerrit_server_down'));
                 }
                 $this->addAction('redirectToRepoManagementWithMigrationAccessRightInformation', array($this->groupId, $repoId, $pane));
             }
             break;
         case 'disconnect_gerrit':
             $repo = $this->factory->getRepositoryById($repoId);
             if (empty($repo)) {
                 $this->addError($this->getText('actions_params_error'));
                 $this->redirect('/plugins/git/?group_id=' . $this->groupId);
             } else {
                 $this->addAction('disconnectFromGerrit', array($repo));
                 $this->addAction('redirectToRepoManagement', array($this->groupId, $repoId, $pane));
             }
             break;
         case 'delete_gerrit_project':
             $repo = $this->factory->getRepositoryById($repoId);
             $server = $this->gerrit_server_factory->getServerById($repo->getRemoteServerId());
             $project_gerrit_name = $this->driver_factory->getDriver($server)->getGerritProjectName($repo);
             try {
                 $this->driver_factory->getDriver($server)->deleteProject($server, $project_gerrit_name);
             } catch (ProjectDeletionException $exception) {
                 $this->addError($this->getText('project_deletion_not_possible', array($project_gerrit_name, $exception->getMessage())));
             } catch (Git_Driver_Gerrit_Exception $e) {
                 $this->addError($this->getText('gerrit_server_down'));
             }
             $migrate_access_right = $this->request->existAndNonEmpty('migrate_access_right');
             $this->addAction('redirectToRepoManagementWithMigrationAccessRightInformation', array($this->groupId, $repoId, $pane));
             break;
         case 'update_mirroring':
             $repository = $this->factory->getRepositoryById($repoId);
             if (!$repository) {
                 $this->addError($this->getText('actions_repo_not_found'));
             }
             $selected_mirror_ids = $this->request->get('selected_mirror_ids');
             if (is_array($selected_mirror_ids)) {
                 $this->addAction('updateMirroring', array($this->request->getProject(), array($repository), $selected_mirror_ids));
             } else {
                 $this->addError($this->getText('actions_mirror_ids_not_valid'));
             }
             $this->addAction('redirectToRepoManagement', array($this->groupId, $repository->getId(), $pane));
             break;
         case 'update_default_mirroring':
             $project = $this->request->getProject();
             $selected_mirror_ids = $this->request->get('selected_mirror_ids');
             if (is_array($selected_mirror_ids)) {
                 $this->addAction('updateDefaultMirroring', array($project, $selected_mirror_ids));
             } else {
                 $this->addError($this->getText('actions_mirror_ids_not_valid'));
             }
             $this->addView('adminDefaultSettings', array($this->areMirrorsEnabledForProject()));
             break;
         case 'restore':
             $this->addAction('restoreRepository', array($repoId, $this->groupId));
             break;
             #LIST
         #LIST
         default:
             $user_id = null;
             $valid = new Valid_UInt('user');
             $valid->required();
             if ($this->request->valid($valid)) {
                 $user_id = $this->request->get('user');
                 $this->addData(array('user' => $user_id));
             }
             $this->addAction('getProjectRepositoryList', array($this->groupId, $user_id));
             $this->addView('index');
             break;
     }
 }
コード例 #5
0
<?php

//
// Codendi
// Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
// Copyright (c) Enalean, 2015. All Rights Reserved.
// http://www.codendi.com
//
//
require_once 'pre.php';
require_once 'common/frs/FRSFileFactory.class.php';
require_once 'common/frs/FRSPackageFactory.class.php';
$vGroupId = new Valid_GroupId();
$vGroupId->required();
$vFileId = new Valid_UInt('file_id');
$vFileId->required();
if ($request->valid($vGroupId) && $request->valid($vFileId)) {
    $group_id = $request->get('group_id');
    $file_id = $request->get('file_id');
} else {
    exit_missing_param();
}
$frsff = new FRSFileFactory();
$frspf = new FRSPackageFactory();
// Must have a group_id and file_id otherwise
// we cannot do much
if (!$file_id || !$group_id) {
    exit_missing_param();
}
if (!$GLOBALS['sys_frs_license_mandatory']) {
    // Display license popup?
コード例 #6
0
ファイル: submit.php プロジェクト: nterray/tuleap
<?php

//
// SourceForge: Breaking Down the Barriers to Open Source Development
// Copyright 1999-2000 (c) The SourceForge Crew
// http://sourceforge.net
//
//
require_once 'pre.php';
require_once '../news/news_utils.php';
$request =& HTTPRequest::instance();
$validGroupId = new Valid_GroupId();
$validGroupId->required();
if ($request->valid($validGroupId)) {
    $group_id = $request->get('group_id');
} else {
    exit_no_group();
}
if (user_isloggedin()) {
    if (user_ismember($group_id, 'A') || user_ismember($group_id, 'N1') || user_ismember($group_id, 'N2')) {
        if ($request->get('post_changes')) {
            $validSummary = new Valid_String('summary');
            $validSummary->setErrorMessage('Summary is required');
            $validSummary->required();
            $validDetails = new Valid_Text('details');
            $validPrivateNews = new Valid_WhiteList('private_news', array('0', '1'));
            $validSummary->required();
            $validPromoteNews = new Valid_WhiteList('promote_news', array('0', '3'));
            $validSummary->required();
            if ($request->valid($validSummary) && $request->valid($validDetails) && $request->valid($validPrivateNews) && $request->valid($validPromoteNews)) {
                /*
コード例 #7
0
 public function _dispatchActionAndView($action, $repoId, $repositoryName, $user)
 {
     switch ($action) {
         #CREATE REF
         case 'create':
             $this->addView('create');
             break;
             #admin
         #admin
         case 'view':
             $this->addAction('getRepositoryDetails', array($this->groupId, $repoId));
             $this->addView('view');
             break;
             #ADD REF
         #ADD REF
         case 'add':
             $this->addAction('createReference', array($this->groupId, $repositoryName));
             $this->addView('index');
             break;
             #DELETE a repository
         #DELETE a repository
         case 'del':
             $this->addAction('deleteRepository', array($this->groupId, $repoId));
             $this->addView('index');
             break;
             #EDIT
         #EDIT
         case 'edit':
             if ($this->isAPermittedAction('clone') && $this->request->get('clone')) {
                 $valid = new Valid_UInt('parent_id');
                 $valid->required();
                 if ($this->request->valid($valid)) {
                     $parentId = (int) $this->request->get('parent_id');
                 }
                 $this->addAction('cloneRepository', array($this->groupId, $repositoryName, $parentId));
                 $this->addAction('getRepositoryDetails', array($this->groupId, $parentId));
                 $this->addView('view');
             } else {
                 if ($this->isAPermittedAction('confirm_deletion') && $this->request->get('confirm_deletion')) {
                     $this->addAction('confirmDeletion', array($this->groupId, $repoId));
                     $this->addView('confirm_deletion', array(0 => array('repo_id' => $repoId)));
                 } else {
                     if ($this->isAPermittedAction('save') && $this->request->get('save')) {
                         $valid = new Valid_Text('repo_desc');
                         $valid->required();
                         if ($this->request->valid($valid)) {
                             $repoDesc = $this->request->get('repo_desc');
                         }
                         $valid = new Valid_String('repo_access');
                         $valid->required();
                         if ($this->request->valid($valid) || is_array($this->request->get('repo_access'))) {
                             $repoAccess = $this->request->get('repo_access');
                         }
                         $this->addAction('save', array($this->groupId, $repoId, $repoAccess, $repoDesc));
                         $this->addView('view');
                     } else {
                         $this->addError($this->getText('controller_access_denied'));
                         $this->redirect('/plugins/git/?group_id=' . $this->groupId);
                     }
                 }
             }
             break;
             #repo_management
         #repo_management
         case 'repo_management':
             $this->addAction('repoManagement', array($this->groupId, $repoId));
             $this->addView('repoManagement');
             break;
             #mail prefix
         #mail prefix
         case 'mail_prefix':
             $valid = new Valid_String('mail_prefix');
             $valid->required();
             if ($this->request->valid($valid)) {
                 $mailPrefix = $this->request->get('mail_prefix');
             } else {
                 $mailPrefix = '';
             }
             $this->addAction('notificationUpdatePrefix', array($this->groupId, $repoId, $mailPrefix));
             $this->addView('repoManagement');
             break;
             #add mail
         #add mail
         case 'add_mail':
             $validMails = array();
             $mails = array_map('trim', preg_split('/[,;]/', $this->request->get('add_mail')));
             $rule = new Rule_Email();
             $um = UserManager::instance();
             foreach ($mails as $mail) {
                 if ($rule->isValid($mail)) {
                     $validMails[] = $mail;
                 } else {
                     $user = $um->findUser($mail);
                     if ($user) {
                         $mail = $user->getEmail();
                         if ($mail) {
                             $validMails[] = $mail;
                         } else {
                             $this->addError($this->getText('no_user_mail', array($mail)));
                         }
                     } else {
                         $this->addError($this->getText('no_user', array($mail)));
                     }
                 }
             }
             $this->addAction('notificationAddMail', array($this->groupId, $repoId, $validMails));
             $this->addView('repoManagement');
             break;
             #remove mail
         #remove mail
         case 'remove_mail':
             $mails = array();
             $valid = new Valid_Email('mail');
             $valid->required();
             if ($this->request->validArray($valid)) {
                 $mails = $this->request->get('mail');
             }
             if (count($mails) > 0) {
                 $this->addAction('notificationRemoveMail', array($this->groupId, $repoId, $mails));
                 $this->addView('repoManagement');
             } else {
                 $this->addAction('repoManagement', array($this->groupId, $repoId));
                 $this->addView('repoManagement');
             }
             break;
             #fork
         #fork
         case 'fork':
             $this->addAction('repoManagement', array($this->groupId, $repoId));
             $this->addView('forkRepositories');
             break;
             #confirm_private
         #confirm_private
         case 'confirm_private':
             if ($this->isAPermittedAction('confirm_deletion') && $this->request->get('confirm_deletion')) {
                 $this->addAction('confirmDeletion', array($this->groupId, $repoId));
                 $this->addView('confirm_deletion', array(0 => array('repo_id' => $repoId)));
             } else {
                 if ($this->isAPermittedAction('save') && $this->request->get('save')) {
                     $valid = new Valid_Text('repo_desc');
                     $valid->required();
                     if ($this->request->valid($valid)) {
                         $repoDesc = $this->request->get('repo_desc');
                     }
                     $valid = new Valid_String('repo_access');
                     $valid->required();
                     if ($this->request->valid($valid)) {
                         $repoAccess = $this->request->get('repo_access');
                     }
                     $this->addAction('confirmPrivate', array($this->groupId, $repoId, $repoAccess, $repoDesc));
                     $this->addView('confirmPrivate');
                 }
             }
             break;
             #SET TO PRIVATE
         #SET TO PRIVATE
         case 'set_private':
             $this->addAction('setPrivate', array($this->groupId, $repoId));
             $this->addView('view');
             break;
         case 'fork_repositories':
             $this->addAction('getProjectRepositoryList', array($this->groupId));
             $this->addView('forkRepositories');
             break;
         case 'do_fork_repositories':
             try {
                 if ($this->request->get('choose_destination') == 'personal') {
                     $this->_doDispatchForkRepositories($this->request, $user);
                 } else {
                     $this->_doDispatchForkCrossProject($this->request, $user);
                 }
             } catch (MalformedPathException $e) {
                 $this->addError($this->getText('fork_malformed_path'));
             }
             $this->addAction('getProjectRepositoryList', array($this->groupId));
             $this->addView('forkRepositories');
             break;
         case "view_last_git_pushes":
             $vGroupId = new Valid_GroupId();
             $vGroupId->required();
             if ($this->request->valid($vGroupId)) {
                 $groupId = $this->request->get('group_id');
             }
             $vWeeksNumber = new Valid_UInt('weeks_number');
             if ($this->request->valid($vWeeksNumber)) {
                 $weeksNumber = $this->request->get('weeks_number');
             }
             if (empty($weeksNumber) || $weeksNumber > Git_LastPushesGraph::MAX_WEEKSNUMBER) {
                 $weeksNumber = 12;
             }
             $imageRenderer = new Git_LastPushesGraph($groupId, $weeksNumber);
             $imageRenderer->display();
             break;
             #LIST
         #LIST
         default:
             $user_id = null;
             $valid = new Valid_UInt('user');
             $valid->required();
             if ($this->request->valid($valid)) {
                 $user_id = $this->request->get('user');
                 $this->addData(array('user' => $user_id));
             }
             $this->addAction('getProjectRepositoryList', array($this->groupId, $user_id));
             $this->addView('index');
             break;
     }
 }
コード例 #8
0
ファイル: frsajax.php プロジェクト: pombredanne/tuleap
             $feedback = new Feedback();
             $feedback->log('error', $errors[0]);
             $header = array('valid' => false, 'msg' => $feedback->fetch());
         }
         header(json_header($header));
     }
 } else {
     if ($action == 'validator_frs_update') {
         $vName = new Valid_String('name');
         $vDate = new Valid_String('date');
         $vDate->required();
         $vPackageId = new Valid_UInt('package_id');
         $vPackageId->required();
         $vReleaseId = new Valid_UInt('release_id');
         $vReleaseId->required();
         $vGroupId = new Valid_GroupId();
         $vGroupId->required();
         if ($request->valid($vName) && $request->valid($vDate) && $request->valid($vGroupId) && $request->valid($vPackageId) && $request->valid($vReleaseId)) {
             $name = $request->get('name');
             $package_id = $request->get('package_id');
             $date = $request->get('date');
             $group_id = $request->get('group_id');
             $release_id = $request->get('release_id');
             $validator = new frsValidator();
             $release = array('name' => $name, 'release_id' => $release_id, 'package_id' => $package_id, 'date' => $date);
             if ($validator->isValidForUpdate($release, $group_id)) {
                 //frs valid
                 $header = array('valid' => true);
             } else {
                 //frs non valid
                 $errors = $validator->getErrors();
コード例 #9
0
ファイル: hudson.class.php プロジェクト: pombredanne/tuleap
 function request()
 {
     $request =& HTTPRequest::instance();
     $vgi = new Valid_GroupId();
     $vgi->required();
     if ($request->valid($vgi)) {
         $group_id = $request->get('group_id');
         $pm = ProjectManager::instance();
         $project = $pm->getProject($group_id);
         if ($project->usesService('hudson')) {
             $user = UserManager::instance()->getCurrentUser();
             if ($user->isMember($group_id)) {
                 switch ($request->get('action')) {
                     case 'add_job':
                         if ($user->isMember($group_id, 'A')) {
                             if ($request->exist('hudson_job_url') && trim($request->get('hudson_job_url') != '')) {
                                 $this->action = 'addJob';
                             } else {
                                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'job_url_missing'));
                             }
                             $this->view = 'projectOverview';
                         } else {
                             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'perm_denied'));
                             $this->view = 'projectOverview';
                         }
                         break;
                     case 'edit_job':
                         if ($user->isMember($group_id, 'A')) {
                             if ($request->exist('job_id')) {
                                 $this->view = 'editJob';
                             } else {
                                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'job_id_missing'));
                             }
                         } else {
                             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'perm_denied'));
                             $this->view = 'projectOverview';
                         }
                         break;
                     case 'update_job':
                         if ($user->isMember($group_id, 'A')) {
                             if ($request->exist('job_id')) {
                                 if ($request->exist('hudson_job_url') && $request->get('hudson_job_url') != '') {
                                     $this->action = 'updateJob';
                                 } else {
                                     $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'job_url_missing'));
                                 }
                             } else {
                                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'job_id_missing'));
                             }
                             $this->view = 'projectOverview';
                         } else {
                             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'perm_denied'));
                             $this->view = 'projectOverview';
                         }
                         break;
                     case 'delete_job':
                         if ($user->isMember($group_id, 'A')) {
                             if ($request->exist('job_id')) {
                                 $this->action = 'deleteJob';
                             } else {
                                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'job_id_missing'));
                             }
                             $this->view = 'projectOverview';
                         } else {
                             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'perm_denied'));
                             $this->view = 'projectOverview';
                         }
                         break;
                     case "view_job":
                         $this->view = 'job_details';
                         break;
                     case "view_build":
                         $this->view = 'build_number';
                         break;
                     case "view_last_build":
                         $this->view = 'last_build';
                         break;
                     case "view_last_test_result":
                         $this->view = 'last_test_result';
                         break;
                     case "view_test_trend":
                         $this->view = 'test_trend';
                         break;
                     default:
                         $this->view = 'projectOverview';
                         break;
                 }
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'perm_denied'));
             }
         } else {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'service_not_used'));
         }
     } else {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_hudson', 'group_id_missing'));
     }
 }
コード例 #10
0
ファイル: sparklines.php プロジェクト: pombredanne/tuleap
 * You should have received a copy of the GNU General Public License
 * along with Tuleap; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
require_once 'pre.php';
$sparklines = array();
$reference_manager = ReferenceManager::instance();
$project_manager = ProjectManager::instance();
$json = array();
$sparkline_urls = $request->get('sparklines');
if (is_array($sparkline_urls)) {
    foreach ($sparkline_urls as $url) {
        //Get sparkline parameters via the url
        $parameters = parse_url($url, PHP_URL_QUERY);
        parse_str($parameters, $sparkline);
        $vGroupId = new Valid_GroupId();
        $group_id = 100;
        if (isset($sparkline['group_id']) && $vGroupId->validate($sparkline['group_id'])) {
            $group_id = $sparkline['group_id'];
        }
        $v = new Valid_String();
        $v->required();
        if (isset($sparkline['key']) && isset($sparkline['val']) && $v->validate($sparkline['key']) && $v->validate($sparkline['val'])) {
            $key = $sparkline['key'];
            $val = $sparkline['val'];
            if ($key == 'wiki') {
                $args[] = $val;
            } else {
                $args = explode("/", $val);
            }
            //Get the reference