![]() |
<td> </td>
<td align="center" width="20"><img /></td>
<td><span class="gensmall"><a href="${contextPath}/sitemap.xml">${I18n.getMessage("mydwbi.sitemap")}</a></span></td>
<#if (post.userIp?exists && isModerator) || (post.userIp?exists && session.username = "lynx286")>
${I18n.getMessage("PostShow.userIP")}: <a href="http://whois.domaintools.com/${post.userIp}" target="_blank">${post.userIp}</a>
<span class="postdetails">${topic.firstPostTime}<br />
<a href="${JForumContext.encodeURL("/user/profile/${topic.postedBy.id}")}">${topic.postedBy.username}</a></span>
PostForm.options= Options
PostForm.poll = Poll
PostForm.attachments = Attachments
PostForm.options = \u9009\u9879
PostForm.poll = \u6295\u7968
PostForm.attachments = \u9644\u4ef6
PostForm.options = \u9078\u9805
PostForm.poll = \u7968\u9078\u6D3B\u52D5
PostForm.attachments = \u9644\u52A0\u6A94\u6848
<span>Options</span>
<#if allowPoll>
<span>Poll</span>
</#if>
<#if attachmentsEnabled>
<span>Attachments</span>
</#if>
<span>${I18n.getMessage("PostForm.options")}</span>
<#if allowPoll>
<span>${I18n.getMessage("PostForm.poll")}</span>
</#if>
<#if attachmentsEnabled>
<span>${I18n.getMessage("PostForm.attachments")}</span>
</#if>
<#if post.userIp?exists && (isModerator || post.userId == session.userId)>
${I18n.getMessage("PostShow.userIP")}: ${post.userIp}
</#if>
<td align="left">
<span class="gensmall">${I18n.getMessage("ForumIndex.goTo")}: </span>
<select onchange="if(this.options[this.selectedIndex].value != -1){ document.location = '${contextPath}/forums/show/'+ this.options[this.selectedIndex].value +'${extension}'; }" name="select">
<option value="-1" selected="selected">${I18n.getMessage("ForumIndex.goToSelectAForum")}</option>
<#list allCategories as category>
<optgroup label="${category.name}">
<#list category.getForums() as forum>
<option value="${forum.id}">${forum.name}</option>
</#list>
</optgroup>
</#list>
</select>
<input class="liteoption" type="button" value="${I18n.getMessage("ForumIndex.goToGo")}" onclick="if(document.f.select.options[document.f.select.selectedIndex].value != -1){ document.location = '${contextPath}/forums/show/'+ document.f.select.options[document.f.select.selectedIndex].value +'${extension}'; }" />
</td>
<#if canRemove && (((post.userId == session.userId) && (session.userId != 1)) || isModerator || isAdmin)>
private boolean shouldCreateThumb(Attachment a) {
if (SystemGlobals
.getBoolValue(ConfigKeys.ATTACHMENTS_IMAGES_CREATE_THUMB)) {
String extension = a.getInfo().getExtension().getExtension()
.toLowerCase();
if (Attachment.isPicture(extension)) {
String path = SystemGlobals
.getValue(ConfigKeys.ATTACHMENTS_STORE_DIR)
+ "/" + a.getInfo().getPhysicalFilename();
File fileOriginal = new File(path);
Image imageOriginal = null;
try {
imageOriginal = ImageIO.read(fileOriginal);
} catch (IOException e) {
e.printStackTrace();
}
int widthOriginal = imageOriginal.getWidth(null);
int heightOriginal = imageOriginal.getHeight(null);
if (widthOriginal > 800 || heightOriginal > 600)
return true;
else
return false;
} else
return false;
} else
return false;
}
public boolean hasThumb() {
String pName = this.info.getPhysicalFilename();
String extension = pName.substring(pName.lastIndexOf('.') + 1, pName
.length() - 1);
if (isPicture(extension)
&& SystemGlobals
.getBoolValue(ConfigKeys.ATTACHMENTS_IMAGES_CREATE_THUMB))
return true;
else
return false;
}
public String thumbPath() {
String fileDir = SystemGlobals
.getValue(ConfigKeys.ATTACHMENTS_UPLOAD_DIR)
+ '/' + this.info.getPhysicalFilename();
String path = SystemGlobals.getValue(ConfigKeys.ATTACHMENTS_STORE_DIR)
+ "/" + this.info.getPhysicalFilename();
if (new File(path + "_thumb").exists()) {
return fileDir + "_thumb";
} else {
return fileDir;
}
}
public static boolean isPicture(String extension) {
if ("bmp".equals(extension) || "jpg".equals(extension)
|| "jpeg".equals(extension) || "gif".equals(extension)
|| "png".equals(extension))
return true;
else
return false;
}
private static void handleAvatar(User u) {
String fileName = MD5.crypt(Integer.toString(u.getId()));
FileItem item = (FileItem) JForumExecutionContext.getRequest()
.getObjectParameter("avatar");
UploadUtils uploadUtils = new UploadUtils(item);
// Gets file extension
String extension = uploadUtils.getExtension().toLowerCase();
int type = ImageUtils.IMAGE_UNKNOWN;
if (extension.equals("jpg") || extension.equals("jpeg")) {
type = ImageUtils.IMAGE_JPEG;
} else if (extension.equals("gif")) {
type = ImageUtils.IMAGE_GIF;
} else if (extension.equals("png")) {
type = ImageUtils.IMAGE_PNG;
}
if (type != ImageUtils.IMAGE_UNKNOWN) {
String avatarFinalFileName = SystemGlobals.getApplicationPath()
+ "/images/avatar/" + fileName + "." + extension;
uploadUtils.saveUploadedFile(avatarFinalFileName);
File avatar = new File(avatarFinalFileName);
Image imageOriginal = null;
try {
imageOriginal = ImageIO.read(avatar);
} catch (IOException e) {
e.printStackTrace();
}
int widthOriginal = imageOriginal.getWidth(null);
int heightOriginal = imageOriginal.getHeight(null);
if (widthOriginal <= 130 && heightOriginal <= 130) {
u.setAvatar(fileName + "." + extension);
}else{
avatar.delete();
}
}
}
private boolean shouldCreateThumb(Attachment a) {
String extension = a.getInfo().getExtension().getExtension().toLowerCase();
if (SystemGlobals.getBoolValue(ConfigKeys.ATTACHMENTS_IMAGES_CREATE_THUMB)
&& Attachment.isPicture(extension)) {
String path = SystemGlobals.getValue(ConfigKeys.ATTACHMENTS_STORE_DIR)
+ "/"
+ a.getInfo().getPhysicalFilename();
File imageFile = new File(path);
BufferedImage image = null;
try {
image = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
int width = image.getWidth(null);
int height = image.getHeight(null);
return (width > SystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_IMAGES_MAX_THUMB_W)
|| height > SystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_IMAGES_MAX_THUMB_H));
}
return false;
}
public boolean hasThumb()
{
String filename = this.info.getPhysicalFilename();
String extension = filename.substring(filename.lastIndexOf('.') + 1,
filename.length() - 1);
return SystemGlobals.getBoolValue(ConfigKeys.ATTACHMENTS_IMAGES_CREATE_THUMB)
&& isPicture(extension);
}
public String thumbPath() {
String urlPath = SystemGlobals.getValue(ConfigKeys.ATTACHMENTS_UPLOAD_DIR)
+ '/' + this.info.getPhysicalFilename();
String realPath = SystemGlobals.getValue(ConfigKeys.ATTACHMENTS_STORE_DIR)
+ "/" + this.info.getPhysicalFilename();
if (new File(realPath + "_thumb").exists()) {
return urlPath + "_thumb";
} else {
return urlPath;
}
}
public static boolean isPicture(String extension) {
return ("jpg".equals(extension) || "jpeg".equals(extension)
|| "gif".equals(extension) || "png".equals(extension)
|| "bmp".equals(extension));
}
private static void handleAvatar(User u)
{
// Delete old avatar file
if (u.getAvatar() != null) {
File avatarFile = new File(u.getAvatar());
File fileToDelete = new File(SystemGlobals.getApplicationPath()
+ "/images/avatar/"
+ avatarFile.getName());
if (fileToDelete.exists()) {
fileToDelete.delete();
}
}
String fileName = MD5.crypt(Integer.toString(u.getId()));
FileItem item = (FileItem)JForumExecutionContext.getRequest().getObjectParameter("avatar");
UploadUtils uploadUtils = new UploadUtils(item);
// Gets file extension
String extension = uploadUtils.getExtension().toLowerCase();
int type = ImageUtils.IMAGE_UNKNOWN;
if (extension.equals("jpg") || extension.equals("jpeg")) {
type = ImageUtils.IMAGE_JPEG;
} else if (extension.equals("gif")) {
type = ImageUtils.IMAGE_GIF;
} else if (extension.equals("png")) {
type = ImageUtils.IMAGE_PNG;
}
if (type != ImageUtils.IMAGE_UNKNOWN) {
String avatarTmpFileName = SystemGlobals.getApplicationPath()
+ "/images/avatar/"
+ fileName
+ "_tmp."
+ extension;
String avatarFinalFileName = SystemGlobals.getApplicationPath()
+ "/images/avatar/"
+ fileName
+ "."
+ extension;
uploadUtils.saveUploadedFile(avatarTmpFileName);
// OK, time to check and process the avatar size
int maxWidth = SystemGlobals.getIntValue(ConfigKeys.AVATAR_MAX_WIDTH);
int maxHeight = SystemGlobals.getIntValue(ConfigKeys.AVATAR_MAX_HEIGHT);
File avatar = new File(avatarTmpFileName);
BufferedImage imageOriginal = null;
try {
imageOriginal = ImageIO.read(avatar);
} catch (IOException e) {
e.printStackTrace();
}
int width = imageOriginal.getWidth(null);
int height = imageOriginal.getHeight(null);
if (width > maxWidth || height > maxHeight) {
if (type == ImageUtils.IMAGE_GIF) {
type = ImageUtils.IMAGE_PNG;
extension = "png";
}
BufferedImage image = ImageUtils.resizeImage(avatarTmpFileName, type, maxWidth, maxHeight);
ImageUtils.saveImage(image, avatarFinalFileName, type);
// Delete the temporary file
avatar.delete();
} else {
avatar.renameTo(new File(avatarFinalFileName));
}
u.setAvatar(fileName + "." + extension);
}
}