예제 #1
0
    print "Usage: php {$argv[0]} <filename>\n";
    exit(1);
}
array_shift($argv);
define('MEDIAWIKI', 1);
define('NOT_REALLY_MEDIAWIKI', 1);
$IP = dirname(__FILE__) . '/../..';
require_once "{$IP}/includes/Defines.php";
require_once "{$IP}/languages/Language.php";
$files = array();
foreach ($argv as $arg) {
    $files = array_merge($files, glob($arg));
}
foreach ($files as $filename) {
    print "{$filename}...";
    $vars = getVars($filename);
    $keys = array_keys($vars);
    $diff = array_diff($keys, Language::$mLocalisationKeys);
    if ($diff) {
        print "\nWarning: unrecognised variable(s): " . implode(', ', $diff) . "\n";
    } else {
        print " ok\n";
    }
}
function getVars($filename)
{
    require $filename;
    $vars = get_defined_vars();
    unset($vars['filename']);
    return $vars;
}
예제 #2
0
//	printSelection(getStringFromRequest('files'),getStringFromRequest('pluginpath'));
if (!getStringFromRequest('doedit')) {
    $filepath = $gfcgfile;
    $has_write = true;
    @($handle = fopen($filepath, 'r+'));
    if (!$handle) {
        // Open readonly but tell you can't write
        $handle = fopen($filepath, 'r');
        $has_write = false;
        $feedback .= _('Could not open the file for read/write. Check the permissions for apache') . '<br />';
    }
    if ($handle) {
        fclose($handle);
        // we had to open it in r+ because we need to check we'll be able to save it later
        $filedata = file_get_contents($filepath);
        $vars = getVars($filedata);
        // get the vars from local.inc
        $keys = array_keys($vars);
        sort($keys);
        echo '<h2>Configuration file: ' . $filepath . '</h2>';
        $title_arr = array(_('Attribute'), _('On'), _('Off'));
        echo $HTML->listTableTop($title_arr);
        $j = 0;
        for ($i = 0; $i < count($keys); $i++) {
            $checkedtrue = "";
            $checkedfalse = "";
            $vars[$keys[$i]] == "true" ? $checkedtrue = ' checked="checked" ' : ($checkedfalse = ' checked="checked" ');
            echo '<tr ' . $HTML->boxGetAltRowStyle($j + 1) . '>' . '<td>' . $keys[$i] . '</td>' . '<td style="text-align:center"><input type="radio" name="attributes[' . $keys[$i] . ']" value="true" ' . $checkedtrue . '/>' . '</td>' . '<td style="text-align:center"><input type="radio" name="attributes[' . $keys[$i] . ']" value="false" ' . $checkedfalse . '/></td>' . '</tr>' . "\n";
            $j++;
        }
        echo $HTML->listTableBottom();
예제 #3
0
        }
    } else {
        $files = $args;
    }
    if (isset($options['o'])) {
        $out = fopen($options['o'], 'wb');
        if (!$out) {
            fwrite($stderr, "Unable to open file \"{$options['o']}\" for output\n");
            exit(1);
        }
    } else {
        $out = fopen('php://stdout', 'wb');
    }
    $vars = array();
    foreach ($files as $inputFile) {
        $vars = array_merge($vars, getVars($inputFile));
    }
    fwrite($out, serialize($vars));
    fclose($out);
    exit(0);
}
//----------------------------------------------------------------------------
function getVars($_gv_filename)
{
    require $_gv_filename;
    $vars = get_defined_vars();
    unset($vars['_gv_filename']);
    # Clean up line endings
    if (wfIsWindows()) {
        $vars = unixLineEndings($vars);
    }
예제 #4
0
    }
} else {
    ?>
<h1>
    <a href="<?php 
    echo HTTP_SERVER . 'index.php?category=1&task=new';
    ?>
">add new category</a>
</h1>
<h3>
</h3>
<p class="desc">
    Add a new variable by clickin on above link.
</p>
<?php 
    $vars = getVars();
    if (mysql_num_rows($vars)) {
        while ($row = mysql_fetch_assoc($vars)) {
            $var = new Variable($row['var_id']);
            ?>
                <h1>
                    <?php 
            echo html_entity_decode($var->var_name);
            ?>
                </h1>
                <h3>
                <a href="<?php 
            echo HTTP_SERVER . 'index.php?variable=1&id=' . html_entity_decode($var->var_id) . '&task=edit';
            ?>
">edit</a>
                <a href="<?php