コード例 #1
0
ファイル: cciag_montossrch.php プロジェクト: scintes/sistemas
 function BuildSearchUrl(&$Url, &$Fld, $OprOnly = FALSE)
 {
     global $objForm;
     $sWrk = "";
     $FldParm = substr($Fld->FldVar, 2);
     $FldVal = $objForm->GetValue("x_{$FldParm}");
     $FldOpr = $objForm->GetValue("z_{$FldParm}");
     $FldCond = $objForm->GetValue("v_{$FldParm}");
     $FldVal2 = $objForm->GetValue("y_{$FldParm}");
     $FldOpr2 = $objForm->GetValue("w_{$FldParm}");
     $FldVal = ew_StripSlashes($FldVal);
     if (is_array($FldVal)) {
         $FldVal = implode(",", $FldVal);
     }
     $FldVal2 = ew_StripSlashes($FldVal2);
     if (is_array($FldVal2)) {
         $FldVal2 = implode(",", $FldVal2);
     }
     $FldOpr = strtoupper(trim($FldOpr));
     $lFldDataType = $Fld->FldIsVirtual ? EW_DATATYPE_STRING : $Fld->FldDataType;
     if ($FldOpr == "BETWEEN") {
         $IsValidValue = $lFldDataType != EW_DATATYPE_NUMBER || $lFldDataType == EW_DATATYPE_NUMBER && $this->SearchValueIsNumeric($Fld, $FldVal) && $this->SearchValueIsNumeric($Fld, $FldVal2);
         if ($FldVal != "" && $FldVal2 != "" && $IsValidValue) {
             $sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) . "&y_" . $FldParm . "=" . urlencode($FldVal2) . "&z_" . $FldParm . "=" . urlencode($FldOpr);
         }
     } else {
         $IsValidValue = $lFldDataType != EW_DATATYPE_NUMBER || $lFldDataType == EW_DATATYPE_NUMBER && $this->SearchValueIsNumeric($Fld, $FldVal);
         if ($FldVal != "" && $IsValidValue && ew_IsValidOpr($FldOpr, $lFldDataType)) {
             $sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) . "&z_" . $FldParm . "=" . urlencode($FldOpr);
         } elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL" || $FldOpr != "" && $OprOnly && ew_IsValidOpr($FldOpr, $lFldDataType)) {
             $sWrk = "z_" . $FldParm . "=" . urlencode($FldOpr);
         }
         $IsValidValue = $lFldDataType != EW_DATATYPE_NUMBER || $lFldDataType == EW_DATATYPE_NUMBER && $this->SearchValueIsNumeric($Fld, $FldVal2);
         if ($FldVal2 != "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $lFldDataType)) {
             if ($sWrk != "") {
                 $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
             }
             $sWrk .= "y_" . $FldParm . "=" . urlencode($FldVal2) . "&w_" . $FldParm . "=" . urlencode($FldOpr2);
         } elseif ($FldOpr2 == "IS NULL" || $FldOpr2 == "IS NOT NULL" || $FldOpr2 != "" && $OprOnly && ew_IsValidOpr($FldOpr2, $lFldDataType)) {
             if ($sWrk != "") {
                 $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
             }
             $sWrk .= "w_" . $FldParm . "=" . urlencode($FldOpr2);
         }
     }
     if ($sWrk != "") {
         if ($Url != "") {
             $Url .= "&";
         }
         $Url .= $sWrk;
     }
 }
