Exemplo n.º 1
0
function luna_ajax_trash_notification()
{
    if (empty($_POST['_nonce'])) {
        luna_send_json_error(-1);
    }
    $response = array();
    if (false === LunaNonces::verify($_POST['_nonce'], 'trash-notification-nonce')) {
        $response['nonces_expired'] = true;
        luna_send_json($response);
    }
    $id = isset($_POST['id']) && !empty($_POST['id']) ? intval($_POST['id']) : 0;
    if (!$id) {
        luna_send_json_error();
    }
    global $luna_user;
    delete_notification($id, $luna_user['id']);
    luna_send_json_success();
}
Exemplo n.º 2
0
 /**
  * Validate a nonce.
  * 
  * This method is static and can be called publicly.
  * 
  * @since    1.1
  * 
  * @param    string     $nonce Nonce value to validate
  * @param    string     $action Nonce action
  * 
  * @return   boolean    Validation result
  */
 public static function verify($nonce, $action = -1)
 {
     if (empty($nonce)) {
         return false;
     }
     $check = new LunaNonces($action);
     $check->_verify($nonce);
     return $check;
 }
Exemplo n.º 3
0
function draw_editor($height)
{
    global $orig_message, $quote, $fid, $is_admmod, $can_edit_subject, $cur_comment, $message, $luna_config, $cur_index, $p_message;
    $pin_btn = $silence_btn = '';
    if (isset($_POST['pin_thread']) || $cur_comment['pinned'] == '1') {
        $pin_status = ' checked';
        $pin_active = ' active';
    } else {
        $pin_status = '';
        $pin_active = '';
    }
    if ($fid && $is_admmod || $can_edit_subject && $is_admmod) {
        $pin_btn = '<div class="btn-group" data-toggle="buttons" title="' . __('Pin thread', 'luna') . '"><label class="btn btn-success' . $pin_active . '"><input type="checkbox" name="pin_thread" value="1" tabindex="-1"' . $pin_status . ' /><span class="fa fa-fw fa-thumb-tack"></span></label></div>';
    }
    if (LUNA_ACTIVE_PAGE == 'edit') {
        if (isset($_POST['form_sent']) && isset($_POST['silent']) || !isset($_POST['form_sent'])) {
            $silence_status = ' checked';
            $silence_active = ' active';
        }
        if ($is_admmod) {
            $silence_btn = '<div class="btn-group" data-toggle="buttons" title="' . __('Mute edit', 'luna') . '"><label class="btn btn-success' . $silence_active . '"><input type="checkbox" name="silent" value="1" tabindex="-1"' . $silence_status . ' /><span class="fa fa-fw fa-microphone-slash"></span></label></div>';
        }
    }
    ?>
<div class="panel panel-default panel-editor">
	<fieldset class="comment-field editor">
		<input type="hidden" name="form_sent" value="1" />
		<div class="alert alert-warning hide-if-js" role="alert">
			<p><?php 
    _e('The Editor Toolbar requires JavaScript to be enabled. BBCode will still work, though.', 'luna');
    ?>
</p>
		</div>
		<div class="btn-toolbar textarea-toolbar textarea-top hide-if-no-js">
			<?php 
    echo $pin_btn;
    ?>
			<?php 
    echo $silence_btn;
    ?>
			<div class="btn-group">
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','b');" title="<?php 
    _e('Bold', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-bold fa-fw"></span></a>
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','u');" title="<?php 
    _e('Underline', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-underline fa-fw"></span></a>
				<a class="btn btn-default btn-editor hidden-sm hidden-xs" href="javascript:void(0);" onclick="AddTag('inline','i');" title="<?php 
    _e('Italic', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-italic fa-fw"></span></a>
				<a class="btn btn-default btn-editor hidden-sm hidden-xs" href="javascript:void(0);" onclick="AddTag('inline','s');" title="<?php 
    _e('Strike', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-strikethrough fa-fw"></span></a>
			</div>
			<div class="btn-group">
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','h');" title="<?php 
    _e('Heading', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-header fa-fw"></span></a>
				<a class="btn btn-default btn-editor hidden-md hidden-sm hidden-xs" href="javascript:void(0);" onclick="AddTag('inline','sub');" title="<?php 
    _e('Subscript', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-subscript fa-fw"></span></a>
				<a class="btn btn-default btn-editor hidden-md hidden-sm hidden-xs" href="javascript:void(0);" onclick="AddTag('inline','sup');" title="<?php 
    _e('Superscript', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-superscript fa-fw"></span></a>
			</div>
			<div class="btn-group">
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','quote');" title="<?php 
    _e('Quote', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-quote-left fa-fw"></span></a>
				<a class="btn btn-default btn-editor hidden-sm hidden-xs" href="javascript:void(0);" onclick="AddTag('code','code');" title="<?php 
    _e('Code', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-code fa-fw"></span></a>
				<a class="btn btn-default btn-editor hidden-md hidden-sm hidden-xs" href="javascript:void(0);" onclick="AddTag('inline','c');" title="<?php 
    _e('Inline code', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-file-code-o fa-fw"></span></a>
			</div>
			<div class="btn-group">
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','url');" title="<?php 
    _e('URL', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-link fa-fw"></span></a>
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','img');" title="<?php 
    _e('Image', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-image fa-fw"></span></a>
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','video');" title="<?php 
    _e('Video', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-play-circle fa-fw"></span></a>
			</div>
			<div class="btn-group">
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('list', 'list');" title="<?php 
    _e('List', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-list-ul fa-fw"></span></a>
				<a class="btn btn-default btn-editor" href="javascript:void(0);" onclick="AddTag('inline','*');" title="<?php 
    _e('List item', 'luna');
    ?>
" tabindex="-1"><span class="fa fa-fw fa-asterisk fa-fw"></span></a>
			</div>
			<div class="btn-group">
<?php 
    if ($luna_config['o_emoji'] == 1) {
        ?>
				<a class="btn btn-default btn-editor btn-emoji dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
					<span class="fa fa-fw text-emoji emoji-ed">&#x263a;</span>
				</a>
				<ul class="dropdown-menu dropdown-menu-right dropdown-emoji" role="menu">
					<li><a href="javascript:void(0);" title="<?php 
        _e('Smile', 'luna');
        ?>
" onclick="AddTag('emoji', ':)');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x263a;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Neutral', 'luna');
        ?>
" onclick="AddTag('emoji', ':|');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f611;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Sad', 'luna');
        ?>
" onclick="AddTag('emoji', ':(');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f629;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Big smile', 'luna');
        ?>
" onclick="AddTag('emoji', ':D');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f604;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Yikes', 'luna');
        ?>
" onclick="AddTag('emoji', ':o');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f632;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Wink', 'luna');
        ?>
" onclick="AddTag('emoji', ';)');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f609;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Hmmm', 'luna');
        ?>
" onclick="AddTag('emoji', ':/');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f612;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Tongue', 'luna');
        ?>
" onclick="AddTag('emoji', ':P');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f60b;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Happy', 'luna');
        ?>
" onclick="AddTag('emoji', '^.^');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f600;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Angry', 'luna');
        ?>
" onclick="AddTag('emoji', ':@');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f620;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Roll eye', 'luna');
        ?>
" onclick="AddTag('emoji', '%)');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f606;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Cool', 'luna');
        ?>
" onclick="AddTag('emoji', 'B:');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f60e;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Happy cry', 'luna');
        ?>
" onclick="AddTag('emoji', ':hc:');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f605;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Angel', 'luna');
        ?>
" onclick="AddTag('emoji', '(a)');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f607;</span></a></li>
					<li><a href="javascript:void(0);" title="<?php 
        _e('Oh yeah', 'luna');
        ?>
" onclick="AddTag('emoji', '^-^');"><span class="text-emoji emoji-ed emoji-ed-dropdown">&#x1f60f;</span></a></li>
				</ul>
<?php 
    } else {
        ?>
				<a class="btn btn-default btn-editor emoticon-ed dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
					<img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/smile.png" alt="<?php 
        _e('Smilies', 'luna');
        ?>
" width="15" height="15" />
				</a>
				<ul class="dropdown-menu dropdown-menu-right dropdown-emoticon" role="menu">
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Smile', 'luna');
        ?>
" onclick="AddTag('emoji', ':)');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/smile.png" alt=":)" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Neutral', 'luna');
        ?>
" onclick="AddTag('emoji', ':|');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/neutral.png" alt=":|" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Sad', 'luna');
        ?>
" onclick="AddTag('emoji', ':(');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/sad.png" alt=":(" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Big smile', 'luna');
        ?>
" onclick="AddTag('emoji', ':D');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/big_smile.png" alt=":D" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Yikes', 'luna');
        ?>
" onclick="AddTag('emoji', ':o');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/yikes.png" alt=":o" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Wink', 'luna');
        ?>
" onclick="AddTag('emoji', ';)');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/wink.png" alt=";)" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Hmmm', 'luna');
        ?>
" onclick="AddTag('emoji', ':/');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/hmm.png" alt=":/" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Tongue', 'luna');
        ?>
" onclick="AddTag('emoji', ':P');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/tongue.png" alt=":P" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Happy', 'luna');
        ?>
" onclick="AddTag('emoji', '^.^');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/happy.png" alt="^.^" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Angry', 'luna');
        ?>
" onclick="AddTag('emoji', ':@');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/angry.png" alt=":@" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Roll eye', 'luna');
        ?>
" onclick="AddTag('emoji', '%)');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/roll.png" alt="%)" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Cool', 'luna');
        ?>
" onclick="AddTag('emoji', 'B:');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/cool.png" alt="B:" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Happy cry', 'luna');
        ?>
" onclick="AddTag('emoji', ':hc:');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/happycry.png" alt=":hc:" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Angel', 'luna');
        ?>
" onclick="AddTag('emoji', '(a)');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/angel.png" alt="(a)" width="15" height="15" /></a></li>
					<li><a class="emoticon-ed emoticon-ed-dropdown" href="javascript:void(0);" title="<?php 
        _e('Oh yeah', 'luna');
        ?>
" onclick="AddTag('emoji', '^-^');"><img src="<?php 
        echo luna_htmlspecialchars(get_base_url(true));
        ?>
/img/smilies/ohyeah.png" alt="^-^" width="15" height="15" /></a></li>
				</ul>
<?php 
    }
    ?>
			</div>
		</div>
		<textarea class="form-control textarea"  placeholder="<?php 
    _e('Start typing...', 'luna');
    ?>
" name="req_message" id="comment_field" rows="<?php 
    echo $height;
    ?>
" tabindex="<?php 
    echo $cur_index++;
    ?>
"><?php 
    if (LUNA_ACTIVE_PAGE == 'comment') {
        echo isset($_POST['req_message']) ? luna_htmlspecialchars($orig_message) : (isset($quote) ? $quote : '');
    } elseif (LUNA_ACTIVE_PAGE == 'edit') {
        echo luna_htmlspecialchars(isset($_POST['req_message']) ? $message : $cur_comment['message']);
    } elseif (LUNA_ACTIVE_PAGE == 'new-inbox') {
        echo luna_htmlspecialchars(isset($p_message) ? $p_message : '');
    }
    ?>
</textarea>
		<?php 
    if (LUNA_ACTIVE_PAGE == 'edit') {
        $action = 'edit-comment';
    } elseif (LUNA_ACTIVE_PAGE == 'new-inbox') {
        $action = 'message';
    } else {
        $action = $fid ? 'thread' : 'comment';
    }
    LunaNonces::field($action);
    ?>
		<div class="btn-toolbar textarea-toolbar textarea-bottom">
			<div class="btn-group pull-right">
				<button class="btn btn-with-text btn-default" type="submit" name="preview" accesskey="p" tabindex="<?php 
    echo $cur_index++;
    ?>
" onclick="window.onbeforeunload=null"><span class="fa fa-fw fa-eye"></span> <?php 
    _e('Preview', 'luna');
    ?>
</button>
				<button class="btn btn-with-text btn-primary" type="submit" name="submit" accesskey="s" tabindex="<?php 
    echo $cur_index++;
    ?>
" onclick="window.onbeforeunload=null"><span class="fa fa-fw fa-plus"></span> <?php 
    _e('Submit', 'luna');
    ?>
</button>
			</div>
		</div>
	</fieldset>
</div>
<script>
function AddTag(type, tag) {
   var Field = document.getElementById('comment_field');
   var val = Field.value;
   var selected_txt = val.substring(Field.selectionStart, Field.selectionEnd);
   var before_txt = val.substring(0, Field.selectionStart);
   var after_txt = val.substring(Field.selectionEnd, val.length);
   if (type == 'inline')
	   Field.value = before_txt + '[' + tag + ']' + selected_txt + '[/' + tag + ']' + after_txt;
   else if (type == 'list')
	   Field.value = before_txt + '[list]' + "\r" + '[*]' + selected_txt + '[/*]' + "\r" + '[/list]' + after_txt;
   else if (type == 'code')
	   Field.value = before_txt + '[' + tag + ']' + "\r" + '[[language]]' + "\r" + selected_txt + "\r" + '[/' + tag + ']' + after_txt;
   else if (type == 'emoji')
	   Field.value = before_txt + ' ' + tag + ' ' + after_txt;

	document.getElementById('comment_field').focus();
}
window.onbeforeunload = function() {
    if ( document.getElementById('comment_field').value ) {
	// Don't translate this; we can't change the confirm text anyway.
	return 'Unsaved changes!';
    }
}
</script>
<?php 
}
Exemplo n.º 4
0
    $cur_posting['subject'] = censor_words($cur_posting['subject']);
}
// Do we have permission to post?
if (($tid && ($cur_posting['post_replies'] == '' && $luna_user['g_post_replies'] == '0' || $cur_posting['post_replies'] == '0') || $fid && ($cur_posting['post_topics'] == '' && $luna_user['g_post_topics'] == '0' || $cur_posting['post_topics'] == '0') || isset($cur_posting['closed']) && $cur_posting['closed'] == '1') && !$is_admmod) {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
// Start with a clean slate
$errors = array();
// Did someone just hit "Submit" or "Preview"?
if (isset($_POST['form_sent'])) {
    // Flood protection
    if (!isset($_POST['preview']) && $luna_user['last_post'] != '' && time() - $luna_user['last_post'] < $luna_user['g_post_flood']) {
        $errors[] = sprintf(__('At least %s seconds have to pass between comments. Please wait %s seconds and try posting again.', 'luna'), $luna_user['g_post_flood'], $luna_user['g_post_flood'] - (time() - $luna_user['last_post']));
    }
    // Make sure they got here from the site
    if ($fid && (!isset($_POST['_luna_nonce_post_topic']) || !LunaNonces::verify($_POST['_luna_nonce_post_topic'], 'post-reply')) || !$fid && (!isset($_POST['_luna_nonce_post_reply']) || !LunaNonces::verify($_POST['_luna_nonce_post_reply'], 'post-reply'))) {
        message(__('Are you sure you want to do this?', 'luna'));
    }
    // If it's a new thread
    if ($fid) {
        $subject = luna_trim($_POST['req_subject']);
        if ($luna_config['o_censoring'] == '1') {
            $censored_subject = luna_trim(censor_words($subject));
        }
        if ($subject == '') {
            $errors[] = __('Threads must contain a subject.', 'luna');
        } elseif ($luna_config['o_censoring'] == '1' && $censored_subject == '') {
            $errors[] = __('Threads must contain a subject. After applying censoring filters, your subject was empty.', 'luna');
        } elseif (luna_strlen($subject) > 70) {
            $errors[] = __('Subjects cannot be longer than 70 characters.', 'luna');
        } elseif ($luna_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$luna_user['is_admmod']) {
Exemplo n.º 5
0
		<script type="text/javascript">
			_nonces = {
				heartbeat:  '<?php 
echo LunaNonces::create('heartbeat-nonce');
?>
',
				fetchNotif: '<?php 
echo LunaNonces::create('fetch-notifications-nonce');
?>
',
				trashNotif: '<?php 
echo LunaNonces::create('trash-notification-nonce');
?>
',
				readNotif:  '<?php 
echo LunaNonces::create('read-notification-nonce');
?>
',
			};
			ajaxurl = '<?php 
echo get_base_url() . '/ajax.php';
?>
';
			l10n = {
				no_notification: '<?php 
_e('No new notifications', 'luna');
?>
'
			}
		</script>
Exemplo n.º 6
0
if ($luna_config['o_censoring'] == '1') {
    $cur_post['subject'] = censor_words($cur_post['subject']);
    $cur_post['message'] = censor_words($cur_post['message']);
}
// Do we have permission to edit this post?
if (($luna_user['g_edit_posts'] == '0' || $cur_post['poster_id'] != $luna_user['id'] || $cur_post['closed'] == '1') && !$is_admmod) {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
if ($is_admmod && $luna_user['g_id'] != FORUM_ADMIN && in_array($cur_post['poster_id'], get_admin_ids())) {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
// Start with a clean slate
$errors = array();
if (isset($_POST['form_sent'])) {
    // Make sure they got here from the site
    if (!isset($_POST['_luna_nonce_edit_post']) || !LunaNonces::verify($_POST['_luna_nonce_edit_post'], 'edit-post')) {
        message(__('Are you sure you want to do this?', 'luna'));
    }
    // If it's a thread it must contain a subject
    if ($can_edit_subject) {
        $subject = luna_trim($_POST['req_subject']);
        if ($luna_config['o_censoring'] == '1') {
            $censored_subject = luna_trim(censor_words($subject));
        }
        if ($subject == '') {
            $errors[] = __('Threads must contain a subject.', 'luna');
        } elseif ($luna_config['o_censoring'] == '1' && $censored_subject == '') {
            $errors[] = __('Threads must contain a subject. After applying censoring filters, your subject was empty.', 'luna');
        } elseif (luna_strlen($subject) > 70) {
            $errors[] = __('Subjects cannot be longer than 70 characters.', 'luna');
        } elseif ($luna_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$luna_user['is_admmod']) {
Exemplo n.º 7
0
if ($luna_config['o_censoring'] == '1') {
    $cur_comment['subject'] = censor_words($cur_comment['subject']);
    $cur_comment['message'] = censor_words($cur_comment['message']);
}
// Do we have permission to edit this comment?
if (($luna_user['g_edit_comments'] == '0' || $cur_comment['commenter_id'] != $luna_user['id'] || $cur_comment['closed'] == '1') && !$is_admmod) {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
if ($is_admmod && $luna_user['g_id'] != LUNA_ADMIN && in_array($cur_comment['commenter_id'], get_admin_ids())) {
    message(__('You do not have permission to access this page.', 'luna'), false, '403 Forbidden');
}
// Start with a clean slate
$errors = array();
if (isset($_POST['form_sent'])) {
    // Make sure they got here from the site
    if (!isset($_POST['_luna_nonce_edit_comment']) || !LunaNonces::verify($_POST['_luna_nonce_edit_comment'], 'edit-comment')) {
        message(__('Are you sure you want to do this?', 'luna'));
    }
    // If it's a thread it must contain a subject
    if ($can_edit_subject) {
        $subject = luna_trim($_POST['req_subject']);
        if ($luna_config['o_censoring'] == '1') {
            $censored_subject = luna_trim(censor_words($subject));
        }
        if ($subject == '') {
            $errors[] = __('Threads must contain a subject.', 'luna');
        } elseif ($luna_config['o_censoring'] == '1' && $censored_subject == '') {
            $errors[] = __('Threads must contain a subject. After applying censoring filters, your subject was empty.', 'luna');
        } elseif (luna_strlen($subject) > 70) {
            $errors[] = __('Subjects cannot be longer than 70 characters.', 'luna');
        } elseif ($luna_config['p_subject_all_caps'] == '0' && is_all_uppercase($subject) && !$luna_user['is_admmod']) {