Example #1
0
 public function no_ssl_settings()
 {
     $f = $this->init_module("Libs/QuickForm");
     $f->addElement('checkbox', 'allow', 'Allow unsecure connection');
     Base_ActionBarCommon::add('back', __('Back'), Base_BoxCommon::pop_main_href());
     Base_ActionBarCommon::add('save', __('Save'), $f->get_submit_form_href());
     if ($f->validate()) {
         $x = $f->exportValues();
         $allow = false;
         if (isset($x['allow']) && $x['allow']) {
             $allow = true;
         }
         Base_EssClientCommon::set_no_ssl_allow($allow);
         Base_BoxCommon::pop_main();
         return;
     }
     $f->setDefaults(array('allow' => Base_EssClientCommon::is_no_ssl_allowed()));
     print '<div class="important_notice">';
     print __('Allowing unsecure connection will cause all the data to be transferred without encryption. This creates opportunity for third parties to capture the data being transmitted, including your License Key. Please note that License Key should be kept confidential and that using the same License Key on several EPESI installations is a direct violation of Terms of Service and will result in termination of the License Key.');
     print '<center>';
     $f->display();
     print '</center>';
     print '</div>';
 }
Example #2
0
 protected function call($function, $params, $serialize_response = true)
 {
     self::log($function, $params, $serialize_response);
     $post_data = $this->build_query_post_data($function, $params, $serialize_response);
     $try_times = 3;
     while ($try_times--) {
         try {
             if ($this->secure_connection() == false) {
                 Base_EssClientCommon::add_client_message_warning("Used unsecure connection!");
             }
             $response = $this->request_server($post_data, !$serialize_response);
             return $this->return_response_value_handling_user_messages($serialize_response, $response);
         } catch (SecureConnectionException $e) {
             if (!Base_EssClientCommon::is_no_ssl_allowed()) {
                 try {
                     $main = Base_BoxCommon::main_module_instance();
                     $disable_link_href = $main->create_callback_href(array('Base_BoxCommon', 'push_module'), array('Base_EssClient', 'no_ssl_settings'));
                     $disable_msg = "<br/>Or disable secure connection here: <a {$disable_link_href}>SSL settings</a>";
                 } catch (Exception $e) {
                     $disable_msg = "<br/>Or disable secure connection";
                 }
                 Base_EssClientCommon::add_client_message_error($e->getMessage() . $disable_msg);
             } else {
                 $this->disable_secure_connection();
                 continue;
             }
         } catch (ErrorException $e) {
             Base_EssClientCommon::add_client_message_error($e->getMessage());
             return null;
         }
     }
     if (!$try_times) {
         Base_EssClientCommon::add_client_message_error("Connection try limit exceeded");
     }
 }