本文整理汇总了PHP中cmsCore::callEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::callEvent方法的具体用法?PHP cmsCore::callEvent怎么用?PHP cmsCore::callEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::callEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rss_content
function rss_content($item_id, $cfg) {
if (!cmsCore::getInstance()->isComponentEnable('content')) { return false; }
global $_LANG;
$channel = array();
$items = array();
if ($item_id) {
$cat = cmsCore::c('db')->getNsCategory('cms_category', (int)$item_id);
if (!$cat) { return false; }
$cat = cmsCore::callEvent('GET_CONTENT_CAT', $cat);
if (!$cat['published']) { return false; }
if (!cmsCore::checkUserAccess('category', $cat['id']) ) {
return false;
}
cmsCore::m('content')->whereThisAndNestedCats($cat['NSLeft'], $cat['NSRight']);
$channel['title'] = $cat['title'] ;
$channel['description'] = $cat['description'];
$channel['link'] = HOST . cmsCore::m('content')->getCategoryURL(0, $cat['seolink']);
} else {
$channel['title'] = $_LANG['NEW_MATERIALS'];
$channel['description'] = $_LANG['LAST_ARTICLES_NEWS'];
$channel['link'] = HOST .'/content';
}
cmsCore::c('db')->where('con.showlatest = 1');
cmsCore::c('db')->orderBy('con.pubdate', 'DESC');
cmsCore::c('db')->limit($cfg['maxitems']);
$content = cmsCore::m('content')->getArticlesList();
if ($content) {
foreach($content as $con){
$con['link'] = HOST . $con['url'];
$con['comments'] = $con['link'].'#c';
$con['category'] = $con['cat_title'];
if ($con['image']) {
$con['size'] = round(filesize(PATH . $con['image']));
$con['image'] = HOST . $con['image'];
}
$items[] = $con;
}
}
return array(
'channel' => $channel,
'items' => $items
);
}
示例2: deletePoll
public function deletePoll($poll_id)
{
cmsCore::callEvent('DELETE_POLL', $poll_id);
$sql = "DELETE FROM cms_polls WHERE id = '{$poll_id}' LIMIT 1";
$this->inDB->query($sql);
$sql = "DELETE FROM cms_polls_log WHERE poll_id = '{$poll_id}'";
$this->inDB->query($sql);
return true;
}
示例3: getPagebar
/**
* Возвращает код панели для постраничной навигации
* @param int $total
* @param int $page
* @param int $perpage
* @param string $link
* @param array $params
* @return html
*/
public static function getPagebar($total, $page, $perpage, $link, $params = array())
{
$pagebar = cmsCore::callEvent('GET_PAGEBAR', array($total, $page, $perpage, $link, $params));
if (!is_array($pagebar) && $pagebar) {
return $pagebar;
}
global $_LANG;
$html = '<div class="pagebar">';
$html .= '<span class="pagebar_title"><strong>' . $_LANG['PAGES'] . ': </strong></span>';
$total_pages = ceil($total / $perpage);
if ($total_pages < 2) {
return;
}
//configure for the starting links per page
$max = 3;
//used in the loop
$max_links = $max + 1;
$h = 1;
//if page is above max link
if ($page > $max_links) {
//start of loop
$h = $h + $page - $max_links;
}
//if page is not page one
if ($page >= 1) {
//top of the loop extends
$max_links = $max_links + ($page - 1);
}
//if the top page is visible then reset the top of the loop to the $total_pages
if ($max_links > $total_pages) {
$max_links = $total_pages + 1;
}
//next and prev buttons
if ($page > 1) {
$href = $link;
if (is_array($params)) {
foreach ($params as $param => $value) {
$href = str_replace('%' . $param . '%', $value, $href);
}
}
$html .= ' <a href="' . str_replace('%page%', 1, $href) . '" class="pagebar_page">«</a> ';
//'.$_LANG['FIRST'].'
$html .= ' <a href="' . str_replace('%page%', $page - 1, $href) . '" class="pagebar_page1"><</a> ';
//'.$_LANG['PREVIOUS'].'
}
//create the page links
for ($i = $h; $i < $max_links; $i++) {
if ($i == $page) {
$html .= '<span class="pagebar_current">' . $i . '</span>';
} else {
$href = $link;
if (is_array($params)) {
foreach ($params as $param => $value) {
$href = str_replace('%' . $param . '%', $value, $href);
}
}
$href = str_replace('%page%', $i, $href);
$html .= ' <a href="' . $href . '" class="pagebar_page">' . $i . '</a> ';
}
}
//Next and last buttons
if ($page >= 1 && $page != $total_pages) {
$href = $link;
if (is_array($params)) {
foreach ($params as $param => $value) {
$href = str_replace('%' . $param . '%', $value, $href);
}
}
$html .= ' <a href="' . str_replace('%page%', $page + 1, $href) . '" class="pagebar_page1">></a> ';
//'.$_LANG['NEXT'].'
$html .= ' <a href="' . str_replace('%page%', $total_pages, $href) . '" class="pagebar_page">»</a> ';
//'.$_LANG['LAST'].'
}
$html .= '</div>';
return $html;
}
示例4: blogs
//.........这里部分代码省略.........
$mod['meta_desc'] = cmsCore::request('meta_desc', 'str', '');
}
$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 ($inCore->do=='newpost'){
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']));
}
}
//...или сохраняем пост после редактирования
示例5: 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();
// Добавлять могут только админы и те, кому разрешено в настройках группы
//.........这里部分代码省略.........
示例6: getArhiveContent
public function getArhiveContent(){
$sql = "SELECT ". cmsCore::c('db')->select ."
FROM cms_content con
". cmsCore::c('db')->join ."
WHERE 1=1 ". cmsCore::c('db')->where ."
". cmsCore::c('db')->group_by ."
". cmsCore::c('db')->order_by ."\n";
if (cmsCore::c('db')->limit){
$sql .= "LIMIT ". cmsCore::c('db')->limit;
}
$result = cmsCore::c('db')->query($sql);
cmsCore::c('db')->resetConditions();
if (!cmsCore::c('db')->num_rows($result)) { return array(); }
while ($item = cmsCore::c('db')->fetch_assoc($result)){
if(!isset($item['seolink'])){
$item['fmonth'] = cmsCore::intMonthToStr($item['month']);
} else {
$item['url'] = cmsCore::m('content')->getArticleURL(0, $item['seolink']);
$item['category_url'] = cmsCore::m('content')->getCategoryURL(0, $item['cat_seolink']);
$item['fpubdate'] = cmsCore::dateFormat($item['pubdate']);
}
$item['image'] = (file_exists(PATH.'/images/photos/small/article'.$item['id'].'.jpg') ?
'article'.$item['id'].'.jpg' : '');
$content[] = $item;
}
return cmsCore::callEvent('GET_ARHIVE', $content);
}
示例7: clubs
//.........这里部分代码省略.........
assign('club', $club)->
assign('moders_list', $moders_list)->
assign('members_list', $members_list)->
assign('friends_list', $friends_list)->
assign('fr_members_list', $fr_members_list)->
assign('is_billing', IS_BILLING)->
assign('is_admin', $inUser->is_admin)->
assign('cfg', $model->config)->
display();
}
}
///////////////////////// ВЫХОД ИЗ КЛУБА ///////////////////////////////////////////
if ($do == 'leave'){
if(!$inUser->id) { return false; }
if(!cmsCore::isAjax()) { return false; }
$club = $model->getClub($id);
if(!$club){ cmsCore::halt(); }
// Инициализируем участников клуба
$model->initClubMembers($club['id']);
// Выйти из клуба могут только его участники
$is_admin = $inUser->id == $club['admin_id'];
$is_member = $model->checkUserRightsInClub();
if ($is_admin || !$is_member){ cmsCore::halt(); }
if (cmsCore::inRequest('confirm')){
if(!cmsUser::checkCsrfToken()) { cmsCore::halt(); }
cmsCore::callEvent('LEAVE_CLUB', $club);
$model->removeUserFromClub($club['id'], $inUser->id);
// Пересчитываем рейтинг
$model->setClubRating($club['id']);
// Кешируем (пересчитываем) количество участников
$model->setClubMembersCount($club['id']);
// Добавляем событие в ленте активности
cmsActions::removeObjectLog('add_club_user', $club['id'], $inUser->id);
cmsCore::addSessionMessage($_LANG['YOU_LEAVE_CLUB'].'"'.$club['title'].'"', 'success');
cmsCore::jsonOutput(array('error' => false, 'redirect' => '/clubs/'.$club['id']));
}
}
///////////////////////// ВСТУПЛЕНИЕ В КЛУБ ////////////////////////////////////
if ($do == 'join'){
if (!$inUser->id){ cmsCore::halt(); }
$club = $model->getClub($id);
if(!$club){ cmsCore::halt(); }
// В приватный клуб участников добавляет администратор
if ($club['clubtype']=='private'){ cmsCore::halt(); }
// Инициализируем участников клуба
$model->initClubMembers($club['id']);
// проверяем наличие пользователя в клубе
$is_admin = $inUser->id == $club['admin_id'];
$is_member = $model->checkUserRightsInClub();
if ($is_admin || $is_member){ cmsCore::halt(); }
示例8: array
</label>
</td>
</tr>
</table>
<p class="lf_submit">
<input type="submit" name="login_btn" value="<?php
echo $this->_tpl_vars['LANG']['SITE_LOGIN_SUBMIT'];
?>
" tabindex="4" />
</p>
</form>
</td>
<td valign="top">
<?php
cmsCore::callEvent('LOGINZA_BUTTON', array());
?>
</td>
</tr>
</table>
<script type="text/javascript">
<?php
echo '
$(document).ready(function(){
$(\'.login_form #login_field\').focus();
});
';
?>
开发者ID:vicktorwork,项目名称:cms1,代码行数:30,代码来源:_default_^%%4E^4E5^4E568BC2%%com_registration_login.tpl.php
示例9: array
$form_id = $inDB->insert('cms_forms', cmsCore::callEvent('ADD_FORM', $item));
cmsCore::addSessionMessage($_LANG['AD_FORM_SUCCESFULL_CREATED']);
} else {
$form_id = cmsCore::request('item_id', 'int');
$inDB->update('cms_forms', cmsCore::callEvent('UPDATE_FORM', $item), $form_id);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] . '.');
}
cmsCore::redirect('?view=components&do=config&id=' . $id . '&opt=edit&item_id=' . $form_id);
}
if ($opt == 'delete') {
$item_id = cmsCore::request('item_id', 'int');
$mod = $inDB->get_fields('cms_forms', "id = '{$item_id}'", '*');
if (!$mod) {
cmsCore::error404();
}
cmsCore::callEvent('DELETE_FORM', $item_id);
$inDB->delete('cms_forms', "id = '{$item_id}'", 1);
$inDB->delete('cms_form_fields', "form_id = '{$item_id}'");
files_remove_directory(PATH . '/upload/forms/' . $item_id);
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'] . '.');
cmsCore::redirect('?view=components&do=config&id=' . $id . '&opt=list');
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if ($opt == 'list') {
$fields[] = array('title' => 'id', 'field' => 'id', 'width' => '30');
$fields[] = array('title' => $_LANG['TITLE'], 'field' => 'title', 'width' => '', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit&item_id=%id%');
$fields[] = array('title' => $_LANG['AD_E-MAIL'], 'field' => 'email', 'width' => '150');
$actions[] = array('title' => $_LANG['EDIT'], 'icon' => 'edit.gif', 'link' => '?view=components&do=config&id=' . $id . '&opt=edit&item_id=%id%');
$actions[] = array('title' => $_LANG['DELETE'], 'icon' => 'delete.gif', 'confirm' => $_LANG['AD_FORM_DELETE'], 'link' => '?view=components&do=config&id=' . $id . '&opt=delete&item_id=%id%');
cpListTable('cms_forms', $fields, $actions);
}
示例10: fenom_function_callEvent
function fenom_function_callEvent($params)
{
cmsCore::callEvent($params['event'], empty($params['item']) ? array() : $params['item']);
}
示例11: getPhotos
/**
* Возвращает массив фотографий по заданным условиям
* @param bool $show_all
* @param bool $is_rating
* @return array $photos
*/
public function getPhotos($show_all = false, $is_comments_count = false){
$pub_where = ($show_all ? '1=1' : 'f.published = 1');
$sql = "SELECT f.* ". cmsCore::c('db')->select ."
FROM cms_photo_files f
". cmsCore::c('db')->join ."
WHERE ". $pub_where ."
". cmsCore::c('db')->where ."
". cmsCore::c('db')->group_by ."
". cmsCore::c('db')->order_by ."\n";
if (cmsCore::c('db')->limit){
$sql .= "LIMIT ". cmsCore::c('db')->limit;
}
$result = cmsCore::c('db')->query($sql);
cmsCore::c('db')->resetConditions();
if(!cmsCore::c('db')->num_rows($result)){ return false; }
$photos = array();
while ($photo = cmsCore::c('db')->fetch_assoc($result)){
if($is_comments_count){
$photo['comments'] = cmsCore::getCommentsCount(($photo['owner']=='photos' ? 'photo' : 'club_photo'), $photo['id']);
}
$photo['pubdate'] = cmsCore::dateFormat($photo['pubdate'], false, false, false);
$photos[] = $photo;
}
return cmsCore::callEvent('GET_PHOTOS', $photos);
}
示例12: array
if(!$club) { cmsCore::halt(); }
if(!$club['enabled_blogs']){ cmsCore::halt(); }
$model->initClubMembers($club['id']);
$is_admin = $inUser->is_admin || ($inUser->id == $club['admin_id']);
$is_moder = $model->checkUserRightsInClub('moderator');
if (!$is_admin && !$is_moder) { cmsCore::halt(); }
$inBlog->publishPost($post_id);
$post['seolink'] = $model->getPostURL($club['id'], $post['seolink']);
if ($club['clubtype'] != 'private' && $post['allow_who'] == 'all') { cmsCore::callEvent('ADD_POST_DONE', $post); }
if ($club['clubtype'] != 'private' && $post['allow_who'] != 'nobody'){
if(!cmsCore::c('db')->get_field('cms_actions_log', "object_id = '". $post['id'] ."' AND object_url = '". $post['seolink'] ."'", 'id')){
cmsActions::log($inBlog->getTarget('actions_post'), array(
'object' => $post['title'],
'user_id' => $post['user_id'],
'object_url' => $post['seolink'],
'object_id' => $post['id'],
'target' => $club['title'],
'target_url' => '/clubs/'.$club['id'],
'target_id' => $club['id'],
'description' => '',
'is_friends_only' => (int)($post['allow_who'] == 'friends')
));
示例13: getActionsLog
/**
* Возвращает массив событий для ленты активности
* @return array
*/
public function getActionsLog()
{
$inUser = cmsUser::getInstance();
if (!$this->only_friends) {
$this->inDB->where('log.is_friends_only = 0');
}
if (!$inUser->id) {
$this->inDB->where('log.is_users_only = 0');
}
$sql = "SELECT log.id as id,\n log.user_id,\n log.object,\n log.object_url,\n log.target,\n log.target_url,\n log.pubdate,\n log.description,\n a.message,\n a.name,\n u.nickname as user_nickname,\n u.login as user_login\n FROM cms_actions_log log\n LEFT JOIN cms_actions a ON a.id = log.action_id AND a.is_visible = 1\n LEFT JOIN cms_users u ON u.id = log.user_id\n WHERE 1=1 {$this->inDB->where}\n ORDER BY log.id DESC\n\t\t\t\t";
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;
}
$actions = array();
while ($action = $this->inDB->fetch_assoc($result)) {
$action['object_link'] = $action['target_link'] = '';
if ($action['object']) {
$action['object_link'] = $action['object_url'] ? '<a href="' . $action['object_url'] . '" class="act_obj_' . $action['name'] . '">' . $action['object'] . '</a>' : $action['object'];
}
if ($action['target']) {
$action['target_link'] = '<a href="' . $action['target_url'] . '" class="act_tgt_' . $action['name'] . '">' . $action['target'] . '</a>';
}
if ($action['message']) {
$target_pos = mb_strpos($action['message'], '|');
if ($target_pos !== false) {
if (!$this->show_targets || !$action['target']) {
$action['message'] = mb_substr($action['message'], 0, $target_pos);
} else {
$action['message'] = str_replace('|', '', $action['message']);
}
}
$action['message'] = sprintf($action['message'], $action['object_link'], $action['target_link']);
}
$action['is_new'] = (bool) (strtotime($action['pubdate']) > strtotime($inUser->logdate));
$action['user_url'] = cmsUser::getProfileURL($action['user_login']);
$action['pubdate'] = cmsCore::dateDiffNow($action['pubdate']);
$actions[] = $action;
}
return cmsCore::callEvent('GET_ACTIONS', $actions);
}
示例14: array
if (cmsCore::request('copy_parent_struct')) {
$fstruct = cmsCore::c('db')->get_field('cms_uc_cats', "id='{$cat['parent_id']}'", 'fieldsstruct');
} else {
$fstruct = cmsCore::request('fstruct', 'array', array());
foreach ($fstruct as $key=>$value) {
if ($value=='') { unset($fstruct[$key]); continue; }
if ($_REQUEST['fformat'][$key]=='html') { $fstruct[$key] .= '/~h~/'; }
if ($_REQUEST['fformat'][$key]=='link') { $fstruct[$key] .= '/~l~/'; }
if ($_REQUEST['flink'][$key]) { $fstruct[$key] .= '/~m~/'; }
}
$fstruct = cmsCore::arrayToYaml($fstruct);
}
$cat['fieldsstruct'] = cmsCore::c('db')->escape_string($fstruct);
if ($opt == 'submit_cat') {
$cat_id = cmsCore::c('db')->addNsCategory('cms_uc_cats', cmsCore::callEvent('ADD_CATALOG_CAT', $cat));
} else {
$cat_id = cmsCore::request('item_id', 'int', 0);
$model->updateCategory($cat_id, $cat);
}
if ($cat['is_public']) {
$showfor = cmsCore::request('showfor', 'array_int', array());
if ($showfor) {
$model->setCategoryAccess($cat_id, $showfor);
}
} else {
$model->clearCategoryAccess($cat_id);
}
cmsCore::addSessionMessage($_LANG['AD_DO_SUCCESS'], 'success');
示例15: board
//.........这里部分代码省略.........
cmsCore::m('board')->setVip($add['id'], $vipdays);
}
if (IS_BILLING) {
cmsBilling::process('board', 'add_item');
if (cmsCore::m('board')->config['vip_enabled'] && $vipdays && cmsCore::m('board')->config['vip_day_cost']) {
if ($vipdays > cmsCore::m('board')->config['vip_max_days']) {
$vipdays = cmsCore::m('board')->config['vip_max_days'];
}
$summ = $vipdays * cmsCore::m('board')->config['vip_day_cost'];
if (cmsCore::c('user')->balance >= $summ) {
cmsBilling::pay(cmsCore::c('user')->id, $summ, $_LANG['VIP_ITEM']);
cmsCore::m('board')->setVip($add['id'], $vipdays);
}
}
}
cmsUser::sessionClearAll();
if ($published) {
//регистрируем событие
cmsActions::log('add_board', array(
'object' => $obtype .' '. $title,
'object_url' => '/board/read'. $add['id'] .'.html',
'object_id' => $add['id'],
'target' => $cat['title'],
'target_url' => '/board/'. $cat['id'],
'target_id' => $cat['id'],
'description' => ''
));
cmsCore::addSessionMessage($_LANG['ADV_IS_ADDED'], 'success');
cmsCore::callEvent('ADD_BOARD_DONE', $add);
cmsCore::redirect('/board/read'. $add['id'] .'.html');
}
if (!$published) {
$link = '<a href="/board/read'. $add['id'] .'.html">'. $obtype .' '. $title .'</a>';
if (cmsCore::c('user')->id) {
$user = '<a href="'. cmsUser::getProfileURL(cmsCore::c('user')->login) .'">'. cmsCore::c('user')->nickname .'</a>';
} else {
$user = $_LANG['BOARD_GUEST'] .', ip: '. cmsCore::c('user')->ip;
}
$message = str_replace('%user%', $user, $_LANG['MSG_ADV_SUBMIT']);
$message = str_replace('%link%', $link, $message);
cmsUser::sendMessage(USER_UPDATER, 1, $message);
cmsCore::addSessionMessage($_LANG['ADV_IS_ADDED'] .'<br>'. $_LANG['ADV_PREMODER_TEXT'], 'success');
cmsCore::redirect('/board/'.cmsCore::m('board')->category_id);
}
}
}
/////////////////////////////// EDIT BOARD ITEM ////////////////////////////////
if ($do == 'edititem') {
$item = cmsCore::m('board')->getRecord(cmsCore::m('board')->item_id);
$cat = cmsCore::m('board')->getCategory($item['category_id']);
if (!$cat || !$item) { cmsCore::error404(); }
cmsCore::c('page')->setTitle($_LANG['EDIT_ADV']);
cmsCore::c('page')->addPathway($item['category'], '/board/'. $item['cat_id']);
cmsCore::c('page')->addPathway($_LANG['EDIT_ADV']);
if (!$item['moderator']) {