X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Futil.php;h=62f7abc9ee6799f4c6740a02396c8e83d1cdfdde;hb=0876b60006da7f0ac2d6a4a01b50117a2ecca6b1;hp=40f2d4cd4de016aa1728a40dd6da4a9eef73c128;hpb=32136f978a7bfad8c261b633edaa1cb24a4dc133;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 40f2d4cd4d..62f7abc9ee 100644 --- a/lib/util.php +++ b/lib/util.php @@ -708,7 +708,7 @@ function common_local_url($action, $args=NULL) { function common_fancy_url($action, $args=NULL) { switch (strtolower($action)) { case 'public': - if ($args && $args['page']) { + if ($args && isset($args['page'])) { return common_path('?page=' . $args['page']); } else { return common_path(''); @@ -742,6 +742,8 @@ function common_fancy_url($action, $args=NULL) { return common_path('settings/email'); case 'openidsettings': return common_path('settings/openid'); + case 'smssettings': + return common_path('settings/sms'); case 'newnotice': if ($args && $args['replyto']) { return common_path('notice/new?replyto='.$args['replyto']); @@ -769,7 +771,7 @@ function common_fancy_url($action, $args=NULL) { case 'userrss': return common_path($args['nickname'].'/rss'); case 'showstream': - if ($args && $args['page']) { + if ($args && isset($args['page'])) { return common_path($args['nickname'].'?page=' . $args['page']); } else { return common_path($args['nickname']); @@ -889,6 +891,7 @@ function common_redirect($url, $code=307) { function common_save_replies($notice) { # Alternative reply format + $tname = false; if (preg_match('/^T ([A-Z0-9]{1,64}) /', $notice->content, $match)) { $tname = $match[1]; } @@ -970,7 +973,13 @@ function common_real_broadcast($notice, $remote=false) { common_log(LOG_ERR, 'Error in jabber broadcast for notice ' . $notice->id); } } - // XXX: broadcast notices to SMS + if ($success) { + require_once(INSTALLDIR.'/lib/mail.php'); + $success = mail_broadcast_notice_sms($notice); + if (!$success) { + common_log(LOG_ERR, 'Error in sms broadcast for notice ' . $notice->id); + } + } // XXX: broadcast notices to other IM return $success; } @@ -1318,4 +1327,10 @@ function common_profile_uri($profile) { } # XXX: this is a very bad profile! return NULL; +} + +function common_canonical_sms($sms) { + # strip non-digits + preg_replace('/\D/', '', $sms); + return $sms; } \ No newline at end of file