summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-09-15 17:16:35 -0400
committerEvan Prodromou <evan@status.net>2009-09-15 17:16:35 -0400
commit13147143fc830e81b80ae86bf4cc4f745ce04381 (patch)
tree7197e7c3437e028a1bc2358f38ac3964cf3fe6e9 /classes
parente559f82e86c495abdc4cf5fff3d8c6279a808354 (diff)
parent4081ed79b02fd06f7c347803478e1f835311c2ab (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes')
-rw-r--r--classes/File.php10
-rw-r--r--classes/Notice.php17
-rw-r--r--classes/Status_network.php2
-rw-r--r--classes/User.php17
4 files changed, 15 insertions, 31 deletions
diff --git a/classes/File.php b/classes/File.php
index dc668ab23..9758cf7f5 100644
--- a/classes/File.php
+++ b/classes/File.php
@@ -78,14 +78,14 @@ class File extends Memcached_DataObject
$file_id = $x->insert();
if (isset($redir_data['type'])
- && ('text/html' === substr($redir_data['type'], 0, 9))
+ && (('text/html' === substr($redir_data['type'], 0, 9) || 'application/xhtml+xml' === substr($redir_data['type'], 0, 21)))
&& ($oembed_data = File_oembed::_getOembed($given_url))) {
File_oembed::saveNew($oembed_data, $file_id);
}
return $x;
}
- function processNew($given_url, $notice_id) {
+ function processNew($given_url, $notice_id=null) {
if (empty($given_url)) return -1; // error, no url to process
$given_url = File_redirection::_canonUrl($given_url);
if (empty($given_url)) return -1; // error, no url to process
@@ -96,7 +96,7 @@ class File extends Memcached_DataObject
$redir_data = File_redirection::where($given_url);
$redir_url = $redir_data['url'];
// TODO: max field length
- if ($redir_url === $given_url || strlen($redir_url) > 255) {
+ if ($redir_url === $given_url || strlen($redir_url) > 255) {
$x = File::saveNew($redir_data, $given_url);
$file_id = $x->id;
} else {
@@ -119,7 +119,9 @@ class File extends Memcached_DataObject
}
}
- File_to_post::processNew($file_id, $notice_id);
+ if (!empty($notice_id)) {
+ File_to_post::processNew($file_id, $notice_id);
+ }
return $x;
}
diff --git a/classes/Notice.php b/classes/Notice.php
index e569d8305..2138e0561 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -56,7 +56,7 @@ class Notice extends Memcached_DataObject
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
- /* Notice types */
+ /* Notice types */
const LOCAL_PUBLIC = 1;
const REMOTE_OMB = 0;
const LOCAL_NONPUBLIC = -1;
@@ -260,17 +260,6 @@ class Notice extends Memcached_DataObject
$notice->saveUrls();
- // FIXME: why do we have to re-render the content?
- // Remove this if it's not necessary.
-
- $orig2 = clone($notice);
-
- $notice->rendered = common_render_content($final, $notice);
- if (!$notice->update($orig2)) {
- common_log_db_error($notice, 'UPDATE', __FILE__);
- return _('Problem saving notice.');
- }
-
$notice->query('COMMIT');
Event::handle('EndNoticeSave', array($notice));
@@ -755,6 +744,10 @@ class Notice extends Memcached_DataObject
return new ArrayWrapper($notices);
} else {
$notice = new Notice();
+ if (empty($ids)) {
+ //if no IDs requested, just return the notice object
+ return $notice;
+ }
$notice->whereAdd('id in (' . implode(', ', $ids) . ')');
$notice->orderBy('id DESC');
diff --git a/classes/Status_network.php b/classes/Status_network.php
index d526cb4d6..fe4f0b0c5 100644
--- a/classes/Status_network.php
+++ b/classes/Status_network.php
@@ -54,7 +54,7 @@ class Status_network extends DB_DataObject
global $config;
$config['db']['database_'.$dbname] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname";
- $config['db']['ini_'.$dbname] = INSTALLDIR.'/classes/statusnet.ini';
+ $config['db']['ini_'.$dbname] = INSTALLDIR.'/classes/status_network.ini';
$config['db']['table_status_network'] = $dbname;
self::$cache = new Memcache();
diff --git a/classes/User.php b/classes/User.php
index 58f9a6874..11cb4f08b 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -103,10 +103,7 @@ class User extends Memcached_DataObject
}
$toupdate = implode(', ', $parts);
- $table = $this->tableName();
- if(common_config('db','quote_identifiers')) {
- $table = '"' . $table . '"';
- }
+ $table = common_database_tablename($this->tableName());
$qry = 'UPDATE ' . $table . ' SET ' . $toupdate .
' WHERE id = ' . $this->id;
$orig->decache();
@@ -630,11 +627,7 @@ class User extends Memcached_DataObject
'ORDER BY subscription.created DESC ';
if ($offset) {
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
}
$profile = new Profile();
@@ -657,11 +650,7 @@ class User extends Memcached_DataObject
'AND subscription.subscribed != subscription.subscriber ' .
'ORDER BY subscription.created DESC ';
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
$profile = new Profile();