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


PHP cmsUser::getShortUserData方法代码示例

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


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

示例1: sendActivationNotice

 public function sendActivationNotice($send_pass, $user_id)
 {
     global $_LANG;
     $user = cmsUser::getShortUserData($user_id);
     if (!$user_id) {
         return false;
     }
     $user['password'] = $send_pass;
     $code = md5($user['email'] . uniqid() . '-' . microtime());
     $codelink = HOST . '/activate/' . $code;
     $sql = "INSERT cms_users_activate (pubdate, user_id, code)\r\n                VALUES (NOW(), '{$user['id']}', '{$code}')";
     $this->inDB->query($sql);
     $letter = cmsCore::getLanguageTextFile('activation');
     foreach ($user as $key => $value) {
         $letter = str_replace('{' . $key . '}', $value, $letter);
     }
     $letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
     $letter = str_replace('{codelink}', $codelink, $letter);
     return cmsCore::mailText($user['email'], $_LANG['ACTIVATION_ACCOUNT'] . ' - ' . cmsConfig::getConfig('sitename'), $letter);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:20,代码来源:model.php

示例2: header

    }
    if ($file['user_id'] != $inUser->id && $file['allow_who'] != 'all' && !$inUser->is_admin) {
        $inCore->halt($_LANG['FILE_HIDEN']);
    }
    $inDB->query("UPDATE cms_user_files SET hits = hits + 1 WHERE id = {$file_id}");
    header('Content-Disposition: attachment; filename=' . basename($fileurl) . "\n");
    header('Content-Type: application/x-force-download; name="' . $fileurl . '"' . "\n");
    header('Location:' . $fileurl);
    cmsCore::halt();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($fdo == 'addfile') {
    if (!$inUser->id) {
        cmsUser::goToLogin();
    }
    $usr = cmsUser::getShortUserData($inUser->id);
    if (!$usr) {
        cmsCore::error404();
    }
    $free_mb = $model->config['filessize'] ? round($model->config['filessize'] - round($model->getUserFilesSize($usr['id']) / 1024 / 1024, 2), 2) : '';
    if (cmsCore::inRequest('upload')) {
        $size_mb = 0;
        $loaded_files = array();
        $list_files = array();
        foreach ($_FILES['upfile'] as $key => $value) {
            foreach ($value as $k => $v) {
                $list_files['upfile' . $k][$key] = $v;
            }
        }
        foreach ($list_files as $key => $data_array) {
            if ($data_array['error'] != UPLOAD_ERR_OK) {
开发者ID:deltas1,项目名称:icms1,代码行数:31,代码来源:files.php

示例3: users


//.........这里部分代码省略.........
        $usr['comments_count'] = $model->config['sw_comm'] ? $inDB->rows_count('cms_comments', "user_id='{$usr['id']}' AND published=1") : 0;
        $usr['forum_count'] = $model->config['sw_forum'] ? $inDB->rows_count('cms_forum_posts', "user_id = '{$usr['id']}'") : 0;
        $usr['files_count'] = $model->config['sw_files'] ? $inDB->rows_count('cms_user_files', "user_id = '{$usr['id']}'") : 0;
        $cfg_reg = $inCore->loadComponentConfig('registration');
        $usr['invites_count'] = $inUser->id && $myprofile && $cfg_reg['reg_type'] == 'invite' ? $model->getUserInvitesCount($inUser->id) : 0;
        $usr['blog'] = $model->config['sw_blogs'] ? $inDB->get_fields('cms_blogs', "user_id = '{$usr['id']}' AND owner = 'user'", 'title, seolink') : false;
        $usr['form_fields'] = array();
        if (is_array($model->config['privforms'])) {
            foreach ($model->config['privforms'] as $form_id) {
                $usr['form_fields'] = array_merge($usr['form_fields'], cmsForm::getFieldsValues($form_id, $usr['formsdata']));
            }
        }
        if ($usr['city']) {
            cmsCore::loadModel('geo');
            $geo = new cms_model_geo();
            $city_parents = $geo->getCityParents($usr['city']);
            if ($city_parents) {
                $usr['country'] = $city_parents['country_name'];
            }
        }
        $plugins = $model->getPluginsOutput($usr);
        cmsPage::initTemplate('components', 'com_users_profile.tpl')->assign('usr', $usr)->assign('plugins', $plugins)->assign('cfg', $model->config)->assign('myprofile', $myprofile)->assign('cfg_forum', $inCore->loadComponentConfig('forum'))->assign('is_admin', $inUser->is_admin)->assign('is_auth', $inUser->id)->display('com_users_profile.tpl');
    }
    //============================================================================//
    //============================= Список сообщений  ============================//
    //============================================================================//
    if ($do == 'messages') {
        if (!$model->config['sw_msg']) {
            cmsCore::error404();
        }
        if (!$inUser->id || $inUser->id != $id && !$inUser->is_admin) {
            cmsUser::goToLogin();
        }
        $usr = cmsUser::getShortUserData($id);
        if (!$usr) {
            cmsCore::error404();
        }
        $inPage->setTitle($_LANG['MY_MESS']);
        $inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
        $inPage->addPathway($_LANG['MY_MESS'], '/users/' . $id . '/messages.html');
        include 'components/users/messages.php';
    }
    //============================================================================//
    //=========================== Отправка сообщения  ============================//
    //============================================================================//
    if ($do == 'sendmessage') {
        if (!$model->config['sw_msg']) {
            cmsCore::halt();
        }
        if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
            cmsCore::halt();
        }
        if (!$inUser->id || $inUser->id == $id && !cmsCore::inRequest('massmail') && !cmsCore::request('send_to_group', 'int', 0)) {
            cmsCore::halt();
        }
        if (!cmsCore::inRequest('gosend')) {
            $replyid = cmsCore::request('replyid', 'int', 0);
            if ($replyid) {
                $msg = $model->getReplyMessage($replyid, $inUser->id);
                if (!$msg) {
                    cmsCore::halt();
                }
            }
            $inPage->setRequestIsAjax();
            cmsPage::initTemplate('components', 'com_users_messages_add')->assign('msg', isset($msg) ? $msg : array())->assign('is_reply_user', $replyid)->assign('id', $id)->assign('bbcodetoolbar', cmsPage::getBBCodeToolbar('message'))->assign('smilestoolbar', cmsPage::getSmilesPanel('message'))->assign('groups', $inUser->is_admin ? cmsUser::getGroups(true) : array())->assign('friends', cmsUser::getFriends($inUser->id))->assign('id_admin', $inUser->is_admin)->display('com_users_messages_add.tpl');
            cmsCore::jsonOutput(array('error' => false, 'html' => ob_get_clean()));
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例4: comments

function comments($target = '', $target_id = 0, $labels = array())
{
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    cmsCore::loadModel('comments');
    $model = new cms_model_comments($labels);
    // Проверяем включени ли компонент
    if (!$inCore->isComponentEnable('comments')) {
        return false;
    }
    // Инициализируем права доступа для группы текущего пользователя
    $model->initAccess();
    global $_LANG;
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $id = cmsCore::request('id', 'int', 0);
    $login = cmsCore::strClear(urldecode(cmsCore::request('login', 'html', '')));
    $inPage->addHeadJS('components/comments/js/comments.js');
    $inPage->addHeadJsLang(array('EDIT_COMMENT', 'CONFIRM_DEL_COMMENT', 'COMMENT_IN_LINK'));
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'view' && !$target && !$target_id) {
        if (!$login) {
            $myprofile = false;
            $page_title = $inCore->getComponentTitle();
            $inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . $_LANG['COMMENTS'] . '" href="' . HOST . '/rss/comments/all/feed.rss">');
        } else {
            // проверяем что пользователь есть
            $user = cmsUser::getShortUserData($login);
            if (!$user) {
                cmsCore::error404();
            }
            // Мои комментарии
            $myprofile = $inUser->id == $user['id'];
            $page_title = $_LANG['COMMENTS'] . ' - ' . $user['nickname'];
            $inPage->addPathway($user['nickname'], cmsUser::getProfileURL($user['login']));
            // Добавляем условие в выборку
            $model->whereUserIs($user['id']);
        }
        $inPage->setTitle($page_title);
        $inPage->addPathway($page_title);
        $inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $page_title);
        $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $page_title);
        // флаг модератора
        $is_moder = $inUser->is_admin || $model->is_can_moderate;
        // Не админам только открытые комментарии
        if (!($is_moder || $myprofile)) {
            $model->whereIsShow();
        }
        // Общее количество комментариев
        $total = $model->getCommentsCount(!($is_moder || $myprofile));
        // Сортировка и разбивка на страницы
        $inDB->orderBy('c.pubdate', 'DESC');
        $inDB->limitPage($page, $model->config['perpage']);
        // Сами комментарии
        $comments = $total ? $model->getComments(!($is_moder || $myprofile)) : array();
        $inDB->resetConditions();
        if (!$comments && $page > 1) {
            cmsCore::error404();
        }
        // пагинация
        if (!$login) {
            $pagebar = cmsPage::getPagebar($total, $page, $model->config['perpage'], '/comments/page-%page%');
        } else {
            $pagebar = cmsPage::getPagebar($total, $page, $model->config['perpage'], 'javascript:centerLink(\'/comments/by_user_' . $user['login'] . '/page-%page%\')');
        }
        // Отдаем в шаблон
        cmsPage::initTemplate('components', 'com_comments_list_all')->assign('comments_count', $total)->assign('comments', $comments)->assign('pagebar', $pagebar)->assign('is_user', $inUser->id)->assign('page_title', $page_title)->assign('cfg', $model->config)->assign('is_admin', $is_moder)->display('com_comments_list_all.tpl');
    }
    //========================================================================================================================//
    //========================================================================================================================//
    if (!in_array($do, array('add', 'edit', 'delete')) && $target && $target_id) {
        if (!$model->config['cmm_ajax']) {
            $model->whereTargetIs($target, $target_id);
            $inDB->orderBy('c.pubdate', 'ASC');
            $comments = cmsCore::callEvent('BEFORE_SHOW_COMMENTS', $model->getComments(!($inUser->is_admin || $model->is_can_moderate), true));
            $total = count($comments);
            ob_start();
            cmsPage::initTemplate('components', 'com_comments_list')->assign('comments_count', $total)->assign('comments', $comments)->assign('user_can_moderate', $model->is_can_moderate)->assign('user_can_delete', $model->is_can_delete)->assign('user_can_add', $model->is_can_add)->assign('is_admin', $inUser->is_admin)->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('labels', $model->labels)->assign('target', $target)->assign('target_id', $target_id)->display('com_comments_list.tpl');
            $html = ob_get_clean();
        } else {
            $model->whereTargetIs($target, $target_id);
            $total = $model->getCommentsCount(!($inUser->is_admin || $model->is_can_moderate));
            $inDB->resetConditions();
        }
        cmsPage::initTemplate('components', 'com_comments_view')->assign('comments_count', $total)->assign('target', $target)->assign('target_id', $target_id)->assign('is_admin', $inUser->is_admin)->assign('labels', $model->labels)->assign('is_user', $inUser->id)->assign('cfg', $model->config)->assign('user_can_add', $model->is_can_add)->assign('html', isset($html) ? $html : '')->assign('add_comment_js', "addComment('" . $target . "', '" . $target_id . "', 0)")->assign('user_subscribed', cmsUser::isSubscribed($inUser->id, $target, $target_id))->display('com_comments_view.tpl');
    }
    //========================================================================================================================//
    //========================================================================================================================//
    // Добавление комментария, форма добавления в addform.php
    if ($do == 'add') {
        // Только аякс
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        // Очищаем буфер
        ob_end_clean();
        // Добавлять могут только админы и те, кому разрешено в настройках группы
//.........这里部分代码省略.........
开发者ID:vicktorwork,项目名称:cms1,代码行数:101,代码来源:frontend.php

示例5: registration

function registration()
{
    header('X-Frame-Options: DENY');
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();
    $inConf = cmsConfig::getInstance();
    $model = new cms_model_registration();
    cmsCore::loadModel('users');
    $users_model = new cms_model_users();
    global $_LANG;
    $do = $inCore->do;
    //============================================================================//
    if ($do == 'sendremind') {
        if ($inUser->id) {
            cmsCore::error404();
        }
        $inPage->setTitle($_LANG['REMINDER_PASS']);
        $inPage->addPathway($_LANG['REMINDER_PASS']);
        if (!cmsCore::inRequest('goremind')) {
            cmsPage::initTemplate('components', 'com_registration_sendremind')->display('com_registration_sendremind.tpl');
        } else {
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }
            $email = cmsCore::request('email', 'email', '');
            if (!$email) {
                cmsCore::addSessionMessage($_LANG['ERR_EMAIL'], 'error');
                cmsCore::redirectBack();
            }
            $usr = cmsUser::getShortUserData($email);
            if (!$usr || $usr['is_locked'] || $usr['is_deleted']) {
                cmsCore::addSessionMessage($_LANG['ADRESS'] . ' "' . $email . '" ' . $_LANG['NOT_IN_OUR_BASE'], 'error');
                cmsCore::redirectBack();
            }
            if (cmsUser::userIsAdmin($usr['id'])) {
                cmsCore::addSessionMessage($_LANG['NOT_ADMIN_SENDREMIND'], 'error');
                cmsCore::redirectBack();
            }
            $usercode = md5($usr['id'] . '-' . uniqid() . '-' . microtime() . '-' . PATH);
            $sql = "INSERT cms_users_activate (pubdate, user_id, code)\n                VALUES (NOW(), '{$usr['id']}', '{$usercode}')";
            $inDB->query($sql);
            $newpass_link = HOST . '/registration/remind/' . $usercode;
            $mail_message = $_LANG['HELLO'] . ', ' . $usr['nickname'] . '!' . "\n\n";
            $mail_message .= $_LANG['REMINDER_TEXT'] . ' "' . $inConf->sitename . '".' . "\n\n";
            $mail_message .= $_LANG['YOUR_LOGIN'] . ': ' . $usr['login'] . "\n\n";
            $mail_message .= $_LANG['NEW_PASS_LINK'] . ":\n" . $newpass_link . "\n\n";
            $mail_message .= $_LANG['LINK_EXPIRES'] . "\n\n";
            $mail_message .= $_LANG['SIGNATURE'] . ', ' . $inConf->sitename . ' (' . HOST . ').' . "\n";
            $mail_message .= date('d-m-Y (H:i)');
            $inCore->mailText($email, $inConf->sitename . ' - ' . $_LANG['REMINDER_PASS'], $mail_message);
            cmsCore::addSessionMessage($_LANG['NEW_PAS_SENDED'], 'info');
            cmsCore::redirect('/login');
        }
    }
    //============================================================================//
    if ($do == 'remind') {
        if ($inUser->id) {
            cmsCore::error404();
        }
        $usercode = cmsCore::request('code', 'str', '');
        //проверяем формат кода
        if (!preg_match('/^[0-9a-f]{32}$/i', $usercode)) {
            cmsCore::error404();
        }
        // проверяем код
        $user_id = $inDB->get_field('cms_users_activate', "code = '{$usercode}'", 'user_id');
        if (!$user_id) {
            cmsCore::error404();
        }
        //получаем пользователя
        $user = $inDB->get_fields('cms_users', "id = '{$user_id}'", '*');
        if (!$user) {
            cmsCore::error404();
        }
        if (cmsUser::userIsAdmin($user['id'])) {
            cmsCore::error404();
        }
        if (cmsCore::inRequest('submit')) {
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }
            $errors = false;
            $pass = cmsCore::request('pass', 'str', '');
            $pass2 = cmsCore::request('pass2', 'str', '');
            if (!$pass) {
                cmsCore::addSessionMessage($_LANG['TYPE_PASS'], 'error');
                $errors = true;
            }
            if ($pass && !$pass2) {
                cmsCore::addSessionMessage($_LANG['TYPE_PASS_TWICE'], 'error');
                $errors = true;
            }
            if ($pass && $pass2 && mb_strlen($pass) < 6) {
                cmsCore::addSessionMessage($_LANG['PASS_SHORT'], 'error');
                $errors = true;
            }
            if ($pass && $pass2 && $pass != $pass2) {
                cmsCore::addSessionMessage($_LANG['WRONG_PASS'], 'error');
//.........这里部分代码省略.........
开发者ID:vicktorwork,项目名称:cms1,代码行数:101,代码来源:frontend.php

示例6: clubs

function clubs() {
    $inCore = cmsCore::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB   = cmsDatabase::getInstance();
    $inUser = cmsUser::getInstance();

    global $_LANG;

    $model = new cms_model_clubs();

    $inPhoto = $model->initPhoto();

    define('IS_BILLING', $inCore->isComponentInstalled('billing'));
    if (IS_BILLING) { cmsCore::loadClass('billing'); }

	// js только авторизованным
	if($inUser->id){
		$inPage->addHeadJS('components/clubs/js/clubs.js');
	}

	$pagetitle = $inCore->getComponentTitle();

	$id   = cmsCore::request('id', 'int', 0);
	$do   = $inCore->do;
	$page = cmsCore::request('page', 'int', 1);

	$inPage->setTitle($pagetitle);
        $inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $pagetitle);
        $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $pagetitle);
	$inPage->addPathway($pagetitle, '/clubs');
    $inPage->addHeadJsLang(array('NO_PUBLISH','EDIT_PHOTO','YOU_REALLY_DELETE_PHOTO','YOU_REALLY_DELETE_ALBUM','RENAME_ALBUM','ALBUM_TITLE','ADD_PHOTOALBUM','REALY_EXIT_FROM_CLUB','JOINING_CLUB','SEND_MESSAGE','CREATE','CREATE_CLUB','SEND_INVITE_CLUB','YOU_NO_SELECT_USER'));

//////////////////////// КЛУБЫ ПОЛЬЗОВАТЕЛЯ/////////////////////////////////////
if ($do == 'user_clubs') {
    if (!cmsCore::isAjax()) { return false; }

    $inPage->displayLangJS(array('CREATE','CREATE_CLUB'));

    $user_id = cmsCore::request('user_id', 'int', $inUser->id);

    $user = cmsUser::getShortUserData($user_id);
    if (!$user) { return false; }

    // получаем клубы, в которых пользователь админ
    $model->whereAdminIs($user['id']);
   	$inDB->orderBy('c.pubdate', 'DESC');
    $clubs = $model->getClubs();

    // получаем клубы, в которых состоит пользователь
    $inDB->addSelect('uc.role');
    $inDB->addJoin("INNER JOIN cms_user_clubs uc ON uc.club_id = c.id AND uc.user_id = '{$user['id']}'");
   	$inDB->orderBy('uc.role', 'DESC, uc.pubdate DESC');
    $inclubs = $model->getClubs();

	cmsPage::initTemplate('components', 'com_clubs_user')->
            assign('can_create', (($inUser->id == $user['id']) && ($model->config['cancreate'] || $inUser->is_admin)))->
            assign('clubs', array_merge($clubs, $inclubs))->
            assign('user', $user)->
            assign('my_profile', $user['id'] == $inUser->id)->
            display();

}
//////////////////////// ВСЕ КЛУБЫ /////////////////////////////////////////////
if ($do=='view'){

	$inDB->orderBy('is_vip', 'DESC, rating DESC');
	$inDB->limitPage($page, $model->config['perpage']);

	$total = $model->getClubsCount();

        $clubs = $model->getClubs();
	if (!$clubs && $page > 1) { return false; }
        
        if ($page > 1) {
            foreach ($clubs as $c) {
                $keys[] = $c['title'];
            }
            $inPage->setKeywords(implode(',', $keys));
        }

	cmsPage::initTemplate('components', 'com_clubs_view')->
            assign('pagetitle', $pagetitle)->
            assign('can_create', ($inUser->id && $model->config['cancreate'] || $inUser->is_admin))->
            assign('clubs', $clubs)->
            assign('total', $total)->
            assign('pagination', cmsPage::getPagebar($total, $page, $model->config['perpage'], '/clubs/page-%page%'))->
            display();

}
/////////////////////// ПРОСМОТР КЛУБА /////////////////////////////////////////
if ($do=='club'){
    $club = $model->getClub($id);
    if (!$club) { return false; }

    if (!$club['published'] && !$inUser->is_admin) { return false; }

    $inPage->setTitle($club['pagetitle'] ? $club['pagetitle'] : $club['title']);
    $inPage->setKeywords($club['meta_keys'] ? $club['meta_keys'] : $club['title']);
    if (!$club['meta_desc']) {
        if ($club['description']) {
//.........这里部分代码省略.........
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:101,代码来源:frontend.php

示例7: array

        $perpage = 21;
        $pagination = cmsPage::getPagebar($total, $page, $perpage, '/users/%user%/photos/%album%%id%-%page%.html', array('user' => $usr['login'], 'album' => $album_type, 'id' => $album_id));
        $page_photos = array();
        $start = $perpage * ($page - 1);
        for ($p = $start; $p < $start + $perpage; $p++) {
            if ($photos[$p]) {
                $page_photos[] = $photos[$p];
            }
        }
        $photos = $page_photos;
        unset($page_photos);
    }
    //Отдаем в шаблон
    cmsPage::initTemplate('components', 'com_users_photos')->assign('page_title', $album['title'])->assign('album_type', $album_type)->assign('album', $album)->assign('photos', $photos)->assign('user_id', $usr['id'])->assign('usr', $usr)->assign('my_profile', $my_profile)->assign('is_admin', $inUser->is_admin)->assign('pagebar', $pagination)->display('com_users_photos.tpl');
}
//============================================================================//
//============================ Удалить фотоальбом ============================//
//============================================================================//
if ($pdo == 'delalbum') {
    $album_id = cmsCore::request('album_id', 'int', '0');
    $album = $model->getPhotoAlbum('private', $album_id);
    if (!$album) {
        cmsCore::error404();
    }
    if (!$inUser->is_admin && $album['user_id'] != $inUser->id) {
        cmsCore::error404();
    }
    $model->deletePhotoAlbum($id, $album_id);
    $user = cmsUser::getShortUserData($album['user_id']);
    cmsCore::redirect(cmsUser::getProfileURL($user['login']));
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:31,代码来源:photos.php

示例8: board


//.........这里部分代码省略.........
    cmsCore::c('page')->setTitle($pagetitle);

    // Отдаем в шаблон категории
    cmsPage::initTemplate('components', 'com_board_cats')->
        assign('cats', $cats)->
        assign('category', $category)->
        assign('root_id', cmsCore::m('board')->root_cat['id'])->
        assign('is_user', cmsCore::c('user')->id)->
        assign('maxcols', cmsCore::m('board')->config['maxcols'])->
        display();

    $pagebar = cmsPage::getPagebar($total, cmsCore::m('board')->page, $category['perpage'], '/board/%catid%-%page%', array('catid'=>$category['id']));
    $order_form = $category['orderform'] ? cmsCore::m('board')->orderForm($orderby, $orderto, $category) : '';

    // Отдаем в шаблон объявления
    cmsPage::initTemplate('components', 'com_board_items')->
        assign('order_form', $order_form)->
        assign('cfg', cmsCore::m('board')->config)->
        assign('root_id', cmsCore::m('board')->root_cat['id'])->
        assign('items', $items)->
        assign('cat', $category)->
        assign('maxcols', $category['maxcols'])->
        assign('colwidth', round(100/$category['maxcols']))->
        assign('pagebar', $pagebar)->
        display();
}

/////////////////////////////// VIEW USER ADV //////////////////////////////////
if ($do == 'by_user') {
    // логин пользователя
    $login = cmsCore::request('login', 'str', cmsCore::c('user')->login);

    // получаем данные пользователя
    $user = cmsUser::getShortUserData($login);
    if (!$user) { cmsCore::error404(); }

    $myprofile = cmsCore::m('board')->checkAccess($user['id']);

    cmsCore::c('page')->addPathway($user['nickname']);
    cmsCore::c('page')->setTitle($_LANG['BOARD'] .' - '. $user['nickname']);
    cmsCore::c('page')->setDescription($_LANG['BOARD'] .' - '. $user['nickname']);

    // Формируем список объявлений
    cmsCore::m('board')->whereUserIs($user['id']);

    // Общее количество объявлений по заданным выше условиям
    $total = cmsCore::m('board')->getAdvertsCount($myprofile);

    //устанавливаем сортировку
    cmsCore::c('db')->orderBy('pubdate', 'DESC');

    //устанавливаем номер текущей страницы и кол-во объявлений на странице
    cmsCore::c('db')->limitPage(cmsCore::m('board')->page, 15);

    // Получаем объявления
    $items = cmsCore::m('board')->getAdverts($myprofile, true, false, true);
    // Если объявлений на странице большей чем 1 нет, 404
    if(!$items && cmsCore::m('board')->page > 1){ cmsCore::error404(); }

    // Пагинация
    $pagebar = cmsPage::getPagebar($total, cmsCore::m('board')->page, 15, '/board/by_user_'.$login.'/page-%page%');

    // Показываем даты
    $category['showdate'] = 1;

    cmsPage::initTemplate('components', 'com_board_items')->
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:67,代码来源:frontend.php

示例9: actions

function actions()
{
    $inCore = cmsCore::getInstance();
    $inUser = cmsUser::getInstance();
    $inPage = cmsPage::getInstance();
    $inDB = cmsDatabase::getInstance();
    $inActions = cmsActions::getInstance();
    $model = new cms_model_actions();
    global $_LANG;
    $do = $inCore->do;
    $page = cmsCore::request('page', 'int', 1);
    $user_id = cmsCore::request('user_id', 'int', 0);
    $perpage = 6;
    $pagetitle = $inCore->getComponentTitle();
    $inPage->setTitle($pagetitle);
    $inPage->addPathway($pagetitle, '/actions');
    $inPage->setDescription($model->config['meta_desc'] ? $model->config['meta_desc'] : $pagetitle);
    $inPage->setKeywords($model->config['meta_keys'] ? $model->config['meta_keys'] : $pagetitle);
    //============================================================================//
    if ($do == 'delete') {
        if (!$inUser->is_admin) {
            cmsCore::error404();
        }
        $id = cmsCore::request('id', 'int', 0);
        if (!$id) {
            cmsCore::error404();
        }
        $model->deleteAction($id);
        cmsCore::redirectBack();
    }
    //============================================================================//
    if ($do == 'view') {
        $inActions->showTargets($model->config['show_target']);
        if ($model->config['act_type'] && !$model->config['is_all']) {
            $inActions->onlySelectedTypes($model->config['act_type']);
        }
        $total = $inActions->getCountActions();
        $inDB->limitPage($page, $model->config['perpage']);
        $actions = $inActions->getActionsLog();
        if (!$actions && $page > 1) {
            cmsCore::error404();
        }
        cmsPage::initTemplate('components', 'com_actions_view')->assign('actions', $actions)->assign('pagetitle', $pagetitle)->assign('total', $total)->assign('user_id', $inUser->id)->assign('pagebar', cmsPage::getPagebar($total, $page, $model->config['perpage'], '/actions/page-%page%'))->display('com_actions_view.tpl');
    }
    //============================================================================//
    if ($do == 'view_user_feed') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        // Получаем друзей
        $friends = cmsUser::getFriends($inUser->id);
        $friends_total = count($friends);
        // нам нужно только определенное количество друзей
        $friends = array_slice($friends, ($page - 1) * $perpage, $perpage, true);
        if ($friends) {
            $inActions->onlyMyFriends();
            $inActions->showTargets($model->config['show_target']);
            $inDB->limitIs($model->config['perpage_tab']);
            $actions = $inActions->getActionsLog();
        } else {
            $actions = array();
        }
        cmsPage::initTemplate('components', 'com_actions_view_tab')->assign('actions', $actions)->assign('friends', $friends)->assign('user_id', $user_id)->assign('page', $page)->assign('cfg', $model->config)->assign('total_pages', ceil($friends_total / $perpage))->assign('friends_total', $friends_total)->display('com_actions_view_tab.tpl');
    }
    //============================================================================//
    if ($do == 'view_user_feed_only') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        if (!cmsCore::isAjax()) {
            cmsCore::error404();
        }
        if ($user_id) {
            if (!cmsUser::isFriend($user_id)) {
                cmsCore::error404();
            }
            $inActions->whereUserIs($user_id);
        } else {
            $inActions->onlyMyFriends();
        }
        $inActions->showTargets($model->config['show_target']);
        $inDB->limitIs($model->config['perpage_tab']);
        $actions = $inActions->getActionsLog();
        // получаем последний элемент массива для выборки имя пользователя и ссылки на профиль.
        if ($actions) {
            $user = end($actions);
        } else {
            $user = cmsUser::getShortUserData($user_id);
        }
        cmsPage::initTemplate('components', 'com_actions_tab')->assign('actions', $actions)->assign('user_id', $user_id)->assign('user', $user)->assign('cfg', $model->config)->display('com_actions_tab.tpl');
    }
    //============================================================================//
    if ($do == 'view_user_friends_only') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        if (!cmsCore::isAjax()) {
//.........这里部分代码省略.........
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例10: sendInvite

    public function sendInvite($owner_id, $email) {

        $inCore = cmsCore::getInstance();
        $inConf = cmsConfig::getInstance();

        global $_LANG;

        $user = cmsUser::getShortUserData($owner_id);

        if (!$user) { return false; }

        $invite = $this->getInvite($owner_id);

        if (!$invite) { return false; }

        $letter = cmsCore::getLanguageTextFile('invite');
        $letter = str_replace('{sitename}', $inConf->sitename, $letter);
        $letter = str_replace('{site_url}', HOST, $letter);
        $letter = str_replace('{invite_code}', $invite['code'], $letter);
        $letter = str_replace('{username}', $user['nickname'], $letter);

        $inCore->mailText($email, sprintf($_LANG['INVITE_SUBJECT'], $user['nickname']), $letter);

        $this->inDB->query("UPDATE cms_user_invites SET is_sended=1 WHERE id='{$invite['id']}'");

        return true;

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

示例11: forum


//.........这里部分代码省略.........
            cmsCore::error404();
        }
        cmsPage::initTemplate('components', 'com_forum_actions')->assign('actions', $actions)->assign('total', $total)->assign('do', $do)->assign('user_id', $inUser->id)->assign('pagetitle', $_LANG['NEW_THREADS_ON_FORUM'])->assign('pagebar', cmsPage::getPagebar($total, $page, 15, '/forum/latest_thread/page-%page%'))->display('com_forum_actions.tpl');
    }
    //============================================================================//
    //========================== Просмотр категории ==============================//
    //============================================================================//
    if ($do == 'view_cat') {
        $cat = $model->getForumCat(cmsCore::request('seolink', 'str', ''));
        if (!$cat) {
            cmsCore::error404();
        }
        $cat = translations::process(cmsConfig::getConfig('lang'), 'forum_forum_cats', $cat);
        $inPage->setTitle($cat['pagetitle'] ? $cat['pagetitle'] : $cat['title']);
        $inPage->setDescription($cat['meta_desc'] ? $cat['meta_desc'] : $cat['title']);
        $inPage->setKeywords($cat['meta_keys'] ? $cat['meta_keys'] : $cat['title']);
        $inPage->addPathway($cat['title']);
        $model->whereForumCatIs($cat['id']);
        $sub_forums = $model->getForums();
        cmsPage::initTemplate('components', 'com_forum_list')->assign('pagetitle', $cat['title'])->assign('forums', $sub_forums)->assign('forum', array())->assign('cfg', $model->config)->assign('user_id', false)->display('com_forum_list.tpl');
        $inDB->addJoin('INNER JOIN cms_forums f ON f.id = t.forum_id');
        $inDB->where("t.is_hidden = 0");
        $model->whereForumCatIs($cat['id']);
        $inDB->orderBy('t.pubdate', 'DESC, t.hits DESC');
        $inDB->limit(15);
        $threads = $model->getThreads();
        cmsPage::initTemplate('components', 'com_forum_view')->assign('threads', $threads)->display('com_forum_view.tpl');
    }
    //============================================================================//
    //===================== Активность пользователя ==============================//
    //============================================================================//
    if ($do == 'user_activity') {
        $login = cmsCore::request('login', 'str', $inUser->login);
        $sub_do = cmsCore::request('sub_do', 'str', 'threads');
        $user = cmsUser::getShortUserData($login);
        if (!$user) {
            cmsCore::error404();
        }
        $my_profile = $inUser->login == $login;
        $pagetitle = $my_profile ? $_LANG['MY_ACTIVITY'] : $user['nickname'] . ' - ' . $_LANG['ACTIVITY_ON_FORUM'];
        $inPage->setTitle($pagetitle);
        $inPage->addPathway($pagetitle);
        $threads = array();
        $posts = array();
        if (!$my_profile && !$inUser->is_admin) {
            $model->wherePublicThreads();
        }
        $model->whereThreadUserIs($user['id']);
        $thread_count = $model->getThreadsCount();
        if ($sub_do == 'threads' && $thread_count) {
            $inDB->orderBy('t.pubdate', 'DESC, t.hits DESC');
            $inDB->limitPage($page, 15);
            $threads = $model->getThreads();
            $pagination = cmsPage::getPagebar($thread_count, $page, 15, "javascript:forum.getUserActivity('threads','/forum/{$user['login']}_activity.html','%page%');");
        }
        $inDB->resetConditions();
        // Если тем у пользователя нет, показываем вкладку сообщений
        if (!$thread_count) {
            $sub_do = 'posts';
        }
        $inDB->addSelect('t.title as thread_title');
        $inDB->addJoin('INNER JOIN cms_forum_threads t ON t.id = p.thread_id');
        $model->wherePostUserIs($user['id']);
        if (!$my_profile && !$inUser->is_admin) {
            $model->wherePublicThreads();
        }
        $post_count = $model->getPostsCount();
        // Если сообщений нет, 404
        if (!$post_count && !$my_profile) {
            cmsCore::error404();
        }
        if ($sub_do == 'posts' && $post_count) {
            $inDB->orderBy('p.thread_id', 'DESC, p.pubdate DESC');
            $inDB->limitPage($page, 10);
            $posts = $model->getPosts();
            $pagination = cmsPage::getPagebar($post_count, $page, 10, "javascript:forum.getUserActivity('posts','/forum/{$user['login']}_activity.html','%page%');");
        }
        $inDB->resetConditions();
        cmsPage::initTemplate('components', 'com_forum_user_activity')->assign('threads', $threads)->assign('posts', $posts)->assign('post_count', $post_count)->assign('thread_count', $thread_count)->assign('pagetitle', $pagetitle)->assign('sub_do', $sub_do)->assign('page', $page)->assign('user_id', $user['id'])->assign('my_profile', $my_profile)->assign('is_admin', $inUser->is_admin)->assign('is_moderator', cmsUser::isUserCan('forum/moderate'))->assign('pagination', $pagination)->assign('link', '/forum/' . $user['login'] . '_activity.html')->display('com_forum_user_activity.tpl');
    }
    ////////////////////////////////////////////////////////////////////////////////
    if ($do == 'delete_all_user_posts') {
        if (!$inUser->id) {
            cmsCore::error404();
        }
        if (!$inUser->is_admin && !cmsUser::isUserCan('forum/moderate')) {
            cmsCore::error404();
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::halt();
        }
        $user = cmsUser::getShortUserData(cmsCore::request('user_id', 'int', 0));
        if (!$user || $user['id'] == $inUser->id) {
            cmsCore::error404();
        }
        $model->deleteAllUserPosts($user['id']);
        cmsCore::addSessionMessage($_LANG['ALL_USERPOSTS_ISDELETED'], 'success');
        cmsCore::halt();
    }
}
开发者ID:deltas1,项目名称:icms1,代码行数:101,代码来源:frontend.php

示例12: IN

    case 'out':
        $page_title = $_LANG['SENT'];
        $inDB->addJoin("INNER JOIN cms_user_msg m ON m.to_id = u.id AND m.from_id = '{$id}' AND m.from_del = 0");
        $msg_count = $model->getMessagesCount();
        $pagebar = cmsPage::getPagebar($msg_count, $page, $perpage, 'javascript:centerLink(\'/users/' . $id . '/messages-sent%page%.html\')');
        break;
    case 'notices':
        $page_title = $_LANG['NOTICES'];
        $show_notice = true;
        $inDB->where("m.to_id = '{$id}'");
        $msg_count = $model->getMessagesCount($show_notice);
        $pagebar = cmsPage::getPagebar($msg_count, $page, $perpage, 'javascript:centerLink(\'/users/' . $id . '/messages-notices%page%.html\')');
        break;
    case 'history':
        if ($whith_id) {
            $with_usr = cmsUser::getShortUserData($whith_id);
            if (!$with_usr) {
                cmsCore::error404();
            }
            $page_title = $_LANG['MESSEN_WITH'] . ' ' . $with_usr['nickname'];
            $inDB->addJoin("INNER JOIN cms_user_msg m ON m.from_id = u.id AND\n                            m.from_id IN ({$id}, {$with_usr['id']}) AND\n                            m.to_id IN ({$id}, {$with_usr['id']}) AND\n                            m.from_del = 0 AND m.to_del = 0");
            $msg_count = $model->getMessagesCount();
            $pagebar = cmsPage::getPagebar($msg_count, $page, $perpage, 'javascript:centerLink(\'/users/' . $id . '/messages-history' . $with_usr['id'] . '-%page%.html\')');
        } else {
            $page_title = $_LANG['DIALOGS'];
            $msg_count = 0;
        }
        break;
    default:
        return;
}
开发者ID:4uva4ek,项目名称:svato,代码行数:31,代码来源:messages.php


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