Files
web-site/External/Starting/Autoload/blog.php
T
2026-07-02 08:16:19 +03:00

108 lines
2.9 KiB
PHP

<?php
function content_list(){
return DB::limit(NULL,10)
->orderBy('id','desc')
->where('content_type','content','and')
->where('lang',LANG)
->get('content');
}
function user_content_list($editor){
return DB::orderBy('id','desc')->where('content_type','content','and')->where('editor',$editor)->get('content')->result();
}
function content_edit($id){
return DB::where('id',$id)->get('content')->row();
}
function blog($id=null){
if ($id) {
return DB::orderBy('id','desc')
->where('content_type','content','and')
->where('status','1','and')
->where('category_id',$id)
->get('content')
->result();
}else{
return DB::orderBy('id','desc')
->where('content_type','content','and')
->where('status','1')
->get('content')
->result();
}
}
function blogCategory($id){
return DB::limit(NULL,10)
->orderBy('id','desc')
->where('content_type','content','and')
->where('status','1','and')
->where('category_id',$id)
->get('content');
}
function content($limit = '3'){
return DB::orderBy('id','desc')->where('content_type','content','and')->where('status','1','and')->where('lang',LANG)->limit($limit)->get('content')->result();
}
function content_confirmation(){
return DB::orderBy('id','desc')->where('content_type','content','and')->where('status','0')->limit('3')->get('content')->result();
}
function contentCategory(){
return DB::content_category()->result();
}
function contentCategoryRow($id){
return DB::where('id',$id)->content_category()->row();
}
function contentRow($id){
if (is_numeric($id)) {
$row = DB::where('id',$id)->get('content')->row();
if ($row) return $row;
}
return DB::where('title_seo',$id)->get('content')->row();
}
function content_image($icerik) {
$resimbir = '';
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', htmlspecialchars_decode($icerik), $matches);
if($output){$resimbir = $matches['1']['0'];}
if(empty($resimbir)){ //Eğer resim eklememişseniz
$resimbir = URL::base('upload/pisilinux_pisi.png');
}
return $resimbir;
}
function contentStatusAdmin($status){
if ($status == '0') {
$stat = '<i class="fa fa-times">';
}elseif($status == '1'){
$stat = '<i class="fa fa-check">';
}elseif($status == '2'){
$stat = '<span class="badge badge-pill badge-danger text-white">'.lang('Genel','banned').'</span>';
}elseif($status == '3'){
$stat = '<span class="badge badge-pill badge-primary">'.lang('Genel','waiting_for_approval').'</span>';
}elseif($status == '4'){
$stat = '<span class="badge badge-pill badge-primary">'.lang('Genel','solved').'</span>';
}
return $stat;
}
function slider(){
return DB::where('durum','1')->orderBy('sira','asc')->get('slider')->result();
}
function blogSearch($search){
return DB::select('id','title','title_seo','content')->orderBy('id','desc')->whereLike('title', $search,'or')->whereLike('content', $search)->get('content')->result();
}