X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Futil.php;h=d461a0a0300473d99bcf3f3adc22b91015d1bdfe;hb=fba25b0d9810dac55a27feed173437a2a2f61364;hp=1b672561fce85c30a81f030d045f9f2ed48eb7c9;hpb=8b1bf1e38cd39db084f5c14ed2b625c22897de70;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 1b672561fc..d461a0a030 100644 --- a/lib/util.php +++ b/lib/util.php @@ -223,6 +223,14 @@ function common_show_header($pagetitle, $callable=NULL, $data=NULL, $headercall= common_element_start('div', array('id' => 'content')); } +# XXX: Refactor w/common_user_error() ? +function common_show_basic_auth_error() { + header('HTTP/1.1 401 Unauthorized'); + header('Content-type: text/plain'); + print("Could not authenticate you.\n"); # exactly what Twitter says + exit(); +} + function common_show_footer() { global $xw, $config; common_element_end('div'); # content div @@ -880,7 +888,7 @@ function common_save_replies($notice) { return true; } # XXX: is there another way to make an array copy? - $names = ($tname) ? array_unique(array_merge(array(strtolower($tname)), $match[1])) : $match[1]; + $names = ($tname) ? array_unique(array_merge(array(strtolower($tname)), $match[1])) : array_unique($match[1]); $sender = Profile::staticGet($notice->profile_id); # store replied only for first @ (what user/notice what the reply directed, # we assume first @ is it) @@ -998,13 +1006,6 @@ function common_notice_form($action=NULL, $content=NULL) { common_element_end('form'); } -function common_mint_tag($extra) { - global $config; - return - 'tag:'.$config['tag']['authority'].','. - $config['tag']['date'].':'.$config['tag']['prefix'].$extra; -} - # Should make up a reasonable root URL function common_root_url() { @@ -1061,7 +1062,6 @@ function common_ensure_syslog() { static $initialized = false; if (!$initialized) { global $config; - define_syslog_variables(); openlog($config['syslog']['appname'], 0, LOG_USER); $initialized = true; } @@ -1292,4 +1292,20 @@ function common_profile_avatar_url($profile, $size=AVATAR_PROFILE_SIZE) { return common_default_avatar($size); } } - \ No newline at end of file + +function common_profile_uri($profile) { + if (!$profile) { + return NULL; + } + $user = User::staticGet($profile->id); + if ($user) { + return $user->uri; + } + + $remote = Remote_profile::staticGet($profile->id); + if ($remote) { + return $remote->uri; + } + # XXX: this is a very bad profile! + return NULL; +} \ No newline at end of file