コード例 #1
0
ファイル: Group.class.php プロジェクト: neymanna/fusionforge
 /**
  *	approve - Approve pending project.
  *
  *	@param	object	The User object who is doing the updating.
  *	@access public
  */
 function approve(&$user)
 {
     if ($this->getStatus() == 'A') {
         $this->setError(_("Group already active"));
         return false;
     }
     db_begin();
     // Step 1: Activate group and create LDAP entries
     if (!$this->setStatus($user, 'A')) {
         db_rollback();
         return false;
     }
     //
     //
     //	Tracker Integration
     //
     //
     $ats = new ArtifactTypes($this);
     if (!$ats || !is_object($ats)) {
         $this->setError(_('Error creating ArtifactTypes object'));
         db_rollback();
         return false;
     } else {
         if ($ats->isError()) {
             $this->setError(sprintf(_('ATS%d: %s'), 1, $ats->getErrorMessage()));
             db_rollback();
             return false;
         }
     }
     if (!$ats->createTrackers()) {
         $this->setError(sprintf(_('ATS%d: %s'), 2, $ats->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	Forum Integration
     //
     //
     $f = new Forum($this);
     if (!$f->create('Open-Discussion', 'General Discussion', 1, '', 1, 0)) {
         $this->setError(sprintf(_('F%d: %s'), 1, $f->getErrorMessage()));
         db_rollback();
         return false;
     }
     $f = new Forum($this);
     if (!$f->create('Help', 'Get Public Help', 1, '', 1, 0)) {
         $this->setError(sprintf(_('F%d: %s'), 2, $f->getErrorMessage()));
         db_rollback();
         return false;
     }
     $f = new Forum($this);
     if (!$f->create('Developers', 'Project Developer Discussion', 0, '', 1, 0)) {
         $this->setError(sprintf(_('F%d: %s'), 3, $f->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	Doc Mgr Integration
     //
     //
     $dg = new DocumentGroup($this);
     if (!$dg->create('Uncategorized Submissions')) {
         $this->setError(sprintf(_('DG: %s'), $dg->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	FRS integration
     //
     //
     $frs = new FRSPackage($this);
     if (!$frs->create($this->getUnixName())) {
         $this->setError(sprintf(_('FRSP: %s'), $frs->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	PM Integration
     //
     //
     $pg = new ProjectGroup($this);
     if (!$pg->create('To Do', 'Things We Have To Do', 1)) {
         $this->setError(sprintf(_('PG%d: %s'), 1, $pg->getErrorMessage()));
         db_rollback();
         return false;
     }
     $pg = new ProjectGroup($this);
     if (!$pg->create('Next Release', 'Items For Our Next Release', 1)) {
         $this->setError(sprintf(_('PG%d: %s'), 2, $pg->getErrorMessage()));
         db_rollback();
         return false;
     }
     //
     //
     //	Set Default Roles
     //
     //
     $role = new Role($this);
     $todo = array_keys($role->defaults);
     for ($c = 0; $c < count($todo); $c++) {
         $role = new Role($this);
         if (!$role->createDefault($todo[$c])) {
             $this->setError(sprintf(_('R%d: %s'), $c, $role->getErrorMessage()));
             db_rollback();
             return false;
         }
     }
     $admin_group = db_query("SELECT user_id FROM user_group \n\t\tWHERE group_id=" . $this->getID() . " AND admin_flags='A'");
     if (db_numrows($admin_group) > 0) {
         $idadmin_group = db_result($admin_group, 0, 'user_id');
     } else {
         $idadmin_group = 1;
     }
     //
     //
     //	Create MailingList
     //
     //
     if ($GLOBALS['sys_use_mail']) {
         $mlist = new MailingList($this);
         if (!$mlist->create('commits', 'Commits', 1, $idadmin_group)) {
             $this->setError(sprintf(_('ML: %s'), $mlist->getErrorMessage()));
             db_rollback();
             return false;
         }
     }
     db_commit();
     $this->sendApprovalEmail();
     $this->addHistory('Approved', 'x');
     //plugin webcal
     //change assistant for webcal
     $params[0] = $idadmin_group;
     $params[1] = $this->getID();
     plugin_hook('change_cal_permission_default', $params);
     return true;
 }
コード例 #2
0
ファイル: deletelist.php プロジェクト: neymanna/fusionforge
    exit_no_group();
}
$Group =& group_get_object($group_id);
if (!$Group || !is_object($Group) || $Group->isError()) {
    exit_no_group();
}
$perm =& $Group->getPermission(session_get_user());
if (!$perm || !is_object($perm) || $perm->isError() || !$perm->isAdmin()) {
    exit_permission_denied();
}
$ml = new MailingList($Group, getIntFromGet('group_list_id'));
if (getStringFromPost('submit')) {
    $sure = getStringFromPost('sure');
    $really_sure = getStringFromPost('really_sure');
    if (!$ml->delete($sure, $really_sure)) {
        exit_error('Error', $ml->getErrorMessage());
    } else {
        header("Location: index.php?group_id={$group_id}&feedback=DELETED");
    }
}
mail_header(array('title' => _('Permanently Delete List')));
?>
<h3><?php 
echo $ml->getName();
?>
</h3>
<p>
<form method="post" action="<?php 
echo getStringFromServer('PHP_SELF');
?>
?group_id=<?php