Beehive PHP Cross Reference Discussion Forums

Source: /edit_poll.php - 1100 lines - 48061 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*======================================================================
   4  Copyright Project Beehive Forum 2002
   5  
   6  This file is part of Beehive Forum.
   7  
   8  Beehive Forum is free software; you can redistribute it and/or modify
   9  it under the terms of the GNU General Public License as published by
  10  the Free Software Foundation; either version 3 of the License, or
  11  (at your option) any later version.
  12  
  13  Beehive Forum is distributed in the hope that it will be useful,
  14  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  GNU General Public License for more details.
  17  
  18  You should have received a copy of the GNU General Public License
  19  along with Beehive; if not, write to the Free Software
  20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  21  USA
  22  ======================================================================*/
  23  
  24  // Bootstrap
  25  require_once  'boot.php';
  26  
  27  // Required includes
  28  require_once  BH_INCLUDE_PATH . 'constants.inc.php';
  29  require_once  BH_INCLUDE_PATH . 'emoticons.inc.php';
  30  require_once  BH_INCLUDE_PATH . 'fixhtml.inc.php';
  31  require_once  BH_INCLUDE_PATH . 'folder.inc.php';
  32  require_once  BH_INCLUDE_PATH . 'form.inc.php';
  33  require_once  BH_INCLUDE_PATH . 'format.inc.php';
  34  require_once  BH_INCLUDE_PATH . 'forum.inc.php';
  35  require_once  BH_INCLUDE_PATH . 'header.inc.php';
  36  require_once  BH_INCLUDE_PATH . 'html.inc.php';
  37  require_once  BH_INCLUDE_PATH . 'messages.inc.php';
  38  require_once  BH_INCLUDE_PATH . 'perm.inc.php';
  39  require_once  BH_INCLUDE_PATH . 'poll.inc.php';
  40  require_once  BH_INCLUDE_PATH . 'post.inc.php';
  41  require_once  BH_INCLUDE_PATH . 'session.inc.php';
  42  require_once  BH_INCLUDE_PATH . 'thread.inc.php';
  43  require_once  BH_INCLUDE_PATH . 'user.inc.php';
  44  require_once  BH_INCLUDE_PATH . 'word_filter.inc.php';
  45  // End Required includes
  46  
  47  // Check we're logged in correctly
  48  if (!session::logged_in()) {
  49      html_guest_error();
  50  }
  51  
  52  $tid = null;
  53  $pid = null;
  54  $edit_msg = null;
  55  
  56  $error_msg_array = array();
  57  
  58  if (forum_get_setting('allow_polls', 'N')) {
  59      html_draw_error(gettext("Polls have been disabled by the forum owner."));
  60  }
  61  
  62  if (isset($_GET['msg']) && validate_msg($_GET['msg'])) {
  63  
  64      $edit_msg = $_GET['msg'];
  65  
  66      list($tid, $pid) = explode('.', $edit_msg);
  67  
  68      if (!($fid = thread_get_folder_fid($tid))) {
  69          html_draw_error(gettext("The requested thread could not be found or access was denied."));
  70      }
  71  
  72  } else if (isset($_POST['msg']) && validate_msg($_POST['msg'])) {
  73  
  74      $edit_msg = $_POST['msg'];
  75  
  76      list($tid, $pid) = explode('.', $_POST['msg']);
  77  
  78      if (!($fid = thread_get_folder_fid($tid))) {
  79          html_draw_error(gettext("The requested thread could not be found or access was denied."));
  80      }
  81  
  82  } else {
  83  
  84      html_draw_error(gettext("No message specified for editing"));
  85  }
  86  
  87  if (isset($_POST['return_msg']) && validate_msg($_POST['return_msg'])) {
  88      $return_msg = $_POST['return_msg'];
  89  } else if (isset($_GET['return_msg']) && validate_msg($_GET['return_msg'])) {
  90      $return_msg = $_GET['return_msg'];
  91  } else {
  92      $return_msg = $msg;
  93  }
  94  
  95  if (!thread_is_poll($tid) || ($pid != 1)) {
  96  
  97      header_redirect("edit.php?webtag=$webtag&msg=$msg&return_msg=$return_msg");
  98      exit;
  99  }
 100  
 101  if (!folder_get_by_type_allowed(FOLDER_ALLOW_POLL_THREAD)) {
 102  
 103      html_message_type_error();
 104      exit;
 105  }
 106  
 107  if (!($fid = thread_get_folder_fid($tid))) {
 108      html_draw_error(gettext("The requested thread could not be found or access was denied."));
 109  }
 110  
 111  if (session::check_perm(USER_PERM_EMAIL_CONFIRM, 0)) {
 112  
 113      html_email_confirmation_error();
 114      exit;
 115  }
 116  
 117  if (!session::check_perm(USER_PERM_POST_EDIT | USER_PERM_POST_READ, $fid)) {
 118      html_draw_error(gettext("You cannot edit posts in this folder"));
 119  }
 120  
 121  if (!($thread_data = thread_get($tid))) {
 122      html_draw_error(gettext("The requested thread could not be found or access was denied."));
 123  }
 124  
 125  if (!$edit_message = messages_get($tid, 1, 1)) {
 126  
 127      html_draw_top(sprintf("title=%s", gettext("Error")));
 128      html_display_error_msg(gettext("That post does not exist in this thread!"));
 129      html_draw_bottom();
 130      exit;
 131  }
 132  
 133  $post_edit_time = forum_get_setting('post_edit_time', 'is_numeric', 0);
 134  
 135  $show_sigs = session::show_sigs();
 136  
 137  $page_prefs = session::get_post_page_prefs();
 138  
 139  if ((forum_get_setting('allow_post_editing', 'N') || (($_SESSION['UID'] != $edit_message['FROM_UID']) && !(perm_get_user_permissions($edit_message['FROM_UID']) & USER_PERM_PILLORIED)) || (session::check_perm(USER_PERM_PILLORIED, 0)) || ($post_edit_time > 0 && (time() - $edit_message['CREATED']) >= ($post_edit_time * HOUR_IN_SECONDS))) && !session::check_perm(USER_PERM_FOLDER_MODERATE, $fid)) {
 140      html_draw_error(gettext("You are not permitted to edit this message."), 'discussion.php', 'get', array('back' => gettext("Back")), array('msg' => $return_msg));
 141  }
 142  
 143  $poll_data = poll_get($tid);
 144  
 145  $poll_questions_array = poll_get_votes($tid);
 146  
 147  $valid = true;
 148  
 149  if (isset($_POST['thread_title'])) {
 150  
 151      if (strlen(trim($_POST['thread_title'])) > 0) {
 152          $thread_title = trim($_POST['thread_title']);
 153      } else {
 154          $thread_title = '';
 155      }
 156  
 157  } else {
 158  
 159      $thread_title = $thread_data['TITLE'];
 160  }
 161  
 162  if (isset($_POST['fid'])) {
 163  
 164      if (is_numeric($_POST['fid']) && ($_POST['fid'] > 0)) {
 165          $fid = $_POST['fid'];
 166      } else {
 167          $fid = 1;
 168      }
 169  }
 170  
 171  if (isset($_POST['poll_questions'])) {
 172  
 173      if (is_array($_POST['poll_questions'])) {
 174  
 175          $poll_questions_array = array();
 176  
 177          foreach ($_POST['poll_questions'] as $question) {
 178  
 179              if (isset($question['question']) || isset($question['options'])) {
 180  
 181                  $poll_question = array(
 182                      'QUESTION_ID' => sizeof($poll_questions_array) + 1,
 183                      'QUESTION' => (isset($question['question']) ? $question['question'] : ''),
 184                      'ALLOW_MULTI' => (isset($question['allow_multi']) && $question['allow_multi'] == 'Y') ? 'Y' : 'N',
 185                      'OPTIONS_ARRAY' => array(),
 186                  );
 187  
 188                  if (isset($question['options']) && is_array($question['options'])) {
 189  
 190                      foreach ($question['options'] as $option) {
 191  
 192                          if (!is_scalar($option)) continue;
 193  
 194                          $poll_option = array(
 195                              'OPTION_ID' => sizeof($poll_question['OPTIONS_ARRAY']) + 1,
 196                              'OPTION_NAME' => $option,
 197                          );
 198  
 199                          $poll_question['OPTIONS_ARRAY'][$poll_option['OPTION_ID']] = $poll_option;
 200                      }
 201                  }
 202  
 203                  $poll_questions_array[$poll_question['QUESTION_ID']] = $poll_question;
 204              }
 205          }
 206  
 207      } else {
 208  
 209          $poll_questions_array = poll_get_default_questions_array();
 210      }
 211  }
 212  
 213  if (sizeof($poll_questions_array) == 0) {
 214      $poll_questions_array = poll_get_default_questions_array();
 215  }
 216  
 217  if (isset($_POST['add_option']) && is_array($_POST['add_option'])) {
 218  
 219      list($question_id) = array_keys($_POST['add_option']);
 220  
 221      if (isset($poll_questions_array[$question_id])) {
 222  
 223          $option_id = sizeof($poll_questions_array[$question_id]['OPTIONS_ARRAY']) + 1;
 224  
 225          $poll_questions_array[$question_id]['OPTIONS_ARRAY'][] = poll_get_option_array($option_id);
 226      }
 227  }
 228  
 229  if (isset($_POST['add_question'])) {
 230  
 231      $question_id = sizeof($poll_questions_array) + 1;
 232  
 233      $poll_questions_array[] = poll_get_question_array($question_id);
 234  }
 235  
 236  if (isset($_POST['delete_option']) && is_array($_POST['delete_option'])) {
 237  
 238      foreach ($_POST['delete_option'] as $question_id => $option_id_array) {
 239  
 240          if (!is_array($option_id_array)) continue;
 241  
 242          if (sizeof($poll_questions_array[$question_id]['OPTIONS_ARRAY']) > 1) {
 243  
 244              foreach (array_keys($option_id_array) as $option_id) {
 245                  unset($poll_questions_array[$question_id]['OPTIONS_ARRAY'][$option_id]);
 246              }
 247          }
 248      }
 249  }
 250  
 251  if (isset($_POST['delete_question']) && is_array($_POST['delete_question'])) {
 252  
 253      list($question_id) = array_keys($_POST['delete_question']);
 254  
 255      if (sizeof($poll_questions_array) > 1) {
 256          unset($poll_questions_array[$question_id]);
 257      }
 258  }
 259  
 260  if (isset($_POST['poll_type'])) {
 261  
 262      if (is_numeric($_POST['poll_type'])) {
 263          $poll_type = $_POST['poll_type'];
 264      } else {
 265          $poll_type = POLL_HORIZONTAL_GRAPH;
 266      }
 267  
 268  } else {
 269  
 270      $poll_type = $poll_data['POLLTYPE'];
 271  }
 272  
 273  if (isset($_POST['show_results'])) {
 274  
 275      if (is_numeric($_POST['show_results'])) {
 276          $show_results = $_POST['show_results'];
 277      } else {
 278          $show_results = POLL_SHOW_RESULTS;
 279      }
 280  
 281  } else {
 282  
 283      $show_results = $poll_data['SHOWRESULTS'];
 284  }
 285  
 286  if (isset($_POST['poll_vote_type'])) {
 287  
 288      if (is_numeric($_POST['poll_vote_type'])) {
 289          $poll_vote_type = $_POST['poll_vote_type'];
 290      } else {
 291          $poll_vote_type = POLL_VOTE_ANON;
 292      }
 293  
 294  } else {
 295  
 296      $poll_vote_type = $poll_data['VOTETYPE'];
 297  }
 298  
 299  if (isset($_POST['option_type'])) {
 300  
 301      if (is_numeric($_POST['option_type'])) {
 302          $option_type = $_POST['option_type'];
 303      } else {
 304          $option_type = POLL_OPTIONS_RADIOS;
 305      }
 306  
 307  } else {
 308  
 309      $option_type = $poll_data['OPTIONTYPE'];
 310  }
 311  
 312  if (isset($_POST['change_vote'])) {
 313  
 314      if (is_numeric($_POST['change_vote'])) {
 315          $change_vote = $_POST['change_vote'];
 316      } else {
 317          $change_vote = POLL_VOTE_CAN_CHANGE;
 318      }
 319  
 320  } else {
 321  
 322      $change_vote = $poll_data['CHANGEVOTE'];
 323  }
 324  
 325  if (isset($_POST['allow_guests'])) {
 326  
 327      if (is_numeric($_POST['allow_guests'])) {
 328          $allow_guests = $_POST['allow_guests'];
 329      } else {
 330          $allow_guests = POLL_GUEST_DENIED;
 331      }
 332  
 333  } else {
 334  
 335      if (forum_get_setting('poll_allow_guests', 'N')) {
 336          $allow_guests = POLL_GUEST_DENIED;
 337      } else {
 338          $allow_guests = $poll_data['ALLOWGUESTS'];
 339      }
 340  }
 341  
 342  if (isset($_POST['close_poll'])) {
 343  
 344      if (is_numeric($_POST['close_poll'])) {
 345          $close_poll = $_POST['close_poll'];
 346      } else {
 347          $close_poll = POLL_CLOSE_NO_CHANGE;
 348      }
 349  
 350  } else {
 351  
 352      $close_poll = POLL_CLOSE_NO_CHANGE;
 353  }
 354  
 355  $allow_html = true;
 356  
 357  if (isset($fid) && !session::check_perm(USER_PERM_HTML_POSTING, $fid)) {
 358      $allow_html = false;
 359  }
 360  
 361  if (isset($_POST['preview_poll']) || isset($_POST['preview_form']) || isset($_POST['apply'])) {
 362  
 363      $valid = true;
 364  
 365      if (!isset($thread_title) || strlen(trim($thread_title)) == 0) {
 366  
 367          $error_msg_array[] = gettext("You must enter a title for the thread!");
 368          $valid = false;
 369      }
 370  
 371      if (!isset($fid) || !folder_is_valid($fid)) {
 372  
 373          $error_msg_array[] = gettext("Unknown folder");
 374          $valid = false;
 375      }
 376  
 377      if (!session::check_perm(USER_PERM_THREAD_CREATE | USER_PERM_POST_READ, $fid)) {
 378  
 379          $error_msg_array[] = gettext("You cannot create new threads in this folder");
 380          $valid = false;
 381      }
 382  
 383      if (!folder_thread_type_allowed($fid, FOLDER_ALLOW_POLL_THREAD)) {
 384  
 385          $error_msg_array[] = gettext("You cannot post this thread type in that folder!");
 386          $valid = false;
 387      }
 388  
 389      if ($valid && (!isset($poll_type) || !is_numeric($poll_type))) {
 390  
 391          $error_msg_array[] = gettext("You must provide a poll type");
 392          $valid = false;
 393      }
 394  
 395      if ($valid && (!isset($show_results) || !is_numeric($show_results))) {
 396  
 397          $error_msg_array[] = gettext("You must provide results display type");
 398          $valid = false;
 399      }
 400  
 401      if ($valid && (!isset($poll_vote_type) || !is_numeric($poll_vote_type))) {
 402  
 403          $error_msg_array[] = gettext("You must provide a poll vote type");
 404          $valid = false;
 405      }
 406  
 407      if ($valid && (!isset($option_type) || !is_numeric($option_type))) {
 408  
 409          $error_msg_array[] = gettext("You must provide a poll option type");
 410          $valid = false;
 411      }
 412  
 413      if ($valid && (!isset($change_vote) || !is_numeric($change_vote))) {
 414  
 415          $error_msg_array[] = gettext("You must provide a poll vote type");
 416          $valid = false;
 417      }
 418  
 419      if ($valid && (!isset($allow_guests) || !is_numeric($allow_guests))) {
 420  
 421          $error_msg_array[] = gettext("You must specify if guests should be allowed to vote");
 422          $valid = false;
 423      }
 424  
 425      if (!isset($close_poll) || !is_numeric($close_poll)) {
 426          $close_poll = false;
 427      }
 428  
 429      $poll_option_count = 0;
 430  
 431      if (isset($poll_questions_array) && sizeof($poll_questions_array) > 0) {
 432  
 433          foreach ($poll_questions_array as $question_id => $question) {
 434  
 435              if (!isset($question['ALLOW_MULTI']) || ($question['ALLOW_MULTI'] != 'Y')) {
 436                  $poll_questions_array[$question_id]['ALLOW_MULTI'] = 'N';
 437              }
 438  
 439              if (($option_type == POLL_OPTIONS_DROPDOWN) && ($question['ALLOW_MULTI'] == 'Y')) {
 440  
 441                  $error_msg_array[] = gettext("Allow multiple option selection is not available with drop-down list options display");
 442                  $valid = false;
 443              }
 444  
 445              if (!isset($question['QUESTION']) || strlen(trim($question['QUESTION'])) == 0) {
 446  
 447                  if (!isset($question['OPTIONS_ARRAY']) || !is_array($question['OPTIONS_ARRAY'])) {
 448  
 449                      unset($poll_questions_array[$question_id]);
 450  
 451                  } else {
 452  
 453                      foreach ($question['OPTIONS_ARRAY'] as $option_id => $option) {
 454  
 455                          if (!isset($option['OPTION_NAME']) || strlen(trim($option['OPTION_NAME'])) == 0) {
 456                              unset($question['OPTIONS_ARRAY'][$option_id]);
 457                          }
 458                      }
 459  
 460                      if (sizeof($question['OPTIONS_ARRAY']) == 0) {
 461  
 462                          unset($poll_questions_array[$question_id]);
 463  
 464                      } else if (sizeof($question['OPTIONS_ARRAY']) > 0) {
 465  
 466                          $error_msg_array[] = gettext("You must provide a question for all options");
 467                          $valid = false;
 468                      }
 469                  }
 470  
 471              } else if (!isset($question['OPTIONS_ARRAY']) || !is_array($question['OPTIONS_ARRAY'])) {
 472  
 473                  $error_msg_array[] = gettext("You must provide at least 2 options for each question");
 474                  $valid = false;
 475  
 476              } else {
 477  
 478                  foreach ($question['OPTIONS_ARRAY'] as $option_id => $option) {
 479  
 480                      if (!isset($option['OPTION_NAME']) || strlen(trim($option['OPTION_NAME'])) == 0) {
 481                          unset($question['OPTIONS_ARRAY'][$option_id]);
 482                      }
 483                  }
 484  
 485                  if ($allow_html == true) {
 486                      $question['QUESTION'] = fix_html(emoticons_strip($question['QUESTION']));
 487                  } else {
 488                      $question['QUESTION'] = htmlentities_array($question['QUESTION']);
 489                  }
 490  
 491                  $poll_option_count += sizeof($question['OPTIONS_ARRAY']);
 492  
 493                  if (sizeof($question['OPTIONS_ARRAY']) < 2) {
 494  
 495                      $error_msg_array[] = gettext("You must provide at least 2 options for each question");
 496                      $valid = false;
 497  
 498                  } else {
 499  
 500                      foreach ($question['OPTIONS_ARRAY'] as $option_id => $option) {
 501  
 502                          if ($allow_html == true) {
 503                              $poll_questions_array[$question_id]['OPTIONS_ARRAY'][$option_id]['OPTION_NAME'] = fix_html($option['OPTION_NAME']);
 504                          } else {
 505                              $poll_questions_array[$question_id]['OPTIONS_ARRAY'][$option_id]['OPTION_NAME'] = htmlentities_array($option['OPTION_NAME']);
 506                          }
 507                      }
 508                  }
 509              }
 510          }
 511      }
 512  
 513      if (sizeof($poll_questions_array) < 1) {
 514  
 515          $poll_questions_array = poll_get_default_questions_array();
 516  
 517          $error_msg_array[] = gettext("You must provide at least one question");
 518  
 519          $valid = false;
 520      }
 521  
 522      if ($valid && ($poll_option_count > 20)) {
 523  
 524          $error_msg_array[] = gettext("You can have a maximum of 20 options per poll");
 525          $valid = false;
 526      }
 527  
 528      if ($valid && ($poll_type == POLL_TABLE_GRAPH) && sizeof($poll_questions_array) <> 2) {
 529  
 530          $error_msg_array[] = gettext("Tabular format polls must have precisely two questions");
 531          $valid = false;
 532      }
 533  
 534      if ($valid && ($poll_type == POLL_TABLE_GRAPH) && ($change_vote == POLL_VOTE_MULTI)) {
 535  
 536          $error_msg_array[] = gettext("Tabular format polls cannot be multi-vote");
 537          $valid = false;
 538      }
 539  
 540      if ($valid && ($poll_vote_type == POLL_VOTE_PUBLIC) && ($change_vote == POLL_VOTE_MULTI)) {
 541  
 542          $error_msg_array[] = gettext("Public ballots cannot be multi-vote");
 543          $valid = false;
 544      }
 545  
 546      if ($valid && ($poll_vote_type == POLL_VOTE_PUBLIC) && ($poll_type != POLL_HORIZONTAL_GRAPH)) {
 547  
 548          $error_msg_array[] = gettext("Public ballots can only be created using horizontal graphs");
 549          $valid = false;
 550      }
 551  
 552  } else if (isset($_POST['emots_toggle_x']) || isset($_POST['sig_toggle_x']) || isset($_POST['poll_additional_message_toggle_x']) || isset($_POST['poll_advanced_toggle_x'])) {
 553  
 554      if (isset($_POST['emots_toggle_x'])) {
 555  
 556          $page_prefs = (double)$page_prefs ^ POST_EMOTICONS_DISPLAY;
 557  
 558      } else if (isset($_POST['sig_toggle_x'])) {
 559  
 560          $page_prefs = (double)$page_prefs ^ POST_SIGNATURE_DISPLAY;
 561  
 562      } else if (isset($_POST['poll_additional_message_toggle_x'])) {
 563  
 564          $page_prefs = (double)$page_prefs ^ POLL_ADDITIONAL_MESSAGE_DISPLAY;
 565  
 566      } else if (isset($_POST['poll_advanced_toggle_x'])) {
 567  
 568          $page_prefs = (double)$page_prefs ^ POLL_ADVANCED_DISPLAY;
 569      }
 570  
 571      $user_prefs = array(
 572          'POST_PAGE' => $page_prefs
 573      );
 574  
 575      if (!user_update_prefs($_SESSION['UID'], $user_prefs)) {
 576  
 577          $error_msg_array[] = gettext("Some or all of your user account details could not be updated. Please try again later.");
 578          $valid = false;
 579      }
 580  }
 581  
 582  if (isset($_POST['dedupe']) && is_numeric($_POST['dedupe'])) {
 583      $dedupe = $_POST['dedupe'];
 584  } else {
 585      $dedupe = time();
 586  }
 587  
 588  if ($valid && isset($_POST['apply'])) {
 589  
 590      if (post_check_ddkey($dedupe)) {
 591  
 592          if ($close_poll == POLL_CLOSE_ONE_DAY) {
 593  
 594              $poll_closes = time() + DAY_IN_SECONDS;
 595  
 596          } else if ($close_poll == POLL_CLOSE_THREE_DAYS) {
 597  
 598              $poll_closes = time() + (DAY_IN_SECONDS * 3);
 599  
 600          } else if ($close_poll == POLL_CLOSE_SEVEN_DAYS) {
 601  
 602              $poll_closes = time() + (DAY_IN_SECONDS * 7);
 603  
 604          } else if ($close_poll == POLL_CLOSE_THIRTY_DAYS) {
 605  
 606              $poll_closes = time() + (DAY_IN_SECONDS * 30);
 607  
 608          } else {
 609  
 610              $poll_closes = false;
 611          }
 612  
 613          $poll_delete_votes = poll_edit_check_questions($tid, $poll_questions_array) || ($poll_data['POLLTYPE'] != $poll_type) || ($poll_data['VOTETYPE'] != $poll_vote_type);
 614  
 615          poll_edit($tid, $poll_questions_array, $poll_closes, $change_vote, $poll_type, $show_results, $poll_vote_type, $option_type, $allow_guests, $poll_delete_votes);
 616  
 617          thread_change_title($tid, $thread_title);
 618  
 619          post_add_edit_text($tid, 1);
 620      }
 621  
 622      header_redirect("discussion.php?webtag=$webtag&msg=$return_msg&edit_success=$tid.1");
 623  }
 624  
 625  if (!$folder_dropdown = folder_draw_dropdown($fid, "fid", "", FOLDER_ALLOW_POLL_THREAD, USER_PERM_POST_EDIT, "", "post_folder_dropdown")) {
 626      html_draw_error(gettext("You cannot create new threads."));
 627  }
 628  
 629  html_draw_top(sprintf("title=%s", gettext("Edit Poll")), "basetarget=_blank", "resize_width=960", "js/post.js", "js/poll.js", "js/emoticons.js", 'class=window_title');
 630  
 631  echo "<h1>", gettext("Edit Poll"), "</h1>\n";
 632  
 633  if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
 634      html_display_error_array(array_unique($error_msg_array), '960', 'left');
 635  }
 636  
 637  echo "<br />\n";
 638  echo "<form accept-charset=\"utf-8\" name=\"f_poll\" action=\"edit_poll.php\" method=\"post\" target=\"_self\">\n";
 639  echo "  ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n";
 640  echo "  ", form_input_hidden("msg", htmlentities_array($edit_msg)), "\n";
 641  echo "  ", form_input_hidden('return_msg', htmlentities_array($return_msg)), "\n";
 642  echo "  ", form_input_hidden('dedupe', htmlentities_array($dedupe)), "\n";
 643  echo "  <table width=\"960\" class=\"max_width\">\n";
 644  echo "    <tr>\n";
 645  echo "      <td align=\"left\">\n";
 646  echo "        <table class=\"box\" width=\"100%\">\n";
 647  echo "          <tr>\n";
 648  echo "            <td align=\"left\" class=\"posthead\">\n";
 649  
 650  if ($valid && (isset($_POST['preview_poll']) || isset($_POST['preview_form']))) {
 651  
 652      echo "              <table class=\"posthead\" width=\"100%\">\n";
 653      echo "                <tr>\n";
 654      echo "                  <td align=\"left\" class=\"subhead\">", gettext("Preview"), "</td>\n";
 655      echo "                </tr>";
 656  
 657      $poll_data['POLLTYPE'] = $poll_type;
 658      $poll_data['VOTETYPE'] = $poll_vote_type;
 659      $poll_data['OPTIONTYPE'] = $option_type;
 660  
 661      $preview_message['RECIPIENTS'] = array();
 662  
 663      $preview_from_user = user_get($_SESSION['UID']);
 664  
 665      $poll_data['FROM_LOGON'] = $preview_from_user['LOGON'];
 666      $poll_data['FROM_NICKNAME'] = $preview_from_user['NICKNAME'];
 667      $poll_data['FROM_UID'] = $preview_from_user['UID'];
 668  
 669      $poll_preview_questions_array = $poll_questions_array;
 670  
 671      if (isset($_POST['preview_form'])) {
 672  
 673          $poll_display = poll_voting_form($poll_preview_questions_array, $poll_data);
 674  
 675      } else {
 676  
 677          $poll_display = "<div align=\"center\">\n";
 678          $poll_display .= "  <table class=\"box\" cellpadding=\"0\" cellspacing=\"0\" width=\"580\">\n";
 679          $poll_display .= "    <tr>\n";
 680          $poll_display .= "      <td align=\"center\">\n";
 681          $poll_display .= "        <table width=\"560\">\n";
 682  
 683          foreach ($poll_preview_questions_array as $question_id => $question) {
 684  
 685              foreach (array_keys($question['OPTIONS_ARRAY']) as $option_id) {
 686                  $poll_preview_questions_array[$question_id]['OPTIONS_ARRAY'][$option_id]['VOTES_ARRAY'] = array();
 687              }
 688          }
 689  
 690          $total_vote_count = 0;
 691  
 692          if (($random_users_array = poll_get_random_users(mt_rand(10, 20))) !== false) {
 693  
 694              while (($random_user = array_pop($random_users_array)) !== null) {
 695  
 696                  $total_vote_count++;
 697  
 698                  foreach ($poll_preview_questions_array as $question_id => $question) {
 699  
 700                      $option = $question['OPTIONS_ARRAY'][array_rand($question['OPTIONS_ARRAY'])];
 701  
 702                      $poll_preview_questions_array[$question_id]['OPTIONS_ARRAY'][$option['OPTION_ID']]['VOTES_ARRAY'][] = $random_user;
 703                  }
 704              }
 705          }
 706  
 707          if ($poll_data['POLLTYPE'] == POLL_TABLE_GRAPH) {
 708  
 709              $poll_display .= "          <tr>\n";
 710              $poll_display .= "            <td align=\"left\" colspan=\"2\">" . poll_table_graph($poll_preview_questions_array, $poll_data) . "</td>\n";
 711              $poll_display .= "           </tr>\n";
 712  
 713          } else {
 714  
 715              foreach ($poll_preview_questions_array as $question_id => $poll_question) {
 716  
 717                  $poll_display .= "          <tr>\n";
 718                  $poll_display .= "            <td align=\"left\"><h2>" . word_filter_add_ob_tags($poll_question['QUESTION'], true) . "</h2></td>\n";
 719                  $poll_display .= "          </tr>\n";
 720                  $poll_display .= "          <tr>\n";
 721                  $poll_display .= "            <td align=\"left\">\n";
 722                  $poll_display .= "              <table width=\"100%\">\n";
 723  
 724                  if ($poll_data['POLLTYPE'] == POLL_VERTICAL_GRAPH) {
 725  
 726                      $poll_display .= "                <tr>\n";
 727                      $poll_display .= "                  <td align=\"left\" colspan=\"2\">" . poll_vertical_graph($poll_question['OPTIONS_ARRAY'], $poll_data, $total_vote_count) . "</td>\n";
 728                      $poll_display .= "                </tr>\n";
 729  
 730                  } else if ($poll_data['VOTETYPE'] == POLL_VOTE_PUBLIC) {
 731  
 732                      $poll_display .= "                <tr>\n";
 733                      $poll_display .= "                  <td align=\"left\" colspan=\"2\">" . poll_horizontal_graph($poll_question['OPTIONS_ARRAY'], $poll_data, $total_vote_count) . "</td>\n";
 734                      $poll_display .= "                 </tr>\n";
 735  
 736                  } else {
 737  
 738                      $poll_display .= "                <tr>\n";
 739                      $poll_display .= "                  <td align=\"left\" colspan=\"2\">" . poll_horizontal_graph($poll_question['OPTIONS_ARRAY'], $poll_data, $total_vote_count) . "</td>\n";
 740                      $poll_display .= "                 </tr>\n";
 741                  }
 742  
 743                  $poll_display .= "              </table>\n";
 744                  $poll_display .= "            </td>\n";
 745                  $poll_display .= "          </tr>\n";
 746              }
 747          }
 748  
 749          $poll_display .= "          </table>\n";
 750          $poll_display .= "        </form>\n";
 751          $poll_display .= "      </td>\n";
 752          $poll_display .= "    </tr>\n";
 753          $poll_display .= "  </table>\n";
 754          $poll_display .= "</div>\n";
 755      }
 756  
 757      $poll_display .= "<p class=\"postbody\" align=\"center\">" . gettext("Note: Poll votes are randomly generated for preview only.") . "</p>\n";
 758  
 759      $poll_data['CONTENT'] = $poll_display;
 760  
 761      echo "                <tr>\n";
 762      echo "                  <td align=\"center\"><br />\n";
 763  
 764      message_display(0, $poll_data, 0, 0, 0, false, false, true, $show_sigs, true);
 765  
 766      echo "                  </td>\n";
 767      echo "                </tr>\n";
 768      echo "                <tr>\n";
 769      echo "                  <td align=\"left\">&nbsp;</td>\n";
 770      echo "                </tr>\n";
 771      echo "              </table>\n";
 772  }
 773  
 774  echo "              <table class=\"posthead\" width=\"100%\">\n";
 775  echo "                <tr>\n";
 776  echo "                  <td align=\"left\" class=\"subhead\" colspan=\"2\">", gettext("Edit Poll"), "</td>\n";
 777  echo "                </tr>\n";
 778  echo "                <tr>\n";
 779  echo "                  <td align=\"left\" valign=\"top\" width=\"210\">\n";
 780  echo "                    <table class=\"posthead\" width=\"100%\">\n";
 781  echo "                      <tr>\n";
 782  echo "                        <td align=\"left\"><h2>", gettext("Folder"), "</h2></td>\n";
 783  echo "                      </tr>\n";
 784  echo "                      <tr>\n";
 785  echo "                        <td align=\"left\">$folder_dropdown</td>\n";
 786  echo "                      </tr>\n";
 787  echo "                      <tr>\n";
 788  echo "                        <td align=\"left\"><h2>", gettext("Thread title"), "</h2></td>\n";
 789  echo "                      </tr>\n";
 790  echo "                      <tr>\n";
 791  echo "                        <td align=\"left\">", form_input_text("thread_title", htmlentities_array($thread_title), 30, 64, null, "thread_title"), "</td>\n";
 792  echo "                      </tr>\n";
 793  echo "                    </table>\n";
 794  
 795  if (isset($_SESSION['EMOTICONS']) && strlen(trim($_SESSION['EMOTICONS'])) > 0) {
 796      $user_emoticon_pack = $_SESSION['EMOTICONS'];
 797  } else {
 798      $user_emoticon_pack = forum_get_setting('default_emoticons', 'strlen', 'default');
 799  }
 800  
 801  if (($emoticon_preview_html = emoticons_preview($user_emoticon_pack)) !== false) {
 802  
 803      echo "                    <br />\n";
 804      echo "                    <table width=\"196\" class=\"messagefoot\" cellspacing=\"0\">\n";
 805      echo "                      <tr>\n";
 806      echo "                        <td align=\"left\" class=\"subhead\">", gettext("Emoticons"), "</td>\n";
 807  
 808      if (($page_prefs & POST_EMOTICONS_DISPLAY) > 0) {
 809          echo "                        <td class=\"subhead\" align=\"right\">", form_submit_image('hide.png', 'emots_toggle', 'hide', null, 'button_image toggle_button', null, 'button_image toggle_button'), "&nbsp;</td>\n";
 810      } else {
 811          echo "                        <td class=\"subhead\" align=\"right\">", form_submit_image('show.png', 'emots_toggle', 'show', null, 'button_image toggle_button', null, 'button_image toggle_button'), "&nbsp;</td>\n";
 812      }
 813  
 814      echo "                      </tr>\n";
 815      echo "                      <tr>\n";
 816      echo "                        <td align=\"left\" colspan=\"2\">\n";
 817  
 818      if (($page_prefs & POST_EMOTICONS_DISPLAY) > 0) {
 819          echo "                          <div class=\"emots_toggle\">{$emoticon_preview_html}</div>\n";
 820      } else {
 821          echo "                          <div class=\"emots_toggle\" style=\"display: none\">{$emoticon_preview_html}</div>\n";
 822      }
 823  
 824      echo "                        </td>\n";
 825      echo "                      </tr>\n";
 826      echo "                    </table>\n";
 827  }
 828  
 829  echo "                  </td>\n";
 830  echo "                  <td align=\"left\" valign=\"top\" width=\"740\">\n";
 831  echo "                    <table class=\"posthead\" width=\"100%\">\n";
 832  echo "                      <tr>\n";
 833  echo "                        <td align=\"left\">\n";
 834  echo "                          <h2>", gettext("Poll"), "</h2>\n";
 835  echo "                          <p>", gettext("<b>Note</b>: Editing certain aspects of a poll will void all the current votes and allow people to vote again."), "</p>\n";
 836  echo "                          <p>", gettext("Enter some questions and the options for your poll. If your poll is a &quot;yes/no&quot; question, simply enter &quot;Yes&quot; and &quot;No&quot; as two separate options."), "</p>\n";
 837  echo "                          <div class=\"poll_questions_container\">\n";
 838  
 839  foreach ($poll_questions_array as $question_id => $question) {
 840  
 841      echo "                            <fieldset class=\"poll_question\">\n";
 842      echo "                              <div>\n";
 843      echo "                                <h2>", gettext("Poll Question"), "</h2>\n";
 844      echo "                                <div class=\"poll_question_input\">\n";
 845      echo "                                  ", form_input_text("poll_questions[{$question_id}][question]", htmlentities_array($question['QUESTION']), 40, 255), "&nbsp;", form_button_html("delete_question[{$question_id}]", 'submit', 'button_image delete_question', sprintf("<img src=\"%s\" alt=\"\" />", html_style_image('delete.png')), sprintf('title="%s"', gettext("Delete question"))), "\n";
 846      echo "                                </div>\n";
 847      echo "                                <div class=\"poll_question_checkbox\">\n";
 848      echo "                                  ", form_checkbox("poll_questions[{$question_id}][allow_multi]", "Y", gettext("Allow multiple options to be selected"), (isset($question['ALLOW_MULTI']) && $question['ALLOW_MULTI'] == 'Y')), "\n";
 849      echo "                                </div>\n";
 850      echo "                                <div class=\"poll_options_list\">\n";
 851      echo "                                  <ol>\n";
 852  
 853      if (isset($question['OPTIONS_ARRAY']) && is_array($question['OPTIONS_ARRAY'])) {
 854  
 855          foreach ($question['OPTIONS_ARRAY'] as $option_id => $option) {
 856              echo "                                    <li>", form_input_text("poll_questions[{$question_id}][options][{$option_id}]", htmlentities_array($option['OPTION_NAME']), 45, 255), "&nbsp;", form_button_html("delete_option[{$question_id}][{$option_id}]", 'submit', 'button_image delete_option', sprintf("<img src=\"%s\" alt=\"\"/>", html_style_image('delete.png')), sprintf('title="%s"', gettext("Delete option"))), "</li>\n";
 857          }
 858  
 859      } else {
 860  
 861          echo "                                    <li>", form_input_text("poll_questions[{$question_id}][options][0]", null, 45, 255), "&nbsp;", form_button_html("delete_option[{$question_id}][0]", 'submit', 'button_image delete_option', sprintf("<img src=\"%s\" alt=\"\"/>", html_style_image('delete.png')), sprintf('title="%s"', gettext("Delete option"))), "</li>\n";
 862  
 863          if (isset($_POST['add_option'][$question_id])) {
 864              echo poll_get_option_html($question_id, 1);
 865          }
 866      }
 867  
 868      echo "                                  </ol>\n";
 869      echo "                                </div>\n";
 870      echo "                              </div>\n";
 871      echo "                            ", form_button_html("add_option[{$question_id}]", 'submit', 'button_image add_option', sprintf("<img src=\"%s\" alt=\"\" />&nbsp;%s", html_style_image('add.png'), gettext("Add new option"))), "\n";
 872      echo "                            </fieldset>\n";
 873  }
 874  
 875  echo "                          </div>\n";
 876  echo "                          <table width=\"100%\">\n";
 877  echo "                            <tr>\n";
 878  echo "                              <td>", form_button_html('add_question', 'submit', 'button_image add_question', sprintf("<img src=\"%s\" alt=\"\" />&nbsp;%s", html_style_image('add.png'), gettext("Add new question"))), "</td>\n";
 879  echo "                            </tr>\n";
 880  echo "                            <tr>\n";
 881  echo "                              <td align=\"left\">&nbsp;</td>\n";
 882  echo "                            </tr>\n";
 883  echo "                          </table>\n";
 884  echo "                          <table width=\"100%\">\n";
 885  echo "                            <tr>\n";
 886  echo "                              <td align=\"left\"><h2>", gettext("Poll Results"), "</h2></td>\n";
 887  echo "                            </tr>\n";
 888  echo "                            <tr>\n";
 889  echo "                              <td align=\"left\">", gettext("How would you like to display the results of your poll?"), "</td>\n";
 890  echo "                            </tr>\n";
 891  echo "                            <tr>\n";
 892  echo "                              <td align=\"left\">\n";
 893  echo "                                <table border=\"0\" width=\"100%\">\n";
 894  echo "                                  <tr>\n";
 895  echo "                                    <td align=\"left\" style=\"white-space: nowrap\">", form_radio('poll_type', POLL_HORIZONTAL_GRAPH, gettext("Horizontal graph"), ($poll_type == POLL_HORIZONTAL_GRAPH)), "</td>\n";
 896  echo "                                  </tr>\n";
 897  echo "                                  <tr>\n";
 898  echo "                                    <td align=\"left\" style=\"white-space: nowrap\">", form_radio('poll_type', POLL_VERTICAL_GRAPH, gettext("Vertical graph"), ($poll_type == POLL_VERTICAL_GRAPH)), "</td>\n";
 899  echo "                                  </tr>\n";
 900  echo "                                  <tr>\n";
 901  echo "                                    <td align=\"left\" style=\"white-space: nowrap\">", form_radio('poll_type', POLL_TABLE_GRAPH, gettext("Tabular format"), ($poll_type == POLL_TABLE_GRAPH)), "</td>\n";
 902  echo "                                  </tr>\n";
 903  echo "                                </table>\n";
 904  echo "                              </td>\n";
 905  echo "                            </tr>\n";
 906  echo "                            <tr>\n";
 907  echo "                              <td align=\"left\">&nbsp;</td>\n";
 908  echo "                            </tr>\n";
 909  echo "                            <tr>\n";
 910  echo "                              <td align=\"left\"><h2>", gettext("Poll Voting Type"), "</h2></td>\n";
 911  echo "                            </tr>\n";
 912  echo "                            <tr>\n";
 913  echo "                              <td align=\"left\">", gettext("How should the poll be conducted?"), "</td>\n";
 914  echo "                            </tr>\n";
 915  echo "                            <tr>\n";
 916  echo "                              <td align=\"left\">\n";
 917  echo "                                <table border=\"0\" width=\"100%\">\n";
 918  echo "                                  <tr>\n";
 919  echo "                                    <td align=\"left\">", form_radio('poll_vote_type', POLL_VOTE_ANON, gettext("Anonymously"), ($poll_vote_type == POLL_VOTE_ANON)), "</td>\n";
 920  echo "                                  </tr>\n";
 921  echo "                                  <tr>\n";
 922  echo "                                    <td align=\"left\">", form_radio('poll_vote_type', POLL_VOTE_PUBLIC, gettext("Public ballot"), ($poll_vote_type == POLL_VOTE_PUBLIC)), "</td>\n";
 923  echo "                                  </tr>\n";
 924  echo "                                </table>\n";
 925  echo "                              </td>\n";
 926  echo "                            </tr>\n";
 927  echo "                            <tr>\n";
 928  echo "                              <td align=\"left\">&nbsp;</td>\n";
 929  echo "                            </tr>\n";
 930  echo "                            <tr>\n";
 931  echo "                              <td>\n";
 932  echo "                                <table border=\"0\" cellspacing=\"0\" width=\"100%\">\n";
 933  echo "                                  <tr>\n";
 934  echo "                                    <td align=\"left\" class=\"subhead\">", gettext("Soft Edit Options"), "</td>\n";
 935  
 936  if (($page_prefs & POLL_EDIT_SOFT_DISPLAY) > 0) {
 937      echo "                                    <td class=\"subhead\" align=\"right\">", form_submit_image('hide.png', 'poll_soft_edit_toggle', 'hide', null, 'button_image toggle_button'), "&nbsp;</td>\n";
 938  } else {
 939      echo "                                    <td class=\"subhead\" align=\"right\">", form_submit_image('show.png', 'poll_soft_edit_toggle', 'show', null, 'button_image toggle_button'), "&nbsp;</td>\n";
 940  }
 941  
 942  echo "                                  </tr>";
 943  echo "                                </table>\n";
 944  echo "                              </td>\n";
 945  echo "                            </tr>\n";
 946  echo "                            <tr>\n";
 947  echo "                              <td>\n";
 948  
 949  if (($page_prefs & POLL_EDIT_SOFT_DISPLAY) > 0) {
 950      echo "                                <div class=\"poll_soft_edit_toggle\">\n";
 951  } else {
 952      echo "                                <div class=\"poll_soft_edit_toggle\" style=\"display: none\">\n";
 953  }
 954  
 955  echo "                                  <table border=\"0\" cellspacing=\"0\" width=\"100%\">\n";
 956  echo "                                    <tr>\n";
 957  echo "                                      <td align=\"left\" colspan=\"2\">\n";
 958  echo "                                        <table border=\"0\" class=\"posthead\" width=\"100%\">\n";
 959  echo "                                          <tr>\n";
 960  echo "                                            <td rowspan=\"28\" width=\"1%\">&nbsp;</td>\n";
 961  echo "                                            <td align=\"left\"><p>", gettext("You may change the options in this section without affecting the current poll votes"), "</p></td>\n";
 962  echo "                                          </tr>\n";
 963  echo "                                          <tr>\n";
 964  echo "                                            <td align=\"left\"><h2>", gettext("Options display type"), "</h2></td>\n";
 965  echo "                                          </tr>\n";
 966  echo "                                          <tr>\n";
 967  echo "                                            <td align=\"left\">", gettext("How should the options be presented?"), "</td>\n";
 968  echo "                                          </tr>\n";
 969  echo "                                          <tr>\n";
 970  echo "                                            <td align=\"left\">\n";
 971  echo "                                              <table border=\"0\" width=\"100%\">\n";
 972  echo "                                                <tr>\n";
 973  echo "                                                  <td align=\"left\">", form_radio('option_type', POLL_OPTIONS_RADIOS, gettext("As a series of radio buttons"), ($option_type == POLL_OPTIONS_RADIOS)), "</td>\n";
 974  echo "                                                </tr>\n";
 975  echo "                                                <tr>\n";
 976  echo "                                                  <td align=\"left\">", form_radio('option_type', POLL_OPTIONS_DROPDOWN, gettext("As drop-down list(s)"), ($option_type == POLL_OPTIONS_DROPDOWN)), "</td>\n";
 977  echo "                                                </tr>\n";
 978  echo "                                              </table>\n";
 979  echo "                                            </td>\n";
 980  echo "                                          </tr>\n";
 981  echo "                                          <tr>\n";
 982  echo "                                            <td align=\"left\">&nbsp;</td>\n";
 983  echo "                                          </tr>\n";
 984  echo "                                          <tr>\n";
 985  echo "                                            <td align=\"left\"><h2>", gettext("Vote Changing"), "</h2></td>\n";
 986  echo "                                          </tr>\n";
 987  echo "                                          <tr>\n";
 988  echo "                                            <td align=\"left\">", gettext("Can a person change his or her vote?"), "</td>\n";
 989  echo "                                          </tr>\n";
 990  echo "                                          <tr>\n";
 991  echo "                                            <td align=\"left\">\n";
 992  echo "                                              <table border=\"0\" width=\"100%\">\n";
 993  echo "                                                <tr>\n";
 994  echo "                                                  <td align=\"left\">", form_radio('change_vote', POLL_VOTE_CAN_CHANGE, gettext("Yes"), ($change_vote == POLL_VOTE_CAN_CHANGE)), "</td>\n";
 995  echo "                                                </tr>\n";
 996  echo "                                                <tr>\n";
 997  echo "                                                  <td align=\"left\">", form_radio('change_vote', POLL_VOTE_CANNOT_CHANGE, gettext("No"), ($change_vote == POLL_VOTE_CANNOT_CHANGE)), "</td>\n";
 998  echo "                                                </tr>\n";
 999  echo "                                                <tr>\n";
