Completed
Push — master ( 369c90...324e29 )
by Michael
04:57
created

reference.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * ****************************************************************************
4
 * references - MODULE FOR XOOPS
5
 * Copyright (c) Herv� Thouzard of Instant Zero (http://www.instant-zero.com)
6
 *
7
 * You may not change or alter any portion of this comment or credits
8
 * of supporting developers from this source code or any supporting source code
9
 * which is considered copyrighted (c) material of the original comment or credit authors.
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 *
14
 * @copyright       Herv� Thouzard of Instant Zero (http://www.instant-zero.com)
15
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
16
 * @package         references
17
 * @author 			Herv� Thouzard of Instant Zero (http://www.instant-zero.com)
18
 *
19
 * Version : $Id:
20
 * ****************************************************************************
21
 */
22
23
/**
24
 * Affichage des r�f�rences d'une cat�gorie
25
 *
26
 * @param integer $article_id	Le num�ro de la r�f�rence
27
 */
28
require 'header.php';
29
$xoopsOption['template_main'] = 'references_reference.html';
30
require XOOPS_ROOT_PATH . '/header.php';
31
32
$baseurl = REFERENCES_URL . basename(__FILE__);
33
$artice_id = isset($_GET['article_id']) ? intval($_GET['article_id']) : 0;
34
if ($artice_id == 0) {
35
	references_utils::redirect(_MD_REFERENCES_ERROR4, 'index.php', 4);
36
}
37
$article = null;
38
$article = $h_references_articles->get($artice_id);
39
if (!is_object($article)) {
40
	references_utils::redirect(_MD_REFERENCES_ERROR4, 'index.php', 4);
41
}
42
// V�rification des permissions
43
$handlers = references_handler::getInstance();
44
if(!$handlers->h_references_articles->userCanSeeReference($article)) {
45
	references_utils::redirect(_NOPERM, 'index.php', 4);
46
}
47
48
// Chargement de la cat�gorie
49
$category = null;
50
$category = $h_references_categories->get($article->getVar('article_category_id'));
51
if (! is_object($category)) {
52
	references_utils::redirect(_MD_REFERENCES_ERROR2, 'index.php', 4);
53
}
54
$xoopsTpl->assign('category', $category->toArray());
55
$xoopsTpl->assign('article', $article->toArray());
56
57
$_SESSION['reference']['current_article'] = $article->getVar('article_title', 'n');
58
59
60
// Breadcrumb
61
$breadcrumb = array($category->getUrl() => $category->getVar('category_title'),
62
$baseurl => $article->getVar('article_title'));
63
$xoopsTpl->assign('breadcrumb', references_utils::breadcrumb($breadcrumb));
64
65
$xoopsTpl->assign('use_rss', references_utils::getModuleOption('use_rss'));
66
67
// MooTools
68
$xoTheme->addScript(REFERENCES_JS_URL . 'js/mootools.js');
69
$xoTheme->addScript(REFERENCES_JS_URL . 'js/mootools-1.2-more.js');
70 View Code Duplication
if (isset($xoopsConfig) && file_exists(REFERENCES_PATH . 'language/' . $xoopsConfig['language'] . '/slimbox.js')) {
71
	$xoTheme->addScript(REFERENCES_URL . 'language/' . $xoopsConfig['language'] . '/slimbox.js');
72
} else {
73
	$xoTheme->addScript(REFERENCES_JS_URL . 'js/slimbox.js');
74
}
75
76
$categoriesSelect = $h_references_categories->getCategoriesSelect('categoriesSelect', $category->getVar('category_id'));
77
$xoopsTpl->assign('categoriesSelect', $categoriesSelect);
78
$xoTheme->addStylesheet(REFERENCES_JS_URL . 'css/slimbox.css');
79
$xoTheme->addStylesheet(REFERENCES_JS_URL . 'css/accordion.css');
80
$xoopsTpl->assign('isAdmin', references_utils::isAdmin());
81
82
// ****************************************************************************************************************************
83
$xoopsTpl->assign('thumbsWidth', references_utils::getModuleOption('thumbs_width'));
84
$xoopsTpl->assign('thumbsHeight', references_utils::getModuleOption('thumbs_height'));
85
86
$metaTitle = $article->getVar('article_title', 'n') . ' - ' . $xoopsModule->name();
87
$metaKeywords = references_utils::createMetaKeywords($article->getVar('article_text', 'n'));
88
references_utils::setMetas($metaTitle, $metaTitle, $metaKeywords);
89
require XOOPS_ROOT_PATH . '/footer.php';
90
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...