/** * @param int $dataset_id * @return array */ public function getDatasetInfo($dataset_id) { $dataset_id = (int) $dataset_id; if (!$dataset_id) { return array(); } $sql = "SELECT dataset_name, dataset_key FROM " . $this->db->table("datasets") . " WHERE dataset_id = " . $dataset_id; $result = $this->db->query($sql); if (!$result->row['dataset_name']) { return array(); } $dataset = new ADataset($result->row['dataset_name'], $result->row['dataset_key']); $output['dataset_name'] = $result->row['dataset_name']; $output['dataset_key'] = $result->row['dataset_key']; $output['num_rows'] = sizeof($dataset->getRows()); $output['dataset_properties'] = $dataset->getDatasetProperties(); if (!$output['dataset_properties']) { unset($output['dataset_properties']); } $cols = $dataset->getColumnDefinitions(); if ($cols) { foreach ($cols as $column) { $output['dataset_column_definition'][] = array($column['dataset_column_name'] => $column['dataset_column_type']); } } $output['dataset_column_properties'] = $dataset->getColumnsProperties(); if (!$output['dataset_column_properties']) { unset($output['dataset_column_properties']); } return $output; }
private function _validateCaptcha() { if ($this->config->get('config_recaptcha_secret_key')) { /** @noinspection PhpIncludeInspection */ require_once DIR_VENDORS . '/google_recaptcha/autoload.php'; $recaptcha = new \ReCaptcha\ReCaptcha($this->config->get('config_recaptcha_secret_key')); $resp = $recaptcha->verify($this->request->post['g-recaptcha-response'], $this->request->server['REMOTE_ADDR']); if (!$resp->isSuccess() && $resp->getErrorCodes()) { $this->error['captcha'] = $this->language->get('error_captcha'); return FALSE; } } else { if (!isset($this->session->data['captcha']) || $this->session->data['captcha'] != $this->request->post['captcha']) { $this->error['captcha'] = $this->language->get('error_captcha'); return FALSE; } } if (mb_strlen($this->request->post['username']) < 1) { $this->error['username'] = $this->language->get('error_username'); return FALSE; } $password_reset = new ADataset('admin_pass_reset', $this->request->post['username'], 'silent'); $reset_data = $password_reset->getDatasetProperties(); $email = $reset_data['email']; $hash = $reset_data['hash']; if (empty($email) || $hash != $this->request->get['hash']) { $this->error['warning'] = $this->language->get('error_hash'); } else { $this->loadModel('user/user'); $users = $this->model_user_user->getUsers(array('search' => "email = '" . $this->db->escape($email) . "'")); if (empty($users)) { $this->error['warning'] = $this->language->get('error_hash'); } else { $this->user_data = $users[0]; } } $this->extensions->hk_ValidateData($this); if (!$this->error) { //destroy scratch data $password_reset->dropDataset(); return TRUE; } else { return FALSE; } }