Ejemplo n.º 1
0
// The PHPBB_VERSION constant was introduced in phpBB 3.0.3, some tools rely on this constant
// if it isn't set here fill it with $config['version'] for backward compatibility
if (!defined('PHPBB_VERSION')) {
    define('PHPBB_VERSION', $config['version']);
}
// Language path.  We are using a custom language path to keep all the files within the stk/ folder.  First check if the $user->data['user_lang'] path exists, if not, check if the default lang path exists, and if still not use english.
stk_add_lang('common');
// Do not use the normal template path (to prevent issues with boards using alternate styles)
$template->set_custom_template(STK_ROOT_PATH . 'style', 'stk');
// Work around for a bug in phpBB3.
$user->theme['template_storedb'] = false;
// Setup some variables
$action = request_var('action', '');
$submit = request_var('submit', false);
// Perform some quick tasks here that don't require any authentication!
perform_unauthed_quick_tasks($action);
/*
* Start Login
*/
$stk_passwd = $stk_passwd_expiration = FALSE;
// See whether we have an emergency login file
if (file_exists(STK_ROOT_PATH . 'passwd.' . PHP_EXT) && $user->data['user_type'] != USER_FOUNDER) {
    // Include the file
    include STK_ROOT_PATH . 'passwd.' . PHP_EXT;
    // Can we use trust this password
    if ($stk_passwd_expiration === false || time() > $stk_passwd_expiration) {
        // No. Unset the password and try to remove the file
        unset($stk_passwd);
        perform_authed_quick_tasks('delpasswdfile');
    }
}
Ejemplo n.º 2
0
/**
 * Perform all quick tasks that require the user to be authenticated
 *
 * @param	String	$action	The action we'll be performing
 */
function perform_authed_quick_tasks($action)
{
    global $user;
    switch ($action) {
        // User wants to logout and remove the password file
        case 'delpasswdfilelogout':
            $logout = true;
            // No Break;
            // If the user wants to distroy the passwd file
        // No Break;
        // If the user wants to distroy the passwd file
        case 'delpasswdfile':
            if (file_exists(STK_ROOT_PATH . 'passwd.' . PHP_EXT) && false === @unlink(STK_ROOT_PATH . 'passwd.' . PHP_EXT)) {
                // Shouldn't happen. Kill the script
                trigger_error($user->lang['FAIL_REMOVE_PASSWD'], E_USER_ERROR);
            }
            // Log him out
            if ($logout) {
                perform_unauthed_quick_tasks('stklogout');
            }
            break;
    }
}
Ejemplo n.º 3
0
if (!defined('DEBUG_CONTAINER')) {
    @define('DEBUG_CONTAINER', true);
}
if (!defined('PHPBB_DISPLAY_LOAD_TIME')) {
    @define('PHPBB_DISPLAY_LOAD_TIME', true);
}
ini_set('display_startup_errors', true);
ini_set('display_errors', 'on');
// Language path.  We are using a custom language path to keep all the files within the stk/ folder.  First check if the $user->data['user_lang'] path exists, if not, check if the default lang path exists, and if still not use english.
stk_add_lang('common');
// Do not use the normal template path (to prevent issues with boards using alternate styles)
$template->set_custom_style('stk', STK_ROOT_PATH . 'style');
// Work around for a bug in phpBB3.
$user->theme['template_storedb'] = false;
// Perform some quick tasks here that don't require any authentication!
perform_unauthed_quick_tasks($action, $submit);
/*
* Start Login
*/
$stk_passwd = $stk_passwd_expiration = false;
// See whether we have an emergency login file
if (file_exists(STK_ROOT_PATH . 'passwd.' . PHP_EXT) && $user->data['user_type'] != USER_FOUNDER) {
    // Include the file
    include STK_ROOT_PATH . 'passwd.' . PHP_EXT;
    // Can we use trust this password
    if ($stk_passwd_expiration === false || time() > $stk_passwd_expiration) {
        // No? Invalidate the password and try to remove the file
        $stk_passwd = false;
        perform_authed_quick_tasks('delpasswdfile');
    }
}