From ab9389007f872488e8620d97949a4692d2e67f0a Mon Sep 17 00:00:00 2001 From: Matthew Barbour <matthew@darkholme.net> Date: Sat, 15 Jun 2019 11:35:36 -0500 Subject: [PATCH] Changed key-generation process for cron upload so it doesn't endlessly generate new keys before the user first hits the same buttons in settings. --- ext/cron_uploader/main.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php index fe1bbfbf..1c12b05f 100644 --- a/ext/cron_uploader/main.php +++ b/ext/cron_uploader/main.php @@ -157,13 +157,14 @@ class CronUploader extends Extension { global $config; // Set default values + $config->set_default_int('cron_uploader_count', 1); + $this->set_dir(); + $this->upload_key = $config->get_string("cron_uploader_key", ""); - if (strlen($this->upload_key) <= 0) { + if (empty($this->upload_key)) { $this->upload_key = $this->generate_key(); - $config->set_default_int('cron_uploader_count', 1); - $config->set_default_string('cron_uploader_key', $this->upload_key); - $this->set_dir(); + $config->set_string('cron_uploader_key', $this->upload_key); } } @@ -180,7 +181,7 @@ class CronUploader extends Extension $sb->add_int_option("cron_uploader_count", "How many to upload each time"); $sb->add_text_option("cron_uploader_dir", "<br>Set Cron Uploader root directory<br>"); - $sb->add_label("<br>Cron Command: <input type='text' size='60' value='$cron_cmd'><br> + $sb->add_label("<br>Cron Command: <input type='text' size='60' readonly='readonly' value='".html_escape($cron_cmd)."'><br> Create a cron job with the command above.<br/> <a href='$documentation_link'>Read the documentation</a> if you're not sure what to do.");