当前位置: 首页>>代码示例>>PHP>>正文


PHP IsFiltered函数代码示例

本文整理汇总了PHP中IsFiltered函数的典型用法代码示例。如果您正苦于以下问题:PHP IsFiltered函数的具体用法?PHP IsFiltered怎么用?PHP IsFiltered使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了IsFiltered函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetList

 function GetList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     $DB = CDatabase::GetModuleConnection('statistic');
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             switch ($key) {
                 case "LAST":
                     $arSqlSearch[] = $val == "Y" ? "S.DATE_STAT = curdate()" : "S.DATE_STAT<>curdate()";
                     break;
                 case "USER_AGENT":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("S.USER_AGENT", $val, $match);
                     break;
                 case "COUNTER1":
                     $arSqlSearch_h[] = "COUNTER>=" . intval($val);
                     break;
                 case "COUNTER2":
                     $arSqlSearch_h[] = "COUNTER<=" . intval($val);
                     break;
             }
         }
         for ($i = 0; $i < count($arSqlSearch_h); $i++) {
             $strSqlSearch_h .= " and (" . $arSqlSearch_h[$i] . ") ";
         }
     }
     if ($by == "s_user_agent") {
         $strSqlOrder = "ORDER BY S.USER_AGENT";
     } elseif ($by == "s_counter") {
         $strSqlOrder = "ORDER BY COUNTER";
     } else {
         $by = "s_counter";
         $strSqlOrder = "ORDER BY COUNTER";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "SET OPTION SQL_BIG_SELECTS=1";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tS.USER_AGENT,\n\t\t\t\tcount(S.ID) COUNTER\n\t\t\tFROM\n\t\t\t\tb_stat_session S\n\t\t\tLEFT JOIN b_stat_browser B ON (\n\t\t\t\tlength(B.USER_AGENT)>0\n\t\t\tand B.USER_AGENT is not null\n\t\t\tand\tupper(S.USER_AGENT) like upper(B.USER_AGENT)\n\t\t\t)\n\t\t\tLEFT JOIN b_stat_searcher R ON (\n\t\t\t\tlength(R.USER_AGENT)>0\n\t\t\tand\tR.USER_AGENT is not null\n\t\t\tand\tupper(S.USER_AGENT) like upper(concat('%',R.USER_AGENT,'%'))\n\t\t\t)\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\tand S.USER_AGENT is not null\n\t\t\tand S.USER_AGENT<>''\n\t\t\tand S.NEW_GUEST<>'N'\n\t\t\tand B.ID is null\n\t\t\tand R.ID is null\n\t\t\tGROUP BY S.USER_AGENT\n\t\t\tHAVING '1'='1' {$strSqlSearch_h}\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch) || strlen($strSqlSearch_h) > 0;
     return $res;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:59,代码来源:autodetect.php

示例2: GetList

 function GetList($arOrder = array('CSORT' => 'ASC'), $arFilter = array(), $arFields = array())
 {
     global $DB;
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         $filter_keys = array_keys($arFilter);
         for ($i = 0, $cnt = count($filter_keys); $i < $cnt; $i++) {
             $val = $arFilter[$filter_keys[$i]];
             $key = $filter_keys[$i];
             switch (strtoupper($filter_keys[$i])) {
                 case "ID":
                     $arSqlSearch[] = 'ID=' . intval($val);
                     break;
                 case "ACTIVE":
                     $arSqlSearch[] = GetFilterQuery("ACTIVE", $val);
                     break;
                 case "NAME":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("NAME", $val, $match);
                     break;
                 case "RATE":
                     $arSqlSearch[] = 'RATE=\'' . doubleval($val) . '\'';
                     //GetFilterQuery('RATE', $val);
                     break;
             }
         }
     }
     $sOrder = "";
     $sort_keys = array_keys($arOrder);
     for ($i = 0, $intCount = count($sort_keys); $i < $intCount; $i++) {
         $ord = strtoupper($arOrder[$sort_keys[$i]]) != "ASC" ? "DESC" : "ASC";
         switch (strtoupper($sort_keys[$i])) {
             case "ID":
                 $sOrder .= ", ID " . $ord;
                 break;
             case "C_SORT":
                 $sOrder .= ", C_SORT " . $ord;
                 break;
             case "ACTIVE":
                 $sOrder .= ", ACTIVE " . $ord;
                 break;
             case "NAME":
                 $sOrder .= ", NAME " . $ord;
                 break;
             case "RATE":
                 $sOrder .= ", RATE " . $ord;
                 break;
         }
     }
     if (strlen($sOrder) <= 0) {
         $sOrder = "C_SORT ASC";
     }
     $strSqlOrder = " ORDER BY " . TrimEx($sOrder, ",");
     $arDefaultFields = array('ID', 'TIMESTAMP_X', 'ACTIVE', 'C_SORT', 'NAME', 'RATE');
     if (!is_array($arFields) || count($arFields) <= 0) {
         $arQueryFields = $arDefaultFields;
     } else {
         $arQueryFields = array();
         foreach ($arFields as $fld) {
             if (in_array($fld, $arDefaultFields)) {
                 $arQueryFields[] = $fld;
             }
         }
         if (count($arQueryFields) <= 0) {
             $arQueryFields = $arDefaultFields;
         }
     }
     $strSqlFields = implode(', ', $arQueryFields);
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\nSELECT\n" . $strSqlFields . "\nFROM b_catalog_vat\nWHERE\n" . $strSqlSearch . "\n" . $strSqlOrder . "\n";
     //echo $strSql;
     $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
     $res->is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:76,代码来源:vat.php

