From 610e22f948b8ab91bcd6467e21dd89d148f641f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=94=E4=BB=A4=E8=8C=82?= Date: Tue, 27 Dec 2022 08:45:32 +0000 Subject: [PATCH] * Optimize code. --- config/config.php | 6 +++--- lib/base/dao/dao.class.php | 15 ++++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/config/config.php b/config/config.php index 9f4aa87bf3..ef15acd093 100644 --- a/config/config.php +++ b/config/config.php @@ -130,9 +130,9 @@ $config->framework->sendXDO = true; // Send X-Download-Options header. $config->framework->detectDevice['zh-cn'] = true; // 在zh-cn语言情况下,是否启用设备检测功能。 Whether enable device detect or not. $config->framework->detectDevice['zh-tw'] = true; // 在zh-tw语言情况下,是否启用设备检测功能。 Whether enable device detect or not. $config->framework->detectDevice['en'] = true; // 在en语言情况下,是否启用设备检测功能。 Whether enable device detect or not. -$config->framework->detectDevice['de'] = true; // 在en语言情况下,是否启用设备检测功能。 Whether enable device detect or not. -$config->framework->detectDevice['fr'] = true; // 在en语言情况下,是否启用设备检测功能。 Whether enable device detect or not. -$config->framework->detectDevice['vi'] = true; // 在en语言情况下,是否启用设备检测功能。 Whether enable device detect or not. +$config->framework->detectDevice['de'] = true; // 在de语言情况下,是否启用设备检测功能。 Whether enable device detect or not. +$config->framework->detectDevice['fr'] = true; // 在fr语言情况下,是否启用设备检测功能。 Whether enable device detect or not. +$config->framework->detectDevice['vi'] = true; // 在vi语言情况下,是否启用设备检测功能。 Whether enable device detect or not. /* IP white list settings.*/ $config->ipWhiteList = '*'; diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index d6bb835790..0a54dbb5ec 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -497,6 +497,7 @@ class baseDAO * Set the data to update or insert. * * @param object $data the data object or array + * @param string $skipFields the skip fields * @access public * @return static|sql the dao object self. */ @@ -541,7 +542,7 @@ class baseDAO } /** - * 查看SQL索引。 + * 解析SQL语句。 * Explain sql. * * @param string $sql @@ -577,7 +578,7 @@ class baseDAO $sql = sprintf($this->sqlobj->get(), $this->fields, $this->table); } - /* If the method if select, update or delete, set the lang condition. */ + /* If the method is select, update or delete, set the lang condition. */ if($this->autoLang and $this->table != '' and $this->method != 'insert' and $this->method != 'replace') { $lang = $this->app->getClientLang(); @@ -588,18 +589,18 @@ class baseDAO $havingPOS = strrpos($sql, DAO::HAVING); // The position of HAVING keyword. $orderPOS = strrpos($sql, DAO::ORDERBY); // The position of ORDERBY keyword. $limitPOS = strrpos($sql, DAO::LIMIT); // The position of LIMIT keyword. - $splitPOS = $orderPOS ? $orderPOS : $limitPOS; // If $orderPOS, use it instead of $limitPOS. - $splitPOS = $havingPOS? $havingPOS: $splitPOS; // If $havingPOS, use it instead of $orderPOS. - $splitPOS = $groupPOS ? $groupPOS : $splitPOS; // If $groupPOS, use it instead of $havingPOS. + $splitPOS = $orderPOS ? $orderPOS : $limitPOS; // If $orderPOS, use it instead of $limitPOS. + $splitPOS = $havingPOS ? $havingPOS : $splitPOS; // If $havingPOS, use it instead of $orderPOS. + $splitPOS = $groupPOS ? $groupPOS : $splitPOS; // If $groupPOS, use it instead of $havingPOS. - /* Set the conditon to be appened. */ + /* Set the condition to be appended. */ $tableName = !empty($this->alias) ? $this->alias : $this->table; if(!empty($this->app->config->cn2tw)) $lang = str_replace('zh-tw', 'zh-cn', $lang); $langCondition = " $tableName.lang in('{$lang}', 'all') "; - /* If $spliPOS > 0, split the sql at $splitPOS. */ + /* If $splitPOS > 0, split the sql at $splitPOS. */ if($splitPOS) { $firstPart = substr($sql, 0, $splitPOS);