當前位置: 首頁>>代碼示例>>PHP>>正文


PHP cmsUser::getAdminAccess方法代碼示例

本文整理匯總了PHP中cmsUser::getAdminAccess方法的典型用法代碼示例。如果您正苦於以下問題:PHP cmsUser::getAdminAccess方法的具體用法?PHP cmsUser::getAdminAccess怎麽用?PHP cmsUser::getAdminAccess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cmsUser的用法示例。


在下文中一共展示了cmsUser::getAdminAccess方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: users


//.........這裏部分代碼省略.........
        foreach ($awards as $aw) {
            //Перебираем все награды и ищем пользователей с текущей наградой
            $sql = "SELECT u.id as id, u.nickname as nickname, u.login as login, IFNULL(p.gender, 'm') as gender\r\n                 FROM cms_user_awards aw\r\n                 LEFT JOIN cms_users u ON u.id = aw.user_id\r\n                 LEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n                 WHERE aw.award_id = '{$aw['id']}'";
            $rs = $inDB->query($sql);
            $aw['uhtml'] = '';
            if ($inDB->num_rows($rs)) {
                while ($user = $inDB->fetch_assoc($rs)) {
                    $aw['uhtml'] .= cmsUser::getGenderLink($user['id'], $user['nickname'], $user['gender'], $user['login']) . ', ';
                }
                $aw['uhtml'] = rtrim($aw['uhtml'], ', ');
            } else {
                $aw['uhtml'] = $_LANG['NOT_USERS_WITH_THIS_AWARD'];
            }
            $aws[] = $aw;
        }
        cmsPage::initTemplate('components', 'com_users_awards_site')->assign('aws', $aws)->display('com_users_awards_site.tpl');
    }
    //============================================================================//
    //============================= Удаление профиля  ============================//
    //============================================================================//
    if ($do == 'delprofile') {
        // неавторизованным тут делать нечего
        if (!$inUser->id) {
            cmsCore::error404();
        }
        // есть ли удаляемый профиль
        $data = cmsUser::getShortUserData($id);
        if (!$data) {
            cmsCore::error404();
        }
        // владелец профиля или админ
        if ($inUser->is_admin) {
            // могут ли администраторы удалять профиль
            if (!cmsUser::isAdminCan('admin/users', cmsUser::getAdminAccess())) {
                cmsCore::error404();
            }
            // администратор сам себя не удалит
            if ($inUser->id == $data['id']) {
                cmsCore::error404();
            }
        } else {
            // удаляем только свой профиль
            if ($inUser->id != $data['id']) {
                cmsCore::error404();
            }
        }
        if (isset($_POST['csrf_token'])) {
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }
            $model->deleteUser($id);
            if (!$inUser->is_admin) {
                session_destroy();
                cmsCore::redirect('/logout');
            } else {
                cmsCore::addSessionMessage($_LANG['DELETING_PROFILE_OK'], 'info');
                cmsCore::redirect('/users');
            }
        } else {
            $inPage->setTitle($_LANG['DELETING_PROFILE']);
            $inPage->addPathway($data['nickname'], $inUser->getProfileURL($data['login']));
            $inPage->addPathway($_LANG['DELETING_PROFILE']);
            $confirm['title'] = $_LANG['DELETING_PROFILE'];
            $confirm['text'] = '<p>' . $_LANG['REALLY_DEL_PROFILE'] . '</p>';
            $confirm['action'] = '/users/' . $id . '/delprofile.html';
            $confirm['yes_button'] = array();
開發者ID:deltas1,項目名稱:icms1,代碼行數:67,代碼來源:frontend.php

示例2: array

if (!cmsCore::c('user')->update()) {
    cmsCore::error404();
}

// проверяем доступ по Ip
if (!cmsCore::checkAccessByIp(cmsCore::c('config')->allow_ip)) { cmsCore::error404(); }

cmsCore::loadLanguage('admin/lang');
global $_LANG;

//-------CHECK AUTHENTICATION--------------------------------------//
if (!cmsCore::c('user')->is_admin && cmsAdmin::getApplet() != 'login') {
    cmsCore::redirect('/admin/index.php?view=login');
}

//--------LOAD ACCESS OPTIONS LIST---------------------------------//

$adminAccess = cmsUser::getAdminAccess();

//------------------------------------------------------------------//

cmsCore::c('user')->onlineStats();
cmsCore::c('page')->setTitle();

$GLOBALS['cp_page_title'] = '';
$GLOBALS['cp_page_head']  = array();

cpProceedBody();

cmsCore::c('page')->showTemplate();
開發者ID:Acsac,項目名稱:CMS-RuDi,代碼行數:30,代碼來源:index.php


注:本文中的cmsUser::getAdminAccess方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。