示例3: GetDomainList

 function GetDomainList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     $DB = CDatabase::GetModuleConnection('statistic');
     $arSqlSearch = array("P.SEARCHER_ID <> 1");
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                 case "SEARCHER_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("P." . $key, $val, $match);
                     break;
                 case "DOMAIN":
                 case "VARIABLE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("P." . $key, $val, $match);
                     break;
             }
         }
     }
     $strSqlOrder = "";
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY P.ID";
     } elseif ($by == "s_domain") {
         $strSqlOrder = "ORDER BY P.DOMAIN";
     } elseif ($by == "s_variable") {
         $strSqlOrder = "ORDER BY P.VARIABLE";
     } else {
         $by = "s_id";
         $strSqlOrder = "ORDER BY P.ID";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tP.ID,\n\t\t\t\tP.DOMAIN,\n\t\t\t\tP.VARIABLE,\n\t\t\t\tP.CHAR_SET\n\t\t\tFROM\n\t\t\t\tb_stat_searcher_params P\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $rs = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $rs;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:54,代码来源:searcher.php

示例4: GetList


//.........这里部分代码省略.........
                     $arSqlSearch[] = "S.DATE_UPDATE<=" . $DB->CharToDateFunction($val . " 23:59:59");
                     break;
                 case "INSERT_1":
                     $arSqlSearch[] = "S.DATE_INSERT>=" . $DB->CharToDateFunction($val);
                     break;
                 case "INSERT_2":
                     $arSqlSearch[] = "S.DATE_INSERT<=" . $DB->CharToDateFunction($val . " 23:59:59");
                     break;
                 case "USER":
                     $arSqlSearch[] = GetFilterQuery("U.ID, U.LOGIN, U.NAME, U.LAST_NAME", $val);
                     break;
                 case "USER_ID":
                     $arSqlSearch[] = GetFilterQuery("S.USER_ID", $val, "N");
                     break;
                 case "ANONYMOUS":
                     $arSqlSearch[] = $val == "Y" ? "(S.USER_ID = 0 or S.USER_ID is null)" : "(S.USER_ID > 0 and S.USER_ID is not null)";
                     break;
                 case "CONFIRMED":
                     $arSqlSearch[] = $val == "Y" ? "S.CONFIRMED='Y'" : "S.CONFIRMED='N'";
                     break;
                 case "ACTIVE":
                     $arSqlSearch[] = $val == "Y" ? "S.ACTIVE='Y'" : "S.ACTIVE='N'";
                     break;
                 case "FORMAT":
                     $arSqlSearch[] = $val == "text" ? "S.FORMAT='text'" : "S.FORMAT='html'";
                     break;
                 case "RUBRIC":
                 case "RUBRIC_MULTI":
                 case "DISTRIBUTION":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     if (strlen($val) > 0) {
                         $from1 = " INNER JOIN b_subscription_rubric SR ON (SR.SUBSCRIPTION_ID=S.ID) ";
                         $arSqlSearch[] = GetFilterQuery("SR.LIST_RUBRIC_ID", $val, "N");
                     } else {
                         $arSqlSearch[] = " 1=0 ";
                     }
                     break;
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $arOrder = array();
     foreach ($aSort as $by => $ord) {
         $by = strtoupper($by);
         $ord = strtoupper($ord) != "ASC" ? "DESC" : "ASC";
         switch ($by) {
             case "ID":
                 $arOrder[$by] = "S.ID " . $ord;
                 break;
             case "DATE_INSERT":
                 $arOrder[$by] = "S.DATE_INSERT " . $ord;
                 break;
             case "DATE_UPDATE":
                 $arOrder[$by] = "S.DATE_UPDATE " . $ord;
                 break;
             case "DATE_CONFIRM":
                 $arOrder[$by] = "S.DATE_CONFIRM " . $ord;
                 break;
             case "ACT":
                 $arOrder[$by] = "S.ACTIVE " . $ord;
                 break;
             case "CONF":
                 $arOrder[$by] = "S.CONFIRMED " . $ord;
                 break;
             case "EMAIL":
                 $arOrder[$by] = "S.EMAIL " . $ord;
                 break;
             case "FMT":
                 $arOrder[$by] = "S.FORMAT " . $ord;
                 break;
             case "USER":
                 $arOrder[$by] = "S.USER_ID " . $ord;
                 break;
             case "CONFIRM_CODE":
                 $arOrder[$by] = "S.CONFIRM_CODE " . $ord;
                 break;
         }
     }
     if (count($arOrder) <= 0) {
         $arOrder["ID"] = "S.ID DESC";
     }
     if (is_array($arNavStartParams)) {
         $strSql = "\n\t\t\t\tSELECT count(" . ($from1 != "" ? "DISTINCT S.ID" : "'x'") . ") as C\n\t\t\t\tFROM\n\t\t\t\t\tb_subscription S\n\t\t\t\t\tLEFT JOIN b_user U ON (S.USER_ID=U.ID)\n\t\t\t\t\t{$from1}\n\t\t\t\tWHERE\n\t\t\t\t" . $strSqlSearch;
         $res_cnt = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $res_cnt = $res_cnt->Fetch();
         $cnt = $res_cnt["C"];
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tS.ID, S.USER_ID, S.ACTIVE, S.EMAIL, S.FORMAT, S.CONFIRM_CODE, S.CONFIRMED,\n\t\t\t\t\t" . $DB->DateToCharFunction("S.DATE_UPDATE") . " DATE_UPDATE,\n\t\t\t\t\t" . $DB->DateToCharFunction("S.DATE_INSERT") . " DATE_INSERT,\n\t\t\t\t\t" . $DB->DateToCharFunction("S.DATE_CONFIRM") . " DATE_CONFIRM,\n\t\t\t\t\tU.LOGIN USER_LOGIN,\n\t\t\t\t\tU.NAME USER_NAME,\n\t\t\t\t\tU.LAST_NAME USER_LAST_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_subscription S\n\t\t\t\t\tLEFT JOIN b_user U ON (S.USER_ID=U.ID)\n\t\t\t\t\t{$from1}\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\t" . ($from1 != "" ? "GROUP BY S.ID, S.USER_ID, S.ACTIVE, S.EMAIL, S.FORMAT, S.CONFIRM_CODE, S.CONFIRMED, S.DATE_CONFIRM, S.DATE_UPDATE, S.DATE_INSERT, U.LOGIN, U.NAME, U.LAST_NAME" : "") . "\n\t\t\t\tORDER BY " . implode(", ", $arOrder);
         $res = new CDBResult();
         $res->NavQuery($strSql, $cnt, $arNavStartParams);
         $res->is_filtered = IsFiltered($strSqlSearch);
         return $res;
     } else {
         $strSql = "\n\t\t\t\tSELECT\n\t\t\t\t\tS.ID, S.USER_ID, S.ACTIVE, S.EMAIL, S.FORMAT, S.CONFIRM_CODE, S.CONFIRMED,\n\t\t\t\t\t" . $DB->DateToCharFunction("S.DATE_UPDATE") . " DATE_UPDATE,\n\t\t\t\t\t" . $DB->DateToCharFunction("S.DATE_INSERT") . " DATE_INSERT,\n\t\t\t\t\t" . $DB->DateToCharFunction("S.DATE_CONFIRM") . " DATE_CONFIRM,\n\t\t\t\t\tU.LOGIN USER_LOGIN,\n\t\t\t\t\tU.NAME USER_NAME,\n\t\t\t\t\tU.LAST_NAME USER_LAST_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_subscription S\n\t\t\t\t\tLEFT JOIN b_user U ON (S.USER_ID=U.ID)\n\t\t\t\t\t{$from1}\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\t" . ($from1 != "" ? "GROUP BY S.ID, S.USER_ID, S.ACTIVE, S.EMAIL, S.FORMAT, S.CONFIRM_CODE, S.CONFIRMED, S.DATE_CONFIRM, S.DATE_UPDATE, S.DATE_INSERT, U.LOGIN, U.NAME, U.LAST_NAME" : "") . "\n\t\t\t\tORDER BY " . implode(", ", $arOrder);
         $res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         $res->is_filtered = IsFiltered($strSqlSearch);
         return $res;
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:subscription.php

示例5: GetList


//.........这里部分代码省略.........
                 case "URL_404":
                 case "NEW_GUEST":
                     $arSqlSearch[] = $val == "Y" ? "H." . $key . "='Y'" : "H." . $key . "='N'";
                     break;
                 case "REGISTERED":
                     $arSqlSearch[] = $val == "Y" ? "H.USER_ID>0" : "(H.USER_ID<=0 or H.USER_ID is null)";
                     break;
                 case "DATE_1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "H.DATE_HIT >= " . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE_2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "H.DATE_HIT < " . CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
                     }
                     break;
                 case "IP":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.IP", $val, $match, array("."));
                     break;
                 case "USER_AGENT":
                 case "COUNTRY_ID":
                 case "CITY_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H." . $key, $val, $match);
                     break;
                 case "COOKIE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.COOKIES", $val, $match);
                     break;
                 case "USER":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = $DB->IsNull("H.USER_ID", "0") . ">0";
                     $arSqlSearch[] = GetFilterQuery("H.USER_ID,A.LOGIN,A.LAST_NAME,A.NAME", $val, $match);
                     $select = ", A.LOGIN, " . $DB->Concat($DB->IsNull("A.NAME", "''"), "' '", $DB->IsNull("A.LAST_NAME", "''")) . " USER_NAME";
                     $from1 = "LEFT JOIN b_user A ON (A.ID = H.USER_ID)";
                     break;
                 case "COUNTRY":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("C.NAME", $val, $match);
                     $from2 = "INNER JOIN b_stat_country C ON (C.ID = H.COUNTRY_ID)";
                     break;
                 case "REGION":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("CITY.REGION", $val, $match);
                     break;
                 case "CITY":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("CITY.NAME", $val, $match);
                     break;
                 case "STOP":
                     $arSqlSearch[] = $val == "Y" ? "H.STOP_LIST_ID>0" : "(H.STOP_LIST_ID<=0 or H.STOP_LIST_ID is null)";
                     break;
                 case "SITE_ID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("H.SITE_ID", $val, $match);
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY H.ID";
     } elseif ($by == "s_site_id") {
         $strSqlOrder = "ORDER BY H.SITE_ID";
     } elseif ($by == "s_session_id") {
         $strSqlOrder = "ORDER BY H.SESSION_ID";
     } elseif ($by == "s_date_hit") {
         $strSqlOrder = "ORDER BY H.DATE_HIT";
     } elseif ($by == "s_user_id") {
         $strSqlOrder = "ORDER BY H.USER_ID";
     } elseif ($by == "s_guest_id") {
         $strSqlOrder = "ORDER BY H.GUEST_ID";
     } elseif ($by == "s_ip") {
         $strSqlOrder = "ORDER BY H.IP";
     } elseif ($by == "s_url") {
         $strSqlOrder = "ORDER BY H.URL ";
     } elseif ($by == "s_country_id") {
         $strSqlOrder = "ORDER BY H.COUNTRY_ID ";
     } elseif ($by == "s_region_name") {
         $strSqlOrder = "ORDER BY CITY.REGION ";
     } elseif ($by == "s_city_id") {
         $strSqlOrder = "ORDER BY H.CITY_ID ";
     } else {
         $by = "s_id";
         $strSqlOrder = "ORDER BY H.ID";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT /*TOP*/\n\t\t\t\tH.ID,\n\t\t\t\tH.SESSION_ID,\n\t\t\t\tH.GUEST_ID,\n\t\t\t\tH.NEW_GUEST,\n\t\t\t\tH.USER_ID,\n\t\t\t\tH.USER_AUTH,\n\t\t\t\tH.URL,\n\t\t\t\tH.URL_404,\n\t\t\t\tH.URL_FROM,\n\t\t\t\tH.IP,\n\t\t\t\tH.METHOD,\n\t\t\t\tH.COOKIES,\n\t\t\t\tH.USER_AGENT,\n\t\t\t\tH.STOP_LIST_ID,\n\t\t\t\tH.COUNTRY_ID,\n\t\t\t\tH.CITY_ID,\n\t\t\t\tCITY.REGION REGION_NAME,\n\t\t\t\tCITY.NAME CITY_NAME,\n\t\t\t\tH.SITE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("H.DATE_HIT") . " DATE_HIT\n\t\t\t\t" . $select . "\n\t\t\tFROM\n\t\t\t\tb_stat_hit H\n\t\t\t\tLEFT JOIN b_stat_city CITY ON (CITY.ID = H.CITY_ID)\n\t\t\t" . $from1 . "\n\t\t\t" . $from2 . "\n\t\t\tWHERE\n\t\t\t" . $strSqlSearch . "\n\t\t\t" . $strSqlOrder . "\n\t\t";
     $res = $DB->Query(CStatistics::DBTopSql($strSql), false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:hit.php

示例6: GetList


//.........这里部分代码省略.........
						break;
					case "USER":
						if(COption::GetOptionString("statistic", "dbnode_id") <= 0)
						{
							$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
							$arSqlSearch[] = $DB->IsNull("G.LAST_USER_ID","0").">0";
							$arSqlSearch[] = GetFilterQuery("G.LAST_USER_ID,A.LOGIN,A.LAST_NAME,A.NAME", $val, $match);
							$select1 .= ", ".$DB->Concat($DB->IsNull("A.NAME","''"), "' '", $DB->IsNull("A.LAST_NAME","''"))." USER_NAME, A.LOGIN";
							$from1 = "LEFT JOIN  b_user A ON (A.ID = G.LAST_USER_ID) ";
							$arrGroup["A.NAME"] = true;
							$arrGroup["A.LAST_NAME"] = true;
							$arrGroup["A.LOGIN"] = true;
							$bGroup = true;
						}
						break;
					case "USER_ID":
						if(COption::GetOptionString("statistic", "dbnode_id") <= 0)
						{
							$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
							$arSqlSearch[] = $DB->IsNull("G.LAST_USER_ID","0").">0";
							$arSqlSearch[] = GetFilterQuery("G.LAST_USER_ID", $val, $match);
							$select1 .= ", ".$DB->Concat($DB->IsNull("A.NAME","''"), "' '", $DB->IsNull("A.LAST_NAME","''"))." USER_NAME, A.LOGIN";
							$from1 = "LEFT JOIN  b_user A ON (A.ID = G.LAST_USER_ID) ";
							$arrGroup["A.NAME"] = true;
							$arrGroup["A.LAST_NAME"] = true;
							$arrGroup["A.LOGIN"] = true;
							$bGroup = true;
						}
						break;
				}
			}
		}
		if ($by == "s_id")					$strSqlOrder = "ORDER BY G.ID";
		elseif ($by == "s_first_site_id")	$strSqlOrder = "ORDER BY G.FIRST_SITE_ID";
		elseif ($by == "s_last_site_id")	$strSqlOrder = "ORDER BY G.LAST_SITE_ID";
		elseif ($by == "s_events")			$strSqlOrder = "ORDER BY G.C_EVENTS";
		elseif ($by == "s_sessions")		$strSqlOrder = "ORDER BY G.SESSIONS";
		elseif ($by == "s_hits")			$strSqlOrder = "ORDER BY G.HITS";
		elseif ($by == "s_first_date")		$strSqlOrder = "ORDER BY G.FIRST_DATE";
		elseif ($by == "s_first_url_from")	$strSqlOrder = "ORDER BY G.FIRST_URL_FROM";
		elseif ($by == "s_first_url_to")	$strSqlOrder = "ORDER BY G.FIRST_URL_TO";
		elseif ($by == "s_first_adv_id")	$strSqlOrder = "ORDER BY G.FIRST_ADV_ID";
		elseif ($by == "s_last_date")		$strSqlOrder = "ORDER BY ".CStatistics::DBFirstDate("G.LAST_DATE");
		elseif ($by == "s_last_user_id")	$strSqlOrder = "ORDER BY G.LAST_USER_ID";
		elseif ($by == "s_last_url_last")	$strSqlOrder = "ORDER BY G.LAST_URL_LAST";
		elseif ($by == "s_last_user_agent")	$strSqlOrder = "ORDER BY G.LAST_USER_AGENT";
		elseif ($by == "s_last_ip")			$strSqlOrder = "ORDER BY G.LAST_IP";
		elseif ($by == "s_last_adv_id")		$strSqlOrder = "ORDER BY G.LAST_ADV_ID";
		elseif ($by == "s_last_country_id")	$strSqlOrder = "ORDER BY G.LAST_COUNTRY_ID";
		elseif ($by == "s_last_region_name")	$strSqlOrder = "ORDER BY CITY.REGION";
		elseif ($by == "s_last_city_id")	$strSqlOrder = "ORDER BY G.LAST_CITY_ID";
		else
		{
			$by = "s_last_date";
			$strSqlOrder = "ORDER BY ".CStatistics::DBFirstDate("G.LAST_DATE");
		}
		if ($order!="asc")
		{
			$strSqlOrder .= " desc ";
			$order="desc";
		}

		if($bGroup)
		{
			$strSqlGroup = "GROUP BY ".implode(", ", array_keys($arrGroup));
		}

		$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
		$strSql = "
			SELECT /*TOP*/
				".$select0."
				G.ID, G.FIRST_SITE_ID, G.FIRST_SESSION_ID,
				G.LAST_SESSION_ID, G.LAST_SITE_ID,
				G.C_EVENTS, G.SESSIONS, G.HITS,  G.FAVORITES,
				G.FIRST_URL_FROM, G.FIRST_URL_TO, G.FIRST_URL_TO_404,
				G.FIRST_ADV_ID, G.FIRST_REFERER1, G.FIRST_REFERER2, G.FIRST_REFERER3,
				G.LAST_ADV_ID, G.LAST_ADV_BACK, G.LAST_REFERER1, G.LAST_REFERER2, G.LAST_REFERER3,
				G.LAST_USER_ID, G.LAST_USER_AUTH, G.LAST_URL_LAST, G.LAST_URL_LAST_404,
				G.LAST_USER_AGENT, G.LAST_IP, G.LAST_LANGUAGE, G.LAST_COUNTRY_ID,
				CITY.REGION as LAST_REGION_NAME,
				G.LAST_CITY_ID, CITY.NAME as LAST_CITY_NAME,
				".$DB->DateToCharFunction("G.FIRST_DATE")." FIRST_DATE,
				".$DB->DateToCharFunction("G.LAST_DATE")." LAST_DATE
				".$select1."
			FROM
				b_stat_guest G
			".$from0."
			".$from1."
			".$from2."
				LEFT JOIN b_stat_city CITY ON (CITY.ID = G.LAST_CITY_ID)
			WHERE
			".$strSqlSearch."
			".$strSqlGroup."
			".$strSqlOrder."
		";

		$res = $DB->Query(CStatistics::DBTopSql($strSql), false, $err_mess.__LINE__);
		$is_filtered = (IsFiltered($strSqlSearch));
		return $res;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:guest.php

