<?php require '../include/mellivora.inc.php'; require CONST_PATH_THIRDPARTY . 'nbbc/nbbc.php'; enforce_authentication(); $time = time(); $bbc = new BBCode(); $bbc->SetEnableSmileys(false); head('Challenges'); if (isset($_GET['status'])) { if ($_GET['status'] == 'correct') { message_dialog('Congratulations! You got the flag!', 'Correct flag', 'Yay!', 'challenge-attempt correct on-page-load'); } else { if ($_GET['status'] == 'incorrect') { message_dialog('Sorry! That wasn\'t correct', 'Incorrect flag', 'Ok', 'challenge-attempt incorrect on-page-load'); } else { if ($_GET['status'] == 'manual') { message_inline_blue('<h1>Your submission is awaiting manual marking.</h1>', false); } } } } $categories = db_select_all('categories', array('id', 'title', 'description', 'available_from', 'available_until'), array('exposed' => 1), 'title ASC'); // determine which category to display if (isset($_GET['category'])) { validate_id($_GET['category']); $current_category = array_search_matching_key($_GET['category'], $categories, 'id'); if (!$current_category) { message_error(lang_get('no_category_for_id'), false); } } else {
function send_email(array $receivers, $subject, $body, array $cc_list = null, array $bcc_list = null, $from_email = CONFIG_EMAIL_FROM_EMAIL, $from_name = CONFIG_EMAIL_FROM_NAME, $replyto_email = CONFIG_EMAIL_REPLYTO_EMAIL, $replyto_name = CONFIG_EMAIL_REPLYTO_NAME, $is_html = false) { $mail = new PHPMailer(); $mail->IsHTML($is_html); $mail->XMailer = ' '; $successfully_sent_to = array(); try { if (CONFIG_EMAIL_USE_SMTP) { $mail->IsSMTP(); $mail->SMTPDebug = CONFIG_EMAIL_SMTP_DEBUG_LEVEL; $mail->Host = CONFIG_EMAIL_SMTP_HOST; $mail->Port = CONFIG_EMAIL_SMTP_PORT; $mail->SMTPSecure = CONFIG_EMAIL_SMTP_SECURITY; $mail->SMTPAuth = CONFIG_EMAIL_SMTP_AUTH; $mail->Username = CONFIG_EMAIL_SMTP_USER; $mail->Password = CONFIG_EMAIL_SMTP_PASSWORD; } $mail->SetFrom($from_email, $from_name); if ($replyto_email) { $mail->AddReplyTo($replyto_email, $replyto_name); } // add the "To" receivers foreach ($receivers as $receiver) { if (!valid_email($receiver)) { continue; } $mail->AddAddress($receiver); $successfully_sent_to[] = $receiver; } if (empty($successfully_sent_to)) { message_error('There must be at least one valid "To" receiver of this email'); } // add the "CC" receivers if (!empty($cc_list)) { foreach ($cc_list as $cc) { if (!valid_email($cc)) { continue; } $mail->AddCC($cc); $successfully_sent_to[] = $cc; } } // add the "BCC" receivers if (!empty($bcc_list)) { foreach ($bcc_list as $bcc) { if (!valid_email($bcc)) { continue; } $mail->AddBCC($bcc); $successfully_sent_to[] = $bcc; } } $mail->Subject = $subject; // HTML email if ($is_html) { require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php'; $bbc = new BBCode(); $bbc->SetEnableSmileys(false); // we assume the email has come to us in BBCode format $mail->MsgHTML($bbc->parse($body)); } else { $mail->Body = $body; } } catch (Exception $e) { log_exception($e); message_error('Could not send email! An exception has been logged. Please contact ' . (CONFIG_EMAIL_REPLYTO_EMAIL ? CONFIG_EMAIL_REPLYTO_EMAIL : CONFIG_EMAIL_FROM_EMAIL)); } return $successfully_sent_to; }
public static function parse_html($content, $process_content_plugins = false, $bbcode = true, $autolink = true) { if ($bbcode) { require_once CJLIB_PATH . '/lib/nbbc/nbbc_main.php'; $bbcode = new BBCode(); $bbcode->SetSmileyURL(CJLIB_MEDIA_URI . '/smileys'); $bbcode->SetSmileyDir(CJLIB_MEDIA_PATH . DS . 'smileys'); $bbcode->SetTagMarker('['); $bbcode->SetAllowAmpersand(false); $bbcode->SetEnableSmileys(true); $bbcode->SetDetectURLs($autolink); $bbcode->SetPlainMode(false); $bbcode->SetDebug(false); $content = $bbcode->Parse($content); } else { if ($autolink) { require_once 'lib_autolink.php'; $content = autolink_urls($content, 50, ' rel="nofollow"'); } } if ($process_content_plugins) { $content = JHTML::_('content.prepare', $content); } return $content; }
<input type='checkbox' <?php if ($tag_marker == '<') { print "checked='checked'"; } ?> name='anglebrackets' /> Use <> instead of [] for tags<br /> </td></tr></tbody></table> </form> </div> <?php if (isset($_POST['bbcode_input'])) { $bbcode = new BBCode(); $bbcode->SetSmileyURL("../smileys"); $bbcode->SetSmileyDir("../smileys"); $bbcode->SetTagMarker($tag_marker); $bbcode->SetAllowAmpersand($allow_ampersand); $bbcode->SetEnableSmileys($enable_smileys); $bbcode->SetDetectURLs($autourl_mode); $bbcode->SetPlainMode($plain_mode); $output = $bbcode->Parse($input); print "<div class='box'>\n" . "<div class='bbcode'>{$output}</div>\n" . "</div>\n"; } ?> </body> </html>