<script language="javascript">
$(document).ready( function() {
	$("#setting1").click(function(){
		$('#settinginput1').show();
		$('#settinginput2').hide();
		$('#settinginput3').hide();
		$('#settinginput4').hide();
		$('#settinginput5').hide();
		$('#settinginput6').hide();
		$('#settinginput7').hide();
		$('#setting1').hide();
		$('#setting2').show();
		$('#setting3').show();
		$('#setting4').show();
		$('#setting5').show();
		$('#setting6').show();
	});
	$("#settingbtn1").click(function(){
		var post = $('#settingtext1').val();
		var mod = 'setting';
		var act =  'website_name';
		var dataString = 'post='+ post + '&mod='+ mod + '&act='+ act;
		$.ajax({
			type: "POST",
			url: "po-component/po-setting/proses.php",
			data: dataString,
			cache: false,
			success: function(html){
				$('#settingtext1').val(html);
				$('#setting1').html(html);
				$('#settinginput1').hide();
				$('#setting1').show();
			}
		});
		return false;
	});
});
</script>

<script language="javascript">
$(document).ready( function() {
	$("#setting2").click(function(){
		$('#settinginput1').hide();
		$('#settinginput2').show();
		$('#settinginput3').hide();
		$('#settinginput4').hide();
		$('#settinginput5').hide();
		$('#settinginput6').hide();
		$('#settinginput7').hide();
		$('#setting1').show();
		$('#setting2').hide();
		$('#setting3').show();
		$('#setting4').show();
		$('#setting5').show();
		$('#setting6').show();
	});
	$("#settingbtn2").click(function(){
		var post = $('#settingtext2').val();
		var mod = 'setting';
		var act =  'website_url';
		var dataString = 'post='+ post + '&mod='+ mod + '&act='+ act;
		$.ajax({
			type: "POST",
			url: "po-component/po-setting/proses.php",
			data: dataString,
			cache: false,
			success: function(html){
				$('#settingtext2').val(html);
				$('#setting2').html(html);
				$('#settinginput2').hide();
				$('#setting2').show();
			}
		});
		return false;
	});
});
</script>

<script language="javascript">
$(document).ready( function() {
	$("#setting3").click(function(){
		$('#settinginput1').hide();
		$('#settinginput2').hide();
		$('#settinginput3').show();
		$('#settinginput4').hide();
		$('#settinginput5').hide();
		$('#settinginput6').hide();
		$('#settinginput7').hide();
		$('#setting1').show();
		$('#setting2').show();
		$('#setting3').hide();
		$('#setting4').show();
		$('#setting5').show();
		$('#setting6').show();
	});
	$("#settingbtn3").click(function(){
		var post = $('#settingtext3').val();
		var mod = 'setting';
		var act =  'meta_description';
		var dataString = 'post='+ post + '&mod='+ mod + '&act='+ act;
		$.ajax({
			type: "POST",
			url: "po-component/po-setting/proses.php",
			data: dataString,
			cache: false,
			success: function(html){
				$('#settingtext3').val(html);
				$('#setting3').html(html);
				$('#settinginput3').hide();
				$('#setting3').show();
			}
		});
		return false;
	});
});
</script>

<script language="javascript">
$(document).ready( function() {
	$("#setting4").click(function(){
		$('#settinginput1').hide();
		$('#settinginput2').hide();
		$('#settinginput3').hide();
		$('#settinginput4').show();
		$('#settinginput5').hide();
		$('#settinginput6').hide();
		$('#settinginput7').hide();
		$('#setting1').show();
		$('#setting2').show();
		$('#setting3').show();
		$('#setting4').hide();
		$('#setting5').show();
		$('#setting6').show();
	});
	$("#settingbtn4").click(function(){
		var post = $('#settingtext4').val();
		var mod = 'setting';
		var act =  'meta_keyword';
		var dataString = 'post='+ post + '&mod='+ mod + '&act='+ act;
		$.ajax({
			type: "POST",
			url: "po-component/po-setting/proses.php",
			data: dataString,
			cache: false,
			success: function(html){
				$('#settingtext4').val(html);
				$('#setting4').html(html);
				$('#settinginput4').hide();
				$('#setting4').show();
			}
		});
		return false;
	});
});
</script>

<script language="javascript">
$(document).ready( function() {
	$("#setting5").click(function(){
		$('#settinginput1').hide();
		$('#settinginput2').hide();
		$('#settinginput3').hide();
		$('#settinginput4').hide();
		$('#settinginput5').show();
		$('#settinginput6').show();
		$('#settinginput7').hide();
		$('#setting1').show();
		$('#setting2').show();
		$('#setting3').show();
		$('#setting4').show();
		$('#setting5').hide();
		$('#setting6').show();
	});
});
</script>

<script language="javascript">
$(document).ready( function() {
	$("#setting6").click(function(){
		$('#settinginput1').hide();
		$('#settinginput2').hide();
		$('#settinginput3').hide();
		$('#settinginput4').hide();
		$('#settinginput5').hide();
		$('#settinginput6').hide();
		$('#settinginput7').show();
		$('#setting1').show();
		$('#setting2').show();
		$('#setting3').show();
		$('#setting4').show();
		$('#setting5').show();
		$('#setting6').hide();
	});
	$("#settingbtn6").click(function(){
		var post = $('#settingtext6').val();
		var mod = 'setting';
		var act =  'email';
		var dataString = 'post='+ post + '&mod='+ mod + '&act='+ act;
		$.ajax({
			type: "POST",
			url: "po-component/po-setting/proses.php",
			data: dataString,
			cache: false,
			success: function(html){
				$('#settingtext6').val(html);
				$('#setting6').html(html);
				$('#settinginput7').hide();
				$('#setting6').show();
			}
		});
		return false;
	});
});
</script>

