%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Manageblog extends CI_Controller { public function __construct() { parent::__construct(); $this->load->library('form_validation','session'); $this->load->Model('Blog_Model'); } /* * Function: index */ public function index($page = 0) { //$this->login_check(); $data = array(); $head = array(); } /* * Function : manageblog */ public function manageblog() { //$this->login_check(); $data = array(); $head = array(); if(isset($_GET['delete'])){ $this->Blog_Model->deleteRecords($_GET['delete'],'id','tbl_blogs'); $this->session->set_flashdata('result_delete', 'Blog is deleted!'); redirect('admin/manageblog/manageblog?msg=1'); } $data['responseArray'] = $this->Blog_Model->getAllRecords('tbl_blogs', '*', array('is_deleted'=>'0'), array('id'=>'desc'),''); //$arrSeo = $this->Public_model->getSeo('manageblog'); $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Blog - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blog/manageblog', $data); $this->load->view('admin/_parts/footer'); } /* * Function : addblog */ public function addblog() { //$this->login_check(); $data = array(); $head = array(); //$arrSeo = $this->Public_model->getSeo('manageblog'); if (isset($_POST['submit'])) { if($_POST['submit']=='Submit') { $_POST['blog_image'] = $this->uploadImage(); if($_POST['old_image']!='' && $_POST['blog_image']==''){ $_POST['blog_image'] = $_POST['old_image']; } unset($_POST['old_image']); unset($_POST['submit']); $_POST['blog_slug'] = str_replace(array(' ','#','%','='),'-',strtolower($_POST['blog_slug'])); if($_POST['id']>0){ $_POST['modifiedon'] = date('Y-m-d h:i:s'); $_POST['tag_id'] = implode(',',$_POST['tag_id']); $_POST['category_id'] = implode(',',$_POST['category_id']); $_POST['author_name'] = "ADMIN"; // $_POST['blog_slug'] = $this->generateSeoURL($_POST['blog_title']); //print_r($_POST);die(); $this->Blog_Model->updateinfo($tbl_name='tbl_blogs', $_POST, 'id', $_POST['id']); redirect('admin/manageblog/manageblog?msg=2'); } else { $_POST['createdon'] = date('Y-m-d h:i:s'); $_POST['tag_id'] = implode(',',$_POST['tag_id']); $_POST['category_id'] = implode(',',$_POST['category_id']); $_POST['author_name'] = "ADMIN"; //$_POST['blog_slug'] = $this->generateSeoURL($_POST['blog_title']); echo $resp = $this->Blog_Model->saveinfo('tbl_blogs',$_POST); redirect('admin/manageblog/manageblog?msg=3'); } } } if (isset($_GET['id'])) { $id = $_GET['id']; $data['responseArray'] = $this->Blog_Model->getSingleRecord('tbl_blogs', '*', array('is_deleted'=>'0', 'id'=>$id)); } $data['categoryArray'] = $this->Blog_Model->getAllRecords('tbl_blog_category', 'id,category_name', array('is_deleted'=>'0')); $data['tagsArray'] = $this->Blog_Model->getAllRecords('tbl_blog_tags', 'id,tag_name', array('is_deleted'=>'0')); $data['authorArray'] = $this->Blog_Model->getAllRecords('tbl_blog_author', 'id,author_name', array('is_deleted'=>'0')); $data['typeArray'] = $this->Blog_Model->getAllRecords('tbl_blog_type', 'id,blogtype_name', array('is_deleted'=>'0')); $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Blog - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blog/addblog', $data); $this->load->view('admin/_parts/footer'); } /* * Function : uploadImage */ private function uploadImage() { $config['upload_path'] = './attachments/blog_images/'; $config['allowed_types'] = '*'; $config['remove_spaces'] = TRUE; $config['overwrite'] = TRUE; $config['max_size'] = 2097152; $this->load->library('upload', $config); $this->upload->initialize($config); if (!$this->upload->do_upload('blog_image')) { log_message('error', 'Image Upload Error: ' . $this->upload->display_errors()); } $img = $this->upload->data(); if(!empty($img['file_name'])) { //resizeImage($img['file_name'],'300','300','attachments/event_images'); } return $img['file_name']; } /* * Function : managecategory */ public function managecategory() { //$this->login_check(); $data = array(); $head = array(); if(isset($_GET['delete'])){ $this->Blog_Model->deleteRecords($_GET['delete'],'id','tbl_blog_category'); $this->session->set_flashdata('result_delete', 'Category is deleted!'); redirect('admin/manageblog/managecategory?msg=1'); } $data['responseArray'] = $this->Blog_Model->getAllRecords('tbl_blog_category', '*', array('is_deleted'=>'0')); //$arrSeo = $this->Public_model->getSeo('managecategory'); $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Category - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogcategory/managecategory', $data); $this->load->view('admin/_parts/footer'); } /* * Function : addcategory */ public function addcategory() { //$this->login_check(); $data = array(); $head = array(); //$arrSeo = $this->Public_model->getSeo('managecategory'); if (isset($_POST['submit'])) { if($_POST['submit']=='Submit') { unset($_POST['submit']); if($_POST['id']>0){ $_POST['modifiedon'] = date('Y-m-d h:i:s'); // $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $_POST['slug'] = $this->generateSeoURL($_POST['category_name']); $this->Blog_Model->updateinfo($tbl_name='tbl_blog_category', $_POST, 'id', $_POST['id']); redirect('admin/manageblog/managecategory?msg=2'); } else { $_POST['createdon'] = date('Y-m-d h:i:s'); // $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $_POST['slug'] = $this->generateSeoURL($_POST['category_name']); $resp = $this->Blog_Model->saveinfo('tbl_blog_category',$_POST); redirect('admin/manageblog/managecategory?msg=3'); } } } if (isset($_GET['id'])) { $id = $_GET['id']; $data['responseArray'] = $this->Blog_Model->getSingleRecord('tbl_blog_category', '*', array('is_deleted'=>'0', 'id'=>$id)); } // Get School List $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Category - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogcategory/addcategory', $data); $this->load->view('admin/_parts/footer'); } /* * Function : managetags */ public function managetags() { //$this->login_check(); $data = array(); $head = array(); if(isset($_GET['delete'])){ $this->Blog_Model->deleteRecords($_GET['delete'],'id','tbl_blog_tags'); $this->session->set_flashdata('result_delete', 'Tag is deleted!'); redirect('admin/manageblog/managetags?msg=1'); } $data['responseArray'] = $this->Blog_Model->getAllRecords('tbl_blog_tags', '*', array('is_deleted'=>'0')); //$arrSeo = $this->Public_model->getSeo('managetags'); $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Tags - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogtags/managetags', $data); $this->load->view('admin/_parts/footer'); } /* * Function : addtags */ public function addtags() { //$this->login_check(); $data = array(); $head = array(); //$arrSeo = $this->Public_model->getSeo('managetags'); if (isset($_POST['submit'])) { if($_POST['submit']=='Submit') { unset($_POST['submit']); if($_POST['id']>0){ $_POST['modifiedon'] = date('Y-m-d h:i:s'); // $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $_POST['slug'] = $this->generateSeoURL($_POST['tag_name']); $this->Blog_Model->updateinfo($tbl_name='tbl_blog_tags', $_POST, 'id', $_POST['id']); redirect('admin/manageblog/managetags?msg=2'); } else { $_POST['createdon'] = date('Y-m-d h:i:s'); // $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $_POST['slug'] = $this->generateSeoURL($_POST['tag_name']); $resp = $this->Blog_Model->saveinfo('tbl_blog_tags',$_POST); redirect('admin/manageblog/managetags?msg=3'); } } } if (isset($_GET['id'])) { $id = $_GET['id']; $data['responseArray'] = $this->Blog_Model->getSingleRecord('tbl_blog_tags', '*', array('is_deleted'=>'0', 'id'=>$id)); } // Get School List $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Tags - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogtags/addtags', $data); $this->load->view('admin/_parts/footer'); } /* * Function : managetype */ public function managetype() { //$this->login_check(); $data = array(); $head = array(); if(isset($_GET['delete'])){ $this->Blog_Model->deleteRecords($_GET['delete'],'id','tbl_blog_type'); $this->session->set_flashdata('result_delete', 'Blog Type is deleted!'); redirect('admin/manageblog/managetype?msg=1'); } $data['responseArray'] = $this->Blog_Model->getAllRecords('tbl_blog_type', '*', array('is_deleted'=>'0')); //$arrSeo = $this->Public_model->getSeo('managetype'); $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Blog Type - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogtype/managetype', $data); $this->load->view('admin/_parts/footer'); } /* * Function : addtype */ public function addtype() { //$this->login_check(); $data = array(); $head = array(); //$arrSeo = $this->Public_model->getSeo('managetype'); if (isset($_POST['submit'])) { if($_POST['submit']=='Submit') { unset($_POST['submit']); if($_POST['id']>0){ $_POST['modifiedon'] = date('Y-m-d h:i:s'); $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $this->Blog_Model->updateinfo($tbl_name='tbl_blog_type', $_POST, 'id', $_POST['id']); redirect('admin/manageblog/managetype?msg=2'); } else { $_POST['createdon'] = date('Y-m-d h:i:s'); $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $resp = $this->Blog_Model->saveinfo('tbl_blog_type',$_POST); redirect('admin/manageblog/managetype?msg=3'); } } } if (isset($_GET['id'])) { $id = $_GET['id']; $data['responseArray'] = $this->Blog_Model->getSingleRecord('tbl_blog_type', '*', array('is_deleted'=>'0', 'id'=>$id)); } // Get School List $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Blog Type - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogtype/addtype', $data); $this->load->view('admin/_parts/footer'); } /* * Function : manageauthors */ public function manageauthors() { //$this->login_check(); $data = array(); $head = array(); if(isset($_GET['delete'])){ $this->Blog_Model->deleteRecords($_GET['delete'],'id','tbl_blog_author'); $this->session->set_flashdata('result_delete', 'Author is deleted!'); redirect('admin/manageblog/manageauthors?msg=1'); } $data['responseArray'] = $this->Blog_Model->getAllRecords('tbl_blog_author', '*', array('is_deleted'=>'0')); //$arrSeo = $this->Public_model->getSeo('manageauthors'); $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Authors - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogauthors/manageauthors', $data); $this->load->view('admin/_parts/footer'); } /* * Function : addauthors */ public function addauthors() { //$this->login_check(); $data = array(); $head = array(); //$arrSeo = $this->Public_model->getSeo('manageauthors'); if (isset($_POST['submit'])) { if($_POST['submit']=='Submit') { unset($_POST['submit']); if($_POST['id']>0){ $_POST['modifiedon'] = date('Y-m-d h:i:s'); $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $this->Blog_Model->updateinfo($tbl_name='tbl_blog_author', $_POST, 'id', $_POST['id']); redirect('admin/manageblog/manageauthors?msg=2'); } else { $_POST['createdon'] = date('Y-m-d h:i:s'); $_POST['display_name'] = ucwords(strtolower($_POST['display_name'])); $resp = $this->Blog_Model->saveinfo('tbl_blog_author',$_POST); redirect('admin/manageblog/manageauthors?msg=3'); } } } if (isset($_GET['id'])) { $id = $_GET['id']; $data['responseArray'] = $this->Blog_Model->getSingleRecord('tbl_blog_author', '*', array('is_deleted'=>'0', 'id'=>$id)); } // Get School List $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'Manage Authors - SWS Blog'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('admin/_parts/header', $head); $this->load->view('admin/blogauthors/addauthors', $data); $this->load->view('admin/_parts/footer'); } public function generateSeoURL($string, $wordLimit = 0){ $separator = '-'; if($wordLimit != 0){ $wordArr = explode(' ', $string); $string = implode(' ', array_slice($wordArr, 0, $wordLimit)); } $quoteSeparator = preg_quote($separator, '#'); $trans = array( '&.+?;' => '', '[^\w\d _-]' => '', '\s+' => $separator, '('.$quoteSeparator.')+'=> $separator ); $string = strip_tags($string); foreach ($trans as $key => $val){ $string = preg_replace('#'.$key.'#i'.(UTF8_ENABLED ? 'u' : ''), $val, $string); } $string = strtolower($string); return trim(trim($string, $separator)); } public function ajaxgetCountblog() { //$this->login_check(); $blog_title = $_POST['blog_title']; //printr($blog_title);die(); $data['responseArray'] = $this->Blog_Model->getAllRecordCount('tbl_blogs', '*', array('blog_title'=>$blog_title,'is_deleted'=>'0')); //print_r($data['responseArray']);die(); echo $data['responseArray']; } }