]> git.mxchange.org Git - friendica.git/blobdiff - mod/contacts.php
begin invites, fb setup changes
[friendica.git] / mod / contacts.php
index e7a800500bcbfdaf0b12e2f47571f49c948acb91..388bf08e6389499de19974567dd7808772b7f32f 100644 (file)
@@ -3,16 +3,30 @@
 require_once('include/Contact.php');
 
 function contacts_init(&$a) {
+       if(! local_user())
+               return;
+
        require_once('include/group.php');
        if(! x($a->page,'aside'))
                $a->page['aside'] = '';
        $a->page['aside'] .= group_side();
 
-       if($a->config['register_policy'] != REGISTER_CLOSED)
-               $a->page['aside'] .= '<div class="side-link" id="side-invite-link" ><a href="invite" >' . t("Invite Friends") . '</a></div>';
+       $inv = '<div class="side-link" id="side-invite-link" ><a href="invite" >' . t("Invite Friends") . '</a></div>';
 
-       if(strlen(get_config('system','directory_submit_url')))
-               $a->page['aside'] .= '<div class="side-link" id="side-match-link"><a href="match" >' . t('Find People With Shared Interests') . '</a></div>';
+       if(get_config('system','invitations_only')) {
+               $x = get_pconfig(local_user(),'system','invites_remaining');
+               if($x || is_site_admin()) {
+                       $a->page['aside'] .= '<div class="side-link" id="side-invite-remain">' 
+                       . sprintf( tt('%d invitation available','%d invitations available',$x), $x) 
+                       . '</div>' . $inv;
+               }
+       }
+       elseif($a->config['register_policy'] != REGISTER_CLOSED)
+               $a->page['aside'] .= $inv;
+
+
+       $a->page['aside'] .= '<div class="side-link" id="side-match-link"><a href="match" >' 
+               . t('Find People With Shared Interests') . '</a></div>';
 
        $tpl = get_markup_template('follow.tpl');
        $a->page['aside'] .= replace_macros($tpl,array(
@@ -268,6 +282,10 @@ function contacts_content(&$a) {
                if($r[0]['last-update'] !== '0000-00-00 00:00:00')
                        $last_update .= ' ' . (($r[0]['last-update'] == $r[0]['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
 
+               $lblsuggest = (($r[0]['network'] === NETWORK_DFRN) 
+                       ? '<div id="contact-suggest-wrapper"><a href="fsuggest/' . $r[0]['id'] . '" id="contact-suggest">' . t('Suggest friends') . '</a></div>' : '');
+
+
                $o .= replace_macros($tpl,array(
                        '$header' => t('Contact Editor'),
                        '$submit' => t('Submit'),
@@ -284,6 +302,7 @@ function contacts_content(&$a) {
                        '$altcrepair' => t('Repair contact URL settings'),
                        '$lblcrepair' => t("Repair contact URL settings \x28WARNING: Advanced\x29"),
                        '$lblrecent' => t('View conversations'),
+                       '$lblsuggest' => $lblsuggest,
                        '$grps' => $grps,
                        '$delete' => t('Delete contact'),
                        '$poll_interval' => contact_poll_interval($r[0]['priority']),