summaryrefslogtreecommitdiff
path: root/lib/common.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-17 10:46:42 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-17 10:46:42 -0400
commit2d581992668b411020cc1dad16d8c05858c31a65 (patch)
tree126ca685b14a08429617e08f939edc83d8b0747f /lib/common.php
parent047412861921706fcf8e01431b5bc1fbe63d8586 (diff)
more twiddling
Placeholder for broadcasting notice updates. Fixup the local url function to include server and path. Add server and path to configuration array. Make new notice 303 redirect to shownotice. Make redirects work. Add link in streams to notices. darcs-hash:20080517144642-84dde-c267a6e3bb0717ad5a3a819a7cf65fdd5817ea8e.gz
Diffstat (limited to 'lib/common.php')
-rw-r--r--lib/common.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/lib/common.php b/lib/common.php
index f7b93011c..4cef9f0d9 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -33,7 +33,9 @@ define('MAX_AVATAR_SIZE', 256 * 1024);
$config =
array('site' =>
- array('name' => 'Just another µB'),
+ array('name' => 'Just another µB',
+ 'server' => 'localhost',
+ 'path' => '/'),
'avatar' =>
array('directory' => INSTALLDIR . 'files',
'path' => '/files'),
@@ -258,13 +260,13 @@ function common_avatar_url($filename) {
}
function common_local_url($action, $args) {
+ global $config;
/* XXX: pretty URLs */
$extra = '';
foreach ($args as $key => $value) {
$extra .= "&${key}=${value}";
}
- /* XXX: correct path */
- return "/index.php?action=${action}${extra}";
+ return "http://".$config['site']['server'].'/'.$config['site']['path']."/index.php?action=${action}${extra}";
}
function commmon_date_string($dt) {
@@ -272,6 +274,25 @@ function commmon_date_string($dt) {
return date(DATE_RFC822);
}
+function common_redirect($url, $code=307) {
+ static $status = (301 => "Moved Permanently",
+ 302 => "Found",
+ 303 => "See Other",
+ 307 => "Temporary Redirect");
+ header("Status: ${code} $status[$code]");
+ header("Location: $url");
+ common_element('a', array('href' => $url), $url);
+}
+
+function common_broadcast_notices($id) {
+ // XXX: broadcast notices to remote subscribers
+ // XXX: broadcast notices to SMS
+ // XXX: broadcast notices to Jabber
+ // XXX: broadcast notices to other IM
+ // XXX: use a queue system like http://code.google.com/p/microapps/wiki/NQDQ
+ return true;
+}
+
// XXX: set up gettext
function _t($str) { $str }