[ 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 19 require_once ("mainfile.php"); 20 $module_name = basename(dirname(__FILE__)); 21 get_lang($module_name); 22 23 $pagetitle = "- "._ENCYCLOPEDIA.""; 24 25 function encysearch($eid) { 26 global $module_name; 27 echo "<center><form action=\"modules.php?name=$module_name&file=search\" method=\"post\">" 28 ."<input type=\"text\" size=\"20\" name=\"query\"> " 29 ."<input type=\"hidden\" name=\"eid\" value=\"$eid\">" 30 ."<input type=\"submit\" value=\""._SEARCH."\">" 31 ."</form>" 32 ."</center>"; 33 } 34 35 function alpha($eid) { 36 global $module_name, $prefix, $db; 37 echo "<center>"._ENCYSELECTLETTER."</center><br><br>"; 38 $alphabet = array ("A","B","C","D","E","F","G","H","I","J","K","L","M", 39 "N","O","P","Q","R","S","T","U","V","W","X","Y","Z"); 40 $num = count($alphabet) - 1; 41 echo "<center>[ "; 42 $counter = 0; 43 $eid = intval($eid); 44 while (list(, $ltr) = each($alphabet)) { 45 $ltr = substr("$ltr", 0,1); 46 $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_encyclopedia_text WHERE eid='$eid' AND UPPER(title) LIKE '$ltr%'")); 47 if ($numrows > 0) { 48 echo "<a href=\"modules.php?name=$module_name&op=terms&eid=$eid&ltr=$ltr\">$ltr</a>"; 49 } else { 50 echo "$ltr"; 51 } 52 if ( $counter == round($num/2) ) { 53 echo " ]\n<br>\n[ "; 54 } elseif ( $counter != $num ) { 55 echo " | \n"; 56 } 57 $counter++; 58 } 59 echo " ]</center><br><br>\n\n\n"; 60 encysearch($eid); 61 echo "<center>"._GOBACK."</center>"; 62 } 63 64 function list_content($eid) { 65 global $module_name, $prefix, $sitename, $db; 66 $eid = intval($eid); 67 $row = $db->sql_fetchrow($db->sql_query("SELECT title, description FROM ".$prefix."_encyclopedia WHERE eid='$eid'")); 68 $title = filter($row['title'], "nohtml"); 69 $description = filter($row['description']); 70 include ("header.php"); 71 title("$title"); 72 OpenTable(); 73 echo "<center><b>$title</b></center><br>" 74 ."<p align=\"justify\">$description</p>"; 75 CloseTable(); 76 echo "<br>"; 77 OpenTable(); 78 alpha($eid); 79 CloseTable(); 80 echo "<br>"; 81 OpenTable(); 82 echo "<center><font class=\"tiny\">"._COPYRIGHT." © "._BY." $sitename</font></center>"; 83 CloseTable(); 84 include ("footer.php"); 85 } 86 87 function terms($eid, $ltr) { 88 global $module_name, $prefix, $sitename, $db, $admin; 89 $eid = intval($eid); 90 $ltr = substr($ltr,0,1); 91 if (ereg("[^a-zA-Z0-9]",$ltr)) 92 { 93 die('Invalid letter/digit specified!'); 94 } 95 $row = $db->sql_fetchrow($db->sql_query("SELECT active FROM ".$prefix."_encyclopedia WHERE eid='$eid'")); 96 $active = intval($row['active']); 97 $row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_encyclopedia WHERE eid='$eid'")); 98 $title = filter($row2['title'], "nohtml"); 99 include ("header.php"); 100 title("$title"); 101 OpenTable(); 102 if (($active == 1) OR (is_admin($admin))) { 103 if (($active != 1) AND (is_admin($admin))) { 104 echo "<center>"._YOURADMINENCY."</center><br><br>"; 105 } 106 echo "<center>Please select one term from the following list:</center><br><br>" 107 ."<table border=\"0\" align=\"center\">"; 108 $result3 = $db->sql_query("SELECT tid, title FROM ".$prefix."_encyclopedia_text WHERE UPPER(title) LIKE '$ltr%' AND eid='$eid'"); 109 $numrows = $db->sql_numrows($result3); 110 if ($numrows == 0) { 111 echo "<center><i>"._NOCONTENTFORLETTER." ".htmlentities($ltr).".</i></center>"; 112 } 113 while ($row3 = $db->sql_fetchrow($result3)) { 114 $tid = intval($row3['tid']); 115 $title = filter($row3['title'], "nohtml"); 116 echo "<tr><td><a href=\"modules.php?name=$module_name&op=content&tid=$tid\">$title</a></td></tr>"; 117 } 118 echo "</table><br><br>"; 119 alpha($eid); 120 } else { 121 echo "<center>"._ENCYNOTACTIVE."<br><br>" 122 .""._GOBACK."</center>"; 123 } 124 CloseTable(); 125 include ("footer.php"); 126 } 127 128 function content($tid, $ltr, $page=0, $query="") { 129 global $prefix, $db, $sitename, $admin, $module_name, $admin_file; 130 $tid = intval($tid); 131 include ("header.php"); 132 OpenTable(); 133 $ency = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_encyclopedia_text WHERE tid='$tid'")); 134 $etid = intval($ency['tid']); 135 $eeid = intval($ency['eid']); 136 $etitle = filter($ency['title'], "nohtml"); 137 $etext = filter($ency['text']); 138 $ecounter = intval($ency['counter']); 139 $row = $db->sql_fetchrow($db->sql_query("SELECT active FROM ".$prefix."_encyclopedia WHERE eid='$eeid'")); 140 $active = intval($row['active']); 141 if (($active == 1) OR ($active == 0 AND is_admin($admin))) { 142 $db->sql_query("UPDATE ".$prefix."_encyclopedia_text SET counter=counter+1 WHERE tid='$tid'"); 143 $row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_encyclopedia WHERE eid='$eeid'")); 144 $enc_title = filter($row2['title'], "nohtml"); 145 echo "<font class=\"title\">$etitle</font><br><br><br>"; 146 $contentpages = explode( "[--pagebreak--]", $etext ); 147 $pageno = count($contentpages); 148 if ( empty($page) || $page < 1 ) 149 $page = 1; 150 if ( $page > $pageno ) 151 $page = $pageno; 152 $arrayelement = (int)$page; 153 $arrayelement --; 154 if ($pageno > 1) { 155 echo ""._PAGE.": $page/$pageno<br>"; 156 } 157 if (!empty($query)) { 158 $query = htmlentities($query); 159 $contentpages[$arrayelement] = eregi_replace($query,"<b>$query</b>",$contentpages[$arrayelement]); 160 $fromsearch = "&query=$query"; 161 } else { 162 $fromsearch = ""; 163 } 164 echo "<p align=\"justify\">".nl2br($contentpages[$arrayelement])."</p>"; 165 if($page >= $pageno) { 166 $next_page = ""; 167 } else { 168 $next_pagenumber = $page + 1; 169 if ($page != 1) { 170 $next_page .= "- "; 171 } 172 $next_page .= "<a href=\"modules.php?name=$module_name&op=content&tid=$tid&page=$next_pagenumber$fromsearch\">"._NEXT." ($next_pagenumber/$pageno)</a> <a href=\"modules.php?name=$module_name&op=content&tid=$tid&page=$next_pagenumber\"><img src=\"images/right.gif\" border=\"0\" alt=\""._NEXT."\" title=\""._NEXT."\"></a>"; 173 } 174 if($page <= 1) { 175 $previous_page = ""; 176 } else { 177 $previous_pagenumber = $page - 1; 178 $previous_page = "<a href=\"modules.php?name=$module_name&op=content&tid=$tid&page=$previous_pagenumber$fromsearch\"><img src=\"images/left.gif\" border=\"0\" alt=\""._PREVIOUS."\" title=\""._PREVIOUS."\"></a> <a href=\"modules.php?name=$module_name&op=content&tid=$tid&page=$previous_pagenumber$fromsearch\">"._PREVIOUS." ($previous_pagenumber/$pageno)</a>"; 179 } 180 echo "<br><br><br><center>$previous_page $next_page<br><br>" 181 .""._GOBACK."</center><br>"; 182 if (is_admin($admin)) { 183 echo "<p align=\"right\">[ <a href=\"".$admin_file.".php?op=encyclopedia_text_edit&tid=$etid\">"._EDIT."</a> ]</p>"; 184 } 185 echo "<p align=\"right\"><a href=\"modules.php?name=$module_name&op=list_content&eid=$eeid\">$enc_title</a></p>"; 186 if ($page == $pageno) { 187 echo "<p align=\"right\">"._COPYRIGHT." © "._BY." $sitename - ($ecounter "._READS.")</font></p>"; 188 } 189 } else { 190 echo "Sorry, This page isn't active..."; 191 } 192 CloseTable(); 193 include ("footer.php"); 194 } 195 196 function list_themes() { 197 global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file; 198 include ("header.php"); 199 title("$sitename: "._ENCYCLOPEDIA.""); 200 OpenTable(); 201 echo "<center><font class=\"content\">"._AVAILABLEENCYLIST." $sitename:</center><br><br>"; 202 $result = $db->sql_query("SELECT eid, title, description, elanguage FROM ".$prefix."_encyclopedia WHERE active='1'"); 203 echo "<blockquote>"; 204 while ($row = $db->sql_fetchrow($result)) { 205 $eid = intval($row['eid']); 206 $title = filter($row['title'], "nohtml"); 207 $description = filter($row['description']); 208 $elanguage = $row['elanguage']; 209 if ($multilingual == 1) { 210 $the_lang = "<img src=\"images/language/flag-$elanguage.png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">"; 211 } else { 212 $the_lang = ""; 213 } 214 if (!empty($subtitle)) { 215 $subtitle = "<br>($description)<br><br>"; 216 } else { 217 $subtitle = ""; 218 } 219 if (is_admin($admin)) { 220 echo "<strong><big>·</big></strong> $the_lang <a href=\"modules.php?name=$module_name&op=list_content&eid=$eid\">$title</a><br>$description<br>[ <a href=\"".$admin_file.".php?op=encyclopedia_edit&eid=$eid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=encyclopedia_change_status&eid=$eid&active=1\">"._DEACTIVATE."</a> | <a href=\"".$admin_file.".php?op=encyclopedia_delete&eid=$eid\">"._DELETE."</a> ]<br><br>"; 221 } else { 222 echo "<strong><big>·</big></strong> $the_lang <a href=\"modules.php?name=$module_name&op=list_content&eid=$eid\">$title</a><br> $description<br><br>"; 223 } 224 } 225 echo "</blockquote>"; 226 if (is_admin($admin)) { 227 $result2 = $db->sql_query("SELECT eid, title, description, elanguage FROM ".$prefix."_encyclopedia WHERE active='0'"); 228 echo "<br><br><center><b>"._YOURADMININACTIVELIST."</b></center><br><br>"; 229 echo "<blockquote>"; 230 while ($row2 = $db->sql_fetchrow($result2)) { 231 $eid = intval($row2['eid']); 232 $title = filter($row2['title'], "nohtml"); 233 $description = filter($row2['description']); 234 $elanguage = $row2['elanguage']; 235 if ($multilingual == 1) { 236 $the_lang = "<img src=\"images/language/flag-$elanguage.png\" hspace=\"3\" border=\"0\" height=\"10\" width=\"20\">"; 237 } else { 238 $the_lang = ""; 239 } 240 if (!empty($subtitle)) { 241 $subtitle = " ($subtitle) "; 242 } else { 243 $subtitle = " "; 244 } 245 echo "<strong><big>·</big></strong> $the_lang <a href=\"modules.php?name=$module_name&op=list_content&eid=$eid\">$title</a><br>$description<br>[ <a href=\"".$admin_file.".php?op=encyclopedia_edit&eid=$eid\">"._EDIT."</a> | <a href=\"".$admin_file.".php?op=encyclopedia_change_status&eid=$eid&active=0\">"._ACTIVATE."</a> | <a href=\"".$admin_file.".php?op=encyclopedia_delete&eid=$eid\">"._DELETE."</a> ]<br><br>"; 246 } 247 echo "</blockquote>"; 248 } 249 CloseTable(); 250 include ("footer.php"); 251 } 252 253 if (!isset($ltr)) { $ltr = ""; } 254 if (!isset($page)) { $page = ""; } 255 if (!isset($query)) { $query = ""; } 256 257 switch($op) { 258 259 case "content": 260 content($tid, $ltr, $page, $query); 261 break; 262 263 case "list_content": 264 list_content($eid); 265 break; 266 267 case "terms": 268 terms($eid, $ltr); 269 break; 270 271 case "search": 272 search($query, $eid); 273 break; 274 275 default: 276 list_themes(); 277 break; 278 279 } 280 281 ?>
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 |