Ejemplo n.º 1
0
function BasicSearchWhere()
{
    global $Security, $archives;
    $sSearchStr = "";
    $sSearchKeyword = ew_StripSlashes(@$_GET[EW_TABLE_BASIC_SEARCH]);
    $sSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
    $sSearchStartTime = @$_GET[EW_TABLE_BASIC_SEARCH_START_TIME];
    $sSearchEndTime = @$_GET[EW_TABLE_BASIC_SEARCH_END_TIME];
    $sSearchProjectName = @$_GET[EW_TABLE_BASIC_SEARCH_PROJECTNAME];
    if ($sSearchKeyword != "") {
        $sSearch = trim($sSearchKeyword);
        if ($sSearchType != "") {
            while (strpos($sSearch, "  ") !== FALSE) {
                $sSearch = str_replace("  ", " ", $sSearch);
            }
            $arKeyword = explode(" ", trim($sSearch));
            foreach ($arKeyword as $sKeyword) {
                if ($sSearchStr != "") {
                    $sSearchStr .= " " . $sSearchType . " ";
                }
                $sSearchStr .= "(" . BasicSearchSQL($sKeyword) . ")";
            }
        } else {
            $sSearchStr = BasicSearchSQL($sSearch);
        }
        $sSearchStrTime = parseTime($sSearchStartTime, $sSearchEndTime);
        if ($sSearchStrTime != "") {
            if ($sSearchStr != "") {
                $sSearchStr = '(' . $sSearchStr . ') AND ';
            }
            $sSearchStr .= $sSearchStrTime;
        }
        $archives->setBasicSearchKeyword($sSearchKeyword);
        $archives->setBasicSearchType($sSearchType);
        $archives->setBasicSearchStartTime($sSearchStartTime);
        $archives->setBasicSearchEndTime($sSearchEndTime);
    }
    $sSearchStrProjectName = parseProjectName($sSearchProjectName);
    if ($sSearchStrProjectName != "") {
        if ($sSearchStr != "") {
            $sSearchStr = '(' . $sSearchStr . ') AND ';
        }
        $sSearchStr .= $sSearchStrProjectName;
    }
    $archives->setBasicSearchProjectName($sSearchProjectName);
    return $sSearchStr;
}
Ejemplo n.º 2
0
function BasicSearchWhere()
{
    global $Security, $user;
    $sSearchStr = "";
    $sSearchKeyword = ew_StripSlashes(@$_GET[EW_TABLE_BASIC_SEARCH]);
    $sSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
    if ($sSearchKeyword != "") {
        $sSearch = trim($sSearchKeyword);
        if ($sSearchType != "") {
            while (strpos($sSearch, "  ") !== FALSE) {
                $sSearch = str_replace("  ", " ", $sSearch);
            }
            $arKeyword = explode(" ", trim($sSearch));
            foreach ($arKeyword as $sKeyword) {
                if ($sSearchStr != "") {
                    $sSearchStr .= " " . $sSearchType . " ";
                }
                $sSearchStr .= "(" . BasicSearchSQL($sKeyword) . ")";
            }
        } else {
            $sSearchStr = BasicSearchSQL($sSearch);
        }
    }
    if ($sSearchKeyword != "") {
        $user->setBasicSearchKeyword($sSearchKeyword);
        $user->setBasicSearchType($sSearchType);
    }
    return $sSearchStr;
}