[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_plugins/poll/ -> admin_config.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/poll/admin_config.php,v $
  14  |     $Revision: 1.15 $
  15  |     $Date: 2007/01/07 15:24:49 $
  16  |     $Author: e107steved $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("../../class2.php");
  20  if (!is_object($tp)) $tp = new e_parse;
  21  if (!getperms("U")) {
  22      header("location:".e_BASE."index.php");
  23      exit;
  24  }
  25  $e_sub_cat = 'poll';
  26  
  27  require_once(e_ADMIN."auth.php");
  28  require_once(e_PLUGIN."poll/poll_class.php");
  29  require_once(e_HANDLER."form_handler.php");
  30  require_once(e_HANDLER."userclass_class.php");
  31  
  32  if(isset($_POST)) {
  33      $_POST = strip_if_magic($_POST);
  34  }
  35  
  36  $rs = new form;
  37  $poll = new poll;
  38  
  39  if (isset($_POST['reset']))
  40  {
  41      unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['multipleChoice'], $_POST['showResults'], $_POST['startday'], $_POST['startmonth'], $_POST['startyear'], $_POST['endday'], $_POST['endmonth'], $_POST['endyear']);
  42      define("RESET", TRUE);
  43  } else if (e_QUERY)
  44  {
  45      list($action, $id) = explode(".", e_QUERY);
  46      define("POLLACTION", $action);
  47      define("POLLID", $id);
  48  }
  49  else
  50  {
  51      define("POLLACTION", FALSE);
  52      define("POLLID", FALSE);
  53  }
  54  
  55  if ($action == "delete") {
  56      $message = $poll->delete_poll($id);
  57      unset($poll_id, $_POST['poll_title'], $_POST['poll_option'], $_POST['activate']);
  58  }
  59  
  60  if (isset($_POST['submit']))
  61  {
  62  
  63      if($_POST['poll_title'])
  64      {
  65          $message = $poll -> submit_poll();
  66          unset($_POST['poll_title'], $_POST['poll_option'], $_POST['activate'], $_POST['poll_comment']);
  67      }
  68      else
  69      {
  70          $message = POLLAN_46;
  71      }
  72  }
  73  
  74  if (POLLACTION == "edit" && !$_POST['preview'] && !$_POST['submit'])
  75  {
  76  
  77      if ($sql->db_Select("polls", "*", "poll_id=".POLLID)) {
  78          $row = $sql->db_Fetch();
  79          extract($row);
  80  
  81          $tmpArray = explode(chr(1), $poll_options);
  82  
  83          foreach($tmpArray as $option)
  84          {
  85              $_POST['poll_option'][] = $option;
  86          }
  87  
  88          $_POST['activate'] = $poll_active;
  89          $_POST['option_count'] = count($_POST['poll_option']);
  90          $_POST['poll_title'] = $poll_title;
  91          $_POST['poll_comment'] = $poll_comment;
  92  
  93          if ($poll_start_datestamp)
  94          {
  95              $tmp = getdate($poll_start_datestamp);
  96              $_POST['startmonth'] = $tmp['mon'];
  97              $_POST['startday'] = $tmp['mday'];
  98              $_POST['startyear'] = $tmp['year'];
  99          }
 100          if ($poll_end_datestamp)
 101          {
 102              $tmp = getdate($poll_end_datestamp);
 103              $_POST['endmonth'] = $tmp['mon'];
 104              $_POST['endday'] = $tmp['mday'];
 105              $_POST['endyear'] = $tmp['year'];
 106          }
 107  
 108          $_POST['multipleChoice'] = $poll_allow_multiple;
 109          $_POST['showResults'] = $poll_result_type;
 110          $_POST['pollUserclass'] = $poll_vote_userclass;
 111          $_POST['storageMethod'] = $poll_storage_method;
 112      }
 113  }
 114  
 115  if (isset($_POST['preview']))
 116  {
 117      $poll->render_poll($_POST, "preview");
 118  }
 119  
 120  if (isset($message))
 121  {
 122      $ns->tablerender("", "<div style='text-align:center'><b>".$message."</b></div>");
 123  }
 124  
 125  $text = "<div style='text-align:center'><div style='padding : 1px; ".ADMIN_WIDTH."; height : 200px; overflow : auto; margin-left: auto; margin-right: auto;'>
 126      <form action='".e_SELF."' method='post' id='del_poll'>";
 127  
 128  if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1")) {
 129      $text .= "<table class='fborder' style='width:99%'>
 130          <tr>
 131          <td style='width:5%' class='fcaption'>ID
 132          <input type='hidden' name='del_poll_confirm' id='del_poll_confirm' value='1' />
 133          </td>
 134          <td style='width:75%' class='fcaption'>".POLLAN_3."</td>
 135          <td style='width:20%' class='fcaption'>".POLLAN_4."</td>
 136          </tr>";
 137      while ($row = $sql->db_Fetch()) {
 138          extract($row);
 139          $text .= "<tr>
 140              <td style='width:5%' class='forumheader3'>$poll_id</td>
 141              <td style='width:75%' class='forumheader3'>".$tp -> toHTML($poll_title, TRUE,"no_hook, emotes_off, defs")."</td>
 142              <td style='width:20%; text-align:center' class='forumheader3'><div>". $rs->form_button("button", "main_edit_{$poll_id}", POLLAN_5, "onclick=\"document.location='".e_SELF."?edit.$poll_id'\""). $rs->form_button("submit", "main_delete_{$poll_id}", POLLAN_6, "onclick=\"confirm_($poll_id)\"")."
 143              </div></td>
 144              </tr>";
 145      }
 146      $text .= "</table>";
 147  } else {
 148      $text .= "<div style='text-align:center'>".POLLAN_7."</div>";
 149  }
 150  $text .= "</form></div></div>";
 151  $ns->tablerender(POLLAN_1, $text);
 152  
 153  $poll_total = $sql->db_Select("polls");
 154  
 155  $text = $poll -> renderPollForm();
 156  
 157  $ns->tablerender(POLLAN_2, $text);
 158  require_once(e_ADMIN."footer.php");
 159  function headerjs() {
 160      global $tp;
 161      $headerjs = "<script type=\"text/javascript\">
 162  		function confirm_(poll_id){
 163          var x=confirm(\"Delete this poll? [ID: \" + poll_id + \"]\");
 164          if (x){
 165          document.getElementById('del_poll').action='".e_SELF."?delete.' + poll_id;
 166          document.getElementById('del_poll').submit();
 167          }
 168          }
 169          </script>";
 170      return $headerjs;
 171  }
 172  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7