summaryrefslogtreecommitdiff
path: root/actions/newnotice.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-25 22:47:23 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-05-25 22:47:23 -0400
commit76aa85fe5ef408cecf7c40c0c56d58ff9ac9fcbb (patch)
treef2bd52d08e421f934bc8466ab1ecb4facbbcc6a5 /actions/newnotice.php
parentb140bcdee4b1f4c8f2f34a89a9c5c51e7ecfe826 (diff)
parent68d90bcab04713d53cf3731d45729a617e68a2fa (diff)
Merge branch '0.8.x' into stats
Conflicts: README
Diffstat (limited to 'actions/newnotice.php')
-rw-r--r--actions/newnotice.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php
index cbd04c58b..ae0ff9636 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -158,7 +158,8 @@ class NewnoticeAction extends Action
$replyto = 'false';
}
- $notice = Notice::saveNew($user->id, $content, 'web', 1,
+// $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
+ $notice = Notice::saveNew($user->id, $content_shortened, 'web', 1,
($replyto == 'false') ? null : $replyto);
if (is_string($notice)) {
@@ -166,6 +167,8 @@ class NewnoticeAction extends Action
return;
}
+ $this->saveUrls($notice);
+
common_broadcast_notice($notice);
if ($this->boolean('ajax')) {
@@ -191,6 +194,24 @@ class NewnoticeAction extends Action
}
}
+ /** save all urls in the notice to the db
+ *
+ * follow redirects and save all available file information
+ * (mimetype, date, size, oembed, etc.)
+ *
+ * @param class $notice Notice to pull URLs from
+ *
+ * @return void
+ */
+ function saveUrls($notice) {
+ common_replace_urls_callback($notice->content, array($this, 'saveUrl'), $notice->id);
+ }
+
+ function saveUrl($data) {
+ list($url, $notice_id) = $data;
+ $zzz = File::processNew($url, $notice_id);
+ }
+
/**
* Show an Ajax-y error message
*