Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (! defined('BASEPATH')) exit('No direct script access allowed');
- class Sendmail extends CI_Model
- {
- function __construct()
- {
- parent::__construct();
- $this->load->library('email');
- }
- /**
- * [objectToArray]
- * @param [stdClass] Opowiedź SOAP
- * @return [ARRAY]
- */
- private function objectToArray($object)
- {
- if((!is_object($object)) && (!is_array($object)))
- {
- return $object;
- }
- if(is_object($object))
- {
- $object = get_object_vars($object);
- }
- return array_map(array($this, 'objectToArray'), $object);
- }
- /**
- * Generowanie naglowkow maila
- */
- public function genHeader($mailto, $header)
- {
- $this->email->from($this->email->smtp_user, $this->config->item('name_site'));
- $this->email->to($mailto);
- $this->email->subject('['.$this->config->item('name_site').'] '. $header);
- }
- /**
- * Generowanie stopki maila
- */
- public function sendNow($message)
- {
- $this->email->message($message);
- $this->email->send();
- return false;
- }
- /**
- * [send_error]
- */
- public function send_soap_error($content)
- {
- $message = $this->parser->parse($this->config->item('url_panel').'sendmail/soaperror.tpl', $content, true);
- $this->Sendmail->sendNow($message);
- }
- /**
- * Recovery Password
- */
- public function recovery_pass($mailto, $content)
- {
- $this->Sendmail->genHeader($mailto, 'Przypomnienie hasła');
- $new_array = array_merge(
- array(
- 'siteName' => $this->config->item('name_site'),
- 'baseUrl' => $this->config->item('base_url'),
- 'emailFooter' => $this->Settings->get('email_footer'),
- $content));
- $message = $this->parser->parse($this->config->item('url_panel').'sendmail/recovery_pass.tpl', $new_array, true);
- $this->Sendmail->sendNow($message);
- }
- /**
- * New user
- */
- public function new_user($mailto, $content)
- {
- $this->Sendmail->genHeader($mailto, 'Aktywacja konta');
- $new_array = array_merge(
- array(
- 'siteName' => $this->config->item('name_site'),
- 'baseUrl' => $this->config->item('base_url'),
- 'emailFooter' => $this->Settings->get('email_footer'),
- $content));
- $message = $this->parser->parse($this->config->item('url_panel').'sendmail/new_user.tpl', $new_array, true);
- $this->Sendmail->sendNow($message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement