- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
<?
namespace components\max;
class articles_element
{
static function run($_arParams)
{
$arParams = &$_arParams['PARAMS'];
$tm = &$_arParams['tm'];
$user = &$tm->user;
$code = $arParams['CODE'];
$arCache = array(
'prefix' => 'show',
'sufix' => $code,
'time' => -1,
'lang' => LANGUAGE_ID,
);
$tm->loadLang('show');
$arSelect = array(
'E.id',
'E.active',
'rel',
'time',
'code',
'date_active_from',
'title_'.LANGUAGE_ID.' AS title' => $tm->conf['LANG_FALLBACKS'][LANGUAGE_ID],
'content_'.LANGUAGE_ID.' AS content' => $tm->conf['LANG_FALLBACKS'][LANGUAGE_ID],
'author_id',
'only_for_auth_users',
'source_url',
'source_author',
'source_date',
);
$arJoin = [];
if($tm->conf['show']['show_additional'])
{
$arSelect[] = 'GROUP_CONCAT(show2category.category_id) AS categories';
$arJoin[\CShow2Category::$table.' show2category ON E.id = show2category.show_id'] = 'LEFT';
}
$arFilter = array('E.code' => $code, 'E.site_id' => $tm->conf['site_id']);
$dbShow = \CShow::GetList(false, $arFilter, ['E.id'], array('nTopCount' => 1), $arSelect, $arJoin);
while($arShow = mysql_fetch_assoc($dbShow))
{
$arShow['title'] = htmlspecialchars($arShow['title']);
if(!empty($arShow['categories']))
{
$arShow['categories'] = explode(',', $arShow['categories']);
}
$arShow['time_write'] = date("d.m.Y", $arShow['date_active_from']);
$arShow['only_for_auth_users'] = $arResult['only_for_auth_users'] && empty($tm->user['id']);
$arResult = $arShow;
if($arResult['only_for_auth_users'])
{
$arResult['title'] = GetMessage('ERROR_ONLY_AUTH');
}
$tm->setLastModifiedTime($arShow['date_active_from']);
$tm->setBuffered('title', $arResult['title'].' | '.GetMessage('sitename'));
$tm->setBuffered('h1', $arResult['title']);
}
if(empty($arResult))
{
// Проверяем редиректы
$arParamsRedirects = array(
'code' => $arFilter['code'],
'module' => 'show',
);
$tm->redirects_modules($arParamsRedirects);
$tm->pagenotfound();
}
$arResult['user_status'] = $user['sts'];
if($tm->conf['show']['show_additional'] && !empty($arResult['categories']))
{
$arFilter = [
'active' => 1,
'show2category.category_id' => $arResult['categories'],
'!E.id' => $arResult['id'],
];
$arSelect = [
'E.id',
'code',
'title_'.LANGUAGE_ID.' AS title' => $tm->conf['LANG_FALLBACKS'][LANGUAGE_ID],
Код от противника фреймворков (это контроллер). Цитата виновника торжества:
"У меня роутинга нету За роутинг отвечает nginx (ранее отвечал .htaccess)"