|
// +---------------------------------------------------------------------------+
function authFileExists()
{
    if (file_exists(SGL_PATH . '/AUTH.txt')) {
        $file = file_get_contents(SGL_PATH . '/AUTH.txt');
        if (strpos($file, $_SESSION['authString']) !== false) {
            return true;
        } else {
            return array('authFile' => '* Authorisation string not found in AUTH.txt file');
        }
    } else {
        return array('authFile' => '* AUTH.txt file does not exist');
    }
}
/**
 * @package Install
 */
class WizardSetupAuth extends HTML_QuickForm_Page
{
    function buildForm()
    {
        $this->_formBuilt = true;
        if (!isset($_SESSION['authString'])) {
            $_SESSION['authString'] = md5($_SERVER['HTTP_HOST'] . SGL_PATH);
        }
        $this->addElement('header',     null, 'Seagull Setup Authorisation: page 2 of 6');
        $this->addElement('static', 'authFile', 'Authenticate',
            'This step is a simple authentication check to make sure the owner of ' .
            'this site is performing this installation.
' .
            '
' .
            'All that is required for you to do is to create a text file named AUTH.txt ' .
            'containing the following randomly generated string of characters and place it ' .
            'in the root directory of the Seagull application. This is the same ' .
            'directory that has the INSTALL.txt, README.txt, and VERSION.txt files.
' .
            '
' .
            '' . $_SESSION["authString"] . '
' .
            '
' .
            'To simplify things for you, you can click on this link to download the AUTH.txt ' .
            'file. Once you download the file, simply place it in the root ' .
            'directory of this Seagull application.');
        $this->addElement('hidden', 'authString', $_SESSION['authString']);
        $this->addFormRule('authFileExists');
        //  submit
        $prevnext[] =& $this->createElement('submit',   $this->getButtonName('back'), '<< Back');
        $prevnext[] =& $this->createElement('submit',   $this->getButtonName('next'), 'Next >>');
        $this->addGroup($prevnext, null, '', ' ', false);
        $this->setDefaultAction('next');
    }
}
?>