[ Index ]

PHP Cross Reference of Nuke-Evolution v2.0.5

title

Body

[close]

/blocks/ -> block-Random_Headlines.php (source)

   1  <?php
   2  /*=======================================================================
   3   Nuke-Evolution Basic: Enhanced PHP-Nuke Web Portal System
   4   =======================================================================*/
   5  
   6  /************************************************************************/
   7  /* PHP-NUKE: Web Portal System                                          */
   8  /* ===========================                                          */
   9  /*                                                                      */
  10  /* Copyright (c) 2002 by Francisco Burzi                                */
  11  /* http://phpnuke.org                                                   */
  12  /*                                                                      */
  13  /* This program is free software. You can redistribute it and/or modify */
  14  /* it under the terms of the GNU General Public License as published by */
  15  /* the Free Software Foundation; either version 2 of the License.       */
  16  /************************************************************************/
  17  /*         Additional security & Abstraction layer conversion           */
  18  /*                           2003 chatserv                              */
  19  /*      http://www.nukefixes.com -- http://www.nukeresources.com        */
  20  /************************************************************************/
  21  
  22  /*****[CHANGES]**********************************************************
  23  -=[Base]=-
  24        Nuke Patched                             v3.1.0       06/26/2005
  25   ************************************************************************/
  26  
  27  if(!defined('NUKE_EVO')) exit;
  28  
  29  global $prefix, $multilingual, $currentlang, $db, $tipath, $user, $cookie, $userinfo;
  30  
  31  if (!isset($mode) OR empty($mode)) {
  32      if(isset($userinfo['umode'])) {
  33        $mode = $userinfo['umode'];
  34      } else {
  35        $mode = "thread";
  36      }
  37  }
  38  if (!isset($order) OR empty($order)) {
  39      if(isset($userinfo['uorder'])) {
  40        $order = $userinfo['uorder'];
  41      } else {
  42        $order = 0;
  43      }
  44  }
  45  if (!isset($thold) OR empty($thold)) {
  46      if(isset($userinfo['thold'])) {
  47        $thold = $userinfo['thold'];
  48      } else {
  49        $thold = 0;
  50      }
  51  }
  52  $r_options = "";
  53  $r_options .= "&amp;mode=".$mode;
  54  $r_options .= "&amp;order=".$order;
  55  $r_options .= "&amp;thold=".$thold;
  56  
  57  if ($multilingual == 1) {
  58      $querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
  59  } else {
  60      $querylang = "";
  61  }
  62  
  63  $sql = "SELECT * FROM ".$prefix."_topics";
  64  $query = $db->sql_query($sql);
  65  $numrows = $db->sql_numrows($query);
  66  if ($numrows > 1) {
  67      $sql = "SELECT topicid FROM ".$prefix."_topics";
  68      $result = $db->sql_query($sql);
  69      while (list($topicid) = $db->sql_fetchrow($result)) {
  70      $topicid = intval($topicid);
  71      $topic_array .= "$topicid-";
  72      }
  73      $r_topic = explode("-",$topic_array);
  74      mt_srand((double)microtime()*1000000);
  75      $numrows = $numrows-1;
  76      $topic = mt_rand(0, $numrows);
  77      $topic = $r_topic[$topic];
  78  } else {
  79      $topic = 1;
  80  }
  81  $db->sql_freeresult($query);
  82  
  83  $sql2 = "SELECT topicimage, topictext FROM ".$prefix."_topics WHERE topicid='$topic'";
  84  $query2 = $db->sql_query($sql2);
  85  list($topicimage, $topictext) = $db->sql_fetchrow($query2);
  86  $db->sql_freeresult($query2);
  87  $content = "<br /><center><a href=\"modules.php?name=News&amp;new_topic=$topic\"><img src=\"$tipath$topicimage\" border=\"0\" alt=\"$topictext\" title=\"$topictext\"></a><br />[ <a href=\"modules.php?name=Search&amp;topic=$topic\">$topictext</a> ]</center><br />";
  88  $content .= "<table border=\"0\" width=\"100%\">";
  89  $sql3 = "SELECT sid, title FROM ".$prefix."_stories WHERE topic='$topic' $querylang ORDER BY sid DESC LIMIT 0,9";
  90  $result3 = $db->sql_query($sql3);
  91  while (list($sid, $title) = $db->sql_fetchrow($result3)) {
  92    $content .= "<tr><td valign=\"top\"><strong><big>&middot;</big></strong></td><td><a href=\"modules.php?name=News&amp;file=article&amp;sid=$sid$r_options\">$title</a></td></tr>";
  93  }
  94  $db->sql_freeresult($result3);
  95  $content .= "</table>";
  96  
  97  ?>


Generated: Wed Jun 6 11:38:01 2007 Cross-referenced by PHPXref 0.7