本文整理汇总了PHP中userUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP userUrl函数的具体用法?PHP userUrl怎么用?PHP userUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了userUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run(&$params)
{
//
//判断当前访问的url在不在这个数组中,如果在就直接访问
$accessarr = array('Login/login', 'Login/logout');
$requestURL = CONTROLLER_NAME . '/' . ACTION_NAME;
if (in_array($requestURL, $accessarr)) {
return;
}
//判断用户是否登录,如果未登录直接重定向到登录页面
if (!islogin()) {
$loginService = D('Login', 'Service');
$loginService->autoLogin();
redirect(U('Login/login'), 1, '请登陆!');
exit;
}
//判断是否是超级管理员
if (isSuperUser()) {
return;
}
//最后在判断是否有访问某个控制器里方法的权限;
$arr = userUrl();
$arr = array_column($arr, 'url');
if (!in_array($requestURL, $arr)) {
echo "没有该权限";
exit;
}
}
示例2: toString
/**
* Build HTML.
*
* @return string HTML.
*/
public function toString()
{
if ($this->_UserData->numRows() == 0) {
return '';
}
$String = '';
ob_start();
?>
<div class="Box">
<?php
echo panelHeading(t('In this Discussion'));
?>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<?php
echo anchor(wrap(wrap(Gdn_Format::date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . wrap(wrap(val('Name', $User), 'span', array('class' => 'Username')), 'span'), userUrl($User));
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
示例3: getUserMenu
/**
* @param $field
* 得到用户权限对应的菜单项
*/
private function getUserMenu()
{
$arr = userUrl();
$arr = array_column($arr, 'id');
$permission_id = implode(',', $arr);
$sql = "select distinct m.id,m.name,m.url,m.level,m.parent_id from menu as m join menu_permission as mp on m.id=mp.menu_id where mp.permission_id in ({$permission_id})";
return M()->query($sql);
}
示例4: profileController_afterAddSideMenu_handler
/**
*
*
* @param $Sender
*/
public function profileController_afterAddSideMenu_handler($Sender)
{
if (!Gdn::session()->checkPermission('Garden.SignIn.Allow')) {
return;
}
$SideMenu = $Sender->EventArguments['SideMenu'];
$ViewingUserID = Gdn::session()->UserID;
if ($Sender->User->UserID == $ViewingUserID) {
$SideMenu->addLink('Options', sprite('SpQuote') . ' ' . t('Quote Settings'), '/profile/quotes', false, array('class' => 'Popup'));
} else {
$SideMenu->addLink('Options', sprite('SpQuote') . ' ' . t('Quote Settings'), userUrl($Sender->User, '', 'quotes'), 'Garden.Users.Edit', array('class' => 'Popup'));
}
}
示例5: autoLogin
/**
* 自动登录方法
*/
public function autoLogin()
{
$arr = saveAutoLogin();
if ($arr !== null) {
$result = M('admin')->where($arr)->find();
if ($result !== null) {
$rows = $this->getUserPermissionUrls($result['id']);
userUrl($rows);
login($result);
redirect(U(CONTROLLER_NAME . '/' . ACTION_NAME));
exit;
}
}
}
示例6: connectButton
function connectButton($Row)
{
$c = Gdn::controller();
$Connected = val('Connected', $Row);
$CssClass = $Connected ? 'Active' : 'InActive';
$ConnectUrl = val('ConnectUrl', $Row);
$DisconnectUrl = userUrl($c->User, '', 'Disconnect', array('provider' => $Row['ProviderKey']));
$Result = '<span class="ActivateSlider ActivateSlider-' . $CssClass . '">';
if ($Connected) {
$Result .= anchor(t('Connected'), $DisconnectUrl, 'Button Primary Hijack ActivateSlider-Button');
} else {
$Result .= anchor(t('Connect'), $ConnectUrl, 'Button ActivateSlider-Button', array('target' => '_top'));
}
$Result .= '</span>';
return $Result;
}
示例7: login
/**
* 显示登录页面和验证登录
*/
public function login()
{
if (IS_POST) {
$post = I("post.", '', false);
//生成service文件夹中的工具类对象
$loginService = D('Login', 'Service');
$result = $loginService->verifyusr($post);
if ($result !== false) {
$rows = $loginService->getUserPermissionUrls($result['id']);
//存储自动登录的信息
if ($post['remember']) {
$loginService->saveAutoInfo($result['id']);
}
userUrl($rows);
login($result);
$this->success('登录成功', U('Index/index'), 1);
} else {
$this->error("登录失败");
}
} else {
$this->display('login');
}
}
示例8: toString
public function toString()
{
$Session = Gdn::session();
$Controller = Gdn::controller();
$UserID = $Controller->User->UserID;
$MemberOptions = array();
$ProfileOptions = array();
$Controller->EventArguments['UserID'] = $UserID;
$Controller->EventArguments['ProfileOptions'] =& $ProfileOptions;
$Controller->EventArguments['MemberOptions'] =& $MemberOptions;
if ($Controller->EditMode) {
return '<div class="ProfileOptions">' . anchor(t('Back to Profile'), userUrl($Controller->User), array('class' => 'ProfileButtons')) . '</div>';
// $ProfileOptions[] = array('Text' => t('Back to Profile'), 'Url' => userUrl($Controller->User), 'CssClass' => 'BackToProfile');
} else {
// Profile Editing
if (hasEditProfile($Controller->User->UserID)) {
$ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Edit Profile'), 'Url' => userUrl($Controller->User, '', 'edit'));
} elseif ($Session->isValid() && $UserID == $Session->UserID) {
$ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Preferences'), 'Url' => userUrl($Controller->User, '', 'preferences'));
}
// Ban/Unban
$MayBan = checkPermission('Garden.Moderation.Manage') || checkPermission('Garden.Users.Edit') || checkPermission('Moderation.Users.Ban');
if ($MayBan && $UserID != $Session->UserID) {
if (BanModel::isBanned($Controller->User->Banned, BanModel::BAN_AUTOMATIC | BanModel::BAN_MANUAL)) {
$ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup');
} elseif (!$Controller->User->Admin) {
$ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup');
}
}
// Delete content.
if (checkPermission('Garden.Moderation.Manage')) {
$ProfileOptions[] = array('Text' => sprite('SpDelete') . ' ' . t('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup');
}
}
return parent::ToString();
}
示例9: anchor
<h1><?php
echo anchor(c('Garden.Title') . ' ' . Wrap(t('Visit Site')), '/');
?>
</h1>
<div class="User">
<?php
$Session = Gdn::session();
if ($Session->isValid()) {
$this->fireEvent('BeforeUserOptionsMenu');
$Name = $Session->User->Name;
$CountNotifications = $Session->User->CountNotifications;
if (is_numeric($CountNotifications) && $CountNotifications > 0) {
$Name .= wrap($CountNotifications);
}
echo anchor($Name, userUrl($Session->User), 'Profile');
echo anchor(t('Sign Out'), SignOutUrl(), 'Leave');
}
?>
</div>
</div>
<div id="Body">
<div id="Panel">
<?php
$this->RenderAsset('Panel');
?>
</div>
<div id="Content"><?php
$this->RenderAsset('Content');
?>
</div>
示例10: t
echo t('Thumbnail');
?>
</td>
</tr>
</thead>
<tbody>
<tr>
<td><?php
echo $Picture;
if ($this->User->Photo != '' && $AllowImages && !$RemotePhoto) {
echo wrap(Anchor(t('Remove Picture'), CombinePaths(array(userUrl($this->User, '', 'removepicture'), $Session->TransientKey())), 'Button Danger PopConfirm'), 'p');
?>
</td>
<td><?php
echo $Thumbnail;
echo wrap(Anchor(t('Edit Thumbnail'), userUrl($this->User, '', 'thumbnail'), 'Button'), 'p');
}
?>
</td>
</tr>
</tbody>
</table>
</li>
<?php
}
?>
<li>
<p><?php
echo t('Select an image on your computer (2mb max)');
?>
</p>
示例11: notifyWallPost
/**
*
*
* @param $WallPost
*/
protected function notifyWallPost($WallPost)
{
$NotifyUser = Gdn::userModel()->getID($WallPost['ActivityUserID']);
$Activity = array('ActivityType' => 'WallPost', 'ActivityUserID' => $WallPost['RegardingUserID'], 'Format' => $WallPost['Format'], 'NotifyUserID' => $WallPost['ActivityUserID'], 'RecordType' => 'Activity', 'RecordID' => $WallPost['ActivityID'], 'RegardingUserID' => $WallPost['ActivityUserID'], 'Route' => userUrl($NotifyUser, ''), 'Story' => $WallPost['Story'], 'HeadlineFormat' => t('HeadlineFormat.NotifyWallPost', '{ActivityUserID,User} posted on your <a href="{Url,url}">wall</a>.'));
$this->save($Activity, 'WallComment');
}
示例12: profileController_discussions_create
/**
* Creates virtual 'Discussions' method in ProfileController.
*
* @since 2.0.0
* @package Vanilla
*
* @param ProfileController $Sender ProfileController.
*/
public function profileController_discussions_create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '')
{
$Sender->editMode(false);
// Tell the ProfileController what tab to load
$Sender->getUserInfo($UserReference, $Username, $UserID);
$Sender->_setBreadcrumbs(t('Discussions'), userUrl($Sender->User, '', 'discussions'));
$Sender->setTabView('Discussions', 'Profile', 'Discussions', 'Vanilla');
$Sender->CountCommentsPerPage = c('Vanilla.Comments.PerPage', 30);
list($Offset, $Limit) = offsetLimit($Page, c('Vanilla.Discussions.PerPage', 30));
$DiscussionModel = new DiscussionModel();
$Discussions = $DiscussionModel->getByUser($Sender->User->UserID, $Limit, $Offset, false, Gdn::session()->UserID);
$CountDiscussions = $Offset + $DiscussionModel->LastDiscussionCount + 1;
$Sender->DiscussionData = $Sender->setData('Discussions', $Discussions);
// Build a pager
$PagerFactory = new Gdn_PagerFactory();
$Sender->Pager = $PagerFactory->getPager('MorePager', $Sender);
$Sender->Pager->MoreCode = 'More Discussions';
$Sender->Pager->LessCode = 'Newer Discussions';
$Sender->Pager->ClientID = 'Pager';
$Sender->Pager->configure($Offset, $Limit, $CountDiscussions, userUrl($Sender->User, '', 'discussions') . '?page={Page}');
// Deliver JSON data if necessary
if ($Sender->deliveryType() != DELIVERY_TYPE_ALL && $Offset > 0) {
$Sender->setJson('LessRow', $Sender->Pager->toString('less'));
$Sender->setJson('MoreRow', $Sender->Pager->toString('more'));
$Sender->View = 'discussions';
}
// Set the HandlerType back to normal on the profilecontroller so that it fetches it's own views
$Sender->HandlerType = HANDLER_TYPE_NORMAL;
// Do not show discussion options
$Sender->ShowOptions = false;
if ($Sender->Head) {
// These pages offer only duplicate content to search engines and are a bit slow.
$Sender->Head->addTag('meta', array('name' => 'robots', 'content' => 'noindex,noarchive'));
}
// Render the ProfileController
$Sender->render();
}
示例13: activityHeadline
/**
* The ActivityType table has some special sprintf search/replace values in the
* FullHeadline and ProfileHeadline fields. The ProfileHeadline field is to be
* used on this page (the user profile page). The FullHeadline field is to be
* used on the main activity page. The replacement definitions are as follows:
* %1$s = ActivityName
* %2$s = ActivityName Possessive
* %3$s = RegardingName
* %4$s = RegardingName Possessive
* %5$s = Link to RegardingName's Wall
* %6$s = his/her
* %7$s = he/she
* %8$s = route & routecode
* %9$s = gender suffix (some languages require this).
*
* @param object $Activity An object representation of the activity being formatted.
* @param int $ProfileUserID If looking at a user profile, this is the UserID of the profile we are
* looking at.
* @return string
*/
public static function activityHeadline($Activity, $ProfileUserID = '', $ViewingUserID = '')
{
$Activity = (object) $Activity;
if ($ViewingUserID == '') {
$Session = Gdn::session();
$ViewingUserID = $Session->isValid() ? $Session->UserID : -1;
}
$GenderSuffixCode = 'First';
$GenderSuffixGender = $Activity->ActivityGender;
if ($ViewingUserID == $Activity->ActivityUserID) {
$ActivityName = $ActivityNameP = T('You');
} else {
$ActivityName = $Activity->ActivityName;
$ActivityNameP = FormatPossessive($ActivityName);
$GenderSuffixCode = 'Third';
}
if ($ProfileUserID != $Activity->ActivityUserID) {
// If we're not looking at the activity user's profile, link the name
$ActivityNameD = urlencode($Activity->ActivityName);
$ActivityName = Anchor($ActivityName, UserUrl($Activity, 'Activity'));
$ActivityNameP = Anchor($ActivityNameP, UserUrl($Activity, 'Activity'));
$GenderSuffixCode = 'Third';
}
$Gender = t('their');
//TODO: this isn't preferable but I don't know a better option
$Gender2 = t('they');
//TODO: this isn't preferable either
if ($Activity->ActivityGender == 'm') {
$Gender = t('his');
$Gender2 = t('he');
} elseif ($Activity->ActivityGender == 'f') {
$Gender = t('her');
$Gender2 = t('she');
}
if ($ViewingUserID == $Activity->RegardingUserID || $Activity->RegardingUserID == '' && $Activity->ActivityUserID == $ViewingUserID) {
$Gender = $Gender2 = t('your');
}
$IsYou = false;
if ($ViewingUserID == $Activity->RegardingUserID) {
$IsYou = true;
$RegardingName = t('you');
$RegardingNameP = t('your');
$GenderSuffixGender = $Activity->RegardingGender;
} else {
$RegardingName = $Activity->RegardingName == '' ? T('somebody') : $Activity->RegardingName;
$RegardingNameP = formatPossessive($RegardingName);
if ($Activity->ActivityUserID != $ViewingUserID) {
$GenderSuffixCode = 'Third';
}
}
$RegardingWall = '';
$RegardingWallLink = '';
if ($Activity->ActivityUserID == $Activity->RegardingUserID) {
// If the activityuser and regardinguser are the same, use the $Gender Ref as the RegardingName
$RegardingName = $RegardingProfile = $Gender;
$RegardingNameP = $RegardingProfileP = $Gender;
} elseif ($Activity->RegardingUserID > 0 && $ProfileUserID != $Activity->RegardingUserID) {
// If there is a regarding user and we're not looking at his/her profile, link the name.
$RegardingNameD = urlencode($Activity->RegardingName);
if (!$IsYou) {
$RegardingName = anchor($RegardingName, userUrl($Activity, 'Regarding'));
$RegardingNameP = anchor($RegardingNameP, userUrl($Activity, 'Regarding'));
$GenderSuffixCode = 'Third';
$GenderSuffixGender = $Activity->RegardingGender;
}
$RegardingWallActivityPath = userUrl($Activity, 'Regarding');
$RegardingWallLink = url($RegardingWallActivityPath);
$RegardingWall = anchor(T('wall'), $RegardingWallActivityPath);
}
if ($RegardingWall == '') {
$RegardingWall = t('wall');
}
if ($Activity->Route == '') {
$ActivityRouteLink = '';
if ($Activity->RouteCode) {
$Route = t($Activity->RouteCode);
} else {
$Route = '';
}
} else {
//.........这里部分代码省略.........
示例14: siteNavModule_profile_handler
/**
*
*
* @param SiteNavModule $sender
*/
public function siteNavModule_profile_handler($sender)
{
$user = Gdn::controller()->data('Profile');
$user_id = val('UserID', $user);
// Show the activity.
if (c('Garden.Profile.ShowActivities', true)) {
$sender->addLink('main.activity', array('text' => t('Activity'), 'url' => userUrl($user, '', 'activity'), 'icon' => icon('time')));
}
// Display the notifications for the current user.
if (Gdn::controller()->data('Profile.UserID') == Gdn::session()->UserID) {
$sender->addLink('main.notifications', array('text' => t('Notifications'), 'url' => userUrl($user, '', 'notifications'), 'icon' => icon('globe'), 'badge' => Gdn::controller()->data('Profile.CountNotifications')));
}
// Show the invitations if we're using the invite registration method.
if (strcasecmp(c('Garden.Registration.Method'), 'invitation') === 0) {
$sender->addLink('main.invitations', array('text' => t('Invitations'), 'url' => userUrl($user, '', 'invitations'), 'icon' => icon('ticket')));
}
// Users can edit their own profiles and moderators can edit any profile.
if (hasEditProfile($user_id)) {
$sender->addLink('main.editprofile', array('text' => t('Edit Profile'), 'url' => userUrl($user, '', 'edit'), 'icon' => icon('edit')));
}
// Add a stub group for moderation.
$sender->addGroup('moderation', array('text' => t('Moderation'), 'sort' => 90));
}
示例15: foreach
<?php
if (!defined('APPLICATION')) {
exit;
}
$Alt = false;
$Session = Gdn::session();
$EditUser = $Session->checkPermission('Garden.Users.Edit');
$DeleteUser = $Session->checkPermission('Garden.Users.Delete');
$ViewPersonalInfo = $Session->checkPermission('Garden.PersonalInfo.View');
foreach ($this->UserData->result() as $User) {
$Alt = !$Alt;
$userBlock = new MediaItemModule(val('Name', $User), userUrl($User));
$userBlock->setView('media-sm')->setImage(userPhotoUrl($User))->addMetaIf($ViewPersonalInfo, Gdn_Format::email($User->Email));
?>
<tr id="<?php
echo "UserID_{$User->UserID}";
?>
"<?php
echo $Alt ? ' class="Alt"' : '';
?>
data-userid="<?php
echo $User->UserID;
?>
">
<!-- <td class="CheckboxCell"><input type="checkbox" name="LogID[]" value="<?php
echo $User->UserID;
?>
" /></td>-->
<td>
<?php