本文整理汇总了PHP中user_ismember函数的典型用法代码示例。如果您正苦于以下问题:PHP user_ismember函数的具体用法?PHP user_ismember怎么用?PHP user_ismember使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_ismember函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: svn_header
function svn_header($params)
{
global $group_id, $Language, $there_are_specific_permissions;
$params['toptab'] = 'svn';
$params['group'] = $group_id;
$project = ProjectManager::instance()->getProject($group_id);
$service = $project->getService('svn');
if (!$service) {
exit_error($Language->getText('global', 'error'), $Language->getText('svn_utils', 'svn_off'));
}
$toolbar = array();
$toolbar[] = array('title' => $Language->getText('svn_utils', 'svn_info'), 'url' => '/svn/?func=info&group_id=' . $group_id);
if ($project->isPublic() || user_isloggedin()) {
$toolbar[] = array('title' => $Language->getText('svn_utils', 'browse_tree'), 'url' => '/svn/viewvc.php/?roottype=svn&root=' . $project->getUnixName(false));
}
if (user_isloggedin()) {
$toolbar[] = array('title' => $Language->getText('svn_utils', 'my_ci'), 'url' => '/svn/?func=browse&group_id=' . $group_id . '&set=my');
$toolbar[] = array('title' => $Language->getText('svn_utils', 'svn_query'), 'url' => '/svn/?func=browse&group_id=' . $group_id);
}
if (user_ismember($group_id, 'A') || user_ismember($group_id, 'SVN_ADMIN')) {
$toolbar[] = array('title' => $Language->getText('svn_utils', 'svn_admin'), 'url' => '/svn/admin/?group_id=' . $group_id);
if (isset($params['path']) && !empty($params['path'])) {
// TODO: Validate the path
$toolbar[] = array('title' => $Language->getText('svn_utils', 'notif'), 'url' => '/svn/admin/?group_id=' . $group_id . '&func=notification&path=' . $params['path']);
}
}
if (!isset($params['help']) || !$params['help']) {
$params['help'] = "svn.html";
}
$toolbar[] = array('title' => $Language->getText('global', 'help'), 'url' => 'javascript:help_window(\'' . get_server_url() . '/doc/' . UserManager::instance()->getCurrentUser()->getShortLocale() . '/user-guide/' . $params['help'] . '\');');
$service->displayHeader($params['title'], array(array('title' => $params['title'], 'url' => '/svn/?group_id=' . $group_id)), $toolbar);
}
示例2: PHPWikiService
/**
* Constructor
*/
function PHPWikiService($id)
{
global $LANG, $is_wiki_page;
//used so the search box will add the necessary element to the pop-up box
$is_wiki_page = 1;
/*
* Check given id
*/
$this->gid = (int) $id;
if (empty($this->gid)) {
exit_no_group();
}
$pm = ProjectManager::instance();
$go = $pm->getProject($this->gid);
if (!$go) {
exit_no_group();
}
$this->wiki = new PHPWiki($this->gid);
// Check access right
$this->checkPermissions();
// If Wiki for project doesn't exist, propose creation ... if user is project admin or wiki admin
if (!$this->wiki->exist()) {
if (!user_ismember($this->gid, 'W2') && !user_ismember($this->gid, 'A')) {
exit_wiki_empty();
}
}
// Set language for phpWiki
if ($this->wiki->getLanguage_id()) {
define('DEFAULT_LANGUAGE', $this->wiki->getLanguage_id());
$LANG = $this->wiki->getLanguage_id();
}
}
示例3: survey_header
function survey_header($params)
{
global $group_id, $is_admin_page, $Language;
$params['toptab'] = 'survey';
$params['group'] = $group_id;
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
if (!$project->usesSurvey()) {
exit_error($Language->getText('global', 'error'), $Language->getText('survey_s_utils', 's_off'));
}
site_project_header($params);
echo "<P><B>";
// Admin link is displayed only if the user is a project administrator
if (user_ismember($group_id, 'A')) {
echo "<A HREF=\"/survey/admin/?group_id={$group_id}\">" . $Language->getText('survey_s_utils', 'admin') . "</A>";
}
if ($is_admin_page && $group_id && user_ismember($group_id, 'A')) {
echo " | <A HREF=\"/survey/admin/add_survey.php?group_id={$group_id}\">" . $Language->getText('survey_admin_index', 'add_s') . "</A>";
echo " | <A HREF=\"/survey/admin/edit_survey.php?func=browse&group_id={$group_id}\">" . $Language->getText('survey_admin_browse_survey', 'edit_s') . "</A>";
echo " | <A HREF=\"/survey/admin/add_question.php?group_id={$group_id}\">" . $Language->getText('survey_admin_index', 'add_q') . "</A>";
echo " | <A HREF=\"/survey/admin/edit_question.php?func=browse&group_id={$group_id}\">" . $Language->getText('survey_admin_browse_question', 'edit_q') . "</A>";
echo " | <A HREF=\"/survey/admin/show_results.php?group_id={$group_id}\">" . $Language->getText('survey_s_utils', 'show_r') . "</A>";
}
if (isset($params['help'])) {
if (user_ismember($group_id, 'A')) {
echo ' | ';
}
echo help_button($params['help'], false, $Language->getText('global', 'help'));
}
echo "</B><P>";
}
示例4: checkAccess
private function checkAccess()
{
try {
$project = $this->getProjectFromRequest();
} catch (Exception $e) {
exit_error($GLOBALS['Language']->getText('global', 'error'), $GLOBALS['Language']->getText('include_html', 'g_not_exist'));
}
// admin pages can be reached by news admin (N2) or project admin (A)
if (!user_ismember($project->getID(), 'A') && !user_ismember($project->getID(), 'N2')) {
exit_error($GLOBALS['Language']->getText('news_admin_index', 'permission_denied'), $GLOBALS['Language']->getText('news_admin_index', 'need_to_be_admin'));
}
}
示例5: header
function header()
{
$request = HTTPRequest::instance();
$group_id = $request->get('group_id');
if ($this->getControler()->view == 'codendi_im_admin') {
$GLOBALS['HTML']->header(array('title' => $this->_getTitle(), 'selected_top_tab' => 'admin'));
} else {
$GLOBALS['HTML']->header(array('title' => $this->_getTitle(), 'group' => $group_id, 'toptab' => 'IM'));
if (user_ismember($request->get('group_id'))) {
echo '<b><a href="/plugins/IM/?group_id=' . $request->get('group_id') . '&action=muc_logs">' . $GLOBALS['Language']->getText('plugin_im', 'toolbar_muc_logs') . '</a> | </b>';
}
echo $this->_getHelp();
}
}
示例6: validate
function validate($data)
{
if (!$data['project']['built_from_template']) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('register_projectname', 'info_missed'));
return false;
} else {
$pm = ProjectManager::instance();
$p = $pm->getProject($data['project']['built_from_template']);
if (!$p->isTemplate() && !user_ismember($data['project']['built_from_template'], 'A')) {
$GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'perm_denied'));
return false;
}
}
return true;
}
示例7: PHPWikiServiceAdmin
function PHPWikiServiceAdmin($id)
{
global $LANG, $is_wiki_page;
//used so the search box will add the necessary element to the pop-up box
$is_wiki_page = 1;
$this->gid = (int) $id;
if (empty($this->gid)) {
exit_no_group();
}
if (!user_ismember($this->gid, 'W2')) {
exit_permission_denied();
}
$this->wiki = new PHPWiki($this->gid);
// If Wiki for project doesn't exist, propose creation...
if (!$this->wiki->exist()) {
header('Location: ' . PHPWIKI_PLUGIN_BASE_URL . '/index.php?group_id=' . $this->gid . '&view=install');
}
// Set language for phpWiki
if ($this->wiki->getLanguage_id()) {
define('DEFAULT_LANGUAGE', $this->wiki->getLanguage_id());
$LANG = $this->wiki->getLanguage_id();
}
}
示例8: mail_header
function mail_header($params)
{
global $group_id, $Language;
//required for site_project_header
$params['group'] = $group_id;
$params['toptab'] = 'mail';
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
if (!$project->usesMail()) {
exit_error($Language->getText('global', 'error'), $Language->getText('mail_utils', 'mail_turned_off'));
}
site_project_header($params);
echo '<P><B>';
// admin link is only displayed if the user is a project administrator
if (user_ismember($group_id, 'A')) {
echo '<A HREF="/mail/admin/?group_id=' . $group_id . '">' . $Language->getText('mail_utils', 'admin') . '</A>';
echo ' | ';
}
if ($params['help']) {
echo help_button($params['help'], false, $Language->getText('global', 'help'));
}
echo '</B><P>';
}
示例9: _CodendiPassUser
function _CodendiPassUser($UserName = '', $prefs = false)
{
if ($prefs) {
$this->_prefs = $prefs;
}
/* Actually, we cannot set preferences here because PhpWiki instanciate
* _PassUser class before. So we had to modify _PassUser constructor to
instanciate CodendiUserPreferences instead of UserPreferences.
* if (!$this->_prefs) {
$this->_prefs = new CodendiUserPreferences();
$this->hasHomePage();
$this->getPreferences();
print_r($this->_prefs);
}*/
$this->_userid = $UserName;
if (!isset($this->_prefs->_method)) {
_PassUser::_PassUser($this->_userid);
}
switch ($this->_userid) {
case '':
case 'NA':
$this->_level = WIKIAUTH_ANON;
break;
case 'admin':
$this->_level = WIKIAUTH_ADMIN;
// admin Codendi
break;
default:
$this->_level = WIKIAUTH_USER;
}
if (user_ismember(GROUP_ID, 'W2')) {
$this->_level = WIKIAUTH_ADMIN;
}
//admin wiki
$this->_authmethod = 'Codendi';
}
示例10: getIntFromRequest
* 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
*/
require_once '../../env.inc.php';
require_once $gfwww . 'include/pre.php';
require_once $gfwww . 'survey/survey_utils.php';
$is_admin_page = 'y';
$group_id = getIntFromRequest('group_id');
$survey_id = getIntFromRequest('survey_id');
$customer_id = getIntFromRequest('customer_id');
survey_header(array('title' => _('Results')));
if (!session_loggedin() || !user_ismember($group_id, 'A')) {
echo "<h1>" . _('Permission denied') . "</h1>";
survey_footer(array());
exit;
}
?>
<form action="none">
<?php
/*
Select this survey from the database
*/
$sql = "SELECT * FROM surveys WHERE survey_id='{$survey_id}' AND group_id='{$group_id}'";
$result = db_query($sql);
echo "\n<h2>" . db_result($result, 0, "survey_title") . "</h2><p> </p>";
/*
示例11: exit_no_group
exit_no_group();
}
// Check permissions
$Group =& group_get_object_by_name($projectName);
if (!$Group || !is_object($Group) || $Group->isError()) {
exit_no_group();
}
if (!$Group->usesSCM()) {
exit_error(_('Error'), _('Error - This project has turned off SCM.'));
}
// check if the scm_box is located in another server
$scm_box = $Group->getSCMBox();
//$external_scm = (gethostbyname($sys_default_domain) != gethostbyname($scm_box));
$external_scm = !$sys_scm_single_host;
if (session_loggedin()) {
if (user_ismember($Group->getID())) {
$perm =& $Group->getPermission(session_get_user());
if (!($perm && is_object($perm) && $perm->isCVSReader()) && !$Group->enableAnonSCM()) {
exit_permission_denied();
}
} else {
if (!$Group->enableAnonSCM()) {
exit_permission_denied();
}
}
} else {
if (!$Group->enableAnonSCM()) {
// user is not logged in... check if group accepts anonymous CVS
exit_permission_denied();
}
}
示例12: outerTabs
function outerTabs($params)
{
global $Language;
$TABS_DIRS[] = '/';
$TABS_TITLES[] = $Language->getText('menu', 'home');
if (user_isloggedin()) {
$TABS_DIRS[] = '/my/';
$TABS_TITLES[] = $Language->getText('menu', 'my_personal_page');
}
if ($GLOBALS['sys_use_trove'] != 0) {
$TABS_DIRS[] = '/softwaremap/';
$TABS_TITLES[] = $Language->getText('menu', 'projectree');
}
if ($GLOBALS['sys_use_snippet'] != 0) {
$TABS_DIRS[] = '/snippet/';
$TABS_TITLES[] = $Language->getText('menu', 'code_snippet');
}
if (user_ismember(1, 'A')) {
$TABS_DIRS[] = '/admin/';
$TABS_TITLES[] = $Language->getText('menu', 'admin');
}
$TABS_DIRS[] = '/site/';
$TABS_TITLES[] = $Language->getText('include_layout', 'Help');
/*
if (user_ismember($GLOBALS['sys_stats_group'])) {
$TABS_DIRS[]='/reporting/';
$TABS_TITLES[]=$Language->getText('menu','reporting');
}
*/
$selected_top_tab = isset($params['selected_top_tab']) ? $params['selected_top_tab'] : '';
if (isset($params['group']) && $params['group']) {
// get group info using the common result set
$pm = ProjectManager::instance();
$project = $pm->getProject($params['group']);
if ($project && is_object($project)) {
if ($project->isError()) {
} else {
$selected = array_search("/softwaremap/", $TABS_DIRS);
}
}
} else {
if (strstr(getStringFromServer('REQUEST_URI'), '/my/') || strstr(getStringFromServer('REQUEST_URI'), '/themes/') || strstr(getStringFromServer('REQUEST_URI'), '/account/')) {
$selected = array_search("/my/", $TABS_DIRS);
} elseif (strstr(getStringFromServer('REQUEST_URI'), 'softwaremap')) {
$selected = array_search("/softwaremap/", $TABS_DIRS);
} elseif (strstr(getStringFromServer('REQUEST_URI'), '/snippet/')) {
$selected = array_search("/snippet/", $TABS_DIRS);
} elseif (strstr(getStringFromServer('REQUEST_URI'), '/site/')) {
$selected = array_search("/site/", $TABS_DIRS);
} elseif (strstr(getStringFromServer('REQUEST_URI'), '/reporting/')) {
$selected = array_search('/reporting/', $TABS_DIRS);
} elseif ((strstr(getStringFromServer('REQUEST_URI'), '/admin/') || $selected_top_tab == 'admin') && user_ismember(1, 'A')) {
$selected = array_search('/admin/', $TABS_DIRS);
} elseif ($selected_top_tab && array_search($selected_top_tab, $TABS_DIRS) !== FALSE) {
$selected = array_search($selected_top_tab, $TABS_DIRS);
} else {
$selected = 0;
}
}
echo $this->tabGenerator($TABS_DIRS, $TABS_TITLES, false, $selected, null, '100%');
}
示例13: isInDebugMode
private function isInDebugMode()
{
return ForgeConfig::get('DEBUG_MODE') && (ForgeConfig::get('DEBUG_DISPLAY_FOR_ALL') || user_ismember(1, 'A'));
}
示例14: check_cvs_access
function check_cvs_access($username, $group_name, $cvspath)
{
$pm = ProjectManager::instance();
$project = $pm->getProjectByUnixName($group_name);
//accept old url containing a .diff at the end of the filename
if (strpos($cvspath, '.diff') == strlen($cvspath) - 5) {
$cvspath = substr($cvspath, 0, strlen($cvspath) - 5);
}
// if the file path exists as such then it's a directory
// else add the ,v extension because it's a file
$path = "/cvsroot/" . $group_name . '/' . $cvspath;
if (!is_dir($path)) {
$path = $path . ',v';
}
$mode = fileperms($path);
// Also check permissions on top directory (in case of private repo)
$mode_top = fileperms("/cvsroot/" . $group_name);
// A directory that is not world readable can only be viewed
// through viewvc if the user is a project member
if ($project && (($mode_top & 0x4) == 0 || ($mode & 0x4) == 0) && !user_ismember($project->getID())) {
return false;
} else {
return true;
}
}
示例15: outerTabs
function outerTabs($params)
{
global $Language, $sys_use_trove, $sys_use_snippet;
$selected_top_tab = '';
if (isset($params['selected_top_tab'])) {
$selected_top_tab = $params['selected_top_tab'];
}
$menuTree = new TreeNode();
$sthSelected = false;
$menuTree->addChild(new TreeNode(array('link' => '/', 'title' => $Language->getText('menu', 'home'))));
// We need to keep a reference on this node in order to set the
// selected value in the data. See bottom of this function.
$homeNode =& $menuTree->getChild(0);
if (user_isloggedin()) {
$selected = isset($params['selected_top_tab']) && $params['selected_top_tab'] == '/my/' || strstr(getStringFromServer('REQUEST_URI'), '/my/') || strstr(getStringFromServer('REQUEST_URI'), '/account/');
$sthSelected = $sthSelected || $selected;
$mynode = new TreeNode(array('link' => '/my/', 'title' => $Language->getText('menu', 'my_personal_page'), 'selected' => $selected));
if ($selected) {
$selected = isset($params['selected_top_tab']) && $params['selected_top_tab'] == '/my/' || (bool) strstr(getStringFromServer('REQUEST_URI'), '/my/');
$mynode->addChild(new TreeNode(array('link' => '/my/', 'title' => $Language->getText('my_index', 'my_dashboard'), 'selected' => $selected)));
$selected = (bool) strstr(getStringFromServer('REQUEST_URI'), '/account/');
$mynode->addChild(new TreeNode(array('link' => '/account/', 'title' => $Language->getText('my_index', 'account_maintenance'), 'selected' => $selected)));
}
$menuTree->addChild($mynode);
} else {
$selected = (bool) strstr(getStringFromServer('REQUEST_URI'), '/my/');
$sthSelected = $sthSelected || $selected;
$menuTree->addChild(new TreeNode(array('link' => '/my/', 'title' => $Language->getText('menu', 'my_personal_page'), 'selected' => $selected)));
}
if ($GLOBALS['sys_use_trove'] != 0 || isset($params['group']) && $params['group']) {
$selected = false;
if (isset($params['group']) && $params['group']) {
// get group info using the common result set
$pm = ProjectManager::instance();
$project = $pm->getProject($params['group']);
if ($project && is_object($project)) {
if ($project->isError()) {
die('is error');
} else {
$sthSelected = true;
$projTree = $this->project_tabs($params['toptab'], $params['group']);
$projTree->setData(array('link' => '/softwaremap/', 'title' => $Language->getText('menu', 'projectree'), 'selected' => true));
//'link'=>'/projects/'.$project->getUnixName().'/'
//,'title'=>$project->getPublicName()
//,'selected' => true));
$menuTree->addChild($projTree);
}
}
} else {
$selected = (bool) strstr(getStringFromServer('REQUEST_URI'), 'softwaremap');
$sthSelected = $sthSelected || $selected;
$menuTree->addChild(new TreeNode(array('link' => '/softwaremap/', 'title' => $Language->getText('menu', 'projectree'), 'selected' => $selected)));
}
}
if ($GLOBALS['sys_use_snippet'] != 0) {
$selected = (bool) strstr(getStringFromServer('REQUEST_URI'), '/snippet/');
$sthSelected = $sthSelected || $selected;
$menuTree->addChild(new TreeNode(array('link' => '/snippet/', 'title' => $Language->getText('menu', 'code_snippet'), 'selected' => $selected)));
}
if (user_ismember(1, 'A')) {
$selected = strpos(getStringFromServer('REQUEST_URI'), '/admin/') === 0 || $selected_top_tab === 'admin';
$sthSelected = $sthSelected || $selected;
$menuTree->addChild(new TreeNode(array('link' => '/admin/', 'title' => $Language->getText('menu', 'admin'), 'selected' => $selected)));
}
$selected = (bool) (strstr(getStringFromServer('REQUEST_URI'), '/site/') || $selected_top_tab === 'site');
$sthSelected = $sthSelected || $selected;
$menuTree->addChild(new TreeNode(array('link' => '/site/', 'title' => $Language->getText('include_layout', 'Help'), 'selected' => $selected)));
$additional_tabs = array();
include $GLOBALS['Language']->getContent('layout/extra_tabs', null, null, '.php');
foreach ($additional_tabs as $t) {
$sthSelected = $sthSelected || $t['selected'];
$menuTree->addChild(new TreeNode($t));
}
// Set selected value for 'home' link (this is the selected tab
// if no other was previously selected)
$homeNodeData =& $homeNode->getData();
$homeNodeData['selected'] = !$sthSelected;
$buildMenuVisitor = new BuildMenuVisitor();
$menuTree->accept($buildMenuVisitor);
echo $buildMenuVisitor->getHtml();
}