speedealing /htdocs/core/tpl/login.tpl.php

Language PHP Lines 368
MD5 Hash 554c08e4fc0c61aac7fe7ed85411d916 Estimated Cost $752 (why?)
Repository https://bitbucket.org/speedealing/speedealing.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<?php
/* Copyright (C) 2009-2013 Regis Houssin 		<regis.houssin@capnetworks.com>
 * Copyright (C) 2011-2012 Laurent Destailleur 	<eldy@users.sourceforge.net>
 * Copyright (C) 2011-2013 Herve Prot			<herve.prot@symeos.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=" . $conf->file->character_set_client);
?>
<!DOCTYPE html>

<!--[if IEMobile 7]><html class="no-js iem7 oldie linen"><![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js ie7 oldie linen" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js ie8 oldie linen" lang="en"><![endif]-->
<!--[if (IE 9)&!(IEMobile)]><html class="no-js ie9 linen" lang="en"><![endif]-->
<!--[if (gt IE 9)|(gt IEMobile 7)]><!--><html class="no-js linen" lang="en"><!--<![endif]-->

	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="robots" content="noindex,nofollow" />
		<meta name="author" content="Speedealing Development Team" />
		<base href="http://<?php echo $_SERVER['HTTP_HOST'] . DOL_URL_ROOT; ?>/" />

		<title><?php echo $langs->trans('Login') . ' ' . $title; ?></title>
		<meta name="description" content="">

		<!-- http://davidbcalhoun.com/2010/viewport-metatag -->
		<meta name="HandheldFriendly" content="True" />
		<meta name="MobileOptimized" content="320" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

		<!-- For all browsers -->
		<link rel="stylesheet" href="theme/symeos/css/reset.css?v=1">
		<link rel="stylesheet" href="theme/symeos/css/style.css?v=1">
		<link rel="stylesheet" href="theme/symeos/css/colors.css?v=1">
		<link rel="stylesheet" media="print" href="theme/symeos/css/print.css?v=1">
		<!-- For progressively larger displays -->
		<link rel="stylesheet" media="only all and (min-width: 480px)" href="theme/symeos/css/480.css?v=1">
		<link rel="stylesheet" media="only all and (min-width: 768px)" href="theme/symeos/css/768.css?v=1">
		<link rel="stylesheet" media="only all and (min-width: 992px)" href="theme/symeos/css/992.css?v=1">
		<link rel="stylesheet" media="only all and (min-width: 1200px)" href="theme/symeos/css/1200.css?v=1">
		<!-- For Retina displays -->
		<link rel="stylesheet" media="only all and (-webkit-min-device-pixel-ratio: 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (min-device-pixel-ratio: 1.5)" href="theme/symeos/css/2x.css?v=1">

		<!-- Additional styles -->
		<link rel="stylesheet" href="theme/symeos/css/styles/form.css?v=1">
		<link rel="stylesheet" href="theme/symeos/css/styles/switches.css?v=1">

		<!-- Login pages styles -->
		<link rel="stylesheet" media="screen" href="theme/symeos/css/login.css?v=1">

		<!-- JavaScript at bottom except for Modernizr -->
		<script src="includes/js/modernizr.custom.js"></script>

		<!-- For Modern Browsers -->
		<link rel="shortcut icon" href="favicon.png">
		<!-- For everything else -->
		<link rel="shortcut icon" href="favicon.ico">
		<!-- For retina screens -->
		<link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-retina.png">
		<!-- For iPad 1-->
		<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-ipad.png">
		<!-- For iPhone 3G, iPod Touch and Android -->
		<link rel="apple-touch-icon-precomposed" href="apple-touch-icon.png">

		<!-- iOS web-app metas -->
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />

		<!-- Startup image for web apps -->
		<!--<link rel="apple-touch-startup-image" href="theme/developr/html/img/splash/ipad-landscape.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
		<link rel="apple-touch-startup-image" href="theme/developr/html/img/splash/ipad-portrait.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
		<link rel="apple-touch-startup-image" href="theme/developr/html/img/splash/iphone.png" media="screen and (max-device-width: 320px)">-->

		<!-- Microsoft clear type rendering -->
		<meta http-equiv="cleartype" content="on" />

		<!-- IE9 Pinned Sites: http://msdn.microsoft.com/en-us/library/gg131029.aspx -->
		<meta name="application-name" content="Developr Admin Skin" />
		<meta name="msapplication-tooltip" content="Cross-platform admin template.">
		<meta name="msapplication-starturl" content="http://www.display-inline.fr/demo/developr" />
		<!-- These custom tasks are examples, you need to edit them to show actual pages -->
		<meta name="msapplication-task" content="name=Agenda;action-uri=http://www.display-inline.fr/demo/developr/agenda.html;icon-uri=http://www.display-inline.fr/demo/developr/img/favicons/favicon.ico" />
		<meta name="msapplication-task" content="name=My profile;action-uri=http://www.display-inline.fr/demo/developr/profile.html;icon-uri=http://www.display-inline.fr/demo/developr/img/favicons/favicon.ico" />

		<meta name="viewport" content="width=device-width, initial-scale=1.0" />

		<!-- main styles -->
		<?php
		if (!empty($conf->global->MAIN_HTML_HEADER))
			echo $conf->global->MAIN_HTML_HEADER;
		?>
		<!-- HTTP_USER_AGENT = <?php echo $_SERVER['HTTP_USER_AGENT']; ?> -->

	</head>
	<body>
		<div id="container">
			<hgroup id="login-title" class="large-margin-bottom">
				<h1 class="login-title-image">Speedealing</h1>
				<h5><?php
					if (!empty($conf->main_resolver)) {
						echo $langs->trans("Entity") . " : " . substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], "."));
						if (substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], ".")) == "demo") {
							echo '<p class="icon-user orange">login : demo / password : demo</p';
						}
					}
					?></h5>
			</hgroup>
			<form name="login" action="<?php echo $php_self; ?>" method="post" id="form-login">
				<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
				<input type="hidden" name="loginfunction" value="loginfunction" />
				<!-- Add fields to send local user information -->
				<input type="hidden" name="tz" id="tz" value="" />
				<input type="hidden" name="dst_observed" id="dst_observed" value="" />
				<input type="hidden" name="dst_first" id="dst_first" value="" />
				<input type="hidden" name="dst_second" id="dst_second" value="" />
				<input type="hidden" name="screenwidth" id="screenwidth" value="" />
				<input type="hidden" name="screenheight" id="screenheight" value="" />
				<div class="elVal">
					<ul class="inputs black-input large">
						<!-- The autocomplete="off" attributes is the only way to prevent webkit browsers from filling the inputs with yellow -->
						<li>
							<span class="icon-user mid-margin-right"></span>
							<input type="text" name="username" id="login" value="<?php echo (!empty($login) ? $login : ''); ?>" class="input-unstyled" placeholder="<?php echo $langs->trans('EMail'); ?>" autocomplete="off" />
						</li>
						<li>
							<span class="icon-lock mid-margin-right"></span>
							<input type="password" name="password" id="pass" value="" class="input-unstyled" placeholder="<?php echo $langs->trans('Password'); ?>" autocomplete="off" />
						</li>
					</ul>
					<button type="submit" class="button glossy full-width huge"><?php echo $langs->trans('Connection'); ?></button>
				</div>
			</form>
		</div>

	<?php if (!empty($main_home)) { ?>
		<center>
			<table summary="info" cellpadding="0" cellspacing="0" border="0" align="center" width="750">
				<tr>
					<td align="center"><?php echo $main_home; ?></td>
				</tr>
			</table>
		</center>
	<?php } ?>

	<?php if (!empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) { ?>
		<div align="center"><br>
			<script type="text/javascript"><!--
				google_ad_client = "<?php echo $conf->global->MAIN_GOOGLE_AD_CLIENT ?>";
				google_ad_slot = "<?php echo $conf->global->MAIN_GOOGLE_AD_SLOT ?>";
				google_ad_width = <?php echo $conf->global->MAIN_GOOGLE_AD_WIDTH ?>;
				google_ad_height = <?php echo $conf->global->MAIN_GOOGLE_AD_HEIGHT ?>;
				//-->
			</script>
			<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
		</div>
	<?php } ?>

	<!-- authentication mode = <?php echo $main_authentication ?> -->
	<!-- cookie name used for this session = <?php echo $session_name ?> -->
	<!-- urlfrom in this session = <?php echo $_SESSION["urlfrom"] ?> -->

	<?php if (!empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?>

	<script src="includes/jquery/js/jquery-latest.min.js"></script>
	<script src="includes/lib/validate/jquery.validate.min.js"></script>
	<script src="theme/symeos/js/setup.min.js"></script>

	<!-- Template functions -->
	<script src="theme/symeos/js/developr.input.min.js"></script>
	<script src="theme/symeos/js/developr.message.min.js"></script>
	<script src="theme/symeos/js/developr.notify.min.js"></script>
	<script src="theme/symeos/js/developr.tooltip.min.js"></script>

	<?php
	if (!empty($_SESSION['dol_loginmesg']))
		dol_htmloutput_errors($_SESSION['dol_loginmesg']);
	?>

	<script>
		$(document).ready(function() {
			// Elements
			var doc = $('html').addClass('js-login'),
					container = $('#container'),
					formLogin = $('#form-login'),
					// If layout is centered
					centered;

			formLogin.submit(function(event) {
				// Values
				var login = $.trim($('#login').val()).toLowerCase(),
						pass = $.trim($('#pass').val());

				// Check inputs
				if (login.length === 0) {
					// Display message
					displayError('Please check your login');
					return false;
				} else if (pass.length === 0) {
					// Remove empty login message if displayed
					formLogin.clearMessages();
					// Display message
					displayError('Please fill in your password');
					return false;
				} else {
					// Remove previous messages
					formLogin.clearMessages();
					// Show progress
					displayLoading('Checking credentials...');
					event.preventDefault();

					var urlPrefix;

					if (this.urlPrefix === undefined)
						urlPrefix = "";
					else
						urlPrefix = this.urlPrefix + "";

					// Stop normal behavior
					event.preventDefault();
					$.ajax({
						type: "POST", url: urlPrefix + "/db/_session", dataType: "json",
						data: {name: login, password: pass},
						beforeSend: function(xhr) {
							xhr.setRequestHeader('Accept', 'application/json');
						},
						complete: function(req) {
							var resp = $.parseJSON(req.responseText);
							if (req.status == 200) {
								document.location.href = 'index.php';
							} else {
								formLogin.clearMessages();
								displayError('Invalid user/password, please try again');
							}
						},
						error: function() {
							formLogin.clearMessages();
							displayError('Error while contacting server, contact the support');
						}
					});
				}
			});

			// Handle resizing (mostly for debugging)
			function handleLoginResize() {
				// Detect mode
				centered = (container.css('position') === 'absolute');

				// Set min-height for mobile layout
				if (!centered) {
					container.css('margin-top', '');
				} else {
					if (parseInt(container.css('margin-top'), 10) === 0)
						centerForm(false);
				}
			}
			;

			// Register and first call
			$(window).bind('normalized-resize', handleLoginResize);
			handleLoginResize();

			/*
			 * Center function
			 * @param boolean animate whether or not to animate the position change
			 * @param string|element|array any jQuery selector, DOM element or set of DOM elements which should be ignored
			 * @return void
			 */
			function centerForm(animate, ignore) {
				// If layout is centered
				if (centered) {
					var siblings = formLogin.siblings(),
							finalSize = formLogin.outerHeight();

					// Ignored elements
					if (ignore)
						siblings = siblings.not(ignore);

					// Get other elements height
					siblings.each(function(i) {
						finalSize += $(this).outerHeight(true);
					});

					// Setup
					container[animate ? 'animate' : 'css']({marginTop: -Math.round(finalSize / 2) + 'px'});
				}
			}
			;

			// Initial vertical adjust
			centerForm(false);

			/**
			 * Function to display error messages
			 * @param string message the error to display
			 */
			function displayError(message) {
				// Show message
				var message = formLogin.message(message, {
					append: false,
					arrow: 'bottom',
					classes: ['red-gradient'],
					animate: false					// We'll do animation later, we need to know the message height first
				});

				// Vertical centering (where we need the message height)
				centerForm(true, 'fast');

				// Watch for closing and show with effect
				message.bind('endfade', function(event) {
					// This will be called once the message has faded away and is removed
					centerForm(true, message.get(0));
				}).hide().slideDown('fast');
			}

			/**
			 * Function to display loading messages
			 * @param string message the message to display
			 */
			function displayLoading(message) {
				// Show message
				var message = formLogin.message('<strong>' + message + '</strong>', {
					append: false,
					arrow: 'bottom',
					classes: ['blue-gradient', 'align-center'],
					stripes: true,
					darkStripes: false,
					closable: false,
					animate: false					// We'll do animation later, we need to know the message height first
				});

				// Vertical centering (where we need the message height)
				centerForm(true, 'fast');

				// Watch for closing and show with effect
				message.bind('endfade', function(event) {
					// This will be called once the message has faded away and is removed
					centerForm(true, message.get(0));
				}).hide().slideDown('fast');
			}

			$(".sl_link").click(function(event) {
				$('.l_pane').slideToggle('normal').toggleClass('dn');
				$('.sl_link,.lb_ribbon').children('span').toggle();
				event.preventDefault();
			});

		});
	</script>
</body>
</html>
<!-- END PHP TEMPLATE -->
Back to Top