Ejemplo n.º 1
0
}
//==========================================================================//
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">



<html dir="<?php 
echo right_to_left() ? 'rtl' : 'ltr';
?>
">
<head>
<link rel="shortcut icon" href="theme/mpstheme/favicon.ico" />
<title>Mps Install</title>
<meta http-equiv="content-type" content="text/html; charset=<?php 
p(current_charset());
?>
" />
<?php 
css_styles();
?>

</head>

<body>


<?php 
if (isset($_GET['help'])) {
    print_install_help($_GET['help']);
    close_window_button();
Ejemplo n.º 2
0
    error_reporting($CFG->debug);
}
if (function_exists('require_capability')) {
    require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
} else {
    if (!isadmin()) {
        error("This page is only accessible to the admin user");
    }
}
if ($CFG->dbtype != "mysql" and $CFG->dbtype != "mysqli") {
    error("This section only works if you are using MySQL as your database");
}
// Make directory for uploads
make_upload_directory('mysql');
if (function_exists('current_charset')) {
    $CFG->defaultcharset = current_charset();
} else {
    //older Moodle versions
    $CFG->defaultcharset = get_string('thischarset');
}
// initialize security token with our sesskey if needed
if (!isset($_SESSION[' PMA_token '])) {
    $_SESSION[' PMA_token '] = sesskey();
}
// try to initialize defaut language if needed
if ($originallang === false and empty($_COOKIE['pma_lang']) and strtolower($CFG->defaultcharset) == 'utf-8') {
    $originallang = substr(current_language(), 0, 2) . '-utf-8';
    // should work for most locales
}
if ($CFG->version < 2007101600) {
    // < 2.0
require_login();
if (isguest()) {
    redirect($CFG->wwwroot);
}
// Script parameters
$wikiBlockId = required_param('wikiBlockId', PARAM_INT);
$wikiKeys = $_SESSION['wikipediaKeys'][$wikiBlockId];
// Stylesheets
$stylesheetshtml = '';
foreach ($CFG->stylesheets as $stylesheet) {
    $stylesheetshtml .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />';
}
/// Select encoding
$encoding = 'ISO-8859-1';
if (function_exists('current_charset')) {
    $encoding = current_charset();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title> </title>
<meta http-equiv="content-type" content="text/html; charset=<?php 
echo $encoding;
?>
" />
<?php 
echo $stylesheetshtml;
?>
</head>
<body>
function book_read_chapter($base, $ref)
{
    $file = $base . '/' . $ref;
    if (filesize($file) <= 0 or !is_readable($file)) {
        book_log($ref, get_string('error'), 2);
        return;
    }
    //first read data
    $handle = fopen($file, "rb");
    $contents = fread($handle, filesize($file));
    fclose($handle);
    //extract title
    $chapter = new object();
    if (preg_match('/<title>([^<]+)<\\/title>/i', $contents, $matches)) {
        $chapter->title = $matches[1];
    } else {
        $chapter->title = $ref;
    }
    //extract page body
    if (preg_match('/<body[^>]*>(.+)<\\/body>/is', $contents, $matches)) {
        $chapter->content = $matches[1];
    } else {
        book_log($ref, get_string('error'), 2);
        return;
    }
    book_log($ref, get_string('ok'));
    $chapter->importsrc = $ref;
    //extract page head
    if (preg_match('/<head[^>]*>(.+)<\\/head>/is', $contents, $matches)) {
        $head = $matches[1];
        if (preg_match('/charset=([^"]+)/is', $head, $matches)) {
            $enc = $matches[1];
            $textlib = textlib_get_instance();
            $chapter->content = $textlib->convert($chapter->content, $enc, current_charset());
            $chapter->title = $textlib->convert($chapter->title, $enc, current_charset());
        }
        if (preg_match_all('/<link[^>]+rel="stylesheet"[^>]*>/i', $head, $matches)) {
            //dlnsk extract links to css
            for ($i = 0; $i < count($matches[0]); $i++) {
                $chapter->content = $matches[0][$i] . "\n" . $chapter->content;
            }
        }
    }
    return $chapter;
}