Example #1
0
// Check that PM system is enabled
pm_enabled();
// Get the user's post page preferences.
$page_prefs = session::get_post_page_prefs();
// Prune old messages for the current user
pm_user_prune_folders($_SESSION['UID']);
$t_subject = null;
$t_content = null;
// Get the Message ID (MID)
if (isset($_GET['mid']) && is_numeric($_GET['mid'])) {
    $mid = $_GET['mid'];
} else {
    if (isset($_POST['mid']) && is_numeric($_POST['mid'])) {
        $mid = $_POST['mid'];
    } else {
        light_html_draw_error(gettext("No message specified for editing"));
    }
}
// Get the message.
if (!($message_data = pm_message_get($mid))) {
    pm_edit_refuse();
}
if (isset($message_data['ATTACHMENTS'])) {
    $attachments = $message_data['ATTACHMENTS'];
} else {
    $attachments = array();
}
$valid = true;
if (isset($_POST['apply']) || isset($_POST['preview'])) {
    if (isset($_POST['t_subject']) && strlen(trim($_POST['t_subject'])) > 0) {
        $t_subject = trim($_POST['t_subject']);
Example #2
0
require_once BH_INCLUDE_PATH . 'session.inc.php';
require_once BH_INCLUDE_PATH . 'styles.inc.php';
require_once BH_INCLUDE_PATH . 'text_captcha.inc.php';
require_once BH_INCLUDE_PATH . 'timezone.inc.php';
require_once BH_INCLUDE_PATH . 'user.inc.php';
// End Required includes
// Where are we going after we've logged on?
if (isset($_GET['final_uri']) && strlen(trim($_GET['final_uri'])) > 0) {
    $available_files_preg = implode("|^", array_map('preg_quote_callback', get_light_mode_files()));
    if (preg_match("/^{$available_files_preg}/u", trim($_GET['final_uri'])) > 0) {
        $final_uri = href_cleanup_query_keys($_GET['final_uri']);
    }
}
// check to see if user registration is available
if (forum_get_setting('allow_new_registrations', 'N')) {
    light_html_draw_error(gettext("Sorry, new user registrations are not allowed right now. Please check back later."));
}
// Get an array of available emoticon sets
$available_emoticons = emoticons_get_available();
// Get an array of available languages
$available_langs = lang_get_available();
// Get an array of available timezones.
$available_timezones = get_available_timezones();
// Initialise the text captcha
$text_captcha = new captcha(6, 15, 25, 9, 30);
// Array to hold error messages
$error_msg_array = array();
$logon = null;
$nickname = null;
$email = null;
$private_key = null;
Example #3
0
function light_pm_enabled()
{
    if (!forum_get_setting('show_pms', 'Y')) {
        light_html_draw_error(gettext("Personal Messages have been disabled by the forum owner."));
    }
    return true;
}
Example #4
0
            }
        }
        header_redirect($uri);
        exit;
    } else {
        $error_msg_array[] = sprintf(gettext("You can only post once every %s seconds. Please try again later."), forum_get_setting('minimum_post_frequency', 'is_numeric', 0));
    }
}
if (!isset($fid)) {
    $fid = 1;
}
if ($new_thread && !($folder_dropdown = folder_draw_dropdown($fid, "fid", "", FOLDER_ALLOW_NORMAL_THREAD, USER_PERM_THREAD_CREATE, "", "post_folder_dropdown"))) {
    light_html_draw_error(gettext("You cannot create new threads."));
}
if (isset($thread_data['CLOSED']) && $thread_data['CLOSED'] > 0 && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
    light_html_draw_error(gettext("This thread is closed, you cannot post in it!"));
}
if (isset($return_msg)) {
    $back = "lmessages.php?webtag={$webtag}&msg={$return_msg}";
} else {
    if (isset($tid) && is_numeric($tid) && isset($reply_to_pid) && is_numeric($reply_to_pid)) {
        $back = "lmessages.php?webtag={$webtag}&msg={$tid}.{$reply_to_pid}";
    } else {
        $back = "lthread_list.php?webtag={$webtag}";
    }
}
light_html_draw_top(array('title' => gettext('Post message'), 'js' => array('js/fineuploader.min.js', 'js/attachments.js')));
light_navigation_bar(array('back' => $back));
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    light_html_display_error_array($error_msg_array);
}
Example #5
0
            }
        } else {
            $post_edit_time = forum_get_setting('post_edit_time', 'is_numeric', 0);
            if (count($edit_message) > 0) {
                if (($edit_message['CONTENT'] = message_get_content($tid, $pid)) !== false) {
                    if ((forum_get_setting('allow_post_editing', 'N') || $_SESSION['UID'] != $edit_message['FROM_UID'] && !(perm_get_user_permissions($edit_message['FROM_UID']) & USER_PERM_PILLORIED) || session::check_perm(USER_PERM_PILLORIED, 0) || $post_edit_time > 0 && time() - $edit_message['CREATED'] >= $post_edit_time * HOUR_IN_SECONDS) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
                        light_html_draw_error(gettext("You are not permitted to edit this message."), 'lmessages.php', 'get', array('back' => gettext("Back")), array('msg' => $return_msg));
                    }
                    $parsed_message = new MessageTextParse($edit_message['CONTENT']);
                    $content = $parsed_message->getMessage();
                    $sig = $parsed_message->getSig();
                } else {
                    light_html_draw_error(sprintf(gettext("Message %s was not found"), $msg), 'lthread_list.php', 'get', array('back' => gettext("Back")));
                }
            } else {
                light_html_draw_error(sprintf(gettext("Message %s was not found"), $msg), 'lthread_list.php', 'get', array('back' => gettext("Back")));
            }
        }
    }
}
$page_title = sprintf(gettext("Edit message %s"), $msg);
light_html_draw_top(array('title' => $page_title, 'js' => array('js/fineuploader.min.js', 'js/attachments.js')));
light_navigation_bar(array('back' => "lmessages.php?webtag={$webtag}&msg={$return_msg}"));
if ($valid && isset($_POST['preview'])) {
    echo "<h3>", gettext("Message Preview"), "</h3>";
    light_message_display($tid, $edit_message, $thread_data['LENGTH'], $pid, $thread_data['FID'], false, false, false, false, true);
}
echo "<form accept-charset=\"utf-8\" name=\"f_edit\" action=\"ledit.php\" method=\"post\" target=\"_self\">\n";
echo "  ", form_csrf_token_field(), "\n";
echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
echo form_input_hidden("msg", htmlentities_array($msg));