function parse($p1, $p2 = '', $fulltag) { global $_CONF, $LANG01, $LANG04; $retval = ''; if (COM_isAnonUser()) { $options = array('hide_forgotpw_link' => false, 'form_action' => $_CONF['site_url'] . '/users.php'); $options['title'] = $LANG04[65]; // log in to {site_name} $options['message'] = $LANG04[66]; // please enter your user name and password below $retval .= '<div class="uk-navbar-content uk-navbar-flip uk-hidden-small">'; $retval .= '<button class="uk-button uk-button-success" type="button" data-uk-modal="{target:\'#modalOpen\'}">' . $LANG01[58] . '</button></div>'; $retval .= '<div id="modalOpen" class="uk-modal">'; $retval .= '<div class="uk-modal-dialog uk-modal-dialog-medium"><a href="#" class="uk-modal-close uk-close"></a>'; $retval .= SEC_loginForm($options); $retval .= '</div></div>'; } else { $retval .= '<ul class="uk-navbar-nav tm-navbar-nav uk-navbar-flip">'; $retval .= '<li class="uk-parent uk-hidden-small" data-uk-dropdown>'; $retval .= '<a href="#">My Account <i class="uk-icon-caret-down"></i></a>'; $retval .= '<div class="uk-dropdown tm-dropdown uk-dropdown-navbar">'; $retval .= '<ul class="uk-nav uk-nav-navbar tm-nav-navbar">'; $userMenu = getUserMenu(); foreach ($userMenu as $option) { $retval .= '<li><a href="' . $option['url'] . '">' . $option['label'] . '</a></li>'; } $retval .= '</ul></div></li></ul>'; } return $retval; }
function _userVerify() { global $_CONF, $_SYSTEM, $_TABLES, $_USER, $LANG04; $retval = ''; $uid = (int) COM_applyFilter($_GET['u'], true); $vid = COM_applyFilter($_GET['vid']); if (!empty($uid) && is_numeric($uid) && $uid > 1 && !empty($vid) && strlen($vid) == 32) { $uid = (int) $uid; $safevid = DB_escapeString($vid); $result = DB_query("SELECT UNIX_TIMESTAMP(act_time) AS act_time FROM {$_TABLES['users']} WHERE uid=" . $uid . " AND act_token='" . $safevid . "' AND status=" . USER_ACCOUNT_AWAITING_VERIFICATION); if (DB_numRows($result) != 1) { $valid = 0; } else { $U = DB_fetchArray($result); if ($U['act_time'] != '' && $U['act_time'] > time() - $_SYSTEM['verification_token_ttl']) { $valid = 1; } else { $valid = 0; } } if ($valid == 1) { DB_query("UPDATE {$_TABLES['users']} SET status=" . USER_ACCOUNT_AWAITING_ACTIVATION . ",act_time='1000-01-01 00:00:00' WHERE uid=" . $uid); $retval .= COM_showMessage(515, '', '', 0, 'success'); $retval .= SEC_loginForm(); } else { // request invalid or expired $result = DB_query("SELECT * FROM {$_TABLES['users']} WHERE uid=" . $uid); if (DB_numRows($result) == 1) { $U = DB_fetchArray($result); switch ($U['status']) { case USER_ACCOUNT_AWAITING_ACTIVATION: case USER_ACCOUNT_ACTIVE: $retval .= COM_showMessage(517, '', '', 0, 'info'); $retval .= SEC_loginForm(); break; case USER_ACCOUNT_AWAITING_VERIFICATION: $retval .= COM_showMessage(516, '', '', 1, 'error'); $retval .= newtokenform($uid); break; default: echo COM_refresh($_CONF['site_url']); } } else { echo COM_refresh($_CONF['site_url']); } } } else { // this request doesn't make sense - ignore it echo COM_refresh($_CONF['site_url']); } return $retval; }
/** * Display a "to access this area you need to be logged in" message * * @return string HTML for the message */ function SEC_loginRequiredForm() { global $_CONF, $LANG_LOGIN; $cfg = array('title' => $LANG_LOGIN[1], 'message' => $LANG_LOGIN[2]); return SEC_loginForm($cfg); }
/** * Shows the user login form * after failed attempts to either login or access a page requiring login. * * @param boolean $hide_forgotpw_link whether to hide "forgot password?" link * @param int $userstatus status of the user's account * @return string HTML for login form */ function loginform($hide_forgotpw_link = false, $userstatus = -1) { global $LANG04; $cfg = array('hide_forgotpw_link' => $hide_forgotpw_link); if ($userstatus == USER_ACCOUNT_DISABLED) { $cfg['title'] = $LANG04[114]; $cfg['message'] = $LANG04[115]; $cfg['hide_forgotpw_link'] = true; $cfg['no_newreg_link'] = true; } elseif ($userstatus == USER_ACCOUNT_AWAITING_APPROVAL) { $cfg['title'] = $LANG04[116]; $cfg['message'] = $LANG04[117]; $cfg['hide_forgotpw_link'] = true; $cfg['no_newreg_link'] = true; } elseif ($userstatus == -2) { // No error user just visited page to login $cfg['title'] = $LANG04['user_login']; $cfg['message'] = $LANG04['user_login_message']; } else { // Status should be -1 which is login error $cfg['title'] = $LANG04[65]; $cfg['message'] = $LANG04[66]; } return SEC_loginForm($cfg); }
/** * Shows the user login form * after failed attempts to either login or access a page requiring login. * * @param boolean $hide_forgotpw_link whether to hide "forgot password?" link * @param int $userstatus status of the user's account * @return string HTML for login form * */ function loginform($hide_forgotpw_link = false, $userstatus = -1) { global $LANG04; $cfg = array('hide_forgotpw_link' => $hide_forgotpw_link); if ($userstatus == USER_ACCOUNT_DISABLED) { $cfg['title'] = $LANG04[114]; $cfg['message'] = $LANG04[115]; $cfg['hide_forgotpw_link'] = true; $cfg['no_newreg_link'] = true; } elseif ($userstatus == USER_ACCOUNT_AWAITING_APPROVAL) { $cfg['title'] = $LANG04[116]; $cfg['message'] = $LANG04[117]; $cfg['hide_forgotpw_link'] = true; $cfg['no_newreg_link'] = true; } else { $cfg['title'] = $LANG04[65]; $cfg['message'] = $LANG04[66]; } return SEC_loginForm($cfg); }