1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
| <?php if (!defined('BLOCK_FILE')) { Header("Location: ../index.php"); exit; }
## © Serg_pnz ## e-mail: print58@yandex.ru
/*-------------- íàñòðàèâàåìûå ïàðàìåòðû --------------*/ $content .= "<div style=\"OVERFLOW: auto; HEIGHT: 300px;\">"; $strip = 40; #îáðåçêà òåêñòà êîììåíòàðèÿ $limit = 10; #êîëè÷åñòâî êîììåíòàðèåâ (òåì) $raz_tag = "<b><i><u>"; #ðàçðåøåííûå òåãè â êîììåíòàðèè. Íàáèðàòü ÁÅÇ ÏÐÎÁÅËΠìåæäó òåãàìè!
/*-------------- êîíåö íàñòðàèâàåìûå ïàðàìåòðû --------------*/
global $prefix, $db;
$result = $db->sql_query("SELECT MAX(id) AS maxid, modul, cid FROM ".$prefix."_comment GROUP BY modul, cid ORDER BY maxid DESC LIMIT $limit "); while (list($maxid, $modul, $cid) = $db->sql_fetchrow($result)) { $mmaxid[] = $maxid;
switch($modul) { case "Voting": $mVoting[] = "$cid"; break;
case "News": $mNews[] = "$cid"; break; case "Files": $mFiles[] = "$cid"; break;
case "Pages": $mPages[] = "$cid"; break; case "Media": $mMedia[] = "$cid"; break; case "Games": $mGames[] = "$cid"; break; case "Links": $mLinks[] = "$cid"; break; case "FAQ": $mFAQ[] = "$cid"; break; case "Album": $mAlbum[] = "$cid"; break; } }
//--------- News $const = sizeof ($mNews); if ($const>0) { $sql = " SELECT lid, title FROM ".$prefix."_stories WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " lid='".$mNews[$i]."' OR "; } $sql .= " lid='".$mNews[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtNews[$sid] = $title; }
//--------- Voting $const = sizeof ($mVoting); if ($const>0) { $sql = " SELECT poll_id, poll_title FROM ".$prefix."_survey WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " poll_id='".$mVoting[$i]."' OR "; } $sql .= " poll_id='".$mVoting[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtVoting[$sid] = $title; }
//--------- Files $const = sizeof ($mFiles); if ($const>0) { $sql = " SELECT lid, title FROM ".$prefix."_files WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " lid='".$mFiles[$i]."' OR "; } $sql .= " lid='".$mFiles[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtFiles[$sid] = $title; }
//--------- Pages $const = sizeof ($mPages); if ($const>0) { $sql = " SELECT pid, title FROM ".$prefix."_pages WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " pid='".$mPages[$i]."' OR "; } $sql .= " pid='".$mPages[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtPages[$sid] = $title; }
//--------- Media $const = sizeof ($mMedia); if ($const>0) { $sql = " SELECT lid, title FROM ".$prefix."_media WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " lid='".$mMedia[$i]."' OR "; } $sql .= " lid='".$mMedia[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtMedia[$sid] = $title; }
//--------- Games $const = sizeof ($mGames); if ($const>0) { $sql = " SELECT lid, title FROM ".$prefix."_games WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " lid='".$mGames[$i]."' OR "; } $sql .= " lid='".$mGames[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtGames[$sid] = $title; }
//--------- Links $const = sizeof ($mLinks); if ($const>0) { $sql = " SELECT lid, title FROM ".$prefix."_links WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " lid='".$mLinks[$i]."' OR "; } $sql .= " lid='".$mLinks[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtLinks[$sid] = $title; }
//--------- FAQ $const = sizeof ($mFAQ); if ($const>0) { $sql = " SELECT lid, question FROM ".$prefix."_faqanswer WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " lid='".$mFAQ[$i]."' OR "; } $sql .= " lid='".$mFAQ[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtFAQ[$sid] = $title; }
//--------- Album $const = sizeof ($mAlbum); if ($const>0) { $sql = " SELECT lid, title FROM ".$prefix."_album _comments WHERE "; for ($i=0; $i<($const-1); $i++) { $sql .= " lid='".$mAlbum[$i]."' OR "; } $sql .= " lid='".$mAlbum[$const-1]."' "; $result = $db->sql_query($sql); while(list($sid, $title) = $db->sql_fetchrow($result)) $mtAlbum[$sid] = $title; }
//---------- Ñàì áëîê $sql = " SELECT cid, modul, date, name, comment FROM ".$prefix."_comment WHERE "; for ($i=0; $i<($limit-1); $i++) { $sql .= " id='".$mmaxid[$i]."' OR "; } $sql .= " id='".$mmaxid[$limit-1]."' ORDER BY id DESC ";
$i=0; $result = $db->sql_query($sql); while(list($cid, $modul, $date, $name, $comment) = $db->sql_fetchrow($result)) { $i++; $comment = preg_replace("#\[quote\](.*?)\[/quote\]#si","",$comment); $comment = preg_replace("#\[php\](.*?)\[/php\]#si","",$comment); $comment = preg_replace("#\[code\](.*?)\[/code\]#si","",$comment); $comment = preg_replace("#\[hide\](.*?)\[/hide\]#si","",$comment); $comment = preg_replace("#\[color=olive\]\[size=9\]_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _.*#si", "", $comment);
$comment = preg_replace("#\*(\d{2})#","\[smile\\1\]",$comment);
$comment = cutstr(strip_tags(bb_decode($comment), $raz_tag), $strip);
$comment = preg_replace("#\[smile(\d{2})\]#","<img src=\"images/smilies/\\1.gif\" border=\"0\" />",$comment);
$slov = explode (" ", $comment);
for ($j=0; $j<=sizeof($slov); $j++) {
if ( strlen($slov[$j]) > 30 ) {$slov[$j] = "[Äëèííîå ñëîâî]";}
}
$comment = implode (" ", $slov);
$date = formatTimestamp($date);
switch($modul) { case "Voting": $link = "<a href=\"index.php?name=Voting&op=poll_result&poll_id=$cid#$cid\" title=\"".$mtVoting[$cid]."\">"; break;
case "News": $link = "<a href=\"index.php?name=News&op=article&lid=$cid#$cid\" title=\"".$mtNews[$cid]."\">"; break; case "Files": $link = "<a href=\"index.php?name=Files&op=view_file&lid=$cid#$cid\" title=\"".$mtFiles[$cid]."\">"; break;
case "Pages": $link = "<a href=\"index.php?name=Pages&op=page&pid=$cid#$cid\" title=\"".$mtPages[$cid]."\">"; break; case "Media": $link = "<a href=\"index.php?name=Media&op=view_file&lid=$cid#$cid\" title=\"".$mtMedia[$cid]."\">"; break; case "Games": $link = "<a href=\"index.php?name=Games&op=view_file&lid=$cid#$cid\" title=\"".$mtGames[$cid]."\">"; break; case "Links": $link = "<a href=\"index.php?name=Games&op=view_link&lid=$cid#$cid\" title=\"".$mtLinks[$cid]."\">"; break; case "FAQ": $link = "<a href=\"index.php?name=FAQ&op=view_faq&lid=$cid#$cid\" title=\"".$mtFAQ[$cid]."\">"; break; case "Album": $link = "<a href=\"index.php?name=Album&file=index&do=showpic&pid=$cid#$cid\" title=\"".$mtAlbum[$cid]."\">"; break; }
$content .= " <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr style=\"padding-top: 7px;\"> <td style=\"padding-right: 5px;\">"."$link"."<img src=\"images/blocks/$modul.gif\" border=\"0\"></a></td> <td width=\"100%\">$date <b>$name</b></td> </tr> <tr> <td colspan=\"2\">"."$link"."$comment</a></td> </tr>"; if ($i!=$limit) {$content .= "<tr><td colspan=\"2\"><hr width=\"90%\"></td></tr>";} $content .= "</table>"; }
$content .= "</div>"; ?> |