function searchFragmentsForUser($user, $query) { $results = searchQuery("user: \"{$user}\" AND searchtext:\"{$query}\"~0.8"); $fragments = array(); foreach ($results as $result) { $fragments[] = new Fragment($result->uri, $result->user, $result->created, $result->modified, $result->title, $result->content); } return $fragments; }
function storyPathQuery() { $querys = array(newsHomeQuery()); if(searchQuery()) { $querys[] = searchQuery(); } if(isset($_REQUEST['search_id'])) { $querys[] = "search_id={$_REQUEST['search_id']}"; } if(isset($_REQUEST['story_id'])) { $querys[] = "story_id={$_REQUEST['story_id']}"; } return implode('&', $querys); }
<!-- Search Page: Last edited 23.10.15 --> <?php include "config.php"; include "functions.php"; websiteHeader(); ?> <body> <?php redirectSignIn(); $searchResults = searchQuery(); $countQuery = str_replace("LIKE '", "LIKE '%", $searchResults); $last = countRowsSearch($countQuery); checkForRequest(); ?> <div id="search-container"> <div class="search-header-bg"> <div class="profile-header"> <img src="../Images/Booklend-small-logo.png" alt="Booklend Logo" class="logo-small"> <div class="logout-container"> <div class="logout-circle"></div> <a href="signout.php" class="logout">LOGOUT</a> </div> <a href="profile.php" class="profile-link"><code><?php echo $_SESSION['user']; ?>
case ':ip': $result = $dbConnection->getIp($searchQuery); break; case ':ad': $result = $dbConnection->getAddress($searchQuery); break; default: $result = false; } //en caso que NO tenga código } else { $result = array_merge($dbConnection->getName($searchQuery), $dbConnection->getIp($searchQuery), $dbConnection->getAddress($searchQuery), $dbConnection->getCode($searchQuery)); } return $result; } //hacer que devuelva un id y no los rows, y que los rows los devuelva una función $response = searchQuery($code, $stringQuery); print "\n <table class='table table-striped table-bordered table-hover table-condensed' >\n <thead>\n <tr>\n <td><b>código</b></td>\n <td><b>nombre</b></td>\n <td><b>ip</b></td>\n <td><b>dirección</b></td>\n <td><b>teléfono</b></td>\n </thead>\n <tbody>\n\n "; try { foreach ($response as $document) { print "<tr>"; print "<td>" . $document['code'] . "</td>"; print "<td>" . $document['name'] . "</td>"; print "<td>" . $document['ip'] . "</td>"; print "</tr>"; } } catch (Exception $e) { echo "error03"; var_dump($e); } print "\n </tbody>\n </table>\n ";