Fixed CSS: footer should go to the bottom
[vanilla-miry.git] / index.php
blob8170d7f698b60a207a692f93c9386661948bfaa5
1 <?php
2 /*
3 * Copyright 2003 Mark O'Sullivan
4 * This file is part of Vanilla.
5 * Vanilla is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
6 * Vanilla is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 * You should have received a copy of the GNU General Public License along with Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8 * The latest source code for Vanilla is available at www.lussumo.com
9 * Contact Mark O'Sullivan at mark [at] lussumo [dot] com
11 * Description: Display and manipulate discussions
14 include("appg/settings.php");
15 $Configuration['SELF_URL'] = 'index.php';
16 include("appg/init_vanilla.php");
18 // 1. DEFINE VARIABLES AND PROPERTIES SPECIFIC TO THIS PAGE
20 // Ensure the user is allowed to view this page
21 $Context->Session->Check($Context);
23 // Define properties of the page controls that are specific to this page
24 $Head->BodyId = 'DiscussionsPage';
25 $Menu->CurrentTab = 'discussions';
26 $Panel->CssClass = 'DiscussionPanel';
27 $Panel->BodyCssClass = 'Discussions';
29 // 2. BUILD PAGE CONTROLS
30 $DiscussionGrid = $Context->ObjectFactory->CreateControl($Context, 'DiscussionGrid');
31 // Add an update reminder if necessary
32 if ($Configuration['UPDATE_REMINDER'] != '') {
33 if ($Context->Session->User && $Context->Session->User->Permission('PERMISSION_CHECK_FOR_UPDATES')) {
34 $ShowUpdateMessage = 0;
35 $LastUpdate = $Configuration['LAST_UPDATE'];
36 if ($LastUpdate == '') $LastUpdate = time();
37 $Difference = time() - $LastUpdate;
38 $Days = floor($Difference/60/60/24);
39 if ($Configuration['LAST_UPDATE'] == '') {
40 $ShowUpdateMessage = 1;
41 } elseif ($Configuration['UPDATE_REMINDER'] == 'Weekly') {
42 if ($Days > 7) $ShowUpdateMessage = 1;
43 } elseif ($Configuration['UPDATE_REMINDER'] == 'Monthly') {
44 if ($Days > 30) $ShowUpdateMessage = 1;
45 } elseif ($Configuration['UPDATE_REMINDER'] == 'Quarterly') {
46 if ($Days > 90) $ShowUpdateMessage = 1;
49 if ($ShowUpdateMessage) {
50 $Message = '';
51 if ($Days == 0) {
52 $Message = $Context->GetDefinition('NeverCheckedForUpdates');
53 } else {
54 $Message = str_replace('//1', $Days, $Context->GetDefinition('XDaysSinceUpdateCheck'));
56 $NoticeCollector->AddNotice($Message.' <a href="'.GetUrl($Configuration, 'settings.php', '', '', '', '', 'PostBackAction=UpdateCheck').'">'.$Context->GetDefinition('CheckForUpdatesNow').'</a>');
61 // Remind them to get addons if this is a new install
62 if ($Configuration['ADDON_NOTICE']) {
63 if ($Context->Session->User && $Context->Session->User->Permission('PERMISSION_MANAGE_EXTENSIONS')) {
64 $HideNotice = ForceIncomingBool('TurnOffAddonNotice', 0);
65 if ($HideNotice) {
66 $SettingsFile = $Configuration['APPLICATION_PATH'].'conf/settings.php';
67 $SettingsManager = $Context->ObjectFactory->NewContextObject($Context, 'ConfigurationManager');
68 $SettingsManager->DefineSetting("ADDON_NOTICE", '0', 1);
69 $SettingsManager->SaveSettingsToFile($SettingsFile);
70 } else {
71 $NoticeCollector->AddNotice('<span><a href="'.GetUrl($Configuration, 'index.php', '', '', '', '', 'TurnOffAddonNotice=1').'">'.$Context->GetDefinition('RemoveThisNotice').'</a></span>
72 '.$Context->GetDefinition('WelcomeToVanillaGetSomeAddons'));
77 // 3. ADD CONTROLS TO THE PAGE
79 $Page->AddRenderControl($Head, $Configuration['CONTROL_POSITION_HEAD']);
80 $Page->AddRenderControl($Menu, $Configuration['CONTROL_POSITION_MENU']);
81 $Page->AddRenderControl($Panel, $Configuration['CONTROL_POSITION_PANEL']);
82 $Page->AddRenderControl($NoticeCollector, $Configuration['CONTROL_POSITION_NOTICES']);
83 $Page->AddRenderControl($DiscussionGrid, $Configuration['CONTROL_POSITION_BODY_ITEM']);
84 $Page->AddRenderControl($Foot, $Configuration['CONTROL_POSITION_FOOT']);
85 $Page->AddRenderControl($PageEnd, $Configuration['CONTROL_POSITION_PAGE_END']);
87 // 4. FIRE PAGE EVENTS
89 $Page->FireEvents();