| 內容 |
|
|
I don't have any experience on this kind of application. Here are some hints, you can try them yourself.
1.You may reference the net.jforum.view.install.InstallAction.java's saveMessage() method:
private void saveMessage(final Connection conn, final String subject, final String message, final int topicType, final int forumId, final int userId, final String sourceIp)
{
try {
ConfigLoader.createLoginAuthenticator();
ConfigLoader.loadDaoImplementation();
SystemGlobals.loadQueries(SystemGlobals.getValue(ConfigKeys.SQL_QUERIES_GENERIC));
SystemGlobals.loadQueries(SystemGlobals.getValue(ConfigKeys.SQL_QUERIES_DRIVER));
final JForumExecutionContext executionContext = JForumExecutionContext.get();
executionContext.setConnection(conn);
JForumExecutionContext.set(executionContext);
final User user = new User(userId);
// Create topic
final Topic topic = new Topic();
topic.setPostedBy(user);
topic.setTitle(subject);
topic.setTime(new Date());
topic.setType(topicType);
topic.setForumId(forumId);
final TopicDAO topicDao = DataAccessDriver.getInstance().newTopicDAO();
topicDao.addNew(topic);
// Create post
final Post post = new Post();
post.setSubject(topic.getTitle());
post.setTime(topic.getTime());
post.setUserId(user.getId());
post.setText(message);
post.setForumId(topic.getForumId());
post.setSmiliesEnabled(true);
post.setHtmlEnabled(true);
post.setBbCodeEnabled(true);
post.setUserIp(sourceIp);
post.setTopicId(topic.getId());
final PostDAO postDao = DataAccessDriver.getInstance().newPostDAO();
postDao.addNew(post);
// Update topic
topic.setFirstPostId(post.getId());
topic.setLastPostId(post.getId());
topicDao.update(topic);
DataAccessDriver.getInstance().newUserDAO().incrementPosts(post.getUserId());
// Update forum stats
final ForumDAO forumDao = DataAccessDriver.getInstance().newForumDAO();
forumDao.incrementTotalTopics(forumId, 1);
forumDao.setLastPost(forumId, post.getId());
}
finally {
final JForumExecutionContext executionContext = JForumExecutionContext.get();
executionContext.setConnection(null);
JForumExecutionContext.set(executionContext);
}
}
2.You may reference the net.jforum.api.integration.mail.pop.POPPostAction.java's insertMessages() method.
|
 |
|
|
自RHEL 6/CentOS 6開始,套件包含OpenSSH 5.3版本,可以不用重新編譯程式只要透過設定就可以限制SSH/SFTP連入的帳號存取的目錄。
1.建立sftponly群組
groupadd sftponly
2.新建帳號test
useradd -s /bin/false -G sftponly test
passwd test
chown root /home/test
3.修改/etc/ssh/sshd_config設定(檔案尾端)
# override default of no subsystems
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server
Match Group sftponly
ChrootDirectory /home/%u
X11Forwarding no
AllowTCPForwarding no
ForceCommand internal-sftp
4.重啟SSHd服務
service sshd restart
5.測試
使用FileZila Client連進去看看,確認可以登入,上傳/下載檔案。
參考資料:
http://www.thisisnotsupported.com/sftp-chrootjail-on-centos6/
|
 |
|
|
|
|
 |
|
|
今天晚上六點後將網站移轉至Linode在日本東京新設立的機房,由台灣連過去主機的速度應該有比之前快,有任何問題請再回應。
參考資料:
http://blog.linode.com/2011/09/19/linode-cloud-asia-pacific/
|
 |
|
|
透過SSO機制,使用者第一次登入時,JForum會檢查帳號是否存在,如果不存在則會自動建立該帳號。如果您SSO後的管理者帳號不是admin的話,您可以先將管理者帳號建立或將admin更名後,再整合SSO。
參考資料:
http://jforum.andowson.com/posts/list/16.page
|
 |
|
|
昨天抱著興奮的心情,將公司電腦的作業系統由Windows XP升級為Windows 7企業版Service Pack1。緊接著做了一堆的Windows Update,在安裝完必要的辦公室軟體Office 2010,也設定好IE的proxy,確定可以正常開啟網頁後,開始安裝上班時對外聯繫的必要軟體Windows Live Messenger 2011(也就是MSN),一開始連安裝都有問題(因為安裝程式還要由網路下載程式主體回來安裝),但經過調整proxy的設定後,終於可以安裝了。安裝完成後,馬上啟動Windows Live Messenger,輸入帳號跟密碼,點選登入,GOD! MSN不通,遇到這樣的錯誤:
你無法登入可以是由於服務存在問題或您的Internet連線有問題。請確保您已連線到互聯網。81000306
搞了很久還是不通,延誤了下班時間,佳人在催,只好殘念回家。
今天又問了公司有裝Windows 7的同事,怎麼解決MSN問題,他們給的答案是改裝舊版的MSN,然後設定不要升級。我比較無法接受這個答案,於是我又開始上網搜尋找答案,結果找到了 這篇,整理重點大致如下:
C:\Windows\system32>netsh
netsh>winhttp
netsh winhttp>
netsh winhttp>import proxy source=ie
這樣子,設定完成就可以登入MSN囉。 
|
 |
