function check_executable_r($dir, $chmod = 0777, $func = CHMOD_DIR, $first = false)
{
    $dh = opendir($dir);
    if (!$first) {
        check_executable($dir, $chmod, false, $func);
    }
    while ($file = readdir($dh)) {
        if ($file != '.' && $file != '..') {
            $fullpath = $dir . DIRECTORY_SEPARATOR . $file;
            if (is_dir($fullpath)) {
                check_executable($fullpath, $chmod, false, $func);
                check_executable_r($fullpath, $chmod, $func, true);
            }
        }
    }
    closedir($dh);
}
require_once "classes/class.filesystem.php";
$filesystem = new filesystem($config['ftp_server'], $config['ftp_user'], $config['ftp_pw'], $config['ftp_port']);
$filesystem->set_wd($config['ftp_path']);
@(include_once "classes/function.chmod.php");
if ($config['check_filesystem'] == 1) {
    check_writable('admin/data/notes.php');
    check_writable_r('docs');
    check_writable_r('language');
    check_executable_r('admin/backup');
    check_executable_r('admin/data');
    check_executable_r('designs');
    check_executable_r('docs');
    check_executable_r('images');
    check_executable_r('templates');
    check_executable_r('components');
    check_executable_r('language');
    check_executable('classes/cron/jobs');
    check_executable('classes/feedcreator');
    check_executable('classes/fonts');
    check_executable('classes/geshi');
    check_executable('classes/graphic/noises');
    check_writable_r('templates');
}
@ini_set('default_charset', '');
header('Content-type: text/html; charset: iso-8859-1');
$htmlhead = '';
// Arrays for Dates
$months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
// Arrays for Permissions
$gls = array('admin' => 'Is Administrator', 'gmod' => 'Is Global Moderator', 'guest' => 'Is Guest', 'members' => 'Can view Memberlist', 'profile' => 'Can view Profiles', 'pdf' => 'Can view PDF-Files', 'pm' => 'Can use PM', 'wwo' => 'Can view Who is Online', 'search' => 'Can use Search', 'team' => 'Can view Teamlist', 'usepic' => 'Can use (own) Avatar', 'useabout' => 'Create (own) Personal Page', 'usesignature' => 'Can use (own) Signature', 'downloadfiles' => 'Can download Attachements', 'forum' => 'Can view Forums', 'posttopics' => 'Can start a new Thread', 'postreplies' => 'Can write a reply', 'addvotes' => 'Can start a Poll', 'attachments' => 'Can add Attachements', 'edit' => 'Can edit own Posts', 'voting' => 'Can vote', 'docs' => 'Can view Documents/Pages');