Profile
MAJ is an Open Source, PHP-based content management system (CMS) that can be deployed as a blog, bulletin or message board, Internet forum, and wiki. It is extensible via PHP panels and is HTML5 and CSS3 ready.
Git
This commit has been accessed 851 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>";
 }
 
 ?>
 
Credits
Sunday, Sep 18, 2005, 12:00 AM (Revision 11 - Thursday, Jul 14, 2011, 7:30 PM)
Open Source enables software developers to stand on the shoulders of giants instead of reinventing the wheel, so to speak. Kudos and many thanks to the folks who made their work freely available for reuse in MAJ.

read more
Bugs and Exploits
Friday, Aug 26, 2005, 12:00 AM (Revision 23 - Wednesday, May 29, 2013, 5:25 AM)
Although MAJ started as a family project, care has been taken to make it as "safe" as possible. With more people now working on MAJ, bugs and exploitable code may sometimes slip in. We invite you to poke around and see if you can find any. Generally, there are two things you can do when you find a MAJ or PHP-related bug or exploit:

1. Take advantage of it. But hey, what's so exciting about messing up someone's blog? Ho-hum, right?
2. Report it here so that we can work on a fix and make MAJ better.

read more
Search
Download
MAJ 2.0
75 files
33164 downloads
MAJ 1.0
26 files
13196 downloads
MAJ 0.14
45 files
35116 downloads