[ Index ] |
|
Code source de PHP NUKE 7.9 |
1 <?php 2 3 /************************************************************************/ 4 /* PHP-NUKE: Web Portal System */ 5 /* =========================== */ 6 /* */ 7 /* Copyright (c) 2005 by Francisco Burzi */ 8 /* http://phpnuke.org */ 9 /* */ 10 /* This program is free software. You can redistribute it and/or modify */ 11 /* it under the terms of the GNU General Public License as published by */ 12 /* the Free Software Foundation; either version 2 of the License. */ 13 /************************************************************************/ 14 15 if (!defined('MODULE_FILE')) { 16 die ("You can't access this file directly..."); 17 } 18 require_once ("mainfile.php"); 19 $optionbox = ""; 20 $module_name = basename(dirname(__FILE__)); 21 get_lang($module_name); 22 23 if (isset($sid)) { $sid = intval($sid); } else { $sid = ""; } 24 if (stristr($REQUEST_URI,"mainfile")) { 25 Header("Location: modules.php?name=$module_name&file=article&sid=$sid"); 26 } elseif (empty($sid) && !isset($tid)) { 27 Header("Location: index.php"); 28 } 29 30 if ($save AND is_user($user)) { 31 cookiedecode($user); 32 getusrinfo($user); 33 if(!isset($mode)) { $mode = $userinfo['umode']; } 34 if(!isset($order)) { $order = $userinfo['uorder']; } 35 if(!isset($thold)) { $thold = $userinfo['thold']; } 36 $db->sql_query("UPDATE ".$user_prefix."_users SET umode='$mode', uorder='$order', thold='$thold' where uid='$cookie[0]'"); 37 getusrinfo($user); 38 $info = base64_encode("$userinfo[user_id]:$userinfo[username]:$userinfo[user_password]:$userinfo[storynum]:$userinfo[umode]:$userinfo[uorder]:$userinfo[thold]:$userinfo[noscore]"); 39 setcookie("user","$info",time()+$cookieusrtime); 40 } 41 42 if ($op == "Reply") { 43 $display = ""; 44 if(isset($mode)) { $display .= "&mode=".$mode; } 45 if(isset($order)) { $display .= "&order=".$order; } 46 if(isset($thold)) { $display .= "&thold=".$thold; } 47 Header("Location: modules.php?name=$module_name&file=comments&op=Reply&pid=0&sid=".$sid.$display); 48 } 49 50 $result = $db->sql_query("select catid, aid, time, title, hometext, bodytext, topic, informant, notes, acomm, haspoll, pollID, score, ratings FROM ".$prefix."_stories where sid='$sid'"); 51 if ($numrows = $db->sql_numrows($result) != 1) { 52 Header("Location: index.php"); 53 die(); 54 } 55 $row = $db->sql_fetchrow($result); 56 $catid = intval($row['catid']); 57 $aaid = filter($row['aid'], "nohtml"); 58 $time = $row['time']; 59 $title = filter($row['title'], "nohtml"); 60 $hometext = filter($row['hometext']); 61 $bodytext = filter($row['bodytext']); 62 $topic = intval($row['topic']); 63 $informant = filter($row['informant'], "nohtml"); 64 $notes = filter($row['notes']); 65 $acomm = intval($row['acomm']); 66 $haspoll = intval($row['haspoll']); 67 $pollID = intval($row['pollID']); 68 $score = intval($row['score']); 69 $ratings = intval($row['ratings']); 70 71 if (empty($aaid)) { 72 Header("Location: modules.php?name=$module_name"); 73 } 74 75 $db->sql_query("UPDATE ".$prefix."_stories SET counter=counter+1 where sid='$sid'"); 76 77 $artpage = 1; 78 $pagetitle = "- $title"; 79 require ("header.php"); 80 $artpage = 0; 81 82 formatTimestamp($time); 83 $title = filter($title, "nohtml"); 84 $hometext = filter($hometext); 85 $bodytext = filter($bodytext); 86 $notes = filter($notes); 87 88 if (!empty($notes)) { 89 $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>"; 90 } else { 91 $notes = ""; 92 } 93 94 if(empty($bodytext)) { 95 $bodytext = "$hometext$notes"; 96 } else { 97 $bodytext = "$hometext<br><br>$bodytext$notes"; 98 } 99 100 if(empty($informant)) { 101 $informant = $anonymous; 102 } 103 104 getTopics($sid); 105 106 if ($catid != 0) { 107 $row2 = $db->sql_fetchrow($db->sql_query("select title from ".$prefix."_stories_cat where catid='$catid'")); 108 $title1 = filter($row2['title'], "nohtml"); 109 $title = "<a href=\"modules.php?name=$module_name&file=categories&op=newindex&catid=$catid\"><font class=\"storycat\">$title1</font></a>: $title"; 110 } 111 112 echo "<table width=\"100%\" border=\"0\"><tr><td valign=\"top\" width=\"100%\">\n"; 113 themearticle($aaid, $informant, $datetime, $title, $bodytext, $topic, $topicname, $topicimage, $topictext); 114 echo "</td><td> </td><td valign=\"top\">\n"; 115 116 if ($multilingual == 1) { 117 $querylang = "AND (blanguage='$currentlang' OR blanguage='')"; 118 } else { 119 $querylang = ""; 120 } 121 122 /* Determine if the article has attached a poll */ 123 if ($haspoll == 1) { 124 $url = sprintf("modules.php?name=Surveys&op=results&pollID=%d", $pollID); 125 $boxContent = "<form action=\"modules.php?name=Surveys\" method=\"post\">"; 126 $boxContent .= "<input type=\"hidden\" name=\"pollID\" value=\"".$pollID."\">"; 127 $row3 = $db->sql_fetchrow($db->sql_query("SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID='$pollID'")); 128 $pollTitle = filter($row3['pollTitle'], "nohtml"); 129 $voters = $row3['voters']; 130 $boxTitle = _ARTICLEPOLL; 131 $boxContent .= "<font class=\"content\"><b>$pollTitle</b></font><br><br>\n"; 132 $boxContent .= "<table border=\"0\" width=\"100%\">"; 133 for($i = 1; $i <= 12; $i++) { 134 $result4 = $db->sql_query("SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')"); 135 $row4 = $db->sql_fetchrow($result4); 136 $numrows = $db->sql_numrows($result4); 137 if($numrows != 0) { 138 $optionText = $row4['optionText']; 139 if(!empty($optionText)) { 140 $boxContent .= "<tr><td valign=\"top\"><input type=\"radio\" name=\"voteID\" value=\"".$i."\"></td><td width=\"100%\"><font class=\"content\">$optionText</font></td></tr>\n"; 141 } 142 } 143 } 144 $boxContent .= "</table><br><center><font class=\"content\"><input type=\"submit\" value=\""._VOTE."\"></font><br>"; 145 if (is_user($user)) { 146 cookiedecode($user); 147 } 148 for($i = 0; $i < 12; $i++) { 149 $row5 = $db->sql_fetchrow($db->sql_query("SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')")); 150 $optionCount = $row5['optionCount']; 151 $sum = (int)$sum+$optionCount; 152 } 153 $boxContent .= "<font class=\"content\">[ <a href=\"modules.php?name=Surveys&op=results&pollID=$pollID&mode=".$userinfo['umode']."&order=".$userinfo['uorder']."&thold=".$userinfo['thold']."\"><b>"._RESULTS."</b></a> | <a href=\"modules.php?name=Surveys\"><b>"._POLLS."</b></a> ]<br>"; 154 155 if ($pollcomm) { 156 $result6 = $db->sql_query("select * from ".$prefix."_pollcomments where pollID='$pollID'"); 157 $numcom = $db->sql_numrows($result6); 158 $boxContent .= "<br>"._VOTES.": <b>$sum</b><br>"._PCOMMENTS." <b>$numcom</b>\n\n"; 159 } else { 160 $boxContent .= "<br>"._VOTES." <b>$sum</b>\n\n"; 161 } 162 $boxContent .= "</font></center></form>\n\n"; 163 themesidebox($boxTitle, $boxContent); 164 } 165 166 $row7 = $db->sql_fetchrow($db->sql_query("select title, content, active, bposition from ".$prefix."_blocks where blockfile='block-Login.php' $querylang")); 167 $title = filter($row7['title'], "nohtml"); 168 $content = filter($row7['content']); 169 $active = intval($row7['active']); 170 $position = $row7['bposition']; 171 $position = substr("$position", 0,1); 172 if (($active == 1) AND ($position == "r") AND (!is_user($user))) { 173 loginbox(); 174 } 175 176 $boxtitle = ""._RELATED.""; 177 $boxstuff = "<font class=\"content\">"; 178 $result8 = $db->sql_query("select name, url from ".$prefix."_related where tid='$topic'"); 179 while ($row8 = $db->sql_fetchrow($result8)) { 180 $name = filter($row8['name'], "nohtml"); 181 $url = filter($row8['url'], "nohtml"); 182 $boxstuff .= "<strong><big>·</big></strong> <a href=\"$url\" target=\"new\">$name</a><br>\n"; 183 } 184 185 $boxstuff .= "<strong><big>·</big></strong> <a href=\"modules.php?name=Search&topic=$topic\">"._MOREABOUT." $topictext</a><br>\n"; 186 $boxstuff .= "<strong><big>·</big></strong> <a href=\"modules.php?name=Search&author=$aaid\">"._NEWSBY." $aaid</a>\n"; 187 $boxstuff .= "</font><br><hr noshade width=\"95%\" size=\"1\"><center><font class=\"content\"><b>"._MOSTREAD." $topictext:</b><br>\n"; 188 189 global $multilingual, $currentlang, $admin_file, $user; 190 if ($multilingual == 1) { 191 $querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */ 192 } else { 193 $querylang = ""; 194 } 195 $row9 = $db->sql_fetchrow($db->sql_query("select sid, title from ".$prefix."_stories where topic='$topic' $querylang order by counter desc limit 0,1")); 196 $topstory = intval($row9['sid']); 197 $ttitle = filter($row9['title'], "nohtml"); 198 199 $boxstuff .= "<a href=\"modules.php?name=$module_name&file=article&sid=$topstory\">$ttitle</a></font></center><br>\n"; 200 themesidebox($boxtitle, $boxstuff); 201 202 if ($ratings != 0) { 203 $rate = substr($score / $ratings, 0, 4); 204 $r_image = round($rate); 205 if ($r_image == 1) { 206 $the_image = "<br><br><img src=\"images/articles/stars-1.gif\" border=\"1\"></center><br>"; 207 } elseif ($r_image == 2) { 208 $the_image = "<br><br><img src=\"images/articles/stars-2.gif\" border=\"1\"></center><br>"; 209 } elseif ($r_image == 3) { 210 $the_image = "<br><br><img src=\"images/articles/stars-3.gif\" border=\"1\"></center><br>"; 211 } elseif ($r_image == 4) { 212 $the_image = "<br><br><img src=\"images/articles/stars-4.gif\" border=\"1\"></center><br>"; 213 } elseif ($r_image == 5) { 214 $the_image = "<br><br><img src=\"images/articles/stars-5.gif\" border=\"1\"></center><br>"; 215 } 216 } else { 217 $rate = 0; 218 $the_image = "</center><br>"; 219 } 220 221 $ratetitle = ""._RATEARTICLE.""; 222 $ratecontent = "<center>"._AVERAGESCORE.": <b>$rate</b><br>"._VOTES.": <b>$ratings</b>$the_image"; 223 $ratecontent .= "<form action=\"modules.php?name=$module_name\" method=\"post\"><center>"._RATETHISARTICLE."</center><br>"; 224 $ratecontent .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\">"; 225 $ratecontent .= "<input type=\"hidden\" name=\"op\" value=\"rate_article\">"; 226 $ratecontent .= "<input type=\"radio\" name=\"score\" value=\"5\"> <img src=\"images/articles/stars-5.gif\" border=\"0\" alt=\""._EXCELLENT."\" title=\""._EXCELLENT."\"><br>"; 227 $ratecontent .= "<input type=\"radio\" name=\"score\" value=\"4\"> <img src=\"images/articles/stars-4.gif\" border=\"0\" alt=\""._VERYGOOD."\" title=\""._VERYGOOD."\"><br>"; 228 $ratecontent .= "<input type=\"radio\" name=\"score\" value=\"3\"> <img src=\"images/articles/stars-3.gif\" border=\"0\" alt=\""._GOOD."\" title=\""._GOOD."\"><br>"; 229 $ratecontent .= "<input type=\"radio\" name=\"score\" value=\"2\"> <img src=\"images/articles/stars-2.gif\" border=\"0\" alt=\""._REGULAR."\" title=\""._REGULAR."\"><br>"; 230 $ratecontent .= "<input type=\"radio\" name=\"score\" value=\"1\"> <img src=\"images/articles/stars-1.gif\" border=\"0\" alt=\""._BAD."\" title=\""._BAD."\"><br><br>"; 231 $ratecontent .= "<center><input type=\"submit\" value=\""._CASTMYVOTE."\"></center></form>"; 232 themesidebox($ratetitle, $ratecontent); 233 $optiontitle = ""._OPTIONS.""; 234 $optionbox = "<br>"; 235 $optionbox .= " <img src='images/print.gif' border='0' alt='"._PRINTER."' title='"._PRINTER."'> <a href=\"modules.php?name=$module_name&file=print&sid=$sid\">"._PRINTER."</a><br><br>"; 236 if (is_user($user)) { 237 $optionbox .= " <img src='images/friend.gif' border='0' alt='"._FRIEND."' title='"._FRIEND."'> <a href=\"modules.php?name=$module_name&file=friend&op=FriendSend&sid=$sid\">"._FRIEND."</a><br><br>"; 238 } 239 $optionbox .= "</center>\n"; 240 if (is_admin($admin)) { 241 $optionbox .= "<center><b>"._ADMIN."</b><br><a href=\"".$admin_file.".php?op=adminStory\"><img src=\"images/add.gif\" alt=\""._ADD."\" title=\""._ADD."\" border=\"0\" width=\"17\" height=\"17\"></a> <a href=\"".$admin_file.".php?op=EditStory&sid=$sid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\"></a> <a href=\"".$admin_file.".php?op=RemoveStory&sid=$sid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\"></a><br><br></center>"; 242 } 243 themesidebox($optiontitle, $optionbox); 244 245 echo "</td></tr></table>\n"; 246 cookiedecode($user); 247 248 include("modules/$module_name/associates.php"); 249 250 if (((empty($mode) OR ($mode != "nocomments")) OR ($acomm == 0)) OR ($articlecomm == 1)) { 251 include ("modules/News/comments.php"); 252 } 253 include ("footer.php"); 254 255 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 11:11:59 2007 | par Balluche grâce à PHPXref 0.7 |