home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / unitednuke / unitednuke.exe / html / themes / Odyssey / theme.php < prev   
PHP Script  |  2004-01-10  |  11KB  |  286 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, $db, $kokku;
  25. //$kokku = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories LIMIT 0, 30 "));
  26. if ($new_topic ==0) {
  27. $kokku = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories LIMIT 0, 30 "));
  28. }
  29. else {
  30. $kokku = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories where topic='".$new_topic."' LIMIT 0, 30 "));
  31. }
  32.  
  33. $bgcolor1 = "#FFFFFF";
  34. $bgcolor2 = "#00BBCC";
  35. $bgcolor3 = "#ffffff";
  36. $bgcolor4 = "#ffffff";
  37. $textcolor1 = "#000000";
  38. $textcolor2 = "#000000";
  39.  
  40. if ($loonr == "") {
  41.     $loonr = "0";
  42. }
  43.  
  44. include("themes/Odyssey/tables.php");
  45.  
  46. /************************************************************/
  47. /* Function themeheader()                                   */
  48. /*                                                          */
  49. /* Control the header for your site. You need to define the */
  50. /* BODY tag and in some part of the code call the blocks    */
  51. /* function for left side with: blocks(left);               */
  52. /************************************************************/
  53.  
  54. function themeheader() {
  55.     global $user, $banners, $sitename, $slogan, $cookie, $prefix, $db;
  56.     cookiedecode($user);
  57.     $username = $cookie[1];
  58.     if ($username == "") {
  59.         $username = "Anonymous";
  60.     }
  61.     echo "<body bgcolor=\"#004080\" text=\"#000000\" link=\"#004080\" vlink=\"#004080\" alink=\"#004080\">";
  62.     if ($banners) {
  63.     include("banners.php");
  64.     }
  65.     $topics_list = "<select name=\"topic\" onChange='submit()'>\n";
  66.     $topics_list .= "<option value=\"\">All Topics</option>\n";
  67.     $toplist = $db->sql_query("select topicid, topictext from ".$prefix."_topics order by topictext");
  68.     while(list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
  69.     $topicid = intval($topicid);
  70.     if ($topicid==$topic) { $sel = "selected "; }
  71.     $topics_list .= "<option $sel value=\"$topicid\">$topics</option>\n";
  72.     $sel = "";
  73.     }
  74.     if ($username == "Anonymous") {
  75.     $theuser = "  <a href=\"modules.php?name=Your_Account\">Create an account";
  76.     } else {
  77.     $theuser = "  Welcome $username!";
  78.     }
  79.     $public_msg = public_message();
  80.     $tmpl_file = "themes/Odyssey/header.html";
  81.     $thefile = implode("", file($tmpl_file));
  82.     $thefile = addslashes($thefile);
  83.     $thefile = "\$r_file=\"".$thefile."\";";
  84.     eval($thefile);
  85.     print $r_file;
  86.     blocks(left);
  87.     $tmpl_file = "themes/Odyssey/left_center.html";
  88.     $thefile = implode("", file($tmpl_file));
  89.     $thefile = addslashes($thefile);
  90.     $thefile = "\$r_file=\"".$thefile."\";";
  91.     eval($thefile);
  92.     print $r_file;
  93. }
  94.  
  95. /************************************************************/
  96. /* Function themefooter()                                   */
  97. /*                                                          */
  98. /* Control the footer for your site. You don't need to      */
  99. /* close BODY and HTML tags at the end. In some part call   */
  100. /* the function for right blocks with: blocks(right);       */
  101. /* Also, $index variable need to be global and is used to   */
  102. /* determine if the page your're viewing is the Homepage or */
  103. /* and internal one.                                        */
  104. /************************************************************/
  105.  
  106. function themefooter() {
  107.     global $index, $foot1, $foot2, $foot3, $foot4;
  108.     if ($index == 1) {
  109.     $tmpl_file = "themes/Odyssey/center_right.html";
  110.     $thefile = implode("", file($tmpl_file));
  111.     $thefile = addslashes($thefile);
  112.     $thefile = "\$r_file=\"".$thefile."\";";
  113.     eval($thefile);
  114.     print $r_file;
  115.     blocks(right);
  116.     }
  117.     $footer_message = "$foot1<br>$foot2<br>$foot3<br>$foot4";
  118.     $tmpl_file = "themes/Odyssey/footer.html";
  119.     $thefile = implode("", file($tmpl_file));
  120.     $thefile = addslashes($thefile);
  121.     $thefile = "\$r_file=\"".$thefile."\";";
  122.     eval($thefile);
  123.     print $r_file;
  124. }
  125.  
  126. /************************************************************/
  127. /* Function themeindex()                                    */
  128. /*                                                          */
  129. /* This function format the stories on the Homepage         */
  130. /************************************************************/
  131.  
  132. function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
  133.     global $anonymous, $tipath, $cookie, $loonr, $vasak, $parem, $kokku, $storyhome, $storynum, $prefix, $pagenum, $catid, $offsettheme, $new_topic, $cycle, $db;
  134.  
  135.     $offsettheme = ($pagenum-1) * $storynum;
  136.  
  137.     $offsettheme = intval($offsettheme);
  138.  
  139.     //nasledujici upravy byly vytvoreny pro kompatibilitu s page numbers, enjoy :-)
  140.  
  141.     //listovani z titulni strany
  142.     if ($pagenum != 1 AND $catid == ""){
  143.     $numstorys1 = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories LIMIT $offsettheme, 30 "));
  144.       if ($numstorys1 <= $storyhome) {
  145.       $kokku = $numstorys1;
  146.       }
  147.     }
  148.  
  149.     //listovani v categories
  150.     if ($catid != "" AND $pagenum >= 1){
  151.     $numstorys2 = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories where catid='$catid' LIMIT $offsettheme, 30 "));
  152.       if ($numstorys2 <= $storyhome) {
  153.       $kokku = $numstorys2;
  154.       }
  155.     }
  156.  
  157.     //listovani  v themes
  158.     if ($new_topic != ""){
  159.     $numstorys = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories where topic='$new_topic' LIMIT $offsettheme, 30 "));
  160.       if ($numstorys <= $storyhome) {
  161.       $kokku = $numstorys;
  162.       }
  163.     }
  164.  
  165.     $ThemeSel = get_theme();
  166.     if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  167.     $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  168.     } else {
  169.     $t_image = "$tipath$topicimage";
  170.     }
  171.     $loonr = ($loonr+1);
  172.     if (isset($cookie[3])) {
  173.     $storynum = $cookie[3];
  174.     } else {
  175.     $storynum = $storyhome;
  176.     }
  177.     $ridaaa1 = round($loonr/2);
  178.     if ($notes != "") {
  179.     $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
  180.     } else {
  181.     $notes = "";
  182.     }
  183.     if ("$aid" == "$informant") {
  184.     $content = "$thetext$notes\n";
  185.     } else {
  186.     if($informant != "") {
  187.         $content = "<a href=\"modules.php?name=Your_Account&op=userinfo&username=$informant\">$informant</a> ";
  188.     } else {
  189.         $content = "$anonymous ";
  190.     }
  191.     $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
  192.     }
  193.     $posted = ""._POSTEDBY." ";
  194.     $posted .= get_author($aid);
  195.     $posted .= " "._ON." $time $timezone ($counter "._READS.")";
  196.     if (($ridaaa1*2) != $loonr) {
  197.     $tmpl_file = "themes/CMD-SITE/story_home.html";
  198.     $thefile = implode("", file($tmpl_file));
  199.     $thefile = addslashes($thefile);
  200.     $thefile = "\$r_file=\"".$thefile."\";";
  201.     eval($thefile);
  202.     $vasak .= "$r_file";
  203.     } else {
  204.     $tmpl_file = "themes/CMD-SITE/story_home.html";
  205.     $thefile = implode("", file($tmpl_file));
  206.     $thefile = addslashes($thefile);
  207.     $thefile = "\$r_file=\"".$thefile."\";";
  208.     eval($thefile);
  209.     $parem .= "$r_file";
  210.     }
  211.     $pagecycle = $pagenum - 1;
  212.     if (($loonr == $storynum OR $loonr == $kokku) OR ($pagecycle > 0 and $catid != 0 and $pagenum !=0) OR ($pagecycle > 0 and $new_topic != 0 and $pagenum != 0))
  213.     {
  214.     echo "<table width=\"100%\" border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">";
  215.     echo "<tr>";
  216.     echo "<td width=\"49%\" valign=\"top\">";
  217.     print $vasak;
  218.     echo "</td>";
  219.     echo "<td width=\"5\" cellpadding=\"0\" cellspacing=\"0\" valign=\"top\"></td>";
  220.     echo "<td width=\"49%\" valign=\"top\">";
  221.     print $parem;
  222.     echo "</td>";
  223.     echo "</tr>";
  224.     echo "</table>";
  225.     }
  226.  
  227. //($pagecycle > 0 and newtopic !=0))
  228.  
  229. }
  230.  
  231. /************************************************************/
  232. /* Function themeindex()                                    */
  233. /*                                                          */
  234. /* This function format the stories on the story page, when */
  235. /* you click on that "Read More..." link in the home        */
  236. /************************************************************/
  237.  
  238. function themearticle ($aid, $informant, $datetime, $title, $thetext, $topic, $topicname, $topicimage, $topictext) {
  239.     global $admin, $sid, $tipath;
  240.     $ThemeSel = get_theme();
  241.     if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  242.     $t_image = "themes/$ThemeSel/images/topics/$topicimage";
  243.     } else {
  244.     $t_image = "$tipath$topicimage";
  245.     }
  246.     $posted = ""._POSTEDON." $datetime "._BY." ";
  247.     $posted .= get_author($aid);
  248.     if ($notes != "") {
  249.     $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
  250.     } else {
  251.     $notes = "";
  252.     }
  253.     if ("$aid" == "$informant") {
  254.     $content = "$thetext$notes\n";
  255.     } else {
  256.     if($informant != "") {
  257.         $content = "<a href=\"modules.php?name=Your_Account&op=userinfo&username=$informant\">$informant</a> ";
  258.     } else {
  259.         $content = "$anonymous ";
  260.     }
  261.     $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
  262.     }
  263.     $tmpl_file = "themes/Odyssey/story_page.html";
  264.     $thefile = implode("", file($tmpl_file));
  265.     $thefile = addslashes($thefile);
  266.     $thefile = "\$r_file=\"".$thefile."\";";
  267.     eval($thefile);
  268.     print $r_file;
  269. }
  270.  
  271. /************************************************************/
  272. /* Function themesidebox()                                  */
  273. /*                                                          */
  274. /* Control look of your blocks. Just simple.                */
  275. /************************************************************/
  276.  
  277. function themesidebox($title, $content) {
  278.     $tmpl_file = "themes/Odyssey/blocks.html";
  279.     $thefile = implode("", file($tmpl_file));
  280.     $thefile = addslashes($thefile);
  281.     $thefile = "\$r_file=\"".$thefile."\";";
  282.     eval($thefile);
  283.     print $r_file;
  284. }
  285.  
  286. ?>