本文整理汇总了PHP中session_get_user函数的典型用法代码示例。如果您正苦于以下问题:PHP session_get_user函数的具体用法?PHP session_get_user怎么用?PHP session_get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了session_get_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IN
/**
* getProjectGroups - get an array of ProjectGroup objects.
*
* @return array The array of ProjectGroups.
*/
function &getProjectGroups()
{
if ($this->projectGroups) {
return $this->projectGroups;
}
if (session_loggedin()) {
$perm =& $this->Group->getPermission(session_get_user());
if (!$perm || !is_object($perm) || !$perm->isMember()) {
$public_flag = '=1';
$exists = '';
} else {
$public_flag = '<3';
if ($perm->isPMAdmin()) {
$exists = '';
} else {
$exists = " AND group_project_id IN (SELECT role_setting.ref_id\n\t\t\t\t\tFROM role_setting, user_group\n\t\t\t\t\tWHERE role_setting.value::integer >= 0\n AND role_setting.section_name = 'pm'\n AND role_setting.ref_id=project_group_list_vw.group_project_id\n \n \t\t\t\t\t AND user_group.role_id = role_setting.role_id\n\t\t\t\t\t AND user_group.user_id='" . user_getid() . "') ";
}
}
} else {
$public_flag = '=1';
$exists = '';
}
$sql = "SELECT *\n\t\t\tFROM project_group_list_vw\n\t\t\tWHERE group_id='" . $this->Group->getID() . "' \n\t\t\tAND is_public {$public_flag} {$exists}\n\t\t\tORDER BY group_project_id;";
$result = db_query($sql);
$rows = db_numrows($result);
if (!$result || $rows < 1) {
$this->setError(_('No ProjectGroups Found') . db_error());
$this->projectGroups = NULL;
} else {
while ($arr = db_fetch_array($result)) {
$this->projectGroups[] = new ProjectGroup($this->Group, $arr['group_project_id'], $arr);
}
}
return $this->projectGroups;
}
示例2: scm_header
/**
* GForge SCM Library
*
* Copyright 2004 (c) GForge LLC
*
* @version $Id$
* @author Tim Perdue tim@gforge.org
* @date 2005-04-16
*
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
function scm_header($params)
{
global $HTML, $sys_use_scm;
if (!$sys_use_scm) {
exit_disabled();
}
$project =& group_get_object($params['group']);
if (!$project || !is_object($project)) {
exit_error('Error', 'Could Not Get Project');
} elseif ($project->isError()) {
exit_error('Error', $project->getErrorMessage());
}
if (!$project->usesSCM()) {
exit_error('Error', _('Error - This project has turned off SCM.'));
}
site_project_header(array('title' => _('SCM Repository'), 'group' => $params['group'], 'toptab' => 'scm'));
/*
Show horizontal links
*/
if (session_loggedin()) {
$perm =& $project->getPermission(session_get_user());
if ($perm && is_object($perm) && !$perm->isError() && $perm->isAdmin()) {
echo $HTML->subMenu(array(_('SCM'), _('Admin'), _('Reporting')), array('/scm/?group_id=' . $params['group'], '/scm/admin/?group_id=' . $params['group'], '/scm/reporting/?group_id=' . $params['group']));
}
}
echo '<div style="width:99%">';
}
示例3: survey_header
function survey_header($params)
{
global $group_id, $is_admin_page, $HTML, $sys_use_survey;
if (!$sys_use_survey) {
exit_disabled();
}
$params['toptab'] = 'surveys';
$params['group'] = $group_id;
if ($project =& group_get_object($group_id)) {
if (!$project->usesSurvey()) {
exit_error(_('Error'), _('This Group Has Turned Off Surveys.'));
}
site_project_header($params);
if ($is_admin_page && $group_id) {
echo $HTML->subMenu(array(_('Surveys'), _('Admin'), _('Add Survey'), _('Edit Survey'), _('Add Questions'), _('Edit Questions'), _('Show Results')), array('/survey/?group_id=' . $group_id, '/survey/admin/?group_id=' . $group_id, '/survey/admin/add_survey.php?group_id=' . $group_id, '/survey/admin/edit_survey.php?group_id=' . $group_id, '/survey/admin/add_question.php?group_id=' . $group_id, '/survey/admin/show_questions.php?group_id=' . $group_id, '/survey/admin/show_results.php?group_id=' . $group_id));
} else {
if (session_loggedin()) {
$perm =& $project->getPermission(session_get_user());
if ($perm && is_object($perm) && !$perm->isError() && $perm->isAdmin()) {
echo $HTML->subMenu(array(_('Admin')), array('/survey/admin/?group_id=' . $group_id));
}
}
}
}
// end if (valid group id)
}
示例4: showRelatedArtifacts
function showRelatedArtifacts()
{
$res = $this->getRelatedArtifacts();
$rows = db_numrows($res);
if ($rows > 0) {
$perm =& $this->ProjectGroup->Group->getPermission(session_get_user());
if (!$perm || !is_object($perm) || !$perm->isPMAdmin()) {
$is_admin = false;
} else {
$is_admin = true;
}
echo '
<h3>' . _('Related Tracker Items') . '</h3>
<p>';
$title_arr = array();
$title_arr[] = _('Task Summary');
$title_arr[] = _('Tracker');
$title_arr[] = _('Open Date');
$is_admin ? $title_arr[] = _('Remove Relation') : '';
echo $GLOBALS['HTML']->listTableTop($title_arr);
for ($i = 0; $i < $rows; $i++) {
echo '
<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '>
<td>' . util_make_link('/tracker/?func=detail&aid=' . db_result($res, $i, 'artifact_id') . '&group_id=' . db_result($res, $i, 'group_id') . '&atid=' . db_result($res, $i, 'group_artifact_id'), db_result($res, $i, 'summary')) . '</td>
<td>' . db_result($res, $i, 'name') . '</td>
<td>' . date(_('Y-m-d H:i'), db_result($res, $i, 'open_date')) . '</td>' . ($is_admin ? '<td><input type="checkbox" name="rem_artifact_id[]" value="' . db_result($res, $i, 'artifact_id') . '"></td>' : '') . '</tr>';
}
echo $GLOBALS['HTML']->listTableBottom();
} else {
echo '
<h3>' . _('No Related Tracker Items Have Been Added') . '</h3>';
}
}
示例5: news_header
function news_header($params)
{
global $HTML, $group_id, $news_name, $news_id, $sys_news_group, $sys_use_news;
if (!$sys_use_news) {
exit_disabled();
}
$params['toptab'] = 'news';
$params['group'] = $group_id;
/*
Show horizontal links
*/
if ($group_id && $group_id != $sys_news_group) {
site_project_header($params);
} else {
$HTML->header($params);
}
if ($group_id && $group_id != $sys_news_group) {
$menu_texts = array();
$menu_links = array();
$menu_texts[] = _('Submit');
$menu_links[] = '/news/submit.php?group_id=' . $group_id;
if (session_loggedin()) {
$project =& group_get_object($params['group']);
if ($project && is_object($project) && !$project->isError()) {
$perm =& $project->getPermission(session_get_user());
if ($perm && is_object($perm) && !$perm->isError() && $perm->isAdmin()) {
$menu_texts[] = _('Admin');
$menu_links[] = '/news/admin/?group_id=' . $group_id;
}
}
}
echo $HTML->subMenu($menu_texts, $menu_links);
}
}
示例6: header
function header()
{
global $HTML, $group_id, $group_public_name, $request, $project;
$pagename = $request->getArg('pagename');
$submenu = Template('navbar');
//group is private
if (!$project->isPublic()) {
//if it's a private group, you must be a member of that group
session_require_perm('project_read', $group_id);
}
//for dead projects must be member of admin project
if (!$project->isActive()) {
//only SF group can view non-active, non-holding groups
session_require_global_perm('forge_admin');
}
$HTML->header(array('title' => $group_public_name . ': ' . htmlspecialchars($pagename), 'group' => $group_id, 'toptab' => 'wiki', 'submenu' => $submenu->asXML()));
// Display a warning banner for internal users when the wiki is opened
// to external users.
if ($project->getIsExternal()) {
$external_user = false;
if (session_loggedin()) {
$user = session_get_user();
$external_user = $user->getIsExternal();
}
if (!$external_user) {
$page = $request->getPage();
if ($page->get('external')) {
$external_msg = _("This page is external.");
}
echo $HTML->warning_msg(_("This project is shared with third-party users (non Alcatel-Lucent users).") . (isset($external_msg) ? ' ' . $external_msg : ''));
}
}
}
示例7: doc_droplist_count
function doc_droplist_count($l_group_id, $language_id, $g)
{
if (session_loggedin()) {
$perm =& $g->getPermission(session_get_user());
if (!$perm || !is_object($perm) || !$perm->isMember()) {
$public_flag = 'AND dd.stateid=1';
} else {
$public_flag = 'AND dd.stateid IN (1,4,5)';
}
} else {
$public_flag = 'AND dd.stateid=1';
}
$query = "select dd.language_id, sl.name, count(*) as count\n\t\t from doc_groups as dg, doc_data as dd, supported_languages as sl\n\t\t where dg.doc_group = dd.doc_group\n\t\t and dg.group_id = '{$l_group_id}'\n\t\t {$public_flag}\n\t\t and sl.language_id = dd.language_id\n\t\t group by dd.language_id,sl.name";
$gresult = db_query($query);
if (db_numrows($gresult) >= 1) {
print "<form name=\"langchoice\" action=\"index.php?group_id=" . $l_group_id . "\" method=\"post\"><table border=\"0\">" . " <tr><td valign=\"middle\"><strong>" . _('Language') . " </strong></td>" . " <td valign=\"middle\"><select name=\"language_id\">\n\n";
print "<option value=\"*\">" . _('All Languages') . " </option>";
while ($grow = db_fetch_array($gresult)) {
if ($language_id == $grow['language_id']) {
print "<option value=\"" . $grow['language_id'] . "\" selected=\"selected\">" . $grow['name'] . " (" . $grow['count'] . ") </option>";
} else {
print "<option value=\"" . $grow['language_id'] . "\">" . $grow['name'] . " (" . $grow['count'] . ") </option>";
}
}
print "</select></td><td valign=\"middle\"><input type=\"submit\" value=\"" . _('Go') . "\" /></td></tr></table></form>";
} else {
echo db_error();
}
}
示例8: SiteblogCommentForm
function SiteblogCommentForm()
{
parent::MailForm();
global $cgi;
$this->parseSettings('inc/app/siteblog/forms/comment/settings.php');
if (isset($cgi->_key) && !empty($cgi->_key)) {
//edit a comment
page_title('Editing Comment');
$comment = db_single('select * from siteblog_comment where id = ?', $cgi->_key);
$this->widgets['name']->setValue($comment->author);
$this->widgets['email']->setValue($comment->email);
$this->widgets['url']->setValue($comment->url);
$this->widgets['body']->setValue($comment->body);
} elseif (!isset($cgi->post)) {
header('Location: ' . site_prefix() . '/index');
exit;
} else {
if (session_valid()) {
$this->widgets['name']->setValue(session_username());
$user = session_get_user();
$this->widgets['email']->setValue($user->email);
$this->widgets['url']->setValue($user->website);
}
$this->widgets['post']->setValue($cgi->post);
//page_title ('Post a Comment');
}
if (!appconf('comments_security')) {
unset($this->widgets['security_test']);
}
}
示例9: activate_group
function activate_group($group_id)
{
global $feedback;
$group =& group_get_object($group_id);
if (!$group || !is_object($group)) {
$feedback .= _('Error creating group object') . '<br />';
return false;
} else {
if ($group->isError()) {
$feedback .= $group->getErrorMessage() . '<br />';
return false;
}
}
$feedback .= sprintf(_('Approving Group: %1$s'), $group->getUnixName()) . '<br />';
if (!$group->approve(session_get_user())) {
$feedback .= $group->getErrorMessage() . '<br />';
return false;
}
$hook_params = array();
$hook_params['group_id'] = $group_id;
plugin_hook("group_approved", $hook_params);
//plugin webcalendar
//create webcal group
plugin_hook('add_cal_group', $group_id);
return true;
}
示例10: siteevent_filter_username
function siteevent_filter_username($user)
{
$info = session_get_user($user);
if (!$info) {
return $user;
}
if (!empty($info->lastname)) {
return $info->lastname . ', ' . $info->firstname;
}
return $user;
}
示例11: SitelliteExportForm
function SitelliteExportForm()
{
parent::MailForm(__FILE__);
$user = session_get_user();
$groups = array('' => '- All -');
foreach (db_pairs('select id, name from sitellite_form_type order by name asc') as $k => $v) {
$groups[$k] = $v;
}
$this->widgets['group']->setValues($groups);
page_title(intl_get('Export Contacts'));
}
示例12: msg_show_user
function msg_show_user($user)
{
if (strstr($user, '@')) {
return '<a href="mailto:' . $user . '">' . $user . '</a>';
}
$info = session_get_user($user);
if (!$info || empty($info->lastname)) {
return '<a href="' . site_prefix() . '/index/cms-user-view-action?user=' . $user . '">' . $user . '</a>';
}
return '<a href="' . site_prefix() . '/index/cms-user-view-action?user=' . $user . '">' . $info->lastname . ', ' . $info->firstname . '</a>';
}
示例13: isGroupMember
/**
* isGroupMember - returns if the logged in user is member of the current group
*
* @param int $groupId group id
*/
function isGroupMember($groupId)
{
$Group =& group_get_object($groupId);
if ($Group && is_object($Group) && !$Group->isError() && session_loggedin()) {
$perm =& $Group->getPermission(session_get_user());
if ($perm && is_object($perm) && $perm->isMember()) {
return true;
}
}
return false;
}
示例14: msg_get_name
function msg_get_name($user)
{
$info = session_get_user($user);
if (!$info) {
return $user;
}
if (!empty($info->lastname)) {
return $info->lastname . ', ' . $info->firstname;
}
return $user;
}
示例15: SitelliteSendForm
function SitelliteSendForm()
{
parent::MailForm(__FILE__);
$user = session_get_user();
$this->widgets['from_email']->setValue($user->email);
$this->widgets['from_name']->setValue($user->firstname . ' ' . $user->lastname);
$groups = array('' => '- All -');
foreach (db_pairs('select id, name from sitellite_form_type order by name asc') as $k => $v) {
$groups[$k] = $v;
}
$this->widgets['send_to']->setValues($groups);
page_title(intl_get('Send Email'));
}