$msg, 'link' => $link, 'label' => $label), 'fatal.tpl')); } function gohome () { l_redirect(''); } function goin () { l_redirect('dash/'); } function loggedin () { goin(); } function l_redirect ($page) { global $b_config; redirect($b_config['base_url'].$page); } function redirect ($url) { header('Location: '.$url); fatal('Redirecting...', $url); } function bulletin_hash ($str, $salt = '') { return hash('sha512', $str); } function bulletin_mail ($to, $subject, $body) { global $b_config; if (isset($b_config['mg_key'])) { try { $mg = new Mailgun\Mailgun($b_config['mg_key']); return $mg->sendMessage($b_config['mg_dom'], array( 'from' => $b_config['mail_from'], 'to' => $to, 'subject' => $subject, 'html' => $body, )); } catch (Exception $e) { return 0; } } //$headers = 'To: ' . $to . "\r\n"; $headers = 'From: ' . $b_config['mail_from'] . "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' return mail($to, $subject, $body, $headers); } function pwgen ($len) { $alpha = 'abcdefghijklmnopqrstuvwxyz'; $alpha .= strtoupper($alpha); $alpha .= '0123456789'; $pass = ''; $alen = strlen($alpha); for ($i = 0; $i < $len; $i++) $pass .= $alpha[mt_rand(0, $alen-1)]; return $pass; } ?>