示例7: GetList

 function GetList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     $DB = CDatabase::GetModuleConnection('statistic');
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                 case "SEARCHER_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("H." . $key, $val, $match);
                     break;
                 case "URL":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.URL", $val, $match, array("/", "\\", ".", "?", "#", ":"));
                     break;
                 case "URL_404":
                     $arSqlSearch[] = $val == "Y" ? "H.URL_404='Y'" : "H.URL_404='N'";
                     break;
                 case "SEARCHER":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("S.NAME", $val, $match);
                     break;
                 case "DATE1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "H.DATE_HIT >= " . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "H.DATE_HIT < " . CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
                     }
                     break;
                 case "IP":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.IP", $val, $match, array("."));
                     break;
                 case "USER_AGENT":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("H.USER_AGENT", $val, $match);
                     break;
                 case "SITE_ID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("H.SITE_ID", $val, $match);
                     break;
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY H.ID";
     } elseif ($by == "s_site_id") {
         $strSqlOrder = "ORDER BY H.SITE_ID";
     } elseif ($by == "s_date_hit") {
         $strSqlOrder = "ORDER BY H.DATE_HIT";
     } elseif ($by == "s_searcher_id") {
         $strSqlOrder = "ORDER BY H.SEARCHER_ID";
     } elseif ($by == "s_user_agent") {
         $strSqlOrder = "ORDER BY H.USER_AGENT";
     } elseif ($by == "s_ip") {
         $strSqlOrder = "ORDER BY H.IP";
     } elseif ($by == "s_url") {
         $strSqlOrder = "ORDER BY H.URL ";
     } else {
         $by = "s_date_hit";
         $strSqlOrder = "ORDER BY H.DATE_HIT";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSql = "\n\t\t\tSELECT /*TOP*/\n\t\t\t\tH.ID, H.SEARCHER_ID, H.URL, H.URL_404, H.IP, H.USER_AGENT, H.HIT_KEEP_DAYS, H.SITE_ID,\n\t\t\t\tS.NAME SEARCHER_NAME,\n\t\t\t\t" . $DB->DateToCharFunction("H.DATE_HIT") . " DATE_HIT\n\t\t\tFROM\n\t\t\t\tb_stat_searcher_hit H\n\t\t\tINNER JOIN b_stat_searcher S ON (S.ID = H.SEARCHER_ID)\n\t\t\tWHERE\n\t\t\t" . $strSqlSearch . "\n\t\t\t" . $strSqlOrder . "\n\t\t";
     $res = $DB->Query(CStatistics::DBTopSql($strSql), false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:92,代码来源:searcherhit.php

示例8: GetList


//.........这里部分代码省略.........
					$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
					$arSqlSearch[] = GetFilterQuery("M.ID", $val, $match);
					break;
				case "TYPE":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.EVENT_NAME, T.NAME", $val, $match);
					break;
				case "EVENT_NAME":
				case "TYPE_ID":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
					$arSqlSearch[] = GetFilterQuery("M.EVENT_NAME", $val, $match);
					break;
				case "TIMESTAMP_1":
					$arSqlSearch[] = "M.TIMESTAMP_X >= FROM_UNIXTIME('".MkDateTime(FmtDate($val,"D.M.Y"),"d.m.Y")."')";
					break;
				case "TIMESTAMP_2":
					$arSqlSearch[] = "M.TIMESTAMP_X <= FROM_UNIXTIME('".MkDateTime(FmtDate($val,"D.M.Y")." 23:59:59","d.m.Y")."')";
					break;
				case "LID":
				case "LANG":
				case "SITE_ID":
					if (is_array($val)) $val = implode(" | ",$val);
					$arSqlSearch[] = GetFilterQuery("MS.SITE_ID",$val,"N");
					$bIsLang = true;
					break;
				case "ACTIVE":
					$arSqlSearch[] = ($val=="Y") ? "M.ACTIVE = 'Y'" : "M.ACTIVE = 'N'";
					break;
				case "FROM":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.EMAIL_FROM", $val, $match);
					break;
				case "TO":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.EMAIL_TO", $val, $match);
					break;
				case "BCC":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.BCC", $val, $match);
					break;
				case "SUBJECT":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.SUBJECT", $val, $match);
					break;
				case "BODY_TYPE":
					$arSqlSearch[] = ($val=="text") ? "M.BODY_TYPE = 'text'" : "M.BODY_TYPE = 'html'";
					break;
				case "BODY":
					$match = ($arFilter[$key."_EXACT_MATCH"]=="Y" && $match_value_set) ? "N" : "Y";
					$arSqlSearch[] = GetFilterQuery("M.MESSAGE", $val, $match);
					break;
				}
			}
		}

		if ($by == "id") $strSqlOrder = " ORDER BY M.ID ";
		elseif ($by == "active") $strSqlOrder = " ORDER BY M.ACTIVE ";
		elseif ($by == "event_name") $strSqlOrder = " ORDER BY M.EVENT_NAME ";
		elseif ($by == "from") $strSqlOrder = " ORDER BY M.EMAIL_FROM ";
		elseif ($by == "to") $strSqlOrder = " ORDER BY M.EMAIL_TO ";
		elseif ($by == "bcc") $strSqlOrder = " ORDER BY M.BCC ";
		elseif ($by == "body_type") $strSqlOrder = " ORDER BY M.BODY_TYPE ";
		elseif ($by == "subject") $strSqlOrder = " ORDER BY M.SUBJECT ";
		else
		{
			$strSqlOrder = " ORDER BY M.ID ";
			$by = "id";
		}

		if ($order!="asc")
		{
			$strSqlOrder .= " desc ";
			$order = "desc";
		}

		$strSqlSearch = GetFilterSqlSearch($arSqlSearch);
		$strSql =
			"SELECT M.ID, M.EVENT_NAME, M.ACTIVE, M.LID, ".($bIsLang? "MS.SITE_ID":"M.LID AS SITE_ID").", M.EMAIL_FROM, M.EMAIL_TO, M.SUBJECT, M.MESSAGE, M.BODY_TYPE, M.BCC,
				M.REPLY_TO,
				M.CC,
				M.IN_REPLY_TO,
				M.PRIORITY,
				M.FIELD1_NAME,
				M.FIELD1_VALUE,
				M.FIELD2_NAME,
				M.FIELD2_VALUE,
			".
				$DB->DateToCharFunction("M.TIMESTAMP_X").
			" TIMESTAMP_X,	if(T.ID is null, M.EVENT_NAME, concat('[ ',T.EVENT_NAME,' ] ',ifnull(T.NAME,'')))	EVENT_TYPE ".
			"FROM b_event_message M ".
			($bIsLang?" LEFT JOIN b_event_message_site MS ON (M.ID = MS.EVENT_MESSAGE_ID)":"")." ".
			"	LEFT JOIN b_event_type T ON (T.EVENT_NAME = M.EVENT_NAME and T.LID = '".LANGUAGE_ID."') ".
			"WHERE ".
			$strSqlSearch.
			$strSqlOrder;

		$res = $DB->Query($strSql, false, $err_mess.__LINE__);
		$res->is_filtered = (IsFiltered($strSqlSearch));
		return $res;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:event.php

