antville/code/ImageMgr/create.hac

28 lines
860 B
Text

checkIfLoggedIn(this.href(req.action));
var deny = this.isDenied(session.user,req.data.memberlevel);
if (deny) {
res.message = getMessage("error",deny);
res.redirect(path.site.href());
}
if (req.data.submit == "cancel" || req.data.cancel)
res.redirect(this.href());
else if (req.data.submit == "save" || req.data.save) {
// check if a url has been passed instead of a file upload. hw
if ((!req.data.rawimage || req.data.rawimage.contentLength == 0) && req.data.url)
req.data.rawimage = getURL(req.data.url);
var result = this.evalImg(req.data,session.user);
res.message = result.message;
if (!result.error)
res.redirect(this.href());
}
res.data.action = this.href(req.action);
res.data.title = path.site.title;
var newImg = new image();
res.data.body = newImg.renderSkinAsString("new");
path.site.renderSkin("page");