<?php
$mod = $_GET['mod'];
if ($mod=="home"){
?>
<div id="sidebar" class="span4">
    <div class="widget clearfix">
		<ul class="social-subscribers">
			<li>
				<a href="#" data-original-title="Share us on Facebook"><img src="po-content/<?php echo $folder; ?>/images/social/somacro/facebook.png" alt="Facebook" /></a>
				<p>
					<?php if ($output[facebook]==''){ echo "0"; }else{ echo $output[facebook]; } ?>
				<i>shares</i></p>
			</li>
			<li>
				<a href="#" data-original-title="Share us on Twitter"><img src="po-content/<?php echo $folder; ?>/images/social/somacro/twitter.png" alt="Twitter" /></a>
				<p>
					<?php 
						if ($output[twitter]==''){ echo "0"; }else{ echo $output[twitter]; }
					?>
				<i>shares</i></p>
			</li>
			<li>
				<a href="#" data-original-title="Subscribe our RSS Feed"><img src="po-content/<?php echo $folder; ?>/images/social/somacro/rss.png" alt="RSS" /></a>
				<?php
					$tablesubs = new PoTable('subscribe');
					$totalsubs = $tablesubs->numRow();
				?>
				<?php if ($lang=="en"){ ?>
					<p><?php echo $totalsubs; ?><i>subscribers</i></p>
				<?php }else{ ?>
					<p><?php echo $totalsubs; ?><i>langganan</i></p>
				<?php } ?>
			</li>
		</ul>
	</div> <!-- End Widget -->
   
    <div class="widget clearfix">
		<div class="enews-tab">
			<!-- Tab Menu -->
			<ul class="nav nav-tabs" id="enewsTabs">
			<?php if ($lang=="en"){ ?>
				<li class="active"><a href="#tab-populars" data-toggle="tab">Populars</a></li>
				<li><a href="#tab-recents" data-toggle="tab">Recents</a></li>
				<li><a href="#tab-comments" data-toggle="tab">Comments</a></li>
			<?php }else{ ?>
				<li class="active"><a href="#tab-populars" data-toggle="tab">Populer</a></li>
				<li><a href="#tab-recents" data-toggle="tab">Terkini</a></li>
				<li><a href="#tab-comments" data-toggle="tab">Komentar</a></li>
			<?php } ?>
			</ul>
		<div class="tab-content">
			<div class="tab-pane active" id="tab-populars">
			<?php
				$tablepop = new PoTable('post');
				$pops = $tablepop->findAllLimit(hits, DESC, 5);
				foreach($pops as $pop){
				if ($lang=="en"){
					$tablepopc = new PoTable('comment');
					$totalpop = $tablepopc->numRowBy(id_post, $pop->id_post);
					$titlepop = $pop->title_en;
					$seotitlepop = $pop->seotitle_en;
					$tglpop = $pop->date;
					$tanggalpop = substr($tglpop,8,2);
					$bulanpop = getBulanEn(substr($tglpop,5,2));
					$tahunpop = substr($tglpop,0,4);
					$comments = "comments";
				}else{
					$tablepopc = new PoTable('comment');
					$totalpop = $tablepopc->numRowBy(id_post, $pop->id_post);
					$titlepop = $pop->title_id;
					$seotitlepop = $pop->seotitle_id;
					$tglpop = $pop->date;
					$tanggalpop = substr($tglpop,8,2);
					$bulanpop = getBulanId(substr($tglpop,5,2));
					$tahunpop = substr($tglpop,0,4);
					$comments = "komentar";
				}
			?>
			<div class="item">
				<figure class="pull-left"><img src="po-content/po-upload/medium-<?php echo $pop->picture; ?>" alt="<?php echo $titlepop; ?>" /></figure>
				<div class="pull-right content">
					<h4><a href="<?php echo "detailpost-$pop->id_post-$seotitlepop-lang-$lang.html"; ?>" title="<?php echo $titlepop; ?>"><?php echo $titlepop; ?></a></h4>
					<p class="meta"><?php echo $pop->hits; ?> views&nbsp;&nbsp;|&nbsp;&nbsp;<?php echo "$totalpop $comments"; ?></p>
				</div>
			</div>
			<?php } ?>
			</div> <!-- End Populars -->

			<div class="tab-pane" id="tab-recents">
			<?php
				$tablerec = new PoTable('post');
				$recs = $tablerec->findAllLimit(id_post, DESC, '5');
				foreach($recs as $rec){
				if ($lang=="en"){
					$validrec = $rec->id_category;
					$tablecatrec = new PoTable('category');
					$currentCatrec = $tablecatrec->findBy(id_category, $validrec);
					$currentCatrec = $currentCatrec->current();
					$titlerec = $rec->title_en;
					$seotitlerec = $rec->seotitle_en;
					$tglrec = $rec->date;
					$tanggalrec = substr($tglrec,8,2);
					$bulanrec = getBulanEn(substr($tglrec,5,2));
					$tahunrec = substr($tglrec,0,4);
					$catrec = $currentCatrec->seotitle_en;
					$titlecat = $currentCatrec->title_en;
					$inrec = "In";
					$onrec = "on";
				}else{
					$validrec = $rec->id_category;
					$tablecatrec = new PoTable('category');
					$currentCatrec = $tablecatrec->findBy(id_category, $validrec);
					$currentCatrec = $currentCatrec->current();
					$titlerec = $rec->title_id;
					$seotitlerec = $rec->seotitle_id;
					$tglrec = $rec->date;
					$tanggalrec = substr($tglrec,8,2);
					$bulanrec = getBulanId(substr($tglrec,5,2));
					$tahunrec = substr($tglrec,0,4);
					$catrec = $currentCatrec->seotitle_id;
					$titlecat = $currentCatrec->title_id;
					$inrec = "Di";
					$onrec = "pada";
				}
			?>
			<div class="item">
				<figure class="pull-left"><img src="po-content/po-upload/medium-<?php echo $rec->picture; ?>" alt="<?php echo $titlerec; ?>" /></figure>
				<div class="pull-right content">
					<h4><a href="<?php echo "detailpost-$rec->id_post-$seotitlerec-lang-$lang.html"; ?>" title="<?php echo $titlerec; ?>"><?php echo $titlerec; ?></a></h4>
					<p class="meta"><?php echo $inrec; ?> <a href="<?php echo "category-$currentCatrec->id_category-$catrec-lang-$lang.html"; ?>"><?php echo $titlecat; ?></a> <?php echo "$onrec $bulanrec"; ?> <?php echo $tanggalrec; ?>, <?php echo $tahunrec; ?></p>
				</div>
			</div>
			<?php } ?>
			</div> <!-- End Recents -->
      
			<div class="tab-pane" id="tab-comments">
			<?php
				$tablecom = new PoTable('comment');
				$coms = $tablecom->findAllLimit(id_comment, DESC, '5');
				foreach($coms as $com){
				if ($lang=="en"){
					$validcom = $com->id_post;
					$tablecompo = new PoTable('post');
					$currentCompo = $tablecompo->findBy(id_post, $validcom);
					$currentCompo = $currentCompo->current();
					$concom = strip_tags($com->comment);
					$concom = substr($concom,0,80);
					$concom = substr($concom,0,strrpos($concom," "));
					$concom = html_entity_decode($concom);
					$urlcom = addhttp($com->url);
					$titlecom = $currentCompo->title_en;
					$seotitlecom = $currentCompo->seotitle_en;
					$tglcom = $currentCompo->date;
					$tanggalcom = substr($tglcom,8,2);
					$bulancom = getBulanEn(substr($tgls,5,2));
					$tahuncom = substr($tgls,0,4);
					$oncom = "on";
				}else{
					$validcom = $com->id_post;
					$tablecompo = new PoTable('post');
					$currentCompo = $tablecompo->findBy(id_post, $validcom);
					$currentCompo = $currentCompo->current();
					$concom = strip_tags($com->comment);
					$concom = substr($concom,0,80);
					$concom = substr($concom,0,strrpos($concom," "));
					$concom = html_entity_decode($concom);
					$urlcom = addhttp($com->url);
					$titlecom = $currentCompo->title_id;
					$seotitlecom = $currentCompo->seotitle_id;
					$tglcom = $currentCompo->date;
					$tanggalcom = substr($tglcom,8,2);
					$bulancom = getBulanId(substr($tgls,5,2));
					$tahuncom = substr($tgls,0,4);
					$oncom = "di";
				}
			?>
			<div class="item">
				<div class="pull-right content">
					<p><a href="<?php echo $urlcom; ?>"><?php echo $com->name; ?></a> <?php echo $oncom; ?> <a href="<?php echo "detailpost-$currentCompo->id_post-$seotitlecom-lang-$lang.html"; ?>" title="<?php echo $titlecom; ?>"><?php echo $titlecom; ?></a></p>
					<p><?php echo $concom; ?></p>
				</div>
			</div>
			<?php } ?>
			</div> <!-- End Comments -->
		</div> <!-- End Tab-Content -->

		</div> <!-- End Enews-Tab --> 
    </div> <!-- End Widget -->
   
    <div class="widget clearfix">
		<div class="sponsors"> 
			<div class="header">
			<?php if ($lang=='en'){ echo "<h4>Sponsors</h4>"; }else{ echo "<h4>Sponsor</h4>"; } ?>
			</div>
			<div class="content">
			<?php
				$tableban = new PoTable('banner');
				$bans = $tableban->findAllLimitByRand(size, '180', '4');
				foreach($bans as $ban){
			?>
				<a href="<?php echo $ban->url; ?>" target="_blank"><img src="po-content/po-upload/banner/<?php echo $ban->picture; ?>" alt="<?php echo $ban->title; ?>" /></a>
			<?php } ?>
			</div>
		</div>
	</div> <!-- End Widget -->
   
    <div class="widget clearfix">
		<div class="subscribe-form">
		<?php if($lang=="en"){ ?>
			<div class="header">
				<h4>Subscribe Us</h4>
			</div>
			<div class="content">
				<p>You can stay up-to-date with our latest news with subscribe our newsletter.</p>
				<form name="subscribe-form" id="enews-subscribe-form" method="post" action="#">
					<input type="text" name="email_address" placeholder="ex: your_email@domain.com" />
					<input type="submit" name="submit" value="Send" />
				</form>
			</div>
		<?php }else{ ?>
			<div class="header">
				<h4>Berlangganan</h4>
			</div>
			<div class="content">
				<p>Anda bisa mendapatkan berita-berita terbaru setiap ada update dari kami melalui email.</p>
				<form name="subscribe-form" id="enews-subscribe-form" method="post" action="#">
					<input type="text" name="email_address" placeholder="con: email_kamu@domain.com" />
					<input type="submit" name="submit" value="Kirim" />
				</form>
			</div>
		<?php } ?>
		</div>
	</div> <!-- End Widget -->
  
</div> <!-- End Sidebar -->
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>





<?php
}elseif ($mod=="gallery"){
?>





<?php
}elseif ($mod=="contact"){
?>
<div id="sidebar" class="span4">
    <div class="widget clearfix">
		<ul class="social-subscribers">
			<li>
				<a href="#" data-original-title="Share us on Facebook"><img src="po-content/<?php echo $folder; ?>/images/social/somacro/facebook.png" alt="Facebook" /></a>
				<p>
					<?php if ($output[facebook]==''){ echo "0"; }else{ echo $output[facebook]; } ?>
				<i>shares</i></p>
			</li>
			<li>
				<a href="#" data-original-title="Share us on Twitter"><img src="po-content/<?php echo $folder; ?>/images/social/somacro/twitter.png" alt="Twitter" /></a>
				<p>
					<?php 
						if ($output[twitter]==''){ echo "0"; }else{ echo $output[twitter]; }
					?>
				<i>shares</i></p>
			</li>
			<li>
				<a href="#" data-original-title="Subscribe our RSS Feed"><img src="po-content/<?php echo $folder; ?>/images/social/somacro/rss.png" alt="RSS" /></a>
				<?php
					$tablesubs = new PoTable('subscribe');
					$totalsubs = $tablesubs->numRow();
				?>
				<?php if ($lang=="en"){ ?>
					<p><?php echo $totalsubs; ?><i>subscribers</i></p>
				<?php }else{ ?>
					<p><?php echo $totalsubs; ?><i>langganan</i></p>
				<?php } ?>
			</li>
		</ul>
	</div> <!-- End Widget -->

    <div class="widget clearfix">
	<?php if ($lang=="en"){ ?>
		<div class="contact-details">
			<div class="header">
				<h4>Contact Informations</h4>
			</div>
			<div class="content">
				<p><strong>Dwira Survivor</strong></p>
				<p>Kebayoran Baru, Jakarta Selatan, DKI Jakarta</p>
				<p>Call: <i>+62-853-40065774</i></p>
				<p>Email: <a href="mailto:djenuar@gmail.com">djenuar@gmail.com</a></p>
			</div>
		</div>
	<?php }else{ ?>
		<div class="contact-details">
			<div class="header">
				<h4>Informasi Kontak</h4>
			</div>
			<div class="content">
				<p><strong>Dwira Survivor</strong></p>
				<p>Kebayoran Baru, Jakarta Selatan, DKI Jakarta</p>
				<p>Telp: <i>+62-853-40065774</i></p>
				<p>Email: <a href="mailto:djenuar@gmail.com">djenuar@gmail.com</a></p>
			</div>
		</div>
	<?php } ?>
    </div> <!-- End Widget -->

</div> <!-- End Sidebar -->
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>





<?php
}else{
?>
<div id="sidebar" class="span4">
    <div class="widget clearfix">
		<div class="enews-tab">
			<!-- Tab Menu -->
			<ul class="nav nav-tabs" id="enewsTabs">
			<?php if ($lang=="en"){ ?>
				<li class="active"><a href="#tab-populars" data-toggle="tab">Populars</a></li>
				<li><a href="#tab-recents" data-toggle="tab">Recents</a></li>
				<li><a href="#tab-comments" data-toggle="tab">Comments</a></li>
			<?php }else{ ?>
				<li class="active"><a href="#tab-populars" data-toggle="tab">Populer</a></li>
				<li><a href="#tab-recents" data-toggle="tab">Terkini</a></li>
				<li><a href="#tab-comments" data-toggle="tab">Komentar</a></li>
			<?php } ?>
			</ul>
		<div class="tab-content">
			<div class="tab-pane active" id="tab-populars">
			<?php
				$tablepop = new PoTable('post');
				$pops = $tablepop->findAllLimit(hits, DESC, '5');
				foreach($pops as $pop){
				if ($lang=="en"){
					$tablepopc = new PoTable('comment');
					$totalpop = $tablepopc->numRowBy(id_post, $pop->id_post);
					$titlepop = $pop->title_en;
					$seotitlepop = $pop->seotitle_en;
					$tglpop = $pop->date;
					$tanggalpop = substr($tglpop,8,2);
					$bulanpop = getBulanEn(substr($tglpop,5,2));
					$tahunpop = substr($tglpop,0,4);
					$comments = "comments";
				}else{
					$tablepopc = new PoTable('comment');
					$totalpop = $tablepopc->numRowBy(id_post, $pop->id_post);
					$titlepop = $pop->title_id;
					$seotitlepop = $pop->seotitle_id;
					$tglpop = $pop->date;
					$tanggalpop = substr($tglpop,8,2);
					$bulanpop = getBulanId(substr($tglpop,5,2));
					$tahunpop = substr($tglpop,0,4);
					$comments = "komentar";
				}
			?>
			<div class="item">
				<figure class="pull-left"><img src="po-content/po-upload/medium-<?php echo $pop->picture; ?>" alt="<?php echo $titlepop; ?>" /></figure>
				<div class="pull-right content">
					<h4><a href="<?php echo "detailpost-$pop->id_post-$seotitlepop-lang-$lang.html"; ?>" title="<?php echo $titlepop; ?>"><?php echo $titlepop; ?></a></h4>
					<p class="meta"><?php echo $pop->hits; ?> views&nbsp;&nbsp;|&nbsp;&nbsp;<?php echo "$totalpop $comments"; ?></p>
				</div>
			</div>
			<?php } ?>
			</div> <!-- End Populars -->

			<div class="tab-pane" id="tab-recents">
			<?php
				$tablerec = new PoTable('post');
				$recs = $tablerec->findAllLimit(id_post, DESC, '5');
				foreach($recs as $rec){
				if ($lang=="en"){
					$validrec = $rec->id_category;
					$tablecatrec = new PoTable('category');
					$currentCatrec = $tablecatrec->findBy(id_category, $validrec);
					$currentCatrec = $currentCatrec->current();
					$titlerec = $rec->title_en;
					$seotitlerec = $rec->seotitle_en;
					$tglrec = $rec->date;
					$tanggalrec = substr($tglrec,8,2);
					$bulanrec = getBulanEn(substr($tglrec,5,2));
					$tahunrec = substr($tglrec,0,4);
					$catrec = $currentCatrec->seotitle_en;
					$titlecat = $currentCatrec->title_en;
					$inrec = "In";
					$onrec = "on";
				}else{
					$validrec = $rec->id_category;
					$tablecatrec = new PoTable('category');
					$currentCatrec = $tablecatrec->findBy(id_category, $validrec);
					$currentCatrec = $currentCatrec->current();
					$titlerec = $rec->title_id;
					$seotitlerec = $rec->seotitle_id;
					$tglrec = $rec->date;
					$tanggalrec = substr($tglrec,8,2);
					$bulanrec = getBulanId(substr($tglrec,5,2));
					$tahunrec = substr($tglrec,0,4);
					$catrec = $currentCatrec->seotitle_id;
					$titlecat = $currentCatrec->title_id;
					$inrec = "Di";
					$onrec = "pada";
				}
			?>
			<div class="item">
				<figure class="pull-left"><img src="po-content/po-upload/medium-<?php echo $rec->picture; ?>" alt="<?php echo $titlerec; ?>" /></figure>
				<div class="pull-right content">
					<h4><a href="<?php echo "detailpost-$rec->id_post-$seotitlerec-lang-$lang.html"; ?>" title="<?php echo $titlerec; ?>"><?php echo $titlerec; ?></a></h4>
					<p class="meta"><?php echo $inrec; ?> <a href="<?php echo "category-$currentCatrec->id_category-$catrec-lang-$lang.html"; ?>"><?php echo $titlecat; ?></a> <?php echo "$onrec $bulanrec"; ?> <?php echo $tanggalrec; ?>, <?php echo $tahunrec; ?></p>
				</div>
			</div>
			<?php } ?>
			</div> <!-- End Recents -->
      
			<div class="tab-pane" id="tab-comments">
			<?php
				$tablecom = new PoTable('comment');
				$coms = $tablecom->findAllLimit(id_comment, DESC, '5');
				foreach($coms as $com){
				if ($lang=="en"){
					$validcom = $com->id_post;
					$tablecompo = new PoTable('post');
					$currentCompo = $tablecompo->findBy(id_post, $validcom);
					$currentCompo = $currentCompo->current();
					$concom = strip_tags($com->comment);
					$concom = substr($concom,0,80);
					$concom = substr($concom,0,strrpos($concom," "));
					$concom = html_entity_decode($concom);
					$urlcom = addhttp($com->url);
					$titlecom = $currentCompo->title_en;
					$seotitlecom = $currentCompo->seotitle_en;
					$tglcom = $currentCompo->date;
					$tanggalcom = substr($tglcom,8,2);
					$bulancom = getBulanEn(substr($tgls,5,2));
					$tahuncom = substr($tgls,0,4);
					$oncom = "on";
				}else{
					$validcom = $com->id_post;
					$tablecompo = new PoTable('post');
					$currentCompo = $tablecompo->findBy(id_post, $validcom);
					$currentCompo = $currentCompo->current();
					$concom = strip_tags($com->comment);
					$concom = substr($concom,0,80);
					$concom = substr($concom,0,strrpos($concom," "));
					$concom = html_entity_decode($concom);
					$urlcom = addhttp($com->url);
					$titlecom = $currentCompo->title_id;
					$seotitlecom = $currentCompo->seotitle_id;
					$tglcom = $currentCompo->date;
					$tanggalcom = substr($tglcom,8,2);
					$bulancom = getBulanId(substr($tgls,5,2));
					$tahuncom = substr($tgls,0,4);
					$oncom = "di";
				}
			?>
			<div class="item">
				<div class="pull-right content">
					<p><a href="<?php echo $urlcom; ?>"><?php echo $com->name; ?></a> <?php echo $oncom; ?> <a href="<?php echo "detailpost-$currentCompo->id_post-$seotitlecom-lang-$lang.html"; ?>" title="<?php echo $titlecom; ?>"><?php echo $titlecom; ?></a></p>
					<p><?php echo $concom; ?></p>
				</div>
			</div>
			<?php } ?>
			</div> <!-- End Comments -->
		</div> <!-- End Tab-Content -->

		</div> <!-- End Enews-Tab --> 
    </div> <!-- End Widget -->
   
    <div class="widget clearfix">
		<div class="sponsors"> 
			<div class="header">
			<?php if ($lang=='en'){ echo "<h4>Sponsors</h4>"; }else{ echo "<h4>Sponsor</h4>"; } ?>
			</div>
			<div class="content">
			<?php
				$tableban = new PoTable('banner');
				$bans = $tableban->findAllLimitByRand(size, '180', '4');
				foreach($bans as $ban){
			?>
				<a href="<?php echo $ban->url; ?>" target="_blank"><img src="po-content/po-upload/banner/<?php echo $ban->picture; ?>" alt="<?php echo $ban->title; ?>" /></a>
			<?php } ?>
			</div>
		</div>
	</div> <!-- End Widget -->

</div> <!-- End Sidebar -->
<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
<?php
}
?>