[xoops-cvslog 153] CVS update: xoops2jp/html/modules/newbb

Back to archive index

onokazu onoka****@users*****
2005年 6月 11日 (土) 11:50:13 JST


Index: xoops2jp/html/modules/newbb/index.php
diff -u xoops2jp/html/modules/newbb/index.php:1.2 xoops2jp/html/modules/newbb/index.php:1.2.10.1
--- xoops2jp/html/modules/newbb/index.php:1.2	Fri Mar 18 21:52:25 2005
+++ xoops2jp/html/modules/newbb/index.php	Sat Jun 11 11:50:13 2005
@@ -1,5 +1,5 @@
 <?php
-// $Id: index.php,v 1.2 2005/03/18 12:52:25 onokazu Exp $
+// $Id: index.php,v 1.2.10.1 2005/06/11 02:50:13 onokazu Exp $
 //  ------------------------------------------------------------------------ //
 //                XOOPS - PHP Content Management System                      //
 //                    Copyright (c) 2000 XOOPS.org                           //
@@ -39,104 +39,104 @@
 
 $sql = 'SELECT c.* FROM '.$xoopsDB->prefix('bb_categories').' c, '.$xoopsDB->prefix("bb_forums").' f WHERE f.cat_id=c.cat_id GROUP BY c.cat_id, c.cat_title, c.cat_order ORDER BY c.cat_order';
 if ( !$result = $xoopsDB->query($sql) ) {
-	redirect_header(XOOPS_URL.'/',1,_MD_ERROROCCURED);
-	exit();
+    redirect_header(XOOPS_URL.'/',1,_MD_ERROROCCURED);
+    exit();
 }
 
