X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=197b6d2381c98c9dd8927379f068d138f05b67c2;hb=31d447126aefbe1bdb14ed5a4a6b7d84845e9f29;hp=57d69a5e1fb1480ca435ff9cba7e89a6bceac56d;hpb=2f532f579c8b3a7052f67c72af901bf2926a85bf;p=friendica.git diff --git a/boot.php b/boot.php index 57d69a5e1f..197b6d2381 100644 --- a/boot.php +++ b/boot.php @@ -2,7 +2,7 @@ set_time_limit(0); -define ( 'BUILD_ID', 1029 ); +define ( 'BUILD_ID', 1030 ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); @@ -1199,11 +1199,12 @@ function set_pconfig($uid,$family,$key,$value) { return $ret; } $ret = q("UPDATE `pconfig` SET `v` = '%s' WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1", - intval($uid), dbesc($value), + intval($uid), dbesc($family), dbesc($key) ); + if($ret) return $value; return $ret; @@ -1741,6 +1742,11 @@ if(! function_exists('contact_block')) { function contact_block() { $o = ''; $a = get_app(); + + $shown = get_pconfig($a->profile['uid'],'system','display_friend_count'); + if(! $shown) + $shown = 24; + if((! is_array($a->profile)) || ($a->profile['hide-friends'])) return $o; $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0", @@ -1753,8 +1759,9 @@ function contact_block() { $o .= '

' . t('No contacts') . '

'; return $o; } - $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT 24", - intval($a->profile['uid']) + $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT %d", + intval($a->profile['uid']), + intval($shown) ); if(count($r)) { $o .= '

' . $total . ' ' . t('Contacts') . '

'; @@ -1777,7 +1784,9 @@ function contact_block() { } - call_hooks('contact_block_end', $o); + $arr = array('contacts' => $r, 'output' => $o); + + call_hooks('contact_block_end', $arr); return $o; }} @@ -2046,6 +2055,14 @@ function profile_sidebar($profile) { if(! function_exists('register_hook')) { function register_hook($hook,$file,$function) { + $r = q("SELECT * FROM `hook` WHERE `hook` = '%s' AND `file` = '%s' AND `function` = '%s' LIMIT 1", + dbesc($hook), + dbesc($file), + dbesc($function) + ); + if(count($r)) + return true; + $r = q("INSERT INTO `hook` (`hook`, `file`, `function`) VALUES ( '%s', '%s', '%s' ) ", dbesc($hook), dbesc($file), @@ -2079,7 +2096,7 @@ function load_hooks() { if(! function_exists('call_hooks')) { -function call_hooks($name, $data = null) { +function call_hooks($name, &$data = null) { $a = get_app(); if(count($a->hooks)) {