Esempio n. 1
0
 public function get_login_url($redirect_to, $extra_info)
 {
     if (is_array($extra_info) && !empty($extra_info['user_id']) && is_numeric($extra_info['user_id'])) {
         $user_id = $extra_info['user_id'];
         if (false == ($login_key = $this->_get_autologin_key($user_id))) {
             return $this->_generic_error_response('user_key_failure');
         }
         // Default value
         $redirect_url = network_admin_url();
         if (is_array($redirect_to) && !empty($redirect_to['module'])) {
             switch ($redirect_to['module']) {
                 case 'updraftplus':
                     if ('initiate_restore' == $redirect_to['action'] && class_exists('UpdraftPlus_Options')) {
                         $redirect_url = UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&udaction=initiate_restore&entities=' . urlencode($redirect_to['data']['entities']) . '&showdata=' . urlencode($redirect_to['data']['showdata']) . '&backup_timestamp=' . (int) $redirect_to['data']['backup_timestamp'];
                     } elseif ('download_file' == $redirect_to['action']) {
                         $findex = empty($redirect_to['data']['findex']) ? 0 : (int) $redirect_to['data']['findex'];
                         // e.g. ?udcentral_action=dl&action=updraftplus_spool_file&backup_timestamp=1455101696&findex=0&what=plugins
                         $redirect_url = site_url() . '?udcentral_action=spool_file&action=updraftplus_spool_file&findex=' . $findex . '&what=' . urlencode($redirect_to['data']['what']) . '&backup_timestamp=' . (int) $redirect_to['data']['backup_timestamp'];
                     }
                     break;
                 case 'direct_url':
                     $redirect_url = $redirect_to['url'];
                     break;
             }
         }
         $login_key = apply_filters('updraftplus_remotecontrol_login_key', array('key' => $login_key, 'created' => time(), 'redirect_url' => $redirect_url), $redirect_to, $extra_info);
         // Over-write any previous value - only one can be valid at a time)
         update_user_meta($user_id, 'updraftcentral_login_key', $login_key);
         return $this->_response(array('login_url' => network_site_url('?udcentral_action=login&login_id=' . $user_id . '&login_key=' . $login_key['key'])));
     } else {
         return $this->_generic_error_response('user_unknown');
     }
 }
Esempio n. 2
0
 public function itsec_external_backup_link($x)
 {
     return UpdraftPlus_Options::admin_page_url() . '?page=updraftplus';
 }
Esempio n. 3
0
 public function bootstrap()
 {
     if (!empty($this->dropbox_object) && !is_wp_error($this->dropbox_object)) {
         return $this->dropbox_object;
     }
     require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/API.php';
     require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/Exception.php';
     require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Consumer/ConsumerAbstract.php';
     require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Storage/StorageInterface.php';
     require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Storage/Encrypter.php';
     require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Storage/WordPress.php';
     require_once UPDRAFTPLUS_DIR . '/includes/Dropbox/OAuth/Consumer/Curl.php';
     //		require_once(UPDRAFTPLUS_DIR.'/includes/Dropbox/OAuth/Consumer/WordPress.php');
     $opts = $this->get_opts();
     $key = empty($opts['secret']) ? '' : $opts['secret'];
     $sec = empty($opts['appkey']) ? '' : $opts['appkey'];
     // Set the callback URL
     $callback = UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraftmethod-dropbox-auth';
     // Instantiate the Encrypter and storage objects
     $encrypter = new Dropbox_Encrypter('ThisOneDoesNotMatterBeyondLength');
     // Instantiate the storage
     $storage = new Dropbox_WordPress($encrypter, "tk_", 'updraft_dropbox');
     //		WordPress consumer does not yet work
     //		$OAuth = new Dropbox_ConsumerWordPress($sec, $key, $storage, $callback);
     // Get the DropBox API access details
     list($d2, $d1) = $this->defaults();
     if (empty($sec)) {
         $sec = base64_decode($d1);
     }
     if (empty($key)) {
         $key = base64_decode($d2);
     }
     $root = 'sandbox';
     if ('dropbox:' == substr($sec, 0, 8)) {
         $sec = substr($sec, 8);
         $root = 'dropbox';
     }
     try {
         $OAuth = new Dropbox_Curl($sec, $key, $storage, $callback);
     } catch (Exception $e) {
         global $updraftplus;
         $updraftplus->log("Dropbox Curl error: " . $e->getMessage());
         $updraftplus->log(sprintf(__("%s error: %s", 'updraftplus'), "Dropbox/Curl", $e->getMessage()), 'error');
         return false;
     }
     $this->dropbox_object = new UpdraftPlus_Dropbox_API($OAuth, $root);
     return $this->dropbox_object;
 }
Esempio n. 4
0
 private function backup_now_remote_message()
 {
     global $updraftplus;
     $service = $updraftplus->just_one(UpdraftPlus_Options::get_updraft_option('updraft_service'));
     if (is_string($service)) {
         $service = array($service);
     }
     if (!is_array($service)) {
         $service = array();
     }
     $no_remote_configured = empty($service) || array('none') === $service || array('') === $service ? true : false;
     if ($no_remote_configured) {
         return '<input type="checkbox" disabled="disabled" id="backupnow_includecloud"> <em>' . sprintf(__("Backup won't be sent to any remote storage - none has been saved in the %s", 'updraftplus'), '<a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&amp;tab=settings" id="updraft_backupnow_gotosettings">' . __('settings', 'updraftplus')) . '</a>. ' . __('Not got any remote storage?', 'updraftplus') . ' <a href="https://updraftplus.com/support/updraftplus-vault-faqs/">' . __("Check out UpdraftPlus Vault.", 'updraftplus') . '</a></em>';
     } else {
         return '<input type="checkbox" id="backupnow_includecloud" checked="checked"> <label for="backupnow_includecloud">' . __("Send this backup to remote storage", 'updraftplus') . '</label>';
     }
 }