-$xoopsTpl->assign(array("lang_welcomemsg" => sprintf(_MD_WELCOME,$xoopsConfig['sitename']), "lang_tostart" => _MD_TOSTART, "lang_totaltopics" => _MD_TOTALTOPICSC, "lang_totalposts" => _MD_TOTALPOSTSC, "total_topics" => get_total_topics(), "total_posts" => get_total_posts(0, 'all'), "lang_lastvisit" => sprintf(_MD_LASTVISIT,formatTimestamp($last_visit)), "lang_currenttime" => sprintf(_MD_TIMENOW,formatTimestamp(time(),"m")), "lang_forum" => _MD_FORUM, "lang_topics" => _MD_TOPICS, "lang_posts" => _MD_POSTS, "lang_lastpost" => _MD_LASTPOST, "lang_moderators" => _MD_MODERATOR));
+$xoopsTpl->assign(array("lang_welcomemsg" => sprintf(_MD_WELCOME,htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)), "lang_tostart" => _MD_TOSTART, "lang_totaltopics" => _MD_TOTALTOPICSC, "lang_totalposts" => _MD_TOTALPOSTSC, "total_topics" => get_total_topics(), "total_posts" => get_total_posts(0, 'all'), "lang_lastvisit" => sprintf(_MD_LASTVISIT,formatTimestamp($last_visit)), "lang_currenttime" => sprintf(_MD_TIMENOW,formatTimestamp(time(),"m")), "lang_forum" => _MD_FORUM, "lang_topics" => _MD_TOPICS, "lang_posts" => _MD_POSTS, "lang_lastpost" => _MD_LASTPOST, "lang_moderators" => _MD_MODERATOR));
 
 $viewcat = (!empty($HTTP_GET_VARS['cat'])) ? intval($HTTP_GET_VARS['cat']) : 0;
 $categories = array();
 while ( $cat_row = $xoopsDB->fetchArray($result) ) {
-	$categories[] = $cat_row;
+    $categories[] = $cat_row;
 }
 
 $sql = 'SELECT f.*, u.uname, u.uid, p.topic_id, p.post_time, p.subject, p.icon FROM '.$xoopsDB->prefix('bb_forums').' f LEFT JOIN '.$xoopsDB->prefix('bb_posts').' p ON p.post_id = f.forum_last_post_id LEFT JOIN '.$xoopsDB->prefix('users').' u ON u.uid = p.uid';
 if ( $viewcat != 0 ) {
-	$sql .= ' WHERE f.cat_id = '.$viewcat;
-	$xoopsTpl->assign('forum_index_title', sprintf(_MD_FORUMINDEX,$xoopsConfig['sitename']));
+    $sql .= ' WHERE f.cat_id = '.$viewcat;
+    $xoopsTpl->assign('forum_index_title', sprintf(_MD_FORUMINDEX,htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
 } else {
-	$xoopsTpl->assign('forum_index_title', '');
+    $xoopsTpl->assign('forum_index_title', '');
 }
 $sql .= ' ORDER BY f.cat_id, f.forum_id';
 if ( !$result = $xoopsDB->query($sql) ) {
-	exit("Error");
+    exit("Error");
 }
 $forums = array(); // RMV-FIX
 while ( $forum_data = $xoopsDB->fetchArray($result) ) {
-	$forums[] = $forum_data;
+    $forums[] = $forum_data;
 }
 $cat_count = count($categories);
 if ($cat_count > 0) {
-	for ( $i = 0; $i < $cat_count; $i++ ) {
-		$categories[$i]['cat_title'] = $myts->makeTboxData4Show($categories[$i]['cat_title']);
-		if ( $viewcat != 0 && $categories[$i]['cat_id'] != $viewcat ) {
-			$xoopsTpl->append("categories", $categories[$i]);
-			continue;
-		}
-		$topic_lastread = newbb_get_topics_viewed();
-		foreach ( $forums as $forum_row ) {
-			unset($last_post);
-			if ( $forum_row['cat_id'] == $categories[$i]['cat_id'] ) {
-				if ($forum_row['post_time']) {
-					//$forum_row['subject'] = $myts->makeTboxData4Show($forum_row['subject']);
-					$categories[$i]['forums']['forum_lastpost_time'][] = formatTimestamp($forum_row['post_time']);
-					$last_post_icon = '<a href="'.XOOPS_URL.'/modules/newbb/viewtopic.php?post_id='.$forum_row['forum_last_post_id'].'&amp;topic_id='.$forum_row['topic_id'].'&amp;forum='.$forum_row['forum_id'].'#forumpost'.$forum_row['forum_last_post_id'].'">';
-					if ( $forum_row['icon'] ) {
-						$last_post_icon .= '<img src="'.XOOPS_URL.'/images/subject/'.$forum_row['icon'].'" border="0" alt="" />';
-					} else {
-						$last_post_icon .= '<img src="'.XOOPS_URL.'/images/subject/icon1.gif" width="15" height="15" border="0" alt="" />';
-					}
-					$last_post_icon .= '</a>';
-					$categories[$i]['forums']['forum_lastpost_icon'][] = $last_post_icon;
-					if ( $forum_row['uid'] != 0 && $forum_row['uname'] ){
-						$categories[$i]['forums']['forum_lastpost_user'][] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$forum_row['uid'].'">' . $myts->makeTboxData4Show($forum_row['uname']).'</a>';
-					} else {
-						$categories[$i]['forums']['forum_lastpost_user'][] = $xoopsConfig['anonymous'];
-					}
-					$forum_lastread = !empty($topic_lastread[$forum_row['topic_id']]) ? $topic_lastread[$forum_row['topic_id']] : false;
-					if ( $forum_row['forum_type'] == 1 ) {
-						$categories[$i]['forums']['forum_folder'][] = $bbImage['locked_forum'];
-					} elseif ( $forum_row['post_time'] > $forum_lastread && !empty($forum_row['topic_id'])) {
-						$categories[$i]['forums']['forum_folder'][] = $bbImage['newposts_forum'];
-					} else {
-						$categories[$i]['forums']['forum_folder'][] = $bbImage['folder_forum'];
-					}
-				} else {
-					// no forums, so put empty values
-					$categories[$i]['forums']['forum_lastpost_time'][] = "";
-					$categories[$i]['forums']['forum_lastpost_icon'][] = "";
-					$categories[$i]['forums']['forum_lastpost_user'][] = "";
-					if ( $forum_row['forum_type'] == 1 ) {
-						$categories[$i]['forums']['forum_folder'][] = $bbImage['locked_forum'];
-					} else {
-						$categories[$i]['forums']['forum_folder'][] = $bbImage['folder_forum'];
-					}
-				}
-				$categories[$i]['forums']['forum_id'][] = $forum_row['forum_id'];
-				$categories[$i]['forums']['forum_name'][] = $myts->makeTboxData4Show($forum_row['forum_name']);
-				$categories[$i]['forums']['forum_desc'][] = $myts->makeTareaData4Show($forum_row['forum_desc']);
-				$categories[$i]['forums']['forum_topics'][] = $forum_row['forum_topics'];
-				$categories[$i]['forums']['forum_posts'][] = $forum_row['forum_posts'];
-	 			$all_moderators = get_moderators($forum_row['forum_id']);
-	 			$count = 0;
-				$forum_moderators = '';
-				foreach ( $all_moderators as $mods) {
-					foreach ( $mods as $mod_id => $mod_name) {
-						if ( $count > 0 ) {
-							$forum_moderators .= ', ';
-						}
-						$forum_moderators .= '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$mod_id.'">'.$myts->makeTboxData4Show($mod_name).'</a>';
-						$count = 1;
-					}
-				}
-				$categories[$i]['forums']['forum_moderators'][] = $forum_moderators;
-			}
-		}
-		$xoopsTpl->append("categories", $categories[$i]);
-	}
+    for ( $i = 0; $i < $cat_count; $i++ ) {
+        $categories[$i]['cat_title'] = $myts->makeTboxData4Show($categories[$i]['cat_title']);
+        if ( $viewcat != 0 && $categories[$i]['cat_id'] != $viewcat ) {
+            $xoopsTpl->append("categories", $categories[$i]);
+            continue;
+        }
+        $topic_lastread = newbb_get_topics_viewed();
+        foreach ( $forums as $forum_row ) {
+            unset($last_post);
+            if ( $forum_row['cat_id'] == $categories[$i]['cat_id'] ) {
+                if ($forum_row['post_time']) {
+                    //$forum_row['subject'] = $myts->makeTboxData4Show($forum_row['subject']);
+                    $categories[$i]['forums']['forum_lastpost_time'][] = formatTimestamp($forum_row['post_time']);
+                    $last_post_icon = '<a href="'.XOOPS_URL.'/modules/newbb/viewtopic.php?post_id='.$forum_row['forum_last_post_id'].'&amp;topic_id='.$forum_row['topic_id'].'&amp;forum='.$forum_row['forum_id'].'#forumpost'.$forum_row['forum_last_post_id'].'">';
+                    if ( $forum_row['icon'] ) {
+                        $last_post_icon .= '<img src="'.XOOPS_URL.'/images/subject/'.$forum_row['icon'].'" border="0" alt="" />';
+                    } else {
+                        $last_post_icon .= '<img src="'.XOOPS_URL.'/images/subject/icon1.gif" width="15" height="15" border="0" alt="" />';
+                    }
+                    $last_post_icon .= '</a>';
+                    $categories[$i]['forums']['forum_lastpost_icon'][] = $last_post_icon;
+                    if ( $forum_row['uid'] != 0 && $forum_row['uname'] ){
+                        $categories[$i]['forums']['forum_lastpost_user'][] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$forum_row['uid'].'">' . $myts->makeTboxData4Show($forum_row['uname']).'</a>';
+                    } else {
+                        $categories[$i]['forums']['forum_lastpost_user'][] = $xoopsConfig['anonymous'];
+                    }
+                    $forum_lastread = !empty($topic_lastread[$forum_row['topic_id']]) ? $topic_lastread[$forum_row['topic_id']] : false;
+                    if ( $forum_row['forum_type'] == 1 ) {
+                        $categories[$i]['forums']['forum_folder'][] = $bbImage['locked_forum'];
+                    } elseif ( $forum_row['post_time'] > $forum_lastread && !empty($forum_row['topic_id'])) {
+                        $categories[$i]['forums']['forum_folder'][] = $bbImage['newposts_forum'];
+                    } else {
+                        $categories[$i]['forums']['forum_folder'][] = $bbImage['folder_forum'];
+                    }
+                } else {
+                    // no forums, so put empty values
+                    $categories[$i]['forums']['forum_lastpost_time'][] = "";
+                    $categories[$i]['forums']['forum_lastpost_icon'][] = "";
+                    $categories[$i]['forums']['forum_lastpost_user'][] = "";
+                    if ( $forum_row['forum_type'] == 1 ) {
+                        $categories[$i]['forums']['forum_folder'][] = $bbImage['locked_forum'];
+                    } else {
+                        $categories[$i]['forums']['forum_folder'][] = $bbImage['folder_forum'];
+                    }
+                }
+                $categories[$i]['forums']['forum_id'][] = $forum_row['forum_id'];
+                $categories[$i]['forums']['forum_name'][] = $myts->makeTboxData4Show($forum_row['forum_name']);
+                $categories[$i]['forums']['forum_desc'][] = $myts->makeTareaData4Show($forum_row['forum_desc']);
+                $categories[$i]['forums']['forum_topics'][] = $forum_row['forum_topics'];
+                $categories[$i]['forums']['forum_posts'][] = $forum_row['forum_posts'];
+                $all_moderators = get_moderators($forum_row['forum_id']);
+                $count = 0;
+                $forum_moderators = '';
+                foreach ( $all_moderators as $mods) {
+                    foreach ( $mods as $mod_id => $mod_name) {
+                        if ( $count > 0 ) {
+                            $forum_moderators .= ', ';
+                        }
+                        $forum_moderators .= '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$mod_id.'">'.$myts->makeTboxData4Show($mod_name).'</a>';
+                        $count = 1;
+                    }
+                }
+                $categories[$i]['forums']['forum_moderators'][] = $forum_moderators;
+            }
+        }
+        $xoopsTpl->append("categories", $categories[$i]);
+    }
 } else {
-	$xoopsTpl->append("categories", array());
+    $xoopsTpl->append("categories", array());
 }
 $xoopsTpl->assign(array("img_hotfolder" => $bbImage['newposts_forum'], "img_folder" => $bbImage['folder_forum'], "img_locked" => $bbImage['locked_forum'], "lang_newposts" => _MD_NEWPOSTS, "lang_private" => _MD_PRIVATEFORUM, "lang_nonewposts" => _MD_NONEWPOSTS, "lang_search" => _MD_SEARCH, "lang_advsearch" => _MD_ADVSEARCH));
 include_once XOOPS_ROOT_PATH.'/footer.php';


xoops-cvslog メーリングリストの案内
Back to archive index