本文整理汇总了PHP中cmsPage::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsPage::getInstance方法的具体用法?PHP cmsPage::getInstance怎么用?PHP cmsPage::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsPage
的用法示例。
在下文中一共展示了cmsPage::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_link_template
function display_link_template($link, $model, $time = 10)
{
global $_LANG;
$inPage = cmsPage::getInstance();
$is_domain_banned = false;
// проверяем ссылку
if (function_exists('curl_init') && $model->config['check_link']) {
$link_domain = parse_url($link, PHP_URL_HOST);
if ($model->config['white_list'] && $link_domain && !in_array($link_domain, $model->config['white_list']) || !$model->config['white_list']) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.vk.com/method/utils.checkLink?url=' . $link);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 2);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_USERAGENT, 'InstantCMS/' . CORE_VERSION . ' +' . HOST);
$data = json_decode(curl_exec($ch), true);
if (!isset($data['error']) && isset($data['response'])) {
$is_domain_banned = $data['response']['status'] == 'banned';
$link = $data['response']['link'];
}
}
}
$inPage->setTitle($_LANG['FILE_EXTERNAL_LINK']);
$inPage->setDescription($_LANG['FILE_EXTERNAL_LINK']);
cmsPage::initTemplate('components', 'com_files_redirect')->assign('url', htmlspecialchars($link))->assign('time', $time)->assign('sitename', cmsConfig::getConfig('sitename'))->assign('is_domain_banned', $is_domain_banned)->display('com_files_redirect.tpl');
}
示例2: __construct
public function __construct()
{
cmsCore::loadClass('page');
$this->inCore = cmsCore::getInstance();
$this->inDB = cmsDatabase::getInstance();
$this->inPage = cmsPage::getInstance();
}
示例3: __construct
function __construct()
{
$this->inDB = cmsDatabase::getInstance();
$this->inCore = cmsCore::getInstance();
$this->inPage = cmsPage::getInstance();
$this->inUser = cmsUser::getInstance();
$this->root = $_SERVER['DOCUMENT_ROOT'];
}
示例4: __construct
public function __construct()
{
cmsCore::loadClass('page');
$this->inCore = cmsCore::getInstance();
$this->inDB = cmsDatabase::getInstance();
$this->inPage = cmsPage::getInstance();
$this->config = array_merge($this->config, $this->inCore->loadPluginConfig(get_called_class()));
}
示例5: cpHead
function cpHead()
{
global $_LANG;
$inPage = cmsPage::getInstance();
$inPage->title = !empty($GLOBALS['cp_page_title']) ? $GLOBALS['cp_page_title'] . ' - ' . $_LANG['AD_ADMIN_PANEL'] . ' v ' . CORE_VERSION : $_LANG['AD_ADMIN_PANEL'];
array_unshift($inPage->page_head, '<script type="text/javascript" src="js/common.js"></script>');
$inPage->addHeadJsLang(array('AD_NO_SELECT_OBJECTS', 'AD_SWITCH_EDITOR', 'CANCEL', 'CONTINUE', 'CLOSE', 'ATTENTION'));
if (!empty($GLOBALS['cp_jquery'])) {
array_unshift($inPage->page_head, '<script type="text/javascript" src="' . $GLOBALS['cp_jquery'] . '"></script>');
} else {
array_unshift($inPage->page_head, '<script type="text/javascript" src="/includes/jquery/jquery.js"></script>');
}
foreach ($GLOBALS['cp_page_head'] as $key => $value) {
$inPage->addHead($value);
unset($GLOBALS['cp_page_head'][$key]);
}
$inPage->printHead();
return;
}
示例6: smarty_function_city_input
function smarty_function_city_input($params, &$smarty)
{
global $_LANG;
if (!cmsCore::getInstance()->isComponentInstalled('forms')) {
return '<input type="text" value="' . htmlspecialchars($params['value']) . '" name="' . htmlspecialchars($params['name']) . '" class="text-input" style="width:300px"/>';
}
array_walk($params, create_function('&$value', 'return htmlspecialchars($value);'));
if (!isset($params['placeholder'])) {
$params['placeholder'] = $_LANG['SELECT_CITY'];
}
if (!isset($params['width'])) {
$params['width'] = '100%';
}
if (!isset($params['input_width'])) {
$params['input_width'] = '150px';
}
if (!isset($params['city_id'])) {
$params['city_id'] = 0;
}
if (!isset($params['region_id'])) {
$params['region_id'] = 0;
}
if (!isset($params['country_id'])) {
$params['country_id'] = 0;
}
if (!isset($params['value'])) {
$params['value'] = '';
}
cmsPage::getInstance()->addHeadJS('components/geo/js/geo.js');
$id = uniqid();
$display = $params['value'] ? '' : 'style="display:none"';
return '<div class="text-input city_block" id="' . $id . '" style="width:' . $params['width'] . '">
<input type="hidden" value="' . htmlspecialchars($params['value']) . '" name="' . $params['name'] . '" class="city_name" />
<input type="hidden" value="' . $params['city_id'] . '" name="city_id" class="city_id" />
<input type="hidden" value="' . $params['region_id'] . '" name="region_id" class="region_id" />
<input type="hidden" value="' . $params['country_id'] . '" name="country_id" class="country_id" />
<input readonly="readonly" placeholder="' . $params['placeholder'] . '" type="text" value="' . $params['value'] . '" class="city_view" onclick="geo.viewForm(\'' . $id . '\');return false;" style="width:' . $params['input_width'] . '" />
<a class="city_link city_clear_link" href="#" onclick="geo.clear(\'' . $id . '\');return false;" ' . $display . '>' . $_LANG['DELETE'] . '</a>
<a class="city_link" href="#" onclick="geo.viewForm(\'' . $id . '\');return false;">' . $_LANG['SELECT'] . '</a>
</div>' . "\n";
}
示例7: arhive
function arhive()
{
global $_LANG;
$model = new cms_model_arhive();
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$pagetitle = $inCore->getComponentTitle();
$do = $inCore->do;
$inPage->setTitle($pagetitle);
$inPage->addPathway($pagetitle, '/arhive');
//======================================================================================================//
if ($do == 'view' || $do == 'y') {
if ($do == 'y') {
$pagetitle = $_LANG['ARCHIVE_MATERIALS_FROM'] . $model->year . $_LANG['ARHIVE_YEAR'];
$inPage->addPathway($model->year, '/arhive/' . $model->year);
$inPage->setTitle($pagetitle);
$model->whereYearIs();
}
$items = $model->getArhiveContent();
cmsPage::initTemplate('components', 'com_arhive_dates')->assign('pagetitle', $pagetitle)->assign('items', $items)->assign('do', $do)->display('com_arhive_dates.tpl');
}
//======================================================================================================//
if ($do == 'ymd' || $do == 'ym') {
$month_name = cmsCore::intMonthToStr($model->month);
$inPage->addPathway($model->year, '/arhive/' . $model->year);
$inPage->addPathway($month_name, '/arhive/' . $model->year . '/' . $model->month);
if ($do == 'ymd') {
$inPage->addPathway($model->day, '/arhive/' . $model->year . '/' . $model->month . '/' . $model->day);
$pagetitle = $_LANG['ARCHIVE_MATERIALS_FROM'] . $model->day . ' ' . $_LANG['MONTH_' . $model->month] . ' ' . $model->year . $_LANG['ARHIVE_YEARS'];
$model->whereDayIs();
} else {
$pagetitle = $_LANG['ARCHIVE_MATERIALS_FROM'] . $month_name . ' ' . $model->year . $_LANG['ARHIVE_YEARS'];
$model->whereMonthIs();
}
$inPage->setTitle($pagetitle);
$model->setArtticleSql();
$items = $model->getArhiveContent();
cmsPage::initTemplate('components', 'com_arhive_list')->assign('pagetitle', $pagetitle)->assign('items', $items)->display('com_arhive_list.tpl');
}
}
示例8: wishes
function wishes()
{
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
$user_id = $inUser->id;
//$inPage->addHeadJS('');
//$inPage->addHeadJS('');
global $_LANG;
$inCore->loadModel('wishes');
$model = new cms_model_wishes();
//Загрузка настроек встреч
$cfg = $inCore->loadComponentConfig('wishes');
// Проверяем включени ли компонент
if (!$cfg['component_enabled']) {
cmsCore::error404();
}
if (!isset($cfg['perpage'])) {
$cfg['perpage'] = 10;
}
if (!isset($cfg['on_main'])) {
$cfg['on_main'] = 5;
}
//Получаем параметры
$id = $inCore->request('id', 'int', 0);
$do = $inCore->request('do', 'str', 'view');
$page = $inCore->request('page', 'int', 1);
$pagetitle = "Потрібно - Допоможу";
$inPage->addPathway($pagetitle, '/wishes/all.html');
$types = array();
$sql = "select * from `cms_wishes_cat`";
$result = $inDB->query($sql);
$j = 1;
while ($tinfo = $inDB->fetch_assoc($result)) {
$types[$j]["1"] = $tinfo['class'];
$types[$j]["2"] = $tinfo['title'];
$j++;
}
$inPage->addHead('<link rel="stylesheet" href="/components/wishes/css/style.css">');
/***********************************************************/
if ($do == 'load') {
$n = $inCore->request('n', 'int', 1);
$page = $inCore->request('page', 'int', 1);
//echo $page." ".$n." дозагрузка данных<br/>";
$t = $types[$n];
$inf = $model->wish_type($n, $t, $user_id, $page, $active = 0, $types = array(), $cfg['on_main']);
echo $inf;
exit;
}
if ($do == 'delete') {
if ($model->is_author($user_id, $id) or $inUser->is_admin) {
$sql = "DELETE FROM `cms_wishes` WHERE `id` = " . $id . ";";
$result = $inDB->query($sql);
cmsCore::addSessionMessage("Успішно видалено!", 'success');
}
cmsCore::redirect('/wishes/');
}
if ($do == 'wish_item') {
$sql = "select * from `cms_wishes` where `published`='1' and `id`='" . $id . "' ";
//echo $sql;
$result = $inDB->query($sql);
$sinfo = $inDB->fetch_assoc($result);
$us = $inUser->loadUser($sinfo['user_id']);
$t = $types[$sinfo['type']];
$inPage->addPathway($t[2], '/wishes/type' . $sinfo['type'] . '.html');
$inPage->addPathway($sinfo['title'], '');
$inPage->setTitle($sinfo['title']);
echo "<h2><a href='/wishes/type" . $sinfo['type'] . ".html'>" . $t[2] . "</a> » " . $sinfo['title'] . "</h2>";
echo "<div style='font-size:11px;'><a href='/users/" . $us['login'] . "'>" . $us['nickname'] . "</a> | " . $inCore->dateformat($sinfo['datetime']) . "</div>";
if ($model->is_author($user_id, $id) or $inUser->is_admin) {
echo "<div style='float:right;'><a href='/wishes/delete" . $id . ".html'>Видалити</a></div>";
}
echo "\n\t\t\t<table width='100%'><tr><td valign='top' width='10%'>\n\t\t\t<a href='/users/" . $us['login'] . "'><img src='" . $us['imageurl'] . "' style='float:left;border-radius:10px;margin:0px 10px 10px 0px;' border='0' /></a>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t<div style='padding:10px;margin-bottom:50px; background-color:#f2f0f0; border-bottom: 1px solid #DDDDDD;border-top: 1px solid #DDDDDD;'>\n\t\t\t" . $sinfo['info'] . "</div>\n\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t";
if ($inCore->isComponentInstalled('comments')) {
cmsCore::includeComments();
comments('wishes', $sinfo['id']);
}
}
/***********************************************************/
if ($do == 'add_item') {
$title = $inCore->request('title', 'str', '');
$info = $inCore->request('info', 'str', '');
$send = $inCore->request('send', 'str', '');
$type = $id;
$guest_info = $inUser->getGuestInfo();
$user_access = $inUser->id;
if ($user_access > 0) {
/**/
/**/
/**/
/**/
$inf = "0";
$success = "0";
$tr = strlen($title);
if ($send == "ok") {
if ($tr > 0) {
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
$sql = "INSERT INTO `cms_wishes` (`id` ,\n`title` ,\n`info` ,\n`published` ,\n`datetime` ,\n`user_id` ,\n`rate` ,\n`type` ,\n`ip` ,\n`browser` \n)\nVALUES (NULL , '" . $title . "', '" . $info . "', '1', NOW(), '" . $user_id . "', '0', '" . $type . "', '" . $ip . "', '" . $browser . "'\n);";
//.........这里部分代码省略.........
示例9: fenom_function_printBody
function fenom_function_printBody($params)
{
cmsPage::getInstance()->printBody();
}
示例10: blogs
function blogs()
{
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
cmsCore::loadClass('blog');
$inBlog = cmsBlogs::getInstance();
$inBlog->owner = 'user';
global $_LANG;
$model = new cms_model_blogs();
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) {
cmsCore::loadClass('billing');
}
//Получаем параметры
$id = cmsCore::request('id', 'int', 0);
$post_id = cmsCore::request('post_id', 'int', 0);
$bloglink = cmsCore::request('bloglink', 'str', '');
$seolink = cmsCore::request('seolink', 'str', '');
$do = $inCore->do;
$page = cmsCore::request('page', 'int', 1);
$cat_id = cmsCore::request('cat_id', 'int', 0);
$ownertype = cmsCore::request('ownertype', 'str', '');
$on_moderate = cmsCore::request('on_moderate', 'int', 0);
$pagetitle = $inCore->getComponentTitle();
$inPage->addPathway($pagetitle, '/blogs');
$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);
$inPage->addHeadJsLang(array('CONFIG_BLOG', 'DEL_BLOG', 'YOU_REALY_DELETE_BLOG', 'NEW_CAT', 'RENAME_CAT', 'YOU_REALY_DELETE_CAT', 'YOU_REALY_DELETE_POST', 'NO_PUBLISHED'));
///////////////////////// МОЙ БЛОГ /////////////////////////////////////////////
if ($do == 'my_blog') {
if (!$inUser->id) {
cmsCore::error404();
}
$my_blog = $inBlog->getBlogByUserId($inUser->id);
if (!$my_blog) {
cmsCore::redirect('/blogs/createblog.html');
} else {
cmsCore::redirect($model->getBlogURL($my_blog['seolink']));
}
}
///////////////////////// ПОСЛЕДНИЕ ПОСТЫ //////////////////////////////////////
if ($do == 'view') {
$inPage->addHead('<link rel="alternate" type="application/rss+xml" title="' . $_LANG['RSS_BLOGS'] . '" href="' . HOST . '/rss/blogs/all/feed.rss">');
// кроме админов в списке только с доступом для всех
if (!$inUser->is_admin) {
$inBlog->whereOnlyPublic();
}
// ограничиваем по рейтингу если надо
if ($model->config['list_min_rating']) {
$inBlog->ratingGreaterThan($model->config['list_min_rating']);
}
// всего постов
$total = $inBlog->getPostsCount($inUser->is_admin);
//устанавливаем сортировку
$inDB->orderBy('p.pubdate', 'DESC');
$inDB->limitPage($page, $model->config['perpage']);
// сами посты
$posts = $inBlog->getPosts($inUser->is_admin, $model);
if (!$posts && $page > 1) {
cmsCore::error404();
}
cmsPage::initTemplate('components', 'com_blog_view_posts')->assign('pagetitle', $pagetitle)->assign('ownertype', $ownertype)->assign('total', $total)->assign('posts', $posts)->assign('pagination', cmsPage::getPagebar($total, $page, $model->config['perpage'], '/blogs/latest-%page%.html'))->assign('cfg', $model->config)->display('com_blog_view_posts.tpl');
}
////////// СОЗДАНИЕ БЛОГА //////////////////////////////////////////////////////
if ($do == 'create') {
//Проверяем авторизацию
if (!$inUser->id) {
cmsUser::goToLogin();
}
//Если у пользователя уже есть блог, то выходим
if ($inBlog->getUserBlogId($inUser->id)) {
cmsCore::redirectBack();
}
$inPage->addPathway($_LANG['PATH_CREATING_BLOG']);
$inPage->setTitle($_LANG['CREATE_BLOG']);
if (IS_BILLING) {
cmsBilling::checkBalance('blogs', 'add_blog');
}
//Показ формы создания блога
if (!cmsCore::inRequest('goadd')) {
cmsPage::initTemplate('components', 'com_blog_create')->assign('is_restrictions', !$inUser->is_admin && $model->config['min_karma'])->assign('cfg', $model->config)->display('com_blog_create.tpl');
}
//Сам процесс создания блога
if (cmsCore::inRequest('goadd')) {
$title = cmsCore::request('title', 'str');
$allow_who = cmsCore::request('allow_who', 'str', 'all');
$ownertype = cmsCore::request('ownertype', 'str', 'single');
//Проверяем название
if (mb_strlen($title) < 5) {
cmsCore::addSessionMessage($_LANG['BLOG_ERR_TITLE'], 'error');
cmsCore::redirect('/blogs/createblog.html');
}
//Проверяем хватает ли кармы, но только если это не админ
if ($model->config['min_karma'] && !$inUser->is_admin) {
// если персональный блог
if ($ownertype == 'single' && $inUser->karma < $model->config['min_karma_private']) {
cmsCore::addSessionMessage($_LANG['BLOG_YOU_NEED'] . ' <a href="/users/' . $inUser->id . '/karma.html">' . $_LANG['BLOG_KARMS'] . '</a> ' . $_LANG['FOR_CREATE_PERSON_BLOG'] . ' — ' . $model->config['min_karma_private'] . ', ' . $_LANG['BLOG_HEAVING'] . ' — ' . $inUser->karma, 'error');
//.........这里部分代码省略.........
示例11: faq
function faq(){
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
$model = new cms_model_faq();
define('IS_BILLING', $inCore->isComponentInstalled('billing'));
if (IS_BILLING) { $inCore->loadClass('billing'); }
global $_LANG;
$pagetitle = $inCore->getComponentTitle();
$inPage->addPathway($pagetitle, '/faq');
$inPage->setTitle($pagetitle);
$inPage->setDescription($pagetitle);
$inPage->addHeadJsLang(array('ERR_QUESTION'));
$cfg = $inCore->loadComponentConfig('faq');
if(!isset($cfg['guest_enabled'])) { $cfg['guest_enabled'] = 1; }
if(!isset($cfg['user_link'])) { $cfg['user_link'] = 1; }
if(!isset($cfg['publish'])) { $cfg['publish'] = 0; }
if(!isset($cfg['is_comment'])) { $cfg['is_comment'] = 1; }
$id = $inCore->request('id', 'int', 0);
$do = $inCore->do;
///////////////////////////////////// VIEW CATEGORY ////////////////////////////////////////////////////////////////////////////////
if ($do=='view'){
if($id>0){
//CURRENT CATEGORY
$sql = "SELECT *
FROM cms_faq_cats
WHERE id = '$id'
ORDER BY title ASC LIMIT 1
";
$result = $inDB->query($sql) ;
if (!$inDB->num_rows($result)) { cmsCore::error404(); }
$cat = $inDB->fetch_assoc($result);
//PAGE HEADING
$pagetitle = $cat['title'];
$inPage->setTitle($cat['title']);
$inPage->addPathway($cat['title']);
$inPage->setDescription($cat['title']);
}
//LIST OF SUBCATEGORIES
$sql = "SELECT *
FROM cms_faq_cats
WHERE parent_id = $id AND id > 0 AND published = 1
ORDER BY title ASC
";
$result = $inDB->query($sql) ;
if ($inDB->num_rows($result)){
$subcats = array();
while($subcat = $inDB->fetch_assoc($result)){
$subcats[] = $subcat;
}
$is_subcats = true;
} else {
$is_subcats = false;
}
//CURRENT CATEGORY CONTENT
$perpage = 15;
$page = $inCore->request('page', 'int', 1);
$records = 0;
if ($id > 0){
$sql = "SELECT q.*, u.login, u.nickname
FROM cms_faq_quests q
LEFT JOIN cms_users u ON u.id = q.user_id
WHERE q.category_id = $id AND q.published = 1
ORDER BY q.pubdate DESC
LIMIT ".(($page-1)*$perpage).", $perpage";
$result_total = $inDB->query("SELECT id FROM cms_faq_quests WHERE category_id = $id AND published = 1") ;
$records = $inDB->num_rows($result_total);
} else {
$sql = "SELECT q.*, c.title cat_title, c.id cid, u.login, u.nickname
FROM cms_faq_quests q
LEFT JOIN cms_faq_cats c ON c.id = q.category_id
LEFT JOIN cms_users u ON u.id = q.user_id
WHERE q.published = 1
ORDER BY q.pubdate DESC
LIMIT 15";
}
$result = $inDB->query($sql) ;
if ($inDB->num_rows($result)){
//.........这里部分代码省略.........
示例12: users
function users()
{
header('X-Frame-Options: DENY');
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inDB = cmsDatabase::getInstance();
$inUser = cmsUser::getInstance();
global $_LANG;
$model = new cms_model_users();
// id пользователя
$id = cmsCore::request('id', 'int', 0);
// логин пользователя
$login = cmsCore::strClear(urldecode(cmsCore::request('login', 'html', '')));
$do = $inCore->do;
$page = cmsCore::request('page', 'int', 1);
$pagetitle = $inCore->getComponentTitle();
if ($model->config['sw_search'] != 2) {
$inPage->addPathway($pagetitle, '/users');
}
$inPage->setTitle($pagetitle);
$inPage->setDescription($pagetitle);
// js только авторизованным
if ($inUser->id) {
$inPage->addHeadJS('components/users/js/profile.js');
$inPage->addHeadJsLang(array('CONFIRM_CLEAN_CAT', 'CHOOSE_RECIPIENT', 'SEND_TO_USER', 'FRIENDSHIP_OFFER', 'STOP_FRIENDLY', 'REALY_STOP_FRIENDLY', 'ENTER_STATUS', 'HAVE_JUST'));
}
//============================================================================//
//========================= Список пользователей ============================//
//============================================================================//
if ($do == 'view') {
// если запрещен просмотр всех пользователей, 404
if ($model->config['sw_search'] == 2) {
cmsCore::error404();
}
//очищаем поисковые запросы если пришли со другой страницы
if (!strstr(cmsCore::getBackURL(), '/users')) {
cmsUser::sessionClearAll();
}
$stext = array();
// Возможные входные переменные
$name = cmsCore::getSearchVar('name');
$city = cmsCore::getSearchVar('city');
$hobby = cmsCore::getSearchVar('hobby');
$gender = cmsCore::getSearchVar('gender');
$orderby = cmsCore::request('orderby', array('karma', 'rating', 'regdate'), 'regdate');
$orderto = cmsCore::request('orderto', array('asc', 'desc'), 'desc');
$age_to = (int) cmsCore::getSearchVar('ageto', 'all');
$age_fr = (int) cmsCore::getSearchVar('agefrom', 'all');
$group_id = cmsCore::request('group_id', 'int', 0);
// Флаг о показе только онлайн пользователей
if (cmsCore::inRequest('online')) {
cmsUser::sessionPut('usr_online', (bool) cmsCore::request('online', 'int'));
$page = 1;
}
$only_online = cmsUser::sessionGet('usr_online');
if ($only_online) {
$stext[] = $_LANG['SHOWING_ONLY_ONLINE'];
}
///////////////////////////////////////
//////////Условия выборки//////////////
///////////////////////////////////////
// группа
if ($group_id) {
$model->whereUserGroupIs($group_id);
$link['group'] = '/users/group/' . $group_id;
$_LANG['GROUP_SEARCH_NAME'] = cmsUser::getGroupTitle($group_id);
}
// Добавляем в выборку имя, если оно есть
if ($name) {
$model->whereNameIs($name);
$stext[] = $_LANG['NAME'] . " — " . htmlspecialchars(stripslashes($name));
}
// Добавляем в выборку город, если он есть
if ($city) {
$model->whereCityIs($city);
$stext[] = $_LANG['CITY'] . " — " . htmlspecialchars(stripslashes($city));
}
// Добавляем в выборку хобби, если есть
if ($hobby) {
$model->whereHobbyIs($hobby);
$stext[] = $_LANG['HOBBY'] . " — " . htmlspecialchars(stripslashes($hobby));
}
// Добавляем в выборку пол, если есть
if ($gender) {
$model->whereGenderIs($gender);
if ($gender == 'm') {
$stext[] = $_LANG['MALE'];
} else {
$stext[] = $_LANG['FEMALE'];
}
}
// Добавляем в выборку возраст, более
if ($age_fr) {
$model->whereAgeFrom($age_fr);
$stext[] = $_LANG['NOT_YOUNG'] . " {$age_fr} " . $_LANG['YEARS'];
}
// Добавляем в выборку возраст, менее
if ($age_to) {
$model->whereAgeTo($age_to);
$stext[] = $_LANG['NOT_OLD'] . " {$age_fr} " . $_LANG['YEARS'];
//.........这里部分代码省略.........
示例13: calendar
function calendar()
{
$inCore = cmsCore::getInstance();
$inPage = cmsPage::getInstance();
$inUser = cmsUser::getInstance();
$inCore->loadModel('calendar');
$model = new cms_model_calendar();
$do = $inCore->request('do', 'str', 'view');
$cfg = $inCore->loadComponentConfig('calendar');
if ($do == 'view') {
$inPage->setTitle("Календарь событий");
$smarty = $inCore->initSmarty('components', 'com_calendar_view.tpl');
$guest = TRUE;
if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
$guest = FALSE;
}
if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
$guest = FALSE;
}
if ($inUser->is_admin) {
$guest = FALSE;
}
$catigories = $model->getAllCategories();
$smarty->assign('guest', $guest);
$smarty->assign('cfg', $cfg);
$smarty->assign('catigories', $catigories);
$smarty->assign('category', "all");
$smarty->display('com_calendar_view.tpl');
return;
}
if ($do == "category_view") {
$category_id = $inCore->request('category_id', 'int', 0);
$smarty = $inCore->initSmarty('components', 'com_calendar_view.tpl');
$guest = TRUE;
if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
$guest = FALSE;
}
if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
$guest = FALSE;
}
if ($inUser->is_admin) {
$guest = FALSE;
}
$category = $model->getCategory($category_id);
$catigories = $model->getAllCategories();
if (!$category) {
//$inCore->redirect("/calendar");
print mysql_error();
}
$inPage->setTitle("Календарь событий:" . $category['title']);
$smarty->assign('guest', $guest);
$smarty->assign('cfg', $cfg);
$smarty->assign('catigories', $catigories);
$smarty->assign('category', $category_id);
$smarty->display('com_calendar_view.tpl');
return;
}
if ($do == 'add') {
$guest = TRUE;
if ($inUser->id == 0 and $cfg['calendar_access'] == "all") {
$guest = FALSE;
}
if ($inUser->id != 0 and $cfg['calendar_access'] == "users") {
$guest = FALSE;
}
if ($inUser->is_admin) {
$guest = FALSE;
}
if ($guest) {
$inCore->redirect('/');
exit;
}
$is_send = $inCore->inRequest('title');
if ($is_send) {
$title = $inCore->request('title', 'str');
$type_raw = $inCore->request('type', 'str');
$date_start = $inCore->request('date_start', 'str');
$date_end = $inCore->request('date_end', 'str');
$hour_start = $inCore->request('hour_start', 'str');
$hour_end = $inCore->request('hour_end', 'str');
$min_start = $inCore->request('min_start', 'str');
$min_end = $inCore->request('min_end', 'str');
$content = $inCore->request('content', 'str');
if (!$title || !$type_raw || !$date_start || !$hour_start || !$hour_end || !$min_start || !$min_end) {
cmsCore::addSessionMessage('Ой, что то не было заполнено...', 'error');
$inCore->redirectBack();
exit;
} else {
$start_time = strtotime($date_start . ' ' . $hour_start . ':' . $min_start);
$end_time = strtotime($date_end . ' ' . $hour_end . ':' . $min_end);
if ($data_end == "" or $date_end < $date_start) {
$data_end = $data_start;
}
$type_data = explode("_", $type_raw);
$type = $type_data[0];
$apx = $type_data[1];
$event_id = $model->addEvent($inUser->id, $type, $apx, $start_time, $end_time, $title, $content);
if ($event_id) {
if ($type != "private") {
cmsActions::log('add_event', array('object' => 'событие', 'object_url' => '/calendar/event' . $event_id . '.html', 'object_id' => $event_id, 'target' => $title, 'target_url' => '/calendar/event' . $event_id . '.html', 'target_id' => '0', 'description' => $title));
//.........这里部分代码省略.........
示例14: 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();
// Добавлять могут только админы и те, кому разрешено в настройках группы
//.........这里部分代码省略.........
示例15: applet_tree
function applet_tree()
{
$inCore = cmsCore::getInstance();
$inUser = cmsUser::getInstance();
$inDB = cmsDatabase::getInstance();
$inPage = cmsPage::getInstance();
cmsCore::loadLib('tags');
global $_LANG;
global $adminAccess;
if (!cmsUser::isAdminCan('admin/content', $adminAccess)) {
cpAccessDenied();
}
$cfg = $inCore->loadComponentConfig('content');
cmsCore::loadModel('content');
$model = new cms_model_content();
$GLOBALS['cp_page_title'] = $_LANG['AD_ARTICLES'];
cpAddPathway($_LANG['AD_ARTICLES'], 'index.php?view=tree');
$GLOBALS['cp_page_head'][] = '<script language="JavaScript" type="text/javascript" src="js/content.js"></script>';
echo '<script>';
echo cmsPage::getLangJS('AD_NO_SELECTED_ARTICLES');
echo cmsPage::getLangJS('AD_DELETE_SELECTED_ARTICLES');
echo cmsPage::getLangJS('AD_PIECES');
echo cmsPage::getLangJS('AD_CATEGORY_DELETE');
echo cmsPage::getLangJS('AD_AND_SUB_CATS');
echo cmsPage::getLangJS('AD_DELETE_SUB_ARTICLES');
echo '</script>';
$do = cmsCore::request('do', 'str', 'tree');
//============================================================================//
//============================================================================//
if ($do == 'tree') {
$toolmenu[] = array('icon' => 'config.gif', 'title' => $_LANG['AD_SETUP_CATEGORY'], 'link' => '?view=components&do=config&link=content');
$toolmenu[] = array('icon' => 'help.gif', 'title' => $_LANG['AD_HELP'], 'link' => '?view=components&do=config&link=content');
cpToolMenu($toolmenu);
$only_hidden = cmsCore::request('only_hidden', 'int', 0);
$category_id = cmsCore::request('cat_id', 'int', 0);
$base_uri = 'index.php?view=tree';
$title_part = cmsCore::request('title', 'str', '');
$def_order = $category_id ? 'con.ordering' : 'pubdate';
$orderby = cmsCore::request('orderby', 'str', $def_order);
$orderto = cmsCore::request('orderto', 'str', 'asc');
$page = cmsCore::request('page', 'int', 1);
$perpage = 20;
$hide_cats = cmsCore::request('hide_cats', 'int', 0);
$cats = $model->getCatsTree();
if ($category_id) {
$model->whereCatIs($category_id);
}
if ($title_part) {
$inDB->where('LOWER(con.title) LIKE \'%' . mb_strtolower($title_part) . '%\'');
}
if ($only_hidden) {
$inDB->where('con.published = 0');
}
$inDB->orderBy($orderby, $orderto);
$inDB->limitPage($page, $perpage);
$total = $model->getArticlesCount(false);
$items = $model->getArticlesList(false);
$pages = ceil($total / $perpage);
$tpl_file = 'admin/content.php';
$tpl_dir = file_exists(TEMPLATE_DIR . $tpl_file) ? TEMPLATE_DIR : DEFAULT_TEMPLATE_DIR;
include $tpl_dir . $tpl_file;
}
}