Location: PHPKode > projects > phlyMail Lite > phlymail/shared/drivers/mysql/setup.php
<?php
/**
 * DB setup module
 * @package phlyMail Nahariya 4.0+, Branch MessageCenter
 * @subpackage phlyMail DB
 * @subpackage Driver MySQL
 * @copyright 2002-2009 phlyLabs, Berlin (http://phlylabs.de)
 * @version 4.0.2 2009-11-14
 */
// Only valid within phlyMail
if (!defined('_IN_PHM_')) die();

require_once(file_exists($_PM_['tmp']['driver_dir'].'/lang.'.$WP_msg['language'].'.php')
        ? $_PM_['tmp']['driver_dir'].'/lang.'.$WP_msg['language'].'.php'
        : $_PM_['tmp']['driver_dir'].'/lang.en.php'
        );
if (!isset($_PM_['core']['file_umask'])) $_PM_['core']['file_umask'] = 0755;
$WP_DBset_action = (isset($_REQUEST['WP_DBset_action'])) ? $_REQUEST['WP_DBset_action'] : false;
$WP_DB = (isset($_REQUEST['WP_DB'])) ? $_REQUEST['WP_DB'] : array();
$skeleton = file($_PM_['tmp']['driver_dir'].'/conf.skel');
$WPDB['conf_file'] = $_PM_['path']['conf'].'/driver.'.$_PM_['core']['database'].'.ini.php';
if (!isset($conf_output)) $conf_output = '';

if ('do' == $WP_DBset_action) {
    $newDB = array();
    foreach ($skeleton as $v) {
        list($v) = explode(';;', trim($v), 4);
        $newDB[$v] = $WP_DB[$v];
    }
    basics::save_config($WPDB['conf_file'], $newDB, true, $_PM_['core']['file_umask']);
    $WP_DBset_action = false;
}
if (!$WP_DBset_action) {
    if (empty($WP_DB) && file_exists($WPDB['conf_file']) && is_readable($WPDB['conf_file'])) {
        $WP_DB = parse_ini_file($WPDB['conf_file']);
    }
    $conf_output .= $WP_drvmsg['HeadGen'].'<br /><table border="0" cellspacing="0" cellpadding="2">'.LF;
    foreach ($skeleton as $v) {
        $line = explode(';;', trim($v), 4);
        if (!isset($WP_DB[$line[0]])) {
            if (isset($DB) && is_object($DB) && isset($DB->DB[$line[0]])) {
                $WP_DB[$line[0]] = $DB->DB[$line[0]];
            } else {
                $WP_DB[$line[0]] = isset($line[3]) ? $line[3] : '';
            }
        }
        $conf_output .= '<tr class="body"><td align="left">'.$WP_drvmsg[$line[0]].'</td><td align="left">'
                .'<input type='.$line[1].' name="WP_DB['.$line[0].']" value="'.$WP_DB[$line[0]].'" size='.$line[2].' />'
                .'</td></tr>';
    }
    $conf_output .= '<tr class="body"><td colspan="2" align="right"><input type="hidden" name="WP_DBset_action" value="do" />'
            .'<input type="submit" value="'.$WP_drvmsg['save'].'" /></td></tr></table>';
}
?>
Return current item: phlyMail Lite