]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
rewrite for settings of sms
[quix0rs-gnu-social.git] / lib / util.php
index 40f2d4cd4de016aa1728a40dd6da4a9eef73c128..62f7abc9ee6799f4c6740a02396c8e83d1cdfdde 100644 (file)
@@ -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