"; } if (is_array($l_res)) { foreach ($l_res as $vv) { $s = exec('grep -m 1 \ ' . $vv, $l_title); $l_title = preg_replace("/(.*)<\/title>/is", "\\1", $l_title[0]); if (!$l_title) {$l_title = basename($vv);} $s = exec('grep -m 1 \'<p class="byline">\' ' . $vv, $l_date); $l_date = preg_replace("/<p class=\"byline\">(.*)<\/p>/is", "\\1", $l_date[0]); if ($l_date) { $l_date_sort = date('Ymd', strtotime(extractdate($l_date))); $l_date = ' --- ' . $l_date ; } else { $l_date_sort = ''; } $s = exec('grep -m 1 \'<meta name="description"\' ' . $vv, $l_descr); $l_descr = preg_replace("/<meta name=\"description\" content=\"(.*)\">/is", "\\1", $l_descr[0]); if ($l_date_sort) { $gResTitles[] = array( 'title' => '<a href="' . $v . '/' . basename($vv) . '">' . $l_title . $l_date . '</a>', 'descr' => $l_descr, 'dtsort' => $l_date_sort ); } foreach ($gResTitles as $key => $row) { $dt[$key] = $row['dtsort']; } array_multisort($dt, SORT_DESC, $gResTitles); } } } } } else { $gUrl = getenv('HTTP_REFERER'); } $p = new SitePage(); $l_templ = array(); $l_val = array(); $l_templ[] = 'stxt'; $l_val[] = h($gStxt); $l_templ[] = 'url'; $l_val[] = h($gUrl); $p->SetContents('tpl/search.tpl.php', 1, $l_val, $l_templ); if (getenv("REMOTE_ADDR") == "193.24.243.2") { $p->ReplaceCont(1, $gResTitles ); } else { $p->ReplaceCont(1, $gResTitles ); } if (count($gResTitles) || !$_GET['frm']) { $p->RemoveComment('NO_RES'); } $p->GetDetails(); $p->ReplaceTag('redtag', 'Search'); $p->Show(); function GetDirectories() { global $gDirs; $gDirs = array(); // $gDirs[] = ""; $handle = fopen($gDocRoot . "confsearch.php", "r"); while (!feof($handle)) { $buffer = fgets($handle, 4096); $gDirs[] = trim($buffer); } fclose($handle); } function extractdate($pStr) { $ret = ''; $cur_res = $pStr; $cur_date = ''; $l_pos = strrpos($cur_res, " "); if ($l_pos === false) {return $ret;} $cur_date = substr($cur_res, $l_pos) . $cur_date; $cur_res = substr($cur_res, 0, $l_pos); $l_pos = strrpos($cur_res, " "); if ($l_pos === false) {return $ret;} $cur_date = substr($cur_res, $l_pos) . $cur_date; $cur_res = substr($cur_res, 0, $l_pos); $l_pos = strrpos($cur_res, " "); if ($l_pos === false) {$l_pos = 0;} $cur_date = substr($cur_res, $l_pos) . $cur_date; $cur_res = substr($cur_res, 0, $l_pos); return $cur_date; } ?>