コード例 #1
0
    function show_news_item($result, $i, $approved, $selectable)
    {
        global $HTML;
        echo '<tr ' . $HTML->boxGetAltRowStyle($i) . '><td width="20%">';
        if ($selectable) {
            echo '<input type="checkbox" ' . 'name="news_id[]" value="' . db_result($result, $i, 'id') . '" />';
        }
        echo date(_('Y-m-d'), db_result($result, $i, 'post_date')) . '</td>
       		<td width="45%">';
        echo '
       		<a href="' . getStringFromServer('PHP_SELF') . '?approve=1&amp;id=' . db_result($result, $i, 'id') . '">' . db_result($result, $i, 'summary') . '</a>
       		</td>

       		<td width="35%">' . util_make_link_g(db_result($result, $i, 'unix_group_name'), db_result($result, $i, 'group_id'), db_result($result, $i, 'group_name') . ' (' . db_result($result, $i, 'unix_group_name') . ')') . '</td>
       		</tr>';
    }
コード例 #2
0
ファイル: news_utils.php プロジェクト: neymanna/fusionforge
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;
}
コード例 #3
0
function show_highest_ranked_projects()
{
    $sql = "SELECT groups.group_name,groups.unix_group_name,groups.group_id," . "project_weekly_metric.ranking,project_weekly_metric.percentile " . "FROM groups,project_weekly_metric " . "WHERE groups.group_id=project_weekly_metric.group_id " . "AND groups.is_public=1 " . "AND groups.type_id=1  " . "AND groups.status != 'D'  " . "ORDER BY ranking ASC";
    $result = db_query($sql, 20);
    if (!$result || db_numrows($result) < 1) {
        return _('No Stats Available') . " " . db_error();
    } else {
        $return = '';
        while ($row = db_fetch_array($result)) {
            $return .= '<strong>(' . number_format(substr($row['percentile'], 0, 5), 1) . '%)</strong> ' . util_make_link_g($row['unix_group_name'], $row['group_id'], $row['group_name']) . '<br />';
        }
        $return .= '<div align="center">' . util_make_link('/top/mostactive.php?type=week', '[ ' . _('More') . ' ]') . '</div>';
    }
    return $return;
}
コード例 #4
0
ファイル: toplist.php プロジェクト: neymanna/fusionforge
            $column1 = _('Posts');
        } else {
            $res_top = $stats->getTopDownloads();
            $title = _('Top Downloads');
            $column1 = _('Downloads');
        }
    }
}
$HTML->header(array('title' => $title));
print '<p>' . util_make_link('/top/', '[' . _('View Other Top Categories') . ']');
$arr = array(_('Rank'), _('Project name'), "{$column1}");
echo $HTML->listTableTop($arr);
echo db_error();
$display_rank = 0;
$i = 0;
while ($row_top = db_fetch_array($res_top)) {
    $i++;
    if ($row_top["items"] == 0) {
        continue;
    }
    $display_rank++;
    print '<tr ' . $HTML->boxGetAltRowStyle($i) . '><td>&nbsp;&nbsp;' . $display_rank . '</td><td>' . util_make_link_g(strtolower($row_top['unix_group_name']), @$row_top['group_id'], stripslashes($row_top['group_name'])) . '</td><td align="right">' . $row_top['items'] . '&nbsp;&nbsp;&nbsp;</td>' . '<td align="right">';
    print '&nbsp;&nbsp;&nbsp;</td></tr>
';
}
echo $HTML->listTableBottom();
$HTML->footer(array());
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
コード例 #5
0
ファイル: mostactive.php プロジェクト: neymanna/fusionforge
<br /><em>(' . _('Updated Daily') . ')</em>

