Exemplo n.º 1
0
 $phpAds_config['tbl_adstats'] = $installvars['tbl_adstats'] = $table_prefix . 'adstats';
 $phpAds_config['tbl_adviews'] = $installvars['tbl_adviews'] = $table_prefix . 'adviews';
 $phpAds_config['tbl_adclicks'] = $installvars['tbl_adclicks'] = $table_prefix . 'adclicks';
 $phpAds_config['tbl_acls'] = $installvars['tbl_acls'] = $table_prefix . 'acls';
 $phpAds_config['tbl_session'] = $installvars['tbl_session'] = $table_prefix . 'session';
 $phpAds_config['tbl_zones'] = $installvars['tbl_zones'] = $table_prefix . 'zones';
 $phpAds_config['tbl_config'] = $installvars['tbl_config'] = $table_prefix . 'config';
 $phpAds_config['tbl_affiliates'] = $installvars['tbl_affiliates'] = $table_prefix . 'affiliates';
 $phpAds_config['tbl_images'] = $installvars['tbl_images'] = $table_prefix . 'images';
 $phpAds_config['tbl_userlog'] = $installvars['tbl_userlog'] = $table_prefix . 'userlog';
 $phpAds_config['tbl_cache'] = $installvars['tbl_cache'] = $table_prefix . 'cache';
 $phpAds_config['tbl_targetstats'] = $installvars['tbl_targetstats'] = $table_prefix . 'targetstats';
 if (phpAds_checkDatabaseExists()) {
     $errormessage[1][] = $strTableInUse;
 } else {
     if (phpAds_isConfigWritable()) {
         // Connect
         if (phpAds_dbConnect()) {
             if (phpAds_createDatabase($phpAds_config['table_type'])) {
                 // Insert basic settings into database and config file
                 phpAds_SettingsWriteAdd('config_version', $phpAds_version);
                 phpAds_SettingsWriteAdd('instance_id', phpAds_ConfigGenerateId());
                 phpAds_SettingsWriteAdd('dblocal', $installvars['dblocal']);
                 phpAds_SettingsWriteAdd('dbhost', $installvars['dbhost']);
                 phpAds_SettingsWriteAdd('dbport', $installvars['dbport']);
                 phpAds_SettingsWriteAdd('dbuser', $installvars['dbuser']);
                 phpAds_SettingsWriteAdd('dbpassword', $installvars['dbpassword']);
                 phpAds_SettingsWriteAdd('dbname', $installvars['dbname']);
                 phpAds_SettingsWriteAdd('table_prefix', $installvars['table_prefix']);
                 phpAds_SettingsWriteAdd('table_type', $installvars['table_type']);
                 phpAds_SettingsWriteAdd('mysql4_compatibility', $installvars['mysql4_compatibility']);
function phpAds_ShowSettings($data, $errors = array())
{
    global $phpAds_config, $HTTP_SERVER_VARS;
    global $tabindex;
    // Initialize tabindex (if not already done)
    if (!isset($tabindex)) {
        $tabindex = 1;
    }
    // Determine if config file is writable
    $phpAds_config_locked = !phpAds_isConfigWritable();
    // Show header
    if (!defined('phpAds_installing')) {
        $image = $phpAds_config_locked ? 'closed' : 'open';
        echo "<form name='settingsform' method='post' action='" . $HTTP_SERVER_VARS['PHP_SELF'] . "' onSubmit='return phpAds_formCheck(this);'>\n";
        echo "<br><div class='errormessage'><img class='errormessage' src='images/padlock-" . $image . ".gif' width='16' height='16' border='0' align='absmiddle'>\n";
        echo $phpAds_config_locked ? $GLOBALS['strEditConfigNotPossible'] : $GLOBALS['strEditConfigPossible'];
        echo "</div>\n";
    }
    $dependbuffer = "function phpAds_refreshEnabled () {\n";
    $checkbuffer = '';
    $helpbuffer = '';
    $i = 0;
    while (list(, $section) = each($data)) {
        if (!isset($section['visible']) || $section['visible']) {
            if (isset($errors[$i])) {
                phpAds_ShowSettings_StartSection($section['text'], $errors[$i]);
            } else {
                phpAds_ShowSettings_StartSection($section['text']);
            }
            while (list(, $item) = each($section['items'])) {
                if (!isset($item['visible']) || $item['visible']) {
                    $item['enabled'] = phpAds_ShowSettings_Locked($item);
                    if (!$item['enabled']) {
                        $dependbuffer .= phpAds_ShowSettings_CheckDependancies($data, $item);
                    }
                    if (count($errors)) {
                        // Page is the result of an error message, get values from the input
                        if (isset($item['name']) && isset($GLOBALS[$item['name']])) {
                            $value = $GLOBALS[$item['name']];
                        } else {
                            $value = '';
                        }
                    } else {
                        // Get the values from the config file
                        if (isset($item['name']) && isset($phpAds_config[$item['name']])) {
                            $value = $phpAds_config[$item['name']];
                        } else {
                            $value = '';
                        }
                    }
                    switch ($item['type']) {
                        case 'break':
                            phpAds_ShowSettings_Break($item);
                            break;
                        case 'checkbox':
                            phpAds_ShowSettings_Checkbox($item, $value);
                            break;
                        case 'text':
                            phpAds_ShowSettings_Text($item, $value);
                            break;
                        case 'textarea':
                            phpAds_ShowSettings_Textarea($item, $value);
                            break;
                        case 'password':
                            phpAds_ShowSettings_Password($item, $value);
                            break;
                        case 'select':
                            phpAds_ShowSettings_Select($item, $value);
                            break;
                    }
                    if (isset($item['check']) || isset($item['req'])) {
                        if (!isset($item['check'])) {
                            $item['check'] = '';
                        }
                        if (!isset($item['req'])) {
                            $item['req'] = false;
                        }
                        $checkbuffer .= "phpAds_formSetRequirements('" . $item['name'] . "', '" . addslashes($item['text']) . "', " . ($item['req'] ? 'true' : 'false') . ", '" . $item['check'] . "');\n";
                        if (isset($item['unique'])) {
                            $checkbuffer .= "phpAds_formSetUnique('" . $item['name'] . "', '|" . addslashes(implode('|', $item['unique'])) . "|');\n";
                        }
                    }
                    if (isset($item['name'])) {
                        $helpbuffer .= phpAds_SettingsHelp($item['name']);
                    }
                }
            }
            phpAds_ShowSettings_EndSection();
        }
        $i++;
    }
    if (!defined('phpAds_installing')) {
        echo '<br><br><input type="submit" value="' . $GLOBALS['strSaveChanges'] . '"></form>';
    }
    echo "<script language='JavaScript'>\n<!--\n\n";
    echo $dependbuffer . "}\n\nphpAds_refreshEnabled();\n\n";
    echo $checkbuffer . "\n";
    echo "var helpArray = new Array();\n\n";
    echo $helpbuffer . "\n";
    echo "//-->\n</script>";
}
Exemplo n.º 3
0
function phpAds_ConfigFilePrepare()
{
    global $phpAds_configBuffer, $phpAds_configFilepath;
    if (phpAds_isConfigWritable()) {
        if ($confighandle = @fopen($phpAds_configFilepath, 'r')) {
            $phpAds_configBuffer = @fread($confighandle, filesize($phpAds_configFilepath));
            @fclose($confighandle);
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}
// $Revision: 3830 $
/************************************************************************/
/* Openads 2.0                                                          */
/* ===========                                                          */
/*                                                                      */
/* Copyright (c) 2000-2007 by the Openads developers                    */
/* For more information visit: http://www.openads.org                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
// Prevent full path disclosure
if (!defined('phpAds_path')) {
    die;
}
// Recreate geotargeting configuration
if ($phpAds_config['geotracking_type'] && phpAds_isConfigWritable()) {
    include phpAds_path . '/libraries/geotargeting/geo-' . $phpAds_config['geotracking_type'] . '.inc.php';
    if (function_exists('phpAds_' . $phpAds_geoPluginID . '_getConf')) {
        $geoconf = call_user_func('phpAds_' . $phpAds_geoPluginID . '_getConf', $phpAds_config['geotracking_location']);
    } else {
        $geoconf = '';
    }
    if ($geoconf != $phpAds_config['geotracking_conf']) {
        phpAds_SettingsWriteAdd('geotracking_conf', $geoconf);
        phpAds_SettingsWriteFlush();
        phpAds_userlogAdd(phpAds_actionGeotargeting, 0);
    }
}