2 define('AT_INCLUDE_PATH', '../../../include/');
\r
3 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
4 require(AT_INCLUDE_PATH.'../mods/_standard/google_search/SOAP_Google.php');
\r
5 $_custom_css = $_base_path . 'mods/_standard/google_search/module.css'; // use a custom stylesheet
\r
6 $search_key = $_config['gsearch'];
\r
8 require(AT_INCLUDE_PATH.'header.inc.php');
\r
13 * Check which type of google search this is, and perform the corresponding action
\r
14 * Note: If the key was invalid, it doesn't matter what search type the admin has chosen.
\r
15 * It should simply just forward the query to the Google site.
\r
17 if (!$_config['gsearch'] || $_config['gtype']==GOOGLE_TYPE_SOAP){ ?>
\r
19 //Search post - SOAP
\r
20 if (isset($_GET['submit'])){
\r
21 $google = new SOAP_Google($search_key);
\r
22 $search_array = array();
\r
23 $search_array['filter'] = true;
\r
24 $search_array['query'] = stripslashes($_GET['q']);
\r
25 $search_array['maxResults'] = 10;
\r
26 $search_array['lr'] = "lang_en";
\r
28 $result = $google->search($search_array);
\r
30 if (isset($result['faultstring'])) {
\r
31 $msg->printErrorS('GOOGLE_QUERY_FAILED');
\r
32 } else if ($result) {
\r
33 echo '<h3>Search Results</h3>';
\r
34 if (is_array($result['resultElements'])) {
\r
37 foreach ($result['resultElements'] as $r) {
\r
38 echo '<li><a href="' . $r['URL'] . '">' . ($r['title'] ? $r['title'] : '<strong>'._AT('no_title').'</strong>' ) . '</a>';
\r
40 echo '<small>'.($r['snippet'] ? $r['snippet'] : '<strong>'._AT('no_content_avail').'</strong>' ) .'<br /><i>'.$r['URL'].'</i></small>';
\r
44 if (count($result['resultElements']) == 10) {
\r
45 $search_array['start'] = 10;
\r
46 $result2 = $google->search($search_array);
\r
48 if (false !== $result2) {
\r
49 foreach ($result2['resultElements'] as $r) {
\r
50 echo '<li><a href="' . $r['URL'] . '">' . ($r['title'] ? $r['title'] : '<strong>'._AT('no_title').'</strong>' ) . '</a>';
\r
52 echo '<small>'.($r['snippet'] ? $r['snippet'] : '<strong>'._AT('no_content_avail').'</strong>' ) .'<br /><i>'.$r['URL'].'</i></small>';
\r
59 if (count($result2['resultElements']) == 10) {
\r
60 echo '<p><i>'._AT('top_20').'</i></p>';
\r
63 echo '<p>'._AT('none_found').'</p>';
\r
68 <?php if ($_config['gsearch']): ?>
\r
69 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
\r
71 <form action="http://www.google.com/search" method="get" target="_new">
\r
72 <input type="hidden" name="hl" value="<?php echo $_SESSION['lang']; ?>" />
\r
75 <div class="input-form" style="max-width: 525px">
\r
77 <?php echo _AT('google_search_txt'); ?>
\r
78 <?php if (!$_config['gsearch']): ?>
\r
80 <p><?php echo _AT('google_new_window'); ?></p>
\r
85 <span class="required" title="<?php echo _AT('required_field'); ?>">*</span><label for="keywords"><?php echo _AT('search_words'); ?></label><br />
\r
86 <input type="text" name="q" size="30" id="keywords" value="<?php echo htmlspecialchars($stripslashes($_GET['q'])); ?>" />
\r
89 <div class="row buttons">
\r
90 <input type="hidden" name="submit" value="<?php echo _AT('search'); ?>"/>
\r
91 <input type="submit" accesskey="s" />
\r
95 <small><?php echo _AT('powered_by_google'); ?></small>
\r
101 } elseif ($_config['gtype']==GOOGLE_TYPE_AJAX){
\r
102 $side_menu_q = stripslashes($_GET['q']); //side menu query
\r
103 include('gsearch.php');
\r
108 require(AT_INCLUDE_PATH.'footer.inc.php');
\r