/**
  * 	getSupportPage
  *
  *
  * @return
  * 
  */
 function getSupportPage()
 {
     if (!current_user_can('manage_options')) {
         return;
     }
     if (EasyContactFormsSupport::submitSupportForm()) {
         return;
     }
     wp_enqueue_script('easy-contact-forms-html', plugins_url('easy-contact-formshtml.1.4.9.js', __FILE__), array(), false, true);
     wp_enqueue_script('easy-contact-forms-env', plugins_url('easy-contact-forms.env.1.4.9.js', __FILE__), array(), false, true);
     $env = (object) array();
     $env->System = (object) array();
     $env->Wordpress = (object) array();
     $env->Theme = (object) array();
     global $current_user;
     $wp_url = rtrim(site_url(), '/');
     $version = '1.4.9';
     $env->System->PHPVersion = phpversion();
     $env->System->UserAgent = $_SERVER['HTTP_USER_AGENT'];
     $env->System->Server = $_SERVER['SERVER_SOFTWARE'];
     $env->Wordpress->Version = get_bloginfo('version');
     $env->Wordpress->Home = home_url();
     $env->Wordpress->Site = $wp_url;
     $env->Wordpress->AdminEmail = $current_user->user_email;
     $env->Theme = (object) array();
     if (function_exists('wp_get_theme')) {
         $theme = wp_get_theme();
     } else {
         $theme_path = get_stylesheet_directory() . '/style.css';
         $theme = get_theme_data($theme_path);
         $theme = (object) $theme;
     }
     $env->Theme->Name = $theme->Name;
     $env->Theme->ThemeURI = $theme->ThemeURI;
     $env->Theme->Version = $theme->Version;
     $env->Plugins = array();
     $plugins = get_plugins();
     $plugintable = array();
     $plugintable[] = "<tr><th>" . __('Name') . "</th><th>" . __('Version') . "</th><th>&nbsp;&nbsp;URI</th></tr>";
     foreach (array_keys($plugins) as $key) {
         if (!is_plugin_active($key)) {
             continue;
         }
         $plugindata =& $plugins[$key];
         $plugin = (object) array();
         $env->Plugins[] = $plugin;
         $plugin->Name = $plugindata['Name'];
         $plugin->Version = $plugindata['Version'];
         $plugin->PluginURI = $plugindata['PluginURI'];
         $plugintable[] = "<tr><td>{$plugin->Name}</td><td>{$plugin->Version}</td><td>{$plugin->PluginURI}</td></tr>";
     }
     $plugintable = implode('', $plugintable);
     $plugintable = "<table class='ufo-object-table'>{$plugintable}</table>";
     global $wpdb;
     $query = "SELECT CustomForms.id AS id, CustomForms.Description AS Name, CustomForms.NotificationSubject, CustomForms.NotificationText, CustomForms.SendNotificationAsText AS NotificationAsText, CustomForms.SendConfirmation AS SendConfirmations, CustomForms.SendFrom AS SendFromName, CustomForms.SendFromAddress, CustomForms.ConfirmationSubject, CustomForms.ConfirmationText, CustomForms.IncludeVisitorsAddressInReplyTo AS ReplyToVisitors, CustomForms.ReplyToNameTemplate, CustomForms.ConfirmationReplyToName, CustomForms.ConfirmationReplyToAddress, Users.email AS RecipientEmail, Users.Role AS RecipientRole, EngineUsers.user_login AS RecipientUserName FROM {$wpdb->prefix}easycontactforms_customforms AS CustomForms\tLEFT JOIN {$wpdb->prefix}easycontactforms_users AS Users LEFT JOIN {$wpdb->prefix}users AS EngineUsers ON Users.CMSId = EngineUsers.ID\tON CustomForms.ObjectOwner = Users.id";
     $env->Forms = $wpdb->get_results($query);
     $formtable = EasyContactFormsUtils::getSimpleTable($env->Forms);
     $env->Settings->SupportInfo = "Objects could not be loaded";
     if (@(include_once 'easy-contact-forms-root.php')) {
         require_once 'easy-contact-forms-applicationsettings.php';
         unset($env->Settings->SupportInfo);
         $as = EasyContactFormsClassLoader::getObject('ApplicationSettings', true, 1);
         $env->Settings = $as->getData();
         unset($env->Settings->SecretWord);
         unset($env->Settings->id);
         unset($env->Settings->Description);
     }
     $settinstable = EasyContactFormsUtils::getSimpleObjectTable($env->Settings);
     $data = "\n\t\t<h4>System Information:</h4>\n\t\t<table class='ufo-object-table'>\n\t\t<tr><th>Plugin Version:</th><td>{$version}</td></tr>\n\t\t<tr><th>WP Version:</th><td>{$env->Wordpress->Version}</td></tr>\n\t\t<tr><th>WP home URL</th><td>{$env->Wordpress->Home}</td></tr>\n\t\t<tr><th>WP site URL</th><td>{$env->Wordpress->Site}</td></tr>\n\t\t<tr><th>Admin email</th><td>{$env->Wordpress->AdminEmail}</td></tr>\n\t\t<tr><th>JS Errors</th><td id='support-data-table-js-errors'><span style='color:red'>Yes</span></td></tr>\n\t\t<tr><th>jQuery version</th><td id='support-data-table-query-version'></td></tr>\n\t\t<tr><th>PHP Version:</th><td>{$env->System->PHPVersion}</td></tr>\n\t\t<tr><th>User Agent:</th><td>{$env->System->UserAgent}</td></tr>\n\t\t<tr><th>Server Software:</th><td>{$env->System->Server}</td></tr>\n\t\t<tr><th>Theme Name:</th><td>{$env->Theme->Name}</td></tr>\n\t\t<tr><th>Theme URI:</th><td>{$env->Theme->ThemeURI}</td></tr>\n\t\t<tr><th>Theme Version:</th><td>{$env->Theme->Version}</td></tr>\n\t\t</table>\n\n\t\t<h4>Active Plugins:</h4>\n\t\t{$plugintable}\n\n\t\t<h4>Settings:</h4>\n\t\t{$settinstable}\n\n\t\t<h4>Form configuration:</h4>\n\t\t{$formtable}\n\n\t\t";
     $supportform = $this->getForm();
     if (!is_string($supportform)) {
         $supportform = $supportform->get_error_message();
     }
     echo "<div class='wrap'>";
     echo EasyContactFormsSupport::validateForm();
     echo "<h2>" . __('Easy Contact Forms Support') . "</h2>";
     echo "<div class='postbox-container-1' style='width:620px'>";
     echo "<div class='metabox-holder'>";
     echo "<div class='postbox'>";
     echo "<h3>" . __('Support Request') . "</h3>";
     echo "<div class='inside'>";
     echo "<form method='POST'>";
     echo "<input type='hidden' name='support-data-product-version' value='{$version}'>";
     echo "<input type='hidden' name='support-form-data' value='1'>";
     echo "<input type='hidden' name='support-data-query-version' id='support-data-query-version'>";
     echo "<input type='hidden' name='support-data-js-errors' id='support-data-js-errors' value='Yes'>";
     $env = base64_encode(serialize($env));
     echo "<input type='hidden' name='support-data-env' id='support-data-env' value='{$env}'>";
     echo $supportform;
     echo "<label><input type='checkbox' checked onchange='document.getElementById(\"support-data-env\").disabled = !this.checked'>&nbsp;" . __('Send Environment Info') . "</label><br />";
     echo "<br /><input class='button-primary' type='submit' value='" . __('Submit') . "'>";
     echo "</form>";
     echo "</div>";
     echo "</div>";
     echo "</div>";
     echo "</div>";
     echo "<style>.ufo-object-table th {text-align:left;}.ufo-object-table{font-size:11px;}</style>";
     echo "<div class='postbox-container-1' style='width:620px'>";
     echo "<div class='metabox-holder'>";
     echo "<div class='postbox'>";
     echo "<h3>" . __('System information to be sent along with the support request:') . "</h3>";
     echo "<div class='inside'>";
     echo "<div>";
     echo $data;
     echo "</div>";
     echo "</div>";
     echo "</div>";
     echo "</div>";
     echo "</div>";
     echo "</div>";
 }