uawdijnntqw1x1x1
IP : 216.73.216.180
Hostname : xhost1.intravision.ru
Kernel : Linux xhost1.intravision.ru 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
.
/
files
/
need-2-delete
/
mini-borishof.ru1
/
bitrix
/
components
/
rpromo
/
vote.result.csv
/
component.php
/
/
<?php /** * Created by PhpStorm. * User: d.orehov * Date: 31.10.2014 * Time: 10:59 * * @param $strDate * * @return bool|\DateTime */ function getDateFromRequest($strDate) { $ret = false; if (preg_match('/\d{4}-\d{2}-\d{2}/i', $strDate)) { $ret = DateTime::createFromFormat('Y-m-d', $strDate); } elseif (preg_match('/\d{2}\.\d{2}\.\d{2}/i', $strDate)) { $ret = DateTime::createFromFormat('d.m.Y', $strDate); } return $ret; } global $DB; $voteID = 3; $arResult = array(); $answerIdToNum = array( 19 => 1, 20 => 2, 21 => 3 ); $dateFrom = getDateFromRequest($_REQUEST['date_from']); $dateTo = getDateFromRequest($_REQUEST['date_to']); if ($dateFrom && $dateTo) { $sQuery = 'SELECT bveq.EVENT_ID, bve.DATE_VOTE, bveq.ID as EVENT_QUESTION_ID, bveq.QUESTION_ID, bvea.ANSWER_ID, bvea.MESSAGE, bva.MESSAGE as ANSWER_MESSAGE FROM b_vote_event as bve, b_vote_event_question as bveq, b_vote_event_answer as bvea, b_vote_answer as bva WHERE bve.ID = bveq.EVENT_ID AND bvea.EVENT_QUESTION_ID = bveq.ID AND bvea.ANSWER_ID = bva.ID AND bve.VOTE_ID = ' . $voteID . ' AND bve.DATE_VOTE >= "' . $dateFrom->format('Y-m-d') . ' 00:00:00" AND bve.DATE_VOTE <= "' . $dateTo->format('Y-m-d') . ' 23:59:59" ORDER BY bveq.ID DESC'; $rsData = $DB->Query($sQuery, false, __LINE__); $arRows = array(); $arRows[] = array( 'A', 'B', 'C', 'D', 'E', 'F', 'G' ); $keySite = 0; $keyDate = 1; $keyQuestion1 = 2; $keyQuestion2 = 5; $keyQuestion2_text = 6; $keyQuestion3 = 3; $keyQuestion3_text = 4; $lastEventID = 0; while ($arDataItem = $rsData->GetNext()) { $eventID = $arDataItem['EVENT_ID']; if (!$arRows[$eventID][$keySite]) { $arRows[$eventID][$keySite] = $_SERVER['HTTP_HOST']; } if (!$arRows[$eventID][$keyDate]) { $obDate = DateTime::createFromFormat('Y-m-d H:i:s', $arDataItem['DATE_VOTE']); $arRows[$eventID][$keyDate] = $obDate->format('d/m/Y H:i:s'); } switch ($arDataItem['QUESTION_ID']) { case '3': $arRows[$eventID][$keyQuestion1] = (int)$arDataItem['MESSAGE']; break; case '4': switch ($arDataItem['ANSWER_ID']) { case 17: $arRows[$eventID][$keyQuestion2] = (int)$arDataItem['MESSAGE']; break; case 18: $arRows[$eventID][$keyQuestion2_text] = $arDataItem['MESSAGE'] !== 'null' ? $arDataItem['MESSAGE'] : ''; break; } break; case '5': switch ($arDataItem['ANSWER_ID']) { case 19: case 20: case 21: $arRows[$eventID][$keyQuestion3] = $answerIdToNum[$arDataItem['ANSWER_ID']]; break; case 22: $arRows[$eventID][$keyQuestion3_text] = $arDataItem['MESSAGE'] !== 'null' ? $arDataItem['MESSAGE'] : ''; break; } break; case '6': // $arRows[$eventID][$keyDuration] = $arDataItem['MESSAGE']; break; } } $fileName = dirname(__FILE__) . '/tmp/' . md5(time() . rand(0, 1000)) . '.csv'; $rsFile = fopen($fileName, 'w'); foreach ($arRows as &$arRow) { for ($i = 2; $i < 7; $i++) { if (!$arRow[$i]) { $arRow[$i] = ''; } else { $arRow[$i] = str_replace(array("\r", "\n"), ' ', $arRow[$i]); } } if ($arRow[$keyQuestion1]) { ksort($arRow); fputcsv($rsFile, $arRow); } } fclose($rsFile); header('Content-Type: text/x-csv; charset=utf-8'); header("Content-Disposition: attachment;filename=nps_vote_stat.csv"); header("Content-Transfer-Encoding: binary "); $APPLICATION->RestartBuffer(); readfile($fileName); unlink($fileName); die(); } $this->IncludeComponentTemplate();
/var/./files/need-2-delete/mini-borishof.ru1/bitrix/components/rpromo/vote.result.csv/component.php