本文整理汇总了PHP中cmsUser::getProfileLink方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::getProfileLink方法的具体用法?PHP cmsUser::getProfileLink怎么用?PHP cmsUser::getProfileLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::getProfileLink方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mod_user_friend
function mod_user_friend($mod, $cfg)
{
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
if (!$inUser->id) {
return false;
}
if ($cfg['view_type'] == 'table') {
$sql = "SELECT\r\n CASE\r\n WHEN f.from_id = {$inUser->id}\r\n THEN f.to_id\r\n WHEN f.to_id = {$inUser->id}\r\n THEN f.from_id\r\n END AS user_id, u.login, u.nickname, u.is_deleted, p.imageurl\r\n FROM cms_user_friends f\r\n INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = {$inUser->id} THEN f.to_id WHEN f.to_id = {$inUser->id} THEN f.from_id END\r\n LEFT JOIN cms_users u ON u.id = o.user_id\r\n LEFT JOIN cms_user_profiles p ON p.user_id = u.id\r\n WHERE (from_id = {$inUser->id} OR to_id = {$inUser->id}) AND is_accepted =1 LIMIT " . $cfg['limit'];
} else {
$sql = "SELECT\r\n CASE\r\n WHEN f.from_id = {$inUser->id}\r\n THEN f.to_id\r\n WHEN f.to_id = {$inUser->id}\r\n THEN f.from_id\r\n END AS user_id, u.login, u.nickname\r\n FROM cms_user_friends f\r\n INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = {$inUser->id} THEN f.to_id WHEN f.to_id = {$inUser->id} THEN f.from_id END\r\n LEFT JOIN cms_users u ON u.id = o.user_id\r\n WHERE (from_id = {$inUser->id} OR to_id = {$inUser->id}) AND is_accepted =1 LIMIT " . $cfg['limit'];
}
$result = $inDB->query($sql);
$total = $inDB->num_rows($result);
if ($total) {
$friends = array();
while ($friend = $inDB->fetch_assoc($result)) {
$friend['avatar'] = $cfg['view_type'] == 'table' ? cmsUser::getUserAvatarUrl($friend['user_id'], 'small', $friend['imageurl'], $friend['is_deleted']) : false;
$friend['user_link'] = cmsUser::getProfileLink($friend['login'], $friend['nickname']);
$friends[$friend['user_id']] = $friend;
}
}
cmsPage::initTemplate('modules', $cfg['tpl'])->assign('friends', $friends)->assign('total', $total)->assign('cfg', $cfg)->display($cfg['tpl']);
return true;
}
示例2: mod_user_friend
function mod_user_friend($mod, $cfg) {
if (!cmsCore::c('user')->id) {
return false;
}
if ($cfg['view_type'] == 'table') {
$sql = "SELECT
CASE
WHEN f.from_id = ". cmsCore::c('user')->id ."
THEN f.to_id
WHEN f.to_id = ". cmsCore::c('user')->id ."
THEN f.from_id
END AS user_id, u.login, u.nickname, u.is_deleted, p.imageurl
FROM cms_user_friends f
INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = ". cmsCore::c('user')->id ." THEN f.to_id WHEN f.to_id = ". cmsCore::c('user')->id ." THEN f.from_id END
LEFT JOIN cms_users u ON u.id = o.user_id
LEFT JOIN cms_user_profiles p ON p.user_id = u.id
WHERE (from_id = ". cmsCore::c('user')->id ." OR to_id = ". cmsCore::c('user')->id .") AND is_accepted =1 LIMIT ". $cfg['limit'];
} else {
$sql = "SELECT
CASE
WHEN f.from_id = ". cmsCore::c('user')->id ."
THEN f.to_id
WHEN f.to_id = ". cmsCore::c('user')->id ."
THEN f.from_id
END AS user_id, u.login, u.nickname
FROM cms_user_friends f
INNER JOIN cms_online o ON o.user_id = CASE WHEN f.from_id = ". cmsCore::c('user')->id ." THEN f.to_id WHEN f.to_id = ". cmsCore::c('user')->id ." THEN f.from_id END
LEFT JOIN cms_users u ON u.id = o.user_id
WHERE (from_id = ". cmsCore::c('user')->id ." OR to_id = ". cmsCore::c('user')->id .") AND is_accepted =1 LIMIT ". $cfg['limit'];
}
$result = cmsCore::c('db')->query($sql) ;
$total = cmsCore::c('db')->num_rows($result);
if ($total) {
$friends = array();
while ($friend = cmsCore::c('db')->fetch_assoc($result)) {
$friend['avatar'] = ($cfg['view_type'] == 'table') ? cmsUser::getUserAvatarUrl($friend['user_id'], 'small', $friend['imageurl'], $friend['is_deleted']) : false;
$friend['user_link'] = cmsUser::getProfileLink($friend['login'], $friend['nickname']);
$friends[$friend['user_id']] = $friend;
}
}
cmsPage::initTemplate('modules', $cfg['tpl'])->
assign('friends', $friends)->
assign('total', $total)->
assign('cfg', $cfg)->
display();
return true;
}
示例3: users
//.........这里部分代码省略.........
//============================================================================//
if ($do == 'addfriend') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id || $inUser->id == $id) {
cmsCore::halt();
}
$usr = cmsUser::getShortUserData($id);
if (!$usr) {
cmsCore::halt();
}
cmsUser::clearSessionFriends();
if (cmsUser::isFriend($id)) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['YOU_ARE_BE_FRIENDS']));
}
// проверяем был ли ранее запрос на дружбу
// если был, то делаем accept запросу
$is_need_accept_id = cmsUser::getFriendFieldId($id, 0, 'to_me');
if ($is_need_accept_id) {
$inDB->query("UPDATE cms_user_friends SET is_accepted = 1 WHERE id = '{$is_need_accept_id}'");
//регистрируем событие
cmsActions::log('add_friend', array('object' => $inUser->nickname, 'user_id' => $usr['id'], 'object_url' => cmsUser::getProfileURL($inUser->login), 'object_id' => $is_need_accept_id, 'target' => '', 'target_url' => '', 'target_id' => 0, 'description' => ''));
cmsCore::callEvent('USER_ACCEPT_FRIEND', $id);
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['ADD_FRIEND_OK'] . $usr['nickname']));
}
// Если пользователь пытается добавиться в друзья к
// пользователю, к которому уже отправил запрос
if (cmsUser::getFriendFieldId($id, 0, 'from_me')) {
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['ADD_TO_FRIEND_SEND_ERR']));
}
// Мы вообще не друзья с пользователем, создаем запрос
cmsUser::addFriend($id);
cmsUser::sendMessage(USER_UPDATER, $id, sprintf($_LANG['RECEIVED_F_O'], cmsUser::getProfileLink($inUser->login, $inUser->nickname), '<a class="ajaxlink" href="javascript:void(0)" onclick="users.acceptFriend(' . $inUser->id . ', this);return false;">' . $_LANG['ACCEPT'] . '</a>', '<a class="ajaxlink" href="javascript:void(0)" onclick="users.rejectFriend(' . $inUser->id . ', this);return false;">' . $_LANG['REJECT'] . '</a>'));
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['ADD_TO_FRIEND_SEND']));
}
//============================================================================//
//============================= Прекращение дружбы ==========================//
//============================================================================//
if ($do == 'delfriend') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
cmsCore::halt();
}
if (!$inUser->id || $inUser->id == $id) {
cmsCore::halt();
}
$usr = cmsUser::getShortUserData($id);
if (!$usr) {
cmsCore::error404();
}
if (cmsUser::getFriendFieldId($id)) {
$is_accepted_friend = cmsUser::isFriend($id);
if (cmsUser::deleteFriend($id)) {
// Если подтвержденный друг
if ($is_accepted_friend) {
cmsCore::jsonOutput(array('error' => false, 'text' => $usr['nickname'] . $_LANG['DEL_FRIEND']));
} else {
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['REJECT_FRIEND'] . $usr['nickname']));
}
} else {
cmsCore::halt();
}
} else {
cmsCore::halt();
}
}
示例4: blogs
//.........这里部分代码省略.........
if (IS_BILLING){ cmsBilling::process('blogs', 'add_post'); }
$mod['pubdate'] = date( 'Y-m-d H:i:s');
$mod['user_id'] = cmsCore::c('user')->id;
// добавляем пост, получая его id и seolink
$added = cmsCore::c('blog')->addPost($mod);
$mod = array_merge($mod, $added);
if ($mod['published']) {
$mod['seolink'] = cmsCore::m('blogs')->getPostURL($blog['seolink'], $mod['seolink']);
if ($blog['allow_who'] != 'nobody' && $mod['allow_who'] != 'nobody') {
cmsCore::callEvent('ADD_POST_DONE', $mod);
cmsActions::log('add_post', array(
'object' => $mod['title'],
'object_url' => $mod['seolink'],
'object_id' => $mod['id'],
'target' => $blog['title'],
'target_url' => cmsCore::m('blogs')->getBlogURL($blog['seolink']),
'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($mod['seolink']);
}
if (!$mod['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink(cmsCore::c('user')->login, cmsCore::c('user')->nickname), $_LANG['MSG_POST_SUBMIT']);
$message = str_replace('%post%', '<a href="'.cmsCore::m('blogs')->getPostURL($blog['seolink'], $added['seolink']).'">'.$mod['title'].'</a>', $message);
$message = str_replace('%blog%', '<a href="'.cmsCore::m('blogs')->getBlogURL($blog['seolink']).'">'.$blog['title'].'</a>', $message);
cmsUser::sendMessage(USER_UPDATER, $blog['user_id'], $message);
cmsCore::addSessionMessage($_LANG['POST_PREMODER_TEXT'], 'info');
cmsCore::redirect(cmsCore::m('blogs')->getBlogURL($blog['seolink']));
}
}
//...или сохраняем пост после редактирования
if ($inCore->do=='editpost') {
if (cmsCore::m('blogs')->config['update_date']){
$mod['pubdate'] = date( 'Y-m-d H:i:s');
}
$mod['edit_times'] = (int)$post['edit_times']+1;
$new_post_seolink = cmsCore::c('blog')->updatePost($post['id'], $mod, cmsCore::m('blogs')->config['update_seo_link']);
$post['seolink'] = is_string($new_post_seolink) ? $new_post_seolink : $post['seolink'];
cmsActions::updateLog(
'add_post',
array(
'object' => $mod['title'],
'pubdate' => cmsCore::m('blogs')->config['update_date'] ? $mod['pubdate'] : $post['pubdate'],
'object_url' => cmsCore::m('blogs')->getPostURL($blog['seolink'], $post['seolink'])
),
$post['id']
);
示例5: clubs
//.........这里部分代码省略.........
if ($club['clubtype']=='private'){ cmsCore::halt(); }
// Получаем список друзей
$friends = cmsUser::getFriends($inUser->id);
// Получаем список участников
$members = $model->getClubMembersIds();
// Проверяем наличие друга в списке участников клуба или является ли он администратором
foreach($friends as $key=>$friend){
if (in_array($friend['id'], $members) || $friend['id'] == $club['admin_id']) { unset($friends[$key]); }
}
// Если нет друзей или все друзья уже в этом клубе, то выводим ошибку и возвращаемся назад
if (!$friends){
cmsCore::jsonOutput(array('error' => true, 'text' => $_LANG['SEND_INVITE_ERROR']));
}
// показываем форму для приглашения
if (!cmsCore::inRequest('join')){
// Выводим шаблон
cmsPage::initTemplate('components', 'com_clubs_join_member')->
assign('club', $club)->
assign('friends', $friends)->
display();
cmsCore::jsonOutput(array('error' => false,'html' => ob_get_clean()));
} else { // Приглашаем
$users = cmsCore::request('users', 'array_int', array());
if ($users){
$club_link = '<a href="/clubs/'.$club['id'].'">'.$club['title'].'</a>';
$user_link = cmsUser::getProfileLink($inUser->login, $inUser->nickname);
$link_join = '<a href="/clubs/'.$club['id'].'">'.$_LANG['JOIN_CLUB'] .'</a>';
$message = str_replace(array('%user%','%club%','%link_join%'),
array($user_link,$club_link,$link_join), $_LANG['INVITE_CLUB_TEXT']);
cmsUser::sendMessages(USER_UPDATER, $users, $message);
}
cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['SEND_INVITE_OK']));
}
}
///////////////////////// ПРОСМОТР УЧАСТНИКОВ //////////////////////////////////
if ($do=='members'){
$club = $model->getClub($id);
if(!$club){ return false; }
if (!$club['published'] && !$inUser->is_admin) { return false; }
$inPage->setTitle($_LANG['CLUB_MEMBERS'].' - '.$club['title']);
$inPage->setDescription($_LANG['CLUB_MEMBERS'].' - '.$club['title']);
$inPage->addPathway($club['title'], '/clubs/'.$club['id']);
$inPage->addPathway($_LANG['CLUB_MEMBERS'].' - '.$club['title']);
// Инициализируем участников клуба
$model->initClubMembers($club['id']);
// права доступа
$is_admin = $inUser->is_admin || ($inUser->id == $club['admin_id']);
$is_moder = $model->checkUserRightsInClub('moderator');
示例6: 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') {
// Получаем добавленную статью
$article = $model->getArticle($article_id);
if (!$article['published']) {
cmsCore::addSessionMessage($_LANG['ARTICLE_PREMODER_TEXT'], 'info');
// отсылаем уведомление администраторам
$link = '<a href="' . $model->getArticleURL(null, $article['seolink']) . '">' . $article['title'] . '</a>';
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_ARTICLE_SUBMIT']);
$message = str_replace('%link%', $link, $message);
cmsUser::sendMessageToGroup(USER_UPDATER, cmsUser::getAdminGroups(), $message);
} else {
//регистрируем событие
cmsActions::log('add_article', array('object' => $article['title'], 'object_url' => $model->getArticleURL(null, $article['seolink']), 'object_id' => $article['id'], 'target' => $article['cat_title'], 'target_url' => $model->getCategoryURL(null, $article['catseolink']), 'target_id' => $article['category_id'], 'description' => ''));
if (IS_BILLING) {
$category_cost = $article['cost'] === '' ? false : (int) $article['cost'];
cmsBilling::process('content', 'add_content', $category_cost);
}
cmsUser::checkAwards($inUser->id);
}
cmsCore::addSessionMessage($_LANG['ARTICLE_SAVE'], 'info');
cmsCore::redirect('/my.html');
}
// Редактирование статьи
if ($do == 'editarticle') {
$model->updateArticle($item['id'], $article, true);
cmsActions::updateLog('add_article', array('object' => $article['title']), $item['id']);
if (!$article['published']) {
$link = '<a href="' . $model->getArticleURL(null, $item['seolink']) . '">' . $article['title'] . '</a>';
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_ARTICLE_EDITED']);
$message = str_replace('%link%', $link, $message);
cmsUser::sendMessageToGroup(USER_UPDATER, cmsUser::getAdminGroups(), $message);
}
$mess = $article['published'] ? $_LANG['ARTICLE_SAVE'] : $_LANG['ARTICLE_SAVE'] . ' ' . $_LANG['ARTICLE_PREMODER_TEXT'];
cmsCore::addSessionMessage($mess, 'info');
cmsCore::redirect($model->getArticleURL(null, $item['seolink']));
}
}
}
///////////////////////// PUBLISH ARTICLE /////////////////////////////////////////////////////////////////////////////
if ($do == 'publisharticle') {
示例7: htmlspecialchars
if ($file) {
if (!cmsCore::inRequest('upload')) {
$last_id = $inDB->get_field('cms_photo_files', 'published=1 ORDER BY id DESC', 'id');
}
$photo['album_id'] = $album['id'];
$photo['file'] = $file['filename'];
$photo['title'] = $photo['title'] ? $photo['title'] . $last_id : $file['realfile'];
$photo['published'] = $inUser->is_admin || $album['public'] == 2 ? 1 : 0;
$photo['owner'] = 'photos';
$photo['user_id'] = $inUser->id;
$photo['id'] = $inPhoto->addPhoto($photo);
if ($photo['published']) {
cmsCore::callEvent('ADD_PHOTO_DONE', $photo);
$description = '<a href="/photos/photo' . $photo['id'] . '.html" class="act_photo"><img src="/images/photos/small/' . $photo['file'] . '" alt="' . htmlspecialchars(stripslashes($photo['title'])) . '" /></a>';
cmsActions::log('add_photo', array('object' => $photo['title'], 'object_url' => '/photos/photo' . $photo['id'] . '.html', 'object_id' => $photo['id'], 'target' => $album['title'], 'target_id' => $album['id'], 'target_url' => '/photos/' . $album['id'], 'description' => $description));
}
if (!$photo['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_PHOTO_SUBMIT']);
$message = str_replace('%photos%', '<a href="/photos/photo' . $photo['id'] . '.html">' . $photo['title'] . '</a>', $message);
$message = str_replace('%album%', '<a href="/photos/' . $album['id'] . '">' . $album['title'] . '</a>', $message);
cmsUser::sendMessage(USER_UPDATER, 1, $message);
cmsCore::addSessionMessage($_LANG['PHOTO_PREMODER_TEXT'], 'info');
}
if (cmsCore::inRequest('upload')) {
cmsCore::redirect('/photos/' . $album['id'] . '/uploaded.html');
}
echo "FILEID:" . $photo['id'];
} else {
header("HTTP/1.1 500 Internal Server Error");
echo $inCore->uploadError();
}
示例8: array
}
//...или сохраняем пост после редактирования
if ($bdo=='editpost') {
$mod['edit_times'] = (int)$post['edit_times']+1;
if (!$is_admin && !$is_moder) {
$mod['published'] = !$club['blog_premod'] ? 1 : 0;
}
$inBlog->updatePost($post['id'], $mod);
cmsActions::updateLog($inBlog->getTarget('actions_post'), array('object' => $mod['title']), $post['id']);
if (!($is_admin || $is_moder) && !$mod['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_CLUB_POST_UPDATE']);
$message = str_replace('%post%', '<a href="'.$model->getPostURL($club['id'], $post['seolink']).'">'.$mod['title'].'</a>', $message);
$message = str_replace('%club%', '<a href="/clubs/'.$club['id'].'">'.$club['title'].'</a>', $message);
cmsUser::sendMessage(USER_UPDATER, $club['admin_id'], $message);
cmsCore::addSessionMessage($_LANG['POST_PREMODER_TEXT'], 'info');
} else {
cmsCore::addSessionMessage($_LANG['POST_UPDATED'], 'success');
}
cmsCore::redirect($model->getPostURL($club['id'], $post['seolink']));
}
}
示例9: getMessages
public function getMessages($show_notice = false) {
if ($show_notice) { return $this->getNotices(); }
$sql = "SELECT m.*, u.id as user_id, u.nickname as author,
u.login as author_login, u.logdate,
m.from_id as sender_id, u.is_deleted,
p.imageurl {$this->inDB->select}
FROM cms_users u
INNER JOIN cms_user_profiles p ON p.user_id = u.id
{$this->inDB->join}
WHERE 1=1
{$this->inDB->where}
{$this->inDB->group_by}
{$this->inDB->order_by}\n";
if ($this->inDB->limit) {
$sql .= 'LIMIT '. $this->inDB->limit;
}
$result = $this->inDB->query($sql);
$this->inDB->resetConditions();
if (!$this->inDB->num_rows($result)) { return false; }
while ($msg = $this->inDB->fetch_assoc($result)) {
$msg['authorlink'] = cmsUser::getProfileLink($msg['author_login'], $msg['author']);
$msg['fpubdate'] = cmsCore::dateFormat($msg['senddate'], true, true, true);
$msg['user_img'] = cmsUser::getUserAvatarUrl($msg['sender_id'], 'small', $msg['imageurl'], $msg['is_deleted']);
$msg['online_status'] = cmsUser::getOnlineStatus($msg['user_id'], $msg['logdate']);
$msgs[] = $msg;
}
return $msgs;
}
示例10: formLastPostArray
private function formLastPostArray($post)
{
$post['lastpage'] = ceil($post['post_count'] / $this->config['pp_thread']);
$link = '/forum/thread' . $post['thread_id'] . '-' . $post['lastpage'] . '.html#' . $post['id'];
$post['thread_link'] = '<a href="' . $link . '">' . $post['thread_title'] . '</a>';
$post['user_link'] = cmsUser::getProfileLink($post['author_login'], $post['author_nickname']);
return $post;
}
示例11: catalog
//.........这里部分代码省略.........
if (isset($htmlfield)) {
if ($makelink) {
$field = $model->getUCSearchLink($cat['id'], $field);
} else {
//PROCESS FILTERS, if neccessary
if ($cat['filters']){
$filters = $inCore->getFilters();
if ($filters){
foreach($filters as $id=>$_data){
require_once PATH.'/filters/'.$_data['link'].'/filter.php';
$_data['link']($field);
}
}
}
$field = stripslashes($field);
}
} else {
if ($makelink) {
$field = $model->getUCSearchLink($cat['id'], $field);
}
}
}
$fields[stripslashes($value)] = stripslashes($field);
}
}
}
if ($cat['view_type']=='shop'){
$item['price'] = number_format(shopDiscountPrice($item['id'], $item['category_id'], $item['price']), 2, '.', ' ');
}
$user = $inDB->get_fields('cms_users', "id='{$item['user_id']}'", 'login, nickname');
$getProfileLink = cmsUser::getProfileLink($user['login'], $user['nickname']);
if ($cat['is_ratings']){
$ratingForm = ratingForm($ratingdata, $item['id']);
}
cmsPage::initTemplate('components', 'com_catalog_item')->
assign('shopCartLink', (isset($shopCartLink) ? $shopCartLink : ''))->
assign('getProfileLink', $getProfileLink)->
assign('tagline', tagLine($item['tags'], $cat['id']))->
assign('item', $item)->
assign('cat', $cat)->
assign('fields', $fields)->
assign('ratingForm', (isset($ratingForm) ? $ratingForm : ''))->
display('com_catalog_item.tpl');
if ($item['is_comments'] && $inCore->isComponentEnable('comments')) {
cmsCore::includeComments();
comments('catalog', $item['id'], array(), ($inUser->id == $item['user_id']));
}
return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// S H O P /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// ADD TO CART /////////////////////////////////////////////////////////////////////////////
if ($do == 'addcart'){
shopAddToCart($id, 1);
示例12: array
}
// Загружаем фото
$file = $model->initUploadClass()->uploadPhoto();
if ($file) {
if (!cmsCore::inRequest('upload')) {
$last_id = $inDB->get_field('cms_photo_files', 'published=1 ORDER BY id DESC', 'id');
}
$photo['album_id'] = $album['id'];
$photo['file'] = $file['filename'];
$photo['title'] = $photo['title'] ? $photo['title'] . $last_id : $file['realfile'];
$photo['published'] = $is_admin || $is_moder ? 1 : (int) (!$club['photo_premod']);
$photo['owner'] = 'club' . $club['id'];
$photo['user_id'] = $inUser->id;
$photo_id = $inPhoto->addPhoto($photo);
if ($photo['published']) {
$description = $club['clubtype'] == 'private' ? '' : '<a href="/clubs/photo' . $photo_id . '.html" class="act_photo"><img border="0" src="/images/photos/small/' . $photo['file'] . '" /></a>';
cmsActions::log('add_photo_club', array('object' => $photo['title'], 'object_url' => '/clubs/photo' . $photo_id . '.html', 'object_id' => $photo_id, 'target' => $club['title'], 'target_id' => $photo['album_id'], 'target_url' => '/clubs/' . $club['id'], 'description' => $description));
}
if (!$photo['published']) {
$message = sprintf($_LANG['MSG_CLUB_PHOTO_SUBMIT'], cmsUser::getProfileLink($inUser->login, $inUser->nickname), '<a href="/clubs/photo' . $photo_id . '.html">' . $photo['title'] . '</a>', '<a href="/clubs/' . $club['id'] . '">' . $club['title'] . '</a>');
cmsUser::sendMessage(USER_UPDATER, $club['admin_id'], $message);
cmsCore::addSessionMessage($_LANG['PHOTO_PREMODER_TEXT'], 'info');
}
if (cmsCore::inRequest('upload')) {
cmsCore::redirect('/clubs/uploaded' . $album['id'] . '.html');
}
echo "FILEID:" . $photo_id;
} else {
header("HTTP/1.1 500 Internal Server Error");
echo $inCore->uploadError();
}
示例13: blog
//.........这里部分代码省略.........
$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');
}
$mod['edit_times'] = (int) $post['edit_times'] + 1;
$new_post_seolink = $inBlog->updatePost($post['id'], $mod, $model->config['update_seo_link']);
$post['seolink'] = is_string($new_post_seolink) ? $new_post_seolink : $post['seolink'];
cmsActions::updateLog('add_post', array('object' => $mod['title'], 'pubdate' => $model->config['update_date'] ? $mod['pubdate'] : $post['pubdate'], 'object_url' => $model->getPostURL('', $post['seolink'])), $post['id']);
if (!$mod['published']) {
$message = str_replace('%user%', cmsUser::getProfileLink($inUser->login, $inUser->nickname), $_LANG['MSG_POST_UPDATE']);
$message = str_replace('%post%', '<a href="' . $model->getPostURL('', $post['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');
} else {
cmsCore::addSessionMessage($_LANG['POST_UPDATED'], 'success');
}
cmsCore::redirect($model->getPostURL('', $post['seolink']));
}
}
}
////////// НОВАЯ РУБРИКА / РЕДАКТИРОВАНИЕ РУБРИКИ //////////////////////////////////////////////////////
if ($do == 'newcat' || $do == 'editcat') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {