nilsteampassnet /
TeamPass
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * |
||
| 4 | * @file index.php |
||
| 5 | * @author Nils Laumaillé |
||
| 6 | * @version 2.1.27 |
||
| 7 | * @copyright (c) 2009-2017 Nils Laumaillé |
||
| 8 | * @licensing GNU AFFERO GPL 3.0 |
||
| 9 | * @link http://www.teampass.net |
||
| 10 | * |
||
| 11 | * This library is distributed in the hope that it will be useful, |
||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 14 | */ |
||
| 15 | |||
| 16 | header("X-XSS-Protection: 1; mode=block"); |
||
| 17 | header("X-Frame-Options: SameOrigin"); |
||
| 18 | |||
| 19 | // **PREVENTING SESSION HIJACKING** |
||
| 20 | // Prevents javascript XSS attacks aimed to steal the session ID |
||
| 21 | ini_set('session.cookie_httponly', 1); |
||
| 22 | |||
| 23 | // **PREVENTING SESSION FIXATION** |
||
| 24 | // Session ID cannot be passed through URLs |
||
| 25 | ini_set('session.use_only_cookies', 1); |
||
| 26 | |||
| 27 | // Uses a secure connection (HTTPS) if possible |
||
| 28 | ini_set('session.cookie_secure', 0); |
||
| 29 | |||
| 30 | // Before we start processing, we should abort no install is present |
||
| 31 | if (!file_exists('includes/config/settings.php')) { |
||
| 32 | // This should never happen, but in case it does |
||
| 33 | // this means if headers are sent, redirect will fallback to JS |
||
| 34 | if (headers_sent()) { |
||
| 35 | echo '<script language="javascript" type="text/javascript">document.location.replace("install/install.php");</script>'; |
||
| 36 | } else { |
||
| 37 | header('Location: install/install.php'); |
||
| 38 | } |
||
| 39 | // Now either way, we should stop processing further |
||
| 40 | exit(); |
||
| 41 | } |
||
| 42 | |||
| 43 | // initialise CSRFGuard library |
||
| 44 | require_once('./includes/libraries/csrfp/libs/csrf/csrfprotector.php'); |
||
| 45 | csrfProtector::init(); |
||
| 46 | session_id(); |
||
| 47 | |||
| 48 | // Load config |
||
| 49 | if (file_exists('../includes/config/tp.config.php')) { |
||
| 50 | require_once '../includes/config/tp.config.php'; |
||
| 51 | } elseif (file_exists('./includes/config/tp.config.php')) { |
||
| 52 | require_once './includes/config/tp.config.php'; |
||
| 53 | } else { |
||
| 54 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
||
| 55 | } |
||
| 56 | |||
| 57 | // Include files |
||
| 58 | require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
||
| 59 | require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
||
| 60 | require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
||
| 61 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
||
| 62 | |||
| 63 | |||
| 64 | // initialize session |
||
| 65 | $_SESSION['CPM'] = 1; |
||
| 66 | View Code Duplication | if (isset($SETTINGS['cpassman_dir']) === false || $SETTINGS['cpassman_dir'] === "") { |
|
| 67 | $SETTINGS['cpassman_dir'] = "."; |
||
| 68 | $SETTINGS['cpassman_url'] = $superGlobal->get("REQUEST_URI", "SERVER"); |
||
| 69 | } |
||
| 70 | |||
| 71 | // Include files |
||
| 72 | require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
||
| 73 | require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
||
| 74 | |||
| 75 | |||
| 76 | // Open MYSQL database connection |
||
| 77 | require_once './includes/libraries/Database/Meekrodb/db.class.php'; |
||
| 78 | $pass = defuse_return_decrypted($pass); |
||
| 79 | DB::$host = $server; |
||
| 80 | DB::$user = $user; |
||
| 81 | DB::$password = $pass; |
||
| 82 | DB::$dbName = $database; |
||
| 83 | DB::$port = $port; |
||
| 84 | DB::$encoding = $encoding; |
||
| 85 | DB::$error_handler = true; |
||
| 86 | $link = mysqli_connect($server, $user, $pass, $database, $port); |
||
| 87 | $link->set_charset($encoding); |
||
| 88 | |||
| 89 | |||
| 90 | // Load Core library |
||
| 91 | require_once $SETTINGS['cpassman_dir'].'/sources/core.php'; |
||
| 92 | |||
| 93 | |||
| 94 | // Prepare POST variables |
||
| 95 | $post_language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
||
| 96 | $post_sig_response = filter_input(INPUT_POST, 'sig_response', FILTER_SANITIZE_STRING); |
||
| 97 | $post_duo_login = filter_input(INPUT_POST, 'duo_login', FILTER_SANITIZE_STRING); |
||
| 98 | $post_duo_data = filter_input(INPUT_POST, 'duo_data', FILTER_SANITIZE_STRING); |
||
| 99 | |||
| 100 | // Prepare superGlobal variables |
||
| 101 | $session_user_language = $superGlobal->get("user_language", "SESSION"); |
||
| 102 | $session_user_id = $superGlobal->get("user_id", "SESSION"); |
||
| 103 | $session_user_flag = $superGlobal->get("user_language_flag", "SESSION"); |
||
| 104 | $session_user_admin = $superGlobal->get("user_admin", "SESSION"); |
||
| 105 | $session_user_avatar_thumb = $superGlobal->get("user_avatar_thumb", "SESSION"); |
||
| 106 | $session_name = $superGlobal->get("name", "SESSION"); |
||
| 107 | $session_lastname = $superGlobal->get("lastname", "SESSION"); |
||
| 108 | $session_user_manager = $superGlobal->get("user_manager", "SESSION"); |
||
| 109 | $session_user_read_only = $superGlobal->get("user_read_only", "SESSION"); |
||
| 110 | $session_is_admin = $superGlobal->get("is_admin", "SESSION"); |
||
| 111 | $session_login = $superGlobal->get("login", "SESSION"); |
||
| 112 | $session_validite_pw = $superGlobal->get("validite_pw", "SESSION"); |
||
| 113 | $session_nb_folders = $superGlobal->get("nb_folders", "SESSION"); |
||
| 114 | $session_nb_roles = $superGlobal->get("nb_roles", "SESSION"); |
||
| 115 | $session_autoriser = $superGlobal->get("autoriser", "SESSION"); |
||
| 116 | $session_hide_maintenance = $superGlobal->get("hide_maintenance", "SESSION"); |
||
| 117 | $session_initial_url = $superGlobal->get("initial_url", "SESSION"); |
||
| 118 | $server_request_uri = $superGlobal->get("REQUEST_URI", "SERVER"); |
||
| 119 | $session_nb_users_online = $superGlobal->get("nb_users_online", "SESSION"); |
||
| 120 | |||
| 121 | |||
| 122 | /* DEFINE WHAT LANGUAGE TO USE */ |
||
| 123 | if (isset($_GET['language']) === true) { |
||
| 124 | // case of user has change language in the login page |
||
| 125 | $dataLanguage = DB::queryFirstRow( |
||
| 126 | "SELECT flag, name |
||
| 127 | FROM ".prefix_table("languages")." |
||
| 128 | WHERE name = %s", |
||
| 129 | filter_var($_GET['language'], FILTER_SANITIZE_STRING) |
||
| 130 | ); |
||
| 131 | $superGlobal->put("user_language", $dataLanguage['name'], "SESSION"); |
||
| 132 | $superGlobal->put("user_language_flag", $dataLanguage['flag'], "SESSION"); |
||
| 133 | } elseif ($session_user_id === null && null === $post_language && $session_user_language === null) { |
||
| 134 | //get default language |
||
| 135 | $dataLanguage = DB::queryFirstRow( |
||
| 136 | "SELECT m.valeur AS valeur, l.flag AS flag |
||
| 137 | FROM ".prefix_table("misc")." AS m |
||
| 138 | INNER JOIN ".prefix_table("languages")." AS l ON (m.valeur = l.name) |
||
| 139 | WHERE m.type=%s_type AND m.intitule=%s_intitule", |
||
| 140 | array( |
||
| 141 | 'type' => "admin", |
||
| 142 | 'intitule' => "default_language" |
||
| 143 | ) |
||
| 144 | ); |
||
| 145 | if (empty($dataLanguage['valeur'])) { |
||
| 146 | $superGlobal->put("user_language", "english", "SESSION"); |
||
| 147 | $superGlobal->put("user_language_flag", "us.png", "SESSION"); |
||
| 148 | $session_user_language = "english"; |
||
| 149 | } else { |
||
| 150 | $superGlobal->put("user_language", $dataLanguage['valeur'], "SESSION"); |
||
| 151 | $superGlobal->put("user_language_flag", $dataLanguage['flag'], "SESSION"); |
||
| 152 | $session_user_language = $dataLanguage['valeur']; |
||
| 153 | } |
||
| 154 | } elseif (isset($SETTINGS['default_language']) === true && $session_user_language === null) { |
||
| 155 | $superGlobal->put("user_language", $SETTINGS['default_language'], "SESSION"); |
||
| 156 | $session_user_language = $SETTINGS['default_language']; |
||
| 157 | } elseif (null !== $post_language) { |
||
| 158 | $superGlobal->put("user_language", $post_language, "SESSION"); |
||
| 159 | $session_user_language = $post_language; |
||
| 160 | } elseif ($session_user_language === null || empty($session_user_language) === true) { |
||
| 161 | if (null !== $post_language) { |
||
| 162 | $superGlobal->put("user_language", $post_language, "SESSION"); |
||
| 163 | $session_user_language = $post_language; |
||
| 164 | View Code Duplication | } elseif ($session_user_language !== null) { |
|
| 165 | $superGlobal->put("user_language", $SETTINGS['default_language'], "SESSION"); |
||
| 166 | $session_user_language = $SETTINGS['default_language']; |
||
| 167 | } |
||
| 168 | View Code Duplication | } elseif ($session_user_language === '0') { |
|
| 169 | $superGlobal->put("user_language", $SETTINGS['default_language'], "SESSION"); |
||
| 170 | $session_user_language = $SETTINGS['default_language']; |
||
| 171 | } |
||
| 172 | |||
| 173 | View Code Duplication | if (isset($SETTINGS['cpassman_dir']) === false || $SETTINGS['cpassman_dir'] === "") { |
|
| 174 | $SETTINGS['cpassman_dir'] = "."; |
||
| 175 | $SETTINGS['cpassman_url'] = (string) $server_request_uri; |
||
| 176 | } |
||
| 177 | |||
| 178 | // Load user languages files |
||
| 179 | if (in_array($session_user_language, $languagesList) === true) { |
||
| 180 | View Code Duplication | if (file_exists($SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php') === true) { |
|
| 181 | require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php'; |
||
| 182 | } |
||
| 183 | } else { |
||
| 184 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
||
| 185 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 186 | } |
||
| 187 | |||
| 188 | // load 2FA Google |
||
| 189 | if (isset($SETTINGS['google_authentication']) === true && $SETTINGS['google_authentication'] === "1") { |
||
| 190 | include_once($SETTINGS['cpassman_dir']."/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php"); |
||
| 191 | } |
||
| 192 | |||
| 193 | // Load links, css and javascripts |
||
| 194 | if (isset($_SESSION['CPM']) === true && isset($SETTINGS['cpassman_dir']) === true) { |
||
| 195 | require_once $SETTINGS['cpassman_dir'].'/load.php'; |
||
| 196 | } |
||
| 197 | |||
| 198 | ?> |
||
| 199 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
||
| 200 | |||
| 201 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
||
| 202 | <head> |
||
| 203 | <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> |
||
| 204 | <title>Teampass</title> |
||
| 205 | <script type="text/javascript"> |
||
| 206 | //<![CDATA[ |
||
| 207 | if (window.location.href.indexOf("page=") == -1 && (window.location.href.indexOf("otv=") == -1 && window.location.href.indexOf("action=") == -1)) { |
||
| 208 | if (window.location.href.indexOf("session_over=true") == -1) { |
||
| 209 | //location.replace("./index.php?page=items"); |
||
| 210 | } else { |
||
| 211 | location.replace("./logout.php"); |
||
| 212 | } |
||
| 213 | } |
||
| 214 | //]]> |
||
| 215 | </script> |
||
| 216 | <?php |
||
| 217 | |||
| 218 | // load HEADERS |
||
| 219 | if (isset($_SESSION['CPM'])) { |
||
| 220 | echo $htmlHeaders; |
||
| 221 | } |
||
| 222 | ?> |
||
| 223 | </head> |
||
| 224 | |||
| 225 | <body> |
||
| 226 | <?php |
||
| 227 | |||
| 228 | /* HEADER */ |
||
| 229 | echo ' |
||
| 230 | <div id="top"> |
||
| 231 | <div id="logo"><img src="includes/images/canevas/logo.png" alt="" /></div>'; |
||
| 232 | // Display menu |
||
| 233 | if (empty($session_login) === false) { |
||
| 234 | // welcome message |
||
| 235 | echo ' |
||
| 236 | <div style="float:right; margin:-10px 5px 0 0; color:#FFF;">' |
||
| 237 | .$LANG['index_welcome'].' <b>'.$session_name.' '.$session_lastname |
||
| 238 | .' ['.$session_login.']</b> - ' |
||
| 239 | , $session_user_admin === '1' ? $LANG['god'] : |
||
| 240 | ($session_user_manager === '1' ? $LANG['gestionnaire'] : |
||
| 241 | ($session_user_read_only === '1' ? $LANG['read_only_account'] : $LANG['user']) |
||
| 242 | ), ' '.strtolower($LANG['index_login']).'</div>'; |
||
| 243 | |||
| 244 | echo ' |
||
| 245 | <div id="menu_top"> |
||
| 246 | <div style="margin-left:20px; margin-top:2px;width:710px;" id="main_menu">'; |
||
| 247 | if ($session_user_admin === '0' || $SETTINGS_EXT['admin_full_right'] == 0) { |
||
| 248 | echo ' |
||
| 249 | <a class="btn btn-default" href="#"', |
||
| 250 | ($session_nb_folders !== null && intval($session_nb_folders) === 0) |
||
| 251 | || ($session_nb_roles !== null && intval($session_nb_roles) === 0) ? '' : ' onclick="MenuAction(\'items\')"', |
||
| 252 | '> |
||
| 253 | <i class="fa fa-key fa-2x tip" title="'.$LANG['pw'].'"></i> |
||
| 254 | </a> |
||
| 255 | |||
| 256 | <a class="btn btn-default" href="#"', |
||
| 257 | ($session_nb_folders !== null && intval($session_nb_folders) === 0) |
||
| 258 | || ($session_nb_roles !== null && intval($session_nb_roles) === 0) ? '' : ' onclick="MenuAction(\'find\')"', |
||
| 259 | '> |
||
| 260 | <i class="fa fa-binoculars fa-2x tip" title="'.$LANG['find'].'"></i> |
||
| 261 | </a>'; |
||
| 262 | } |
||
| 263 | |||
| 264 | // Favourites menu |
||
| 265 | if (isset($SETTINGS['enable_favourites']) |
||
| 266 | && $SETTINGS['enable_favourites'] == 1 |
||
| 267 | && |
||
| 268 | ($session_user_admin === '0' || ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false)) |
||
| 269 | ) { |
||
| 270 | echo ' |
||
| 271 | <a class="btn btn-default" href="#" onclick="MenuAction(\'favourites\')"> |
||
| 272 | <i class="fa fa-star fa-2x tip" title="'.$LANG['my_favourites'].'"></i> |
||
| 273 | </a>'; |
||
| 274 | } |
||
| 275 | // KB menu |
||
| 276 | View Code Duplication | if (isset($SETTINGS['enable_kb']) && $SETTINGS['enable_kb'] == 1) { |
|
| 277 | echo ' |
||
| 278 | <a class="btn btn-default" href="#" onclick="MenuAction(\'kb\')"> |
||
| 279 | <i class="fa fa-map-signs fa-2x tip" title="'.$LANG['kb_menu'].'"></i> |
||
| 280 | </a>'; |
||
| 281 | } |
||
| 282 | echo ' |
||
| 283 | <span id="menu_suggestion_position">'; |
||
| 284 | // SUGGESTION menu |
||
| 285 | if (isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] === '1' |
||
| 286 | && ($session_user_read_only === '1' || $session_user_admin === '1' || $session_user_manager === '1') |
||
| 287 | ) { |
||
| 288 | echo ' |
||
| 289 | <a class="btn btn-default" href="#" onclick="MenuAction(\'suggestion\')"> |
||
| 290 | <i class="fa fa-lightbulb-o fa-2x tip" id="menu_icon_suggestions" title="'.$LANG['suggestion_menu'].'"></i> |
||
| 291 | </a>'; |
||
| 292 | } |
||
| 293 | echo ' |
||
| 294 | </span>'; |
||
| 295 | // Admin menu |
||
| 296 | if ($session_user_admin === '1') { |
||
| 297 | echo ' |
||
| 298 | |
||
| 299 | <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_main\')"> |
||
| 300 | <i class="fa fa-info fa-2x tip" title="'.$LANG['admin_main'].'"></i> |
||
| 301 | </a> |
||
| 302 | <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_settings\')"> |
||
| 303 | <i class="fa fa-wrench fa-2x tip" title="'.$LANG['admin_settings'].'"></i> |
||
| 304 | </a>'; |
||
| 305 | } |
||
| 306 | |||
| 307 | if ($session_user_admin === '1' || $session_user_manager === '1') { |
||
| 308 | echo ' |
||
| 309 | |
||
| 310 | <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_folders\')"> |
||
| 311 | <i class="fa fa-folder-open fa-2x tip" title="'.$LANG['admin_groups'].'"></i> |
||
| 312 | </a> |
||
| 313 | <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_roles\')"> |
||
| 314 | <i class="fa fa-graduation-cap fa-2x tip" title="'.$LANG['admin_functions'].'"></i> |
||
| 315 | </a> |
||
| 316 | <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_users\')"> |
||
| 317 | <i class="fa fa-users fa-2x tip" title="'.$LANG['admin_users'].'"></i> |
||
| 318 | </a> |
||
| 319 | <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_views\')"> |
||
| 320 | <i class="fa fa-cubes fa-2x tip" title="'.$LANG['admin_views'].'"></i> |
||
| 321 | </a>'; |
||
| 322 | } |
||
| 323 | |||
| 324 | echo ' |
||
| 325 | <div style="float:right;"> |
||
| 326 | <ul class="menu" style=""> |
||
| 327 | <li class="" style="padding:4px;width:40px; text-align:center;"><i class="fa fa-dashboard fa-fw"></i> |
||
| 328 | <ul class="menu_200" style="text-align:left;">', |
||
| 329 | ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === true) ? '' : isset($SETTINGS['enable_pf_feature']) === true && $SETTINGS['enable_pf_feature'] == 1 ? ' |
||
| 330 | <li onclick="$(\'#div_set_personal_saltkey\').dialog(\'open\')"> |
||
| 331 | <i class="fa fa-key fa-fw"></i> '.$LANG['home_personal_saltkey_button'].' |
||
| 332 | </li>' : '', ' |
||
| 333 | <li onclick="$(\'#div_increase_session_time\').dialog(\'open\')"> |
||
| 334 | <i class="fa fa-clock-o fa-fw"></i> '.$LANG['index_add_one_hour'].' |
||
| 335 | </li> |
||
| 336 | <li onclick="loadProfileDialog()"> |
||
| 337 | <i class="fa fa-user fa-fw"></i> '.$LANG['my_profile'].' |
||
| 338 | </li> |
||
| 339 | <li onclick="MenuAction(\'deconnexion\', \''.$session_user_id.'\')"> |
||
| 340 | <i class="fa fa-sign-out fa-fw"></i> '.$LANG['disconnect'].' |
||
| 341 | </li> |
||
| 342 | </ul> |
||
| 343 | </li> |
||
| 344 | </ul> |
||
| 345 | </div>'; |
||
| 346 | |||
| 347 | if ($session_user_admin !== '1' || ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false)) { |
||
| 348 | echo ' |
||
| 349 | <div style="float:right; margin-right:10px;"> |
||
| 350 | <ul class="menu" id="menu_last_seen_items"> |
||
| 351 | <li class="" style="padding:4px;width:40px; text-align:center;"><i class="fa fa-map fa-fw"></i> |
||
| 352 | <ul class="menu_200" id="last_seen_items_list" style="text-align:left;"> |
||
| 353 | <li>'.$LANG['please_wait'].'</li> |
||
| 354 | </ul> |
||
| 355 | </li> |
||
| 356 | </ul> |
||
| 357 | </div>'; |
||
| 358 | } |
||
| 359 | |||
| 360 | // show avatar |
||
| 361 | if ($session_user_avatar_thumb !== null && empty($session_user_avatar_thumb) === false) { |
||
| 362 | if (file_exists('includes/avatars/'.$session_user_avatar_thumb)) { |
||
| 363 | $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$session_user_avatar_thumb; |
||
| 364 | } else { |
||
| 365 | $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
||
| 366 | } |
||
| 367 | } else { |
||
| 368 | $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
||
| 369 | } |
||
| 370 | echo ' |
||
| 371 | <div style="float:right; margin-right:10px;"> |
||
| 372 | <img src="'.$avatar.'" style="border-radius:10px; height:28px; cursor:pointer;" onclick="loadProfileDialog()" alt="photo" id="user_avatar_thumb" /> |
||
| 373 | </div>'; |
||
| 374 | |||
| 375 | echo ' |
||
| 376 | </div>'; |
||
| 377 | |||
| 378 | echo ' |
||
| 379 | </div>'; |
||
| 380 | } |
||
| 381 | |||
| 382 | echo ' |
||
| 383 | </div>'; |
||
| 384 | |||
| 385 | echo ' |
||
| 386 | <div id="main_info_box" style="display:none; z-index:99999; position:absolute; width:400px; height:40px;" class="ui-widget ui-state-active ui-color"> |
||
| 387 | <span class="closeButton" onclick="$(\'#main_info_box\').hide()">✖</span> |
||
| 388 | <div id="main_info_box_text" style="text-align:center;margin-top:10px;"></div> |
||
| 389 | </div>'; |
||
| 390 | |||
| 391 | /* MAIN PAGE */ |
||
| 392 | echo ' |
||
| 393 | <input type="hidden" id="temps_restant" value="', isset($_SESSION['fin_session']) ? $_SESSION['fin_session'] : '', '" /> |
||
| 394 | <input type="hidden" name="language" id="language" value="" /> |
||
| 395 | <input type="hidden" name="user_pw_complexity" id="user_pw_complexity" value="', isset($_SESSION['user_pw_complexity']) ? $_SESSION['user_pw_complexity'] : '', '" /> |
||
| 396 | <input type="hidden" name="user_session" id="user_session" value=""/> |
||
| 397 | <input type="hidden" name="encryptClientServer" id="encryptClientServer" value="', isset($SETTINGS['encryptClientServer']) ? $SETTINGS['encryptClientServer'] : '1', '" /> |
||
| 398 | <input type="hidden" name="please_login" id="please_login" value="" /> |
||
| 399 | <input type="hidden" name="disabled_action_on_going" id="disabled_action_on_going" value="" /> |
||
| 400 | <input type="hidden" id="duo_sig_response" value="', null !== $post_sig_response ? intval($post_sig_response) : '', '" />'; |
||
| 401 | |||
| 402 | // SENDING STATISTICS? |
||
| 403 | if (isset($SETTINGS['send_stats']) && $SETTINGS['send_stats'] === "1" |
||
| 404 | && (!isset($_SESSION['temporary']['send_stats_done']) || $_SESSION['temporary']['send_stats_done'] !== "1") |
||
| 405 | ) { |
||
| 406 | echo ' |
||
| 407 | <input type="hidden" name="send_statistics" id="send_statistics" value="1" />'; |
||
| 408 | } else { |
||
| 409 | echo ' |
||
| 410 | <input type="hidden" name="send_statistics" id="send_statistics" value="0" />'; |
||
| 411 | } |
||
| 412 | |||
| 413 | echo ' |
||
| 414 | <div id="', (isset($_GET['page']) && filter_var($_GET['page'], FILTER_SANITIZE_STRING) === "items" && $session_user_id !== null) ? "main_simple" : "main", '">'; |
||
| 415 | // MESSAGE BOX |
||
| 416 | echo ' |
||
| 417 | <div style="" class="div_center"> |
||
| 418 | <div id="message_box" style="display:none;width:200px;padding:5px;text-align:center; z-index:999999;" class="ui-widget-content ui-state-error ui-corner-all"></div> |
||
| 419 | </div>'; |
||
| 420 | // Main page |
||
| 421 | if ($session_autoriser !== null && $session_autoriser === true) { |
||
| 422 | // Show menu |
||
| 423 | echo ' |
||
| 424 | <form method="post" name="main_form" action=""> |
||
| 425 | <input type="hidden" name="menu_action" id="menu_action" value="" /> |
||
| 426 | <input type="hidden" name="changer_pw" id="changer_pw" value="" /> |
||
| 427 | <input type="hidden" name="form_user_id" id="form_user_id" value="', $session_user_id !== null ? $session_user_id : '', '" /> |
||
| 428 | <input type="hidden" name="is_admin" id="is_admin" value="', $session_is_admin !== null ? $session_is_admin : '', '" /> |
||
| 429 | <input type="hidden" name="personal_saltkey_set" id="personal_saltkey_set" value="', isset($_SESSION['user_settings']['clear_psk']) ? true : false, '" /> |
||
| 430 | </form>'; |
||
| 431 | } |
||
| 432 | // --------- |
||
| 433 | // Display a help to admin |
||
| 434 | $errorAdmin = ""; |
||
| 435 | |||
| 436 | // error nb folders |
||
| 437 | if ($session_nb_folders !== null && intval($session_nb_folders) === 0) { |
||
| 438 | $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;"> </span>'.$LANG['error_no_folders'].'<br />'; |
||
| 439 | } |
||
| 440 | // error nb roles |
||
| 441 | if ($session_nb_roles !== null && intval($session_nb_roles) === 0) { |
||
| 442 | if (empty($errorAdmin)) { |
||
| 443 | $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;"> </span>'.$LANG['error_no_roles']; |
||
| 444 | } else { |
||
| 445 | $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;"> </span>'.$LANG['error_no_roles']; |
||
| 446 | } |
||
| 447 | } |
||
| 448 | |||
| 449 | if ($session_validite_pw !== null && empty($session_validite_pw) === false) { |
||
| 450 | // error cpassman dir |
||
| 451 | View Code Duplication | if (isset($SETTINGS['cpassman_dir']) && empty($SETTINGS['cpassman_dir']) || !isset($SETTINGS['cpassman_dir'])) { |
|
| 452 | if (empty($errorAdmin)) { |
||
| 453 | $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;"> </span>'.$LANG['error_cpassman_dir']; |
||
| 454 | } else { |
||
| 455 | $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;"> </span>'.$LANG['error_cpassman_dir']; |
||
| 456 | } |
||
| 457 | } |
||
| 458 | // error cpassman url |
||
| 459 | View Code Duplication | if ($session_validite_pw !== null && (isset($SETTINGS['cpassman_url']) && empty($SETTINGS['cpassman_url']) || !isset($SETTINGS['cpassman_url']))) { |
|
| 460 | if (empty($errorAdmin)) { |
||
| 461 | $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;"> </span>'.$LANG['error_cpassman_url']; |
||
| 462 | } else { |
||
| 463 | $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;"> </span>'.$LANG['error_cpassman_url']; |
||
| 464 | } |
||
| 465 | } |
||
| 466 | } |
||
| 467 | // Display help |
||
| 468 | if (!empty($errorAdmin)) { |
||
| 469 | echo ' |
||
| 470 | <div style="margin:10px;padding:10px;" class="ui-state-error ui-corner-all"> |
||
| 471 | '.$errorAdmin.' |
||
| 472 | </div>'; |
||
| 473 | } |
||
| 474 | // ----------- |
||
| 475 | // Display Maintenance mode information |
||
| 476 | if (isset($SETTINGS['maintenance_mode']) === true && $SETTINGS['maintenance_mode'] === '1' |
||
| 477 | && $session_user_admin !== null && $session_user_admin === '1' |
||
| 478 | ) { |
||
| 479 | echo ' |
||
| 480 | <div style="text-align:center;margin-bottom:5px;padding:10px;" class="ui-state-highlight ui-corner-all"> |
||
| 481 | <b>'.$LANG['index_maintenance_mode_admin'].'</b> |
||
| 482 | </div>'; |
||
| 483 | } |
||
| 484 | // Display UPDATE NEEDED information |
||
| 485 | if (isset($SETTINGS['update_needed']) && $SETTINGS['update_needed'] === true |
||
| 486 | && $session_user_admin !== null && $session_user_admin === '1' |
||
| 487 | && (($session_hide_maintenance !== null && $session_hide_maintenance === '0') |
||
| 488 | || $session_hide_maintenance === null) |
||
| 489 | ) { |
||
| 490 | echo ' |
||
| 491 | <div style="text-align:center;margin-bottom:5px;padding:10px;" |
||
| 492 | class="ui-state-highlight ui-corner-all" id="div_maintenance"> |
||
| 493 | <b>'.$LANG['update_needed_mode_admin'].'</b> |
||
| 494 | <span style="float:right;cursor:pointer;"> |
||
| 495 | <span class="fa fa-close mi-red" onclick="toggleDiv(\'div_maintenance\')"></span> |
||
| 496 | </span> |
||
| 497 | </div>'; |
||
| 498 | } |
||
| 499 | |||
| 500 | // display an item in the context of OTV link |
||
| 501 | if (($session_validite_pw === null || empty($session_validite_pw) === true || empty($session_user_id) === true) && |
||
| 502 | isset($_GET['otv']) && filter_var($_GET['otv'], FILTER_SANITIZE_STRING) === 'true' |
||
| 503 | ) { |
||
| 504 | // case where one-shot viewer |
||
| 505 | if (isset($_GET['code']) && !empty($_GET['code']) |
||
| 506 | && isset($_GET['stamp']) && !empty($_GET['stamp']) |
||
| 507 | ) { |
||
| 508 | include 'otv.php'; |
||
| 509 | } else { |
||
| 510 | $_SESSION['error']['code'] = ERR_VALID_SESSION; |
||
| 511 | $superGlobal->put( |
||
| 512 | "initial_url", |
||
| 513 | filter_var( |
||
| 514 | substr($server_request_uri, strpos($server_request_uri, "index.php?")), |
||
| 515 | FILTER_SANITIZE_URL |
||
| 516 | ), |
||
| 517 | "SESSION" |
||
| 518 | ); |
||
| 519 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 520 | } |
||
| 521 | // Ask the user to change his password |
||
| 522 | } elseif (($session_validite_pw === null || $session_validite_pw === false) |
||
| 523 | && empty($session_user_id) === false |
||
| 524 | ) { |
||
| 525 | //Check if password is valid |
||
| 526 | echo ' |
||
| 527 | <div style="margin:auto; padding:20px; width:500px;" class="ui-state-focus ui-corner-all"> |
||
| 528 | <h3>'.$LANG['index_change_pw'].'</h3> |
||
| 529 | <div style="height:20px;text-align:center;margin:2px;display:none;" id="change_pwd_error" class=""></div> |
||
| 530 | <div style="text-align:center;margin:5px;padding:3px;" id="change_pwd_complexPw" class="ui-widget ui-state-active ui-corner-all">'. |
||
| 531 | $LANG['complex_asked'].' : '.$SETTINGS_EXT['pwComplexity'][$_SESSION['user_pw_complexity']][1]. |
||
| 532 | '</div> |
||
| 533 | <div id="pw_strength" style="margin:0 0 10px 140px;"></div> |
||
| 534 | <table> |
||
| 535 | <tr> |
||
| 536 | <td>'.$LANG['index_new_pw'].' :</td><td><input type="password" size="15" name="new_pw" id="new_pw"/></td> |
||
| 537 | </tr> |
||
| 538 | <tr><td>'.$LANG['index_change_pw_confirmation'].' :</td><td><input type="password" size="15" name="new_pw2" id="new_pw2" onkeypress="if (event.keyCode == 13) ChangeMyPass();" /></td></tr> |
||
| 539 | </table> |
||
| 540 | <input type="hidden" id="pw_strength_value" /> |
||
| 541 | <div style="width:420px; text-align:center; margin:15px 0 10px 0;"> |
||
| 542 | <input type="button" onClick="ChangeMyPass()" onkeypress="if (event.keyCode == 13) ChangeMyPass();" class="ui-state-default ui-corner-all" style="padding:4px;width:150px;margin:10px 0 0 80px;" value="'.$LANG['index_change_pw_button'].'" /> |
||
| 543 | </div> |
||
| 544 | </div> |
||
| 545 | <script type="text/javascript"> |
||
| 546 | $("#new_pw").focus(); |
||
| 547 | </script>'; |
||
| 548 | // Display pages |
||
| 549 | } elseif ($session_validite_pw !== null |
||
| 550 | && $session_validite_pw === true |
||
| 551 | && empty($_GET['page']) === false |
||
| 552 | && empty($session_user_id) === false |
||
| 553 | ) { |
||
| 554 | if (!extension_loaded('mcrypt')) { |
||
| 555 | $_SESSION['error']['code'] = ERR_NO_MCRYPT; |
||
| 556 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 557 | } elseif ($session_initial_url !== null && empty($session_initial_url) === false) { |
||
| 558 | include $session_initial_url; |
||
| 559 | } elseif ($_GET['page'] == "items") { |
||
| 560 | // SHow page with Items |
||
| 561 | if (($session_user_admin !== '1') |
||
| 562 | || |
||
| 563 | ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false) |
||
| 564 | ) { |
||
| 565 | include 'items.php'; |
||
| 566 | } else { |
||
| 567 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
||
| 568 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 569 | } |
||
| 570 | } elseif ($_GET['page'] == "find") { |
||
| 571 | // Show page for items findind |
||
| 572 | include 'find.php'; |
||
| 573 | } elseif ($_GET['page'] == "favourites") { |
||
| 574 | // Show page for user favourites |
||
| 575 | include 'favorites.php'; |
||
| 576 | View Code Duplication | } elseif ($_GET['page'] == "kb") { |
|
| 577 | // Show page KB |
||
| 578 | if (isset($SETTINGS['enable_kb']) && $SETTINGS['enable_kb'] == 1) { |
||
| 579 | include 'kb.php'; |
||
| 580 | } else { |
||
| 581 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
||
| 582 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 583 | } |
||
| 584 | } elseif ($_GET['page'] == "suggestion") { |
||
| 585 | // Show page KB |
||
| 586 | View Code Duplication | if (isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] == 1) { |
|
| 587 | include 'suggestion.php'; |
||
| 588 | } else { |
||
| 589 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
||
| 590 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 591 | } |
||
| 592 | } elseif (in_array($_GET['page'], array_keys($mngPages))) { |
||
| 593 | // Define if user is allowed to see management pages |
||
| 594 | if ($session_user_admin === '1') { |
||
| 595 | include($mngPages[$_GET['page']]); |
||
| 596 | } elseif ($session_user_manager === '1') { |
||
| 597 | if (($_GET['page'] != "manage_main" && $_GET['page'] != "manage_settings")) { |
||
| 598 | include($mngPages[$_GET['page']]); |
||
| 599 | } else { |
||
| 600 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
||
| 601 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 602 | } |
||
| 603 | } else { |
||
| 604 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
||
| 605 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 606 | } |
||
| 607 | } else { |
||
| 608 | $_SESSION['error']['code'] = ERR_NOT_EXIST; //page doesn't exist |
||
| 609 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 610 | } |
||
| 611 | // Case of password recovery |
||
| 612 | } elseif (isset($_GET['action']) && $_GET['action'] === "password_recovery") { |
||
| 613 | // Case where user has asked new PW |
||
| 614 | echo ' |
||
| 615 | <div style="width:400px;margin:50px auto 50px auto;padding:25px;" class="ui-state-highlight ui-corner-all"> |
||
| 616 | <div style="text-align:center;font-weight:bold;margin-bottom:20px;"> |
||
| 617 | '.$LANG['pw_recovery_asked'].' |
||
| 618 | </div> |
||
| 619 | <div id="generate_new_pw_error" style="color:red;display:none;text-align:center;margin:5px;"></div> |
||
| 620 | <div style="margin-bottom:3px;"> |
||
| 621 | '.$LANG['pw_recovery_info'].' |
||
| 622 | </div> |
||
| 623 | <div style="margin:15px; text-align:center;"> |
||
| 624 | <input type="button" id="but_generate_new_password" onclick="GenerateNewPassword(\''.htmlspecialchars($_GET['key'], ENT_QUOTES).'\',\''.htmlspecialchars($_GET['login'], ENT_QUOTES).'\')" style="padding:3px;cursor:pointer;" class="ui-state-default ui-corner-all" value="'.$LANG['pw_recovery_button'].'" /> |
||
| 625 | <br /><br /> |
||
| 626 | <div id="ajax_loader_send_mail" style="display:none; margin: 20px;"><span class="fa fa-cog fa-spin fa-2x"></span></div> |
||
| 627 | </div> |
||
| 628 | <div style="margin-top:30px; text-align:center;"> |
||
| 629 | <a href="index.php" class="tip" title="'.$LANG['home'].'"><span class="fa fa-home fa-lg"></span></a> |
||
| 630 | </div> |
||
| 631 | </div>'; |
||
| 632 | } elseif (empty($session_user_id) === false && $session_user_id !== null) { |
||
| 633 | // Page doesn't exist |
||
| 634 | $_SESSION['error']['code'] = ERR_NOT_EXIST; |
||
| 635 | include $SETTINGS['cpassman_dir'].'/error.php'; |
||
| 636 | // When user is not identified |
||
| 637 | } else { |
||
| 638 | // Automatic redirection |
||
| 639 | if (strpos($server_request_uri, "?") > 0) { |
||
| 640 | $nextUrl = filter_var(substr($server_request_uri, strpos($server_request_uri, "?")), FILTER_SANITIZE_URL); |
||
| 641 | } else { |
||
| 642 | $nextUrl = ""; |
||
| 643 | } |
||
| 644 | // MAINTENANCE MODE |
||
| 645 | if (isset($SETTINGS['maintenance_mode']) === true && $SETTINGS['maintenance_mode'] === '1') { |
||
| 646 | echo ' |
||
| 647 | <div style="text-align:center;margin-top:30px;margin-bottom:20px;padding:10px;" |
||
| 648 | class="ui-state-error ui-corner-all"> |
||
| 649 | <b>'.addslashes($LANG['index_maintenance_mode']).'</b> |
||
| 650 | </div>'; |
||
| 651 | } elseif (isset($_GET['session_over']) && $_GET['session_over'] === 'true') { |
||
| 652 | // SESSION FINISHED => RECONNECTION ASKED |
||
| 653 | echo ' |
||
| 654 | <div style="text-align:center;margin-top:30px;margin-bottom:20px;padding:10px;" |
||
| 655 | class="ui-state-error ui-corner-all"> |
||
| 656 | <b>'.addslashes($LANG['index_session_expired']).'</b> |
||
| 657 | </div>'; |
||
| 658 | } |
||
| 659 | |||
| 660 | // case where user not logged and can't access a direct link |
||
| 661 | if (empty($_GET['page']) === false) { |
||
| 662 | $superGlobal->put( |
||
| 663 | "initial_url", |
||
| 664 | filter_var( |
||
| 665 | substr($server_request_uri, strpos($server_request_uri, "index.php?")), |
||
| 666 | FILTER_SANITIZE_URL |
||
| 667 | ), |
||
| 668 | "SESSION" |
||
| 669 | ); |
||
| 670 | // REDIRECTION PAGE ERREUR |
||
| 671 | echo ' |
||
| 672 | <script language="javascript" type="text/javascript"> |
||
| 673 | <!-- |
||
| 674 | sessionStorage.clear(); |
||
| 675 | window.location.href = "index.php"; |
||
| 676 | --> |
||
| 677 | </script>'; |
||
| 678 | exit; |
||
| 679 | } else { |
||
| 680 | $superGlobal->put("initial_url", '', "SESSION"); |
||
| 681 | } |
||
| 682 | |||
| 683 | // CONNECTION FORM |
||
| 684 | echo ' |
||
| 685 | <form method="post" name="form_identify" id="form_identify" action=""> |
||
| 686 | <div style="width:480px;margin:10px auto 10px auto;padding:25px;" class="ui-state-highlight ui-corner-all"> |
||
| 687 | <div style="text-align:center;font-weight:bold;margin-bottom:20px;">', |
||
| 688 | isset($SETTINGS['custom_logo']) && !empty($SETTINGS['custom_logo']) ? '<img src="'.(string) $SETTINGS['custom_logo'].'" alt="" style="margin-bottom:40px;" />' : '', '<br /> |
||
| 689 | '.$LANG['index_get_identified'].' |
||
| 690 | <span id="ajax_loader_connexion" style="display:none;margin-left:10px;"><span class="fa fa-cog fa-spin fa-1x"></span></span> |
||
| 691 | </div> |
||
| 692 | <div id="connection_error" style="display:none;text-align:center;margin:5px; padding:3px;" class="ui-state-error ui-corner-all"> <i class="fa fa-warning"></i> '.$LANG['index_bas_pw'].'</div>'; |
||
| 693 | echo ' |
||
| 694 | <div style="margin-bottom:3px;"> |
||
| 695 | <label for="login" class="form_label">', isset($SETTINGS['custom_login_text']) && !empty($SETTINGS['custom_login_text']) ? (string) $SETTINGS['custom_login_text'] : $LANG['index_login'], '</label> |
||
| 696 | <input type="text" size="10" id="login" name="login" class="input_text text ui-widget-content ui-corner-all" value="', isset($_POST['login']) ? $_POST['login'] : '', '" /> |
||
|
0 ignored issues
–
show
|
|||
| 697 | <span id="login_check_wait" style="display:none; float:right;"><i class="fa fa-cog fa-spin fa-1x"></i></span> |
||
| 698 | </div>'; |
||
| 699 | |||
| 700 | // AGSES |
||
| 701 | if (isset($SETTINGS['agses_authentication_enabled']) && $SETTINGS['agses_authentication_enabled'] == 1) { |
||
| 702 | echo ' |
||
| 703 | <div id="agses_cardid_div" style="text-align:center; display:none; padding:5px; width:454px; margin-bottom:5px;" class="ui-state-active ui-corner-all"> |
||
| 704 | '.$LANG['user_profile_agses_card_id'].': |
||
| 705 | <input type="text" size="12" id="agses_cardid"> |
||
| 706 | </div> |
||
| 707 | <div id="agses_flickercode_div" style="text-align:center; display:none;"> |
||
| 708 | <canvas id="axs_canvas"></canvas> |
||
| 709 | </div>'; |
||
| 710 | } |
||
| 711 | |||
| 712 | echo ' |
||
| 713 | <div id="connect_pw" style="margin-bottom:3px;"> |
||
| 714 | <label for="pw" class="form_label" id="user_pwd">'.$LANG['index_password'].'</label> |
||
| 715 | <input type="password" size="10" id="pw" name="pw" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['google_authentication']) && $SETTINGS['google_authentication'] === "1" ? 1 : '', '\')" class="input_text text ui-widget-content ui-corner-all" value="', isset($_POST['pw']) ? $_POST['pw'] : '', '" /> |
||
|
0 ignored issues
–
show
Security
Cross-Site Scripting
introduced
by
isset($_POST['pw']) ? $_POST['pw'] : '' can contain request data and is used in output context(s) leading to a potential security vulnerability.
Preventing Cross-Site-Scripting AttacksCross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user. In order to prevent this, make sure to escape all user-provided data:
// for HTML
$sanitized = htmlentities($tainted, ENT_QUOTES);
// for URLs
$sanitized = urlencode($tainted);
General Strategies to prevent injectionIn general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:
if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
throw new \InvalidArgumentException('This input is not allowed.');
}
For numeric data, we recommend to explicitly cast the data: $sanitized = (integer) $tainted;
Loading history...
|
|||
| 716 | </div>'; |
||
| 717 | |||
| 718 | // Personal salt key |
||
| 719 | if (isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1") { |
||
| 720 | echo ' |
||
| 721 | <div id="connect_psk" style="margin-bottom:3px;"> |
||
| 722 | <label for="personal_psk" class="form_label">'.$LANG['home_personal_saltkey'].'</label> |
||
| 723 | <input type="password" size="10" id="psk" name="psk" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1" ? 1 : '', '\')" class="input_text text ui-widget-content ui-corner-all" /> |
||
| 724 | </div> |
||
| 725 | <div id="connect_psk_confirm" style="margin-bottom:3px; display:none;"> |
||
| 726 | <label for="psk_confirm" class="form_label">'.$LANG['home_personal_saltkey_confirm'].'</label> |
||
| 727 | <input type="password" size="10" id="psk_confirm" name="psk_confirm" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1" ? 1 : '', '\')" class="input_text text ui-widget-content ui-corner-all" /> |
||
| 728 | </div>'; |
||
| 729 | } |
||
| 730 | |||
| 731 | // Google Authenticator code |
||
| 732 | if (isset($SETTINGS['google_authentication']) && $SETTINGS['google_authentication'] === "1") { |
||
| 733 | echo ' |
||
| 734 | <div id="ga_code_div" style="margin-bottom:10px;"> |
||
| 735 | '.$LANG['ga_identification_code'].' |
||
| 736 | <input type="text" size="4" id="ga_code" name="ga_code" style="margin:0px;" class="input_text text ui-widget-content ui-corner-all numeric_only" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\')" /> |
||
| 737 | <div id="2fa_new_code_div" style="text-align:center; display:none; margin-top:5px; padding:5px;" class="ui-state-default ui-corner-all"></div> |
||
| 738 | <div style="margin-top:2px; font-size:10px; text-align:center; cursor:pointer;" onclick="send_user_new_temporary_ga_code()">'.$LANG['i_need_to_generate_new_ga_code'].'</div> |
||
| 739 | </div>'; |
||
| 740 | } |
||
| 741 | echo ' |
||
| 742 | <div style="margin-bottom:3px;"> |
||
| 743 | <label for="duree_session" class="">'.$LANG['index_session_duration'].' ('.$LANG['minutes'].') </label> |
||
| 744 | <input type="text" size="4" id="duree_session" name="duree_session" value="', isset($SETTINGS['default_session_expiration_time']) ? $SETTINGS['default_session_expiration_time'] : "60", '" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\')" class="input_text text ui-widget-content ui-corner-all numeric_only" /> |
||
| 745 | </div> |
||
| 746 | |||
| 747 | <div style="text-align:center;margin-top:5px;font-size:10pt;"> |
||
| 748 | <span onclick="OpenDialog(\'div_forgot_pw\')" style="padding:3px;cursor:pointer;">'.$LANG['forgot_my_pw'].'</span> |
||
| 749 | </div> |
||
| 750 | <div style="text-align:center;margin-top:15px;"> |
||
| 751 | <input type="button" id="but_identify_user" onclick="launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1" ? 1 : '', '\')" style="padding:3px;cursor:pointer;" class="ui-state-default ui-corner-all" value="'.$LANG['index_identify_button'].'" /> |
||
| 752 | </div> |
||
| 753 | </div> |
||
| 754 | </form> |
||
| 755 | <script type="text/javascript"> |
||
| 756 | $("#login").focus(); |
||
| 757 | </script>'; |
||
| 758 | // DIV for forgotten password |
||
| 759 | echo ' |
||
| 760 | <div id="div_forgot_pw" style="display:none;"> |
||
| 761 | <div style="margin:5px auto 5px auto;" id="div_forgot_pw_alert"></div> |
||
| 762 | <div style="margin:5px auto 5px auto;">'.$LANG['forgot_my_pw_text'].'</div> |
||
| 763 | <label for="forgot_pw_email">'.$LANG['email'].'</label> |
||
| 764 | <input type="text" size="40" name="forgot_pw_email" id="forgot_pw_email" /> |
||
| 765 | <br /> |
||
| 766 | <label for="forgot_pw_login">'.$LANG['login'].'</label> |
||
| 767 | <input type="text" size="20" name="forgot_pw_login" id="forgot_pw_login" /> |
||
| 768 | <div id="div_forgot_pw_status" style="text-align:center;margin-top:15px;display:none; padding:5px;" class="ui-corner-all"> |
||
| 769 | <i class="fa fa-cog fa-spin fa-2x"></i> <b>'.$LANG['please_wait'].'</b> |
||
| 770 | </div> |
||
| 771 | </div>'; |
||
| 772 | } |
||
| 773 | echo ' |
||
| 774 | </div>'; |
||
| 775 | // FOOTER |
||
| 776 | /* DON'T MODIFY THE FOOTER ... MANY THANKS TO YOU */ |
||
| 777 | echo ' |
||
| 778 | <div id="footer"> |
||
| 779 | <div style="float:left;width:32%;"> |
||
| 780 | <a href="http://teampass.net" target="_blank" style="color:#F0F0F0;">'.$SETTINGS_EXT['tool_name'].' '.$SETTINGS_EXT['version'].' <i class="fa fa-copyright"></i> '.$SETTINGS_EXT['copyright'].'</a> |
||
| 781 | | |
||
| 782 | <a href="http://teampass.readthedocs.io/en/latest/" target="_blank" style="color:#F0F0F0;" class="tip" title="'.addslashes($LANG['documentation_canal']).' ReadTheDocs"><i class="fa fa-book"></i></a> |
||
| 783 | |
||
| 784 | <a href="https://www.reddit.com/r/TeamPass/" target="_blank" style="color:#F0F0F0;" class="tip" title="'.addslashes($LANG['admin_help']).'"><i class="fa fa-reddit-alien"></i></a> |
||
| 785 | </div> |
||
| 786 | <div style="float:left;width:32%;text-align:center;"> |
||
| 787 | ', ($session_user_id !== null && empty($session_user_id) === false) ? '<i class="fa fa-users"></i> '.$session_nb_users_online.' '.$LANG['users_online'].' | <i class="fa fa-hourglass-end"></i> '.$LANG['index_expiration_in'].' <div style="display:inline;" id="countdown"></div>' : '', ' |
||
| 788 | </div><div id="countdown2"></div> |
||
| 789 | <div style="float:right;text-align:right;"> |
||
| 790 | <i class="fa fa-clock-o"></i> '. $LANG['server_time']." : ".@date($SETTINGS['date_format'], (string) $_SERVER['REQUEST_TIME'])." - ".@date($SETTINGS['time_format'], (string) $_SERVER['REQUEST_TIME']).' |
||
| 791 | </div> |
||
| 792 | </div>'; |
||
| 793 | // PAGE LOADING |
||
| 794 | echo ' |
||
| 795 | <div id="div_loading" class="hidden"> |
||
| 796 | <div style="padding:5px; z-index:9999999;" class="ui-widget-content ui-state-focus ui-corner-all"> |
||
| 797 | <i class="fa fa-cog fa-spin fa-2x"></i> |
||
| 798 | </div> |
||
| 799 | </div>'; |
||
| 800 | // Alert BOX |
||
| 801 | echo ' |
||
| 802 | <div id="div_dialog_message" style="display:none;"> |
||
| 803 | <div id="div_dialog_message_text" style="text-align:center; padding:4px; font-size:12px; margin-top:10px;"></div> |
||
| 804 | </div>'; |
||
| 805 | |||
| 806 | // WARNING FOR QUERY ERROR |
||
| 807 | echo ' |
||
| 808 | <div id="div_mysql_error" style="display:none;"> |
||
| 809 | <div style="padding:10px;text-align:center;" id="mysql_error_warning"></div> |
||
| 810 | </div>'; |
||
| 811 | |||
| 812 | |||
| 813 | //Personnal SALTKEY |
||
| 814 | if (isset($SETTINGS['enable_pf_feature']) && $SETTINGS['enable_pf_feature'] === "1") { |
||
| 815 | echo ' |
||
| 816 | <div id="div_set_personal_saltkey" style="display:none;padding:4px;"> |
||
| 817 | <i class="fa fa-key"></i> <b>'.$LANG['home_personal_saltkey'].'</b> |
||
| 818 | <input type="password" name="input_personal_saltkey" id="input_personal_saltkey" style="width:200px;padding:5px;margin-left:30px;" class="text ui-widget-content ui-corner-all text_without_symbols tip" value="', isset($_SESSION['user_settings']['clear_psk']) ? (string) $_SESSION['user_settings']['clear_psk'] : '', '" title="<i class=\'fa fa-bullhorn\'></i> '.$LANG['text_without_symbols'].'" /> |
||
| 819 | <span id="set_personal_saltkey_last_letter" style="font-weight:bold;font-size:20px;"></span> |
||
| 820 | <div style="display:none;margin-top:5px;text-align:center;padding:4px;" id="set_personal_saltkey_warning" class="ui-widget-content ui-state-error ui-corner-all"></div> |
||
| 821 | </div>'; |
||
| 822 | } |
||
| 823 | |||
| 824 | // user profile |
||
| 825 | echo ' |
||
| 826 | <div id="dialog_user_profil" style="display:none;padding:4px;"> |
||
| 827 | <div id="div_user_profil"> |
||
| 828 | <i class="fa fa-cog fa-spin fa-2x"></i> <b>'.$LANG['please_wait'].'</b> |
||
| 829 | </div> |
||
| 830 | </div>'; |
||
| 831 | |||
| 832 | // DUO box |
||
| 833 | echo ' |
||
| 834 | <div id="dialog_duo" style="display:none;padding:4px;"> |
||
| 835 | <div id="div_duo"></div> |
||
| 836 | '.$LANG['duo_loading_iframe'].' |
||
| 837 | <form method="post" id="duo_form" action="#"> |
||
| 838 | <input type="hidden" id="duo_login" name="duo_login" value="', null !== $post_duo_login ? $post_duo_login : '', '" /> |
||
| 839 | <input type="hidden" id="duo_data" name="duo_data" value="', null !== $post_duo_data ? htmlentities(base64_decode($post_duo_data)) : '', '" /> |
||
| 840 | </form> |
||
| 841 | </div>'; |
||
| 842 | |||
| 843 | // INCREASE session time |
||
| 844 | echo ' |
||
| 845 | <div id="div_increase_session_time" style="display:none;padding:4px;"> |
||
| 846 | <b>'.$LANG['index_session_duration'].':</b> |
||
| 847 | <input type="text" id="input_session_duration" style="width:50px;padding:5px;margin:0 10px 0 10px;" class="text ui-widget-content ui-corner-all" value="', isset($_SESSION['user_settings']['session_duration']) ? (int) $_SESSION['user_settings']['session_duration'] / 60 : 60, '" /> |
||
| 848 | <b>'.$LANG['minutes'].'</b> |
||
| 849 | <div style="display:none;margin-top:5px;text-align:center;padding:4px;" id="input_session_duration_warning" class="ui-widget-content ui-state-error ui-corner-all"></div> |
||
| 850 | </div>'; |
||
| 851 | |||
| 852 | closelog(); |
||
| 853 | |||
| 854 | ?> |
||
| 855 | <script type="text/javascript">NProgress.start();</script> |
||
| 856 | </body> |
||
| 857 | </html> |
isset($_POST['login']) ? $_POST['login'] : ''can contain request data and is used in output context(s) leading to a potential security vulnerability.1 path for user data to reach this point
$_POSTin index.php on line 696
Preventing Cross-Site-Scripting Attacks
Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.
In order to prevent this, make sure to escape all user-provided data:
General Strategies to prevent injection
In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:
if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) { throw new \InvalidArgumentException('This input is not allowed.'); }For numeric data, we recommend to explicitly cast the data: