function getContent()
 {
     $html = '';
     $i = 1;
     $UH = UserHelper::instance();
     $hp = Codendi_HTMLPurifier::instance();
     while ($data = db_fetch_array($this->getLatestRevisions())) {
         $html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">';
         $html .= '<div style="font-size:0.98em;">';
         $html .= '<a href="' . $this->_getLinkToCommit($data) . '">#' . $data['revision'] . '</a>';
         $html .= ' by ';
         if (isset($data['whoid'])) {
             $name = $UH->getDisplayNameFromUserId($data['whoid']);
         } else {
             $name = $UH->getDisplayNameFromUserName($data['who']);
         }
         $html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . ' on ';
         //In the db, svn dates are stored as int whereas cvs dates are stored as timestamp
         $html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date']));
         $html .= '</div>';
         $html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">';
         $html .= util_make_links(substr($data['description'], 0, 255), $this->group_id);
         if (strlen($data['description']) > 255) {
             $html .= '&nbsp;[...]';
         }
         $html .= '</div>';
         $html .= '</div>';
     }
     $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
     $html .= '<a href="' . $this->_getLinkToMore() . '">[ More ]</a>';
     $html .= '</div>';
     return $html;
 }
 public function getContent()
 {
     $html = '';
     $uh = UserHelper::instance();
     $request = HTTPRequest::instance();
     $hp = Codendi_HTMLPurifier::instance();
     $user = UserManager::instance()->getCurrentUser();
     $pm = ProjectManager::instance();
     $project_ids = $user->getProjects();
     foreach ($project_ids as $project_id) {
         $project = $pm->getProject($project_id);
         if ($project->usesSVN()) {
             list($hide_now, $count_diff, $hide_url) = my_hide_url('my_svn_group', $project_id, $request->get('hide_item_id'), count($project_ids), $request->get('hide_my_svn_group'));
             $html .= $hide_url;
             $html .= '<strong>' . $project->getPublicName() . '</strong>';
             if (!$hide_now) {
                 list($latest_revisions, $nb_revisions) = svn_get_revisions($project, 0, $this->_nb_svn_commits, '', $user->getUserName(), '', '', 0, false);
                 if (db_numrows($latest_revisions) > 0) {
                     $i = 0;
                     while ($data = db_fetch_array($latest_revisions)) {
                         $html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">';
                         $html .= '<div style="font-size:0.98em;">';
                         $html .= '<a href="' . $this->_getLinkToCommit($project->getGroupId(), $data['revision']) . '">rev #' . $data['revision'] . '</a>';
                         $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_on') . ' ';
                         //In the db, svn dates are stored as int whereas cvs dates are stored as timestamp
                         $html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date']));
                         $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_by') . ' ';
                         if (isset($data['whoid'])) {
                             $name = $uh->getDisplayNameFromUserId($data['whoid']);
                         } else {
                             $name = $uh->getDisplayNameFromUserName($data['who']);
                         }
                         $html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML);
                         $html .= '</div>';
                         $html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">';
                         $html .= util_make_links(substr($data['description'], 0, 255), $project->getGroupId());
                         if (strlen($data['description']) > 255) {
                             $html .= '&nbsp;[...]';
                         }
                         $html .= '</div>';
                         $html .= '</div>';
                     }
                     $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
                     $html .= '<a href="' . $this->_getLinkToMore($project->getGroupId(), $user->getUserName()) . '">[ More ]</a>';
                     $html .= '</div>';
                 } else {
                     $html .= '<div></div>';
                 }
             } else {
                 $html .= '<div></div>';
             }
         }
     }
     return $html;
 }
Ejemplo n.º 3
0
function forum_show_a_nested_message($result, $row = 0)
{
    /*
    	accepts a database result handle to display a single message
    		in the format appropriate for the nested messages
    	second param is which row in that result set to use
    */
    global $Language;
    $g_id = db_result($result, $row, 'group_id');
    if ($g_id == $GLOBALS['sys_news_group']) {
        $f_id = db_result($result, $row, 'group_forum_id');
        $gr = db_query("SELECT group_id FROM news_bytes WHERE forum_id=" . db_ei($f_id));
        $g_id = db_result($gr, 0, 'group_id');
    }
    $poster = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name'));
    $ret_val = '
		<TABLE BORDER="0" WIDTH="100%">
			<TR>                  
              <TD class="thread" NOWRAP>' . $Language->getText('forum_forum', 'by') . ': ' . UserHelper::instance()->getLinkOnUser($poster) . '<BR><A HREF="/forum/message.php?msg_id=' . db_result($result, $row, 'msg_id') . '">' . '<IMG SRC="' . util_get_image_theme("msg.png") . '" BORDER=0 HEIGHT=12 WIDTH=10> ' . db_result($result, $row, 'subject') . ' [ ' . $Language->getText('forum_forum', 'reply') . ' ]</A> &nbsp; ' . '<BR>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $row, 'date')) . '
                </TD>      
                               
			</TR>
			<TR>
				<TD>
					' . util_make_links(nl2br(db_result($result, $row, 'body')), $g_id) . '
				</TD>
			</TR>';
    $crossref_fact = new CrossReferenceFactory(db_result($result, $row, 'msg_id'), ReferenceManager::REFERENCE_NATURE_FORUMMESSAGE, $g_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        $ret_val .= '<tr>';
        $ret_val .= ' <td class="forum_reference_separator">';
        $ret_val .= '  <b> ' . $Language->getText('cross_ref_fact_include', 'references') . '</b>';
        $ret_val .= $crossref_fact->getHTMLDisplayCrossRefs();
        $ret_val .= ' </td>';
        $ret_val .= '</tr>';
    }
    $ret_val .= '
			<tr>
			 <td>
			 </td>
			</tr>
		</TABLE>';
    return $ret_val;
}
Ejemplo n.º 4
0
function news_foundry_latest($group_id = 0, $limit = 5, $show_summaries = true)
{
    /*
    	Show a the latest news for a portal
    */
    $sql = "SELECT groups.group_name,groups.unix_group_name,groups.group_id,\n\t\tusers.user_name,users.realname,news_bytes.forum_id,\n\t\tnews_bytes.summary,news_bytes.post_date,news_bytes.details \n\t\tFROM users,news_bytes,groups,foundry_news \n\t\tWHERE foundry_news.foundry_id='{$group_id}' \n\t\tAND users.user_id=news_bytes.submitted_by \n\t\tAND foundry_news.news_id=news_bytes.id \n\t\tAND news_bytes.group_id=groups.group_id \n\t\tAND foundry_news.is_approved=1 \n\t\tORDER BY news_bytes.post_date DESC";
    $result = db_query($sql, $limit);
    $rows = db_numrows($result);
    if (!$result || $rows < 1) {
        $return .= '<h3>' . _('No News Items Found') . '</h3>';
        $return .= db_error();
    } else {
        for ($i = 0; $i < $rows; $i++) {
            if ($show_summaries) {
                //get the first paragraph of the story
                $arr = explode("\n", db_result($result, $i, 'details'));
                if (isset($arr[1]) && isset($arr[2]) && strlen($arr[0]) < 200 && strlen($arr[1] . $arr[2]) < 300 && strlen($arr[2]) > 5) {
                    $summ_txt = util_make_links($arr[0] . '<br />' . $arr[1] . '<br />' . $arr[2]);
                } else {
                    $summ_txt = util_make_links($arr[0]);
                }
                //show the project name
                $proj_name = ' &nbsp; - &nbsp; ' . util_make_link_g(strtolower(db_result($result, $i, 'unix_group_name')), db_result($result, $i, 'group_id'), db_result($result, $i, 'group_name'));
            } else {
                $proj_name = '';
                $summ_txt = '';
            }
            $return .= util_make_link('/forum/forum.php?forum_id=' . db_result($result, $i, 'forum_id'), '<strong>' . db_result($result, $i, 'summary') . '</strong>') . '<br /><em>' . db_result($result, $i, 'realname') . ' - ' . date(_('Y-m-d H:i'), db_result($result, $i, 'post_date')) . $proj_name . '</em>
				' . $summ_txt . '<hr width="100%" size="1" />';
        }
    }
    return $return;
}
Ejemplo n.º 5
0
 function artifactfollowups_to_soap($followups_res, $group_id, $group_artifact_id, $artifact)
 {
     $return = array();
     $rows = db_numrows($followups_res);
     for ($i = 0; $i < $rows; $i++) {
         $comment = util_make_links(db_result($followups_res, $i, 'new_value'), $group_id, $group_artifact_id);
         $id = db_result($followups_res, $i, 'artifact_history_id');
         $return[] = array('artifact_id' => db_result($followups_res, $i, 'artifact_id'), 'follow_up_id' => $id, 'comment' => util_unconvert_htmlspecialchars($comment), 'date' => db_result($followups_res, $i, 'date'), 'original_date' => db_result($artifact->getOriginalCommentDate($id), 0, 'date'), 'by' => db_result($followups_res, $i, 'mod_by') == 100 ? db_result($followups_res, $i, 'email') : db_result($followups_res, $i, 'user_name'), 'original_by' => db_result($artifact->getOriginalCommentSubmitter($id), 0, 'mod_by') == 100 ? db_result($artifact->getOriginalCommentSubmitter($id), 0, 'email') : user_getname(db_result($artifact->getOriginalCommentSubmitter($id), 0, 'mod_by')), 'comment_type_id' => db_result($followups_res, $i, 'comment_type_id'), 'comment_type' => util_unconvert_htmlspecialchars(db_result($followups_res, $i, 'comment_type')), 'field_name' => db_result($followups_res, $i, 'field_name'), 'user_can_edit' => $artifact->userCanEditFollowupComment($id) ? 1 : 0);
     }
     return $return;
 }
