Changeset 1284


Ignore:
Timestamp:
2007/01/22 13:43:29 (17 years ago)
Author:
kakinaka
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • temp/test-xoops.ec-cube.net/html/modules/newbb/response.php

    r1283 r1284  
    77$xoopsOption['template_main_path'] = XOOPS_ROOT_PATH . '/modules/newbb/templates/newbb_response.html'; 
    88include XOOPS_ROOT_PATH."/header.php"; 
    9  
    10 /* 
    11 $forum = intval($_GET['forum']); 
    12 if ( $forum < 1 ) { 
    13     redirect_header("index.php", 2, _MD_ERRORFORUM); 
    14     exit(); 
    15 } 
    16 $sql = 'SELECT forum_type, forum_name, forum_access, allow_html, allow_sig, posts_per_page, hot_threshold, topics_per_page FROM '.$xoopsDB->prefix('bb_forums').' WHERE forum_id = '.$forum; 
    17 if ( !$result = $xoopsDB->query($sql) ) { 
    18     redirect_header("index.php", 2, _MD_ERRORCONNECT); 
    19     exit(); 
    20 } 
    21 if ( !$forumdata = $xoopsDB->fetchArray($result) ) { 
    22     redirect_header("index.php", 2, _MD_ERROREXIST); 
    23     exit(); 
    24 } 
    25 */ 
    26  
    27  
    28 /* 
    29 $can_post = 0; 
    30 $show_reg = 0; 
    31 if ( $forumdata['forum_type'] == 1 ) { 
    32     // this is a private forum. 
    33     $xoopsTpl->assign('is_private_forum', true); 
    34     $accesserror = 0; 
    35     if ( $xoopsUser ) { 
    36         if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) { 
    37             if ( !check_priv_forum_auth($xoopsUser->getVar("uid"), $forum, false) ) { 
    38                 $accesserror = 1; 
    39             } 
    40         } 
    41     } else { 
    42         $accesserror = 1; 
    43     } 
    44     if ( $accesserror == 1 ) { 
    45         redirect_header("index.php",2,_MD_NORIGHTTOACCESS); 
    46         exit(); 
    47     } 
    48     $can_post = 1; 
    49     $show_reg = 1; 
    50 } else { 
    51     // this is not a priv forum 
    52     $xoopsTpl->assign('is_private_forum', false); 
    53     if ( $forumdata['forum_access'] == 1 ) { 
    54         // this is a reg user only forum 
    55         if ( $xoopsUser ) { 
    56             $can_post = 1; 
    57         } else { 
    58             $show_reg = 1; 
    59         } 
    60     } elseif ( $forumdata['forum_access'] == 2 ) { 
    61         // this is an open forum 
    62         $can_post = 1; 
    63     } else { 
    64         // this is an admin/moderator only forum 
    65         if ( $xoopsUser ) { 
    66             if ( $xoopsUserIsAdmin || is_moderator($forum, $xoopsUser->uid()) ) { 
    67                 $can_post = 1; 
    68             } 
    69         } 
    70     } 
    71 } 
    72 $xoopsTpl->assign("forum_id", $forum); 
    73  
    74 if ( $can_post == 1 ) { 
    75     $xoopsTpl->assign('viewer_can_post', true); 
    76     $xoopsTpl->assign('forum_post_or_register', "newtopic.php?forum=".$forum); 
    77 } else { 
    78     $xoopsTpl->assign('viewer_can_post', false); 
    79     if ( $show_reg == 1 ) { 
    80         $xoopsTpl->assign('forum_post_or_register', XOOPS_URL.'/user.php?xoops_redirect='.htmlspecialchars($xoopsRequestUri)); 
    81     } else { 
    82         $xoopsTpl->assign('forum_post_or_register', ""); 
    83     } 
    84 } 
    85 */ 
    86 /* 
    87 $xoopsTpl->assign('forum_index_title', sprintf(_MD_FORUMINDEX,$xoopsConfig['sitename'])); 
    88 $xoopsTpl->assign('forum_image_folder', $bbImage['folder_topic']); 
    89 $myts =& MyTextSanitizer::getInstance(); 
    90 $xoopsTpl->assign('forum_name', $myts->makeTboxData4Show($forumdata['forum_name'])); 
    91 $xoopsTpl->assign('lang_moderatedby', _MD_MODERATEDBY); 
    92 */ 
    93 /* 
    94 $forum_moderators = ""; 
    95 $count = 0; 
    96 $moderators = get_moderators($forum); 
    97 foreach ( $moderators as $mods ) { 
    98     foreach ( $mods as $mod_id => $mod_name ) { 
    99         if ( $count > 0 ) { 
    100             $forum_moderators .= ", "; 
    101         } 
    102         $forum_moderators .=  '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$mod_id.'">'.$myts->makeTboxData4Show($mod_name).'</a>'; 
    103         $count = 1; 
    104     } 
    105 } 
    106 $xoopsTpl->assign('forum_moderators', $forum_moderators); 
    107  
    108 $sel_sort_array = array("t.topic_response"=>_MD_RESPONSE, "t.topic_title"=>_MD_TOPICTITLE, "t.topic_replies"=>_MD_NUMBERREPLIES, "u.uname"=>_MD_TOPICPOSTER, "t.topic_views"=>_MD_VIEWS, "p.post_time"=>_MD_LASTPOSTTIME); 
    109 if ( !isset($_GET['sortname']) || !in_array($_GET['sortname'], array_keys($sel_sort_array)) ) { 
    110     $sortname = "p.post_time"; 
    111 } else { 
    112     $sortname = $_GET['sortname']; 
    113 } 
    114  
    115 $xoopsTpl->assign('lang_sortby', _MD_SORTEDBY); 
    116  
    117 $forum_selection_sort = '<select name="sortname">'; 
    118 foreach ( $sel_sort_array as $sort_k => $sort_v ) { 
    119     $forum_selection_sort .= '<option value="'.$sort_k.'"'.(($sortname == $sort_k) ? ' selected="selected"' : '').'>'.$sort_v.'</option>'; 
    120 } 
    121 $forum_selection_sort .= '</select>'; 
    122  
    123 // assign to template 
    124 $xoopsTpl->assign('forum_selection_sort', $forum_selection_sort); 
    125  
    126 $sortorder = (!isset($_GET['sortorder']) || $_GET['sortorder'] != "ASC") ? "DESC" : "ASC"; 
    127 $forum_selection_order = '<select name="sortorder">'; 
    128 $forum_selection_order .= '<option value="ASC"'.(($sortorder == "ASC") ? ' selected="selected"' : '').'>'._MD_ASCENDING.'</option>'; 
    129 $forum_selection_order .= '<option value="DESC"'.(($sortorder == "DESC") ? ' selected="selected"' : '').'>'._MD_DESCENDING.'</option>'; 
    130 $forum_selection_order .= '</select>'; 
    131  
    132 // assign to template 
    133 $xoopsTpl->assign('forum_selection_order', $forum_selection_order); 
    134  
    135 $sortsince = !empty($_GET['sortsince']) ? intval($_GET['sortsince']) : 100; 
    136 $sel_since_array = array(1, 2, 5, 10, 20, 30, 40, 60, 75, 100); 
    137 $forum_selection_since = '<select name="sortsince">'; 
    138 foreach ($sel_since_array as $sort_since_v) { 
    139     $forum_selection_since .= '<option value="'.$sort_since_v.'"'.(($sortsince == $sort_since_v) ? ' selected="selected"' : '').'>'.sprintf(_MD_FROMLASTDAYS,$sort_since_v).'</option>'; 
    140 } 
    141 $forum_selection_since .= '<option value="365"'.(($sortsince == 365) ? ' selected="selected"' : '').'>'.sprintf(_MD_THELASTYEAR,365).'</option>'; 
    142 $forum_selection_since .= '<option value="1000"'.(($sortsince == 1000) ? ' selected="selected"' : '').'>'.sprintf(_MD_BEGINNING,1000).'</option>'; 
    143 $forum_selection_since .= '</select>'; 
    144  
    145 // assign to template 
    146 $xoopsTpl->assign('forum_selection_since', $forum_selection_since); 
    147 $xoopsTpl->assign('lang_go', _MD_GO); 
    148  
    149 $xoopsTpl->assign('h_topic_link', "viewforum.php?forum=$forum&amp;sortname=t.topic_title&amp;sortsince=$sortsince&amp;sortorder=". (($sortname == "t.topic_title" && $sortorder == "DESC") ? "ASC" : "DESC")); 
    150 $xoopsTpl->assign('lang_topic', _MD_TOPIC); 
    151  
    152 // Âбþ¾õ¶· 
    153 $xoopsTpl->assign('h_reply_response', "viewforum.php?forum=$forum&amp;sortname=t.topic_response&amp;sortsince=$sortsince&amp;sortorder=". (($sortname == "t.topic_response" && $sortorder == "DESC") ? "ASC" : "DESC")); 
    154 $xoopsTpl->assign('lang_response', _MD_RESPONSE); 
    155  
    156 $xoopsTpl->assign('h_reply_link', "viewforum.php?forum=$forum&amp;sortname=t.topic_replies&amp;sortsince=$sortsince&amp;sortorder=". (($sortname == "t.topic_replies" && $sortorder == "DESC") ? "ASC" : "DESC")); 
    157 $xoopsTpl->assign('lang_replies', _MD_REPLIES); 
    158  
    159 $xoopsTpl->assign('h_poster_link', "viewforum.php?forum=$forum&amp;sortname=u.uname&amp;sortsince=$sortsince&amp;sortorder=". (($sortname == "u.uname" && $sortorder == "DESC") ? "ASC" : "DESC")); 
    160 $xoopsTpl->assign('lang_poster', _MD_POSTER); 
    161  
    162 $xoopsTpl->assign('h_views_link', "viewforum.php?forum=$forum&amp;sortname=t.topic_views&amp;sortsince=$sortsince&amp;sortorder=". (($sortname == "t.topic_views" && $sortorder == "DESC") ? "ASC" : "DESC")); 
    163 $xoopsTpl->assign('lang_views', _MD_VIEWS); 
    164  
    165 $xoopsTpl->assign('h_date_link', "viewforum.php?forum=$forum&amp;sortname=p.post_time&amp;sortsince=$sortsince&amp;sortorder=". (($sortname == "p.post_time" && $sortorder == "DESC") ? "ASC" : "DESC")); 
    166 $xoopsTpl->assign('lang_date', _MD_DATE); 
    167  
    168 $startdate = time() - (86400* $sortsince); 
    169 $start = !empty($_GET['start']) ? intval($_GET['start']) : 0; 
    170 */ 
    171  
    1729 
    17310$xoopsTpl->assign('lang_topic', _MD_TOPIC); 
     
    20946$xoopsTpl->assign('arrResponse', $arrResponse); 
    21047 
    211 /* 
    212 // ¥æ¡¼¥¶¡¼¾ðÊó¼èÆÀ 
    213 $member_handler =& xoops_gethandler('member'); 
    214 $xoopsUserIsAdmin = false; 
    215 $user_id = ""; 
    216 $user_name = ""; 
    217 if (!empty($_SESSION['xoopsUserId'])) { 
    218      $xoopsUser =& $member_handler->getUser($_SESSION['xoopsUserId']); 
    219     if (is_object($xoopsUser)) { 
    220         $xoopsUserIsAdmin = $xoopsUser->isAdmin(); 
    221     } 
    222     $user_id = $_SESSION['xoopsUserId']; 
    223     $user_name = $xoopsUser->uname(); 
    224 } 
    225  
    226 //sfprintr($xoopsUser->uname()); 
    227  
    228 // Âбþ¾õ¶·¹¹¿·¤¹¤ë 
    229 //if($_GET['mode'] == 'response' and $xoopsUserIsAdmin and is_numeric($_GET['topic_id'])){ 
    230 if($_GET['mode'] == 'response' and is_numeric($_GET['topic_id'])){ 
    231     $sql = 'UPDATE '.$xoopsDB->prefix("bb_topics").' SET topic_response = '.$_GET["response_".$_GET['topic_id']]; 
    232     if($user_id != ""){ 
    233         $sql .= ', topic_response_uid = '.$user_id; 
    234     }else{ 
    235         $sql .= ', topic_response_uid = NULL'; 
    236     } 
    237     $sql .= ' WHERE topic_id = '.$_GET['topic_id']; 
    238  
    239     if ( !$xoopsDB->queryF($sql)) { 
    240         redirect_header('index.php',2,_MD_ERROROCCURED); 
    241         exit(); 
    242     } 
    243     // ¥ê¥í¡¼¥É 
    244     header("Location: " . $_SERVER['PHP_SELF'] . "?forum=" . $_GET['forum'] . "&sortname=p.post_time&sortorder=DESC&sortsince=" . $_GET['sortsince'] . "&start=" . $_GET['start']); 
    245 } 
    246  
    247 $xoopsTpl->assign('xoopsUserIsAdmin', $xoopsUserIsAdmin); 
    248 */ 
    249 /* 
    250 $xoopsTpl->assign('lang_by', _MD_BY); 
    251  
    252 $xoopsTpl->assign('img_newposts', $bbImage['newposts_topic']); 
    253 $xoopsTpl->assign('img_hotnewposts', $bbImage['hot_newposts_topic']); 
    254 $xoopsTpl->assign('img_folder', $bbImage['folder_topic']); 
    255 $xoopsTpl->assign('img_hotfolder', $bbImage['hot_folder_topic']); 
    256 $xoopsTpl->assign('img_locked', $bbImage['locked_topic']); 
    257 $xoopsTpl->assign('img_sticky', $bbImage['folder_sticky']); 
    258 $xoopsTpl->assign('lang_newposts', _MD_NEWPOSTS); 
    259 $xoopsTpl->assign('lang_hotnewposts', _MD_MORETHAN); 
    260 $xoopsTpl->assign('lang_hotnonewposts', _MD_MORETHAN2); 
    261 $xoopsTpl->assign('lang_nonewposts', _MD_NONEWPOSTS); 
    262 $xoopsTpl->assign('lang_legend', _MD_LEGEND); 
    263 $xoopsTpl->assign('lang_topiclocked', _MD_TOPICLOCKED); 
    264 $xoopsTpl->assign('lang_topicsticky', _MD_TOPICSTICKY); 
    265 $xoopsTpl->assign("lang_search", _MD_SEARCH); 
    266 $xoopsTpl->assign("lang_advsearch", _MD_ADVSEARCH); 
    267  
    268 $sql = 'SELECT COUNT(*) FROM '.$xoopsDB->prefix('bb_topics').' WHERE forum_id = '.$forum.' AND (topic_time > '.$startdate.' OR topic_sticky = 1)'; 
    269 if ( !$r = $xoopsDB->query($sql) ) { 
    270     //redirect_header('index.php',2,_MD_ERROROCCURED); 
    271     //exit(); 
    272 } 
    273 list($all_topics) = $xoopsDB->fetchRow($r); 
    274 if ( $all_topics > $forumdata['topics_per_page'] ) { 
    275     include XOOPS_ROOT_PATH.'/class/pagenav.php'; 
    276     $nav = new XoopsPageNav($all_topics, $forumdata['topics_per_page'], $start, "start", 'forum='.$forum.'&amp;sortname='.$sortname.'&amp;sortorder='.$sortorder.'&amp;sortsince='.$sortsince); 
    277     $xoopsTpl->assign('forum_pagenav', $nav->renderNav(4)); 
    278 } else { 
    279     $xoopsTpl->assign('forum_pagenav', ''); 
    280 } 
    281  
    282 // ¥«¥Æ¥´¥ê̾¼èÆÀ 
    283 $sql = "SELECT c.cat_id, c.cat_title FROM ".$xoopsDB->prefix("bb_categories")." c, ".$xoopsDB->prefix("bb_forums")." f WHERE c.cat_id = f.cat_id AND forum_id = $forum"; 
    284  
    285 if ( !$result = $xoopsDB->query($sql) ) { 
    286     //redirect_header('index.php',2,_MD_ERROROCCURED); 
    287     //exit(); 
    288 } 
    289 $arrCat = $xoopsDB->fetchArray($result); 
    290 $xoopsTpl->assign('arrCat', $arrCat); 
    291  
    292 $xoopsTpl->assign('forum_jumpbox', make_jumpbox($forum)); 
    293 */ 
    29448include XOOPS_ROOT_PATH."/footer.php"; 
    29549?> 
Note: See TracChangeset for help on using the changeset viewer.