<?php
session_start();  ob_start();
if($_GET["tID"]>0){
	$_SESSION["tID"]=$_GET["tID"];
}elseif($_GET["tID"]=="0"){
	$_SESSION["tID"]="";
	foreach ($_SESSION as $key => $value){
		if(substr($key,0,2)=="tm"){
			$_SESSION["tm_".$key] = "";
		}
	}
}
$sqls=mysqli_query($conn, "select * from genel where ne='sablon' and id=".$_GET["tID"].""); $rss=mysqli_fetch_assoc($sqls);
if(mysqli_num_rows($sqls)>0){
	$tmessage=$rss["n1"];
	$tmgonderen=$rss["t10"];
	$tsubject=$rss["t1"];
}
?>
<div class="inner-wrapper" style="<?php if($mobile==""){echo "margin-top: -28px;";}?> min-height: 90vh;">
	<section role="main" class="content-body">
		<header class="page-header">
			<h2><?php echo ctranslate("Webmail")?></h2>
			
			<div class="right-wrapper text-right">
				<ol class="breadcrumbs">
					<li>
						<a href=".">
							<i class="fa fa-home"></i>
						</a>
					</li>
					<li><span><?php echo ctranslate("Webmail")?></span></li>
					<li><span><?php echo ctranslate("Gelen Kutusu")?></span></li>
				</ol>
				
				<a class="sidebar-right-toggle" data-open="sidebar-right"><i class="fa fa-chevron-left"></i></a>
			</div>
		</header>
		<!-- start: page -->
		<section class="content-with-menu mailbox" style="<?php if($mobile==""){echo "margin: -150px -40px -50px 0px;";}?>">
			<div class="content-with-menu-container" data-mailbox="" data-mailbox-view="folder">
				<div class="inner-menu-toggle">
					<a href="#" class="inner-menu-expand " data-open="inner-menu">
						Menu <i class="fa fa-chevron-right"></i>
					</a>
				</div>
				
				<menu id="content-menu" class="inner-menu" role="menu">
					<div class="nano">
						<div class="nano-content" style="padding:15px;">
							
							<div class="inner-menu-toggle-inside">
								<a href="#" class="inner-menu-collapse"> <i class="fa fa-chevron-up d-inline-block d-md-none"></i><i class="fa fa-chevron-left d-none d-md-inline-block"></i> Menu </a>							
								<a href="#" class="inner-menu-expand" data-open="inner-menu"> Menu <i class="fa fa-chevron-down"></i> </a>
							</div>
							
							<div class="inner-menu-content">
								<center>
									<a href="?ne=cmail&islem=<?php echo $_GET["islem"]?>&mID=<?php echo $_GET["mID"]?>" class="btn btn-warning" style="">
										<i class="fas fa-edit"></i> <?php echo ctranslate("İleti Gönder")?>
									</a>
								</center>
								<div class="accordion" id="accordion">
									<?php $b=0;$bmessage_count=0; $sqlt=mysqli_query($conn, "select * from genel where ne='tanim' and t2='email' and s13=1 order by s10 asc"); while($rst=mysqli_fetch_assoc($sqlt)){$b++;?>
										<div class="card card-default">
											<div class="card-header">
												<h4 class="card-title m-0">
													<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $b;?>One">
														<i class="fa fa-envelope mr-1"></i> <?php echo base64_decode($rst["n1"]);?>
													</a>
												</h4>
											</div>
											<div id="collapse<?php echo $b;?>One" class="collapse <?php if(($_GET["mID"]=="" and $b==1) or $_GET["mID"]==$b-1){echo "show";}?>">
												<div class="card-body">
													<a href="?ne=Inbox&islem=<?php echo $_GET["islem"]?>&mID=<?php echo $rst["s10"];?>" class="menu-item <?php if($b==0){echo "active";}?>"> <?php echo $sdil[128]; //Gelen Kutusu?>  <span class="badge badge-primary font-weight-normal float-right" style="background: #0088CC;" id="mID<?php echo $rst["id"];?>"></span></a>
												</div>
											</div>
										</div>
									<?php }?>
								</div>
								<?php if($MSA==1 and tanim("cpanel","n1",0)<>""){?>
									<a href="?ne=lmail&islem=<?php echo $_GET["islem"]?>" class="menu-item"><?php echo ctranslate("E-Posta Hesapları")?></a>
								<?php }?>
								<?php if($module["gtaslak"]=="1"){?>
									<select onChange="self.location.href=this.options[this.selectedIndex].value;" class="form-control">
										<option value="?ne=cmail&islem=mailbox&tID=0"><?php echo translate("Taslaklar")?></option>
										<?php $sqlt=mysqli_query($conn, "select * from genel where ne='sablon' and t2='tmail' order by id desc"); while($rst=mysqli_fetch_assoc($sqlt)){ ?>
											<option value="?ne=cmail&islem=mailbox&tID=<?php echo $rst["id"];?>" <?php if($tID==$rst["id"]){?>selected<?php }?>><?php echo $rst["t1"];?></option>
										<?php }?>
										<option value="?ne=mesajlar&islem=sablon">+ <?php echo translate("Yeni Ekle")?></option>
									</select>
								<?php }?>
							</div>
						</div>
					</div>
				</menu>
				<?php 
				//Mail bilgileri
				if($_GET["mID"]==""){
					$mID=$_SESSION["user_id"];
				}elseif($_GET["mID"]<>""){
					$mID=$_GET["mID"];
				}
				if(substr(tanim("email","n3",$mID),0,4)<>"smtp"){
					$mail_server = "{".tanim("email", "n3", $mID).":995/pop3/ssl/novalidate-cert}INBOX";
					$mail_user = tanim("email","n1", $mID);
					$mail_pass = tanim("email","n2", $mID);
					$imap = imap_open($mail_server, $mail_user, $mail_pass);
				}
				if(!empty(imap_errors()[0])){echo "<div class=\"alert alert-warning\">".imap_errors()[0]."</div>";}
				$message_count = imap_num_msg($imap);
				?>
				<?php if($_GET["ne"]=="Inbox"){?>
					<div class="inner-body mailbox-folder" style="">
						<!-- START: .mailbox-header -->
						<header class="mailbox-header">
							<div class="row">
								<div class="col-md-12">
									<h1 class="mailbox-title font-weight-light m-0">
										<a id="mailboxToggleSidebar" class="sidebar-toggle-btn trigger-toggle-sidebar">
											<span class="line"></span>
											<span class="line"></span>
											<span class="line"></span>
											<span class="line line-angle1"></span>
											<span class="line line-angle2"></span>
										</a>
										
										<?php echo $sdil[128]; //Gelen Kutusu?>
									</h1>
								</div>
								<div class="col-md-6" style="display:none;">
									<div class="search">
										<div class="input-group input-search">
											<input type="text" class="form-control" name="q" id="q" placeholder="Search...">
											<span class="input-group-btn">
												<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
											</span>
										</div>
									</div>
								</div>
							</div>
						</header>
						<!-- END: .mailbox-header -->
						<form id="mform" action="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&mID=<?php echo $_GET["mID"]?>&durum=dmail" method="post">							
							<!-- START: .mailbox-actions -->
							<div class="mailbox-actions">
								<ul class="list-unstyled m-0 pt-3 pb-3">
									<li class="ib mr-2">
										<a class="item-action fa fa-refresh" href="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&mID=<?php echo $_GET["mID"]?>"></a>
									</li>
									<li class="ib">
										<a class="item-action fa fa-trash text-danger" onclick="document.getElementById('mform').submit();" style="cursor:pointer;"></a>
									</li>
								</ul>
							</div>
							<!-- END: .mailbox-actions -->
							
							<div id="mailbox-email-list" class="mailbox-email-list">
								<div class="nano">
									<div class="nano-content">
										<ul id="" class="list-unstyled">
											<?php
											function trURLtoCHAR($str){ 
												$ara   = array ('Ä±','�?','Ã¼','Ã§','Ã¶','Ä?','�','Ã','Ä°','Ä','�ž','Ã','Ã','Ä±','�?','Ã§','Ã¶','Ä?','�','Ã','Ä°','Ä','�ž','Ã','Ã','Ã¼','Ä', 'Ç', 'ç', 'Ð', 'ð', 'ý', 'Ý', 'Ö', 'ö', 'Þ', 'þ', 'Ü', 'ü');
												$degis = array ('ı','ş','ü','ç','ö','ğ','ş','Ç','i','ğ','Ş','Ö','Ü','ı', 'ş', 'ç', 'ö', 'ğ', 'ş', 'Ç', 'i', 'ğ', 'Ş', 'Ö', 'Ü', 'ü', 'ğ','Ç', 'ç', 'Ğ', 'ğ', 'ı', 'İ', 'Ö', 'ö', 'Ş', 'ş', 'Ü', 'ü');  
												return str_replace($ara, $degis, $str);  
											}
											?>
											<li class="read" style="font-weight: 600;">
												<a href="#">
													<div class="col-sender">
														<div class="" style="position: absolute; margin-top: 5px;">
															<div class="checkbox-custom checkbox-danger" style="margin-top:20px">
																<input type="checkbox" id="c0" onclick="Checks(this);" title="Tümünü Seç" style="width: 18px;height: 18px;">
																<label for="c0"></label>
															</div>
														</div>
														<p class="m-0 ib"><?php echo ctranslate("Gönderen")?></p>
													</div>
													<div class="col-mail">
														<p class="m-0 mail-content">
															<span class="subject"><?php echo ctranslate("Konu")?></span>
														</p>
														<p class="m-0 mail-date" style="width: 35%;"><?php echo ctranslate("Tarih")?></p>
														<p class="m-0 mail-date" style="width: 5%;"></p>
													</div>
												</a>
											</li>
											<?php
											for ($i = 1; $i <= $message_count; ++$i){
												$header = imap_header($imap, $message_count+1-$i);
												$mailbox = $header->from[0]->mailbox;
												$host = $header->from[0]->host;
												$subject = iconv_mime_decode($header->subject, 0, "ISO-8859-9");
												$subject = mb_convert_encoding($subject, "UTF-8", "ISO-8859-9");
												$mdate   = iconv_mime_decode($header->date, 0, "ISO-8859-9");
												?>
												<li class="unread">
													
													<div class="col-sender mfrm" onclick="show('m<?php echo $i?>')" data-toggle="modal" data-target="#myModal" data-url="fonksiyon.php?islem=rmail&mID=<?php echo $mID;?>&i=<?php echo $message_count+1-$i?>" style="cursor:pointer;">
														<div class="" style="position: absolute; margin-top: 5px;">
															<div class="checkbox-custom checkbox-danger" style="margin-top:20px">
																<input type="checkbox" class="dchck" name="q[]" id="mail<?php echo $message_count+1-$i?>" value="<?php echo $message_count+1-$i?>" style="width: 18px;height: 18px;">
																<label for="mail<?php echo $i?>"></label>
															</div>
														</div>
														<p class="m-0 ib"><?php echo "".$mailbox."@".substr($host,0,10)."";?>...</p>
													</div>
													<div class="col-mail">
														<p class="m-0 mail-content">
															<span class="subject"><?php echo $subject;?></span>
															<!--<span class="mail-partial"><?php echo kisalt(trURLtoCHAR($message),3);?></span>-->
														</p>
														<p class="m-0 mail-date" style="width: 35%;"><?php echo substr($mdate,0,-5);?></p>
														<p class="m-0 mail-date" style="width: 5%;"><a href="?ne=cmail&islem=mailbox&mID=<?php echo $mID;?>&i=<?php echo $message_count+1-$i?>"><i class="fa fa-reply" style="margin-left: -20px;"></i></a></p>
													</div>
												</li>
												<?php
				} // for döngüsü bitti
				if($_GET["durum"]=="dmail"){
					$qis = implode(',',$_POST["q"]); $qes = explode(',',$qis);
					foreach($qes as $s) {
						imap_delete($imap, $s); // mesajı silmek üzere işaretliyoruz	
					}
				imap_expunge($imap); // silmek üzere işaretlediğimiz mailleri siliyoruz
				echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&key=".$_GET["key"]."&sayfa=".$_GET["sayfa"]."&mID=".$_GET["mID"]."&durum=ok",self,500,1);
			}
				imap_close($imap); // mail bağlantısını kapatıyoruz
				?>							
			</form>
		</ul>
	</div>
</div>
<?php
}elseif($_GET["ne"]=="lmail"){
	include("../deppo/tools/script/cpanel.php");
	$lmail = listmail(tanim("cpanel","n1",0), tanim("cpanel","n2",0), tanim("cpanel","n3",0));
	?>
	<div class="inner-body mailbox-folder" style="">
		<!-- START: .mailbox-header -->
		<header class="mailbox-header">
			<div class="row">
				<div class="col-md-12">
					<h1 class="mailbox-title font-weight-light m-0">
						<a id="mailboxToggleSidebar" class="sidebar-toggle-btn trigger-toggle-sidebar">
							<span class="line"></span>
							<span class="line"></span>
							<span class="line"></span>
							<span class="line line-angle1"></span>
							<span class="line line-angle2"></span>
						</a>
						<?php echo ctranslate("E-Posta Hesapları")?>
					</h1>
				</div>
				<div class="col-md-6" style="display:none;">
					<div class="search">
						<div class="input-group input-search">
							<input type="text" class="form-control" name="q" id="q" placeholder="Search...">
							<span class="input-group-btn">
								<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
							</span>
						</div>
					</div>
				</div>
			</div>
		</header>
		<!-- END: .mailbox-header -->
		<!-- START: .mailbox-actions -->
		<div class="mailbox-actions">
			<ul class="list-unstyled m-0 pt-3 pb-3">
				<li class="ib mr-2" style="float: right;">
					<a href="?ne=crtmail&islem=<?php echo $_GET["islem"]?>" class="btn btn-info"><i class="fa fa-plus"></i> Oluştur</a>
				</li>
			</ul>
		</div>
		<!-- END: .mailbox-actions -->
		
		<div id="mailbox-email-list" class="mailbox-email-list">
			<div class="nano">
				<div class="nano-content">
					<ul id="" class="list-unstyled">
						<li class="row">
							<div class="col-md-6">
								<?php echo ctranslate("Email")?>
							</div>
							<div class="col-md-2">
								<?php echo ctranslate("Kota")?>
							</div>
							<div class="col-md-2">
								<?php echo ctranslate("Kullanılan")?>
							</div>
							<div class="col-md-2">
								<?php echo ctranslate("İşlem")?>
							</div>
						</a>
					</li>
					<?php
					foreach($lmail['cpanelresult']['data'] as $value) {
						$tags = explode('@',$value['email']);
						?>
						<li class="row">
							<div class="col-md-6" >
								<?php echo $value['email'];?>
							</div>
							<div class="col-md-2">
								<?php echo number_format($value['_diskquota']/1024,0);?> Mb
							</div>
							<div class="col-md-2">
								<?php echo number_format($value['_diskused']/1024,0);?> Mb
							</div>
							<div class="col-md-2">
								<a href="?ne=cpmail&islem=<?php echo $_GET["islem"]?>&mail=<?php echo $tags[0];?>" class="btn-xs btn-info">Şifre Değiştir</a>
								<a href="?ne=lmail&islem=mailbox&durum=dlmail&mail=<?php echo $tags[0];?>" class="btn-xs btn-danger">Kaldır</a>
							</div>
						</a>
					</li>
				<?php }?>							
			</form>
		</ul>
	</div>
</div>
<?php
}elseif($_GET["ne"]=="cmail"){
	if($_GET["i"]<>""){
		function trURLtoCHAR($str){ 
			$ara   = array ('Ä±','�?','Ã¼','Ã§','Ã¶','Ä?','�','Ã','Ä°','Ä','�ž','Ã','Ã','Ä±','�?','Ã§','Ã¶','Ä?','�','Ã','Ä°','Ä','�ž','Ã','Ã','Ã¼','Ä', 'Ç', 'ç', 'Ð', 'ð', 'ý', 'Ý', 'Ö', 'ö', 'Þ', 'þ', 'Ü', 'ü');  
			$degis = array ('ı','ş','ü','ç','ö','ğ','ş','Ç','i','ğ','Ş','Ö','Ü','ı', 'ş', 'ç', 'ö', 'ğ', 'ş', 'Ç', 'i', 'ğ', 'Ş', 'Ö', 'Ü', 'ü', 'ğ','Ç', 'ç', 'Ğ', 'ğ', 'ı', 'İ', 'Ö', 'ö', 'Ş', 'ş', 'Ü', 'ü');  
			return str_replace($ara, $degis, $str);  
		}
					$mail_server = "{".tanim("mail","n3",$_GET["mID"]).":995/pop3/ssl}INBOX"; // notls sertifika hatasını ignore eder.
					$mail_user = tanim("email","n1",$_GET["mID"]); // mail kullanıcı adı
					$mail_pass = tanim("email","n2",$_GET["mID"]); //mail şifresi
					$header = imap_header($imap, $_GET["i"]);
					$mailbox = $header->from[0]->mailbox;
					$host = $header->from[0]->host;
					$subject = iconv_mime_decode($header->subject, 0, "ISO-8859-9");
					$subject = "Re: ".mb_convert_encoding($subject, "UTF-8", "ISO-8859-9")."";
					$imap = imap_open($mail_server, $mail_user, $mail_pass);
					$message = imap_fetchbody($imap,$_GET["i"],1);
					$message = quoted_printable_decode($message);
					$message = "<br><br><hr>".mb_convert_encoding($message, "UTF-8")."<br><br><b>".$firma."</b><br>Telefon: ".$ftel."<br>Gsm: ".$fgsm."<br>Email: ".$fmail."";
				}
				?>
				<div class="inner-body">
					<div class="mailbox-compose" style="padding:15px 0px;">
						<form id="sform" action="?ne=<?php echo $_GET["ne"]?>&islem=<?php echo $_GET["islem"]?>&mID=<?php echo $_GET["mID"]?>&durum=smail" class="form-horizontal form-bordered form-bordered" method="post">
							<div class="form-group form-group-invisible col-md-4 fl mfl">
								<label for="to" class="control-label-invisible"><?php echo ctranslate("Gönderen")?>:</label>
								<div class="col-md-9 ml-md-auto">
									<select name="mgonderen" class="form-control">
										<?php $bmessage_count=0; $sqlt=mysqli_query($conn, "select * from genel where ne='tanim' and t2='email' order by s10 asc"); while($rst=mysqli_fetch_assoc($sqlt)){?>
											<option value="<?php echo base64_decode($rst["n1"]);?>" <?php if(v3d($rsmg["n1"])==$mail.$tmgonderen){?>Selected<?php }?>><?php echo base64_decode($rst["n1"]);?></option>
										<?php }?>
									</select>
								</div>
							</div>
							<div class="form-group form-group-invisible col-md-4 fl mfl">
								<label for="to" class="control-label-invisible"><?php echo ctranslate("Kime")?>:</label>
								<div class="col-md-9 ml-md-auto">
									<input name="alici" type="email" class="form-control" value="<?php if($mailbox<>""){echo "".$mailbox."@".$host."";}?><?php echo $_GET["alici"]?>" placeholder="ad.soyad@mail.com">
								</div>
							</div>
							<div class="form-group form-group-invisible col-md-4 fl mfl">
								<label for="to" class="control-label-invisible"><?php echo ctranslate("Kime/Bcc")?>:</label>
								<div class="col-md-9 ml-md-auto">
									<input name="bcc" type="email" class="form-control" value="">
								</div>
							</div>
							
							<div class="form-group form-group-invisible" style="clear: both;">
								<label for="subject" class="control-label-invisible"><?php echo ctranslate("Konu")?>:</label>
								<div class="col-md-11 ml-md-auto">
									<input name="konu" type="text" class="form-control form-control-invisible" value="<?php echo $subject.$tsubject?>" placeholder="Mailinize bir başlık ekleyin">
								</div>
							</div>
							
							<div class="form-group">
								<div class="compose">
									<textarea name="mesaj" rows="5" class="form-control rte" id="rte" cols="20" placeholder="Email <?php echo $sdil[207]; //Detay?>">
										<?php echo $message.$tmessage;?>
									</textarea>
								</div>
							</div>
							<div class="form-group form-group-invisible">
								<div class="col-md-12" style="margin-left: 25px;">
									<a href="#" class="btn btn-success" onclick="document.getElementById('sform').submit();" style="padding: 10px; border-radius: 20px;"><i class="fa fa-send-o"></i> <?php echo $sdil[112]; //Gönder?></a>
								</div>
							</div>
						</form>
					</div>
				</div>
			<?php }elseif($_GET["ne"]=="crtmail"){?>
				<div class="inner-body">
					<?php if($_GET["durum"]=="err"){?>
						<div class="inner-toolbar clearfix">
							<ul>
								<li>
									<a href="#"><i class="fa fa-times mr-2"></i> <?php echo $_GET["err"]; //Hata Oluştu !?></a>
								</li>
							</ul>
						</div>
					<?php }?>
					<div class="mailbox-compose" style="margin-top: 50px;margin: 50px 0px;">
						<form id="crtform" action="?ne=lmail&islem=<?php echo $_GET["islem"]?>&durum=crtmail" class="form-horizontal form-bordered form-bordered" method="post">
							<div class="form-group form-group-invisible">
								<label for="to" class="control-label-invisible"><?php echo ctranslate("Email")?>:</label>
								<div class="col-md-11 ml-md-auto">
									<div class="input-group">
										<input name="email" type="email" class="form-control" placeholder="E-posta adresinizin kullanıcı adını buraya girin" style="border:1px solid #ccc !important;">
										<span class="input-group-addon" id="basic-addon2">@<?php echo str_replace("https://","",$weburl)?></span>
									</div>
								</div>
							</div>
							
							<div class="form-group form-group-invisible">
								<label for="subject" class="control-label-invisible"><?php echo $sdil[101]; //pass?>:</label>
								<div class="col-md-11 ml-md-auto">
									<input name="pass" type="text" class="form-control form-control-invisible" value="<?php echo generatePassword(12);?>">
								</div>
							</div>
							<div class="form-group form-group-invisible">
								<a  class="btn btn-info fr" onclick="document.getElementById('crtform').submit();"><i class="fa fa-plus mr-2"></i> <?php echo $sdil[201]; //Ekle?></a>
							</div>
							
						</form>
					</div>
				</div>
			<?php }elseif($_GET["ne"]=="cpmail"){?>
				<div class="inner-body">
					<?php if($_GET["durum"]=="err"){?>
						<div class="inner-toolbar clearfix">
							<ul>
								<li>
									<a href="#"><i class="fa fa-times mr-2"></i> <?php echo $_GET["err"]; //Hata Oluştu !?></a>
								</li>
							</ul>
						</div>
					<?php }?>
					<div class="mailbox-compose" style="margin-top: 50px;margin: 50px 0px;">
						<form id="cpform" action="?ne=lmail&islem=<?php echo $_GET["islem"]?>&durum=cpmail" class="form-horizontal form-bordered form-bordered" method="post">
							<div class="form-group form-group-invisible">
								<label for="to" class="control-label-invisible"><?php echo ctranslate("Email")?>:</label>
								<div class="col-md-11 ml-md-auto">
									<div class="input-group">
										<input name="email" type="email" class="form-control" placeholder="E-posta adresinizin kullanıcı adını buraya girin" style="border:1px solid #ccc !important;" value="<?php echo $_GET["mail"]?>">
										<span class="input-group-addon" id="basic-addon2">@<?php echo str_replace("https://","",$weburl)?></span>
									</div>
								</div>
							</div>
							
							<div class="form-group form-group-invisible">
								<label for="subject" class="control-label-invisible"><?php echo $sdil[101]; //pass?>:</label>
								<div class="col-md-11 ml-md-auto">
									<input name="pass" type="text" class="form-control form-control-invisible" value="<?php echo generatePassword(12);?>">
								</div>
							</div>
							<div class="form-group form-group-invisible">
								<a  class="btn btn-info fr" onclick="document.getElementById('cpform').submit();"><i class="fa fa-refresh mr-2"></i> <?php echo translate("Güncelle")?></a>
							</div>
							
						</form>
					</div>
				</div>
			<?php }?>
		</div>
	</div>
