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


PHP cmsUser::clearSessionFriends方法代碼示例

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


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

示例1: users


//.........這裏部分代碼省略.........
    //============================= Просмотр профиля  ============================//
    //============================================================================//
    if ($do == 'profile') {
        $inPage->addHeadJsLang(array('NEW_POST_ON_WALL', 'CONFIRM_DEL_POST_ON_WALL'));
        // если просмотр профиля гостям запрещен
        if (!$inUser->id && !$model->config['sw_guest']) {
            cmsUser::goToLogin();
        }
        if (is_numeric($login)) {
            cmsCore::error404();
        }
        $usr = $model->getUser($login);
        if (!$usr) {
            cmsCore::error404();
        }
        $myprofile = $inUser->id == $usr['id'];
        $inPage->setTitle($usr['nickname']);
        $inPage->addPathway($usr['nickname']);
        // просмотр профиля запрещен
        if (!cmsUser::checkUserContentAccess($usr['allow_who'], $usr['id'])) {
            cmsPage::initTemplate('components', 'com_users_not_allow')->assign('is_auth', $inUser->id)->assign('usr', $usr)->display('com_users_not_allow.tpl');
            return;
        }
        // Профиль удален
        if ($usr['is_deleted']) {
            cmsPage::initTemplate('components', 'com_users_deleted.tpl')->assign('usr', $usr)->assign('is_admin', $inUser->is_admin)->assign('others_active', $inDB->rows_count('cms_users', "login='{$usr['login']}' AND is_deleted=0", 1))->display('com_users_deleted.tpl');
            return;
        }
        // Данные о друзьях
        $usr['friends_total'] = cmsUser::getFriendsCount($usr['id']);
        $usr['friends'] = cmsUser::getFriends($usr['id']);
        // очищать сессию друзей если в своем профиле и количество друзей из базы не совпадает с количеством друзей в сессии
        if ($myprofile && sizeof($usr['friends']) != $usr['friends_total']) {
            cmsUser::clearSessionFriends();
        }
        // обрезаем список
        $usr['friends'] = array_slice($usr['friends'], 0, 6);
        // выясняем друзья ли мы с текущим пользователем
        $usr['isfriend'] = !$myprofile ? cmsUser::isFriend($usr['id']) : false;
        // награды пользователя
        $usr['awards'] = $model->config['sw_awards'] ? $model->getUserAwards($usr['id']) : false;
        // стена
        if ($model->config['sw_wall']) {
            $inDB->limitPage(1, $model->config['wall_perpage']);
            $usr['wall_html'] = cmsUser::getUserWall($usr['id'], 'users', $myprofile, $inUser->is_admin);
        }
        // можно ли пользователю изменять карму
        $usr['can_change_karma'] = $model->isUserCanChangeKarma($usr['id']) && $inUser->id;
        // Фотоальбомы пользователя
        if ($model->config['sw_photo']) {
            $usr['albums'] = $model->getPhotoAlbums($usr['id'], $usr['isfriend'], !$inCore->isComponentEnable('photos'));
            $usr['albums_total'] = sizeof($usr['albums']);
            $usr['albums_show'] = 6;
            if ($usr['albums_total'] > $usr['albums_show']) {
                array_splice($usr['albums'], $usr['albums_show']);
            }
        }
        $usr['board_count'] = $model->config['sw_board'] ? $inDB->rows_count('cms_board_items', "user_id='{$usr['id']}' AND published=1") : 0;
        $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'])) {
開發者ID:deltas1,項目名稱:icms1,代碼行數:67,代碼來源:frontend.php

示例2: deleteFriend

 /**
  * Удаляет пользователя $user_id из списка друзей текущего пользователя
  * @param int $user_id
  * @return bool
  */
 public static function deleteFriend($user_id = 0)
 {
     if (!$user_id) {
         return false;
     }
     $friend_field_id = self::getFriendFieldId($user_id);
     if ($friend_field_id) {
         cmsCore::callEvent('DELETE_FRIEND', $user_id);
         cmsDatabase::getInstance()->query("DELETE FROM cms_user_friends WHERE id = '{$friend_field_id}'");
         cmsActions::removeObjectLog('add_friend', $friend_field_id);
         cmsUser::clearSessionFriends();
         return true;
     }
     return false;
 }
開發者ID:vicktorwork,項目名稱:cms1,代碼行數:20,代碼來源:user.class.php


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