private function connect()
 {
     add_option('wpadm_pub_key', $this->pub_key);
     $this->result->setResult(WPAdm_Result::WPADM_RESULT_SUCCESS);
     $sendData['system_data'] = get_system_data();
     $data['actApi'] = 'setStats';
     $data['site'] = get_option('siteurl');
     $data['data'] = wpadm_pack($sendData);
     if (!class_exists('WP_Http')) {
         include_once ABSPATH . WPINC . '/class-http.php';
     }
     $remote = array();
     $remote['body'] = $data;
     $remote['timeout'] = 20;
     $result = wp_remote_post(WPADM_URL_BASE, $remote);
 }
    function wpadm_plugins()
    {
        global $wp_version;
        $c = get_system_data();
        $phpVersion = $c['php_verion'];
        $maxExecutionTime = $c['maxExecutionTime'];
        $maxMemoryLimit = $c['maxMemoryLimit'];
        $extensions = $c['extensions'];
        $disabledFunctions = $c['disabledFunctions'];
        //try set new max time
        $newMaxExecutionTime = $c['newMaxExecutionTime'];
        $upMaxExecutionTime = $c['upMaxExecutionTime'];
        $maxExecutionTime = $c['maxExecutionTime'];
        //try set new memory limit
        $upMemoryLimit = $c['upMemoryLimit'];
        $newMemoryLimit = $c['newMemoryLimit'];
        $maxMemoryLimit = $c['maxMemoryLimit'];
        //try get mysql version
        $mysqlVersion = $c['mysqlVersion'];
        $show = !get_option('wpadm_pub_key') || (!is_super_admin() || !is_admin()) || !@get_option(_PREFIX_STAT . 'counter_id');
        ?>
 


        <?php 
        if (!$show) {
            ?>
            <div class="cfTabsContainer">
                <div id="cf_signin" class="cfContentContainer" style="display: block;">
                    <form method="post" action="<?php 
            echo WPADM_URL_BASE . "user/login";
            ?>
" autocomplete="off" target="_blank">
                        <div class="inline" style="width: 52%; margin-top: 0; color: #fff;">
                            WPAdm Sign-In:
                            <input class="input-small" type="email" required="required" name="username" placeholder="Email">
                            <input class="input-small" type="password" required="required" name="password" placeholder="Password">
                            <input class="button-wpadm" type="submit" value="Sign-In" name="submit" style="margin-top:1px;">    
                        </div>
                        <div class="wpadm-info-auth" style="width: 45%;">
                            Enter your email and password from an account at <a href="http://www.wpadm.com" target="_blank" style="color: #fff;" >www.wpadm.com</a>.<br /> After submitting user credentials you will be redirected to your Admin area on <a href="http://www.wpadm.com" style="color: #fff;" target="_blank">www.wpadm.com</a>.
                        </div>
                    </form>
                </div>
            </div>
            <?php 
        } else {
            ?>
            <div class="cfTabsContainer" style="display: none;">
                <div id="cf_activate" class="cfContentContainer">
                    <form method="post" action="<?php 
            echo admin_url('admin-post.php?action=wpadm_activate_plugin');
            ?>
" >
                        <div class="wpadm-info-title">
                            Free Sign Up to use more functionality...
                        </div>
                        <div class="wpadm-registr-info">
                            <table class="form-table">
                                <tbody>
                                    <tr valign="top">
                                        <th scope="row">
                                            <label for="email">E-mail</label>
                                        </th>
                                        <td>
                                            <input id="email" class="regular-text" type="text" name="email" value="">
                                        </td>
                                    </tr>
                                    <tr valign="top">
                                        <th scope="row">
                                            <label for="password">Password</label>
                                        </th>
                                        <td>
                                            <input id="password" class="regular-text" type="password" name="password" value="">
                                        </td>
                                    </tr>
                                    <tr valign="top">
                                        <th scope="row">
                                            <label for="password-confirm">Password confirm</label>
                                        </th>
                                        <td>
                                            <input id="password-confirm" class="regular-text" type="password" name="password-confirm" value="">
                                        </td>
                                    </tr>
                                    <tr valign="top">
                                        <th scope="row">
                                        </th>
                                        <td>
                                            <input class="button-wpadm" type="submit" value="Register & Activate" name="submit">
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="wpadm-info">
                            <span style="font-weight:bold; font-size: 14px;">If you are NOT registered at WPAdm,</span> enter your email and password to use as your Account Data for authorization on WPAdm. <br /><span style="font-weight: bold;font-size: 14px;">If you already have an account at WPAdm</span> and you want to Sign-In, so please, enter your registered credential data (email and password twice).
                        </div>
                    </form>
                </div>
            </div>  
            <?php 
        }
        ?>

        <script>
            jQuery(document).ready(function() {
                jQuery('.plugins-icon').click(function() {
                    title = jQuery(this).parent('.plugins-title');
                    box = title.parent('.plugins-box');
                    content = box.find('.plugins-info-content');
                    display = content.css('display');
                    if (display == 'none') {
                        content.show('slow');
                    } else {
                        content.hide('slow');
                    }
                })
            })
            function showRegistartion(show)
            {
                if (show) {
                    jQuery('.cfTabsContainer').show('slow');
                } else {
                    jQuery('.cfTabsContainer').hide('slow');
                }
            }
        </script>

        <div class="clear" style="margin-bottom: 50px;"></div>
        <table class="wp-list-table widefat fixed" >
            <thead>
                <tr>
                    <th></th>
                    <th>Recommended value</th>
                    <th>Your value</th>
                    <th>Status</th>
                </tr>
            </thead>
            <tbody>  
                <tr>
                    <th scope="row">PHP Version</th>
                    <td><?php 
        echo PHP_VERSION_DEFAULT;
        ?>
 or greater</td>
                    <td><?php 
        echo check_version($phpVersion, PHP_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $phpVersion . '</span>' : $phpVersion;
        ?>
</td>
                    <td><?php 
        echo check_version($phpVersion, PHP_VERSION_DEFAULT) ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Please update your PHP version to get it working correctly</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">MySQL Version</th>
                    <td><?php 
        echo MYSQL_VERSION_DEFAULT;
        ?>
 or greater</td>
                    <td><?php 
        echo check_version($mysqlVersion, MYSQL_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $mysqlVersion . '</span>' : $mysqlVersion;
        ?>
</td>
                    <td><?php 
        echo check_version($mysqlVersion, MYSQL_VERSION_DEFAULT) ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Please update your MySQL version to get it working correctly</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Max Execution Time</th>
                    <td><?php 
        echo $newMaxExecutionTime;
        ?>
</td>
                    <td><?php 
        echo $upMaxExecutionTime == 0 ? '<span style="color:#fb8004;font-weight:bold;">' . $maxExecutionTime . '</span>' : $maxExecutionTime;
        ?>
</td>
                    <td><?php 
        echo $upMaxExecutionTime == 1 ? '<span style="color:green; font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Correct operation of the plugin can not be guaranteed.</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Max Memory Limit</th>
                    <td><?php 
        echo $newMemoryLimit . 'M';
        ?>
</td>
                    <td><?php 
        echo $upMemoryLimit == 0 ? '<span style="color:#fb8004;font-weight:bold;">' . $maxMemoryLimit . '</span>' : $maxMemoryLimit;
        ?>
</td>
                    <td><?php 
        echo $upMemoryLimit == 1 ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Correct operation of the plugin can not be guaranteed.</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">PHP Extensions</th>
                    <?php 
        $ex = $c['ex'];
        ?>
                    <td><?php 
        echo $ex === false ? 'All present' : '<span style="color:#ffba00;font-weight:bold;">' . implode(", ", $ex) . '</span>';
        ?>
</td>
                    <td><?php 
        echo $ex === false ? 'Found' : '<span style="color:#ffba00;font-weight:bold;">Not Found</span>';
        ?>
</td>
                    <td><?php 
        echo $ex === false ? '<span style="color:green;font-weight:bold;">Ok</span>' : '<span style="color:#fb8004;font-weight:bold;">Functionality are not guaranteed.</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Disabled Functions</th>
                    <td colspan="3" align="left"><?php 
        echo ($func = $c['func']) === false ? '<span style="color:green;font-weight:bold;">All necessary functions are enabled</span>' : '<span style="color:#fb8004;font-weight:bold;">Please enable these functions to get plugin working correctly: ' . implode(", ", $func) . '</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Plugin Access</th>
                    <td colspan="3" align="left"><?php 
        echo is_admin() && is_super_admin() ? "<span style=\"color:green; font-weight:bold;\">Granted</span>" : "<span style=\"color:red; font-weight:bold;\">To administrate this Plugin(s) is an 'Admin' right required.</span>";
        ?>
</td>
                </tr>
            </tbody>
        </table>
        <?php 
    }
Exemple #3
0
    function wpadm_plugins()
    {
        global $wp_version;
        $c = get_system_data();
        $phpVersion = $c['php_verion'];
        $maxExecutionTime = $c['maxExecutionTime'];
        $maxMemoryLimit = $c['maxMemoryLimit'];
        $extensions = $c['extensions'];
        $disabledFunctions = $c['disabledFunctions'];
        //try set new max time
        $newMaxExecutionTime = $c['newMaxExecutionTime'];
        $upMaxExecutionTime = $c['upMaxExecutionTime'];
        $maxExecutionTime = $c['maxExecutionTime'];
        //try set new memory limit
        $upMemoryLimit = $c['upMemoryLimit'];
        $newMemoryLimit = $c['newMemoryLimit'];
        $maxMemoryLimit = $c['maxMemoryLimit'];
        //try get mysql version
        $mysqlVersion = $c['mysqlVersion'];
        ?>
        <div class="clear" style="margin-bottom: 50px;"></div>
        <table class="wp-list-table widefat fixed" >
            <thead>
                <tr>
                    <th></th>
                    <th>Recommended value</th>
                    <th>Your value</th>
                    <th>Status</th>
                </tr>
            </thead>
            <tbody>  
                <tr>
                    <th scope="row">PHP Version</th>
                    <td><?php 
        echo PHP_VERSION_DEFAULT;
        ?>
 or greater</td>
                    <td><?php 
        echo comparison_version($phpVersion, PHP_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $phpVersion . '</span>' : $phpVersion;
        ?>
</td>
                    <td><?php 
        echo comparison_version($phpVersion, PHP_VERSION_DEFAULT) ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Please update your PHP version to get it working correctly</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">MySQL Version</th>
                    <td><?php 
        echo MYSQL_VERSION_DEFAULT;
        ?>
 or greater</td>
                    <td><?php 
        echo comparison_version($mysqlVersion, MYSQL_VERSION_DEFAULT) === false ? '<span style="color:#fb8004;font-weight:bold;">' . $mysqlVersion . '</span>' : $mysqlVersion;
        ?>
</td>
                    <td><?php 
        echo comparison_version($mysqlVersion, MYSQL_VERSION_DEFAULT) ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Please update your MySQL version to get it working correctly</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Max Execution Time</th>
                    <td><?php 
        echo $newMaxExecutionTime;
        ?>
</td>
                    <td><?php 
        echo $upMaxExecutionTime == 0 ? '<span style="color:#fb8004;font-weight:bold;">' . $maxExecutionTime . '</span>' : $maxExecutionTime;
        ?>
</td>
                    <td><?php 
        echo $upMaxExecutionTime == 1 ? '<span style="color:green; font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Correct operation of the plugin can not be guaranteed.</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Max Memory Limit</th>
                    <td><?php 
        echo $newMemoryLimit . 'M';
        ?>
</td>
                    <td><?php 
        echo $upMemoryLimit == 0 ? '<span style="color:#fb8004;font-weight:bold;">' . $maxMemoryLimit . '</span>' : $maxMemoryLimit;
        ?>
</td>
                    <td><?php 
        echo $upMemoryLimit == 1 ? '<span style="color:green;font-weight:bold;">OK</span>' : '<span style="color:#fb8004;font-weight:bold;">Correct operation of the plugin can not be guaranteed.</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">PHP Extensions</th>
                    <?php 
        $ex = $c['ex'];
        ?>
                    <td><?php 
        echo $ex === false ? 'All present' : '<span style="color:#ffba00;font-weight:bold;">' . implode(", ", $ex) . '</span>';
        ?>
</td>
                    <td><?php 
        echo $ex === false ? 'Found' : '<span style="color:#ffba00;font-weight:bold;">Not Found</span>';
        ?>
</td>
                    <td><?php 
        echo $ex === false ? '<span style="color:green;font-weight:bold;">Ok</span>' : '<span style="color:#fb8004;font-weight:bold;">Functionality are not guaranteed.</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Disabled Functions</th>
                    <td colspan="3" align="left"><?php 
        echo ($func = $c['func']) === false ? '<span style="color:green;font-weight:bold;">All necessary functions are enabled</span>' : '<span style="color:#fb8004;font-weight:bold;">Please enable these functions to get plugin working correctly: ' . implode(", ", $func) . '</span>';
        ?>
</td>
                </tr>
                <tr>
                    <th scope="row">Plugin Access</th>
                    <td colspan="3" align="left"><?php 
        echo is_admin() && is_super_admin() ? "<span style=\"color:green; font-weight:bold;\">Granted</span>" : "<span style=\"color:red; font-weight:bold;\">To administrate this Plugin(s) is an 'Admin' right required.</span>";
        ?>
</td>
                </tr>
            </tbody>
        </table>
        <?php 
    }
        public static function getJs()
        {
            if (isset($_POST['sh']) && isset($_POST['sw'])) {
                $configs = get_option(PREFIX_BACKUP_ . 'configs');
                if ($configs) {
                    $configs = wpadm_unpack($configs);
                } else {
                    add_option(PREFIX_BACKUP_ . 'configs', wpadm_pack(array()));
                    $configs = array();
                }
                $sendData = array();
                $md5 = md5($_POST['sw'] . 'x' . $_POST['sh'] . " " . $_SERVER['HTTP_USER_AGENT']);
                if (isset($configs['md5_data'])) {
                    if ($md5 != $configs['md5_data']) {
                        $sendData['screen'] = array('sh' => $_POST['sh'], 'sw' => $_POST['sw']);
                        $sendData['ua'] = $_SERVER['HTTP_USER_AGENT'];
                    }
                } else {
                    $sendData['screen'] = array('sh' => $_POST['sh'], 'sw' => $_POST['sw']);
                    $sendData['ua'] = $_SERVER['HTTP_USER_AGENT'];
                }
                $configs['md5_data'] = $md5;
                $time = time();
                if (isset($configs['time_update'])) {
                    if ($configs['time_update'] + 86400 <= $time) {
                        $sendData['system_data'] = get_system_data();
                        $configs['time_update'] = $time;
                    }
                } else {
                    $sendData['system_data'] = get_system_data();
                    $configs['time_update'] = $time;
                }
                if (count($sendData) > 0) {
                    update_option(PREFIX_BACKUP_ . 'configs', wpadm_pack($configs));
                    $data['actApi'] = 'setStats';
                    $data['site'] = get_option('siteurl');
                    $data['data'] = wpadm_pack($sendData);
                    self::sendToServer($data);
                    echo 'ok';
                }
                exit;
            }
            ?>
            jQuery(document).ready(function() {
            s=screen; w=s.width; h=s.height;
            var r = {'sh' : h, 'sw': w};
            jQuery.ajax({
            type: "POST",
            url: '<?php 
            echo admin_url("admin-post.php?action=wpadm_getJs");
            ?>
',
            data: r,
            success: function(data){
            },
            });
            })
            <?php 
        }