当前位置: 首页>>代码示例>>PHP>>正文


PHP cmsCore::getBackURL方法代码示例

本文整理汇总了PHP中cmsCore::getBackURL方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::getBackURL方法的具体用法?PHP cmsCore::getBackURL怎么用?PHP cmsCore::getBackURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmsCore的用法示例。


在下文中一共展示了cmsCore::getBackURL方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mod_auth

function mod_auth($mod, $cfg)
{
    $inUser = cmsUser::getInstance();
    if ($inUser->id) {
        return false;
    }
    cmsUser::sessionPut('auth_back_url', cmsCore::getBackURL());
    cmsPage::initTemplate('modules', $cfg['tpl'])->assign('cfg', $cfg)->display($cfg['tpl']);
    return true;
}
开发者ID:deltas1,项目名称:icms1,代码行数:10,代码来源:module.php

示例2: users

function users()
{
    header('X-Frame-Options: DENY');
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    global $_LANG;
    $model = new cms_model_users();
    // id пользователя
    $id = cmsCore::request('id', 'int', 0);
    // логин пользователя
    $login = cmsCore::strClear(urldecode(cmsCore::request('login', 'html', '')));
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $pagetitle = $inCore->getComponentTitle();
    if ($model->config['sw_search'] != 2) {
        $inPage->addPathway($pagetitle, '/users');
    }
    $inPage->setTitle($pagetitle);
    $inPage->setDescription($pagetitle);
    // js только авторизованным
    if ($inUser->id) {
        $inPage->addHeadJS('components/users/js/profile.js');
        $inPage->addHeadJsLang(array('CONFIRM_CLEAN_CAT', 'CHOOSE_RECIPIENT', 'SEND_TO_USER', 'FRIENDSHIP_OFFER', 'STOP_FRIENDLY', 'REALY_STOP_FRIENDLY', 'ENTER_STATUS', 'HAVE_JUST'));
    }
    //============================================================================//
    //========================= Список пользователей  ============================//
    //============================================================================//
    if ($do == 'view') {
        // если запрещен просмотр всех пользователей, 404
        if ($model->config['sw_search'] == 2) {
            cmsCore::error404();
        }
        //очищаем поисковые запросы если пришли со другой страницы
        if (!strstr(cmsCore::getBackURL(), '/users')) {
            cmsUser::sessionClearAll();
        }
        $stext = array();
        // Возможные входные переменные
        $name = cmsCore::getSearchVar('name');
        $city = cmsCore::getSearchVar('city');
        $hobby = cmsCore::getSearchVar('hobby');
        $gender = cmsCore::getSearchVar('gender');
        $orderby = cmsCore::request('orderby', array('karma', 'rating', 'regdate'), 'regdate');
        $orderto = cmsCore::request('orderto', array('asc', 'desc'), 'desc');
        $age_to = (int) cmsCore::getSearchVar('ageto', 'all');
        $age_fr = (int) cmsCore::getSearchVar('agefrom', 'all');
        $group_id = cmsCore::request('group_id', 'int', 0);
        // Флаг о показе только онлайн пользователей
        if (cmsCore::inRequest('online')) {
            cmsUser::sessionPut('usr_online', (bool) cmsCore::request('online', 'int'));
            $page = 1;
        }
        $only_online = cmsUser::sessionGet('usr_online');
        if ($only_online) {
            $stext[] = $_LANG['SHOWING_ONLY_ONLINE'];
        }
        ///////////////////////////////////////
        //////////Условия выборки//////////////
        ///////////////////////////////////////
        // группа
        if ($group_id) {
            $model->whereUserGroupIs($group_id);
            $link['group'] = '/users/group/' . $group_id;
            $_LANG['GROUP_SEARCH_NAME'] = cmsUser::getGroupTitle($group_id);
        }
        // Добавляем в выборку имя, если оно есть
        if ($name) {
            $model->whereNameIs($name);
            $stext[] = $_LANG['NAME'] . " — " . htmlspecialchars(stripslashes($name));
        }
        // Добавляем в выборку город, если он есть
        if ($city) {
            $model->whereCityIs($city);
            $stext[] = $_LANG['CITY'] . " — " . htmlspecialchars(stripslashes($city));
        }
        // Добавляем в выборку хобби, если есть
        if ($hobby) {
            $model->whereHobbyIs($hobby);
            $stext[] = $_LANG['HOBBY'] . " — " . htmlspecialchars(stripslashes($hobby));
        }
        // Добавляем в выборку пол, если есть
        if ($gender) {
            $model->whereGenderIs($gender);
            if ($gender == 'm') {
                $stext[] = $_LANG['MALE'];
            } else {
                $stext[] = $_LANG['FEMALE'];
            }
        }
        // Добавляем в выборку возраст, более
        if ($age_fr) {
            $model->whereAgeFrom($age_fr);
            $stext[] = $_LANG['NOT_YOUNG'] . " {$age_fr} " . $_LANG['YEARS'];
        }
        // Добавляем в выборку возраст, менее
        if ($age_to) {
            $model->whereAgeTo($age_to);
            $stext[] = $_LANG['NOT_OLD'] . " {$age_fr} " . $_LANG['YEARS'];
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例3: applet_userbanlist

function applet_userbanlist()
{
    $inCore = cmsCore::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/users', $adminAccess)) {
        cpAccessDenied();
    }
    $GLOBALS['cp_page_title'] = $_LANG['AD_BANLIST'];
    cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
    cpAddPathway($_LANG['AD_BANLIST'], 'index.php?view=userbanlist');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    $to = cmsCore::request('to', 'int', 0);
    // для редиректа обратно в профиль на сайт
    if ($to) {
        cmsUser::sessionPut('back_url', cmsCore::getBackURL());
    }
    if ($do == 'list') {
        $toolmenu[] = array('icon' => 'useradd.gif', 'title' => $_LANG['AD_TO_BANLIST_ADD'], 'link' => '?view=userbanlist&do=add');
        $toolmenu[] = array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=edit&multiple=1');");
        $toolmenu[] = array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=delete&multiple=1');");
        cpToolMenu($toolmenu);
        $fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
        $fields[] = array('title' => $_LANG['AD_IS_ACTIVE'], 'field' => 'status', 'width' => '55', 'prc' => 'cpYesNo');
        $fields[] = array('title' => $_LANG['AD_BANLIST_USER'], 'field' => 'user_id', 'width' => '120', 'filter' => '12', 'prc' => 'cpUserNick');
        $fields[] = array('title' => $_LANG['AD_BANLIST_IP'], 'field' => 'ip', 'width' => '100', 'link' => '?view=userbanlist&do=edit&id=%id%', 'filter' => '12');
        $fields[] = array('title' => $_LANG['DATE'], 'field' => 'bandate', 'width' => '', 'fdate' => '%d/%m/%Y %H:%i:%s', 'filter' => '12');
        $fields[] = array('title' => $_LANG['AD_BANLIST_TIME'], 'field' => 'int_num', 'width' => '55');
        $fields[] = array('title' => '', 'field' => 'int_period', 'width' => '70');
        $fields[] = array('title' => $_LANG['AD_AUTOREMOVE'], 'field' => 'autodelete', 'width' => '90', 'prc' => 'cpYesNo');
        $actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=userbanlist&do=edit&id=%id%');
        $actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_RULE'], 'link' => '?view=userbanlist&do=delete&id=%id%');
        cpListTable('cms_banlist', $fields, $actions, '1=1', 'ip DESC');
    }
    if ($do == 'delete') {
        if (!isset($_REQUEST['item'])) {
            if ($id >= 0) {
                dbDelete('cms_banlist', $id);
            }
        } else {
            dbDeleteList('cms_banlist', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::redirect('?view=userbanlist');
    }
    if ($do == 'submit' || $do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $types = array('user_id' => array('user_id', 'int', 0), 'ip' => array('ip', 'str', ''), 'cause' => array('cause', 'str', ''), 'autodelete' => array('autodelete', 'int', 0), 'int_num' => array('int_num', 'int', 0), 'int_period' => array('int_period', 'str', '', create_function('$p', 'if(!in_array($p, array("MONTH","DAY","HOUR","MINUTE"))){ $p = "MINUTE"; } return $p;')));
        $items = cmsCore::getArrayFromRequest($types);
        $error = false;
        if (!$items['ip']) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_NEED_IP'], 'error');
        }
        if ($items['ip'] == $_SERVER['REMOTE_ADDR'] || $items['user_id'] == $inUser->id) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_YOUR_IP'], 'error');
        }
        if (cmsUser::userIsAdmin($items['user_id'])) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_ADMIN'], 'error');
        }
        if ($error) {
            cmsCore::redirectBack();
        }
        if ($do == 'update') {
            $inDB->update('cms_banlist', $items, $id);
            if (empty($_SESSION['editlist'])) {
                cmsCore::redirect('?view=userbanlist');
            } else {
                cmsCore::redirect('?view=userbanlist&do=edit');
            }
        }
        $inDB->insert('cms_banlist', $items);
        $back_url = cmsUser::sessionGet('back_url');
        cmsUser::sessionDel('back_url');
        cmsCore::redirect($back_url ? $back_url : '?view=userbanlist');
    }
    if ($do == 'add' || $do == 'edit') {
        $GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="/admin/js/banlist.js"></script>';
        $toolmenu[] = array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();');
        $toolmenu[] = array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);');
        cpToolMenu($toolmenu);
        if ($do == 'add') {
            echo '<h3>' . $_LANG['AD_TO_BANLIST_ADD'] . '</h3>';
            cpAddPathway($_LANG['AD_TO_BANLIST_ADD']);
        } else {
            if (isset($_REQUEST['multiple'])) {
                if (isset($_REQUEST['item'])) {
                    $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
                } else {
                    cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
                    cmsCore::redirectBack();
                }
            }
            $ostatok = '';
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:userbanlist.php

示例4: registration


//.........这里部分代码省略.........
            }
        }
        $correct_invite = cmsUser::sessionGet('invite_code') ? true : false;
        if ($model->config['reg_type'] == 'invite' && cmsCore::inRequest('invite_code')) {
            $invite_code = cmsCore::request('invite_code', 'str', '');
            $correct_invite = $users_model->checkInvite($invite_code);
            if ($correct_invite) {
                cmsUser::sessionPut('invite_code', $invite_code);
            } else {
                cmsCore::addSessionMessage($_LANG['INCORRECT_INVITE'], 'error');
            }
        }
        $item = cmsUser::sessionGet('item');
        if ($item) {
            cmsUser::sessionDel('item');
        }
        if (empty($item['birthdate'])) {
            $item['birthdate'] = date('Y-m-d');
        }
        $private_forms = array();
        if (isset($users_model->config['privforms'])) {
            if (is_array($users_model->config['privforms'])) {
                foreach ($users_model->config['privforms'] as $form_id) {
                    $private_forms = array_merge($private_forms, cmsForm::getFieldsHtml($form_id, array(), true));
                }
            }
        }
        cmsPage::initTemplate('components', 'com_registration')->assign('cfg', $model->config)->assign('item', $item)->assign('pagetitle', $pagetitle)->assign('correct_invite', $correct_invite)->assign('private_forms', $private_forms)->display('com_registration.tpl');
    }
    //============================================================================//
    if ($do == 'activate') {
        $code = cmsCore::request('code', 'str', '');
        if (!$code) {
            cmsCore::error404();
        }
        $user_id = $inDB->get_field('cms_users_activate', "code = '{$code}'", 'user_id');
        if (!$user_id) {
            cmsCore::error404();
        }
        $inDB->query("UPDATE cms_users SET is_locked = 0 WHERE id = '{$user_id}'");
        $inDB->query("DELETE FROM cms_users_activate WHERE code = '{$code}'");
        cmsCore::callEvent('USER_ACTIVATED', $user_id);
        if ($model->config['send_greetmsg']) {
            $model->sendGreetsMessage($user_id);
        }
        // Регистрируем событие
        cmsActions::log('add_user', array('object' => '', 'user_id' => $user_id, 'object_url' => '', 'object_id' => $user_id, 'target' => '', 'target_url' => '', 'target_id' => 0, 'description' => ''));
        cmsCore::addSessionMessage($_LANG['ACTIVATION_COMPLETE'], 'info');
        cmsUser::goToLogin();
    }
    //============================================================================//
    if ($do == 'auth') {
        //====================//
        //==  разлогивание  ==//
        if (cmsCore::inRequest('logout')) {
            $inUser->logout();
            cmsCore::redirect('/');
        }
        //====================//
        //==  авторизация  ==//
        if (!cmsCore::inRequest('logout')) {
            // флаг неуспешных авторизаций
            $anti_brute_force = cmsUser::sessionGet('anti_brute_force');
            $login = cmsCore::request('login', 'str', '');
            $passw = cmsCore::request('pass', 'str', '');
            $remember_pass = cmsCore::inRequest('remember');
            // если нет логина или пароля, показываем форму входа
            if (!$login || !$passw) {
                if ($inUser->id && !$inUser->is_admin) {
                    cmsCore::redirect('/');
                }
                $inPage->setTitle($_LANG['SITE_LOGIN']);
                $inPage->addPathway($_LANG['SITE_LOGIN']);
                cmsPage::initTemplate('components', 'com_registration_login')->assign('cfg', $model->config)->assign('anti_brute_force', $anti_brute_force)->assign('is_sess_back', cmsUser::sessionGet('auth_back_url'))->display('com_registration_login.tpl');
                if (!mb_strstr(cmsCore::getBackURL(), 'login')) {
                    cmsUser::sessionPut('auth_back_url', cmsCore::getBackURL());
                }
                return;
            }
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }
            // Проверяем каптчу
            if ($anti_brute_force && !cmsPage::checkCaptchaCode()) {
                cmsCore::addSessionMessage($_LANG['ERR_CAPTCHA'], 'error');
                cmsCore::redirect('/login');
            }
            cmsUser::sessionDel('anti_brute_force');
            $back_url = $inUser->signInUser($login, $passw, $remember_pass);
            cmsCore::redirect($back_url);
        }
    }
    //============================================================================//
    if ($do == 'autherror') {
        cmsUser::sessionPut('anti_brute_force', 1);
        cmsPage::includeTemplateFile('special/autherror.php');
        cmsCore::halt();
    }
    //============================================================================//
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:101,代码来源:frontend.php

