function get_decoded_cookie($key, $chipper) { $key = cms_encode($key, $chipper); if (!array_key_exists($key, $_COOKIE)) { $key = urldecode($key); } if (array_key_exists($key, $_COOKIE)) { return cms_decode($_COOKIE[$key], $chipper); } return NULL; }
/** * @author go frendi * * @param string from_address * @param string from_name * @param string to_address * @param string subject * @param string message * @desc send email */ public function cms_send_email($from_address, $from_name, $to_address, $subject, $message) { $this->load->library('email'); //send email to user $config['useragent'] = (string) $this->cms_get_config('cms_email_useragent'); $config['protocol'] = (string) $this->cms_get_config('cms_email_protocol'); $config['mailpath'] = (string) $this->cms_get_config('cms_email_mailpath'); $config['smtp_host'] = (string) $this->cms_get_config('cms_email_smtp_host'); $config['smtp_user'] = (string) $this->cms_get_config('cms_email_smtp_user'); $config['smtp_pass'] = (string) cms_decode($this->cms_get_config('cms_email_smtp_pass')); $config['smtp_port'] = (int) $this->cms_get_config('cms_email_smtp_port'); $config['smtp_timeout'] = (int) $this->cms_get_config('cms_email_smtp_timeout'); $config['wordwrap'] = (bool) $this->cms_get_config('cms_email_wordwrap'); $config['wrapchars'] = (int) $this->cms_get_config('cms_email_wrapchars'); $config['mailtype'] = (string) $this->cms_get_config('cms_email_mailtype'); $config['charset'] = (string) $this->cms_get_config('cms_email_charset'); $config['validate'] = (bool) $this->cms_get_config('cms_email_validate'); $config['priority'] = (int) $this->cms_get_config('cms_email_priority'); $config['crlf'] = "\r\n"; $config['newline'] = "\r\n"; $config['bcc_batch_mode'] = (bool) $this->cms_get_config('cms_email_bcc_batch_mode'); $config['bcc_batch_size'] = (int) $this->cms_get_config('cms_email_bcc_batch_size'); $ssl = $this->email->smtp_crypto === 'ssl' ? 'ssl://' : ''; // if protocol is (not smtp) or (is smtp and able to connect) if ($config['protocol'] != 'smtp' || $config['protocol'] == 'smtp' && $this->cms_is_connect($ssl . $config['smtp_host'], $config['smtp_port'])) { $message = $this->cms_parse_keyword($message); $subject = $this->cms_parse_keyword($subject); $this->email->initialize($config); $this->email->from($from_address, $from_name); $this->email->to($to_address); $this->email->subject($subject); $this->email->message($message); try { $success = $this->email->send(); log_message('debug', $this->email->print_debugger()); } catch (Error $error) { $success = false; log_message('error', $this->email->print_debugger()); } } else { $success = false; log_message('error', 'Connection to ' . $ssl . $config['smtp_host'] . ':' . $config['smtp_port'] . ' is impossible'); } return $success; }