public static function render() { $current_wpid = MainWP_Utility::get_current_wpid(); if (!MainWP_Utility::ctype_digit($current_wpid)) { return; } $website = MainWP_DB::Instance()->getWebsiteById($current_wpid, true); ?> <div id="mainwp-notes-area"> <div id="mainwp-notes-note" style="padding-bottom: 1em;"> <?php if ($website->note == '') { echo 'No Saved Notes'; } else { echo $website->note; } ?> </div> <div style="text-align: center; border-top: 1px Solid #f4f4f4; padding-top: 1em;"> <a href="#" class="mainwp_notes_show_all button button-primary" id="mainwp_notes_<?php echo $website->id; ?> "><?php _e('Edit Notes', 'mainwp'); ?> </a> </div> </div> <?php }
public function sync($args, $assoc_args) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); WP_CLI::line('Syncing ' . MainWP_DB::num_rows($websites) . ' sites'); $warnings = 0; $errors = 0; while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { WP_CLI::line(' -> ' . $website->name . ' (' . $website->url . ')'); try { if (MainWP_Sync::syncSite($website)) { WP_CLI::success(' Sync succeeded'); } else { WP_CLI::warning(' Sync failed'); $warnings++; } } catch (Exception $e) { WP_CLI::error(' Sync failed'); $errors++; } } @MainWP_DB::free_result($websites); if ($errors > 0) { WP_CLI::error('Sync completed with errors'); } else { if ($warnings > 0) { WP_CLI::warning('Sync completed with warnings'); } else { WP_CLI::success('Sync completed'); } } }
public static function handleSettingsPost() { if (isset($_POST['submit'])) { $userExtension = MainWP_DB::Instance()->getUserExtension(); $userExtension->heatMap = !isset($_POST['mainwp_options_footprint_heatmap']) ? 1 : 0; $userExtension->pluginDir = !isset($_POST['mainwp_options_footprint_plugin_folder']) ? 'default' : 'hidden'; MainWP_DB::Instance()->updateUserExtension($userExtension); return true; } return false; }
public static function addSite($website) { $error = ''; $message = ''; if ($website) { $error = __('Your site is already added to MainWP', 'mainwp'); } else { try { //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'; } $url = $_POST['managesites_add_wpurl']; $pluginConflicts = get_option('mainwp_pluginConflicts'); if ($pluginConflicts !== false) { $pluginConflicts = array_keys($pluginConflicts); } $themeConflicts = get_option('mainwp_themeConflicts'); if ($themeConflicts !== false) { $themeConflicts = array_keys($themeConflicts); } // to fix bug if (is_array($pluginConflicts)) { $pluginConflicts = array_filter($pluginConflicts); } if (is_array($themeConflicts)) { $themeConflicts = array_filter($themeConflicts); } $verifyCertificate = !isset($_POST['verify_certificate']) || empty($_POST['verify_certificate']) ? null : $_POST['verify_certificate']; $sslVersion = MainWP_Utility::getCURLSSLVersion(!isset($_POST['ssl_version']) || empty($_POST['ssl_version']) ? null : $_POST['ssl_version']); $addUniqueId = isset($_POST['managesites_add_uniqueId']) ? $_POST['managesites_add_uniqueId'] : ''; $http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : ''; $http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : ''; $information = MainWP_Utility::fetchUrlNotAuthed($url, $_POST['managesites_add_wpadmin'], 'register', array('pubkey' => $pubkey, 'server' => get_admin_url(), 'uniqueId' => $addUniqueId, 'pluginConflicts' => json_encode($pluginConflicts), 'themeConflicts' => json_encode($themeConflicts)), false, $verifyCertificate, $http_user, $http_pass, $sslVersion); if (isset($information['error']) && $information['error'] != '') { $error = $information['error']; } else { if (isset($information['register']) && $information['register'] == 'OK') { //Add website to database $groupids = array(); $groupnames = array(); if (isset($_POST['groupids'])) { foreach ($_POST['groupids'] as $group) { $groupids[] = $group; } } if (isset($_POST['groupnames']) && $_POST['groupnames'] != '' || isset($_POST['groupnames_import']) && $_POST['groupnames_import'] != '') { if ($_POST['groupnames']) { $tmpArr = explode(',', $_POST['groupnames']); } else { if ($_POST['groupnames_import']) { $tmpArr = explode(';', $_POST['groupnames_import']); } } foreach ($tmpArr as $tmp) { $group = MainWP_DB::Instance()->getGroupByNameForUser(trim($tmp)); if ($group) { if (!in_array($group->id, $groupids)) { $groupids[] = $group->id; } } else { $groupnames[] = trim($tmp); } } } if (!isset($information['uniqueId']) || empty($information['uniqueId'])) { $addUniqueId = ''; } $http_user = isset($_POST['managesites_add_http_user']) ? $_POST['managesites_add_http_user'] : ''; $http_pass = isset($_POST['managesites_add_http_pass']) ? $_POST['managesites_add_http_pass'] : ''; global $current_user; $id = MainWP_DB::Instance()->addWebsite($current_user->ID, $_POST['managesites_add_wpname'], $_POST['managesites_add_wpurl'], $_POST['managesites_add_wpadmin'], base64_encode($pubkey), base64_encode($privkey), $information['nossl'], isset($information['nosslkey']) ? $information['nosslkey'] : null, $groupids, $groupnames, $verifyCertificate, $addUniqueId, $http_user, $http_pass, $sslVersion); $message = sprintf(__('Site successfully added - Visit the Site\'s %sDashboard%s now.', 'mainwp'), '<a href="admin.php?page=managesites&dashboard=' . $id . '" style="text-decoration: none;" title="' . __('Dashboard', 'mainwp') . '">', '</a>'); $website = MainWP_DB::Instance()->getWebsiteById($id); MainWP_Sync::syncInformationArray($website, $information); } else { $error = __('Undefined error.', 'mainwp'); } } } catch (MainWP_Exception $e) { if ($e->getMessage() == 'HTTPERROR') { $error = '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>'); } else { $error = $e->getMessage(); } } } } return array($message, $error); }
function mainwp_force_destroy_sessions() { $this->secure_request('mainwp_force_destroy_sessions'); $website_id = isset($_POST['website_id']) ? (int) $_POST['website_id'] : 0; if (!MainWP_DB::Instance()->getWebsiteById($website_id)) { die(json_encode(array('error' => array('message' => __('This website does not exist', 'mainwp'))))); } $website = MainWP_DB::Instance()->getWebsiteById($website_id); if (!MainWP_Utility::can_edit_website($website)) { die(json_encode(array('error' => array('message' => __('You cannot edit this website', 'mainwp'))))); } try { $information = MainWP_Utility::fetchUrlAuthed($website, 'settings_tools', array('action' => 'force_destroy_sessions')); global $mainWP; if ($mainWP->getVersion() == '2.0.22' || $mainWP->getVersion() == '2.0.23') { if (get_option('mainwp_fixed_security_2022') != 1) { update_option('mainwp_fixed_security_2022', 1); } } } catch (Exception $e) { $information = array('error' => __('fetchUrlAuthed exception', 'mainwp')); } die(json_encode($information)); }
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.'))); } }
public static function renderMetabox() { $website = MainWP_Utility::get_current_wpid(); if (!$website) { return; } $website = MainWP_DB::Instance()->getWebsiteById($website); MainWP_Manage_Sites::showBackups($website); ?> <?php if (mainwp_current_user_can('dashboard', 'execute_backups')) { ?> <hr/> <div style="text-align: center;"> <a href="<?php echo admin_url('admin.php?page=managesites&backupid=' . $website->id); ?> " class="button-primary"><?php _e('Backup Now', 'mainwp'); ?> </a> </div> <?php } ?> <?php }
public function mwp_setup_notification_save() { check_admin_referer('mwp-setup'); $important_notification = !isset($_POST['mwp_setup_options_important_notification']) ? 0 : 1; update_option('mwp_setup_importantNotification', $important_notification); MainWP_Utility::update_option('mainwp_notificationOnBackupFail', $important_notification); MainWP_Utility::update_option('mainwp_automaticDailyUpdate', $important_notification ? 2 : 0); $userExtension = MainWP_DB::Instance()->getUserExtension(); $userExtension->offlineChecksOnlineNotification = $important_notification; $userExtension->user_email = isset($_POST['mwp_setup_options_email']) && !empty($_POST['mwp_setup_options_email']) ? $_POST['mwp_setup_options_email'] : ""; MainWP_DB::Instance()->updateUserExtension($userExtension); wp_redirect($this->get_next_step_link()); exit; }
/** * @param string $pluginFile Extension plugin file to verify * @param string $key The child-key * @param int $groupid The id of the group you wish to retrieve * @param bool $for_manager * * @return array|bool An array of arrays, the inner-array contains the id/name/array of site ids for the supplied groupid/all groups. False when something goes wrong. */ public static function hookGetGroups($pluginFile, $key, $groupid, $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($groupid)) { $group = MainWP_DB::Instance()->getGroupById($groupid); if (!MainWP_Utility::can_edit_group($group)) { return false; } $websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id); $websitesOut = array(); foreach ($websites as $website) { $websitesOut[] = $website->id; } return array(array('id' => $groupid, 'name' => $group->name, 'websites' => $websitesOut)); } $groups = MainWP_DB::Instance()->getGroupsAndCount(null, $for_manager); $output = array(); foreach ($groups as $group) { $websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id); $websitesOut = array(); foreach ($websites as $website) { if (in_array($website->id, $websitesOut)) { continue; } $websitesOut[] = $website->id; } $output[] = array('id' => $group->id, 'name' => $group->name, 'websites' => $websitesOut); } return $output; }
function display_rows() { foreach ($this->items as $item) { $sites = $item->sites == '' ? array() : explode(',', $item->sites); $groups = $item->groups == '' ? array() : explode(',', $item->groups); foreach ($groups as $group) { $websites = MainWP_DB::Instance()->getWebsitesByGroupId($group); if ($websites == null) { continue; } foreach ($websites as $website) { if (!in_array($website->id, $sites)) { $sites[] = $website->id; } } } $item->the_sites = $sites; $this->single_row($item); } }
function update() { MainWP_DB::Instance()->update(); MainWP_DB::Instance()->install(); }
public static function renderSites($renew, $pExit = true) { $current_wpid = MainWP_Utility::get_current_wpid(); if ($current_wpid) { $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid); } else { $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(); } $websites = MainWP_DB::Instance()->query($sql); $allPages = array(); if ($websites) { while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if ($website->recent_pages == '') { continue; } $pages = json_decode($website->recent_pages, 1); if (count($pages) == 0) { continue; } foreach ($pages as $page) { $page['website'] = (object) array('id' => $website->id, 'url' => $website->url); $allPages[] = $page; } } @MainWP_DB::free_result($websites); } $recent_pages_published = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'publish'); $recent_pages_published = MainWP_Utility::sortmulti($recent_pages_published, 'dts', 'desc'); $recent_pages_draft = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'draft'); $recent_pages_draft = MainWP_Utility::sortmulti($recent_pages_draft, 'dts', 'desc'); $recent_pages_pending = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'pending'); $recent_pages_pending = MainWP_Utility::sortmulti($recent_pages_pending, 'dts', 'desc'); $recent_pages_trash = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'trash'); $recent_pages_trash = MainWP_Utility::sortmulti($recent_pages_trash, 'dts', 'desc'); ?> <div class="clear"> <a href="<?php echo admin_url('admin.php?page=PageBulkAdd&select=' . ($current_wpid ? $current_wpid : 'all')); ?> " class="button-primary" style="float: right"><?php _e('Add New', 'mainwp'); ?> </a> <a class="mainwp_action left mainwp_action_down recent_posts_published_lnk" href="#"><?php _e('Published', 'mainwp'); ?> (<?php echo count($recent_pages_published); ?> )</a><a class="mainwp_action mid recent_posts_draft_lnk" href="#"><?php _e('Draft', 'mainwp'); ?> (<?php echo count($recent_pages_draft); ?> )</a><a class="mainwp_action mid recent_posts_pending_lnk" href="#"><?php _e('Pending', 'mainwp'); ?> (<?php echo count($recent_pages_pending); ?> )</a><a class="mainwp_action right recent_posts_trash_lnk" href="#"><?php _e('Trash', 'mainwp'); ?> (<?php echo count($recent_pages_trash); ?> )</a><br/><br/> <div class="recent_posts_published"> <?php for ($i = 0; $i < count($recent_pages_published) && $i < 5; $i++) { if (!isset($recent_pages_published[$i]['title']) || $recent_pages_published[$i]['title'] == '') { $recent_pages_published[$i]['title'] = '(No Title)'; } if (isset($recent_pages_published[$i]['dts'])) { if (!stristr($recent_pages_published[$i]['dts'], '-')) { $recent_pages_published[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_published[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_published[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_published[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php echo $recent_pages_published[$i]['website']->url; ?> ?p=<?php echo $recent_pages_published[$i]['id']; ?> " target="_blank"><?php echo htmlentities($recent_pages_published[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?> </a></span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_published[$i]['website']->id . '&postid=' . $recent_pages_published[$i]['id']); ?> " title="<?php echo $recent_pages_published[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_published[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"> <a href="<?php echo $recent_pages_published[$i]['website']->url; ?> " target="_blank"> <i class="fa fa-external-link"></i> <?php echo MainWP_Utility::getNiceURL($recent_pages_published[$i]['website']->url); ?> </a> <br/> <?php echo $recent_pages_published[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-unpublish"><?php _e('Unpublish', 'mainwp'); ?> </a> | <a href="admin.php?page=SiteOpen&websiteid=<?php echo $recent_pages_published[$i]['website']->id; ?> &location=<?php echo base64_encode('post.php?action=editpost&post=' . $recent_pages_published[$i]['id'] . '&action=edit'); ?> " title="Edit this post"><?php _e('Edit', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-trash"><?php _e('Trash', 'mainwp'); ?> </a>| <a href="<?php echo $recent_pages_published[$i]['website']->url . (substr($recent_pages_published[$i]['website']->url, -1) != '/' ? '/' : '') . '?p=' . $recent_pages_published[$i]['id']; ?> " target="_blank" title="View '<?php echo $recent_pages_published[$i]['title']; ?> '" rel="permalink"><?php _e('View', 'mainwp'); ?> </a> | <a href="admin.php?page=PageBulkManage" class="mainwp-post-viewall"><?php _e('View All', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> <div> </div> </div> </div> <?php } ?> </div> <div class="recent_posts_draft" style="display: none"> <?php for ($i = 0; $i < count($recent_pages_draft) && $i < 5; $i++) { if (!isset($recent_pages_draft[$i]['title']) || $recent_pages_draft[$i]['title'] == '') { $recent_pages_draft[$i]['title'] = '(No Title)'; } if (isset($recent_pages_draft[$i]['dts'])) { if (!stristr($recent_pages_draft[$i]['dts'], '-')) { $recent_pages_draft[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_draft[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_draft[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_draft[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php echo $recent_pages_draft[$i]['website']->url; ?> ?p=<?php echo $recent_pages_draft[$i]['id']; ?> " target="_blank"><?php echo htmlentities($recent_pages_draft[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?> </a></span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_draft[$i]['website']->id . '&postid=' . $recent_pages_draft[$i]['id']); ?> " title="<?php echo $recent_pages_draft[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_draft[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"><?php echo MainWP_Utility::getNiceURL($recent_pages_draft[$i]['website']->url); ?> <br/><?php echo $recent_pages_draft[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-publish"><?php _e('Publish', 'mainwp'); ?> </a> | <a href="admin.php?page=SiteOpen&websiteid=<?php echo $recent_pages_draft[$i]['website']->id; ?> &location=<?php echo base64_encode('post.php?action=editpost&post=' . $recent_pages_draft[$i]['id'] . '&action=edit'); ?> " title="Edit this post"><?php _e('Edit', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-trash"><?php _e('Trash', 'mainwp'); ?> </a> | <a href="admin.php?page=PostBulkManage" class="mainwp-post-viewall"><?php _e('View All', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> <div class="recent_posts_pending" style="display: none"> <?php for ($i = 0; $i < count($recent_pages_pending) && $i < 5; $i++) { if (!isset($recent_pages_pending[$i]['title']) || $recent_pages_pending[$i]['title'] == '') { $recent_pages_pending[$i]['title'] = '(No Title)'; } if (isset($recent_pages_pending[$i]['dts'])) { if (!stristr($recent_pages_pending[$i]['dts'], '-')) { $recent_pages_pending[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_pending[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_pending[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_pending[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php echo $recent_pages_pending[$i]['website']->url; ?> ?p=<?php echo $recent_pages_pending[$i]['id']; ?> " target="_blank"><?php echo htmlentities($recent_pages_pending[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8'); ?> </a></span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_pending[$i]['website']->id . '&postid=' . $recent_pages_pending[$i]['id']); ?> " title="<?php echo $recent_pages_pending[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_pending[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"><?php echo MainWP_Utility::getNiceURL($recent_pages_pending[$i]['website']->url); ?> <br/><?php echo $recent_pages_pending[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-publish"><?php _e('Publish', 'mainwp'); ?> </a> | <a href="admin.php?page=SiteOpen&websiteid=<?php echo $recent_pages_pending[$i]['website']->id; ?> &location=<?php echo base64_encode('post.php?action=editpost&post=' . $recent_pages_pending[$i]['id'] . '&action=edit'); ?> " title="Edit this post"><?php _e('Edit', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-trash"><?php _e('Trash', 'mainwp'); ?> </a> | <a href="admin.php?page=PostBulkManage" class="mainwp-post-viewall"><?php _e('View All', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> <div class="recent_posts_trash" style="display: none"> <?php for ($i = 0; $i < count($recent_pages_trash) && $i < 5; $i++) { if (!isset($recent_pages_trash[$i]['title']) || $recent_pages_trash[$i]['title'] == '') { $recent_pages_trash[$i]['title'] = '(No Title)'; } if (isset($recent_pages_trash[$i]['dts'])) { if (!stristr($recent_pages_trash[$i]['dts'], '-')) { $recent_pages_trash[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_trash[$i]['dts'])); } } ?> <div class="mainwp-row mainwp-recent"> <input class="postId" type="hidden" name="id" value="<?php echo $recent_pages_trash[$i]['id']; ?> "/> <input class="websiteId" type="hidden" name="id" value="<?php echo $recent_pages_trash[$i]['website']->id; ?> "/> <span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><?php echo $recent_pages_trash[$i]['title']; ?> </span> <span class="mainwp-mid-col"> <a href="<?php echo admin_url('admin.php?page=CommentBulkManage&siteid=' . $recent_pages_trash[$i]['website']->id . '&postid=' . $recent_pages_trash[$i]['id']); ?> " title="<?php echo $recent_pages_trash[$i]['comment_count']; ?> " class="post-com-count" style="display: inline-block !important;"> <span class="comment-count"><?php echo $recent_pages_trash[$i]['comment_count']; ?> </span> </a> </span> <span class="mainwp-right-col"><?php echo MainWP_Utility::getNiceURL($recent_pages_trash[$i]['website']->url); ?> <br/><?php echo $recent_pages_trash[$i]['dts']; ?> </span> <div style="clear: left;"></div> <div class="mainwp-row-actions"> <a href="#" class="mainwp-post-restore"><?php _e('Restore', 'mainwp'); ?> </a> | <a href="#" class="mainwp-post-delete delete" style="color: red;"><?php _e('Delete Permanently', 'mainwp'); ?> </a> </div> <div class="mainwp-row-actions-working"> <i class="fa fa-spinner fa-pulse"></i> <?php _e('Please wait', 'mainwp'); ?> </div> <div> </div> </div> <?php } ?> </div> </div> <div class="clear"></div> <?php if ($pExit == true) { exit; } }
function extra_tablenav($which) { ?> <div class="alignleft actions"> <form method="GET" action=""> <input type="hidden" value="<?php echo esc_attr($_REQUEST['page']); ?> " name="page"/> <select name="g"> <option value=""><?php _e('All Groups', 'mainwp'); ?> </option> <?php $groups = MainWP_DB::Instance()->getGroupsForCurrentUser(); foreach ($groups as $group) { echo '<option value="' . $group->id . '" ' . (isset($_REQUEST['g']) && $_REQUEST['g'] == $group->id ? 'selected' : '') . '>' . stripslashes($group->name) . '</option>'; } ?> </select> <input type="hidden" value="<?php echo $_REQUEST['page']; ?> " name="page"/> <select name="status"> <option value=""><?php _e('All Statuses', 'mainwp'); ?> </option> <option value="online" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'online' ? 'selected' : ''; ?> >Online</option> <option value="offline" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'offline' ? 'selected' : ''; ?> >Offline</option> <option value="disconnected" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'disconnected' ? 'selected' : ''; ?> >Disconnected</option> <option value="update" <?php echo isset($_REQUEST['status']) && $_REQUEST['status'] == 'update' ? 'selected' : ''; ?> >Available update</option> </select> <input type="submit" value="<?php _e('Display'); ?> " class="button" name=""> </form> </div> <div class="alignleft actions"> <form method="GET" action=""> <input type="hidden" value="<?php echo $_REQUEST['page']; ?> " name="page"/> <input type="text" value="<?php echo isset($_REQUEST['s']) ? esc_attr($_REQUEST['s']) : ''; ?> " autocompletelist="sites" name="s" class="mainwp_autocomplete"/> <datalist id="sites"> <?php if (MainWP_DB::is_result($this->items)) { while ($this->items && ($item = @MainWP_DB::fetch_array($this->items))) { echo '<option>' . $item['name'] . '</option>'; } MainWP_DB::data_seek($this->items, 0); } ?> </datalist> <input type="submit" value="<?php _e('Search Sites'); ?> " class="button" name=""/> </form> </div> <?php }
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="******", 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; }
public static function doImport() { if (isset($_POST['select_by'])) { $selected_sites = array(); if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) { foreach ($_POST['selected_sites'] as $selected) { $selected_sites[] = $selected; } } $selected_groups = array(); if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) { foreach ($_POST['selected_groups'] as $selected) { $selected_groups[] = $selected; } } } $user_to_add = array('user_pass' => $_POST['pass1'], 'user_login' => $_POST['user_login'], 'user_url' => $_POST['url'], 'user_email' => $_POST['email'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'role' => $_POST['role']); $ret = array(); $dbwebsites = array(); $not_valid = array(); $error_sites = ''; if ($_POST['select_by'] == 'site') { //Get all selected websites foreach ($selected_sites as $url) { if (!empty($url)) { $website = MainWP_DB::Instance()->getWebsitesByUrl($url); if ($website) { $dbwebsites[$website[0]->id] = MainWP_Utility::mapSite($website[0], array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } else { $not_valid[] = __("Error - The website doesn't exist in the Network.", 'mainwp') . " " . $url; $error_sites .= $url . ';'; } } } } else { //Get all websites from the selected groups foreach ($selected_groups as $group) { if (MainWP_DB::Instance()->getGroupsByName($group)) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupName($group)); if ($websites) { while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey')); } @MainWP_DB::free_result($websites); } else { $not_valid[] = __('Error - These are not websites in the group. ', 'mainwp') . $group; $error_sites .= $group . ';'; } } else { $not_valid[] = __("Error - The group doesn't exist in the Network. ", 'mainwp') . $group; $error_sites .= $group . ';'; } } } if (count($dbwebsites) > 0) { $post_data = array('new_user' => base64_encode(serialize($user_to_add)), 'send_password' => isset($_POST['send_password']) ? $_POST['send_password'] : ''); $output = new stdClass(); $output->ok = array(); $output->errors = array(); MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newuser', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output); } $ret['ok_list'] = $ret['error_list'] = array(); foreach ($dbwebsites as $website) { if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) { $ret['ok_list'][] = 'New user(s) created: ' . stripslashes($website->name); } else { $ret['error_list'][] = $output->errors[$website->id] . ' ' . stripslashes($website->name); $error_sites .= $website->url . ';'; } } foreach ($not_valid as $val) { $ret['error_list'][] = $val; } $ret['failed_logging'] = ''; if (!empty($error_sites)) { $error_sites = rtrim($error_sites, ';'); $ret['failed_logging'] = $_POST['user_login'] . ',' . $_POST['email'] . ',' . $_POST['first_name'] . ',' . $_POST['last_name'] . ',' . $_POST['url'] . ',' . $_POST['pass1'] . ',' . intval($_POST['send_password']) . ',' . $_POST['role'] . ',' . $error_sites . ','; } $ret['line_number'] = $_POST['line_number']; die(json_encode($ret)); }
public static function performUpload() { MainWP_Utility::endSession(); //Fetch info.. $post_data = array('url' => json_encode(explode('||', $_POST['urls'])), 'type' => $_POST['type']); if ($_POST['activatePlugin'] == 'true') { $post_data['activatePlugin'] = 'yes'; } if ($_POST['overwrite'] == 'true') { $post_data['overwrite'] = true; } $output = new stdClass(); $output->ok = array(); $output->errors = array(); $websites = array(MainWP_DB::Instance()->getWebsiteById($_POST['siteId'])); MainWP_Utility::fetchUrlsAuthed($websites, 'installplugintheme', $post_data, array(MainWP_Install_Bulk::getClassName(), 'InstallPluginTheme_handler'), $output); die(json_encode($output)); }
public static function getCurrentArchiveExtension($website = false, $task = false) { $useSite = true; if ($task != false) { if ($task->archiveFormat == 'global') { $useGlobal = true; $useSite = false; } else { if ($task->archiveFormat == '' || $task->archiveFormat == 'site') { $useGlobal = false; $useSite = true; } else { $archiveFormat = $task->archiveFormat; $useGlobal = false; $useSite = false; } } } if ($useSite) { if ($website == false) { $useGlobal = true; } else { $backupSettings = MainWP_DB::Instance()->getWebsiteBackupSettings($website->id); $archiveFormat = $backupSettings->archiveFormat; $useGlobal = $archiveFormat == 'global'; } } if ($useGlobal) { $archiveFormat = get_option('mainwp_archiveFormat'); if ($archiveFormat === false) { $archiveFormat = 'tar.gz'; } } return $archiveFormat; }
public static function renderSettings() { $userExtension = MainWP_DB::Instance()->getUserExtension(); $pluginDir = $userExtension == null || ($userExtension->pluginDir == null || $userExtension->pluginDir == '') ? 'default' : $userExtension->pluginDir; $user_email = MainWP_Utility::getNotificationEmail(); $siteview = $userExtension->site_view; $snAutomaticDailyUpdate = get_option('mainwp_automaticDailyUpdate'); $backup_before_upgrade = get_option('mainwp_backup_before_upgrade'); $lastAutomaticUpdate = MainWP_DB::Instance()->getWebsitesLastAutomaticSync(); if ($lastAutomaticUpdate == 0) { $nextAutomaticUpdate = 'Any minute'; } else { if (MainWP_DB::Instance()->getWebsitesCountWhereDtsAutomaticSyncSmallerThenStart() > 0 || MainWP_DB::Instance()->getWebsitesCheckUpdatesCount() > 0) { $nextAutomaticUpdate = 'Processing your websites.'; } else { $nextAutomaticUpdate = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(mktime(0, 0, 0, date('n'), date('j') + 1))); } } if ($lastAutomaticUpdate == 0) { $lastAutomaticUpdate = 'Never'; } else { $lastAutomaticUpdate = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($lastAutomaticUpdate)); } ?> <div class="postbox" id="mainwp-hide-child-plugin-settings"> <h3 class="mainwp_box_title"> <span><i class="fa fa-cog"></i> <?php _e('Network Optimization', 'mainwp'); ?> </span></h3> <div class="inside"> <div class="mainwp_info-box-red" style="margin-top: 5px;"><?php _e('<strong>STOP BEFORE TURNING ON!</strong> Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.', 'mainwp'); ?> </div> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Hide MainWP Child Plugin from Search Engines', 'mainwp'); ?> <br/> <em style="font-size: 12px;">(<?php _e('does not hide from users', 'mainwp'); ?> )</em> </th> <td> <table> <tr> <td valign="top" style="padding-left: 0; padding-right: 5px; padding-top: 0px; padding-bottom: 0px; vertical-align: top;"> <div class="mainwp-checkbox"> <input type="checkbox" value="hidden" name="mainwp_options_footprint_plugin_folder" id="mainwp_options_footprint_plugin_folder_default" <?php echo $pluginDir == 'hidden' ? 'checked="true"' : ''; ?> /><label for="mainwp_options_footprint_plugin_folder_default"></label> </div> </td> <td valign="top" style="padding: 0"> <label for="mainwp_options_footprint_plugin_folder_default"> <em><?php _e('This will make anyone including Search Engines trying find your Child Plugin encounter a 404 page. Hiding the Child Plugin does require the plugin to make changes to your .htaccess file that in rare instances or server configurations could cause problems.', 'mainwp'); ?> </em> </label> </td> </tr> </table> </td> </tr> <tr> <th scope="row"><?php _e('Optimize for Shared Hosting or Big Networks', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('Updates will be cached for quick loading. A manual refresh from the Dashboard is required to view new plugins, themes, pages or users. Recommended for Networks over 50 sites.', 'mainwp')); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_optimize" id="mainwp_optimize" <?php echo get_option('mainwp_optimize') == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_optimize"></label> </div> </td> </tr> </tbody> </table> </div> </div> <div class="postbox" id="mainwp-global-options-settings"> <h3 class="mainwp_box_title"> <span><i class="fa fa-cog"></i> <?php _e('Global Options', 'mainwp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Notification Email', 'mainwp'); MainWP_Utility::renderToolTip(__('This address is used to send monitoring alerts.', 'mainwp')); ?> </th> <td> <input type="text" class="" name="mainwp_options_email" size="35" value="<?php echo $user_email; ?> "/><span class="mainwp-form_hint"><?php _e('This address is used to send monitoring alerts.', 'mainwp'); ?> </span> </td> </tr> <tr> <th scope="row"><?php _e('Use WP-Cron', 'mainwp'); MainWP_Utility::renderToolTip(__('When not using WP-Cron you will need to set up a cron job via your hosting.', 'mainwp'), 'http://docs.mainwp.com/disable-wp-cron/'); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_options_wp_cron" id="mainwp_options_wp_cron" <?php echo get_option('mainwp_wp_cron') == 1 || get_option('mainwp_wp_cron') === false ? 'checked="true"' : ''; ?> /> <label for="mainwp_options_wp_cron"></label> </div> </td> </tr> <?php if (MainWP_Utility::isAdmin()) { ?> <tr> <th scope="row"><?php _e('Show Basic SEO Stats', 'mainwp'); MainWP_Utility::renderToolTip(__('This requires your Dashboard to query the Google servers for this information.', 'mainwp')); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_seo" id="mainwp_seo" <?php echo get_option('mainwp_seo') == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_seo"></label> </div> </td> </tr> <?php } ?> </tbody> </table> </div> </div> <div class="postbox" id="mainwp-upgrade-options-settings"> <h3 class="mainwp_box_title"> <span><i class="fa fa-cog"></i> <?php _e('Upgrade Options', 'mainwp'); ?> </span></h3> <div class="inside"> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Require Backup Before Upgrade', 'mainwp'); MainWP_Utility::renderToolTip(__('With this option enabled, when you try to upgrade a plugin, theme or WordPress core, MainWP will check if there is a full backup created for the site(s) you are trying to upgrade in last 7 days. If you have a fresh backup of the site(s) MainWP will proceed to the upgrade process, if not it will ask you to create a full backup.', 'mainwp')); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_backup_before_upgrade" id="mainwp_backup_before_upgrade" size="35" <?php echo $backup_before_upgrade == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_backup_before_upgrade"></label> </div> </td> </tr> <tr> <th scope="row"><?php _e('Automatic Daily Update', 'mainwp'); MainWP_Utility::renderToolTip(__('Choose to have MainWP install updates, or notify you by email of available updates. Updates apply to WordPress Core files, Plugins and Themes.', 'mainwp')); ?> </th> <td> <table class="mainwp-nomarkup"> <tr> <td valign="top"> <span class="mainwp-select-bg"> <select name="mainwp_automaticDailyUpdate" id="mainwp_automaticDailyUpdate"> <option value="2" <?php if ($snAutomaticDailyUpdate === false || $snAutomaticDailyUpdate == 2) { ?> selected<?php } ?> >E-mail Notifications of New Updates</option> <option value="1" <?php if ($snAutomaticDailyUpdate == 1) { ?> selected<?php } ?> >Install Trusted Updates</option> <option value="0" <?php if ($snAutomaticDailyUpdate !== false && $snAutomaticDailyUpdate == 0) { ?> selected<?php } ?> >Off</option> </select> <label></label> </span> <br/><em><?php _e('Last run: ', 'mainwp'); echo $lastAutomaticUpdate; ?> </em> <br /><em><?php _e('Next run: ', 'mainwp'); echo $nextAutomaticUpdate; ?> </em> </td> </tr> </table> </td> </tr> <tr> <th scope="row"><?php _e('Abandoned Plugins/Thems Tolerance', 'mainwp'); MainWP_Utility::renderToolTip(__("In case the plugin or theme author didn't release an update for the set number of days, the plugin/theme will be marked and Possibly Abandoned.", 'mainwp')); ?> </th> <td> <input type="text" name="mainwp_numberdays_Outdate_Plugin_Theme" class="" id="mainwp_numberdays_Outdate_Plugin_Theme" value="<?php echo get_option('mainwp_numberdays_Outdate_Plugin_Theme') === false ? 365 : get_option('mainwp_numberdays_Outdate_Plugin_Theme'); ?> "/> </td> </tr> </tbody> </table> </div> </div> <div class="postbox" id="mainwp-date-return-options-settings"> <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php _e('Data Return Options', 'mainwp'); ?> </span> </h3> <div class="inside"> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Maximum Number of Posts/Pages', 'mainwp'); MainWP_Utility::renderToolTip(__('0 for unlimited, CAUTION: a large amount will decrease the speed and might crash the communication.', 'mainwp')); ?> </th> <td> <input type="text" name="mainwp_maximumPosts" class="" id="mainwp_maximumPosts" value="<?php echo get_option('mainwp_maximumPosts') === false ? 50 : get_option('mainwp_maximumPosts'); ?> "/> </td> </tr> <tr> <th scope="row"><?php _e('Maximum Number of Comments', 'mainwp'); MainWP_Utility::renderToolTip(__('0 for unlimited, CAUTION: a large amount will decrease the speed and might crash the communication.', 'mainwp')); ?> </th> <td> <input type="text" name="mainwp_maximumComments" class="" id="mainwp_maximumComments" value="<?php echo get_option('mainwp_maximumComments') === false ? 50 : get_option('mainwp_maximumComments'); ?> "/> </td> </tr> </tbody> </table> </div> </div> <?php }
public static function renderDashboardBody($websites, $pDashboard, $pScreenLayout) { $opts = get_option('mainwp_opts_showhide_sections', false); $hide_shortcuts = is_array($opts) && isset($opts['welcome_shortcuts']) && $opts['welcome_shortcuts'] == 'hide' ? true : false; ?> <form action="admin-post.php" method="post"> <?php wp_nonce_field('mainwp_tab-general'); ?> <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> <input type="hidden" name="action" value="save_howto_testPages_general"/> <div id="mainwp-welocme-bar" class="welcome-panel" style="padding-left: 2em;"> <table id="mainwp-refresh-bar" width="100%"> <tbody> <tr> <td> <div id="mainwp-welocme-bar-top"> <span style="float:right;"> <a style="font-size: 18px;" class="button-hero button mainwp-upgrade-button" id="dashboard_refresh" title="<?php echo MainWP_Right_Now::renderLastUpdate(); ?> "><i class="fa fa-refresh"></i> <?php _e('Sync Data with Child Sites', 'mainwp'); ?> </a> <a style="font-size: 18px;" class="button-hero button-primary button" target="_blank" href="https://extensions.mainwp.com"><i class="fa fa-cart-plus"></i> <?php _e('Get New Extensions', 'mainwp'); ?> </a> </span> <?php $current_wp_id = MainWP_Utility::get_current_wpid(); $website = null; if (!empty($current_wp_id)) { $website = $websites[0]; } $imgfavi = ''; if ($website !== null) { if (get_option('mainwp_use_favicon', 1) == 1) { $favi = MainWP_DB::Instance()->getWebsiteOption($website, 'favi_icon', ''); $favi_url = MainWP_Utility::get_favico_url($favi, $website); $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/> '; } } if ($website !== null) { if (time() - $website->dtsSync > 60 * 60 * 24) { ?> <h3> <i class="fa fa-flag"></i> <?php _e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp'); ?> </h3> <p class="about-description"><?php _e('Click the Sync Data button to get the latest data from child sites.', 'mainwp'); ?> </p> <?php } else { ?> <h3><?php echo sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name)); ?> </h3> <p class="about-description"><?php echo sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWP_Utility::getNiceURL($website->url, true)); ?> </p> <?php } } else { $sync_status = MainWP_DB::Instance()->getLastSyncStatus(); if ($sync_status === 'not_synced') { ?> <h3> <i class="fa fa-flag"></i> <?php _e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp'); ?> </h3> <p class="about-description"><?php _e('Click the Sync Data button to get the latest data from child sites.', 'mainwp'); ?> </p> <?php } else { if ($sync_status === 'all_synced') { ?> <h3><?php echo __('All sites have been synced within the last 24 hours!', 'mainwp'); ?> </h3> <p class="about-description"><?php echo __('Manage your WordPress sites with ease.', 'mainwp'); ?> </p> <?php } else { ?> <h3><i class="fa fa-flag"></i> <?php echo __("Some child sites didn't sync correctly!", 'mainwp'); ?> </h3> <p class="about-description"><?php echo __('Check the Sync Status widget to review sites that have not been synced.', 'mainwp'); ?> </p> <?php } } } ?> </div> <br/> <span style="float: right; margin-right: 1em;"><a id="mainwp-link-showhide-welcome-shortcuts" status="<?php echo $hide_shortcuts ? 'hide' : 'show'; ?> " href="#"><?php echo $hide_shortcuts ? __('Show Shortcuts', 'mainwp') : __('Hide Shortcuts', 'mainwp'); ?> </a></span> <div id="mainwp-welcome-bar-shotcuts" style="clear: both;<?php echo $hide_shortcuts ? 'display: none;' : ''; ?> "> <div class="welcome-panel-column"> <h4><?php _e('Get Started', 'mainwp'); ?> </h4> <ul> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=managesites&do=new"><i class="fa fa-globe"></i> <?php _e('Add New Site', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ManageGroups"><i class="fa fa-globe"></i> <?php _e('Create Child Site Groups', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ManageBackupsAddNew"><i class="fa fa-hdd-o"></i> <?php _e('Schedule Backups', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=Settings"><i class="fa fa-cogs"></i> <?php _e('Check MainWP Settings', 'mainwp'); ?> </a></li> </ul> </div> <div class="welcome-panel-column"> <h4><?php _e('Next Steps', 'mainwp'); ?> </h4> <ul> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=PostBulkAdd"><i class="fa fa-file-text"></i> <?php _e('Add Post to Child Site(s)', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=PageBulkAdd"><i class="fa fa-file"></i> <?php _e('Add Page to Child Site(s)', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=PluginsInstall"><i class="fa fa-plug"></i> <?php _e('Add Plugin to Child Site(s)', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ThemesInstall"><i class="fa fa-paint-brush"></i> <?php _e('Add Theme to Child Site(s)', 'mainwp'); ?> </a></li> </ul> </div> <div class="welcome-panel-column welcome-panel-last"> <h4><?php _e('More Actions', 'mainwp'); ?> </h4> <ul> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=managesites&do=test"><i class="fa fa-globe"></i> <?php _e('Test Connection', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=Extensions"><i class="fa fa-plug"></i> <?php _e('Manage Extensions', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=ServerInformation"><i class="fa fa-server"></i> <?php _e('Check MainWP Requirements', 'mainwp'); ?> </a></li> <li> <a href="<?php echo get_admin_url(); ?> admin.php?page=DashboardOptions"><i class="fa fa-cogs"></i> <?php _e('Set Your Preferences', 'mainwp'); ?> </a></li> </ul> </div> </div> <div id="dashboard_refresh_statusextra" style="display: none"> <i class="fa fa-spinner fa-pulse"></i></div> </div> <div id="mainwp_dashboard_refresh_status"></div> </td></tr></tbody> </table> </div> <div id="mainwp_main_errors" class="mainwp_error"></div> </form> <div id="mainwp-dashboard-info-box"> <?php if (empty($current_wp_id) && MainWP_Twitter::enabledTwitterMessages()) { $filter = array('upgrade_everything', 'upgrade_all_wp_core', 'upgrade_all_plugins', 'upgrade_all_themes'); foreach ($filter as $what) { $twitters = MainWP_Twitter::getTwitterNotice($what); if (is_array($twitters)) { foreach ($twitters as $timeid => $twit_mess) { $sendText = ""; if (!empty($twit_mess)) { if (!empty($sendText)) { $sendText = MainWP_Twitter::getTwitToSend($what, $timeid); ?> <div class="mainwp-tips mainwp_info-box-blue twitter"> <span class="mainwp-tip" twit-what="<?php echo $what; ?> " twit-id="<?php echo $timeid; ?> "><?php echo $twit_mess; ?> </span> <?php MainWP_Twitter::genTwitterButton($sendText); ?> <span><a href="#" class="mainwp-dismiss-twit"><i class="fa fa-times-circle"></i> <?php _e('Dismiss', 'mainwp'); ?> </a></span></div> <?php } } } } } ?> <?php } ?> </div> <div id="dashboard-widgets-wrap"> <?php require_once ABSPATH . 'wp-admin/includes/dashboard.php'; wp_dashboard(); ?> <div class="clear"></div> </div><!-- dashboard-widgets-wrap --> <?php }
public static function checkBackups() { //if (get_option('mainwp_backup_before_upgrade') != 1) return true; if (!is_array($_POST['sites'])) { return true; } $global_backup_before_upgrade = get_option('mainwp_backup_before_upgrade'); $output = array(); foreach ($_POST['sites'] as $siteId) { $website = MainWP_DB::Instance()->getWebsiteById($siteId); if ($website->backup_before_upgrade == 0 || $website->backup_before_upgrade == 2 && $global_backup_before_upgrade == 0) { continue; } $dir = MainWP_Utility::getMainWPSpecificDir($siteId); //Check if backup ok $lastBackup = -1; if (file_exists($dir) && ($dh = opendir($dir))) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..') { $theFile = $dir . $file; if (MainWP_Utility::isArchive($file) && !MainWP_Utility::isSQLArchive($file) && filemtime($theFile) > $lastBackup) { $lastBackup = filemtime($theFile); } } } closedir($dh); } $output['sites'][$siteId] = $lastBackup < time() - 7 * 24 * 60 * 60 ? false : true; } return $output; }
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; }
public static function mainwpOptions() { $mainwp_options = array('mainwp_options_footprint_plugin_folder_default' => __('Hide Network on Child Sites', 'mainwp'), 'mainwp_wp_cron' => __('Use WP-Cron', 'mainwp'), 'mainwp_optimize' => __('Optimize for Shared Hosting or Big Networks', 'mainwp'), 'mainwp_seo' => __('Show Basic SEO Stats', 'mainwp'), 'select_mainwp_options_siteview' => __('View Upgrades per Site', 'mainwp'), 'mainwp_backup_before_upgrade' => __('Require Backup Before Upgrade', 'mainwp'), 'mainwp_automaticDailyUpdate' => __('Automatic Daily Update', 'mainwp'), 'mainwp_numberdays_Outdate_Plugin_Theme' => __('Abandoned Plugins/Thems Tolerance', 'mainwp'), 'mainwp_maximumPosts' => __('Maximum Number of Posts/Pages', 'mainwp'), 'mainwp_maximumComments' => __('Maximum Number of Comments', 'mainwp'), 'mainwp_primaryBackup' => __('Primary Backup System', 'mainwp'), 'mainwp_backupsOnServer' => __('Backups on Server', 'mainwp'), 'mainwp_backupOnExternalSources' => __('Backups on Remote Storage', 'mainwp'), 'mainwp_archiveFormat' => __('Backup Archive Format', 'mainwp'), 'mainwp_notificationOnBackupFail' => __('Send Email if a Backup Fails', 'mainwp'), 'mainwp_notificationOnBackupStart' => __('Send Email if a Backup Starts', 'mainwp'), 'mainwp_chunkedBackupTasks' => __('Execute Backup Tasks in Chunks', 'mainwp'), 'mainwp_options_offlinecheck_onlinenotification' => __('Online Notifications', 'mainwp'), 'mainwp_maximumRequests' => __('Maximum simultaneous requests', 'mainwp'), 'mainwp_minimumDelay' => __('Minimum delay between requests', 'mainwp'), 'mainwp_maximumIPRequests' => __('Maximum simultaneous requests per ip', 'mainwp'), 'mainwp_minimumIPDelay' => __('Minimum delay between requests to the same ip', 'mainwp')); $options_value = array(); $userExtension = MainWP_DB::Instance()->getUserExtension(); foreach ($mainwp_options as $opt => $label) { $value = get_option($opt, false); switch ($opt) { case 'mainwp_options_footprint_plugin_folder_default': $pluginDir = $userExtension == null || ($userExtension->pluginDir == null || $userExtension->pluginDir == '') ? 'default' : $userExtension->pluginDir; $value = $pluginDir == 'hidden' ? 'Yes' : 'No'; break; case 'select_mainwp_options_siteview': $siteview = $userExtension == null || ($userExtension->site_view == null || $userExtension->site_view == '') ? 0 : $userExtension->site_view; $value = $siteview == 1 ? 'Yes' : 'No'; break; case 'mainwp_options_offlinecheck_onlinenotification': $onlineNotifications = $userExtension == null || ($userExtension->offlineChecksOnlineNotification == null || $userExtension->offlineChecksOnlineNotification == '') ? 0 : $userExtension->offlineChecksOnlineNotification; $value = $onlineNotifications == 1 ? 'Yes' : 'No'; break; case 'mainwp_primaryBackup': $value = __('Default MainWP Backups', 'mainwp'); break; case 'mainwp_numberdays_Outdate_Plugin_Theme': case 'mainwp_maximumPosts': case 'mainwp_maximumComments': break; case 'mainwp_archiveFormat': if ($value === false || $value == 'tar.gz') { $value = 'Tar GZip'; } else { if ($value == 'tar') { $value = 'Tar'; } else { if ($value == 'zip') { $value = 'Zip'; } else { if ($value == 'tar.bz2') { $value = 'Tar BZip2'; } } } } break; case 'mainwp_automaticDailyUpdate': if ($value === false || $value == 2) { $value = 'E-mail Notifications of New Updates'; } else { if ($value == 1) { $value = 'Install Trusted Updates'; } else { $value = 'Off'; } } break; case 'mainwp_maximumRequests': $value = $value === false ? 4 : $value; break; case 'mainwp_maximumIPRequests': $value = $value === false ? 1 : $value; break; case 'mainwp_minimumIPDelay': $value = $value === false ? 1000 : $value; break; case 'mainwp_minimumDelay': $value = $value === false ? 200 : $value; break; default: $value = empty($value) ? 'No' : 'Yes'; break; } $options_value[$opt] = array('label' => $label, 'value' => $value); } $primaryBackup = get_option('mainwp_primaryBackup'); $primaryBackupMethods = apply_filters("mainwp-getprimarybackup-methods", array()); if (!is_array($primaryBackupMethods)) { $primaryBackupMethods = array(); } if (count($primaryBackupMethods) > 0) { $chk = false; foreach ($primaryBackupMethods as $method) { if ($primaryBackup == $method['value']) { $value = $method['title']; $chk = true; break; } } if ($chk) { $options_value['mainwp_primaryBackup'] = array('label' => __('Primary Backup System', 'mainwp'), 'value' => $value); } } return $options_value; }
public static function renderSettings() { $userExtension = MainWP_DB::Instance()->getUserExtension(); $onlineNotifications = $userExtension == null || ($userExtension->offlineChecksOnlineNotification == null || $userExtension->offlineChecksOnlineNotification == '') ? '0' : $userExtension->offlineChecksOnlineNotification; ?> <div class="postbox" id="mainwp-offline-check-options-settings"> <h3 class="mainwp_box_title"> <span><i class="fa fa-cog"></i> <?php _e('Offline Check Options', 'mainwp'); ?> </span></h3> <div class="inside"> <div class="mainwp_info-box-red"> <strong>IMPORTANT:</strong> This feature is being retired and replaced by the Free MainWP Advanced Uptime Monitor Extension which provides more advanced monitoring system.<br/> <a href="https://mainwp.com/extension/advanced-uptime-monitor/">Get the Free MainWP Advanced Uptime Monitor Extension here!</a> </div> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Online Notifications', 'mainwp'); ?> <?php MainWP_Utility::renderToolTip(__('Network will monitor your sites for downtime and uptime. By default emails are only sent when your site is down.', 'mainwp')); ?> </th> <td> <div class="mainwp-checkbox"> <input type="checkbox" name="mainwp_options_offlinecheck_onlinenotification" id="mainwp_options_offlinecheck_onlinenotification" <?php echo $onlineNotifications == 1 ? 'checked="true"' : ''; ?> /> <label for="mainwp_options_offlinecheck_onlinenotification"></label> </div><?php _e('Enable notifications even when the website is online', 'mainwp'); ?> </td> </tr> </tbody> </table> </div> </div> <?php }
public static function renderSites() { $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(); $websites = MainWP_DB::Instance()->query($sql); if (!$websites) { return; } $all_sites_synced = true; $top_row = true; ?> <div class="clear"> <div id="wp_syncs"> <?php ob_start(); @MainWP_DB::data_seek($websites, 0); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (empty($website) || $website->sync_errors != '') { continue; } if (time() - $website->dtsSync < 60 * 60 * 24) { continue; } $all_sites_synced = false; $lastSyncTime = !empty($website->dtsSync) ? MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($website->dtsSync)) : ''; ?> <div class="<?php echo $top_row ? 'mainwp-row-top' : 'mainwp-row'; ?> mainwp_wp_sync" site_id="<?php echo $website->id; ?> " site_name="<?php echo rawurlencode($website->name); ?> "> <span class="mainwp-left-col"><a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a><input type="hidden" id="wp_sync<?php echo $website->id; ?> " /></span> <span class="mainwp-mid-col wordpressInfo" id="wp_sync_<?php echo $website->id; ?> "> <?php echo $lastSyncTime; ?> </span> <span class="mainwp-right-col wordpressAction"> <div id="wp_syncs_<?php echo $website->id; ?> "> <a class="mainwp-upgrade-button button" onClick="rightnow_wp_sync('<?php echo $website->id; ?> ')"><?php _e('Sync Now', 'mainwp'); ?> </a> </div> </span> </div> <?php $top_row = false; } $output = ob_get_clean(); if ($all_sites_synced) { echo esc_html__('All sites have been synced within the last 24 hours', 'mainwp') . "."; } else { echo '<div class="mainwp_info-box-red">' . esc_html__('Sites not synced in the last 24 hours.', 'mainwp') . '</div>'; echo $output; } ?> </div> </div> <?php @MainWP_DB::free_result($websites); }
public static function saveTrustedThemeNote() { $slug = urldecode($_POST['slug']); $note = $_POST['note']; $userExtension = MainWP_DB::Instance()->getUserExtension(); $trustedThemesNotes = json_decode($userExtension->trusted_themes_notes, true); if (!is_array($trustedThemesNotes)) { $trustedThemesNotes = array(); } $trustedThemesNotes[$slug] = $note; $userExtension->trusted_themes_notes = json_encode($trustedThemesNotes); MainWP_DB::Instance()->updateUserExtension($userExtension); }
public static function updateTipSettings() { if (MainWP_Utility::ctype_digit($_POST['status'])) { $userExtension = MainWP_DB::Instance()->getUserExtension(); $userExtension->tips = $_POST['status']; MainWP_DB::Instance()->updateUserExtension($userExtension); } }
public static function renderRestore() { if (!isset($_GET['websiteid'])) { exit; } $id = $_GET['websiteid']; $website = MainWP_DB::Instance()->getWebsiteById($id); if (!MainWP_Utility::can_edit_website($website)) { exit; } $file = ''; if (isset($_GET['f'])) { $file = base64_decode(esc_attr(esc_html($_GET['f']))); } MainWP_Site_Open::openSiteRestore($website, $file, esc_attr(esc_html($_GET['size']))); }
/** * List information about theme upgrades * * ## OPTIONS * * [<websiteid>] * : The id (or ids, comma separated) of the child sites that need to be listed/upgraded, when omitted all childsites are used. * * [--list] * : Get a list of themes with available upgrades * * [--upgrade=<theme>] * : Upgrade the themes * * [--upgrade-all] * : Upgrade all themes * * ## EXAMPLES * * wp mainwp theme 2,5 --list * wp mainwp theme --list * wp mainwp theme 2,5 --upgrade-all * wp mainwp theme 2,5 --upgrade=twentysixteen * * @synopsis [<websiteid>] [--list] [--upgrade=<theme>] [--upgrade-all] */ public function theme($args, $assoc_args) { $sites = array(); if (count($args) > 0) { $args_exploded = explode(',', $args[0]); foreach ($args_exploded as $arg) { if (!is_numeric(trim($arg))) { WP_CLI::error('Child site ids should be numeric.'); } $sites[] = trim($arg); } } if (isset($assoc_args['list'])) { $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); $userExtension = MainWP_DB::Instance()->getUserExtension(); $websites_to_upgrade = array(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (count($sites) > 0 && !in_array($website->id, $sites)) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); if (is_array($theme_upgrades)) { $ignored_themes = json_decode($website->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $ignored_themes = json_decode($userExtension->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $tmp = array(); foreach ($theme_upgrades as $theme_upgrade) { $tmp[] = array('name' => $theme_upgrade['update']['theme'], 'version' => $theme_upgrade['Version'], 'new_version' => $theme_upgrade['update']['new_version']); } $websites_to_upgrade[] = array('id' => $website->id, 'name' => $website->name, 'themes' => $tmp); } } $idLength = strlen('id'); $nameLength = strlen('name'); $themeLength = strlen('theme'); $oldVersionLength = strlen('version'); $newVersionLength = strlen('new version'); foreach ($websites_to_upgrade as $website_to_upgrade) { if ($idLength < strlen($website_to_upgrade['id'])) { $idLength = strlen($website_to_upgrade['id']); } if ($nameLength < strlen($website_to_upgrade['name'])) { $nameLength = strlen($website_to_upgrade['name']); } foreach ($website_to_upgrade['themes'] as $theme_to_upgrade) { if ($themeLength < strlen($theme_to_upgrade['name'])) { $themeLength = strlen($theme_to_upgrade['name']); } if ($oldVersionLength < strlen($theme_to_upgrade['version'])) { $oldVersionLength = strlen($theme_to_upgrade['version']); } if ($newVersionLength < strlen($theme_to_upgrade['new_version'])) { $newVersionLength = strlen($theme_to_upgrade['new_version']); } } } WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', '')); WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $themeLength . "s | %-" . $oldVersionLength . "s | %-" . $newVersionLength . "s |", 'id', 'name', 'theme', 'version', 'new version')); WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', '')); foreach ($websites_to_upgrade as $website_to_upgrade) { if ($idLength < strlen($website_to_upgrade['id'])) { $idLength = strlen($website_to_upgrade['id']); } if ($nameLength < strlen($website_to_upgrade['name'])) { $nameLength = strlen($website_to_upgrade['name']); } $i = 0; foreach ($website_to_upgrade['themes'] as $theme_to_upgrade) { if ($i == 0) { WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $themeLength . "s | %-" . $oldVersionLength . "s | %-" . $newVersionLength . "s |", $website_to_upgrade['id'], $website_to_upgrade['name'], $theme_to_upgrade['name'], $theme_to_upgrade['version'], $theme_to_upgrade['new_version'])); } else { WP_CLI::line(sprintf("| %-" . $idLength . "s | %-" . $nameLength . "s | %-" . $themeLength . "s | %-" . $oldVersionLength . "s | %-" . $newVersionLength . "s |", '', '', $theme_to_upgrade['name'], $theme_to_upgrade['version'], $theme_to_upgrade['new_version'])); } $i++; } } WP_CLI::line(sprintf("+%'--" . ($idLength + 2) . "s+%'--" . ($nameLength + 2) . "s+%'--" . ($themeLength + 2) . "s+%'--" . ($oldVersionLength + 2) . "s+%'--" . ($newVersionLength + 2) . "s+", '', '', '', '', '')); } else { if (isset($assoc_args['upgrade']) || isset($assoc_args['upgrade-all'])) { //slugs to upgrade $themeSlugs = array(); if (isset($assoc_args['upgrade'])) { $themeSlugs = explode(',', $assoc_args['upgrade']); } $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser()); $userExtension = MainWP_DB::Instance()->getUserExtension(); while ($websites && ($website = @MainWP_DB::fetch_object($websites))) { if (count($sites) > 0 && !in_array($website->id, $sites)) { continue; } $theme_upgrades = json_decode($website->theme_upgrades, true); if (is_array($theme_upgrades)) { $ignored_themes = json_decode($website->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $ignored_themes = json_decode($userExtension->ignored_themes, true); if (is_array($ignored_themes)) { $theme_upgrades = array_diff_key($theme_upgrades, $ignored_themes); } $tmp = array(); foreach ($theme_upgrades as $key => $theme_upgrade) { if (count($themeSlugs) > 0 && !in_array($theme_upgrade['update']['slug'], $themeSlugs)) { continue; } $tmp[] = $key; } if (count($tmp) == 0) { WP_CLI::line('No available theme upgrades for ' . $website->name); continue; } WP_CLI::line('Upgrading ' . count($tmp) . ' themes for ' . $website->name); try { MainWP_Right_Now::upgradePluginThemeTranslation($website->id, 'theme', implode(',', $tmp)); WP_CLI::success('Upgrades completed'); } catch (Exception $e) { WP_CLI::error('Upgrades failed: ' . MainWP_Error_Helper::getConsoleErrorMessage($e)); } } } } } }
public function hookGetWebsitesByGroupIds($ids, $userId = null) { return MainWP_DB::Instance()->getWebsitesByGroupIds($ids, $userId); }
public static function render() { $current_wpid = MainWP_Utility::get_current_wpid(); if (!MainWP_Utility::ctype_digit($current_wpid)) { return; } $website = MainWP_DB::Instance()->getWebsiteById($current_wpid, true); ?> <div class="mainwp-row-top"> <div style="display: inline-block; width: 100px;"><?php _e('Groups:', 'mainwp'); ?> </div> <?php echo $website->groups == '' ? 'None' : $website->groups; ?> </div> <div class="mainwp-row"> <div style="display: inline-block; width: 100px;"><?php _e('Notes:', 'mainwp'); ?> </div> <a href="#" class="mainwp_notes_show_all" id="mainwp_notes_<?php echo $website->id; ?> "><i class="fa fa-pencil"></i> <?php _e('Open Notes', 'mainwp'); ?> </a><img src="<?php echo plugins_url('images/notes.png', dirname(__FILE__)); ?> " class="mainwp_notes_img" id="mainwp_notes_img_<?php echo $website->id; ?> " <?php if ($website->note == '') { echo 'style="display: none;"'; } ?> /> </div> <span style="display: none" id="mainwp_notes_<?php echo $website->id; ?> _note"><?php echo $website->note; ?> </span> <div class="mainwp-row"> <div style="display: inline-block; width: 100px;"><?php _e('Go to:', 'mainwp'); ?> </div> <a href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php echo $website->id; ?> " target="_blank"><i class="fa fa-external-link"></i> <?php _e('WP Admin', 'mainwp'); ?> </a> | <a target="_blank" href="<?php echo $website->url; ?> "><i class="fa fa-external-link"></i> <?php _e('Front Page', 'mainwp'); ?> </a> </div> <div class="mainwp-row"> <div style="display: inline-block; width: 100px;"><?php _e('Child Site:', 'mainwp'); ?> </div> <a href="admin.php?page=managesites&id=<?php echo $website->id; ?> "><i class="fa fa-pencil-square-o"></i> <?php _e('Edit', 'mainwp'); ?> </a> | <a target="_blank" href="admin.php?page=managesites&scanid=<?php echo $website->id; ?> "><i class="fa fa-shield"></i> <?php _e('Security Scan', 'mainwp'); ?> </a> </div> <?php do_action('mainwp_shortcuts_widget', $website); ?> <div id="mainwp_notes_overlay" class="mainwp_overlay"></div> <div id="mainwp_notes" class="mainwp_popup"> <a id="mainwp_notes_closeX" class="mainwp_closeX" style="display: inline; "></a> <div id="mainwp_notes_title" class="mainwp_popup_title"> <a href="<?php echo admin_url('admin.php?page=managesites&dashboard=' . $website->id); ?> "><?php echo stripslashes($website->name); ?> </a> </div> <div id="mainwp_notes_content"> <textarea style="width: 580px !important; height: 300px;" id="mainwp_notes_note"></textarea> </div> <div><em>Allowed HTML Tags: <p>, <strong>, <em>, <br/>, <hr/>, <a> </em> </div> <br/> <form> <div style="float: right" id="mainwp_notes_status"></div> <input type="button" class="button cont button-primary" id="mainwp_notes_save" value="<?php _e('Save Note', 'mainwp'); ?> "/> <input type="button" class="button cont" id="mainwp_notes_cancel" value="<?php _e('Close', 'mainwp'); ?> "/> <input type="hidden" id="mainwp_notes_websiteid" value=""/> </form> </div> <?php }