Enable poll deletion + improve random generator

This commit is contained in:
Olivier PEREZ 2014-12-25 01:11:06 +01:00
parent 9ed0043569
commit 98f14c487a
2 changed files with 6 additions and 4 deletions

View File

@ -77,10 +77,12 @@ class AdminPollService {
function deleteEntirePoll($poll_id) {
$poll = $this->connect->findPollById($poll_id);
$this->logService->log("DELETE_POLL", "id:$poll->poll_id, format:$poll->format, admin:$poll->admin_name, mail:$poll->admin_mail");
/*$this->connect->deleteVotesByPollId($poll_id);
// Delete the entire poll
$this->connect->deleteVotesByPollId($poll_id);
$this->connect->deleteCommentsByPollId($poll_id);
$this->connect->deleteSlotsByPollId($poll_id);
$this->connect->deleteByPollId($poll_id);*/
$this->connect->deleteByPollId($poll_id);
return true;
}

View File

@ -176,9 +176,9 @@ class PollService {
// TODO Better random ?
$string = '';
$chaine = 'abcdefghijklmnopqrstuvwxyz123456789';
srand((double)microtime() * 1000000);
mt_srand();
for ($i = 0; $i < $car; $i++) {
$string .= $chaine[rand() % strlen($chaine)];
$string .= $chaine[mt_rand() % strlen($chaine)];
}
return $string;