[Fusionforge-commits] r8150 - in trunk/gforge/common: include reporting
Roland Mas
lolando at libremir.placard.fr.eu.org
Wed Sep 23 17:17:57 CEST 2009
Author: lolando
Date: 2009-09-23 17:17:57 +0200 (Wed, 23 Sep 2009)
New Revision: 8150
Modified:
trunk/gforge/common/include/Group.class.php
trunk/gforge/common/include/User.class.php
trunk/gforge/common/reporting/report_utils.php
Log:
Removing non-portable ILIKE constructs in SQL
Modified: trunk/gforge/common/include/Group.class.php
===================================================================
--- trunk/gforge/common/include/Group.class.php 2009-09-23 15:17:36 UTC (rev 8149)
+++ trunk/gforge/common/include/Group.class.php 2009-09-23 15:17:57 UTC (rev 8150)
@@ -154,8 +154,8 @@
}
function &group_get_object_by_publicname($groupname) {
- $res=db_query_params ('SELECT * FROM groups WHERE group_name ILIKE $1',
- array (htmlspecialchars ($groupname))) ;
+ $res=db_query_params ('SELECT * FROM groups WHERE lower(group_name) LIKE $1',
+ array (htmlspecialchars (strtolower ($groupname)))) ;
return group_get_object(db_result($res,0,'group_id'),$res);
}
Modified: trunk/gforge/common/include/User.class.php
===================================================================
--- trunk/gforge/common/include/User.class.php 2009-09-23 15:17:36 UTC (rev 8149)
+++ trunk/gforge/common/include/User.class.php 2009-09-23 15:17:57 UTC (rev 8150)
@@ -844,8 +844,9 @@
}
if ($GLOBALS['sys_require_unique_email']) {
- if (db_numrows(db_query_params('SELECT user_id FROM users WHERE user_id!=$1 AND (email ILIKE $2 OR email_new ILIKE $2)',
- array ($this->getID(), $email))) > 0) {
+ if (db_numrows(db_query_params('SELECT user_id FROM users WHERE user_id!=$1 AND (lower(email) LIKE $2 OR lower(email_new) LIKE $2)',
+ array ($this->getID(),
+ strtolower($email)))) > 0) {
$this->setError(_('User with this email already exists.'));
return false;
}
@@ -896,8 +897,9 @@
}
if ($GLOBALS['sys_require_unique_email']) {
- if (db_numrows(db_query_params('SELECT user_id FROM users WHERE user_id!=$1 AND (email ILIKE $2 OR email_new ILIKE $2)',
- array ($this->getID(), $email))) > 0) {
+ if (db_numrows(db_query_params('SELECT user_id FROM users WHERE user_id!=$1 AND (lower(email) LIKE $2 OR lower(email_new) LIKE $2)',
+ array ($this->getID(),
+ strtolower($email)))) > 0) {
$this->setError(_('User with this email already exists.'));
return false;
}
Modified: trunk/gforge/common/reporting/report_utils.php
===================================================================
--- trunk/gforge/common/reporting/report_utils.php 2009-09-23 15:17:36 UTC (rev 8149)
+++ trunk/gforge/common/reporting/report_utils.php 2009-09-23 15:17:57 UTC (rev 8150)
@@ -103,10 +103,10 @@
if ( $sys_database_type == "mysql" ) {
$res = db_query_mysql ("SELECT user_id,realname FROM users WHERE status='A' AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) AND (lower(lastname) LIKE lower('$start_with%') OR lower(user_name) LIKE lower('$start_with%')) ORDER BY lastname") ;
} else {
- $res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) AND (lastname ILIKE $2 OR user_name ILIKE $3) ORDER BY lastname',
+ $res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) AND (lower(lastname) LIKE $2 OR lower(user_name) LIKE $3) ORDER BY lastname',
array ('A',
- "$start_with%",
- "$start_with%")) ;
+ strtolower("$start_with%"),
+ strtolower("$start_with%"))) ;
}
} else {
$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_user_act_daily WHERE user_id=users.user_id)) ORDER BY lastname',
@@ -122,10 +122,10 @@
if ( $sys_database_type == "mysql" ) {
$res = db_query_mysql ("SELECT user_id,realname FROM users WHERE status='A' AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) AND (lower(lastname) LIKE lower('$start_with%') OR lower(user_name) LIKE lower('$start_with%')) ORDER BY lastname") ;
} else {
- $res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) AND (lastname ILIKE $2 OR user_name ILIKE $3) ORDER BY lastname',
+ $res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) AND (lower(lastname) LIKE $2 OR lower(user_name) LIKE $3) ORDER BY lastname',
array ('A',
- "$start_with%",
- "$start_with%")) ;
+ strtolower("$start_with%"),
+ strtolower("$start_with%"))) ;
}
} else {
$res = db_query_params ('SELECT user_id,realname FROM users WHERE status=$1 AND (exists (SELECT user_id FROM rep_time_tracking WHERE user_id=users.user_id)) ORDER BY lastname',
More information about the Fusionforge-commits
mailing list