Пример #1
0
        }
    }
} else {
    if ($wgRequest->getSafeVal('password') == file_get_contents('/data/project/xtools/.password')) {
        $dbr = new Database('tools-db', $toolserver_username, $toolserver_password, 'p50380g50570_xtools');
        $dbr->query("SET NAMES 'utf8'");
        if (!$wgRequest->getBool('approve')) {
            try {
                $res = $dbr->select('translations', '*', array('tr_done' => 0, 'tr_denied' => 0));
                if (!count($res)) {
                    WebTool::toDie("No pending translations");
                }
                $submissions = array();
                foreach ($res as $row) {
                    $row['tr_date'] = date('r', strtotime($row['tr_date']));
                    $submissions[] = array_merge($row, array('tr_diff' => nl2br(getTextDiff('unified', htmlentities(@file_get_contents($tools[$row['tr_tool']]['uri'] . $row['tr_lang'] . '.conf')), htmlentities($row['tr_text'])))));
                }
                $content->assign("adminlist", true);
                $content->assign("submissionlist", $submissions);
                $content->assign("password", file_get_contents('/data/project/xtools/.password'));
            } catch (DBError $e) {
                WebTool::toDie($phptemp->get_config_vars('mysqlerror', $e->getMessage()));
            }
        } else {
            $post = $wgRequest->getValues();
            foreach ($post as $name => $val) {
                if (substr($name, 0, 7) != "result-") {
                    unset($post[$name]);
                }
            }
            foreach ($post as $name => $result) {
Пример #2
0
$langs[] = 'qqq';
$dirs = null;
$phptemp->assign("header", $phptemp->getConf('translation'));
if (isset($_POST['title'])) {
    $content->assign("submitted", true);
    $diff = "[pcount]\n";
    foreach ($_POST as $key => $get) {
        if ($key == "usedlanguage") {
            continue;
        }
        $diff .= $key . " = \"{$get}\"\n";
    }
    //$diff = utf8_encode( html_entity_decode( $diff ) );
    //echo  getTextDiff( 'unified', implode( "\n", file_get_contents( '/data/project/xtools/public_html/pcount/configs/'.$_GET['usedlanguage'].'.conf' ) ), $diff );
    if (is_file('/data/project/xtools/public_html/pcount/configs/' . $_POST['usedlanguage'] . '.conf')) {
        $diff .= "\n\n--------------\n\n" . getTextDiff('unified', file_get_contents('/data/project/xtools/public_html/pcount/configs/' . $_POST['usedlanguage'] . '.conf'), trim($diff));
    }
    $email = new Email("*****@*****.**", "Translation Machine", "New translation in the {$_POST['usedlanguage']} language", $diff . "\n\n-----------\n\n//tools.wmflabs.org/xtools/pcount/translate2.php?passu=arghyry3738&uselang=" . $_POST['usedlanguage']);
    $email->addTarget("*****@*****.**", "Cyberpwoer678");
    $email->send();
} elseif ((!isset($_GET['language']) || !in_array($_GET['language'], $langs)) && !isset($_GET['title'])) {
    $select = null;
    foreach ($langs as $lang) {
        if ($lang == "en") {
            $select .= '<option value="en" selected="selected">en</option>';
        } else {
            $select .= "<option>{$lang}</option>";
        }
        $select .= "\n";
    }
    $content->assign("form", $select);