Location: PHPKode > projects > FarODP > farodp/includes/FarODPController.php
<?php

function FarODPController($cat, &$node, &$request, $handler) {
    global $action;

	$rootCat = urlCat(ROOT_CAT);
	
	$search = $request->getString('search', '', 64);
	
	if ((count($cat) && $search === '') || (count($rootCat) && $search === '')) // browse
	{
		if (!count($cat) && count($rootCat))
		{
		    $cat = $rootCat;
		}
		
		$node->addNode(new AstCurCat($cat));

		// block inappropriate categories

		if (strtolower($cat[0]) === 'adult')
		{
		    $action->setAction('categoryBlocked');
		}
	
        if ($handler->doBrowse($cat, $node) !== false)
		{
	    	$action->setAction('browse');
		}
	}
	elseif ($search !== '') // search
	{
		$search = $request->getString('search', '');

		if (preg_match("#\b(fuck|shit|piss|cunt|cocksucker|motherfucker)\b#i", $search)) // block inappropriate searches
		{
		    $action->setAction('searchFiltered');
		}
	
	    if ($handler->doSearch($request, $node) !== false)
		{
	    	$action->setAction('search');
		}
	}
	else // main category
	{
	    if ($handler->doMainPage($node) !== false)
	    {
	    	$action->setAction('mainPage');
	    }
	}
}

?>
Return current item: FarODP