/** * Check that both the "from" and "to" fora are vaild * * @param object $event The event object * @return $fora_ok * @access protected */ protected function check_fora() { $fora_ok = true; if ($this->config['copy_topic_from_forum'] == 0 || $this->config['copy_topic_to_forum'] == 0) { $fora_ok = false; $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_FORA_ERROR'); } return $fora_ok; }
/** * Create the options to show the cookie acceptance box * * @param object $event The event object * @return null * @access public */ public function page_header($event) { $cookie_enabled = $this->config['cookie_policy_enabled']; // If we have already set the cookie on this device then there is no need to process $cookie_set = $this->request->is_set($this->config['cookie_name'] . '_ca', \phpbb\request\request_interface::COOKIE) ? true : false; if ($this->config['cookie_policy_enabled'] && !$cookie_set && !$this->user->data['is_bot']) { // Only need to do this if we are trying to detect if cookie required if ($this->config['cookie_eu_detect']) { // Setting this to true here means that if there is a problem with the IP lookup then the cookie will be enabled - just in case we have got it wrong! $cookie_enabled = true; // Check if cURL is available on the server if (function_exists('curl_version')) { $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_URL, 'http://ip-api.com/json/' . $this->user->ip . '?fields=status,countryCode'); $ip_query = curl_exec($curl_handle); curl_close($curl_handle); if (!empty($ip_query)) { $ip_array = json_decode($ip_query, true); $eu_array = array('AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'EU', 'FI', 'FR', 'FX', 'GB', 'GR', 'HR', 'HU', 'IE', 'IM', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'UK'); if ($ip_array['status'] == 'success' && !in_array($ip_array['countryCode'], $eu_array)) { // IP not in an EU country therefore we do not need to invoke the Cookie Policy $cookie_enabled = false; } else { if ($ip_array['status'] != 'success' && $this->config['cookie_log_errors']) { $this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_COOKIE_ERROR'); } } } else { if ($this->config['cookie_log_errors']) { $this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_SERVER_ERROR'); } } } else { if ($this->config['cookie_log_errors']) { $this->log->add('critical', $this->user->data['user_id'], $this->user->ip, 'LOG_CURL_ERROR'); } } } $this->template->assign_vars(array('COOKIE_BOX_BG_COLOUR' => addslashes($this->config['cookie_box_bg_colour']), 'COOKIE_BOX_HREF_COLOUR' => addslashes($this->config['cookie_box_href_colour']), 'COOKIE_BOX_TXT_COLOUR' => addslashes($this->config['cookie_box_txt_colour']), 'COOKIE_CLASS' => $this->config['cookie_box_position'] ? addslashes('cookie-box rightside') : addslashes('cookie-box leftside'), 'COOKIE_EXPIRES' => addslashes($this->config['cookie_expire']), 'COOKIE_NAME' => addslashes($this->config['cookie_name']), 'S_COOKIE_CUSTOM_BOX' => $this->config['cookie_custom_box'])); } $this->template->assign_vars(array('S_SHOW_COOKIE_ACCEPT' => $cookie_set, 'S_COOKIE_ENABLED' => $cookie_enabled)); }