Issues (1268)

register.php (21 issues)

1
<!DOCTYPE html>
2
<html>
3
<head>
4
<title>Create new account</title>
5
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
<?php echo stylesheet_tag("css/default.css") ?>
0 ignored issues
show
Deprecated Code introduced by
The function stylesheet_tag() has been deprecated: Use Twig filter cssTag ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

6
<?php echo /** @scrutinizer ignore-deprecated */ stylesheet_tag("css/default.css") ?>

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
Are you sure the usage of stylesheet_tag('css/default.css') is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
7
<?php echo javascript_tag("js/common.js") ?>
0 ignored issues
show
Are you sure the usage of javascript_tag('js/common.js') is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Deprecated Code introduced by
The function javascript_tag() has been deprecated: Use Twig filter jsTag ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

7
<?php echo /** @scrutinizer ignore-deprecated */ javascript_tag("js/common.js") ?>

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
8
<?php echo javascript_tag("lib/prototype.js") ?>
0 ignored issues
show
Deprecated Code introduced by
The function javascript_tag() has been deprecated: Use Twig filter jsTag ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

8
<?php echo /** @scrutinizer ignore-deprecated */ javascript_tag("lib/prototype.js") ?>

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
Are you sure the usage of javascript_tag('lib/prototype.js') is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
9
<?php echo javascript_tag("lib/scriptaculous/scriptaculous.js?load=effects,controls") ?>
0 ignored issues
show
Are you sure the usage of javascript_tag('lib/scri...load=effects,controls') is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Deprecated Code introduced by
The function javascript_tag() has been deprecated: Use Twig filter jsTag ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

9
<?php echo /** @scrutinizer ignore-deprecated */ javascript_tag("lib/scriptaculous/scriptaculous.js?load=effects,controls") ?>

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
10
</head>
11
12
<script type="text/javascript">
13
14
	public function checkUsername() {
15
16
		try {
17
			var f = document.forms['register_form'];
18
			var login = f.login.value;
19
20
			if (login == "") {
21
				new Effect.Highlight(f.login);
22
				f.sub_btn.disabled = true;
23
				return false;
24
			}
25
26
			var query = "register.php?action=check&login=" +
27
					encodeURIComponent(login);
28
29
			new Ajax.Request(query, {
30
				onComplete: function(transport) {
31
32
					try {
33
34
						var reply = transport.responseXML;
35
36
						var result = reply.getElementsByTagName('result')[0];
37
						var result_code = result.firstChild.nodeValue;
38
39
						if (result_code == 0) {
40
							new Effect.Highlight(f.login, {startcolor : '#00ff00'});
41
							f.sub_btn.disabled = false;
42
						} else {
43
							new Effect.Highlight(f.login, {startcolor : '#ff0000'});
44
							f.sub_btn.disabled = true;
45
						}
46
					} catch (e) {
47
						App.Error.report(e);
48
					}
49
50
				} });
51
52
		} catch (e) {
53
			App.Error.report(e);
54
		}
55
56
		return false;
57
58
	}
59
60
	public function validateRegForm() {
61
		try {
62
63
			var f = document.forms['register_form'];
64
65
			if (f.login.value.length == 0) {
66
				new Effect.Highlight(f.login);
67
				return false;
68
			}
69
70
			if (f.email.value.length == 0) {
71
				new Effect.Highlight(f.email);
72
				return false;
73
			}
74
75
			if (f.turing_test.value.length == 0) {
76
				new Effect.Highlight(f.turing_test);
77
				return false;
78
			}
79
80
			return true;
81
82
		} catch (e) {
83
			alert(e.stack);
84
			return false;
85
		}
86
	}
87
88
</script>
89
90
<body class="claro ttrss_utility">
91
92
<h1><?php echo __("Create new account") ?></h1>
93
94
<div class="content">
95
96
<?php
97
        if (!ENABLE_REGISTRATION) {
0 ignored issues
show
The constant ENABLE_REGISTRATION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
98
            print_error(__("New user registrations are administratively disabled."));
0 ignored issues
show
Deprecated Code introduced by
The function print_error() has been deprecated: Use twig function errorMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

98
            /** @scrutinizer ignore-deprecated */ print_error(__("New user registrations are administratively disabled."));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
The call to print_error() has too many arguments starting with __('New user registratio...istratively disabled.'). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

98
            /** @scrutinizer ignore-call */ 
99
            print_error(__("New user registrations are administratively disabled."));

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
99
100
            print "<p><form method=\"GET\" action=\"backend.php\">
101
				<input type=\"hidden\" name=\"op\" value=\"logout\">
102
				<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
103
				</form>";
104
            return;
105
        }
106
?>
107
108
<?php if (REG_MAX_USERS > 0) {
0 ignored issues
show
The constant REG_MAX_USERS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
109
        $result = db_query("SELECT COUNT(*) AS cu FROM ttrss_users");
110
        $num_users = db_fetch_result($result, 0, "cu");
111
} ?>
112
113
<?php if (!REG_MAX_USERS || $num_users < REG_MAX_USERS) { ?>
114
115
	<!-- If you have any rules or ToS you'd like to display, enter them here -->
116
117
	<?php	if (file_exists("templates/register_notice.txt")) {
118
            require_once "templates/register_notice.txt";
119
    } ?>
120
121
	<?php if (!$action) { ?>
122
123
	<p><?php echo __('Your temporary password will be sent to the specified email. Accounts, which were not logged in once, are erased automatically 24 hours after temporary password is sent.') ?></p>
124
125
	<form action="register.php" method="POST" name="register_form">
126
	<input type="hidden" name="action" value="do_register">
127
	<table>
128
	<tr>
129
	<td><?php echo __('Desired login:') ?></td><td>
130
		<input name="login" required>
131
	</td><td>
132
		<input type="submit" value="<?php echo __('Check availability') ?>" onclick='return checkUsername()'>
133
	</td></tr>
134
	<tr><td><?php echo __('Email:') ?></td><td>
135
		<input name="email" type="email" required>
136
	</td></tr>
137
	<tr><td><?php echo __('How much is two plus two:') ?></td><td>
138
		<input name="turing_test" required></td></tr>
139
	<tr><td colspan="2" align="right">
140
	<input type="submit" name="sub_btn" value="<?php echo __('Submit registration') ?>"
141
			disabled="disabled" onclick='return validateRegForm()'>
142
	</td></tr>
143
	</table>
144
	</form>
145
146
	<?php print "<p><form method=\"GET\" action=\"index.php\">
147
				<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
148
				</form>"; ?>
149
150
	<?php } else if ($action == "do_register") { ?>
151
152
	<?php
153
        $login = mb_strtolower(trim(db_escape_string($_REQUEST["login"])));
154
        $email = trim(db_escape_string($_REQUEST["email"]));
155
        $test = trim(db_escape_string($_REQUEST["turing_test"]));
156
157
        if (!$login || !$email || !$test) {
158
            print_error(__("Your registration information is incomplete."));
0 ignored issues
show
Deprecated Code introduced by
The function print_error() has been deprecated: Use twig function errorMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

158
            /** @scrutinizer ignore-deprecated */ print_error(__("Your registration information is incomplete."));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
159
            print "<p><form method=\"GET\" action=\"index.php\">
160
				<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
161
				</form>";
162
            return;
163
        }
164
165
        if ($test == "four" || $test == "4") {
166
                $password = make_password();
167
168
                $salt = substr(bin2hex(get_random_bytes(125)), 0, 250);
169
                $pwd_hash = encrypt_password($password, $salt, true);
170
171
                db_query("INSERT INTO ttrss_users
172
					(login,pwd_hash,access_level,last_login, email, created, salt)
173
					VALUES ('$login', '$pwd_hash', 0, null, '$email', NOW(), '$salt')");
174
175
                $result = db_query("SELECT id FROM ttrss_users WHERE
176
					login = '$login' AND pwd_hash = '$pwd_hash'");
177
178
                if (db_num_rows($result) != 1) {
179
                    print_error(__('Registration failed.'));
0 ignored issues
show
Deprecated Code introduced by
The function print_error() has been deprecated: Use twig function errorMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

179
                    /** @scrutinizer ignore-deprecated */ print_error(__('Registration failed.'));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
180
                    print "<p><form method=\"GET\" action=\"index.php\">
181
					<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
182
					</form>";
183
                } else {
184
185
                    $new_uid = db_fetch_result($result, 0, "id");
186
187
                    initialize_user($new_uid);
188
189
                    $reg_text = "Hi!\n".
190
                        "\n".
191
                        "You are receiving this message, because you (or somebody else) have opened\n".
192
                        "an account at Tiny Tiny RSS.\n".
193
                        "\n".
194
                        "Your login information is as follows:\n".
195
                        "\n".
196
                        "Login: $login\n".
197
                        "Password: $password\n".
198
                        "\n".
199
                        "Don't forget to login at least once to your new account, otherwise\n".
200
                        "it will be deleted in 24 hours.\n".
201
                        "\n".
202
                        "If that wasn't you, just ignore this message. Thanks.";
203
204
                    $mailer = new Mailer();
205
                    $rc = $mailer->mail(["to_address" => $email,
206
                        "subject" => "Registration information for Tiny Tiny RSS",
207
                        "message" => $reg_text]);
208
209
                    if (!$rc) {
210
                        print_error($mailer->error());
0 ignored issues
show
Deprecated Code introduced by
The function print_error() has been deprecated: Use twig function errorMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

210
                        /** @scrutinizer ignore-deprecated */ print_error($mailer->error());

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
211
                    }
212
213
                    $reg_text = "Hi!\n".
214
                        "\n".
215
                        "New user had registered at your Tiny Tiny RSS installation.\n".
216
                        "\n".
217
                        "Login: $login\n".
218
                        "Email: $email\n";
219
220
                    $mailer = new Mailer();
221
                    $rc = $mailer->mail(["to_address" => REG_NOTIFY_ADDRESS,
0 ignored issues
show
The constant REG_NOTIFY_ADDRESS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
222
                        "subject" => "Registration notice for Tiny Tiny RSS",
223
                        "message" => $reg_text]);
224
225
                    if (!$rc) {
226
                        print_error($mailer->error());
0 ignored issues
show
Deprecated Code introduced by
The function print_error() has been deprecated: Use twig function errorMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

226
                        /** @scrutinizer ignore-deprecated */ print_error($mailer->error());

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
227
                    }
228
229
                    print_notice(__("Account created successfully."));
0 ignored issues
show
The call to print_notice() has too many arguments starting with __('Account created successfully.'). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

229
                    /** @scrutinizer ignore-call */ 
230
                    print_notice(__("Account created successfully."));

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
Deprecated Code introduced by
The function print_notice() has been deprecated: Use twig function noticeMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

229
                    /** @scrutinizer ignore-deprecated */ print_notice(__("Account created successfully."));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
230
231
                    print "<p><form method=\"GET\" action=\"index.php\">
232
					<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
233
					</form>";
234
235
                }
236
237
            } else {
238
                print_error('Plese check the form again, you have failed the robot test.');
0 ignored issues
show
Deprecated Code introduced by
The function print_error() has been deprecated: Use twig function errorMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

238
                /** @scrutinizer ignore-deprecated */ print_error('Plese check the form again, you have failed the robot test.');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
239
                print "<p><form method=\"GET\" action=\"index.php\">
240
				<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
241
				</form>";
242
243
            }
244
        }
245
    ?>
246
247
<?php } else { ?>
248
249
	<?php print_notice(__('New user registrations are currently closed.')) ?>
0 ignored issues
show
Deprecated Code introduced by
The function print_notice() has been deprecated: Use twig function noticeMessage ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

249
	<?php /** @scrutinizer ignore-deprecated */ print_notice(__('New user registrations are currently closed.')) ?>

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
250
251
	<?php print "<p><form method=\"GET\" action=\"index.php\">
252
				<input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
253
				</form>"; ?>
254
255
<?php } ?>
256
257
	</div>
258
259
</body>
260
</html>
261