Beispiel #1
0
 function new_menus()
 {
     if (MainWP_Utility::isAdmin()) {
         //Adding the page to manage your added sites/groups
         //The first page which will display the post area etc..
         MainWP_Security_Issues::initMenu();
         MainWP_Manage_Sites::initMenu();
         MainWP_Post::initMenu();
         MainWP_Page::initMenu();
         MainWP_Themes::initMenu();
         MainWP_Plugins::initMenu();
         MainWP_User::initMenu();
         MainWP_Manage_Backups::initMenu();
         MainWP_Bulk_Update_Admin_Passwords::initMenu();
         MainWP_Manage_Groups::initMenu();
         MainWP_Settings::initMenu();
         MainWP_Extensions::initMenu();
         do_action('mainwp_admin_menu');
         MainWP_Documentation::initMenu();
         MainWP_Server_Information::initMenu();
         MainWP_Child_Scan::initMenu();
         MainWP_API_Settings::initMenu();
     }
 }
    public static function _renderNewSite(&$groups)
    {
        if (!mainwp_current_user_can('dashboard', 'add_sites')) {
            mainwp_do_not_have_permissions(__('add sites', 'mainwp'));
            return;
        }
        $passed_curl_ssl = MainWP_Server_Information::checkCURLSSLInfo();
        ?>
       <div id="mainwp_managesites_add_errors" class="mainwp_info-box-red"></div>
       <div id="mainwp_managesites_add_message" class="mainwp_info-box"></div>
       <div class="postbox" id="mainwp-add-a-single-site">
       <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Add a Single Site', 'mainwp');
        ?>
</span></h3>
       <div class="inside">
        <div id="mainwp-add-site-notice-box" >
       <div id="mainwp-add-site-notice-show" class="mainwp_info-box-blue" style="background-position: 10px 10px !important; display: none; text-align: center;"><a href="#" class="button button-primary" id="mainwp-add-site-notice-show-link"><?php 
        _e('Having trouble adding your site?', 'mainwp');
        ?>
</a></div>
       <div id="mainwp-add-site-notice" class="mainwp_info-box-blue" style="background-position: 10px 25px !important;">
         <p>
			<?php 
        echo sprintf(__('If you are having trouble adding your site please use the %sTest Connection tab%s. This tells you the header response being received by your dashboard from that child site. <br/><strong>The Test Connection feature is specifically testing what your Dashboard can "see" and what your Dashboard "sees" and what my Dashboard "sees" or what your browser "sees" can be completely different things.</strong>', 'mainwp'), '<a href="/wp-admin/admin.php?page=managesites&do=test" style="text-decoration: none;">', '</a>');
        ?>
         </p>
         <p>
           <strong><?php 
        _e('Most common reasons for sites not being added are:', 'mainwp');
        ?>
</strong>
           <ol>
			   <li><strong><?php 
        echo sprintf(__('You have a Security Plugin blocking the connection. If you have a security plugin installed and are having an issue please check the %sPlugin Conflict page%s for how to resolve.', 'mainwp'), '<a href="http://docs.mainwp.com/known-plugin-conflicts/" style="text-decoration: none;">', '</a>');
        ?>
</strong></li>
             <li><?php 
        _e('Your Dashboard is on the same host as your Child site. Some hosts will not allow two sites on the same server to communicate with each other. In this situation you would contact your host for assistance or move your Dashboard or Child site to a different host.', 'mainwp');
        ?>
</li>
             <li><?php 
        _e('You may have recently moved the child site and your Dashboard\'s Server may not have an updated DNS or your server may be experiencing DNS issues.  To check this use the Test Connection tab and verify the IP that shows up with the IP that shows on your Child sites MainWP Server Information page. ', 'mainwp');
        ?>
</li>
             <li class="curl-notice" <?php 
        echo $passed_curl_ssl ? 'style="display: none;"' : '';
        ?>
><?php 
        _e('Your Dashboard or Child site is experiencing SSL or cURL errors which can make it so you are unable to the new Child site.  You can check for these errors on the Server Information page for both the MainWP Dashboard and Child Plugin.', 'mainwp');
        ?>
</li>
           </ol>
         </p>
         <p style="text-align: center;"><a href="#" class="button button-primary" style="text-decoration: none;" id="mainwp-add-site-notice-dismiss"><?php 
        _e('Hide this message', 'mainwp');
        ?>
</a></p>         
       </div>
        </div>
       <form method="POST" action="" enctype="multipart/form-data" id="mainwp_managesites_add_form">
           <table class="form-table">
               <tr class="form-field form-required">
                   <th scope="row"><?php 
        _e('Site Name', 'mainwp');
        ?>
</th>
                   <td>
                            <input type="text"
                                   id="mainwp_managesites_add_wpname"
                                   name="mainwp_managesites_add_wpname"
                                   value=""
                                   class=""/>
                    </td>
               </tr>
               <tr class="form-field form-required">
                   <th scope="row"><?php 
        _e('Site URL', 'mainwp');
        ?>
</th>
                   <td><select id="mainwp_managesites_add_wpurl_protocol" name="mainwp_managesites_add_wpurl_protocol"><option value="http">http://</option><option value="https">https://</option></select> <input type="text"
                               id="mainwp_managesites_add_wpurl"
                               name="mainwp_managesites_add_wpurl"
                               value=""
                               class="" />
                    </td>
               </tr>
               <tr class="form-field form-required">
                   <th scope="row"><?php 
        _e('Administrator Username', 'mainwp');
        ?>
</th>
                   <td>
                        <input type="text"
                               id="mainwp_managesites_add_wpadmin"
                               name="mainwp_managesites_add_wpadmin"
                               value=""
                               class="" />
                    </td>
               </tr>
               <tr>
                   <th scope="row"><?php 
        _e('Groups', 'mainwp');
        ?>
</th>
                   <td>
                        <input type="text"
                               name="mainwp_managesites_add_addgroups"
                               id="mainwp_managesites_add_addgroups"
                               value=""
                               class="regular-text form-control" />
                        <span class="mainwp-form_hint"><?php 
        _e('Separate groups by commas (e.g. Group 1, Group 2)', 'mainwp');
        ?>
</span>
                       <div id="selected_groups" style="display: block; width: 25em">
                           <?php 
        if (count($groups) == 0) {
            echo 'No groups added yet.';
        }
        foreach ($groups as $group) {
            echo '<div class="mainwp_selected_groups_item"><input type="checkbox" name="selected_groups[]" value="' . $group->id . '" /> &nbsp ' . stripslashes($group->name) . '</div>';
        }
        ?>
                       </div>
                       <span class="description"><?php 
        _e('Or assign existing groups.', 'mainwp');
        ?>
</span>
                   </td>
               </tr>
               </table>
               </div>
               </div>

            <div class="postbox" id="mainwp-managesites-adv-options">
                <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Advanced Options', 'mainwp');
        ?>
</span></h3>
                <div class="inside">
                    <table class="form-table">
                        <tr class="form-field form-required">
                             <th scope="row"><?php 
        _e('Child Unique Security
                               ID ', 'mainwp');
        MainWP_Utility::renderToolTip('The Unique Security ID adds additional protection between the Child plugin and your Main Dashboard. The Unique Security ID will need to match when being added to the Main Dashboard. This is additional security and should not be needed in most situations.');
        ?>
</th>
                             <td>
                             <input type="text"
                                    id="mainwp_managesites_add_uniqueId"
                                    style="width: 350px;"
                                    name="mainwp_managesites_add_uniqueId"
                                    value=""
                                    class=""/>
                            <span class="mainwp-form_hint">The Unique Security ID adds additional protection between the Child plugin and your Main Dashboard. The Unique Security ID will need to match when being added to the Main Dashboard. This is additional security and should not be needed in most situations.</span></td>
                        </tr>
                        <tr class="form-field form-required">
                            <th scope="row"><?php 
        _e('Verify Certificate', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp'));
        ?>
</th>
                            <td>
                                    <select id="mainwp_managesites_verify_certificate" name="mainwp_managesites_verify_certificate" class="form-control">
                                         <option selected value="1"><?php 
        _e('Yes', 'mainwp');
        ?>
</option>
                                         <option value="0"><?php 
        _e('No', 'mainwp');
        ?>
</option>
                                         <option value="2"><?php 
        _e('Use Global Setting', 'mainwp');
        ?>
</option>
                                    </select> <em><?php 
        _e('Default: Yes', 'mainwp');
        ?>
</em>
                            </td>
                        </tr>
	                    <tr class="form-field form-required">
	                       <th scope="row"><?php 
        _e('SSL Version', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Prefered SSL Version to connect to your site.', 'mainwp'));
        ?>
</th>
	                        <td>
	                            <select id="mainwp_managesites_ssl_version" name="mainwp_managesites_ssl_version">
	                                 <option selected value="auto"><?php 
        _e('Auto detect', 'mainwp');
        ?>
</option>
	                                 <option value="1.x"><?php 
        _e('TLS v1.x', 'mainwp');
        ?>
</option>
	                                 <option value="2"><?php 
        _e('SSL v2', 'mainwp');
        ?>
</option>
	                                 <option value="3"><?php 
        _e('SSL v3', 'mainwp');
        ?>
</option>
	                                 <option value="1.0"><?php 
        _e('TLS v1.0', 'mainwp');
        ?>
</option>
	                                 <option value="1.1"><?php 
        _e('TLS v1.1', 'mainwp');
        ?>
</option>
	                                 <option value="1.2"><?php 
        _e('TLS v1.2', 'mainwp');
        ?>
</option>
	                             </select> <em>(<?php 
        _e('Default: Auto detect', 'mainwp');
        ?>
)</em>
	                        </td>
	                    </tr>

                        <!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
                        <input style="display:none" type="text" name="fakeusernameremembered"/>
                        <input style="display:none" type="password" name="fakepasswordremembered"/>

                        <tr>
                            <td colspan="2"><div class="mainwp_info-box"><?php 
        _e('If your Child Site is protected with HTTP basic authentication, please set the username and password for authentication here.', 'mainwp');
        ?>
</div></td>
                        </tr>

                        <tr class="form-field form-required">
                             <th scope="row"><?php 
        _e('HTTP username ', 'mainwp');
        ?>
</th>
                             <td>
                                     <input type="text"
                                            id="mainwp_managesites_add_http_user"
                                            style="width: 350px;"
                                            name="mainwp_managesites_add_http_user"
                                            value=""
                                            class=""/>
                            </td>
                        </tr>
                        <tr class="form-field form-required">
                             <th scope="row"><?php 
        _e('HTTP password ', 'mainwp');
        ?>
</th>
                             <td>
                                    <input type="password"
                                           id="mainwp_managesites_add_http_pass"
                                           style="width: 350px;"
                                           name="mainwp_managesites_add_http_pass"
                                           value=""
                                           class=""/>
                            </td>
                        </tr>
                    </table>
                    </div>
                </div>

               <div class="postbox" id="mainwp-bulk-upload-sites">
               <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Bulk Upload', 'mainwp');
        ?>
</span></h3>
               <div class="inside">
               <table>
                   <th scope="row"></th>
                   <td>
                       <input type="file" name="mainwp_managesites_file_bulkupload"
                              id="mainwp_managesites_file_bulkupload"
                              accept="text/comma-separated-values"
                              class="regular-text" disabled="disabled"/>
                      <span
                              class="description"><?php 
        _e('File must be in CSV format.', 'mainwp');
        ?>
 <a
                              href="<?php 
        echo plugins_url('csv/sample.csv', dirname(__FILE__));
        ?>
"><?php 
        _e('Click
                          here to download sample CSV file.', 'mainwp');
        ?>
</a></span>

                       <div>
                           <p>
                               <input type="checkbox" name="mainwp_managesites_chk_bulkupload"
                                      id="mainwp_managesites_chk_bulkupload" value="1"/>
                               <label for="mainwp_managesites_chk_bulkupload"><span class="description"><?php 
        _e('Upload file', 'mainwp');
        ?>
</span></label>
                           </p>

                           <p>
                               <input type="checkbox" name="mainwp_managesites_chk_header_first"
                                      disabled="disabled" checked="checked"
                                      id="mainwp_managesites_chk_header_first" value="1"/>
                               <label for="mainwp_managesites_chk_header_first"><span class="description"><?php 
        _e('CSV file contains a header.', 'mainwp');
        ?>
</span></label>
                           </p>
                       </div>
                   </td>
           </table>
           </div>
           </div>



           <p class="submit"><input type="button" name="mainwp_managesites_add"
                                    id="mainwp_managesites_add"
                                    class="button-primary button button-hero" value="<?php 
        _e('Add New Site', 'mainwp');
        ?>
"/></p>
       </form>
<?php 
    }
 function mainwp_serverInformation()
 {
     $this->secure_request();
     MainWP_Server_Information::fetchChildServerInformation($_POST['siteId']);
     die;
 }
    protected static function render_row_with_description($pConfig, $pCompare, $pVersion, $pGetter, $pExtraText = '', $pExtraCompare = null, $pExtraVersion = null, $description = '', $whatType = null, $errorType = self::WARNING)
    {
        $currentVersion = call_user_func(array(MainWP_Server_Information::getClassName(), $pGetter));
        ?>
		<tr>
			<td><?php 
        echo $pConfig;
        ?>
</td>
			<td><?php 
        echo $pCompare;
        ?>
  <?php 
        echo ($pVersion === true ? 'true' : (is_array($pVersion) && isset($pVersion['version']) ? $pVersion['version'] : $pVersion)) . ' ' . $pExtraText;
        ?>
</td>
			<td><?php 
        echo $currentVersion === true ? 'true' : $currentVersion;
        ?>
</td>
			<?php 
        if ($whatType == 'filesize') {
            ?>
				<td><?php 
            echo self::filesize_compare($currentVersion, $pVersion, $pCompare) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML($errorType);
            ?>
</td>
			<?php 
        } else {
            if ($whatType == 'curlssl') {
                ?>
				<td><?php 
                echo self::curlssl_compare($pVersion, $pCompare) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML($errorType);
                ?>
</td>
			<?php 
            } else {
                if ($pGetter == 'getMaxInputTime' && $currentVersion == -1) {
                    ?>
				<td><?php 
                    echo '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>';
                    ?>
</td>
			<?php 
                } else {
                    ?>
				<td><?php 
                    echo version_compare($currentVersion, $pVersion, $pCompare) || $pExtraCompare != null && version_compare($currentVersion, $pExtraVersion, $pExtraCompare) ? '<span class="mainwp-pass"><i class="fa fa-check-circle"></i> Pass</span>' : self::getWarningHTML($errorType);
                    ?>
</td>
			<?php 
                }
            }
        }
        ?>
		</tr>
		<?php 
    }
    public function mwp_setup_system_requirements()
    {
        $hosting_type = get_option('mwp_setup_installationHostingType');
        $system_type = get_option('mwp_setup_installationSystemType');
        $back_step = "installation";
        if ($system_type == 3 && $hosting_type == 2) {
            $back_step = '';
        }
        ?>
		<h1><?php 
        _e('Dashboard System Requirements Checkup', 'mainwp');
        ?>
</h1>
		<p><?php 
        _e('Any Warning here may cause the MainWP Dashboard to malfunction. After you complete the Quick Start setup it is recommended to contact your host’s support and updating your server configuration for optimal performance.', 'mainwp');
        ?>
</p>
		<?php 
        MainWP_Server_Information::renderQuickSetupSystemCheck();
        ?>
		<br/>
		<p class="mwp-setup-actions step">
			<a href="<?php 
        echo esc_url($this->get_next_step_link());
        ?>
" class="button-primary button button-large"><?php 
        _e('Continue', 'mainwp');
        ?>
</a>
			<a href="<?php 
        echo esc_url($this->get_next_step_link());
        ?>
" class="button button-large"><?php 
        _e('Skip this step', 'mainwp');
        ?>
</a>
			<a href="<?php 
        echo esc_url($this->get_back_step_link($back_step));
        ?>
" class="button button-large"><?php 
        _e('Back', 'mainwp');
        ?>
</a>
			<?php 
        wp_nonce_field('mwp-setup');
        ?>
		</p>
		<?php 
    }