/**
  * Gets the correct error message.
  *
  * Methoed tries to use $lang-Object. If not available, hardcoded english phrases will be used.
  *
  * @return	string		error message
  */
 function get_error()
 {
     if ($this->error == null) {
         return false;
     }
     $lang = new lang();
     $lang->group("classes");
     switch ($this->error) {
         case UPLOAD_ERR_FILE_INDEX:
             $message = $lang->phrase('upload_error_noupload');
             break;
         case UPLOAD_ERR_FILE_SIZE:
             $lang->assign('mfs', formatFilesize($this->max_filesize));
             $message = $lang->phrase('upload_error_maxfilesize');
             break;
         case UPLOAD_ERR_IMAGE_WIDTH:
         case UPLOAD_ERR_IMAGE_HEIGHT:
             $lang->assign('mih', $this->max_image_height > 0 ? numbers($this->max_image_height) : $lang->phrase('upload_unspecified'));
             $lang->assign('miw', $this->max_image_width > 0 ? numbers($this->max_image_width) : $lang->phrase('upload_unspecified'));
             $message = $lang->phrase('upload_error_maximagesize');
             break;
         case UPLOAD_ERR_FILE_TYPE:
             $lang->assign('aft', implode(', ', $this->file_types));
             $message = $lang->phrase('upload_error_wrongfiletype');
             break;
         case UPLOAD_ERR_COPY:
             $message = $lang->phrase('upload_error_noaccess');
             break;
         case UPLOAD_ERR_FILE_EXISTS:
             $message = $lang->phrase('upload_error_fileexists');
             break;
         default:
             $message = $lang->phrase('upload_error_default');
     }
     if (!empty($this->file['name'])) {
         return "{$this->file['name']}: {$message}";
     } else {
         return $message;
     }
 }
