PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Includes/blocks/block_survey.php

https://code.google.com/p/nuked-klan/
PHP | 107 lines | 79 code | 20 blank | 8 comment | 16 complexity | e8e628185be7a018010bd9ef12e5c924 MD5 | raw file
Possible License(s): GPL-3.0, BSD-3-Clause, GPL-2.0, LGPL-3.0, LGPL-2.1
  1. <?php
  2. // -------------------------------------------------------------------------//
  3. // Nuked-KlaN - PHP Portal //
  4. // http://www.nuked-klan.org //
  5. // -------------------------------------------------------------------------//
  6. // This program is free software. you can redistribute it and/or modify //
  7. // it under the terms of the GNU General Public License as published by //
  8. // the Free Software Foundation; either version 2 of the License. //
  9. // -------------------------------------------------------------------------//
  10. defined('INDEX_CHECK') or die ('You can\'t run this file alone.');
  11. function affich_block_survey($blok){
  12. global $file, $nuked;
  13. if ($file != 'Survey'){
  14. $survey_id = $blok['content'];
  15. $blok['content'] = '';
  16. if ($survey_id != '') $where = 'WHERE sid = \'' . $survey_id . '\' ';
  17. else $where = 'ORDER BY sid DESC LIMIT 0, 1';
  18. $sql = mysql_query('SELECT sid, titre FROM ' . SURVEY_TABLE . ' ' . $where);
  19. list($poll_id, $titre) = mysql_fetch_array($sql);
  20. $titre = printSecuTags($titre);
  21. $blok['content'] = '<form action="index.php?file=Survey&amp;nuked_nude=index&amp;op=update_sondage" method="post">'."\n"
  22. . '<div style="text-align: center">'."\n"
  23. . '<b>' . $titre . '</b><br /><p style="text-align: left" >'."\n";
  24. $sql2 = mysql_query('SELECT voteID, optionText FROM ' . SURVEY_DATA_TABLE . ' WHERE sid = \'' . $poll_id . '\' ORDER BY voteID ASC');
  25. while (list($voteid, $optiontext) = mysql_fetch_array($sql2)){
  26. $optiontext = printSecuTags($optiontext);
  27. $blok['content'] .= '<input type="radio" class="checkbox" name="voteID" value="' . $voteid . '" />&nbsp;' . $optiontext . '<br />'."\n";
  28. }
  29. $blok['content'] .= '</p><p style="text-align: center"><input type="hidden" name="poll_id" value="' . $poll_id . '" />'."\n"
  30. . '<br /><input type="submit" value="' . _TOVOTE . '" />&nbsp;'
  31. . '<input type="button" value="' . _RESULT . '" onclick="document.location=\'index.php?file=Survey&amp;op=affich_res&amp;poll_id=' . $poll_id . '\'" />'."\n"
  32. . '<br /><a href="index.php?file=Survey"><b>' . _OTHERPOLL . '</b></a></p></div></form>'."\n";
  33. }
  34. return $blok;
  35. }
  36. function edit_block_survey($bid){
  37. global $nuked, $language;
  38. $sql = mysql_query('SELECT active, position, titre, module, content, type, nivo, page FROM ' . BLOCK_TABLE . ' WHERE bid = \'' . $bid . '\' ');
  39. list($active, $position, $titre, $modul, $content, $type, $nivo, $pages) = mysql_fetch_array($sql);
  40. $titre = printSecuTags($titre);
  41. if ($active == 1) $checked1 = 'selected="selected"';
  42. else if ($active == 2) $checked2 = 'selected="selected"';
  43. else $checked0 = 'selected="selected"';
  44. echo '<div class="content-box">',"\n" //<!-- Start Content Box -->
  45. , '<div class="content-box-header"><h3>' , _BLOCKADMIN , '</h3>',"\n"
  46. , '<a href="help/' , $language , '/block.html" rel="modal">',"\n"
  47. , '<img style="border: 0;" src="help/help.gif" alt="" title="' , _HELP , '" /></a>',"\n"
  48. , '</div>',"\n"
  49. , '<div class="tab-content" id="tab2"><form method="post" action="index.php?file=Admin&amp;page=block&amp;op=modif_block">',"\n"
  50. , '<table style="margin-left: auto;margin-right: auto;text-align: left;" cellspacing="0" cellpadding="2" border="0">',"\n"
  51. , '<tr><td><b>' , _TITLE , '</b></td><td><b>' , _BLOCK , '</b></td><td><b>' , _POSITION , '</b></td><td><b>' , _LEVEL , '</b></td></tr>',"\n"
  52. , '<tr><td align="center"><input type="text" name="titre" size="40" value="' , $titre , '" /></td>',"\n"
  53. , '<td align="center"><select name="active">',"\n"
  54. , '<option value="1" ' , $checked1 , '>' , _LEFT , '</option>',"\n"
  55. , '<option value="2" ' , $checked2 , '>' , _RIGHT , '</option>',"\n"
  56. , '<option value="0" ' , $checked0 , '>' , _OFF , '</option></select></td>',"\n"
  57. , '<td align="center"><input type="text" name="position" size="2" value="' , $position , '" /></td>',"\n"
  58. , '<td align="center"><select name="nivo"><option>' , $nivo , '</option>',"\n"
  59. , '<option>0</option>',"\n"
  60. , '<option>1</option>',"\n"
  61. , '<option>2</option>',"\n"
  62. , '<option>3</option>',"\n"
  63. , '<option>4</option>',"\n"
  64. , '<option>5</option>',"\n"
  65. , '<option>6</option>',"\n"
  66. , '<option>7</option>',"\n"
  67. , '<option>8</option>',"\n"
  68. , '<option>9</option></select></td></tr><tr><td colspan="4"><b>' , _POLL , ' :</b>&nbsp;<select name="content">',"\n";
  69. $sql2 = mysql_query('SELECT sid, titre FROM ' . SURVEY_TABLE . ' ORDER BY sid DESC');
  70. while (list($survey_id, $survey_title) = mysql_fetch_array($sql2)){
  71. $survey_title = printSecuTags($survey_title);
  72. if ($survey_id == $content) $checked3 = "selected=\"selected\"";
  73. else $checked3 = "";
  74. echo '<option value="' . $survey_id . '" ' . $checked3 . '>' . $survey_title . '</option>'."\n";
  75. }
  76. echo '</select></td></tr><tr><td colspan="4">&nbsp;</td></tr>',"\n"
  77. , '<tr><td colspan="4" align="center"><b>' , _PAGESELECT , ' :</b></td></tr><tr><td colspan="4">&nbsp;</td></tr>',"\n"
  78. , '<tr><td colspan="4" align="center"><select name="pages[]" size="8" multiple="multiple">',"\n";
  79. select_mod2($pages);
  80. echo '</select></td></tr><tr><td colspan="4" align="center"><br />',"\n"
  81. , '<input type="hidden" name="type" value="' , $type , '" />',"\n"
  82. , '<input type="hidden" name="bid" value="' , $bid , '" />',"\n"
  83. , '<input type="submit" name="send" value="' , _MODIFBLOCK , '" />',"\n"
  84. , '</td></tr></table>',"\n"
  85. , '<div style="text-align: center;"><br />[ <a href="index.php?file=Admin&amp;page=block"><b>' , _BACK , '</b></a> ]</div></form><br /></div></div>',"\n";
  86. }
  87. ?>