minor cleanup

This commit is contained in:
Mike Macgirvin 2010-10-12 17:11:06 -07:00
parent 744edcf2ab
commit f1977d420e
2 changed files with 17 additions and 13 deletions

View file

@ -17,6 +17,11 @@ define ( 'REL_VIP', 1);
define ( 'REL_FAN', 2); define ( 'REL_FAN', 2);
define ( 'REL_BUD', 3); define ( 'REL_BUD', 3);
// Maximum number of "people who like (or don't like) this" we will list by name
define ( 'MAX_LIKERS', 75);
define ( 'NOTIFY_INTRO', 0x0001 ); define ( 'NOTIFY_INTRO', 0x0001 );
define ( 'NOTIFY_CONFIRM', 0x0002 ); define ( 'NOTIFY_CONFIRM', 0x0002 );
define ( 'NOTIFY_WALL', 0x0004 ); define ( 'NOTIFY_WALL', 0x0004 );
@ -841,7 +846,7 @@ function webfinger_dfrn($s) {
$links = webfinger($s); $links = webfinger($s);
if(count($links)) { if(count($links)) {
foreach($links as $link) foreach($links as $link)
if($link['@attributes']['rel'] == NAMESPACE_DFRN) if($link['@attributes']['rel'] === NAMESPACE_DFRN)
return $link['@attributes']['href']; return $link['@attributes']['href'];
} }
return ''; return '';
@ -1086,13 +1091,13 @@ function format_like($cnt,$arr,$type,$id) {
$o .= '<span class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');" >' $o .= '<span class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');" >'
. $cnt . ' ' . t('people') . '</span> ' . (($type === 'like') ? t('like this.') : t('don\'t like this.')) . EOL ; . $cnt . ' ' . t('people') . '</span> ' . (($type === 'like') ? t('like this.') : t('don\'t like this.')) . EOL ;
$total = count($arr); $total = count($arr);
if($total >= 75) if($total >= MAX_LIKERS)
$arr = array_slice($arr,0,74); $arr = array_slice($arr, 0, MAX_LIKERS - 1);
if($total < 75) if($total < MAX_LIKERS)
$arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1]; $arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1];
$str = implode(', ', $arr); $str = implode(', ', $arr);
if($total >= 75) if($total >= MAX_LIKERS)
$str .= t(', and ') . $total - 75 . t(' other people'); $str .= t(', and ') . $total - MAX_LIKERS . t(' other people');
$str .= (($type === 'like') ? t(' like this.') : t(' don\'t like this.')); $str .= (($type === 'like') ? t(' like this.') : t(' don\'t like this.'));
$o .= '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>'; $o .= '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
} }

View file

@ -80,13 +80,12 @@
$importer = $r[0]; $importer = $r[0];
if($debugging) if($debugging)
echo "IMPORTER: {$importer['name']}"; echo "IMPORTER: {$importer['name']}\n";
$last_update = (($contact['last-update'] === '0000-00-00 00:00:00') $last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
? datetime_convert('UTC','UTC','now - 30 days','Y-m-d\TH:i:s\Z') ? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME)
: datetime_convert('UTC','UTC',$contact['last-update'],'Y-m-d\TH:i:s\Z')); : datetime_convert('UTC','UTC',$contact['last-update'], ATOM_TIME)
);
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']); $idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
@ -160,8 +159,8 @@
$xml = post_url($contact['poll'],$postvars); $xml = post_url($contact['poll'],$postvars);
if($debugging) { if($debugging) {
echo "XML response:" . $xml . "\r\n"; echo "XML response:" . $xml . "\n";
echo "Length:" . strlen($xml) . "\r\n"; echo "Length:" . strlen($xml) . "\n";
} }
if(! strlen($xml)) if(! strlen($xml))