diff options
Diffstat (limited to 'buildscripts/index/search.php')
-rw-r--r-- | buildscripts/index/search.php | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/buildscripts/index/search.php b/buildscripts/index/search.php index a34363f4..23948ca5 100644 --- a/buildscripts/index/search.php +++ b/buildscripts/index/search.php @@ -1,36 +1,36 @@ -<?php
-
-if(isset($_GET['keyword']))
- $keyword=trim($_GET['keyword']);
-else
- $keyword='';
-
-$zend_path=realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index');
-set_include_path(get_include_path().PATH_SEPARATOR.$zend_path);
-require_once('Zend/Search/Lucene.php');
-
-if($keyword!=='')
-{
- $search=new Zend_Search_Lucene(realpath(dirname(__FILE__)));
- $results=$search->find(strtolower($keyword));
- $content='';
- foreach($results as $entry)
- $content.="<li><a href=\"{$entry->link}\">{$entry->title}</a></li>\n";
- if($content!=='')
- {
- $count=count($results);
- $content="<p>Total <b>$count</b> pages matching keyword <b>".htmlentities($keyword)."</b>.\n<ol>\n$content</ol>\n";
- }
- else
- $content="<p>No page matches <b>".htmlentities($keyword)."</b>.</p>";
-}
-else
- $content="<p>Please specify a keyword to search for.</p>";
-
-$page=file_get_contents(dirname(__FILE__).'/index.html');
-$page=preg_replace('/<!-- content begin -->.*<!-- content end -->/ms',$content,$page);
-if($keyword!=='')
- $page=preg_replace('/<input type="text" name="keyword"/','<input type="text" name="keyword" value="'.htmlentities($keyword).'"',$page);
-echo $page;
-
+<?php + +if(isset($_GET['keyword'])) + $keyword=trim($_GET['keyword']); +else + $keyword=''; + +$zend_path=realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index'); +set_include_path(get_include_path().PATH_SEPARATOR.$zend_path); +require_once('Zend/Search/Lucene.php'); + +if($keyword!=='') +{ + $search=new Zend_Search_Lucene(realpath(dirname(__FILE__))); + $results=$search->find(strtolower($keyword)); + $content=''; + foreach($results as $entry) + $content.="<li><a href=\"{$entry->link}\">{$entry->title}</a></li>\n"; + if($content!=='') + { + $count=count($results); + $content="<p>Total <b>$count</b> pages matching keyword <b>".htmlentities($keyword)."</b>.\n<ol>\n$content</ol>\n"; + } + else + $content="<p>No page matches <b>".htmlentities($keyword)."</b>.</p>"; +} +else + $content="<p>Please specify a keyword to search for.</p>"; + +$page=file_get_contents(dirname(__FILE__).'/index.html'); +$page=preg_replace('/<!-- content begin -->.*<!-- content end -->/ms',$content,$page); +if($keyword!=='') + $page=preg_replace('/<input type="text" name="keyword"/','<input type="text" name="keyword" value="'.htmlentities($keyword).'"',$page); +echo $page; + ?>
\ No newline at end of file |