1000  echo "                                                  <td align=\"left\">", form_radio('change_vote', POLL_VOTE_MULTI, gettext("Allow Multiple Votes"), ($change_vote == POLL_VOTE_MULTI)), "</td>\n";
1001  echo "                                                </tr>\n";
1002  echo "                                              </table>\n";
1003  echo "                                            </td>\n";
1004  echo "                                          </tr>\n";
1005  echo "                                          <tr>\n";
1006  echo "                                            <td align=\"left\">&nbsp;</td>\n";
1007  echo "                                          </tr>\n";
1008  
1009  if (forum_get_setting('poll_allow_guests', 'Y')) {
1010  
1011      echo "                                          <tr>\n";
1012      echo "                                            <td align=\"left\"><h2>", gettext("Guest Voting"), "</h2></td>\n";
1013      echo "                                          </tr>\n";
1014      echo "                                          <tr>\n";
1015      echo "                                            <td align=\"left\">", gettext("Can guests vote in this poll?"), "</td>\n";
1016      echo "                                          </tr>\n";
1017      echo "                                          <tr>\n";
1018      echo "                                            <td align=\"left\">\n";
1019      echo "                                              <table border=\"0\" width=\"100%\">\n";
1020      echo "                                                <tr>\n";
1021      echo "                                                  <td align=\"left\">", form_radio('allow_guests', POLL_GUEST_ALLOWED, gettext("Yes"), ($allow_guests == POLL_GUEST_ALLOWED)), "</td>\n";
1022      echo "                                                </tr>\n";
1023      echo "                                                <tr>\n";
1024      echo "                                                  <td align=\"left\">", form_radio('allow_guests', POLL_GUEST_DENIED, gettext("No"), ($allow_guests == POLL_GUEST_DENIED)), "</td>\n";
1025      echo "                                                </tr>\n";
1026      echo "                                              </table>\n";
1027      echo "                                            </td>\n";
1028      echo "                                          </tr>\n";
1029      echo "                                          <tr>\n";
1030      echo "                                            <td align=\"left\">&nbsp;</td>\n";
1031      echo "                                          </tr>\n";
1032  }
1033  
1034  echo "                                          <tr>\n";
1035  echo "                                            <td align=\"left\"><h2>", gettext("Expiration"), "</h2></td>\n";
1036  echo "                                          </tr>\n";
1037  echo "                                          <tr>\n";
1038  echo "                                            <td align=\"left\">", gettext("Do you want to show results while the poll is open?"), "</td>\n";
1039  echo "                                          </tr>\n";
1040  echo "                                          <tr>\n";
1041  echo "                                            <td align=\"left\">\n";
1042  echo "                                              <table border=\"0\" width=\"100%\">\n";
1043  echo "                                                <tr>\n";
1044  echo "                                                  <td align=\"left\" width=\"50%\">", form_radio('show_results', POLL_SHOW_RESULTS, gettext("Yes"), ($show_results == POLL_SHOW_RESULTS)), "</td>\n";
1045  echo "                                                </tr>\n";
1046  echo "                                                <tr>\n";
1047  echo "                                                  <td align=\"left\" width=\"50%\">", form_radio('show_results', POLL_HIDE_RESULTS, gettext("No"), ($show_results == POLL_HIDE_RESULTS)), "</td>\n";
1048  echo "                                                </tr>\n";
1049  echo "                                              </table>\n";
1050  echo "                                            </td>\n";
1051  echo "                                          </tr>\n";
1052  echo "                                          <tr>\n";
1053  echo "                                            <td align=\"left\">&nbsp;</td>\n";
1054  echo "                                          </tr>\n";
1055  echo "                                          <tr>\n";
1056  echo "                                            <td align=\"left\">", gettext("When would you like your poll to automatically close?"), "</td>\n";
1057  echo "                                          </tr>\n";
1058  echo "                                          <tr>\n";
1059  echo "                                            <td align=\"left\">", form_dropdown_array('close_poll', array(gettext("One day"), gettext("Three days"), gettext("Seven days"), gettext("Thirty days"), gettext("Never"), gettext("No change")), $close_poll), "</td>\n";
1060  echo "                                          </tr>\n";
1061  echo "                                          <tr>\n";
1062  echo "                                            <td align=\"left\">&nbsp;</td>\n";
1063  echo "                                          </tr>\n";
1064  echo "                                        </table>\n";
1065  echo "                                      </td>\n";
1066  echo "                                    </tr>\n";
1067  echo "                                  </table>\n";
1068  echo "                                </div>\n";
1069  echo "                              </td>\n";
1070  echo "                            </tr>\n";
1071  echo "                            <tr>\n";
1072  echo "                              <td align=\"left\">&nbsp;</td>\n";
1073  echo "                            </tr>\n";
1074  echo "                            <tr>\n";
1075  echo "                              <td align=\"left\">\n";
1076  echo "                                ", form_submit("apply", gettext("Apply")), "&nbsp;", form_submit("preview_poll", gettext("Preview")), "&nbsp;", form_submit("preview_form", gettext("Preview Voting Form"));
1077  
1078  echo "&nbsp;<a href=\"discussion.php?webtag=$webtag&msg=$return_msg\" class=\"button\" target=\"_self\"><span>", gettext("Cancel"), "</span></a>";
1079  
1080  echo "                              </td>\n";
1081  echo "                            </tr>\n";
1082  echo "                          </table>\n";
1083  echo "                        </td>\n";
1084  echo "                      </tr>\n";
1085  echo "                    </table>\n";
1086  echo "                  </td>\n";
1087  echo "                </tr>\n";
1088  echo "                <tr>\n";
1089  echo "                  <td align=\"left\">&nbsp;</td>\n";
1090  echo "                </tr>\n";
1091  echo "              </table>\n";
1092  echo "            </td>\n";
1093  echo "          </tr>\n";
1094  echo "        </table>\n";
1095  echo "      </td>\n";
1096  echo "    </tr>\n";
1097  echo "  </table>\n";
1098  echo "</form>\n";
1099  
1100  html_draw_bottom();

title

Description

title

Description

title

Description

title

title

Body