示例9: GetSimpleList

 function GetSimpleList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = "File: " . __FILE__ . "<br>Line: ";
     $DB = CDatabase::GetModuleConnection('statistic');
     $arSqlSearch = array();
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("A." . $key, $val, $match);
                     break;
                 case "REFERER1":
                 case "REFERER2":
                 case "DESCRIPTION":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("A." . $key, $val, $match);
                     break;
             }
         }
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $order = $order != "desc" ? "asc" : "desc";
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY A.ID " . $order;
     } elseif ($by == "s_referer1") {
         $strSqlOrder = "ORDER BY A.REFERER1 " . $order . ", A.REFERER2";
     } elseif ($by == "s_referer2") {
         $strSqlOrder = "ORDER BY A.REFERER2 " . $order;
     } elseif ($by == "s_description") {
         $strSqlOrder = "ORDER BY A.DESCRIPTION " . $order;
     } else {
         $by = "s_referer1";
         $strSqlOrder = "ORDER BY A.REFERER1 " . $order . ", A.REFERER2";
     }
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tA.ID,\n\t\t\t\tA.REFERER1,\n\t\t\t\tA.REFERER2,\n\t\t\t\tA.DESCRIPTION\n\t\t\tFROM\n\t\t\t\tb_stat_adv A\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\tLIMIT " . intval(COption::GetOptionString('statistic', 'RECORDS_LIMIT')) . "\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:51,代码来源:adv.php

示例10: GetList


//.........这里部分代码省略.........
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("S.ID", $val, $match);
                     break;
                 case "DATE_START_1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "S.DATE_START >= " . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE_START_2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "S.DATE_START < " . CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
                     }
                     break;
                 case "DATE_END_1":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "S.DATE_END >= " . $DB->CharToDateFunction($val, "SHORT");
                     }
                     break;
                 case "DATE_END_2":
                     if (CheckDateTime($val)) {
                         $arSqlSearch[] = "S.DATE_END < " . CStatistics::DBDateAdd($DB->CharToDateFunction($val, "SHORT"), 1);
                     }
                     break;
                 case "ACTIVE":
                 case "SAVE_STATISTIC":
                     $arSqlSearch[] = $val == "Y" ? "S." . $key . "='Y'" : "S." . $key . "='N'";
                     break;
                 case "IP_1":
                 case "IP_2":
                 case "IP_3":
                 case "IP_4":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("S." . $key, $val, $match);
                     break;
                 case "URL_FROM":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("S.URL_FROM", $val, $match, array("/", "\\", ".", "?", "#", ":"));
                     break;
                 case "USER_AGENT":
                 case "MESSAGE":
                 case "COMMENTS":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("S." . $key, $val, $match);
                     break;
                 case "URL_TO":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("S.URL_TO", $val, $match, array("/", "\\", ".", "?", "#", ":"));
                     break;
                 case "URL_REDIRECT":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("S.URL_REDIRECT", $val, $match, array("/", "\\", ".", "?", "#", ":"));
                     break;
                 case "SITE_ID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("S.SITE_ID", $val, $match);
                     break;
             }
         }
     }
     $strSqlOrder = "";
     if ($order != "asc") {
         $order = "desc";
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY S.ID {$order}";
     } elseif ($by == "s_date_start") {
         $strSqlOrder = "ORDER BY S.DATE_START {$order}";
     } elseif ($by == "s_site_id") {
         $strSqlOrder = "ORDER BY S.SITE_ID {$order}";
     } elseif ($by == "s_date_end") {
         $strSqlOrder = "ORDER BY S.DATE_END {$order}";
     } elseif ($by == "s_active") {
         $strSqlOrder = "ORDER BY S.ACTIVE {$order}";
     } elseif ($by == "s_save_statistic") {
         $strSqlOrder = "ORDER BY S.SAVE_STATISTIC {$order}";
     } elseif ($by == "s_ip") {
         $strSqlOrder = "ORDER BY S.IP_1 {$order}, S.IP_2 {$order}, S.IP_3 {$order}, S.IP_4 {$order}";
     } elseif ($by == "s_mask") {
         $strSqlOrder = "ORDER BY S.MASK_1 {$order}, S.MASK_2 {$order}, S.MASK_3 {$order}, S.MASK_4 {$order}";
     } elseif ($by == "s_url_to") {
         $strSqlOrder = "ORDER BY S.URL_TO {$order}";
     } elseif ($by == "s_url_from") {
         $strSqlOrder = "ORDER BY S.URL_FROM {$order}";
     } else {
         $strSqlOrder = "ORDER BY S.ID {$order}";
         $by = "s_id";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tS.ID, S.ACTIVE, S.SAVE_STATISTIC,\n\t\t\t\tS.IP_1, S.IP_2, S.IP_3, S.IP_4,\n\t\t\t\tS.MASK_1, S.MASK_2, S.MASK_3, S.MASK_4,\n\t\t\t\tS.USER_AGENT, S.USER_AGENT_IS_NULL,\n\t\t\t\tS.URL_TO, S.URL_FROM, S.MESSAGE, S.MESSAGE_LID,\n\t\t\t\tS.URL_REDIRECT, S.COMMENTS, S.TEST, S.SITE_ID,\n\t\t\t\t" . $DB->DateToCharFunction("S.TIMESTAMP_X") . "\tTIMESTAMP_X,\n\t\t\t\t" . $DB->DateToCharFunction("S.DATE_END") . "\t\tDATE_END,\n\t\t\t\t" . $DB->DateToCharFunction("S.DATE_START") . "\t\tDATE_START,\n\t\t\t\tif ((\n\t\t\t\t\t(S.DATE_START<=now() or S.DATE_START is null) and\n\t\t\t\t\t(S.DATE_END>=now() or S.DATE_END is null) and\n\t\t\t\t\tS.ACTIVE='Y'),\n\t\t\t\t\t'green',\n\t\t\t\t\t'red') as LAMP\n\t\t\tFROM\n\t\t\t\tb_stop_list S\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$strSqlOrder}\n\t\t\tLIMIT " . COption::GetOptionString('statistic', 'RECORDS_LIMIT') . "\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:stoplist.php

示例11: GetList

 function GetList(&$by, &$order, $arFilter = array(), &$isFiltered)
 {
     $err_mess = CTicketDictionary::err_mess() . "<br>Function: GetList<br>Line: ";
     global $DB;
     $arSqlSearch = array();
     $strSqlSearch = "";
     $leftJoinSite = "";
     $leftJoinUser = "";
     if (is_array($arFilter)) {
         $filterKeys = array_keys($arFilter);
         for ($i = 0; $i < count($filterKeys); $i++) {
             $key = $filterKeys[$i];
             $val = $arFilter[$filterKeys[$i]];
             if (is_array($val) && count($val) <= 0 || !is_array($val) && (strlen($val) <= 0 || $val === 'NOT_REF')) {
                 continue;
             }
             $match_value_set = in_array($key . "_EXACT_MATCH", $filterKeys) ? true : false;
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                 case "SID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("D." . $key, $val, $match);
                     break;
                 case "SITE":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("DS.SITE_ID", $val, $match);
                     $leftJoinSite .= "LEFT JOIN b_ticket_dictionary_2_site DS ON (D.ID = DS.DICTIONARY_ID)";
                     $select_user = ", DS.SITE_ID ";
                     break;
                 case "TYPE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("D.C_TYPE", $val, $match);
                     break;
                 case "NAME":
                 case "DESCR":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("D." . $key, $val, $match);
                     break;
                 case "RESPONSIBLE_ID":
                     if (intval($val) > 0) {
                         $arSqlSearch[] = "D.RESPONSIBLE_USER_ID = '" . intval($val) . "'";
                     } elseif ($val == 0) {
                         $arSqlSearch[] = "(D.RESPONSIBLE_USER_ID is null or D.RESPONSIBLE_USER_ID=0)";
                     }
                     break;
                 case "RESPONSIBLE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("D.RESPONSIBLE_USER_ID, U.LOGIN, U.LAST_NAME, U.NAME", $val, $match);
                     $select_user = ",\n\t\t\t\t\t\t\tU.LOGIN\t\t\t\t\t\t\t\t\t\t\t\t\t\tRESPONSIBLE_LOGIN,\n\t\t\t\t\t\t\tconcat(ifnull(U.NAME,''),' ',ifnull(U.LAST_NAME,''))\t\tRESPONSIBLE_NAME\n\t\t\t\t\t\t\t";
                     $leftJoinUser = "LEFT JOIN b_user U ON (U.ID = D.RESPONSIBLE_USER_ID)";
                     break;
                 case "DEFAULT":
                     $arSqlSearch[] = $val == "Y" ? "D.SET_AS_DEFAULT='Y'" : "D.SET_AS_DEFAULT='N'";
                     break;
                 case "LID":
                 case "FIRST_SITE_ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("D.FIRST_SITE_ID", $val, $match);
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "D.ID";
     } elseif ($by == "s_c_sort") {
         $strSqlOrder = "D.C_SORT";
     } elseif ($by == "s_sid") {
         $strSqlOrder = "D.SID";
     } elseif ($by == "s_lid") {
         $strSqlOrder = "D.FIRST_SITE_ID";
     } elseif ($by == "s_name") {
         $strSqlOrder = "D.NAME";
     } elseif ($by == "s_responsible") {
         $strSqlOrder = "D.RESPONSIBLE_USER_ID";
     } elseif ($by == "s_dropdown") {
         $strSqlOrder = "D.C_SORT, D.ID, D.NAME";
     } else {
         $by = "s_c_sort";
         $strSqlOrder = "D.C_SORT";
     }
     if ($order != "desc") {
         $strSqlOrder .= " asc ";
         $order = "asc";
     } else {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tD.*,\n\t\t\t\tD.FIRST_SITE_ID\t\t\t\t\t\tLID,\n\t\t\t\tD.ID\t\t\t\t\t\t\t\tREFERENCE_ID,\n\t\t\t\tD.NAME\t\t\t\t\t\t\t\tREFERENCE\n\t\t\t\t{$select_user}\n\t\t\tFROM\n\t\t\t\tb_ticket_dictionary D\n\t\t\t{$leftJoinUser}\n\t\t\t{$leftJoinSite}\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\tGROUP BY\n\t\t\t\tD.ID\n\t\t\tORDER BY\n\t\t\t\tcase D.C_TYPE\n\t\t\t\t\twhen 'C'\tthen '1'\n\t\t\t\t\twhen 'F'\tthen '2'\n\t\t\t\t\twhen 'S'\tthen '3'\n\t\t\t\t\twhen 'M'\tthen '4'\n\t\t\t\t\twhen 'K'\tthen '5'\n\t\t\t\t\twhen 'SR'\tthen '6'\n\t\t\t\t\twhen 'D'\tthen '7'\n\t\t\t\t\telse ''\tend,\n\t\t\t{$strSqlOrder}\n\t\t\t";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $isFiltered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:100,代码来源:dictionary.php

示例12: GetList

 public static function GetList($VOTE_ID, &$by, &$order, $arFilter = array(), &$is_filtered)
 {
     global $DB;
     $err_mess = CAllVoteQuestion::err_mess() . "<br>Function: GetList<br>Line: ";
     $VOTE_ID = intval($VOTE_ID);
     $arSqlSearch = array();
     $arFilter = is_array($arFilter) ? $arFilter : array($arFilter);
     foreach ($arFilter as $key => $val) {
         if (empty($key) || empty($val) || $val === "NOT_REF") {
             continue;
         }
         $key_res = VoteGetFilterOperation($key);
         $strNegative = $key_res["NEGATIVE"];
         $strOperation = $key_res["OPERATION"];
         $key = strtoupper($key_res["FIELD"]);
         switch ($key) {
             case "ID":
                 $match = $arFilter[$key . "_EXACT_MATCH"] == "N" ? "Y" : "N";
                 //turn off
                 $arSqlSearch[] = GetFilterQuery("Q.ID", $val, $match);
                 break;
             case "DIAGRAM":
             case "ACTIVE":
             case "REQUIRED":
                 $arSqlSearch[] = ($strNegative == "Y" ? " Q." . $key . " IS NULL OR NOT " : "") . " (Q." . $key . " " . $strOperation . " '" . $DB->ForSql($val) . "')";
                 break;
             case "QUESTION":
                 $match = $arFilter[$key . "_EXACT_MATCH"] != "N" ? "Y" : "N";
                 //turn on
                 $arSqlSearch[] = GetFilterQuery("Q.QUESTION", $val, $match);
                 break;
         }
     }
     if ($VOTE_ID > 0) {
         $arSqlSearch[] = "Q.VOTE_ID = " . $VOTE_ID;
     }
     // Order
     $by1 = strtoupper(strpos($by, "s_") === 0 ? substr($by, 2) : $by);
     $order = $order != "desc" ? "asc" : "desc";
     $order1 = strtoupper($order);
     if (in_array($by1, array("ID", "TIMESTAMP_X", "ACTIVE", "DIAGRAM", "C_SORT", "REQUIRED"))) {
         $strSqlOrder = "Q." . $by1 . " " . $order1;
     } else {
         $by = "s_c_sort";
         $strSqlOrder = "Q.C_SORT " . $order1;
     }
     // Sql
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT Q.*,\n\t\t\t\t" . $DB->DateToCharFunction("Q.TIMESTAMP_X", "SHORT") . " TIMESTAMP_X\n\t\t\tFROM b_vote_question Q\n\t\t\tWHERE " . $strSqlSearch . "\n\t\t\tORDER BY " . $strSqlOrder;
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:53,代码来源:question.php

示例13: GetList


//.........这里部分代码省略.........
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformfield/index.php">Поля CFormField</a> </li>
  * <li> <a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformfield/getbyid.php">CFormField::GetByID</a> </li> <li>
  * <a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformfield/getbysid.php">CFormField::GetBySID</a> <br> </li>
  * </ul></b<a name="examples"></a>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/form/classes/cformfield/getlist.php
  * @author Bitrix
  */
 public static function GetList($WEB_FORM_ID, $get_fields, &$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = CAllFormField::err_mess() . "<br>Function: GetList<br>Line: ";
     global $DB, $strError;
     $WEB_FORM_ID = intval($WEB_FORM_ID);
     $str = "";
     if (strlen($get_fields) > 0 && $get_fields != "ALL") {
         InitBVar($get_fields);
         $str = "and ADDITIONAL='{$get_fields}'";
     }
     $arSqlSearch = array();
     $strSqlSearch = "";
     if (is_array($arFilter)) {
         if (isset($arFilter["SID"]) && strlen($arFilter["SID"]) > 0) {
             $arFilter["VARNAME"] = $arFilter["SID"];
         } elseif (isset($arFilter["VARNAME"]) && strlen($arFilter["VARNAME"]) > 0) {
             $arFilter["SID"] = $arFilter["VARNAME"];
         }
         $filter_keys = array_keys($arFilter);
         for ($i = 0; $i < count($filter_keys); $i++) {
             $key = $filter_keys[$i];
             $val = $arFilter[$filter_keys[$i]];
             if (strlen($val) <= 0 || "{$val}" == "NOT_REF") {
                 continue;
             }
             if (is_array($val) && count($val) <= 0) {
                 continue;
             }
             $match_value_set = in_array($key . "_EXACT_MATCH", $filter_keys) ? true : false;
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                 case "SID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("F." . $key, $val, $match);
                     break;
                 case "TITLE":
                 case "COMMENTS":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("F." . $key, $val, $match);
                     break;
                 case "ACTIVE":
                 case "IN_RESULTS_TABLE":
                 case "IN_EXCEL_TABLE":
                 case "IN_FILTER":
                 case "REQUIRED":
                     $arSqlSearch[] = $val == "Y" ? "F." . $key . "='Y'" : "F." . $key . "='N'";
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY F.ID";
     } elseif ($by == "s_active") {
         $strSqlOrder = "ORDER BY F.ACTIVE";
     } elseif ($by == "s_varname" || $by == "s_sid") {
         $strSqlOrder = "ORDER BY F.SID";
     } elseif ($by == "s_c_sort" || $by == "s_sort") {
         $strSqlOrder = "ORDER BY F.C_SORT";
     } elseif ($by == "s_title") {
         $strSqlOrder = "ORDER BY F.TITLE";
     } elseif ($by == "s_comments") {
         $strSqlOrder = "ORDER BY F.COMMENTS";
     } elseif ($by == "s_required") {
         $strSqlOrder = "ORDER BY F.REQUIRED";
     } elseif ($by == "s_in_results_table") {
         $strSqlOrder = "ORDER BY F.IN_RESULTS_TABLE";
     } elseif ($by == "s_in_excel_table") {
         $strSqlOrder = "ORDER BY F.IN_EXCEL_TABLE";
     } elseif ($by == "s_field_type") {
         $strSqlOrder = "ORDER BY F.FIELD_TYPE";
     } else {
         $by = "s_sort";
         $strSqlOrder = "ORDER BY F.C_SORT";
     }
     if ($order != "desc") {
         $strSqlOrder .= " asc ";
         $order = "asc";
     } else {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\t\tSELECT\n\t\t\t\tF.*,\n\t\t\t\tF.SID as VARNAME,\n\t\t\t\t" . $DB->DateToCharFunction("F.TIMESTAMP_X") . "\tTIMESTAMP_X\n\t\t\tFROM\n\t\t\t\tb_form_field F\n\t\t\tWHERE\n\t\t\t{$strSqlSearch}\n\t\t\t{$str}\n\t\t\tand FORM_ID='{$WEB_FORM_ID}'\n\t\t\t{$strSqlOrder}\n\t\t\t";
     //echo "<pre>".$strSql."</pre>";
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:form_callformfield.php

示例14: GetList

 public static function GetList(&$by, &$order, $arFilter = array(), &$is_filtered)
 {
     $err_mess = CVoteChannel::err_mess() . "<br>Function: GetList<br>Line: ";
     global $DB;
     $arSqlSearch = array();
     $left_join = "";
     if (is_array($arFilter)) {
         foreach ($arFilter as $key => $val) {
             if (is_array($val)) {
                 if (count($val) <= 0) {
                     continue;
                 }
             } else {
                 if (strlen($val) <= 0 || $val === "NOT_REF") {
                     continue;
                 }
             }
             $match_value_set = array_key_exists($key . "_EXACT_MATCH", $arFilter);
             $key = strtoupper($key);
             switch ($key) {
                 case "ID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("C.ID", $val, $match);
                     break;
                 case "SITE_ID":
                 case "SITE":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("CS.SITE_ID", $val, $match);
                     $left_join = "LEFT JOIN b_vote_channel_2_site CS ON (C.ID = CS.CHANNEL_ID)";
                     break;
                 case "TITLE":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("C.TITLE", $val, $match);
                     break;
                 case "SID":
                 case "SYMBOLIC_NAME":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("C.SYMBOLIC_NAME", $val, $match);
                     break;
                 case "HIDDEN":
                 case "ACTIVE":
                     $arSqlSearch[] = $val == "Y" ? "C." . $key . "='Y'" : "C." . $key . "='N'";
                     break;
                 case "FIRST_SITE_ID":
                 case "LID":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("C.FIRST_SITE_ID", $val, $match);
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = "ORDER BY C.ID";
     } elseif ($by == "s_timestamp") {
         $strSqlOrder = "ORDER BY C.TIMESTAMP_X";
     } elseif ($by == "s_c_sort") {
         $strSqlOrder = "ORDER BY C.C_SORT";
     } elseif ($by == "s_active") {
         $strSqlOrder = "ORDER BY C.ACTIVE";
     } elseif ($by == "s_hidden") {
         $strSqlOrder = "ORDER BY C.HIDDEN";
     } elseif ($by == "s_symbolic_name") {
         $strSqlOrder = "ORDER BY C.SYMBOLIC_NAME";
     } elseif ($by == "s_title") {
         $strSqlOrder = "ORDER BY C.TITLE ";
     } elseif ($by == "s_votes") {
         $strSqlOrder = "ORDER BY VOTES";
     } else {
         $by = "s_id";
         $strSqlOrder = "ORDER BY C.ID";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     $strSql = "\n\t\tSELECT CC.*, C.*, C.FIRST_SITE_ID LID, C.SYMBOLIC_NAME SID,\n\t\t\t\t" . $DB->DateToCharFunction("C.TIMESTAMP_X") . " TIMESTAMP_X\n\t\tFROM (\n\t\t\tSELECT C.ID, count(V.ID) VOTES\n\t\t\tFROM b_vote_channel C\n\t\t\t\tLEFT JOIN b_vote V ON (V.CHANNEL_ID = C.ID)\n\t\t\t\t" . $left_join . "\n\t\t\tWHERE " . $strSqlSearch . "\n\t\t\tGROUP BY C.ID) CC\n\t\tINNER JOIN b_vote_channel C ON (C.ID = CC.ID)\n\t\t" . $strSqlOrder;
     $is_filtered = IsFiltered($strSqlSearch);
     if (VOTE_CACHE_TIME === false || strpos($_SERVER['REQUEST_URI'], '/bitrix/admin/') !== false) {
         $res = $DB->Query($strSql, false, $err_mess . __LINE__);
         return $res;
     } else {
         global $CACHE_MANAGER;
         $md5 = md5($strSql);
         $arCache = array();
         if ($CACHE_MANAGER->Read(VOTE_CACHE_TIME, "b_vote_channel_" . $md5, "b_vote_channel")) {
             $arCache = $CACHE_MANAGER->Get("b_vote_channel_" . $md5);
         } else {
             $res = $DB->Query($strSql, false, $err_mess . __LINE__);
             while ($ar = $res->Fetch()) {
                 $arCache[] = $ar;
             }
             $CACHE_MANAGER->Set("b_vote_channel_" . $md5, $arCache);
         }
         $r = new CDBResult();
         $r->InitFromArray($arCache);
         unset($arCache);
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:channel.php

示例15: GetList


//.........这里部分代码省略.........
                 case "TYPE_SID":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "N" && $match_value_set ? "Y" : "N";
                     $arSqlSearch[] = GetFilterQuery("B.TYPE_SID", $val, $match);
                     break;
                 case "TYPE":
                     if (is_array($val)) {
                         $val = implode(" | ", $val);
                     }
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("B.TYPE_SID, T.NAME, T.DESCRIPTION", $val, $match);
                     break;
                 case "SHOW_USER_GROUP":
                     if ($val == "Y") {
                         $arSqlSearch[] = "B.SHOW_USER_GROUP='Y'";
                     } else {
                         $arSqlSearch[] = "B.SHOW_USER_GROUP <> 'Y'";
                     }
                     break;
                 case "NAME":
                 case "CODE":
                 case "COMMENTS":
                     $match = $arFilter[$key . "_EXACT_MATCH"] == "Y" && $match_value_set ? "N" : "Y";
                     $arSqlSearch[] = GetFilterQuery("B." . $key, $val, $match);
                     break;
                     // совместимость со старой версией
                 // совместимость со старой версией
                 case "LANG":
                 case "FIRST_SITE_ID":
                     $arSqlSearch[] = GetFilterQuery("B.FIRST_SITE_ID", $val, "N");
                     break;
             }
         }
     }
     if ($by == "s_id") {
         $strSqlOrder = " ORDER BY B.ID ";
     } elseif ($by == "s_lamp") {
         $strSqlOrder = " ORDER BY LAMP ";
     } elseif ($by == "s_name") {
         $strSqlOrder = " ORDER BY B.NAME ";
     } elseif ($by == "s_type_sid") {
         $strSqlOrder = " ORDER BY B.TYPE_SID ";
     } elseif ($by == "s_contract_id") {
         $strSqlOrder = " ORDER BY B.CONTRACT_ID ";
     } elseif ($by == "s_group_sid") {
         $strSqlOrder = " ORDER BY B.GROUP_SID ";
     } elseif ($by == "s_visitor_count") {
         $strSqlOrder = " ORDER BY B.VISITOR_COUNT ";
     } elseif ($by == "s_max_visitor_count") {
         $strSqlOrder = " ORDER BY ifnull(B.MAX_VISITOR_COUNT,0) ";
     } elseif ($by == "s_show_count") {
         $strSqlOrder = " ORDER BY B.SHOW_COUNT ";
     } elseif ($by == "s_max_show_count") {
         $strSqlOrder = " ORDER BY ifnull(B.MAX_SHOW_COUNT,0) ";
     } elseif ($by == "s_date_last_show") {
         $strSqlOrder = " ORDER BY B.DATE_LAST_SHOW ";
     } elseif ($by == "s_click_count") {
         $strSqlOrder = " ORDER BY B.CLICK_COUNT ";
     } elseif ($by == "s_max_click_count") {
         $strSqlOrder = " ORDER BY ifnull(B.MAX_CLICK_COUNT,0) ";
     } elseif ($by == "s_date_last_click") {
         $strSqlOrder = " ORDER BY B.DATE_LAST_CLICK ";
     } elseif ($by == "s_active") {
         $strSqlOrder = " ORDER BY B.ACTIVE ";
     } elseif ($by == "s_weight") {
         $strSqlOrder = " ORDER BY B.WEIGHT ";
     } elseif ($by == "s_status_sid") {
         $strSqlOrder = " ORDER BY B.STATUS_SID ";
     } elseif ($by == "s_date_show_from") {
         $strSqlOrder = " ORDER BY B.DATE_SHOW_FROM ";
     } elseif ($by == "s_date_show_to") {
         $strSqlOrder = " ORDER BY B.DATE_SHOW_TO ";
     } elseif ($by == "s_dropdown") {
         $strSqlOrder = " ORDER BY B.CONTRACT_ID desc, B.ID ";
     } elseif ($by == "s_ctr") {
         $strSqlOrder = " ORDER BY CTR ";
     } elseif ($by == "s_date_create") {
         $strSqlOrder = " ORDER BY B.DATE_CREATE ";
     } elseif ($by == "s_date_modify") {
         $strSqlOrder = " ORDER BY B.DATE_MODIFY ";
     } else {
         $strSqlOrder = " ORDER BY B.ID ";
         $by = "s_id";
     }
     if ($order != "asc") {
         $strSqlOrder .= " desc ";
         $order = "desc";
     }
     $strSqlSearch = GetFilterSqlSearch($arSqlSearch);
     if ($isAdmin || $isDemo || $isManager) {
         $strSql = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t{$lamp}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLAMP,\n\t\t\t\t\tB.*,\n\t\t\t\t\tB.FIRST_SITE_ID,\n\t\t\t\t\tB.FIRST_SITE_ID\t\t\t\t\t\t\t\t\t\t\t\t\t\tLID,\n\t\t\t\t\tif(B.SHOW_COUNT<=0,0,round((B.CLICK_COUNT*100)/B.SHOW_COUNT,2))\t\tCTR,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_SHOW") . "\t\t\t\t\t\tDATE_LAST_SHOW,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_CLICK") . "\t\t\t\t\tDATE_LAST_CLICK,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FROM") . "\t\t\tDATE_SHOW_FROM,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_TO") . "\t\t\t\tDATE_SHOW_TO,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FIRST") . "\t\t\tDATE_SHOW_FIRST,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_CREATE") . "\t\t\t\t\t\tDATE_CREATE,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_MODIFY") . "\t\t\t\t\t\tDATE_MODIFY,\n\t\t\t\t\tC.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONTRACT_NAME,\n\t\t\t\t\tT.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTYPE_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_adv_banner B\n\t\t\t\tINNER JOIN b_adv_type T ON (T.SID = B.TYPE_SID)\n\t\t\t\tINNER JOIN b_adv_contract C ON (C.ID = B.CONTRACT_ID)\n\t\t\t\t{$left_join}\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strSqlOrder}\n\t\t\t\t";
     } else {
         $strSql = "\n\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t{$lamp}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLAMP,\n\t\t\t\t\tB.*,\n\t\t\t\t\tB.FIRST_SITE_ID,\n\t\t\t\t\tB.FIRST_SITE_ID\t\t\t\t\t\t\t\t\t\t\t\t\t\tLID,\n\t\t\t\t\tif(B.SHOW_COUNT<=0,0,round((B.CLICK_COUNT*100)/B.SHOW_COUNT,2))\t\tCTR,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_SHOW") . "\t\t\t\t\t\tDATE_LAST_SHOW,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_LAST_CLICK") . "\t\t\t\t\tDATE_LAST_CLICK,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FROM") . "\t\t\tDATE_SHOW_FROM,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_TO") . "\t\t\t\tDATE_SHOW_TO,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_SHOW_FIRST") . "\t\t\tDATE_SHOW_FIRST,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_CREATE") . "\t\t\t\t\t\tDATE_CREATE,\n\t\t\t\t\t" . $DB->DateToCharFunction("B.DATE_MODIFY") . "\t\t\t\t\t\tDATE_MODIFY,\n\t\t\t\t\tC.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tCONTRACT_NAME,\n\t\t\t\t\tT.NAME\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tTYPE_NAME\n\t\t\t\tFROM\n\t\t\t\t\tb_adv_banner B\n\t\t\t\tINNER JOIN b_adv_type T ON (T.SID = B.TYPE_SID)\n\t\t\t\tINNER JOIN b_adv_contract C ON (C.ID = B.CONTRACT_ID)\n\t\t\t\tINNER JOIN b_adv_contract_2_user CU ON (CU.CONTRACT_ID=C.ID and CU.USER_ID={$USER_ID})\n\t\t\t\t{$left_join}\n\t\t\t\tWHERE\n\t\t\t\t{$strSqlSearch}\n\t\t\t\t{$strSqlOrder}\n\t\t\t\t";
     }
     $res = $DB->Query($strSql, false, $err_mess . __LINE__);
     $is_filtered = IsFiltered($strSqlSearch);
     return $res;
 }
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:advertising.php


注:本文中的IsFiltered函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。