Esempio n. 5
0
    private function settings_formcontents($last_backup_html)
    {
        global $updraftplus;
        $updraft_dir = $updraftplus->backups_dir_location();
        ?>
			<table class="form-table">
			<tr>
				<th><?php 
        _e('File backup intervals', 'updraftplus');
        ?>
:</th>
				<td><select id="updraft_interval" name="updraft_interval" onchange="jQuery(document).trigger('updraftplus_interval_changed'); updraft_check_same_times();">
					<?php 
        $intervals = $this->get_intervals();
        $selected_interval = UpdraftPlus_Options::get_updraft_option('updraft_interval', 'manual');
        foreach ($intervals as $cronsched => $descrip) {
            echo "<option value=\"{$cronsched}\" ";
            if ($cronsched == $selected_interval) {
                echo 'selected="selected"';
            }
            echo ">" . htmlspecialchars($descrip) . "</option>\n";
        }
        ?>
					</select> <span id="updraft_files_timings"><?php 
        echo apply_filters('updraftplus_schedule_showfileopts', '<input type="hidden" name="updraftplus_starttime_files" value="">');
        ?>
</span>
					<?php 
        echo __('and retain this many scheduled backups', 'updraftplus') . ': ';
        $updraft_retain = (int) UpdraftPlus_Options::get_updraft_option('updraft_retain', 2);
        $updraft_retain = $updraft_retain > 0 ? $updraft_retain : 1;
        ?>
 <input type="number" min="1" step="1" name="updraft_retain" value="<?php 
        echo $updraft_retain;
        ?>
" style="width:48px;" />
					</td>
			</tr>

			<?php 
        if (defined('UPDRAFTPLUS_EXPERIMENTAL') && UPDRAFTPLUS_EXPERIMENTAL) {
            ?>
			<tr id="updraft_incremental_row">
				<th><?php 
            _e('Incremental file backup intervals', 'updraftplus');
            ?>
:</th>
				<td>
					<?php 
            do_action('updraftplus_incremental_cell', $selected_interval);
            ?>
					<a href="http://updraftplus.com/support/tell-me-more-about-incremental-backups/"><em><?php 
            _e('Tell me more about incremental backups', 'updraftplus');
            ?>
<em></a>
					</td>
			</tr>
			<?php 
        }
        ?>

			<?php 
        apply_filters('updraftplus_after_file_intervals', false, $selected_interval);
        ?>
			<tr>
				<th><?php 
        _e('Database backup intervals', 'updraftplus');
        ?>
:</th>
				<td><select id="updraft_interval_database" name="updraft_interval_database" onchange="updraft_check_same_times();">
					<?php 
        foreach ($intervals as $cronsched => $descrip) {
            echo "<option value=\"{$cronsched}\" ";
            if ($cronsched == UpdraftPlus_Options::get_updraft_option('updraft_interval_database', UpdraftPlus_Options::get_updraft_option('updraft_interval'))) {
                echo 'selected="selected"';
            }
            echo ">{$descrip}</option>\n";
        }
        ?>
					</select> <span id="updraft_same_schedules_message"><?php 
        echo apply_filters('updraftplus_schedule_sametimemsg', '');
        ?>
</span><span id="updraft_db_timings"><?php 
        echo apply_filters('updraftplus_schedule_showdbopts', '<input type="hidden" name="updraftplus_starttime_db" value="">');
        ?>
</span>
					<?php 
        echo __('and retain this many scheduled backups', 'updraftplus') . ': ';
        $updraft_retain_db = (int) UpdraftPlus_Options::get_updraft_option('updraft_retain_db', $updraft_retain);
        $updraft_retain_db = $updraft_retain_db > 0 ? $updraft_retain_db : 1;
        ?>
 <input type="number" min="1" step="1" name="updraft_retain_db" value="<?php 
        echo $updraft_retain_db;
        ?>
" style="width:48px" />
			</td>
			</tr>
			<tr class="backup-interval-description">
				<td></td><td><div style="max-width:670px;">
				<?php 
        echo apply_filters('updraftplus_fixtime_ftinfo', '<p><strong>' . __('To fix the time at which a backup should take place,', 'updraftplus') . ' </strong> (' . __('e.g. if your server is busy at day and you want to run overnight', 'updraftplus') . '), <a href="http://updraftplus.com/shop/updraftplus-premium/">' . htmlspecialchars(__('use UpdraftPlus Premium', 'updraftplus')) . '</a></p>');
        ?>
				</div></td>
			</tr>
			<tr>
				<th><?php 
        _e('Include in files backup', 'updraftplus');
        ?>
:</th>
				<td>

			<?php 
        $backupable_entities = $updraftplus->get_backupable_file_entities(true, true);
        # The true (default value if non-existent) here has the effect of forcing a default of on.
        foreach ($backupable_entities as $key => $info) {
            $included = UpdraftPlus_Options::get_updraft_option("updraft_include_{$key}", apply_filters("updraftplus_defaultoption_include_" . $key, true)) ? 'checked="checked"' : "";
            if ('others' == $key || 'uploads' == $key) {
                $include_exclude = UpdraftPlus_Options::get_updraft_option('updraft_include_' . $key . '_exclude', 'others' == $key ? UPDRAFT_DEFAULT_OTHERS_EXCLUDE : UPDRAFT_DEFAULT_UPLOADS_EXCLUDE);
                ?>
<input id="updraft_include_<?php 
                echo $key;
                ?>
" type="checkbox" name="updraft_include_<?php 
                echo $key;
                ?>
" value="1" <?php 
                echo $included;
                ?>
 /> <label <?php 
                if ('others' == $key) {
                    echo 'title="' . sprintf(__('Your wp-content directory server path: %s', 'updraftplus'), WP_CONTENT_DIR) . '"';
                }
                ?>
 for="updraft_include_<?php 
                echo $key;
                ?>
"><?php 
                echo 'others' == $key ? __('Any other directories found inside wp-content', 'updraftplus') : htmlspecialchars($info['description']);
                ?>
</label><br><?php 
                $display = $included ? '' : 'style="display:none;"';
                echo "<div id=\"updraft_include_" . $key . "_exclude\" {$display}>";
                echo '<label for="updraft_include_' . $key . '_exclude">' . __('Exclude these:', 'updraftplus') . '</label>';
                echo '<input title="' . __('If entering multiple files/directories, then separate them with commas. For entities at the top level, you can use a * at the start or end of the entry as a wildcard.', 'updraftplus') . '" type="text" id="updraft_include_' . $key . '_exclude" name="updraft_include_' . $key . '_exclude" size="54" value="' . htmlspecialchars($include_exclude) . '" />';
                echo '<br>';
                echo '</div>';
            } else {
                echo "<input id=\"updraft_include_{$key}\" type=\"checkbox\" name=\"updraft_include_{$key}\" value=\"1\" {$included} /><label for=\"updraft_include_{$key}\"" . (isset($info['htmltitle']) ? ' title="' . htmlspecialchars($info['htmltitle']) . '"' : '') . "> " . htmlspecialchars($info['description']) . "</label><br>";
                do_action("updraftplus_config_option_include_{$key}");
            }
        }
        ?>
				<p><?php 
        echo apply_filters('updraftplus_admin_directories_description', __('The above directories are everything, except for WordPress core itself which you can download afresh from WordPress.org.', 'updraftplus') . ' <a href="http://updraftplus.com/shop/">' . htmlspecialchars(__('See also the "More Files" add-on from our shop.', 'updraftplus')));
        ?>
</a></p>
				<?php 
        if (1 == 0 && !defined('UPDRAFTPLUS_NOADS_B')) {
            echo '<p><a href="http://wordshell.net">(' . __('Use WordShell for automatic backup, version control and patching', 'updraftplus') . ').</a></p>';
        }
        ?>
				</td>
			</tr>

			</table>

			<h2><?php 
        _e('Database Options', 'updraftplus');
        ?>
</h2>

			<table class="form-table" style="width:900px;">

			<tr>
				<th><?php 
        _e('Database encryption phrase', 'updraftplus');
        ?>
:</th>

				<td>
				<?php 
        echo apply_filters('updraft_database_encryption_config', '<a href="http://updraftplus.com/shop/updraftplus-premium/">' . __("Don't want to be spied on? UpdraftPlus Premium can encrypt your database backup.", 'updraftplus') . '</a> ' . __('It can also backup external databases.', 'updraftplus'));
        ?>
				</td>
			</tr>
			<tr class="backup-crypt-description">
				<td></td>

				<td>

				<a href="#" onclick="jQuery('#updraftplus_db_decrypt').val(jQuery('#updraft_encryptionphrase').val()); jQuery('#updraft-manualdecrypt-modal').slideToggle(); return false;"><?php 
        _e('You can manually decrypt an encrypted database here.', 'updraftplus');
        ?>
</a>

				<div id="updraft-manualdecrypt-modal" style="width: 85%; margin: 6px; display:none; margin-left: 100px;">
					<p><h3><?php 
        _e("Manually decrypt a database backup file", 'updraftplus');
        ?>
</h3></p>

					<?php 
        global $wp_version;
        if (version_compare($wp_version, '3.3', '<')) {
            echo '<em>' . sprintf(__('This feature requires %s version %s or later', 'updraftplus'), 'WordPress', '3.3') . '</em>';
        } else {
            ?>

					<div id="plupload-upload-ui2" style="width: 80%;">
						<div id="drag-drop-area2">
							<div class="drag-drop-inside">
								<p class="drag-drop-info"><?php 
            _e('Drop encrypted database files (db.gz.crypt files) here to upload them for decryption');
            ?>
</p>
								<p><?php 
            _ex('or', 'Uploader: Drop db.gz.crypt files here to upload them for decryption - or - Select Files');
            ?>
</p>
								<p class="drag-drop-buttons"><input id="plupload-browse-button2" type="button" value="<?php 
            esc_attr_e('Select Files');
            ?>
" class="button" /></p>
								<p style="margin-top: 18px;"><?php 
            _e('First, enter the decryption key', 'updraftplus');
            ?>
: <input id="updraftplus_db_decrypt" type="text" size="12"></input></p>
							</div>
						</div>
						<div id="filelist2">
						</div>
					</div>

					<?php 
        }
        ?>

				</div>


				</td>
			</tr>

			<?php 
        #'<a href="http://updraftplus.com/shop/updraftplus-premium/">'.__("This feature is part of UpdraftPlus Premium.", 'updraftplus').'</a>'
        $moredbs_config = apply_filters('updraft_database_moredbs_config', false);
        if (!empty($moredbs_config)) {
            ?>

			<tr>
				<th><?php 
            _e('Back up more databases', 'updraftplus');
            ?>
:</th>

				<td><?php 
            echo $moredbs_config;
            ?>

				</td>
			</tr>

			<?php 
        }
        ?>

			</table>

			<h2><?php 
        _e('Reporting', 'updraftplus');
        ?>
</h2>

			<table class="form-table" style="width:900px;">

			<?php 
        $report_rows = apply_filters('updraftplus_report_form', false);
        if (is_string($report_rows)) {
            echo $report_rows;
        } else {
            ?>

			<tr>
				<th><?php 
            _e('Email', 'updraftplus');
            ?>
:</th>
				<td>
					<?php 
            $updraft_email = UpdraftPlus_Options::get_updraft_option('updraft_email');
            ?>
					<input type="checkbox" id="updraft_email" name="updraft_email" value="<?php 
            esc_attr_e(get_bloginfo('admin_email'));
            ?>
"<?php 
            if (!empty($updraft_email)) {
                echo ' checked="checked"';
            }
            ?>
 > <br><label for="updraft_email"><?php 
            echo __("Check this box to have a basic report sent to", 'updraftplus') . ' <a href="' . admin_url('options-general.php') . '">' . __("your site's admin address", 'updraftplus') . '</a> (' . htmlspecialchars(get_bloginfo('admin_email')) . ").";
            ?>
</label>
					<?php 
            if (!class_exists('UpdraftPlus_Addon_Reporting')) {
                echo '<a href="https://updraftplus.com/shop/reporting/">' . __('For more reporting features, use the Reporting add-on.', 'updraftplus') . '</a>';
            }
            ?>
				</td>
			</tr>

			<?php 
        }
        ?>

			</table>

			<h2><?php 
        _e('Copying Your Backup To Remote Storage', 'updraftplus');
        ?>
</h2>

			<?php 
        $debug_mode = UpdraftPlus_Options::get_updraft_option('updraft_debug_mode') ? 'checked="checked"' : "";
        // Should be one of s3, dropbox, ftp, googledrive, email, or whatever else is added
        $active_service = UpdraftPlus_Options::get_updraft_option('updraft_service');
        ?>

			<table class="form-table" style="width:900px;">
			<tr>
				<th><?php 
        _e('Choose your remote storage', 'updraftplus');
        ?>
:</th>
				<td><?php 
        if (false === apply_filters('updraftplus_storage_printoptions', false, $active_service)) {
            if (is_array($active_service)) {
                $active_service = $updraftplus->just_one($active_service);
            }
            ?>

						<select name="updraft_service" id="updraft-service">
						<option value="none" <?php 
            if ('none' === $active_service) {
                echo ' selected="selected"';
            }
            ?>
><?php 
            _e('None', 'updraftplus');
            ?>
</option>
						<?php 
            foreach ($updraftplus->backup_methods as $method => $description) {
                echo "<option value=\"{$method}\"";
                if ($active_service === $method || is_array($active_service) && in_array($method, $active_service)) {
                    echo ' selected="selected"';
                }
                echo '>' . $description;
                echo "</option>\n";
            }
            ?>
						</select>

						<?php 
            echo '<p><a href="http://updraftplus.com/shop/morestorage/">' . htmlspecialchars(__('You can send a backup to more than one destination with an add-on.', 'updraftplus')) . '</a></p>';
            ?>

						</td>
					</tr>

					<?php 
        }
        ?>

					<tr class="updraftplusmethod none" style="display:none;">
						<td></td>
						<td><em><?php 
        echo htmlspecialchars(__('If you choose no remote storage, then the backups remain on the web-server. This is not recommended (unless you plan to manually copy them to your computer), as losing the web-server would mean losing both your website and the backups in one event.', 'updraftplus'));
        ?>
</em></td>
					</tr>

					<?php 
        $method_objects = array();
        foreach ($updraftplus->backup_methods as $method => $description) {
            do_action('updraftplus_config_print_before_storage', $method);
            require_once UPDRAFTPLUS_DIR . '/methods/' . $method . '.php';
            $call_method = 'UpdraftPlus_BackupModule_' . $method;
            $method_objects[$method] = new $call_method();
            $method_objects[$method]->config_print();
            do_action('updraftplus_config_print_after_storage', $method);
        }
        ?>

			</table>
			<script type="text/javascript">
			/* <![CDATA[ */

				jQuery(document).ready(function() {
					<?php 
        $really_is_writable = $updraftplus->really_is_writable($updraft_dir);
        if (!$really_is_writable) {
            echo "jQuery('.backupdirrow').show();\n";
        }
        ?>
					<?php 
        if (!empty($active_service)) {
            if (is_array($active_service)) {
                foreach ($active_service as $serv) {
                    echo "jQuery('.{$serv}').show();\n";
                }
            } else {
                echo "jQuery('.{$active_service}').show();\n";
            }
        } else {
            echo "jQuery('.none').show();\n";
        }
        foreach ($updraftplus->backup_methods as $method => $description) {
            // already done: require_once(UPDRAFTPLUS_DIR.'/methods/'.$method.'.php');
            $call_method = "UpdraftPlus_BackupModule_{$method}";
            if (method_exists($call_method, 'config_print_javascript_onready')) {
                $method_objects[$method]->config_print_javascript_onready();
            }
        }
        ?>
				});
			/* ]]> */
			</script>
			<table class="form-table" style="width:900px;">
			<tr>
				<td colspan="2"><h2><?php 
        _e('Advanced / Debugging Settings', 'updraftplus');
        ?>
</h2></td>
			</tr>

			<tr>
				<th><?php 
        _e('Expert settings', 'updraftplus');
        ?>
:</th>
				<td><a id="enableexpertmode" href="#enableexpertmode"><?php 
        _e('Show expert settings', 'updraftplus');
        ?>
</a> - <?php 
        _e("click this to show some further options; don't bother with this unless you have a problem or are curious.", 'updraftplus');
        ?>
 <?php 
        do_action('updraftplus_expertsettingsdescription');
        ?>
</td>
			</tr>
			<?php 
        $delete_local = UpdraftPlus_Options::get_updraft_option('updraft_delete_local', 1);
        $split_every_mb = UpdraftPlus_Options::get_updraft_option('updraft_split_every', 500);
        if (!is_numeric($split_every_mb)) {
            $split_every_mb = 500;
        }
        if ($split_every_mb < UPDRAFTPLUS_SPLIT_MIN) {
            $split_every_mb = UPDRAFTPLUS_SPLIT_MIN;
        }
        ?>

			<tr class="expertmode" style="display:none;">
				<th><?php 
        _e('Debug mode', 'updraftplus');
        ?>
:</th>
				<td><input type="checkbox" id="updraft_debug_mode" name="updraft_debug_mode" value="1" <?php 
        echo $debug_mode;
        ?>
 /> <br><label for="updraft_debug_mode"><?php 
        _e('Check this to receive more information and emails on the backup process - useful if something is going wrong.', 'updraftplus');
        ?>
 <?php 
        _e('This will also cause debugging output from all plugins to be shown upon this screen - please do not be surprised to see these.', 'updraftplus');
        ?>
</label></td>
			</tr>

			<tr class="expertmode" style="display:none;">
				<th><?php 
        _e('Split archives every:', 'updraftplus');
        ?>
</th>
				<td><input type="text" name="updraft_split_every" id="updraft_split_every" value="<?php 
        echo $split_every_mb;
        ?>
" size="5" /> Mb<br><?php 
        echo sprintf(__('UpdraftPlus will split up backup archives when they exceed this file size. The default value is %s megabytes. Be careful to leave some margin if your web-server has a hard size limit (e.g. the 2 Gb / 2048 Mb limit on some 32-bit servers/file systems).', 'updraftplus'), 500);
        ?>
</td>
			</tr>

			<tr class="deletelocal expertmode" style="display:none;">
				<th><?php 
        _e('Delete local backup', 'updraftplus');
        ?>
:</th>
				<td><input type="checkbox" id="updraft_delete_local" name="updraft_delete_local" value="1" <?php 
        if ($delete_local) {
            echo 'checked="checked"';
        }
        ?>
> <br><label for="updraft_delete_local"><?php 
        _e('Check this to delete any superfluous backup files from your server after the backup run finishes (i.e. if you uncheck, then any files despatched remotely will also remain locally, and any files being kept locally will not be subject to the retention limits).', 'updraftplus');
        ?>
</label></td>
			</tr>

			<tr class="expertmode backupdirrow" style="display:none;">
				<th><?php 
        _e('Backup directory', 'updraftplus');
        ?>
:</th>
				<td><input type="text" name="updraft_dir" id="updraft_dir" style="width:525px" value="<?php 
        echo htmlspecialchars($this->prune_updraft_dir_prefix($updraft_dir));
        ?>
" /></td>
			</tr>
			<tr class="expertmode backupdirrow" style="display:none;">
				<td></td><td><?php 
        if ($really_is_writable) {
            $dir_info = '<span style="color:green">' . __('Backup directory specified is writable, which is good.', 'updraftplus') . '</span>';
        } else {
            $dir_info = '<span style="color:red">';
            if (!is_dir($updraft_dir)) {
                $dir_info .= __('Backup directory specified does <b>not</b> exist.', 'updraftplus');
            } else {
                $dir_info .= __('Backup directory specified exists, but is <b>not</b> writable.', 'updraftplus');
            }
            $dir_info .= ' <span style="font-size:110%;font-weight:bold"><a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraft_create_backup_dir&nonce=' . wp_create_nonce('create_backup_dir') . '">' . __('Click here to attempt to create the directory and set the permissions', 'updraftplus') . '</a></span>, ' . __('or, to reset this option', 'updraftplus') . ' <a href="#" onclick="jQuery(\'#updraft_dir\').val(\'updraft\'); return false;">' . __('click here', 'updraftplus') . '</a>. ' . __('If that is unsuccessful check the permissions on your server or change it to another directory that is writable by your web server process.', 'updraftplus') . '</span>';
        }
        echo $dir_info . ' ' . __("This is where UpdraftPlus will write the zip files it creates initially.  This directory must be writable by your web server. It is relative to your content directory (which by default is called wp-content).", 'updraftplus') . ' ' . __("<b>Do not</b> place it inside your uploads or plugins directory, as that will cause recursion (backups of backups of backups of...).", 'updraftplus');
        ?>
</td>
			</tr>

			<tr class="expertmode" style="display:none;">
				<th><?php 
        _e('Use the server\'s SSL certificates', 'updraftplus');
        ?>
:</th>
				<td><input type="checkbox" id="updraft_ssl_useservercerts" name="updraft_ssl_useservercerts" value="1" <?php 
        if (UpdraftPlus_Options::get_updraft_option('updraft_ssl_useservercerts')) {
            echo 'checked="checked"';
        }
        ?>
> <br><label for="updraft_ssl_useservercerts"><?php 
        _e('By default UpdraftPlus uses its own store of SSL certificates to verify the identity of remote sites (i.e. to make sure it is talking to the real Dropbox, Amazon S3, etc., and not an attacker). We keep these up to date. However, if you get an SSL error, then choosing this option (which causes UpdraftPlus to use your web server\'s collection instead) may help.', 'updraftplus');
        ?>
</label></td>
			</tr>

			<tr class="expertmode" style="display:none;">
				<th><?php 
        _e('Do not verify SSL certificates', 'updraftplus');
        ?>
:</th>
				<td><input type="checkbox" id="updraft_ssl_disableverify" name="updraft_ssl_disableverify" value="1" <?php 
        if (UpdraftPlus_Options::get_updraft_option('updraft_ssl_disableverify')) {
            echo 'checked="checked"';
        }
        ?>
> <br><label for="updraft_ssl_disableverify"><?php 
        _e('Choosing this option lowers your security by stopping UpdraftPlus from verifying the identity of encrypted sites that it connects to (e.g. Dropbox, Google Drive). It means that UpdraftPlus will be using SSL only for encryption of traffic, and not for authentication.', 'updraftplus');
        ?>
 <?php 
        _e('Note that not all cloud backup methods are necessarily using SSL authentication.', 'updraftplus');
        ?>
</label></td>
			</tr>

			<tr class="expertmode" style="display:none;">
				<th><?php 
        _e('Disable SSL entirely where possible', 'updraftplus');
        ?>
:</th>
				<td><input type="checkbox" id="updraft_ssl_nossl" name="updraft_ssl_nossl" value="1" <?php 
        if (UpdraftPlus_Options::get_updraft_option('updraft_ssl_nossl')) {
            echo 'checked="checked"';
        }
        ?>
> <br><label for="updraft_ssl_nossl"><?php 
        _e('Choosing this option lowers your security by stopping UpdraftPlus from using SSL for authentication and encrypted transport at all, where possible. Note that some cloud storage providers do not allow this (e.g. Dropbox), so with those providers this setting will have no effect.', 'updraftplus');
        ?>
 <a href="http://updraftplus.com/faqs/i-get-ssl-certificate-errors-when-backing-up-andor-restoring/"><?php 
        _e('See this FAQ also.', 'updraftplus');
        ?>
</a></label></td>
			</tr>

			<?php 
        do_action('updraftplus_configprint_expertoptions');
        ?>

			<tr>
			<td></td>
			<td>
				<?php 
        $ws_ad = $updraftplus->wordshell_random_advert(1);
        if ($ws_ad) {
            ?>
				<p style="margin: 10px 0; padding: 10px; font-size: 140%; background-color: lightYellow; border-color: #E6DB55; border: 1px solid; border-radius: 4px;">
					<?php 
            echo $ws_ad;
            ?>
				</p>
				<?php 
        }
        ?>
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<input type="hidden" name="action" value="update" />
					<input type="submit" class="button-primary" value="<?php 
        _e('Save Changes', 'updraftplus');
        ?>
" />
				</td>
			</tr>
		</table>
		<?php 
    }
