Example #1
0
     Log::addAuthenticationLog('Login failed (not approved by admin): ' . $username);
     throw new Exception(WT_I18N::translate('This account has not been approved.  Please wait for an administrator to approve it.'));
 }
 Auth::login($user);
 Log::addAuthenticationLog('Login: '******'/' . Auth::user()->getRealName());
 $WT_SESSION->timediff = $timediff;
 $WT_SESSION->locale = Auth::user()->getSetting('language');
 $WT_SESSION->theme_dir = Auth::user()->getSetting('theme');
 // If we’ve clicked login from the login page, we don’t want to go back there.
 if (strpos($url, WT_SCRIPT_NAME) === 0) {
     $url = '';
 }
 // We're logging in as an administrator
 if (Auth::isAdmin()) {
     // Check for updates
     $latest_version_txt = fetch_latest_version();
     if (preg_match('/^[0-9.]+\\|[0-9.]+\\|/', $latest_version_txt)) {
         list($latest_version, $earliest_version, $download_url) = explode('|', $latest_version_txt);
         if (version_compare(WT_VERSION, $latest_version) < 0) {
             // An upgrade is available.  Let the admin know, by redirecting to the upgrade wizard
             $url = 'admin_site_upgrade.php';
         }
     } else {
         // Cannot determine the latest version
     }
 }
 // Redirect to the target URL
 header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH . $url);
 // Explicitly write the session data before we exit,
 // as it doesn’t always happen when using APC.
 Zend_Session::writeClose();
Example #2
0
define('WT_SCRIPT_NAME', 'index.php');
require './includes/session.php';
// The only option for action is "ajax"
$action = WT_Filter::get('action');
// The default view depends on whether we are logged in
$ctype = WT_Filter::get('ctype', 'gedcom|user', WT_USER_ID ? 'user' : 'gedcom');
// Get the blocks list
if (WT_USER_ID && $ctype == 'user') {
    $blocks = get_user_blocks(WT_USER_ID);
} else {
    $blocks = get_gedcom_blocks(WT_GED_ID);
}
$all_blocks = WT_Module::getActiveBlocks();
// The latest version is shown on the administration page.  This updates it every day.
// TODO: send an email notification to the admin when new versions are available.
fetch_latest_version();
// We generate individual blocks using AJAX
if ($action == 'ajax') {
    $controller = new WT_Controller_Ajax();
    $controller->pageHeader();
    // Check we’re displaying an allowable block.
    $block_id = WT_Filter::getInteger('block_id');
    if (array_key_exists($block_id, $blocks['main'])) {
        $module_name = $blocks['main'][$block_id];
    } elseif (array_key_exists($block_id, $blocks['side'])) {
        $module_name = $blocks['side'][$block_id];
    } else {
        exit;
    }
    if (array_key_exists($module_name, $all_blocks)) {
        $class_name = $module_name . '_WT_Module';