diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Contact.php | 18 | ||||
-rw-r--r-- | include/bbcode.php | 15 | ||||
-rw-r--r-- | include/comanche.php | 5 | ||||
-rw-r--r-- | include/contact_selectors.php | 2 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rwxr-xr-x | include/diaspora.php | 4 | ||||
-rw-r--r-- | include/dir_fns.php | 61 | ||||
-rw-r--r-- | include/event.php | 150 | ||||
-rw-r--r-- | include/identity.php | 35 | ||||
-rwxr-xr-x | include/items.php | 32 | ||||
-rw-r--r-- | include/network.php | 4 | ||||
-rw-r--r-- | include/photo/photo_driver.php | 8 | ||||
-rw-r--r-- | include/security.php | 6 | ||||
-rw-r--r-- | include/taxonomy.php | 4 | ||||
-rw-r--r-- | include/text.php | 2 | ||||
-rw-r--r-- | include/widgets.php | 4 | ||||
-rw-r--r-- | include/zot.php | 29 |
17 files changed, 300 insertions, 81 deletions
diff --git a/include/Contact.php b/include/Contact.php index 9490fd2da..035e83a82 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -311,6 +311,24 @@ function channel_remove($channel_id, $local = true, $unset_session=true) { intval(PAGE_REMOVED), intval($channel_id) ); + // if this was the default channel, set another one as default + if($a->account['account_default_channel'] == $channel_id) { + $r = q("select channel_id from channel where channel_account_id = %d and not ( channel_pageflags & %d)>0 limit 1", + intval($a->account['account_id']), + intval(PAGE_REMOVED)); + if ($r) { + $rr = q("update account set account_default_channel = %d where account_id = %d", + intval($r[0]['channel_id']), + intval($a->account['account_id'])); + logger("Default channel deleted, changing default to channel_id " . $r[0]['channel_id']); + } + else { + $rr = q("update account set account_default_channel = 0 where account_id = %d", + intval($r[0]['channel_id']), + intval($a->account['account_id'])); + } + } + $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s' and hubloc_url = '%s' ", intval(HUBLOC_FLAGS_DELETED), diff --git a/include/bbcode.php b/include/bbcode.php index e248c3771..6fc481fff 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -174,10 +174,14 @@ function bb_parse_app($match) { function bb_parse_element($match) { $j = json_decode(base64url_decode($match[1]),true); - if ($j) { + if ($j && local_channel()) { $text = sprintf( t('Install %s element: '), translate_design_element($j['type'])) . $j['pagetitle']; $o = EOL . '<a href="#" onclick="importElement(\'' . $match[1] . '\'); return false;" >' . $text . '</a>' . EOL; } + else { + $text = sprintf( t('This post contains an installable %s element, however you lack permissions to install it on this site.' ), translate_design_element($j['type'])) . $j['pagetitle']; + $o = EOL . $text . EOL; + } return $o; } @@ -922,14 +926,21 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true) { // start which is always required). Allow desc with a missing summary for compatibility. if ((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) { + $sub = format_event_html($ev); + $sub = str_replace('$',"\0",$sub); + + $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text); + $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text); $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text); - $Text = preg_replace("/\[event\-start\](.*?)\[\/event\-start\]/ism",$sub,$Text); $Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text); $Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text); $Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text); + + $Text = str_replace("\0",'$',$Text); + } // Unhide all [noparse] contained bbtags unspacefying them diff --git a/include/comanche.php b/include/comanche.php index cb46985eb..49b910bdb 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -284,6 +284,11 @@ function comanche_widget($name, $text) { if(file_exists('widget/' . trim($name) . '.php')) require_once('widget/' . trim($name) . '.php'); + else { + $theme_widget = 'widget_' . trim($name) . '.php'; + if(theme_include($theme_widget)) + require_once(theme_include($theme_widget)); + } $func = 'widget_' . trim($name); if (function_exists($func)) diff --git a/include/contact_selectors.php b/include/contact_selectors.php index 726efce9d..8671f1bd1 100644 --- a/include/contact_selectors.php +++ b/include/contact_selectors.php @@ -5,7 +5,7 @@ function contact_profile_assign($current) { $o = ''; - $o .= "<select id=\"contact-profile-selector\" name=\"profile_assign\" />\r\n"; + $o .= "<select id=\"contact-profile-selector\" name=\"profile_assign\" class=\"form-control\"/>\r\n"; $r = q("SELECT profile_guid, profile_name FROM `profile` WHERE `uid` = %d", intval($_SESSION['uid'])); diff --git a/include/conversation.php b/include/conversation.php index fb012667e..76a2f47d1 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -597,7 +597,7 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $ if($arr_blocked) { $blocked = false; foreach($arr_blocked as $b) { - if(($b) && ($item['author_xchan'] == $b)) { + if(($b) && (($item['author_xchan'] == $b) || ($item['owner_xchan'] == $b))) { $blocked = true; break; } diff --git a/include/diaspora.php b/include/diaspora.php index cf8d89023..74a56dd79 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1009,6 +1009,10 @@ function diaspora_post($importer,$xml,$msg) { return 202; } + if(! post_is_importable($datarray,$contact)) { + logger('diaspora_post: filtering this author.'); + return 202; + } $result = item_store($datarray); return; diff --git a/include/dir_fns.php b/include/dir_fns.php index 77c78558c..83073154a 100644 --- a/include/dir_fns.php +++ b/include/dir_fns.php @@ -72,33 +72,20 @@ function check_upstream_directory() { set_config('system', 'directory_server', ''); } -function get_globaldir_setting($observer) { - - if($observer) - $globaldir = get_xconfig($observer,'directory','globaldir'); - else - $globaldir = ((array_key_exists('globaldir',$_SESSION)) ? intval($_SESSION['globaldir']) : false); - - if($globaldir === false) - $globaldir = get_config('directory','globaldir'); - - return $globaldir; -} - -function get_safemode_setting($observer) { +function get_directory_setting($observer, $setting) { if ($observer) - $safe_mode = get_xconfig($observer,'directory','safe_mode'); + $ret = get_xconfig($observer, 'directory', $setting); else - $safe_mode = ((array_key_exists('safemode',$_SESSION)) ? intval($_SESSION['safemode']) : false); + $ret = ((array_key_exists($setting,$_SESSION)) ? intval($_SESSION[$setting]) : false); - if($safe_mode === false) - $safe_mode = get_config('directory','safe_mode'); + if($ret === false) + $ret = get_config('directory', $setting); - if($safe_mode === false) - $safe_mode = 1; + if($setting == 'safemode' && $ret === false) + $ret = 1; - return $safe_mode; + return $ret; } /** @@ -110,49 +97,37 @@ function dir_sort_links() { $observer = get_observer_hash(); - $safe_mode = get_safemode_setting($observer); - $globaldir = get_globaldir_setting($observer); + $safe_mode = get_directory_setting($observer, 'safemode'); + $globaldir = get_directory_setting($observer, 'globaldir'); + $pubforums = get_directory_setting($observer, 'pubforums'); // Build urls without order and pubforums so it's easy to tack on the changed value // Probably there's an easier way to do this - $directory_sort_order = get_config('system','directory_sort_order'); if(! $directory_sort_order) $directory_sort_order = 'date'; - $current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : $directory_sort_order); - $url = 'directory?f='; + $suggest = (($_REQUEST['suggest']) ? '&suggest=' . $_REQUEST['suggest'] : ''); - $tmp = array_merge($_GET,$_POST); - unset($tmp['order']); - unset($tmp['q']); - unset($tmp['f']); - $sorturl = $url . http_build_query($tmp); + $url = 'directory?f='; $tmp = array_merge($_GET,$_POST); + unset($tmp['suggest']); unset($tmp['pubforums']); unset($tmp['global']); unset($tmp['safe']); unset($tmp['q']); unset($tmp['f']); - $forumsurl = $url . http_build_query($tmp); + $forumsurl = $url . http_build_query($tmp) . $suggest; $o = replace_macros(get_markup_template('dir_sort_links.tpl'), array( '$header' => t('Directory Options'), - '$normal' => t('Alphabetic'), - '$reverse' => t('Reverse Alphabetic'), - '$date' => t('Newest to Oldest'), - '$reversedate' => t('Oldest to Newest'), - '$sort' => t('Sort'), - '$selected_sort' => $current_order, - '$sorturl' => $sorturl, '$forumsurl' => $forumsurl, - '$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'','',' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''), - - '$pubforums' => array('pubforums', t('Public Forums Only'),(x($_REQUEST,'pubforums') ? $_REQUEST['pubforums'] : ''),'','',' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''), - '$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'','',' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''), + '$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''), + '$pubforums' => array('pubforums', t('Public Forums Only'),$pubforums,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''), + '$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''), )); return $o; diff --git a/include/event.php b/include/event.php index 0b1e56ae2..134c23aa2 100644 --- a/include/event.php +++ b/include/event.php @@ -1,4 +1,6 @@ <?php +use Sabre\VObject; + /** * @file include/event.php */ @@ -16,6 +18,7 @@ function format_event_html($ev) { if(! ((is_array($ev)) && count($ev))) return ''; + $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8:01 AM $o = '<div class="vevent">' . "\r\n"; @@ -90,6 +93,7 @@ function format_event_ical($ev) { $o .= "\nLOCATION:" . format_ical_text($ev['location']); if($ev['description']) $o .= "\nDESCRIPTION:" . format_ical_text($ev['description']); + $o .= "\nUID:" . $ev['event_hash'] ; $o .= "\nEND:VEVENT\n"; return $o; @@ -100,7 +104,7 @@ function format_ical_text($s) { require_once('include/bbcode.php'); require_once('include/html2plain.php'); - return(wordwrap(html2plain(bbcode($s)),72,"\n ",true)); + return(wordwrap(str_replace(',','\\,',html2plain(bbcode($s))),72,"\n ",true)); } @@ -162,7 +166,18 @@ function bbtoevent($s) { $match = ''; if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) $ev['adjust'] = $match[1]; - $ev['nofinish'] = (((x($ev, 'start') && $ev['start']) && (!x($ev, 'finish') || !$ev['finish'])) ? 1 : 0); + if(array_key_exists('start',$ev)) { + if(array_key_exists('finish',$ev)) { + if($ev['finish'] === $ev['start']) + $ev['nofinish'] = 1; + elseif($ev['finish']) + $ev['nofinish'] = 0; + else + $ev['nofinish'] = 1; + } + else + $ev['nofinish'] = 1; + } return $ev; } @@ -208,6 +223,7 @@ function event_store_event($arr) { $arr['type'] = (($arr['type']) ? $arr['type'] : 'event' ); $arr['event_xchan'] = (($arr['event_xchan']) ? $arr['event_xchan'] : ''); + // Existing event being modified if($arr['id'] || $arr['event_hash']) { @@ -275,7 +291,11 @@ function event_store_event($arr) { // New event. Store it. - $hash = random_string(); + + if(array_key_exists('external_id',$arr)) + $hash = $arr['external_id']; + else + $hash = random_string() . '@' . get_app()->get_hostname(); $r = q("INSERT INTO event ( uid,aid,event_xchan,event_hash,created,edited,start,finish,summary,description,location,type, adjust,nofinish,allow_cid,allow_gid,deny_cid,deny_gid) @@ -364,6 +384,130 @@ function event_addtocal($item_id, $uid) { } +function parse_ical_file($f,$uid) { +require_once('vendor/autoload.php'); + + $s = @file_get_contents($f); + + // Change the current timezone to something besides UTC. + // Doesn't matter what it is, as long as it isn't UTC. + // Save the current timezone so we can reset it when we're done processing. + + $saved_timezone = date_default_timezone_get(); + date_default_timezone_set('Australia/Sydney'); + + $ical = VObject\Reader::read($s); + + if($ical) { + foreach($ical->VEVENT as $event) { + event_import_ical($event,$uid); + + } + } + + date_default_timezone_set($saved_timezone); + + if($ical) + return true; + return false; +} + + + +function event_import_ical($ical, $uid) { + + $c = q("select * from channel where channel_id = %d limit 1", + intval($uid) + ); + + if(! $c) + return false; + + $channel = $c[0]; + $ev = array(); + + + if(! isset($ical->DTSTART)) { + logger('no event start'); + return false; + } + + $dtstart = $ical->DTSTART->getDateTime(); + +// logger('dtstart: ' . var_export($dtstart,true)); + + if(($dtstart->timezone_type == 2) || (($dtstart->timezone_type == 3) && ($dtstart->timezone === 'UTC'))) { + $ev['adjust'] = 1; + } + else { + $ev['adjust'] = 0; + } + + $ev['start'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC', + $dtstart->format(\DateTime::W3C)); + + + if(isset($ical->DTEND)) { + $dtend = $ical->DTEND->getDateTime(); + $ev['finish'] = datetime_convert((($ev['adjust']) ? 'UTC' : date_default_timezone_get()),'UTC', + $dtend->format(\DateTime::W3C)); + } + else + $ev['nofinish'] = 1; + + + if($ev['start'] === $ev['finish']) + $ev['nofinish'] = 1; + + if(isset($ical->CREATED)) { + $created = $ical->CREATED->getDateTime(); + $ev['created'] = datetime_convert('UTC','UTC',$created->format(\DateTime::W3C)); + } + + if(isset($ical->{'LAST-MODIFIED'})) { + $edited = $ical->{'LAST-MODIFIED'}->getDateTime(); + $ev['edited'] = datetime_convert('UTC','UTC',$edited->format(\DateTime::W3C)); + } + + if(isset($ical->LOCATION)) + $ev['location'] = (string) $ical->LOCATION; + if(isset($ical->DESCRIPTION)) + $ev['description'] = (string) $ical->DESCRIPTION; + if(isset($ical->SUMMARY)) + $ev['summary'] = (string) $ical->SUMMARY; + + if(isset($ical->UID)) { + $evuid = (string) $ical->UID; + $r = q("SELECT * FROM event WHERE event_hash = '%s' AND uid = %d LIMIT 1", + dbesc($evuid), + intval($uid) + ); + if($r) + $ev['event_hash'] = $evuid; + else + $ev['external_id'] = $evuid; + } + + if($ev['summary'] && $ev['start']) { + $ev['event_xchan'] = $channel['channel_hash']; + $ev['uid'] = $channel['channel_id']; + $ev['account'] = $channel['channel_account_id']; + $ev['private'] = 1; + $ev['allow_cid'] = '<' . $channel['channel_hash'] . '>'; + + logger('storing event: ' . print_r($ev,true), LOGGER_ALL); + $event = event_store_event($ev); + if($event) { + $item_id = event_store_item($ev,$event); + return true; + } + } + + return false; + +} + + function event_store_item($arr, $event) { require_once('include/datetime.php'); diff --git a/include/identity.php b/include/identity.php index 29d9ef022..5a3861b31 100644 --- a/include/identity.php +++ b/include/identity.php @@ -583,7 +583,7 @@ function identity_basic_export($channel_id, $items = false) { /** @warning this may run into memory limits on smaller systems */ - $r = q("select * from item where (item_flags & %d)>0 and not (item_restrict & %d)>0 and uid = %d", + $r = q("select * from item where (item_flags & %d)>0 and not (item_restrict & %d)>0 and uid = %d order by created", intval(ITEM_WALL), intval(ITEM_DELETED), intval($channel_id) @@ -600,6 +600,35 @@ function identity_basic_export($channel_id, $items = false) { } + +function identity_export_year($channel_id,$year) { + + if(! $year) + return array(); + + $ret = array(); + $mindate = datetime_convert('UTC','UTC',$year . '-01-01 00:00:00'); + $maxdate = datetime_convert('UTC','UTC',$year+1 . '-01-01 00:00:00'); + $r = q("select * from item where (item_flags & %d) > 0 and (item_restrict & %d) = 0 and uid = %d and created >= '%s' and created < '%s' order by created ", + intval(ITEM_WALL), + intval(ITEM_DELETED), + intval($channel_id), + dbesc($mindate), + dbesc($maxdate) + ); + + if($r) { + $ret['item'] = array(); + xchan_query($r); + $r = fetch_post_tags($r,true); + foreach($r as $rr) + $ret['item'][] = encode_item($rr,true); + } + + return $ret; +} + + /** * @brief Loads a profile into the App structure. * @@ -1364,10 +1393,10 @@ function get_theme_uid() { * with the specified size. * * @param int $size -* one of (175, 80, 48) +* one of (300, 80, 48) * @returns string */ -function get_default_profile_photo($size = 175) { +function get_default_profile_photo($size = 300) { $scheme = get_config('system','default_profile_photo'); if(! $scheme) $scheme = 'rainbow_man'; diff --git a/include/items.php b/include/items.php index 1009530a4..c807c1d5d 100755 --- a/include/items.php +++ b/include/items.php @@ -1198,12 +1198,15 @@ function encode_item($item,$mirror = false) { case 2: $x['item_restrict'] |= ITEM_PDL; break; - case 2: + case 3: $x['item_restrict'] |= ITEM_WEBPAGE; break; - case 2: + case 4: $x['item_restrict'] |= ITEM_BUG; break; + case 5: + $x['item_restrict'] |= ITEM_DOC; + break; default: break; } @@ -2654,11 +2657,12 @@ function item_store_update($arr,$allow_exec = false) { return $ret; } + $r = q("delete from term where oid = %d and otype = %d", + intval($orig_post_id), + intval(TERM_OBJ_POST) + ); + if(is_array($terms)) { - $r = q("delete from term where oid = %d and otype = %d", - intval($orig_post_id), - intval(TERM_OBJ_POST) - ); foreach($terms as $t) { q("insert into term (uid,oid,otype,type,term,url) values(%d,%d,%d,%d,'%s','%s') ", @@ -2670,7 +2674,6 @@ function item_store_update($arr,$allow_exec = false) { dbesc($t['url']) ); } - $arr['term'] = $terms; } @@ -3370,14 +3373,18 @@ function post_is_importable($item,$abook) { if(! $item) return false; - if((! $abook['abook_incl']) && (! $abook['abook_excl'])) + if(! ($abook['abook_incl'] || $abook['abook_excl'])) return true; - require_once('include/html2plain.php'); $text = prepare_text($item['body'],$item['mimetype']); $text = html2plain($text); + $lang = null; + + if((strpos($abook['abook_incl'],'lang=') !== false) || (strpos($abook['abook_excl'],'lang=') !== false)) { + $lang = detect_language($text); + } $tags = ((count($item['term'])) ? $item['term'] : false); // exclude always has priority @@ -3394,6 +3401,8 @@ function post_is_importable($item,$abook) { } elseif((strpos($word,'/') === 0) && preg_match($word,$body)) return false; + elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0)) + return false; elseif(stristr($text,$word) !== false) return false; } @@ -3411,6 +3420,8 @@ function post_is_importable($item,$abook) { } elseif((strpos($word,'/') === 0) && preg_match($word,$body)) return true; + elseif((strpos($word,'lang=') === 0) && ($lang) && (strcasecmp($lang,trim(substr($word,5))) == 0)) + return true; elseif(stristr($text,$word) !== false) return true; } @@ -3751,6 +3762,9 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { $author['owner_avatar'] = $contact['thumb']; } + if(! post_is_importable($datarray,$contact)) + continue; + logger('consume_feed: author ' . print_r($author,true),LOGGER_DEBUG); logger('consume_feed: ' . print_r($datarray,true),LOGGER_DATA); diff --git a/include/network.php b/include/network.php index 3abb1b40e..d9546a074 100644 --- a/include/network.php +++ b/include/network.php @@ -531,7 +531,7 @@ function avatar_img($email) { $avatar = array(); $a = get_app(); - $avatar['size'] = 175; + $avatar['size'] = 300; $avatar['email'] = $email; $avatar['url'] = ''; $avatar['success'] = false; @@ -1658,4 +1658,4 @@ function format_and_send_email($sender,$xchan,$item) { -}
\ No newline at end of file +} diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php index 6f508bf72..5d61556ab 100644 --- a/include/photo/photo_driver.php +++ b/include/photo/photo_driver.php @@ -606,16 +606,16 @@ function import_profile_photo($photo,$xchan,$thing = false) { if(($width / $height) > 1.2) { // crop out the sides $margin = $width - $height; - $img->cropImage(175,($margin / 2),0,$height,$height); + $img->cropImage(300,($margin / 2),0,$height,$height); } elseif(($height / $width) > 1.2) { // crop out the bottom $margin = $height - $width; - $img->cropImage(175,0,0,$width,$width); + $img->cropImage(300,0,0,$width,$width); } else { - $img->scaleImageSquare(175); + $img->scaleImageSquare(300); } } @@ -682,7 +682,7 @@ function import_channel_photo($photo,$type,$aid,$uid) { $img = photo_factory($photo, $type); if($img->is_valid()) { - $img->scaleImageSquare(175); + $img->scaleImageSquare(300); $p = array('aid' => $aid, 'uid' => $uid, 'resource_id' => $hash, 'filename' => $filename, 'album' => t('Profile Photos'), 'photo_flags' => PHOTO_PROFILE, 'scale' => 4); diff --git a/include/security.php b/include/security.php index 91683cc98..bad39d805 100644 --- a/include/security.php +++ b/include/security.php @@ -422,6 +422,9 @@ function stream_perms_api_uids($perms = NULL, $limit = 0, $rand = 0 ) { $str .= intval($rr); } } + else + $str = "''"; + logger('stream_perms_api_uids: ' . $str, LOGGER_DEBUG); return $str; @@ -452,6 +455,9 @@ function stream_perms_xchans($perms = NULL ) { $str .= "'" . dbesc($rr) . "'"; } } + else + $str = "''"; + logger('stream_perms_xchans: ' . $str, LOGGER_DEBUG); return $str; diff --git a/include/taxonomy.php b/include/taxonomy.php index fa540ac56..a5da190d4 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -276,7 +276,7 @@ function dir_tagblock($link,$r) { $o = ''; $observer = get_observer_hash(); - if(! get_globaldir_setting($observer)) + if(! get_directory_setting($observer, 'globaldir')) return $o; @@ -407,4 +407,4 @@ function get_things($profile_hash,$uid) { //logger('things: ' . print_r($sorted_things,true)); return $sorted_things; -}
\ No newline at end of file +} diff --git a/include/text.php b/include/text.php index 7101d76da..02a038ef4 100644 --- a/include/text.php +++ b/include/text.php @@ -807,7 +807,7 @@ function contact_block() { $shown = get_pconfig($a->profile['uid'],'system','display_friend_count'); if($shown === false) - $shown = 24; + $shown = 25; if($shown == 0) return; diff --git a/include/widgets.php b/include/widgets.php index 4a9032a21..032b1c67e 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -132,7 +132,7 @@ function widget_suggestions($arr) { 'profile' => $rr['xchan_url'], 'name' => $rr['xchan_name'], 'photo' => $rr['xchan_photo_m'], - 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'], + 'ignlnk' => z_root() . '/directory?ignore=' . $rr['xchan_hash'], 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'ignore' => t('Ignore/Hide') @@ -381,6 +381,7 @@ function widget_categories($arr) { $srchurl = str_replace(array('?f=','&f='),array('',''),$srchurl); return categories_widget($srchurl, $cat); + } function widget_tagcloud_wall($arr) { @@ -409,6 +410,7 @@ function widget_catcloud_wall($arr) { $limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50); return catblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], ITEM_WALL); + } diff --git a/include/zot.php b/include/zot.php index 34e7f3e42..a677da808 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1110,13 +1110,18 @@ function zot_import($arr, $sender_url) { logger('specific recipients'); $recip_arr = array(); foreach($i['notify']['recipients'] as $recip) { - $recip_arr[] = make_xchan_hash($recip['guid'],$recip['guid_sig']); + if(is_array($recip)) { + $recip_arr[] = make_xchan_hash($recip['guid'],$recip['guid_sig']); + } + } + $r = false; + if($recip_arr) { + stringify_array_elms($recip_arr); + $recips = implode(',',$recip_arr); + $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and not ( channel_pageflags & %d ) > 0 ", + intval(PAGE_REMOVED) + ); } - stringify_array_elms($recip_arr); - $recips = implode(',',$recip_arr); - $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and not ( channel_pageflags & %d ) > 0 ", - intval(PAGE_REMOVED) - ); if(! $r) { logger('recips: no recipients on this site'); continue; @@ -1272,7 +1277,8 @@ function public_recips($msg) { $include_sys = false; if($msg['message']['type'] === 'activity') { - $include_sys = true; + if(! get_config('system','disable_discover_tab')) + $include_sys = true; $col = 'channel_w_stream'; $field = PERMS_W_STREAM; if(array_key_exists('flags',$msg['message']) && in_array('thread_parent', $msg['message']['flags'])) { @@ -2887,7 +2893,12 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) { - $disallowed = array('channel_id','channel_account_id','channel_primary','channel_prvkey', 'channel_address', 'channel_notifyflags'); + if(array_key_exists('channel_removed',$arr['channel'])) + $arr['channel_pageflags'] |= PAGE_REMOVED; + if(array_key_exists('channel_system',$arr['channel'])) + $arr['channel_pageflags'] |= PAGE_SYSTEM; + + $disallowed = array('channel_id','channel_account_id','channel_primary','channel_prvkey', 'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_system'); $clean = array(); foreach($arr['channel'] as $k => $v) { @@ -3200,7 +3211,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } if(count($clean)) { foreach($clean as $k => $v) { - $r = dbq("UPDATE profile set " . dbesc($k) . " = '" . dbesc($v) + $r = dbq("UPDATE profile set `" . dbesc($k) . "` = '" . dbesc($v) . "' where profile_guid = '" . dbesc($profile['profile_guid']) . "' and uid = " . intval($channel['channel_id'])); } } |