当前位置: 首页>>代码示例>>PHP>>正文


PHP MainWP_Utility::can_edit_website方法代码示例

本文整理汇总了PHP中MainWP_Utility::can_edit_website方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::can_edit_website方法的具体用法?PHP MainWP_Utility::can_edit_website怎么用?PHP MainWP_Utility::can_edit_website使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainWP_Utility的用法示例。


在下文中一共展示了MainWP_Utility::can_edit_website方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ignoreUpdates

 public static function ignoreUpdates()
 {
     $websiteIdEnc = $_POST['websiteId'];
     $websiteId = $websiteIdEnc;
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         die('FAIL');
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         die('FAIL');
     }
     $themes = $_POST['themes'];
     $names = $_POST['names'];
     $decodedIgnoredThemes = json_decode($website->ignored_themes, true);
     if (!is_array($decodedIgnoredThemes)) {
         $decodedIgnoredThemes = array();
     }
     if (is_array($themes)) {
         for ($i = 0; $i < count($themes); $i++) {
             $slug = $themes[$i];
             $name = $names[$i];
             if (!isset($decodedIgnoredThemes[$slug])) {
                 $decodedIgnoredThemes[$slug] = urldecode($name);
             }
         }
         MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_themes' => json_encode($decodedIgnoredThemes)));
     }
     die(json_encode(array('result' => true)));
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:29,代码来源:page-mainwp-themes.php

示例2: getPostMeta

 public static function getPostMeta($postId, $keys, $value, $websiteId)
 {
     if (!MainWP_Utility::ctype_digit($postId)) {
         return;
     }
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         return;
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         return;
     }
     try {
         $results = MainWP_Utility::fetchUrlAuthed($website, 'get_post_meta', array('id' => base64_encode($postId), 'keys' => base64_encode($keys), 'value' => base64_encode($value)));
     } catch (MainWP_Exception $e) {
         return;
     }
     return $results;
 }
开发者ID:senlin,项目名称:mainwp,代码行数:19,代码来源:page-mainwp-post.php

