From a703bb98542cee53e1c58cfba87add46e05437f1 Mon Sep 17 00:00:00 2001
From: jgen <jeffgenovy@gmail.com>
Date: Sun, 27 Apr 2014 15:45:22 -0400
Subject: [PATCH 1/4] Bump the version number.

---
 core/sys_config.inc.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/sys_config.inc.php b/core/sys_config.inc.php
index bd9f0616..5804ba60 100644
--- a/core/sys_config.inc.php
+++ b/core/sys_config.inc.php
@@ -33,7 +33,7 @@ _d("SPEED_HAX", false);      // boolean  do some questionable things in the name
 _d("COMPILE_ELS", false);    // boolean  pre-build the list of event listeners
 _d("NICE_URLS", false);      // boolean  force niceurl mode
 _d("WH_SPLITS", 1);          // int      how many levels of subfolders to put in the warehouse
-_d("VERSION", 'trunk');      // string   shimmie version
+_d("VERSION", '2.5.1-e9d8ae7'); // string   shimmie version
 _d("TIMEZONE", null);        // string   timezone
 _d("MIN_FREE_SPACE",100*1024*1024); // int      disable uploading if there's less than MIN_FREE_SPACE bytes free space
 _d("CORE_EXTS", "bbcode,user,mail,upload,image,view,handle_pixel,ext_manager,setup,upgrade,handle_404,comment,tag_list,index,tag_edit,alias_editor"); // extensions to always enable
@@ -44,7 +44,7 @@ _d("EXTRA_EXTS", "");        // optional extra extensions
  * Calculated settings - you should never need to change these
  * directly, only the things they're built from
  */
-_d("SCORE_VERSION", 's2hack/'.VERSION); // string SCore version
+_d("SCORE_VERSION", 'develop/'.VERSION); // string SCore version
 _d("ENABLED_EXTS", CORE_EXTS.",".EXTRA_EXTS);
 
 

From 5f0642f349048b05a4a20d4c2e358a689a27e64c Mon Sep 17 00:00:00 2001
From: YaoiFox <admin@yaoifox.com>
Date: Wed, 7 May 2014 05:30:44 +0200
Subject: [PATCH 2/4] some bug fixes to cron uploader

---
 ext/cron_uploader/main.php | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php
