Exemplo n.º 1
0
 function Page_Main()
 {
     global $ReportLanguage;
     $GLOBALS["Page"] =& $this;
     $post = ewr_StripSlashes($_POST);
     if (count($post) == 0) {
         die("Missing post data.");
     }
     //$sql = $qs->getValue("s");
     $sql = @$post["s"];
     $sql = ewr_Decrypt($sql);
     if ($sql == "") {
         die("Missing SQL.");
     }
     // Field delimiter
     $dlm = @$post["dlm"];
     $dlm = ewr_Decrypt($dlm);
     // Language object
     $ReportLanguage = new crLanguage();
     if (strpos($sql, "{filter}") > 0) {
         $filters = "";
         for ($i = 0; $i < 5; $i++) {
             // Get the filter values (for "IN")
             $filter = ewr_Decrypt(@$post["f" . $i]);
             if ($filter != "") {
                 $value = @$post["v" . $i];
                 if ($value == "") {
                     if ($i > 0) {
                         // Empty parent field
                         //continue; // Allow
                         ewr_AddFilter($filters, "1=0");
                     }
                     // Disallow
                     continue;
                 }
                 $arValue = explode(",", $value);
                 $fldtype = intval(@$post["t" . $i]);
                 $wrkfilter = "";
                 for ($j = 0, $cnt = count($arValue); $j < $cnt; $j++) {
                     if ($wrkfilter != "") {
                         $wrkfilter .= " OR ";
                     }
                     $val = $arValue[$j];
                     if ($val == EWR_NULL_VALUE) {
                         $wrkfilter .= str_replace(" = {filter_value}", " IS NULL", $filter);
                     } elseif ($val == EWR_NOT_NULL_VALUE) {
                         $wrkfilter .= str_replace(" = {filter_value}", " IS NOT NULL", $filter);
                     } elseif ($val == EWR_EMPTY_VALUE) {
                         $wrkfilter .= str_replace(" = {filter_value}", " = ''", $filter);
                     } else {
                         $wrkfilter .= str_replace("{filter_value}", ewr_QuotedValue($val, ewr_FieldDataType($fldtype)), $filter);
                     }
                 }
                 ewr_AddFilter($filters, $wrkfilter);
             }
         }
         $sql = str_replace("{filter}", $filters != "" ? $filters : "1=1", $sql);
     }
     // Get the query value (for "LIKE" or "=")
     $value = ewr_AdjustSql(@$_GET["q"]);
     // Get the query value from querystring
     if ($value == "") {
         $value = ewr_AdjustSql(@$post["q"]);
     }
     // Get the value from post
     if ($value != "") {
         $sql = preg_replace('/LIKE \'(%)?\\{query_value\\}%\'/', ewr_Like('\'$1{query_value}%\''), $sql);
         $sql = str_replace("{query_value}", $value, $sql);
     }
     // Replace {query_value_n}
     preg_match_all('/\\{query_value_(\\d+)\\}/', $sql, $out);
     $cnt = count($out[0]);
     for ($i = 0; $i < $cnt; $i++) {
         $j = $out[1][$i];
         $v = ewr_AdjustSql(@$post["q" . $j]);
         $sql = str_replace("{query_value_" . $j . "}", $v, $sql);
     }
     $ds = @$post["ds"];
     // Date search type
     $df = @$post["df"];
     // Date format
     $this->GetLookupValues($sql, $ds, $df, $dlm);
 }
Exemplo n.º 2
0
 function AutoLogin()
 {
     if (@$_COOKIE[EWR_PROJECT_VAR]['AutoLogin'] == "autologin") {
         $usr = ewr_Decrypt(@$_COOKIE[EWR_PROJECT_VAR]['Username'], EWR_RANDOM_KEY);
         $pwd = ewr_Decrypt(@$_COOKIE[EWR_PROJECT_VAR]['Password'], EWR_RANDOM_KEY);
         $AutoLogin = $this->ValidateUser($usr, $pwd, TRUE);
     } else {
         $AutoLogin = FALSE;
     }
     return $AutoLogin;
 }