Exemple #1
0
 navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
        	<button type="button" class="btn btn-navbar collapsed" data-toggle="collapse" data-target=".menu-mobile">
        		<span class="icon-bar"></span>
        		<span class="icon-bar"></span>
        		<span class="icon-bar"></span>
        	</button>
            
			<?php 
echo @render('logo');
?>
            
            <div id="desktop-main-menu" class="nav-collapse collapse">
            	<?php 
echo @searchbox('searchbox');
?>
	            <?php 
echo @template('menus/main');
?>
	            <span class="viewer pull-right">
	            	<?php 
if (get_viewer()->guest()) {
    ?>
	            	<?php 
    $return = base64UrlEncode(KRequest::url());
    ?>
    
					<a data-trigger="OpenModal" class="btn btn-primary" href="#" data-url="<?php 
    echo @route('option=people&view=session&layout=modal&connect=1&return=' . $return);
    ?>
Exemple #2
0
function widget_savedsearch($arr)
{
    if (!local_user() || !feature_enabled(local_user(), 'savedsearch')) {
        return '';
    }
    $a = get_app();
    $search = x($_GET, 'search') ? $_GET['search'] : '';
    if (x($_GET, 'searchsave') && $search) {
        $r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1", intval(local_user()), intval(TERM_SAVEDSEARCH), dbesc($search));
        if (!$r) {
            q("insert into `term` ( `uid`,`type`,`term` ) values ( %d, %d, '%s') ", intval(local_user()), intval(TERM_SAVEDSEARCH), dbesc($search));
        }
    }
    if (x($_GET, 'searchremove') && $search) {
        q("delete from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1", intval(local_user()), intval(TERM_SAVEDSEARCH), dbesc($search));
        $search = '';
    }
    $srchurl = $a->query_string;
    $srchurl = rtrim(preg_replace('/searchsave\\=[^\\&].*?(\\&|$)/is', '', $srchurl), '&');
    $hasq = strpos($srchurl, '?') !== false ? true : false;
    $srchurl = rtrim(preg_replace('/searchremove\\=[^\\&].*?(\\&|$)/is', '', $srchurl), '&');
    $hasq = strpos($srchurl, '?') !== false ? true : false;
    $srchurl = rtrim(preg_replace('/search\\=[^\\&].*?(\\&|$)/is', '', $srchurl), '&');
    $srchurl = str_replace(array('?f=', '&f='), array('', ''), $srchurl);
    $hasq = strpos($srchurl, '?') !== false ? true : false;
    $o = '';
    $r = q("select `tid`,`term` from `term` WHERE `uid` = %d and `type` = %d ", intval(local_user()), intval(TERM_SAVEDSEARCH));
    $saved = array();
    if (count($r)) {
        foreach ($r as $rr) {
            $saved[] = array('id' => $rr['tid'], 'term' => $rr['term'], 'dellink' => z_root() . '/' . $srchurl . ($hasq ? '' : '?f=') . '&amp;searchremove=1&amp;search=' . urlencode($rr['term']), 'srchlink' => z_root() . '/' . $srchurl . ($hasq ? '' : '?f=') . '&amp;search=' . urlencode($rr['term']), 'displayterm' => htmlspecialchars($rr['term'], ENT_COMPAT, 'UTF-8'), 'encodedterm' => urlencode($rr['term']), 'delete' => t('Remove term'), 'selected' => $search == $rr['term']);
        }
    }
    $tpl = get_markup_template("saved_searches.tpl");
    $o = replace_macros($tpl, array('$title' => t('Saved Searches'), '$add' => t('add'), '$searchbox' => searchbox($search, 'netsearch-box', $srchurl . ($hasq ? '' : '?f='), true), '$saved' => $saved));
    return $o;
}
Exemple #3
0
function widget_sitesearch($arr)
{
    $search = x($_GET, 'search') ? $_GET['search'] : '';
    $srchurl = App::$query_string;
    $srchurl = rtrim(preg_replace('/search\\=[^\\&].*?(\\&|$)/is', '', $srchurl), '&');
    $srchurl = rtrim(preg_replace('/submit\\=[^\\&].*?(\\&|$)/is', '', $srchurl), '&');
    $srchurl = str_replace(array('?f=', '&f='), array('', ''), $srchurl);
    $hasq = strpos($srchurl, '?') !== false ? true : false;
    $hasamp = strpos($srchurl, '&') !== false ? true : false;
    if ($hasamp && !$hasq) {
        $srchurl = substr($srchurl, 0, strpos($srchurl, '&')) . '?f=&' . substr($srchurl, strpos($srchurl, '&') + 1);
    }
    $o = '';
    $saved = array();
    $tpl = get_markup_template("sitesearch.tpl");
    $o = replace_macros($tpl, array('$title' => t('Search'), '$searchbox' => searchbox($search, 'netsearch-box', $srchurl . ($hasq ? '' : '?f='), false), '$saved' => $saved));
    return $o;
}