index 97f4062c..fef72f92 100644
--- a/ext/cron_uploader/main.php
+++ b/ext/cron_uploader/main.php
@@ -30,6 +30,12 @@ class CronUploader extends Extension {
 	 */
 	private $root_dir = "";
 	
+	/**
+	 * Key used to identify uploader
+	 * @var string
+	 */
+	private $upload_key = "";
+	
 	/**
 	 * Checks if the cron upload page has been accessed
 	 * and initializes the upload.
@@ -39,10 +45,10 @@ class CronUploader extends Extension {
 		global $config, $user;
 		
 		if ($event->page_matches ( "cron_upload" )) {
-			$key = $config->get_string ( "cron_uploader_key", "" );
+			$this->upload_key = $config->get_string ( "cron_uploader_key", "" );
 			
 			// If the key is in the url, upload
-			if ($key != "" && $event->get_arg ( 0 ) == $key) {
+			if ($this->upload_key != "" && $event->get_arg ( 0 ) == $this->upload_key) {
 				// log in as admin
 				$this->process_upload(); // Start upload
 			} 
@@ -67,7 +73,7 @@ class CronUploader extends Extension {
 		$uploaded_dirinfo = $this->scan_dir($uploaded_dir);
 		$failed_dirinfo = $this->scan_dir($failed_dir);
 		
-		$cron_url = make_http(make_link("/cron_upload/" . $config->get_string('cron_uploader_key', 'invalid key' )));
+		$cron_url = make_http(make_link("/cron_upload/" . $this->upload_key));
 		$cron_cmd = "curl -f $cron_url";
 		$log_path = $this->root_dir . "/uploads.log";
 		
@@ -135,19 +141,21 @@ class CronUploader extends Extension {
 	public function onInitExt(InitExtEvent $event) {
 		global $config;
 		// Set default values
-		$key = $this->generate_key ();
+		if ($config->get_string("cron_uploader_key", "")) {
+			$this->upload_key = $this->generate_key ();
 	
-		$config->set_default_int ( 'cron_uploader_count', 1 );
-		$config->set_default_string ( 'cron_uploader_key', $key );
-		$this->set_dir();
+			$config->set_default_int ( 'cron_uploader_count', 1 );
+			$config->set_default_string ( 'cron_uploader_key', $this->upload_key );
+			$this->set_dir();
+		}
 	}
 	
 	public function onSetupBuilding(SetupBuildingEvent $event) {
 		global $config;
 		$this->set_dir();
 		
-		$cron_url = make_http(make_link("/cron_upload/" . $config->get_string('cron_uploader_key', 'invalid key' )));
-		$cron_cmd = "wget $cron_url";
+		$cron_url = make_http(make_link("/cron_upload/" . $this->upload_key));
+		$cron_cmd = "curl -f $cron_url";
 		$documentation_link = make_http(make_link("cron_upload"));
 		
 		$sb = new SetupBlock ( "Cron Uploader" );
@@ -194,11 +202,11 @@ class CronUploader extends Extension {
 			
 		// Make the directory if it doesn't exist yet
 		if (!is_dir($dir . "/queue/")) 
-			mkdir ( $dir . "/queue/", 0755, true );
+			mkdir ( $dir . "/queue/", 775, true );
 		if (!is_dir($dir . "/uploaded/")) 
-			mkdir ( $dir . "/uploaded/", 0755, true );
+			mkdir ( $dir . "/uploaded/", 775, true );
 		if (!is_dir($dir . "/failed_to_upload/")) 
-			mkdir ( $dir . "/failed_to_upload/", 0755, true );
+			mkdir ( $dir . "/failed_to_upload/", 0775, true );
 		
 		$this->root_dir = $dir;
 		return $dir;
@@ -242,6 +250,7 @@ class CronUploader extends Extension {
 		// Throw exception if there's nothing in the queue
 		if (count($this->image_queue) == 0) {
 			$this->add_upload_info("Your queue is empty so nothing could be uploaded.");
+			$this->handle_log();
 			return false;
 		}
 		
@@ -289,10 +298,9 @@ class CronUploader extends Extension {
 		}
 		
 		// move file to correct dir
-		$newPath = $newDir . $filename;
-		rename($path, $newPath);
+		rename($path, $newDir.$filename);
 		
-		$this->add_upload_info($info . "Image \"$filename\" moved from queue to \"$newPath\".");
+		$this->add_upload_info($info . "Image \"$filename\" moved from queue to \"$$newDir\".");
 	}
 
 	/**

From f5f48d8a0b274c9d2f4a5da1baf4be062b740069 Mon Sep 17 00:00:00 2001
From: YaoiFox <admin@yaoifox.com>
Date: Wed, 7 May 2014 05:38:12 +0200
Subject: [PATCH 3/4] Update main.php

---
 ext/cron_uploader/main.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php
index fef72f92..0cdfd9f3 100644
--- a/ext/cron_uploader/main.php
+++ b/ext/cron_uploader/main.php
@@ -300,7 +300,7 @@ class CronUploader extends Extension {
 		// move file to correct dir
 		rename($path, $newDir.$filename);
 		
-		$this->add_upload_info($info . "Image \"$filename\" moved from queue to \"$$newDir\".");
+		$this->add_upload_info($info . "Image \"$filename\" moved from queue to \"$newDir\".");
 	}
 
 	/**

From 349d7bfa4d8e8c70d350227c299bc6fb20dc6437 Mon Sep 17 00:00:00 2001
From: YaoiFox <admin@yaoifox.com>
Date: Wed, 7 May 2014 07:10:23 +0200
Subject: [PATCH 4/4] curl --silent now

curl --silent now
---
 ext/cron_uploader/main.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ext/cron_uploader/main.php b/ext/cron_uploader/main.php
index 0cdfd9f3..2803fe4c 100644
--- a/ext/cron_uploader/main.php
+++ b/ext/cron_uploader/main.php
@@ -74,7 +74,7 @@ class CronUploader extends Extension {
 		$failed_dirinfo = $this->scan_dir($failed_dir);
 		
 		$cron_url = make_http(make_link("/cron_upload/" . $this->upload_key));
-		$cron_cmd = "curl -f $cron_url";
+		$cron_cmd = "curl --silent $cron_url";
 		$log_path = $this->root_dir . "/uploads.log";
 		
 		$info_html = "<b>Information</b>
@@ -155,7 +155,7 @@ class CronUploader extends Extension {
 		$this->set_dir();
 		
 		$cron_url = make_http(make_link("/cron_upload/" . $this->upload_key));
-		$cron_cmd = "curl -f $cron_url";
+		$cron_cmd = "curl --silent $cron_url";
 		$documentation_link = make_http(make_link("cron_upload"));
 		
 		$sb = new SetupBlock ( "Cron Uploader" );