<p>' . util_make_link('/top/', '[' . _('View Other Top Categories') . ']');
$arr = array(_('Rank'), _('Project name'), _('Percentile'));
echo $HTML->listTableTop($arr);
$stats = new Stats();
$res_top = $stats->getMostActiveStats($type, $offset);
$rows = db_numrows($res_top);
$i = 0;
while ($row_top = db_fetch_array($res_top)) {
    $i++;
    print '
	<tr ' . $HTML->boxGetAltRowStyle($i) . '>
		<td>&nbsp;&nbsp;' . $i . '
		</td>
		<td>' . util_make_link_g(strtolower($row_top['unix_group_name']), $row_top['group_id'], $row_top['group_name']) . '
		</td>
		<td align="right">' . substr($row_top['percentile'], 0, 5) . '%</td>
	</tr>';
}
if ($i < $rows) {
    if ($offset > 0) {
        print '
	<tr class="tablegetmore">
		<td>' . util_make_link('/top/mostactive.php?type=' . $type . '&offset=' . ($offset - $LIMIT), '<strong><-- ' . _('More') . '</strong>');
    } else {
        print '&nbsp;';
    }
    print '
		</td>
		<td>&nbsp;</td>
コード例 #6
0
ファイル: vhost.php プロジェクト: neymanna/fusionforge
        $row_vh = db_fetch_array($res_vh);
        print '<p><strong>' . _('Update Record:') . '</strong></p><hr />';
        $title = array();
        $title[] = _('VHOST ID');
        $title[] = _('VHOST Name');
        $title[] = _('Group');
        $title[] = _('Htdocs Dir');
        $title[] = _('CGI Dir');
        $title[] = _('Operations');
        print '
			<form name="update" method="post" action="' . getStringFromServer('PHP_SELF') . '">

			' . $GLOBALS['HTML']->listTableTop($title) . '
			<tr><td>' . $row_vh['vhostid'] . '</td>
			<td>' . $row_vh['vhost_name'] . '</td>
			<td>' . util_make_link_g($row_vh['unix_group_name'], $row_vh['group_id'], $row_vh['unix_group_name']) . '</td>
			<td><input maxlength="255" type="text" name="docdir" value="' . $row_vh['docdir'] . '" /></td>
			<td><input type="text" name="cgidir" value="' . $row_vh['cgidir'] . '" /></td><td><input maxlength="255" type="submit" value="' . _('Update') . '" /></tr>
			' . $GLOBALS['HTML']->listTableBottom() . '

			<input type="hidden" name="tweakcommit" value="1" />
			<input type="hidden" name="vhostid" value="' . $row_vh['vhostid'] . '" />
			</form>
		';
    } else {
        echo _('No such VHOST:') . $vhost_name;
    }
}
site_admin_footer(array());
// Local Variables:
// mode: php
コード例 #7
0
ファイル: index.php プロジェクト: neymanna/fusionforge
            	Show the submit form
            */
            $sql = "SELECT groups.unix_group_name,groups.group_id,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'), _('NewsByte not found'));
            }
            $group =& group_get_object(db_result($result, 0, 'group_id'));
            $user =& user_get_object(db_result($result, 0, 'submitted_by'));
            echo '
		<h3>' . sprintf(_('Approve a NewsByte For Project: %1$s'), $group->getPublicName()) . '</h3>
		<p />
		<form action="' . getStringFromServer('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') . '" />
		<strong>' . _('Submitted for group') . ':</strong> ' . util_make_link_g(strtolower(db_result($result, 0, 'unix_group_name')), db_result($result, 0, 'group_id'), $group->getPublicName()) . '<br />
		<strong>' . _('Submitted by') . ':</strong> ' . $user->getRealName() . '<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="checked" /> ' . _('Reject') . '<br />
		<strong>' . _('Subject') . ':</strong><br />
		<input type="text" name="summary" value="' . db_result($result, 0, 'summary') . '" size="30" maxlength="60" /><br />
		<strong>' . _('Details') . ':</strong><br />';
            $GLOBALS['editor_was_set_up'] = false;
            $params = array();
            $params['name'] = 'details';
            $params['width'] = "600";
            $params['height'] = "300";
            $params['group'] = db_result($result, 0, 'group_id');
コード例 #8
0
ファイル: user_home.php プロジェクト: neymanna/fusionforge
<?php 
// now get listing of groups for that user
$res_cat = db_query("SELECT groups.group_name, \n\t groups.unix_group_name, \n\t groups.group_id, \n\t user_group.admin_flags,\n         role.role_name\n\t FROM \n\t groups,user_group,role WHERE user_group.user_id='{$user_id}' AND  user_group.role_id=role.role_id AND\n\t groups.group_id=user_group.group_id AND groups.is_public='1' AND groups.status='A'");
// see if there were any groups
if (db_numrows($res_cat) < 1) {
    ?>
	<p/><?php 
    echo _('This developer is not a member of any projects.');
    ?>
<p/>
	<?php 
} else {
    // endif no groups
    print "<p/>" . _('This developer is a member of the following groups:') . "<br />&nbsp;";
    while ($row_cat = db_fetch_array($res_cat)) {
        print '<br />' . util_make_link_g($row_cat['unix_group_name'], $row_cat['group_id'], htmlentities($row_cat['group_name'])) . ' (' . htmlentities($row_cat['role_name']) . ')';
    }
    print '</ul><p/>';
}
// end if groups
?>
	</td>
