示例#1
0
 public function __construct()
 {
     parent::__construct();
     //load user model
     $this->load->model('user_m');
     //cache all except the login page
     if (check_live_server()) {
         if ($this->uri->segment(2) != 'login') {
             $this->output->cache('21600');
             //cache the page for a day
         }
     }
 }
示例#2
0
function get_user_country($ip_address)
{
    if (check_live_server()) {
        //enable soap for this to work
        $client = new SoapClient("http://www.webservicex.net/geoipservice.asmx?WSDL");
        $params = new stdClass();
        $params->IPAddress = $ip_address;
        $result = $client->GetGeoIP($params);
        // Check for errors...
        return $result->GetGeoIPResult->CountryName;
    } else {
        //if on local host return uganda
        return 'Uganda';
    }
}
示例#3
0
    ?>
</td>
                    </tr>

                    <tr class="text_danger">
                        <th>Bids past deadline</th>
                        <td class="number"><?php 
    echo count($expired_bids);
    ?>
</td>
                    </tr>



                    <?php 
    if (check_live_server()) {
        ?>
                        <tr class="text_danger">
                            <th>Bids awarded to suspended providers</th>
                            <td class="number"><?php 
        echo count($suspended_providers);
        ?>
</td>
                        </tr>
                    <?php 
    }
    ?>