示例3: updateWebsite

 public static function updateWebsite()
 {
     if (!isset($_POST['websiteid']) || !isset($_POST['offline_check'])) {
         return '0';
     }
     $website = MainWP_DB::Instance()->getWebsiteById($_POST['websiteid']);
     if ($website == null) {
         return 0;
     }
     if (!MainWP_Utility::can_edit_website($website)) {
         return '0';
     }
     MainWP_DB::Instance()->updateWebsiteOfflineCheckSetting($website->id, $_POST['offline_check']);
     return '1';
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:15,代码来源:page-mainwp-offline-checks.php

示例4: fetchChildServerInformation

    public static function fetchChildServerInformation($siteId)
    {
        try {
            $website = MainWP_DB::Instance()->getWebsiteById($siteId);
            if (!MainWP_Utility::can_edit_website($website)) {
                return __('This is not your website.', 'mainwp');
            }
            $serverInformation = MainWP_Utility::fetchUrlAuthed($website, 'serverInformation');
            ?>

        <div id="mainwp-server-information-section">
			<h2><i class="fa fa-server"></i>
				<strong><?php 
            echo stripslashes($website->name);
            ?>
</strong>&nbsp;<?php 
            _e('Server Information');
            ?>
			</h2>
			<?php 
            echo $serverInformation['information'];
            ?>
		</div>
        <div id="mainwp-cron-schedules-section">
			<h2><i class="fa fa-server"></i>
				<strong><?php 
            echo stripslashes($website->name);
            ?>
</strong>&nbsp;<?php 
            _e('Cron Schedules', 'mainwp');
            ?>
			</h2>
			<?php 
            echo $serverInformation['cron'];
            ?>
		</div>
			<?php 
            if (isset($serverInformation['wpconfig'])) {
                ?>
        	<div id="mainwp-wp-config-section">
				<h2><i class="fa fa-server"></i>
					<strong><?php 
                echo stripslashes($website->name);
                ?>
</strong>&nbsp;<?php 
                _e('WP-Config File', 'mainwp');
                ?>
				</h2>
				<?php 
                echo $serverInformation['wpconfig'];
                ?>
			</div>
			<div id="mainwp-error-log-section">
				<h2><i class="fa fa-server"></i>
					<strong><?php 
                echo stripslashes($website->name);
                ?>
</strong>&nbsp;<?php 
                _e('Error Log', 'mainwp');
                ?>
</h2>
				<?php 
                echo $serverInformation['error'];
                ?>
			</div>
			<?php 
            }
            ?>
			<?php 
        } catch (MainWP_Exception $e) {
            die(MainWP_Error_Helper::getErrorMessage($e));
        } catch (Exception $e) {
            die('Something went wrong processing your request.');
        }
        die;
    }
开发者ID:jexmex,项目名称:mainwp,代码行数:76,代码来源:page-mainwp-server-information.php

示例5: _reconnectSite

 public static function _reconnectSite($website)
 {
     if (MainWP_Utility::can_edit_website($website)) {
         try {
             //Try to refresh stats first;
             if (MainWP_Sync::syncSite($website, true)) {
                 return true;
             }
             //Add
             if (function_exists('openssl_pkey_new')) {
                 $conf = array('private_key_bits' => 384);
                 $conf_loc = MainWP_System::get_openssl_conf();
                 if (!empty($conf_loc)) {
                     $conf['config'] = $conf_loc;
                 }
                 $res = openssl_pkey_new($conf);
                 @openssl_pkey_export($res, $privkey, null, $conf);
                 $pubkey = openssl_pkey_get_details($res);
                 $pubkey = $pubkey['key'];
             } else {
                 $privkey = '-1';
                 $pubkey = '-1';
             }
             $information = MainWP_Utility::fetchUrlNotAuthed($website->url, $website->adminname, 'register', array('pubkey' => $pubkey, 'server' => get_admin_url()), true, $website->verify_certificate, $website->http_user, $website->http_pass, $website->ssl_version);
             if (isset($information['error']) && $information['error'] != '') {
                 throw new Exception($information['error']);
             } else {
                 if (isset($information['register']) && $information['register'] == 'OK') {
                     //Update website
                     MainWP_DB::Instance()->updateWebsiteValues($website->id, array('pubkey' => base64_encode($pubkey), 'privkey' => base64_encode($privkey), 'nossl' => $information['nossl'], 'nosslkey' => isset($information['nosslkey']) ? $information['nosslkey'] : '', 'uniqueId' => isset($information['uniqueId']) ? $information['uniqueId'] : ''));
                     MainWP_Sync::syncInformationArray($website, $information);
                     return true;
                 } else {
                     throw new Exception(__('Undefined error.', 'mainwp'));
                 }
             }
         } catch (MainWP_Exception $e) {
             if ($e->getMessage() == 'HTTPERROR') {
                 throw new Exception('HTTP error' . ($e->getMessageExtra() != null ? ' - ' . $e->getMessageExtra() : ''));
             } else {
                 if ($e->getMessage() == 'NOMAINWP') {
                     $error = __('No MainWP Child plugin detected, first install and activate the plugin and add your site to MainWP afterwards. If you continue experiencing this issue please ', 'mainwp');
                     if ($e->getMessageExtra() != null) {
                         $error .= sprintf(__('test your connection %shere%s or ', 'mainwp'), '<a href="' . admin_url('admin.php?page=managesites&do=test&site=' . urlencode($e->getMessageExtra())) . '">', '</a>');
                     }
                     $error .= sprintf(__('post as much information as possible on the error in the %ssupport forum%s.', 'mainwp'), '<a href="https://mainwp.com/forum/">', '</a>');
                     throw new Exception($error);
                 }
             }
         }
     } else {
         throw new Exception(__('Not allowed this operation.', 'mainwp'));
     }
     return false;
 }
开发者ID:senlin,项目名称:mainwp,代码行数:55,代码来源:view-mainwp-manage-sites-view.php

示例6: action

 public static function action($pAction)
 {
     $plugin = $_POST['plugin'];
     $websiteIdEnc = $_POST['websiteId'];
     if (empty($plugin)) {
         die(json_encode(array('error' => 'Invalid Request.')));
     }
     $websiteId = $websiteIdEnc;
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         die(json_encode(array('error' => 'Invalid Request.')));
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         die(json_encode(array('error' => 'You can not edit this website.')));
     }
     try {
         $information = MainWP_Utility::fetchUrlAuthed($website, 'plugin_action', array('action' => $pAction, 'plugin' => $plugin));
     } catch (MainWP_Exception $e) {
         die(json_encode(array('error' => $e->getMessage())));
     }
     if (!isset($information['status']) || $information['status'] != 'SUCCESS') {
         die(json_encode(array('error' => 'Unexpected error.')));
     }
 }
开发者ID:senlin,项目名称:mainwp,代码行数:24,代码来源:widget-mainwp-widget-plugins.php

示例7: updateChildsiteValue

 public static function updateChildsiteValue()
 {
     if (isset($_POST['site_id']) && MainWP_Utility::ctype_digit($_POST['site_id'])) {
         $website = MainWP_DB::Instance()->getWebsiteById($_POST['site_id']);
         if (MainWP_Utility::can_edit_website($website)) {
             $error = '';
             $uniqueId = isset($_POST['unique_id']) ? $_POST['unique_id'] : '';
             try {
                 $information = MainWP_Utility::fetchUrlAuthed($website, 'update_values', array('uniqueId' => $uniqueId));
             } catch (MainWP_Exception $e) {
                 $error = $e->getMessage();
             }
             if ($error != '') {
                 die(json_encode(array('error' => $error)));
             } else {
                 if (isset($information['result']) && $information['result'] == 'ok') {
                     die(json_encode(array('result' => 'SUCCESS')));
                 } else {
                     die(json_encode(array('undefined_error' => true)));
                 }
             }
         }
     }
     die(json_encode(array('error' => 'NO_SIDE_ID')));
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:25,代码来源:page-mainwp-manage-sites.php

示例8: updateWebsite

 public function updateWebsite($websiteid, $userid, $name, $siteadmin, $groupids, $groupnames, $offlineChecks, $pluginDir, $maximumFileDescriptorsOverride, $maximumFileDescriptorsAuto, $maximumFileDescriptors, $verifyCertificate = 1, $archiveFormat, $uniqueId = '', $http_user = null, $http_pass = null, $sslVersion = 0)
 {
     if (MainWP_Utility::ctype_digit($websiteid) && MainWP_Utility::ctype_digit($userid)) {
         $website = MainWP_DB::Instance()->getWebsiteById($websiteid);
         if (MainWP_Utility::can_edit_website($website)) {
             //update admin
             $this->wpdb->query('UPDATE ' . $this->tableName('wp') . ' SET name="' . $this->escape($name) . '", adminname="' . $this->escape($siteadmin) . '",offline_checks="' . $this->escape($offlineChecks) . '",pluginDir="' . $this->escape($pluginDir) . '",maximumFileDescriptorsOverride = ' . ($maximumFileDescriptorsOverride ? 1 : 0) . ',maximumFileDescriptorsAuto= ' . ($maximumFileDescriptorsAuto ? 1 : 0) . ',maximumFileDescriptors = ' . $maximumFileDescriptors . ', verify_certificate="' . intval($verifyCertificate) . '", ssl_version="' . intval($sslVersion) . '", uniqueId="' . $this->escape($uniqueId) . '", http_user="' . $this->escape($http_user) . '", http_pass="' . $this->escape($http_pass) . '"  WHERE id=' . $websiteid);
             $this->wpdb->query('UPDATE ' . $this->tableName('wp_settings_backup') . ' SET archiveFormat = "' . $this->escape($archiveFormat) . '" WHERE wpid=' . $websiteid);
             //remove groups
             $this->wpdb->query('DELETE FROM ' . $this->tableName('wp_group') . ' WHERE wpid=' . $websiteid);
             //Remove GA stats
             $showErrors = $this->wpdb->hide_errors();
             do_action('mainwp_ga_delete_site', $websiteid);
             if ($showErrors) {
                 $this->wpdb->show_errors();
             }
             //add groups with groupnames
             foreach ($groupnames as $groupname) {
                 if ($this->wpdb->insert($this->tableName('group'), array('userid' => $userid, 'name' => $this->escape($groupname)))) {
                     $groupids[] = $this->wpdb->insert_id;
                 }
             }
             //add groupids
             foreach ($groupids as $groupid) {
                 $this->wpdb->insert($this->tableName('wp_group'), array('wpid' => $websiteid, 'groupid' => $groupid));
             }
             return true;
         }
     }
     return false;
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:31,代码来源:class-mainwp-db.php

示例9: unIgnorePluginThemeConflict

 public static function unIgnorePluginThemeConflict($type, $name, $siteid)
 {
     if ($siteid != '') {
         //For the sites..
         if ($siteid == '_ALL_') {
             $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
         } else {
             $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsiteById($siteid));
         }
         while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
             if (MainWP_Utility::can_edit_website($website)) {
                 $name = urldecode($name);
                 if ($type == 'plugin') {
                     $decodedIgnoredPlugins = json_decode($website->ignored_pluginConflicts, true);
                     if (!is_array($decodedIgnoredPlugins)) {
                         $decodedIgnoredPlugins = array();
                     }
                     if ($name == '') {
                         MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_pluginConflicts' => json_encode(array())));
                     } else {
                         if (in_array($name, $decodedIgnoredPlugins)) {
                             $idx = array_search($name, $decodedIgnoredPlugins);
                             array_splice($decodedIgnoredPlugins, $idx, 1);
                             MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_pluginConflicts' => json_encode($decodedIgnoredPlugins)));
                         }
                     }
                 } else {
                     if ($type == 'theme') {
                         $decodedIgnoredThemes = json_decode($website->ignored_themeConflicts, true);
                         if (!is_array($decodedIgnoredThemes)) {
                             $decodedIgnoredThemes = array();
                         }
                         if ($name == '') {
                             MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_themeConflicts' => json_encode(array())));
                         } else {
                             if (in_array($name, $decodedIgnoredThemes)) {
                                 $idx = array_search($name, $decodedIgnoredThemes);
                                 array_splice($decodedIgnoredThemes, $idx, 1);
                                 MainWP_DB::Instance()->updateWebsiteValues($website->id, array('ignored_themeConflicts' => json_encode($decodedIgnoredThemes)));
                             }
                         }
                     }
                 }
             }
         }
         @MainWP_DB::free_result($websites);
     } else {
         //unignore globally
         $userExtension = MainWP_DB::Instance()->getUserExtension();
         $name = urldecode($name);
         if ($type == 'plugin') {
             $globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true);
             if (!is_array($globalIgnoredPluginConflicts)) {
                 $globalIgnoredPluginConflicts = array();
             }
             if ($name == '') {
                 //Unignore all
                 $globalIgnoredPluginConflicts = array();
                 $userExtension->ignored_pluginConflicts = json_encode($globalIgnoredPluginConflicts);
                 MainWP_DB::Instance()->updateUserExtension($userExtension);
             } else {
                 if (in_array($name, $globalIgnoredPluginConflicts)) {
                     $idx = array_search($name, $globalIgnoredPluginConflicts);
                     array_splice($globalIgnoredPluginConflicts, $idx, 1);
                     $userExtension->ignored_pluginConflicts = json_encode($globalIgnoredPluginConflicts);
                     MainWP_DB::Instance()->updateUserExtension($userExtension);
                 }
             }
         } else {
             if ($type == 'theme') {
                 $globalIgnoredThemeConflicts = json_decode($userExtension->ignored_themeConflicts, true);
                 if (!is_array($globalIgnoredThemeConflicts)) {
                     $globalIgnoredThemeConflicts = array();
                 }
                 if ($name == '') {
                     $globalIgnoredThemeConflicts = array();
                     $userExtension->ignored_themeConflicts = json_encode($globalIgnoredThemeConflicts);
                     MainWP_DB::Instance()->updateUserExtension($userExtension);
                 } else {
                     if (in_array($name, $globalIgnoredThemeConflicts)) {
                         $idx = array_search($name, $globalIgnoredThemeConflicts);
                         array_splice($globalIgnoredThemeConflicts, $idx, 1);
                         $userExtension->ignored_themeConflicts = json_encode($globalIgnoredThemeConflicts);
                         MainWP_DB::Instance()->updateUserExtension($userExtension);
                     }
                 }
             }
         }
     }
     return 'success';
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:91,代码来源:page-mainwp-plugins.php

