示例#1
0
 static function updateOption($name, $value, $blogID = 1)
 {
     if (wpsIsMultisite()) {
         return update_blog_option($blogID, $name, $value);
     }
     return update_option($name, $value);
 }
示例#2
0
 /**
  * @internal
  * @param $userID
  */
 public static function _watchUserInfoUpdated($userID)
 {
     // If an admin user's password has been updated
     if (!empty($_POST['pass1'])) {
         $userInfo = self::_getUserInfo($userID);
         $userName = $userInfo['userName'];
         $userRole = $userInfo['userRole'];
         if ($userRole == 'administrator') {
             global $wpsPluginAlertsArray;
             $actionName = $wpsPluginAlertsArray['watch_admin_password_update']['name'];
             $alertType = $wpsPluginAlertsArray['watch_admin_password_update']['type'];
             if (wpsIsMultisite()) {
                 global $wpdb;
                 $blogID = $wpdb->blogid;
                 $blogName = WpsOption::getOption('blogname', $blogID);
                 self::alert($actionName, $alertType, WpsSettings::ALERT_MEDIUM, sprintf(__('Administrator (<strong>%s</strong>) of blog <strong>%s</strong> has updated their password.', WpsSettings::TEXT_DOMAIN), $userName, $blogName), __('<p>This alert is generated every time an administrator\'s password is updated.</p>', WpsSettings::TEXT_DOMAIN));
             } else {
                 self::alert($actionName, $alertType, WpsSettings::ALERT_MEDIUM, sprintf(__('Administrator (<strong>%s</strong>) has updated their password.', WpsSettings::TEXT_DOMAIN), $userName), __('<p>This alert is generated every time an administrator\'s password is updated.</p>', WpsSettings::TEXT_DOMAIN));
             }
         }
     }
 }
示例#3
0
define('WPS_PLUGIN_BACKUPS_DIR', WPS_PLUGIN_DIR . 'res/backups/');
require 'wss-settings.php';
require 'res/inc/alerts.php';
require 'res/inc/WpsOption.php';
require 'res/inc/WsdUtil.php';
require 'res/inc/WsdPlugin.php';
require 'res/inc/WsdInfo.php';
require 'res/inc/WsdSecurity.php';
require 'res/inc/WsdCheck.php';
require 'res/inc/WsdScheduler.php';
require 'res/inc/WsdWatch.php';
require 'res/inc/WsdLiveTraffic.php';
require 'res/inc/WsdWpScanner.php';
require 'res/inc/wss-functions.php';
//#!--
if (wpsIsMultisite()) {
    add_action('network_admin_menu', 'wpsCreateNetworkMenu');
    add_action('admin_menu', 'wpsCreateSiteMenu');
} else {
    add_action('admin_menu', 'wpsCreateNetworkMenu');
}
add_action('init', array('WsdUtil', 'loadPluggable'));
add_action('init', array('WsdPlugin', 'loadResources'));
$wpsCanRun = (bool) WpsOption::getOption(WpsSettings::CAN_RUN_TASKS_OPTION_NAME);
if ($wpsCanRun) {
    add_action('init', array('WsdLiveTraffic', 'registerHit'));
    add_action('wp_ajax_ajaxGetTrafficData', array('WsdLiveTraffic', 'ajaxGetTrafficData'));
    add_action('wp_ajax_nopriv_ajaxGetTrafficData', array('WsdLiveTraffic', 'ajaxGetTrafficData'));
}
add_action('wp_ajax_ajaxDeleteBackupFile', array('WsdUtil', 'ajaxDeleteBackupFile'));
add_action('wp_dashboard_setup', array('WsdUtil', 'addDashboardWidget'));
示例#4
0
function wpsNetworkDeactivate($networkwide = false)
{
    if (wpsIsMultisite() && $networkwide) {
        global $wpdb;
        $old_blog = $wpdb->blogid;
        // network deactivate
        $blogIds = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
        foreach ($blogIds as $blog_id) {
            switch_to_blog($blog_id);
            delete_blog_option($blog_id, 'WPS_PLUGIN_ACTIVATED');
            delete_blog_option($blog_id, WpsSettings::PLUGIN_ERROR_NOTICE_OPTION);
        }
        // main site
        switch_to_blog($old_blog);
        _wpsSiteDeactivate(true, $old_blog);
    } else {
        _wpsSiteDeactivate();
    }
}
示例#5
0
 /**
  * @public
  * @static
  * Add the rss widget to dashboard
  * @return void
  */
 static function addDashboardWidget()
 {
     $rssWidgetData = WpsOption::getOption('WSD-RSS-WGT-DISPLAY');
     if ($rssWidgetData == 'yes') {
         if (wpsIsMultisite()) {
             global $wpdb;
             $old_blog = $wpdb->blogid;
             // Get all blog ids
             $blogIds = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
             foreach ($blogIds as $blog_id) {
                 switch_to_blog($blog_id);
                 wp_add_dashboard_widget('acx_plugin_dashboard_widget', __('Acunetix news and updates', WpsSettings::TEXT_DOMAIN), array('WsdUtil', 'displayDashboardWidget'));
             }
             switch_to_blog($old_blog);
             wp_add_dashboard_widget('acx_plugin_dashboard_widget', __('Acunetix news and updates', WpsSettings::TEXT_DOMAIN), array('WsdUtil', 'displayDashboardWidget'));
         } else {
             wp_add_dashboard_widget('acx_plugin_dashboard_widget', __('Acunetix news and updates', WpsSettings::TEXT_DOMAIN), array('WsdUtil', 'displayDashboardWidget'));
         }
     }
 }
示例#6
0
 /**
  * Retrieve the settings from database. This method will extract all methods found in the WsdSecurity class and provide them as
  * settings in the settings page. It will also auto update itself in case new methods are added to the class or if
  * some of them were removed.
  * @return array
  */
 public static function getSettings()
 {
     $className = 'WsdSecurity';
     if (!class_exists($className)) {
         return array();
     }
     if (wpsIsMultisite()) {
         $settings = get_blog_option(1, WpsSettings::PLUGIN_SETTINGS_OPTION_NAME);
     } else {
         $settings = WpsOption::getOption(WpsSettings::PLUGIN_SETTINGS_OPTION_NAME);
     }
     $methods = WpsSettings::getSettingsList();
     $useReflection = false;
     if (empty($settings)) {
         $settings = array();
         foreach ($methods as $method) {
             $settings[$method['name']] = array('name' => $method['name'], 'value' => 0, 'desc' => $method['text']);
         }
     } else {
         // Check to see whether or not new methods were added or subtracted
         $numSettings = count($settings);
         $numMethods = count($methods);
         if ($numMethods != $numSettings) {
             // add new methods
             $_temp = array();
             foreach ($methods as $method) {
                 if (!isset($settings[$method['name']])) {
                     $settings[$method['name']] = array('name' => $method['name'], 'value' => 0, 'desc' => $method['text']);
                 }
                 array_push($_temp, $method['name']);
             }
             // remove missing methods
             foreach ($settings as $k => &$entry) {
                 if (!in_array($entry['name'], $_temp)) {
                     unset($settings[$k]);
                 }
             }
         }
     }
     WpsOption::addOption(WpsSettings::PLUGIN_SETTINGS_OPTION_NAME, $settings);
     return $settings;
 }