diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/admin.php | 42 | ||||
-rw-r--r-- | mod/chat.php | 4 | ||||
-rw-r--r-- | mod/editblock.php | 1 | ||||
-rw-r--r-- | mod/editlayout.php | 1 | ||||
-rw-r--r-- | mod/editpost.php | 1 | ||||
-rw-r--r-- | mod/editwebpage.php | 1 | ||||
-rwxr-xr-x | mod/events.php | 23 | ||||
-rw-r--r-- | mod/import.php | 69 | ||||
-rw-r--r-- | mod/import_items.php | 49 | ||||
-rw-r--r-- | mod/item.php | 38 | ||||
-rwxr-xr-x | mod/like.php | 31 | ||||
-rw-r--r-- | mod/menu.php | 8 | ||||
-rw-r--r-- | mod/mitem.php | 4 | ||||
-rw-r--r-- | mod/network.php | 19 | ||||
-rw-r--r-- | mod/photos.php | 2 | ||||
-rw-r--r-- | mod/profile_photo.php | 37 | ||||
-rw-r--r-- | mod/public.php | 8 | ||||
-rw-r--r-- | mod/rpost.php | 15 | ||||
-rw-r--r-- | mod/zfinger.php | 2 |
19 files changed, 182 insertions, 173 deletions
diff --git a/mod/admin.php b/mod/admin.php index 89207e4fa..2b7bb007d 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -84,48 +84,6 @@ function admin_content(&$a) { return login(false); } - /* - * Side bar links - */ - - // array( url, name, extra css classes ) - - $aside = array( - 'site' => array($a->get_baseurl(true)."/admin/site/", t("Site") , "site"), - 'users' => array($a->get_baseurl(true)."/admin/users/", t("Accounts") , "users"), - 'channels' => array($a->get_baseurl(true)."/admin/channels/", t("Channels") , "channels"), - 'plugins' => array($a->get_baseurl(true)."/admin/plugins/", t("Plugins") , "plugins"), - 'themes' => array($a->get_baseurl(true)."/admin/themes/", t("Themes") , "themes"), - 'queue' => array(z_root() . '/admin/queue', t('Inspect queue'), 'queue'), -// 'hubloc' => array($a->get_baseurl(true)."/admin/hubloc/", t("Server") , "server"), - 'profs' => array(z_root() . '/admin/profs', t('Profile Config'), 'profs'), - 'dbsync' => array($a->get_baseurl(true)."/admin/dbsync/", t('DB updates'), "dbsync") - - ); - - /* get plugins admin page */ - - $r = q("SELECT * FROM addon WHERE plugin_admin = 1"); - $aside['plugins_admin'] = array(); - foreach ($r as $h){ - $plugin = $h['name']; - $aside['plugins_admin'][] = array($a->get_baseurl(true) . '/admin/plugins/' . $plugin, $plugin, 'plugin'); - // temp plugins with admin - $a->plugins_admin[] = $plugin; - } - - $aside['logs'] = Array($a->get_baseurl(true)."/admin/logs/", t("Logs"), "logs"); - - $t = get_markup_template("admin_aside.tpl"); - $a->page['aside'] .= replace_macros( $t, array( - '$admin' => $aside, - '$admtxt' => t('Admin'), - '$plugadmtxt' => t('Plugin Features'), - '$logtxt' => t('Logs'), - '$h_pending' => t('User registrations waiting for confirmation'), - '$admurl'=> $a->get_baseurl(true)."/admin/" - )); - /* * Page content diff --git a/mod/chat.php b/mod/chat.php index c2c11d0ab..9ad58bc32 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -62,11 +62,13 @@ function chat_post(&$a) { chatroom_create($channel,$arr); - $x = q("select cr_id from chatroom where cr_name = '%s' and cr_uid = %d limit 1", + $x = q("select * from chatroom where cr_name = '%s' and cr_uid = %d limit 1", dbesc($room), intval(local_channel()) ); + create_sync_packet(0, array('chatroom' => $x)); + if($x) goaway(z_root() . '/chat/' . $channel['channel_address'] . '/' . $x[0]['cr_id']); diff --git a/mod/editblock.php b/mod/editblock.php index b4d954ef5..9269676b1 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -111,6 +111,7 @@ function editblock_content(&$a) { $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), + '$pretext' => '', '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'), '$geotag' => '', '$nickname' => $channel['channel_address'], diff --git a/mod/editlayout.php b/mod/editlayout.php index 6ea7f4100..fc68cfe3c 100644 --- a/mod/editlayout.php +++ b/mod/editlayout.php @@ -105,6 +105,7 @@ function editlayout_content(&$a) { $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), + '$pretext' => '', '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'), '$geotag' => $geotag, '$nickname' => $channel['channel_address'], diff --git a/mod/editpost.php b/mod/editpost.php index daca7c154..d4dc35ef8 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -47,6 +47,7 @@ function editpost_content(&$a) { $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), + '$pretext' => '', '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'), '$geotag' => $geotag, '$nickname' => $channel['channel_address'], diff --git a/mod/editwebpage.php b/mod/editwebpage.php index 974e8cc38..0192fd9c0 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -146,6 +146,7 @@ function editwebpage_content(&$a) { $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), + '$pretext' => '', '$ispublic' => ' ', // t('Visible to <strong>everybody</strong>'), '$geotag' => $geotag, '$nickname' => $channel['channel_address'], diff --git a/mod/events.php b/mod/events.php index 9120f8713..d76602a33 100755 --- a/mod/events.php +++ b/mod/events.php @@ -205,6 +205,23 @@ function events_post(&$a) { $item_id = event_store_item($datarray,$event); + if($item_id) { + $r = q("select * from item where id = %d", + intval($item_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $z = q("select * from event where event_hash = '%s' and uid = %d limit 1", + dbesc($r[0]['resource_id']), + intval($channel['channel_id']) + ); + if($z) { + build_sync_packet($channel['channel_id'],array('event_item' => array(encode_item($sync_item[0],true)),'event' => $z)); + } + } + } + if($share) proc_run('php',"include/notifier.php","event","$item_id"); @@ -528,6 +545,9 @@ function events_content(&$a) { dbesc($event_id), intval(local_channel()) ); + + $sync_event = $r[0]; + if($r) { $r = q("delete from event where event_hash = '%s' and uid = %d limit 1", dbesc($event_id), @@ -538,6 +558,9 @@ function events_content(&$a) { dbesc($event_id), intval(local_channel()) ); + $sync_event['event_deleted'] = 1; + build_sync_packet(0,array('event' => array($sync_event))); + info( t('Event removed') . EOL); } else { diff --git a/mod/import.php b/mod/import.php index c2ed82a0a..563967aa2 100644 --- a/mod/import.php +++ b/mod/import.php @@ -161,7 +161,6 @@ function import_post(&$a) { } - if($completed < 3) { if($data['photo']) { @@ -169,8 +168,8 @@ function import_post(&$a) { import_channel_photo(base64url_decode($data['photo']['data']),$data['photo']['type'],get_account_id(),$channel['channel_id']); } - if(is_array($data['profiles'])) - import_profiles($channel,$data['profiles']); + if(is_array($data['profile'])) + import_profiles($channel,$data['profile']); logger('import step 3'); $_SESSION['import_step'] = 3; @@ -433,65 +432,35 @@ function import_post(&$a) { if(is_array($data['obj'])) import_objs($channel,$data['obj']); + if(is_array($data['likes'])) + import_likes($channel,$data['likes']); + if(is_array($data['app'])) import_apps($channel,$data['app']); - $saved_notification_flags = notifications_off($channel['channel_id']); + if(is_array($data['chatroom'])) + import_chatrooms($channel,$data['chatroom']); - if($import_posts && array_key_exists('item',$data) && $data['item']) { + if(is_array($data['event'])) + import_events($channel,$data['event']); - foreach($data['item'] as $i) { - $item = get_item_elements($i); + if(is_array($data['event_item'])) + import_items($channel,$data['event_item']); - $r = q("select id, edited from item where mid = '%s' and uid = %d limit 1", - dbesc($item['mid']), - intval($channel['channel_id']) - ); - if($r) { - if($item['edited'] > $r[0]['edited']) { - $item['id'] = $r[0]['id']; - $item['uid'] = $channel['channel_id']; - item_store_update($item); - continue; - } - } - else { - $item['aid'] = $channel['channel_account_id']; - $item['uid'] = $channel['channel_id']; - $item_result = item_store($item); - } + if(is_array($data['menu'])) + import_menus($channel,$data['menu']); + - } + $saved_notification_flags = notifications_off($channel['channel_id']); - } + if($import_posts && array_key_exists('item',$data) && $data['item']) + import_items($channel,$data['item']); notifications_on($channel['channel_id'],$saved_notification_flags); - if(array_key_exists('item_id',$data) && $data['item_id']) { - foreach($data['item_id'] as $i) { - $r = q("select id from item where mid = '%s' and uid = %d limit 1", - dbesc($i['mid']), - intval($channel['channel_id']) - ); - if(! $r) - continue; - $z = q("select * from item_id where service = '%s' and sid = '%s' and iid = %d and uid = %d limit 1", - dbesc($i['service']), - dbesc($i['sid']), - intval($r[0]['id']), - intval($channel['channel_id']) - ); - if(! $z) { - q("insert into item_id (iid,uid,sid,service) values(%d,%d,'%s','%s')", - intval($r[0]['id']), - intval($channel['channel_id']), - dbesc($i['sid']), - dbesc($i['service']) - ); - } - } - } + if(array_key_exists('item_id',$data) && $data['item_id']) + import_item_ids($channel,$data['item_id']); // FIXME - ensure we have a self entry if somebody is trying to pull a fast one diff --git a/mod/import_items.php b/mod/import_items.php index 1e54c0deb..6b97939c9 100644 --- a/mod/import_items.php +++ b/mod/import_items.php @@ -1,5 +1,6 @@ <?php +require_once('include/import.php'); function import_items_post(&$a) { @@ -88,57 +89,13 @@ function import_items_post(&$a) { $saved_notification_flags = notifications_off($channel['channel_id']); if(array_key_exists('item',$data) && $data['item']) { - - foreach($data['item'] as $i) { - $item = get_item_elements($i); - - $r = q("select id, edited from item where mid = '%s' and uid = %d limit 1", - dbesc($item['mid']), - intval($channel['channel_id']) - ); - if($r) { - if($item['edited'] > $r[0]['edited']) { - $item['id'] = $r[0]['id']; - $item['uid'] = $channel['channel_id']; - item_store_update($item); - continue; - } - } - else { - $item['aid'] = $channel['channel_account_id']; - $item['uid'] = $channel['channel_id']; - $item_result = item_store($item); - } - - } - + import_items($channel,$data['item']); } notifications_on($channel['channel_id'],$saved_notification_flags); if(array_key_exists('item_id',$data) && $data['item_id']) { - foreach($data['item_id'] as $i) { - $r = q("select id from item where mid = '%s' and uid = %d limit 1", - dbesc($i['mid']), - intval($channel['channel_id']) - ); - if(! $r) - continue; - $z = q("select * from item_id where service = '%s' and sid = '%s' and iid = %d and uid = %d limit 1", - dbesc($i['service']), - dbesc($i['sid']), - intval($r[0]['id']), - intval($channel['channel_id']) - ); - if(! $z) { - q("insert into item_id (iid,uid,sid,service) values(%d,%d,'%s','%s')", - intval($r[0]['id']), - intval($channel['channel_id']), - dbesc($i['sid']), - dbesc($i['service']) - ); - } - } + import_item_ids($channel,$data['item_id']); } info( t('Import completed') . EOL); diff --git a/mod/item.php b/mod/item.php index c93560771..d0cf59091 100644 --- a/mod/item.php +++ b/mod/item.php @@ -805,6 +805,19 @@ function item_post(&$a) { update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); + if(! $parent) { + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $rid = q("select * from item_id where iid = %d", + intval($post_id) + ); + build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); + } + } if(! $nopush) proc_run('php', "include/notifier.php", 'edit_post', $post_id); @@ -884,14 +897,28 @@ function item_post(&$a) { // NOTREACHED } - if($parent) { + + update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); + + if(($parent) && ($parent != $post_id)) { // Store the comment signature information in case we need to relay to Diaspora $ditem = $datarray; $ditem['author'] = $observer; store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id, (($walltowall_comment) ? 1 : 0)); } - - update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); + else { + $r = q("select * from item where id = %d", + intval($post_id) + ); + if($r) { + xchan_query($r); + $sync_item = fetch_post_tags($r); + $rid = q("select * from item_id where iid = %d", + intval($post_id) + ); + build_sync_packet($uid,array('item' => array(encode_item($sync_item[0],true)),'item_id' => $rid)); + } + } $datarray['id'] = $post_id; $datarray['llink'] = $a->get_baseurl() . '/display/' . $channel['channel_address'] . '/' . $post_id; @@ -903,6 +930,11 @@ function item_post(&$a) { logger('post_complete'); + + + + + // figure out how to return, depending on from whence we came if($api_source) diff --git a/mod/like.php b/mod/like.php index 42ff9bb8a..ce8bc3063 100755 --- a/mod/like.php +++ b/mod/like.php @@ -219,13 +219,23 @@ function like_content(&$a) { ); if($z) { + $z[0]['deleted'] = 1; + build_sync_packet($ch[0]['channel_id'],array('likes' => $z)); + q("delete from likes where id = %d limit 1", intval($z[0]['id']) ); - drop_item($z[0]['iid'],false); - if($interactive) { - notice( t('Previous action reversed.') . EOL); - return $o; + if($z[0]['i_mid']) { + $r = q("select id from item where mid = '%s' and uid = %d limit 1", + dbesc($z[0]['i_mid']), + intval($ch[0]['channel_id']) + ); + if($r) + drop_item($r[0]['id'],false); + if($interactive) { + notice( t('Previous action reversed.') . EOL); + return $o; + } } killme(); } @@ -490,7 +500,18 @@ function like_content(&$a) { dbesc($obj_id), dbesc(($target) ? $target : $object) ); - }; + $r = q("select * from likes where liker = '%s' and likee = '%s' and i_mid = '%s' and verb = '%s' and target_type = '%s' and target_id = '%s' ", + dbesc($observer['xchan_hash']), + dbesc($ch[0]['channel_hash']), + dbesc($mid), + dbesc($activity), + dbesc(($tgttype)? $tgttype : $objtype), + dbesc($obj_id) + ); + if($r) + build_sync_packet($ch[0]['channel_id'],array('likes' => $r)); + + } proc_run('php',"include/notifier.php","like","$post_id"); diff --git a/mod/menu.php b/mod/menu.php index 7763c4ed1..bfc45adef 100644 --- a/mod/menu.php +++ b/mod/menu.php @@ -37,6 +37,7 @@ function menu_post(&$a) { $_REQUEST['menu_id'] = intval(argv(1)); $r = menu_edit($_REQUEST); if($r) { + menu_sync_packet($uid,get_observer_hash(),$menu_id); //info( t('Menu updated.') . EOL); goaway(z_root() . '/mitem/' . $menu_id . (($a->is_sys) ? '?f=&sys=1' : '')); } @@ -45,7 +46,9 @@ function menu_post(&$a) { } else { $r = menu_create($_REQUEST); - if($r) { + if($r) { + menu_sync_packet($uid,get_observer_hash(),$r); + //info( t('Menu created.') . EOL); goaway(z_root() . '/mitem/' . $r . (($a->is_sys) ? '?f=&sys=1' : '')); } @@ -56,6 +59,8 @@ function menu_post(&$a) { } + + function menu_content(&$a) { $uid = local_channel(); @@ -121,6 +126,7 @@ function menu_content(&$a) { if(intval(argv(1))) { if(argc() == 3 && argv(2) == 'drop') { + menu_sync_packet($uid,get_observer_hash(),intval(argv(1)),true); $r = menu_delete_id(intval(argv(1)),$uid); if(!$r) notice( t('Menu could not be deleted.'). EOL); diff --git a/mod/mitem.php b/mod/mitem.php index 0fadd1548..d6572bd56 100644 --- a/mod/mitem.php +++ b/mod/mitem.php @@ -64,6 +64,7 @@ function mitem_post(&$a) { $_REQUEST['mitem_id'] = $mitem_id; $r = menu_edit_item($_REQUEST['menu_id'],$uid,$_REQUEST); if($r) { + menu_sync_packet($uid,get_observer_hash(),$_REQUEST['menu_id']); //info( t('Menu element updated.') . EOL); goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . (($a->is_sys) ? '?f=&sys=1' : '')); } @@ -74,6 +75,7 @@ function mitem_post(&$a) { else { $r = menu_add_item($_REQUEST['menu_id'],$uid,$_REQUEST); if($r) { + menu_sync_packet($uid,get_observer_hash(),$_REQUEST['menu_id']); //info( t('Menu element added.') . EOL); if($_REQUEST['submit']) { goaway(z_root() . '/menu' . (($a->is_sys) ? '?f=&sys=1' : '')); @@ -202,7 +204,9 @@ function mitem_content(&$a) { $lockstate = (($mitem['allow_cid'] || $mitem['allow_gid'] || $mitem['deny_cid'] || $mitem['deny_gid']) ? 'lock' : 'unlock'); if(argc() == 4 && argv(3) == 'drop') { + menu_sync_packet($uid,get_observer_hash(),$mitem['mitem_menu_id']); $r = menu_del_item($mitem['mitem_menu_id'], $uid, intval(argv(2))); + menu_sync_packet($uid,get_observer_hash(),$mitem['mitem_menu_id']); if($r) info( t('Menu item deleted.') . EOL); else diff --git a/mod/network.php b/mod/network.php index d5e305687..53de975a4 100644 --- a/mod/network.php +++ b/mod/network.php @@ -115,6 +115,8 @@ function network_content(&$a, $update = 0, $load = false) { $file = ((x($_GET,'file')) ? $_GET['file'] : ''); + $deftag = ''; + if(x($_GET,'search') || x($_GET,'file')) $nouveau = true; if($cid) { @@ -130,7 +132,10 @@ function network_content(&$a, $update = 0, $load = false) { goaway($a->get_baseurl(true) . '/network'); // NOTREACHED } - $def_acl = array('allow_cid' => '<' . $r[0]['abook_xchan'] . '>'); + if($_GET['pf'] === '1') + $deftag = '@' . t('forum') . '+' . intval($cid) . '+'; + else + $def_acl = array('allow_cid' => '<' . $r[0]['abook_xchan'] . '>'); } if(! $update) { @@ -153,17 +158,21 @@ function network_content(&$a, $update = 0, $load = false) { 'deny_gid' => $channel['channel_deny_gid'] ); + $private_editing = ((($group || $cid) && (! intval($_GET['pf']))) ? true : false); + $x = array( 'is_owner' => true, 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], - 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), - 'acl' => populate_acl((($group || $cid) ? $def_acl : $channel_acl)), - 'bang' => (($group || $cid) ? '!' : ''), + 'lockstate' => (($private_editing || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl)), + 'bang' => (($private_editing) ? '!' : ''), 'visitor' => true, 'profile_uid' => local_channel() ); + if($deftag) + $x['pretext'] = $deftag; $status_editor = status_editor($a,$x); $o .= $status_editor; @@ -223,7 +232,7 @@ function network_content(&$a, $update = 0, $load = false) { if($r) { $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) $item_normal ) "; $title = replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => t('Connection: ') . $r[0]['xchan_name'] + '$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>' )); $o = $tabs; $o .= $title; diff --git a/mod/photos.php b/mod/photos.php index d06a8e69c..f48603d71 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -85,7 +85,7 @@ function photos_post(&$a) { $owner_record = $s[0]; - $acl = AccessList($a->data['channel']); + $acl = new AccessList($a->data['channel']); if((argc() > 3) && (argv(2) === 'album')) { diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 13923a655..7564a3f69 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -130,7 +130,7 @@ function profile_photo_post(&$a) { if($r) { $base_image = $r[0]; - $base_image['data'] = dbunescbin($base_image['data']); + $base_image['data'] = (($r[0]['os_storage']) ? @file_get_contents($base_image['data']) : dbunescbin($base_image['data'])); $im = photo_factory($base_image['data'], $base_image['type']); if($im->is_valid()) { @@ -238,16 +238,19 @@ function profile_photo_post(&$a) { notice( t('Image upload failed.') . EOL ); return; } + $os_storage = false; + foreach($i as $ii) { if(intval($ii['scale']) < 2) { $smallest = intval($ii['scale']); + $os_storage = intval($ii['os_storage']); $imagedata = $ii['data']; $filetype = $ii['type']; } } } -// $imagedata = @file_get_contents($src); + $imagedata = (($os_storage) ? @file_get_contents($imagedata) : $imagedata); $ph = photo_factory($imagedata, $filetype); if(! $ph->is_valid()) { @@ -332,7 +335,7 @@ function profile_photo_content(&$a) { goaway($a->get_baseurl() . '/profiles'); } - $r = q("SELECT `data`, `type` FROM photo WHERE id = %d and uid = %d limit 1", + $r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", intval($r[0]['id']), intval(local_channel()) @@ -342,9 +345,31 @@ function profile_photo_content(&$a) { return; } - $ph = photo_factory(dbunescbin($r[0]['data']), $r[0]['type']); - // go ahead as if we have just uploaded a new photo to crop - profile_photo_crop_ui_head($a, $ph); + if(intval($r[0]['os_storage'])) + $data = @file_get_contents($r[0]['data']); + else + $data = dbunescbin($r[0]['data']); + + $ph = photo_factory($data, $r[0]['type']); + $smallest = 0; + if($ph->is_valid()) { + // go ahead as if we have just uploaded a new photo to crop + $i = q("select resource_id, scale from photo where resource_id = '%s' and uid = %d order by scale", + dbesc($r[0]['resource_id']), + intval(local_channel()) + ); + + if($i) { + $hash = $i[0]['resource_id']; + foreach($i as $ii) { + if(intval($ii['scale']) < 2) { + $smallest = intval($ii['scale']); + } + } + } + } + + profile_photo_crop_ui_head($a, $ph, $hash, $smallest); } $profiles = q("select id, profile_name as name, is_default from profile where uid = %d", diff --git a/mod/public.php b/mod/public.php index 2106be7a6..45edda6c0 100644 --- a/mod/public.php +++ b/mod/public.php @@ -22,7 +22,7 @@ function public_content(&$a, $update = 0, $load = false) { $maxheight = get_config('system','home_divmore_height'); if(! $maxheight) - $maxheight = 75; + $maxheight = 400; $o .= '<div id="live-public"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1)) @@ -80,10 +80,12 @@ function public_content(&$a, $update = 0, $load = false) { $a->data['firehose'] = intval($sys['channel_id']); } + if(get_config('system','public_list_mode')) + $page_mode = 'list'; + else + $page_mode = 'client'; - $page_mode = 'list'; - $simple_update = (($update) ? " and item.item_unseen = 1 " : ''); if($update && $_SESSION['loadtime']) diff --git a/mod/rpost.php b/mod/rpost.php index 4a6b87cc6..d519a996b 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -94,15 +94,13 @@ function rpost_content(&$a) { $channel = $a->get_channel(); - $channel_acl = array( - 'allow_cid' => $channel['channel_allow_cid'], - 'allow_gid' => $channel['channel_allow_gid'], - 'deny_cid' => $channel['channel_deny_cid'], - 'deny_gid' => $channel['channel_deny_gid'] - ); + + $acl = new AccessList($channel); + + $channel_acl = $acl->get(); if($_REQUEST['url']) { - $x = z_fetch_url(z_root() . '/urlinfo?f=&url=' . urlencode($_REQUEST['url'])); + $x = z_fetch_url(z_root() . '/linkinfo?f=&url=' . urlencode($_REQUEST['url'])); if($x['success']) $_REQUEST['body'] = $_REQUEST['body'] . $x['body']; } @@ -112,8 +110,7 @@ function rpost_content(&$a) { 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], - 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] - || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), + 'lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'), 'acl' => populate_acl($channel_acl), 'bang' => '', 'visitor' => true, diff --git a/mod/zfinger.php b/mod/zfinger.php index ba80fc9b6..54ea52bc9 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -116,7 +116,7 @@ function zfinger_init(&$a) { $t = q("select abook_my_perms from abook where abook_channel = %d and abook_self = 1 limit 1", intval($e['channel_id']) ); - if($t && ($t[0]['abook_my_perms'] & PERMS_W_TAGWALL)) + if(($t) && (($t[0]['abook_my_perms'] & PERMS_W_TAGWALL) && (! ($t[0]['abook_my_perms'] & PERMS_W_STREAM)))) $public_forum = true; } |