|
|
這也是今天無意中發現的
momo親子台討論區
http://talk.momokids.com.tw/jForum/forums/list.page
成立日期:2011/06/10
討論區版本:JForum 2.1.8
作業系統:Windows Server 2003
應用伺服器:Apache Tomcat/5.5.33
|
 |
|
|
163郵箱的設定資訊如下:
http://help.163.com/09/1223/14/5R7P3QI100753VB8.html?servCode=6010377
您可以先做些簡易測試,例如由web主機先telnet smtp.163.com 25看看
如果不行可以改試試看GMail,請參考下面的文章:
http://www.andowson.com/posts/list/349.page
|
 |
|
|
yuhfa2002您好:
請先確認一下在您的ftp.sh目錄下,執行完./ftp.sh後有沒有產生一個test.txt檔案。
如果沒有請自行手動建立一個,然後再執行一次./ftp.sh。
|
 |
|
|
yuhfa2002您好:
抱歉,在ftp指令模式裡面不支援echo指令,所以應該要將所有的echo刪除:
#! /bin/bash host=ftp.server.ip username=ftpuser password=ftppwd dir=/ filename=test.txt echo "test" > $filename /usr/bin/ftp -v -n >> /tmp/ftp.log <<EOD open $host user $username $password passive bi prompt cd $dir mput $filename quit EOD
另外,在您將ftp.sh上傳到主機時,請先執行一下dos2unix ftp.sh,然後再執行:
chmod 755 ftp.sh
./ftp.sh
注意,為便於除錯,建議每次執行ftp.sh前先刪除或清空/tmp/ftp.log
|
 |
|
|
臺灣期貨交易所委託證基會辦理100年新進人員招募測驗,報名時間自100年8月5日至100年8月15日止,測驗日期為100年8月28日(日)上午。
詳情請參見下列網址:
http://www.sfi.org.tw/newsfi/seminar/main/Default.asp?s=43
檔案下載:
http://www.sfi.org.tw/download/test_ftp/期交所簡章.pdf
http://www.sfi.org.tw/download/test_ftp/期交所時程表.pdf
http://www.sfi.org.tw/download/test_ftp/期交所報名表.doc
http://www.sfi.org.tw/download/test_ftp/期交所報名表.pdf
|
 |
|
|
yuhfa2002您好:
請試著將ftp.sh取代為下列的檔案內容,並自行修改第2~6行的變數值,然後單獨執行ftp.sh看看是否可以正常運作,如果有問題再將ftp.log附上。
#! /bin/bash
host=192.168.1.2
username=xxx
password=yyyyyyy
dir=/tmp
filename=test.txt
echo "test" > $filename
/usr/bin/ftp -v -n >> /tmp/ftp.log <<EOD
echo $host
open $host
echo $username
echo $password
user $username $password
bi
prompt
echo $dir
cd $dir
echo $filename
mput $filename
quit
EOD
|
 |
|
|
目前JForum中使用的templates對FreeMarker來說都是使用相對路徑,例如forum_list.htm裡面的<#include "header.htm" />就是和forum_list.htm同一目錄下的header.htm。
可以參考下面這個網址的說明:
http://freemarker.sourceforge.net/docs/ref_directive_include.html
|
 |
|
|
十鼎 wrote:关于运行时更新配置文件引起的异常问题
jforum支持运行时更新配置文件功能,运行时会监测主要的配置文件是否被更新,如果发现则重新装载。相关代码见SystemGlobalsListener.java 文件:
[code=java; first-line:60]
public void fileChanged(final String filename)
{
LOGGER.info("Reloading "+ filename);
SystemGlobals.reset(); //这里已经清空了所有配置信息
SystemGlobals.initGlobals(SystemGlobals.getApplicationPath(),
SystemGlobals.getValue(ConfigKeys.DEFAULT_CONFIG));//这里希望取出默认配置文件名,返回值为空
}
[/code]
嗯!這個問題只要把SystemGlobals.reset();這行刪掉即可解決。
|
 |
|
|
配合新版JForum 2.3.1的測試,將本站風格作一改變,希望這樣子閱讀起來比較清爽。
|
 |
|
|