function send_new_project_email($group_id) { global $Language; $res_grp = db_query("SELECT * FROM groups WHERE group_id='" . db_ei($group_id) . "'"); if (db_numrows($res_grp) < 1) { echo $Language->getText('include_proj_email', 'g_not_exist', $group_id); } $row_grp = db_fetch_array($res_grp); $res_admins = db_query("SELECT user.user_name,user.email FROM user,user_group WHERE " . "user.user_id=user_group.user_id AND user_group.group_id='" . db_ei($group_id) . "' AND " . "user_group.admin_flags='A'"); $nb_recipients = db_numrows($res_admins); if ($nb_recipients < 1) { echo $Language->getText('include_proj_email', 'no_admin', $group_id); } // send one email per admin $nb_mail_failed = 0; $pm = ProjectManager::instance(); while ($row_admins = db_fetch_array($res_admins)) { $server = get_server_url(); $p = $pm->getProject($group_id); $host = $GLOBALS['sys_default_domain']; if ($p && $p->usesService('svn')) { $sf = new ServerFactory(); if ($s =& $sf->getServerById($p->services['svn']->getServerId())) { $host = URL::getHost($s->getUrl(session_issecure())); } } if ($GLOBALS['sys_force_ssl']) { $svn_url = 'https://' . $host; } else { $svn_url = 'http://svn.' . $row_grp['unix_group_name'] . '.' . $host; } $svn_url .= '/svnroot/' . $row_grp['unix_group_name']; // $message is defined in the content file include $Language->getContent('include/new_project_email'); // LJ Uncomment to test //echo $message; return $mail = new Mail(); $mail->setTo($row_admins['email']); $mail->setSubject($GLOBALS['sys_name'] . ' ' . $Language->getText('include_proj_email', 'proj_approve', $row_grp['unix_group_name'])); $mail->setBody($message); $mail->setFrom($GLOBALS['sys_email_admin']); if (!$mail->send()) { $nb_mail_failed++; } } return $nb_mail_failed < $nb_recipients; }
<br> <?php $res_cat = db_query("SELECT category.category_id AS category_id," . "category.category_name AS category_name FROM category,group_category " . "WHERE category.category_id=group_category.category_id AND " . "group_category.group_id={$row_grp['group_id']}"); while ($row_cat = db_fetch_array($res_cat)) { print "<br>{$row_cat['category_name']} " . '<A href="groupedit.php?group_id=' . $row_grp['group_id'] . '&group_idrm=' . $row_grp['group_id'] . '&form_catrm=' . $row_cat['category_id'] . '">' . "[" . $Language->getText('admin_approve_pending', 'remove_category') . "]</A>"; } // ########################## OTHER INFO print "<P><B>" . $Language->getText('admin_groupedit', 'other_info') . "</B>"; print "<br><u>" . $Language->getText('admin_groupedit', 'public') . "</u>: " . ($row_grp['is_public'] ? $Language->getText('global', 'yes') : $Language->getText('global', 'no')); print "<br><u>" . $Language->getText('admin_groupedit', 'unix_grp') . "</u>: {$row_grp['unix_group_name']}"; $currentproject->displayProjectsDescFieldsValue(); print "<br><u>" . $Language->getText('admin_groupedit', 'license_other') . "</u>: <br> {$row_grp['license_other']}"; $template_group = ProjectManager::instance()->getProject($row_grp['built_from_template']); print "<br><u>" . $Language->getText('admin_groupedit', 'built_from_template') . '</u>: <br> <A href="/projects/' . $template_group->getUnixName() . '"> <B> ' . $template_group->getPublicname() . ' </B></A>'; $sf = new ServerFactory(); if (count($sf->getAllServers()) > 1) { $p = $pm->getProject($row_grp['group_id']); if ($p->usesFile() || $p->usesSVN()) { print '<br><u>' . $Language->getText('admin_approve_pending', 'distributed_services') . '</u>:<br><ul>'; if ($p->usesFile()) { if ($s =& $sf->getServerById($p->services['file']->getServerId())) { print '<li>' . $Language->getText('project_admin_editservice', 'service_file_lbl_key') . ': ' . $s->getName() . '</li>'; } } if ($p->usesSVN()) { if ($s =& $sf->getServerById($p->services['svn']->getServerId())) { print '<li>' . $Language->getText('project_admin_editservice', 'service_svn_lbl_key') . ': ' . $s->getName() . '</li>'; } } print '</ul>';
function display($data) { echo '<p>' . $GLOBALS['Language']->getText('register_services', 'desc') . '</p>'; $sf = new ServerFactory(); $servers = $sf->getAllServers(); $can_display_servers = count($servers) > 1; $pm = ProjectManager::instance(); $p = $pm->getProject($data['project']['built_from_template']); $title_arr = array(); $title_arr[] = ''; //$GLOBALS['Language']->getText('project_admin_editservice','enabled'); $title_arr[] = $GLOBALS['Language']->getText('project_admin_editservice', 's_label'); $title_arr[] = $GLOBALS['Language']->getText('project_admin_editservice', 's_desc'); if ($can_display_servers) { $title_arr[] = $GLOBALS['Language']->getText('register_services', 'server'); } echo html_build_list_table_top($title_arr); $row_num = 0; foreach ($p->services as $key => $nop) { if (!in_array($p->services[$key]->getShortName(), array('summary', 'admin')) && $p->services[$key]->isActive() && !$p->services[$key]->isRestricted()) { $short_name = $p->services[$key]->getShortName(); $description = $p->services[$key]->getDescription(); $label = $p->services[$key]->getLabel(); $id = $p->services[$key]->getId(); $is_used = isset($data['project']['services'][$id]['is_used']) ? $data['project']['services'][$id]['is_used'] : $p->services[$key]->isUsed(); $matches = array(); if ($description == "service_" . $short_name . "_desc_key") { $description = $GLOBALS['Language']->getText('project_admin_editservice', $description); } elseif (preg_match('/(.*):(.*)/', $description, $matches)) { $description = $GLOBALS['Language']->getText($matches[1], $matches[2]); } if ($label == "service_" . $short_name . "_lbl_key") { $label = $GLOBALS['Language']->getText('project_admin_editservice', $label); } elseif (preg_match('/(.*):(.*)/', $label, $matches)) { $label = $GLOBALS['Language']->getText($matches[1], $matches[2]); } echo '<tr class="' . util_get_alt_row_color($row_num++) . '">'; //{{{ is_used echo '<td>'; $field_name = 'services[' . $id . '][is_used]'; $checked = $is_used ? 'checked="checked"' : ''; echo '<input type="hidden" name="' . $field_name . '" value="0" />'; echo '<input type="checkbox" id="project_register_service_is_used_' . $id . '" name="' . $field_name . '" value="1" ' . $checked . ' />'; echo '</td>'; //}}} echo '<td>' . $label . '</td>'; echo '<td>' . $description . '</td>'; //{{{ server if ($can_display_servers) { echo '<td style="text-align:center">'; if ($short_name == 'svn' || $short_name == 'file') { echo '<select name="services[' . $id . '][server_id]">'; foreach ($servers as $server_key => $nop) { $selected = $servers[$server_key]->getId() == $p->services[$key]->getServerId() ? 'selected="selected"' : ''; echo '<option value="' . $servers[$server_key]->getId() . '" ' . $selected . '>' . $servers[$server_key]->getName() . '</option>'; } echo '</select>'; } else { echo '-'; echo '<input type="hidden" name="services[' . $id . '][server_id]" value="' . $p->services[$key]->getServerId() . '" />'; } echo '</td>'; } //}}} echo '</tr>'; } } echo '</table>'; }
function display_service_configuration_form($group_id, $service_id, $service, $ro, $su) { global $Language; // There is a special case for the 'Home Page' service: only the link can be modified (except for superuser) $hp = false; if ($service['short_name'] == "homepage") { $hp = true; } // There is a special case for the 'Legacy docman' service: project admins can modify the label and description (but not the link) $is_legacy_docman = false; if ($service['short_name'] == "doc") { $is_legacy_docman = true; if (user_ismember($group_id, 'A')) { $ro = false; } } if ($su) { $ro = false; } echo ' <h3>' . $Language->getText('project_admin_editservice', 's_conf') . '</h3>'; $hp =& Codendi_HTMLPurifier::instance(); echo ' <form method="post" name="form_update" action="/project/admin/servicebar.php?group_id=' . $group_id . '"> <input type="hidden" name="func" VALUE="do_update"> <input type="hidden" name="service_id" VALUE="' . $service_id . '"> <input type="hidden" name="group_id" VALUE="' . $group_id . '">'; if ($service['short_name']) { echo ' <input type="hidden" name="short_name" VALUE="' . $service['short_name'] . '">'; } if ($ro) { echo ' <input type="hidden" name="label" VALUE="' . $service['label'] . '"> <input type="hidden" name="description" VALUE="' . $service['description'] . '"> '; } echo ' <table width="100%" cellspacing=0 cellpadding=3 border=0> <tr><td colspan=2><b>' . $Language->getText('project_admin_editservice', 's_ident_desc') . '</b></td></tr> <tr><td width="10%"><a href="#" title="' . $Language->getText('project_admin_editservice', 's_name_in_bar') . '">' . $Language->getText('project_admin_editservice', 's_label') . ': </a><font color="red">*</font></td> <td>'; if (!$ro) { echo '<input type="text" name="label" size="30" maxlength="40" value="' . $hp->purify($service['label']) . '">'; } else { if ($service['label'] == "service_" . $service['short_name'] . "_lbl_key") { echo $Language->getText('project_admin_editservice', $service['label']); } else { echo $hp->purify($service['label']); } } echo '</td></tr> <tr><td><a href="#" title="' . $Language->getText('project_admin_editservice', 'url') . '">' . $Language->getText('project_admin_editservice', 's_link') . ': </a><font color="red">*</font></td> <td>'; if ((!$ro || $hp) && (!$is_legacy_docman || $su)) { echo '<input type="text" name="link" size="70" maxlength="255" value="' . $hp->purify($service['link']) . '">'; } else { echo $service['link']; echo '<input type="hidden" name="link" VALUE="' . $service['link'] . '">'; } echo '</td></tr>'; if ($su && $service['short_name']) { // Can't modify a shortname! Too many problems if the admin changes the system shortnames. echo ' <tr><td><a href="#" title="' . $Language->getText('project_admin_editservice', 's_short_name') . '">' . $Language->getText('project_admin_editservice', 'short_name') . '</a>: </td> <td>' . $service['short_name'] . '</td></tr>'; } echo '</td></tr> <tr><td><a href="#" title="' . $Language->getText('project_admin_editservice', 's_desc_in_tooltip') . '">' . $Language->getText('project_admin_editservice', 's_desc') . '</a>: </td> <td>'; if (!$ro) { echo '<input type="text" name="description" size="70" maxlength="255" value="' . $hp->purify($service['description']) . '">'; } else { if ($service['description'] == "service_" . $service['short_name'] . "_desc_key") { echo $Language->getText('project_admin_editservice', $service['description']); } else { echo $hp->purify($service['description']); } } echo '</td></tr>'; if ($su && $group_id == 100) { echo ' <tr><td><a href="#" title="' . $Language->getText('project_admin_editservice', 's_scope') . '">' . $Language->getText('project_admin_editservice', 'scope') . ': </a></td> <td><FONT size="-1"><SELECT name="scope"> <option value="system"' . ($service['scope'] == "system" ? " selected" : "") . '>' . $Language->getText('project_admin_editservice', 'system') . '</option> <option value="project"' . ($service['scope'] != "system" ? " selected" : "") . '>' . $Language->getText('project_admin_editservice', 'project') . '</option> </SELECT></FONT></td></tr>'; } else { echo '<input type="hidden" name="scope" VALUE="' . $service['scope'] . '"></td></tr>'; } echo ' <tr><td colspan=2><b>' . $Language->getText('project_admin_editservice', 'display_options') . '</b></td></tr>'; if ($su) { echo ' <tr><td><a href="#" title="' . $Language->getText('project_admin_editservice', 'instanciated_for_new_p') . '">' . $Language->getText('project_admin_editservice', 'available') . ':</a> </td><td><input type="CHECKBOX" NAME="is_active" VALUE="1"' . ($service['is_active'] ? ' CHECKED' : '') . '></td></tr>'; } else { print '<input type="hidden" name="is_active" VALUE="' . $service['is_active'] . '">'; } echo ' <tr><td><a href="#" title="' . $Language->getText('project_admin_editservice', 'display_in_s_bar') . '">' . $Language->getText('project_admin_editservice', 'enabled') . ':</a> </td><td>'; echo '<input type="CHECKBOX" NAME="is_used" VALUE="1"' . ($service['is_used'] ? ' CHECKED' : '') . '>'; echo '</td></tr>'; if ($service['scope'] == 'project') { echo '<tr><td>'; echo '<a href="#" title="' . 'Display in iframe' . '">' . 'Display in iframe' . ':</a> '; echo '</td><td>'; echo '<input type="checkbox" name="is_in_iframe" value="1" ' . ($service['is_in_iframe'] ? 'checked="checked"' : '') . ' />'; echo '</td></tr>'; } echo '<tr><td><a href="#" title="' . $Language->getText('project_admin_editservice', 'pos_in_s_bar') . '">' . $Language->getText('project_admin_editservice', 'screen_rank') . ': </a><font color="red">*</font></td><td>'; if ($service['short_name'] == 'summary') { echo '<input type="text" name="rank" size="5" maxlength="5" value="' . $service['rank'] . '" readonly>'; } else { echo '<input type="text" name="rank" size="5" maxlength="5" value="' . $service['rank'] . '">'; } echo '</td></tr>'; //{{{ Distributed architecture if (in_array($service['short_name'], array('file', 'svn'))) { $sf = new ServerFactory(); $servers = $sf->getAllServers(); if ($servers && count($servers) > 1) { echo '<tr><td colspan="2"><b>Server</b></tr>'; echo '<tr><td><label><a href="#" title="Location">Location:</a></label></td><td>'; if ($su) { echo '<select name="server_id">'; foreach ($servers as $key => $nop) { $selected = $servers[$key]->getId() == $service['server_id'] ? 'selected="selected"' : ''; echo '<option value="' . $servers[$key]->getId() . '" ' . $selected . '>' . $servers[$key]->getName() . '</option>'; } } else { foreach ($servers as $key => $nop) { if ($servers[$key]->getId() == $service['server_id']) { echo $servers[$key]->getName(); } } } echo '</td></tr>'; } } //}}} echo '</table> <P><INPUT type="submit" name="Update" value="' . $Language->getText('global', 'btn_update') . '"> </form> <p><font color="red">*</font>: ' . $Language->getText('project_admin_editservice', 'fields_required') . '</p>'; }
$hp =& Codendi_HTMLPurifier::instance(); svn_header(array('title' => $Language->getText('svn_intro', 'info'))); // Table for summary info print '<TABLE width="100%"><TR valign="top"><TD width="65%">' . "\n"; // Get group properties $res_grp = db_query("SELECT * FROM groups WHERE group_id=" . db_ei($group_id)); $row_grp = db_fetch_array($res_grp); $pm = ProjectManager::instance(); $p = $pm->getProject($group_id); // Show CVS access information if ($row_grp['svn_preamble'] != '') { echo $hp->purify(util_unconvert_htmlspecialchars($row_grp['svn_preamble']), CODENDI_PURIFIER_FULL); } else { $host = $GLOBALS['sys_default_domain']; if ($p && $p->usesService('svn')) { $sf = new ServerFactory(); if ($server =& $sf->getServerById($p->services['svn']->getServerId())) { $host = URL::getHost($server->getUrl(session_issecure())); } } if ($GLOBALS['sys_force_ssl']) { $svn_url = 'https://' . $host; } else { if (isset($GLOBALS['sys_disable_subdomains']) && $GLOBALS['sys_disable_subdomains']) { $svn_url = 'http://' . $host; } else { $svn_url = 'http://svn.' . $row_grp['unix_group_name'] . '.' . $host; } } // Domain name must be lowercase (issue with some SVN clients) $svn_url = strtolower($svn_url);