function getBodyHeaderActions($params) { $html = ''; $html .= '<ul>'; if (user_isloggedin()) { $html .= '<li class="header_actions_nolink">' . $GLOBALS['Language']->getText('include_menu', 'logged_in') . ': ' . user_getname() . '</li>'; $html .= '<li><a href="/account/logout.php">' . $GLOBALS['Language']->getText('include_menu', 'logout') . '</a></li>'; if (isset($GLOBALS['sys_use_project_registration']) && $GLOBALS['sys_use_project_registration'] == 1 || !isset($GLOBALS['sys_use_project_registration'])) { $html .= '<li><a href="/project/register.php">' . $GLOBALS['Language']->getText('include_menu', 'register_new_proj') . '</a></li>'; } if (!HTTPRequest::instance()->isPost()) { $add_bookmark_url = http_build_query(array('bookmark_url' => $_SERVER['REQUEST_URI'], 'bookmark_title' => str_replace($GLOBALS['sys_name'] . ': ', '', $params['title']))); $html .= '<li class="bookmarkpage"><a href="/my/bookmark_add.php?' . $add_bookmark_url . '">' . $GLOBALS['Language']->getText('include_menu', 'bookmark_this_page') . '</a></li>'; } } else { $html .= '<li class="header_actions_nolink highlight">' . $GLOBALS['Language']->getText('include_menu', 'not_logged_in') . '</li>'; $login_url = '/account/login.php'; if ($_SERVER['REQUEST_URI'] != $login_url) { $login_url .= '?return_to=' . urlencode($_SERVER['REQUEST_URI']); } $html .= '<li><a href="' . $this->purifier->purify($login_url) . '">' . $GLOBALS['Language']->getText('include_menu', 'login') . '</a></li>'; $em =& EventManager::instance(); $display_new_user = true; $em->processEvent('display_newaccount', array('allow' => &$display_new_user)); if ($display_new_user) { $html .= '<li><a href="/account/register.php">' . $GLOBALS['Language']->getText('include_menu', 'new_user') . '</a></li>'; } } $html .= '</ul>'; return $html; }
function svn_data_get_revision_detail($group_id, $commit_id, $rev_id = 0, $order = '') { $order_str = ""; if ($order) { if ($order != 'filename') { // SQLi Warning: no real possibility to escape $order here. // We rely on a proper filtering of user input by calling methods. $order_str = " ORDER BY " . $order; } else { $order_str = " ORDER BY dir, file"; } } //check user access rights $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); $forbidden = svn_utils_get_forbidden_paths(user_getname(), $project->getSVNRootPath()); $where_forbidden = ""; if (!empty($forbidden)) { while (list($no_access, ) = each($forbidden)) { $where_forbidden .= " AND svn_dirs.dir not like '%" . db_es(substr($no_access, 1)) . "%' "; } } // if the subversion revision id is given then it akes precedence on // the internal commit_id (this is to make it easy for users to build // URL to access a revision if ($rev_id) { // To be done -> get the commit ID from the svn-commit table $sql = "SELECT svn_commits.description, svn_commits.date, svn_commits.revision, svn_checkins.type,svn_checkins.commitid,svn_dirs.dir,svn_files.file " . "FROM svn_dirs, svn_files, svn_checkins, svn_commits " . "WHERE svn_checkins.fileid=svn_files.id " . "AND svn_checkins.dirid=svn_dirs.id " . "AND svn_checkins.commitid=svn_commits.id " . "AND svn_commits.revision=" . db_ei($rev_id) . " " . "AND svn_commits.group_id=" . db_ei($group_id) . " " . $where_forbidden . $order_str; } else { $sql = "SELECT svn_commits.description, svn_commits.date, svn_commits.revision, svn_checkins.type,svn_checkins.commitid,svn_dirs.dir,svn_files.file " . "FROM svn_dirs, svn_files, svn_checkins, svn_commits " . "WHERE svn_checkins.fileid=svn_files.id " . "AND svn_checkins.dirid=svn_dirs.id " . "AND svn_checkins.commitid=svn_commits.id " . "AND svn_commits.id=" . db_ei($commit_id) . " " . $where_forbidden . $order_str; } $result = db_query($sql); return $result; }
function RemovePage(&$request) { global $WikiTheme; $page = $request->getPage(); $pagelink = WikiLink($page); if ($request->getArg('cancel')) { $request->redirect(WikiURL($page)); // noreturn } $current = $page->getCurrentRevision(); if (!$current or !($version = $current->getVersion())) { $html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database."))); } elseif (!$request->isPost() || !$request->getArg('verify')) { $removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin'); $cancelB = Button('submit:cancel', _("Cancel"), 'button'); // use generic wiki button look $html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr()); $sample = HTML::div(array('class' => 'transclusion')); // simple and fast preview expanding only newlines foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) { $sample->pushContent($s, HTML::br()); } $html->pushContent(HTML::div(array('class' => 'wikitext'), $sample)); } elseif ($request->getArg('currentversion') != $version) { $html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s. Please check to make sure you still want to permanently remove the page from the database.", $pagelink))); } else { // Codendi specific: remove the deleted wiki page from ProjectWantedPages $projectPageName = 'ProjectWantedPages'; $pagename = $page->getName(); $dbi = $request->getDbh(); require_once PHPWIKI_DIR . "/lib/loadsave.php"; $pagehandle = $dbi->getPage($projectPageName); if ($pagehandle->exists()) { // don't replace default contents $current = $pagehandle->getCurrentRevision(); $version = $current->getVersion(); $text = $current->getPackedContent(); $meta = $current->_data; } $text = str_replace("* [{$pagename}]", "", $text); $meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename)); $meta['author'] = user_getname(); $pagehandle->save($text, $version + 1, $meta); //Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere. require_once 'common/wiki/lib/WikiPage.class.php'; $wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']); $wiki_page->resetPermissions(); // Real delete. //$pagename = $page->getName(); $dbi = $request->getDbh(); $dbi->deletePage($pagename); $dbi->touch(); $link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page.")); $html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr()); } GeneratePage($html, _("Remove Page")); }
function getBodyHeader($params) { $output = ' <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td class="header_osdn">' . $this->getOsdnNavBar() . '</td> <td class="header_actions"> <ul>'; if (user_isloggedin()) { $output .= '<li class="header_actions_nolink">' . $GLOBALS['Language']->getText('include_menu', 'logged_in') . ': ' . user_getname() . '</li>'; $output .= '<li><a href="/account/logout.php">' . $GLOBALS['Language']->getText('include_menu', 'logout') . '</a></li>'; if (isset($GLOBALS['sys_use_project_registration']) && $GLOBALS['sys_use_project_registration'] == 1 || !isset($GLOBALS['sys_use_project_registration'])) { $output .= '<li><a href="/project/register.php">' . $GLOBALS['Language']->getText('include_menu', 'register_new_proj') . '</a></li>'; } $request = HTTPRequest::instance(); if (!$request->isPost()) { $bookmark_title = urlencode(str_replace($GLOBALS['sys_name'] . ': ', '', $params['title'])); $output .= '<li class="bookmarkpage"><a href="/my/bookmark_add.php?bookmark_url=' . urlencode($_SERVER['REQUEST_URI']) . '&bookmark_title=' . $bookmark_title . '">' . $GLOBALS['Language']->getText('include_menu', 'bookmark_this_page') . '</a></li>'; } } else { $output .= '<li class="header_actions_nolink highlight">' . $GLOBALS['Language']->getText('include_menu', 'not_logged_in') . '</li>'; $output .= '<li><a href="/account/login.php">' . $GLOBALS['Language']->getText('include_menu', 'login') . '</a></li>'; $em =& EventManager::instance(); $display_new_user = true; $params = array('allow' => &$display_new_user); $em->processEvent('display_newaccount', $params); if ($display_new_user) { $output .= '<li><a href="/account/register.php">' . $GLOBALS['Language']->getText('include_menu', 'new_user') . '</a></li>'; } } $output .= '</ul> </td> </tr> <tr> <td class="header_logo"> <a class="header_logo" href="/"><img src="' . $this->imgroot . 'organization_logo.png" /></a> </td> <td class="header_searchbox"><br />' . $this->getSearchBox() . '</td> </tr> </table>'; return $output; }
function cvs_get_revisions(&$project, $offset, $chunksz, $_tag = 100, $_branch = 100, $_commit_id = '', $_commiter = 100, $_srch = '', $order_by = '', $pv = 0) { //if tag selected, and more to where clause if ($_tag != 100) { //for open tasks, add status=100 to make sure we show all $tag_str = "AND cvs_checkins.stickytag='{$_tag}'"; } else { //no status was chosen, so don't add it to where clause $tag_str = ''; } //if status selected, and more to where clause if ($_branch != 100) { //for open tasks, add status=100 to make sure we show all $branch_str = "AND cvs_checkins.branchid='{$_branch}'"; } else { //no status was chosen, so don't add it to where clause $branch_str = ''; } //if assigned to selected, and more to where clause if ($_commit_id != '') { $commit_str = "AND cvs_commits.id='{$_commit_id}' AND cvs_checkins.commitid != 0 "; } else { $commit_str = ''; } if ($_commiter != 100) { $commiter_str = "AND user.user_id=cvs_checkins.whoid " . "AND user.user_name='{$_commiter}' "; } else { //no assigned to was chosen, so don't add it to where clause $commiter_str = ''; } if ($_srch != '') { $srch_str = "AND cvs_descs.description like '%" . $_srch . "%' "; } else { $srch_str = ""; } //build page title to make bookmarking easier //if a user was selected, add the user_name to the title //same for status //commits_header(array('title'=>'Browse Commits'. // (($_assigned_to)?' For: '.user_getname($_assigned_to):''). // (($_tag && ($_tag != 100))?' By Status: '. get_commits_status_nam//e($_status):''), // 'help' => 'CommitsManager.html')); // get repository id $query = "SELECT id from cvs_repositories where cvs_repositories.repository='/cvsroot/" . $project->getUnixName(false) . "' "; $rs = db_query($query); $repo_id = db_result($rs, 0, 0); $repo_id = $repo_id ? $repo_id : -1; $select = 'SELECT distinct cvs_checkins.commitid as id, cvs_checkins.commitid as revision, cvs_descs.id as did, cvs_descs.description, cvs_commits.comm_when as c_when, cvs_commits.comm_when as date, cvs_commits.comm_when as f_when, user.user_name as who '; $from = "FROM cvs_descs, cvs_checkins, user, cvs_commits "; $where = "WHERE cvs_checkins.descid=cvs_descs.id " . "AND " . (check_cvs_access(user_getname(), $project->getUnixName(false), '') ? 1 : 0) . " " . "AND cvs_checkins.commitid=cvs_commits.id " . "AND user.user_id=cvs_checkins.whoid " . "AND cvs_checkins.repositoryid=" . $repo_id . " " . "{$commiter_str} " . "{$commit_str} " . "{$srch_str} " . "{$branch_str} "; if (!$pv) { $limit = " LIMIT {$offset},{$chunksz}"; } if (!$order_by) { $order_by = " ORDER BY id desc, f_when desc "; } $sql = $select . $from . $where . $order_by . $limit; $result = db_query($sql); /* expensive way to have total rows number didn'get a cheaper one */ $sql1 = $select . $from . $where; $result1 = db_query($sql1); $totalrows = db_numrows($result1); return array($result, $totalrows); }
/** * Function svn_utils_check_access : check if the user $username can access the path $svnpath of the project $gname * regarding the global arrays $SVNACCESS and $SVNGROUPS. * * @param string $username the login name of the user we want to check the perms * @param string $project_svnroot the unix name of the group (project) * @param string $svnpath the subversion path to check * @global array $SVNACCESS the array populated with the rights for each user for this project $gname * @global array $SVNGROUPS the array populated with the members of each ugroup of this project * * Warning: * The code source of this function is writing in Python too. * If you modify part of this code, thanks to check if * the corresponding Python code needs to be updated too. * (see src/utils/svn/svnaccess.py) */ function svn_utils_check_access($username, $project_svnroot, $svnpath) { global $SVNACCESS; if (user_getname() == $username && user_is_super_user()) { return true; } $em =& EventManager::instance(); $em->processEvent('svn_check_access_username', array('username' => &$username, 'project_svnroot' => $project_svnroot)); $username = strtolower($username); if ($SVNACCESS == "None") { svn_utils_parse_access_file($project_svnroot); } $perm = ''; $path = '/' . $svnpath; while (true) { if (array_key_exists($username, $SVNACCESS) && array_key_exists($path, $SVNACCESS[$username])) { $perm = $SVNACCESS[$username][$path]; //echo "match: SVNACCESS[$username][$path] $perm"; break; } else { if (array_key_exists('*', $SVNACCESS) && array_key_exists($path, $SVNACCESS['*'])) { $perm = $SVNACCESS['*'][$path]; //echo "match: SVNACCESS[*][$path] $perm"; break; } else { // see if it maches higher in the path if ($path == '/') { break; } $idx = strrpos($path, '/'); if ($idx == 0) { $path = '/'; } else { $path = substr($path, 0, $idx); } } } } if (strpos($perm, 'r') === false) { return false; } else { return true; } }
// $Id: mod_patch.php,v 1.3 2003/11/26 15:01:17 helix Exp $ patch_header(array('title' => 'Modify a Patch')); $sql = "SELECT * FROM patch WHERE patch_id='{$patch_id}' AND group_id='{$group_id}'"; $result = db_query($sql); if (db_numrows($result) > 0) { echo ' <H2>[ Patch #' . $patch_id . ' ] ' . db_result($result, 0, 'summary') . '</H2>'; echo ' <FORM ACTION="' . $PHP_SELF . '" METHOD="POST" enctype="multipart/form-data"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="postmodpatch"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '"> <INPUT TYPE="HIDDEN" NAME="patch_id" VALUE="' . $patch_id . '"> <TABLE WIDTH="100%"> <TR> <TD><B>Submitted By:</B><BR>' . user_getname(db_result($result, 0, 'submitted_by')) . '</TD> <TD><B>Group:</B><BR>' . group_getname($group_id) . '</TD> </TR> <TR> <TD><B>Date Submitted:</B><BR> ' . date($sys_datefmt, db_result($result, 0, 'open_date')) . ' </TD> <TD><FONT SIZE="-1"> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Submit Changes"> </TD> </TR> <TR> <TD><B>Category:</B><BR>'; echo patch_category_box($group_id, 'patch_category_id', db_result($result, 0, 'patch_category_id'));
function show_grouphistory($group_id) { /* show the group_history rows that are relevant to this group_id */ global $sys_datefmt; $result = group_get_history($group_id); $rows = db_numrows($result); if ($rows > 0) { echo ' <H3>Group Change History</H3> <P>'; $title_arr = array(); $title_arr[] = 'Field'; $title_arr[] = 'Old Value'; $title_arr[] = 'Date'; $title_arr[] = 'By'; echo html_build_list_table_top($title_arr); for ($i = 0; $i < $rows; $i++) { $field = db_result($result, $i, 'field_name'); echo ' <TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD>' . $field . '</TD><TD>'; if ($field == 'removed user') { echo user_getname(db_result($result, $i, 'old_value')); } else { echo db_result($result, $i, 'old_value'); } echo '</TD>' . '<TD>' . date($sys_datefmt, db_result($result, $i, 'date')) . '</TD>' . '<TD>' . db_result($result, $i, 'user_name') . '</TD></TR>'; } echo ' </TABLE>'; } else { echo ' <H3>No Changes Have Been Made to This Group</H3>'; } }
function _getField() { $name = $this->_getFieldName(); $value = $this->md->getValue(); if ($value === null) { $value = $this->md->getDefaultValue(); } $v = ''; if ($value != null && $value != '' && $value > 0) { $v = user_getname($value); } $field = '<input type="text" class="text_field" name="' . $this->_getFieldName() . '" value="' . $v . '" />'; return $field; }
$addresses = $agnf->getAllAddresses($ath->getID(), true); $ah->mailFollowupWithPermissions($addresses, $changes); } $GLOBALS['Response']->redirect('?group_id=' . (int) $group_id . '&atid=' . (int) $atid . '&aid=' . (int) $aid . '&func=detail'); } } break; case 'delete_file': // // Delete a file from this artifact // $ah = new ArtifactHtml($ath, $aid); // Check permissions $id = $request->get('id'); $file_array = $ah->getAttachedFile($id); if (user_ismember($group_id) || user_getname(user_getid()) == $file_array['user_name']) { $afh = new ArtifactFileHtml($ah, $id); if (!$afh || !is_object($afh)) { $GLOBALS['Response']->addFeedback('error', $Language->getText('tracker_index', 'not_create_file_obj', $afh->getName())); } elseif ($afh->isError()) { $GLOBALS['Response']->addFeedback('error', $afh->getErrorMessage() . '::' . $hp->purify($afh->getName(), CODENDI_PURIFIER_CONVERT_HTML)); } else { if (!$afh->delete()) { $GLOBALS['Response']->addFeedback('error', $Language->getText('tracker_index', 'file_delete', $afh->getErrorMessage())); } else { $GLOBALS['Response']->addFeedback('info', $Language->getText('tracker_index', 'file_delete_success')); } } $GLOBALS['Response']->redirect('?group_id=' . (int) $group_id . '&atid=' . (int) $atid . '&aid=' . (int) $aid . '&func=detail'); } else { // Invalid permission
<B>Title of policy</B><BR> <INPUT TYPE="TEXT" NAME="name" VALUE="<?php echo html_scrub($name); ?> " SIZE="40" MAXLENGTH="50"> <P> <B>Someone who believes that...</B><BR> <textarea name="description" rows="6" cols="80"><?php echo html_scrub($description); ?> </textarea></p> <p><span class="ptitle">Privacy notes:</span> By creating a policy you are making your user name <b><?php echo user_getname(); ?> </b> and the policy's voting record public. <p><INPUT TYPE="SUBMIT" NAME="submit" VALUE="Make Policy"> </FORM> <p>If you like you can <a href="/forum/viewforum.php?f=1">discuss policies on our forum</a>. <?php } pw_footer(); } else { login_screen(); } ?>
/** * Display the list of attached files * * @param group_id: the group id * @param group_artifact_id: the artifact type ID * @param ascii: ascii mode * * @return void */ function showAttachedFiles($group_id, $group_artifact_id, $ascii = false, $pv = 0) { global $Language; $hp = $this->getHtmlPurifier(); // // show the files attached to this artifact // $result = $this->getAttachedFiles(); $rows = db_numrows($result); // No file attached -> return now if ($rows <= 0) { if ($ascii) { $out = $Language->getText('tracker_include_artifact', 'no_file_attached') . $GLOBALS['sys_lf']; } else { $out = '<H4>' . $Language->getText('tracker_include_artifact', 'no_file_attached') . '</H4>'; } return $out; } // Header first if ($ascii) { $out = $Language->getText('tracker_include_artifact', 'file_attachment') . $GLOBALS['sys_lf'] . str_repeat("*", strlen($Language->getText('tracker_include_artifact', 'file_attachment'))); } else { $title_arr = array(); $title_arr[] = $Language->getText('tracker_include_artifact', 'name'); $title_arr[] = $Language->getText('tracker_include_artifact', 'desc'); $title_arr[] = $Language->getText('tracker_include_artifact', 'size_kb'); $title_arr[] = $Language->getText('global', 'by'); $title_arr[] = $Language->getText('tracker_include_artifact', 'posted_on'); if ($pv == 0) { $title_arr[] = $Language->getText('tracker_include_canned', 'delete'); } $out = html_build_list_table_top($title_arr); } // Determine what the print out format is based on output type (Ascii, HTML) if ($ascii) { $fmt = $GLOBALS['sys_lf'] . $GLOBALS['sys_lf'] . "------------------------------------------------------------------" . $GLOBALS['sys_lf'] . $Language->getText('tracker_import_utils', 'date') . ": %s " . $Language->getText('tracker_include_artifact', 'name') . ": %s " . $Language->getText('tracker_include_artifact', 'size') . ": %dKB " . $Language->getText('global', 'by') . ": %s" . $GLOBALS['sys_lf'] . "%s" . $GLOBALS['sys_lf'] . "%s"; } else { $fmt = "" . $GLOBALS['sys_lf'] . '<TR class="%s"><td>%s</td><td>%s</td><td align="center">%s</td><td align="center">%s</td><td align="center">%s</td>'; if ($pv == 0) { $fmt .= '<td align="center">%s</td>'; } $fmt .= '</tr>'; } // Determine which protocl to use for embedded URL in ASCII format $server = get_server_url(); // Loop throuh the attached files and format them for ($i = 0; $i < $rows; $i++) { $artifact_file_id = db_result($result, $i, 'id'); $href = "/tracker/download.php?artifact_id=" . (int) $this->getID() . "&id=" . (int) $artifact_file_id; if ($ascii) { $out .= sprintf($fmt, format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), db_result($result, $i, 'filename'), intval(db_result($result, $i, 'filesize') / 1024), db_result($result, $i, 'user_name'), SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), $server . $href); } else { // show CC delete icon if one of the condition is met: // (a) current user is group member // (b) the current user is the person who added a gieven name in CC list if (user_ismember($this->ArtifactType->getGroupID()) || user_getname(user_getid()) == db_result($result, $i, 'user_name')) { $html_delete = '<a href="?func=delete_file&group_id=' . (int) $group_id . "&atid=" . (int) $group_artifact_id . "&aid=" . (int) $this->getID() . "&id=" . (int) db_result($result, $i, 'id') . '" ' . ' onClick="return confirm(\'' . $Language->getText('tracker_include_artifact', 'delete_attachment') . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="' . $Language->getText('global', 'btn_delete') . '"></A>'; } else { $html_delete = '-'; } $out .= sprintf($fmt, util_get_alt_row_color($i), '<a href="' . $href . '">' . $hp->purify(db_result($result, $i, 'filename'), CODENDI_PURIFIER_CONVERT_HTML) . '</a>', $hp->purify(SimpleSanitizer::unsanitize(db_result($result, $i, 'description')), CODENDI_PURIFIER_BASIC, $group_id), intval(db_result($result, $i, 'filesize') / 1024), util_user_link(db_result($result, $i, 'user_name')), format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $i, 'adddate')), $html_delete); } } // for // final touch... $out .= $ascii ? "" . $GLOBALS['sys_lf'] . "" : "</TABLE>"; return $out; }
/** * return a field for the given user. * * @protected **/ function _getFieldLabelAndValueForUser($group_id, $group_artifact_id, &$field, $user_id, $force_read_only = false) { $html = false; if ($field->userCanRead($group_id, $group_artifact_id, $user_id)) { $read_only = $force_read_only || !$field->userCanUpdate($group_id, $group_artifact_id, $user_id); // For multi select box, we need to retrieve all the values if ($field->isMultiSelectBox()) { $field_value = $field->getValues($this->getID()); } else { $field_value = $this->getValue($field->getName()); } $field_html = new ArtifactFieldHtml($field); $label = $field_html->labelDisplay(false, false, !$read_only); $label .= $field->isEmptyOk() ? '' : '<span class="highlight"><big>*</big></b></span>'; // original submission field must be displayed read-only, // except for site admin, tracker admin and for the artifact submitter if ($field->getName() == 'details') { if (user_is_super_user() || $this->ArtifactType->userIsAdmin() || $this->getSubmittedBy() == $user_id) { // original submission is editable $value = $field_html->display($this->ArtifactType->getID(), $field_value, false, false, $read_only); } else { $value = util_make_links($field_html->display($this->ArtifactType->getID(), $field_value, false, false, true), $group_id, $group_artifact_id); } } else { if ($field->getName() == 'submitted_by') { $value = util_user_link(user_getname($field_value)); } else { if ($field->getName() == 'open_date') { $value = format_date($GLOBALS['Language']->getText('system', 'datefmt'), $field_value); } else { if ($field->getName() == 'last_update_date') { $value = format_date($GLOBALS['Language']->getText('system', 'datefmt'), $field_value); } else { $value = $field_html->display($this->ArtifactType->getID(), $field_value, false, false, $read_only); if ($read_only) { $value = util_make_links($value, $group_id, $group_artifact_id); } } } } } $html = array('label' => $label, 'value' => $value); } return $html; }
/* Show the submit form */ $sql = "SELECT groups.unix_group_name,news_bytes.* " . "FROM news_bytes,groups WHERE id='{$id}' " . "AND news_bytes.group_id=groups.group_id "; $result = db_query($sql); if (db_numrows($result) < 1) { exit_error('Error', 'Error - not found'); } echo ' <H3>Approve a NewsByte</H3> <P> <FORM ACTION="' . $PHP_SELF . '" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="for_group" VALUE="' . db_result($result, 0, 'group_id') . '"> <INPUT TYPE="HIDDEN" NAME="id" VALUE="' . db_result($result, 0, 'id') . '"> <B>Submitted for group:</B> <a href="/projects/' . strtolower(db_result($result, 0, 'unix_group_name')) . '/">' . group_getname(db_result($result, 0, 'group_id')) . '</a><BR> <B>Submitted by:</B> ' . user_getname(db_result($result, 0, 'submitted_by')) . '<BR> <INPUT TYPE="HIDDEN" NAME="approve" VALUE="y"> <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y"> <INPUT TYPE="RADIO" NAME="status" VALUE="1"> Approve For Front Page<BR> <INPUT TYPE="RADIO" NAME="status" VALUE="0"> Do Nothing<BR> <INPUT TYPE="RADIO" NAME="status" VALUE="2" CHECKED> Delete<BR> <B>Subject:</B><BR> <INPUT TYPE="TEXT" NAME="summary" VALUE="' . db_result($result, 0, 'summary') . '" SIZE="30" MAXLENGTH="60"><BR> <B>Details:</B><BR> <TEXTAREA NAME="details" ROWS="5" COLS="50" WRAP="SOFT">' . db_result($result, 0, 'details') . '</TEXTAREA><BR> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="SUBMIT"> </FORM>'; } else { /* Show list of waiting news items */
echo $PHP_SELF; ?> " METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="func" VALUE="postmodfilters"> <INPUT TYPE="HIDDEN" NAME="group_id" VALUE="<?php echo $group_id; ?> "> <INPUT TYPE="HIDDEN" NAME="subfunc" VALUE="turn_off"> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Deactivate Filters"> </FORM> <?php } bug_header(array('title' => 'Create a Personal Filter')); if (user_isloggedin()) { echo "<H2>Create a personal filter for " . user_getname() . "</H2>"; echo "<B>Creating or modifying a filter makes it your active filter</B><P>"; echo "Be sure include 'bug.' before each field name, as in the example, as multiple tables are being joined in the query"; show_filters($group_id); $sql = "SELECT users.user_id,users.user_name FROM users,user_group WHERE users.user_id=user_group.user_id AND user_group.bug_flags IN (1,2) AND user_group.group_id='{$group_id}'"; $result = db_query($sql); $sql = "select * from bug_status"; $result2 = db_query($sql); $sql = "select bug_category_id,category_name from bug_category WHERE group_id='{$group_id}'"; $result3 = db_query($sql); $sql = "select * from bug_resolution"; $result4 = db_query($sql); $sql = "select bug_group_id,group_name from bug_group WHERE group_id='{$group_id}'"; $result5 = db_query($sql); ?> <TABLE WIDTH="100%" CELLPADDING="3">
protected function displayAdminNotifications_Personnal($current_user) { $user_id = $current_user->getId(); $hp = Codendi_HTMLPurifier::instance(); // Build Wachees UI $arr_watchees = array(); foreach ($this->getWatcherDao()->searchWatchees($this->tracker->id, $current_user->getId()) as $row) { $arr_watchees[] = user_getname($row['watchee_id']); } $watchees = join(',', $arr_watchees); echo '<h3>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'perso_mail_notif') . '</h3>'; if ($this->tracker->userIsAdmin()) { // To watch other users you must have at least admin rights on the tracker echo ' <h4>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'users_to_watch') . ' ' . help_button('TrackerV5Administration.html#TrackerV5Watchers') . '</h4> <P>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'backup_person') . ' <p><INPUT TYPE="TEXT" NAME="watchees" VALUE="' . $hp->purify($watchees, CODENDI_PURIFIER_CONVERT_HTML) . '" SIZE="55" MAXLENGTH="255"><br></p> '; $watchers = ""; foreach ($this->getWatcherDao()->searchWatchers($this->tracker->id, $current_user->getId()) as $row) { $watcher_name = user_getname($row_watcher['user_id']); $watchers .= '<a href="/users/' . urlencode($watcher_name) . '">' . $hp->purify($watcher_name, CODENDI_PURIFIER_CONVERT_HTML) . '</a>,'; } $watchers = substr($watchers, 0, -1); // remove extra comma at the end if ($watchers) { echo "<p>" . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'watchers', $hp->purify($watchers, CODENDI_PURIFIER_CONVERT_HTML)); } else { echo "<p>" . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'no_watcher'); } echo '<br><br>'; } // Build Role/Event table $dar_roles = $this->getNotificationDao()->searchRoles($this->tracker->id); $num_roles = $dar_roles->rowCount(); $dar_events = $this->getNotificationDao()->searchEvents($this->tracker->id); $num_events = $dar_events->rowCount(); $arr_notif = array(); // By default it's all 'yes' foreach ($dar_roles as $role) { foreach ($dar_events as $event) { $arr_notif[$role['role_label']][$event['event_label']] = 1; } } foreach ($this->getNotificationDao()->searchNotification($this->tracker->id, $current_user->getId()) as $arr) { $arr_notif[$arr['role_label']][$arr['event_label']] = $arr['notify']; } // Rk: Can't use html_build_list_table_top because of the specific layout echo '<h4>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'event_settings') . ' ' . help_button('TrackerV5Administration.html#TrackerV5EventRoleBasedEmailNotification') . '</h4> <P>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'tune_settings'); echo ' <table BORDER="0" CELLSPACING="1" CELLPADDING="2" class="small"> <tr class="boxtitle"> <td colspan="' . (int) $num_roles . '" align="center" width="50%"><b>' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'role_is') . '</b></td> <td rowspan="2" width="50%"><b> ' . $GLOBALS['Language']->getText('plugin_tracker_include_type', 'notify_me') . '</b></td> </tr>'; $dar_roles->rewind(); foreach ($dar_roles as $role) { echo '<td align="center" width="10%"><b>' . $GLOBALS['Language']->getText('plugin_tracker_common_types', $role['short_description_msg']) . "</b></td>\n"; } echo "</tr>\n"; $dar_events->rewind(); $dar_roles->rewind(); $i = 0; foreach ($dar_events as $event) { $event_label = $event['event_label']; echo "<tr class=\"" . util_get_alt_row_color($i++) . "\">\n"; foreach ($dar_roles as $role) { $role_label = $role['role_label']; $cbox_name = 'cb_' . $role['role_id'] . '_' . $event['event_id']; if ($event_label == 'NEW_ARTIFACT' && $role_label != 'ASSIGNEE' && $role_label != 'SUBMITTER' || $event_label == 'ROLE_CHANGE' && $role_label != 'ASSIGNEE' && $role_label != 'CC') { // if the user is not a member then the ASSIGNEE column cannot // be set. If it's not an assignee or a submitter the new_artifact event is meaningless echo ' <td align="center"><input type="hidden" name="' . $cbox_name . '" value="1">-</td>' . "\n"; } else { echo ' <td align="center"><input type="checkbox" name="' . $cbox_name . '" value="1" ' . ($arr_notif[$role_label][$event_label] ? 'checked' : '') . "></td>\n"; } } echo ' <td> ' . $GLOBALS['Language']->getText('plugin_tracker_common_types', $event['description_msg']) . "</td>\n"; echo "</tr>\n"; } echo ' </table>'; }
} //if assigned to selected, and more to where clause if ($_assigned_to) { $assigned_str = "AND project_assigned_to.assigned_to_id='{$_assigned_to}'"; //workaround for old tasks that do not have anyone assigned to them //should not be needed for tasks created/updated after may, 2000 $assigned_str2 = ',project_assigned_to'; $assigned_str3 = 'project_task.project_task_id=project_assigned_to.project_task_id AND'; } else { //no assigned to was chosen, so don't add it to where clause $assigned_str = ''; } //build page title to make bookmarking easier //if a user was selected, add the user_name to the title //same for status pm_header(array('title' => 'Browse Tasks' . ($_assigned_to ? ' For: ' . user_getname($_assigned_to) : '') . ($_status && $_status != 100 ? ' By Status: ' . pm_data_get_status_name($_status) : ''))); $sql = "SELECT project_task.priority,project_task.group_project_id,project_task.project_task_id," . "project_task.start_date,project_task.end_date,project_task.percent_complete,project_task.summary " . "FROM project_task {$assigned_str2} " . "WHERE {$assigned_str3} project_task.group_project_id='{$group_project_id}' " . " {$assigned_str} {$status_str} " . $order_by; $message = "Browsing Custom Task List"; $result = db_query($sql, 51, $offset); /* creating a custom technician box which includes "any" and "unassigned" */ $res_tech = pm_data_get_technicians($group_id); $tech_id_arr = util_result_column_to_array($res_tech, 0); $tech_id_arr[] = '0'; //this will be the 'any' row $tech_name_arr = util_result_column_to_array($res_tech, 1); $tech_name_arr[] = 'Any'; $tech_box = html_build_select_box_from_arrays($tech_id_arr, $tech_name_arr, '_assigned_to', $_assigned_to, true, 'Unassigned'); /* Show the new pop-up boxes to select assigned to and/or status
<?php // // BerliOS : The Open Source Mediator // Copyright 2000-2004 (c) The BerliOS Crew // http://developer.berlios.de // // $Id: userdonation.php,v 1.1 2004/04/02 10:42:24 helix Exp $ require "pre.php"; // Initial db and session library, opens session $HTML->header(array(title => "Process User Donation")); if (user_isloggedin()) { $from_user_name = user_getname(); $from_user_id = user_getid(); } else { $from_user_name = 'anonymous'; $from_user_id = 7428; } $time = time(); ?> <p> <center> <table cellspacing="1" cellpadding="5" border="0" bgcolor="#FFFFFF"> <tr bgcolor="#EAECEF"><td><b>Donors Login name:</b></td><td><?php echo $from_user_name; ?> </td></tr> <tr bgcolor="#EAECEF"><td><b>Donors User ID:</b></td><td><?php echo $from_user_id; ?>
function _getGlobalSettings() { $html = ''; $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_create_settings') . '</h3>'; $html .= '<div id="docman_approval_table_create_settings">'; $html .= '<table>'; // Version if (is_a($this->table, 'Docman_ApprovalTableVersionned')) { $html .= '<tr>'; $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_version') . '</td>'; $html .= '<td>'; $html .= $this->table->getVersionNumber(); $html .= '</td>'; $html .= '</tr>'; } // Owner $html .= '<tr>'; $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_requester') . '</td>'; $html .= '<td>'; $html .= '<input type="text" class="text_field" name="table_owner" value="' . user_getname($this->table->getOwner()) . '" />'; $html .= '</td>'; $html .= '</tr>'; // Status $html .= '<tr>'; $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_status') . '</td>'; $vals = array(0 => PLUGIN_DOCMAN_APPROVAL_TABLE_CLOSED, 1 => PLUGIN_DOCMAN_APPROVAL_TABLE_DELETED); $txts = array(0 => $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_' . PLUGIN_DOCMAN_APPROVAL_TABLE_CLOSED), 1 => $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_' . PLUGIN_DOCMAN_APPROVAL_TABLE_DELETED)); if ($this->table->isCustomizable()) { $vals[2] = PLUGIN_DOCMAN_APPROVAL_TABLE_DISABLED; $vals[3] = PLUGIN_DOCMAN_APPROVAL_TABLE_ENABLED; $txts[2] = $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_' . PLUGIN_DOCMAN_APPROVAL_TABLE_DISABLED); $txts[3] = $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_' . PLUGIN_DOCMAN_APPROVAL_TABLE_ENABLED); } $html .= '<td>'; $html .= html_build_select_box_from_arrays($vals, $txts, 'status', $this->table->getStatus(), false); $html .= '</td>'; $html .= '</tr>'; // Description $html .= '<tr>'; $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_description') . '</td>'; $html .= '<td>'; $html .= '<textarea name="description">' . $this->hp->purify($this->table->getDescription()) . '</textarea>'; $html .= '</td>'; $html .= '</tr>'; $html .= '</table>'; $html .= '</div>'; return $html; }
function addUploadPage() { // Dirty hack to 'give' a WikiRequest object to phpwiki // So obscure functions seems require it. $request =& $this->getRequest(); $dbi = $request->getDbh(); require_once PHPWIKI_SRC_PATH . "/lib/loadsave.php"; $pagehandle = $dbi->getPage("UpLoad"); if ($pagehandle->exists()) { // don't replace default contents $current = $pagehandle->getCurrentRevision(); $version = $current->getVersion(); $text = $current->getPackedContent(); $meta = $current->_data; } else { // Create a new page (first use or page previously erased) $version = 0; $text = '__Upload a file which will be accessible by typing:__ <verbatim> Upload:num_rev/filename </verbatim> ---- <?plugin UpLoad ?> ---- '; $meta['author'] = user_getname(); } $meta['summary'] = "Page created"; $pagehandle->save($text, $version + 1, $meta); }
if (user_isloggedin()) { $vRoot = new Valid_String('root'); $vRoot->required(); if (!$request->valid($vRoot)) { exit_no_group(); } $root = $request->get('root'); $group_id = group_getid_by_name($root); if ($group_id === false) { exit_no_group(); } $vRootType = new Valid_WhiteList('roottype', array('svn')); $vRootType->setErrorMessage($Language->getText('svn_viewvc', 'bad_roottype')); $vRootType->required(); if ($request->valid($vRootType)) { if (!svn_utils_check_access(user_getname(), $root, viewvc_utils_getfile("/svn/viewvc.php"))) { exit_error($Language->getText('svn_viewvc', 'access_denied'), $Language->getText('svn_viewvc', 'acc_den_comment', session_make_url("/project/memberlist.php?group_id={$group_id}"))); } viewvc_utils_track_browsing($group_id, 'svn'); $display_header_footer = viewvc_utils_display_header(); if ($display_header_footer) { $prefix_title = ''; if ($path = viewvc_utils_getfile("/svn/viewvc.php")) { $prefix_title = basename($path) . ' - '; } $GLOBALS['HTML']->addStylesheet('/viewvc-static/styles.css'); svn_header(array('title' => $prefix_title . $Language->getText('svn_utils', 'browse_tree'), 'path' => '/' . urlencode(viewvc_utils_getfile("/svn/viewvc.php")))); } viewvc_utils_passcommand(); if ($display_header_footer) { site_footer(array());
function _deduceUsername() { global $HTTP_SERVER_VARS, $HTTP_ENV_VARS; if (!empty($this->args['auth']) and !empty($this->args['auth']['userid'])) { return $this->args['auth']['userid']; } // Codendi specific return user_getname(); if ($user = $this->getSessionVar('wiki_user')) { // switched auth between sessions. // Note: There's no way to demandload a missing class-definition // afterwards! (Stupid php) if (isa($user, WikiUserClassname())) { $this->_user = $user; $this->_user->_authhow = 'session'; return ENABLE_USER_NEW ? $user->UserName() : $this->_user; } } // Sessions override http auth if (!empty($HTTP_SERVER_VARS['PHP_AUTH_USER'])) { return $HTTP_SERVER_VARS['PHP_AUTH_USER']; } // pubcookie et al if (!empty($HTTP_SERVER_VARS['REMOTE_USER'])) { return $HTTP_SERVER_VARS['REMOTE_USER']; } if (!empty($HTTP_ENV_VARS['REMOTE_USER'])) { return $HTTP_ENV_VARS['REMOTE_USER']; } if ($userid = $this->getCookieVar('WIKI_ID')) { if (!empty($userid) and substr($userid, 0, 2) != 's:') { $this->_user->authhow = 'cookie'; return $userid; } } if ($this->getArg('action') == 'xmlrpc') { // how about SOAP? // wiki.putPage has special otional userid/passwd arguments. check that later. $userid = ''; if (isset($HTTP_SERVER_VARS['REMOTE_USER'])) { $userid = $HTTP_SERVER_VARS['REMOTE_USER']; } elseif (isset($HTTP_SERVER_VARS['REMOTE_ADDR'])) { $userid = $HTTP_SERVER_VARS['REMOTE_ADDR']; } elseif (isset($HTTP_ENV_VARS['REMOTE_ADDR'])) { $userid = $HTTP_ENV_VARS['REMOTE_ADDR']; } elseif (isset($GLOBALS['REMOTE_ADDR'])) { $userid = $GLOBALS['REMOTE_ADDR']; } return $userid; } return false; }
$set = 'custom'; } else { $set = 'custom'; $_commiter = 100; } } else { $_commiter = 100; $set = 'custom'; } } if ($set == 'my') { /* My commits - backwards compat can be removed 9/10 */ $_tag = 100; $_commiter = user_getname(); $_branch = 100; } else { if ($set == 'custom') { /* if this custom set is different than the stored one, reset preference */ $pref_ = $_commit_id . '|' . $_commiter . '|' . $_tag . '|' . $_branch . '|' . $_srch . '|' . $chunksz; if ($pref_ != user_get_preference('commits_browcust' . $group_id)) { //echo 'setting pref'; user_set_preference('commits_browcust' . $group_id, $pref_); } } else { if ($set == 'any') { /* Closed commits - backwards compat can be removed 9/10
// If it's super user and license terms have not yet been agreed then redirect // to license agreement page if (user_is_super_user() && !license_already_displayed()) { session_redirect("/admin/approve_license.php"); } // Make sure this page is not cached because // it uses the exact same URL for all user's // personal page header("Cache-Control: no-cache, no-store, must-revalidate"); // for HTTP 1.1 header("Pragma: no-cache"); // for HTTP 1.0 if (browser_is_netscape4()) { $feedback .= $Language->getText('my_index', 'err_badbrowser'); } $title = $Language->getText('my_index', 'title', array($hp->purify(user_getrealname(user_getid()), CODENDI_PURIFIER_CONVERT_HTML) . ' (' . user_getname() . ')')); $GLOBALS['HTML']->includeJavascriptFile('/scripts/scriptaculous/scriptaculous.js'); my_header(array('title' => $title, 'body_class' => array('widgetable'))); echo '<p>' . $Language->getText('my_index', 'message') . '</p>'; $lm = new WidgetLayoutManager(); $lm->displayLayout(user_getid(), WidgetLayoutManager::OWNER_TYPE_USER); if (!$current_user->getPreference(Tuleap_Tour_WelcomeTour::TOUR_NAME)) { $GLOBALS['Response']->addTour(new Tuleap_Tour_WelcomeTour($current_user)); } ?> </span> <?php $request =& HTTPRequest::instance(); if ($request->get('pv') == 2) { $GLOBALS['Response']->pv_footer(array()); } else {
$assigned_str = "AND support.assigned_to='{$_assigned_to}'"; } else { //no assigned to was chosen, so don't add it to where clause $assigned_str = ''; } //if category selected, add to where clause if ($_category && $_category != 100) { $category_str = "AND support.support_category_id='{$_category}'"; } else { //no assigned to was chosen, so don't add it to where clause $category_str = ''; } //build page title to make bookmarking easier //if a user was selected, add the user_name to the title //same for status support_header(array('title' => 'Browse Support Requests' . ($_assigned_to ? ' For: ' . user_getname($_assigned_to) : '') . ($_status && $_status != 100 ? ' By Status: ' . support_data_get_status_name($_status) : ''))); //now build the query using the criteria built above $sql = "SELECT support.priority,support.group_id,support.support_id,support.summary," . "support_category.category_name,support_status.status_name," . "support.open_date AS date,users.user_name AS submitted_by,user2.user_name AS assigned_to_user " . "FROM support,support_category,support_status,users,users user2 " . "WHERE users.user_id=support.submitted_by " . " {$status_str} {$assigned_str} {$category_str} " . "AND user2.user_id=support.assigned_to " . "AND support_category.support_category_id=support.support_category_id " . "AND support_status.support_status_id=support.support_status_id " . "AND support.group_id='{$group_id}'" . $order_by; /* creating a custom technician box which includes "any" and "unassigned" */ $res_tech = support_data_get_technicians($group_id); $tech_id_arr = util_result_column_to_array($res_tech, 0); $tech_id_arr[] = '0'; //this will be the 'any' row $tech_name_arr = util_result_column_to_array($res_tech, 1); $tech_name_arr[] = 'Any'; $tech_box = html_build_select_box_from_arrays($tech_id_arr, $tech_name_arr, '_assigned_to', $_assigned_to, true, 'Unassigned'); /* Show the new pop-up boxes to select assigned to and/or status */
} else { $prefill = new Account_RegisterPrefillValuesPresenter($form_loginname, $form_email, $form_realname, $form_register_purpose, $form_mail_site, $timezone); $presenter = new Account_RegisterByUserPresenter($prefill); $template = 'register-user'; } $renderer = TemplateRendererFactory::build()->getRenderer(ForgeConfig::get('codendi_dir') . '/src/templates/account/'); $renderer->renderToPage($template, $presenter); } // ###### first check for valid login, if so, congratulate $request =& HTTPRequest::instance(); $hp =& Codendi_HTMLPurifier::instance(); if ($request->isPost() && $request->exist('Register')) { $page = $request->get('page'); $confirm_hash = substr(md5($GLOBALS['session_hash'] . $request->get('form_pw') . time()), 0, 16); if ($new_userid = register_valid($confirm_hash)) { $user_name = user_getname($new_userid); $content = ''; $admin_creation = false; $password = ''; if ($page == 'admin_creation') { $admin_creation = true; $password = $request->get('form_pw'); $login = $request->get('form_loginname'); if ($request->get('form_send_email')) { //send an email to the user with th login and password $from = $GLOBALS['sys_noreply']; $to = $request->get('form_email'); $subject = $Language->getText('account_register', 'welcome_email_title', $GLOBALS['sys_name']); include $Language->getContent('account/new_account_email'); $mail = new Mail(); $mail->setSubject($subject);
} } $GLOBALS['Response']->redirect('/news/admin'); } } news_header(array('title' => $Language->getText('news_admin_index', 'title'))); if ($request->get('approve')) { /* Show the submit form */ $sql = "SELECT groups.unix_group_name,news_bytes.* " . "FROM news_bytes,groups WHERE id=" . db_ei($id) . " " . "AND news_bytes.group_id=groups.group_id "; $result = db_query($sql); if (db_numrows($result) < 1) { exit_error($Language->getText('global', 'error'), $Language->getText('news_admin_index', 'not_found_err')); } $username = user_getname(db_result($result, 0, 'submitted_by')); $news_date = util_timestamp_to_userdateformat(db_result($result, 0, 'date'), true); echo ' <H3>' . $Language->getText('news_admin_index', 'approve') . '</H3> <P> <FORM ACTION="" METHOD="POST"> <INPUT TYPE="HIDDEN" NAME="for_group" VALUE="' . db_result($result, 0, 'group_id') . '"> <INPUT TYPE="HIDDEN" NAME="id" VALUE="' . db_result($result, 0, 'id') . '"> <B>' . $Language->getText('news_admin_index', 'submitted_for_group') . ':</B> <a href="/projects/' . strtolower(db_result($result, 0, 'unix_group_name')) . '/">' . $pm->getProject(db_result($result, 0, 'group_id'))->getPublicName() . '</a><BR> <B>' . $Language->getText('news_admin_index', 'submitted_by') . ':</B> <a href="/users/' . $username . '">' . $username . '</a><BR> <B>' . $Language->getText('news_admin_index', 'submitted_on') . ':</B> ' . $news_date . '<BR> <INPUT TYPE="HIDDEN" NAME="approve" VALUE="y"> <INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="y"> <INPUT TYPE="RADIO" NAME="status" VALUE="1"> ' . $Language->getText('news_admin_index', 'approve_for_front') . '<BR> <INPUT TYPE="RADIO" NAME="status" VALUE="0"> ' . $Language->getText('news_admin_index', 'do_nothing') . '<BR> <INPUT TYPE="RADIO" NAME="status" VALUE="2" CHECKED> ' . $Language->getText('news_admin_index', 'reject') . '<BR>
function show_supporthistory($support_id) { /* show the support_history rows that are relevant to this support_id, excluding details */ global $sys_datefmt; $result = support_data_get_history($support_id); $rows = db_numrows($result); if ($rows > 0) { $title_arr = array(); $title_arr[] = 'Field'; $title_arr[] = 'Old Value'; $title_arr[] = 'Date'; $title_arr[] = 'By'; echo html_build_list_table_top($title_arr); for ($i = 0; $i < $rows; $i++) { $field = db_result($result, $i, 'field_name'); echo ' <TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD>' . $field . '</TD><TD>'; if ($field == 'support_status_id') { echo support_data_get_status_name(db_result($result, $i, 'old_value')); } else { if ($field == 'support_category_id') { echo support_data_get_category_name(db_result($result, $i, 'old_value')); } else { if ($field == 'assigned_to') { echo user_getname(db_result($result, $i, 'old_value')); } else { if ($field == 'close_date') { echo date($sys_datefmt, db_result($result, $i, 'old_value')); } else { echo db_result($result, $i, 'old_value'); } } } } echo '</TD>' . '<TD>' . date($sys_datefmt, db_result($result, $i, 'date')) . '</TD>' . '<TD>' . db_result($result, $i, 'user_name') . '</TD></TR>'; } echo ' </TABLE>'; } else { echo ' <H3>No Changes Have Been Made to This Support Request</H3>'; } }
function displayNotificationForm($user_id) { global $Language; $hp = Codendi_HTMLPurifier::instance(); // By default it's all 'yes' for ($i = 0; $i < $this->num_roles; $i++) { $role_label = $this->arr_roles[$i]['role_label']; for ($j = 0; $j < $this->num_events; $j++) { $event_label = $this->arr_events[$j]['event_label']; $arr_notif[$role_label][$event_label] = 1; //echo "[$role_label][$event_label] = 1<br>"; } } $res_notif = $this->getNotificationWithLabels($user_id); while ($arr = db_fetch_array($res_notif)) { $arr_notif[$arr['role_label']][$arr['event_label']] = $arr['notify']; } $group = $this->getGroup(); $group_artifact_id = $this->getID(); $group_id = $group->getGroupId(); echo '<H2>' . $Language->getText('tracker_import_admin', 'tracker') . ' \'<a href="/tracker/admin/?group_id=' . (int) $group_id . '&atid=' . $group_artifact_id . '">' . $hp->purify(SimpleSanitizer::unsanitize($this->getName()), CODENDI_PURIFIER_CONVERT_HTML) . '</a>\' - ' . $Language->getText('tracker_include_type', 'mail_notif') . '</h2>'; // Build Wachees UI $res = $this->getWatchees($user_id); $arr_watchees = array(); while ($row_watchee = db_fetch_array($res)) { $arr_watchees[] = user_getname($row_watchee['watchee_id']); } $watchees = join(',', $arr_watchees); echo ' <FORM action="/tracker/admin" method="get"> <INPUT type="hidden" name="func" value="notification"> <INPUT type="hidden" name="atid" value="' . (int) $this->getID() . '"> <INPUT type="hidden" name="group_id" value="' . (int) $group_id . '">'; if ($this->userIsAdmin()) { echo '<h3><a name="ToggleEmailNotification"></a>' . $Language->getText('tracker_include_type', 'toggle_notification') . ' ' . help_button('TrackerAdministration.html#ToggleEmailNotification') . '</h3>'; echo ' <P>' . $Language->getText('tracker_include_type', 'toggle_notif_note') . '<BR> <BR><INPUT TYPE="checkbox" NAME="stop_notification" VALUE="1" ' . ($this->getStopNotification() ? 'CHECKED' : '') . '> ' . $Language->getText('tracker_include_type', 'stop_notification'); } else { if ($this->getStopNotification()) { echo '<h3><a name="ToggleEmailNotification"></a>' . $Language->getText('tracker_include_type', 'notification_suspended') . ' ' . help_button('TrackerAdministration.html#ToggleEmailNotification') . '</h3>'; echo ' <P><b>' . $Language->getText('tracker_include_type', 'toggle_notif_warn') . '</b><BR>'; } } echo '<h3><a name="GlobalEmailNotification"></a>' . $Language->getText('tracker_include_type', 'global_mail_notif') . ' ' . help_button('TrackerAdministration.html#TrackerGlobalEmailNotification') . '</h3>'; $agnf = new ArtifactGlobalNotificationFactory(); $notifs = $agnf->getGlobalNotificationsForTracker($this->getID()); if ($this->userIsAdmin()) { echo '<p>' . $Language->getText('tracker_include_type', 'admin_note') . '</p>'; if (count($notifs)) { echo '<div id="global_notifs">'; foreach ($notifs as $key => $nop) { echo '<div>'; echo '<a href="?func=notification&group_id=' . (int) $group_id . '&atid=' . (int) $this->getId() . '&action=remove_global&global_notification_id=' . (int) $notifs[$key]->getId() . '">' . $GLOBALS['Response']->getimage('ic/trash.png') . '</a> '; //addresses echo '<input type="text" name="global_notification[' . (int) $notifs[$key]->getId() . '][addresses]" value="' . $hp->purify($notifs[$key]->getAddresses(), CODENDI_PURIFIER_CONVERT_HTML) . '" size="55" />'; //all_updates echo ' ' . $Language->getText('tracker_include_type', 'send_all') . ' '; echo '<input type="hidden" name="global_notification[' . (int) $notifs[$key]->getId() . '][all_updates]" value="0" />'; echo '<input type="checkbox" name="global_notification[' . (int) $notifs[$key]->getId() . '][all_updates]" value="1" ' . ($notifs[$key]->isAllUpdates() ? 'checked="checked"' : '') . ' />'; //check_permissions echo ' ' . $Language->getText('tracker_include_type', 'check_perms') . ' '; echo '<input type="hidden" name="global_notification[' . (int) $notifs[$key]->getId() . '][check_permissions]" value="0" />'; echo '<input type="checkbox" name="global_notification[' . (int) $notifs[$key]->getId() . '][check_permissions]" value="1" ' . ($notifs[$key]->isCheckPermissions() ? 'checked="checked"' : '') . ' />'; echo '</div>'; } echo '</div>'; } echo '<p><a href="?func=notification&group_id=' . (int) $group_id . '&atid=' . (int) $this->getId() . '&action=add_global" id="add_global">' . $Language->getText('tracker_include_type', 'add') . '</a></p>'; echo '<script type="text/javascript">' . "\n document.observe('dom:loaded', function() {\n \$('add_global').observe('click', function (evt) {\n var self = arguments.callee;\n if (!self.counter) {\n self.counter = 0;\n }\n var number = self.counter++;\n \n var div = new Element('div');\n div.insert('<a href=\"#\" onclick=\"this.parentNode.remove(); return false;\">" . $GLOBALS['Response']->getimage('ic/trash.png') . "</a> '+\n //addresses\n '<input type=\"text\" name=\"add_global_notification['+number+'][addresses]\" size=\"55\" />'+\n //all_updates\n ' " . addslashes($Language->getText('tracker_include_type', 'send_all')) . " '+\n '<input type=\"hidden\" name=\"add_global_notification['+number+'][all_updates]\" value=\"0\" />'+\n '<input type=\"checkbox\" name=\"add_global_notification['+number+'][all_updates]\" value=\"1\" />'+\n //check_permissions\n ' " . addslashes($Language->getText('tracker_include_type', 'check_perms')) . " '+\n '<input type=\"hidden\" name=\"add_global_notification['+number+'][check_permissions]\" value=\"0\" />'+\n '<input type=\"checkbox\" name=\"add_global_notification['+number+'][check_permissions]\" value=\"1\" checked=\"checked\" />'\n );\n \n Element.insert(\$('global_notifs'), div);\n \n Event.stop(evt);\n return false;\n });\n });\n </script>"; } else { $ok = false; if (count($notifs)) { reset($notifs); while (!$ok && (list($id, ) = each($notifs))) { $ok = $notifs[$id]->getAddresses(); } } if ($ok) { echo $Language->getText('tracker_include_type', 'admin_conf'); foreach ($notifs as $key => $nop) { if ($notifs[$key]->getAddresses()) { echo '<div>' . $notifs[$key]->getAddresses() . ' '; echo $Language->getText('tracker_include_type', 'send_all_or_not', $notifs[$key]->isAllUpdates() ? $Language->getText('global', 'yes') : $Language->getText('global', 'no')); echo '</div>'; } } } else { echo $Language->getText('tracker_include_type', 'admin_not_conf'); } } echo '<h3>' . $Language->getText('tracker_include_type', 'perso_mail_notif') . '</h3>'; if ($this->userIsAdmin()) { // To watch other users you must have at least admin rights on the tracker echo ' <h4>' . $Language->getText('tracker_include_type', 'users_to_watch') . ' ' . help_button('TrackerAdministration.html#TrackerWatchers') . '</h4> <P>' . $Language->getText('tracker_include_type', 'backup_person') . ' <p><INPUT TYPE="TEXT" NAME="watchees" VALUE="' . $hp->purify($watchees, CODENDI_PURIFIER_CONVERT_HTML) . '" SIZE="55" MAXLENGTH="255"><br></p> '; $res = $this->getWatchers($user_id); $arr_watchers = array(); $watchers = ""; while ($row_watcher = db_fetch_array($res)) { $watcher_name = user_getname($row_watcher['user_id']); $watchers .= '<a href="/users/' . urlencode($watcher_name) . '">' . $hp->purify($watcher_name, CODENDI_PURIFIER_CONVERT_HTML) . '</a>,'; } $watchers = substr($watchers, 0, -1); // remove extra comma at the end if ($watchers) { echo "<p>" . $Language->getText('tracker_include_type', 'watchers', $hp->purify($watchers, CODENDI_PURIFIER_CONVERT_HTML)); } else { echo "<p>" . $Language->getText('tracker_include_type', 'no_watcher'); } echo '<br><br>'; } // Build Role/Event table // Rk: Can't use html_build_list_table_top because of the specific layout echo '<h4>' . $Language->getText('tracker_include_type', 'event_settings') . ' ' . help_button('TrackerAdministration.html#TrackerEventRoleBasedEmailNotification') . '</h4> <P>' . $Language->getText('tracker_include_type', 'tune_settings'); echo ' <table BORDER="0" CELLSPACING="1" CELLPADDING="2" class="small"> <tr class="boxtitle"> <td colspan="' . (int) $this->num_roles . '" align="center" width="50%"><b>' . $Language->getText('tracker_include_type', 'role_is') . '</b></td> <td rowspan="2" width="50%"><b> ' . $Language->getText('tracker_include_type', 'notify_me') . '</b></td> </tr>'; for ($i = 0; $i < $this->num_roles; $i++) { echo '<td align="center" width="10%"><b>' . $Language->getText('tracker_common_types', $this->arr_roles[$i]['short_description_msg']) . "</b></td>\n"; } echo "</tr>\n"; for ($j = 0; $j < $this->num_events; $j++) { $event_id = $this->arr_events[$j]['event_id']; $event_label = $this->arr_events[$j]['event_label']; echo "<tr class=\"" . util_get_alt_row_color($j) . "\">\n"; for ($i = 0; $i < $this->num_roles; $i++) { $role_id = $this->arr_roles[$i]['role_id']; $role_label = $this->arr_roles[$i]['role_label']; $cbox_name = 'cb_' . $role_id . '_' . $event_id; //echo "<BR>$role_label $role_id $event_label $event_id ".$arr_notif['$role_label']['$event_label']; if ($event_label == 'NEW_ARTIFACT' && $role_label != 'ASSIGNEE' && $role_label != 'SUBMITTER' || $event_label == 'ROLE_CHANGE' && $role_label != 'ASSIGNEE' && $role_label != 'CC') { // if the user is not a member then the ASSIGNEE column cannot // be set. If it's not an assignee or a submitter the new_artifact event is meaningless echo ' <td align="center"><input type="hidden" name="' . $cbox_name . '" value="1">-</td>' . "\n"; } else { echo ' <td align="center"><input type="checkbox" name="' . $cbox_name . '" value="1" ' . ($arr_notif[$role_label][$event_label] ? 'checked' : '') . "></td>\n"; } } echo ' <td> ' . $Language->getText('tracker_common_types', $this->arr_events[$j]['description_msg']) . "</td>\n"; echo "</tr>\n"; } echo "</table>\n"; $em = EventManager::instance(); $em->processEvent('artifact_type_html_display_notification_form', array('at' => $this, 'group_id' => $group_id, 'art_field_fact' => $GLOBALS['art_field_fact'])); echo '<P align="center"><INPUT type="submit" name="submit" value="' . $Language->getText('tracker_include_artifact', 'submit') . '"> </FORM>'; }
function showHistory() { global $artifact_cat_arr, $artifact_grp_arr, $artifact_res_arr; $result = $this->getHistory(); $rows = db_numrows($result); if ($rows > 0) { $title_arr = array(); $title_arr[] = _('Field'); $title_arr[] = _('Old Value'); $title_arr[] = _('Date'); $title_arr[] = _('By'); echo $GLOBALS['HTML']->listTableTop($title_arr); $artifactType =& $this->getArtifactType(); for ($i = 0; $i < $rows; $i++) { $field = db_result($result, $i, 'field_name'); echo ' <tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td>' . $field . '</td><td>'; if ($field == 'status_id') { echo $artifactType->getStatusName(db_result($result, $i, 'old_value')); } else { if ($field == 'assigned_to') { echo user_getname(db_result($result, $i, 'old_value')); } else { if ($field == 'close_date') { echo date(_('Y-m-d H:i'), db_result($result, $i, 'old_value')); } else { echo db_result($result, $i, 'old_value'); } } } echo '</td>' . '<td>' . date(_('Y-m-d H:i'), db_result($result, $i, 'entrydate')) . '</td>' . '<td>' . db_result($result, $i, 'user_name') . '</td></tr>'; } echo $GLOBALS['HTML']->listTableBottom(); } else { echo ' <h3>' . _('No Changes Have Been Made to This Item') . '</h3>'; } }