Ejemplo n.º 6
0
function snippet_show_snippet_details($id)
{
    global $SCRIPT_TYPE, $SCRIPT_CATEGORY, $SCRIPT_LICENSE, $SCRIPT_LANGUAGE;
    $sql = "SELECT * FROM snippet WHERE snippet_id='{$id}'";
    $result = db_query($sql);
    echo '
	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2">

	<TR><TD COLSPAN="2">
	<H2>' . db_result($result, 0, 'name') . '</H2>
	</TD></TR>

	<TR><TD><B>Type:</B><BR>
		' . $SCRIPT_TYPE[db_result($result, 0, 'type')] . '</TD>
	<TD><B>Category:</B><BR>
		' . $SCRIPT_CATEGORY[db_result($result, 0, 'category')] . '
	</TD></TR>

	<TR><TD><B>License:</B><BR>
		' . $SCRIPT_LICENSE[db_result($result, 0, 'license')] . '</TD>
	<TD><B>Language:</B><BR>
		' . $SCRIPT_LANGUAGE[db_result($result, 0, 'language')] . '
	</TD></TR>

	<TR><TD COLSPAN="2">&nbsp;<BR>
	<B>Description:</B><BR>
	' . util_make_links(nl2br(db_result($result, 0, 'description'))) . '
	</TD></TR>

	</TABLE>';
}
Ejemplo n.º 7
0
 /**
  * Show survey form - Show all forums of Survey
  */
 function ShowSurveyForm(&$s)
 {
     global $group_id;
     global $survey_id;
     if (!$s->isActive()) {
         return '<span class="error">' . _('Error - you can\'t vote for inactive survey') . '</span>';
     }
     /* Get questions of this survey */
     $questions =& $s->getQuestionInstances();
     $ret = "";
     if ($s->isUserVote(user_getid())) {
         $ret .= '<span class="error">' . _('Warning - you are about to vote a second time on this survey.') . '</span>';
     }
     $ret .= '<form action="/survey/survey_resp.php" method="post">' . '<input type="hidden" name="group_id" value="' . $group_id . '" />' . '<input type="hidden" name="survey_id" value="' . $survey_id . '" />';
     $ret .= '<h3>' . $s->getTitle() . '</h3>';
     $ret .= '<table border="0">';
     /* Keep question numbers */
     $index = 1;
     $last_question_type = "";
     for ($i = 0; $i < count($questions); $i++) {
         if ($questions[$i]->isError()) {
             echo $questions[$i]->getErrorMessage();
             continue;
         }
         $question_type = $questions[$i]->getQuestionType();
         $question_id = $questions[$i]->getID();
         $question_title = stripslashes($questions[$i]->getQuestion());
         if ($question_type == '4') {
             /* Don't show question number if it's just a comment */
             $ret .= '<tr><td valign="top">&nbsp;</td><td>';
         } else {
             $ret .= '<tr><td valign="top"><strong>';
             /* If it's a 1-5 question box and first in series, move Quest number down a bit	*/
             if ($question_type != $last_question_type && ($question_type == '1' || $question_type == '3')) {
                 $ret .= '&nbsp;<br />';
             }
             $ret .= $index++ . '&nbsp;&nbsp;&nbsp;&nbsp;<br /></td><td>';
         }
         switch ($question_type) {
             case 1:
                 /* This is a radio-button question. Values 1-5.
                 	  Show the 1-5 markers only if this is the first in a series */
                 if ($question_type != $last_question_type) {
                     $ret .= '	<strong>1</strong>' . _('Low') . '  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>5</strong>' . _('High') . '<br />';
                 }
                 for ($j = 1; $j <= 5; $j++) {
                     $ret .= '<input type="radio" name="_' . $question_id . '" value="' . $j . '" />';
                 }
                 $ret .= '&nbsp; ' . $question_title;
                 break;
             case 2:
                 /* This is a text-area question. */
                 $ret .= $question_title . '<br />';
                 $ret .= '<textarea name="_' . $question_id . '" rows="5" cols="60" wrap="soft"></textarea>';
                 break;
             case 3:
                 /* This is a Yes/No question. 
                    Show the Yes/No only if this is the first in a series */
                 if ($question_type != $last_question_type) {
                     $ret .= '<strong>Yes / No</strong><br />';
                 }
                 $ret .= '<input type="radio" name="_' . $question_id . '" value="1" />';
                 $ret .= '<input type="radio" name="_' . $question_id . '" value="5" />';
                 $ret .= '&nbsp; ' . $question_title;
                 break;
             case 4:
                 /* This is a comment only. */
                 $ret .= '&nbsp;<br /><strong>' . util_make_links($question_title) . '</strong>';
                 $ret .= '<input type="hidden" name="_' . $question_id . '" value="-666" />';
                 break;
             case 5:
                 /* This is a text-field question. */
                 $ret .= $question_title . '<br />';
                 $ret .= '<input type="text" name="_' . $question_id . '" size="20" maxlength="70" />';
                 break;
             default:
                 $ret .= $question_title . '<br />';
         }
         $ret .= '</td></tr>';
         $last_question_type = $question_type;
     }
     $ret .= '<tr><td style="text-align:center" colspan="2">' . '<input type="submit" name="submit" value="' . _('Submit') . '" />' . '<br />' . util_make_link('/survey/privacy.php', _('Survey Privacy')) . '</td></tr></form></table>';
     return $ret;
 }
