summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-07-23 14:45:44 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-07-23 14:45:44 -0700
commit0dab5f58723cba8b5915c694a8200e242cc9ec02 (patch)
tree240bc8ff72c69bde7789d08493eeee87de1f1a38 /classes
parent749d9bfbbf65d962804bea1fa510039da185179f (diff)
parent7fff454ff931635dc1aca6a67af194b25567a65b (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
Diffstat (limited to 'classes')
-rw-r--r--classes/File.php4
-rw-r--r--classes/Notice.php14
-rw-r--r--classes/Profile.php2
3 files changed, 13 insertions, 7 deletions
diff --git a/classes/File.php b/classes/File.php
index 68d385d1e..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 .= ' 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;
diff --git a/classes/Notice.php b/classes/Notice.php
index 413d281f3..c2770edbe 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -98,13 +98,21 @@ 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;
}
+
+ //turn each into their canonical tag
+ //this is needed to remove dupes before saving e.g. #hash.tag = #hashtag
+ $hashtags = array();
+ for($i=0; $i<count($match[1]); $i++) {
+ $hashtags[] = common_canonical_tag($match[1][$i]);
+ }
+
/* Add them to the database */
- foreach(array_unique($match[1]) as $hashtag) {
+ foreach(array_unique($hashtags) as $hashtag) {
/* elide characters we don't want in the tag */
$this->saveTag($hashtag);
}
@@ -113,8 +121,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;
diff --git a/classes/Profile.php b/classes/Profile.php
index 372005cdd..f926b2cef 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);