</div>
</section>
<!-- end: page -->
</section>
</div>
<aside id="sidebar-right" class="sidebar-right">
	<div class="nano">
		<div class="nano-content">
			<a href="#" class="mobile-close d-md-none">
				Collapse <i class="fa fa-chevron-right"></i>
			</a>
			<div class="sidebar-right-wrapper">
				
				<div class="sidebar-widget widget-calendar">
					<h6>Upcoming Tasks</h6>
					<div data-plugin-datepicker="" data-plugin-skin="dark"></div>
					
					<ul>
						<li>
							<time datetime="2017-04-19T00:00+00:00">04/19/2017</time>
							<span>Company Meeting</span>
						</li>
					</ul>
				</div>
				
				<div class="sidebar-widget widget-friends">
					<h6>Friends</h6>
					<ul>
						<li class="status-online">
							<figure class="profile-picture">
								<img src="img\!sample-user.jpg" alt="Joseph Doe" class="rounded-circle">
							</figure>
							<div class="profile-info">
								<span class="name">Joseph Doe Junior</span>
								<span class="title">Hey, how are you?</span>
							</div>
						</li>
						<li class="status-online">
							<figure class="profile-picture">
								<img src="img\!sample-user.jpg" alt="Joseph Doe" class="rounded-circle">
							</figure>
							<div class="profile-info">
								<span class="name">Joseph Doe Junior</span>
								<span class="title">Hey, how are you?</span>
							</div>
						</li>
						<li class="status-offline">
							<figure class="profile-picture">
								<img src="img\!sample-user.jpg" alt="Joseph Doe" class="rounded-circle">
							</figure>
							<div class="profile-info">
								<span class="name">Joseph Doe Junior</span>
								<span class="title">Hey, how are you?</span>
							</div>
						</li>
						<li class="status-offline">
							<figure class="profile-picture">
								<img src="img\!sample-user.jpg" alt="Joseph Doe" class="rounded-circle">
							</figure>
							<div class="profile-info">
								<span class="name">Joseph Doe Junior</span>
								<span class="title">Hey, how are you?</span>
							</div>
						</li>
					</ul>
				</div>
				
			</div>
		</div>
	</div>
</aside>
</section>
<?php
if($_GET["durum"]=="crtmail"){
	$cmail = createmail(tanim("cpanel","n1",0), tanim("cpanel","n2",0), tanim("cpanel","n3",0),$_POST["email"],$_POST["pass"]);
	if($cmail=="İşlem Başarılı"){
		echo location("?ne=lmail&islem=mailbox",self,500,1);
	}else{
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&key=".$_GET["key"]."&sayfa=".$_GET["sayfa"]."&durum=err&err=".$cmail."",self,500,1);
	}
}elseif($_GET["durum"]=="dlmail"){
	$dmail = delmail(tanim("cpanel","n1",0), tanim("cpanel","n2",0), tanim("cpanel","n3",0),$_GET["mail"]);
	if($cmail=="İşlem Başarılı"){
		echo location("?ne=lmail&islem=mailbox",self,500,1);
	}else{
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&key=".$_GET["key"]."&sayfa=".$_GET["sayfa"]."&durum=err&err=".$cmail."",self,500,1);
	}
}elseif($_GET["durum"]=="cpmail"){	
	$cpmail=cpassmail(tanim("cpanel","n1",0), tanim("cpanel","n2",0), tanim("cpanel","n3",0),$_POST["email"],$_POST["pass"]);
	if($cpmail=="İşlem Başarılı"){
		echo location("?ne=lmail&islem=mailbox",self,500,1);
	}else{
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&key=".$_GET["key"]."&sayfa=".$_GET["sayfa"]."&durum=err&err=".$cpmail."",self,500,1);
	}
}elseif($_GET["durum"]=="smail"){
	$mesaj			= $_POST["mesaj"];
	$malici			= $_POST["alici"];
	$mgonderen	= $_POST["mgonderen"];
	$gonderen		= $firma;
	$konu			= $_POST["konu"];
	$bcc				= $_POST["bcc"];
	$mesaj			= $design_top.$mesaj.$design_bottom;
	$path			= "../";
	emailgonder($malici,$konu,$cc,$mesaj);
	echo location("?ne=cmail&islem=".$_GET["islem"]."&key=".$_GET["key"]."&sayfa=".$_GET["sayfa"]."&mID=".$_GET["mID"]."&tID=0&durum=ok",self,500,1);
}
?>