<commit_before><?php
// Class Config
$hp = $this;
$right = $hp->getright();
$level = $_SESSION['level'];
$get = $hp->get();
$post = $hp->post();
$dbprfix = $hp->getprfix();
$lang = $hp->getlangclass();
$error = $hp->geterror();
$info = $hp->getinfo();
$lbs = $hp->lbsites;
$xajaxF = $hp->xajaxF;


if (!$right[$level]['manage_vote'])
{
echo "Sie drfen keine Umfragen Managen!<br>";
echo "<a href=index.php>Zurck</a>";
$error->error("Sie drfen keine Newsmeldungen Managen!");
} else
{


if (isset($get['addvote']))
{

?>
<script type="text/javascript" src="js/votes.js"></script>
<form action="index.php?site=vote" method="post">
<table width="100%" border="0">
  <tr>
    <td width="5%">&nbsp;</td>
    <td width="14%"><strong>Neue Umfrage starten:</strong></td>
    <td width="15%"></td>
  </tr>
  <tr>
    <td>Titel</td>
    <td><input type="text" name="titel" id="titel"  size="70"  onchange="checkvote(false)"/></td>
    <td><div id="titelwarn">Bitte Geben Sie einen Titel ein.</div></td>
  </tr>
  <tr>
    <td>Antworten:</td>
    <td><table width="100%" border="0" id="answers">
      <tr>
        <td>
            <input type="text" name="antwort[]" id="antwort1" size="70"  onchange="checkvote(false)" /> </td>
      </tr>
        <tr>
        <td>
            <input type="text" name="antwort[]" id="antwort2" size="70"  onchange="checkvote(false)" /> </td>
      </tr>
      
    </table>
    
    <!--Fr die mit IE-->
    <div id="mehrantworten">
    <table width="100%" border="0" id="answers">
      <tr>
        <td>
            <input type="text" name="antwort[]"  size="70"  /> </td>
      </tr>
        <tr>
        <td>
            <input type="text" name="antwort[]"  size="70"   /> </td>
      </tr>
      
    </table>
    </div>
    
    
         <SCRIPT language="JavaScript">
<!--
var BrowserName = navigator.appName;
var antworten = document.getElementById("mehrantworten");

if (BrowserName!="Microsoft Internet Explorer")
{
antworten.style.visibility = 'hidden';
antworten.style.position = 'absolute';
antworten.style.top = '0px';
antworten.style.left = '0px';

}
//-->
</script>
    
    <img src="images/add.gif"  onClick="addanswer()"><hr /></td>
    <td><div id="answerwarn">Bitte Geben Sie mindestens 2 Antworten an.</div></td>
  </tr>
  <tr>
    <td>Gltig bis:</td>
    <td>
    <?php
  
  $date = getdate();



$tag = $date['mday'];
$monat = $date['mon'];
$year = $date['year'];

if ($tag < 10)
{
$tag = "0".$tag;
}
if ($monat < 10)
{
$monat = "0".$monat;
}
  
  
  ?>
  
    <input type="hidden" name="day" id="day" size="2" maxlength="2" value="<?php echo $tag?>" onchange="checkvote(false)"  />
       <input type="hidden" name="month" id="month" size="2" maxlength="2" value="<?php echo $monat?>" onchange="checkvote(false)" /> 
      <input type="hidden" name="year" id="year" size="4" maxlength="4" value="<?php echo $year?>"  onchange="checkvote(false)"/> 
       <input type="hidden" name="hour" id="hour" size="2" maxlength="2" value="00"  onchange="checkvote(false)"/>
        <input type="hidden" name="min" id="min" size="2" maxlength="2" value="00"  onchange="checkvote(false)"/>
        <div id="kalender" align="center"></div></td>
      <td><div id="datewarn">berprfen Sie die Eingaben</div>
      <br>Aktuelle Auswahl: <div id="aktdate"><?php echo "$tag.$monat.$year"; ?></div></td>
  
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div id="post">Bitte beachten Sie die Meldungen</div>
    <noscript><br>berprfung deaktiviert:<br><input type="submit" name="addvote" id="post" value="Senden" /></noscript></td> <!--<input type="submit" name="button" id="button" value="Senden" />-->
    <td></td>
  </tr>
</table>
</form>
<?php
$xajaxF->open("xajax_calender();");

} elseif (isset($post['addvote']))
{
$titel = $post['titel'];
$antwort = $post['antwort'];
$day = $post['day'];
$month = $post['month'];
$year = $post['year'];
$hour = $post['hour'];
$min = $post['min'];
$user = $_SESSION['ID'];
$time = time();

$timestamp = mktime($hour, $min, 0, $month, $day, $year);
$antworten = "";

foreach ($antwort as $key=>$value) {
	
if ($value != "")
{
if ($antworten == "")
{
$antworten = "$value";
} else
{
$antworten .= "<!--!>$value";
}

}

}


$sql = "INSERT INTO `$dbprfix"."vote` (
`ID` ,
`name` ,
`userid` ,
`antworten` ,
`ergebnisse` ,
`timestamp` ,
`upto`
)
VALUES (
NULL , '$titel', '$user', '$antworten', '', '$time', '$timestamp'
);
";
$erg = $hp->mysqlquery($sql);
//$this->fp->log($sql);

$info->okn("Umfrage erfolgreich eingetragen!");
echo "Erfolreich eingetragen<br><a href=index.php?site=vote>Zurck</a>";


} elseif (isset($get['editvote']))
{
$id = $get['editvote'];

$sql = "SELECT * FROM `$dbprfix"."vote` WHERE `ID` = $id";
$erg = $hp->mysqlquery($sql);
$row = mysql_fetch_object($erg);

?>
<form action="index.php?site=vote" method="post">
<input type="hidden" value="<?php echo $id?>" name="ID">
<table width="100%" border="0">
  <tr>
    <td width="5%">&nbsp;</td>
    <td width="14%"><strong>Neue Umfrage starten:</strong></td>
    <td width="15%"></td>
  </tr>
  <tr>
    <td>Titel</td>
    <td><input type="text" name="titel" id="titel"  size="70" value="<?php echo $row->name?>"  onchange="checkvote(true)" /></td>
    <td><div id="titelwarn">Bitte Geben Sie einen Titel ein.</div></td>
  </tr>
  <tr>
    <td>Antworten:</td>
    <td><table width="100%" border="0" id="answers">
    <?php
    
    $antworten = explode("<!--!>", $row->antworten);
    $i = 0;
    foreach ($antworten as $key=>$value) {
    	$i++;
    
    ?>
      <tr>
        <td>
            <input type="text" name="antwort[]" id="antwort<?php echo $i?>" size="70"  onchange="checkvote(true)" value="<?php echo $value?>" /> </td>
      </tr>

      <?php
      }
      ?>
    </table><img src="images/add.gif"  onClick="addanswer()"><hr /></td>
    <td><div id="answerwarn">Bitte Geben Sie mindestens 2 Antworten an.</div></td>
  </tr>
  <tr>
    <td>Gltig bis:</td>
    <td>
    <?php
  
  $date = getdate($row->upto);



$tag = $date['mday'];
$monat = $date['mon'];
$year = $date['year'];

if ($tag < 10)
{
$tag = "0".$tag;
}
if ($monat < 10)
{
$monat = "0".$monat;
}
  
  
  ?>
    <input type="hidden" name="day" id="day" size="2" maxlength="2" value="<?php echo $tag?>" onchange="checkvote(true)"  />
       <input type="hidden" name="month" id="month" size="2" maxlength="2" value="<?php echo $monat?>" onchange="checkvote(true)" /> 
      <input type="hidden" name="year" id="year" size="4" maxlength="4" value="<?php echo $year?>"  onchange="checkvote(true)"/> 
       <input type="hidden" name="hour" id="hour" size="2" maxlength="2" value="00"  onchange="checkvote(true)"/>
        <input type="hidden" name="min" id="min" size="2" maxlength="2" value="00"  onchange="checkvote(true)"/>
        <div id="kalender" align="center"></div></td>
      <td><div id="datewarn">berprfen Sie die Eingaben</div>
      <br>Aktuelle Auswahl: <div id="aktdate"><?php echo "$tag.$monat.$year"; ?></div></td>
  
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div id="post">Bitte beachten Sie die Meldungen</div>
    <noscript><br>berprfung deaktiviert:<br><input type="submit" name="editvote" id="post" value="Senden" /></noscript></td> <!--<input type="submit" name="button" id="button" value="Senden" />-->
    <td></td>
  </tr>
</table>
</form>
<?php
$xajaxF->open("xajax_calender();");
$xajaxF->open("checkvote(true);");




} elseif (isset($post['editvote']))
{
$ID = $post['ID'];
$titel = $post['titel'];
$antwort = $post['antwort'];
$day = $post['day'];
$month = $post['month'];
$year = $post['year'];
$hour = $post['hour'];
$min = $post['min'];
$user = $_SESSION['ID'];
$time = time();

$timestamp = mktime($hour, $min, 0, $month, $day, $year);
$antworten = "";

foreach ($antwort as $key=>$value) {
	
if ($value != "")
{
if ($antworten == "")
{
$antworten = "$value";
} else
{
$antworten .= "<!--!>$value";
}

}

}


$sql = "UPDATE `$dbprfix"."vote` SET `name` = '$titel', `antworten` = '$antworten', `upto` = '$timestamp' WHERE `ID` = '$ID';";
$erg = $hp->mysqlquery($sql);


$info->okn("Umfrage erfolgreich aktualisiert!");
echo "Erfolreich aktualisiert<br><a href=index.php?site=vote>Zurck</a>";



} elseif (isset($post['delvote']))
{
$sql = "DELETE FROM `$dbprfix"."vote` WHERE `ID` = ".$post['voteiddel'];
$erg = $hp->mysqlquery($sql);

$info->ok("Umfrage erfolgreich gelscht!");
echo "Umfrage erfolgreich gelscht.<br><a href=index.php?site=vote>Zurck</a>";


} else
{

echo "Das Menu :D";
echo "<br> Hier werden dann die Votes angezeigt.";
echo "<br><a href=index.php?site=vote&addvote>Neue Umfrage</a><br><hr>";

$sql = "SELECT * FROM `$dbprfix"."vote`";
$erg = $hp->mysqlquery($sql);
while ($row = mysql_fetch_object($erg))
{
$ergebniss = explode("<!--!>", $row->ergebnisse);
$voted = count($ergebniss);
if ($ergebniss[0] == "")
{
$voted--;<commit_msg>[FIX] man konnte keine Umfragen löschen<commit_after><?php
// Class Config
$hp = $this;
$right = $hp->getright();
$level = $_SESSION['level'];
$get = $hp->get();
$post = $hp->post();
$dbprfix = $hp->getprfix();
$lang = $hp->getlangclass();
$error = $hp->geterror();
$info = $hp->getinfo();
$lbs = $hp->lbsites;
$xajaxF = $hp->xajaxF;


if (!$right[$level]['manage_vote'])
{
echo "Sie drfen keine Umfragen Managen!<br>";
echo "<a href=index.php>Zurck</a>";
$error->error("Sie drfen keine Newsmeldungen Managen!");
} else
{


if (isset($get['addvote']))
{

?>
<script type="text/javascript" src="js/votes.js"></script>
<form action="index.php?site=vote" method="post">
<table width="100%" border="0">
  <tr>
    <td width="5%">&nbsp;</td>
    <td width="14%"><strong>Neue Umfrage starten:</strong></td>
    <td width="15%"></td>
  </tr>
  <tr>
    <td>Titel</td>
    <td><input type="text" name="titel" id="titel"  size="70"  onchange="checkvote(false)"/></td>
    <td><div id="titelwarn">Bitte Geben Sie einen Titel ein.</div></td>
  </tr>
  <tr>
    <td>Antworten:</td>
    <td><table width="100%" border="0" id="answers">
      <tr>
        <td>
            <input type="text" name="antwort[]" id="antwort1" size="70"  onchange="checkvote(false)" /> </td>
      </tr>
        <tr>
        <td>
            <input type="text" name="antwort[]" id="antwort2" size="70"  onchange="checkvote(false)" /> </td>
      </tr>
      
    </table>
    
    <!--Fr die mit IE-->
    <div id="mehrantworten">
    <table width="100%" border="0" id="answers">
      <tr>
        <td>
            <input type="text" name="antwort[]"  size="70"  /> </td>
      </tr>
        <tr>
        <td>
            <input type="text" name="antwort[]"  size="70"   /> </td>
      </tr>
      
    </table>
    </div>
    
    
         <SCRIPT language="JavaScript">
<!--
var BrowserName = navigator.appName;
var antworten = document.getElementById("mehrantworten");

if (BrowserName!="Microsoft Internet Explorer")
{
antworten.style.visibility = 'hidden';
antworten.style.position = 'absolute';
antworten.style.top = '0px';
antworten.style.left = '0px';

}
//-->
</script>
    
    <img src="images/add.gif"  onClick="addanswer()"><hr /></td>
    <td><div id="answerwarn">Bitte Geben Sie mindestens 2 Antworten an.</div></td>
  </tr>
  <tr>
    <td>Gltig bis:</td>
    <td>
    <?php
  
  $date = getdate();



$tag = $date['mday'];
$monat = $date['mon'];
$year = $date['year'];

if ($tag < 10)
{
$tag = "0".$tag;
}
if ($monat < 10)
{
$monat = "0".$monat;
}
  
  
  ?>
  
    <input type="hidden" name="day" id="day" size="2" maxlength="2" value="<?php echo $tag?>" onchange="checkvote(false)"  />
       <input type="hidden" name="month" id="month" size="2" maxlength="2" value="<?php echo $monat?>" onchange="checkvote(false)" /> 
      <input type="hidden" name="year" id="year" size="4" maxlength="4" value="<?php echo $year?>"  onchange="checkvote(false)"/> 
       <input type="hidden" name="hour" id="hour" size="2" maxlength="2" value="00"  onchange="checkvote(false)"/>
        <input type="hidden" name="min" id="min" size="2" maxlength="2" value="00"  onchange="checkvote(false)"/>
        <div id="kalender" align="center"></div></td>
      <td><div id="datewarn">berprfen Sie die Eingaben</div>
      <br>Aktuelle Auswahl: <div id="aktdate"><?php echo "$tag.$monat.$year"; ?></div></td>
  
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div id="post">Bitte beachten Sie die Meldungen</div>
    <noscript><br>berprfung deaktiviert:<br><input type="submit" name="addvote" id="post" value="Senden" /></noscript></td> <!--<input type="submit" name="button" id="button" value="Senden" />-->
    <td></td>
  </tr>
</table>
</form>
<?php
$xajaxF->open("xajax_calender();");

} elseif (isset($post['addvote']))
{
$titel = $post['titel'];
$antwort = $post['antwort'];
$day = $post['day'];
$month = $post['month'];
$year = $post['year'];
$hour = $post['hour'];
$min = $post['min'];
$user = $_SESSION['ID'];
$time = time();

$timestamp = mktime($hour, $min, 0, $month, $day, $year);
$antworten = "";

foreach ($antwort as $key=>$value) {
	
if ($value != "")
{
if ($antworten == "")
{
$antworten = "$value";
} else
{
$antworten .= "<!--!>$value";
}

}

}


$sql = "INSERT INTO `$dbprfix"."vote` (
`ID` ,
`name` ,
`userid` ,
`antworten` ,
`ergebnisse` ,
`timestamp` ,
`upto`
)
VALUES (
NULL , '$titel', '$user', '$antworten', '', '$time', '$timestamp'
);
";
$erg = $hp->mysqlquery($sql);
//$this->fp->log($sql);

$info->okn("Umfrage erfolgreich eingetragen!");
echo "Erfolreich eingetragen<br><a href=index.php?site=vote>Zurck</a>";


} elseif (isset($get['editvote']))
{
$id = $get['editvote'];

$sql = "SELECT * FROM `$dbprfix"."vote` WHERE `ID` = $id";
$erg = $hp->mysqlquery($sql);
$row = mysql_fetch_object($erg);

?>
<form action="index.php?site=vote" method="post">
<input type="hidden" value="<?php echo $id?>" name="ID">
<table width="100%" border="0">
  <tr>
    <td width="5%">&nbsp;</td>
    <td width="14%"><strong>Neue Umfrage starten:</strong></td>
    <td width="15%"></td>
  </tr>
  <tr>
    <td>Titel</td>
    <td><input type="text" name="titel" id="titel"  size="70" value="<?php echo $row->name?>"  onchange="checkvote(true)" /></td>
    <td><div id="titelwarn">Bitte Geben Sie einen Titel ein.</div></td>
  </tr>
  <tr>
    <td>Antworten:</td>
    <td><table width="100%" border="0" id="answers">
    <?php
    
    $antworten = explode("<!--!>", $row->antworten);
    $i = 0;
    foreach ($antworten as $key=>$value) {
    	$i++;
    
    ?>
      <tr>
        <td>
            <input type="text" name="antwort[]" id="antwort<?php echo $i?>" size="70"  onchange="checkvote(true)" value="<?php echo $value?>" /> </td>
      </tr>

      <?php
      }
      ?>
    </table><img src="images/add.gif"  onClick="addanswer()"><hr /></td>
    <td><div id="answerwarn">Bitte Geben Sie mindestens 2 Antworten an.</div></td>
  </tr>
  <tr>
    <td>Gltig bis:</td>
    <td>
    <?php
  
  $date = getdate($row->upto);



$tag = $date['mday'];
$monat = $date['mon'];
$year = $date['year'];

if ($tag < 10)
{
$tag = "0".$tag;
}
if ($monat < 10)
{
$monat = "0".$monat;
}
  
  
  ?>
    <input type="hidden" name="day" id="day" size="2" maxlength="2" value="<?php echo $tag?>" onchange="checkvote(true)"  />
       <input type="hidden" name="month" id="month" size="2" maxlength="2" value="<?php echo $monat?>" onchange="checkvote(true)" /> 
      <input type="hidden" name="year" id="year" size="4" maxlength="4" value="<?php echo $year?>"  onchange="checkvote(true)"/> 
       <input type="hidden" name="hour" id="hour" size="2" maxlength="2" value="00"  onchange="checkvote(true)"/>
        <input type="hidden" name="min" id="min" size="2" maxlength="2" value="00"  onchange="checkvote(true)"/>
        <div id="kalender" align="center"></div></td>
      <td><div id="datewarn">berprfen Sie die Eingaben</div>
      <br>Aktuelle Auswahl: <div id="aktdate"><?php echo "$tag.$monat.$year"; ?></div></td>
  
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><div id="post">Bitte beachten Sie die Meldungen</div>
    <noscript><br>berprfung deaktiviert:<br><input type="submit" name="editvote" id="post" value="Senden" /></noscript></td> <!--<input type="submit" name="button" id="button" value="Senden" />-->
    <td></td>
  </tr>
</table>
</form>
<?php
$xajaxF->open("xajax_calender();");
$xajaxF->open("checkvote(true);");




} elseif (isset($post['editvote']))
{
$ID = $post['ID'];
$titel = $post['titel'];
$antwort = $post['antwort'];
$day = $post['day'];
$month = $post['month'];
$year = $post['year'];
$hour = $post['hour'];
$min = $post['min'];
$user = $_SESSION['ID'];
$time = time();

$timestamp = mktime($hour, $min, 0, $month, $day, $year);
$antworten = "";

foreach ($antwort as $key=>$value) {
	
if ($value != "")
{
if ($antworten == "")
{
$antworten = "$value";
} else
{
$antworten .= "<!--!>$value";
}

}

}


$sql = "UPDATE `$dbprfix"."vote` SET `name` = '$titel', `antworten` = '$antworten', `upto` = '$timestamp' WHERE `ID` = '$ID';";
$erg = $hp->mysqlquery($sql);


$info->okn("Umfrage erfolgreich aktualisiert!");
echo "Erfolreich aktualisiert<br><a href=index.php?site=vote>Zurck</a>";



} elseif (isset($post['votedel']))
{
$sql = "DELETE FROM `$dbprfix"."vote` WHERE `ID` = ".$post['voteiddel'];
$erg = $hp->mysqlquery($sql);

$info->okm("Umfrage erfolgreich gelscht!");
echo "Umfrage erfolgreich gelscht.<br><a href=index.php?site=vote>Zurck</a>";


} else
{

echo "Das Menu :D";
echo "<br> Hier werden dann die Votes angezeigt.";
echo "<br><a href=index.php?site=vote&addvote>Neue Umfrage</a><br><hr>";

$sql = "SELECT * FROM `$dbprfix"."vote`";
$erg = $hp->mysqlquery($sql);
while ($row = mysql_fetch_object($erg))
{
$ergebniss = explode("<!--!>", $row->ergebnisse);
$voted = count($ergebniss);
if ($ergebniss[0] == "")
{
$voted--;
{'fraction_non_alphanumeric': 0.25327510917030566, 'fraction_numerical': 0.010661827255713718, 'mean_word_length': 4.058519793459553, 'pattern_counts': {'":': 0, '<': 469, '<?xml version=': 0, '>': 519, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1821641', 'n_tokens_mistral': 6974, 'n_tokens_neox': 6868, 'n_words': 1366}