Ejemplo n.º 8
0
 /**
  * displayRSS
  * 
  * Display the follow-ups of this artifact as a rss feed
  *
  */
 function displayRSS()
 {
     $uh = UserHelper::instance();
     $hp = Codendi_HTMLPurifier::instance();
     $group = $this->ArtifactType->getGroup();
     $rss = new RSS(array('title' => $group->getPublicName() . ' ' . $this->ArtifactType->getName() . ' #' . $this->getId() . ' - ' . $this->getValue('summary') . ' - ' . $GLOBALS['Language']->getText('tracker_include_artifact', 'follow_ups'), 'description' => '', 'link' => '<![CDATA[' . get_server_url() . '/tracker/?atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . ']]>', 'language' => 'en-us', 'copyright' => $GLOBALS['Language']->getText('rss', 'copyright', array($GLOBALS['sys_long_org_name'], $GLOBALS['sys_name'], date('Y', time()))), 'pubDate' => gmdate('D, d M Y h:i:s', $this->getLastUpdateDate()) . ' GMT'));
     $result = $this->getFollowups();
     for ($i = 0; $i < db_numrows($result); $i++) {
         $comment_type = db_result($result, $i, 'comment_type');
         $comment_type_id = db_result($result, $i, 'comment_type_id');
         $comment_id = db_result($result, $i, 'artifact_history_id');
         $field_name = db_result($result, $i, 'field_name');
         $orig_subm = $this->getOriginalCommentSubmitter($comment_id);
         $orig_date = $this->getOriginalCommentDate($comment_id);
         if ($comment_type_id == 100 || $comment_type == "") {
             $comment_type = '';
         } else {
             $comment_type = '<strong>[' . $comment_type . ']</strong><br />';
         }
         $rss->addItem(array('title' => '<![CDATA[' . $GLOBALS['Language']->getText('tracker_include_artifact', 'add_flup_comment') . ' #' . $comment_id . ']]>', 'description' => '<![CDATA[' . $comment_type . util_make_links(nl2br(db_result($result, $i, 'new_value')), $group->getGroupId(), $this->ArtifactType->getID()) . ']]>', 'pubDate' => gmdate('D, d M Y h:i:s', db_result($orig_date, 0, 'date')) . ' GMT', 'dc:creator' => $hp->purify($uh->getDisplayNameFromUserId(db_result($orig_subm, 0, 'mod_by'))), 'link' => '<![CDATA[' . get_server_url() . '/tracker/?func=detail&aid=' . $this->getId() . '&atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . '#comment_' . $comment_id . ']]>', 'guid' => '<![CDATA[' . get_server_url() . '/tracker/?func=detail&aid=' . $this->getId() . '&atid=' . $this->ArtifactType->getID() . '&group_id=' . $group->getGroupId() . '#comment_' . $comment_id . ']]>'));
     }
     $rss->display();
     exit;
 }
Ejemplo n.º 9
0
function svn_utils_show_revision_detail($result, $group_id, $group_name, $commit_id)
{
    global $Language;
    /*
      Accepts a result set from the svn_checkins table. Should include all columns from
      the table, and it should be joined to USER to get the user_name.
    */
    $rows = db_numrows($result);
    $url = "/svn/?func=detailrevision&commit_id={$commit_id}&group_id={$group_id}&order=";
    $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>';
    $revision = db_result($result, 0, 'revision');
    $hdr = '[' . $Language->getText('svn_browse_revision', 'rev') . ' #' . $revision . '] - ';
    echo '<h2>' . $hdr . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'date')) . '</h2></h2>';
    echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>';
    $crossref_fact = new CrossReferenceFactory($revision, ReferenceManager::REFERENCE_NATURE_SVNREVISION, $group_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>';
        $crossref_fact->DisplayCrossRefs();
    }
    echo '<h3> ' . $Language->getText('svn_utils', 'impacted_files') . '</h3>';
    $title_arr = array();
    $title_arr[] = $Language->getText('svn_utils', 'file');
    $title_arr[] = $Language->getText('svn_browse_revision', 'rev');
    $title_arr[] = $Language->getText('svn_utils', 'type');
    //$title_arr[]='AddedLines'; To be implemented
    //$title_arr[]='RemovedLines'; To be implemented
    $links_arr = array();
    $links_arr[] = $url . 'filename';
    $links_arr[] = $url . '';
    $links_arr[] = $url . 'type';
    $pm = ProjectManager::instance();
    $project = $pm->getProject($group_id);
    $root = $project->getUnixName();
    echo html_build_list_table_top($title_arr, $links_arr);
    for ($i = 0; $i < $rows; $i++) {
        $type = db_result($result, $i, 'type');
        $dirname = db_result($result, $i, 'dir');
        $filename = db_result($result, $i, 'file');
        $fullpath = $dirname . $filename;
        if ($filename) {
            // It' a file
            $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}&view=log");
            $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&revision={$revision}&pathrev={$revision}&view=markup");
        } else {
            // It' a directory
            $viewfile_url = svn_utils_make_viewlink($group_name, $fullpath, $fullpath, "&pathrev={$revision}");
            $viewrev_url = svn_utils_make_viewlink($group_name, $fullpath, $revision, "&pathrev={$revision}&view=log");
        }
        if ($type == 'Change') {
            $viewtype_url = svn_utils_make_viewlink($group_name, $fullpath, $Language->getText('svn_utils', 'change'), "&r1=" . ($revision - 1) . "&r2={$revision}&diff_format=h&pathrev={$revision}");
        } else {
            if ($type == 'Add') {
                $viewtype_url = $Language->getText('svn_utils', 'add');
            } else {
                if ($type == 'Delete') {
                    $viewtype_url = $Language->getText('svn_utils', 'del');
                }
            }
        }
        echo '
	       <TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $viewfile_url . '</b></TD>' . '<TD class="small" width="10%" align="center">' . $viewrev_url . '</TD>' . '<TD class="small" width="10%" align="center">' . $viewtype_url . '</TD>';
        //'<TD class="small">'.$added.'</TD>'. // To be done
        //'<TD class="small">'.$removed.'</TD></TR>'; // To be done
    }
    echo '</TD></TR></TABLE>';
}
Ejemplo n.º 10
0
} else {
    $title_arr = array();
    $title_arr[] = _('Snippet ID');
    $title_arr[] = _('Title');
    $title_arr[] = _('Creator');
    echo $GLOBALS['HTML']->listTableTop($title_arr);
    //	List packages if there are any
    if ($rows2 > 0) {
        echo '
			<tr class="tableheading"><td colspan="3">' . _('Packages Of Snippets') . '<td>';
    }
    for ($i = 0; $i < $rows2; $i++) {
        echo '
			<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td rowspan="2">' . util_make_link('/snippet/detail.php?type=package&amp;id=' . db_result($result2, $i, 'snippet_package_id'), '<strong>' . db_result($result2, $i, 'snippet_package_id') . '</strong>') . '</td><td><strong>' . db_result($result2, $i, 'name') . '</td><td>' . util_make_link_u(db_result($result2, $i, 'user_name'), db_result($result2, $i, 'user_id'), db_result($result2, $i, 'realname')) . '</td></tr>';
        echo '
			<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td colspan="2">' . util_make_links(nl2br(db_result($result2, $i, 'description'))) . '</td></tr>';
    }
    //	List snippets if there are any
    if ($rows > 0) {
        echo '
			<tr class="tableheading"><td colspan="3">' . _('Snippets') . '</td>';
    }
    for ($i = 0; $i < $rows; $i++) {
        echo '
			<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td rowspan="2">' . util_make_link('/snippet/detail.php?type=snippet&amp;id=' . db_result($result, $i, 'snippet_id'), '<strong>' . db_result($result, $i, 'snippet_id') . '</strong>') . '</td><td><strong>' . util_make_link('/snippet/detail.php?type=snippet&amp;id=' . db_result($result, $i, 'snippet_id'), db_result($result, $i, 'name')) . '</strong></td><td>' . util_make_link_u(db_result($result, $i, 'user_name'), db_result($result, $i, 'user_id'), db_result($result, $i, 'realname')) . '</td></tr>';
        echo '
			<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td colspan="2">' . util_make_links(nl2br(db_result($result, $i, 'description'))) . '</td></tr>';
    }
    echo $GLOBALS['HTML']->listTableBottom();
}
snippet_footer(array());
Ejemplo n.º 11
0
function forum_show_a_nested_message($result)
{
    /*
    	
    		accepts a database result handle to display a single message
    		in the format appropriate for the nested messages
    	second param is which row in that result set to use
    */
    global $sys_datefmt;
    /*
    	See if this message is new or not
    	If so, highlite it in bold
    */
    if (get_forum_saved_date($result['group_forum_id']) < $result['date']) {
        $bold_begin = '<B>';
        $bold_end = '</B>';
    }
    $ret_val = '
		<TABLE BORDER="0">
			<TR>
				<TD BGCOLOR="#DDDDDD" NOWRAP>By: <A HREF="/users/' . $result['user_name'] . '/">' . $result['user_name'] . '</A>' . ' ( ' . $result['realname'] . ' ) ' . '<BR><A HREF="/forum/message.php?msg_id=' . $result['msg_id'] . '">' . html_image("images/msg.gif", "10", "12", array("BORDER" => "0")) . $bold_begin . " " . $result['subject'] . ' [ reply ]' . $bold_end . '</A> &nbsp; ' . '<BR>' . date($sys_datefmt, $result['date']) . '
				</TD>   
			</TR>
			<TR>
				<TD>
					' . nl2br(util_make_links($result['body'])) . '
				</TD>
			</TR>
		</TABLE>';
    return $ret_val;
}
Ejemplo n.º 12
0
    if (!$result || db_numrows($result) < 1) {
        /*
        	Message not found
        */
        return 'message not found.\\n';
    }
    $title_arr = array();
    $title_arr[] = 'Message: ' . $msg_id;
    echo html_build_list_table_top($title_arr);
    echo "<TR><TD BGCOLOR=\"E3E3E3\">\n";
    echo "BY: " . db_result($result, 0, "user_name") . "<BR>";
    echo "DATE: " . date($sys_datefmt, db_result($result, 0, "date")) . "<BR>";
    echo "SUBJECT: " . db_result($result, 0, "subject") . "<P>";
    // correct making links with anchor tag - helix 2003-11-19
    //	echo util_make_links(nl2br(db_result($result,0, 'body')));
    echo nl2br(util_make_links(db_result($result, 0, 'body')));
    echo "</TD></TR></TABLE>";
    /*
    	Show entire thread
    */
    echo '<BR>&nbsp;<P><H3>Thread View</H3>';
    //highlight the current message in the thread list
    $current_message = $msg_id;
    echo show_thread(db_result($result, 0, 'thread_id'));
    /*
    	Show post followup form
    */
    echo '<P>&nbsp;<P>';
    echo '<CENTER><h3>Post a followup to this message</h3></CENTER>';
    show_post_form(db_result($result, 0, 'group_forum_id'), db_result($result, 0, 'thread_id'), $msg_id, db_result($result, 0, 'subject'));
} else {
 /**
  * Perform HTML purification depending of level purification required and create links. 
  */
 function purify($html, $level = 0, $groupId = 0)
 {
     $clean = '';
     switch ($level) {
         case CODENDI_PURIFIER_FORUMML:
             require_once $GLOBALS['htmlpurifier_dir'] . '/HTMLPurifier.auto.php';
             $hp = HTMLPurifier::getInstance();
             $config = $this->getHPConfig($level);
             $clean = util_make_links($hp->purify($html, $config), $groupId);
             break;
         default:
             $clean = parent::purify($html, $level, $groupId);
     }
     return $clean;
 }
Ejemplo n.º 14
0
function forum_header($params)
{
    global $HTML, $group_id, $forum_name, $forum_id, $sys_news_group, $f, $sys_use_forum, $group_forum_id;
    if ($group_forum_id) {
        $forum_id = $group_forum_id;
    }
    if (!$sys_use_forum) {
        exit_disabled();
    }
    $params['group'] = $group_id;
    $params['toptab'] = 'forums';
    /*
    bastardization for news
    Show icon bar unless it's a news forum
    */
    if ($group_id == $sys_news_group) {
        //this is a news item, not a regular forum
        if ($forum_id) {
            // Show this news item at the top of the page
            $sql = "SELECT submitted_by, post_date, group_id, forum_id, summary, details FROM news_bytes WHERE forum_id='{$forum_id}'";
            $result = db_query($sql);
            // checks which group the news item belongs to
            $params['group'] = db_result($result, 0, 'group_id');
            $params['toptab'] = 'news';
            $HTML->header($params);
            echo '<table><tr><td valign="top">';
            if (!$result || db_numrows($result) < 1) {
                echo '<h3>' . _('Error - this news item was not found') . '</h3>';
            } else {
                $user = user_get_object(db_result($result, 0, 'submitted_by'));
                $group =& group_get_object($params['group']);
                if (!$group || !is_object($group) || $group->isError()) {
                    exit_no_group();
                }
                echo '
				<strong>' . _('Posted by') . ':</strong> ' . $user->getRealName() . '<br />
				<strong>' . _('Date') . ':</strong> ' . date(_('Y-m-d H:i'), db_result($result, 0, 'post_date')) . '<br />
				<strong>' . _('Summary') . ':</strong>' . util_make_link('/forum/forum.php?forum_id=' . db_result($result, 0, 'forum_id') . '&group_id=' . $group_id, db_result($result, 0, 'summary')) . '<br/>
				<strong>' . _('Project') . ':</strong>' . util_make_link_g($group->getUnixName(), db_result($result, 0, 'group_id'), $group->getPublicName()) . '<br />
				<p>
				' . util_make_links(nl2br(db_result($result, 0, 'details')));
                echo '</p>';
            }
            echo '</td><td valign="top" width="35%">';
            echo $HTML->boxTop(_('Latest News'));
            echo news_show_latest($params['group'], 5, false);
            echo $HTML->boxBottom();
            echo '</td></tr></table>';
        } else {
            site_project_header($params);
        }
    } else {
        site_project_header($params);
    }
    $menu_text = array();
    $menu_links = array();
    if ($f) {
        if ($f->userIsAdmin()) {
            $menu_text[] = _('Admin');
            $menu_links[] = '/forum/admin/?group_id=' . $group_id;
        }
        if ($forum_id) {
            $menu_text[] = _('Discussion Forums:') . ' ' . $f->getName();
            $menu_links[] = '/forum/forum.php?forum_id=' . $forum_id;
        }
    } else {
        $gg =& group_get_object($group_id);
        $perm =& $gg->getPermission(session_get_user());
        if ($perm->isForumAdmin()) {
            $menu_text[] = _('Admin');
            $menu_links[] = '/forum/admin/?group_id=' . $group_id;
        }
    }
    if (count($menu_text) > 0) {
        echo $HTML->subMenu($menu_text, $menu_links);
    }
    if (session_loggedin()) {
        if ($f) {
            if ($f->isMonitoring()) {
                echo util_make_link('/forum/monitor.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id . '&amp;stop=1', html_image('ic/xmail16w.png', '20', '20', array()) . ' ' . _('Stop Monitoring')) . ' | ';
            } else {
                echo util_make_link('/forum/monitor.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id . '&amp;start=1', html_image('ic/mail16w.png', '20', '20', array()) . ' ' . _('Monitor Forum')) . ' | ';
            }
            echo util_make_link('/forum/save.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id, html_image('ic/save.png', '24', '24', array()) . ' ' . _('Save Place')) . ' | ';
        }
    }
    if ($f && $forum_id) {
        echo util_make_link('/forum/new.php?forum_id=' . $forum_id . '&amp;group_id=' . $group_id, html_image('ic/write16w.png', '20', '20', array('alt' => _('Start New Thread'))) . ' ' . _('Start New Thread'));
    }
}
Ejemplo n.º 15
0
/**
 * show_survey() - Select and show a specific survey from the database
 *
 * @param		int		The group ID
 * @param		int		The survey ID
 */
function show_survey($group_id, $survey_id)
{
    /*
    	Select this survey from the database
    */
    $sql = "SELECT * FROM surveys WHERE survey_id='{$survey_id}' and group_id = '{$group_id}'";
    $result = db_query($sql);
    if (db_numrows($result) > 0) {
        echo '
		<h3>' . db_result($result, 0, 'survey_title') . '</h3>
		<form action="/survey/survey_resp.php" method="post">
		<input type="hidden" name="group_id" value="' . $group_id . '" />
		<input type="hidden" name="survey_id" value="' . $survey_id . '" />';
        /*
        	Select the questions for this survey
        */
        $questions = db_result($result, 0, 'survey_questions');
        $quest_array = explode(',', $questions);
        $count = count($quest_array);
        echo '
		<table border="0">';
        $q_num = 1;
        for ($i = 0; $i < $count; $i++) {
            /*
            	Build the questions on the HTML form
            */
            $sql = "SELECT * FROM survey_questions WHERE question_id='" . $quest_array[$i] . "'";
            $result = db_query($sql);
            $question_type = db_result($result, 0, 'question_type');
            if ($question_type == '4') {
                /*
                	Don't show question number if it's just a comment
                */
                echo '
				<tr><td valign="top">&nbsp;</td><td>';
            } else {
                echo '
				<tr><td valign="top"><strong>';
                /*
                	If it's a 1-5 question box and first in series, move Quest
                	number down a bit
                */
                if ($question_type != $last_question_type && ($question_type == '1' || $question_type == '3')) {
                    echo '&nbsp;<br />';
                }
                echo $q_num . '&nbsp;&nbsp;&nbsp;&nbsp;<br /></td><td>';
                $q_num++;
            }
            if ($question_type == "1") {
                /*
                	This is a radio-button question. Values 1-5.
                */
                // Show the 1-5 markers only if this is the first in a series
                if ($question_type != $last_question_type) {
                    echo '
					<strong>1</strong>' . _('Low') . '  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>5</strong>' . _('High');
                    echo '<br />';
                }
                for ($j = 1; $j <= 5; $j++) {
                    echo '
					<input type="radio" name="_' . $quest_array[$i] . '" value="' . $j . '" />';
                }
                echo '&nbsp; ' . stripslashes(db_result($result, 0, 'question'));
            } else {
                if ($question_type == '2') {
                    /*
                    	This is a text-area question.
                    */
                    echo stripslashes(db_result($result, 0, 'question')) . '<br />';
                    echo '
				<textarea name="_' . $quest_array[$i] . '" rows="5" cols="60" wrap="soft"></textarea>';
                } else {
                    if ($question_type == '3') {
                        /*
                        	This is a Yes/No question.
                        */
                        //Show the Yes/No only if this is the first in a series
                        if ($question_type != $last_question_type) {
                            echo '<strong>Yes / No</strong><br />';
                        }
                        echo '
				<input type="radio" name="_' . $quest_array[$i] . '" value="1" />';
                        echo '
				<input type="radio" name="_' . $quest_array[$i] . '" value="5" />';
                        echo '&nbsp; ' . stripslashes(db_result($result, 0, 'question'));
                    } else {
                        if ($question_type == '4') {
                            /*
                            	This is a comment only.
                            */
                            echo '&nbsp;<br /><strong>' . util_make_links(stripslashes(db_result($result, 0, 'question'))) . '</strong>';
                            echo '
				<input type="hidden" name="_' . $quest_array[$i] . '" value="-666" />';
                        } else {
                            if ($question_type == '5') {
                                /*
                                	This is a text-field question.
                                */
                                echo stripslashes(db_result($result, 0, 'question')) . '<br />';
                                echo '
				<input type="text" name="_' . $quest_array[$i] . '" size="20" maxlength="70" />';
                            } else {
                                // no answers, just show question
                                echo stripslashes(db_result($result, 0, 'question')) . '<br />';
                            }
                        }
                    }
                }
            }
            echo '</td></tr>';
            $last_question_type = $question_type;
        }
        ?>
	<tr><td style="text-align:center" colspan="2">

	<input type="submit" name="submit" value="<?php 
        echo _('Submit');
        ?>
" />
	<br />
	<?php 
        util_make_link('/survey/privacy.php', _('Survey Privacy'));
        ?>
	</td></tr>
	</form>
	</table>
	<?php 
    } else {
        echo "<strong>" . _('Survey not found.') . "</strong>";
    }
}
Ejemplo n.º 16
0
 * input parameters:
 *    group_id : project where references are defined
 *    text     : HTML input text
 * output: HTML text with embedded references (links to goto script)
*/
require_once 'pre.php';
require_once 'common/include/HTTPRequest.class.php';
require_once 'common/reference/ReferenceManager.class.php';
header('Content-type: text/html');
$reference_manager =& ReferenceManager::instance();
$request =& HTTPRequest::instance();
if (!$request->getValidated('group_id', 'GroupId')) {
    if (!$request->get('group_name')) {
        $group_id = 100;
    } else {
        $group_id = group_getid_by_name($request->get('group_name'));
    }
} else {
    $group_id = $request->get('group_id');
}
if (!$request->getValidated('text', 'text')) {
    # Empty string? return empty string...
    exit;
}
if ($request->get('help')) {
    echo $GLOBALS['Language']->getText('project_reference', 'insert_syntax');
    exit;
}
$text = $request->get('text');
echo nl2br(util_make_links(htmlentities($text, ENT_QUOTES, 'UTF-8'), $group_id) . "\n");
exit;
Ejemplo n.º 17
0
function snippet_show_snippet_details($id)
{
    global $Language;
    $sql = "SELECT * FROM snippet WHERE snippet_id='{$id}'";
    $result = db_query($sql);
    echo '
	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2">

	<TR><TD COLSPAN="2">
	<H2>' . db_result($result, 0, 'name') . '</H2>
	</TD></TR>

	<TR><TD><B>' . $Language->getText('snippet_utils', 'type') . '</B><BR>
		' . snippet_data_get_type_from_id(db_result($result, 0, 'type')) . '</TD>
	<TD><B>' . $Language->getText('snippet_package', 'category') . '</B><BR>
		' . snippet_data_get_category_from_id(db_result($result, 0, 'category')) . '
	</TD></TR>

	<TR><TD><B>' . $Language->getText('snippet_utils', 'license') . '</B><BR>
		' . snippet_data_get_license_from_id(db_result($result, 0, 'license')) . '</TD>
	<TD><B>' . $Language->getText('snippet_package', 'language') . '</B><BR>
		' . snippet_data_get_language_from_id(db_result($result, 0, 'language')) . '
	</TD></TR>

	<TR><TD COLSPAN="2">&nbsp;<BR>
	<B>' . $Language->getText('snippet_package', 'description') . '</B><BR>
	' . util_make_links(nl2br(db_result($result, 0, 'description'))) . '
	</TD></TR>

	</TABLE>';
}
Ejemplo n.º 18
0
function make_links($data = "")
{
    //moved make links to /include/utils.php
    util_make_links($data);
}
Ejemplo n.º 19
0
function show_commit_details($result)
{
    global $group_id, $commit_id, $Language;
    /*
    	Accepts a result set from the commits table. Should include all columns from
    	the table, and it should be joined to USER to get the user_name.
    */
    $rows = db_numrows($result);
    $url = "/cvs/?func=detailcommit&commit_id={$commit_id}&group_id={$group_id}&order=";
    $list_log = '<pre>' . util_make_links(util_line_wrap(db_result($result, 0, 'description')), $group_id) . '</pre>';
    if ($commit_id) {
        $hdr = '[' . $Language->getText('cvs_commit_utils', 'commit') . $commit_id . '] - ';
    } else {
        $hdr = $Language->getText('cvs_commit_utils', 'checkin') . ' ';
    }
    echo '<h2>' . $hdr . uniformat_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, 'c_when')) . '</h2></h2>';
    echo '<table WIDTH="100%" BORDER="0" CELLSPACING="1" CELLPADDING="2"><tr class="' . util_get_alt_row_color(0) . '"><td>' . $list_log . '</td></tr></table>';
    $crossref_fact = new CrossReferenceFactory($commit_id, ReferenceManager::REFERENCE_NATURE_CVSCOMMIT, $group_id);
    $crossref_fact->fetchDatas();
    if ($crossref_fact->getNbReferences() > 0) {
        echo '<h3> ' . $Language->getText('cross_ref_fact_include', 'references') . '</h3>';
        $crossref_fact->DisplayCrossRefs();
    }
    echo '<h3>' . $Language->getText('cvs_commit_utils', 'impacted_file') . '</h3>';
    $title_arr = array();
    $title_arr[] = $Language->getText('cvs_commit_utils', 'file');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'rev');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'branch');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'type');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'added_line');
    $title_arr[] = $Language->getText('cvs_commit_utils', 'removed_line');
    $links_arr = array();
    $links_arr[] = $url . 'filename';
    $links_arr[] = $url . 'revision';
    $links_arr[] = $url . 'branch';
    $links_arr[] = $url . 'type';
    $links_arr[] = $url . 'addedlines';
    $links_arr[] = $url . 'removedlines';
    echo html_build_list_table_top($title_arr, $links_arr);
    for ($i = 0; $i < $rows; $i++) {
        $commit_id = db_result($result, $i, 'id');
        $type = db_result($result, $i, 'type');
        $added = db_result($result, $i, 'addedlines');
        $removed = db_result($result, $i, 'removedlines');
        $revision = db_result($result, $i, 'revision');
        $filename = db_result($result, $i, 'dir') . '/' . db_result($result, $i, 'file');
        $type_text = $Language->getText('cvs_commit_utils', strtolower($type));
        if ($type == "Change" && $added == 999 && $removed == 999) {
            // the default values
            // back to rcs to complete
            $repo = db_result($result, $i, 'repository');
            $command = "rlog -r" . $revision . " " . $repo . "/" . $filename;
            $output = array();
            exec($command, $output, $ret);
            $added = 0;
            $removed = 0;
            $l = 0;
            while ($l < count($output)) {
                // parse the rlog result till getting "state: Exp;  lines:"
                $line = $output[$l];
                $l++;
                if (ereg('state: +Exp; +lines: +\\+([0-9]*) +\\-([0-9]*)$', $line, $na)) {
                    $added = $na[1];
                    $removed = $na[2];
                    $sql_up = "UPDATE cvs_checkins SET addedlines=" . $added . ", removedlines=" . $removed . " WHERE repositoryid=" . db_result($result, $i, 'repositoryid') . " AND dirid=" . db_result($result, $i, 'dirid') . " AND fileid=" . db_result($result, $i, 'fileid') . " AND revision=" . $revision;
                    $res = db_query($sql_up);
                    break;
                }
            }
        }
        if (!$filename) {
            $filename = '';
        } else {
            if ($type == 'Remove') {
                $filename = makeCvsDirLink($group_id, db_result($result, $i, 'file'), $filename, db_result($result, $i, 'dir'));
                $rev_text = '';
            } else {
                // Clean file path to remove duplicate separators
                $filename = preg_replace('/\\/\\//', '/', $filename);
                $filename = preg_replace('/\\.\\//', '', $filename);
                if ($type == 'Change') {
                    // horrible hack to 'guess previous revision' to diff with
                    $prev = explode(".", $revision);
                    $lastIndex = sizeof($prev);
                    $lastIndex = $lastIndex - 1;
                    if ($prev[$lastIndex] != '1') {
                        $prev[$lastIndex] = $prev[$lastIndex] - 1;
                        $previous = join(".", $prev);
                    } else {
                        $index = 0;
                        $new_prev = array();
                        while ($index <= $lastIndex - 2) {
                            $new_prev[$index] = $prev[$index];
                            $index++;
                        }
                        $previous = join('.', $new_prev);
                    }
                    $type = makeCvsLink($group_id, $filename, $type_text, '', '&r1=' . $previous . '&r2=' . $revision);
                }
                $rev_text = makeCvsLink($group_id, $filename, $revision, $revision, '&view=markup');
                $filename = makeCvsLink($group_id, $filename, $filename, '', '&view=log');
            }
        }
        ##$commits_url = '<A HREF="/commits/download.php/Commits'.$commit_id.'.txt?commit_id='.$id.'">'.$filename.'</a>';
        echo '
			<TR class="' . util_get_alt_row_color($i) . '">' . '<TD class="small"><b>' . $filename . '</b></TD>' . '<TD class="small">' . $rev_text . '</TD>' . '<TD class="small">' . db_result($result, $i, 'branch') . '</TD>' . '<TD class="small">' . $type . '</TD>' . '<TD class="small">' . $added . '</TD>' . '<TD class="small">' . $removed . '</TD></TR>';
    }
    /*
    	Show extra rows for <-- Prev / Next -->
    */
    echo '
		<TR><TD COLSPAN="2" class="small">';
    if ($offset > 0) {
        echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset - 50) . '"><B>&lt; ' . $Language->getText('global', 'prev') . '</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD><TD>&nbsp;</TD><TD COLSPAN="2" class="small">';
    if ($rows == 50) {
        echo '<A HREF="?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset + 50) . '"><B>' . $Language->getText('global', 'prev') . ' 50 &gt;</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD></TR></TABLE>';
}
Ejemplo n.º 20
0
function show_survey($group_id, $survey_id)
{
    ?>
<FORM ACTION="/survey/survey_resp.php" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="<?php 
    echo $group_id;
    ?>
">
<INPUT TYPE="HIDDEN" NAME="survey_id" VALUE="<?php 
    echo $survey_id;
    ?>
">
<?php 
    /*
    	Select this survey from the database
    */
    $sql = "SELECT * FROM surveys WHERE survey_id='{$survey_id}'";
    $result = db_query($sql);
    if (db_numrows($result) > 0) {
        echo '
		<H3>' . db_result($result, 0, 'survey_title') . '</H3>';
        /*
        	Select the questions for this survey
        */
        $questions = db_result($result, 0, 'survey_questions');
        $quest_array = explode(',', $questions);
        $count = count($quest_array);
        echo '
		<TABLE BORDER=0>';
        $q_num = 1;
        for ($i = 0; $i < $count; $i++) {
            /*
            	Build the questions on the HTML form
            */
            $sql = "SELECT * FROM survey_questions WHERE question_id='" . $quest_array[$i] . "'";
            $result = db_query($sql);
            $question_type = db_result($result, 0, 'question_type');
            if ($question_type == '4') {
                /*
                	Don't show question number if it's just a comment
                */
                echo '
				<TR><TD valign="top">&nbsp;</TD><TD>';
            } else {
                echo '
				<TR><TD valign="top"><B>';
                /*
                	If it's a 1-5 question box and first in series, move Quest
                	number down a bit
                */
                if ($question_type != $last_question_type && ($question_type == '1' || $question_type == '3')) {
                    echo '&nbsp;<BR>';
                }
                echo $q_num . '&nbsp;&nbsp;&nbsp;&nbsp;<BR></TD><TD valign="top">';
                $q_num++;
            }
            if ($question_type == "1") {
                /*
                	This is a radio-button question. Values 1-5.
                */
                // Show the 1-5 markers only if this is the first in a series
                if ($question_type != $last_question_type) {
                    echo '
					<B>&nbsp; 1 &nbsp;&nbsp; 2 &nbsp;&nbsp; 3 &nbsp;&nbsp; 4 &nbsp;&nbsp; 5</B>';
                    echo '<BR>';
                }
                for ($j = 1; $j <= 5; $j++) {
                    echo '
					<INPUT TYPE="RADIO" NAME="_' . $quest_array[$i] . '" VALUE="' . $j . '">';
                }
                echo '&nbsp; ' . stripslashes(db_result($result, 0, 'question'));
            } else {
                if ($question_type == '2') {
                    /*
                    	This is a text-area question.
                    */
                    echo stripslashes(db_result($result, 0, 'question')) . '<BR>';
                    echo '
				<textarea name="_' . $quest_array[$i] . '" rows=5 cols=60 wrap="soft"></textarea>';
                } else {
                    if ($question_type == '3') {
                        /*
                        	This is a Yes/No question.
                        */
                        //Show the Yes/No only if this is the first in a series
                        if ($question_type != $last_question_type) {
                            echo '<B>Yes / No</B><BR>';
                        }
                        echo '
				<INPUT TYPE="RADIO" NAME="_' . $quest_array[$i] . '" VALUE="1">';
                        echo '
				<INPUT TYPE="RADIO" NAME="_' . $quest_array[$i] . '" VALUE="5">';
                        echo '&nbsp; ' . stripslashes(db_result($result, 0, 'question'));
                    } else {
                        if ($question_type == '4') {
                            /*
                            	This is a comment only.
                            */
                            echo '&nbsp;<BR><B>' . util_make_links(stripslashes(db_result($result, 0, 'question'))) . '</B>';
                            echo '
				<INPUT TYPE="HIDDEN" NAME="_' . $quest_array[$i] . '" VALUE="-666">';
                        } else {
                            if ($question_type == '5') {
                                /*
                                	This is a text-field question.
                                */
                                echo stripslashes(db_result($result, 0, 'question')) . '<BR>';
                                echo '
				<INPUT TYPE="TEXT" name="_' . $quest_array[$i] . '" SIZE=20 MAXLENGTH=70>';
                            }
                        }
                    }
                }
            }
            echo '</TD></TR>';
            $last_question_type = $question_type;
        }
        ?>
	<TR><TD ALIGN="MIDDLE" COLSPAN="2">
	&nbsp;<br>
	<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="SUBMIT">
	<p>
	<A HREF="/survey/privacy.php">Survey Privacy</A>
	</TD></TR>
	</FORM>
	</TABLE>
	<?php 
    } else {
        echo "<TR><TD COLSPAN='2'>";
        echo "<H3>Survey Not Found</H3>";
        echo "</TD></TR>";
    }
}
Ejemplo n.º 21
0
 /**
  * return a field for the given user.
  *
  * @protected
  **/
 function _getFieldLabelAndValueForHTMLMail($group_id, $group_artifact_id, $field, $field_perm)
 {
     $html = false;
     $read_only = true;
     $field_name = $field->getName();
     if ($field_perm === false || isset($field_perm[$field_name]) && $field_perm[$field_name] && permission_can_read_field($field_perm[$field_name])) {
         // 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);
         $field_html->disableJavascript();
         $label = $field_html->labelDisplay(false, false, false);
         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, false, false, 0, false, 0, false, 0, false);
                     $value = util_make_links($value, $group_id, $group_artifact_id);
                 }
             }
         }
         $html = array('label' => $label, 'value' => $value);
     }
     return $html;
 }