示例#4
0
function action_email_template_wrap($to, $subject, $content, $from, $action_link)
{
    if (check_live_server()) {
        $to = $to;
        $subject = $subject;
        $headers = "From: " . strip_tags($from) . "\r\n";
        $headers .= "Reply-To: " . strip_tags($from) . "\r\n";
        $headers .= "MIME-Version: 1.0\r\n";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
        $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Actionable emails e.g. reset password</title>


<style type="text/css">
img {
max-width: 100%;
}
body {
-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6;
}
body {
background-color: #f6f6f6;
}
@media only screen and (max-width: 640px) {
  body {
    padding: 0 !important;
  }
  h1 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h2 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h3 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h4 {
    font-weight: 800 !important; margin: 20px 0 5px !important;
  }
  h1 {
    font-size: 22px !important;
  }
  h2 {
    font-size: 18px !important;
  }
  h3 {
    font-size: 16px !important;
  }
  .container {
    padding: 0 !important; width: 100% !important;
  }
  .content {
    padding: 0 !important;
  }
  .content-wrap {
    padding: 10px !important;
  }
  .invoice {
    width: 100% !important;
  }
}
</style>
</head>

<body itemscope itemtype="http://schema.org/EmailMessage" style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6; background: #f6f6f6; margin: 0;">

<table class="body-wrap" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; background: #f6f6f6; margin: 0;">
	<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
		<td style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top"></td>
		<td class="container" width="600" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto;" valign="top">
			<div class="content" style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;">
				<table class="main" width="100%" cellpadding="0" cellspacing="0" itemprop="action" itemscope itemtype="http://schema.org/ConfirmAction" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background: #fff; margin: 0; border: 1px solid #e9e9e9;">
					<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
						<td class="content-wrap" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 20px;" valign="top">
							<meta itemprop="name" content="Confirm Email" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;" />
							<table width="100%" cellpadding="0" cellspacing="0" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
								<tr style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
									<td class="content-block" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
										' . $content . '
									</td>
								</tr>

								<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
									<td class="content-block" itemprop="handler" itemscope itemtype="' . $action_link . '" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
										<a href="' . $action_link . '" itemprop="url" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; color: #FFF; text-decoration: none; line-height: 2; font-weight: bold; text-align: center; cursor: pointer; display: inline-block; border-radius: 5px; text-transform: capitalize; background: #348eda; margin: 0; border-color: #348eda; border-style: solid; border-width: 10px 20px;">' . $subject . ' </a>
									</td>
								</tr>

							</table>
						</td>
					</tr>
				</table>
				<div class="footer" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
					<table width="100%" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
						<tr style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
							<td class="aligncenter content-block" style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; text-align: center; margin: 0; padding: 0 0 20px;" align="center" valign="top"><a href="' . base_url() . '" style="font-family:' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;"></a> ' . SITE_NAME . ' .</td>
						</tr>
					</table>
				</div></div>
		</td>
		<td style="font-family: ' . 'Helvetica Neue' . ', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0;" valign="top"></td>
	</tr>
</table>

</body>
</html>
';
        if (mail($to, $subject, $message, $headers)) {
            return TRUE;
        } else {
            //if not sent
            echo error_template('Mail was not sent');
            return FALSE;
        }
    } else {
        //if on localhost return true
        return TRUE;
    }
}
示例#5
0
 function best_evaluated_bidder_reports()
 {
     check_user_access($this, 'view_reports', 'redirect');
     # Get the passed details into the url data array if any
     $urldata = $this->uri->uri_to_assoc(3, array('m', 'p'));
     # Pick all assigned data
     $data = assign_to_data($urldata);
     $data = add_msg_if_any($this, $data);
     $data = handle_redirected_msgs($this, $data);
     $data['financial_years'] = $this->financial_years;
     //if online get suspended providers
     if (check_live_server()) {
         $data['rop_suspended_providers'] = $this->remoteapi_m->providers_suspended();
     }
     $data['page_title'] = 'Best evaluated bidder reports';
     $data['current_menu'] = 'best_evaluated_bidder_reports';
     $data['view_to_load'] = 'reports/beb/beb_report_v';
     $data['view_data']['form_title'] = $data['page_title'];
     $data['search_url'] = '';
     $data['report_form'] = 'reports/beb/forms/beb_f';
     $data['report_view'] = 'reports/beb/beb_home';
     $data['report_heading'] = 'BEST EVALUATED BIDDERS';
     $data['financial_year'] = $data['financial_year'] = date('Y') . '-' . (date('Y') + 1);
     $from = date('Y') . '-' . date('m') . '-01';
     //$from=date('Y').'-'.'01'.'-01';
     $to = mysqldate();
     $data['reporting_period'] = '<b>' . custom_date_format('d M, Y', $from) . '</b> &nbsp<i> to </i> <b>  &nbsp &nbsp' . custom_date_format('d M, Y', $to) . '</b>';
     $this->db->order_by("pdename", "asc");
     $data['pdes'] = $this->db->get_where('pdes', array('isactive' => 'Y', 'status' => 'in'))->result_array();
     $data['pdes'] = array_merge(array(array('pdeid' => 'ALL', 'pdename' => 'View All')), $data['pdes']);
     if ($this->input->post('view')) {
         $data['financial_year'] = $this->input->post('financial_year');
         switch ($this->input->post('beb_report_type')) {
             case 'PBEB':
                 $data['financial_year'] = $this->input->post('financial_year');
                 $from = $this->input->post('beb_publish_from_date');
                 $to = $this->input->post('beb_publish_to_date');
                 $data['reporting_period'] = '<b>' . custom_date_format('d M, Y', $from) . '</b> &nbsp<i> to </i> <b>  &nbsp &nbsp' . custom_date_format('d M, Y', $to) . '</b>';
                 $data['report_heading'] = 'PUBLISHED BEST EVALUATED BIDDERS';
                 //if its supper admin logged in
                 if ($this->session->userdata('isadmin') == 'Y') {
                     //when filtering by pde
                     if ($this->input->post('pde')) {
                         $data['report_heading'] = 'PUBLISHED BEST EVALUATED BIDDERS <small>Filtered by PDE : ' . get_pde_info_by_id($this->input->post('pde'), 'title') . '</small>';
                         $pde = $this->input->post('pde');
                         $data['results'] = $this->bid_invitation_m->get_published_bids_by_month($from, $to, $pde);
                     } else {
                         $data['results'] = $this->bid_invitation_m->get_published_bids_by_month($from, $to);
                     }
                 } else {
                     //if pde filer results by pde
                     $pde = $this->session->userdata('pdeid');
                     $data['report_heading'] = 'PUBLISHED BEST EVALUATED BIDDERS';
                     $data['results'] = $this->bid_invitation_m->get_published_bids_by_month($from, $to, $pde);
                 }
                 break;
             case 'EBN':
                 $data['financial_year'] = $this->input->post('financial_year');
                 $from = $this->input->post('beb_publish_from_date');
                 $to = $this->input->post('beb_publish_to_date');
                 $data['reporting_period'] = '<b>' . custom_date_format('d M, Y', $from) . '</b> &nbsp<i> to </i> <b>  &nbsp &nbsp' . custom_date_format('d M, Y', $to) . '</b>';
                 $data['report_heading'] = 'EXPIRED BEST EVALUATED BIDDER NOTICES';
                 //if its supper admin logged in
                 if ($this->session->userdata('isadmin') == 'Y') {
                     if ($this->input->post('pde')) {
                         $data['report_heading'] = 'EXPIRED BEST EVALUATED BIDDER NOTICES <small>Filtered by PDE : ' . get_pde_info_by_id($this->input->post('pde'), 'title') . '</small>';
                         $pde = $this->input->post('pde');
                         $data['results'] = $this->bid_invitation_m->get_expired_bids_by_month($from, $to, $pde);
                     } else {
                         $data['results'] = $this->bid_invitation_m->get_expired_bids_by_month($from, $to);
                     }
                 } else {
                     //if pde filer results by pde
                     $pde = $this->session->userdata('pdeid');
                     $data['report_heading'] = 'EXPIRED BEST EVALUATED BIDDER NOTICES';
                     $data['results'] = $this->bid_invitation_m->get_expired_bids_by_month($from, $to, $pde);
                 }
                 break;
             default:
                 //if its supper admin logged in
                 if ($this->session->userdata('isadmin') == 'Y') {
                     $data['results'] = $this->bid_invitation_m->get_published_bids_by_month($from, $to);
                 } else {
                     //if pde filer results by pde
                     $pde = $this->session->userdata('pdeid');
                     $data['report_heading'] = 'BEST EVALUATED BIDDERS';
                     $data['results'] = $this->bid_invitation_m->get_published_bids_by_month($from, $to, $pde);
                 }
         }
     } else {
         //if its supper admin logged in
         if ($this->session->userdata('isadmin') == 'Y') {
             $data['results'] = $this->bid_invitation_m->get_published_bids_by_month($from, $to);
         } else {
             //if pde filer results by pde
             $pde = $this->session->userdata('pdeid');
             $data['report_heading'] = 'BEST EVALUATED BIDDERS: ' . get_pde_info_by_id($pde, 'title') . '</small>';
             $data['results'] = $this->bid_invitation_m->get_published_bids_by_month($from, $to, $pde);
         }
     }
     //load view
     $this->load->view('dashboard_v', $data);
 }
