Exemple #1
0
function _xMogrifyTest()
{
    global $C;
    $C['magick_mogrify_path'] = $_REQUEST['magick_mogrify_path'];
    check_image_resizer();
    if ($C['have_magick']) {
        JSON::Success('The mogrify path appears to be valid!');
    } else {
        if ($C['have_gd']) {
            JSON::Warning('The mogrify path does not appear to be valid, however the GD PHP extension is installed and can be used instead');
        } else {
            JSON::Warning('The mogrify path does not appear to be valid and the GD PHP extension is either not installed or configured without JPEG support.  Thumbnail resizing will not be possible.');
        }
    }
}
      <?php 
global $C;
$C = string_htmlspecialchars($C);
check_image_resizer();
?>
      <div id="dialog-content">

        <div id="dialog-header">
          <img src="images/dialog-close-22x22.png" id="dialog-close"/>
          Global Software Settings
        </div>

        <form method="post" action="xhr.php" enctype="multipart/form-data" class="xhr-form">

          <div id="dialog-panel" dwidth="900px">
            <div style="padding-top: 2px;">

              <fieldset>
                <legend>Base Settings</legend>

                <div class="field">
                  <label>Site Name:</label>
                  <span><input type="text" size="70" value="<?php 
echo $C['site_name'];
?>
" name="site_name"/></span>
                </div>

                <div class="field">
                  <label>Traffic URL:</label>
                  <span><input type="text" size="80" value="<?php 
Exemple #3
0
function write_config($settings)
{
    global $C;
    if (!file_exists(FILE_HISTORY)) {
        file_create(FILE_HISTORY);
    }
    unset($settings['r']);
    $settings['domain'] = preg_replace('~^www\\.~i', '', $_SERVER['HTTP_HOST']);
    $C = array_merge($C, $settings);
    check_image_resizer();
    $C['base_url'] = preg_replace('~/$~', '', $C['base_url']);
    $fp = fopen(DIR_LIB . '/config.php', 'r+');
    flock($fp, LOCK_EX);
    fwrite($fp, "<?php\nglobal \$C;\n\$C = array();\n");
    foreach ($C as $key => $val) {
        $val = str_replace(array('\\"', '\\.'), array('"', '.'), addslashes($val));
        fwrite($fp, "\$C['{$key}'] = '{$val}';\n");
    }
    fwrite($fp, "?>");
    ftruncate($fp, ftell($fp));
    flock($fp, LOCK_UN);
    fclose($fp);
    $in_settings = "\$C = array('cookie_domain' => '{$C['cookie_domain']}',\n" . "'domain' => '{$C['domain']}',\n" . "'keyphrase' => '{$C['keyphrase']}',\n" . "'flag_filter_no_image' => '{$C['flag_filter_no_image']}');";
    $out_settings = "\$C = array('domain' => '{$C['cookie_domain']}',\n" . "'keyphrase' => '{$C['keyphrase']}',\n" . "'distrib_forces' => '{$C['distrib_forces']}',\n" . "'distrib_main' => '{$C['distrib_main']}',\n" . "'distrib_primary' => '{$C['distrib_primary']}',\n" . "'distrib_secondary' => '{$C['distrib_secondary']}',\n" . "'count_clicks' => '{$C['count_clicks']}',\n" . "'fast_click' => '{$C['fast_click']}',\n" . "'trades_satisfied_url' => '{$C['trades_satisfied_url']}',\n" . "'flag_filter_no_image' => '{$C['flag_filter_no_image']}');";
    $img_settings = "\$C = array('dir_base' => '" . DIR_BASE . "',\n" . "'domain' => '{$C['cookie_domain']}',\n" . "'keyphrase' => '{$C['keyphrase']}');";
    // Write settings to in.php
    $in = string_format_lf(file_get_contents(FILE_IN_PHP));
    $in = preg_replace('~/\\*#<CONFIG>\\*/(.*?)/\\*#</CONFIG>\\*/~msi', "/*#<CONFIG>*/\n" . $in_settings . "\n/*#</CONFIG>*/", $in);
    if (version_compare(PHP_VERSION, '5.1.0', '>=')) {
        $timezone = date_default_timezone_get();
        $in = preg_replace('~/?/?date_default_timezone_set\\(\'.*?\'\\);~', "date_default_timezone_set('{$timezone}');", $in);
        $in = str_replace('//date_default_timezone_set($timezone);', 'date_default_timezone_set($timezone);', $in);
        $in = str_replace('//$timezone = date_default_timezone_get();', '$timezone = date_default_timezone_get();', $in);
    }
    file_write(FILE_IN_PHP, $in, null);
    // Write settings to out.php
    $out = string_format_lf(file_get_contents(FILE_OUT_PHP));
    $out = preg_replace('~/\\*#<CONFIG>\\*/(.*?)/\\*#</CONFIG>\\*/~msi', "/*#<CONFIG>*/\n" . $out_settings . "\n/*#</CONFIG>*/", $out);
    file_write(FILE_OUT_PHP, $out, null);
    // Write settings to image.php
    $img = string_format_lf(file_get_contents(FILE_IMAGE_PHP));
    $img = preg_replace('~/\\*#<CONFIG>\\*/(.*?)/\\*#</CONFIG>\\*/~msi', "/*#<CONFIG>*/\n" . $img_settings . "\n/*#</CONFIG>*/", $img);
    file_write(FILE_IMAGE_PHP, $img, null);
}