Somebody finish this. All that is needed is the ACP

harmor

New member
I pirated Xenforo to play with the code and I don't have the motivation nor time anymore. Someone can have this code and do what you please. It's a way to add links to the navigation bar without creating a PHP script.

I know it's a simple code but I didn't want it to go to waste.

PHP:
<?php

class NavBarManager_ControllerPublic_Index extends XenForo_ControllerPublic_Abstract
{
    public static function addNavbarTab(array &$extraTabs, $selectedTabId)
    {

        $visitor = XenForo_Visitor::getInstance();
        $db = XenForo_Application::get('db');

        $navlink_query = $db->fetchAll('SELECT nav_id, title, href, position, usergroup_perms, linkstemplate FROM navbar_manager');
        foreach($navlink_query AS $rowName => $navlink)
        {
            $usergroupPerms = explode(",", $navlink['usergroup_perms']);
            if(in_array($visitor['user_group_id'], $usergroupPerms) OR $navlink['usergroup_perms'] == '0')
            {
                $extraTabs['info'.$navlink['nav_id']] = array(
                    'title' => $navlink['title'],
                    'href'  => XenForo_Link::buildPublicLink('full:'.$navlink['href']),
                    'selected' => ($selectedTabId == $navlink['href']),
                    'linksTemplate' => (!empty($navlink['linkstemplate'])) ? $navlink['linkstemplate'] : '',
                    'position'  =>  $navlink['position']);
            }
        }
    }
}
?>

Install/Uninstall Code
PHP:
<?php

class NavbarManager_Alterdb
{
    public static function installCode($existingAddOn)
    {
        $db = XenForo_Application::get('db'); 
         $db->query('CREATE TABLE IF NOT EXISTS `navbar_manager` (
              `nav_id` int(10) NOT NULL AUTO_INCREMENT,
              `title` varchar(60) NOT NULL,
              `href` varchar(100) NOT NULL,
            `postion` varvhar(40) NOT NULL,
            `usergroup_perms` varchar(40) NOT NULL,
            `linkstemplate` varchar(70) NOT NULL,
              PRIMARY KEY (`nav_id`)
         )');
    }
    public static function uninstallCode(array $addonInfo)
    {
        $db = XenForo_Application::get('db'); 
        $db->query('DROP TABLE navbar_manager');
    }
}
 
I'm a little conflicted, gimme some perspective. As a server-side script, does it really matter? Seems to me it would only be a problem (sin, crime?) if you "go live". Anyone can get the codebase for VB or XF or many others. Is there anything wrong with looking at the code, and maybe playing with it? No harm, no foul, right?

Like to hear Kier's opinion on this. I think there's a little hacker inside of every coder.
 
Top Bottom