コード例 #2
0
ファイル: phpfn8.php プロジェクト: Razinsky/echaude-com
function ew_GetSearchSql(&$Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2)
{
    $sSql = "";
    $sFldExpression = $Fld->FldIsVirtual && !$Fld->FldForceSelection ? $Fld->FldVirtualExpression : $Fld->FldExpression;
    $FldDataType = $Fld->FldDataType;
    if ($Fld->FldIsVirtual && !$Fld->FldForceSelection) {
        $FldDataType = EW_DATATYPE_STRING;
    }
    if ($FldOpr == "BETWEEN") {
        $IsValidValue = $FldDataType != EW_DATATYPE_NUMBER || $FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2);
        if ($FldVal != "" && $FldVal2 != "" && $IsValidValue) {
            $sSql = $sFldExpression . " BETWEEN " . ew_QuotedValue($FldVal, $FldDataType) . " AND " . ew_QuotedValue($FldVal2, $FldDataType);
        }
    } elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
        $sSql = $sFldExpression . " " . $FldOpr;
    } else {
        $IsValidValue = $FldDataType != EW_DATATYPE_NUMBER || $FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal);
        if ($FldVal != "" && $IsValidValue && ew_IsValidOpr($FldOpr, $FldDataType)) {
            $sSql = $sFldExpression . ew_SearchString($FldOpr, $FldVal, $FldDataType);
        }
        $IsValidValue = $FldDataType != EW_DATATYPE_NUMBER || $FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal2);
        if ($FldVal2 != "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $FldDataType)) {
            $sSql2 = $sFldExpression . ew_SearchString($FldOpr2, $FldVal2, $FldDataType);
            if ($sSql != "") {
                $sSql = "(" . $sSql . " " . ($FldCond == "OR" ? "OR" : "AND") . " " . $sSql2 . ")";
            } else {
                $sSql = $sSql2;
            }
        }
    }
    return $sSql;
}
コード例 #3
0
ファイル: phpfn12.php プロジェクト: NaurozAhmad/Senho
function ew_GetSearchSql(&$Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2, $dbid)
{
    $sSql = "";
    $virtual = $Fld->FldIsVirtual && $Fld->FldVirtualSearch;
    $sFldExpression = $virtual ? $Fld->FldVirtualExpression : $Fld->FldExpression;
    $FldDataType = $Fld->FldDataType;
    if (ew_IsFloatFormat($Fld->FldType)) {
        $FldVal = ew_StrToFloat($FldVal);
        $FldVal2 = ew_StrToFloat($FldVal2);
    }
    if ($virtual) {
        $FldDataType = EW_DATATYPE_STRING;
    }
    if ($FldDataType == EW_DATATYPE_NUMBER) {
        // Fix wrong operator
        if ($FldOpr == "LIKE" || $FldOpr == "STARTS WITH" || $FldOpr == "ENDS WITH") {
            $FldOpr = "=";
        } elseif ($FldOpr == "NOT LIKE") {
            $FldOpr = "<>";
        }
        if ($FldOpr2 == "LIKE" || $FldOpr2 == "STARTS WITH" || $FldOpr2 == "ENDS WITH") {
            $FldOpr2 = "=";
        } elseif ($FldOpr2 == "NOT LIKE") {
            $FldOpr2 = "<>";
        }
    }
    if ($FldOpr == "BETWEEN") {
        $IsValidValue = $FldDataType != EW_DATATYPE_NUMBER || $FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2);
        if ($FldVal != "" && $FldVal2 != "" && $IsValidValue) {
            $sSql = $sFldExpression . " BETWEEN " . ew_QuotedValue($FldVal, $FldDataType, $dbid) . " AND " . ew_QuotedValue($FldVal2, $FldDataType, $dbid);
        }
    } else {
        // Handle first value
        if ($FldVal == EW_NULL_VALUE || $FldOpr == "IS NULL") {
            $sSql = $Fld->FldExpression . " IS NULL";
        } elseif ($FldVal == EW_NOT_NULL_VALUE || $FldOpr == "IS NOT NULL") {
            $sSql = $Fld->FldExpression . " IS NOT NULL";
        } else {
            $IsValidValue = $FldDataType != EW_DATATYPE_NUMBER || $FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal);
            if ($FldVal != "" && $IsValidValue && ew_IsValidOpr($FldOpr, $FldDataType)) {
                $sSql = $sFldExpression . ew_SearchString($FldOpr, $FldVal, $FldDataType, $dbid);
                if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN && $FldVal == $Fld->FalseValue && $FldOpr == "=") {
                    $sSql = "(" . $sSql . " OR " . $sFldExpression . " IS NULL)";
                }
            }
        }
        // Handle second value
        $sSql2 = "";
        if ($FldVal2 == EW_NULL_VALUE || $FldOpr2 == "IS NULL") {
            $sSql2 = $Fld->FldExpression . " IS NULL";
        } elseif ($FldVal2 == EW_NOT_NULL_VALUE || $FldOpr2 == "IS NOT NULL") {
            $sSql2 = $Fld->FldExpression . " IS NOT NULL";
        } else {
            $IsValidValue = $FldDataType != EW_DATATYPE_NUMBER || $FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal2);
            if ($FldVal2 != "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $FldDataType)) {
                $sSql2 = $sFldExpression . ew_SearchString($FldOpr2, $FldVal2, $FldDataType, $dbid);
                if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN && $FldVal2 == $Fld->FalseValue && $FldOpr2 == "=") {
                    $sSql2 = "(" . $sSql2 . " OR " . $sFldExpression . " IS NULL)";
                }
            }
        }
        // Combine SQL
        if ($sSql2 != "") {
            if ($sSql != "") {
                $sSql = "(" . $sSql . " " . ($FldCond == "OR" ? "OR" : "AND") . " " . $sSql2 . ")";
            } else {
                $sSql = $sSql2;
            }
        }
    }
    return $sSql;
}
コード例 #4
0
ファイル: logssrch.php プロジェクト: BGCX261/zhss-svn-to-git
function BuildSearchUrl(&$Url, &$Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2)
{
    $sWrk = "";
    $FldParm = substr($Fld->FldVar, 2);
    $FldVal = ew_StripSlashes($FldVal);
    if (is_array($FldVal)) {
        $FldVal = implode(",", $FldVal);
    }
    $FldVal2 = ew_StripSlashes($FldVal2);
    if (is_array($FldVal2)) {
        $FldVal2 = implode(",", $FldVal2);
    }
    $FldOpr = strtoupper(trim($FldOpr));
    if ($FldOpr == "BETWEEN") {
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || $Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2);
        if ($FldVal != "" && $FldVal2 != "" && $IsValidValue) {
            $sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) . "&y_" . $FldParm . "=" . urlencode($FldVal2) . "&z_" . $FldParm . "=" . urlencode($FldOpr);
        }
    } elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
        $sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) . "&z_" . $FldParm . "=" . urlencode($FldOpr);
    } else {
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || ($Fld->FldDataType = EW_DATATYPE_NUMBER && is_numeric($FldVal));
        if ($FldVal != "" && $IsValidValue && ew_IsValidOpr($FldOpr, $Fld->FldDataType)) {
            $sWrk = "x_" . $FldParm . "=" . urlencode($FldVal) . "&z_" . $FldParm . "=" . urlencode($FldOpr);
        }
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || ($Fld->FldDataType = EW_DATATYPE_NUMBER && is_numeric($FldVal2));
        if ($FldVal2 != "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $Fld->FldDataType)) {
            if ($sWrk != "") {
                $sWrk .= "&v_" . $FldParm . "=" . urlencode($FldCond) . "&";
            }
            $sWrk .= "&y_" . $FldParm . "=" . urlencode($FldVal2) . "&w_" . $FldParm . "=" . urlencode($FldOpr2);
        }
    }
    if ($sWrk != "") {
        if ($Url != "") {
            $Url .= "&";
        }
        $Url .= $sWrk;
    }
}
コード例 #5
0
ファイル: phpfn6.php プロジェクト: airfox7412/ps01
function ew_GetSearchSql(&$Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2)
{
    $sSql = "";
    if ($FldOpr == "BETWEEN") {
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || $Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2);
        if ($FldVal != "" && $FldVal2 != "" && $IsValidValue) {
            $sSql = $Fld->FldExpression . " BETWEEN " . ew_QuotedValue($FldVal, $Fld->FldDataType) . " AND " . ew_QuotedValue($FldVal2, $Fld->FldDataType);
        }
    } elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
        $sSql = $Fld->FldExpression . " " . $FldOpr;
    } else {
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || $Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal);
        if ($FldVal != "" && $IsValidValue && ew_IsValidOpr($FldOpr, $Fld->FldDataType)) {
            $sSql = $Fld->FldExpression . ew_SearchString($FldOpr, $FldVal, $Fld->FldDataType);
        }
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || $Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal2);
        if ($FldVal2 != "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $Fld->FldDataType)) {
            if ($sSql != "") {
                $sSql .= " " . ($FldCond == "OR" ? "OR" : "AND") . " ";
            }
            $sSql = "(" . $sSql . $Fld->FldExpression . ew_SearchString($FldOpr2, $FldVal2, $Fld->FldDataType) . ")";
        }
    }
    return $sSql;
}
コード例 #6
0
ファイル: logslist.php プロジェクト: BGCX261/zhss-svn-to-git
function BuildSearchSql(&$Where, &$Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2)
{
    $sWrk = "";
    $FldParm = substr($Fld->FldVar, 2);
    $FldVal = ew_StripSlashes($FldVal);
    if (is_array($FldVal)) {
        $FldVal = implode(",", $FldVal);
    }
    $FldVal2 = ew_StripSlashes($FldVal2);
    if (is_array($FldVal2)) {
        $FldVal2 = implode(",", $FldVal2);
    }
    $FldOpr = strtoupper(trim($FldOpr));
    if ($FldOpr == "") {
        $FldOpr = "=";
    }
    $FldOpr2 = strtoupper(trim($FldOpr2));
    if ($FldOpr2 == "") {
        $FldOpr2 = "=";
    }
    if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN) {
        if ($FldVal != "") {
            $FldVal = $FldVal == "1" ? $Fld->TrueValue : $Fld->FalseValue;
        }
        if ($FldVal2 != "") {
            $FldVal2 = $FldVal2 == "1" ? $Fld->TrueValue : $Fld->FalseValue;
        }
    } elseif ($Fld->FldDataType == EW_DATATYPE_DATE) {
        if ($FldVal != "") {
            $FldVal = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
        }
        if ($FldVal2 != "") {
            $FldVal2 = ew_UnFormatDateTime($FldVal2, $Fld->FldDateTimeFormat);
        }
    }
    if ($FldOpr == "BETWEEN") {
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || $Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal) && is_numeric($FldVal2);
        if ($FldVal != "" && $FldVal2 != "" && $IsValidValue) {
            $sWrk = $Fld->FldExpression . " BETWEEN " . ew_QuotedValue($FldVal, $Fld->FldDataType) . " AND " . ew_QuotedValue($FldVal2, $Fld->FldDataType);
        }
    } elseif ($FldOpr == "IS NULL" || $FldOpr == "IS NOT NULL") {
        $sWrk = $Fld->FldExpression . " " . $FldOpr;
    } else {
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || $Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal);
        if ($FldVal != "" && $IsValidValue && ew_IsValidOpr($FldOpr, $Fld->FldDataType)) {
            $sWrk = $Fld->FldExpression . SearchString($FldOpr, $FldVal, $Fld->FldDataType);
        }
        $IsValidValue = $Fld->FldDataType != EW_DATATYPE_NUMBER || $Fld->FldDataType == EW_DATATYPE_NUMBER && is_numeric($FldVal2);
        if ($FldVal2 != "" && $IsValidValue && ew_IsValidOpr($FldOpr2, $Fld->FldDataType)) {
            if ($sWrk != "") {
                $sWrk .= " " . ($FldCond == "OR" ? "OR" : "AND") . " ";
            }
            $sWrk .= $Fld->FldExpression . SearchString($FldOpr2, $FldVal2, $Fld->FldDataType);
        }
    }
    if ($sWrk != "") {
        if ($Where != "") {
            $Where .= " AND ";
        }
        $Where .= "(" . $sWrk . ")";
    }
}