include_once "classes/class.language.php";
// Global functions
require_once "classes/function.global.php";
$benchmark = benchmarktime();
$slog = new slog();
$my = $slog->logged();
$lang->initAdmin($my->language);
$tpl = new tpl();
$slog->checkBan();
$my->p = $slog->Permissions();
$job = $gpc->get('job', str);
if (!isset($my->settings['admin_interface'])) {
    $my->settings['admin_interface'] = $admconfig['nav_interface'];
}
// Arrays for Dates
$months = array($lang->phrase('admin_months_january'), $lang->phrase('admin_months_february'), $lang->phrase('admin_months_march'), $lang->phrase('admin_months_april'), $lang->phrase('admin_months_may'), $lang->phrase('admin_months_june'), $lang->phrase('admin_months_july'), $lang->phrase('admin_months_august'), $lang->phrase('admin_months_september'), $lang->phrase('admin_months_october'), $lang->phrase('admin_months_november'), $lang->phrase('admin_months_december'));
$days = array($lang->phrase('admin_days_sunday'), $lang->phrase('admin_days_monday'), $lang->phrase('admin_days_tuesday'), $lang->phrase('admin_days_wednesday'), $lang->phrase('admin_days_thursday'), $lang->phrase('admin_days_friday'), $lang->phrase('admin_days_saturday'));
// Arrays for Permissions
$gls = array('admin' => $lang->phrase('admin_gls_admin'), 'gmod' => $lang->phrase('admin_gls_gmod'), 'guest' => $lang->phrase('admin_gls_guest'), 'members' => $lang->phrase('admin_gls_members'), 'profile' => $lang->phrase('admin_gls_profile'), 'pdf' => $lang->phrase('admin_gls_pdf'), 'pm' => $lang->phrase('admin_gls_pm'), 'wwo' => $lang->phrase('admin_gls_wwo'), 'search' => $lang->phrase('admin_gls_search'), 'team' => $lang->phrase('admin_gls_team'), 'usepic' => $lang->phrase('admin_gls_usepic'), 'useabout' => $lang->phrase('admin_gls_useabout'), 'usesignature' => $lang->phrase('admin_gls_usesignature'), 'downloadfiles' => $lang->phrase('admin_gls_downloadfiles'), 'forum' => $lang->phrase('admin_gls_forum'), 'posttopics' => $lang->phrase('admin_gls_posttopics'), 'postreplies' => $lang->phrase('admin_gls_postreplies'), 'addvotes' => $lang->phrase('admin_gls_addvotes'), 'attachments' => $lang->phrase('admin_gls_attachments'), 'edit' => $lang->phrase('admin_gls_edit'), 'voting' => $lang->phrase('admin_gls_voting'), 'docs' => $lang->phrase('admin_gls_docs'));
$gll = array('admin' => $lang->phrase('admin_gll_admin'), 'gmod' => $lang->phrase('admin_gll_gmod'), 'guest' => $lang->phrase('admin_gll_guest'), 'members' => $lang->phrase('admin_gll_members'), 'profile' => $lang->phrase('admin_gll_profile'), 'pdf' => $lang->phrase('admin_gll_pdf'), 'pm' => $lang->phrase('admin_gll_pm'), 'wwo' => $lang->phrase('admin_gll_wwo'), 'search' => $lang->phrase('admin_gll_search'), 'team' => $lang->phrase('admin_gll_team'), 'usepic' => $lang->phrase('admin_gll_usepix'), 'useabout' => $lang->phrase('admin_gll_useabout'), 'usesignature' => $lang->phrase('admin_gll_usesignature'), 'downloadfiles' => $lang->phrase('admin_gll_downloadfiles'), 'forum' => $lang->phrase('admin_gll_forum'), 'posttopics' => $lang->phrase('admin_gll_posttopics'), 'postreplies' => $lang->phrase('admin_gll_postreplies'), 'addvotes' => $lang->phrase('admin_gll_addvotes'), 'attachments' => $lang->phrase('admin_gll_attachments'), 'edit' => $lang->phrase('admin_gll_edit'), 'voting' => $lang->phrase('admin_gll_voting'), 'docs' => $lang->phrase('admin_gll_docs'));
$glk = array_keys($gls);
$glk_forums = array('f_downloadfiles' => 'downloadfiles', 'f_forum' => 'forum', 'f_posttopics' => 'posttopics', 'f_postreplies' => 'postreplies', 'f_addvotes' => 'addvotes', 'f_attachments' => 'attachments', 'f_edit' => 'edit', 'f_voting' => 'voting');
$guest_limitation = array('admin', 'gmod', 'pm', 'usepic', 'useabout', 'usesignature', 'voting', 'edit');
function getLangCodesByDir($dir)
{
    $d = dir($dir);
    $codes = array();
    while (false !== ($entry = $d->read())) {
        if (preg_match('~^(\\w{2})_?(\\w{0,2})$~i', $entry, $code) && is_dir("{$dir}/{$entry}")) {
            if (!isset($codes[$code[1]])) {
                $codes[$code[1]] = array();
// A class for Templates
include_once "classes/class.template.php";
// A class for Languages
include_once "classes/class.language.php";
// Global functions
require_once "classes/function.global.php";
$benchmark = benchmarktime();
$slog = new slog();
$my = $slog->logged();
$lang->initAdmin($my->language);
$tpl = new tpl();
$slog->checkBan();
$my->p = $slog->Permissions();
$job = $gpc->get('job', str);
// Arrays for Dates
$months = array($lang->phrase('admin_months_january'), $lang->phrase('admin_months_february'), $lang->phrase('admin_months_march'), $lang->phrase('admin_months_april'), $lang->phrase('admin_months_may'), $lang->phrase('admin_months_june'), $lang->phrase('admin_months_july'), $lang->phrase('admin_months_august'), $lang->phrase('admin_months_september'), $lang->phrase('admin_months_october'), $lang->phrase('admin_months_november'), $lang->phrase('admin_months_december'));
$days = array($lang->phrase('admin_days_sunday'), $lang->phrase('admin_days_monday'), $lang->phrase('admin_days_tuesday'), $lang->phrase('admin_days_wednesday'), $lang->phrase('admin_days_thursday'), $lang->phrase('admin_days_friday'), $lang->phrase('admin_days_saturday'));
function nl2whitespace($str)
{
    return preg_replace("~(\r\n|\n|\r)~", " ", $str);
}
function AdminLogInForm()
{
    global $gpc, $lang;
    $addr = $gpc->get('addr', none);
    ?>
	<form action="editorcp.php?action=login2<?php 
    echo iif(!empty($addr), '&amp;addr=' . rawurlencode($addr));
    ?>
" method="post" target="_top">
	 <table class="border" style="width: 50%;">