From 711ade9835f3523dcf83702834adef313f9cf54d Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 20 Jul 2009 14:01:51 +1200 Subject: look for full unicode when saving tags --- classes/Notice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes') diff --git a/classes/Notice.php b/classes/Notice.php index 101fadb67..12b47f360 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -97,11 +97,11 @@ class Notice extends Memcached_DataObject function saveTags() { /* extract all #hastags */ - $count = preg_match_all('/(?:^|\s)#([A-Za-z0-9_\-\.]{1,64})/', strtolower($this->content), $match); + $count = preg_match_all('/(?:^|\s)#([\pL\pN_\-\.]{1,64})/', strtolower($this->content), $match); if (!$count) { return true; } - + /* Add them to the database */ foreach(array_unique($match[1]) as $hashtag) { /* elide characters we don't want in the tag */ -- cgit v1.2.3-54-g00ecf From d95f45f0705467cfc7e3650db932e43f0a20e45f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Mon, 20 Jul 2009 14:18:48 +1200 Subject: turn into canonical terms before checking for unique-ness of a tag in a notice --- classes/Notice.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'classes') diff --git a/classes/Notice.php b/classes/Notice.php index 12b47f360..7f002d838 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -101,9 +101,17 @@ class Notice extends Memcached_DataObject if (!$count) { return true; } + + //turn each into their canonical tag + //this is needed to remove dupes before saving e.g. #hash.tag = #hashtag + $hashtags = array(); + for($i=0; $isaveTag($hashtag); } @@ -112,8 +120,6 @@ class Notice extends Memcached_DataObject function saveTag($hashtag) { - $hashtag = common_canonical_tag($hashtag); - $tag = new Notice_tag(); $tag->notice_id = $this->id; $tag->tag = $hashtag; -- cgit v1.2.3-54-g00ecf From 2aa47096b82fd224008d901584f09931c0432c2b Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 13:45:38 +1200 Subject: missing AND in the SQL --- classes/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/File.php b/classes/File.php index 68d385d1e..7ee8f6e08 100644 --- a/classes/File.php +++ b/classes/File.php @@ -136,7 +136,7 @@ class File extends Memcached_DataObject return sprintf(_('A file this large would exceed your user quota of %d bytes.'), common_config('attachments', 'user_quota')); } - $query .= ' month(modified) = month(now()) and year(modified) = year(now())'; + $query .= ' AND month(modified) = month(now()) and year(modified) = year(now())'; $this->query($query); $this->fetch(); $total = $this->total + $fileSize; -- cgit v1.2.3-54-g00ecf From 28b62f357d80d86e17f9688d65809cb959f4be6c Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Wed, 22 Jul 2009 17:05:44 +1200 Subject: fixed SQL in checking for monthly quota - works in postgres and mysql --- classes/File.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'classes') diff --git a/classes/File.php b/classes/File.php index 7ee8f6e08..0c4fbf7e6 100644 --- a/classes/File.php +++ b/classes/File.php @@ -122,6 +122,7 @@ class File extends Memcached_DataObject } function isRespectsQuota($user,$fileSize) { + if ($fileSize > common_config('attachments', 'file_quota')) { return sprintf(_('No file may be larger than %d bytes ' . 'and the file you sent was %d bytes. Try to upload a smaller version.'), @@ -135,8 +136,7 @@ class File extends Memcached_DataObject if ($total > common_config('attachments', 'user_quota')) { return sprintf(_('A file this large would exceed your user quota of %d bytes.'), common_config('attachments', 'user_quota')); } - - $query .= ' AND month(modified) = month(now()) and year(modified) = year(now())'; + $query .= ' AND EXTRACT(month FROM file.modified) = EXTRACT(month FROM now()) and EXTRACT(year FROM file.modified) = EXTRACT(year FROM now())'; $this->query($query); $this->fetch(); $total = $this->total + $fileSize; -- cgit v1.2.3-54-g00ecf From 27e525dbbc126b4fce91c89f25153dfe2b771ee9 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 23 Jul 2009 15:07:28 +1200 Subject: fixed up a limit offset to be ANSI SQL compliant --- classes/Profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/Profile.php b/classes/Profile.php index 224b61bd2..32de608cf 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -199,7 +199,7 @@ class Profile extends Memcached_DataObject $query .= ' order by id DESC'; if (!is_null($offset)) { - $query .= " limit $offset, $limit"; + $query .= " LIMIT $limit OFFSET $offset"; } $notice->query($query); -- cgit v1.2.3-54-g00ecf