summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-23 05:24:13 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-23 05:24:13 -0400
commit85c7b8df7101185907a43a8d83d54805a8473c2e (patch)
tree864dc346d82c029a2c5112ff7643b4b9bc17cb02
parent2053bdabef929f4a095d91fbdd3fa62646e9f332 (diff)
parent63c52784c7acc54b0b7b39ff3ca7763774e4ab9a (diff)
Merge branch '0.7.x' of git@gitorious.org:laconica/dev into 0.7.x
-rw-r--r--actions/all.php2
-rw-r--r--actions/newmessage.php45
-rw-r--r--db/notice_source.sql1
-rw-r--r--js/util.js6
-rw-r--r--lib/common.php2
-rw-r--r--lib/util.php2
6 files changed, 48 insertions, 10 deletions
diff --git a/actions/all.php b/actions/all.php
index a92e55462..a53bbea07 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -93,7 +93,7 @@ class AllAction extends ProfileAction
if (common_logged_in()) {
$current_user = common_current_user();
if ($this->user->id === $current_user->id) {
- $message .= _('Try subscribing to more people, [join a group](%%action.groups) or post something yourself.');
+ $message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
} else {
$message .= sprintf(_('You can try to [nudge %s](../%s) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
}
diff --git a/actions/newmessage.php b/actions/newmessage.php
index 82276ff34..52d4899ba 100644
--- a/actions/newmessage.php
+++ b/actions/newmessage.php
@@ -172,15 +172,54 @@ class NewmessageAction extends Action
$this->notify($user, $this->other, $message);
- $url = common_local_url('outbox', array('nickname' => $user->nickname));
+ if ($this->boolean('ajax')) {
+ $this->startHTML('text/xml;charset=utf-8');
+ $this->elementStart('head');
+ $this->element('title', null, _('Message sent'));
+ $this->elementEnd('head');
+ $this->elementStart('body');
+ $this->element('p', array('id' => 'command_result'),
+ sprintf(_('Direct message to %s sent'),
+ $this->other->nickname));
+ $this->elementEnd('body');
+ $this->elementEnd('html');
+ } else {
+ $url = common_local_url('outbox',
+ array('nickname' => $user->nickname));
+ common_redirect($url, 303);
+ }
+ }
- common_redirect($url, 303);
+ /**
+ * Show an Ajax-y error message
+ *
+ * Goes back to the browser, where it's shown in a popup.
+ *
+ * @param string $msg Message to show
+ *
+ * @return void
+ */
+
+ function ajaxErrorMsg($msg)
+ {
+ $this->startHTML('text/xml;charset=utf-8', true);
+ $this->elementStart('head');
+ $this->element('title', null, _('Ajax Error'));
+ $this->elementEnd('head');
+ $this->elementStart('body');
+ $this->element('p', array('id' => 'error'), $msg);
+ $this->elementEnd('body');
+ $this->elementEnd('html');
}
function showForm($msg = null)
{
- $this->msg = $msg;
+ if ($msg && $this->boolean('ajax')) {
+ $this->ajaxErrorMsg($msg);
+ return;
+ }
+ $this->msg = $msg;
$this->showPage();
}
diff --git a/db/notice_source.sql b/db/notice_source.sql
index d5124e223..ce44f3235 100644
--- a/db/notice_source.sql
+++ b/db/notice_source.sql
@@ -8,6 +8,7 @@ VALUES
('deskbar','Deskbar-Applet','http://www.gnome.org/projects/deskbar-applet/', now()),
('Do','Gnome Do','http://do.davebsd.com/wiki/index.php?title=Microblog_Plugin', now()),
('Facebook','Facebook','http://apps.facebook.com/identica/', now()),
+ ('feed2omb','feed2omb','http://projects.ciarang.com/p/feed2omb/', now()),
('Gwibber','Gwibber','http://launchpad.net/gwibber', now()),
('HelloTxt','HelloTxt','http://hellotxt.com/', now()),
('identicatools','Laconica Tools','http://bitbucketlabs.net/laconica-tools/', now()),
diff --git a/js/util.js b/js/util.js
index 53e6eb792..13036f7ca 100644
--- a/js/util.js
+++ b/js/util.js
@@ -192,10 +192,8 @@ $(document).ready(function(){
$("#notice_action-submit").removeClass("disabled");
}
};
- if (document.body.id != 'inbox' && document.body.id != 'outbox') {
- $("#form_notice").ajaxForm(PostNotice);
- $("#form_notice").each(addAjaxHidden);
- }
+ $("#form_notice").ajaxForm(PostNotice);
+ $("#form_notice").each(addAjaxHidden);
NoticeHover();
NoticeReply();
});
diff --git a/lib/common.php b/lib/common.php
index b3882d207..f983c4d16 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -192,7 +192,7 @@ $_config_files[] = INSTALLDIR.'/config.php';
$_have_a_config = false;
foreach ($_config_files as $_config_file) {
- if (file_exists($_config_file)) {
+ if (@file_exists($_config_file)) {
include_once($_config_file);
$_have_a_config = true;
}
diff --git a/lib/util.php b/lib/util.php
index 9b6d2941a..af4db4f02 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -980,7 +980,7 @@ function common_root_url($ssl=false)
function common_good_rand($bytes)
{
// XXX: use random.org...?
- if (file_exists('/dev/urandom')) {
+ if (@file_exists('/dev/urandom')) {
return common_urandom($bytes);
} else { // FIXME: this is probably not good enough
return common_mtrand($bytes);