Exemplo n.º 1
0
function _getInputCLI()
{
    $opt = _read();
    $opt = strtoupper(trim($opt));
    return $opt;
}
Exemplo n.º 2
0
if (isset($_GET['rename']) && AJAX_request()) {
    file_exists_str($_GET['rename']);
    @rename($_GET['rename'], $directory . '/' . $_GET['newrename']);
}
if (isset($_GET['unzip']) && AJAX_request()) {
    file_exists_str($_GET['unzip']);
    @openZipArchive($_GET['unzip'], $_GET['to']);
}
if (isset($_GET['listFolderFiles']) && AJAX_request()) {
    die(listFolderFiles($directory));
}
if (isset($_GET['read']) && $show_file_or_dir && AJAX_request()) {
    file_exists_str($_GET['read']);
    if (in_array(extension($_GET['read']), $_extensions[1]) || count($_extensions[1]) == 0) {
        header('Content-type: text/html; charset=' . $charset);
        die(_read($_GET['read']));
    } else {
        die($lang[7]);
    }
}
if (isset($_GET['write']) && $show_file_or_dir && AJAX_request()) {
    file_exists_str($_POST['write']);
    if (in_array(extension($_POST['write']), $_extensions[1]) || count($_extensions[1]) == 0) {
        header('Content-type: text/html; charset=' . $charset);
        $txtData = isset($_POST['txt']) ? $_POST['txt'] : '';
        die(_write($_POST['write'], $txtData));
    } else {
        die($lang[7]);
    }
}
if (isset($_GET['uploadfile']) && AJAX_request()) {
Exemplo n.º 3
0
function loadMO($file)
{
    $translations = array();
    if (is_resource($file)) {
        $fh = $file;
        fseek($fh, 0);
    } else {
        if (is_string($file)) {
            $fh = fopen($file, 'r');
            if ($fh === false) {
                I2CE::raiseError("Could not read {$file}");
                return $translations;
            }
        } else {
            I2CE::raiseError("Don't know how to read what you gave me");
            return $translations;
        }
    }
    //http://www.gnu.org/software/autoconf/manual/gettext/MO-Files.html
    $big_mo_magic = 0x9504 << 16 | 0x12de;
    $litle_mo_magic = 0xde12 << 16 | 0x495;
    $read_magic = _read($fh, 2);
    if ($read_magic == $big_mo_magic) {
        // "big endian"
        $big = true;
    } else {
        if ($read_magic == $litle_mo_magic) {
            //"litle endian ";
            $big = false;
        } else {
            I2CE::raiseError("Cannot determin magic number 0x" . dechex($read_magic) . " as mo file for {$file}\n" . "\tBig magic number 0x" . dechex($big_mo_magic) . "\n" . "\tLitle magic number 0x" . dechex($litle_mo_magic));
            fclose($fh);
            return $translations;
        }
    }
    //now check the revision number is zero
    //echo "At byte " . ftell($fh) . "\n";
    if (_read($fh, 2) != 0) {
        I2CE::raiseError("Wrong revision number -- not zero");
        fclose($fh);
        return $translation;
    }
    $num = _read($fh, 2, $big);
    $orig_offset = _read($fh, 2, $big);
    $trans_offset = _read($fh, 2, $big);
    fseek($fh, $orig_offset);
    $orig_offsets = array();
    for ($i = 0; $i < $num; $i++) {
        $orig_offsets[] = array(_read($fh, 2, $big), _read($fh, 2, $big));
        //length and offset
    }
    fseek($fh, $trans_offset);
    $tran_offsets = array();
    for ($i = 0; $i < $num; $i++) {
        $tran_offsets[] = array(_read($fh, 2, $big), _read($fh, 2, $big));
        //length and offset
    }
    for ($i = 0; $i < $num; $i++) {
        if ($orig_offsets[$i][0] <= 0) {
            continue;
        }
        fseek($fh, $orig_offsets[$i][1]);
        $orig = mb_convert_encoding(fread($fh, $orig_offsets[$i][0]), 'UTF-8', 'ASCII');
        fseek($fh, $tran_offsets[$i][1]);
        $tran = explode(0, fread($fh, $tran_offsets[$i][0]));
        //explode for plural forms
        if (count($tran) == 1) {
            $tran = $tran[0];
        }
        $translations[$orig] = $tran;
    }
    fclose($fh);
    return $translations;
}
Exemplo n.º 4
0
    return $result;
}
function _write($path, $v)
{
    $f = fopen($path, "w+");
    flock($f, LOCK_EX);
    fwrite($f, $v);
    flock($f, LOCK_UN);
    fclose($f);
}
$header = _read(realpath('./..') . '/src/000_header.js') . "\n";
$footer = _read(realpath('./..') . '/src/999_footer.js') . "\n";
$path = realpath('./..') . '/src/';
$js = '';
foreach (array(1 => 'base', 5 => 'detect', 10 => 'polyfill', 15 => 'cls', 20 => 'math', 25 => 'date', 30 => 'util', 35 => 'local', 40 => 'network', 45 => 'style', 50 => 'css', 55 => 'key', 60 => 'event', 70 => 'win', 80 => 'query', 90 => 'dom', 100 => 'template', 110 => 'i18n', 120 => 'vali', 130 => 'ani', 140 => 'img', 150 => 'ga', 900 => 'boot') as $k => $v) {
    $js .= _read($path . substr('0' . $k, -3) . '_' . $v . '.js', "r") . "\n";
}
_write(realpath('') . '/build.js', $header . $js . $footer);
require_once dirname(__FILE__) . '/JSMin.php';
$min = JavaScriptMinifier::minify($js);
_write(realpath('') . '/min.js', $header . $min . $footer);
$root = isset($_GET['root']) && $_GET['root'] == 'true' ? TRUE : FALSE;
switch (isset($_GET['live']) ? $_GET['live'] : 'full') {
    case 'min':
        _write(realpath('./..') . '/index.js', $header . $min . $footer);
        $live = 'min';
        if ($root) {
            _write(realpath('./../..') . '/index.js', $header . $min . $footer);
        }
        break;
    case 'full':
Exemplo n.º 5
0
function charmap($page_id)
{
    global $db, $board_config, $template, $lang, $images, $theme, $phpEx, $phpbb_root_path;
    global $user_ip, $session_length, $starttime;
    global $userdata;
    // ensure categories hierarchy v2.1.x compliancy
    if (!empty($board_config['mod_cat_hierarchy'])) {
        global $config, $user, $censored_words, $icons, $navigation, $themes, $smilies;
        global $forums, $forum_id;
        // fix this missing var
        $topic_title = '';
        $forum_id = intval($forum_id);
        if (empty($forum_id)) {
            $forum_id = _read(POST_FORUM_URL, TYPE_INT);
        }
    }
    $userdata = session_pagestart($user_ip, $page_id);
    init_userprefs($userdata);
    // bbc box language file
    if ($userdata['user_id'] != ANONYMOUS) {
        if (!empty($userdata['user_lang'])) {
            $board_config['default_lang'] = $userdata['user_lang'];
        }
    }
    if (!file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_bbc_box.' . $phpEx))) {
        $board_config['default_lang'] = 'english';
    }
    include_once $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_bbc_box.' . $phpEx;
    $gen_simple_header = TRUE;
    $page_title = $lang['charmap_page'] . " - {$topic_title}";
    include $phpbb_root_path . 'includes/page_header.' . $phpEx;
    $template->set_filenames(array('chrpopup' => 'bbc_chr_popup.tpl'));
    $template->assign_vars(array('L_CHARMAP_TITLE' => $lang['charmap_title'], 'L_CLOSE_WINDOW' => $lang['Close_window'], 'BBC_CHR_SHEET' => $images['bbc_chr_sheet']));
    $template->pparse('chrpopup');
}