408 lines
13 KiB
PHP
408 lines
13 KiB
PHP
<?php
|
||
|
||
function category(){
|
||
return DB::where('kat_ustid',0)->kategoriler()->result();
|
||
}
|
||
|
||
function content_category(){return DB::where('lang',LANG,'and')->where('parentId',0)->content_category()->result();}
|
||
|
||
function contentListAdmin($lang = 'tr'){
|
||
return DB::orderBy('id','desc')
|
||
->where('content_type','content','and')
|
||
->where('lang',$lang)
|
||
->get('content')
|
||
->result();
|
||
}
|
||
|
||
/* Functions Content */
|
||
function pageList($lang = 'tr'){
|
||
return DB::orderBy('title','asc')
|
||
->where('content_type','page','and')
|
||
->where('lang', $lang)
|
||
->get('content')->result();
|
||
}
|
||
|
||
function pageEdit($id){
|
||
return DB::where('id',$id)->get('content')->row();
|
||
}
|
||
|
||
|
||
function duyuru(){
|
||
return DB::where('status','1')->duyuruRow();
|
||
}
|
||
|
||
function duyuruRow($id){
|
||
return DB::Where('id',$id)->duyuruRow();
|
||
}
|
||
|
||
function etiketler(){
|
||
$par = DB::select('icerik_tag')->get('content')->result();
|
||
$a = '';$b='';
|
||
foreach ($par as $key ) {
|
||
$a .= $key->icerik_tag.',';
|
||
}
|
||
|
||
$new = explode(',',$a);
|
||
return array_unique($new);
|
||
|
||
}
|
||
|
||
|
||
/* End Functions Content */
|
||
function telegram1($messaggio) {
|
||
$url = "https://api.telegram.org/bot889222363:AAF-kRBifC2lt9Yvv6mUqEuu1h0f7vIYhhA/sendMessage?forum_topic_created_name=-testkonu";
|
||
$url = $url . "&text=" . urlencode($messaggio);
|
||
$ch = curl_init();
|
||
$optArray = array(
|
||
CURLOPT_URL => $url,
|
||
CURLOPT_RETURNTRANSFER => true
|
||
);
|
||
curl_setopt_array($ch, $optArray);
|
||
$result = curl_exec($ch);
|
||
curl_close($ch);
|
||
}
|
||
|
||
function telegram($messaggio) {
|
||
//echo "Mesaj Gönderiliyor.. -1001464176086\n";
|
||
$url = "https://api.telegram.org/bot889222363:AAF-kRBifC2lt9Yvv6mUqEuu1h0f7vIYhhA/sendMessage?chat_id=-1001464176086";
|
||
$url = $url . "&text=" . urlencode($messaggio);
|
||
$ch = curl_init();
|
||
$optArray = array(
|
||
CURLOPT_URL => $url,
|
||
CURLOPT_RETURNTRANSFER => true
|
||
);
|
||
curl_setopt_array($ch, $optArray);
|
||
$result = curl_exec($ch);
|
||
curl_close($ch);
|
||
}
|
||
|
||
function translate($data){echo ML::select($data);}
|
||
|
||
function lang($langFile, $langParam){
|
||
return Lang::select($langFile, $langParam);
|
||
}
|
||
|
||
|
||
function loginControl($deg='Panel'){
|
||
if(!Session::select('login')){
|
||
redirect('home/login');
|
||
}
|
||
}
|
||
|
||
function reCaptcha($response){
|
||
$fileds = [
|
||
'secret' => "6Lc2qXwUAAAAAGfGK29-85EpV72saCoGwDUvwJv2",
|
||
'response' => $response
|
||
];
|
||
|
||
$ch = curl_init('https://www.google.com/recaptcha/api/siteverify');
|
||
curl_setopt_array($ch, [
|
||
CURLOPT_POST => true,
|
||
CURLOPT_POSTFIELDS => http_build_query($fileds),
|
||
CURLOPT_RETURNTRANSFER => true
|
||
]);
|
||
|
||
$result = curl_exec($ch);
|
||
curl_close($ch);
|
||
return json_decode($result,true);
|
||
}
|
||
|
||
function member_role($id){
|
||
return DB::select('authority')->where('id',$id)->get('authority')->value();
|
||
|
||
}
|
||
|
||
function authority_list(){
|
||
return DB::get('authority')->result();
|
||
}
|
||
|
||
|
||
function category_name($id){
|
||
return DB::select('adi')->where('id',$id)->get('kategoriler')->value();
|
||
}
|
||
|
||
function galeryCategory(){
|
||
return DB::get('galeryCategory')->result();
|
||
}
|
||
|
||
|
||
|
||
function languageList(){
|
||
return DB::orderBy('sirala','asc')->language()->result();
|
||
}
|
||
|
||
function langList(){
|
||
return DB::orderBy('sirala','asc')->language()->result();
|
||
}
|
||
|
||
function langRow($id){
|
||
return DB::where('id',$id)->language()->row();
|
||
}
|
||
|
||
/* MENU FUNCTIONS */
|
||
function menuList($menuCatId=''){
|
||
return DB::where('menuCatId',$menuCatId)->menuResult();
|
||
}
|
||
|
||
function menuListAdmin($subMenuId ='0'){
|
||
return DB::where('subMenuId',$subMenuId)->menuResult();
|
||
}
|
||
|
||
function menuCatList(){
|
||
return DB::menucat()->result();
|
||
}
|
||
|
||
function menuCatName($id){
|
||
return DB::where('id',$id)->menucat()->value('name');
|
||
}
|
||
|
||
|
||
function menu($data){
|
||
$catid = DB::where('name', $data)->menucat()->value('id');
|
||
|
||
$menu = DB::where('menuCatId', $catid, 'and')->where('lang', LANG)->menu()->result();
|
||
|
||
foreach ($menu as $item) {
|
||
// Sadece http:// veya https:// ile BAŞLAMIYORSA base URL ekle
|
||
if (!preg_match('/^(https?:\/\/)/i', $item->link)) {
|
||
$item->link = URL::base() . ltrim($item->link, '/');
|
||
}
|
||
}
|
||
|
||
return $menu;
|
||
}
|
||
|
||
function menu1($menuCatId){
|
||
return DB::where('menuCatId', $menuCatId,'and')->where('lang',LANG)->menu()->result();
|
||
}
|
||
|
||
function menuRow($id){
|
||
return DB::where('id',$id)->menu()->row();
|
||
}
|
||
|
||
/* END MENU FUNCTIONS */
|
||
function userRow($id){
|
||
return DB::where('user_id',$id)->get('user')->row();
|
||
}
|
||
|
||
function activeUserCount(){
|
||
return DB::where('status','1')->get('user')->totalRows();
|
||
}
|
||
|
||
function disableMemberCount(){
|
||
return DB::where('status','2')->get('user')->totalRows();
|
||
}
|
||
|
||
function pendingMemberCount(){
|
||
return DB::where('status','0')->get('user')->totalRows();
|
||
}
|
||
|
||
function username($id){
|
||
return DB::select('username')->where('user_id',$id)->get('user')->value();
|
||
}
|
||
|
||
function userId($username){
|
||
return DB::select('user_id')->whereLike('username',$username)->get('user')->value();
|
||
}
|
||
|
||
function userStatus($id){
|
||
return DB::select('status')->where('user_id',$id)->get('user')->value();
|
||
}
|
||
|
||
function userList(){
|
||
return DB::orderBy('username','asc')->where('status',1)->get('user')->limit('10')->result();
|
||
}
|
||
|
||
|
||
|
||
function contentStatus($id){
|
||
return DB::select('status')->where('value',$id, 'and')->where('lang',LANG)->contentStatus()->value();
|
||
}
|
||
|
||
|
||
|
||
/* functions Meagges*/
|
||
function messsageCount($userid){
|
||
return DB::where('userId',$userid,'and')->where('status','0')->messages()->totalRows('TRUE');
|
||
}
|
||
|
||
function messageList($userid){
|
||
return DB::where('userId',$userid)->messages()->result();
|
||
}
|
||
|
||
|
||
|
||
function messageListAdmin(){
|
||
return DB::where('admin','1')->messages()->result();
|
||
}
|
||
|
||
function messageRow($id){
|
||
return DB::where('id',$id)->messages()->row();
|
||
}
|
||
|
||
function messageStatus($status){
|
||
if ($status == 1) {
|
||
echo '<i class="fa-solid fa-envelope-circle-check" title="'.lang('message','read').'"></i>';
|
||
}else{
|
||
echo '<i class="fa-solid fa-envelope" title="'.lang('message','unread').'"></i>';
|
||
}
|
||
}
|
||
|
||
/* End Functions Meagges*/
|
||
function curl($url, $post = NULL)
|
||
{
|
||
$http_header = array(
|
||
"Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
|
||
"Accept-Language:tr-TR,tr;q=0.8,en-US;q=0.6,en;q=0.4,id;q=0.2,ru;q=0.2,ar;q=0.2,fa;q=0.2",
|
||
"Cache-Control:max-age=0",
|
||
"Upgrade-Insecure-Requests:1",
|
||
);
|
||
$ch = curl_init();
|
||
curl_setopt_array($ch, array(
|
||
CURLOPT_URL => $url,
|
||
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36",
|
||
CURLOPT_RETURNTRANSFER => TRUE,
|
||
CURLOPT_FOLLOWLOCATION => TRUE,
|
||
CURLOPT_ENCODING => "",
|
||
CURLOPT_SSL_VERIFYPEER => FALSE,
|
||
CURLOPT_SSL_VERIFYHOST => FALSE,
|
||
CURLOPT_MAXREDIRS => 3,
|
||
CURLOPT_HTTPHEADER => $http_header,
|
||
));
|
||
if (isset($post)) {
|
||
curl_setopt_array($ch, array(
|
||
CURLOPT_POST => TRUE,
|
||
CURLOPT_POSTFIELDS => $post,
|
||
CURLOPT_HTTPHEADER => array_merge($http_header, array(
|
||
"Expect: ",
|
||
)),
|
||
));
|
||
}
|
||
$content = curl_exec($ch);
|
||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||
$http_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
|
||
curl_close($ch);
|
||
return (object)array(
|
||
"http_code" => $http_code,
|
||
"http_url" => $http_url,
|
||
"content" => $content,
|
||
);
|
||
}
|
||
|
||
|
||
// Üyelik onayı e-posta şablonu
|
||
function emailActivationTemplate($username, $rnd) {
|
||
return "
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset='UTF-8'>
|
||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||
<title>Üyelik Onayı</title>
|
||
</head>
|
||
<body style='margin: 0; padding: 0; font-family: Arial, sans-serif; background-color: #f4f4f4;'>
|
||
<div style='max-width: 600px; margin: 0 auto; background-color: #ffffff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);'>
|
||
<div style='text-align: center; margin-bottom: 30px;'>
|
||
<h1 style='color: #333; margin: 0; font-size: 24px;'>Pisi GNU / Linux</h1>
|
||
<p style='color: #666; margin: 10px 0 0; font-size: 14px;'>Üyelik Onayı</p>
|
||
</div>
|
||
|
||
<div style='background-color: #f9f9f9; padding: 20px; border-radius: 6px; margin-bottom: 20px;'>
|
||
<p style='color: #333; margin: 0 0 15px; font-size: 16px; line-height: 1.6;'>
|
||
Merhaba <strong>$username</strong>,
|
||
</p>
|
||
<p style='color: #666; margin: 0 0 15px; font-size: 14px; line-height: 1.6;'>
|
||
Sitemize kayıt olduğunuz için teşekkür ederiz. Üyeliğinizi aktif etmek için aşağıdaki butona tıklayın:
|
||
</p>
|
||
</div>
|
||
|
||
<div style='text-align: center; margin: 30px 0;'>
|
||
<a href='https://pisilinux.org/member/aktivizasyon/$rnd'
|
||
style='display: inline-block; background-color: #007bff; color: #ffffff; text-decoration: none; padding: 12px 30px; border-radius: 6px; font-size: 16px; font-weight: bold;'>
|
||
Üyeliği Aktif Et
|
||
</a>
|
||
</div>
|
||
|
||
<div style='background-color: #fff3cd; padding: 15px; border-left: 4px solid #ffc107; border-radius: 4px; margin-bottom: 20px;'>
|
||
<p style='color: #856404; margin: 0; font-size: 13px; line-height: 1.5;'>
|
||
<strong>Alternatif:</strong> Eğer buton çalışmazsa, şu bağlantıyı tarayıcınıza kopyalayın:<br>
|
||
<span style='word-break: break-all; color: #007bff;'>https://pisilinux.org/member/aktivizasyon/$rnd</span>
|
||
</p>
|
||
</div>
|
||
|
||
<div style='border-top: 1px solid #e0e0e0; padding-top: 20px; margin-top: 20px;'>
|
||
<p style='color: #666; margin: 0 0 10px; font-size: 14px; line-height: 1.6;'>
|
||
Ayrıca <a href='https://t.me/joinchat/MAcpp0o6E4dAAoz090cDjA' style='color: #007bff; text-decoration: none;'>Telegram</a> kanalımızda da sizi aramızda görmekten memnuniyet duyarız.
|
||
</p>
|
||
<p style='color: #999; margin: 10px 0 0; font-size: 12px;'>
|
||
Bu e-posta otomatik olarak gönderilmiştir, lütfen cevaplamayınız.
|
||
</p>
|
||
</div>
|
||
|
||
<div style='text-align: center; margin-top: 30px;'>
|
||
<p style='color: #999; margin: 0; font-size: 12px;'>
|
||
". date("Y") ." Pisi GNU / Linux. Tüm hakları saklıdır.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>";
|
||
}
|
||
|
||
// Şifre kurtarma e-posta şablonu
|
||
function emailPasswordResetTemplate($rnd) {
|
||
return "
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset='UTF-8'>
|
||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||
<title>Şifre Kurtarma</title>
|
||
</head>
|
||
<body style='margin: 0; padding: 0; font-family: Arial, sans-serif; background-color: #f4f4f4;'>
|
||
<div style='max-width: 600px; margin: 0 auto; background-color: #ffffff; padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);'>
|
||
<div style='text-align: center; margin-bottom: 30px;'>
|
||
<h1 style='color: #333; margin: 0; font-size: 24px;'>Pisi GNU / Linux</h1>
|
||
<p style='color: #666; margin: 10px 0 0; font-size: 14px;'>Şifre Kurtarma</p>
|
||
</div>
|
||
|
||
<div style='background-color: #f9f9f9; padding: 20px; border-radius: 6px; margin-bottom: 20px;'>
|
||
<p style='color: #333; margin: 0 0 15px; font-size: 16px; line-height: 1.6;'>
|
||
Merhaba,
|
||
</p>
|
||
<p style='color: #666; margin: 0 0 15px; font-size: 14px; line-height: 1.6;'>
|
||
Şifrenizi kurtarmak için aşağıdaki butona tıklayarak yeni şifrenizi belirleyebilirsiniz:
|
||
</p>
|
||
</div>
|
||
|
||
<div style='text-align: center; margin: 30px 0;'>
|
||
<a href='https://pisilinux.org/member/yenisifre/$rnd'
|
||
style='display: inline-block; background-color: #007bff; color: #ffffff; text-decoration: none; padding: 12px 30px; border-radius: 6px; font-size: 16px; font-weight: bold;'>
|
||
Yeni Şifre Belirle
|
||
</a>
|
||
</div>
|
||
|
||
<div style='background-color: #fff3cd; padding: 15px; border-left: 4px solid #ffc107; border-radius: 4px; margin-bottom: 20px;'>
|
||
<p style='color: #856404; margin: 0; font-size: 13px; line-height: 1.5;'>
|
||
<strong>Alternatif:</strong> Eğer buton çalışmazsa, şu bağlantıyı tarayıcınıza kopyalayın:<br>
|
||
<span style='word-break: break-all; color: #007bff;'>https://pisilinux.org/member/yenisifre/$rnd</span>
|
||
</p>
|
||
</div>
|
||
|
||
<div style='border-top: 1px solid #e0e0e0; padding-top: 20px; margin-top: 20px;'>
|
||
<p style='color: #999; margin: 10px 0 0; font-size: 12px;'>
|
||
Bu e-posta otomatik olarak gönderilmiştir, lütfen cevaplamayınız.<br>
|
||
Şifrenizi değiştirmediyseniz bu e-postayı görmezden gelebilirsiniz.
|
||
</p>
|
||
</div>
|
||
|
||
<div style='text-align: center; margin-top: 30px;'>
|
||
<p style='color: #999; margin: 0; font-size: 12px;'>
|
||
". date("Y") ." Pisi GNU / Linux. Tüm hakları saklıdır.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>";
|
||
}
|