示例5: signInUser

 /**
  * Авторизует пользователя
  * возвращает url для редиректа
  * @param str $login
  * @param str $passw
  * @param int $remember_pass
  * @return srt $back_url
  */
 public function signInUser($login = '', $passw = '', $remember_pass = 1, $pass_in_md5 = 0)
 {
     if ($this->id) {
         return cmsCore::getBackURL();
     }
     $default_back_url = '/auth/error.html';
     if (!$login || !$passw) {
         return $default_back_url;
     }
     $inDB = cmsDatabase::getInstance();
     $inCore = cmsCore::getInstance();
     // Авторизация по логину или e-mail
     if (!preg_match("/^([a-z0-9\\._-]+)@([a-z0-9\\._-]+)\\.([a-z]{2,4})\$/ui", $login)) {
         $where_login = "u.login = '{$login}'";
     } else {
         $where_login = "u.email = '{$login}'";
     }
     $where_pass = $pass_in_md5 ? "u.password = '{$passw}'" : "u.password = md5('{$passw}')";
     // Проверяем локальную пару логин + пароль
     $user = $this->loadUser(0, "{$where_login} AND {$where_pass}");
     // иначе пытаемся авторизоваться через плагины
     if (!$user) {
         $user = cmsCore::callEvent('SIGNIN_USER', array('login' => $login, 'pass' => $passw));
     }
     if (!$user) {
         return $default_back_url;
     }
     $_SESSION['user'] = $user;
     cmsCore::callEvent('USER_LOGIN', $_SESSION['user']);
     if ($remember_pass) {
         $cookie_code = md5($user['id'] . $user['password'] . PATH);
         cmsCore::setCookie('userid', $cookie_code, time() + 2592000);
     }
     // Флаг первой авторизации
     $first_time_auth = !$user['is_logged_once'];
     // обновляем дату последнего визита, ip
     self::setUserLogdate($user['id']);
     $inDB->query("UPDATE cms_users SET last_ip = '{$this->ip}', is_logged_once = 1 WHERE id = '{$user['id']}'");
     // помечаем, что пользователь онлайн
     $inDB->query("UPDATE cms_online SET user_id = '{$user['id']}' WHERE sess_id = '" . session_id() . "'");
     //////////////  юзер уже авторизован //////////////////////////
     // Формируем url редиректа после авторизации
     // Получаем настройки что делать после авторизации
     $cfg = $inCore->loadComponentConfig('registration');
     // Получаем URL, предыдущий перед формой логина
     $auth_back_url = cmsUser::sessionGet('auth_back_url');
     $auth_back_url = $auth_back_url ? $auth_back_url : cmsCore::getBackURL();
     if (strpos($auth_back_url, $_SERVER['HTTP_HOST']) === false || strpos($auth_back_url, '/auth/') !== false) {
         $auth_back_url = '/';
     }
     cmsUser::sessionDel('auth_back_url');
     // Авторизация в админку
     if ($_SESSION['user']['is_admin'] && cmsCore::inRequest('is_admin')) {
         return '/admin/';
     }
     // Остальные пользователи
     if ($_SESSION['user']['id']) {
         if ($first_time_auth) {
             $cfg['auth_redirect'] = $cfg['first_auth_redirect'];
         }
         switch ($cfg['auth_redirect']) {
             case 'none':
                 $url = $auth_back_url;
                 break;
             case 'index':
                 $url = '/';
                 break;
             case 'profile':
                 $url = cmsUser::getProfileURL($user['login']);
                 break;
             case 'editprofile':
                 $url = '/users/' . $user['id'] . '/editprofile.html';
                 break;
         }
         return $url;
     }
     return $default_back_url;
 }
