Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Set Categories as Homepage / Starting Point / Frontpage :-)
I read a lot on the forum but couldn't find an answer, so here's a quick'n dirty but perfectly working solution:
What we're gonna do is find out from which page we have come to the forum.
If you were already on vanilla forum, then just go to index.php
If you were on another page or just openened a new browser window, goto categories.php
should you have any questions, feel free to comment the post and I'll answer ;)
here's the full code of index.php. Exchange MYURL with your url:
$referer = $HTTP_REFERER;
if (! strpos($referer, "MYURL")) {
echo "<meta http-equiv=\"refresh\" content=\"0;url=http://MYURL/categories.php\">";
} else {
include("appg/settings.php");
include_once(sgLIBRARY."Vanilla.Discussion.class.php");
include_once(sgLIBRARY."Vanilla.Comment.class.php");
include_once(sgLIBRARY."Vanilla.Search.class.php");
include_once(sgLIBRARY."Utility.Pagelist.class.php");
include("appg/init_internal.php");
// 1. DEFINE VARIABLES AND PROPERTIES SPECIFIC TO THIS PAGE
// Ensure the user is allowed to view this page
$Context->Session->Check(agSAFE_REDIRECT);
// Instantiate data managers to be used in this page
$DiscussionManager = $Context->ObjectFactory->NewContextObject($Context, "DiscussionManager");
$SearchManager = $Context->ObjectFactory->NewContextObject($Context, "SearchManager");
// Define properties of the page controls that are specific to this page
$Menu->CurrentTab = "discussions";
$Panel->CssClass = "DiscussionPanel";
$Body->CssClass = "Discussions";
// 2. BUILD PAGE CONTROLS
// Panel
AddDiscussionOptionsToPanel($Context, $Panel);
AddBookmarksToPanel($Context, $Panel, $DiscussionManager);
AddDiscussionsToPanel($Context, $Panel, $DiscussionManager, "GetDiscussionsByUserID", agPANEL_USERDISCUSSIONS_COUNT, $Context->GetDefinition("YourDiscussions"), "Recent", $Context->Session->User->Setting("ShowRecentDiscussions"));
AddDiscussionsToPanel($Context, $Panel, $DiscussionManager, "GetViewedDiscussionsByUserID", agPANEL_HISTORY_COUNT, $Context->GetDefinition("History"), "History", $Context->Session->User->Setting("ShowBrowsingHistory"));
AddSearchesToPanel($Context, $Panel, $SearchManager, agPANEL_SEARCH_COUNT);
AddAppendixToPanel($Context, $Panel, "Discussion");
AddTextModeToPanel($Context, $Panel);
AddGuestInfoToPanel($Context, $Panel);
// Add the discussion grid to the body
$CategoryID = ForceIncomingInt("CategoryID", 0);
$View = ForceIncomingString("View", "");
$DiscussionGrid = $Context->ObjectFactory->NewContextObject($Context, "DiscussionGrid", $DiscussionManager, $CategoryID, $View);
$Body->AddControl($DiscussionGrid);
// 3. ADD CONTROLS TO THE PAGE
$Page->AddControl("Head_Render", $Head);
$Page->AddControl("Menu_Render", $Menu);
$Page->AddControl("Panel_Render", $Panel);
$Page->AddControl("Body_Render", $Body);
// 4. FIRE PAGE EVENTS
$Page->FireEvents();
}
0
This discussion has been closed.
Comments
Is a http redirect/meta better than doing it like header('location: MYURL') ?
Other than that, not bad, interesting concept.
$referer = $HTTP_REFERER;
You should be using the "medium" form.
$referer = $_SERVER[’HTTP_REFERRER’];
Incase register_globals is off...
Also, you should be using header() redirects.
header("Location: path/to/file");