[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/popups/ -> pollwindow.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  //$adminside = 3;
  17  //require_once('../../index.php');
  18  
  19  /** Set flag that this is a parent file */
  20  if (!defined('_VALID_MOS')) define( '_VALID_MOS', 1 );
  21  
  22  global $mainframe, $database, $mosConfig_absolute_path;
  23  
  24  require_once ('../../includes/database.php');
  25  require_once ('../../includes/core.classes.php');
  26  
  27  $configuration =& mamboCore::getMamboCore();
  28  $database =& mamboDatabase::getInstance();
  29  
  30  $pollid = (int) mosGetParam( $_REQUEST, 'pollid', 0 );
  31  $css = mosGetParam( $_REQUEST, 't', '' );
  32  
  33  // @RawSQLUse, trivial_implementation, SELECT, CONCEPT
  34  $database->setQuery( "SELECT title FROM #__polls WHERE id='$pollid'" );
  35  $title = $database->loadResult();
  36  
  37  // @RawSQLUse, trivial_implementation, SELECT, CONCEPT
  38  $database->setQuery( "SELECT text FROM #__poll_data WHERE pollid='$pollid' order by id" );
  39  $options = $database->loadResultArray();
  40  ?>
  41  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  42  <html>
  43  <head>
  44      <title><?php echo T_('Poll Preview') ?></title>
  45      <meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
  46      <link rel="stylesheet" href="../../templates/<?php echo $css; ?>/css/template_css.css" type="text/css">
  47  </head>
  48  
  49  <body>
  50  <form>
  51  <table align="center" width="90%" cellspacing="2" cellpadding="2" border="0" >
  52      <tr>
  53          <td class="moduleheading" colspan="2"><?php echo $title; ?></td>
  54      </tr>
  55      <?php foreach ($options as $text)
  56      {
  57          if ($text <> "")
  58          {?>
  59          <tr>
  60              <td valign="top" height="30"><input type="radio" name="poll" value="<?php echo $text; ?>"></td>
  61              <td class="poll" width="100%" valign="top"><?php echo $text; ?></td>
  62          </tr>
  63          <?php }
  64      } ?>
  65      <tr>
  66          <td valign="middle" height="50" colspan="2" align="center"><input type="button" name="submit" value="<?php echo T_('Vote') ?>">&nbsp;&nbsp;<input type="button" name="result" value="<?php echo T_('Results') ?>"></td>
  67      </tr>
  68      <tr>
  69          <td align="center" colspan="2"><a href="#" onClick="window.close()"><?php echo T_('Close') ?></a></td>
  70      </tr>
  71  </table>
  72  </form>
  73  
  74  </body>
  75  </html>
  76  
  77  <?php
  78  /**
  79  * Utility function to return a value from a named array or a specified default
  80  */
  81  define( "_MOS_NOTRIM", 0x0001 );
  82  define( "_MOS_ALLOWHTML", 0x0002 );
  83  define( "_MOS_ALLOWRAW", 0x0004 );
  84  define( "_MOS_NOMAGIC", 0x0008 );
  85  function mosGetParam( &$arr, $name, $def=null, $mask=0 ) {
  86      if (isset( $arr[$name] )) {
  87          if (is_array($arr[$name])) foreach ($arr[$name] as $key=>$element) $result[$key] = mosGetParam ($arr[$name], $key, $def, $mask);
  88          else {
  89              $result = $arr[$name];
  90              if (!($mask&_MOS_NOTRIM)) $result = trim($result);
  91              if (!is_numeric( $result)) {
  92                  if (!($mask&_MOS_ALLOWHTML)) $result = strip_tags($result);
  93                  if (!($mask&_MOS_ALLOWRAW)) {
  94                      if (is_numeric($def)) $result = intval($result);
  95                  }
  96              }
  97              if (!get_magic_quotes_gpc()) {
  98                  $result = addslashes( $result );
  99              }
 100          }
 101          return $result;
 102      } else {
 103          return $def;
 104      }
 105  } 
 106  ?>