예제 #1
0
function show_page($page)
{
    $template = '';
    $posts_per_page = 5;
    $page_nr = isset($_GET['page_nr']) ? $_GET['page_nr'] : '0';
    $limit = $page_nr * $posts_per_page . ", {$posts_per_page}";
    //    $template_file = select_from_db(array('blogs.template'), array('blogs'), array("blogs.name='$page'"));
    //    $template = "view/templates/" . $template_file[0]['template'];
    $template = "view/templates/default_template.php";
    if (file_exists($template) && is_file($template)) {
        require_once $template;
    } else {
        require_once "view/templates/default_template.php";
    }
    echo get_document_head();
    echo get_header();
    echo get_menu();
    if ($page == "startpage") {
        echo "startpage";
    } else {
        if ($page == "search") {
            echo get_searchbar();
            echo get_search_results();
            echo get_thechosen();
        } else {
            if ($page == "fileupload") {
                echo get_fileupload();
            } else {
                if ($page == "nyheter") {
                    echo get_news();
                } else {
                    if ($page == "receipes") {
                        $recipe = "Hallonmums";
                        echo get_recipes($recipe);
                    } else {
                        echo get_default("Välkommen");
                    }
                }
            }
        }
    }
    echo get_footer();
    echo get_document_end();
}
">
    </div>

    <button name="search" type="submit" class="btn btn-primary" value="Search"><span class="glyphicon glyphicon-search"></span> Search</button>
    <p class="help-block">You can use * as a wildcard character. Tip: search for * alone to retrieve all of your experiments.</p>
</form>




