[ Index ]
 

Code source de PHP NUKE 7.9

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

title

Body

[fermer]

/blocks/ -> block-Survey.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, $boxTitle, $content, $pollcomm, $user, $cookie, $userinfo;
  21  
  22  if ($multilingual == 1) {
  23      $querylang = "WHERE planguage='$currentlang' AND artid='0'";
  24  } else {
  25      $querylang = "WHERE artid='0'";
  26  }
  27  
  28  $row = $db->sql_fetchrow($db->sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT 1"));
  29  $pollID = intval($row['pollID']);
  30  if ($pollID == 0 || empty($pollID)) {
  31      $content = "";
  32  } else {
  33      $content .= "<form action=\"modules.php?name=Surveys\" method=\"post\">";
  34      $content .= "<input type=\"hidden\" name=\"pollID\" value=\"".$pollID."\">";
  35      $row2 = $db->sql_fetchrow($db->sql_query("SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID='$pollID'"));
  36      $pollTitle = filter($row2['pollTitle'], "nohtml");
  37      $voters = intval($row2['voters']);
  38      $boxTitle = _SURVEY;
  39      $content .= "<span class=\"content\"><strong>$pollTitle</strong></span><br><br>\n";
  40      $content .= "<table border=\"0\" width=\"100%\">";
  41      for($i = 1; $i <= 12; $i++) {
  42          $row3 = $db->sql_fetchrow($db->sql_query("SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')"));
  43          if(isset($row3)) {
  44              $optionText = $row3['optionText'];
  45              if ($optionText != "") {
  46                  $content .= "<tr><td valign=\"top\"><input type=\"radio\" name=\"voteID\" value=\"".$i."\"></td><td width=\"100%\"><span class=\"content\">$optionText</span></td></tr>\n";
  47              }
  48          }
  49      }
  50      $content .= "</table><br><center><span class=\"content\"><input type=\"submit\" value=\""._VOTE."\"></span><br>";
  51      if (is_user($user)) {
  52          cookiedecode($user);
  53              getusrinfo($user);
  54      }
  55      $sum = 0;
  56      for($i = 0; $i < 12; $i++) {
  57          $row4 = $db->sql_fetchrow($db->sql_query("SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')"));
  58          $optionCount = intval($row4['optionCount']);
  59          $sum = (int)$sum+$optionCount;
  60      }
  61  
  62            if (!isset($mode) OR empty($mode)) {
  63              if(isset($userinfo['umode'])) {
  64                $mode = $userinfo['umode'];
  65              } else {
  66                $mode = "thread";
  67              }
  68            }
  69            if (!isset($order) OR empty($order)) {
  70              if(isset($userinfo['uorder'])) {
  71                $order = $userinfo['uorder'];
  72              } else {
  73                $order = 0;
  74              }
  75            }
  76            if (!isset($thold) OR empty($thold)) {
  77              if(isset($userinfo['thold'])) {
  78                $thold = $userinfo['thold'];
  79              } else {
  80                $thold = 0;
  81              }
  82            }
  83      $r_options = "";
  84      $r_options .= "&amp;mode=".$mode;
  85      $r_options .= "&amp;order=".$order;
  86      $r_options .= "&amp;thold=".$thold;
  87      // Quake - end

  88      $content .= "<br><span class=\"content\"><a href=\"modules.php?name=Surveys&amp;op=results&amp;pollID=".$pollID.$r_options."\"><strong>"._RESULTS."</strong></a><br><a href=\"modules.php?name=Surveys\"><strong>"._POLLS."</strong></a><br>";
  89      if ($pollcomm) {
  90          $numcom = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pollcomments WHERE pollID='$pollID'"));
  91          $content .= "<br>"._VOTES.": <strong>".intval($sum)."</strong> <br> "._PCOMMENTS." <strong>".intval($numcom)."</strong>\n\n";
  92      } else {
  93          $content .= "<br>"._VOTES." <strong>".intval($sum)."</strong>\n\n";
  94      }
  95      $content .= "</span></center></form>\n\n";
  96  }
  97  
  98  ?>


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