This commit has been accessed 571 times via Git panel.
commit 1fc9d7d9987989d167d2bee454afc0d5e8c0132b
tree e7a2547e5f48720b223b2c3f4737ffc0c0698b6a
parent 83c0857532f73c40f29e16781fc663890cbfe8f3
author Engels Antonio <engels@majcms.org> 1277314192 +0800
committer Engels Antonio <engels@majcms.org> 1277314192 +0800
maj-0.14-20071118-bb.zip
diff --git a/dig.php b/dig.php
index 3bd5f44..adf1b93 100644
--- a/dig.php
+++ b/dig.php
@@ -89,9 +89,78 @@ if (strlen($search) < 3) {
$dir = "data/items";
-$start_time = round(microtime(), 3);
+if (file_exists("data/bb.txt") and file_exists("data/members/active") and ($dh_search_members = opendir("data/members/active"))) {
+
+ $start_time_member = round(microtime(), 3);
+
+ while (($entry_search_members = readdir($dh_search_members)) !== false) {
+
+ if ($entry_search_members != "." && $entry_search_members != "..") {
+ $total_members[] = $entry_search_members;
+ }
+
+ if ($entry_search_members != "." && $entry_search_members != ".." && (preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/firstname.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/lastname.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/rank.txt")) or ($search == $entry_search_members))) {
+ $show_search_members[] = $entry_search_members;
+ }
+ }
+
+ $stop_time_member = round(microtime(), 3);
+ $generation_time_member = $stop_time_member - $start_time_member;
+
+ $show_search_members = array_unique($show_search_members);
+ $show_search_members = array_values($show_search_members);
+ sort($show_search_members);
+
+ reset($show_search_members);
+ $count_search_members = count($show_search_members);
+
+ reset($total_members);
+ $count_total_members = count($total_members);
+
+ if ($count_search_members > 0) {
+ echo "<p>Found <b>$search</b> in $count_search_members out of $count_total_members ";
+
+ if ($count_total_members == 1) {
+ echo "member";
+ }
+
+ if ($count_total_members > 1) {
+ echo "members";
+ }
+
+ echo " ($generation_time_member seconds).</p>";
+
+ $search_ucfirst = ucfirst($search);
+ $search_ucwords = ucwords($search);
+ $search_strtoupper = strtoupper($search);
+
+ foreach ($show_search_members as $match_member) {
+ $match_member_firstname = file_get_contents("data/members/active/$match_member/firstname.txt");
+ $match_member_firstname = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $match_member_firstname);
+ $match_member_firstname = str_replace($search_ucfirst, "<span style=\"background-color: #ffff00;\">$search_ucfirst</span>", $match_member_firstname);
+ $match_member_firstname = str_replace($search_ucwords, "<span style=\"background-color: #ffff00;\">$search_ucwords</span>", $match_member_firstname);
+ $match_member_firstname = str_replace($search_strtoupper, "<span style=\"background-color: #ffff00;\">$search_strtoupper</span>", $match_member_firstname);
+
+ $match_member_lastname = file_get_contents("data/members/active/$match_member/lastname.txt");
+ $match_member_lastname = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $match_member_lastname);
+ $match_member_lastname = str_replace($search_ucfirst, "<span style=\"background-color: #ffff00;\">$search_ucfirst</span>", $match_member_lastname);
+ $match_member_lastname = str_replace($search_ucwords, "<span style=\"background-color: #ffff00;\">$search_ucwords</span>", $match_member_lastname);
+ $match_member_lastname = str_replace($search_strtoupper, "<span style=\"background-color: #ffff00;\">$search_strtoupper</span>", $match_member_lastname);
+
+ $match_member_link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/member.php?id={$match_member}";
+ $match_member_link_fix = array('//member.php', '///member.php');
+ $match_member_link = str_replace($match_member_link_fix, '/member.php', $match_member_link);
+ $match_member_link = trim($match_member_link);
+
+ echo "<p><a href=member.php?id={$match_member}>$match_member</a><br>{$match_member_firstname} {$match_member_lastname}<br>$match_member_link</p>";
+ }
+ }
+}
if ($dh_search_items = opendir($dir)) {
+
+ $start_time_item = round(microtime(), 3);
+
while (($entry_search_items = readdir($dh_search_items)) !== false) {
$cat_dir = file_get_contents("data/items/$entry_search_items/category.txt");
@@ -138,6 +207,9 @@ if ($dh_search_items = opendir($dir)) {
closedir($dh_search_items);
}
+$stop_time_item = round(microtime(), 3);
+$generation_time_item = $stop_time_item - $start_time_item;
+
$show_search_items = array_unique($show_search_items);
$show_search_items = array_values($show_search_items);
rsort($show_search_items);
@@ -151,12 +223,8 @@ $count_total_comments = count($total_comments);
reset($total_entries);
$count_total_items = count($total_entries);
-$stop_time = round(microtime(), 3);
-
if (($count_search_items > 0) and ($count_total_items > 0)) {
-$generation_time = $stop_time - $start_time;
-
echo "<p>Found <b>$search</b> in $count_search_items out of $count_total_items ";
if ($count_total_items == 1) {
@@ -179,7 +247,7 @@ $generation_time = $stop_time - $start_time;
}
}
- echo " ($generation_time seconds).</p>";
+ echo " ($generation_time_item seconds).</p>";
$increment_search_entries = 0;
@@ -255,7 +323,19 @@ else {
if ($count_total_items > 1) {
echo "entries";
}
- echo ".<br>Click <a href=http://google.com/search?q=$google target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
+
+ if ($count_total_comments > 0) {
+ echo " and $count_total_comments ";
+
+ if ($count_total_comments == 1) {
+ echo "comment";
+ }
+
+ if ($count_total_comments > 1) {
+ echo "comments";
+ }
+ }
+ echo " ($generation_time_item seconds).<br><br>Click <a href=http://google.com/search?q=$google target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
}
?>
tree e7a2547e5f48720b223b2c3f4737ffc0c0698b6a
parent 83c0857532f73c40f29e16781fc663890cbfe8f3
author Engels Antonio <engels@majcms.org> 1277314192 +0800
committer Engels Antonio <engels@majcms.org> 1277314192 +0800
maj-0.14-20071118-bb.zip
diff --git a/dig.php b/dig.php
index 3bd5f44..adf1b93 100644
--- a/dig.php
+++ b/dig.php
@@ -89,9 +89,78 @@ if (strlen($search) < 3) {
$dir = "data/items";
-$start_time = round(microtime(), 3);
+if (file_exists("data/bb.txt") and file_exists("data/members/active") and ($dh_search_members = opendir("data/members/active"))) {
+
+ $start_time_member = round(microtime(), 3);
+
+ while (($entry_search_members = readdir($dh_search_members)) !== false) {
+
+ if ($entry_search_members != "." && $entry_search_members != "..") {
+ $total_members[] = $entry_search_members;
+ }
+
+ if ($entry_search_members != "." && $entry_search_members != ".." && (preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/firstname.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/lastname.txt")) or preg_match("/\b$search\b/i", file_get_contents("data/members/active/$entry_search_members/rank.txt")) or ($search == $entry_search_members))) {
+ $show_search_members[] = $entry_search_members;
+ }
+ }
+
+ $stop_time_member = round(microtime(), 3);
+ $generation_time_member = $stop_time_member - $start_time_member;
+
+ $show_search_members = array_unique($show_search_members);
+ $show_search_members = array_values($show_search_members);
+ sort($show_search_members);
+
+ reset($show_search_members);
+ $count_search_members = count($show_search_members);
+
+ reset($total_members);
+ $count_total_members = count($total_members);
+
+ if ($count_search_members > 0) {
+ echo "<p>Found <b>$search</b> in $count_search_members out of $count_total_members ";
+
+ if ($count_total_members == 1) {
+ echo "member";
+ }
+
+ if ($count_total_members > 1) {
+ echo "members";
+ }
+
+ echo " ($generation_time_member seconds).</p>";
+
+ $search_ucfirst = ucfirst($search);
+ $search_ucwords = ucwords($search);
+ $search_strtoupper = strtoupper($search);
+
+ foreach ($show_search_members as $match_member) {
+ $match_member_firstname = file_get_contents("data/members/active/$match_member/firstname.txt");
+ $match_member_firstname = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $match_member_firstname);
+ $match_member_firstname = str_replace($search_ucfirst, "<span style=\"background-color: #ffff00;\">$search_ucfirst</span>", $match_member_firstname);
+ $match_member_firstname = str_replace($search_ucwords, "<span style=\"background-color: #ffff00;\">$search_ucwords</span>", $match_member_firstname);
+ $match_member_firstname = str_replace($search_strtoupper, "<span style=\"background-color: #ffff00;\">$search_strtoupper</span>", $match_member_firstname);
+
+ $match_member_lastname = file_get_contents("data/members/active/$match_member/lastname.txt");
+ $match_member_lastname = str_replace($search, "<span style=\"background-color: #ffff00;\">$search</span>", $match_member_lastname);
+ $match_member_lastname = str_replace($search_ucfirst, "<span style=\"background-color: #ffff00;\">$search_ucfirst</span>", $match_member_lastname);
+ $match_member_lastname = str_replace($search_ucwords, "<span style=\"background-color: #ffff00;\">$search_ucwords</span>", $match_member_lastname);
+ $match_member_lastname = str_replace($search_strtoupper, "<span style=\"background-color: #ffff00;\">$search_strtoupper</span>", $match_member_lastname);
+
+ $match_member_link = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/member.php?id={$match_member}";
+ $match_member_link_fix = array('//member.php', '///member.php');
+ $match_member_link = str_replace($match_member_link_fix, '/member.php', $match_member_link);
+ $match_member_link = trim($match_member_link);
+
+ echo "<p><a href=member.php?id={$match_member}>$match_member</a><br>{$match_member_firstname} {$match_member_lastname}<br>$match_member_link</p>";
+ }
+ }
+}
if ($dh_search_items = opendir($dir)) {
+
+ $start_time_item = round(microtime(), 3);
+
while (($entry_search_items = readdir($dh_search_items)) !== false) {
$cat_dir = file_get_contents("data/items/$entry_search_items/category.txt");
@@ -138,6 +207,9 @@ if ($dh_search_items = opendir($dir)) {
closedir($dh_search_items);
}
+$stop_time_item = round(microtime(), 3);
+$generation_time_item = $stop_time_item - $start_time_item;
+
$show_search_items = array_unique($show_search_items);
$show_search_items = array_values($show_search_items);
rsort($show_search_items);
@@ -151,12 +223,8 @@ $count_total_comments = count($total_comments);
reset($total_entries);
$count_total_items = count($total_entries);
-$stop_time = round(microtime(), 3);
-
if (($count_search_items > 0) and ($count_total_items > 0)) {
-$generation_time = $stop_time - $start_time;
-
echo "<p>Found <b>$search</b> in $count_search_items out of $count_total_items ";
if ($count_total_items == 1) {
@@ -179,7 +247,7 @@ $generation_time = $stop_time - $start_time;
}
}
- echo " ($generation_time seconds).</p>";
+ echo " ($generation_time_item seconds).</p>";
$increment_search_entries = 0;
@@ -255,7 +323,19 @@ else {
if ($count_total_items > 1) {
echo "entries";
}
- echo ".<br>Click <a href=http://google.com/search?q=$google target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
+
+ if ($count_total_comments > 0) {
+ echo " and $count_total_comments ";
+
+ if ($count_total_comments == 1) {
+ echo "comment";
+ }
+
+ if ($count_total_comments > 1) {
+ echo "comments";
+ }
+ }
+ echo " ($generation_time_item seconds).<br><br>Click <a href=http://google.com/search?q=$google target=_maj>here</a> to search for <b>$search</b> with Google.<br>Click <a href=index.php>here</a> to go to the index page.</p>";
}
?>