<?php 
if (isset($_POST['search'])) {
    /**
     * get results
     */
    $experiments = get_search_results();
    //var_dump($experiments[0]);
    if (sizeof($experiments) == 0) {
        print_warning_message('No results found. Please try again.');
    } else {
        echo '
            <div class="table-responsive">
            <table class="table">
                <tr>
                    <th>Name</th>
                    <th>Application</th>
                    <th>Description</th>
                    <!--<th>Resource</th>-->
                    <th>Creation Time</th>
                    <th>Status</th>
                </tr>
 }
 // Work out the settings for pagination
 if ($show_as == 'posts') {
     $forum_page['per_page'] = $forum_user['disp_posts'];
 } else {
     if ($show_as == 'topics') {
         $forum_page['per_page'] = $forum_user['disp_topics'];
     } else {
         if ($show_as == 'forums') {
             $forum_page['per_page'] = 0;
         }
     }
 }
 // Show all
 // We now have a query that will give us our results in $query, lets get the data!
 $num_hits = get_search_results($query, $search_set);
 ($hook = get_hook('se_post_results_fetched')) ? eval($hook) : null;
 // No search results?
 if ($num_hits == 0) {
     no_search_results($action);
 }
 //
 // Output the search results
 //
 // Setup breadcrumbs and results header and footer
 $forum_page['crumbs'][] = array($forum_config['o_board_title'], forum_link($forum_url['index']));
 $action = isset($action) ? $action : null;
 generate_search_crumbs($action);
 // Generate paging links
 if ($show_as == 'posts' || $show_as == 'topics') {
     $forum_page['page_post']['paging'] = '<p class="paging"><span class="pages">' . $lang_common['Pages'] . '</span> ' . paginate($forum_page['num_pages'], $forum_page['page'], $url_type, $lang_common['Paging separator'], $search_id) . '</p>';
예제 #4
0
파일: api.php 프로젝트: ayunah/opencorpora
// check token for most action types
if (!in_array($action, array('search', 'login'))) {
    $user_id = check_auth_token($_POST['user_id'], $_POST['token']);
    if (!$user_id) {
        throw new Exception('Incorrect token');
    }
}
try {
    switch ($action) {
        case 'search':
            if (isset($_GET['all_forms'])) {
                $all_forms = (bool) $_GET['all_forms'];
            } else {
                $all_forms = false;
            }
            $answer['answer'] = get_search_results($_GET['query'], !$all_forms);
            foreach ($answer['answer']['results'] as &$res) {
                $parts = array();
                foreach (get_book_parents($res['book_id'], true) as $p) {
                    $parts[] = $p['title'];
                }
                $res['text_fullname'] = join(': ', array_reverse($parts));
            }
            break;
        case 'login':
            $user_id = user_check_password($_POST['login'], $_POST['password']);
            if ($user_id) {
                $token = remember_user($user_id, false, false);
                $answer['answer'] = array('user_id' => $user_id, 'token' => $token);
            } else {
                $answer['error'] = 'Incorrect login or password';
예제 #5
0
파일: search.php 프로젝트: dubems/Jabros
}
function saveToLog($query, $elapsed, $results)
{
    global $mysql_table_prefix;
    if ($results == "") {
        $results = 0;
    }
    $query = "insert into " . $mysql_table_prefix . "query_log (query, time, elapsed, results) values ('{$query}', now(), '{$elapsed}', '{$results}')";
    mysql_query($query);
    echo mysql_error();
}
switch ($search) {
    case 1:
        if (!isset($results)) {
            $results = "";
        }
        $search_results = get_search_results($query, $start, $category, $type, $results, $domain);
        require "{$template_dir}/{$template}/search_results.html";
        break;
    default:
        if ($show_categories) {
            if ($_REQUEST['catid'] && is_numeric($catid)) {
                $cat_info = get_category_info($catid);
            } else {
                $cat_info = get_categories_view();
            }
            require "{$template_dir}/{$template}/categories.html";
        }
        break;
}
include "{$template_dir}/{$template}/footer.html";
예제 #6
0
    }
} else {
    // +-----------------------------------------------------------------------+
    // |                            tags section                               |
    // +-----------------------------------------------------------------------+
    if ($page['section'] == 'tags') {
        $page['tag_ids'] = array();
        foreach ($page['tags'] as $tag) {
            $page['tag_ids'][] = $tag['id'];
        }
        $items = get_image_ids_for_tags($page['tag_ids']);
        $page = array_merge($page, array('title' => get_tags_content_title(), 'items' => $items));
    } else {
        if ($page['section'] == 'search') {
            include_once PHPWG_ROOT_PATH . 'include/functions_search.inc.php';
            $search_result = get_search_results($page['search'], @$page['super_order_by']);
            //save the details of the query search
            if (isset($search_result['qs'])) {
                $page['qsearch_details'] = $search_result['qs'];
            }
            $page = array_merge($page, array('items' => $search_result['items'], 'title' => '<a href="' . duplicate_index_url(array('start' => 0)) . '">' . l10n('Search results') . '</a>'));
        } else {
            if ($page['section'] == 'favorites') {
                check_user_favorites();
                $page = array_merge($page, array('title' => l10n('Favorites')));
                if (!empty($_GET['action']) && $_GET['action'] == 'remove_all_from_favorites') {
                    $query = '
DELETE FROM ' . FAVORITES_TABLE . '
  WHERE user_id = ' . $user['id'] . '
;';
                    pwg_query($query);
예제 #7
0
    if ($search_in != 'all') {
        if (isset($used_modules[$search_in]) && isset($modules_args[$search_in])) {
            $used_modules = array($search_in => $used_modules[$search_in]);
            $modules_args = array($search_in => $modules_args[$search_in]);
        } else {
            $used_modules = array();
            $modules_args = array();
        }
    } else {
        // We remove modules that we're not searching in
        foreach ($modules_args as $module_id => $module_args) {
            if (!$query_mode && (!in_array($module_id, $selected_modules) || !isset($modules_args[$module_id]))) {
                unset($modules_args[$module_id]);
                unset($used_modules[$module_id]);
            }
        }
    }
    // Génération des résultats et passage aux templates
    $nbResults = get_search_results($search, $used_modules, $modules_args, $results, $idsSearch);
    foreach ($used_modules as $module_id => $extension_point) {
        $tpl->assign_block_vars('results', array('MODULE_NAME' => $module_id, 'L_MODULE_NAME' => ucfirst(ModulesManager::get_module($module_id)->get_configuration()->get_name()), 'ID_SEARCH' => $idsSearch[$module_id]));
    }
    $all_html_result = '';
    if ($nbResults > 0) {
        get_html_results($results, $all_html_result, $search_in);
    }
    $tpl->assign_vars(array('NB_RESULTS_PER_PAGE' => NB_RESULTS_PER_PAGE, 'L_TITLE_ALL_RESULTS' => $LANG['title_all_results'], 'L_RESULTS' => $LANG['results'], 'L_RESULTS_CHOICE' => $LANG['results_choice'], 'L_PRINT' => $LANG['print'], 'L_NB_RESULTS_FOUND' => $nbResults > 1 ? $LANG['nb_results_found'] : ($nbResults == 0 ? $LANG['no_results_found'] : $LANG['one_result_found']), 'L_SEARCH_RESULTS' => $LANG['search_results'], 'NB_RESULTS' => $nbResults, 'ALL_RESULTS' => $all_html_result, 'SEARCH_IN' => $search_in, 'C_SIMPLE_SEARCH' => $search_in == 'all'));
    $tpl->display();
}
//--------------------------------------------------------------------- Footer
require_once '../kernel/footer.php';
예제 #8
0
function getSearchResultString($query)
{
    $search_results = get_search_results("{$query}", "", "", "and", "", "");
    extract($search_results);
    global $urlRequestRoot, $cmsFolder;
    $resultHTML = "<link rel='stylesheet' media='print' type='text/css' href=\"{$urlRequestRoot}/{$cmsFolder}/templates/common/search.css\" />";
    if ($search_results['did_you_mean']) {
        $dym = quote_replace(addmarks($search_results['did_you_mean']));
        $resultHTML .= <<<DIDYOUMEAN
\t\t\t<div id="did_you_mean">
\t\t\t\tDid You Mean: <a href="./+search&query={$dym}&search=1">{$search_results['did_you_mean_b']}</a>
\t\t\t</div>
DIDYOUMEAN;
    }
    if ($search_results['ignore_words']) {
        $resultHTML .= '<div id="common_report">';
        $ignored = '';
        while ($thisword = each($ignore_words)) {
            $ignored .= " " . $thisword[1];
        }
        $resultHTML .= '</div>';
    }
    if ($search_results['total_results'] == 0) {
        $resultHTML .= '<div id ="result_report">';
        $resultHTML .= str_replace('%query', $ent_query, "Sorry! No matches found.");
        $resultHTML .= '</div>';
    }
    if ($total_results != 0 && $from <= $to) {
        $resultHTML .= '<div id ="result_report">';
        $res = 'Results';
        $res = str_replace('%from', $from, $res);
        $res = str_replace('%to', $to, $res);
        $res = str_replace('%all', $total_results, $res);
        $matchword = "matches";
        if ($total_results == 1) {
            $matchword = "match";
        } else {
            $matchword = "matches";
        }
        $res = str_replace('%matchword', $matchword, $res);
        $res = str_replace('%secs', $time, $res);
        $resultHTML .= $res;
        $resultHTML .= '</div>';
    }
    if (isset($qry_results)) {
        $resultHTML .= '<div id="results">';
        foreach ($qry_results as $_key => $_row) {
            $last_domain = $domain_name;
            extract($_row);
            if ($sph_show_query_scores == 0) {
                $weight = '';
            } else {
                $weight = "[{$weight}%]";
            }
            if ($domain_name == $last_domain && $sph_merge_site_results == 1 && $domain == "") {
                $resultHTML .= '<div class="idented">';
            }
            $resultHTML .= "<b>{$num}.</b> {$weight} \n";
            $resultHTML .= "<a href=\"{$url}\" class=\"sph_title\">" . ($title ? $title : 'Untitled') . "</a><br/>\n";
            $resultHTML .= "<div class=\"description\">{$fulltxt}</div>\n";
            $resultHTML .= "<div class=\"url\">{$url2} - {$page_size}</div>\n";
            if ($domain_name == $last_domain && $sph_merge_site_results == 1 && $domain == "") {
                $q = quote_replace(addmarks($query));
                $resultHTML .= "[ <a href=\"./+search&query={$q}&search=1&results={$results_per_page}&domain={$domain_name}\">More results from {$domain_name}</a> ]";
                $resultHTML .= "</div class=\"idented\">\n";
            }
            $resultHTML .= "<br />\n";
        }
        $resultHTML .= '</div>';
    }
    if (isset($other_pages)) {
        if ($adv == 1) {
            $adv_qry = "&adv=1";
        }
        if ($type != "") {
            $type_qry = "&type={$type}";
        }
        $resultHTML .= "<div id=\"other_pages\">\nResult page: ";
        if ($start > 1) {
            $q = quote_replace(addmarks($query));
            $resultHTML .= "<a href=\"./+search&query={$q}&start={$prev}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">Previous</a>";
        }
        foreach ($other_pages as $page_num) {
            if ($page_num != $start) {
                $q = quote_replace(addmarks($query));
                $resultHTML .= "<a href=\"./+search&query={$q}&start={$page_num}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">{$page_num}</a>";
            } else {
                $resultHTML .= "<b>{$page_num}</b>";
            }
        }
        if ($next <= $pages) {
            $q = quote_replace(addmarks($query));
            $resultHTML .= "<a href=\"./+search&query={$q}&start={$next}&search=1&results={$results_per_page}{$type_qry}{$adv_qry}&domain={$domain}\">Next</a>";
        }
        $resultHTML .= '</div>';
    }
    return $resultHTML;
}
예제 #9
0
<?php

require 'lib/header.php';
require 'lib/lib_annot.php';
if (isset($_GET['q'])) {
    $search = trim(mb_strtolower($_GET['q']));
    $smarty->assign('search', get_search_results($search, isset($_GET['exact_form'])));
    $smarty->display('search.tpl');
} else {
    show_error("Не задан поисковый запрос");
}
log_timing();
예제 #10
0
     foreach ($search_modules as $id => $extension_point) {
         if ($form_module->has_search_options()) {
             // Récupération de la liste des paramètres
             $form_module_args = $extension_point->get_search_args();
             // Ajout des paramètres optionnels sans les sécuriser.
             // Ils sont sécurisés à l'intérieur de chaque module.
             foreach ($form_module_args as $arg) {
                 if ($request->has_postparameter($arg)) {
                     $modules_args[$id][$arg] = $request->get_postvalue($arg);
                 }
             }
         }
     }
     $results = array();
     $ids_search = array();
     get_search_results($search_txt, $search_modules, $modules_args, $results, $ids_search, true);
     if (empty($ids_search[$module_id])) {
         $ids_search[$module_id] = 0;
     }
     // Propagation des nouveaux id_search
     foreach ($ids_search as $module_name => $id_search) {
         $search->id_search[$module_name] = $id_search;
         echo 'idSearch[\'' . $module_name . '\'] = ' . $id_search . ';';
     }
 } else {
     $search->id_search[$module_id] = $id_search;
 }
 echo 'var resultsAJAX = new Array();';
 $nb_results = $search->get_results_by_id($results, $search->id_search[$module_id]);
 if ($nb_results > 0) {
     //$module = $modules->get_module($module_id);
예제 #11
0
    } else {
        ?>
<div class="disabled">&raquo;</div><?php 
    }
    ?>
									<?php 
}
?>
									</div>
									<div style="clear:both;"></div>
								</div>
							</div>
							<div class="channel-content">
								<ul>
									<?php 
get_search_results($search_terms, $offset);
?>
								</ul>					
							</div>
						</div>
						
					</div>
				
					<?php 
include_once "includes/channel_preview.php";
?>
					
				</div>
		
			</div>
			
예제 #12
0
<?php

$word = htmlspecialchars($_GET["word"]);
function get_search_results($word)
{
    include 'dbconnect.php';
    $query = "SELECT * FROM Notiz, Person WHERE " . "Person.id = Notiz.person_id" . " AND note_text LIKE '%" . $word . "%'";
    $mysqli_result = mysqli_query($connection, $query);
    $search_results = array();
    foreach ($mysqli_result as $row) {
        $search_results[] = $row;
    }
    return $search_results;
}
echo json_encode(get_search_results($word));
예제 #13
0
<?php

$options = get_option(THEME_OPTIONS_NAME);
if ($options['enable_google'] or $options['enable_google'] === null) {
    $domain = $options['search_domain'];
    $limit = (int) $options['search_per_page'];
    $start = is_numeric($_GET['start']) ? (int) $_GET['start'] : 0;
    $results = get_search_results($_GET['s'], $start, $limit, $domain);
    get_header();
    ?>
	<div class="row page-content" id="search-results">
		<div class="span9">
			<article>
				<h1>Search Results</h1>
				<?php 
    if (count($results['items'])) {
        ?>
				<ul class="result-list">
					<?php 
        foreach ($results['items'] as $result) {
            ?>
					<li class="item">
						<h3>
							<a class="<?php 
            echo mimetype_to_application($result['mime'] ? $result['mime'] : 'text/html');
            ?>
" href="<?php 
            echo $result['url'];
            ?>
">
								<?php 
예제 #14
0
             $html .= '<tr><td>' . $lang->translate(509) . '</td><td><input type="text" id="handelsnaam" name="handelsnaam" value="' . $tempuser['handelsnaam'] . '"></td></tr>';
             $html .= '<tr><td>' . $lang->translate(525) . '</td><td><input type="text" id="home_page" name="home_page" value="' . $tempuser['home_page'] . '"></td></tr>';
             $html .= '<tr><td>' . $lang->translate(511) . '</td><td><input type="text" id="email" name="email" value="' . $tempuser['email'] . '"></td></tr>';
             $html .= '<tr><td colspan="2"></td></tr>';
             $html .= '</table></div><br /><div class="content"><p><input type="submit" value="' . $lang->translate(543) . '" id="submit" class="button" name="submit"></p></div></form><br><br>';
         } else {
             $html .= '<br /><a href="?lang=' . lang_get_value_defaultlang() . '&page=klanten&type=rechten&id=' . $userdata2['id'] . '"><div class="content"><p>' . $lang->translate(546) . '</p></div></a><br /><br />';
         }
     } else {
         $html .= '<br /><br />' . $lang->translate(542) . '<br /><br />';
     }
 } elseif (get_value_get('type') == 'zoeken') {
     $html = '<div class="paginatitel">' . $lang->translate(531) . '</div>';
     if (check_user_right(get_value_session('from_db', 'id'), 'klantzoeken', get_value_session('from_db', 'is_admin')) != FALSE) {
         if (get_value_post('submit')) {
             $temp = get_search_results(get_value_session('from_db', 'id'), get_value_post('search'), 'users', get_value_session('from_db', 'is_admin'));
             if ($temp == FALSE) {
                 $html .= '<br /><p>' . $lang->translate(532) . '</p><br /><br />';
             } else {
                 $html .= '<DIV class="tablestop2"><table><tr><td align="right" colspan="10"><div style="width:665px;">';
                 $html .= '<div style="float: right;"> <form name="form2" method="post" action="?page=klanten&type=zoeken">';
                 $html .= '<input type="text" id="search" name="search" class="search">';
                 $html .= '<input type="submit" value="' . $lang->translate(533) . '" id="submit" name="submit" class="searchbutton"></form></div></div>';
                 $html .= '</td></tr>';
                 $html .= '<tr><td>' . $lang->translate(213) . '';
                 if (check_user_right(get_value_session('from_db', 'id'), 'klanttoevoegen', get_value_session('from_db', 'is_admin')) != FALSE) {
                     $html .= '<div style="float: right;"><a href="?page=klanten&type=toevoegen"><img src="' . $template_dir . '/plus.png" border="0" valign="middle" title="' . $lang->translate(541) . '"></a></div>';
                 }
                 $html .= '</td><td>' . $lang->translate(509) . '</td><td colspan="8">' . $lang->translate(630) . '</td></tr>';
                 foreach ($temp as $item) {
                     $userdata = get_userdata($item['id']);
            </div>

            <button name="search" type="submit" class="btn btn-primary" value="Search"><span class="glyphicon glyphicon-search"></span> Search</button>
                <p class="help-block">You can use * as a wildcard character. Tip: search for * alone to retrieve all of your projects.</p>
        </form>





        <?php 
if (isset($_POST['search'])) {
    /**
     * get results
     */
    $projects = get_search_results();
    /**
     * display results
     */
    if (sizeof($projects) == 0) {
        print_warning_message('No results found. Please try again.');
    } else {
        echo '<div class="table-responsive">';
        echo '<table class="table">';
        echo '<tr>';
        echo '<th>Name</th>';
        echo '<th>Creation Time</th>';
        echo '<th>Experiments</th>';
        echo '</tr>';
        foreach ($projects as $project) {
            echo '<tr>';