<?php
session_start();
if (empty($_SESSION['namauser']) AND empty($_SESSION['passuser'])){
	header('location:404.php');
}else{

$aksi="po-component/po-setting/proses.php";
switch($_GET[act]){
  default:
	if ($_SESSION[leveluser]=='admin'){
	echo "<div class='page-header'>
		<div class='icon'>
			<span class='ico-brush'></span>
		</div>
		<h1>$langsetting1<small><span class='text-info'>$langsetting2</span></small></h1>
	</div>
	<div class='row-fluid'>
		<div class='span12'>
			<div class='block'>";
				$tablesetting = new PoTable('setting');
				$currentSetting = $tablesetting->findBy(id_setting, '1');
				$currentSetting = $currentSetting->current();
				echo "<div class='data-fluid'>
					<div class='head dblue'>
                        <div class='icon'><span class='ico-brush'></span></div>
                        <h2>$langsetting10</h2>                                                       
                    </div>
					<table cellspacing='0' border='0' class='table table-hover'>
					<thead><tr><th>$langsetting3</th><th>$langsetting4</th></tr></thead>
					<tbody>
					<tr>
                        <td><i class='icon-check'></i> $langsetting5</td>
                        <td>
							<div id='setting1' style='cursor:pointer;'>$currentSetting->website_name</div>
							<div class='input-append' id='settinginput1' style='display:none;'>
								<input id='settingtext1' style='width: 312px;' type='text' value='$currentSetting->website_name'>
								<button id='settingbtn1' class='btn' type='button'>$langsetting11</button>
							</div>
						</td>
					</tr>
					<tr>
                        <td><i class='icon-check'></i> $langsetting6</td>
                        <td>
							<div id='setting2' style='cursor:pointer;'>$currentSetting->website_url</div>
							<div class='input-append' id='settinginput2' style='display:none;'>
								<input id='settingtext2' style='width: 312px;' type='text' value='$currentSetting->website_url'>
								<button id='settingbtn2' class='btn' type='button'>$langsetting11</button>
							</div>
						</td>
					</tr>
					<tr>
                        <td><i class='icon-check'></i> $langsetting7</td>
                        <td>
							<div id='setting3' style='cursor:pointer;'>$currentSetting->meta_description</div>
							<div class='input-append' id='settinginput3' style='display:none;'>
								<input id='settingtext3' style='width: 312px;' type='text' value='$currentSetting->meta_description'>
								<button id='settingbtn3' class='btn' type='button'>$langsetting11</button>
							</div>
						</td>
					</tr>
					<tr>
                        <td><i class='icon-check'></i> $langsetting8</td>
                        <td>
							<div id='setting4' style='cursor:pointer;'>$currentSetting->meta_keyword</div>
							<div class='input-append' id='settinginput4' style='display:none;'>
								<input id='settingtext4' style='width: 312px;' type='text' value='$currentSetting->meta_keyword'>
								<button id='settingbtn4' class='btn' type='button'>$langsetting11</button>
							</div>
						</td>
					</tr>
					<tr>
                        <td><i class='icon-check'></i> $langsetting9</td>
                        <td>
							<div id='setting5' style='cursor:pointer;'><img src='../$currentSetting->favicon' /></div>
							<form method='post' action='$aksi' enctype='multipart/form-data' autocomplete='off'>
							<input type='hidden' name='mod' value='setting'>
							<input type='hidden' name='act' value='favicon'>
							<div class='row-form'>
								<div class='span4'>
									<div class='input-append file' id='settinginput5' style='display:none;margin-left:-15px;'>
										<input style='width: 284px;' name='fupload' type='file' required>
										<input style='width: 297px;' type='text'>
										<span class='btn'>$langsetting12</span>
									</div>
								</div>
							</div>
							<div id='settinginput6' style='display:none;'>
								<button class='btn' type='submit'>$langsetting13</button>
							</div>
							<form>
						</td>
					</tr>
					<tr>
                        <td><i class='icon-check'></i> Email</td>
                        <td>
							<div id='setting6' style='cursor:pointer;'>$currentSetting->website_email</div>
							<div class='input-append' id='settinginput7' style='display:none;'>
								<input id='settingtext6' style='width: 312px;' type='text' value='$currentSetting->website_email'>
								<button id='settingbtn6' class='btn' type='button'>$langsetting11</button>
							</div>
						</td>
					</tr>
				</tbody></table>
				</div>
			</div>
			<div style='width:100%; height:500px;'>&nbsp;</div>
		</div>
	</div>";
	}else{
		echo "<div class='page-header'></div>
		<div class='row-fluid'>
			<div class='span12'>
				<div class='errorContainerpage'>
					<h1>404</h1>
					<h2>$langsetting1</h2>
					<button class='btn btn-large btn-primary' onClick='document.location.href=\"admin.php?mod=home\";'>$langpagenotfound2</button> <button class='btn btn-large' onClick='history.back();'>$langpagenotfound3</button>
				</div>
			</div>
		</div>";
	}
    break;
}
}
?>