📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
projetakipscripti.demodesign.com.tr
/
application
/
controllers
📝
Ayarlar.php
← Geri Dön
<?php /* * Generated by CRUDigniter v3.2 * www.crudigniter.com */ class Ayarlar extends CI_Controller{ function __construct() { parent::__construct(); $this->load->model('ayarlar_model'); // CI viewden controlleri calıstırmak için gerekli $CI = NULL; $this->CI = & get_instance(); // Giris Yapılmamış ise logine gönderiyoruz.. $userid = $this->session->userdata('userid'); if(empty($userid)) { redirect('login'); } // Yetkili Degil ise Anasayfa gönderiyoruz.. // Calisanlar Giremez $userid = $this->session->userdata('useryetki'); if($userid!=1) { redirect('anasayfa'); } } /* * Listing of ayarlar */ function index() { $data['ayarlar'] = $this->db->query("SELECT * FROM ayarlar WHERE aktif=1 ORDER BY id DESC")->result_array(); //anlık kontrol aktifleştirme $data['sayfaad'] = 'admin_ayarlar'; $data['anlikkontrol'] = 1; $data['_view'] = 'ayarlar/index'; $this->load->view('layouts/main',$data); } /* * Adding a new ayarlar */ function add() { if(isset($_POST) && count($_POST) > 0) { ///logoyu alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('logo')) { $dosyaurl = site_url('/resources/varsayilanprofil/ayarlar.png'); $yenidosyaad = md5(date("d.m.Y H:i")) . '.png'; copy($dosyaurl , './uploads/' . $yenidosyaad); $logo=$yenidosyaad; } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $logo=$data['file_name']; } ///Reçete alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'pdf|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('recete')) { $recete=""; } else { $data=$this->upload->data(); $recete=$data['file_name']; } $params = array( 'logo' => $logo, 'ad' => $this->input->post('ad'), 'adres' => $this->input->post('adres'), 'ucret' => $this->input->post('ucret'), 'odemetarih' => $this->input->post('odemetarih'), 'kayittarih' => $this->input->post('kayittarih'), 'aktif' => 1, ); if (isset($recete)) { $params['recete'] = $recete; }; $calisan_id = $this->ayarlar_model->add_ayarlar($params); redirect('ayarlar/index'); // echo site_url('ayarlar/index'); }else { $data['_view'] = 'ayarlar/add'; $this->load->view('layouts/main',$data); } } /* * Editing a ayarlar */ function edit($id) { // check if the ayarlar exists before trying to edit it $data['ayarlar'] = $this->ayarlar_model->get_ayarlar($id); if(isset($data['ayarlar']['id'])) { if(isset($_POST) && count($_POST) > 0) { ///logoyu alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('logo')) { $error = array('error' => $this->upload->display_errors()); // print_r ($error); } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $logo=$data['file_name']; } ///Faviconu alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('favicon')) { $error = array('error' => $this->upload->display_errors()); // print_r ($error); } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, 'width' => 250, 'height' => 250, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $favicon=$data['file_name']; } ///Giriş Sayfası Kapak Foto alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); $this->load->library('upload', $config); if ( ! $this->upload->do_upload('login')) { $error = array('error' => $this->upload->display_errors()); // print_r ($error); } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $loginkapak=$data['file_name']; } ///Reçete alıyoruz $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'pdf|jpg|png'; $config['max_size'] = '1000000000000000'; $config['file_name'] = md5(date("d.m.Y H:i")); if ( ! $this->upload->do_upload('recete')) { $error = array('error' => $this->upload->display_errors()); // print_r ($error); } else { $data=$this->upload->data(); $recete=$data['file_name']; } ///Arkafotoyu alıyoruz $this->load->library('upload', $config); if ( ! $this->upload->do_upload('arkafoto')) { } else { $data=$this->upload->data(); //Resmi Küçültme $image_data = $this->upload->data(); $this->load->library('image_lib'); $configer = array( 'image_library' => 'gd2', 'source_image' => $image_data['full_path'], 'maintain_ratio' => FALSE, 'width' => 872, 'height' => 270, ); $this->image_lib->clear(); $this->image_lib->initialize($configer); $this->image_lib->resize(); $arkafoto=$data['file_name']; } //verileri $params = array( 'title' => $this->input->post('title'), 'slogan' => $this->input->post('slogan'), 'renk' => $this->input->post('renk'), ); if(isset($logo)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('ayarlar')->row_array(); $eskidosyaadi= $query['logo']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); } $params['logo']=$logo; } if(isset($favicon)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('ayarlar')->row_array(); $eskidosyaadi= $query['favicon']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); } $params['favicon']=$favicon; } if(isset($recete)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('ayarlar')->row_array(); $eskidosyaadi= $query['recete']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); }; $params['recete']=$recete; } if(isset($loginkapak)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('ayarlar')->row_array(); $eskidosyaadi= $query['login']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); }; $params['login']=$loginkapak; } if(isset($arkafoto)) { // Eski Dosyayı Bulup Siliyoruz. $this->db->where('id', $id); $query = $this->db->get('ayarlar')->row_array(); $eskidosyaadi= $query['recete']; if(isset($eskidosyaadi)) { unlink('uploads/'.$eskidosyaadi); } $params['arkafoto']=$arkafoto; } $this->ayarlar_model->update_ayarlar($id,$params); redirect('ayarlar/edit/1'); // echo site_url('ayarlar/index'); } else { $data['_view'] = 'ayarlar/edit'; $this->load->view('layouts/main',$data); } } else show_error('The ayarlar you are trying to edit does not exist.'); } /* * Deleting ayarlar */ function remove($id) { $ayarlar = $this->ayarlar_model->get_ayarlar($id); // check if the ayarlar exists before trying to delete it if(isset($ayarlar['id'])) { $params['aktif']=0; $this->ayarlar_model->update_ayarlar($id,$params); redirect('ayarlar/index'); } else show_error('The ayarlar you are trying to delete does not exist.'); } }
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula