close();
}
$app =& JFactory::getApplication();
if ($func == "showcaptcha") {
include (JPATH_ROOT . '/components/com_kunena/template/default/plugin/captcha/randomImage.php');
$app->close();
}
include_once (KUNENA_PATH_LIB .DS. "kunena.debug.php");
require_once (KUNENA_PATH_LIB .DS. "kunena.config.class.php");
require_once (KUNENA_PATH_LIB .DS. "kunena.user.class.php");
global $fbConfig, $kunenaProfile;
$kunena_my = &JFactory::getUser();
$KunenaUser = new CKunenaUser($kunena_my->id);
$fbConfig =& CKunenaConfig::getInstance();
if (file_exists(KUNENA_FILE_LANGUAGE)) {
include_once (KUNENA_FILE_LANGUAGE);
} else {
include_once (KUNENA_FILE_LANGUAGE_DEFAULT);
}
$kn_tables =& CKunenaTables::getInstance();
if ($kn_tables->installed() === false) {
$fbConfig->board_offline = 1;
}
global $aro_group;
$kunena_acl = &JFactory::getACL();
if ($kunena_my->id != 0)
{
$aro_group = $kunena_acl->getAroGroup($kunena_my->id);
$aro_group->id = $aro_group->id;
$is_admin = (strtolower($aro_group->name) == 'super administrator' || strtolower($aro_group->name) == 'administrator');
}
else
{
$aro_group = new StdClass();
$aro_group->id = 0;
$is_admin = 0;
}
$my_id = $kunena_my->id;
if ($fbConfig->regonly && !$my_id)
{
echo '
' . _FORUM_UNAUTHORIZIED . '
';
echo '' . _FORUM_UNAUTHORIZIED2 . '
';
}
else if ($fbConfig->board_offline && !$is_admin)
{
echo stripslashes($fbConfig->offline_message);
}
else
{
global $lang, $fbIcons;
global $is_Moderator;
global $message;
require_once (KUNENA_PATH_LIB .DS. "kunena.link.class.php");
require_once (KUNENA_PATH .DS. "class.kunena.php");
if (file_exists(KUNENA_ABSTMPLTPATH .DS. 'smile.class.php'))
{
require_once (KUNENA_ABSTMPLTPATH .DS. 'smile.class.php');
}
else
{
require_once (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'smile.class.php');
}
if ($func == 'fb_rss')
{
include (KUNENA_PATH_LIB .DS. 'kunena.rss.php');
$app->close();
}
if ($func == 'fb_pdf')
{
include (KUNENA_PATH_LIB .DS. 'kunena.pdf.php');
$app->close();
}
if ($fbConfig->pm_component == "clexuspm")
{
require_once (KUNENA_ROOT_PATH .DS. 'components/com_mypms/class.mypms.php');
$ClexusPMconfig = new ClexusPMConfig();
}
include_once (KUNENA_PATH_LIB .DS. 'kunena.timeformat.class.php');
$systime = time() + $fbConfig->board_ofset * KUNENA_SECONDS_IN_HOUR;
$settings = !empty($_COOKIE['fboard_settings'])?$_COOKIE['fboard_settings']:'';
$board_title = $fbConfig->board_title;
$fromBot = 0;
$prefview = $fbConfig->default_view;
if ($fbConfig->joomlastyle < 1) {
$boardclass = "fb_";
}
if ($func == "getpreview")
{
$message = utf8_urldecode(utf8_decode(stripslashes($msgpreview)));
$smileyList = smile::getEmoticons(1);
$msgbody = smile::smileReplace( $message , 0, $fbConfig->disemoticons, $smileyList);
$msgbody = nl2br($msgbody);
$msgbody = str_replace("__FBTAB__", "\t", $msgbody);
$msgbody = CKunenaTools::prepareContent($msgbody);
$msgbody = smile::htmlwrap($msgbody, $fbConfig->wrap);
header("Content-Type: text/html; charset=utf-8");
echo $msgbody;
$app->close();
}
if ($no_html == 0) {
$document =& JFactory::getDocument();
$document->addCustomTag('');
if (is_object($kunenaProfile) && $kunenaProfile->useProfileIntegration())
{
if (defined('KUNENA_COREJSURL'))
{
global $_CB_framework;
$_CB_framework->addJQueryPlugin( 'kunena_tmpl', KUNENA_COREJSPATH );
$_CB_framework->outputCbJQuery( '', 'kunena_tmpl' );
}
}
else
{
if (defined('KUNENA_JQURL') && !defined('J_JQUERY_LOADED'))
{
define('J_JQUERY_LOADED', 1);
if (!defined('C_ASSET_JQUERY')) define('C_ASSET_JQUERY', 1);
$document->addCustomTag('');
}
if (defined('KUNENA_COREJSURL'))
{
$document->addCustomTag('');
}
}
//adept
$document->addCustomTag('');
$document->addCustomTag('');
if($fbConfig->zoom)
{?>
joomlastyle < 1) {
if (file_exists(KUNENA_JTEMPLATEPATH.'/css/kunena.forum.css'))
{
$document->addCustomTag('');
}
else
{
$document->addCustomTag('');
}
}
else
{
$document->addCustomTag('');
}
}
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/who/who.class.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/who/who.class.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/who/who.class.php');
}
if (file_exists(KUNENA_ABSTMPLTPATH . '/fb_layout.php')) {
require_once (KUNENA_ABSTMPLTPATH . '/fb_layout.php');
}
else {
require_once (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'fb_layout.php');
}
require_once (KUNENA_PATH_LIB .DS. 'kunena.permissions.php');
require_once (KUNENA_PATH_LIB .DS. 'kunena.category.class.php');
require_once (JPATH_BASE.'/libraries/joomla/template/template.php');
if ($catid != '') {
$thisCat = new jbCategory($kunena_db, $catid);
}
$KunenaTemplate = new patTemplate();
$KunenaTemplate->setRoot( KUNENA_ABSTMPLTPATH );
$KunenaTemplate->readTemplatesFromFile("header.html");
$KunenaTemplate->readTemplatesFromFile("footer.html");
$is_Moderator = fb_has_moderator_permission($kunena_db, $thisCat, $kunena_my->id, $is_admin);
if ($func == '')
{
switch ($fbConfig->fbdefaultpage)
{
case 'recent':
$func = 'latest';
break;
case 'my':
$func = $kunena_my->id > 0 ? 'mylatest' : 'latest';
break;
default:
$func = 'listcat';
}
}
$useIcons = 0;
$fbIcons = 0;
if (file_exists(KUNENA_ABSTMPLTPATH . '/icons.php'))
{
include_once (KUNENA_ABSTMPLTPATH . '/icons.php');
$useIcons = 1;
}
else
{
include_once (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'icons.php');
}
require_once (KUNENA_PATH_LIB .DS. 'kunena.session.class.php');
global $fbSession;
$fbSession =& CKunenaSession::getInstance();
if ($kunena_my->id > 0)
{
setcookie("fboard_settings[member_id]", $kunena_my->id, time() + KUNENA_SECONDS_IN_YEAR, '/');
$new_fb_user = 0;
$resetView = 0;
if ($fbSession->_exists === false) {
$new_fb_user = 1;
$resetView = 1;
}
$fbSessionTimeOut = ($fbSession->currvisit + $fbConfig->fbsessiontimeout) < $systime;
if ($markaction == "allread") {
$fbSession->lasttime = $systime;
$fbSession->readtopics = '';
} elseif ($fbSessionTimeOut) {
$fbSession->lasttime = $fbSession->currvisit;
$fbSession->readtopics = '';
}
if (!$fbSession->allowed or $fbSession->allowed == 'na' or $fbSessionTimeOut) {
$allow_forums = CKunenaTools::getAllowedForums($kunena_my->id, $aro_group->id, $kunena_acl);
if (!$allow_forums) $allow_forums = '0';
if ($allow_forums != $fbSession->allowed)
$fbSession->allowed = $allow_forums;
unset($allow_forums);
}
$fbSession->currvisit = $systime;
$fbSession->save($fbSession);
if ($markaction == "allread") {
$app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)), _GEN_ALL_MARKED);
}
$kunena_db->setQuery("SELECT view FROM #__fb_users WHERE userid='{$kunena_my->id}'");
$prefview = $kunena_db->loadResult();
check_dberror('Unable load default view type for user.');
if ($prefview == "")
{
$prefview = $fbConfig->default_view;
$kunena_db->setQuery("SELECT COUNT(*) FROM #__fb_users WHERE userid='{$kunena_my->id}'");
$userexists = $kunena_db->loadResult();
check_dberror('Unable load default view type for user.');
if (!$userexists)
{
$kunena_db->setQuery("insert into #__fb_users (userid,view,moderator) values ('$kunena_my->id','$prefview','$is_admin')");
$kunena_db->query();
check_dberror('Unable to create user profile.');
}
}
if ($resetView == 1)
{
setcookie("fboard_settings[current_view]", $prefview, time() + KUNENA_SECONDS_IN_YEAR, '/');
$view = $prefview;
}
$prevCheck = $fbSession->lasttime;
}
else
{
$kunena_db->setQuery("SELECT id FROM #__fb_categories WHERE pub_access='0' AND published='1'");
$fbSession->allowed =
($arr_pubcats = $kunena_db->loadResultArray())?implode(',', $arr_pubcats):'';
check_dberror('Unable load accessible categories for user.');
$prevCheck = $systime;
$new_fb_user = 0;
$fbSession->readtopics = '';
}
if (!$fbSession->allowed) $fbSession->allowed = '0';
$view = "flat";
$kunena_db->setQuery("SELECT MAX(posts) FROM #__fb_users");
$maxPosts = $kunena_db->loadResult();
check_dberror('Unable load max(posts) for user.');
$readTopics=$fbSession->readtopics;
$read_topics = explode(',', $readTopics);
if ($func == "showcat" || $func == "view" || $func == "post")
{
if ($catid != 0) {
$kunena_db->setQuery("SELECT parent FROM #__fb_categories WHERE id='{$catid}'");
$strCatParent = $kunena_db->loadResult();
check_dberror('Unable to load categories.');
}
if ($catid == 0 || $strCatParent === '0')
{
$strcatid = '';
if ($catid) $strcatid = "&catid={$catid}";
$app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL.'&func=listcat'.$strcatid)));
}
}
switch ($func)
{
case 'view':
$fbMenu = KUNENA_get_menu(NULL, $fbConfig, $fbIcons, $my_id, 3, $view, $catid, $id, $thread);
break;
case 'showcat':
$kunena_db->setQuery("SELECT COUNT(*) FROM #__fb_messages WHERE catid='$catid' AND hold='1'");
$numPending = $kunena_db->loadResult();
check_dberror('Unable load pending messages.');
$fbMenu = KUNENA_get_menu(NULL, $fbConfig, $fbIcons, $my_id, 2, $view, $catid, $id, $thread, $is_Moderator, $numPending);
break;
default:
$fbMenu = KUNENA_get_menu(NULL, $fbConfig, $fbIcons, $my_id, 1, $view);
break;
}
$KunenaTemplate->addVar('kunena-header', 'menu', $fbMenu);
$KunenaTemplate->addVar('kunena-header', 'board_title', stripslashes($board_title));
if (file_exists(KUNENA_JTEMPLATEPATH.'/css/kunena.forum.css')) {
$KunenaTemplate->addVar('kunena-header', 'css_path', KUNENA_JTEMPLATEURL . '/template/' . $fbConfig->template . '/kunena.forum.css');
} else {
$KunenaTemplate->addVar('kunena-header', 'css_path', KUNENA_DIRECTURL . '/template/' . $fbConfig->template . '/kunena.forum.css');
}
$KunenaTemplate->addVar('kunena-header', 'offline_message', stripslashes($fbConfig->board_offline) ? '' . _FORUM_IS_OFFLINE . '' : '');
$KunenaTemplate->addVar('kunena-header', 'searchbox', getSearchBox());
$KunenaTemplate->addVar('kunena-header', 'pb_imgswitchurl', KUNENA_URLIMAGESPATH . "shrink.gif");
$KunenaTemplate->displayParsedTemplate('kunena-header');
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/profilebox/profilebox.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/profilebox/profilebox.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/profilebox/profilebox.php');
}
switch ($func)
{
case 'who':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/who/who.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/who/who.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/who/who.php');
}
break;
#########################################################################################
case 'announcement':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/announcement/announcement.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/announcement/announcement.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/announcement/announcement.php');
}
break;
#########################################################################################
case 'stats':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/stats/stats.class.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/stats/stats.class.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/stats/stats.class.php');
}
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/stats/stats.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/stats/stats.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/stats/stats.php');
}
break;
#########################################################################################
case 'fbprofile':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/fbprofile/fbprofile.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/fbprofile/fbprofile.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/fbprofile/fbprofile.php');
}
break;
#########################################################################################
case 'userlist':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/userlist/userlist.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/userlist/userlist.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/userlist/userlist.php');
}
break;
#########################################################################################
case 'post':
if (file_exists(KUNENA_ABSTMPLTPATH . '/post.php')) {
include (KUNENA_ABSTMPLTPATH . '/post.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'post.php');
}
break;
#########################################################################################
case 'view':
if (file_exists(KUNENA_ABSTMPLTPATH . '/view.php')) {
include (KUNENA_ABSTMPLTPATH . '/view.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'view.php');
}
break;
#########################################################################################
case 'faq':
if (file_exists(KUNENA_ABSTMPLTPATH . '/faq.php')) {
include (KUNENA_ABSTMPLTPATH . '/faq.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'faq.php');
}
break;
#########################################################################################
case 'showcat':
if (file_exists(KUNENA_ABSTMPLTPATH . '/showcat.php')) {
include (KUNENA_ABSTMPLTPATH . '/showcat.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'showcat.php');
}
break;
#########################################################################################
case 'listcat':
if (file_exists(KUNENA_ABSTMPLTPATH . '/listcat.php')) {
include (KUNENA_ABSTMPLTPATH . '/listcat.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'listcat.php');
}
break;
#########################################################################################
case 'review':
if (file_exists(KUNENA_ABSTMPLTPATH . '/moderate_messages.php')) {
include (KUNENA_ABSTMPLTPATH . '/moderate_messages.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'moderate_messages.php');
}
break;
#########################################################################################
case 'rules':
include (KUNENA_PATH_LIB .DS. 'kunena.rules.php');
break;
#########################################################################################
case 'userprofile':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/myprofile/myprofile.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/myprofile/myprofile.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/myprofile/myprofile.php');
}
break;
#########################################################################################
case 'myprofile':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/myprofile/myprofile.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/myprofile/myprofile.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/myprofile/myprofile.php');
}
break;
#########################################################################################
case 'report':
if (file_exists(KUNENA_ABSTMPLTPATH . '/plugin/report/report.php')) {
include (KUNENA_ABSTMPLTPATH . '/plugin/report/report.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'plugin/report/report.php');
}
break;
#########################################################################################
case 'latest':
case 'mylatest':
if (file_exists(KUNENA_ABSTMPLTPATH . '/latestx.php')) {
include (KUNENA_ABSTMPLTPATH . '/latestx.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'latestx.php');
}
break;
#########################################################################################
case 'search':
case 'advsearch':
require_once (KUNENA_PATH_LIB .DS. 'kunena.search.class.php');
$kunenaSearch = &new CKunenaSearch();
$kunenaSearch->show();
break;
#########################################################################################
case 'markthisread':
$kunena_db->setQuery("SELECT readtopics FROM #__fb_sessions WHERE userid='{$kunena_my->id}'");
$allreadyRead = $kunena_db->loadResult();
check_dberror("Unable to load read topics.");
$kunena_db->setQuery("SELECT thread FROM #__fb_messages WHERE catid='{$catid}' AND thread NOT IN ('{$allreadyRead}') GROUP BY thread");
$readForum = $kunena_db->loadObjectList();
check_dberror("Unable to load messages.");
$readTopics = '--';
foreach ($readForum as $rf) {
$readTopics = $readTopics . ',' . $rf->thread;
}
$readTopics = str_replace('--,', '', $readTopics);
if ($allreadyRead != "") {
$readTopics = $readTopics . ',' . $allreadyRead;
}
$kunena_db->setQuery("UPDATE #__fb_sessions set readtopics='$readTopics' WHERE userid=$kunena_my->id");
$kunena_db->query();
check_dberror('Unable to update readtopics in session table.');
$app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL.'&func=showcat&catid='.$catid)), _GEN_FORUM_MARKED);
break;
#########################################################################################
case 'karma':
include (KUNENA_PATH_LIB .DS. 'kunena.karma.php');
break;
#########################################################################################
case 'bulkactions':
switch ($do)
{
case "bulkDel":
CKunenaTools::fbDeletePosts( $is_Moderator, $return);
break;
case "bulkMove":
CKunenaTools::fbMovePosts($catid, $is_Moderator, $return);
break;
}
break;
######################
case "templatechooser":
$fb_user_template = strval(JRequest::getVar('fb_user_template', '','COOKIE'));
$fb_user_img_template = strval(JRequest::getVar('fb_user_img_template', $fb_user_img_template));
$fb_change_template = strval(JRequest::getVar('fb_change_template', $fb_user_template));
$fb_change_img_template = strval(JRequest::getVar('fb_change_img_template', $fb_user_img_template));
if ($fb_change_template)
{
$fb_change_template = preg_replace('#\W#', '', $fb_change_template);
if (strlen($fb_change_template) >= 40) {
$fb_change_template = substr($fb_change_template, 0, 39);
}
if (file_exists(KUNENA_PATH_TEMPLATE .DS. $fb_change_template . '/kunena.forum.css'))
{
$lifetime = 60 * 10;
$fb_current_template = $fb_change_template;
setcookie('fb_user_template', "$fb_change_template", time() + $lifetime);
}
else {
setcookie('fb_user_template', '', time() - 3600);
}
}
if ($fb_change_img_template)
{
$fb_change_img_template = preg_replace('#\W#', '', $fb_change_img_template);
if (strlen($fb_change_img_template) >= 40) {
$fb_change_img_template = substr($fb_change_img_template, 0, 39);
}
if (file_exists(KUNENA_PATH_TEMPLATE .DS. $fb_change_img_template . '/kunena.forum.css'))
{
$lifetime = 60 * 10;
$fb_current_img_template = $fb_change_img_template;
setcookie('fb_user_img_template', "$fb_change_img_template", time() + $lifetime);
}
else {
setcookie('fb_user_img_template', '', time() - 3600);
}
}
$app->redirect(htmlspecialchars_decode(JRoute::_(KUNENA_LIVEURLREL)));
break;
#########################################################################################
case 'credits':
include (KUNENA_PATH_LIB .DS. 'kunena.credits.php');
break;
#########################################################################################
default:
if (file_exists(KUNENA_ABSTMPLTPATH . '/listcat.php')) {
include (KUNENA_ABSTMPLTPATH . '/listcat.php');
}
else {
include (KUNENA_PATH_TEMPLATE_DEFAULT .DS. 'listcat.php');
}
break;
}
if (JDocumentHTML::countModules('kunena_bottom'))
{?>
loadRenderer('modules');
$options = array('style' => 'xhtml');
$position = 'kunena_bottom';
echo $renderer->render($position, $options, null);
?>
'._KUNENA_POWEREDBY.'Kunena | '._ADEPT.'Adeptus | version 1.5.4 | Build 12';
if ($fbConfig->enablerss)
{
$document->addCustomTag('');
echo CKunenaLink::GetRSSLink('');
}
echo '';
$KunenaTemplate->displayParsedTemplate('kunena-footer');
}
if (is_object($kunenaProfile)) $kunenaProfile->close();
$mtime = explode(" ", microtime());
$tend = $mtime[1] + $mtime[0];
$tpassed = ($tend - $tstart);
function to_translit($txt)
{
Error_Reporting(E_ERROR);
$rus = array('à','á','â','ã','ä','å','¸','æ','ç','è','é','ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô','õ','ö','÷','ø','ù','ü','ú','ý','þ','ÿ',);
$lat = array('/a/','/b/','/v/','/g/','/d/','/e/','/e/','/zj/','/z/','/i/','/i/','/k/','/l/','/m/','/n/','/o/','/p/','/r/','/s/','/t/','/u/','/f/','/h/','/tz/','/ch/','/sh/','/sh/','//','//','/ie/','/iu/','/ia/',);
return preg_replace($rus, $lat, $txt);
//return iconv('UTF-8','windows-1251',$txt);
}
?>