| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/adeetie_hellogtx/application/helpers/ |
Upload File : |
<?php
/**---------------------------------------------------------------------------------------------------
* Global Helper
*
*
* All the set of Global Helper Functions
* 1.global_datetime
* ---------------------------------------------------------------------------------------------------
*/
/**
* Global DateTime Function
* @return timestamp Y-m-d h:i:s [<description>]
*/
if(!function_exists('global_datetime')){
function global_datetime(){
date_default_timezone_set('Asia/Calcutta');
return date('Y-m-d h:i:s');
}
}
/**
* Render BreadCrumb
* @return String [Bread Crumb]
*/
if(!function_exists('render_bread_crumb')){
function render_bread_crumb($nodes=array()){
$i=sizeof($nodes)-1;
$bread_crumb = '';
foreach ($nodes as $node => $title) {
$i--;
if($i>=0)
$bread_crumb.='<li><a href="javascript:void(0);">'.$title.'</a></li>';
else
$bread_crumb.= '<li class="active">'.$title.'</li>';
}
return $bread_crumb;
}
}
if(! function_exists('sendEmail')){
function sendEmail($subject,$message,$to,$cc='')
{
require_once('phpmailer'.DS.'PHPMailerAutoload.php' );
$mail = new PHPMailer();
$mail->IsSMTP(); // we are going to use SMTP
$mail->SMTPAuth = TRUE; // enabled SMTP authentication
// $mail->SMTPDebug = 1;
$mail->SMTPSecure = SMTP_PROTOCAL;
$mail->Port = SMTP_PORT;
//or more succinctly:
$mail->Host = SMTP_HOST; // SMTP port to connect to GMail
$mail->Username = USER_NAME; // user email address
$mail->Password = USER_PASSWORD; // password in GMail
$mail->setFrom(EMAIL_FROM, "BEE's Facilitation Centre");
$mail->Subject =$subject;
$mail->Body = $message;
$mail->AltBody = "Plain text message";
if(is_string($to) == 1) {
$mail->AddAddress($to, "BEE");
} else {
foreach($to as $kto) {
$mail->AddAddress($kto, "BEE");
}
}
if(!empty($cc)) {
$mail->addCC($cc);
}
if(!$mail->Send()) {
$data["message"] = "Error: " . $mail->ErrorInfo;
return FALSE;
//exit();
} else {
$data["message"] = "Message sent correctly!";
return TRUE;
}
}
}
if(! function_exists('emailCheck')){
function emailCheck($subject, $message, $to, $cc=''){
require_once('mail'.DS.'class.phpmailer.php' );
$mail = new PHPMailer(true);
try {
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = SMTP_PROTOCAL; // secure transfer enabled REQUIRED for Gmail
$mail->Host = SMTP_HOST;
$mail->Port = SMTP_PORT; // or 587
$mail->IsHTML(true);
$mail->Username = USER_NAME;
$mail->Password = USER_PASSWORD;//"Bee@1234";
$mail->SetFrom(EMAIL_FROM, "BEE's Facilitation Centre");
$mail->Subject = $subject;
$mail->Body = $message;
if(is_string($to) == 1) {
$mail->AddAddress($to, "BEE");
} else {
foreach($to as $kto) {
$mail->AddAddress($kto, "BEE");
}
}
if(!empty($cc)){
$mail->addCC($cc);
}
return $mail->Send();
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
}
/**
* Get Template
* @return String [Path to a specific template.php]
*/
if(!function_exists('get_template')){
function get_template(){
$CI =& get_instance();
$auth_id=isset($CI->ion_auth->get_users_groups()->row()->id) ? true: false;
if($auth_id){
$folder = 'user';
}
else{
$folder='web';
}
return 'templates'.DS.$folder.DS.'template';
}
}
if(! function_exists('getCITokenJsVars')){
function getCITokenJsVars(){
$CI = & get_instance();
echo "<script>
var ci_csrf_enabled = ".($CI->config->item("csrf_protection") ? '1':'0').";
var ci_token_name = '".$CI->config->item("csrf_token_name")."';
var ci_token_val = '".$CI->security->get_csrf_hash()."';
var error_redirect = '';
var debug_enable = false;
</script>
";
}
}
if(!function_exists('htmlSubstr')){
function htmlSubstr($text, $max_length)
{
$tags = array();
$result = "";
$is_open = false;
$grab_open = false;
$is_close = false;
$in_double_quotes = false;
$in_single_quotes = false;
$tag = "";
$i = 0;
$stripped = 0;
$stripped_text = strip_tags($text);
while ($i < strlen($text) && $stripped < strlen($stripped_text) && $stripped < $max_length)
{
$symbol = $text[$i];
$result .= $symbol;
switch ($symbol)
{
case '<':
$is_open = true;
$grab_open = true;
break;
case '"':
if ($in_double_quotes)
$in_double_quotes = false;
else
$in_double_quotes = true;
break;
case "'":
if ($in_single_quotes)
$in_single_quotes = false;
else
$in_single_quotes = true;
break;
case '/':
if ($is_open && !$in_double_quotes && !$in_single_quotes)
{
$is_close = true;
$is_open = false;
$grab_open = false;
}
break;
case ' ':
if ($is_open)
$grab_open = false;
else
$stripped++;
break;
case '>':
if ($is_open)
{
$is_open = false;
$grab_open = false;
array_push($tags, $tag);
$tag = "";
}
else if ($is_close)
{
$is_close = false;
array_pop($tags);
$tag = "";
}
break;
default:
if ($grab_open || $is_close)
$tag .= $symbol;
if (!$is_open && !$is_close)
$stripped++;
}
$i++;
}
while ($tags)
$result .= "</".array_pop($tags).">";
return $result;
}
}
if(!function_exists('password_generate')){
function password_generate($chars)
{
$data = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcefghijklmnopqrstuvwxyz';
return substr(str_shuffle($data), 0, $chars);
}
}
if(!function_exists('dateDiff')){
function dateDiff($date1, $date2)
{
$date1_ts = strtotime($date1);
$date2_ts = strtotime($date2);
$diff = $date2_ts - $date1_ts;
return round($diff / 86400);
}
}
?>