本文整理汇总了PHP中cmsUser::isFriend方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::isFriend方法的具体用法?PHP cmsUser::isFriend怎么用?PHP cmsUser::isFriend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::isFriend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$album = $model->getPhotoAlbum($album_type, $album_id);
if (!$album) {
cmsCore::error404();
}
if ($album_type != 'private') {
$album['allow_who'] = 'all';
}
$inPage->setTitle($album['title']);
$inPage->addPathway($usr['nickname'], cmsUser::getProfileURL($usr['login']));
$inPage->addPathway($_LANG['PHOTOALBUMS'], '/users/' . $usr['id'] . '/photoalbum.html');
$inPage->addPathway($album['title']);
$photos = array();
//Мой профиль или нет
$my_profile = $inUser->id == $usr['id'] ? true : false;
//Определяем, друзья мы или нет
$we_friends = $inUser->id && !$my_profile ? cmsUser::isFriend($usr['id']) : 0;
if ($album['allow_who'] == 'all' || $my_profile || $album['allow_who'] == 'friends' && $we_friends || $album['allow_who'] == 'registered' && $inUser->id) {
$photos = $model->getAlbumPhotos($usr['id'], $album_type, $album_id, $we_friends);
}
//Делим на страницы
$total = sizeof($photos);
if ($total) {
$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];
}
}
示例2: users
//.........这里部分代码省略.........
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'])) {
foreach ($model->config['privforms'] as $form_id) {
$usr['form_fields'] = array_merge($usr['form_fields'], cmsForm::getFieldsValues($form_id, $usr['formsdata']));
}
}
if ($usr['city']) {
示例3: 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()) {
//.........这里部分代码省略.........