示例10: getSiteDirectories

 public static function getSiteDirectories()
 {
     $websites = array();
     if (isset($_REQUEST['site']) && $_REQUEST['site'] != '') {
         $siteId = $_REQUEST['site'];
         $website = MainWP_DB::Instance()->getWebsiteById($siteId);
         if (MainWP_Utility::can_edit_website($website)) {
             $websites[] = $website;
         }
     } else {
         if (isset($_REQUEST['sites']) && $_REQUEST['sites'] != '') {
             $siteIds = explode(',', urldecode($_REQUEST['sites']));
             $siteIdsRequested = array();
             foreach ($siteIds as $siteId) {
                 $siteId = $siteId;
                 if (!MainWP_Utility::ctype_digit($siteId)) {
                     continue;
                 }
                 $siteIdsRequested[] = $siteId;
             }
             $websites = MainWP_DB::Instance()->getWebsitesByIds($siteIdsRequested);
         } else {
             if (isset($_REQUEST['groups']) && $_REQUEST['groups'] != '') {
                 $groupIds = explode(',', urldecode($_REQUEST['groups']));
                 $groupIdsRequested = array();
                 foreach ($groupIds as $groupId) {
                     $groupId = $groupId;
                     if (!MainWP_Utility::ctype_digit($groupId)) {
                         continue;
                     }
                     $groupIdsRequested[] = $groupId;
                 }
                 $websites = MainWP_DB::Instance()->getWebsitesByGroupIds($groupIdsRequested);
             }
         }
     }
     if (count($websites) == 0) {
         die('<i><strong>Select a site or group first</strong></i>');
     }
     //Nothing selected!
     $allFiles = array();
     $excludedBackupFiles = array();
     $excludedCacheFiles = array();
     $excludedNonWPFiles = array();
     foreach ($websites as $website) {
         $files = null;
         $result = json_decode($website->directories, true);
         $dir = urldecode($_POST['dir']);
         if ($dir == '') {
             if (is_array($result)) {
                 $files = array_keys($result);
                 self::addExcludedBackups($result, $excludedBackupFiles);
                 self::addExcludedCache($result, $excludedCacheFiles);
                 self::addExcludedNonWP($files, $excludedNonWPFiles);
             }
         } else {
             $dirExploded = explode('/', $dir);
             $tmpResult = $result;
             foreach ($dirExploded as $innerDir) {
                 if ($innerDir == '') {
                     continue;
                 }
                 if (isset($tmpResult[$innerDir])) {
                     $tmpResult = $tmpResult[$innerDir];
                 } else {
                     $tmpResult = null;
                     break;
                 }
             }
             if ($tmpResult != null && is_array($tmpResult)) {
                 $files = array_keys($tmpResult);
             } else {
                 $files = null;
             }
         }
         if ($files != null && count($files) > 0) {
             $allFiles = array_unique(array_merge($allFiles, $files));
         }
     }
     if ($allFiles != null && count($allFiles) > 0) {
         natcasesort($allFiles);
         echo '<ul class="jqueryFileTree" style="display: none;">';
         // All dirs
         foreach ($allFiles as $file) {
             echo '<li class="directory collapsed"><a href="#" rel="' . esc_attr($_POST['dir'] . $file) . '/">' . esc_html($file) . '<div title="Exclude form backup" class="exclude_folder_control"><img src="' . plugins_url('images/exclude.png', dirname(__FILE__)) . '" /></div></a></li>';
         }
         echo '</ul>';
         if (count($excludedBackupFiles) > 0) {
             echo '<div id="excludedBackupFiles" style="display:none">';
             foreach ($excludedBackupFiles as $excludedBackupFile) {
                 echo $excludedBackupFile . "\n";
             }
             echo '</div>';
         }
         if (count($excludedCacheFiles) > 0) {
             echo '<div id="excludedCacheFiles" style="display:none">';
             foreach ($excludedCacheFiles as $excludedCacheFile) {
                 echo $excludedCacheFile . "\n";
             }
             echo '</div>';
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-manage-backups.php

示例11: action

 public static function action($pAction, $extra = '')
 {
     $userId = $_POST['userId'];
     $userName = $_POST['userName'];
     $websiteIdEnc = $_POST['websiteId'];
     $pass = $_POST['update_password'];
     if (!MainWP_Utility::ctype_digit($userId)) {
         die(json_encode(array('error' => 'Invalid Request.')));
     }
     $websiteId = $websiteIdEnc;
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         die(json_encode(array('error' => 'Invalid Request.')));
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         die(json_encode(array('error' => 'You can not edit this website.')));
     }
     if ($pAction == 'delete' && $website->adminname == $userName) {
         die(json_encode(array('error' => __('This user is used for our secure link, it can not be deleted.', 'mainwp'))));
     }
     if ($pAction == 'changeRole' && $website->adminname == $userName) {
         die(json_encode(array('error' => __('This user is used for our secure link, you can not change the role.', 'mainwp'))));
     }
     try {
         $information = MainWP_Utility::fetchUrlAuthed($website, 'user_action', array('action' => $pAction, 'id' => $userId, 'extra' => $extra, 'user_pass' => $pass));
     } catch (MainWP_Exception $e) {
         die(json_encode(array('error' => $e->getMessage())));
     }
     if (!isset($information['status']) || $information['status'] != 'SUCCESS') {
         die(json_encode(array('error' => 'Unexpected error.')));
     }
 }
开发者ID:senlin,项目名称:mainwp,代码行数:32,代码来源:page-mainwp-user.php

示例12: action_update

 public static function action_update($pAction)
 {
     $postId = $_POST['postId'];
     $websiteIdEnc = $_POST['websiteId'];
     $post_data = $_POST['post_data'];
     if (!MainWP_Utility::ctype_digit($postId)) {
         die('FAIL');
     }
     $websiteId = $websiteIdEnc;
     if (!MainWP_Utility::ctype_digit($websiteId)) {
         die('FAIL');
     }
     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
     if (!MainWP_Utility::can_edit_website($website)) {
         die('FAIL');
     }
     try {
         $information = MainWP_Utility::fetchUrlAuthed($website, 'post_action', array('action' => $pAction, 'id' => $postId, 'post_data' => $post_data));
     } catch (MainWP_Exception $e) {
         die('FAIL');
     }
     if (!isset($information['status']) || $information['status'] != 'SUCCESS') {
         die('FAIL');
     }
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:25,代码来源:widget-mainwp-recent-posts.php

示例13: updateGroup

 public static function updateGroup()
 {
     if (isset($_POST['groupId']) && MainWP_Utility::ctype_digit($_POST['groupId'])) {
         $group = MainWP_DB::Instance()->getGroupById($_POST['groupId']);
         if (MainWP_Utility::can_edit_group($group)) {
             MainWP_DB::Instance()->clearGroup($group->id);
             if (isset($_POST['websiteIds'])) {
                 foreach ($_POST['websiteIds'] as $websiteId) {
                     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
                     if (MainWP_Utility::can_edit_website($website)) {
                         MainWP_DB::Instance()->updateGroupSite($group->id, $website->id);
                     }
                 }
             }
             die(json_encode(array('result' => true)));
         }
     }
     die(json_encode(array('result' => false)));
 }
开发者ID:senlin,项目名称:mainwp,代码行数:19,代码来源:page-mainwp-manage-groups.php

示例14: unfixSecurityIssue

 public static function unfixSecurityIssue()
 {
     if (!isset($_REQUEST['id']) || !MainWP_Utility::ctype_digit($_REQUEST['id'])) {
         return '';
     }
     $website = MainWP_DB::Instance()->getWebsiteById($_REQUEST['id']);
     if (!MainWP_Utility::can_edit_website($website)) {
         return '';
     }
     $information = MainWP_Utility::fetchUrlAuthed($website, 'securityUnFix', array('feature' => $_REQUEST['feature']));
     if (isset($information['sync']) && !empty($information['sync'])) {
         MainWP_Sync::syncInformationArray($website, $information['sync']);
         unset($information['sync']);
     }
     return $information;
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:16,代码来源:page-mainwp-security-issues.php

示例15: hookGetSites

 /**
  * @param string $pluginFile Extension plugin file to verify
  * @param string $key The child-key
  * @param int $websiteid The id of the child-site you wish to retrieve
  * @param bool $for_manager
  *
  * @return array|bool An array of arrays, the inner-array contains the id/url/name/totalsize of the website. False when something goes wrong.
  */
 public static function hookGetSites($pluginFile, $key, $websiteid = null, $for_manager = false)
 {
     if (!self::hookVerify($pluginFile, $key)) {
         return false;
     }
     if ($for_manager && (!defined('MWP_TEAMCONTROL_PLUGIN_SLUG') || !mainwp_current_user_can('extension', dirname(MWP_TEAMCONTROL_PLUGIN_SLUG)))) {
         return false;
     }
     if (isset($websiteid) && $websiteid != null) {
         $website = MainWP_DB::Instance()->getWebsiteById($websiteid);
         if (!MainWP_Utility::can_edit_website($website)) {
             return false;
         }
         if (!mainwp_current_user_can('site', $websiteid)) {
             return false;
         }
         return array(array('id' => $websiteid, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize));
     }
     $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp.url', false, false, null, $for_manager));
     $output = array();
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         $output[] = array('id' => $website->id, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize);
     }
     @MainWP_DB::free_result($websites);
     return $output;
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:34,代码来源:page-mainwp-extensions.php


注:本文中的MainWP_Utility::can_edit_website方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。