</tr>

	<?php 
echo $HTML->boxBottom();
?>

	</td>

コード例 #9
0
ファイル: index.php プロジェクト: neymanna/fusionforge
    if (!$result || $rows < 1) {
        echo '<tr><td colspan="3" bgcolor="#FFFFFF"><strong>' . _('You\'re not a member of any active projects') . '</strong></td></tr>';
        echo db_error();
    } else {
        for ($i = 0; $i < $rows; $i++) {
            $admin_flags = db_result($result, $i, 'admin_flags');
            if (stristr($admin_flags, 'A')) {
                $img = "trash-x.png";
            } else {
                $img = "trash.png";
            }
            echo '
			<tr ' . $HTML->boxGetAltRowStyle($i) . '><td style="text-align:center">';
            echo util_make_link("/my/rmproject.php?group_id=" . db_result($result, $i, 'group_id'), '<img src="' . $HTML->imgroot . 'ic/' . $img . '" alt="' . _('Delete') . '" height="16" width="16" border="0" />');
            echo '</td>
			<td>' . util_make_link_g(db_result($result, $i, 'unix_group_name'), db_result($result, $i, 'group_id'), htmlspecialchars(db_result($result, $i, 'group_name'))) . '</td>
			<td>' . htmlspecialchars(db_result($result, $i, 'role_name')) . '</td></tr>';
        }
    }
    echo $HTML->listTableBottom();
    ?>
</div>
<?php 
    //link to webcal
    plugin_hook('call_user_cal');
    ?>
