function enforce_authentication($minClass = CONFIG_UC_USER) { login_session_refresh(); if (!user_is_logged_in()) { logout(); } if ($_SESSION['IID'] != $_SESSION['UIID'] && !verifySAGlobal()) { logout(); } if ($_SESSION['class'] < $minClass) { log_exception(new Exception('Class less than required')); logout(); } if (user_is_staff() && $_SESSION['fingerprint'] != get_fingerprint()) { logout(); } enforce_2fa(); }
$fingerprints[$fingerprint] = 1; echo "<td class='{$evenodd}'>" . formatTimestamp(filemtime($basefilepath), 'm') . '<br />' . substr($fingerprint, 0, 16) . "<br /><input type='checkbox' name='basecheck[{$tpl_file}]' value='1' /></td>\n"; } else { echo "<td class='{$evenodd}'><br /></td>"; } // db template columns foreach ($tplsets as $tplset) { $tplset4disp = htmlspecialchars($tplset, ENT_QUOTES); // query for templates in db $drs = $db->query("SELECT * FROM " . $db->prefix("tplfile") . " f NATURAL LEFT JOIN " . $db->prefix("tplsource") . " s WHERE tpl_file='" . addslashes($tpl_file) . "' AND tpl_tplset='" . addslashes($tplset) . "'"); $numrows = $db->getRowsNum($drs); $tpl = $db->fetchArray($drs); if (empty($tpl['tpl_id'])) { echo "<td class='{$evenodd}'>({$numrows})</td>\n"; } else { $fingerprint = get_fingerprint(explode("\n", $tpl['tpl_source'])); if (isset($fingerprints[$fingerprint])) { $style = $fingerprints[$fingerprint]; } else { $fingerprint_style_count++; $style = $fingerprint_styles[$fingerprint_style_count]; $fingerprints[$fingerprint] = $style; } echo "<td class='{$evenodd}' style='{$style}'>" . formatTimestamp($tpl['tpl_lastmodified'], 'm') . '<br />' . substr($fingerprint, 0, 16) . "<br /><input type='checkbox' name='{$tplset4disp}_check[{$tpl_file}]' value='1' /> <a href='mytplsform.php?tpl_file=" . htmlspecialchars($tpl['tpl_file'], ENT_QUOTES) . "&tpl_tplset=" . htmlspecialchars($tpl['tpl_tplset'], ENT_QUOTES) . "'>" . _EDIT . "</a> ({$numrows})</td>\n"; } } echo "</tr>\n"; } // command submit ROW echo "\n\t<tr>\n\t\t<td class='head'>\n\t\t\t" . _MYTPLSADMIN_CREATE_NEW_TPLSET . ": <br />\n\t\t\t" . _MYTPLSADMIN_CAPTION_BASE . ":\n\t\t\t<select name='clone_tplset_from'>\n\t\t\t\t{$tplset_options}\n\t\t\t\t<option value='_blank_'>" . _MYTPLSADMIN_OPT_BLANKSET . "</option>\n\t\t\t</select>\n\t\t\t<br />\n\t\t\t" . _MYTPLSADMIN_CAPTION_SETNAME . ": <input type='text' name='clone_tplset_to' size='8' maxlength='16' /> <input type='submit' name='clone_tplset_do' value='" . _MD_GENERATE . "' />\n\t\t</td>\n\t\t<td class='head'></td>\n\t\t<td class='head'>\n\t\t\t" . _MYTPLSADMIN_CAPTION_COPYTO . ":\n\t\t\t<select name='copyf2db_to'>\n\t\t\t\t{$tplset_options}\n\t\t\t</select>\n\t\t\t<br />\n\t\t\t<input name='copyf2db_do' type='submit' value='" . _MYTPLSADMIN_BTN_COPY . "' onclick='return confirm(\"" . _MYTPLSADMIN_CNF_COPY_SELECTED_TEMPLATES . "\");' />\n\t\t</td>\n"; foreach ($tplsets as $tplset) {
function enforce_authentication($min_class = CONST_USER_CLASS_USER, $force_user_data_reload = false) { login_session_refresh($force_user_data_reload); if (!user_is_logged_in()) { logout(); } if ($_SESSION['class'] < $min_class) { log_exception(new Exception('Class less than required')); logout(); } if (user_is_staff() && $_SESSION['fingerprint'] != get_fingerprint()) { logout(); } enforce_2fa(); }
function user_sign_in($user_id) { session_regenerate_id(); $_SESSION['user-id'] = $user_id; $_SESSION['fingerprint'] = get_fingerprint($user_id); }