mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
Merge branch 'spamadmin' into dev
This commit is contained in:
commit
4cf85b1a21
@ -3,6 +3,9 @@ RewriteEngine on
|
||||
RewriteCond $1 !^(index\.php|static|favicon\.ico|robots\.txt|sitemap.xml|google(.+)\.html)
|
||||
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
|
||||
|
||||
# basic auth for PHP with fastcgi
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
|
||||
|
||||
SetOutputFilter DEFLATE
|
||||
FileETag MTime Size
|
||||
|
||||
@ -32,3 +35,5 @@ FileETag MTime Size
|
||||
#AuthName "Backend"
|
||||
#AuthUserFile /path/to/.htpasswd #create one with htpasswd -c .htpasswd username
|
||||
#Require user username
|
||||
|
||||
AddHandler php5-fastcgi .php .php5
|
||||
|
@ -22,6 +22,9 @@ class Spamadmin extends CI_Controller
|
||||
$user = $this->config->item('spamadmin_user');
|
||||
$pass = $this->config->item('spamadmin_pass');
|
||||
|
||||
// basic auth for fastcgi
|
||||
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
|
||||
|
||||
if ($user == '' || $pass == '' || !isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $user || $_SERVER['PHP_AUTH_PW'] != $pass)
|
||||
{
|
||||
header('WWW-Authenticate: Basic realm="Spamadmin"');
|
||||
@ -33,6 +36,19 @@ class Spamadmin extends CI_Controller
|
||||
function index()
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$pastes_to_delete = $this->input->post('pastes_to_delete');
|
||||
|
||||
if ($pastes_to_delete)
|
||||
{
|
||||
foreach (explode(' ', $pastes_to_delete) as $pid)
|
||||
{
|
||||
$this->db->where('pid', $pid);
|
||||
$this->db->delete('pastes');
|
||||
}
|
||||
redirect(site_url('spamadmin/' . $this->uri->segment(2)));
|
||||
}
|
||||
|
||||
//render view
|
||||
$data = $this->pastes->getSpamLists();
|
||||
$this->load->view('list_ips', $data);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.hidden {
|
||||
.hidden, .inv {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -127,3 +127,11 @@ table.table thead .sorting_desc_disabled { background: url('../images/sort_desc_
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.ui-selectable>.ui-selected { background-color: #a6c9e2; }
|
||||
.ui-selectable>.ui-selecting { background: #FECA40; }
|
||||
|
||||
.ui-selectable-helper {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
border:1px dotted black;
|
||||
}
|
6
htdocs/themes/bootstrap/js/jquery-ui-selectable-combined.min.js
vendored
Normal file
6
htdocs/themes/bootstrap/js/jquery-ui-selectable-combined.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -16,6 +16,48 @@ ST.show_embed = function() {
|
||||
});
|
||||
};
|
||||
|
||||
ST.spamadmin = function() {
|
||||
if ($('.content h1').text() == 'Spamadmin') {
|
||||
$('.content .hidden').show();
|
||||
$('.content .quick_remove').live('click', function(ev) {
|
||||
var ip = $(ev.target).data('ip');
|
||||
if (confirm('Delete all pastes belonging to ' + ip + '?')) {
|
||||
$.post(base_url + 'spamadmin/' + ip, {
|
||||
'confirm_remove': 'yes',
|
||||
'block_ip': 1
|
||||
}, function() {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// needed by .selectable
|
||||
$.fn.addBack = function(selector) {
|
||||
return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
|
||||
}
|
||||
|
||||
$('.selectable>tbody').selectable({
|
||||
filter: 'tr',
|
||||
cancel: 'a',
|
||||
stop: function() {
|
||||
var $deletestack = $(".paste_deletestack");
|
||||
var $input = $("input[name=pastes_to_delete]");
|
||||
$('.inv').show();
|
||||
$deletestack.empty();
|
||||
$input.empty();
|
||||
var res = [];
|
||||
$(".ui-selected").each(function(i, el) {
|
||||
var id = $('a', el).attr('href').split('view/')[1];
|
||||
res.push(id);
|
||||
});
|
||||
$deletestack.text(res.join(' '));
|
||||
$input.val(res.join(' '));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ST.line_highlighter = function() {
|
||||
var org_href = window.location.href.replace(/(.*?)#(.*)/, '$1');
|
||||
var first_line = false;
|
||||
@ -293,6 +335,7 @@ ST.clickable_urls = function() {
|
||||
|
||||
ST.init = function() {
|
||||
ST.show_embed();
|
||||
ST.spamadmin();
|
||||
ST.line_highlighter();
|
||||
ST.crypto();
|
||||
ST.dragdrop();
|
||||
|
@ -18,6 +18,7 @@ if(isset($ace_modes)){
|
||||
//Javascript
|
||||
$this->carabiner->js('jquery.js');
|
||||
$this->carabiner->js('jquery.timers.js');
|
||||
$this->carabiner->js('jquery-ui-selectable-combined.min.js');
|
||||
$this->carabiner->js('bootstrap.min.js');
|
||||
$this->carabiner->js('crypto-js/rollups/aes.js');
|
||||
$this->carabiner->js('lz-string-1.3.3-min.js');
|
||||
|
@ -9,10 +9,8 @@
|
||||
<?php } else { ?>
|
||||
<?php echo $page['title']; ?>
|
||||
<?php } ?>
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="span12">
|
||||
<form action="<?php echo base_url(); ?>" method="post" class="form-vertical well">
|
||||
@ -20,19 +18,15 @@
|
||||
<div class="span3">
|
||||
<label for="name"><?php echo lang('paste_author'); ?>
|
||||
</label>
|
||||
|
||||
<?php $set = array('name' => 'name', 'id' => 'name', 'class' => 'span3', 'value' => $name_set, 'maxlength' => '32', 'tabindex' => '1');
|
||||
echo form_input($set);?>
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
<label for="title">
|
||||
<?php echo lang('paste_title'); ?>
|
||||
</label>
|
||||
|
||||
<input value="<?php if(isset($title_set)){ echo $title_set; }?>" class="span3" type="text" id="title" name="title" tabindex="2" maxlength="50" />
|
||||
</div>
|
||||
|
||||
<div class="span3">
|
||||
<label for="lang">
|
||||
<?php echo lang('paste_lang'); ?>
|
||||
@ -40,7 +34,6 @@
|
||||
<?php $lang_extra = 'id="lang" class="select span3" tabindex="3"'; echo form_dropdown('lang', $languages, $lang_set, $lang_extra); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<label for="code"><?php echo lang('paste_yourpaste'); ?>
|
||||
@ -109,11 +102,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($reply){ ?>
|
||||
<input type="hidden" value="<?php echo $reply; ?>" name="reply" />
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->config->item('enable_captcha') && $this->session->userdata('is_human') === null){ ?>
|
||||
<div class="item_group">
|
||||
<div class="item item_captcha">
|
||||
|
@ -172,7 +172,7 @@ h4 {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.hidden, .email, .url {
|
||||
.hidden, .email, .url, .inv {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -565,3 +565,11 @@ h4 {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.ui-selectable>.ui-selected { background-color: #a6c9e2; }
|
||||
.ui-selectable>.ui-selecting { background: #FECA40; }
|
||||
|
||||
.ui-selectable-helper {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
border:1px dotted black;
|
||||
}
|
||||
|
6
htdocs/themes/default/js/jquery-ui-selectable-combined.min.js
vendored
Normal file
6
htdocs/themes/default/js/jquery-ui-selectable-combined.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -51,6 +51,30 @@ ST.spamadmin = function() {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// needed by .selectable
|
||||
$.fn.addBack = function(selector) {
|
||||
return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
|
||||
}
|
||||
|
||||
$('.selectable>tbody').selectable({
|
||||
filter: 'tr',
|
||||
cancel: 'a',
|
||||
stop: function() {
|
||||
var $deletestack = $(".paste_deletestack");
|
||||
var $input = $("input[name=pastes_to_delete]");
|
||||
$('.inv').show();
|
||||
$deletestack.empty();
|
||||
$input.empty();
|
||||
var res = [];
|
||||
$(".ui-selected").each(function(i, el) {
|
||||
var id = $('a', el).attr('href').split('view/')[1];
|
||||
res.push(id);
|
||||
});
|
||||
$deletestack.text(res.join(' '));
|
||||
$input.val(res.join(' '));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ST.line_highlighter = function() {
|
||||
|
@ -18,6 +18,7 @@ if(isset($ace_modes)){
|
||||
//Javascript
|
||||
$this->carabiner->js('jquery.js');
|
||||
$this->carabiner->js('jquery.timers.js');
|
||||
$this->carabiner->js('jquery-ui-selectable-combined.min.js');
|
||||
$this->carabiner->js('crypto-js/rollups/aes.js');
|
||||
$this->carabiner->js('lz-string-1.3.3-min.js');
|
||||
$this->carabiner->js('filereader.js');
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
<?php echo validation_errors(); ?>
|
||||
|
||||
<div class="form_wrapper margin">
|
||||
|
@ -8,14 +8,14 @@
|
||||
}
|
||||
$n = 0;
|
||||
if(!empty($pastes)){ ?>
|
||||
<table class="recent">
|
||||
<table class="recent selectable">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="title">Title</th>
|
||||
<th class="name">Name</th>
|
||||
<th class="time">When</th>
|
||||
<th class="time">IP</th>
|
||||
<th title="Quick remove" class="qr hidden">X</th>
|
||||
<th title="Quick remove" class="hidden">X</th>
|
||||
</tr>
|
||||
<?php foreach($pastes as $paste) {
|
||||
if(checkNum($n) == TRUE) {
|
||||
@ -37,6 +37,15 @@
|
||||
<?php }?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<form action="" method="post">
|
||||
<h2 class="confirm_title inv">Confirm deletion of the following pastes:</h2>
|
||||
<div class="paste_deletestack"></div>
|
||||
<input type="hidden" name="pastes_to_delete" />
|
||||
|
||||
<input type="submit" name="delete_pastes" value="Delete selected pastes" class="inv" />
|
||||
</form>
|
||||
|
||||
<?php } else { ?>
|
||||
<p><?php echo lang('paste_missing'); ?> :(</p>
|
||||
<?php }?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user