File: //home/awaldron/public_html/archive/mg/application/controllers/home.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function index()
{
$this->load->library('wordpress');
$data['blog'] = $this->wordpress->getPosts();
$data['is_home'] = true;
$data['title'] = "Home";
require_once('nav.php');
$data['nav'] = $nav;
$this->load->view('_head.php', $data);
$this->load->view('v_home', $data);
$this->load->view('_foot.php', $data);
}
public function sub1()
{
require_once('nav.php');
$data['title'] = ucfirst($this->uri->segment(1));
$data['category'] = 'Murray Guard';
$controllername = $this->uri->segment(1);
if (@file_exists(APPPATH."views/v_".$controllername.".php")) {
$this->load->view('_head.php', $data);
$this->load->view('v_'.$this->uri->segment(1), $data);
$this->load->view('_foot.php', $data);
} else {
show_404();
}
}
public function sub2()
{
require_once('nav.php');
$data['title'] = $this->get_title($this->uri->segment(1), $this->uri->segment(2), $nav);
$data['category'] = ucfirst($this->uri->segment(1));
if ($data['category'] == 'Services') {
if (file_exists(ROOTPATH.'img/services/'.$this->uri->segment(2).'.jpg')) $data['service_image'] = $this->uri->segment(2);
else $data['service_image'] = 'nophoto';
}
$controllername = $this->uri->segment(2);
if (@file_exists(APPPATH."views/v_".$controllername.".php")) {
$this->load->view('_head.php', $data);
$this->load->view('v_'.$this->uri->segment(2), $data);
$this->load->view('_foot.php', $data);
} else {
show_404();
}
}
public function contactform() {
$ctype = $this->uri->segment(2);
if (empty($ctype)) redirect('/contact/temp_request');
require_once('nav.php');
$data['category'] = 'Contact';
switch( $ctype ) {
case 'temp_request' : $data['title'] = "Request Temporary Security Services";
$data['intro'] = "Public events. Natural disasters. Work stoppages. When you need temporary safety and security services, Murray Guard is there. Contact us for fast response."; break;
case 'proposal' : $data['title'] = "Request a Proposal";
$data['intro'] = "Find out how Murray Guard can deliver performance and accountability tailored to the security needs of your organization. Contact us with your next RFP."; break;
case 'feedback' : $data['title'] = "Customer Feedback";
$data['intro'] = "Tell us how we're doing! Contact us with questions, comments and ideas on how we can serve you better."; break;
case 'other' : $data['title'] = "General Inquiry";
$data['intro'] = "Contact us with general questions, comments and ideas. (If you're looking for employment, do not use this page. <a href=\"http://mg.balancetrak.com/lists/950/default.aspx\">Click here for job listings.</a>) "; break;
default : $data['title'] = "Request Temporary Security Services"; $ctype = 'temp_request'; break;
}
$data['ctype'] = $ctype;
$data['post'] = $this->input->post();
$this->load->view('_head.php', $data);
$this->load->view('v_contactform', $data);
$this->load->view('_foot.php', $data);
}
public function locations() {
$data['category'] = 'Contact';
$data['title'] = "Contact a Location";
require_once('nav.php');
$this->load->view('_head.php', $data);
$this->load->view('v_locations', $data);
$this->load->view('_foot.php', $data);
}
public function contactsubmit() {
$post = $this->input->post();
// Check if we trapped a spammer
if (!empty($post['yourcomments'])) redirect();
$title = $post['formname'];
$ctype = $post['ctype'];
switch( $post['ctype'] ) {
case 'temp_request' : $to = "sjohnson@murrayguard.com, spratt@murrayguard.com"; break;
case 'proposal' : $to = "sjohnson@murrayguard.com, spratt@murrayguard.com"; break;
case 'feedback' : $to = "sjohnson@murrayguard.com, spratt@murrayguard.com"; break;
case 'other' : $to = "sjohnson@murrayguard.com, spratt@murrayguard.com"; break;
default : $to = "sjohnson@murrayguard.com, spratt@murrayguard.com"; break;
}
unset($post['ctype']);
unset($post['formname']);
unset($post['msgsubmit']);
unset($post['yourcomments']);
$msg = $title;
$msg .= "\nMessage generated ".date('F d, Y h:i a')."\n";
foreach ($post as $key => $val) {
if (is_array($val)) {
$msg .= "\n".str_pad($key,10).': ';
foreach ($val as $v) {
$msg .= "\n ".$v;
}
} else $msg .= "\n".str_pad($key,10).": ".$val;
}
$subject = '[MGWEB] '.$title;
$headers = 'From: ' . $post['email'] . "\r\n" .
'Reply-To: ' . $post['email'] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $msg, $headers);
$data['category'] = 'Contact';
$data['title'] = $title;
require_once('nav.php');
$this->load->view('_head.php', $data);
$this->load->view('v_thankyou', $data);
$this->load->view('_foot.php', $data);
}
private function get_title( $sect, $sub, $nav ) {
foreach ($nav[$sect] as $x) {
if ($x[0] == "$sect/$sub") return $x[1];
}
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */