home *** CD-ROM | disk | FTP | other *** search
/ PC World 2001 March / PCWorld_2001-03_cd.bin / KOMUNIK / progweb / progweb.exe / phpnuke / html / sections.php < prev    next >
PHP Script  |  2000-12-05  |  4KB  |  132 lines

  1. <?PHP
  2.  
  3. ######################################################################
  4. # PHP-NUKE: Web Portal System
  5. # ===========================
  6. #
  7. # Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
  8. # http://phpnuke.org
  9. #
  10. # This modules is to have special sections for articles, reviews, etc.
  11. #
  12. # This program is free software. You can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; either version 2 of the License.
  15. ######################################################################
  16.  
  17. if(!isset($mainfile)) { include("mainfile.php"); }
  18.  
  19. function listsections() {
  20.     include ('header.php');
  21.     
  22.     $result = mysql_query("select secid, secname, image from sections order by secname");
  23.     echo "
  24.     <center>
  25.     <table width=100% border=0 cellspacing=1 cellpadding=0 bgcolor=000000><tr><td>
  26.     <table width=100% border=0 cellspacing=1 cellpadding=8 bgcolor=FFFFFF><tr><td>
  27.     <center>
  28.     ".translate("Welcome to the Special Sections at")." $sitename.<br><br>
  29.     ".translate("Here you can find some cool articles not presents in the Home.")."
  30.     <br><br>
  31.     <table border=0>";
  32.     $count = 0;
  33.     while (list($secid, $secname, $image) = mysql_fetch_row($result)) {
  34.         if ($count==2) {
  35.         echo "<tr>";
  36.         $count = 0;
  37.         }
  38.         echo "<td><a href=sections.php?op=listarticles&secid=$secid><img src=images/sections/$image border=0 Alt=\"$secname\"></a>";
  39.         $count++;
  40.         if ($count==2) {
  41.         echo "</tr>";
  42.         }
  43.         echo "</td>";
  44.     }
  45.     mysql_free_result($result);
  46.     echo "</table></center></td></tr></table></td></tr></table>";
  47.     include ('footer.php');
  48. }
  49.  
  50. function listarticles($secid) {
  51.     include ('header.php');
  52.     $result = mysql_query("select secname from sections where secid=$secid");
  53.     list($secname) = mysql_fetch_row($result);
  54.     mysql_free_result($result);
  55.     $result = mysql_query("select artid, secid, title, content, counter from seccont where secid=$secid");
  56.     echo "<center>
  57.     <table width=100% border=0 cellspacing=1 cellpadding=0 bgcolor=000000><tr><td>
  58.     <table width=100% border=0 cellspacing=1 cellpadding=8 bgcolor=FFFFFF><tr><td>";
  59.     $result2 = mysql_query("select image from sections where secid=$secid");
  60.     list($image) = mysql_fetch_row($result2);
  61.     echo "<center><img src=images/sections/$image border=0><br><br>
  62.     <font size=3>
  63.     ".translate("This is Section")." <b>$secname</b>.<br>".translate("Following are the articles published under this section.")."
  64.     <br><br>
  65.     <table border=0>";
  66.     while (list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result)) {
  67.         echo "
  68.         <tr><td align=left><font size=2>
  69.         <li><a href=sections.php?op=viewarticle&artid=$artid>$title</a> (".translate("read:")." $counter ".translate("times").")
  70.         </td></tr>
  71.         ";    
  72.     }
  73.     echo "</table>
  74.     <br><br><br>
  75.     [ <a href=sections.php>".translate("Return to Sections Index")."</a> ]
  76.     </center>
  77.     </td></tr></table></td></tr></table>";
  78.     mysql_free_result($result);
  79.     include ('footer.php');
  80. }
  81.  
  82. function viewarticle($artid) {
  83.     include("header.php");
  84.     mysql_query("update seccont set counter=counter+1 where artid='$artid'");
  85.     
  86.     $result = mysql_query("select artid, secid, title, content, counter from seccont where artid=$artid");
  87.     list($artid, $secid, $title, $content, $counter) = mysql_fetch_row($result);
  88.         
  89.     $result2 = mysql_query("select secid, secname from sections where secid=$secid");
  90.     list($secid, $secname) = mysql_fetch_row($result2);
  91.     $words = sizeof(explode(" ", $content));
  92.     
  93.     echo "<center>
  94.     <table border=0 cellpadding=1 cellspacing=1 width=100% bgcolor=000000><tr><td>
  95.     <table border=0 cellpadding=8 cellspacing=1 width=100% bgcolor=FFFFFF>
  96.     <tr><td align=left><font size=3>
  97.     <b>$title</b><br>
  98.     <font size=2>
  99.     ($words ".translate("total words in this text)")."<br>
  100.     (".translate("read:")." $counter ".translate("times").")<br><br>
  101.     <br><br>
  102.     $content
  103.     </td></tr>
  104.     <tr><td align=center>
  105.     [ <a href=sections.php?op=listarticles&secid=$secid>".translate("Back to")." $secname</a> |
  106.     <a href=sections.php>".translate("Sections Index")."</a> ]
  107.     </td></tr>
  108.     </table></td></tr></table></center>";
  109.     mysql_free_result($result);
  110.     mysql_free_result($result2);
  111.     include ('footer.php');
  112. }
  113.  
  114.  
  115.  
  116. switch($op) {
  117.  
  118.     case "viewarticle":
  119.     viewarticle($artid);
  120.     break;
  121.  
  122.     case "listarticles":
  123.     listarticles($secid);
  124.     break;
  125.         
  126.     default:
  127.     listsections();
  128.     break;
  129.  
  130. }
  131. ?>
  132.