Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bing as a search engine option. Search engine placement is random…
… on each page load. Add randomization of the order of platinum supporter logos as in years past. Closes #120.
- Loading branch information
1 parent
ab3ec66
commit 59653df
Showing
13 changed files
with
131 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
$title = "SIGCSE 2012 - Search Results"; | ||
$onload = "pageLoad(null, null);"; | ||
include("parts/top.php"); | ||
?> | ||
<div class="SectionHeader"><div class="Full"> | ||
<h2>SIGCSE 2012 Search Results from Bing</h2> | ||
</div></div> | ||
<div class="searchResult"> | ||
|
||
<?php | ||
$resultPerPage = 10; | ||
$offsetNum = 0; | ||
$offset = "web.offset=0"; | ||
if (isset($_GET['offset'])) { | ||
$offsetNum = intval($_GET['offset']); | ||
$offset = "web.offset=0" . $_GET['offset']; | ||
} | ||
|
||
|
||
if (isset($_GET['query'])) { | ||
$request = | ||
'http://api.bing.net/json.aspx?Appid=1EAAC8DFCA91DD8D0E442B4AFCAB8B641F7903E1&sources=web&' . | ||
$offset . '&web.count=' . $resultPerPage . '&query=' . urlencode( $_GET["query"] ) . "+site%3Asigcse.org%2Fsigcse2012%2F"; | ||
$response = file_get_contents($request); | ||
$jsonobj = json_decode($response); | ||
|
||
echo('<p>Found ' . $jsonobj->SearchResponse->Web->Total . ' total results</p>'); | ||
|
||
foreach($jsonobj->SearchResponse->Web->Results as $value) | ||
{ | ||
echo('<p><strong><a href="' . $value->Url . '" style="color: blue;">' . $value->Title . '</a></strong><br/>'); | ||
echo( $value->Description . "<br/>"); | ||
echo( '<span class="searchUrl">' . $value->DisplayUrl . '</span>'); | ||
echo('</p>'); | ||
} | ||
|
||
$page = 1; | ||
$pages = ceil($jsonobj->SearchResponse->Web->Total / floatval($resultPerPage)); | ||
$curPage = floor($offsetNum / $resultPerPage) + 1; | ||
echo('<p>Page: '); | ||
while($page <= $pages) { | ||
if ($page == $curPage) { | ||
echo('<strong>' . $page . '</strong>'); | ||
} else { | ||
$newOffset = ($page - 1) * $resultPerPage; | ||
echo('<a href="/sigcse2012/bing.php?offset=' . $newOffset . '&query=' . urlencode( $_GET["query"] ) . '">' . $page . '</a>'); | ||
} | ||
echo(' '); | ||
$page = $page + 1; | ||
} | ||
echo('</p>'); | ||
} ?> | ||
</div> | ||
<?php | ||
$updated = filemtime( $_SERVER["SCRIPT_FILENAME"] ); | ||
$mainPage = true; | ||
include("parts/bottom.php"); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<form method="get" action="/sigcse2012/bing.php"> | ||
Search with Bing<br/><input type="text" id="query" name="query" size="31" value="<?php | ||
if (isset($_GET['query'])) { | ||
echo($_GET['query']); } | ||
else { | ||
echo('SIGCSE 2012'); | ||
} | ||
?>"/> | ||
<input type="submit" value="Search" name="submit" id="searchButton" /> | ||
|
||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<td align="center" valign="middle" colspan="1"> | ||
<a href="http://www.google.com/edu/" alt="Google EDU"><img src="/sigcse2012/images/logos/sponsors/google.png" /></a> | ||
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Search with Google<br/><script type="text/javascript" src="http://www.google.com/jsapi"></script> | ||
<script type="text/javascript"> | ||
google.load('search', '1'); | ||
google.setOnLoadCallback(function() { | ||
google.search.CustomSearchControl.attachAutoCompletion( | ||
'000184131728111546209:ca9n_ricjba', | ||
document.getElementById('q'), | ||
'cse-search-box'); | ||
}); | ||
</script> | ||
<form action="http://www.sigcse.org/sigcse2012/search.php" id="cse-search-box"> | ||
<div> | ||
<input type="hidden" name="cx" value="000184131728111546209:bra5kgqicnk" /> | ||
<input type="hidden" name="cof" value="FORID:11" /> | ||
<input type="hidden" name="ie" value="UTF-8" /> | ||
<input type="text" name="q" id="q" autocomplete="on" size="31" /> | ||
<input type="submit" name="sa" value="Search" /> | ||
</div> | ||
</form> | ||
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&lang=en"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<td align="center" valign="middle"> | ||
<a href="http://software.intel.com/sites/academic_showcase/" alt="Intel Education"><img src="/sigcse2012/images/logos/sponsors/intel.png" /></a> | ||
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<td align="center" valign="middle" colspan="1"> | ||
<a href="http://www.microsoft.com/education/highered/faculty/" alt="Microsoft Highered"><img src="/sigcse2012/images/logos/sponsors/microsoft.png" /></a> | ||
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
$sponsors = array("microsoft.php", "google.php", "intel.php"); | ||
shuffle($sponsors); | ||
foreach ($sponsors as $sponsor) { | ||
include($sponsor); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters