本文整理匯總了PHP中AddFieldWrappers函數的典型用法代碼示例。如果您正苦於以下問題:PHP AddFieldWrappers函數的具體用法?PHP AddFieldWrappers怎麽用?PHP AddFieldWrappers使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AddFieldWrappers函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getNextPrevRecordKeys
function getNextPrevRecordKeys(&$data, $securityMode, &$next, &$prev)
{
global $conn;
$next = array();
$prev = array();
if (@$_SESSION[$this->sessionPrefix . "_noNextPrev"]) {
return;
}
$prevExpr = "";
$nextExpr = "";
$where_next = "";
$where_prev = "";
$order_next = "";
$order_prev = "";
require_once getabspath('classes/orderclause.php');
$orderClause = new OrderClause($this);
$orderClause->init();
$query = $this->pSet->GetQueryObject();
$where = $_SESSION[$this->sessionPrefix . "_where"];
if (!strlen($where)) {
$where = SecuritySQL($securityMode);
}
$having = $_SESSION[$this->sessionPrefix . "_having"];
$tKeys = $this->pSet->getTableKeys();
if (!count($orderClause->fieldsList)) {
$_SESSION[$this->sessionPrefix . "_noNextPrev"] = 1;
return;
}
// make next & prev ORDER BY strings
for ($i = 0; $i < count($orderClause->fieldsList); $i++) {
$field = $orderClause->fieldsList[$i];
if (!$this->pSet->GetFieldByIndex($field->fieldIndex)) {
continue;
}
if ($order_next == "") {
$order_next = " ORDER BY ";
$order_prev = " ORDER BY ";
} else {
$order_next .= ",";
$order_prev .= ",";
}
$order_next .= $field->fieldIndex . " " . $field->orderDirection;
$order_prev .= $field->fieldIndex . " " . ($field->orderDirection == "DESC" ? "ASC" : "DESC");
}
// make next & prev where expressions
$tail = "";
for ($i = 0; $i < count($orderClause->fieldsList); $i++) {
$field = $orderClause->fieldsList[$i];
$fieldName = $this->pSet->GetFieldByIndex($field->fieldIndex);
if (!$fieldName) {
continue;
}
if (!$query->HasGroupBy()) {
$fullName = GetFullFieldName($fieldName, $this->tName, false);
} else {
$fullName = AddFieldWrappers($fieldName);
}
$asc = $field->orderDirection == "ASC";
if (!is_null($data[$fieldName])) {
// current field value is not null
$value = $this->cipherer->MakeDBValue($fieldName, $data[$fieldName], "", "", true);
$nextop = $asc ? ">" : "<";
$prevop = $asc ? "<" : ">";
$nextExpr = $fullName . $nextop . $value;
$prevExpr = $fullName . $prevop . $value;
if ($nextop == "<") {
$nextExpr .= " or " . $fullName . " IS NULL";
} else {
$prevExpr .= " or " . $fullName . " IS NULL";
}
if ($i < count($orderClause->fieldsList) - 1) {
$nextExpr .= " or " . $fullName . "=" . $value;
$prevExpr .= " or " . $fullName . "=" . $value;
}
} else {
$nextExpr = "";
$prevExpr = "";
// current field value is null
if ($asc) {
$nextExpr = $fullName . " IS NOT NULL";
} else {
$prevExpr = $fullName . " IS NOT NULL";
}
if ($i < count($orderClause->fieldsList) - 1) {
if ($nextExpr != "") {
$nextExpr .= " or ";
}
$nextExpr .= $fullName . " IS NULL";
if ($prevExpr != "") {
$prevExpr .= " or ";
}
$prevExpr .= $fullName . " IS NULL";
}
}
if ($nextExpr == "") {
$nextExpr = " 1=0 ";
}
if ($prevExpr == "") {
$prevExpr = " 1=0 ";
}
//.........這裏部分代碼省略.........
示例2: buildSQL
function buildSQL()
{
$this->buildLookupWhereClause();
if ($this->dispFieldAlias) {
$this->gsqlHead .= ", " . $this->dispField . " ";
$this->gsqlHead .= "as " . AddFieldWrappers($this->dispFieldAlias) . " ";
}
parent::buildSQL();
}
示例3: InsertRecord
function InsertRecord($arr, $recInd)
{
global $goodlines, $conn, $error_message, $keys_present, $keys, $strOriginalTableName, $strTableName, $eventObj, $locale_info, $auditObj;
$ret = 1;
$rawvalues = array();
foreach ($arr as $key => $val) {
$rawvalues[$key] = $val;
$type = GetFieldType($key);
if (!NeedQuotes($type)) {
$value = (string) $val;
$value = str_replace(",", ".", $value);
if (strlen($value) > 0) {
$value = str_replace($locale_info["LOCALE_SCURRENCY"], "", $value);
$arr[$key] = 0 + $value;
} else {
$arr[$key] = NULL;
}
}
}
$retval = true;
if ($eventObj->exists('BeforeInsert')) {
$retval = $eventObj->BeforeInsert($rawvalues, $arr);
}
if ($retval) {
$fields = array_keys($arr);
foreach ($fields as $key => $val) {
$fields_list[$key] = AddFieldWrappers(GetFullFieldName($val));
}
$values_list = "";
foreach ($arr as $key => $val) {
if (!is_null($arr[$key])) {
$values_list .= add_db_quotes($key, $val) . ", ";
} else {
$values_list .= "NULL, ";
}
}
if (strlen($values_list) > 0) {
$values_list = substr($values_list, 0, strlen($values_list) - 2);
}
$sql = "insert into " . AddTableWrappers($strOriginalTableName) . " (" . implode(",", $fields_list) . ") values (" . $values_list . ")";
if (db_exec_import($sql, $conn)) {
$goodlines++;
if ($auditObj) {
$aKeys = GetKeysArray($arr, true);
$auditObj->LogAdd($strTableName, $arr, $aKeys);
}
} else {
$temp_error_message = "<b>Error:</b> in the line: " . implode(",", $arr) . ' <a linkType="debugOpener" recId="' . $recInd . '" href="" onclick="importMore(' . $recInd . ');">More info</a><br>';
$temp_error_message .= '<div id="importDebugInfoTable' . $recInd . '" cellpadding="3" cellspacing="1" align="center" style="display: none;"><p class="error">SQL query: ' . $sql . '; </p><p class="error">DB error: ' . db_error($conn) . ';</p></div>';
$temp_error_message .= "<br><br>";
// we'll try to update the record
if ($keys_present) {
$sql = "update " . AddTableWrappers($strOriginalTableName) . " set ";
$sqlset = "";
$where = " where ";
foreach ($fields as $k => $val) {
if (!in_array(AddFieldWrappers($fields[$k]), $keys)) {
if (!is_null($arr[$val])) {
$sqlset .= $fields_list[$k] . "=" . add_db_quotes($val, $arr[$val]) . ", ";
} else {
$sqlset .= $fields_list[$k] . "=NULL, ";
}
} else {
$where .= $fields_list[$k] . "=" . add_db_quotes($val, $arr[$val]) . " and ";
}
}
if (strlen($sqlset) > 0) {
$sql .= substr($sqlset, 0, strlen($sqlset) - 2);
}
$where = substr($where, 0, strlen($where) - 5);
$sql .= " " . $where;
$rstmp = db_query("select * from " . AddTableWrappers($strOriginalTableName) . " " . $where, $conn);
$data = db_fetch_array($rstmp);
if ($data) {
if ($auditObj) {
foreach ($data as $key => $val) {
$auditOldValues[$key] = $val;
}
}
if (db_exec_import($sql, $conn)) {
// update successfull
$goodlines++;
if ($auditObj) {
$aKeys = GetKeysArray($arr);
$auditObj->LogEdit($strTableName, $arr, $auditOldValues, $aKeys);
}
} else {
echo 'not updated';
// update not successfull
$error_message .= $temp_error_message;
$ret = 0;
}
} else {
$error_message .= $temp_error_message;
$ret = 0;
}
} else {
$error_message .= $temp_error_message;
}
}
//.........這裏部分代碼省略.........
示例4: elseif
$strSQLbak = $strSQL;
if (is_wr_db()) {
$strSQL = $rpt_array['sql'] . $rpt_array['where'] . $rpt_array['order_by'];
} elseif (is_wr_project()) {
$strSQL = $gQuery->gSQLWhere($strWhereClause);
$strSQL .= " " . trim($strOrderBy);
} elseif (is_wr_custom()) {
if (GetDatabaseType() != 1) {
$sqlquery = $rpt_array['sql'];
if (GetDatabaseType() == 2) { //MSSQLServer
$pos = strrpos(strtoupper($sqlquery), "ORDER BY");
if ($pos)
$sqlquery = substr($sqlquery, 0, $pos);
}
$strSQL = "select * from (" . $sqlquery . ") as " . AddFieldWrappers("t") . " " . $rpt_array['where'] . $rpt_array['order_by'];
} else
$strSQL = "select * from (" . $rpt_array['sql'] . ")" . $rpt_array['where'] . $rpt_array['order_by'];
}
$grid_row = array();
if ($cross_table != "true") {
$groupno = 0;
if (!$_SESSION[$sessPrefix . "_pagenumber"]) {
$_SESSION[$sessPrefix . "_pagenumber"] = 1;
}
if (!$_SESSION[$sessPrefix . "_pagesize"]) {
if ((count($rpt_array['group_fields']) - 1 ) > 0) {
$_SESSION[$sessPrefix . "_pagesize"] = 5;
} else {
$_SESSION[$sessPrefix . "_pagesize"] = 20;
示例5: LoginAccess
function LoginAccess()
{
if ($this->attLogin > 0 && $this->timeLogin > 0) {
$rstmp = $this->TableObj->Query(AddFieldWrappers("ip") . "='" . $_SERVER["REMOTE_ADDR"] . "' and " . AddFieldWrappers("action") . "='access'", AddFieldWrappers("id") . " asc");
$i = 0;
while ($data = db_fetch_array($rstmp)) {
if (secondsPassedFrom($data["datetime"]) / 60 <= $this->timeLogin) {
if ($i == 0) {
$firstAccess = $data["datetime"];
}
$i += 1;
}
}
if ($i >= $this->attLogin) {
return ceil($this->timeLogin - secondsPassedFrom($firstAccess) / 60);
} else {
return false;
}
} else {
return false;
}
}
示例6: AddTableWrappers
function AddTableWrappers($strName)
{
return AddFieldWrappers($strName);
}
示例7: buildLookupSQL
function buildLookupSQL($pageType, $field, $table, $parentVal, $childVal = "", $doCategoryFilter = true, $doValueFilter = false, $addCategoryField = false, $doWhereFilter = true, $oneRecordMode = false, $doValueFilterByLinkField = false)
{
global $strTableName;
if (!strlen($table)) {
$table = $strTableName;
}
$pSet = new ProjectSettings($table, $pageType);
// read settings
$nLookupType = $pSet->getLookupType($field);
if ($nLookupType != LT_LOOKUPTABLE && $nLookupType != LT_QUERY) {
return "";
}
$lookupTable = $pSet->getLookupTable($field);
$displayFieldName = $pSet->getDisplayField($field);
$linkFieldName = $pSet->getLinkField($field);
$linkAndDisplaySame = $displayFieldName == $linkFieldName;
$bUnique = $pSet->isLookupUnique($field);
$strLookupWhere = GetLWWhere($field, $pageType, $table);
$strOrderBy = $pSet->getLookupOrderBy($field);
if (strlen($strOrderBy)) {
$strOrderBy = GetFullFieldName($strOrderBy, $lookupTable);
if ($pSet->isLookupDesc($field)) {
$strOrderBy .= ' DESC';
}
}
$bDesc = $pSet->isLookupDesc($field);
$strCategoryFilter = $pSet->getCategoryFilter($field);
if ($nLookupType == LT_QUERY) {
$lookupPSet = new ProjectSettings($lookupTable, $pageType);
$cipherer = new RunnerCipherer($lookupTable, $lookupPSet);
} else {
$cipherer = new RunnerCipherer($table, $pSet);
}
if ($doCategoryFilter) {
if ($nLookupType == LT_QUERY) {
$parentVal = $cipherer->MakeDBValue($strCategoryFilter, $parentVal, "", $lookupTable, true);
} else {
$parentVal = make_db_value($pSet->getCategoryControl($field), $parentVal, '', '', $table);
}
}
if ($doValueFilter) {
if ($pageType != PAGE_SEARCH || $doValueFilterByLinkField) {
if ($nLookupType == LT_QUERY) {
$childWhereField = $pSet->getLWLinkField($field, false);
} else {
$childWhereField = $pSet->getLWLinkField($field, true);
}
} else {
if ($nLookupType == LT_QUERY) {
$childWhereField = $pSet->getLWDisplayField($field, false);
} else {
$childWhereField = $pSet->getLWDisplayField($field, true);
}
}
if ($nLookupType == LT_QUERY) {
$childVal = $cipherer->MakeDBValue($childWhereField, $childVal, "", $lookupTable, true);
} else {
if ($linkAndDisplaySame) {
$childVal = make_db_value($field, $childVal, '', '', $table);
} else {
$childVal = add_db_quotes($field, $childVal, $table, 200);
}
}
}
// build Where clause
$categoryWhere = "";
$childWhere = "";
if ($pSet->useCategory($field) && $doCategoryFilter) {
$condition = "=" . $parentVal;
if ($parentVal === "null") {
$condition = " is null";
}
if ($nLookupType == LT_QUERY) {
$categoryWhere = $cipherer->GetFieldName(AddFieldWrappers($strCategoryFilter), $strCategoryFilter) . $condition;
} else {
$categoryWhere = AddFieldWrappers($strCategoryFilter) . $condition;
}
}
if ($doValueFilter) {
$condition = "=" . $childVal;
if ($childVal === "null") {
$condition = " is null";
}
if ($nLookupType == LT_QUERY) {
if ($pageType != PAGE_SEARCH || $pSet->lookupControlType($field) == LCT_LIST || $doValueFilterByLinkField) {
$childWhere = GetFullFieldName($pSet->getLinkField($field), $lookupTable, false) . $condition;
} else {
if (!$pSet->getCustomDisplay($field)) {
$childWhere = $cipherer->GetFieldName($lookupPSet->getFullNameField($displayFieldName), $field) . $condition;
} else {
$childWhere = $pSet->getDisplayField($field) . $condition;
}
}
} else {
if ($pageType != PAGE_SEARCH || $doValueFilterByLinkField) {
$childWhere = $pSet->getLWLinkField($field, true) . $condition;
} else {
$childWhere = $pSet->getLWDisplayField($field, true) . $condition;
}
}
//.........這裏部分代碼省略.........
示例8: toSql
function toSql($query, $first)
{
$ret = '';
if(is_a($this->m_table, "SQLTable"))
{
$ret .= $this->m_table->toSql($query);
}
else
{
if($this->m_table)
{
if(is_a($this->m_table, 'SQLQuery'))
{
return $this->m_sql;
}
else
{
$ret .= '(' . $this->m_table->toSql($query) . ')';
}
}
}
if($this->m_alias != '')
{
$ret .= ' ' . AddFieldWrappers($this->m_alias);
}
if($this->m_link == 'SQLL_MAIN')
{
return $ret;
}
switch($this->m_link)
{
case 'SQLL_INNERJOIN':
$ret = ' INNER JOIN ' . $ret;
break;
case 'SQLL_NATURALJOIN':
$ret = ' NATURAL JOIN ' . $ret;
break;
case 'SQLL_LEFTJOIN':
$ret = ' LEFT OUTER JOIN ' . $ret;
break;
case 'SQLL_RIGHTJOIN':
$ret = ' RIGHT OUTER JOIN ' . $ret;
break;
case 'SQLL_FULLOUTERJOIN':
$ret = ' FULL OUTER JOIN ' . $ret;
break;
case 'SQLL_CROSSJOIN':
$ret = (!$first ? ',' : '') . $ret;
break;
}
$joinStr = $this->m_joinon->toSql($query);
if($joinStr != '')
{
$ret .= ' ON ' . $joinStr;
}
return $ret;
}
示例9: DBGetTableKeys
if(!$show)
exit();
// security - end
// construct sql
$keys = DBGetTableKeys($table);
if(!count($keys))
exit();
$strkeywhere = "";
foreach($keys as $idx=>$k)
{
if(strlen($strkeywhere))
$strkeywhere.=" and ";
$strkeywhere.=AddTableWrappers($table).".".AddFieldWrappers($k)."=";
$type=WRGetFieldType($table.".".$k);
if(NeedQuotes($type))
$strkeywhere.=db_prepare_string(postvalue("key".($idx+1)));
else
{
$value=postvalue("key".($idx+1));
$strvalue = (string)$value;
$strvalue = str_replace(",",".",$strvalue);
if(is_numeric($strvalue))
$value=$strvalue;
else
$value=0;
$strkeywhere.=$value;
}
}
示例10: buildLookupSQL
function buildLookupSQL($field, $table, $parentVal, $childVal = "", $doCategoryFilter = true, $doValueFilter = false, $addCategoryField = false, $doWhereFilter = true, $oneRecordMode = false)
{
global $strTableName;
if (!strlen($table)) {
$table = $strTableName;
}
// read settings
$nLookupType = GetFieldData($table, $field, "LookupType", LT_LISTOFVALUES);
if ($nLookupType != LT_LOOKUPTABLE) {
return "";
}
$bUnique = GetFieldData($table, $field, "LookupUnique", false);
$strLookupWhere = LookupWhere($field, $table);
$strOrderBy = GetFieldData($table, $field, "LookupOrderBy", "");
$bDesc = GetFieldData($table, $field, "LookupDesc", false);
$strCategoryFilter = GetFieldData($table, $field, "CategoryFilter", "");
if ($doCategoryFilter) {
$parentVal = make_db_value(CategoryControl($field, $table), $parentVal);
}
if ($doValueFilter) {
$childVal = make_db_value($field, $childVal);
}
// build SQL string
$LookupSQL = "SELECT ";
if ($oneRecordMode) {
$LookupSQL .= "top 1 ";
}
if ($bUnique) {
$LookupSQL .= "DISTINCT ";
}
$LookupSQL .= GetLWLinkField($field, $table);
$LookupSQL .= "," . GetLWDisplayField($field, $table);
if ($addCategoryField && strlen($strCategoryFilter)) {
$LookupSQL .= "," . AddFieldWrappers($strCategoryFilter);
}
$LookupSQL .= " FROM " . AddTableWrappers(GetLookupTable($field, $table));
// build Where clause
$categoryWhere = "";
$childWhere = "";
if (UseCategory($field, $table) && $doCategoryFilter) {
$condition = "=" . $parentVal;
if ($childVal === "null") {
$condition = " is null";
}
$categoryWhere = AddFieldWrappers($strCategoryFilter) . $condition;
}
if ($doValueFilter) {
$condition = "=" . $childVal;
if ($childVal === "null") {
$condition = " is null";
}
$childWhere = AddFieldWrappers(GetLWLinkField($field, $table)) . $condition;
}
$strWhere = "";
if ($doWhereFilter && strlen($strLookupWhere)) {
$strWhere = "(" . $strLookupWhere . ")";
}
if (strlen($categoryWhere)) {
if (strlen($strWhere)) {
$strWhere .= " AND ";
}
$strWhere .= $categoryWhere;
}
if (strlen($childWhere)) {
if (strlen($strWhere)) {
$strWhere .= " AND ";
}
$strWhere .= $childWhere;
}
if (strlen($strWhere)) {
$LookupSQL .= " WHERE " . $strWhere;
}
// order by clause
if (strlen($strOrderBy)) {
$LookupSQL .= " ORDER BY " . AddTableWrappers(GetLookupTable($field, $table)) . "." . AddFieldWrappers($strOrderBy);
if ($bDesc) {
$LookupSQL .= " DESC";
}
}
return $LookupSQL;
}
示例11: GetEncryptedFieldName
/**
* Get an SQL expression retriving the encrypted field's value
* Please note, when changing this function you should make appropriate changes in wizard method (dynamic permissions --> add new user) #8923
* @param {string} field
* @param {string} alias
* @param {string} addAs
* @return {string}
*/
function GetEncryptedFieldName($field, $alias = null, $addAs = false)
{
$result = "";
$result = "cast(DES_DECRYPT(unhex(%s), '%s') as char)";
if($result == "")
return $field;
$result = mysprintf($result, array($field, $this->key));
return $addAs ? $result." as ".AddFieldWrappers($alias != null ? $alias : $field) : $result;
}
示例12: SQLWhere
//.........這裏部分代碼省略.........
}
if ($isSuggest || $strSearchOption == "Contains") {
$value = '%' . $value . '%';
}
if ($isSuggest || $strSearchOption == "Contains" || $strSearchOption == "Starts with" || $strSearchOption == "More than" || $strSearchOption == "Less than" || $strSearchOption == "Equal or more than" || $strSearchOption == "Equal or less than" || $strSearchOption == "Between" || $strSearchOption == "Equals" && $this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$value = $this->escapeSearchValForMySQL($value);
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value = $this->lookupPSet->isEnableUpper(db_prepare_string($value));
} else {
$value = db_prepare_string($value);
}
} else {
if ($strSearchOption == "Equals") {
$value = make_db_value($this->field, $value);
}
}
}
if ($strSearchOption == "Equals") {
if (!($value == "null" || $value == "Null")) {
if ($this->LCType == LCT_AJAX && !$this->linkAndDisplaySame) {
$condition = $gstrField . '=' . $value;
} else {
$condition = GetFullFieldName($this->field, "", false) . '=' . $value;
}
}
} else {
if ($strSearchOption == "Starts with" || $strSearchOption == "Contains" && !$this->multiselect) {
$condition = $gstrField . " " . $this->like . " " . $value;
} else {
if ($strSearchOption == "More than") {
$condition = $gstrField . " > " . $value;
} else {
if ($strSearchOption == "Less than") {
$condition = $gstrField . "<" . $value;
} else {
if ($strSearchOption == "Equal or more than") {
$condition = $gstrField . ">=" . $value1;
} else {
if ($strSearchOption == "Equal or less than") {
$condition = $gstrField . "<=" . $value1;
} else {
if ($strSearchOption == "Between") {
if ($this->lookupType == LT_QUERY && IsCharType($displayFieldType) && !$this->btexttype) {
$value2 = $this->lookupPSet->isEnableUpper(db_prepare_string($SearchFor2));
} else {
$value2 = db_prepare_string($SearchFor2);
}
$condition = $gstrField . ">=" . $value . " and ";
if (IsDateFieldType($this->type)) {
$timeArr = db2time($SearchFor2);
// for dates without time, add one day
if ($timeArr[3] == 0 && $timeArr[4] == 0 && $timeArr[5] == 0) {
$timeArr = adddays($timeArr, 1);
$SearchFor2 = $timeArr[0] . "-" . $timeArr[1] . "-" . $timeArr[2];
$SearchFor2 = add_db_quotes($this->field, $SearchFor2, $this->pageObject->tName);
$condition .= $gstrField . "<" . $SearchFor2;
} else {
$condition .= $gstrField . "<=" . $value2;
}
} else {
$condition .= $gstrField . "<=" . $value2;
}
} else {
if (strpos($value, ",") !== false || strpos($value, '"') !== false) {
$value = '"' . str_replace('"', '""', $value) . '"';
}
$value = $this->escapeSearchValForMySQL($value);
//for search by multiply Lookup wizard field
$ret .= GetFullFieldName($this->field, "", false) . " = " . db_prepare_string($value);
$ret .= " or " . GetFullFieldName($this->field, "", false) . " " . $this->like . " " . db_prepare_string("%," . $value . ",%");
$ret .= " or " . GetFullFieldName($this->field, "", false) . " " . $this->like . " " . db_prepare_string("%," . $value);
$ret .= " or " . GetFullFieldName($this->field, "", false) . " " . $this->like . " " . db_prepare_string($value . ",%");
}
}
}
}
}
}
}
if ($condition != "" && ($isSuggest || $strSearchOption == "Contains" || $strSearchOption == "Equals" || $strSearchOption == "Starts with" || $strSearchOption == "More than" || $strSearchOption == "Less than" || $strSearchOption == "Equal or more than" || $strSearchOption == "Equal or less than" || $strSearchOption == "Between")) {
if ($this->linkAndDisplaySame || $strSearchOption == "Equals" && $this->LCType != LCT_AJAX) {
$ret .= " " . $condition;
} else {
if ($this->lookupType == LT_QUERY) {
$lookupQueryObj = $this->lookupPSet->getSQLQuery();
$ret .= " EXISTS (" . $lookupQueryObj->toSql($condition . " and " . GetFullFieldName($this->linkFieldName, $this->lookupTable, false) . " = " . AddTableWrappers($this->pageObject->pSetEdit->getStrOriginalTableName()) . "." . AddFieldWrappers($this->field), '', null, false) . ")";
} else {
$ret .= " EXISTS (SELECT 1 as fld from " . AddTableWrappers($this->lookupTable) . " where " . $condition . " and " . $this->lwLinkField . " = " . AddTableWrappers($this->pageObject->pSetEdit->getStrOriginalTableName()) . "." . AddFieldWrappers($this->field) . ")";
}
}
}
}
}
if (strlen(trim($ret))) {
$ret = "(" . $ret . ")";
} else {
$ret = trim($ret);
}
return $ret;
}
示例13: GetFullFieldName
if ($strLookupWhere) {
$strLookupWhere = " (" . $strLookupWhere . ") AND ";
}
if ($LookupType == LT_QUERY) {
if ($gSettings->getCustomDisplay($f)) {
$strLookupWhere .= $displayFieldName;
} else {
$strLookupWhere .= GetFullFieldName($displayFieldName, $lookupTable, false);
}
} else {
$strLookupWhere .= $cipherer->GetFieldName($lwDisplayField, $f);
}
$strLookupWhere .= $cipherer->GetLikeClause($LookupType == LT_QUERY ? $displayFieldName : $f, $value);
if ($gSettings->useCategory($f) && (postvalue("category") != '' || postvalue('editMode') != MODE_SEARCH)) {
$cvalue = make_db_value($gSettings->getCategoryControl($f), postvalue("category"));
$strLookupWhere .= " AND " . AddFieldWrappers($gSettings->getCategoryFilter($f)) . "=" . $cvalue;
}
$lookupOrderBy = $gSettings->getLookupOrderBy($f);
if (strlen($lookupOrderBy)) {
$lookupOrderBy = GetFullFieldName($lookupOrderBy, $lookupTable);
if ($gSettings->isLookupDesc($f)) {
$lookupOrderBy .= ' DESC';
}
}
if ($LookupType == LT_QUERY) {
$LookupSQL = $lookupQueryObj->toSql(whereAdd($lookupQueryObj->m_where->toSql($lookupQueryObj), $strLookupWhere), strlen($lookupOrderBy) ? ' ORDER BY ' . $lookupOrderBy : null);
} else {
$LookupSQL = $LookupSQLTable . " where " . $strLookupWhere;
if (!$gSettings->isLookupUnique($f) || nDATABASE_Access != 4) {
if ($lookupOrderBy) {
$LookupSQL .= " ORDER BY " . $lookupOrderBy;
示例14: Chart
//.........這裏部分代碼省略.........
for ($j = 0; $j < count($this->chrt_array['fields']); $j++) {
if ($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'] == $this->chrt_array['fields'][$j]['name']) {
if ($this->table_type == "project") {
$this->label2 = $this->chart_xmlencode(GetFieldLabel($TableName, GoodFieldName($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name'])));
} else {
$this->label2 = $this->chart_xmlencode($this->chrt_array['parameters'][count($this->chrt_array['parameters']) - 1]['name']);
}
}
}
}
if ($this->chrt_array["chart_type"]["type"] != "ohlc" && $this->chrt_array["chart_type"]["type"] != "candlestick") {
foreach ($this->arrDataColor as $ind => $val) {
if ($ind == 0) {
$this->arrAxesColor = "#000000";
} else {
$this->arrAxesColor = "#" . $this->arrDataColor[$ind];
}
}
} else {
foreach ($this->arrOHLC_color as $ind => $val) {
if ($ind == 0) {
$this->arrAxesColor = "#000000";
} else {
$this->arrAxesColor = "#" . $this->arrOHLC_color[$ind];
}
}
}
// prepare search params
$gQuery = $this->pSet->getSQLQuery();
$strWhereClause = "";
$searchHavingClause = "";
$strSearchCriteria = "and";
global $strTableName;
// search where for basic charts
if (!$this->webchart) {
if (isset($_SESSION[$this->sessionPrefix . '_advsearch'])) {
$searchClauseObj = unserialize($_SESSION[$this->sessionPrefix . '_advsearch']);
include_once getabspath('classes/controls/EditControlsContainer.php');
$editControls = new EditControlsContainer(null, $this->pSet, PAGE_REPORT, $this->cipherer);
$strWhereClause = $searchClauseObj->getWhere($this->pSet->getListOfFieldsByExprType(false), $editControls);
$searchHavingClause = $searchClauseObj->getWhere($this->pSet->getListOfFieldsByExprType(true), $editControls);
$strSearchCriteria = @$_SESSION[$strTableName . "_criteria"];
if ($searchClauseObj->isUsedSearchFor && !$searchClauseObj->isUsedFieldsForSearch) {
$strSearchCriteria = "or";
}
}
} else {
if ($this->table_type != "project") {
$strTableName = "webchart" . $this->cname;
}
$strWhereClause = CalcSearchParam($this->table_type != "project");
}
if ($strWhereClause) {
$this->chrt_array['where'] .= $this->chrt_array['where'] ? " AND (" . $strWhereClause . ")" : " WHERE (" . $strWhereClause . ")";
}
if ($this->table_type == "project") {
if (SecuritySQL("Search")) {
$strWhereClause = whereAdd($strWhereClause, SecuritySQL("Search"));
}
$this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
$strOrderBy = $this->gstrOrderBy;
$this->strSQL .= " " . $strOrderBy;
$strSQLbak = $this->strSQL;
if (tableEventExists("BeforeQueryChart", $strTableName)) {
$tstrSQL = $this->strSQL;
$eventObj = getEventObject($strTableName);
$eventObj->BeforeQueryChart($tstrSQL, $strWhereClause, $strOrderBy);
$this->strSQL = $tstrSQL;
}
if ($strSQLbak == $this->strSQL) {
$this->strSQL = $gQuery->gSQLWhere($strWhereClause, $searchHavingClause, $strSearchCriteria);
$this->strSQL .= " " . $strOrderBy;
}
}
if ($this->cname && $this->table_type == "db") {
$this->strSQL = $this->chrt_array['sql'] . $this->chrt_array['where'] . $this->chrt_array['group_by'] . $this->chrt_array['order_by'];
} elseif ($this->cname && $this->table_type == "custom") {
if (!IsStoredProcedure($this->chrt_array['sql'])) {
$sql_query = $this->chrt_array['sql'];
if (GetDatabaseType() == 2) {
$pos = strrpos(strtoupper($sql_query), "ORDER BY");
if ($pos) {
$sql_query = substr($sql_query, 0, $pos);
}
}
if (GetDatabaseType() != 1) {
//Oracle
$this->strSQL = "select * from (" . $sql_query . ") as " . AddFieldWrappers("custom_query") . $this->chrt_array['where'];
} else {
$this->strSQL = "select * from (" . $sql_query . ")" . $this->chrt_array['where'];
}
} else {
$this->strSQL = $this->chrt_array['sql'];
}
}
if (tableEventExists("UpdateChartSettings", $strTableName)) {
$eventObj = getEventObject($strTableName);
$eventObj->UpdateChartSettings($this);
}
}
示例15: RunnerCipherer
{
$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];
redirectToLogin();
}
// check user permissions
if(!CheckTablePermissions($strTableName, "I"))
{
HeaderRedirect("menu");
}
$cipherer = new RunnerCipherer($strTableName);
$keys = array();
// keys array
$keys[] = AddFieldWrappers("id");
$keys_present=1;
$total_records=0;
$goodlines = 0;
// Create audit object
$auditObj = GetAuditObject($strTableName);
function getFieldNamesByHeaders($fields, $strOriginalTableName, $ext)
{
global $strTableName, $conn, $gSettings;
// check fields in column headers
// check that we have labes in column headers
$fieldsNotFoundArr = array();
$fNamesArr = array();