本文整理汇总了PHP中cmsActions::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsActions::getInstance方法的具体用法?PHP cmsActions::getInstance怎么用?PHP cmsActions::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsActions
的用法示例。
在下文中一共展示了cmsActions::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mod_actions
function mod_actions(array $mod, $cfg)
{
$inDB = cmsDatabase::getInstance();
$inActions = cmsActions::getInstance();
global $_LANG;
if (!isset($cfg['show_target'])) {
$cfg['show_target'] = 1;
}
if (!isset($cfg['limit'])) {
$cfg['limit'] = 15;
}
if (!isset($cfg['show_link'])) {
$cfg['show_link'] = 1;
}
if (!isset($cfg['action_types'])) {
echo $_LANG['MODULE_NOT_CONFIGURED'];
return true;
}
if (!$cfg['show_target']) {
$inActions->showTargets(false);
}
$inActions->onlySelectedTypes($cfg['action_types']);
$inDB->limitIs($cfg['limit']);
$actions = $inActions->getActionsLog();
if (!$actions) {
return false;
}
cmsPage::initTemplate('modules', $cfg['tpl'])->assign('actions', $actions)->assign('cfg', $cfg)->assign('user_id', cmsUser::getInstance()->id)->display($cfg['tpl']);
return true;
}
示例2: mod_actions_new
function mod_actions_new($module_id)
{
$inCore = cmsCore::getInstance();
$inUser = cmsUser::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
$cfg = $inCore->loadModuleConfig($module_id);
if (!isset($cfg['show_target'])) {
$cfg['show_target'] = 1;
}
if (!isset($cfg['limit'])) {
$cfg['limit'] = 15;
}
if (!isset($cfg['show_link'])) {
$cfg['show_link'] = 1;
}
if (!isset($cfg['action_types'])) {
echo $_LANG['MODULE_NOT_CONFIGURED'];
return true;
}
$inActions = cmsActions::getInstance();
if (!$cfg['show_target']) {
$inActions->showTargets(false);
}
$inActions->onlySelectedTypes($cfg['action_types']);
$inActions->limitIs($cfg['limit']);
$actions = $inActions->getActionsLog();
$new_actions = array();
foreach ($actions as $action) {
$user = $inUser->getuserByLogin($action['user_login']);
$user_id = $user['id'];
$action['user_online'] = $inUser->isOnline($user['id']);
$action['user_ava'] = $inDB->get_field('cms_user_profiles', "user_id={$user_id}", 'imageurl');
$new_actions[] = $action;
}
$smarty = $inCore->initSmarty('modules', 'mod_actions_new.tpl');
$smarty->assign('actions', $new_actions);
$smarty->assign('cfg', $cfg);
$smarty->display('mod_actions_new.tpl');
return true;
}
示例3: applet_main
function applet_main()
{
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
global $_LANG;
$GLOBALS['cp_page_title'] = $_LANG['PATH_HOME'];
?>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="275" valign="top" style="padding-left:0px;">
<div class="small_box">
<div class="small_title"><?php
echo $_LANG['AD_SITE_CONTENT'];
?>
</div>
<div style="padding:8px">
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<?php
if ($inCore->isComponentEnable('content')) {
$new['content'] = (int) newContent('cms_content');
?>
<tr>
<td><a href="index.php?view=tree"><?php
echo $_LANG['AD_ARTICLES'];
?>
</a> <?php
if ($new['content']) {
?>
<span class="new_content">+<?php
echo $new['content'];
?>
</span><?php
}
?>
</td>
<td width="20" align="center"><a href="index.php?view=cats&do=add"><img src="/admin/images/mainpage/folder_add.png" alt="<?php
echo $_LANG['AD_CREATE_SECTION'];
?>
" width="16" height="16" border="0" /></a></td>
<td width="20" align="center"><a href="index.php?view=content&do=add"><img src="/admin/images/mainpage/page_add.png" alt="<?php
echo $_LANG['AD_CREATE_ARTICLE'];
?>
" width="16" height="16" border="0" /></a></td>
</tr>
<?php
}
?>
<?php
if ($inCore->isComponentEnable('photos')) {
$new['photos'] = (int) newContent('cms_photo_files');
?>
<tr>
<td><a href="index.php?view=components&do=config&link=photos"><?php
echo $_LANG['AD_PHOTOGALLERY'];
?>
</a> <?php
if ($new['photos']) {
?>
<span class="new_content">+<?php
echo $new['photos'];
?>
</span><?php
}
?>
</td>
<td align="center"><a href="index.php?view=components&do=config&link=photos&opt=add_album"><img src="/admin/images/mainpage/folder_add.png" alt="<?php
echo $_LANG['AD_CREATE_ALBUM'];
?>
" width="16" height="16" border="0" /></a></td>
<td align="center"></td>
</tr>
<?php
}
?>
<?php
if ($inCore->isComponentEnable('video')) {
$new['video'] = (int) newContent('cms_video_movie');
?>
<tr>
<td><a href="index.php?view=components&do=config&link=video"><?php
echo $_LANG['AD_VIDEOGALLERY'];
?>
</a> <?php
if ($new['video']) {
?>
<span class="new_content">+<?php
echo $new['video'];
?>
</span><?php
}
?>
</td>
<td align="center"><a href="index.php?view=components&do=config&link=video&opt=add_cat"><img src="/admin/images/mainpage/folder_add.png" alt="<?php
echo $_LANG['AD_CREATE_CATEGORY'];
?>
" width="16" height="16" border="0" /></a></td>
<td align="center"></td>
</tr>
<?php
//.........这里部分代码省略.........
示例4: cms_model_actions
// InstantCMS v1.9 //
// http://www.instantcms.ru/ //
// //
// written by InstantCMS Team, 2007-2011 //
// produced by InstantSoft, (www.instantsoft.ru) //
// //
// LICENSED BY GNU/GPL v2 //
// //
/******************************************************************************/
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
$inCore = cmsCore::getInstance();
$inCore->loadModel('actions');
$model = new cms_model_actions();
$inCore->loadClass('actions');
$inActions = cmsActions::getInstance();
$opt = $inCore->request('opt', 'str', 'list');
$id = $inCore->request('id', 'int', 0);
$act_components = cmsActions::getActionsComponents();
$act_component = $inCore->request('act_component', 'str', '');
cpAddPathway('Лента активности', '?view=components&do=config&id=' . $id);
$messages = cmsCore::getSessionMessages();
if ($messages) {
?>
<div class="sess_messages">
<?php
foreach ($messages as $message) {
echo $message;
}
?>
</div>
示例5: 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()) {
//.........这里部分代码省略.........
示例6: forum
function forum()
{
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
$model = new cms_model_forum();
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) {
cmsCore::loadClass('billing');
}
global $_LANG;
$pagetitle = $inCore->getComponentTitle();
$inPage->addPathway($pagetitle, '/forum');
$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);
$id = cmsCore::request('id', 'int', 0);
$do = $inCore->do;
$page = cmsCore::request('page', 'int', 1);
$inPage->addHeadJS('components/forum/js/common.js');
$inPage->addHeadJsLang(array('CONFIRM_DELETE_POLL', 'CONFIRM_DEL_POST', 'CONFIRM_DEL_THREAD', 'MOVE_THREAD', 'MOVE_POST', 'RENAME_THREAD', 'CONFIRM_DELETE_FILE', 'SELECT_NEW_FILE_UPLOAD', 'SELECT_TEXT_QUOTE', 'CONFIRM_DELETE_ALL_USER_POSTS'));
//============================================================================//
//=============================== Список Форумов ============================//
//============================================================================//
if ($do == 'view') {
$inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . $_LANG['FORUMS'] . '" href="' . HOST . '/rss/forum/all/feed.rss">');
$forums = $model->getForums();
cmsPage::initTemplate('components', 'com_forum_list')->assign('pagetitle', $pagetitle)->assign('forums', $forums)->assign('forum', array())->assign('user_id', $inUser->id)->assign('cfg', $model->config)->display('com_forum_list.tpl');
}
//============================================================================//
//================ Список тем форума + список подфорумов ====================//
//============================================================================//
if ($do == 'forum') {
$forum = $model->getForum($id);
if (!$forum) {
cmsCore::error404();
}
$forum = translations::process(cmsConfig::getConfig('lang'), 'forum_forums', $forum);
$moderators = $model->getForumModerators($forum['moder_list']);
// опции просмотра
$order_by = cmsCore::getSearchVar('order_by', 'pubdate');
$order_to = cmsCore::getSearchVar('order_to', 'desc');
if (!in_array($order_by, array('pubdate', 'title', 'post_count', 'hits'))) {
$order_by = 'pubdate';
}
if (!in_array($order_to, array('asc', 'desc'))) {
$order_to = 'desc';
}
$daysprune = (int) cmsCore::getSearchVar('daysprune');
if (!cmsCore::checkContentAccess($forum['access_list'])) {
cmsPage::includeTemplateFile('special/accessdenied.php');
return;
}
$inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . htmlspecialchars($forum['title']) . '" href="' . HOST . '/rss/forum/' . $forum['id'] . '/feed.rss">');
$inPage->setTitle($forum['pagetitle'] ? $forum['pagetitle'] : $forum['title']);
$inPage->setDescription($forum['meta_desc'] ? $forum['meta_desc'] : crop($forum['description'] ? $forum['description'] : $forum['title']));
$inPage->setKeywords($forum['meta_keys'] ? $forum['meta_keys'] : $forum['title']);
// Получаем дерево форумов
$path_list = $inDB->getNsCategoryPath('cms_forums', $forum['NSLeft'], $forum['NSRight'], 'id, title, access_list, moder_list');
// Строим глубиномер
if ($path_list) {
$path_list = translations::process(cmsConfig::getConfig('lang'), 'forum_forums', $path_list);
foreach ($path_list as $pcat) {
if (!cmsCore::checkContentAccess($pcat['access_list'])) {
cmsPage::includeTemplateFile('special/accessdenied.php');
return;
}
$inPage->addPathway($pcat['title'], '/forum/' . $pcat['id']);
}
}
// Получим подфорумы
$model->whereNestedForum($forum['NSLeft'], $forum['NSRight']);
$sub_forums = $model->getForums();
cmsPage::initTemplate('components', 'com_forum_list')->assign('pagetitle', $forum['title'])->assign('forums', $sub_forums)->assign('forum', $forum)->assign('cfg', $model->config)->assign('user_id', $inUser->id)->display('com_forum_list.tpl');
// Получим темы
if ($daysprune) {
$model->whereDayIntervalIs($daysprune);
}
$model->whereForumIs($forum['id']);
$inDB->orderBy('t.pinned', 'DESC, t.' . $order_by . ' ' . $order_to);
$inDB->limitPage($page, $model->config['pp_forum']);
$threads = $model->getThreads();
if (!$threads && $page > 1) {
cmsCore::error404();
}
cmsPage::initTemplate('components', 'com_forum_view')->assign('threads', $threads)->assign('show_panel', true)->assign('order_by', $order_by)->assign('order_to', $order_to)->assign('daysprune', $daysprune)->assign('moderators', $moderators)->assign('pagination', cmsPage::getPagebar($forum['thread_count'], $page, $model->config['pp_forum'], '/forum/' . $forum['id'] . '-%page%'))->display('com_forum_view.tpl');
}
//============================================================================//
//======================== Просмотр темы форума =============================//
//============================================================================//
if ($do == 'thread') {
$thread = $model->getThread($id);
if (!$thread) {
cmsCore::error404();
}
// Строим глубиномер
$path_list = $inDB->getNsCategoryPath('cms_forums', $thread['NSLeft'], $thread['NSRight'], 'id, title, access_list, moder_list');
if ($path_list) {
$path_list = translations::process(cmsConfig::getConfig('lang'), 'forum_forums', $path_list);
//.........这里部分代码省略.........