Exemplo n.º 1
0
 public function commit()
 {
     require_once 'emails.inc.php';
     if ($this->asso == 'alias') {
         foreach ($this->members as $member) {
             add_to_list_alias($member, $this->liste, $this->domain);
         }
     } else {
         $members = User::getBulkForlifeEmails($this->members, true, array('ListsModule', 'no_login_callback'));
         $owners = User::getBulkForlifeEmails($this->owners, true, array('ListsModule', 'no_login_callback'));
         // Make sure we send a list (array_values) of unique (array_unique)
         // emails.
         $owners = array_values(array_unique($owners));
         $members = array_values(array_unique($members));
         $success = MailingList::create($this->liste, $this->domain, S::user(), $this->desc, $this->advertise, $this->modlevel, $this->inslevel, $owners, $members);
         if ($success) {
             create_list($this->liste, $this->domain);
         }
         return $success;
     }
 }
Exemplo n.º 2
0
 /**
  *	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;
 }
Exemplo n.º 3
0
 function handler_create($page)
 {
     if (!$this->get_lists_domain()) {
         return PL_NOT_FOUND;
     }
     $page->changeTpl('xnetlists/create.tpl');
     if (!Post::has('submit')) {
         return;
     } else {
         S::assert_xsrf_token();
     }
     if (!Post::has('liste') || !Post::t('liste')) {
         $page->trigError('Le champs «&nbsp;adresse souhaitée&nbsp;» est vide.');
         return;
     }
     $list = strtolower(Post::t('liste'));
     if (!preg_match("/^[a-zA-Z0-9\\-]*\$/", $list)) {
         $page->trigError('le nom de la liste ne doit contenir que des lettres non accentuées, chiffres et tirets');
         return;
     }
     require_once 'emails.inc.php';
     if (list_exist($list, $this->get_lists_domain())) {
         $page->trigError('Cet alias est déjà pris.');
         return;
     }
     if (!Post::t('desc')) {
         $page->trigError('Le sujet est vide.');
         return;
     }
     $mlist = $this->prepare_list($list);
     $success = MailingList::create($mlist->mbox, $mlist->domain, S::user(), Post::t('desc'), Post::t('advertise'), Post::t('modlevel'), Post::t('inslevel'), array(S::user()->forlifeEmail()), array(S::user()->forlifeEmail()));
     if (!$success) {
         $page->kill("Un problème est survenu, contacter " . "<a href='mailto:support@m4x.org'>support@m4x.org</a>");
         return;
     }
     create_list($mlist->mbox, $mlist->domain);
     global $globals;
     XDB::execute("UPDATE  groups\n                         SET  flags = CONCAT_WS(',', IF(flags = '', NULL, flags), 'has_ml')\n                       WHERE  id = {?}", $globals->asso('id'));
     pl_redirect('lists/admin/' . $list);
 }