load->helper(array('form', 'url')); $this->load->library(array('form_validation','pagination','visitorscount','treeview')); $this->load->model(array('pagemodel','catmodel','panelmodel','newsmodel','langmodel','sortmodel','mediamodel','usermodel')); if(!$this->session->userdata('lang')) $this->session->set_userdata('lang', 1); $this->languages=$this->langmodel->languages(); foreach($this->languages as $lang) { if($lang['id']==$this->session->userdata('lang')) { $this->session->set_userdata('lang_short_title', $lang['short_title']); $this->session->set_userdata('lang_english_title', $lang['english_title']); } } $this->language = $this->session->userdata('lang'); $this->lang->load('front', $this->session->userdata('lang_english_title')); $tree = $this->pagemodel->pages_tree($this->language,"0"); if(is_array($tree) && count($tree)>0){ $this->menu = $this->treeview->generate_menu($tree, 0, 'tabs'); $this->treeview->parent = ""; } else redirect($this->uri->uri_string()); } function index($offset=0) { $this->load->helper('date_helper'); $page_slug = $this->uri->segment('2'); // Grab the URI segment if($page_slug === FALSE) $page_slug = 'home'; $data['menu'] = $this->menu; $data['second_menu'] = $this->second_menu; $data['slug'] = $page_slug; $data['languages'] = $this->languages; $data['language'] = $this->language; $data['parent_page'] = $this->parent_page; if($page_slug!="send_message") { $page_data = $this->pagemodel->fetch($page_slug, $this->language); if($page_slug!="products" && $page_data === FALSE) show_404(); // Show a 404 if no page exists $page_data = $page_data[0]; if($page_slug == "home"){ $news_info = $this->pagemodel->fetch_small('news', $this->language); $data['latest_news_title'] = $news_info->title; $data['latest_news'] = $this->newsmodel->latest_news_home($this->language,6,'news'); } $page_panels = $this->panelmodel->panels_by_page($page_data['id'], $this->session->userdata('lang')); foreach($page_panels as $panel) $data['page_panels'][$panel['code']] = $panel; $other_panels = $this->panelmodel->fetch(2, $this->session->userdata('lang')); foreach($other_panels as $panel) $data['other_panels'][$panel['code']] = $panel; if($page_slug != 'news' && $page_slug != 'products') { $page_photos = $this->mediamodel->get_photos($page_data['id']); foreach($page_photos as $item){ $item['title'] = $this->mediamodel->get_media_translation_by_lang($item['id'], $this->language); $data['page_photos'][] = $item; } } $data['second_menu'] = $this->pagemodel->get_menu($this->language,"1"); if($page_slug == 'news') { $this->news($data); } else if($page_slug == 'products') { $data['page_data'] = $page_data; $this->products($data); } else { $data['page_data'] = $page_data; $this->_view('', $data); } } else $this->send_message(); } function news($data) { $this->load->helper('date_helper'); if($this->uri->segment('3')=="detail") { $section = trim($this->uri->segment('4')); if(!is_numeric($section)) show_404(); $page_data = $this->newsmodel->news_front($section, $this->language); $data['page_data'] = $page_data; $page_photos = $this->mediamodel->get_photos($section, 1); $data['page_photos'] = array(); foreach($page_photos as $photo){ $title = $this->mediamodel->get_media_translation_by_lang($photo['id'], $this->language); $photo['title'] = $title; $data['page_photos'][] = $photo; } $this->_view('content_view', $data); } else { $page_data = $this->pagemodel->fetch($data['slug'], $this->language); $page_data = $page_data[0]; $data['page_data'] = $page_data; $limit = 10; $uri_segment = 3; $offset = $this->uri->segment($uri_segment); $offset==null?$offset=0:$offset=$offset; $config['base_url'] = site_url('main/news/'); $config['total_rows'] = $this->newsmodel->count_all($page_data['id']); $config['per_page'] = $limit; $config['uri_segment'] = $uri_segment; $config['num_links'] = 10; $config['first_link'] = '<<'; $config['last_link'] = '>>'; $config['full_tag_open'] = ''; $config['cur_tag_open'] = ' '; $config['cur_tag_close'] = ''; $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $data['news_list'] = $this->newsmodel->news_list_front($page_data['id'],$this->language,$limit,$offset); $this->_view('news_view', $data); } } function products($data) { if($this->uri->segment('3')=="detail") { $section = trim($this->uri->segment('4')); if(!is_numeric($section)) show_404(); $page_data = $this->newsmodel->news_front($section, $this->language); $data['page_data'] = $page_data; $page_photos = $this->mediamodel->get_photos($section, 1); $data['page_photos'] = array(); foreach($page_photos as $photo){ $title = $this->mediamodel->get_media_translation_by_lang($photo['id'], $this->language); $photo['title'] = $title; $data['page_photos'][] = $photo; } $data['language'] = $this->language; $data['page_path'] = $this->treeview->page_path($page_data['page_id'], $this->language['id']); $this->_view('content_view', $data); } else if($this->uri->segment('3')=="category") { $slug = trim($this->uri->segment('4')); $page_data = $this->pagemodel->fetch($slug, $this->language); if($page_data === FALSE) show_404(); // Show a 404 if no page exists $page_data = $page_data[0]; $data['page_data'] = $page_data; $limit = 1000; $offset = 0; $category_id = $page_data['id']; $kids = $this->pagemodel->pages_by_level($category_id, $this->language['id']); $data['kids'] = array(); foreach($kids as $item){ $photo = $this->mediamodel->get_one_by_page($item['id'], '0'); ($photo != "") ? $item['photo'] = $photo : $item['photo'] = "0"; $data['kids'][] = $item; } $data['language'] = $this->language; $data['page_path'] = $this->treeview->page_path($page_data['id'], $this->language['id']); $this->_view('products_category_view', $data); } else if($this->uri->segment('3')!="detail" && $this->uri->segment('3')!="category" && $this->uri->segment('3')!="") { $slug = $this->uri->segment('3'); $page_data = $this->pagemodel->fetch($slug, $this->language); if($page_data === FALSE) show_404(); // Show a 404 if no page exists $page_data = $page_data[0]; $data['page_data'] = $page_data; $limit = 10; $uri_segment = 4; $offset = $this->uri->segment($uri_segment); $offset==null?$offset=0:$offset=$offset; $config['base_url'] = site_url('main/products/'.$slug.'/'); $config['total_rows'] = $this->newsmodel->count_all($page_data['id']); $config['per_page'] = $limit; $config['uri_segment'] = $uri_segment; $config['num_links'] = 10; $config['first_link'] = '<<'; $config['last_link'] = '>>'; $config['full_tag_open'] = ''; $config['cur_tag_open'] = ' '; $config['cur_tag_close'] = ''; $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $products = array(); $products = $this->newsmodel->news_list_front($page_data['id'],$this->language,$limit,$offset); $data['products_list'] = array(); foreach($products as $section){ $photo = $this->mediamodel->get_one_by_page($section['id'], '1'); ($photo != "") ? $section['file_name'] = $photo : $section['file_name'] = "0"; $data['products_list'][] = $section; } $data['page_path'] = $this->treeview->page_path($page_data['id'], $this->language['id']); $this->_view('products_view', $data); } } function send_message() { if($_POST) { $user = $this->usermodel->get_user('1'); $user = $user[0]; $to = $user['email']; $_POST['name']!=""?$name=$_POST['name']:$name="______"; $_POST['email']!=""?$email=$_POST['email']:$email="______"; $_POST['phone']!=""?$phone=$_POST['phone']:$phone="______"; $_POST['message']!=""?$message=$_POST['message']:$message="______"; $message_body = "Name: ".$name."
"; $message_body.= "Email: ".$email."
"; $message_body.= "Phone: ".$phone."
"; $message_body.= "Message: ".$message; $this->load->library('email'); $config['mailtype'] ='html'; $this->email->initialize($config); $this->email->from('noreply@bonis.md', 'Bonis'); $this->email->to($to); $this->email->subject('Bonis Message'); $this->email->message($message_body); $this->email->send(); //echo $this->email->print_debugger(); redirect('main/contacts/success'); } } function _view($page, $page_data) { if($page != "") $view = $page; else if($page_data['slug'] == "home") $view = "home_view"; else if($page_data['slug'] == "contacts") $view = "contact_view"; else $view = "content_view"; $this->load->view('top_view', $page_data); $this->load->view($view, $page_data); $this->load->view('bottom_view', $page_data); } } ?> 404 Page Not Found

404 Page Not Found

The page you requested was not found.