/** * Render bayesFilters * * @param array $params smarty {insert} parameters * @return string html */ function insert_bayesFilters($params) { if ($GLOBALS['CONFIG']['FEATURE']['bayes'] == false) { return null; } // Feature is turned off if (!isset($_SESSION['users_id'])) { return null; } // Anonymous user, skip $r = new suxBayesRenderer('bayes'); // Renderer if (!$r->getUserCategories()) { return null; } // No categories, skip $tpl = new suxTemplate('bayes'); // Template $r->gtext = suxFunct::gtext('bayes'); // Language if (isset($_GET['filter'])) { $tpl->assign('filter', $_GET['filter']); } if (isset($_GET['threshold']) && $_GET['threshold'] !== false) { $tpl->assign('threshold', $_GET['threshold']); } if (isset($_GET['search'])) { $tpl->assign('search', strip_tags($_GET['search'])); } if (isset($params['form_url'])) { $r->text['form_url'] = $params['form_url']; } if (isset($params['hidden']) && is_array($params['hidden'])) { $r->arr['hidden'] = $params['hidden']; } if (!$GLOBALS['CONFIG']['CLEAN_URL']) { $r->text['c'] = @$_GET['c']; } // We need this if CLEAN_URL = false $tpl->assignByRef('r', $r); return $tpl->fetch('filters.tpl'); }
/** * Construct a navigation div * * @global bool $CONFIG['CLEAN_URL'] * @global string $CONFIG['URL'] * @param array $list key => name, val => url * @return string the html code */ static function navlist($list = null) { if (!is_array($list)) { $gtext = suxFunct::gtext(); if (isset($gtext['navcontainer'])) { $list = $gtext['navcontainer']; } } if (is_array($list)) { // Make an educated guess as to which controller we are currently using? $compare = 'home'; if (!empty($_GET['c'])) { $params = explode('/', $_GET['c']); $compare = array_shift($params); } if (!$GLOBALS['CONFIG']['CLEAN_URL']) { $compare = "?c={$compare}"; } else { $compare = ltrim($GLOBALS['CONFIG']['URL'] . "/{$compare}", '/'); } $selected = null; if ($compare) { foreach ($list as $key => $val) { if (is_array($val) && mb_strpos($val[0], $compare)) { // Sub-menu $selected = $key; break; } elseif (is_string($val) && mb_strpos($val, $compare)) { // No sub-menu $selected = $key; break; } } } } // Makeshift renderer object $r['arr']['list'] = $list; $r['text']['selected'] = $selected; $r = (object) $r; // Template $tpl = new suxTemplate('globals'); $tpl->assignByRef('r', $r); return $tpl->fetch('navlist.tpl'); }