]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
more ajax coming (un-sub)
[quix0rs-gnu-social.git] / lib / util.php
index e958a87babf867b1162fcf66a75f8ad51c46f28c..8fff5f605b09d658ff50748159aa6eba7152620a 100644 (file)
@@ -317,7 +317,6 @@ function common_nav_menu() {
                                                 _('Home'));
        }
        common_menu_item(common_local_url('peoplesearch'), _('Search'));
-       common_menu_item(common_local_url('tags'), _('Tags'));
        if ($user) {
                common_menu_item(common_local_url('profilesettings'),
                                                 _('Settings'));
@@ -948,10 +947,26 @@ function common_fancy_url($action, $args=NULL) {
                } else {
                        return common_path('');
                }
+        case 'featured':
+               if ($args && isset($args['page'])) {
+                       return common_path('featured?page=' . $args['page']);
+               } else {
+                       return common_path('featured');
+               }
+        case 'favorited':
+               if ($args && isset($args['page'])) {
+                       return common_path('favorited?page=' . $args['page']);
+               } else {
+                       return common_path('favorited');
+               }
         case 'publicrss':
                return common_path('rss');
         case 'publicxrds':
                return common_path('xrds');
+        case 'featuredrss':
+               return common_path('featuredrss');
+        case 'favoritedrss':
+               return common_path('favoritedrss');
         case 'opensearch':
                 if ($args && $args['type']) {
                         return common_path('opensearch/'.$args['type']);
@@ -978,6 +993,8 @@ function common_fancy_url($action, $args=NULL) {
                } else {
                        return common_path('main/remote');
                }
+        case 'nudge':
+               return common_path($args['nickname'].'/nudge');
         case 'openidlogin':
                return common_path('main/openid');
         case 'profilesettings':
@@ -1009,8 +1026,6 @@ function common_fancy_url($action, $args=NULL) {
         case 'xrds':
         case 'foaf':
                return common_path($args['nickname'].'/'.$action);
-        case 'subscriptions':
-        case 'subscribers':
         case 'all':
         case 'replies':
         case 'inbox':
@@ -1020,6 +1035,16 @@ function common_fancy_url($action, $args=NULL) {
                } else {
                        return common_path($args['nickname'].'/'.$action);
                }
+        case 'subscriptions':
+        case 'subscribers':
+               $nickname = $args['nickname'];
+               unset($args['nickname']);
+               $params = http_build_query($args);
+               if ($params) {
+                       return common_path($nickname.'/'.$action . '?' . $params);
+               } else {
+                       return common_path($nickname.'/'.$action);
+               }
         case 'allrss':
                return common_path($args['nickname'].'/all/rss');
         case 'repliesrss':
@@ -1088,11 +1113,11 @@ function common_fancy_url($action, $args=NULL) {
                        switch (strtolower($args['method'])) {
                         case 'user_timeline.rss':
                                return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
-                        case 'user_timeline.atom':                             
+                        case 'user_timeline.atom':
                                return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
                         case 'user_timeline.rss':
                                return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
-                        case 'user_timeline.atom':                             
+                        case 'user_timeline.atom':
                                return common_path('api/statuses/user_timeline/'.$args['argument'].'.rss');
                         default: return common_simple_url($action, $args);
                        }
@@ -1100,7 +1125,7 @@ function common_fancy_url($action, $args=NULL) {
                }
         case 'sup':
                if ($args && isset($args['seconds'])) {
-                       return common_path('main/sup?seconds='.$args['seconds']);                       
+                       return common_path('main/sup?seconds='.$args['seconds']);
                } else {
                        return common_path('main/sup');
                }
@@ -1264,7 +1289,7 @@ function common_save_replies($notice) {
 function common_broadcast_notice($notice, $remote=false) {
 
        // Check to see if notice should go to Twitter
-       $flink = Foreign_link::getForeignLink($notice->profile_id, 1); // 1 == Twitter
+       $flink = Foreign_link::getByUserID($notice->profile_id, 1); // 1 == Twitter
        if (($flink->noticesync & FOREIGN_NOTICE_SEND) == FOREIGN_NOTICE_SEND) {
 
                // If it's not a Twitter-style reply, or if the user WANTS to send replies...
@@ -1861,6 +1886,28 @@ function common_favor_form($notice) {
        common_element_end('form');
 }
 
+function common_nudge_form($profile) {
+       common_element_start('form', array('id' => 'nudge', 'method' => 'post',
+                                                                          'action' => common_local_url('nudge', array('nickname' => $profile->nickname))));
+       common_hidden('token', common_session_token());
+       common_element('input', array('type' => 'submit',
+                                                                 'class' => 'submit',
+                                                                 'value' => _('Send a nudge')));
+       common_element_end('form');
+}
+
+function common_subscribe_response() {
+       common_element('p', array('id' => 'subscribe_response'), _('Subscribed'));
+}
+
+function common_unsubscribe_response() {
+       common_element('p', array('id' => 'unsubscribe_response'), _('Unsubscribed'));
+}
+
+function common_nudge_response() {
+       common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
+}
+
 function common_cache_key($extra) {
        return 'laconica:' . common_keyize(common_config('site', 'name')) . ':' . $extra;
 }