Location: PHPKode > projects > phlyMail Lite > phlymail/config/setup.general.php
<?php
/**
 * Setup General Settings
 * @package phlyMail Nahariya 4.0+ Default Branch
 * @copyright 2003-2010 phlyLabs, Berlin (http://phlylabs.de)
 * @version 4.0.5 2010-08-20
 */
// Only valid within phlyMail
if (!defined('_IN_PHM_')) die();

if (!isset($_SESSION['phM_perm_read']['general_']) && !$_SESSION['phM_superroot']) {
    $tpl = new fxl_template(CONFIGPATH.'/templates/setup.noaccess.tpl');
    $tpl->assign('msg_no_access', $WP_msg['no_access']);
    return;
}

$whattodo = (isset($_REQUEST['whattodo'])) ? $_REQUEST['whattodo'] : false;
$WP_return = (isset($_REQUEST['WP_return']) && $_REQUEST['WP_return']) ? $_REQUEST['WP_return'] : false;

if ('save' == $whattodo) {
    if (!isset($_SESSION['phM_perm_write']['general_']) && !$_SESSION['phM_superroot']) {
        $tpl = new fxl_template(CONFIGPATH.'/templates/setup.noaccess.tpl');
        $tpl->assign('msg_no_access', $WP_msg['no_access']);
        return;
    }
    $tokens = array
            ('theme_name' => 'WP_newskin'
            ,'language' => 'WP_newlang'
            ,'receipt_out' => 'WP_newreceiptout'
            ,'send_wordwrap' => 'WP_newsendwordwrap'
            ,'logout_redir_uri' => 'logout_uri'
            ,'failed_redir_uri' => 'failed_uri'
            );
    $tokvar = array();
    foreach ($tokens as $k => $v) {
        $tokvar['core'][$k] = (isset($_REQUEST[$v])) ? $_REQUEST[$v] : 0;
    }
    $truth = basics::save_config($_PM_['path']['conf'].'/global.choices.ini.php', $tokvar);
    $WP_return = ($truth) ? $WP_msg['optssaved'] : $WP_msg['optsnosave'];
    header('Location: '.$link_base.'general&WP_return='.urlencode($WP_return));
    exit();
}

$tpl = new fxl_template(CONFIGPATH.'/templates/setup.general.tpl');
if ($WP_return) $tpl->assign_block('return');
$tpl->assign(array
        ('target_link' => htmlspecialchars($link_base.'general&whattodo=save')
        ,'WP_return' => $WP_return
        ,'head_text' => $WP_msg['SuHeadGen']
        ,'leg_general' => $WP_msg['general']
        ,'msg_optskin' => $WP_msg['optskin']
        ,'msg_optlang' => $WP_msg['optlang']
        ,'msg_optreceipt' => $WP_msg['optreceipt']
        ,'leg_receipt' => $WP_msg['LegReceipt']
        ,'about_receipt' => $WP_msg['AboutReceipt']
        ,'msg_optwrap' => $WP_msg['optwrap']
        ,'leg_wrap' => $WP_msg['LegWrap']
        ,'about_wrap' => $WP_msg['AboutWrap']
        ,'msg_uri_logout' => $WP_msg['URIlogout']
        ,'msg_uri_failed' => $WP_msg['URIfailed']
        ,'leg_URIs' => $WP_msg['LegURIs']
        ,'about_URIs' => $WP_msg['AboutURIs']
        ,'msg_save' => $WP_msg['save']
        ,'logout_uri' => isset($_PM_['core']['logout_redir_uri']) ? $_PM_['core']['logout_redir_uri'] : ''
        ,'failed_uri' => isset($_PM_['core']['failed_redir_uri']) ? $_PM_['core']['failed_redir_uri'] : ''
        ));
$themeEngine = trim(file_get_contents($_PM_['path']['conf'].'/theme.engine'));
$d_ = opendir($_PM_['path']['theme']);
while (false !== ($skinname = readdir($d_))) {
    if ($skinname == '.' or $skinname == '..') continue;
    if (!is_dir($_PM_['path']['theme'].'/'.$skinname)) continue;
    if (!file_exists($_PM_['path']['theme'].'/'.$skinname.'/main.tpl'))
    if (!file_exists($_PM_['path']['theme'].'/'.$skinname.'/choices.ini.php')) continue;
    // Read theme's chocies
    $thChoi = parse_ini_file($_PM_['path']['theme'].'/'.$skinname.'/choices.ini.php'); // Parse
    if (!isset($thChoi['engine']) || $thChoi['engine'] != $themeEngine) { // Has engine setting and version matches?
        continue; // This theme ought to be imcompatible
    }
    $skins[] = $skinname;
}
closedir($d_);
sort($skins);
$t_s = $tpl->get_block('skinline');
foreach($skins as $skinname) {
    $t_s->assign(array('key' => $skinname,  'skinname' => $skinname));
    if ($skinname == $_PM_['core']['theme_name']) $t_s->assign_block('sel');
    $tpl->assign('skinline', $t_s);
    $t_s->clear();
}
$langs = $langnames = array();
$d_ = opendir($_PM_['path']['message']);
while (false !== ($langname = readdir($d_))) {
    if ($langname == '.' || $langname == '..') continue;
    if (!preg_match('/\.php$/i', trim($langname))) continue;
    preg_match
            ('!\$WP_msg\[\'language_name\'\]\ \=\ \'([^\']+)\'!'
            ,file_get_contents($_PM_['path']['message'].'/'.$langname)
            ,$found
            );
    $langname = preg_replace('/\.php$/i', '', trim($langname));
    $langs[] = $found[1];
    $langnames[] = $langname;
}
closedir($d_);
array_multisort($langs, SORT_ASC, $langnames);
$t_s = $tpl->get_block('langline');
foreach($langs as $id => $langname) {
    $t_s->assign(array('key' => $langnames[$id], 'langname' => $langname));
    if ($langnames[$id] == $_PM_['core']['language']) $t_s->assign_block('sel');
    $tpl->assign('langline', $t_s);
    $t_s->clear();
}
if (isset($_PM_['core']['receipt_out']) && $_PM_['core']['receipt_out']) $tpl->assign_block('receipt');
if (isset($_PM_['core']['send_wordwrap']) && $_PM_['core']['send_wordwrap']) $tpl->assign_block('wordwrap');
?>
Return current item: phlyMail Lite