Go to the source code of this file.
Functions | |
| news_new_subbox ($row) | |
| news_show_latest ($group_id, $limit=10, $show_summaries="true", $start_from="no") | |
| news_total_number ($group_id) | |
| get_news_name ($id) | |
|
|
Definition at line 177 of file news/general.php. References $result, $sql, db_numrows(), db_query(), db_result, and summary. 00178 { 00179 /* 00180 Takes an ID and returns the corresponding forum name 00181 */ 00182 $sql="SELECT summary FROM news_bytes WHERE id='$id'"; 00183 $result=db_query($sql); 00184 if (!$result || db_numrows($result) < 1) 00185 { 00186 return _("Not found"); 00187 } 00188 else 00189 { 00190 return db_result($result, 0, 'summary'); 00191 } 00192 }
|
|
|
Definition at line 26 of file news/general.php. References $row. Referenced by news_show_latest(). 00027 { 00028 return $row > 1 ? '</div><div class="'.utils_get_alt_row_color($row).'">' : ''; 00029 }
|
|
||||||||||||||||||||
|
Definition at line 31 of file news/general.php. References $GLOBALS, $group_id, $result, $return, $rows, $sql, db_numrows(), db_query(), db_result, format_date(), group_id, nbsp, news_new_subbox(), news_total_number(), and summary. Referenced by forum_header(). 00032 { 00033 global $sys_datefmt; 00034 /* 00035 Show a simple list of the latest news items with a link to the forum 00036 */ 00037 if (!isset($group_id)) 00038 { 00039 $group_id = $GLOBALS['sys_group_id']; 00040 } 00041 00042 # We want the total number of news 00043 $news_total=news_total_number($group_id); 00044 00045 # We fetch news item for that group 00046 if ($group_id != $GLOBALS['sys_group_id']) 00047 { 00048 $wclause="news_bytes.group_id='$group_id' AND news_bytes.is_approved <> 4 AND news_bytes.is_approved <> 5"; 00049 } 00050 else 00051 { 00052 $wclause='news_bytes.is_approved=1'; 00053 } 00054 00055 $sql="SELECT groups.group_name,groups.unix_group_name,user.user_name,news_bytes.forum_id,news_bytes.summary,news_bytes.date,news_bytes.details ". 00056 "FROM user,news_bytes,groups ". 00057 "WHERE $wclause ". 00058 "AND user.user_id=news_bytes.submitted_by ". 00059 "AND news_bytes.group_id=groups.group_id ". 00060 "ORDER BY date DESC"; 00061 00062 $sql .= " LIMIT "; 00063 00064 if ($start_from != 0 && $start_from != "no" && $start_from != "nolinks") 00065 { 00066 $sql .= "$start_from,$news_total"; 00067 } 00068 else 00069 { 00070 $sql .= "$limit"; 00071 } 00072 00073 $result=db_query($sql); 00074 $rows=db_numrows($result); 00075 00076 if (!$result || $rows < 1) 00077 { 00078 $return .= news_new_subbox(0).'<h3>'._("No news items found").'</h3>'; 00079 } 00080 else 00081 { 00082 for ($i=0; $i<$rows; $i++) 00083 { 00084 # We want the number of message in this forum 00085 $tres_count = db_query("SELECT group_forum_id FROM forum WHERE group_forum_id='". db_result($result,$i,'forum_id') ."'"); 00086 $trow_count = db_numrows($tres_count); 00087 if ($show_summaries != "false") 00088 { 00089 # Get the story 00090 $story = rtrim(db_result($result,$i,'details')); 00091 00092 # if the news item is large (>500), only show the first 00093 # 250 characters of the story 00094 # Fixes bug #1934 -- toddy 2005-02-11 00095 if (strlen($story) > 500) 00096 { 00097 # create an abstract with a [read more] link 00098 $summ_txt = substr($story, 0, 250); 00099 $summ_txt = substr($summ_txt, 0, strrpos($summ_txt, ' ')); 00100 $summ_txt .= "..."; 00101 $summ_txt = utils_full_markup($summ_txt); 00102 $summ_txt .= sprintf(_("%s[Read more]%s"), '<p><a href="'.$GLOBALS['sys_home'].'forum/forum.php?forum_id='.db_result($result,$i,'forum_id').'">', '</a></p>'); 00103 } 00104 else 00105 { 00106 # this is a short news item. just display it. 00107 $summ_txt = utils_full_markup($story); 00108 } 00109 $proj_name = db_result($result,$i,'group_name'); 00110 } 00111 else 00112 { 00113 $proj_name=''; 00114 $summ_txt=''; 00115 } 00116 $reply = sprintf(ngettext("%s reply", "%s replies", $trow_count), $trow_count); 00117 00118 $return .= 00119 news_new_subbox($i+1) 00120 .'<p><a href="'.$GLOBALS['sys_home'].'forum/forum.php?forum_id=' 00121 .db_result($result,$i,'forum_id').'"><strong>' 00122 .db_result($result,$i,'summary').'</strong></a>'; 00123 if ($show_summaries != "false") 00124 { $return .= '<br /> '; } 00125 $return .= ' <span class="smaller"><em>'._("posted by").' <a href="' 00126 .$GLOBALS['sys_home'].'users/'. db_result($result,$i,'user_name') .'">'. db_result($result,$i,'user_name') 00127 .'</a>, '. format_date($sys_datefmt,db_result($result,$i,'date')) .' - ' 00128 .$reply.'</em></span></p>' 00129 .$summ_txt; 00130 00131 } 00132 } 00133 00134 if ($start_from != "nolinks") 00135 { 00136 00137 # No link is a trick to skip archives + submit news links 00138 00139 if ($group_id != $GLOBALS['sys_group_id']) 00140 { 00141 # You can only submit news from a project now. 00142 # You used to be able to submit general news. 00143 $return .= news_new_subbox($i) 00144 .'<br /> <a href="'.$GLOBALS['sys_home'].'news/submit.php?group_id=' 00145 .$group_id.'"><span class="smaller">['._("Submit News").']</span></a>'; 00146 } 00147 00148 $return .= news_new_subbox($i) 00149 .'<br /> <a href="'.$GLOBALS['sys_home'].'news/?group_id='.$group_id.'"><span class="smaller">[' 00150 .sprintf(ngettext("%d news in archive", "%d news in archive", $news_total), $news_total) 00151 .']</span></a>'; 00152 } 00153 00154 return $return; 00155 }
|
|
|
Definition at line 158 of file news/general.php. References $sql, db_query(), db_result, and group_id. Referenced by news_show_latest(). 00159 { 00160 # We want the total number of news for a group 00161 if ($group_id != $GLOBALS['sys_group_id']) 00162 { 00163 $wclause="news_bytes.group_id='$group_id' AND news_bytes.is_approved <> 4 AND news_bytes.is_approved <> 5"; 00164 } 00165 else 00166 { 00167 $wclause='news_bytes.is_approved=1'; 00168 } 00169 $sql="SELECT count(*) FROM user,news_bytes,groups ". 00170 "WHERE $wclause ". 00171 "AND user.user_id=news_bytes.submitted_by ". 00172 "AND news_bytes.group_id=groups.group_id "; 00173 return db_result(db_query($sql),0,0); 00174 }
|
1.4.4