Ejemplo n.º 22
0
function news_fetch_a_news_summary_block($data, $group_id, $limit, $show_projectname, $hide_nb_comments)
{
    global $Language;
    $uh = new UserHelper();
    $html = '';
    $arr = explode("\n", $data['details']);
    if (strlen($arr[0]) < 200 && isset($arr[1]) && isset($arr[2]) && strlen($arr[1] . $arr[2]) < 300 && strlen($arr[2]) > 5) {
        $details = util_make_links($arr[0] . '<BR>' . $arr[1] . '<BR>' . $arr[2], $group_id);
    } else {
        $details = util_make_links($arr[0], $group_id);
    }
    $proj_name = '';
    if ($show_projectname && $limit) {
        //show the project name
        $proj_name = ' &middot; <a href="/projects/' . strtolower($data['unix_group_name']) . '/">' . $data['group_name'] . '</a>';
    }
    if (!$limit) {
        $html .= '<li><span class="news_summary"><a href="/forum/forum.php?forum_id=' . $data['forum_id'] . '">' . $data['summary'] . '</a></span> ';
        $html .= '<small><span class="news_date">' . html_time_ago($data['date']) . '</span></small></li>';
    } else {
        $comments_txt = '';
        if (!$hide_nb_comments) {
            $num_comments = (int) $data['num_comments'];
            $comments_txt .= ' <a href="/forum/forum.php?forum_id=' . $data['forum_id'] . '">(' . $num_comments . ' ';
            if ($num_comments == 1) {
                $comments_txt .= $Language->getText('news_utils', 'comment');
            } else {
                $comments_txt .= $Language->getText('news_utils', 'comments');
            }
            $comments_txt .= ')</a>';
        }
        $html .= '<div class="news">';
        $html .= '<span class="news_summary"><a href="/forum/forum.php?forum_id=' . $data['forum_id'] . '"><h4>' . $data['summary'] . '</h4></a></span>';
        $html .= '<blockquote>';
        $html .= '<div>' . $details . '</div>';
        $html .= '<small>
                    <span class="news_author">' . $uh->getLinkOnUserFromUserId($data['submitted_by']) . '</span>
                    <span class="news_date">' . html_time_ago($data['date']) . '</span>' . $comments_txt . $proj_name . '</small>';
        $html .= '</blockquote>';
        $html .= '<hr width="100%" size="1" noshade>';
        $html .= '</div>';
    }
    return $html;
}
Ejemplo n.º 23
0
    echo html_build_list_table_top($title_arr);
    /*
    	List packages if there are any
    */
    if ($rows2 > 0) {
        echo '
			<TR BGCOLOR="EFEFEF"><TD COLSPAN="3"><B>Packages Of Snippets</B></TD>';
    }
    for ($i = 0; $i < $rows2; $i++) {
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD ROWSPAN="2" VALIGN="top"><A HREF="/snippet/detail.php?type=package&id=' . db_result($result2, $i, 'snippet_package_id') . '"><B>' . sprintf("%06d", db_result($result2, $i, 'snippet_package_id')) . '</B></A></TD><TD><B>' . db_result($result2, $i, 'name') . '</TD><TD>' . db_result($result2, $i, 'user_name') . '</TD></TR>';
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD COLSPAN="2">' . util_make_links(nl2br(db_result($result2, $i, 'description'))) . '</TD></TR>';
    }
    /*
    	List snippets if there are any
    */
    if ($rows > 0) {
        echo '
			<TR BGCOLOR="EFEFEF"><TD COLSPAN="3"><B>Snippets</B></TD>';
    }
    for ($i = 0; $i < $rows; $i++) {
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD ROWSPAN="2" VALIGN="top"><A HREF="/snippet/detail.php?type=snippet&id=' . db_result($result, $i, 'snippet_id') . '"><B>' . sprintf("%06d", db_result($result, $i, 'snippet_id')) . '</B></A></TD><TD><B>' . db_result($result, $i, 'name') . '</TD><TD>' . db_result($result, $i, 'user_name') . '</TD></TR>';
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '"><TD COLSPAN="2">' . util_make_links(nl2br(db_result($result, $i, 'description'))) . '</TD></TR>';
    }
    echo '
		</TABLE>';
}
snippet_footer(array());
Ejemplo n.º 24
0
 $result = db_query($sql);
 if (!$result || db_numrows($result) < 1) {
     /*
     	Message not found
     */
     return 'message not found.\\n';
 }
 $title_arr = array();
 $title_arr[] = 'Message: ' . $msg_id;
 echo html_build_list_table_top($title_arr);
 $poster = UserManager::instance()->getUserByUserName(db_result($result, 0, "user_name"));
 echo "<TR><TD class=\"threadmsg\">\n";
 echo $Language->getText('forum_message', 'by') . ": " . UserHelper::instance()->getLinkOnUser($poster) . "<BR>";
 echo $Language->getText('forum_message', 'date') . ": " . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, 0, "date")) . "<BR>";
 echo $Language->getText('forum_message', 'subject') . ": " . db_result($result, 0, "subject") . "<P>";
 echo util_make_links(nl2br(db_result($result, 0, 'body')), $group_id);
 echo "</TD></TR>";
 $crossref_fact = new CrossReferenceFactory($msg_id, ReferenceManager::REFERENCE_NATURE_FORUMMESSAGE, $group_id);
 $crossref_fact->fetchDatas();
 if ($crossref_fact->getNbReferences() > 0) {
     echo '<tr>';
     echo ' <td class="forum_reference_separator">';
     echo '  <b> ' . $Language->getText('cross_ref_fact_include', 'references') . '</b>';
     echo $crossref_fact->getHTMLDisplayCrossRefs();
     echo ' </td>';
     echo '</tr>';
 }
 echo "</TABLE>";
 if ($pv == 0) {
     /*
     	Show entire thread