closes #613, fixed allowRegistration incase its undefined

v1.18.x
Baris Soner Usakli 11 years ago
parent 256a2fa9c6
commit e9fbed71ae

@ -202,6 +202,20 @@ define(['taskbar'], function(taskbar) {
} }
}); });
postContainer.on('click', '.formatting-bar span .fa-picture-o', function() {
$('#files').click();
});
$('#files').on('change', function(e) {
var files = e.target.files;
if(files) {
for (var i=0; i<files.length; i++) {
loadFile(post_uuid, files[i]);
}
}
});
var resizeActive = false, var resizeActive = false,
resizeCenterX = 0, resizeCenterX = 0,
resizeOffset = 0, resizeOffset = 0,
@ -302,6 +316,10 @@ define(['taskbar'], function(taskbar) {
} }
} }
if(config.imgurClientIDSet) {
postContainer.find('.upload-instructions').removeClass('hide')
}
postContainer.css('visibility', 'visible'); postContainer.css('visibility', 'visible');
composer.focusElements(post_uuid); composer.focusElements(post_uuid);
@ -459,12 +477,16 @@ define(['taskbar'], function(taskbar) {
} }
function loadFile(post_uuid, file) { function loadFile(post_uuid, file) {
if (!file.type.match('image.*')) {
return;
}
var reader = new FileReader(), var reader = new FileReader(),
dropDiv = $('#cmp-uuid-' + post_uuid).find('.imagedrop'); dropDiv = $('#cmp-uuid-' + post_uuid).find('.imagedrop');
$(reader).on('loadend', function(e) { $(reader).on('loadend', function(e) {
var bin = this.result; var bin = this.result.split(',')[1];
bin = bin.split(',')[1];
var img = { var img = {
name: file.name, name: file.name,

@ -54,13 +54,13 @@
<div class="collapse navbar-collapse"> <div class="collapse navbar-collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<a href="/admin/index"><i class="fa fa-home"></i> Home</a> <a href="/admin/index"><i class="fa fa-home" title="Home"></i></a>
</li> </li>
<li> <li>
<a href="/admin/settings"><i class="fa fa-cogs"></i> Settings</a> <a href="/admin/settings"><i class="fa fa-cogs" title="Settings"></i></a>
</li> </li>
<li> <li>
<a href="/" target="_top"><i class="fa fa-book"></i> Forum</a> <a href="/" target="_top"><i class="fa fa-book" title="Forum"></i></a>
</li> </li>
<li> <li>
<a href="#" id="reconnect"></a> <a href="#" id="reconnect"></a>

@ -7,12 +7,19 @@
<span class="btn btn-link" tabindex="-1"><i class="fa fa-italic"></i></span> <span class="btn btn-link" tabindex="-1"><i class="fa fa-italic"></i></span>
<span class="btn btn-link" tabindex="-1"><i class="fa fa-list"></i></span> <span class="btn btn-link" tabindex="-1"><i class="fa fa-list"></i></span>
<span class="btn btn-link" tabindex="-1"><i class="fa fa-link"></i></span> <span class="btn btn-link" tabindex="-1"><i class="fa fa-link"></i></span>
<span class="btn btn-link" tabindex="-1">
<input type="file" id="files" name="files[]" multiple class="hide"/>
<i class="fa fa-picture-o"></i>
</span>
</div> </div>
<!-- <div class="btn btn-link pull-right">Preview</div> --> <!-- <div class="btn btn-link pull-right">Preview</div> -->
</div> </div>
<textarea tabIndex="2"></textarea> <textarea tabIndex="2"></textarea>
<div class="preview"></div> <div class="preview"></div>
<div class="imagedrop"><div>Drag and Drop Images Here</div></div> <div class="imagedrop"><div>Drag and Drop Images Here</div></div>
<div class="text-center upload-instructions hide">
<small>Upload images by dragging & dropping them</small>
</div>
<div class="btn-toolbar action-bar"> <div class="btn-toolbar action-bar">
<div class="btn-group pull-right"> <div class="btn-group pull-right">
<button class="btn btn-default" data-action="discard" tabIndex="5"><i class="fa fa-times"></i> Discard</button> <button class="btn btn-default" data-action="discard" tabIndex="5"><i class="fa fa-times"></i> Discard</button>

@ -193,7 +193,7 @@
}); });
app.post('/register', function(req, res) { app.post('/register', function(req, res) {
if(parseInt(meta.config.allowRegistration, 10) === 0) { if(meta.config.allowRegistration !== undefined && parseInt(meta.config.allowRegistration, 10) === 0) {
return res.send(403); return res.send(403);
} }

@ -390,7 +390,7 @@ var path = require('path'),
res.redirect('/user/' + userslug); res.redirect('/user/' + userslug);
}); });
return; return;
} else if(route === 'register' && parseInt(meta.config.allowRegistration, 10) === 0) { } else if(route === 'register' && meta.config.allowRegistration !== undefined && parseInt(meta.config.allowRegistration, 10) === 0) {
return res.redirect('/403'); return res.redirect('/403');
} else if (loginRequired.indexOf(route) !== -1 && !req.user) { } else if (loginRequired.indexOf(route) !== -1 && !req.user) {
return res.redirect('/403'); return res.redirect('/403');

Loading…
Cancel
Save