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

  1. <?php
  2.  
  3. /************************************************************/
  4. /* IMPORTANT NOTE FOR THEMES DEVELOPERS!                    */
  5. /*                                                          */
  6. /* When you start cOdysseyng your theme, if you want to     */
  7. /* distribute it, please double check it to fit the HTML    */
  8. /* 4.01 Transitional Standard. You can use the W3 validator */
  9. /* located at http://validator.w3.org                       */
  10. /* If you don't know where to start with your theme, just   */
  11. /* start mOdysseyfying this theme, it's validate and is cool*/
  12. /************************************************************/
  13.  
  14. /************************************************************/
  15. /* Theme Colors Definition                                  */
  16. /*                                                          */
  17. /* Define colors for your web site. $bgcolor2 is generaly   */
  18. /* used for the tables border as you can see on OpenTable() */
  19. /* function, $bgcolor1 is for the table background and the  */
  20. /* other two bgcolor variables follows the same criteria.   */
  21. /* $texcolor1 and 2 are for tables internal texts           */
  22. /************************************************************/
  23.  
  24. global $loonr, $prefix, $dbi, $kokku;
  25. $kokku = sql_num_rows(sql_query("select * from ".$prefix."_stories LIMIT 0, 30 ", $dbi), $dbi);
  26.  
  27. $bgcolor1 = "#FFFFFF";
  28. $bgcolor2 = "#00BBCC";
  29. $bgcolor3 = "#ffffff";
  30. $bgcolor4 = "#ffffff";
  31. $textcolor1 = "#000000";
  32. $textcolor2 = "#000000";
  33.  
  34. if ($loonr == "") {
  35.     $loonr = "0";
  36. }
  37.  
  38. include("themes/Odyssey/tables.php");
  39.  
  40. /************************************************************/
  41. /* Function themeheader()                                   */
  42. /*                                                          */
  43. /* Control the header for your site. You need to define the */
  44. /* BODY tag and in some part of the code call the blocks    */
  45. /* function for left side with: blocks(left);               */
  46. /************************************************************/
  47.  
  48. function themeheader() {
  49.     global $user, $banners, $sitename, $slogan, $cookie, $prefix, $dbi;
  50.     cookiedecode($user);
  51.     $username = $cookie[1];
  52.     if ($username == "") {
  53.         $username = "Anonymous";
  54.     }
  55.     echo "<body bgcolor=\"#004080\" text=\"#000000\" link=\"#004080\" vlink=\"#004080\" alink=\"#004080\">";
  56.     if ($banners) {
  57.     include("banners.php");
  58.     }
  59.     $topics_list = "<select name=\"topic\" onChange='submit()'>\n";
  60.     $topics_list .= "<option value=\"\">All Topics</option>\n";
  61.     $toplist = sql_query("select topicid, topictext from ".$prefix."_topics order by topictext", $dbi);
  62.     while(list($topicid, $topics) = sql_fetch_row($toplist, $dbi)) {
  63.     if ($topicid==$topic) { $sel = "selected "; }
  64.     $topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";
  65.     $sel = "";
  66.     }
  67.     if ($username == "Anonymous") {
  68.     $theuser = "  <a href=\"modules.php?name=Your_Account\">Create an account";
  69.     } else {
  70.     $theuser = "  Welcome $username!";
  71.     }
  72.     $public_msg = public_message();
  73.     $tmpl_file = "themes/Odyssey/header.html";
  74.     $thefile = implode("", file($tmpl_file));
  75.     $thefile = addslashes($thefile);
  76.     $thefile = "\$r_file=\"".$thefile."\";";
  77.     eval($thefile);
  78.     print $r_file;
  79.     blocks(left);
  80.     $tmpl_file = "themes/Odyssey/left_center.html";
  81.     $thefile = implode("", file($tmpl_file));
  82.     $thefile = addslashes($thefile);
  83.     $thefile = "\$r_file=\"".$thefile."\";";
  84.     eval($thefile);
  85.     print $r_file;
  86. }
  87.  
  88. /************************************************************/
  89. /* Function themefooter()                                   */
  90. /*                                                          */
  91. /* Control the footer for your site. You don't need to      */
  92. /* close BODY and HTML tags at the end. In some part call   */
  93. /* the function for right blocks with: blocks(right);       */
  94. /* Also, $index variable need to be global and is used to   */
  95. /* determine if the page your're viewing is the Homepage or */
  96. /* and internal one.                                        */
  97. /************************************************************/
  98.  
  99. function themefooter() {
  100.     global $index, $foot1, $foot2, $foot3, $foot4;
  101.     if ($index == 1) {
  102.     $tmpl_file = "themes/Odyssey/center_right.html";
  103.     $thefile = implode("", file($tmpl_file));
  104.     $thefile = addslashes($thefile);
  105.     $thefile = "\$r_file=\"".$thefile."\";";
  106.     eval($thefile);
  107.     print $r_file;
  108.     blocks(right);
  109.     }
  110.     $footer_message = "$foot1<br>$foot2<br>$foot3<br>$foot4";
  111.     $tmpl_file = "themes/Odyssey/footer.html";
  112.     $thefile = implode("", file($tmpl_file));
  113.     $thefile = addslashes($thefile);
  114.     $thefile = "\$r_file=\"".$thefile."\";";
  115.     eval($thefile);
  116.     print $r_file;
  117. }
  118.  
  119. /************************************************************/
  120. /* Function themeindex()                                    */
  121. /*                                                          */
  122. /* This function format the stories on the Homepage         */
  123. /************************************************************/
  124.  
  125. function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
  126.     global $anonymous, $tipath, $cookie, $loonr, $vasak, $parem, $kokku, $storyhome, $storynum; 
  127.     $ThemeSel = get_theme();
  128.     if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  129.     $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  130.     } else {
  131.     $t_image = "$tipath$topicimage";
  132.     }
  133.     $loonr = ($loonr+1);
  134.     if (isset($cookie[3])) {
  135.     $storynum = $cookie[3];
  136.     } else {
  137.     $storynum = $storyhome;
  138.     }
  139.     $ridaaa1 = round($loonr/2);
  140.     if ($notes != "") {
  141.     $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
  142.     } else {
  143.     $notes = "";
  144.     }
  145.     if ("$aid" == "$informant") {
  146.     $content = "$thetext$notes\n";
  147.     } else {
  148.     if($informant != "") {
  149.         $content = "<a href=\"modules.php?name=Your_Account&op=userinfo&uname=$informant\">$informant</a> ";
  150.     } else {
  151.         $content = "$anonymous ";
  152.     }
  153.     $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
  154.     }
  155.     $posted = ""._POSTEDBY." ";
  156.     $posted .= get_author($aid);
  157.     $posted .= " "._ON." $time $timezone ($counter "._READS.")";
  158.     if (($ridaaa1*2) != $loonr) {
  159.     $tmpl_file = "themes/Odyssey/story_home.html";
  160.     $thefile = implode("", file($tmpl_file));
  161.     $thefile = addslashes($thefile);
  162.     $thefile = "\$r_file=\"".$thefile."\";";
  163.     eval($thefile);
  164.     $vasak .= "$r_file";
  165.     } else {
  166.     $tmpl_file = "themes/Odyssey/story_home.html";
  167.     $thefile = implode("", file($tmpl_file));
  168.     $thefile = addslashes($thefile);
  169.     $thefile = "\$r_file=\"".$thefile."\";";
  170.     eval($thefile);
  171.     $parem .= "$r_file";
  172.     }
  173.     if ($loonr == $storynum OR $loonr == $kokku) {
  174.     echo "<table width=\"100%\" border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">";
  175.     echo "<tr>";
  176.     echo "<td width=\"49%\" valign=\"top\">";
  177.     print $vasak;
  178.     echo "</td>";
  179.     echo "<td width=\"5\" cellpadding=\"0\" cellspacing=\"0\" valign=\"top\"></td>";
  180.     echo "<td width=\"49%\" valign=\"top\">";
  181.     print $parem;
  182.     echo "</td>";
  183.     echo "</tr>";
  184.     echo "</table>";
  185.     }
  186. }
  187.  
  188. /************************************************************/
  189. /* Function themeindex()                                    */
  190. /*                                                          */
  191. /* This function format the stories on the story page, when */
  192. /* you click on that "Read More..." link in the home        */
  193. /************************************************************/
  194.  
  195. function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
  196.     global $admin, $sid, $tipath;
  197.     $ThemeSel = get_theme();
  198.     if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  199.     $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  200.     } else {
  201.     $t_image = "$tipath$topicimage";
  202.     }
  203.     $posted = ""._POSTEDON." $datetime "._BY." ";
  204.     $posted .= get_author($aid);
  205.     if ($notes != "") {
  206.     $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
  207.     } else {
  208.     $notes = "";
  209.     }
  210.     if ("$aid" == "$informant") {
  211.     $content = "$thetext$notes\n";
  212.     } else {
  213.     if($informant != "") {
  214.         $content = "<a href=\"modules.php?name=Your_Account&op=userinfo&uname=$informant\">$informant</a> ";
  215.     } else {
  216.         $content = "$anonymous ";
  217.     }
  218.     $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
  219.     }
  220.     $tmpl_file = "themes/Odyssey/story_page.html";
  221.     $thefile = implode("", file($tmpl_file));
  222.     $thefile = addslashes($thefile);
  223.     $thefile = "\$r_file=\"".$thefile."\";";
  224.     eval($thefile);
  225.     print $r_file;
  226. }
  227.  
  228. /************************************************************/
  229. /* Function themesidebox()                                  */
  230. /*                                                          */
  231. /* Control look of your blocks. Just simple.                */
  232. /************************************************************/
  233.  
  234. function themesidebox($title, $content) {
  235.     $tmpl_file = "themes/Odyssey/blocks.html";
  236.     $thefile = implode("", file($tmpl_file));
  237.     $thefile = addslashes($thefile);
  238.     $thefile = "\$r_file=\"".$thefile."\";";
  239.     eval($thefile);
  240.     print $r_file;
  241. }
  242.  
  243. ?>