[ Index ]
 

Code source de PHP NUKE 7.9

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

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

   1  <?php
   2  
   3  /************************************************************************/

   4  /* PHP-NUKE: Web Portal System                                          */

   5  /* ===========================                                          */

   6  /*                                                                      */

   7  /* Copyright (c) 2005 by Francisco Burzi                                */

   8  /* http://phpnuke.org                                                   */

   9  /*                                                                      */

  10  /* This program is free software. You can redistribute it and/or modify */

  11  /* it under the terms of the GNU General Public License as published by */

  12  /* the Free Software Foundation; either version 2 of the License.       */

  13  /************************************************************************/

  14  
  15  if ( !defined('BLOCK_FILE') ) {
  16      Header("Location: ../index.php");
  17      die();
  18  }
  19  
  20  global $prefix, $multilingual, $currentlang, $db, $tipath, $user, $cookie, $userinfo;
  21  
  22  getusrinfo($user);
  23  
  24            if (!isset($mode) OR empty($mode)) {
  25              if(isset($userinfo['umode'])) {
  26                $mode = $userinfo['umode'];
  27              } else {
  28                $mode = "thread";
  29              }
  30            }
  31            if (!isset($order) OR empty($order)) {
  32              if(isset($userinfo['uorder'])) {
  33                $order = $userinfo['uorder'];
  34              } else {
  35                $order = 0;
  36              }
  37            }
  38            if (!isset($thold) OR empty($thold)) {
  39              if(isset($userinfo['thold'])) {
  40                $thold = $userinfo['thold'];
  41              } else {
  42                $thold = 0;
  43              }
  44            }
  45  $r_options = "";
  46  $r_options .= "&amp;mode=".$mode;
  47  $r_options .= "&amp;order=".$order;
  48  $r_options .= "&amp;thold=".$thold;
  49  
  50  if ($multilingual == 1) {
  51      $querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
  52  } else {
  53      $querylang = "";
  54  }
  55  
  56  $numrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_topics"));
  57  if ($numrows > 1) {
  58      $result = $db->sql_query("SELECT topicid FROM ".$prefix."_topics");
  59      while ($row = $db->sql_fetchrow($result)) {
  60      $topicid = intval($row['topicid']);
  61      $topic_array .= "$topicid-";
  62      }
  63      $r_topic = explode("-",$topic_array);
  64      mt_srand((double)microtime()*1000000);
  65      $numrows = $numrows-1;
  66      $topic = mt_rand(0, $numrows);
  67      $topic = $r_topic[$topic];
  68  } else {
  69      $topic = 1;
  70  }
  71  $row2 = $db->sql_fetchrow($db->sql_query("SELECT topicimage, topictext FROM ".$prefix."_topics WHERE topicid='$topic'"));
  72  $topicimage = filter($row2['topicimage'], "nohtml");
  73  $topictext = filter($row2['topictext'], "nohtml");
  74  $content = "<br><center><a href=\"modules.php?name=News&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>";
  75  $content .= "<table border=\"0\" width=\"100%\">";
  76  $result3 = $db->sql_query("SELECT sid, title FROM ".$prefix."_stories WHERE topic='$topic' $querylang ORDER BY sid DESC LIMIT 0,9");
  77  while ($row3 = $db->sql_fetchrow($result3)) {
  78  $sid = intval($row3['sid']);
  79  $title = $row3['title'];
  80      $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>";
  81  }
  82  $content .= "</table>";
  83  
  84  ?>


Généré le : Sun Apr 1 11:11:59 2007 par Balluche grâce à PHPXref 0.7