Passed
Push — master ( 6b7476...095fed )
by Cody
03:39
created

include/login_form.php (1 issue)

1
<?php startup_gettext(); ?>
0 ignored issues
show
Deprecated Code introduced by
The function startup_gettext() has been deprecated: Loaded in bootstrap ( Ignorable by Annotation )

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

1
<?php /** @scrutinizer ignore-deprecated */ startup_gettext(); ?>

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...
2
<!DOCTYPE html>
3
<html>
4
<head>
5
	<title>Tiny Tiny RSS : Login</title>
6
	<?php echo stylesheet_tag("css/default.css") ?>
7
	<link rel="shortcut icon" type="image/png" href="images/favicon.png">
8
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
9
	<?php
10
    foreach (array("lib/prototype.js",
11
                "lib/dojo/dojo.js",
12
                "lib/dojo/tt-rss-layer.js",
13
                "js/common.js",
14
                "errors.php?mode=js") as $jsfile) {
15
16
        echo javascript_tag($jsfile);
17
18
    } ?>
19
20
	<script type="text/javascript">
21
		require({cache:{}});
22
	</script>
23
</head>
24
25
<body class="flat ttrss_utility ttrss_login">
26
27
<script type="text/javascript">
28
require(['dojo/parser', "dojo/ready", 'dijit/form/Button','dijit/form/CheckBox', 'dijit/form/Form',
29
    'dijit/form/Select','dijit/form/TextBox','dijit/form/ValidationTextBox'],function(parser, ready){
30
        ready(function() {
31
            parser.parse();
32
33
            dijit.byId("bw_limit").attr("checked", Cookie.get("ttrss_bwlimit") == 'true');
34
            dijit.byId("login").focus();
35
        });
36
});
37
38
function fetchProfiles() {
39
    xhrJson("public.php", { op: "getprofiles", login: dijit.byId("login").attr('value') },
40
        (reply) => {
41
			const profile = dijit.byId('profile');
42
43
			profile.removeOption(profile.getOptions());
44
45
			reply.each((p) => {
46
				profile
47
        			.attr("disabled", false)
48
					.addOption(p);
49
			});
50
		});
51
}
52
53
function gotoRegForm() {
54
	window.location.href = "register.php";
55
	return false;
56
}
57
58
function bwLimitChange(elem) {
59
    Cookie.set("ttrss_bwlimit", elem.checked,
60
        <?php print SESSION_COOKIE_LIFETIME ?>);
61
}
62
</script>
63
64
<?php $return = urlencode(make_self_url()) ?>
65
66
<div class="container">
67
68
	<h1><?php echo "Authentication" ?></h1>
69
	<div class="content">
70
		<form action="public.php?return=<?php echo $return ?>"
71
			  dojoType="dijit.form.Form" method="POST">
72
73
			<?php print_hidden("op", "login"); ?>
74
75
			<?php if ($_SESSION["login_error_msg"]) { ?>
76
				<?php echo format_error($_SESSION["login_error_msg"]) ?>
77
				<?php $_SESSION["login_error_msg"] = ""; ?>
78
			<?php } ?>
79
80
			<fieldset>
81
				<label><?php echo __("Login:") ?></label>
82
				<input name="login" id="login" dojoType="dijit.form.TextBox" type="text"
83
					   onchange="fetchProfiles()" onfocus="fetchProfiles()" onblur="fetchProfiles()"
84
					   required="1" value="<?php echo $_SESSION["fake_login"] ?>" />
85
			</fieldset>
86
87
			<fieldset>
88
				<label><?php echo __("Password:") ?></label>
89
90
				<input type="password" name="password" required="1"
91
					   dojoType="dijit.form.TextBox"
92
					   class="input input-text"
93
					   value="<?php echo $_SESSION["fake_password"] ?>"/>
94
			</fieldset>
95
			<?php if (strpos(PLUGINS, "auth_internal") !== false) { ?>
96
				<fieldset class="align-right">
97
					<a href="public.php?op=forgotpass"><?php echo __("I forgot my password") ?></a>
98
				</fieldset>
99
			<?php } ?>
100
101
			<fieldset>
102
				<label><?php echo __("Profile:") ?></label>
103
104
				<select disabled='disabled' name="profile" id="profile" dojoType='dijit.form.Select'>
105
					<option><?php echo __("Default profile") ?></option>
106
				</select>
107
			</fieldset>
108
109
			<fieldset class="narrow">
110
				<label> </label>
111
112
				<label id="bw_limit_label"><input dojoType="dijit.form.CheckBox" name="bw_limit" id="bw_limit"
113
					  type="checkbox" onchange="bwLimitChange(this)">
114
					<?php echo __("Use less traffic") ?></label>
115
			</fieldset>
116
117
			<div dojoType="dijit.Tooltip" connectId="bw_limit_label" position="below" style="display:none">
118
				<?php echo __("Does not display images in articles, reduces automatic refreshes."); ?>
119
			</div>
120
121
			<?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
122
123
				<fieldset class="narrow">
124
					<label> </label>
125
					<label>
126
						<input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
127
						<?php echo __("Remember me") ?>
128
					</label>
129
				</fieldset>
130
131
			<?php } ?>
132
133
			<hr/>
134
135
			<fieldset class="align-right">
136
				<label> </label>
137
138
				<button dojoType="dijit.form.Button" type="submit" class="alt-primary"><?php echo __('Log in') ?></button>
139
140
				<?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
141
					<button onclick="return gotoRegForm()" dojoType="dijit.form.Button">
142
						<?php echo __("Create new account") ?></button>
143
				<?php } ?>
144
			</fieldset>
145
146
		</form>
147
	</div>
148
149
	<div class="footer">
150
		<a href="https://tt-rss.org/">Tiny Tiny RSS</a>
151
		&copy; 2005&ndash;<?php echo date('Y') ?> <a href="https://fakecake.org/">Andrew Dolgov</a>
152
	</div>
153
154
</div>
155
156
</body>
157
</html>
158