Esempio n. 6
0
 public function adminaction_searchreplace()
 {
     echo '<h2>' . __('Search / replace database', 'updraftplus') . '</h2>';
     echo '<strong>' . __('Search for', 'updraftplus') . ':</strong> ' . htmlspecialchars($_POST['search']) . "<br>";
     echo '<strong>' . __('Replace with', 'updraftplus') . ':</strong> ' . htmlspecialchars($_POST['replace']) . "<br>";
     $this->page_size = empty($_POST['pagesize']) || !is_numeric($_POST['pagesize']) ? 5000 : $_POST['pagesize'];
     $this->which_tables = empty($_POST['whichtables']) ? '' : explode(',', $_POST['whichtables']);
     if (empty($_POST['search'])) {
         echo sprintf(__("Failure: No %s was given.", 'updraftplus'), __('search term', 'updraftplus')) . "<br>";
         echo '<a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
         return;
     }
     global $updraftplus_restorer;
     if (empty($updraftplus_restorer) || !is_a($updraftplus_restorer, '')) {
         # Needed for the UpdraftPlus_WPDB class and Updraft_Restorer::sql_exec() method
         require_once UPDRAFTPLUS_DIR . '/restorer.php';
         $updraftplus_restorer = new Updraft_Restorer(null, null, true);
     }
     $this->updraftplus_restore_db_pre();
     $this->tables_replaced = array();
     $this->updraftplus_restored_db_dosearchreplace($_POST['search'], $_POST['replace'], $this->base_prefix, false);
     echo '<a href="' . UpdraftPlus_Options::admin_page_url() . '?page=updraftplus">' . __('Return to UpdraftPlus Configuration', 'updraftplus') . '</a>';
 }