开发者ID:vicktorwork,项目名称:cms1,代码行数:86,代码来源:user.class.php

示例6: applet_userbanlist

function applet_userbanlist()
{
    $inCore = cmsCore::getInstance();
    global $_LANG;
    global $adminAccess;
    if (!cmsUser::isAdminCan('admin/users', $adminAccess)) {
        cpAccessDenied();
    }
    cmsCore::c('page')->setTitle($_LANG['AD_BANLIST']);
    cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
    cpAddPathway($_LANG['AD_BANLIST'], 'index.php?view=userbanlist');
    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    $to = cmsCore::request('to', 'int', 0);
    // для редиректа обратно в профиль на сайт
    if ($to) {
        cmsUser::sessionPut('back_url', cmsCore::getBackURL());
    }
    if ($do == 'list') {
        $toolmenu = array(array('icon' => 'useradd.gif', 'title' => $_LANG['AD_TO_BANLIST_ADD'], 'link' => '?view=userbanlist&do=add'), array('icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=edit&multiple=1');"), array('icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=delete&multiple=1');"));
        cpToolMenu($toolmenu);
        $fields = array(array('title' => 'id', 'field' => 'id', 'width' => '40'), array('title' => $_LANG['AD_IS_ACTIVE'], 'field' => 'status', 'width' => '65', 'prc' => 'cpYesNo'), array('title' => $_LANG['AD_BANLIST_USER'], 'field' => 'user_id', 'width' => '120', 'filter' => '12', 'prc' => 'cpUserNick'), array('title' => $_LANG['AD_BANLIST_IP'], 'field' => 'ip', 'width' => '100', 'link' => '?view=userbanlist&do=edit&id=%id%', 'filter' => '12'), array('title' => $_LANG['DATE'], 'field' => 'bandate', 'width' => '', 'fdate' => '%d/%m/%Y %H:%i:%s', 'filter' => '12'), array('title' => $_LANG['AD_BANLIST_TIME'], 'field' => 'int_num', 'width' => '55'), array('title' => '', 'field' => 'int_period', 'width' => '70'), array('title' => $_LANG['AD_AUTOREMOVE'], 'field' => 'autodelete', 'width' => '100', 'prc' => 'cpYesNo'));
        $actions = array(array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=userbanlist&do=edit&id=%id%'), array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_RULE'], 'link' => '?view=userbanlist&do=delete&id=%id%'));
        cpListTable('cms_banlist', $fields, $actions, '1=1', 'ip DESC');
    }
    if ($do == 'delete') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) {
                dbDelete('cms_banlist', $id);
            }
        } else {
            dbDeleteList('cms_banlist', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::redirect('?view=userbanlist');
    }
    if ($do == 'submit' || $do == 'update') {
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        $types = array('user_id' => array('user_id', 'int', 0), 'ip' => array('ip', 'str', ''), 'cause' => array('cause', 'str', ''), 'autodelete' => array('autodelete', 'int', 0), 'int_num' => array('int_num', 'int', 0), 'int_period' => array('int_period', 'str', '', create_function('$p', 'if(!in_array($p, array("MONTH","DAY","HOUR","MINUTE"))){ $p = "MINUTE"; } return $p;')));
        $items = cmsCore::getArrayFromRequest($types);
        $error = false;
        if (!$items['ip']) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_NEED_IP'], 'error');
        }
        if ($items['ip'] == $_SERVER['REMOTE_ADDR'] || $items['user_id'] == cmsCore::c('user')->id) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_YOUR_IP'], 'error');
        }
        if (cmsUser::userIsAdmin($items['user_id'])) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_ADMIN'], 'error');
        }
        if ($error) {
            cmsCore::redirectBack();
        }
        if ($do == 'update') {
            cmsCore::c('db')->update('cms_banlist', $items, $id);
            if (empty($_SESSION['editlist'])) {
                cmsCore::redirect('?view=userbanlist');
            } else {
                cmsCore::redirect('?view=userbanlist&do=edit');
            }
        }
        cmsCore::c('db')->insert('cms_banlist', $items);
        $back_url = cmsUser::sessionGet('back_url');
        cmsUser::sessionDel('back_url');
        cmsCore::redirect($back_url ? $back_url : '?view=userbanlist');
    }
    if ($do == 'add' || $do == 'edit') {
        cmsCore::c('page')->addHeadJS('admin/js/banlist.js');
        $toolmenu = array(array('icon' => 'save.gif', 'title' => $_LANG['SAVE'], 'link' => 'javascript:document.addform.submit();'), array('icon' => 'cancel.gif', 'title' => $_LANG['CANCEL'], 'link' => 'javascript:history.go(-1);'));
        cpToolMenu($toolmenu);
        if ($do == 'add') {
            echo '<h3>' . $_LANG['AD_TO_BANLIST_ADD'] . '</h3>';
            cpAddPathway($_LANG['AD_TO_BANLIST_ADD']);
        } else {
            if (cmsCore::inRequest('multiple')) {
                if (cmsCore::inRequest('item')) {
                    $_SESSION['editlist'] = cmsCore::request('item', 'array_int', array());
                } else {
                    cmsCore::addSessionMessage($_LANG['AD_NO_SELECT_OBJECTS'], 'error');
                    cmsCore::redirectBack();
                }
            }
            $ostatok = '';
            if (isset($_SESSION['editlist'])) {
                $item_id = array_shift($_SESSION['editlist']);
                if (count($_SESSION['editlist']) == 0) {
                    unset($_SESSION['editlist']);
                } else {
                    $ostatok = '(' . $_LANG['AD_NEXT_IN'] . count($_SESSION['editlist']) . ')';
                }
            } else {
                $item_id = cmsCore::request('id', 'int', 0);
            }
            $mod = cmsCore::c('db')->get_fields('cms_banlist', "id = '" . $item_id . "'", '*');
            if (!$mod) {
                cmsCore::error404();
//.........这里部分代码省略.........
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:101,代码来源:userbanlist.php

示例7: applet_userbanlist

function applet_userbanlist() {
    $inCore = cmsCore::getInstance();
    
    global $_LANG;
    global $adminAccess;
    
    if (!cmsUser::isAdminCan('admin/users', $adminAccess)) { cpAccessDenied(); }

    cmsCore::c('page')->setTitle($_LANG['AD_BANLIST']);
    cpAddPathway($_LANG['AD_USERS'], 'index.php?view=users');
    cpAddPathway($_LANG['AD_BANLIST'], 'index.php?view=userbanlist');

    $do = cmsCore::request('do', 'str', 'list');
    $id = cmsCore::request('id', 'int', -1);
    $to = cmsCore::request('to', 'int', 0);
    
    // для редиректа обратно в профиль на сайт
    if ($to) {
        cmsUser::sessionPut('back_url', cmsCore::getBackURL());
    }

    if ($do == 'list') {
        $toolmenu = array(
            array( 'icon' => 'useradd.gif', 'title' => $_LANG['AD_TO_BANLIST_ADD'], 'link' => '?view=userbanlist&do=add' ),
            array( 'icon' => 'edit.gif', 'title' => $_LANG['AD_EDIT_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=edit&multiple=1');" ),
            array( 'icon' => 'delete.gif', 'title' => $_LANG['AD_DELETE_SELECTED'], 'link' => "javascript:checkSel('?view=userbanlist&do=delete&multiple=1');" )
        );

        cpToolMenu($toolmenu);

        $fields = array(
            array( 'title' => 'id', 'field' => 'id', 'width' => '40' ),
            array( 'title' => $_LANG['AD_IS_ACTIVE'], 'field' => 'status', 'width' => '65', 'prc' => 'cpYesNo' ),
            array( 'title' => $_LANG['AD_BANLIST_USER'], 'field' => 'user_id', 'width' => '120', 'filter' => '12', 'prc' => 'cpUserNick' ),
            array( 'title' => $_LANG['AD_BANLIST_IP'], 'field' => 'ip', 'width' => '100', 'link' => '?view=userbanlist&do=edit&id=%id%', 'filter' => '12' ),
            array( 'title' => $_LANG['DATE'], 'field' => 'bandate', 'width' => '', 'fdate' => '%d/%m/%Y %H:%i:%s', 'filter' => '12' ),
            array( 'title' => $_LANG['AD_BANLIST_TIME'], 'field' => 'int_num', 'width' => '55' ),
            array( 'title' => '', 'field' => 'int_period', 'width' => '70' ),
            array( 'title' => $_LANG['AD_AUTOREMOVE'], 'field' => 'autodelete', 'width' => '100', 'prc' => 'cpYesNo' )
        );
        
        $actions = array(
            array( 'title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=userbanlist&do=edit&id=%id%' ),
            array( 'title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_REMOVE_RULE'], 'link' => '?view=userbanlist&do=delete&id=%id%' )
        );

        cpListTable('cms_banlist', $fields, $actions, '1=1', 'ip DESC');
    }

    if ($do == 'delete') {
        if (!cmsCore::inRequest('item')) {
            if ($id >= 0) { dbDelete('cms_banlist', $id); }
        } else {
            dbDeleteList('cms_banlist', cmsCore::request('item', 'array_int', array()));
        }
        cmsCore::redirect('?view=userbanlist');
    }

    if ($do == 'submit' || $do == 'update') {
        if (!cmsUser::checkCsrfToken()) { cmsCore::error404(); }

        $types = array(
            'user_id' => array( 'user_id', 'int', 0 ),
            'ip' => array( 'ip', 'str', '' ),
            'cause' => array( 'cause', 'str', '' ),
            'autodelete' => array( 'autodelete', 'int', 0 ),
            'int_num' => array( 'int_num', 'int', 0 ),
            'int_period' => array( 'int_period', 'str', '', create_function('$p', 'if(!in_array($p, array("MONTH","DAY","HOUR","MINUTE"))){ $p = "MINUTE"; } return $p;') )
        );

        $items = cmsCore::getArrayFromRequest($types);

        $error = false;

        if (!$items['ip']) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_NEED_IP'], 'error');
        }
        
        if ($items['ip'] == $_SERVER['REMOTE_ADDR'] ||
            $items['user_id'] == cmsCore::c('user')->id) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_YOUR_IP'], 'error');
        }

        if (cmsUser::userIsAdmin($items['user_id'])) {
            $error = true;
            cmsCore::addSessionMessage($_LANG['AD_ITS_ADMIN'], 'error');
        }

        if ($error) {
            cmsCore::redirectBack();
        }

        if ($do == 'update') {
            cmsCore::c('db')->update('cms_banlist', $items, $id);

            if (empty($_SESSION['editlist'])) {
                cmsCore::redirect('?view=userbanlist');
            } else {
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:userbanlist.php


注:本文中的cmsCore::getBackURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。