From e0a79aee895f1bcfbeabbddfb39e9c16f049d244 Mon Sep 17 00:00:00 2001
From: Brett Bieber <brett.bieber@gmail.com>
Date: Tue, 16 Feb 2010 16:33:52 +0000
Subject: [PATCH] Add two patches. One that strips html from strings inserted
 into the database. One that makes the relatioships file compatible with php
 5.3

---
 patches/database_strip_html.diff         | 15 +++++++++++++++
 patches/relationship_get_set_public.diff | 24 ++++++++++++++++++++++++
 setup.sh                                 | 13 ++++++++-----
 3 files changed, 47 insertions(+), 5 deletions(-)
 create mode 100644 patches/database_strip_html.diff
 create mode 100644 patches/relationship_get_set_public.diff

diff --git a/patches/database_strip_html.diff b/patches/database_strip_html.diff
new file mode 100644
index 00000000..b56865f0
--- /dev/null
+++ b/patches/database_strip_html.diff
@@ -0,0 +1,15 @@
+Index: database.php
+===================================================================
+--- database.php	(revision 3939)
++++ database.php	(working copy)
+@@ -612,6 +612,10 @@
+ 	 * @return string Sanitised string
+ 	 */
+         function sanitise_string($string) {
++            while($string != html_entity_decode($string)) {
++                $string = html_entity_decode($string);
++            }
++            $string = strip_tags($string);
+         	return mysql_real_escape_string(trim($string));
+         }
+         
diff --git a/patches/relationship_get_set_public.diff b/patches/relationship_get_set_public.diff
new file mode 100644
index 00000000..455dead5
--- /dev/null
+++ b/patches/relationship_get_set_public.diff
@@ -0,0 +1,24 @@
+### Eclipse Workspace Patch 1.0
+#P UNL_Elgg
+Index: elgg/engine/lib/relationships.php
+===================================================================
+--- elgg/engine/lib/relationships.php	(revision 3938)
++++ elgg/engine/lib/relationships.php	(working copy)
+@@ -60,7 +60,7 @@
+ 		 * @param string $name
+ 		 * @return mixed
+ 		 */
+-		protected function __get($name) {
++		public function __get($name) {
+ 			if (isset($this->attributes[$name])) 
+ 				return $this->attributes[$name];
+ 	
+@@ -74,7 +74,7 @@
+ 		 * @param mixed $value
+ 		 * @return mixed
+ 		 */
+-		protected function __set($name, $value) {
++		public function __set($name, $value) {
+ 			$this->attributes[$name] = $value;
+ 			return true;
+ 		}
diff --git a/setup.sh b/setup.sh
index 6f65b121..63c2f217 100755
--- a/setup.sh
+++ b/setup.sh
@@ -1,11 +1,14 @@
 # Make a directory for elgg data files outside the root
-mkdir elgg_data
+mkdir elgg_data &> /dev/null
 
  
 
 #Do patches
-cd elgg
-patch -p0 < ../patches/lowercase_post.diff
-cd mod/groups
-patch -p0 < ../../../patches/add_closing_labels.diff
+patch -p0 -s -N  -r tmp.rej                   < patches/relationship_get_set_public.diff > /dev/null
+patch -p0 -s -N -d elgg -r tmp.rej            < patches/lowercase_post.diff              > /dev/null
+patch -p0 -s -N -d elgg/engine/lib -r tmp.rej < patches/database_strip_html.diff         > /dev/null
+patch -p0 -s -N -d elgg/mod/groups -r tmp.rej < patches/add_closing_labels.diff          > /dev/null
+rm tmp.rej
+
+echo 'Setup successful'
 
-- 
GitLab