示例#6
0
function save_user($firstname, $lastname, $email, $password)
{
    $ci =& get_instance();
    $ci->load->model('user_m');
    //echo $ci->input->post('ajax');
    $firstname = $ci->input->post('fname') != '' ? $ci->input->post('fname') : $firstname;
    $lastname = $ci->input->post('lname') != '' ? $ci->input->post('lname') : $lastname;
    $email = $ci->input->post('email') != '' ? $ci->input->post('email') : $email;
    $password = $ci->input->post('password') != '' ? $ci->input->post('password') : $password;
    $usertype = $ci->input->post('usertype') != '' ? $ci->input->post('usertype') : '4';
    $ci->form_validation->set_rules($ci->user_m->add_user_validation);
    $str = '';
    if ($ci->form_validation->run() == FALSE) {
        //if there were errors add them to the errors array
        echo error_template(validation_errors());
    } else {
        $user_data = array('fname' => $firstname, 'lname' => $lastname, 'email' => $email, 'usertype' => $usertype, 'password' => md5($password), 'dateadded' => mysqldate(), 'slug' => now() . random_string('numeric', 8));
        //more validation special cases
        if ($ci->input->post('cpassword') != '') {
            //chek o see id the two match
            if ($ci->input->post('password') != $ci->input->post('cpassword')) {
                echo error_template('Passwords do not match');
            }
        } else {
            $user_id = $ci->user_m->create($user_data);
            if ($user_id) {
                //add him to the roles tables
                //if online
                if (check_live_server()) {
                    //send email to user
                    $salutation = $content = '<p>Hello<strong> ' . ucwords($firstname . ' ' . $lastname) . '</strong>,</p>';
                    $content = '<p>Hello<strong> ' . ucwords($firstname . ' ' . $lastname) . '</strong>,</p>

<p>You have created a new account on <a href="' . base_url() . '>' . base_url() . '</a>.</p>

<p>Below are your login credentials:</p>

<p><strong>Username</strong>: ' . $email . '</p>

<p><strong>Password</strong>: ' . $password . '</p>

<p>Click <a href="' . base_url() . 'admin/login">here</a> to login</p>
';
                    send_html_email($ci->input->post('email'), 'New account', $salutation, $content, SITE_EMAIL);
                }
                //if there were errors add them to the errors array
                $str .= jquery_clear_fields();
                echo $str;
                return $user_id;
            } else {
                //if there were errors add them to the errors array
                echo warning_template('User was not added. Please try one more time');
            }
        }
    }
}