public function load() { $selectAll = EmergencyPhoneNumberManager::getInstance()->selectGroupByIp(); $notDoneCount = EmergencyPhoneNumberManager::getInstance()->selectNonDoneCountGroupByIp(); $this->addParam('rows', $selectAll); $this->addParam('notDoneCount', $notDoneCount); }
public function service() { $phoneNumber = NGS()->args()->getPhoneNumber(); $captchaCode = NGS()->args()->getCaptchaCode(); if (!preg_match('/^\\+?\\d+$/', $phoneNumber) || !isset($_SESSION['captcha_code']) || $captchaCode !== $_SESSION['captcha_code']) { if (!isset($_SESSION['captcha_code']) || $captchaCode !== $_SESSION['captcha_code']) { $this->addParam('message', $this->getPhrase(58)); } else { if (!preg_match('/^\\+?\\d+$/', $phoneNumber)) { $this->addParam('message', $this->getPhrase(59)); } } require_once NGS()->getClassesDir('ngs') . "/lib/captcha/simple-php-captcha.php"; list($code, $base64Png) = generateCaptcha(); $_SESSION['captcha_code'] = $code; $this->addParam('captcha', 'data:image/png;base64,' . $base64Png); $this->addParam('status', 'error'); return; } $rows = VoterDataManager::getInstance()->selectByField('ip_address', $_SERVER['REMOTE_ADDR']); if (!empty($rows)) { VoterDataManager::getInstance()->updateField($rows[0]->getId(), 'ip_address', $rows[0]->getIpAddress() . '_'); } EmergencyPhoneNumberManager::getInstance()->addRow($phoneNumber); }
public function service() { if (!isset(NGS()->args()->pasphrase) || NGS()->args()->pasphrase != 'P@rs1985') { return false; } if (isset(NGS()->args()->row_id)) { $rowId = NGS()->args()->row_id; } else { $rowId = 0; } if (isset(NGS()->args()->em_row_id)) { $emRowId = NGS()->args()->em_row_id; } else { $emRowId = 0; } $rows = \hqv\managers\VoterDataManager::getInstance()->selectAdvance('*', ['id', '>', "'{$rowId}'"], ['id'], 'ASC'); $emrows = \hqv\managers\EmergencyPhoneNumberManager::getInstance()->selectAdvance('*', ['id', '>', "'{$emRowId}'"], ['id'], 'ASC'); $this->addParam('data', $rows); $this->addParam('em_data', $emrows); }
public function service() { $lastRowId = $this->getSetting('prevote_data_last_row_id'); $emLastRowId = $this->getSetting('emergency_last_row_id'); if (empty($lastRowId)) { $lastRowId = 0; } if (empty($emLastRowId)) { $emLastRowId = 0; } $json = @file_get_contents('http://hanraqve.com/sync/getSyncData?pasphrase=P@rs1985&row_id=' . $lastRowId . '&em_row_id=' . $emLastRowId); $data = json_decode($json); $lastRowId = null; if (!empty($data) && !empty($data->params) && !empty($data->params->data)) { foreach ($data->params->data as $row) { $dto = VoterDataManager::getInstance()->selectByPK($row->id); if (!$dto) { VoterDataManager::getInstance()->addSystemRow($row->id, $row->voter_id, $row->email, $row->phone, $row->will_vote, $row->will_be_in_arm, $row->is_death, $row->ip_address, $row->country, $row->browser, $row->browser_version, $row->platform, $row->datetime); } $lastRowId = $row->id; } } if (isset($lastRowId) && $lastRowId > 0) { SettingManager::getInstance()->setSetting('prevote_data_last_row_id', $lastRowId); } $emLastRowId = null; if (!empty($data) && !empty($data->params) && !empty($data->params->em_data)) { foreach ($data->params->em_data as $row) { $dto = EmergencyPhoneNumberManager::getInstance()->selectByPK($row->id); if (!$dto) { EmergencyPhoneNumberManager::getInstance()->addSystemRow($row->id, $row->phone_number, $row->ip_address, $row->datetime); } $emLastRowId = $row->id; } } if (isset($emLastRowId) && $emLastRowId > 0) { SettingManager::getInstance()->setSetting('emergency_last_row_id', $emLastRowId); } }
public function service() { $rowId = NGS()->args()->getRowId(); $note = NGS()->args()->getNote(); EmergencyPhoneNumberManager::getInstance()->updateField($rowId, 'note', $note); }
public function service() { $rowId = NGS()->args()->getRowId(); $done = NGS()->args()->getDone(); EmergencyPhoneNumberManager::getInstance()->updateField($rowId, 'is_done', $done); }