</div>
<?php 
    echo site_user_footer(array());
}
// Local Variables:
コード例 #10
0
ファイル: index.php プロジェクト: neymanna/fusionforge
} else {
    if (db_numrows($res_new) > 20) {
        $rows = 20;
    } else {
        $rows = db_numrows($res_new);
    }
    print '
		<table width="100%" cellpadding="0" cellspacing="0" border="0">';
    $seen = array();
    for ($i = 0; $i < $rows; $i++) {
        $row_new = db_fetch_array($res_new);
        // avoid dupulicates of different file types
        if (!isset($seen[$row_new['group_id']])) {
            print '
			<tr valign="top">
				<td colspan="2">' . util_make_link_g($row_new['unix_group_name'], $row_new['group_id'], '<strong>' . $row_new['group_name'] . '</strong>') . '
				</td>
				<td nowrap="nowrap"><em>' . _('Released by:') . util_make_link_u($row_new['user_name'], $row_new['user_id'], '<em>' . $row_new['user_name'] . '</em>') . '
				</td>
			</tr>
			<tr>
				<td>' . _('Module:') . ' ' . $row_new['module_name'] . '
				</td>
				<td>' . _('Version:') . ' ' . $row_new['release_version'] . '
				</td>
				<td>' . date("M d, h:iA", $row_new['release_date']) . '
				</td>
			</tr>
			<tr valign="top">
				<td colspan="2">&nbsp;<br />';
            if ($row_new['short_description']) {
コード例 #11
0
ファイル: trove_list.php プロジェクト: neymanna/fusionforge
print $html_limit . "<hr />\n";
// #################################################################
// print actual project listings
// note that the for loop starts at 1, not 0
for ($i_proj = 1; $i_proj <= $querytotalcount; $i_proj++) {
    $row_grp = db_fetch_array($res_grp);
    // check to see if row is in page range
    if ($i_proj > ($page - 1) * $TROVE_BROWSELIMIT && $i_proj <= $page * $TROVE_BROWSELIMIT) {
        $viewthisrow = 1;
    } else {
        $viewthisrow = 0;
    }
    if ($row_grp && $viewthisrow) {
        print '<table border="0" cellpadding="0" width="100%"><tr valign="top"><td colspan="2">';
        print "{$i_proj}. ";
        print util_make_link_g($row_grp['unix_group_name'], $row_grp['group_id'], "<strong>" . htmlspecialchars($row_grp['group_name']) . "</strong> ");
        if ($row_grp['short_description']) {
            print "- " . htmlspecialchars($row_grp['short_description']);
        }
        print '<br />&nbsp;';
        // extra description
        print '</span></td></tr><tr valign="top"><td>';
        // list all trove categories
        print trove_getcatlisting($row_grp['group_id'], 1, 0);
        print '</span></td>' . "\n" . '<td style="text-align:right">';
        // now the right side of the display
        print 'Activity Percentile: <strong>' . number_format($row_grp['percentile'], 2) . '</strong>';
        print '<br />Activity Ranking: <strong>' . number_format($row_grp['ranking'], 2) . '</strong>';
        print '<br />Register Date: <strong>' . date(_('Y-m-d H:i'), $row_grp['register_time']) . '</strong>';
        print '</span></td></tr>';
        print '</table>';
コード例 #12
0
ファイル: people_utils.php プロジェクト: neymanna/fusionforge
function people_show_job_list($result)
{
    //takes a result set from a query and shows the jobs
    //query must contain 'group_id', 'job_id', 'title', 'category_name' and 'status_name'
    $title_arr = array();
    $title_arr[] = _('Title');
    $title_arr[] = _('Category');
    $title_arr[] = _('Date Opened');
    $title_arr[] = sprintf(_('%1$s project'), $GLOBALS['sys_name']);
    $return = $GLOBALS['HTML']->listTableTop($title_arr);
    $rows = db_numrows($result);
    if (!isset($i)) {
        $i = 1;
    }
    if ($rows < 1) {
        $return .= '<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td class="error" colspan="4">' . _('None Found') . db_error() . '</td></tr>';
    } else {
        for ($i = 0; $i < $rows; $i++) {
            $return .= '
				<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '><td>' . util_make_link('/people/viewjob.php?group_id=' . db_result($result, $i, 'group_id') . '&amp;job_id=' . db_result($result, $i, 'job_id'), db_result($result, $i, 'title')) . '</td><td>' . db_result($result, $i, 'category_name') . '</td><td>' . date(_('Y-m-d H:i'), db_result($result, $i, 'post_date')) . '</td><td>' . util_make_link_g(strtolower(db_result($result, $i, 'unix_group_name')), db_result($result, $i, 'group_id'), db_result($result, $i, 'group_name')) . '</td></tr>';
        }
    }
    $return .= $GLOBALS['HTML']->listTableBottom();
    return $return;
}
コード例 #13
0
ファイル: index.php プロジェクト: neymanna/fusionforge
        } else {
            $html_limit .= url_make_link("/softwaremap/trove_list.php?form_cat={$form_cat}&page={$i}", $displayed_i);
        }
        $html_limit .= ' ';
    }
}
$html_limit .= '</span>';
print $html_limit . "<hr />\n";
?>
<table border="0" cellpadding="0" width="100%"><?php 
while ($project = db_fetch_array($projectsResult)) {
    ?>
		<tr valign="top">
			<td colspan="2"><?php 
    echo $count . '. ';
    echo util_make_link_g($project['unix_group_name'], $project['group_id'], '<strong>' . htmlspecialchars($project['group_name']) . '</strong>');
    if ($project['short_description']) {
        echo ' - ' . htmlspecialchars($project['short_description']);
    }
    ?>
			<br />&nbsp;
			</td>
		</tr>
		<tr valign="top">
			<td><?php 
    // list all trove categories
    //print trove_getcatlisting($row_grp['group_id'],1,0);
    ?>
</td>
			<td align="right">
				Activity Percentile: <strong><?php 
コード例 #14
0
 /**
  * Outputs user's FOAF profile
  * @param unknown_type $params
  */
 function content_negociated_user_home(&$params)
 {
     $username = $params['username'];
     $accept = $params['accept'];
     if ($accept == 'application/rdf+xml') {
         $params['content_type'] = 'application/rdf+xml';
         $user_obj = user_get_object_by_name($username);
         $user_real_name = $user_obj->getRealName();
         $user_email = $user_obj->getEmail();
         $mbox = 'mailto:' . $user_email;
         $mbox_sha1sum = sha1($mbox);
         $projects = $user_obj->getGroups();
         sortProjectList($projects);
         $roles = RBACEngine::getInstance()->getAvailableRolesForUser($user_obj);
         sortRoleList($roles);
         // Construct an ARC2_Resource containing the project's RDF (DOAP) description
         $ns = array('rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#', 'foaf' => 'http://xmlns.com/foaf/0.1/', 'sioc' => 'http://rdfs.org/sioc/ns#', 'doap' => 'http://usefulinc.com/ns/doap#', 'dcterms' => 'http://purl.org/dc/terms/', 'planetforge' => 'http://coclico-project.org/ontology/planetforge#');
         $conf = array('ns' => $ns);
         // First, let's deal with the account
         $account_res = ARC2::getResource($conf);
         $account_uri = util_make_url_u($username, $user_obj->getID());
         $account_uri = rtrim($account_uri, '/');
         $person_uri = $account_uri . '#person';
         $account_res->setURI($account_uri);
         // $account_res->setRel('rdf:type', 'foaf:OnlineAccount');
         rdfutils_setPropToUri($account_res, 'rdf:type', 'foaf:OnlineAccount');
         rdfutils_setPropToUri($account_res, 'foaf:accountServiceHomepage', $account_uri . '/');
         $account_res->setProp('foaf:accountName', $username);
         rdfutils_setPropToUri($account_res, 'sioc:account_of', $person_uri);
         rdfutils_setPropToUri($account_res, 'foaf:accountProfilePage', $account_uri);
         $groups_index = array();
         $projects_index = array();
         $roles_index = array();
         $usergroups_uris = array();
         // see if there were any groups
         if (count($projects) >= 1) {
             foreach ($projects as $p) {
                 // TODO : report also private projects if authenticated, for instance through OAuth
                 if ($p->isPublic()) {
                     $project_link = util_make_link_g($p->getUnixName(), $p->getID(), $p->getPublicName());
                     $project_uri = util_make_url_g($p->getUnixName(), $p->getID());
                     // sioc:UserGroups for all members of a project are named after /projects/A_PROJECT/members/
                     $usergroup_uri = $project_uri . 'members/';
                     $role_names = array();
                     $usergroups_uris[] = $usergroup_uri;
                     $usergroup_res = ARC2::getResource($conf);
                     $usergroup_res->setURI($usergroup_uri);
                     rdfutils_setPropToUri($usergroup_res, 'rdf:type', 'sioc:UserGroup');
                     rdfutils_setPropToUri($usergroup_res, 'sioc:usergroup_of', $project_uri);
                     $roles_uris = array();
                     foreach ($roles as $r) {
                         if ($r instanceof RoleExplicit && $r->getHomeProject() != NULL && $r->getHomeProject()->getID() == $p->getID()) {
                             $role_names[$r->getID()] = $r->getName();
                             $role_uri = $project_uri . 'roles/' . $r->getID();
                             $roles_uris[] = $role_uri;
                         }
                     }
                     rdfutils_setPropToUri($usergroup_res, 'planetforge:group_has_function', $roles_uris);
                     $project_res = ARC2::getResource($conf);
                     $project_res->setURI($project_uri);
                     rdfutils_setPropToUri($project_res, 'rdf:type', 'planetforge:ForgeProject');
                     $project_res->setProp('doap:name', $p->getUnixName());
                     $projects_index = ARC2::getMergedIndex($projects_index, $project_res->index);
                     foreach ($role_names as $id => $name) {
                         $role_res = ARC2::getResource($conf);
                         $role_res->setURI($project_uri . 'roles/' . $id);
                         rdfutils_setPropToUri($role_res, 'rdf:type', 'sioc:Role');
                         $role_res->setProp('sioc:name', $name);
                         $roles_index = ARC2::getMergedIndex($roles_index, $role_res->index);
                     }
                     $groups_index = ARC2::getMergedIndex($groups_index, $usergroup_res->index);
                 }
             }
         }
         // end if groups
         rdfutils_setPropToUri($account_res, 'sioc:member_of', $usergroups_uris);
         // next, deal with the person
         $person_res = ARC2::getResource($conf);
         $person_res->setURI($person_uri);
         rdfutils_setPropToUri($person_res, 'rdf:type', 'foaf:Person');
         $person_res->setProp('foaf:name', $user_real_name);
         rdfutils_setPropToUri($person_res, 'foaf:holdsAccount', $account_uri);
         $person_res->setProp('foaf:mbox_sha1sum', $mbox_sha1sum);
         // merge the two sets of triples
         $merged_index = ARC2::getMergedIndex($account_res->index, $person_res->index);
         $merged_index = ARC2::getMergedIndex($merged_index, $groups_index);
         $merged_index = ARC2::getMergedIndex($merged_index, $projects_index);
         $merged_index = ARC2::getMergedIndex($merged_index, $roles_index);
         $conf = array('ns' => $ns, 'serializer_type_nodes' => true);
         $ser = ARC2::getRDFXMLSerializer($conf);
         /* Serialize a resource index */
         $doc = $ser->getSerializedIndex($merged_index);
         $params['content'] = $doc . "\n";
     }
 }
コード例 #15
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'));
    }
}