示例#1
0
function SEARCH($properties, $searchQuery, $HTDN)
{
    global $THEME_NAME;
    global $HTDN;
    include 'conf/connect.php';
    @($launchpad = $_GET['launchpad']);
    @($total_results = 0);
    @($not_allowed = 0);
    @($o_not_allowed = 0);
    @($not_allowed_list = "");
    @($o_not_allowed_list = "");
    //set up a div to put all the stuff in
    echo "<div style=\"padding:10px;\">";
    //get the launchpadID
    $launchpadID = GET_LP_ID($properties, $launchpad);
    //get the general filter list
    $GET_FILTER_GEN = mysql_query("SELECT * FROM {$properties->DB_PREFIX}filter_list WHERE type='general'");
    if (mysql_num_rows($GET_FILTER_GEN) < 1) {
        echo "No filters";
    } else {
        while ($FETCH_FILTER_GEN = mysql_fetch_array($GET_FILTER_GEN)) {
            if ($FETCH_FILTER_GEN['status'] == "not allowed") {
                $not_allowed_list .= $FETCH_FILTER_GEN['word'] . ",";
            } else {
                if ($FETCH_FILTER_GEN['status'] == "allowed") {
                    /* ALLOWED */
                }
            }
        }
    }
    //get the obscene filter list
    $GET_FILTER_O = mysql_query("SELECT * FROM {$properties->DB_PREFIX}filter_list WHERE type='obscene'");
    if (mysql_num_rows($GET_FILTER_O) < 1) {
        echo "No filters";
    } else {
        while ($FETCH_FILTER_O = mysql_fetch_array($GET_FILTER_O)) {
            if ($FETCH_FILTER_O['status'] == "not allowed") {
                $o_not_allowed_list .= $FETCH_FILTER_O['word'] . ",";
            } else {
                if ($FETCH_FILTER_O['status'] == "allowed") {
                    /* ALLOWED */
                }
            }
        }
    }
    $not_allowed_list = explode(",", $not_allowed_list);
    $o_not_allowed_list = explode(",", $o_not_allowed_list);
    for ($i = 0; $i < count($not_allowed_list); $i++) {
        if ($searchQuery == $not_allowed_list[$i]) {
            $not_allowed = 1;
        }
        if (strtolower($searchQuery) == $not_allowed_list[$i]) {
            $not_allowed = 1;
        }
    }
    for ($i = 0; $i < count($o_not_allowed_list); $i++) {
        if ($searchQuery == $o_not_allowed_list[$i]) {
            $o_not_allowed = 1;
        }
        if (strtolower($searchQuery) == $o_not_allowed_list[$i]) {
            $o_not_allowed = 1;
        }
    }
    if ($not_allowed == 1) {
        echo "<h1>Hey! You're not allow to search for &quot;{$searchQuery}&quot;!</h1>";
        echo "<p><u>Why am I seeing this?</u><br />Because our system is built to store pages (HTML/PHP) in a database and load them in dynamically. These pages have regular HTML (and some PHP) markup on them. This is a much more secure way to store info and it is a heck of a lot easier way to manipulate this website.<br /><br />However, this method comes at a cost and that cost is the search-ability of words, symbols, or phrases, like &quot;{$searchQuery}&quot;. The reason we do this is because this is one more way to prevent hacking on this website. What could I do if I search something that pulled up a page with markup language on it? You could be able to know where pages are (structures), find the ends and outs of this site, and may even be able to hack us. :(<br /><br />If you believe this is a mistake, or you don't like the way we do things on this site, you could turn around and leave this site (which we highly recommend not doing...:)) or contact us ";
        ?>
<a href="<?php 
        if ($_SERVER['HTTP_HOST'] == $properties->HTTP_HOST) {
            echo $properties->WEBSITE_TEST_URL . $properties->PADMAIN;
        } else {
            echo $properties->WEBSITE_REMO_URL . $properties->PADMAIN;
        }
        ?>
contact"<?php 
        echo "class=\"black-url\">here</a>.</p>";
    } else {
        if ($o_not_allowed == 1) {
            echo "<h1>Hey! You're not allow to search for &quot;{$searchQuery}&quot;!</h1>";
            echo "<p><u>Why am I seeing this?</u><br />Because the word or phrase &quot;{$searchQuery}&quot; you search for is not a nice word and it directly violates our Terms of Service.<br /><br />If you believe this is a mistake, or you don't like the way we do things on this site, you could turn around and leave this site (which we highly recommend not doing...:)) or contact us ";
            ?>
<a href="<?php 
            if ($_SERVER['HTTP_HOST'] == $properties->HTTP_HOST) {
                echo $properties->WEBSITE_TEST_URL . $properties->PADMAIN;
            } else {
                echo $properties->WEBSITE_REMO_URL . $properties->PADMAIN;
            }
            ?>
contact" <?php 
            echo "class=\"black-url\">here</a>.</p>";
        } else {
            /* DYNAMICALLY LOAD IN THE SEARCH CHAPTERS */
            //check for launchpad
            if ($launchpad != $properties->PADMAIN) {
                //its a launchpad that is not the main
                $GET_SEARCH_CHAPTERS = mysql_query("SELECT * FROM {$properties->DB_PREFIX}search_chapters WHERE is_searchable='yes' AND launchpad_id='{$launchpadID}' ORDER BY name");
            } else {
                $GET_SEARCH_CHAPTERS = mysql_query("SELECT * FROM {$properties->DB_PREFIX}search_chapters WHERE is_searchable='yes' ORDER BY name");
            }
            if (mysql_num_rows($GET_SEARCH_CHAPTERS) < 1) {
                echo "<h2>No Search Chapters Found...</h2>";
            } else {
                while ($FETCH_SEARCH_CHAPTERS = mysql_fetch_array($GET_SEARCH_CHAPTERS)) {
                    $id = $FETCH_SEARCH_CHAPTERS['id'];
                    $chapter_id = $FETCH_SEARCH_CHAPTERS['chapter_id'];
                    $name = $FETCH_SEARCH_CHAPTERS['name'];
                    $item_id = $FETCH_SEARCH_CHAPTERS['item_id'];
                    $search_this = $FETCH_SEARCH_CHAPTERS['search_this'];
                    $item_single = $FETCH_SEARCH_CHAPTERS['item_single'];
                    $item_single_list = explode(",", $item_single);
                    $item_plural = $FETCH_SEARCH_CHAPTERS['item_plural'];
                    $item_plural_list = explode(",", $item_plural);
                    $connector_single = $FETCH_SEARCH_CHAPTERS['connector_single'];
                    $connector_single_list = explode(",", $connector_single);
                    $connector_plural = $FETCH_SEARCH_CHAPTERS['connector_plural'];
                    $connector_plural_list = explode(",", $connector_plural);
                    $ending_single = $FETCH_SEARCH_CHAPTERS['ending_single'];
                    $ending_single_list = explode(",", $ending_single);
                    $ending_plural = $FETCH_SEARCH_CHAPTERS['ending_plural'];
                    $ending_plural_list = explode(",", $ending_plural);
                    $where_clause = $FETCH_SEARCH_CHAPTERS['where_clause'];
                    $order_by = $FETCH_SEARCH_CHAPTERS['order_by'];
                    echo "<h1 style=\"font-size: 36px;font-weight:bold;\"><u>" . $name . "</u></h1>";
                    $item_id_list = explode(",", $item_id);
                    $chapter_id_list = explode(",", $chapter_id);
                    $search_this_list = explode(",", $search_this);
                    $where_clause_list = explode(",", $where_clause);
                    $order_by_list = explode(",", $order_by);
                    for ($i = 0; $i < count($search_this_list) - 1; $i++) {
                        /* SEARCH IN ... */
                        @($NUM_ = "");
                        $NUM_ = $id;
                        @($item = "");
                        @($connector = "");
                        @($ending = "");
                        @($search_this_ind = $search_this_list[$i]);
                        @($where_clause_ind = $where_clause_list[$i]);
                        @($order_by_ind = $order_by_list[$i]);
                        $where_clause_ind = str_replace("(searchQuery)", "'%{$searchQuery}%'", $where_clause_ind);
                        @($query = "SELECT * FROM {$properties->DB_PREFIX}" . $search_this_ind . " WHERE " . $where_clause_ind . " AND is_searchable='yes'");
                        $COUNT = mysql_query($query);
                        if (@mysql_num_rows($COUNT) < 1) {
                            $item = $item_plural_list[$i];
                            $connector = $connector_plural_list[$i];
                            $ending = $ending_plural_list[$i];
                        } else {
                            if (@mysql_num_rows($COUNT) > 0 && @mysql_num_rows($COUNT) < 2) {
                                $item = $item_single_list[$i];
                                $connector = $connector_single_list[$i];
                                $ending = $ending_single_list[$i];
                            } else {
                                $item = $item_plural_list[$i];
                                $connector = $connector_plural_list[$i];
                                $ending = $ending_plural_list[$i];
                            }
                        }
                        /* CUSTOM QUERIES GO IN HERE */
                        @($THEBLOG_BLOGCATEGORIES_GET_CAT = mysql_query("SELECT * FROM {$properties->DB_PREFIX}blog_categories WHERE name LIKE '%{$searchQuery}%'"));
                        @($THEBLOG_BLOGCATEGORIES_FETCH_CAT = mysql_fetch_array($THEBLOG_BLOGCATEGORIES_GET_CAT));
                        @($theblog_blogcategories_id_of_cat = $THEBLOG_BLOGCATEGORIES_FETCH_CAT['id']);
                        $where_clause_ind = str_replace("(id_of_cat)", $theblog_blogcategories_id_of_cat, $where_clause_ind);
                        /* CUSTOM QUERIES GO IN HERE */
                        $query = "SELECT * FROM {$properties->DB_PREFIX}" . $search_this_ind . " WHERE " . $where_clause_ind . " ORDER BY " . $order_by_ind . "";
                        $GET_ITEM = mysql_query($query);
                        $total_results += mysql_num_rows($GET_ITEM);
                        if (mysql_num_rows($GET_ITEM) < 1) {
                            /* NO ITEMS FOUND */
                            echo "<h2>" . mysql_num_rows($GET_ITEM) . " {$item} {$connector} &quot;{$searchQuery}&quot;{$ending}</h2>";
                        } else {
                            echo "<h2><a id=\"search_container_link_" . $NUM_ . "_" . str_replace(" ", "_", $item_id_list[$i]) . "\" class=\"black-url-no-underline\" style=\"cursor:pointer;\" onclick=\"searchToggle('Expand'," . $NUM_ . ",'" . str_replace(" ", "_", $item_id_list[$i]) . "')\">[+]</a> " . mysql_num_rows($GET_ITEM) . " {$item} {$connector} &quot;{$searchQuery}&quot;{$ending}</h2>";
                            echo "<div id=\"search_container_contents_" . $NUM_ . "_" . str_replace(" ", "_", $item_id_list[$i]) . "\" style=\"display:none;\">";
                            while ($FETCH_ITEM = mysql_fetch_array($GET_ITEM)) {
                                /* CHECK TO SEE IF THE ITEM IS SEARCHABLE */
                                if ($FETCH_ITEM['is_searchable'] == "no") {
                                    /* NOT SEARCHABLE */
                                    if (mysql_num_rows($GET_ITEM) < 1) {
                                        $privacy_connector = "this";
                                        $privacy_results = "results";
                                        $privacy_ending = "has";
                                    } else {
                                        if (mysql_num_rows($GET_ITEM) > 0 && mysql_num_rows($GET_ITEM) < 2) {
                                            $privacy_connector = "this";
                                            $privacy_results = "result";
                                            $privacy_ending = "has";
                                        } else {
                                            if (mysql_num_rows($GET_ITEM) > 1) {
                                                $privacy_connector = "this";
                                                $privacy_results = "results";
                                                $privacy_ending = "has";
                                            }
                                        }
                                    }
                                    echo "<h2>Your search matched " . mysql_num_rows($GET_ITEM) . " {$privacy_results}, however {$privacy_connector} " . $item_single_list[$i] . " {$privacy_ending} choosen to hide their profile information from our search. :(</h2>";
                                } else {
                                    /* FOUND ITEMS; DISPLAY THEM */
                                    $query = "SELECT * FROM {$properties->DB_PREFIX}search_chapters_items WHERE item_id='{$item_id_list[$i]}' AND chapter_id='{$chapter_id_list[$i]}'";
                                    $GET_ITEM_CONTENTS = mysql_query($query);
                                    if (mysql_num_rows($GET_ITEM_CONTENTS) < 1) {
                                        echo $query;
                                        echo "Sorry! Something is missing!<br />";
                                    } else {
                                        $FETCH_ITEM_CONTENTS = mysql_fetch_array($GET_ITEM_CONTENTS);
                                        echo eval($FETCH_ITEM_CONTENTS['content']);
                                    }
                                    /* END FOUND ITEMS; DISPLAY THEM */
                                }
                            }
                            echo "</div>";
                        }
                    }
                    echo "<br />";
                }
            }
            echo "<br />";
            /* END DYNAMICALLY LOAD IN THE SEARCH CHAPTERS */
            @($total_ending = "");
            if ($total_results < 1) {
                $total_ending = "s";
            }
            if ($total_results > 0 && $total_ending < 2) {
                $total_ending = "";
            }
            if ($total_results > 1) {
                $total_ending = "s";
            }
            echo "<h1 class=\"searching-text-h1\">Searching &quot;{$searchQuery}&quot; gave {$total_results} result{$total_ending}</h1>";
        }
    }
    //close up the div to put all the stuff in
    echo "</div>";
}
示例#2
0
文件: mode.php 项目: nat4ancorp/JELLY
<?php 
            include "includes/private/art/lower_left.php";
            include "includes/private/art/lower_right.php";
            if ($properties->TURN_ON_BOTTOM_NAV == "yes" && $launchpad == $properties->PAD3) {
                ?>
<div id="bottomnavigation">
<div class="wrap-bottom">
<div id="bottomnav">
<div class="left">
<ul>
<?php 
                /* PHP BOTTOM NAVIGATIN LIST MAKER FROM CLASS */
                $wurl = $WEBSITE_URL;
                //determine launchpad constants
                $launchpadNAME = $launchpad;
                $launchpadID = GET_LP_ID($properties, $launchpad);
                echo bottomnavigation($wurl, $launchpadNAME, $launchpadID, $page, $properties, $subpage);
                ?>
</ul>
</div>
<!-- end of #left --> 
</div>
<!-- end of #bottomnav --> 
</div>
<!-- end of .wrap --> 
</div>
<!-- end of #bottomnavigation -->
<?php 
            } else {
                if ($properties->TURN_ON_BOTTOM_NAV == "no") {
                    /* LEAVE BOTTOM NAV OFF */