Skip to content

Commit 6079edf

Browse files
committed
Imporoved isTrue function to get rid of PHP warnings.
1 parent e40a312 commit 6079edf

10 files changed

Lines changed: 28 additions & 28 deletions

File tree

WEB-INF/lib/Auth.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function isPasswordExternal()
6464
function doLogin($login, $password) {
6565
$auth = $this->authenticate($login, $password);
6666

67-
if (isTrue(AUTH_DEBUG)) {
67+
if (isTrue('AUTH_DEBUG')) {
6868
echo '<br>'; var_dump($auth); echo '<br />';
6969
}
7070

@@ -77,13 +77,13 @@ function doLogin($login, $password) {
7777
$sql = "SELECT id FROM tt_users WHERE login = ".$mdb2->quote($login)." AND status = 1";
7878
$res = $mdb2->query($sql);
7979
if (is_a($res, 'PEAR_Error')) {
80-
if (isTrue(AUTH_DEBUG))
80+
if (isTrue('AUTH_DEBUG'))
8181
echo 'db error!<br />';
8282
return false;
8383
}
8484
$val = $res->fetchRow();
8585
if (!$val['id']) {
86-
if (isTrue(AUTH_DEBUG))
86+
if (isTrue('AUTH_DEBUG'))
8787
echo 'login "'.$login.'" does not exist in Time Tracker database.<br />';
8888
return false;
8989
}

WEB-INF/lib/auth/Auth_db.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function authenticate($login, $password)
5757
return array('login'=>$login,'id'=>$val['id']);
5858
} else {
5959
// If the OLD_PASSWORDS option is defined - set it.
60-
if (isTrue(OLD_PASSWORDS)) {
60+
if (isTrue('OLD_PASSWORDS')) {
6161
$sql = "SET SESSION old_passwords = 1";
6262
$res = $mdb2->query($sql);
6363
if (is_a($res, 'PEAR_Error')) {

WEB-INF/lib/auth/Auth_ldap.class.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function authenticate($login, $password)
9696

9797
$lc = ldap_connect($this->params['server']);
9898

99-
if (isTrue(AUTH_DEBUG)) {
99+
if (isTrue('AUTH_DEBUG')) {
100100
echo '<br />';
101101
echo '$lc='; var_dump($lc); echo '<br />';
102102
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
@@ -106,7 +106,7 @@ function authenticate($login, $password)
106106

107107
ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, 3);
108108
ldap_set_option($lc, LDAP_OPT_REFERRALS, 0);
109-
if (isTrue(AUTH_DEBUG)) {
109+
if (isTrue('AUTH_DEBUG')) {
110110
ldap_set_option($lc, LDAP_OPT_DEBUG_LEVEL, 7);
111111
}
112112

@@ -119,13 +119,13 @@ function authenticate($login, $password)
119119
$login .= '@' . $this->params['default_domain'];
120120
}
121121

122-
if (isTrue(AUTH_DEBUG)) {
122+
if (isTrue('AUTH_DEBUG')) {
123123
echo '$login='; var_dump($login); echo '<br />';
124124
}
125125

126126
$lb = @ldap_bind($lc, $login, $password);
127127

128-
if (isTrue(AUTH_DEBUG)) {
128+
if (isTrue('AUTH_DEBUG')) {
129129
echo '$lb='; var_dump($lb); echo '<br />';
130130
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
131131
}
@@ -142,7 +142,7 @@ function authenticate($login, $password)
142142
$fields = array('memberof');
143143
$sr = @ldap_search($lc, $this->params['base_dn'], $filter, $fields);
144144

145-
if (isTrue(AUTH_DEBUG)) {
145+
if (isTrue('AUTH_DEBUG')) {
146146
echo '$sr='; var_dump($sr); echo '<br />';
147147
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
148148
}
@@ -154,7 +154,7 @@ function authenticate($login, $password)
154154

155155
$entries = @ldap_get_entries($lc, $sr);
156156

157-
if (isTrue(AUTH_DEBUG)) {
157+
if (isTrue('AUTH_DEBUG')) {
158158
echo '$entries='; var_dump($entries); echo '<br />';
159159
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
160160
}
@@ -173,7 +173,7 @@ function authenticate($login, $password)
173173
$groups[] = substr($grp_fields[0], 3);
174174
}
175175

176-
if (isTrue(AUTH_DEBUG)) {
176+
if (isTrue('AUTH_DEBUG')) {
177177
echo '$member_of'; var_dump($member_of); echo '<br />';
178178
};
179179

@@ -195,7 +195,7 @@ function authenticate($login, $password)
195195
// Assuming OpenLDAP server.
196196
$login_oldap = 'uid='.$login.','.$this->params['base_dn'];
197197

198-
if (isTrue(AUTH_DEBUG)) {
198+
if (isTrue('AUTH_DEBUG')) {
199199
echo '$login_oldap='; var_dump($login_oldap); echo '<br />';
200200
}
201201

@@ -207,7 +207,7 @@ function authenticate($login, $password)
207207

208208
$lb = @ldap_bind($lc, $login_oldap, $password);
209209

210-
if (isTrue(AUTH_DEBUG)) {
210+
if (isTrue('AUTH_DEBUG')) {
211211
echo '$lb='; var_dump($lb); echo '<br />';
212212
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
213213
}
@@ -225,7 +225,7 @@ function authenticate($login, $password)
225225
$fields = array('samaccountname', 'mail', 'memberof', 'department', 'displayname', 'telephonenumber', 'primarygroupid');
226226
$sr = @ldap_search($lc, $this->params['base_dn'], $filter, $fields);
227227

228-
if (isTrue(AUTH_DEBUG)) {
228+
if (isTrue('AUTH_DEBUG')) {
229229
echo '$sr='; var_dump($sr); echo '<br />';
230230
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
231231
}
@@ -238,7 +238,7 @@ function authenticate($login, $password)
238238

239239
$entries = @ldap_get_entries($lc, $sr);
240240

241-
if (isTrue(AUTH_DEBUG)) {
241+
if (isTrue('AUTH_DEBUG')) {
242242
echo '$entries='; var_dump($entries); echo '<br />';
243243
echo 'ldap_error()='; echo ldap_error($lc); echo '<br />';
244244
}
@@ -258,7 +258,7 @@ function authenticate($login, $password)
258258
$groups[] = substr($grp_fields[0], 3);
259259
}
260260

261-
if (isTrue(AUTH_DEBUG)) {
261+
if (isTrue('AUTH_DEBUG')) {
262262
echo '$member_of'; var_dump($member_of); echo '<br />';
263263
}
264264

WEB-INF/lib/common.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function check_extension($ext)
165165
// isTrue is a helper function to return correct false for older config.php values defined as a string 'false'.
166166
function isTrue($val)
167167
{
168-
return ($val === true);
168+
return (defined($val) && constant($val) === true);
169169
}
170170

171171
// ttValidString is used to check user input to validate a string.

WEB-INF/lib/mail/Mailer.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function send($subject, $data) {
104104
$port = defined('MAIL_SMTP_PORT') ? MAIL_SMTP_PORT : '25';
105105
$username = defined('MAIL_SMTP_USER') ? MAIL_SMTP_USER : null;
106106
$password = defined('MAIL_SMTP_PASSWORD') ? MAIL_SMTP_PASSWORD : null;
107-
$auth = isTrue(MAIL_SMTP_AUTH);
108-
$debug = isTrue(MAIL_SMTP_DEBUG);
107+
$auth = isTrue('MAIL_SMTP_AUTH');
108+
$debug = isTrue('MAIL_SMTP_DEBUG');
109109

110110
$mail = Mail::factory('smtp', array ('host' => $host,
111111
'port' => $port,
@@ -116,7 +116,7 @@ function send($subject, $data) {
116116
break;
117117
}
118118

119-
if (isTrue(MAIL_SMTP_DEBUG))
119+
if (isTrue('MAIL_SMTP_DEBUG'))
120120
PEAR::setErrorHandling(PEAR_ERROR_PRINT);
121121

122122
$res = $mail->send($recipients, $headers, $data);

WEB-INF/templates/footer.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<br>
1313
<table cellspacing="0" cellpadding="4" width="100%" border="0">
1414
<tr>
15-
<td align="center">&nbsp;Anuko Time Tracker 1.18.36.4706 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
15+
<td align="center">&nbsp;Anuko Time Tracker 1.18.36.4707 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
1616
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
1717
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
1818
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>

login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
}
7676
} // isPost
7777

78-
if(!isTrue(MULTITEAM_MODE) && !ttOrgHelper::getOrgs())
78+
if(!isTrue('MULTITEAM_MODE') && !ttOrgHelper::getOrgs())
7979
$err->add($i18n->get('error.no_groups'));
8080

8181
// Determine whether to show login hint. It is currently used only for Windows LDAP authentication.

mobile/login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
}
8181
} // isPost
8282

83-
if(!isTrue(MULTITEAM_MODE) && !ttOrgHelper::getOrgs())
83+
if(!isTrue('MULTITEAM_MODE') && !ttOrgHelper::getOrgs())
8484
$err->add($i18n->get('error.no_groups'));
8585

8686
// Determine whether to show login hint. It is currently used only for Windows LDAP authentication.

register.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
require_once('initialize.php');
3030
import('form.Form');
3131

32-
if (!isTrue(MULTITEAM_MODE) || $auth->isPasswordExternal()) {
32+
if (!isTrue('MULTITEAM_MODE') || $auth->isPasswordExternal()) {
3333
header('Location: login.php');
3434
exit();
3535
}

tofile.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
print "\t<".$group_by_tag."><![CDATA[".$subtotal['name']."]]></".$group_by_tag.">\n";
9595
if ($bean->getAttribute('chduration')) {
9696
$val = $subtotal['time'];
97-
if($val && isTrue(EXPORT_DECIMAL_DURATION))
97+
if($val && isTrue('EXPORT_DECIMAL_DURATION'))
9898
$val = time_to_decimal($val);
9999
print "\t<duration><![CDATA[".$val."]]></duration>\n";
100100
}
@@ -126,7 +126,7 @@
126126
if ($bean->getAttribute('chfinish')) print "\t<finish><![CDATA[".$item['finish']."]]></finish>\n";
127127
if ($bean->getAttribute('chduration')) {
128128
$duration = $item['duration'];
129-
if($duration && isTrue(EXPORT_DECIMAL_DURATION))
129+
if($duration && isTrue('EXPORT_DECIMAL_DURATION'))
130130
$duration = time_to_decimal($duration);
131131
print "\t<duration><![CDATA[".$duration."]]></duration>\n";
132132
}
@@ -179,7 +179,7 @@
179179
print '"'.$subtotal['name'].'"';
180180
if ($bean->getAttribute('chduration')) {
181181
$val = $subtotal['time'];
182-
if($val && isTrue(EXPORT_DECIMAL_DURATION))
182+
if($val && isTrue('EXPORT_DECIMAL_DURATION'))
183183
$val = time_to_decimal($val);
184184
print ',"'.$val.'"';
185185
}
@@ -223,7 +223,7 @@
223223
if ($bean->getAttribute('chfinish')) print ',"'.$item['finish'].'"';
224224
if ($bean->getAttribute('chduration')) {
225225
$val = $item['duration'];
226-
if($val && isTrue(EXPORT_DECIMAL_DURATION))
226+
if($val && isTrue('EXPORT_DECIMAL_DURATION'))
227227
$val = time_to_decimal($val);
228228
print ',"'.$val.'"';
229229
}

0 commit comments

Comments
 (0)