real_escape_string($url); //убираем символы * = + % из url $url = str_replace('*', '', $url); $url = str_replace(' ', '', $url); $url = str_replace('=', '', $url); $url = str_replace('+', '', $url); $url = str_replace('%', '', $url); $url = str_replace(';', '', $url); //$url = str_replace('?', '' , $url); $url = explode('?', $url); $url = explode("/", $url[0]);//делает массив из ЧПУ строки /* echo ''; */ return $url; } //возвращает массив GET параметров static function getGet(){ $get = $_GET; return $get; //print_r($get); } //возвращает массив POST параметров static function getPost(){ $post = $_POST; //$get = list($_GET); //print_r($post); return $post; } //возвращает массив $_FILES параметров static function getFiles(){ $files = $_FILES; //$get = list($_GET); //print_r($post); return $files; } //возвращает массив с куками static function getCookie(){ $cookie = $_COOKIE; return $cookie; //print_r($get); } //получаем хэш от пароля static function getPasswordHash($pass){ $salt = 'fu67^439f$&*%8z';//соль для пароля $hash = sha1($pass.$salt); return $hash; } //возвращает безопасный текст static function getText($text){ $text = strip_tags($text); return $text; //print_r($get); } //генерация нового пароля static function getGeneratePassword($number){ $arr = array('a','b','c','d','e','f', 'g','h','i','j','k','l', 'm','n','o','p','r','s', 't','u','v','x','y','z', 'A','B','C','D','E','F', 'G','H','I','J','K','L', 'M','N','O','P','R','S', 'T','U','V','X','Y','Z', '1','2','3','4','5','6', '7','8','9','0','.',',', '(',')','[',']','!','?', '&','^','%','@','*','$', '<','>','+','-','~' ); $pass = ''; $countSymbols = count($arr) - 1; for ($i=0; $i<$number; $i++){ $index = rand(0, $countSymbols); $pass .= $arr[$index]; } return $pass; } } \n"; $addHeaders .= "Content-Type: text/plain; charset=UTF-8\n"; */ //$mail = mail($emailTo, $title, $text, $addHeaders); //$smtp = Mail::factory('smtp', $params); //$mail = $smtp->send($emailTo, $headers, $body); //$title= "=?utf-8?b?".base64_encode($title)."?="; //$title= "=?utf-8?b?".base64_encode($title)."?="; /* $headers = "MIME-Version: 1.0\r\n"; //$headers.= "From: =?utf-8?b?".base64_encode($emailFrom)."?= <".$emailFrom.">\r\n"; $headers.= "From: ".$emailFrom."\r\n"; $headers.= "Content-Type: text/html;charset=utf-8\r\n"; $headers.= "Reply-To: $emailFrom\r\n"; //$headers.= "X-Mailer: PHP/" . phpversion(); $mail = mail($emailTo, $title, $text, $headers); return $mail; */ require_once 'includes/plugins/swiftmailer/lib/swift_required.php'; $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance() // Give the message a subject ->setSubject($title) // Set the From address with an associative array ->setFrom(array($emailFrom => 'SelfColor')) // Set the To addresses with an associative array ->setTo(array($emailTo)) // Give it a body ->setBody($text); $type = $message->getHeaders()->get('Content-Type'); $type->setValue('text/html'); $type->setParameter('charset', 'utf-8'); $res = $mailer->send($message); return $res; } static function getTpl($file, $function, $data){ include_once 'core/view/email_tpl/'.$file.'.php'; return $function($data); } } ?>