= G2_SUPPORT_MAX_LOGIN_ATTEMPTS) { if (!file_exists($authFile)) { $options['authFileErrors']['missing'] = 1; } else if (!is_readable($authFile)) { $options['authFileErrors']['unreadable'] = 1; } else { $authKeyFromFile = trim(join('', file($authFile))); if ($authKeyFromFile == $options['key']) { GallerySetupUtilities::authenticateThisSession(); GallerySetupUtilities::redirectBackToSelf(); exit; } else { $options['authFileErrors']['mismatch'] = 1; } } render('loginTxtForm', $options); } else if (!empty($_POST['password'])) { if ($_POST['password'] == $config['setup.password']) { GallerySetupUtilities::authenticateThisSession(); GallerySetupUtilities::redirectBackToSelf(); exit; } else { $options['attempts']++; if (!GallerySetupUtilities::setLoginAttempts($options['attempts'])) { $options['error'] = true; } if ($options['error'] || $options['attempts'] >= G2_SUPPORT_MAX_LOGIN_ATTEMPTS) { if ($options['attempts'] >= G2_SUPPORT_MAX_LOGIN_ATTEMPTS) { $ret = GallerySetupUtilities::notifySiteAdministrator(); /* swallow return code; we can't do anything with it */ } render('loginTxtForm', $options); } else { $options['wrongPassword'] = 1; render('passwordForm', $options); } } } else { if (isset($_POST['password'])) { $options['missingPassword'] = 1; } render('passwordForm', $options); } } if (GallerySetupUtilities::isSessionAuthenticated()) { /* This is the only safe way out of this include. Everything else aborts now */ return; } /* Unless we're properly authenticated, this is the end of the line */ exit; function startForm($action='', $name=null) { print '