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


PHP cmsUser::sessionPut方法代码示例

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


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

function cpGetTicketCats()
{
    $cats = cmsUser::sessionGet('ticket_cat');
    if (empty($cats)) {
        $result = cmsCore::c('db')->query('SELECT id,title FROM cms_ticket_cat');
        $cats = array(0 => array('id' => 0, 'title' => 'CMS RuDi'));
        while ($cat = cmsCore::c('db')->fetch_assoc($result)) {
            $cats[$cat['id']] = array('id' => $cat['id'], 'title' => $cat['title']);
        }
        cmsUser::sessionPut('ticket_cat', $cats);
    }
    return $cats;
}
开发者ID:CMS-RuDi,项目名称:CMS-RuDi,代码行数:13,代码来源:tickets.php

示例3: applet_users


//.........这里部分代码省略.........
        if ($items['password'] && $items['pass2'] && $items['password'] != $items['pass2']) {
            cmsCore::addSessionMessage($_LANG['WRONG_PASS'], 'error');
            $errors = true;
        }

        // никнейм
        if (mb_strlen($items['nickname']) < 2) {
            cmsCore::addSessionMessage($_LANG['SHORT_NICKNAME'], 'error');
            $errors = true;
        }
        
        // Проверяем email
        if (!$items['email']) {
            cmsCore::addSessionMessage($_LANG['ERR_EMAIL'], 'error');
            $errors = true;
        }

        // проверяем есть ли такой пользователь
        if ($do == 'submit') {
            $user_exist = cmsCore::c('db')->get_fields('cms_users', "(login LIKE '". $items['login'] ."' OR email LIKE '". $items['email'] ."') AND is_deleted = 0", 'login');
            if ($user_exist) {
                if ($user_exist['login'] == $items['login']) {
                    cmsCore::addSessionMessage($_LANG['LOGIN'] .' "'. $items['login'] .'" '. $_LANG['IS_BUSY'], 'error');
                    $errors = true;
                } else {
                    cmsCore::addSessionMessage($_LANG['EMAIL_IS_BUSY'], 'error');
                    $errors = true;
                }
            }
        }

        if ($errors) {
            if ($do == 'submit') {
                cmsUser::sessionPut('items', $items);
            }
            cmsCore::redirectBack();
        }

        if ($do == 'submit') {
            $items['regdate']  = date('Y-m-d H:i:s');
            $items['logdate']  = date('Y-m-d H:i:s');
            $items['password'] = md5($items['password']);

            $items['user_id'] = cmsCore::c('db')->insert('cms_users', $items);
            if (!$items['user_id']) { cmsCore::error404(); }

            cmsCore::c('db')->insert('cms_user_profiles', $items);

            cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
            cmsCore::redirect('?view=users');
        } else {
            // главного админа может редактировать только он сам
            if ($id == 1 && cmsCore::c('user')->id != $id) {
                cmsCore::error404();
            }
            
            if ($id == 1) {
                unset($items['group_id']);
                unset($items['is_locked']);
            }

            if (!$items['password']) {
                unset($items['password']);
            } else {
                $items['password'] = md5($items['password']);
            }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:users.php

示例4: clubs


//.........这里部分代码省略.........

    // Проверяем ограничения на количество участников
    if ($club['maxsize'] && ($model->club_total_members >= $club['maxsize']) && !$inUser->is_admin){
        cmsCore::jsonOutput(array('error' => true, 'text'  => $_LANG['CLUB_SIZE_LIMIT']));
    }
    // Проверяем ограничения по карме на вступление
    if($club['join_karma_limit'] && ($inUser->karma < $club['join_min_karma']) && !$inUser->is_admin){

        cmsCore::jsonOutput(array('error' => true, 'text'  => '<p><strong>'.$_LANG['NEED_KARMA_TEXT'].'</strong></p><p>'.$_LANG['NEEDED'].' '.$club['join_min_karma'].', '.$_LANG['HAVE_ONLY'].' '.$inUser->karma.'.</p><p>'.$_LANG['WANT_SEE'].' <a href="/users/'.$inUser->id.'/karma.html">'.$_LANG['HISTORY_YOUR_KARMA'].'</a>?</p>'));

    }

    //
    // Обработка заявки
    //
    if (cmsCore::inRequest('confirm')){

		cmsCore::callEvent('JOIN_CLUB', $club);

        //списываем оплату если клуб платный
        if (IS_BILLING && $club['is_vip'] && $club['join_cost'] && !$inUser->is_admin){
            if ($inUser->balance >= $club['join_cost']){
                //если средств на балансе хватает
                cmsBilling::pay($inUser->id, $club['join_cost'], sprintf($_LANG['VIP_CLUB_BUY_JOIN'], $club['title']));
            } else {
                //недостаточно средств, создаем тикет
                //и отправляем оплачивать
                $billing_ticket = array(
                    'action' => sprintf($_LANG['VIP_CLUB_BUY_JOIN'], $club['title']),
                    'cost'   => $club['join_cost'],
                    'amount' => $club['join_cost'] - $inUser->balance,
                    'url'    => $_SERVER['REQUEST_URI'].'?confirm=1'
                );
                cmsUser::sessionPut('billing_ticket', $billing_ticket);
				cmsCore::jsonOutput(array('error' => false, 'redirect'  => '/billing/pay'));
            }
        }

        //добавляем пользователя в клуб
        $model->addUserToClub($club['id'], $inUser->id);
		// Пересчитываем рейтинг клуба
        $model->setClubRating($club['id']);
		// Кешируем (пересчитываем) количество участников
		$model->setClubMembersCount($club['id']);

		//регистрируем событие
		cmsActions::log('add_club_user', array(
						'object' => $club['title'],
						'object_url' => '/clubs/'.$club['id'],
						'object_id' => $club['id'],
						'target' => '',
						'target_url' => '',
						'target_id' => 0,
						'description' => ''
		));

		cmsCore::addSessionMessage($_LANG['YOU_JOIN_CLUB'].'"'.$club['title'].'"', 'success');

		if($_SERVER['REQUEST_URI'] != '/clubs/'.$club['id'].'/join.html'){
			cmsCore::redirect('/clubs/'.$club['id']);
		} else {
	        cmsCore::jsonOutput(array('error' => false, 'redirect'  => '/clubs/'.$club['id']));
		}

    }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:66,代码来源:frontend.php

示例5: foreach

            $model->deletePhoto($photo_id);
        }
        $album_has_photos = $inDB->rows_count('cms_user_photos', "album_id = {$album_id}", 1);
        if ($album_has_photos) {
            cmsCore::redirectBack();
        } else {
            $model->deletePhotoAlbum($id, $album_id);
            cmsCore::redirect(cmsUser::getProfileURL($usr['login']));
        }
    }
    if (cmsCore::inRequest('edit')) {
        foreach ($photo_ids as $photo_id) {
            $photos[] = $photo_id;
        }
        if ($photos) {
            cmsUser::sessionPut('photos_list', $photos);
        }
        cmsCore::redirect('/users/' . $usr['login'] . '/photos/submit-edit');
    }
}
//============================================================================//
//============================ Все фотографии ================================//
//============================================================================//
if ($pdo == 'viewphotos') {
    if (!$inUser->id && !$model->config['sw_guest']) {
        cmsUser::goToLogin();
    }
    $usr = cmsUser::getShortUserData($id);
    if (!$usr) {
        cmsCore::error404();
    }
开发者ID:vicktorwork,项目名称:cms1,代码行数:31,代码来源:photos.php

示例6: content


//.........这里部分代码省略.........
            $article['content'] = cmsCore::request('content', 'html', '');
            $article['description'] = cmsCore::badTagClear($article['description']);
            $article['content'] = cmsCore::badTagClear($article['content']);
            $article['published'] = $is_auto_add ? 1 : 0;
            if ($do == 'editarticle') {
                $article['published'] = $item['published'] == 0 ? $item['published'] : $article['published'];
            }
            $article['pubdate'] = $do == 'editarticle' ? $item['pubdate'] : date('Y-m-d H:i');
            $article['enddate'] = $do == 'editarticle' ? $item['enddate'] : $article['pubdate'];
            $article['is_end'] = $do == 'editarticle' ? $item['is_end'] : 0;
            $article['showtitle'] = $do == 'editarticle' ? $item['showtitle'] : 1;
            $article['meta_desc'] = $do == 'addarticle' ? mb_strtolower($article['title']) : $inDB->escape_string($item['meta_desc']);
            $article['meta_keys'] = $do == 'addarticle' ? $inCore->getKeywords($article['content']) : $inDB->escape_string($item['meta_keys']);
            $article['showdate'] = $do == 'editarticle' ? $item['showdate'] : 1;
            $article['showlatest'] = $do == 'editarticle' ? $item['showlatest'] : 1;
            $article['showpath'] = $do == 'editarticle' ? $item['showpath'] : 1;
            $article['comments'] = $do == 'editarticle' ? $item['comments'] : 1;
            $article['canrate'] = $do == 'editarticle' ? $item['canrate'] : 1;
            $article['pagetitle'] = '';
            if ($do == 'editarticle') {
                $article['tpl'] = $item['tpl'];
            }
            if (mb_strlen($article['title']) < 2) {
                cmsCore::addSessionMessage($_LANG['REQ_TITLE'], 'error');
                $errors = true;
            }
            if (mb_strlen($article['content']) < 10) {
                cmsCore::addSessionMessage($_LANG['REQ_CONTENT'], 'error');
                $errors = true;
            }
            if ($errors) {
                // При добавлении статьи при ошибках сохраняем введенные поля
                if ($do == 'addarticle') {
                    cmsUser::sessionPut('article', $article);
                }
                cmsCore::redirectBack();
            }
            $article['description'] = $inDB->escape_string($article['description']);
            $article['content'] = $inDB->escape_string($article['content']);
            $article = cmsCore::callEvent('AFTER_EDIT_ARTICLE', $article);
            // добавление статьи
            if ($do == 'addarticle') {
                $article_id = $model->addArticle($article);
            }
            // загрузка фото
            $file = 'article' . (@$article_id ? $article_id : $item['id']) . '.jpg';
            if (cmsCore::request('delete_image', 'int', 0)) {
                @unlink(PATH . "/images/photos/small/{$file}");
                @unlink(PATH . "/images/photos/medium/{$file}");
            }
            // Загружаем класс загрузки фото
            cmsCore::loadClass('upload_photo');
            $inUploadPhoto = cmsUploadPhoto::getInstance();
            // Выставляем конфигурационные параметры
            $inUploadPhoto->upload_dir = PATH . '/images/photos/';
            $inUploadPhoto->small_size_w = $model->config['img_small_w'];
            $inUploadPhoto->medium_size_w = $model->config['img_big_w'];
            $inUploadPhoto->thumbsqr = $model->config['img_sqr'];
            $inUploadPhoto->is_watermark = $model->config['watermark'];
            $inUploadPhoto->input_name = 'picture';
            $inUploadPhoto->filename = $file;
            // Процесс загрузки фото
            $inUploadPhoto->uploadPhoto();
            // операции после добавления/редактирования статьи
            // добавление статьи
            if ($do == 'addarticle') {
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例7: blog


//.........这里部分代码省略.........
            $smarty->assign('bb_toolbar', $bb_toolbar);
            $smarty->assign('smilies', $smilies);
            $smarty->assign('is_admin', $inUser->is_admin);
            $smarty->assign('myblog', $myblog);
            $smarty->assign('user_can_iscomments', cmsUser::isUserCan('comments/iscomments'));
            $smarty->assign('autocomplete_js', $autocomplete_js);
            $smarty->display('com_blog_edit_post.tpl');
        }
        //Если есть запрос на сохранение
        if (cmsCore::inRequest('goadd')) {
            $error = false;
            //Получаем параметры
            $mod['title'] = cmsCore::request('title', 'str');
            $mod['content'] = cmsCore::request('content', 'html');
            $mod['feel'] = cmsCore::request('feel', 'str', '');
            $mod['music'] = cmsCore::request('music', 'str', '');
            $mod['cat_id'] = cmsCore::request('cat_id', 'int');
            $mod['allow_who'] = cmsCore::request('allow_who', 'str', $blog['allow_who']);
            $mod['tags'] = cmsCore::request('tags', 'str', '');
            $mod['comments'] = cmsCore::request('comments', 'int', 1);
            $mod['published'] = $myblog || !$blog['premod'] ? 1 : 0;
            $mod['blog_id'] = $blog['id'];
            //Проверяем их
            if (mb_strlen($mod['title']) < 2) {
                cmsCore::addSessionMessage($_LANG['POST_ERR_TITLE'], 'error');
                $errors = true;
            }
            if (mb_strlen($mod['content']) < 5) {
                cmsCore::addSessionMessage($_LANG['POST_ERR_TEXT'], 'error');
                $errors = true;
            }
            // Если есть ошибки, возвращаемся назад
            if ($errors) {
                cmsUser::sessionPut('mod', $mod);
                cmsCore::redirectBack();
            }
            //Если нет ошибок
            //добавляем новый пост...
            if ($do == 'newpost') {
                if (IS_BILLING) {
                    cmsBilling::process('blogs', 'add_post');
                }
                $mod['pubdate'] = date('Y-m-d H:i:s');
                $mod['user_id'] = $inUser->id;
                // добавляем пост, получая его id и seolink
                $added = $inBlog->addPost($mod);
                if ($mod['published']) {
                    if ($blog['allow_who'] != 'nobody' && $mod['allow_who'] != 'nobody') {
                        cmsActions::log('add_post', array('object' => $mod['title'], 'object_url' => $model->getPostURL('', $added['seolink']), 'object_id' => $added['id'], 'target' => $blog['title'], 'target_url' => $model->getBlogURL(), 'target_id' => $blog['id'], 'description' => '', 'is_friends_only' => (int) ($blog['allow_who'] == 'friends' || $mod['allow_who'] == 'friends')));
                    }
                    cmsCore::addSessionMessage($_LANG['POST_CREATED'], 'success');
                    cmsCore::redirect($model->getPostURL('', $added['seolink']));
                }
                if (!$mod['published']) {
                    $message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_POST_SUBMIT']);
                    $message = str_replace('%post%', '<a href="' . $model->getPostURL('', $added['seolink']) . '">' . $mod['title'] . '</a>', $message);
                    $message = str_replace('%blog%', '<a href="' . $model->getBlogURL() . '">' . $blog['title'] . '</a>', $message);
                    cmsUser::sendMessage(USER_UPDATER, $blog['user_id'], $message);
                    cmsCore::addSessionMessage($_LANG['POST_PREMODER_TEXT'], 'info');
                    cmsCore::redirect($model->getBlogURL());
                }
            }
            //...или сохраняем пост после редактирования
            if ($do == 'editpost') {
                if ($model->config['update_date']) {
                    $mod['pubdate'] = date('Y-m-d H:i:s');
开发者ID:4uva4ek,项目名称:svato,代码行数:67,代码来源:frontend.php

示例8: 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'] . " &mdash; " . htmlspecialchars(stripslashes($name));
        }
        // Добавляем в выборку город, если он есть
        if ($city) {
            $model->whereCityIs($city);
            $stext[] = $_LANG['CITY'] . " &mdash; " . htmlspecialchars(stripslashes($city));
        }
        // Добавляем в выборку хобби, если есть
        if ($hobby) {
            $model->whereHobbyIs($hobby);
            $stext[] = $_LANG['HOBBY'] . " &mdash; " . 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

示例9: 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

示例10: search

function search() {
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB   = cmsDatabase::getInstance();

    global $_LANG;

    $model = cms_model_search::initModel();

    $do = $inCore->do;

    $pagetitle = $inCore->getComponentTitle();

    $inPage->setTitle($pagetitle);
    $inPage->addPathway($pagetitle, '/search');

/* ==================================================================================================== */
/* ==================================================================================================== */
    if ($do == 'view') {
        if (mb_strlen($model->query) <= 3 && mb_strlen($model->query) >= 1) {
            cmsCore::addSessionMessage($_LANG['ERROR'] .': '. $_LANG['SHORT_QUERY'], 'error');
            $inCore->redirect('/search');
        }

        if ($model->query) {
            $inPage->addPathway($model->query);

            // если параметры запроса изменились
            // делаем полный поиск, заполняя кеш
            // иначе берем из кеша результаты
            if (!$model->isChangedParams()) {
                // Удаляем записи поиска от текущей сессии
                $model->deleteResultsFromThisSession();

                // Готовим поиск
                // выполняется поиск по индексу фултекст
                if (!$model->prepareSearch()) { cmsCore::error404(); }

                // Кладем в сессию текущие параметры запроса
                cmsUser::sessionPut('query_params', $model->parametrs_array);
                // кладем в сессию слова запроса
                cmsUser::sessionPut('searchquery', $model->words);
            }

            // формируем условия выборки
            $model->whereSessionIs(session_id());
            $model->wherePeriodIs();
            if ($model->order_by_date) {
                cmsCore::c('db')->orderBy('pubdate', 'DESC');
            } else {
                cmsCore::c('db')->orderBy('id', 'ASC');
            }

            // Получаем общее количество результатов
            $total = $model->getCountResults();

            // Получаем сами результаты поиска
            if ($total) {
                $results = $model->getResults();
            } else {
                cmsCore::c('db')->resetConditions();
            }
        }

        cmsPage::initTemplate('components', 'com_search_text')->
            assign('query', $model->query)->
            assign('look', $model->look)->
            assign('order_by_date', $model->order_by_date)->
            assign('from_pubdate', $model->from_pubdate)->
            assign('results', $results)->
            assign('total', $total)->
            assign('enable_components', $model->getEnableComponentsWithSupportSearch())->
            assign('from_component', $model->from_component)->
            assign('external_link', str_replace('%q%', urlencode($model->query), $_LANG['FIND_EXTERNAL_URL']))->
            assign('host', HOST)->
            assign('pagebar', cmsPage::getPagebar($total, $model->page, $model->config['perpage'], 'javascript:paginator(%page%)'))->
            display();
    }

/* ==================================================================================================== */
/* ==================================================================================================== */
    if ($do == 'tag') {
        if (mb_strlen($model->query) <= 3 && mb_strlen($model->query) >= 1) {
            cmsCore::addSessionMessage($_LANG['EMPTY_QUERY'], 'error');
            $inCore->redirect('/search');
        }

        $inPage->setTitle($_LANG['SEARCH_BY_TAG'] .' "'. $model->query .'"');

        if ($model->query) {
            $inPage->addPathway($_LANG['SEARCH_BY_TAG'] .' "'. $model->query .'"');
        }
        $inPage->initAutocomplete();

        $total = $model->getCountTags();

        $results = $model->searchByTag();

        cmsPage::initTemplate('components', 'com_search_tag')->
        assign('query', $model->query)->
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:frontend.php

示例11: board


//.........这里部分代码省略.........
        if (!cmsCore::m('board')->config['srok']){ $pubdays = isset(cmsCore::m('board')->config['pubdays']) ? cmsCore::m('board')->config['pubdays'] : 14; }

        // Проверяем значения
        if (!$title) {
            cmsCore::addSessionMessage($_LANG['NEED_TITLE'], 'error');
            $errors = true;
        }
        if (!$content) {
            cmsCore::addSessionMessage($_LANG['NEED_TEXT_ADV'], 'error');
            $errors = true;
        }
        if (!$city) {
            cmsCore::addSessionMessage($_LANG['NEED_CITY'], 'error');
            $errors = true;
        }
        if (!cmsCore::c('user')->id && !cmsCore::checkCaptchaCode()) {
            cmsCore::addSessionMessage($_LANG['ERR_CAPTCHA'], 'error');
            $errors = true;
        }

        // Проверяем значения формы
        foreach ($form_input['errors'] as $field_error) {
            if ($field_error) {
                cmsCore::addSessionMessage($field_error, 'error');
                $errors = true;
            }
        }

        if ($errors) {
            $item['content'] = htmlspecialchars(stripslashes($_REQUEST['content']));
            $item['city']    = stripslashes($city);
            $item['title']   = stripslashes($title);
            $item['obtype']  = $obtype;
            cmsUser::sessionPut('item', $item);
            cmsCore::redirect('/board/'. cmsCore::m('board')->category_id .'/add.html');
        }

        if ($cat['is_photos']) {
            // Загружаем фото
            $file = cmsCore::m('board')->uploadPhoto('', $cat);
        } else {
            $file['filename'] = '';
            cmsCore::addSessionMessage($_LANG['INFO_CAT_NO_PHOTO'], 'info');
        }
        
        
        $add = array(
            'category_id' => cmsCore::m('board')->category_id,
            'user_id'     => cmsCore::c('user')->id,
            'obtype'      => $obtype,
            'title'       => $title,
            'content'     => $content,
            'formsdata'   => $formsdata,
            'city'        => $city,
            'pubdays'     => $pubdays,
            'published'   => $published,
            'pagetitle'   => $pagetitle,
            'meta_keys'   => $meta_keys,
            'meta_desc'   => $meta_desc,
            'file'        => $file['filename']
        );
        $add['id'] = cmsCore::m('board')->addRecord($add);

        if (cmsCore::c('user')->is_admin && $vipdays) {
            cmsCore::m('board')->setVip($add['id'], $vipdays);
        }
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php

示例12: forum


//.........这里部分代码省略.........
        }
        /////////////////////////
        ///  Показываем форму ///
        /////////////////////////
        if (!cmsCore::inRequest('gosend')) {
            $inPage->setTitle($pagetitle);
            $inPage->addPathway($pagetitle);
            $inPage->addHeadJsLang(array('FILE_SELECTED', 'FILE_DENIED', 'FILE_DUPLICATE'));
            cmsCore::initAutoGrowText('#message');
            cmsPage::initTemplate('components', 'com_forum_add')->assign('pagetitle', $pagetitle)->assign('is_first_post', isset($last_post['id']) ? $first_post_id == $last_post['id'] : true)->assign('thread_poll', $thread_poll)->assign('cfg', $model->config)->assign('do', $do)->assign('forum', isset($forum) ? $forum : $pcat)->assign('is_subscribed', cmsUser::isSubscribed($inUser->id, 'forum', @$thread['id']))->assign('thread', $thread)->assign('post_content', htmlspecialchars($last_post['content']))->assign('is_moder', $is_forum_moder)->assign('is_admin', $inUser->is_admin)->assign('is_allow_attach', cmsCore::checkContentAccess($model->config['group_access']) && $is_allow_attach)->assign('bb_toolbar', cmsPage::getBBCodeToolbar('message', $model->config['img_on'], 'forum', 'post', @$last_post['id']))->assign('smilies', cmsPage::getSmilesPanel('message'))->display('com_forum_add.tpl');
        } else {
            /////////////////////////
            // Выполняем действия ///
            /////////////////////////
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }
            $message_bb = $inDB->escape_string(cmsCore::request('message', 'html', ''));
            $message_html = $inDB->escape_string(cmsCore::parseSmiles(cmsCore::request('message', 'html', ''), true));
            if (!$message_html) {
                cmsCore::addSessionMessage($_LANG['NEED_TEXT_POST'], 'error');
                cmsCore::redirectBack();
            }
            $message_post = strip_tags($message_html);
            $message_post = mb_strlen($message_post) > 200 ? mb_substr($message_post, 0, 200) : $message_post;
            $post_pinned = 0;
            if (in_array($do, array('newthread', 'newpost'))) {
                if ($do == 'newthread') {
                    $thread['title'] = cmsCore::request('title', 'str', '');
                    $thread['description'] = cmsCore::request('description', 'str', '');
                    $post_pinned = 1;
                    if (!$thread['title']) {
                        cmsCore::addSessionMessage($_LANG['NEED_TITLE_THREAD_YOUR_POST'], 'error');
                        cmsUser::sessionPut('thread', $thread);
                        cmsUser::sessionPut('post_content', stripcslashes($message_bb));
                        cmsCore::redirectBack();
                    }
                    $thread['is_hidden'] = cmsCore::yamlToArray($forum['access_list']) ? 1 : 0;
                    $thread['forum_id'] = $forum['id'];
                    $thread['user_id'] = $inUser->id;
                    $thread['pubdate'] = date("Y-m-d H:i:s");
                    $thread['hits'] = 0;
                    $thread['id'] = $model->addThread($thread);
                    $thread['NSLeft'] = $forum['NSLeft'];
                    $thread['NSRight'] = $forum['NSRight'];
                    $thread['post_count'] = 0;
                    if (IS_BILLING && $forum['topic_cost']) {
                        cmsBilling::process('forum', 'add_thread', $forum['topic_cost']);
                    }
                }
                $post_id = $model->addPost(array('thread_id' => $thread['id'], 'user_id' => $inUser->id, 'pinned' => $post_pinned, 'content' => $message_bb, 'content_html' => $message_html, 'pubdate' => date("Y-m-d H:i:s"), 'editdate' => date("Y-m-d H:i:s")));
                // Обновляем количество постов в теме
                $thread_post_count = $model->updateThreadPostCount($thread['id']);
                // Закрываем тему если нужно
                $is_fixed = cmsCore::request('fixed', 'int', 0);
                if ($is_fixed && ($is_forum_moder || $inUser->is_admin || $thread['is_mythread'])) {
                    $model->closeThread($thread['id']);
                }
                // Загружаем аттачи
                if ($model->config['fa_on'] && cmsCore::checkContentAccess($model->config['group_access'])) {
                    $file_error = $model->addUpdatePostAttachments($post_id);
                    if ($file_error === false) {
                        cmsCore::addSessionMessage($_LANG['CHECK_SIZE_TYPE_FILE'] . $model->config['fa_max'], 'error');
                    }
                }
                // Обновляем кеши
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例13: getFieldsInputValues

 /**
  * Проверяет значения формы
  * @param int $form_id ID формы
  * @return array
  */
 public static function getFieldsInputValues($form_id)
 {
     // Получаем данные без mysqli_real_escape_string
     $form_array = cmsCore::request('field', 'array');
     if (!$form_array) {
         return array();
     }
     $formObj = new self($form_id, $form_array);
     if (!$formObj->form || !$formObj->form_fields) {
         return array();
     }
     global $_LANG;
     $inUser = cmsUser::getInstance();
     $output = array();
     // Заполняем выходной массив значений
     // $output['values'] массив значений полей
     // $output['errors'] массив ошибок полей
     foreach ($formObj->form_fields as $field) {
         // Значение поля
         $field_value = array_key_exists($field['id'], $formObj->values) ? $formObj->values[$field['id']] : '';
         $error = '';
         // проверяем заполненность текстового поля если нужно
         if ($field['mustbe'] && !$field_value && $field['kind'] != 'file') {
             $error = $_LANG['FIELD'] . ' "' . $field['title'] . '" ' . $_LANG['MUST_BE_FILLED'];
         } else {
             cmsUser::sessionPut('form_last_' . $formObj->form_id . '_' . $field['id'], htmlspecialchars($field_value));
         }
         // Загружаем файл если он есть в форме
         if ($field['kind'] == 'file') {
             // старые значения если есть
             $old_url = $field_value['url'];
             $old_name = $field_value['name'];
             $output['values'][$field['id']] = array();
             if (!$_FILES['field']['name'][$field['id']]) {
                 // Поле обязательно для заполнения?
                 if ($field['mustbe'] && !$old_url) {
                     $error = $_LANG['FIELD'] . ' "' . $field['title'] . '" ' . $_LANG['MUST_BE_FILLED'];
                 } else {
                     // если пришел флаг на удаление
                     if (isset($field_value['delete'])) {
                         $formObj->deleteFile($old_url);
                         $old_url = '';
                         $old_name = '';
                     }
                     $output['values'][$field['id']] = array('name' => $old_name, 'url' => $old_url);
                 }
             } else {
                 // директория загрузки
                 $upload_dir = PATH . '/upload/forms/' . $form_id . '/' . $inUser->id;
                 @mkdir($upload_dir, 0777, true);
                 @chmod($upload_dir, 0777);
                 // проверяем расширение файла
                 $maytypes = explode(',', $field['config']['ext']);
                 $ext = mb_strtolower(pathinfo($_FILES['field']['name'][$field['id']], PATHINFO_EXTENSION));
                 if (!in_array($ext, $maytypes)) {
                     $error = $_LANG['ERROR_TYPE_FILE'] . $field['config']['ext'];
                 }
                 // имя файла
                 $file_name = cmsCore::strToURL(pathinfo($_FILES['field']['name'][$field['id']], PATHINFO_FILENAME));
                 $dest = $upload_dir . '/' . $file_name . uniqid() . '.' . $ext;
                 if (!$error) {
                     if (!cmsCore::moveUploadedFile($_FILES['field']['tmp_name'][$field['id']], $dest, $_FILES['field']['error'][$field['id']])) {
                         $error = cmsCore::uploadError();
                     } else {
                         $formObj->deleteFile($old_url);
                         $output['values'][$field['id']] = array('name' => $file_name, 'url' => str_replace(PATH, '', $dest));
                     }
                 }
             }
         } else {
             // Заполняем массив значений полей, ключи массива id поля
             $output['values'][$field['id']] = $field['config']['max'] ? mb_substr(strip_tags($field_value), 0, $field['config']['max']) : strip_tags($field_value);
         }
         // Заполняем массив ошибок
         $output['errors'][$field['id']] = $error;
     }
     // если были ошибки, удаляем загруженный файл, если он есть
     if (!empty($dest)) {
         foreach ($output['errors'] as $field_error) {
             if ($field_error) {
                 @unlink($dest);
                 break;
             }
         }
     }
     return $output;
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:92,代码来源:form.class.php

示例14: getOrder

 public function getOrder($order = '', $default = '')
 {
     if ($order == 'orderby') {
         $valid = array('title', 'user_id', 'obtype', 'hits', 'pubdate');
     } else {
         $valid = array('desc', 'asc');
     }
     if (cmsCore::inRequest($order)) {
         $orders = cmsCore::request($order, $valid, $default);
         cmsUser::sessionPut('ad_' . $order, $orders);
     } elseif (cmsUser::sessionGet('ad_' . $order)) {
         $orders = cmsUser::sessionGet('ad_' . $order);
     } else {
         $orders = $default;
     }
     return $orders ? $orders : $default;
 }
开发者ID:deltas1,项目名称:icms1,代码行数:17,代码来源:model.php

示例15: catalog


//.........这里部分代码省略.........
        $path_list = $model->getCategoryPath($cat['NSLeft'], $cat['NSRight']);
        if ($path_list){
            foreach($path_list as $pcat){
                $inPage->addPathway($pcat['title'], '/catalog/'.$pcat['id']);
            }
        }
        $inPage->setTitle($cat['pagetitle'] ? $cat['pagetitle'] : $cat['title']);

        //subcategories
        $subcats = subCatsList($cat['id'], $cat['NSLeft'], $cat['NSRight']);

        //alphabetic list
        if ($cat['showabc']){ $alphabet = getAlphaList($cat['id']);	} else { $alphabet = ''; }

        //Tool links
        $shopcartlink = shopCartLink();

        //get items SQL
        if (!isset($findsql)){
            $sql = "SELECT i.* , IFNULL(AVG( r.points ), 0) AS rating, i.price as price
                    FROM cms_uc_items i
                    LEFT JOIN cms_uc_ratings r ON r.item_id = i.id
                    WHERE i.published = 1 AND i.category_id = $id
                    GROUP BY i.id";
        } else {
            $sql = $findsql;
            if (!$advsearch){ $inPage->addPathway(icms_ucfirst($query)); } else
            { $inPage->addPathway($_LANG['SEARCH_RESULT']); }
        }

        // сортировка
        if(cmsCore::inRequest('orderby')){
            $orderby = cmsCore::request('orderby', array('hits','rating','pubdate','title','price'), $cat['orderby']);
            cmsUser::sessionPut('uc_orderby', $orderby);
        } elseif(cmsUser::sessionGet('uc_orderby')){
            $orderby = cmsUser::sessionGet('uc_orderby');
        } else {
            $orderby = $cat['orderby'];
        }
        if(cmsCore::inRequest('orderto')){
            $orderto = cmsCore::request('orderto', array('asc','desc'), $cat['orderto']);
            cmsUser::sessionPut('uc_orderto', $orderto);
        } elseif(cmsUser::sessionGet('uc_orderto')){
            $orderto = cmsUser::sessionGet('uc_orderto');
        } else {
            $orderto = $cat['orderto'];
        }

        $sql .=  " ORDER BY ".$orderby." ".$orderto;

        //get total items count
        $result = $inDB->query($sql);
        $itemscount = $inDB->num_rows($result);

        //can user add items here?
        $is_cat_access = $model->checkCategoryAccess($cat['id'], $cat['is_public'], $inUser->group_id);
        $is_can_add = $is_cat_access || $inUser->is_admin;

        $tpl = cmsPage::initTemplate('components', 'com_catalog_view')->
                assign('id', $id)->
                assign('cat', $cat)->
                assign('subcats', $subcats)->
                assign('alphabet', $alphabet)->
                assign('shopcartlink', $shopcartlink)->
                assign('itemscount', $itemscount)->
                assign('is_can_add', $is_can_add)->
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php


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