本文整理汇总了PHP中isSuperUser函数的典型用法代码示例。如果您正苦于以下问题:PHP isSuperUser函数的具体用法?PHP isSuperUser怎么用?PHP isSuperUser使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isSuperUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run(&$params)
{
//>>1.定义不需要登陆验证的地址
$noCheck = array('Login/index', 'Verify/index');
//>>2.获取用户正在访问的url地址
$requestURL = CONTROLLER_NAME . '/' . ACTION_NAME;
if (in_array($requestURL, $noCheck)) {
return;
}
header('Content-Type: text/html;charset=utf-8');
//>>1.判定用户是否登陆
if (!isLogin()) {
$loginService = D('Login', 'Service');
if (!$loginService->autoLogin()) {
//进行自动登录, 如果没有自动登录,就转向登录页面
redirect(U('Login/index'), 1, '请登陆!');
}
}
//>>3.如果是超级管理员不用在判定权限
if (isSuperUser()) {
return;
}
//>>2.判定登陆用户访问的url是否在他的权限范围之内
$urls = savePermissionURL();
if (!in_array($requestURL, $urls)) {
exit('权限不足!请求联系管理员!');
}
}
示例2: 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;
}
}
示例3: addToolbar
function addToolbar($item)
{
$canDo = JHotelReservationHelper::getActions();
JRequest::setVar('hidemainmenu', 1);
if ($canDo->get('core.create') && ($item->hotel_state == 0 || isSuperUser(JFactory::getUser()->id))) {
JToolBarHelper::apply('hotel.apply');
JToolBarHelper::save('hotel.save');
}
JToolBarHelper::cancel('hotel.cancel');
}
示例4: accessLevel
function accessLevel($page)
{
global $tables, $access_levels;
if (!$GLOBALS["require_login"] || isSuperUser()) {
return "all";
}
if (!isset($_SESSION["adminloggedin"])) {
return 0;
}
if (!is_array($_SESSION["logindetails"])) {
return 0;
}
## for non-supers we only allow owner views
## this is likely to need tweaking
return 'owner';
}
示例5: checkHotels
function checkHotels($userId, $hotels)
{
if (isSuperUser($userId) || isManager($userId)) {
return $hotels;
}
$db = JFactory::getDBO();
$query = "SELECT b.hotel_id\r\n\t\t\t\t FROM #__users a,\r\n\t\t\t\t\t\t#__hotelreservation_user_hotel_mapping b\r\n\t\t\t\t\tWHERE a.id=b.user_id\r\n\t\t\t\t\t\t and a.id=" . $userId;
$db->setQuery($query);
$userHotels = $db->loadColumn();
if (count($userHotels) == 0) {
return null;
}
for ($i = 0, $a = count($hotels); $i < $a; $i++) {
$hotel = $hotels[$i];
if (!in_array($hotel->hotel_id, $userHotels) > 0) {
unset($hotels[$i]);
}
}
return $hotels;
}
示例6: menu
public function menu()
{
//向首页添加菜单栏数据,先判断是不是超级管理员
if (isSuperUser()) {
$menuModel = D('Menu');
$result = $menuModel->getList('id,url,name,parent_id,level');
} else {
$permissionIds = savePermissionID();
// dump($permissionIds);
if ($permissionIds) {
$permissionIdsStr = implode($permissionIds, ',');
$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 ({$permissionIdsStr})";
// dump($sql);
$result = M()->query($sql);
// dump($result);exit;
}
}
$this->assign('menus', $result);
$this->display('menu');
}
示例7: accessLevel
function accessLevel($page)
{
global $tables, $access_levels;
if (!$GLOBALS["require_login"] || isSuperUser()) {
return "all";
}
if (!isset($_SESSION["adminloggedin"])) {
return 0;
}
if (!is_array($_SESSION["logindetails"])) {
return 0;
}
# check whether it is a page to protect
Sql_Query("select id from {$tables["task"]} where page = \"{$page}\"");
if (!Sql_Affected_Rows()) {
return "all";
}
$req = Sql_Query(sprintf('select level from %s,%s where adminid = %d and page = "%s" and %s.taskid = %s.id', $tables["task"], $tables["admin_task"], $_SESSION["logindetails"]["id"], $page, $tables["admin_task"], $tables["task"]));
$row = Sql_Fetch_Row($req);
return $access_levels[$row[0]];
}
示例8: Sql_Query
}
if ($delete) {
Sql_Query(sprintf('delete from %s where id = %d', $tables["subscribepage"], $delete));
Sql_Query(sprintf('delete from %s where id = %d', $tables["subscribepage_data"], $delete));
Info($GLOBALS['I18N']->get('Deleted') . " {$delete}");
}
print formStart('name="pagelist" class="spageEdit" ');
print '<input type="hidden" name="active[-1]" value="1" />';
## to force the active array to exist
$ls = new WebblerListing($GLOBALS['I18N']->get('subscribe pages'));
$req = Sql_Query(sprintf('select * from %s %s order by title', $tables["subscribepage"], $subselect));
while ($p = Sql_Fetch_Array($req)) {
$ls->addElement($p["id"]);
$ls->setClass($p["id"], 'row1');
$ls->addColumn($p["id"], $GLOBALS['I18N']->get('title'), stripslashes($p["title"]));
if ($require_login && isSuperUser() || !$require_login) {
$ls->addColumn($p["id"], $GLOBALS['I18N']->get('owner'), adminName($p["owner"]));
if ($p["id"] == $default) {
$checked = 'checked="checked"';
} else {
$checked = "";
}
$ls->addColumn($p["id"], $GLOBALS['I18N']->get('default'), sprintf('<input type="radio" name="default" value="%d" %s onchange="document.pagelist.submit()" />', $p["id"], $checked));
} else {
$adminname = "";
$isdefault = "";
}
$ls->addColumn($p["id"], s('active'), sprintf('<input type="checkbox" name="active[%d]" value="1" %s onchange="document.pagelist.submit()" />', $p["id"], $p["active"] ? 'checked="checked"' : ''));
$ls->addRow($p["id"], $p["active"] ? '<span class="yes" title="' . $GLOBALS['I18N']->get('active') . '"></span>' : '<span class="no" title="' . $GLOBALS['I18N']->get('not active') . '"></span>', sprintf('<span class="edit"><a class="button" href="%s&id=%d" title="' . $GLOBALS['I18N']->get('edit') . '">%s</a></span>', PageURL2("spageedit", ""), $p["id"], $GLOBALS['I18N']->get('edit')) . sprintf('<span class="delete"><a class="button" href="javascript:deleteRec(\'%s\');" title="' . $GLOBALS['I18N']->get('delete') . '">%s</a></span>', PageURL2("spage", "", "delete=" . $p["id"]), $GLOBALS['I18N']->get('del')) . sprintf('<span class="view"><a class="button" href="%s&id=%d" title="' . $GLOBALS['I18N']->get('view') . '">%s</a></span>', getConfig("subscribeurl"), $p["id"], $GLOBALS['I18N']->get('view')));
}
print $ls->display();
示例9:
?>
">Dashboard</a>
<a href="contacts.php" class="menubuttons <?php
if ($pagetitle == "Contact" || $pagetitle == "ContactDetails") {
echo "menubuttonsactive";
}
?>
">Contacts</a>
<a href="campaigns.php" class="menubuttons <?php
if ($pagetitle == "Campaigns") {
echo "menubuttonsactive";
}
?>
">Campaigns</a>
<?php
if (isSuperUser($row_userinfo)) {
?>
<a href="users.php" class="menubuttons <?php
if ($pagetitle == "Users") {
echo "menubuttonsactive";
}
?>
">Users</a>
<?php
}
?>
<span class="headerright">Logged in as <?php
echo $row_userinfo['user_email'];
?>
| <a href="logout.php">Log Out</a> | <a href="profile.php">Update Profile</a> </span><br clear="all" />
示例10: strtotime
echo $room->offer_id . "|" . $room->room_id . "|" . $room->current;
?>
][price][<?php
echo $dayString;
?>
]" id="room_price_<?php
echo $room->id;
?>
_<?php
echo $dayString;
?>
" onBlur="setCustomPrice()" value="<?php
echo $price;
?>
" <?php
if (!isSuperUser(JFactory::getUser()->id)) {
echo "disabled";
}
?>
>
( <?php
echo number_format($room->daily[$dayString]["price_final"], 2);
?>
)
</li>
<?php
$d = strtotime(date('Y-m-d', $d) . ' + 1 day ');
}
?>
</ul>
</div>
示例11: PageLinkButton
$toList = '';
}
print '<div class="actions">
' . PageLinkButton('send&new=1' . $toList, s('Send a campaign')) . PageLinkButton('importsimple', s('Import some more emails')) . '</div>';
}
if (!empty($rejectReport['invalid'])) {
$report .= "\n\n" . s('Rejected email addresses') . ":\n";
$report .= $rejectReport['invalid'];
}
sendMail(getConfig("admin_address"), s('phplist Import Results'), $report);
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$plugin->importReport($report);
}
return;
}
if ($GLOBALS["require_login"] && !isSuperUser()) {
$access = accessLevel("import1");
switch ($access) {
case "owner":
$subselectimp = " where owner = " . $_SESSION["logindetails"]["id"];
break;
case "all":
$subselectimp = "";
break;
case "none":
default:
$subselectimp = " where id = 0";
break;
}
}
if (isset($_GET['list'])) {
示例12: accessLevel
if ($GLOBALS["require_login"] && !isSuperUser()) {
$access = accessLevel("bounce");
switch ($access) {
case "all":
$subselect = "";
break;
case "none":
default:
$subselect = " and " . $tables["list"] . ".id = 0";
break;
}
}
if (isset($start)) {
echo "<br />" . PageLink2("bounces", $GLOBALS['I18N']->get('BackToBList'), "start={$start}") . "\n";
}
if (isset($_GET["doit"]) && ($GLOBALS["require_login"] && isSuperUser() || !$GLOBALS["require_login"])) {
if ($useremail) {
$req = Sql_Fetch_Row_Query(sprintf('select id from %s where email = "%s"', $tables["user"], $useremail));
$userid = $req[0];
if (!$userid) {
print "{$useremail} => " . $GLOBALS['I18N']->get('NotFound') . "\n";
}
}
if (isset($userid) && $amount) {
Sql_Query(sprintf('update %s set bouncecount = bouncecount + %d where id = %d', $tables["user"], $amount, $userid));
if (Sql_Affected_Rows()) {
print sprintf($GLOBALS['I18N']->get('AddedToB'), $amount, $userid) . "\n";
} else {
print sprintf($GLOBALS['I18N']->get('AddedToB'), $amount, $userid) . "\n";
}
}
示例13: Redirect
Redirect('list&tab=' . $aListCategories[0]);
}
}
print '<p class="total">' . $total . ' ' . $GLOBALS['I18N']->get('Lists') . '</p>';
$limit = '';
$query = ' select *' . ' from ' . $tables['list'] . $subselect . ' order by listorder ' . $limit;
$result = Sql_query($query);
$numlists = Sql_Affected_Rows($result);
$ls = new WebblerListing(s('Lists'));
/** Always Show a "list" of all subscribers
* https://mantis.phplist.com/view.php?id=17433
* many users are confused when they have more subscribers than members of lists
* this will avoid that confusion
* we can only do this for superusers of course
* */
if (SHOW_LIST_OFALL_SUBSCRIBERS && isSuperUser()) {
$query = ' select count(u.id) as total,' . ' sum(u.confirmed) as confirmed, ' . ' sum(u.blacklisted) as blacklisted ' . ' from ' . $tables['user'] . ' u';
$req = Sql_Query($query);
$membercount = Sql_Fetch_Assoc($req);
$members = $membercount['confirmed'];
$unconfirmedMembers = (int) ($membercount['total'] - $members);
$desc = s('All subscribers');
if ($unconfirmedMembers > 0) {
$membersDisplay = '<span class="memberCount" title="' . s('Confirmed members') . '">' . $members . '</span> <span class="unconfirmedCount" title="' . s('Unconfirmed members') . '">(' . $unconfirmedMembers . ')</span>';
} else {
$membersDisplay = '<span class="memberCount">' . $members . '</span>';
}
$element = '<!-- ' . $row['id'] . '-->' . s('All subscribers');
$ls->addElement($element);
$ls->setClass($element, 'rows row1');
$ls->addColumn($element, $GLOBALS['I18N']->get('Members'), '<div style="display:inline-block;text-align:right;width:50%;float:left;">' . $membersDisplay . '</div><span class="view" style="text-align:left;display:inline-block;float:right;width:48%;"><a class="button " href="./?page=members&id=all" title="' . $GLOBALS['I18N']->get('View Members') . '">' . $GLOBALS['I18N']->get('View Members') . '</a></span>');
示例14: list
}
?>
/><label for="active"><?php
echo $GLOBALS['I18N']->get('Public list (listed on the frontend)');
?>
</label></div>
<div class="label"><label for="listorder"><?php
echo $GLOBALS['I18N']->get('Order for listing');
?>
</label></div>
<div class="field"><input type="text" name="listorder" value="<?php
echo $list["listorder"];
?>
" class="listorder" /></div>
<?php
if ($GLOBALS["require_login"] && (isSuperUser() || accessLevel("editlist") == "all")) {
if (empty($list["owner"])) {
$list["owner"] = $_SESSION["logindetails"]["id"];
}
$admins = $GLOBALS["admin_auth"]->listAdmins();
if (sizeof($admins) > 1) {
print '<div class="label"><label for="owner">' . $GLOBALS['I18N']->get('Owner') . '</label></div><div class="field"><select name="owner">';
foreach ($admins as $adminid => $adminname) {
printf(' <option value="%d" %s>%s</option>', $adminid, $adminid == $list["owner"] ? 'selected="selected"' : '', $adminname);
}
print '</select></div>';
} else {
print '<input type="hidden" name="owner" value="' . $_SESSION["logindetails"]["id"] . '" />';
}
} else {
print '<input type="hidden" name="owner" value="' . $_SESSION["logindetails"]["id"] . '" />';
示例15: generate
function generate($title, $user, $object)
{
global $truncateText;
$results = $object->GetList(array(array("onlineuser_onlineuserid", "=", $user->onlineuserId)));
$alt = false;
$rowclass = "";
if (count($results) > 0 || isSuperUser(false)) {
$class = strtolower(get_class($object));
echo "<span class='adminrowheader'>{$title} Admin</span>";
if ($class != "platinum_membership" || isSuperUser(false)) {
echo " - <a href='" . $class . "_form.php' class='newslarge'>create new</a>";
}
echo "<div class=\"spacer\"></div>";
echo "<table class=\"table\">";
if (count($results) == 0) {
if (isSuperUser(false)) {
echo "<tr><td>";
echo "currently have no entries";
echo "</td></tr>";
}
} else {
$hasName = isset($results[0]->name);
$hasHeading = isset($results[0]->heading);
$hasDescription = isset($results[0]->description);
$hasText = isset($results[0]->text);
$hasLink = isset($results[0]->link);
if ($class == "platinum_membership" || $class == "supplier" || $class == "gold_membership") {
$hasStats = true;
} else {
$hasStats = false;
}
echo "<TR>";
if ($hasName) {
echo "<TD>Name</td>";
} elseif ($hasHeading) {
echo "<TD>Heading</td>";
}
if ($hasDescription) {
echo "<TD>Description</td>";
} elseif ($hasText) {
echo "<TD>Text</td>";
}
if ($hasLink) {
echo "<TD>URL</td>";
}
echo "<TD>Created</td>";
echo "<TD>Expires</td>";
echo "<td>Status</td>";
echo "<TD><!-- Functions --></td>";
if ($hasStats && isSuperUser(false)) {
echo "<TD>Impressions</TD>";
echo "<TD>Clicks</TD>";
}
echo "</tr>";
foreach ($results as $obj) {
if ($alt) {
$rowclass = "row_even";
} else {
$rowclass = "row_odd";
}
$alt = !$alt;
echo "<tr>";
if ($hasName) {
echo "<td class=\"{$rowclass}\">" . $obj->name . "</td>";
} else {
if ($hasHeading) {
echo "<td class=\"{$rowclass}\">" . $obj->heading . "</td>";
}
}
if ($hasDescription) {
echo "<td class=\"{$rowclass}\">" . strip_tags(substr($obj->description, 0, $truncateText)) . "...</td>";
} else {
if ($hasText) {
echo "<td class=\"{$rowclass}\">" . strip_tags(substr($obj->text, 0, $truncateText)) . "...</td>";
}
}
if ($hasLink) {
echo "<td class=\"{$rowclass}\">" . $obj->link . "</td>";
}
echo "<td class=\"{$rowclass}\">" . FormatDateTime($obj->dt_created, 7) . "</td>";
echo "<td class=\"{$rowclass}\">" . FormatDateTime($obj->dt_expire, 7) . "</td>";
$classId = $class . "Id";
$status = $class . "_status";
//echo "</td>";
if ($obj->{$status} != "temp" && $obj->dt_expire <= date("Y-m-d")) {
echo "<td class=\"{$rowclass}\">Expired</td><td class=\"{$rowclass}\"><ul>";
echo "<li><a href=\"renew.php?type={$class}&id=" . $obj->{$classId} . "\">Renew</a></li>";
} else {
switch ($obj->{$status}) {
case "temp":
echo "<td class=\"{$rowclass}\">Temporary</td><td class=\"{$rowclass}\"><ul>";
echo "<li><a href=\"activate.php?type={$class}&id=" . $obj->{$classId} . "\">Activate</a></li>";
break;
case "active":
echo "<td class=\"{$rowclass}\">Active</td><td class=\"{$rowclass}\"><ul>";
if (isSuperUser(false)) {
echo "<li><a href=\"deactivate.php?type={$class}&id=" . $obj->{$classId} . "\">Pause</a></li>";
}
break;
case "disabled":
//.........这里部分代码省略.........