home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 May / INTERNET103.ISO / pc / software / windows / building / php_nuke / html / themes / anagram / theme.php
Encoding:
PHP Script  |  2002-09-16  |  16.1 KB  |  310 lines

  1. <?php
  2.  
  3. /************************************************************/
  4. /* Ported Theme Name: Anagram (v1.0)                           */
  5. /* Original Theme Name: Vision (v1.0)                       */
  6. /* Copyright (c) 2001 Somara Sem (http://www.somara.com)    */
  7. /* Last Updated: 09/19/2001 by dezina.com                   */
  8. /************************************************************/
  9.  
  10. /************************************************************/
  11. /* Theme Colors Definition                                  */
  12. /*                                                          */
  13. /* Define colors for your web site. $bgcolor2 is generaly   */
  14. /* used for the tables border as you can see on OpenTable() */
  15. /* function, $bgcolor1 is for the table background and the  */
  16. /* other two bgcolor variables follows the same criteria.   */
  17. /* $texcolor1 and 2 are for tables internal texts           */
  18. /************************************************************/
  19.  
  20. $bgcolor1 = "#DAD8D8";
  21. $bgcolor2 = "#EEEEEE";
  22. $bgcolor3 = "#efefef";
  23. $bgcolor4 = "#ffffff";
  24. $textcolor1 = "#000000";
  25. $textcolor2 = "#000000";
  26.  
  27. /************************************************************/
  28. /* OpenTable Functions                                      */
  29. /*                                                          */
  30. /* Define the tables look&feel for you whole site. For this */
  31. /* we have two options: OpenTable and OpenTable2 functions. */
  32. /* Then we have CloseTable and CloseTable2 function to      */
  33. /* properly close our tables. The difference is that        */
  34. /* OpenTable has a 100% width and OpenTable2 has a width    */
  35. /* according with the table content                         */
  36. /************************************************************/
  37.  
  38. function OpenTable() {
  39.     global $bgcolor1, $bgcolor2;
  40.     echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\"><tr><td>\n";
  41.     echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
  42. }
  43.  
  44. function CloseTable() {
  45.     echo "</td></tr></table></td></tr></table>\n";
  46. }
  47.  
  48. function OpenTable2() {
  49.     global $bgcolor1, $bgcolor2;
  50.     echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\" align=\"center\"><tr><td>\n";
  51.     echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"$bgcolor1\"><tr><td>\n";
  52. }
  53.  
  54. function CloseTable2() {
  55.     echo "</td></tr></table></td></tr></table>\n";
  56. }
  57.  
  58. /************************************************************/
  59. /* FormatStory                                              */
  60. /*                                                          */
  61. /* Here we'll format the look of the stories in our site.   */
  62. /* If you dig a little on the function you will notice that */
  63. /* we set different stuff for anonymous, admin and users    */
  64. /* when displaying the story.                               */
  65. /************************************************************/
  66.  
  67. function FormatStory($thetext, $notes, $aid, $informant) {
  68.     global $anonymous;
  69.     if ($notes != "") {
  70.     $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
  71.     } else {
  72.     $notes = "";
  73.     }
  74.     if ("$aid" == "$informant") {
  75.     echo "<font class=\"content\">$thetext$notes</font>\n";
  76.     } else {
  77.     if($informant != "") {
  78.         $boxstuff = "<a href=\"modules.php?name=Your_Account&op=userinfo&uname=$informant\">$informant</a> ";
  79.     } else {
  80.         $boxstuff = "$anonymous ";
  81.     }
  82.     $boxstuff .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
  83.     echo "<font class=\"content\">$boxstuff</font>\n";
  84.     }
  85. }
  86.  
  87. /************************************************************/
  88. /* Function themeheader()                                   */
  89. /*                                                          */
  90. /* Control the header for your site. You need to define the */
  91. /* BODY tag and in some part of the code call the blocks    */
  92. /* function for left side with: blocks(left);               */
  93. /************************************************************/
  94.  
  95. function themeheader() {
  96.     global $user, $banners, $sitename, $slogan, $cookie, $prefix, $anonymous;
  97.     cookiedecode($user);
  98.     $username = $cookie[1];
  99.     if ($username == "") {
  100.         $username = $anonymous;
  101.     }
  102.     echo "<body bgcolor=\"#ffffff\" text=\"#000000\">\n";
  103.     if ($banners) {
  104.     include("banners.php");
  105.     }
  106.     echo "<br>\n"
  107.     ."<table cellpadding=\"0\" cellspacing=\"10\" width=\"780\" border=\"0\" align=\"center\" bgcolor=\"#EEEEEE\">\n"
  108.     ."<tr>\n"
  109.     ."<td bgcolor=\"#EEEEEE\">\n"
  110.     ."<a href=\"index.php\"><img src=\"themes/Anagram/images/logo.gif\" align=\"left\" alt=\""._WELCOMETO." $sitename\" border=\"0\"></a></td>\n"
  111.     ."<td bgcolor=\"#EEEEEE\" align=\"right\">\n"
  112.     ."<form action=\"modules.php?name=Search\" method=\"post\"><font class=\"content\" color=\"#000000\"><b>"._SEARCH." </b>\n"
  113.     ."<input type=\"text\" name=\"query\" size=\"14\"></font></form></td>\n"
  114.     ."<td bgcolor=\"#EEEEEE\" align=\"right\">\n"
  115.     ."<form action=\"modules.php?name=Search\" method=\"get\"><font class=\"content\"><b>"._TOPICS." </b>\n";
  116.     $toplist = mysql_query("select topicid, topictext from $prefix"._topics." order by topictext");
  117.     echo "<select name=\"topic\"onChange='submit()'>\n"
  118.     ."<option value=\"\">"._ALLTOPICS."</option>\n";
  119.     while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
  120.     if ($topicid==$topic) { $sel = "selected "; }
  121.     echo "<option $sel value=\"$topicid\">$topics</option>\n";
  122.     $sel = "";
  123.     }
  124.     echo "</select></font></form></td>\n"
  125.     ."</tr></table>\n"
  126.  
  127.     ."<table cellpadding=\"1\" cellspacing=\"2\" width=\"780\" border=\"0\" align=\"center\" bgcolor=\"#DAD8D8\">\n"
  128.     ."<tr>\n"
  129.     ."<td width=\"14%\" bgcolor=\"#EEEEEE\" align=\"center\" style=\"cursor:hand\" onMouseOver=\"this.style.background='#DAD8D8'\" onMouseOut=\"this.style.background='#EEEEEE'\" onClick=\"window.location.href='/'\"><a href=\"/\">Home</a></td>\n"
  130.     ."<td width=\"14%\" bgcolor=\"#EEEEEE\" align=\"center\" style=\"cursor:hand\" onMouseOver=\"this.style.background='#DAD8D8'\" onMouseOut=\"this.style.background='#EEEEEE'\" onClick=\"window.location.href='modules.php?name=Your_Account'\"><a href=\"modules.php?name=Your_Account\">Tu Cuenta</a></td>\n"
  131.     ."<td width=\"14%\" bgcolor=\"#EEEEEE\" align=\"center\" style=\"cursor:hand\" onMouseOver=\"this.style.background='#DAD8D8'\" onMouseOut=\"this.style.background='#EEEEEE'\" onClick=\"window.location.href='modules.php?name=FAQ'\"><a href=\"modules.php?name=FAQ\">FAQ</a></td>\n"
  132.     ."<td width=\"14%\" bgcolor=\"#EEEEEE\" align=\"center\" style=\"cursor:hand\" onMouseOver=\"this.style.background='#DAD8D8'\" onMouseOut=\"this.style.background='#EEEEEE'\" onClick=\"window.location.href='modules.php?name=Topics'\"><a href=\"modules.php?name=Topics\">T≤picos</a></td>\n"
  133.     ."<td width=\"14%\" bgcolor=\"#EEEEEE\" align=\"center\" style=\"cursor:hand\" onMouseOver=\"this.style.background='#DAD8D8'\" onMouseOut=\"this.style.background='#EEEEEE'\" onClick=\"window.location.href='modules.php?name=Content'\"><a href=\"modules.php?name=Contenido\">Contenido</a></td>\n"
  134.     ."<td width=\"14%\" bgcolor=\"#EEEEEE\" align=\"center\" style=\"cursor:hand\" onMouseOver=\"this.style.background='#DAD8D8'\" onMouseOut=\"this.style.background='#EEEEEE'\" onClick=\"window.location.href='modules.php?name=Submit_News'\"><a href=\"modules.php?name=Submit_News\">Enviar Noticia</a></td>\n"
  135.     ."<td width=\"14%\" bgcolor=\"#EEEEEE\" align=\"center\" style=\"cursor:hand\" onMouseOver=\"this.style.background='#DAD8D8'\" onMouseOut=\"this.style.background='#EEEEEE'\" onClick=\"window.location.href='modules.php?name=Top'\"><a href=\"modules.php?name=Top\">Top 10</a></td>\n"
  136.     ."</tr>\n"
  137.     ."</table>\n"
  138.  
  139.         ."<table cellpadding=\"0\" cellspacing=\"0\" width=\"780\" border=\"0\" align=\"center\" bgcolor=\"#fefefe\">\n"
  140.         ."<tr>\n"
  141.         ."<td bgcolor=\"#DAD8D8\" colspan=\"4\"><IMG src=\"themes/Anagram/images/pixel.gif\" width=\"1\" height=1 alt=\"\" border=\"0\" hspace=\"0\"></td>\n"
  142.         ."</tr>\n"
  143.         ."<tr valign=\"middle\" bgcolor=\"#DAD8D8\">\n"
  144.         ."<td width=\"20%\" nowrap><font class=\"content\">\n";
  145.         if ($username == "Anonymous") {
  146.         echo "  <a href=\"modules.php?name=Your_Account\">"._LOGINCREATE."</a>\n";
  147.         } else {
  148.         echo "  "._HELLO." $username!";
  149.         }
  150.         echo "</font></td>\n"
  151.             ."<td align=\"center\" height=\"20\" width=\"60%\">\n"
  152.             ." \n"
  153.             ."</td>\n"
  154.             ."<td align=\"right\" width=\"20%\"><font class=\"content\">\n"
  155.             ."<script type=\"text/javascript\">\n\n"
  156.             ."<!--   // Array ofmonth Names\n"
  157.             ."var monthNames = new Array( \""._JANUARY."\",\""._FEBRUARY."\",\""._MARCH."\",\""._APRIL."\",\""._MAY."\",\""._JUNE."\",\""._JULY."\",\""._AUGUST."\",\""._SEPTEMBER."\",\""._OCTOBER."\",\""._NOVEMBER."\",\""._DECEMBER."\");\n"
  158.             ."var now = new Date();\n"
  159.             ."thisYear = now.getYear();\n"
  160.             ."if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem\n"
  161.             ."document.write(monthNames[now.getMonth()] + \" \" + now.getDate() + \", \" + thisYear);\n"
  162.             ."// -->\n\n"
  163.             ."</script></b></font></td>\n"
  164.             ."<td> </td>\n"
  165.             ."</tr>\n"
  166.             ."<tr>\n"
  167.             ."<td bgcolor=\"#DAD8D8\" colspan=\"4\"><IMG src=\"themes/ Anagram/images/pixel.gif\" width=\"1\" height=\"1\" alt=\"\" border=\"0\" hspace=\"0\"></td>\n"
  168.             ."</tr>\n"
  169.         ."</table>\n"
  170. ;
  171.  
  172.     $public_msg = public_message();
  173.         echo "$public_msg<br>";
  174.     echo "<!-- Begin Main Content -->\n"
  175.     ."<table width=\"780\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\"><tr valign=\"top\">\n"
  176.     ."<td background=\"themes/Anagram/images/column-bg.gif\" width=\"150\" valign=\"top\">\n";
  177.     blocks(left);
  178.     echo "</td>\n"
  179.         ."<td><img src=\"themes/Anagram/images/pixel.gif\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>\n"
  180.         ."<td><img src=\"themes/Anagram/images/pixel.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\"></td>\n"
  181.         ."<td width=\"100%\">\n";
  182. }
  183.  
  184. /************************************************************/
  185. /* Function themefooter()                                   */
  186. /*                                                          */
  187. /* Control the footer for your site. You don't need to      */
  188. /* close BODY and HTML tags at the end. In some part call   */
  189. /* the function for right blocks with: blocks(right);       */
  190. /* Also, $index variable need to be global and is used to   */
  191. /* determine if the page your're viewing is the Homepage or */
  192. /* and internal one.                                        */
  193. /************************************************************/
  194.  
  195. function themefooter() {
  196.     global $index;
  197.     if ($index == 1) {
  198.     echo "</td><td><img src=\"themes/Anagram/images/pixel.gif\" width=\"5\" height=\"1\" border=\"0\" alt=\"\"></td>\n"
  199.         ."<td background=\"themes/Anagram/images/column-bg.gif\" valign=\"top\" width=\"150\">\n";
  200.     blocks(right);
  201.     }
  202.     echo "</td>\n"
  203.     ."</tr></table>\n"
  204.  
  205.         ."<table width=\"780\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"#ffffff\" align=\"center\">\n"
  206.         ."<tr align=\"center\">\n"
  207.         ."<td width=\"100%\" bgcolor=\"#DAD8D8\"><img src=\"themes/Anagram/images/pixel.gif\" width=\"1\" height=\"1\" alt=\"\"></td>\n"
  208.         ."</tr>\n"
  209.         ."</table>\n"
  210.  
  211.         ."<table width=\"780\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"#EEEEEE\" align=\"center\">\n"
  212.         ."<tr align=\"center\">\n"
  213.         ."<td width=\"100%\" colspan=\"3\">\n";
  214.     footmsg();
  215.     echo "</td>\n"
  216.         ."</tr>\n"
  217.         ."</table>\n";
  218. }
  219.  
  220. /************************************************************/
  221. /* Function themeindex()                                    */
  222. /*                                                          */
  223. /* This function format the stories on the Homepage         */
  224. /************************************************************/
  225.  
  226. function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
  227.     global $anonymous, $tipath;
  228.     $ThemeSel = get_theme();
  229.     if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  230.     $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  231.     } else {
  232.     $t_image = "$tipath$topicimage";
  233.     }
  234.     echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#ffffff\" width=\"100%\"><tr><td>\n"
  235.     ."<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#DAD8D8\" width=\"100%\"><tr><td>\n"
  236.     ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" bgcolor=\"#EEEEEE\" width=\"100%\"><tr><td align=\"left\">\n"
  237.     ."<font class=\"option\" color=\"#363636\"><b>$title</b></font>\n"
  238.     ."</td></tr></table></td></tr></table>\n"
  239.     ."<b><a href=\"modules.php?name=News&new_topic=$topic\"><img src=\"$t_image\" border=\"0\" Alt=\"$topictext\" align=\"right\" hspace=\"10\" vspace=\"10\"></a></B>\n";
  240.     FormatStory($thetext, $notes, $aid, $informant);
  241.     echo "</td></tr></table>\n"
  242.     ."<table background=\"themes/Anagram/images/column-bg.gif\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\"><tr><td>\n"
  243.     ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"center\">\n"
  244.     ."<font class=\"tiny\">"._POSTEDBY." ";
  245.     formatAidHeader($aid);
  246.     echo " "._ON." $time $timezone ($counter "._READS.")<br></font>\n"
  247.     ."<font class=\"content\">$morelink</font>\n"
  248.     ."</td></tr></table></td></tr></table>\n"
  249.     ."<br>\n\n\n";
  250. }
  251.  
  252. /************************************************************/
  253. /* Function themeindex()                                    */
  254. /*                                                          */
  255. /* This function format the stories on the story page, when */
  256. /* you click on that "Read More..." link in the home        */
  257. /************************************************************/
  258.  
  259. function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
  260.     global $admin, $sid, $tipath;
  261.     $ThemeSel = get_theme();
  262.     if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  263.     $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  264.     } else {
  265.     $t_image = "$tipath$topicimage";
  266.     }
  267.     echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#ffffff\" width=\"100%\"><tr><td>\n"
  268.         ."<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#DAD8D8\" width=\"100%\"><tr><td>\n"
  269.         ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" bgcolor=\"#EEEEEE\" width=\"100%\"><tr><td align=\"left\">\n"
  270.         ."<font class=\"option\" color=\"#363636\"><b>$title</b></font><br>\n"
  271.         ."<font class=\"content\">"._POSTEDON." $datetime "._BY." ";
  272.     formatAidHeader($aid);
  273.     if (is_admin($admin)) {
  274.     echo "<br>[ <a href=\"admin.php?op=EditStory&sid=$sid\">"._EDIT."</a> | <a href=\"admin.php?op=RemoveStory&sid=$sid\">"._DELETE."</a> ]\n";
  275.     }
  276.     echo "</td></tr></table></td></tr></table><br>";
  277.     echo "<a href=\"modules.php?name=News&new_topic=$topic\"><img src=\"$t_image\" border=\"0\" Alt=\"$topictext\" align=\"right\" hspace=\"10\" vspace=\"10\"></a>\n";
  278.     FormatStory($thetext, $notes="", $aid, $informant);
  279.     echo "</td></tr></table><br>\n\n\n";
  280. }
  281.  
  282. /************************************************************/
  283. /* Function themesidebox()                                  */
  284. /*                                                          */
  285. /* Control look of your blocks. Just simple.                */
  286. /************************************************************/
  287.  
  288. function themesidebox($title, $content) {
  289.     echo "<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"150\">\n"
  290.     ."<tr>\n"
  291.     ."<td>\n"
  292.  
  293.     ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" bgcolor=\"#EEEEEE\" width=\"100%\">\n"
  294.     ."<tr>\n"
  295.     ."<td align=left><font class=\"content\" color=\"#363636\"><b>$title</b></font></td>\n"
  296.     ."</tr>\n"
  297.     ."</table>\n"
  298.  
  299.     ."</td>\n"
  300.     ."</tr>\n"
  301.     ."</table>\n"
  302.  
  303.     ."<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" width=\"150\">\n"
  304.     ."<tr valign=\"top\"><td>\n"
  305.     ."$content\n"
  306.     ."</td></tr></table>\n"
  307.     ."<br>\n\n\n";
  308. }
  309.  
  310.