View file modules/padmin/settings.php

File size: 6.12Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.ua	  *
**********************************/
$locate = 'in_padmin';
if(isset($user) && $user['level'] >= 6) {

$title = $lang->word('padmin_settings');
require_once(SYS.'/view/header.php');
$tpl->div('title',  $lang->word('padmin_settings'));
if(isset($_POST['save']) && $_GET['act']== 'save') {
$lnges = input($_POST['lang']);
$theme_w = input($_POST['theme']);
$open_reg = input($_POST['open_reg']);
$open_site = input($_POST['open_site']);
$public_site = input($_POST['public_site']);
$timezone = input($_POST['timezone']);
$title_s = substr(input($_POST['title']), 0, 20);
$keywords = substr(input($_POST['keywords']), 0, 500);
$description = substr(input($_POST['description']), 0, 1500);
$copyright = substr(input($_POST['copyright']), 0, 20);
$ames = substr(abs(intval($_POST['ames'])), 0, 2);
$db->query("UPDATE `system` SET  `lang` = '". $lnges."', `theme` = '". $theme_w."', `open_reg` = '". $open_reg."', `ames` = '". $ames."', `open_site` = '". $open_site."', `public_site` = '". $public_site."', `title` = '". $title_s."', `keywords` = '". $keywords."', `description` = '". $description."', `copyright` = '". $copyright."', `timezone` = '$timezone'");
$tpl->div('menu', $lang->word('succ_save'));
$tpl->div('block', img('settings.png') . '<a href="/padmin/settings/">'.$lang->word('padmin_settings').'</a><br/>'. img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
exit;
	}
echo '<div class="post">
<form action="/padmin/settings/?act=save" method="post">
<b>'. $lang->word('slang') .'</b>:<br/>
<select name="lang" size="1">';
	$langs_dir = opendir(SYS .'/lang');
	while ($langs = readdir($langs_dir)) {
	if ($langs == '.' || $langs == '..') 
	continue;
	$lngs = parse_ini_file(SYS .'/lang/'.$langs.'/lang.ini');
	echo '<option value="'. $langs .'" '. ($system['lang'] == $langs?' selected="selected"':NULL) .'>'. $lngs['lang_name'] .'</option>';
}
echo '</select><br />
<b>'. $lang->word('stheme') .'</b>:<br/>
<select name="theme" size="1">';
	$themes_dir = opendir(TPL .'/themes/wap');
	while ($themes = readdir($themes_dir)) {
	if ($themes == '.' || $themes == '..') 
	continue;
	$thems = parse_ini_file(TPL .'/themes/wap/'.$themes.'/manifest.ini');
	echo '<option value="'. $themes .'" '. ($system['theme'] == $themes?' selected="selected"':NULL) .'>'. $thems['name'] .'</option>';
}
echo '</select><br/>
<b>'. $lang->word('timezone') .'</b>:<br />
<select name="timezone">';
$zonelist = 
     array
     (
         'Kwajalein' => '-12:00',
         'Pacific/Midway' => '-11:00',
         'Pacific/Honolulu' => '-10:00',
         'America/Anchorage' => '-09:00',
         'America/Los_Angeles' => '-08:00',
         'America/Denver' => '-07:00',
         'America/Tegucigalpa' => '-06:00',
         'America/New_York' => '-05:00',
         'America/Caracas' => '-04:30',
         'America/Halifax' => '-04:00',
         'America/St_Johns' => '-03:30',
         'America/Argentina/Buenos_Aires' => '-03:00',
         'America/Sao_Paulo' => '-03:00',
         'Atlantic/South_Georgia' => '-02:00',
         'Atlantic/Azores' => '-01:00',
         'Europe/Dublin' => '0',
         'Europe/Belgrade' => '+01:00',
         'Europe/Kiev' => '+02:00',
         'Asia/Kuwait' => '+03:00',
         'Asia/Tehran' => '+03:30',
         'Asia/Muscat' => '+04:00',
         'Asia/Yekaterinburg' => '+05:00',
         'Asia/Kolkata' => '+05:30',
         'Asia/Katmandu' => '+05:45',
         'Asia/Dhaka' => '+06:00',
         'Asia/Rangoon' => '+06:00',
         'Asia/Krasnoyarsk' => '+07:00',
         'Asia/Brunei' => '+08:00',
         'Asia/Seoul' => '+09:00',
         'Australia/Darwin' => '+09:30',
         'Australia/Canberra' => '+10:00',
         'Asia/Magadan' => '+11:00',
         'Pacific/Fiji' => '+12:00',
         'Pacific/Tongatapu' => '+13:00'
     );
foreach($zonelist as $zone => $timez) {
echo '<option value="'.$zone.'" '.($zone == $system['timezone'] ? 'selected="selected"' : NULL).'>'.$timez.'</option>'."\n";
}
echo '</select><br/>
<b>'. $lang->word('open_reg') .'</b>:<br />
<input type="radio" name="open_reg" value="yes"'. ($system['open_reg'] == 'yes'?' checked="checked"':NULL) .' />'. $lang->word('yyes') .'
<input type="radio" name="open_reg" value="no"'. ($system['open_reg'] == 'no'?' checked="checked"':NULL) .' />'. $lang->word('yno') .'<br />
<b>'. $lang->word('open_site') .'</b>:<br />
<input type="radio" name="open_site" value="yes"'. ($system['open_site'] == 'yes'?' checked="checked"':NULL) .' />'. $lang->word('yyes') .'
<input type="radio" name="open_site" value="no"'. ($system['open_site'] == 'no'?' checked="checked"':NULL) .' />'. $lang->word('yno') .'<br />
<b>'. $lang->word('public_site') .'</b>:<br />
<input type="radio" name="public_site" value="yes"'. ($system['public_site'] == 'yes'?' checked="checked"':NULL) .' />'. $lang->word('yyes') .'
<input type="radio" name="public_site" value="no"'. ($system['public_site'] == 'no'?' checked="checked"':NULL) .' />'. $lang->word('yno') .'<br />
<b>'. $lang->word('title') .'</b>:<br />
<input type="text" name="title" value="'. $system['title'] .'" /><br/>
<b>'. $lang->word('copyright') .'</b>:<br />
<input type="text" name="copyright" value="'. $system['copyright'] .'" /><br/>
<b>'. $lang->word('keywords') .'</b>:<br />
<textarea rows="5" cols="26" name="keywords">'. $system['keywords'] .'</textarea><br/>
<b>'. $lang->word('description') .'</b>:<br />
<textarea rows="5" cols="26" name="description">'. $system['description'] .'</textarea><br/>
<b>'. $lang->word('amess') .'</b>:<br />
<input type="text" size="2" name="ames" value="'. $system['ames'] .'" /><br />
<input type="submit" name="save" value="'. $lang->word('save') .'" />
</form>
</div>';
$tpl->div('block', img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
} else { header('Location: /'); }
?>