Esempio n. 7
0
    public function config_print()
    {
        $opts = $this->get_opts();
        ?>
			<tr class="updraftplusmethod googledrive">
				<td></td>
				<td>
				<img src="https://developers.google.com/drive/images/drive_logo.png" alt="<?php 
        _e('Google Drive', 'updraftplus');
        ?>
">
				<p><em><?php 
        printf(__('%s is a great choice, because UpdraftPlus supports chunked uploads - no matter how big your site is, UpdraftPlus can upload it a little at a time, and not get thwarted by timeouts.', 'updraftplus'), 'Google Drive');
        ?>
</em></p>
				</td>
			</tr>

			<tr class="updraftplusmethod googledrive">
			<th></th>
			<td>
			<?php 
        $admin_page_url = UpdraftPlus_Options::admin_page_url();
        # This is advisory - so the fact it doesn't match IPv6 addresses isn't important
        if (preg_match('#^(https?://(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+))/#', $admin_page_url, $matches)) {
            echo '<p><strong>' . htmlspecialchars(sprintf(__("%s does not allow authorisation of sites hosted on direct IP addresses. You will need to change your site's address (%s) before you can use %s for storage.", 'updraftplus'), __('Google Drive', 'updraftplus'), $matches[1], __('Google Drive', 'updraftplus'))) . '</strong></p>';
        } else {
            ?>

					<p><a href="https://updraftplus.com/support/configuring-google-drive-api-access-in-updraftplus/"><strong><?php 
            _e('For longer help, including screenshots, follow this link. The description below is sufficient for more expert users.', 'updraftplus');
            ?>
</strong></a></p>

					<p><a href="https://console.developers.google.com"><?php 
            _e('Follow this link to your Google API Console, and there activate the Drive API and create a Client ID in the API Access section.', 'updraftplus');
            ?>
</a> <?php 
            _e("Select 'Web Application' as the application type.", 'updraftplus');
            ?>
</p><p><?php 
            echo htmlspecialchars(__('You must add the following as the authorised redirect URI (under "More Options") when asked', 'updraftplus'));
            ?>
: <kbd><?php 
            echo UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-googledrive-auth';
            ?>
</kbd> <?php 
            _e('N.B. If you install UpdraftPlus on several WordPress sites, then you cannot re-use your project; you must create a new one from your Google API console for each site.', 'updraftplus');
            ?>
					</p>
					<?php 
        }
        ?>

			</td>
			</tr>

			<tr class="updraftplusmethod googledrive">
				<th><?php 
        echo __('Google Drive', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
        ?>
:</th>
				<td><input type="text" autocomplete="off" style="width:442px" name="updraft_googledrive[clientid]" value="<?php 
        echo htmlspecialchars($opts['clientid']);
        ?>
" /><br><em><?php 
        _e('If Google later shows you the message "invalid_client", then you did not enter a valid client ID here.', 'updraftplus');
        ?>
</em></td>
			</tr>
			<tr class="updraftplusmethod googledrive">
				<th><?php 
        echo __('Google Drive', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
        ?>
:</th>
				<td><input type="<?php 
        echo apply_filters('updraftplus_admin_secret_field_type', 'password');
        ?>
" style="width:442px" name="updraft_googledrive[secret]" value="<?php 
        echo htmlspecialchars($opts['secret']);
        ?>
" /></td>
			</tr>

			<?php 
        # Legacy configuration
        if (isset($opts['parentid'])) {
            $parentid = is_array($opts['parentid']) ? $opts['parentid']['id'] : $opts['parentid'];
            $showparent = is_array($opts['parentid']) && !empty($opts['parentid']['name']) ? $opts['parentid']['name'] : $parentid;
            $folder_opts = '<tr class="updraftplusmethod googledrive">
				<th>' . __('Google Drive', 'updraftplus') . ' ' . __('Folder', 'updraftplus') . ':</th>
				<td><input type="hidden" name="updraft_googledrive[parentid][id]" value="' . htmlspecialchars($parentid) . '">
				<input type="text" title="' . esc_attr($parentid) . '" readonly="readonly" style="width:442px" value="' . htmlspecialchars($showparent) . '">';
            if (!empty($parentid) && (!is_array($opts['parentid']) || empty($opts['parentid']['name']))) {
                $folder_opts .= '<em>' . __("<strong>This is NOT a folder name</strong>.", 'updraftplus') . ' ' . __('It is an ID number internal to Google Drive', 'updraftplus') . '</em>';
            } else {
                $folder_opts .= '<input type="hidden" name="updraft_googledrive[parentid][name]" value="' . htmlspecialchars($opts['parentid']['name']) . '">';
            }
        } else {
            $folder_opts = '<tr class="updraftplusmethod googledrive">
				<th>' . __('Google Drive', 'updraftplus') . ' ' . __('Folder', 'updraftplus') . ':</th>
				<td><input type="text" readonly="readonly" style="width:442px" name="updraft_googledrive[folder]" value="UpdraftPlus" />';
        }
        $folder_opts .= '<br><em><a href="https://updraftplus.com/shop/updraftplus-premium/">' . __('To be able to set a custom folder name, use UpdraftPlus Premium.', 'updraftplus') . '</em></a>';
        $folder_opts .= '</td></tr>';
        echo apply_filters('updraftplus_options_googledrive_others', $folder_opts, $opts);
        ?>

			<tr class="updraftplusmethod googledrive">
				<th><?php 
        _e('Authenticate with Google');
        ?>
:</th>
				<td><p><?php 
        if (!empty($opts['token'])) {
            echo __("<strong>(You appear to be already authenticated,</strong> though you can authenticate again to refresh your access if you've had a problem).", 'updraftplus');
        }
        ?>

				<?php 
        if (!empty($opts['token']) && !empty($opts['ownername'])) {
            echo '<br>' . sprintf(__("Account holder's name: %s.", 'updraftplus'), htmlspecialchars($opts['ownername'])) . ' ';
        }
        ?>
				</p>
				<p>

				<a href="<?php 
        echo UpdraftPlus_Options::admin_page_url();
        ?>
?action=updraftmethod-googledrive-auth&page=updraftplus&updraftplus_googleauth=doit"><?php 
        print __('<strong>After</strong> you have saved your settings (by clicking \'Save Changes\' below), then come back here once and click this link to complete authentication with Google.', 'updraftplus');
        ?>
</a>
				</p>
				</td>
			</tr>
		<?php 
    }
Esempio n. 8
0
    public function options_printpage()
    {
        if (!UpdraftPlus_Options::user_can_manage()) {
            wp_die(__('You do not have sufficient permissions to access this page.'));
        }
        $options = $this->options->get_option(UDADDONS2_SLUG . '_options');
        $user_and_pass_at_top = empty($options['email']) ? true : false;
        $title = htmlspecialchars($this->title);
        $mother = $this->mother;
        echo <<<ENDHERE
\t<div class="wrap">
\t\t
ENDHERE;
        $enter_credentials_begin = UpdraftPlus_Options::options_form_begin('', false);
        if (is_multisite()) {
            $enter_credentials_begin .= '<input type="hidden" name="action" value="update">';
        }
        $interested = htmlspecialchars(__('Interested in knowing about your UpdraftPlus.Com password security? Read about it here.', 'updraftplus'));
        $connect = htmlspecialchars(__('Connect', 'updraftplus'));
        $enter_credentials_end = <<<ENDHERE
\t\t\t<p style="margin-left: 258px;">
\t\t\t\t<input id="ud_connectsubmit" type="submit" class="button-primary" value="{$connect}" />
\t\t\t</p>
\t\t\t<p style="margin-left: 258px; font-size: 70%"><em><a href="http://updraftplus.com/faqs/tell-me-about-my-updraftplus-com-account/">{$interested}</a></em></p>
\t\t</form>
ENDHERE;
        global $updraftplus_addons2;
        // 		$this->connected = (!empty($options['email']) && !empty($options['password'])) ? $updraftplus_addons2->connection_status() : false;
        $this->connected = !empty($options['email']) ? $updraftplus_addons2->connection_status() : false;
        if (true !== $this->connected) {
            if (is_wp_error($this->connected)) {
                $connection_errors = array();
                foreach ($this->connected->get_error_messages() as $key => $msg) {
                    $connection_errors[] = $msg;
                }
            } else {
                if (!empty($options['email']) && !empty($options['password'])) {
                    $connection_errors = array(__('An unknown error occurred when trying to connect to UpdraftPlus.Com', 'updraftplus'));
                }
            }
            $this->connected = false;
        }
        if ($this->connected) {
            echo '<p style="clear: both; float: left;">' . __('You are presently <strong>connected</strong> to an UpdraftPlus.Com account.', 'updraftplus');
            echo ' <a href="#" onclick="jQuery(\'#ud_connectsubmit\').click();">' . __('If you bought new add-ons, then follow this link to refresh your connection', 'updraftplus') . '</a>.';
            if (!empty($options['password'])) {
                echo ' ' . __("Note that after you have claimed your add-ons, you can remove your password (but not the email address) from the settings below, without affecting this site's access to updates.", 'updraftplus');
            }
        } else {
            // 			$oval = is_object($this->plug_updatechecker) ? get_site_option($this->plug_updatechecker->optionName, null) : null;
            // 			// Detect the case where the password has been removed
            // 			if (is_object($oval) && !empty($oval->lastCheck) && time()-$oval->lastCheck < 86400*8) {
            // 			} else {
            echo "<p>" . __('You are presently <strong>not connected</strong> to an UpdraftPlus.Com account.', 'updraftplus');
            // 			}
        }
        echo '</p>';
        if (isset($connection_errors)) {
            echo '<div class="error"><p><strong>' . __('Errors occurred when trying to connect to UpdraftPlus.Com:', 'updraftplus') . '</strong></p><ul>';
            foreach ($connection_errors as $err) {
                echo '<li style="list-style:disc inside;">' . $err . '</li>';
            }
            echo '</ul></div>';
        }
        global $updraftplus_addons2;
        $sid = $updraftplus_addons2->siteid();
        $home_url = home_url();
        // Enumerate possible unclaimed/re-claimable purchases, and what should be active on this site
        $unclaimed_available = array();
        $assigned = array();
        $have_all = false;
        if ($this->connected && isset($updraftplus_addons2->user_addons) && is_array($updraftplus_addons2->user_addons)) {
            foreach ($updraftplus_addons2->user_addons as $akey => $addon) {
                // Keys: site, sitedescription, key, status
                if (isset($addon['status']) && 'active' == $addon['status'] && isset($addon['site']) && ('unclaimed' == $addon['site'] || 'unlimited' == $addon['site'])) {
                    $key = $addon['key'];
                    $unclaimed_available[$key] = array('eid' => $akey, 'status' => 'available');
                } elseif (isset($addon['status']) && 'active' == $addon['status'] && isset($addon['site']) && $addon['site'] == $sid) {
                    $key = $addon['key'];
                    $assigned[$key] = $akey;
                    if ('all' == $key) {
                        $have_all = true;
                    }
                } elseif (isset($addon['sitedescription']) && ($home_url === $addon['sitedescription'] || 0 === strpos($addon['sitedescription'], $home_url . ' - '))) {
                    # Is assigned to a site with the same URL as this one - allow a reclaim
                    $key = $addon['key'];
                    $unclaimed_available[$key] = array('eid' => $akey, 'status' => 'reclaimable');
                }
            }
        }
        if (!$this->connected) {
            $this->show_credentials_form($enter_credentials_begin, $enter_credentials_end);
        }
        $email = isset($options['email']) ? $options['email'] : '';
        $pass = isset($options['password']) ? base64_encode($options['password']) : '';
        $sn = base64_encode(get_bloginfo('name'));
        $su = base64_encode($home_url);
        $ourpageslug = UDADDONS2_PAGESLUG;
        $mother = $this->mother;
        //$href = (is_multisite()) ? 'settings.php' : 'options-general.php';
        $href = UpdraftPlus_Options::admin_page_url();
        if (count($unclaimed_available) > 0) {
            $nonce = wp_create_nonce('udmanager-nonce');
            $pleasewait = htmlspecialchars(__('Please wait whilst we make the claim...', 'updraftplus'));
            $notgranted = esc_js(__('Claim not granted - perhaps you have already used this purchase somewhere else?', 'updraftplus'));
            $notgrantedlogin = esc_js(__('Claim not granted - your account login details were wrong', 'updraftplus'));
            $ukresponse = esc_js(__('An unknown response was received. Response was:', 'updraftplus'));
            echo <<<ENDHERE
\t\t<div id="udm_pleasewait" class="updated" style="border: 1px solid; padding: 10px; margin-top: 10px; margin-bottom: 10px; clear: both; float: left; display:none;"><strong>{$pleasewait}</strong></div>
\t\t<script type="text/javascript">
\t\t\tfunction udm_claim(key) {
\t\t\t\tvar data = {
\t\t\t\t\t\taction: 'udaddons_claimaddon',
\t\t\t\t\t\tnonce: '{$nonce}',
\t\t\t\t\t\tkey: key
\t\t\t\t};
\t\t\t\tjQuery('#udm_pleasewait').fadeIn();
\t\t\t\tjQuery.post(ajaxurl, data, function(response) {
\t\t\t\t\tif ('ERR' == response) {
\t\t\t\t\t\talert("{$notgranted}");
\t\t\t\t\t} else if (response == 'OK') {
\t\t\t\t\t\twindow.location.href = '{$href}?page={$ourpageslug}&udm_refresh=1&udm_clearcred=1&tab=addons';
\t\t\t\t\t} else if (response == 'BADAUTH') {
\t\t\t\t\t\talert("{$notgrantedlogin}");
\t\t\t\t\t} else {
\t\t\t\t\t\talert("{$ukresponse} "+response);
\t\t\t\t\t}
\t\t\t\t\tjQuery('#udm_pleasewait').fadeOut();
\t\t\t\t});
\t\t\t}
\t\t</script>
ENDHERE;
        }
        $this->update_js = '';
        echo '<h3 style="clear:left; margin-top: 10px;">' . __('UpdraftPlus Addons', 'updraftplus') . '</h3><div>';
        $addons = $updraftplus_addons2->get_available_addons();
        $this->plugin_update_url = 'update-core.php';
        # Can we get a direct update URL?
        $updates_available = get_site_transient('update_plugins');
        if (is_object($updates_available) && isset($updates_available->response) && isset($updraftplus_addons2->plug_updatechecker) && isset($updraftplus_addons2->plug_updatechecker->pluginFile) && isset($updates_available->response[$updraftplus_addons2->plug_updatechecker->pluginFile])) {
            $file = $updraftplus_addons2->plug_updatechecker->pluginFile;
            $this->plugin_update_url = wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&updraftplus_noautobackup=1&plugin=') . $file, 'upgrade-plugin_' . $file);
            $this->update_js = '<script>jQuery(document).ready(function() { jQuery(\'#updraftaddons_updatewarning\').html(\'' . __('An update containing your addons is available for UpdraftPlus - please follow this link to get it.', 'updraftplus') . '\') });</script>';
        }
        $first = '';
        $second = '';
        $third = '';
        if (is_array($addons)) {
            foreach ($addons as $key => $addon) {
                extract($addon);
                if (empty($addon['latestversion'])) {
                    $latestversion = false;
                }
                if (empty($addon['installedversion'])) {
                    $installedversion = false;
                }
                if (empty($addon['installed']) && $installedversion == false) {
                    $installed = false;
                }
                $unclaimed = isset($unclaimed_available[$key]) ? $unclaimed_available[$key] : false;
                $is_assigned = isset($assigned[$key]) ? $assigned[$key] : false;
                $box = $this->addonbox($key, $name, $shopurl, $description, trim($installedversion), trim($latestversion), $installed, $unclaimed, $is_assigned, $have_all);
                if ($is_assigned) {
                    $first .= $box;
                } elseif (!empty($unclaimed)) {
                    $second .= $box;
                } else {
                    $third .= $box;
                }
            }
        } else {
            echo "<em>" . __('An error occurred when trying to retrieve your add-ons.', 'updraftplus') . "</em>";
        }
        echo $first . $second . $third;
        echo <<<ENDHERE
\t\t</div>
ENDHERE;
        echo $this->update_js;
        // TODO: Show their support package, if any - ?
        if (is_array($updraftplus_addons2->user_support)) {
            // Keys:
        }
        echo '<h3>' . __('UpdraftPlus Support', 'updraftplus') . '</h3>
<ul>
<li style="list-style:disc inside;">' . __('Need to get support?', 'updraftplus') . ' <a href="' . $mother . '/support/">' . __('Go here', 'updraftplus') . "</a>.</li>\n</ul>";
        if ($this->connected) {
            echo "<hr>";
            $this->show_credentials_form($enter_credentials_begin, $enter_credentials_end);
        }
        echo '</div>';
    }
Esempio n. 9
0
    public function do_config_print($opts)
    {
        global $updraftplus_admin;
        $bucket_path = empty($opts['bucket_path']) ? '' : untrailingslashit($opts['bucket_path']);
        $accesskey = empty($opts['accesskey']) ? '' : $opts['accesskey'];
        $secret = empty($opts['secret']) ? '' : $opts['secret'];
        $client_id = empty($opts['clientid']) ? '' : $opts['clientid'];
        $project_id = empty($opts['project_id']) ? '' : $opts['project_id'];
        $storage_class = empty($opts['storage_class']) ? 'STANDARD' : $opts['storage_class'];
        $bucket_location = empty($opts['bucket_location']) ? 'US' : $opts['bucket_location'];
        ?>
		<tr class="updraftplusmethod googlecloud">
			<td></td>
			<td>
				<img alt="<?php 
        _e(sprintf(__('%s logo', 'updraftplus'), 'Google Cloud'));
        ?>
" src="<?php 
        echo esc_attr(UPDRAFTPLUS_URL . '/images/googlecloud.png');
        ?>
"><br>
				<p><?php 
        printf(__('Do not confuse %s with %s - they are separate things.', 'updraftplus'), '<a href="https://cloud.google.com/storage">Google Cloud</a>', '<a href="https://drive.google.com">Google Drive</a>');
        ?>
</p>

			<?php 
        $admin_page_url = UpdraftPlus_Options::admin_page_url();
        # This is advisory - so the fact it doesn't match IPv6 addresses isn't important
        if (preg_match('#^(https?://(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+))/#', $admin_page_url, $matches)) {
            echo '<p><strong>' . htmlspecialchars(sprintf(__("%s does not allow authorisation of sites hosted on direct IP addresses. You will need to change your site's address (%s) before you can use %s for storage.", 'updraftplus'), __('Google Cloud', 'updraftplus'), $matches[1], __('Google Cloud', 'updraftplus'))) . '</strong></p>';
        } else {
            ?>

					<p><a href="https://updraftplus.com/support/configuring-google-cloud-api-access-updraftplus/"><strong><?php 
            _e('For longer help, including screenshots, follow this link. The description below is sufficient for more expert users.', 'updraftplus');
            ?>
</strong></a></p>

					<p><a href="https://console.developers.google.com"><?php 
            _e('Follow this link to your Google API Console, and there activate the Storage API and create a Client ID in the API Access section.', 'updraftplus');
            ?>
</a> <?php 
            _e("Select 'Web Application' as the application type.", 'updraftplus');
            ?>
</p><p><?php 
            echo htmlspecialchars(__('You must add the following as the authorised redirect URI (under "More Options") when asked', 'updraftplus'));
            ?>
: <kbd><?php 
            echo UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-googlecloud-auth';
            ?>
</kbd>

					</p>
					<?php 
        }
        ?>

			</td>
			</tr>
		
		<tr class="updraftplusmethod googlecloud">
			<th><?php 
        echo __('Google Cloud', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
        ?>
:</th>
			<td>
				<input type="text" autocomplete="off" style="width:442px" id="updraft_googlecloud_clientid" name="updraft_googlecloud[clientid]" value="<?php 
        echo esc_attr($client_id);
        ?>
" />
				<br><em><?php 
        _e('If Google later shows you the message "invalid_client", then you did not enter a valid client ID here.', 'updraftplus');
        ?>
</em>
			</td>
		</tr>
		
		<tr class="updraftplusmethod googlecloud">
			<th><?php 
        echo __('Google Cloud', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
        ?>
:</th>
			<td><input type="<?php 
        echo apply_filters('updraftplus_admin_secret_field_type', 'password');
        ?>
" style="width:442px" id="updraft_googlecloud_apisecret" name="updraft_googlecloud[secret]" value="<?php 
        echo esc_attr($secret);
        ?>
" /></td>
		</tr>

		<?php 
        $updraftplus_admin->storagemethod_row('googlecloud', 'Google Cloud ' . __('Project ID', 'updraftplus') . ':', '<input title="' . esc_attr(sprintf(__('Enter the ID of the %s project you wish to use here.', 'updraftplus'), 'Google Cloud')) . '" type="text" style="width:442px" id="updraft_googlecloud_project_id" name="updraft_googlecloud[project_id]" value="' . esc_attr($project_id) . '"><br><em>' . __('N.B. This is only needed if you have not already created the bucket, and you wish UpdraftPlus to create it for you.', 'updraftplus') . ' ' . __('Otherwise, you can leave it blank.', 'updraftplus') . ' <a href="https://updraftplus.com/faqs/where-do-i-find-my-google-project-id/">' . __('Go here for more information.', 'updraftplus') . '</a></em>');
        $updraftplus_admin->storagemethod_row('googlecloud', 'Google Cloud ' . __('Bucket', 'updraftplus') . ':', '<input title="' . esc_attr(sprintf(__('Enter the name of the %s bucket you wish to use here.', 'updraftplus'), 'Google Cloud') . ' ' . __('Bucket names have to be globally unique. If the bucket does not already exist, then it will be created.') . ' ' . sprintf(__('e.g. %s', 'updraftplus'), 'mybackups/workwebsite.')) . '" type="text" style="width:442px" id="updraft_googlecloud_bucket_path" name="updraft_googlecloud[bucket_path]" value="' . esc_attr($bucket_path) . '"><br><a href="https://cloud.google.com/storage/docs/bucket-naming?hl=en"><em>' . __("See Google's guidelines on bucket naming by following this link.", 'updraftplus') . '</a> ' . sprintf(__('You must use a bucket name that is unique, for all %s users.', 'updraftplus'), __('Google Cloud', 'updraftplus')) . '</em>');
        ?>
		<tr class="updraftplusmethod googlecloud">
			<th><?php 
        _e('Storage class', 'updraftplus');
        ?>
:<br><a href="https://cloud.google.com/storage/docs/storage-classes"><em><?php 
        _e('(Read more)', 'updraftplus');
        ?>
</em></a></th>
			<td>
				<select name="updraft_googlecloud[storage_class]" id="updraft_googlecloud_storage_class">
					<?php 
        foreach ($this->storage_classes as $id => $description) {
            echo '<option value="' . $id . '" ' . ($id == $storage_class ? ' selected="selected"' : '') . '>' . htmlspecialchars($description) . '</option>';
        }
        ?>
				</select>
				<br>
				<em><?php 
        echo __('This setting applies only when a new bucket is being created.', 'updraftplus') . ' ' . __('Note that Google do not support every storage class in every location - you should read their documentation to learn about current availability.', 'updraftplus');
        ?>
</em>
			</td>
		</tr>
		
		<tr class="updraftplusmethod googlecloud">
			<th><?php 
        _e('Bucket location', 'updraftplus');
        ?>
:<br><a href="https://cloud.google.com/storage/docs/bucket-locations"><em><?php 
        _e('(Read more)', 'updraftplus');
        ?>
</em></a></th>
			<td>
				<select name="updraft_googlecloud[bucket_location]" id="updraft_googlecloud_bucket_location">
					<?php 
        foreach ($this->bucket_locations as $id => $description) {
            echo '<option value="' . $id . '" ' . ($id == $bucket_location ? ' selected="selected"' : '') . '>' . htmlspecialchars($description) . '</option>';
        }
        ?>
				</select>
				<br>
				<em><?php 
        echo __('This setting applies only when a new bucket is being created.', 'updraftplus');
        ?>
</em>

			</td>
		</tr>
		
		<tr class="updraftplusmethod googlecloud">
			<th><?php 
        _e('Authenticate with Google');
        ?>
:</th>
			<td>
				<p><?php 
        if (!empty($opts['token'])) {
            echo __("<strong>(You appear to be already authenticated,</strong> though you can authenticate again to refresh your access if you've had a problem).", 'updraftplus');
        }
        ?>

				<?php 
        if (!empty($opts['token']) && !empty($opts['ownername'])) {
            echo '<br>' . sprintf(__("Account holder's name: %s.", 'updraftplus'), htmlspecialchars($opts['ownername'])) . ' ';
        }
        ?>
				</p>
				<p>
					<a href="<?php 
        echo UpdraftPlus_Options::admin_page_url();
        ?>
?action=updraftmethod-googlecloud-auth&page=updraftplus&updraftplus_googleauth=doit"><?php 
        _e("<strong>After</strong> you have saved your settings (by clicking 'Save Changes' below), then come back here once and click this link to complete authentication with Google.", 'updraftplus');
        ?>
</a>
				</p>
			</td>
		</tr>
		
		<?php 
    }
Esempio n. 10
0
 public static function add_networkadmin_page()
 {
     global $wp_admin_bar;
     if (!is_object($wp_admin_bar) || !is_super_admin() || !function_exists('is_admin_bar_showing') || !is_admin_bar_showing()) {
         return;
     }
     $wp_admin_bar->add_node(array('parent' => 'network-admin', 'id' => 'updraftplus-admin-settings', 'title' => __('UpdraftPlus Backups', 'updraftplus'), 'href' => UpdraftPlus_Options::admin_page_url() . '?page=updraftplus'));
 }
Esempio n. 11
0
    public static function config_print()
    {
        ?>
			<tr class="updraftplusmethod googledrive">
				<td><?php 
        _e('Google Drive', 'updraftplus');
        ?>
:</td>
				<td>
				<img src="https://developers.google.com/drive/images/drive_logo.png" alt="<?php 
        _e('Google Drive', 'updraftplus');
        ?>
">
				<p><em><?php 
        printf(__('%s is a great choice, because UpdraftPlus supports chunked uploads - no matter how big your site is, UpdraftPlus can upload it a little at a time, and not get thwarted by timeouts.', 'updraftplus'), 'Google Drive');
        ?>
</em></p>
				</td>
			</tr>

			<tr class="updraftplusmethod googledrive">
			<th></th>
			<td>
			<?php 
        global $updraftplus_admin;
        if (!class_exists('SimpleXMLElement')) {
            $updraftplus_admin->show_double_warning('<strong>' . __('Warning', 'updraftplus') . ':</strong> ' . sprintf(__('Your web server\'s PHP installation does not included a required module (%s). Please contact your web hosting provider\'s support.', 'updraftplus'), 'SimpleXMLElement') . ' ' . sprintf(__("UpdraftPlus's %s module <strong>requires</strong> %s. Please do not file any support requests; there is no alternative.", 'updraftplus'), __('Google Drive', 'updraftplus'), 'SimpleXMLElement'), 'googledrive');
        }
        ?>

			</td>
			</tr>

			<tr class="updraftplusmethod googledrive">
			<th>Google Drive:</th>
			<td>
			<p><a href="http://updraftplus.com/support/configuring-google-drive-api-access-in-updraftplus/"><strong><?php 
        _e('For longer help, including screenshots, follow this link. The description below is sufficient for more expert users.', 'updraftplus');
        ?>
</strong></a></p>
			<p><a href="https://code.google.com/apis/console/"><?php 
        _e('Follow this link to your Google API Console, and there create a Client ID in the API Access section.', 'updraftplus');
        ?>
</a> <?php 
        _e("Select 'Web Application' as the application type.", 'updraftplus');
        ?>
</p><p><?php 
        echo htmlspecialchars(__('You must add the following as the authorised redirect URI (under "More Options") when asked', 'updraftplus'));
        ?>
: <kbd><?php 
        echo UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-googledrive-auth';
        ?>
</kbd> <?php 
        _e('N.B. If you install UpdraftPlus on several WordPress sites, then you cannot re-use your client ID; you must create a new one from your Google API console for each site.', 'updraftplus');
        ?>

			<?php 
        if (!class_exists('SimpleXMLElement')) {
            echo "<b>", __('Warning', 'updraftplus') . ':</b> ' . __("You do not have the SimpleXMLElement installed. Google Drive backups will <b>not</b> work until you do.", 'updraftplus');
        }
        ?>
			</p>
			</td>
			</tr>

			<tr class="updraftplusmethod googledrive">
				<th><?php 
        echo __('Google Drive', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
        ?>
:</th>
				<td><input type="text" autocomplete="off" style="width:412px" name="updraft_googledrive_clientid" value="<?php 
        echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_googledrive_clientid'));
        ?>
" /><br><em><?php 
        _e('If Google later shows you the message "invalid_client", then you did not enter a valid client ID here.', 'updraftplus');
        ?>
</em></td>
			</tr>
			<tr class="updraftplusmethod googledrive">
				<th><?php 
        echo __('Google Drive', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
        ?>
:</th>
				<td><input type="<?php 
        echo apply_filters('updraftplus_admin_secret_field_type', 'text');
        ?>
" style="width:412px" name="updraft_googledrive_secret" value="<?php 
        echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_googledrive_secret'));
        ?>
" /></td>
			</tr>
			<tr class="updraftplusmethod googledrive">
				<th><?php 
        echo __('Google Drive', 'updraftplus') . ' ' . __('Folder ID', 'updraftplus');
        ?>
:</th>
				<td><input type="text" style="width:412px" name="updraft_googledrive_remotepath" value="<?php 
        echo htmlspecialchars(UpdraftPlus_Options::get_updraft_option('updraft_googledrive_remotepath'));
        ?>
" /> <em><?php 
        _e("<strong>This is NOT a folder name</strong>. To get a folder's ID navigate to that folder in Google Drive in your web browser and copy the ID from your browser's address bar. It is the part that comes after <kbd>#folders/</kbd>. Leave empty to use your root folder.", 'updraftplus');
        ?>
</em></td>
			</tr>
			<tr class="updraftplusmethod googledrive">
				<th><?php 
        _e('Authenticate with Google');
        ?>
:</th>
				<td><p><?php 
        if ('' != UpdraftPlus_Options::get_updraft_option('updraft_googledrive_token')) {
            echo __("<strong>(You appear to be already authenticated,</strong> though you can authenticate again to refresh your access if you've had a problem).", 'updraftplus');
        }
        ?>
 <a href="<?php 
        echo UpdraftPlus_Options::admin_page_url();
        ?>
?action=updraftmethod-googledrive-auth&page=updraftplus&updraftplus_googleauth=doit"><?php 
        print __('<strong>After</strong> you have saved your settings (by clicking \'Save Changes\' below), then come back here once and click this link to complete authentication with Google.', 'updraftplus');
        ?>
</a>
				</p>
				</td>
			</tr>
		<?php 
    }
Esempio n. 12
0
 private function auth_request()
 {
     # &updraftcopycomparms=, because copy.com is dumb and always appends '?param=value' regardless of the supplied format...
     # i.e. we get sent back to somewhere like:
     # options-general.php?action=updraftmethod-copycom-auth&updraftcopycomparms=?oauth_token=(etc)&oauth_verifier=(etc)
     $callback_url = UpdraftPlus_Options::admin_page_url() . '?action=updraftmethod-copycom-auth&updraftcopycomparms=';
     $get_request = $this->storage->get('oauth/request?scope=' . $this->get_copycom_perms() . '&oauth_callback=' . urlencode($callback_url));
     if (!is_string($get_request)) {
         throw new Exception('Unexpected HTTP result returned (' . serialize($get_request) . ')');
     }
     parse_str($get_request, $result);
     # Also, there's oauth_callback_confirmed - not sure it's any use (it should be 'true')
     if (empty($result['oauth_token']) || empty($result['oauth_token_secret'])) {
         throw new Exception('Unexpected HTTP result returned (' . serialize($get_request) . ')');
     }
     # We will need this. But don't set token yet, as that is taken to indicate that all is finished
     $this->options['tokensecret'] = $result['oauth_token_secret'];
     UpdraftPlus_Options::update_updraft_option('updraft_copycom', $this->options);
     # Next: request an authorize screen
     #$auth_request = $this->storage->get('applications/authorize');
     # N.B. It's www.copy.com - not the api_url in the storage
     $authurl = 'https://www.copy.com/applications/authorize?oauth_token=' . urlencode($result['oauth_token']);
     # = wp_remote_get($this->storage->api_url.'?oauth_token='.urlencode($result['oauth_token']));
     #if (is_wp_error($auth_request))  { global $updraftplus; return $updraftplus->log_wp_error($auth_request, false, true); }
     if (!headers_sent()) {
         header('Location: ' . $authurl);
         exit;
     } else {
         throw new Exception(sprintf(__('The %s authentication could not go ahead, because something else on your site is breaking it. Try disabling your other plugins and switching to a default theme. (Specifically, you are looking for the component that sends output (most likely PHP warnings/errors) before the page begins. Turning off any debugging settings may also help).', 'updraftplus'), 'Copy.Com'));
     }
 }
 private function delete_old_dirs()
 {
     global $wp_filesystem, $updraftplus;
     $credentials = request_filesystem_credentials(wp_nonce_url(UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraft_delete_old_dirs', 'updraftplus-credentialtest-nonce'));
     WP_Filesystem($credentials);
     if ($wp_filesystem->errors->get_error_code()) {
         foreach ($wp_filesystem->errors->get_error_messages() as $message) {
             show_message($message);
         }
         exit;
     }
     // From WP_CONTENT_DIR - which contains 'themes'
     $ret = $this->delete_old_dirs_dir($wp_filesystem->wp_content_dir());
     $updraft_dir = $updraftplus->backups_dir_location();
     if ($updraft_dir) {
         $ret4 = $updraft_dir ? $this->delete_old_dirs_dir($updraft_dir, false) : true;
     } else {
         $ret4 = true;
     }
     //      $ret2 = $this->delete_old_dirs_dir($wp_filesystem->abspath());
     $plugs = untrailingslashit($wp_filesystem->wp_plugins_dir());
     if ($wp_filesystem->is_dir($plugs . '-old')) {
         print '<strong>' . esc_html__('Delete', 'updraftplus') . ': </strong>plugins-old: ';
         if (!$wp_filesystem->delete($plugs . '-old', true)) {
             $ret3 = false;
             print '<strong>' . esc_html__('Failed', 'updraftplus') . '</strong><br>';
         } else {
             $ret3 = true;
             print '<strong>' . esc_html__('OK', 'updraftplus') . '</strong><br>';
         }
     } else {
         $ret3 = true;
     }
     return $ret && $ret3 && $ret4;
 }
Esempio n. 14
0
 public function bootstrap($deauthenticate = false)
 {
     if (!empty($this->dropbox_object) && !is_wp_error($this->dropbox_object)) {
         return $this->dropbox_object;
     }
     /*
     			Use Old Dropbox API constant is used to force bootstrap to use the old API this is for users having problems. By default we will use the new Dropbox API v2 as the old version will be deprecated as of June 2017
     */
     $dropbox_api = defined('UPDRAFTPLUS_DROPBOX_API_V1') && UPDRAFTPLUS_DROPBOX_API_V1 && time() < 1498608000 ? 'Dropbox' : 'Dropbox2';
     require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/API.php';
     require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/Exception.php';
     require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Consumer/ConsumerAbstract.php';
     require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Storage/StorageInterface.php';
     require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Storage/Encrypter.php';
     require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Storage/WordPress.php';
     require_once UPDRAFTPLUS_DIR . '/includes/' . $dropbox_api . '/OAuth/Consumer/Curl.php';
     //		require_once(UPDRAFTPLUS_DIR.'/includes/'.$dropbox_api.'/OAuth/Consumer/WordPress.php');
     $opts = $this->get_opts();
     $key = empty($opts['secret']) ? '' : $opts['secret'];
     $sec = empty($opts['appkey']) ? '' : $opts['appkey'];
     $oauth2_id = base64_decode('aXA3NGR2Zm1sOHFteTA5');
     // Set the callback URL
     $callbackhome = UpdraftPlus_Options::admin_page_url() . '?page=updraftplus&action=updraftmethod-dropbox-auth';
     $callback = defined('UPDRAFTPLUS_DROPBOX_AUTH_RETURN_URL') ? UPDRAFTPLUS_DROPBOX_AUTH_RETURN_URL : 'https://auth.updraftplus.com/auth/dropbox/';
     // Instantiate the Encrypter and storage objects
     $encrypter = new Dropbox_Encrypter('ThisOneDoesNotMatterBeyondLength');
     // Instantiate the storage
     $storage = new Dropbox_WordPress($encrypter, "tk_", 'updraft_dropbox');
     //		WordPress consumer does not yet work
     //		$OAuth = new Dropbox_ConsumerWordPress($sec, $key, $storage, $callback);
     // Get the DropBox API access details
     list($d2, $d1) = $this->defaults();
     if (empty($sec)) {
         $sec = base64_decode($d1);
     }
     if (empty($key)) {
         $key = base64_decode($d2);
     }
     $root = 'sandbox';
     if ('dropbox:' == substr($sec, 0, 8)) {
         $sec = substr($sec, 8);
         $root = 'dropbox';
     }
     try {
         $OAuth = new Dropbox_Curl($sec, $oauth2_id, $key, $storage, $callback, $callbackhome, $deauthenticate);
     } catch (Exception $e) {
         global $updraftplus;
         $updraftplus->log("Dropbox Curl error: " . $e->getMessage());
         $updraftplus->log(sprintf(__("%s error: %s", 'updraftplus'), "Dropbox/Curl", $e->getMessage() . ' (' . get_class($e) . ') (line: ' . $e->getLine() . ', file: ' . $e->getFile()) . ')', 'error');
         return false;
     }
     if ($deauthenticate) {
         return true;
     }
     $this->dropbox_object = new UpdraftPlus_Dropbox_API($OAuth, $root);
     return $this->dropbox_object;
 }
Esempio n. 15
0
    public function do_config_print($opts)
    {
        global $updraftplus_admin;
        $folder = empty($opts['folder']) ? '' : untrailingslashit($opts['folder']);
        $clientid = empty($opts['clientid']) ? '' : $opts['clientid'];
        $secret = empty($opts['secret']) ? '' : $opts['secret'];
        $site_host = parse_url(network_site_url(), PHP_URL_HOST);
        if ('127.0.0.1' == $site_host || '::1' == $site_host || 'localhost' == $site_host) {
            // Of course, there are other things that are effectively 127.0.0.1. This is just to help.
            $callback_text = '<p><strong>' . htmlspecialchars(sprintf(__('Microsoft OneDrive is not compatible with sites hosted on a localhost or 127.0.0.1 URL - their developer console forbids these (current URL is: %s).', 'updraftplus'), site_url())) . '</strong></p>';
        } else {
            $callback_text = '<p>' . htmlspecialchars(__('You must add the following as the authorised redirect URI in your OneDrive console (under "API Settings") when asked', 'updraftplus')) . ': <kbd>' . UpdraftPlus_Options::admin_page_url() . '</kbd></p>';
        }
        $updraftplus_admin->storagemethod_row('onedrive', '', '<img src="' . UPDRAFTPLUS_URL . '/images/onedrive.png">' . $callback_text . '<p><a href="https://account.live.com/developers/applications/create">' . __('Create OneDrive credentials in your OneDrive developer console.', 'updraftplus') . '</a></p><p><a href="https://updraftplus.com/microsoft-onedrive-setup-guide/">' . __('For longer help, including screenshots, follow this link.', 'updraftplus') . '</a></p>');
        ?>
		<tr class="updraftplusmethod onedrive">
			<th><?php 
        echo __('OneDrive', 'updraftplus') . ' ' . __('Client ID', 'updraftplus');
        ?>
:</th>
			<td><input type="text" autocomplete="off" style="width:442px" name="updraft_onedrive[clientid]" value="<?php 
        echo esc_attr($clientid);
        ?>
" /><br><em><?php 
        echo htmlspecialchars(__('If OneDrive later shows you the message "unauthorized_client", then you did not enter a valid client ID here.', 'updraftplus'));
        ?>
</em></td>
		</tr>
		<tr class="updraftplusmethod onedrive">
			<th><?php 
        echo __('OneDrive', 'updraftplus') . ' ' . __('Client Secret', 'updraftplus');
        ?>
:</th>
			<td><input type="<?php 
        echo apply_filters('updraftplus_admin_secret_field_type', 'password');
        ?>
" style="width:442px" name="updraft_onedrive[secret]" value="<?php 
        echo esc_attr($secret);
        ?>
" /></td>
		</tr>

		<?php 
        $updraftplus_admin->storagemethod_row('onedrive', 'OneDrive ' . __('Folder', 'updraftplus'), '<input title="' . esc_attr(sprintf(__('Enter the path of the %s folder you wish to use here.', 'updraftplus'), 'OneDrive') . ' ' . __('If the folder does not already exist, then it will be created.') . ' ' . sprintf(__('e.g. %s', 'updraftplus'), 'MyBackups/WorkWebsite.') . ' ' . sprintf(__('If you leave it blank, then the backup will be placed in the root of your %s', 'updraftplus'), 'OneDrive account') . ' ' . sprintf(__('N.B. %s is not case-sensitive.', 'updraftplus'), 'OneDrive')) . '" type="text" style="width:442px" name="updraft_onedrive[folder]" value="' . esc_attr($folder) . '">');
        $updraftplus_admin->storagemethod_row('onedrive', sprintf(__('Authenticate with %s', 'updraftplus'), 'OneDrive') . ':', '<p>' . (!empty($opts['refresh_token']) ? "<strong>" . __('(You appear to be already authenticated).', 'updraftplus') . '</strong>' : '') . (!empty($opts['refresh_token']) && !empty($opts['ownername']) ? ' ' . sprintf(__("Account holder's name: %s.", 'updraftplus'), htmlspecialchars($opts['ownername'])) . ' ' : '') . '</p><p><a href="?page=updraftplus&action=updraftmethod-onedrive-auth&updraftplus_onedriveauth=doit">' . sprintf(__('<strong>After</strong> you have saved your settings (by clicking \'Save Changes\' below), then come back here once and click this link to complete authentication with %s.', 'updraftplus'), 'OneDrive') . '</a></p>');
        $updraftplus_admin->curl_check('OneDrive', false, 'onedrive', false);
    }