diff options
Diffstat (limited to 'mod')
37 files changed, 1188 insertions, 105 deletions
diff --git a/mod/_well_known.php b/mod/_well_known.php index d88bc2391..47cfe1512 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -7,6 +7,22 @@ function _well_known_init(&$a){ $arr = array('server' => $_SERVER, 'request' => $_REQUEST);
call_hooks('well_known', $arr);
+
+ if(! check_siteallowed($_SERVER['REMOTE_ADDR'])) {
+ logger('well_known: site not allowed. ' . $_SERVER['REMOTE_ADDR']);
+ killme();
+ }
+
+ // from php.net re: REMOTE_HOST:
+ // Note: Your web server must be configured to create this variable. For example in Apache
+ // you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().
+
+ if(get_config('system','siteallowed_remote_host') && (! check_siteallowed($_SERVER['REMOTE_HOST']))) {
+ logger('well_known: site not allowed. ' . $_SERVER['REMOTE_HOST']);
+ killme();
+ }
+
+
switch(argv(1)) {
case 'zot-info':
$a->argc -= 1;
@@ -33,6 +49,19 @@ function _well_known_init(&$a){ break;
default:
+ // look in $WEBROOT/well_known for the requested file in case it is
+ // something a site requires and for which we do not have a module
+
+ // @fixme - we may need to determine the content-type and stick it in the header
+ // for now this can be done with a php script masquerading as the requested file
+
+ $wk_file = str_replace('.well-known','well_known',$a->cmd);
+ if(file_exists($wk_file)) {
+ echo file_get_contents($wk_file);
+ killme();
+ }
+ elseif(file_exists($wk_file . '.php'))
+ require_once($wk_file . '.php');
break;
}
diff --git a/mod/admin.php b/mod/admin.php index 85ab3627c..b537992d7 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -62,6 +62,9 @@ function admin_post(&$a){ case 'hubloc': admin_page_hubloc_post($a); break; + case 'features': + admin_page_features_post($a); + break; case 'dbsync': admin_page_dbsync_post($a); break; @@ -113,6 +116,9 @@ function admin_content(&$a) { // case 'hubloc': // $o = admin_page_hubloc($a); // break; + case 'features': + $o = admin_page_features($a); + break; case 'logs': $o = admin_page_logs($a); break; @@ -486,7 +492,7 @@ function admin_page_site(&$a) { '$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")), '$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")), '$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")), - '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (matrix/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')), + '$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')), '$form_security_token' => get_form_security_token("admin_site"), )); } @@ -530,6 +536,74 @@ function admin_page_hubloc_post(&$a){ goaway($a->get_baseurl(true) . '/admin/hubloc' ); } + +function admin_page_features_post(&$a) { + + check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features'); + + logger('postvars: ' . print_r($_POST,true)); + + $arr = array(); + $features = get_features(false); + + foreach($features as $fname => $fdata) { + foreach(array_slice($fdata,1) as $f) { + $feature = $f[0]; + + if(array_key_exists('feature_' . $feature,$_POST)) + $val = intval($_POST['feature_' . $feature]); + else + $val = 0; + set_config('feature',$feature,$val); + + if(array_key_exists('featurelock_' . $feature,$_POST)) + set_config('feature_lock',$feature,$val); + else + del_config('feature_lock',$feature); + } + } + + goaway(z_root() . '/admin/features' ); + +} + +function admin_page_features(&$a) { + + if((argc() > 1) && (argv(1) === 'features')) { + $arr = array(); + $features = get_features(false); + + foreach($features as $fname => $fdata) { + $arr[$fname] = array(); + $arr[$fname][0] = $fdata[0]; + foreach(array_slice($fdata,1) as $f) { + + $set = get_config('feature',$f[0]); + if($set === false) + $set = $f[3]; + $arr[$fname][1][] = array( + array('feature_' .$f[0],$f[1],$set,$f[2],array(t('Off'),t('On'))), + array('featurelock_' .$f[0],sprintf( t('Lock feature %s'),$f[1]),(($f[4] !== false) ? 1 : 0),'',array(t('Off'),t('On'))) + ); + } + } + + $tpl = get_markup_template("admin_settings_features.tpl"); + $o .= replace_macros($tpl, array( + '$form_security_token' => get_form_security_token("admin_manage_features"), + '$title' => t('Manage Additional Features'), + '$features' => $arr, + '$submit' => t('Submit'), + )); + + return $o; + } +} + + + + + function admin_page_hubloc(&$a) { $hubloc = q("SELECT hubloc_id, hubloc_addr, hubloc_host, hubloc_status FROM hubloc"); @@ -1018,6 +1092,23 @@ function admin_page_plugins(&$a){ return ''; } + $enabled = in_array($plugin,$a->plugins); + $info = get_plugin_info($plugin); + $x = check_plugin_versions($info); + + // disable plugins which are installed but incompatible versions + + if($enabled && ! $x) { + $enabled = false; + $idz = array_search($plugin, $a->plugins); + if ($idz !== false) { + unset($a->plugins[$idz]); + uninstall_plugin($plugin); + set_config("system","addon", implode(", ",$a->plugins)); + } + } + $info['disabled'] = 1-intval($x); + if (x($_GET,"a") && $_GET['a']=="t"){ check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't'); @@ -1068,6 +1159,7 @@ function admin_page_plugins(&$a){ } } + $t = get_markup_template('admin_plugins_details.tpl'); return replace_macros($t, array( '$title' => t('Administration'), @@ -1079,9 +1171,14 @@ function admin_page_plugins(&$a){ '$plugin' => $plugin, '$status' => $status, '$action' => $action, - '$info' => get_plugin_info($plugin), + '$info' => $info, '$str_author' => t('Author: '), '$str_maintainer' => t('Maintainer: '), + '$str_minversion' => t('Minimum project version: '), + '$str_maxversion' => t('Maximum project version: '), + '$str_minphpversion' => t('Minimum PHP version: '), + + '$disabled' => t('Disabled - version incompatibility'), '$admin_form' => $admin_form, '$function' => 'plugins', @@ -1103,7 +1200,23 @@ function admin_page_plugins(&$a){ if (is_dir($file)){ list($tmp, $id) = array_map('trim', explode('/', $file)); $info = get_plugin_info($id); - $plugins[] = array( $id, (in_array($id, $a->plugins)?"on":"off") , $info); + $enabled = in_array($id,$a->plugins); + $x = check_plugin_versions($info); + + // disable plugins which are installed but incompatible versions + + if($enabled && ! $x) { + $enabled = false; + $idz = array_search($id, $a->plugins); + if ($idz !== false) { + unset($a->plugins[$idz]); + uninstall_plugin($id); + set_config("system","addon", implode(", ",$a->plugins)); + } + } + $info['disabled'] = 1-intval($x); + + $plugins[] = array( $id, (($enabled)?"on":"off") , $info); } } } @@ -1116,6 +1229,7 @@ function admin_page_plugins(&$a){ '$baseurl' => $a->get_baseurl(true), '$function' => 'plugins', '$plugins' => $plugins, + '$disabled' => t('Disabled - version incompatibility'), '$form_security_token' => get_form_security_token('admin_plugins'), )); } diff --git a/mod/channel.php b/mod/channel.php index 2b9d0ed89..f88a5bf45 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -128,7 +128,7 @@ function channel_content(&$a, $update = 0, $load = false) { 'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''), 'nickname' => $a->profile['channel_address'], 'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl) : ''), + 'acl' => (($is_owner) ? populate_acl($channel_acl,true,(($a->profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), 'showacl' => (($is_owner) ? 'yes' : ''), 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), @@ -156,13 +156,18 @@ function channel_content(&$a, $update = 0, $load = false) { $abook_uids = " and abook.abook_channel = " . intval($a->profile['profile_uid']) . " "; $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - + + if($mid) { + $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\r\n"; + } + if($update && $_SESSION['loadtime']) $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; if($load) $simple_update = ''; if(($update) && (! $load)) { + if ($mid) { $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", @@ -258,7 +263,6 @@ function channel_content(&$a, $update = 0, $load = false) { $items = array(); } - if((! $update) && (! $load)) { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, diff --git a/mod/connections.php b/mod/connections.php index 2060ca85e..1de8279c4 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -121,53 +121,60 @@ function connections_content(&$a) { $search = ((x($_REQUEST,'search')) ? notags(trim($_REQUEST['search'])) : ''); $tabs = array( + /* array( 'label' => t('Suggestions'), 'url' => z_root() . '/suggest', 'sel' => '', 'title' => t('Suggest new connections'), ), - array( + */ + + 'pending' => array( 'label' => t('New Connections'), 'url' => z_root() . '/connections/pending', 'sel' => ($pending) ? 'active' : '', 'title' => t('Show pending (new) connections'), ), - array( + + 'all' => array( 'label' => t('All Connections'), 'url' => z_root() . '/connections/all', 'sel' => ($all) ? 'active' : '', 'title' => t('Show all connections'), ), + + /* array( 'label' => t('Unblocked'), 'url' => z_root() . '/connections', 'sel' => (($unblocked) && (! $search) && (! $nets)) ? 'active' : '', 'title' => t('Only show unblocked connections'), ), + */ - array( + 'blocked' => array( 'label' => t('Blocked'), 'url' => z_root() . '/connections/blocked', 'sel' => ($blocked) ? 'active' : '', 'title' => t('Only show blocked connections'), ), - array( + 'ignored' => array( 'label' => t('Ignored'), 'url' => z_root() . '/connections/ignored', 'sel' => ($ignored) ? 'active' : '', 'title' => t('Only show ignored connections'), ), - array( + 'archived' => array( 'label' => t('Archived'), 'url' => z_root() . '/connections/archived', 'sel' => ($archived) ? 'active' : '', 'title' => t('Only show archived connections'), ), - array( + 'hidden' => array( 'label' => t('Hidden'), 'url' => z_root() . '/connections/hidden', 'sel' => ($hidden) ? 'active' : '', @@ -184,8 +191,8 @@ function connections_content(&$a) { ); - $tab_tpl = get_markup_template('common_tabs.tpl'); - $t = replace_macros($tab_tpl, array('$tabs'=>$tabs)); + //$tab_tpl = get_markup_template('common_tabs.tpl'); + //$t = replace_macros($tab_tpl, array('$tabs'=>$tabs)); $searching = false; if($search) { @@ -221,20 +228,51 @@ function connections_content(&$a) { foreach($r as $rr) { if($rr['xchan_url']) { + + $status_str = ''; + $status = array( + ((intval($rr['abook_pending'])) ? t('Pending approval') : ''), + ((intval($rr['abook_archived'])) ? t('Archived') : ''), + ((intval($rr['abook_hidden'])) ? t('Hidden') : ''), + ((intval($rr['abook_ignored'])) ? t('Ignored') : ''), + ((intval($rr['abook_blocked'])) ? t('Blocked') : '') + ); + + foreach($status as $str) { + if(!$str) + continue; + $status_str .= $str; + $status_str .= ', '; + } + $status_str = rtrim($status_str, ', '); + $contacts[] = array( 'img_hover' => sprintf( t('%1$s [%2$s]'),$rr['xchan_name'],$rr['xchan_url']), 'edit_hover' => t('Edit connection'), + 'delete_hover' => t('Delete connection'), 'id' => $rr['abook_id'], - 'alt_text' => $alt_text, - 'dir_icon' => $dir_icon, 'thumb' => $rr['xchan_photo_m'], 'name' => $rr['xchan_name'], - 'username' => $rr['xchan_name'], 'classes' => (intval($rr['abook_archived']) ? 'archived' : ''), 'link' => z_root() . '/connedit/' . $rr['abook_id'], - 'edit' => t('Edit'), + 'deletelink' => z_root() . '/connedit/' . intval($rr['abook_id']) . '/drop', + 'delete' => t('Delete'), 'url' => chanlink_url($rr['xchan_url']), - 'network' => network_to_name($rr['network']), + 'webbie_label' => t('Channel address'), + 'webbie' => $rr['xchan_addr'], + 'network_label' => t('Network'), + 'network' => network_to_name($rr['xchan_network']), + 'public_forum' => ((intval($rr['xchan_pubforum'])) ? true : false), + 'status_label' => t('Status'), + 'status' => $status_str, + 'connected_label' => t('Connected'), + 'connected' => datetime_convert('UTC',date_default_timezone_get(),$rr['abook_created'], 'c'), + 'approve_hover' => t('Approve connection'), + 'approve' => (($rr['abook_pending']) ? t('Approve') : false), + 'ignore_hover' => t('Ignore connection'), + 'ignore' => ((! $rr['abook_ignored']) ? t('Ignore') : false), + 'recent_label' => t('Recent activity'), + 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']) ); } } @@ -257,12 +295,13 @@ function connections_content(&$a) { else { $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>"; $o .= replace_macros(get_markup_template('connections.tpl'),array( - '$header' => t('Connections') . (($head) ? ' - ' . $head : ''), - '$tabs' => $t, + '$header' => t('Connections') . (($head) ? ': ' . $head : ''), + '$tabs' => $tabs, '$total' => $total, '$search' => $search_hdr, + '$label' => t('Search'), '$desc' => t('Search your connections'), - '$finding' => (($searching) ? t('Finding: ') . "'" . $search . "'" : ""), + '$finding' => (($searching) ? t('Connections search') . ": '" . $search . "'" : ""), '$submit' => t('Find'), '$edit' => t('Edit'), '$cmd' => $a->cmd, diff --git a/mod/connedit.php b/mod/connedit.php index 9c46fa999..cb785fc31 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -305,6 +305,9 @@ function connedit_post(&$a) { connedit_clone($a); + if(($_REQUEST['pending']) && (!$_REQUEST['done'])) + goaway($a->get_baseurl(true) . '/connections/ifpending'); + return; } @@ -397,7 +400,6 @@ function connedit_content(&$a) { } if($cmd === 'update') { - // pull feed and consume it, which should subscribe to the hub. proc_run('php',"include/poller.php","$contact_id"); goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); @@ -405,8 +407,15 @@ function connedit_content(&$a) { } if($cmd === 'refresh') { - if(! zot_refresh($orig_record[0],get_app()->get_channel())) - notice( t('Refresh failed - channel is currently unavailable.') ); + if($orig_record[0]['xchan_network'] === 'zot') { + if(! zot_refresh($orig_record[0],get_app()->get_channel())) + notice( t('Refresh failed - channel is currently unavailable.') ); + } + else { + + // if you are on a different network we'll force a refresh of the connection basic info + proc_run('php','include/notifier.php','permission_update',$contact_id); + } goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); } @@ -705,10 +714,6 @@ function connedit_content(&$a) { '$slide' => $slide, '$affinity' => $affinity, '$pending_label' => t('Connection Pending Approval'), - '$pending_modal_title' => t('Connection Request'), - '$pending_modal_body' => sprintf(t('(%s) would like to connect with you. Please approve this connection to allow communication.'), $contact['xchan_addr']), - '$pending_modal_approve' => t('Approve'), - '$pending_modal_dismiss' => t('Approve Later'), '$is_pending' => (intval($contact['abook_pending']) ? 1 : ''), '$unapproved' => $unapproved, '$inherited' => t('inherited'), diff --git a/mod/cover_photo.php b/mod/cover_photo.php new file mode 100644 index 000000000..de11857b0 --- /dev/null +++ b/mod/cover_photo.php @@ -0,0 +1,417 @@ +<?php + +/* + @file cover_photo.php + @brief Module-file with functions for handling of cover-photos + +*/ + +require_once('include/photo/photo_driver.php'); +require_once('include/identity.php'); + + + +/* @brief Initalize the cover-photo edit view + * + * @param $a Current application + * @return void + * + */ + +function cover_photo_init(&$a) { + + if(! local_channel()) { + return; + } + + $channel = $a->get_channel(); + profile_load($a,$channel['channel_address']); + +} + +/* @brief Evaluate posted values + * + * @param $a Current application + * @return void + * + */ + +function cover_photo_post(&$a) { + + if(! local_channel()) { + return; + } + + $channel = $a->get_channel(); + + check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo'); + + if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) { + + // phase 2 - we have finished cropping + + if(argc() != 2) { + notice( t('Image uploaded but image cropping failed.') . EOL ); + return; + } + + $image_id = argv(1); + + if(substr($image_id,-2,1) == '-') { + $scale = substr($image_id,-1,1); + $image_id = substr($image_id,0,-2); + } + + + $srcX = $_POST['xstart']; + $srcY = $_POST['ystart']; + $srcW = $_POST['xfinal'] - $srcX; + $srcH = $_POST['yfinal'] - $srcY; + + + $r = q("select gender from profile where uid = %d and is_default = 1 limit 1", + intval(local_channel()) + ); + if($r) { + $profile = $r[0]; + } + + $r = q("SELECT * FROM photo WHERE resource_id = '%s' AND uid = %d AND scale = 0 LIMIT 1", + dbesc($image_id), + intval(local_channel()) + ); + + if($r) { + + $base_image = $r[0]; + $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()) { + + // We are scaling and cropping the relative pixel locations to the original photo instead of the + // scaled photo we operated on. + + // First load the scaled photo to check its size. (Should probably pass this in the post form and save + // a query.) + + $g = q("select width, height from photo where resource_id = '%s' and uid = %d and scale = 3", + dbesc($image_id), + intval(local_channel()) + ); + + + $scaled_width = $g[0]['width']; + $scaled_height = $g[0]['height']; + + if((! $scaled_width) || (! $scaled_height)) { + logger('potential divide by zero scaling cover photo'); + return; + } + + // unset all other cover photos + + q("update photo set photo_usage = %d where photo_usage = %d and uid = %d", + intval(PHOTO_NORMAL), + intval(PHOTO_COVER), + intval(local_channel()) + ); + + $orig_srcx = ( $r[0]['width'] / $scaled_width ) * $srcX; + $orig_srcy = ( $r[0]['height'] / $scaled_height ) * $srcY; + $orig_srcw = ( $srcW / $scaled_width ) * $r[0]['width']; + $orig_srch = ( $srcH / $scaled_height ) * $r[0]['height']; + + $im->cropImageRect(1200,435,$orig_srcx, $orig_srcy, $orig_srcw, $orig_srch); + + $aid = get_account_id(); + + $p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'], + 'filename' => $base_image['filename'], 'album' => t('Cover Photos')); + + $p['scale'] = 7; + $p['photo_usage'] = PHOTO_COVER; + + $r1 = $im->save($p); + + $im->doScaleImage(850,310); + $p['scale'] = 8; + + $r2 = $im->save($p); + + + $im->doScaleImage(425,160); + $p['scale'] = 9; + + $r3 = $im->save($p); + + if($r1 === false || $r2 === false || $r3 === false) { + // if one failed, delete them all so we can start over. + notice( t('Image resize failed.') . EOL ); + $x = q("delete from photo where resource_id = '%s' and uid = %d and scale >= 7 ", + dbesc($base_image['resource_id']), + local_channel() + ); + return; + } + + $channel = $a->get_channel(); + send_cover_photo_activity($channel,$base_image,$profile); + + + } + else + notice( t('Unable to process image') . EOL); + } + + goaway(z_root() . '/channel/' . $channel['channel_address']); + + } + + + $hash = photo_new_resource(); + $smallest = 0; + + require_once('include/attach.php'); + + $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash)); + + logger('attach_store: ' . print_r($res,true)); + + if($res && intval($res['data']['is_photo'])) { + $i = q("select * from photo where resource_id = '%s' and uid = %d and scale = 0", + dbesc($hash), + intval(local_channel()) + ); + + if(! $i) { + notice( t('Image upload failed.') . EOL ); + return; + } + $os_storage = false; + + foreach($i as $ii) { + $smallest = intval($ii['scale']); + $os_storage = intval($ii['os_storage']); + $imagedata = $ii['data']; + $filetype = $ii['type']; + + } + } + + $imagedata = (($os_storage) ? @file_get_contents($imagedata) : $imagedata); + $ph = photo_factory($imagedata, $filetype); + + if(! $ph->is_valid()) { + notice( t('Unable to process image.') . EOL ); + return; + } + + return cover_photo_crop_ui_head($a, $ph, $hash, $smallest); + +} + +function send_cover_photo_activity($channel,$photo,$profile) { + + $arr = array(); + $arr['item_thread_top'] = 1; + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; + $arr['obj_type'] = ACTIVITY_OBJ_PHOTO; + $arr['verb'] = ACTIVITY_UPDATE; + + $arr['object'] = json_encode(array( + 'type' => $arr['obj_type'], + 'id' => z_root() . '/photo/' . $photo['resource_id'] . '-7', + 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7') + )); + + if($profile && stripos($profile['gender'],t('female')) !== false) + $t = t('%1$s updated her %2$s'); + elseif($profile && stripos($profile['gender'],t('male')) !== false) + $t = t('%1$s updated his %2$s'); + else + $t = t('%1$s updated their %2$s'); + + $ptext = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' . t('cover photo') . '[/zrl]'; + + $ltext = '[zrl=' . z_root() . '/profile/' . $channel['channel_address'] . ']' . '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-8[/zmg][/zrl]'; + + $arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext; + + $acl = new AccessList($channel); + $x = $acl->get(); + $arr['allow_cid'] = $x['allow_cid']; + + $arr['allow_gid'] = $x['allow_gid']; + $arr['deny_cid'] = $x['deny_cid']; + $arr['deny_gid'] = $x['deny_gid']; + + $arr['uid'] = $channel['channel_id']; + $arr['aid'] = $channel['channel_account_id']; + + $arr['owner_xchan'] = $channel['channel_hash']; + $arr['author_xchan'] = $channel['channel_hash']; + + post_activity_item($arr); + + +} + + +/* @brief Generate content of profile-photo view + * + * @param $a Current application + * @return void + * + */ + + +function cover_photo_content(&$a) { + + if(! local_channel()) { + notice( t('Permission denied.') . EOL ); + return; + } + + $channel = $a->get_channel(); + + $newuser = false; + + if(argc() == 2 && argv(1) === 'new') + $newuser = true; + + if(argv(1) === 'use') { + if (argc() < 3) { + notice( t('Permission denied.') . EOL ); + return; + }; + +// check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo'); + + $resource_id = argv(2); + + $r = q("SELECT id, album, scale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY scale ASC", + intval(local_channel()), + dbesc($resource_id) + ); + if(! $r) { + notice( t('Photo not available.') . EOL ); + return; + } + $havescale = false; + foreach($r as $rr) { + if($rr['scale'] == 7) + $havescale = true; + } + + $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()) + + ); + if(! $r) { + notice( t('Photo not available.') . EOL ); + return; + } + + 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 and scale = 0", + dbesc($r[0]['resource_id']), + intval(local_channel()) + ); + + if($i) { + $hash = $i[0]['resource_id']; + foreach($i as $ii) { + $smallest = intval($ii['scale']); + } + } + } + + cover_photo_crop_ui_head($a, $ph, $hash, $smallest); + } + + + if(! x($a->data,'imagecrop')) { + + $tpl = get_markup_template('cover_photo.tpl'); + + $o .= replace_macros($tpl,array( + '$user' => $a->channel['channel_address'], + '$lbl_upfile' => t('Upload File:'), + '$lbl_profiles' => t('Select a profile:'), + '$title' => t('Upload Cover Photo'), + '$submit' => t('Upload'), + '$profiles' => $profiles, + '$form_security_token' => get_form_security_token("cover_photo"), +// FIXME - yuk + '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . $a->get_baseurl() . '">' . t('skip this step') . '</a>' : '<a href="'. $a->get_baseurl() . '/photos/' . $a->channel['channel_address'] . '">' . t('select a photo from your photo albums') . '</a>') + )); + + call_hooks('cover_photo_content_end', $o); + + return $o; + } + else { + $filename = $a->data['imagecrop'] . '-3'; + $resolution = 3; + $tpl = get_markup_template("cropcover.tpl"); + $o .= replace_macros($tpl,array( + '$filename' => $filename, + '$profile' => intval($_REQUEST['profile']), + '$resource' => $a->data['imagecrop'] . '-3', + '$image_url' => $a->get_baseurl() . '/photo/' . $filename, + '$title' => t('Crop Image'), + '$desc' => t('Please adjust the image cropping for optimum viewing.'), + '$form_security_token' => get_form_security_token("cover_photo"), + '$done' => t('Done Editing') + )); + return $o; + } + + return; // NOTREACHED +} + +/* @brief Generate the UI for photo-cropping + * + * @param $a Current application + * @param $ph Photo-Factory + * @return void + * + */ + + + +function cover_photo_crop_ui_head(&$a, $ph, $hash, $smallest){ + + $max_length = get_config('system','max_image_length'); + if(! $max_length) + $max_length = MAX_IMAGE_LENGTH; + if($max_length > 0) + $ph->scaleImage($max_length); + + $width = $ph->getWidth(); + $height = $ph->getHeight(); + + if($width < 300 || $height < 300) { + $ph->scaleImageUp(240); + $width = $ph->getWidth(); + $height = $ph->getHeight(); + } + + + $a->data['imagecrop'] = $hash; + $a->data['imagecrop_resolution'] = $smallest; + $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); + return; +} + diff --git a/mod/directory.php b/mod/directory.php index 4ab118b17..dca96694e 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -144,11 +144,14 @@ function directory_content(&$a) { } if($url) { - // We might want to make the tagadelic count (&kw=) configurable or turn it off completely. $numtags = get_config('system','directorytags'); - $kw = ((intval($numtags)) ? $numtags : 50); + $kw = ((intval($numtags) > 0) ? intval($numtags) : 50); + + if(get_config('system','disable_directory_keywords')) + $kw = 0; + $query = $url . '?f=&kw=' . $kw . (($safe_mode != 1) ? '&safe=' . $safe_mode : ''); if($token) diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 388e5f3ac..bc2fa108f 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -75,6 +75,8 @@ function dirsearch_content(&$a) { $kw = ((x($_REQUEST,'kw')) ? intval($_REQUEST['kw']) : 0 ); $forums = ((array_key_exists('pubforums',$_REQUEST)) ? intval($_REQUEST['pubforums']) : 0); + if(get_config('system','disable_directory_keywords')) + $kw = 0; // by default use a safe search diff --git a/mod/events.php b/mod/events.php index 74b44906c..ed9f0f2e3 100755 --- a/mod/events.php +++ b/mod/events.php @@ -434,7 +434,7 @@ function events_content(&$a) { '$xchan' => $event_xchan, '$mid' => $mid, '$event_hash' => $event_id, - '$summary' => array('summary', (($event_id) ? t('Edit event titel') : t('Event titel')), $t_orig, t('Required'), '*'), + '$summary' => array('summary', (($event_id) ? t('Edit event title') : t('Event title')), $t_orig, t('Required'), '*'), '$catsenabled' => $catsenabled, '$placeholdercategory' => t('Categories (comma-separated list)'), '$c_text' => (($event_id) ? t('Edit Category') : t('Category')), diff --git a/mod/group.php b/mod/group.php index ce9633669..7eaad771f 100644 --- a/mod/group.php +++ b/mod/group.php @@ -17,13 +17,13 @@ function group_post(&$a) { $public = intval($_POST['public']); $r = group_add(local_channel(),$name,$public); if($r) { - info( t('Collection created.') . EOL ); + info( t('Privacy group created.') . EOL ); $r = group_byname(local_channel(),$name); if($r) goaway($a->get_baseurl() . '/group/' . $r); } else - notice( t('Could not create collection.') . EOL ); + notice( t('Could not create privacy group.') . EOL ); goaway($a->get_baseurl() . '/group'); } @@ -35,7 +35,7 @@ function group_post(&$a) { intval(local_channel()) ); if(! $r) { - notice( t('Collection not found.') . EOL ); + notice( t('Privacy group not found.') . EOL ); goaway($a->get_baseurl() . '/connections'); } @@ -51,7 +51,7 @@ function group_post(&$a) { intval($group['id']) ); if($r) - info( t('Collection updated.') . EOL ); + info( t('Privacy group updated.') . EOL ); } goaway(z_root() . '/group/' . argv(1) . '/' . argv(2)); @@ -83,8 +83,8 @@ function group_content(&$a) { if((argc() == 2) && (argv(1) === 'new')) { return replace_macros($tpl, $context + array( - '$title' => t('Create a collection of channels.'), - '$gname' => array('groupname',t('Collection Name: '), '', ''), + '$title' => t('Create a group of channels.'), + '$gname' => array('groupname',t('Privacy group name: '), '', ''), '$gid' => 'new', '$public' => array('public',t('Members are visible to other channels'), false, ''), '$form_security_token' => get_form_security_token("group_edit"), @@ -104,9 +104,9 @@ function group_content(&$a) { if($r) $result = group_rmv(local_channel(),$r[0]['name']); if($result) - info( t('Collection removed.') . EOL); + info( t('Privacy group removed.') . EOL); else - notice( t('Unable to remove collection.') . EOL); + notice( t('Unable to remove privacy group.') . EOL); } goaway($a->get_baseurl() . '/group'); // NOTREACHED @@ -134,7 +134,7 @@ function group_content(&$a) { intval(local_channel()) ); if(! $r) { - notice( t('Collection not found.') . EOL ); + notice( t('Privacy group not found.') . EOL ); goaway($a->get_baseurl() . '/connections'); } $group = $r[0]; @@ -176,8 +176,8 @@ function group_content(&$a) { $context = $context + array( - '$title' => t('Collection Editor'), - '$gname' => array('groupname',t('Collection Name: '),$group['name'], ''), + '$title' => t('Privacy group editor'), + '$gname' => array('groupname',t('Privacy group name: '),$group['name'], ''), '$gid' => $group['id'], '$drop' => $drop_txt, '$public' => array('public',t('Members are visible to other channels'), $group['visible'], ''), diff --git a/mod/help.php b/mod/help.php index c4549a2bd..e1c6fede8 100644 --- a/mod/help.php +++ b/mod/help.php @@ -157,7 +157,7 @@ function help_content(&$a) { $path = trim(substr($dirname,4),'/'); $o .= '<li><a href="help/' . (($path) ? $path . '/' : '') . $fname . '" >' . ucwords(str_replace('_',' ',notags($fname))) . '</a><br />' . - str_replace('$Projectname',PLATFORM_NAME,substr($rr['text'],0,200)) . '...<br /><br /></li>'; + str_replace('$Projectname',get_platform_name(),substr($rr['text'],0,200)) . '...<br /><br /></li>'; } $o .= '</ul>'; @@ -229,6 +229,8 @@ function help_content(&$a) { if($doctype === 'bbcode') { require_once('include/bbcode.php'); $content = bbcode($text); + // bbcode retargets external content to new windows. This content is internal. + $content = str_replace(' target="_blank"','',$content); } $content = preg_replace_callback("/#include (.*?)\;/ism", 'preg_callback_help_include', $content); @@ -248,7 +250,9 @@ function preg_callback_help_include($matches) { if(preg_match('/\.bb$/', $matches[1]) || preg_match('/\.txt$/', $matches[1])) { require_once('include/bbcode.php'); $include = bbcode($include); - } elseif(preg_match('/\.md$/', $matches[1])) { + $include = str_replace(' target="_blank"','',$include); + } + elseif(preg_match('/\.md$/', $matches[1])) { require_once('library/markdown.php'); $include = Markdown($include); } diff --git a/mod/hostxrd.php b/mod/hostxrd.php index 0e18c133b..18066b7bf 100644 --- a/mod/hostxrd.php +++ b/mod/hostxrd.php @@ -12,6 +12,7 @@ function hostxrd_init(&$a) { )); $arr = array('xrd' => $x); call_hooks('hostxrd',$arr); + echo $arr['xrd']; killme(); } diff --git a/mod/import.php b/mod/import.php index 02e71233a..b6091d944 100644 --- a/mod/import.php +++ b/mod/import.php @@ -123,7 +123,7 @@ function import_account(&$a, $account_id) { if(array_key_exists('channel',$data)) { if($completed < 1) { - $channel = import_channel($data['channel'], $account_id); + $channel = import_channel($data['channel'], $account_id, $seize); } else { diff --git a/mod/import_items.php b/mod/import_items.php index 6b97939c9..f369ad780 100644 --- a/mod/import_items.php +++ b/mod/import_items.php @@ -86,14 +86,11 @@ function import_items_post(&$a) { $channel = $a->get_channel(); - $saved_notification_flags = notifications_off($channel['channel_id']); if(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']) { import_item_ids($channel,$data['item_id']); } @@ -107,9 +104,6 @@ function import_items_post(&$a) { function import_items_content(&$a) { - - - if(! local_channel()) { notice( t('Permission denied') . EOL); return login(); diff --git a/mod/item.php b/mod/item.php index b3ef57529..fdc768c67 100644 --- a/mod/item.php +++ b/mod/item.php @@ -210,7 +210,7 @@ function item_post(&$a) { } } else { - if(! perm_is_allowed($profile_uid,$observer['xchan_hash'],'post_wall')) { + if(! perm_is_allowed($profile_uid,$observer['xchan_hash'],($webpage) ? 'write_pages' : 'post_wall')) { notice( t('Permission denied.') . EOL) ; if(x($_REQUEST,'return')) goaway($a->get_baseurl() . "/" . $return_path ); @@ -446,7 +446,7 @@ function item_post(&$a) { $execflag = false; - if($mimetype === 'application/x-php') { + if($mimetype !== 'text/bbcode') { $z = q("select account_id, account_roles, channel_pageflags from account left join channel on channel_account_id = account_id where channel_id = %d limit 1", intval($profile_uid) ); @@ -720,8 +720,7 @@ function item_post(&$a) { $datarray = array(); - $item_thead_top = ((! $parent) ? 1 : 0); - + $item_thread_top = ((! $parent) ? 1 : 0); if ((! $plink) && ($item_thread_top)) { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; @@ -818,25 +817,26 @@ function item_post(&$a) { dbesc($body) ); - if($z && $z[0]['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) { - $datarray['cancel'] = 1; - notice( t('Duplicate post suppressed.') . EOL); - logger('Duplicate post. Faking plugin cancel.'); + if($z) { + foreach($z as $zz) { + if($zz['created'] > datetime_convert('UTC','UTC', 'now - 2 minutes')) { + $datarray['cancel'] = 1; + notice( t('Duplicate post suppressed.') . EOL); + logger('Duplicate post. Faking plugin cancel.'); + } + } } } call_hooks('post_local',$datarray); if(x($datarray,'cancel')) { - logger('mod_item: post cancelled by plugin.'); - if($return_path) { + logger('mod_item: post cancelled by plugin or duplicate suppressed.'); + if($return_path) goaway($a->get_baseurl() . "/" . $return_path); - } $json = array('cancel' => 1); - if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload'])) - $json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload']; - + $json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload']; echo json_encode($json); killme(); } @@ -919,7 +919,7 @@ function item_post(&$a) { else { $parent = $post_id; - if($datarray['owner_xchan'] != $datarray['author_xchan']) { + if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($datarray['item_type'] == ITEM_TYPE_POST)) { notification(array( 'type' => NOTIFY_WALL, 'from_xchan' => $datarray['author_xchan'], diff --git a/mod/linkinfo.php b/mod/linkinfo.php index c3df1305d..5d9e2bc67 100644 --- a/mod/linkinfo.php +++ b/mod/linkinfo.php @@ -22,6 +22,8 @@ function linkinfo_content(&$a) { else $url = trim($_GET['url']); + $url = strip_zids($url); + if((substr($url,0,1) != '/') && (substr($url,0,4) != 'http')) $url = 'http://' . $url; @@ -113,7 +115,7 @@ function linkinfo_content(&$a) { // If this is a Red site, use zrl rather than url so they get zids sent to them by default - if( x($siteinfo,'generator') && (strpos($siteinfo['generator'],PLATFORM_NAME . ' ') === 0)) + if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], get_platform_name() . ' ') === 0)) $template = str_replace('url','zrl',$template); if($siteinfo["title"] == "") { diff --git a/mod/lostpass.php b/mod/lostpass.php index 3dbc2fe7d..ffdd7b62e 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -87,7 +87,7 @@ function lostpass_content(&$a) { '$lbl2' => t('Your password has been reset as requested.'), '$lbl3' => t('Your new password is'), '$lbl4' => t('Save or copy your new password - and then'), - '$lbl5' => '<a href="' . $a->get_baseurl() . '">' . t('click here to login') . '</a>.', + '$lbl5' => '<a href="' . $a->get_baseurl() . '/login">' . t('click here to login') . '</a>.', '$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'), '$newpass' => $new_password, '$baseurl' => $a->get_baseurl() diff --git a/mod/magic.php b/mod/magic.php index 2fee87241..12679773b 100644 --- a/mod/magic.php +++ b/mod/magic.php @@ -105,6 +105,7 @@ function magic_init(&$a) { $r = q("select * from channel left join hubloc on channel_hash = hubloc_hash where hubloc_addr = '%s' limit 1", dbesc($delegate) ); + if($r && intval($r[0]['channel_id'])) { $allowed = perm_is_allowed($r[0]['channel_id'],get_observer_hash(),'delegate'); if($allowed) { @@ -112,6 +113,7 @@ function magic_init(&$a) { $_SESSION['delegate'] = get_observer_hash(); $_SESSION['account_id'] = intval($r[0]['channel_account_id']); change_channel($r[0]['channel_id']); + $delegation_success = true; } } diff --git a/mod/manage.php b/mod/manage.php index b609ede44..671003efd 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -148,6 +148,8 @@ function manage_content(&$a) { for($x = 0; $x < count($delegates); $x ++) { $delegates[$x]['link'] = 'magic?f=&dest=' . urlencode($delegates[$x]['xchan_url']) . '&delegate=' . urlencode($delegates[$x]['xchan_addr']); + $delegates[$x]['channel_name'] = $delegates[$x]['xchan_name']; + $delegates[$x]['delegate'] = 1; } } else { diff --git a/mod/network.php b/mod/network.php index 9f0604296..17f57f498 100644 --- a/mod/network.php +++ b/mod/network.php @@ -166,7 +166,7 @@ function network_content(&$a, $update = 0, $load = false) { 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], '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)), + 'acl' => populate_acl((($private_editing) ? $def_acl : $channel_acl), true, (($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')), 'bang' => (($private_editing) ? '!' : ''), 'visitor' => true, 'profile_uid' => local_channel() @@ -204,7 +204,7 @@ function network_content(&$a, $update = 0, $load = false) { } else { $contact_str = ' 0 '; - info( t('Collection is empty')); + info( t('Privacy group is empty')); } $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str )) or allow_gid like '" . protect_sprintf('%<' . dbesc($group_hash) . '>%') . "' ) and id = parent $item_normal ) "; @@ -213,7 +213,7 @@ function network_content(&$a, $update = 0, $load = false) { if($x) { $title = replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => t('Collection: ') . $x['name'] + '$title' => t('Privacy group: ') . $x['name'] )); } diff --git a/mod/new_channel.php b/mod/new_channel.php index 047048f0a..630984bf2 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -64,7 +64,14 @@ function new_channel_post(&$a) { $arr = $_POST; - if(($arr['account_id'] = get_account_id()) === false) { + $acc = $a->get_account(); + $arr['account_id'] = get_account_id(); + + // prevent execution by delegated channels as well as those not logged in. + // get_account_id() returns the account_id from the session. But $a->account + // may point to the original authenticated account. + + if((! $acc) || ($acc['account_id'] != $arr['account_id'])) { notice( t('Permission denied.') . EOL ); return; } @@ -95,11 +102,25 @@ function new_channel_post(&$a) { function new_channel_content(&$a) { - if(! get_account_id()) { + + $acc = $a->get_account(); + + if((! $acc) || $acc['account_id'] != get_account_id()) { notice( t('Permission denied.') . EOL); return; } + $default_role = ''; + $aid = get_account_id(); + if($aid) { + $r = q("select count(channel_id) as total from channel where channel_account_id = %d", + intval($aid) + ); + if($r && (! intval($r[0]['total']))) { + $default_role = get_config('system','default_permissions_role'); + } + } + $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); @@ -112,11 +133,13 @@ function new_channel_content(&$a) { '$label_name' => t('Channel Name'), '$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '), '$label_nick' => t('Choose a short nickname'), + '$nick_hub' => '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')), '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), '$label_import' => t('Or <a href="import">import an existing channel</a> from another location'), '$name' => $name, '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), '$role' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()), + '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create') )); diff --git a/mod/oep.php b/mod/oep.php new file mode 100644 index 000000000..8d959c3e2 --- /dev/null +++ b/mod/oep.php @@ -0,0 +1,387 @@ +<?php + +// oembed provider + + + +function oep_init(&$a) { + + logger('oep: ' . print_r($_REQUEST,true), LOGGER_DEBUG, LOG_INFO); + + if($_REQUEST['url']) { + $_REQUEST['url'] = strip_zids($_REQUEST['url']); + $url = $_REQUEST['url']; + } + + if(! $url) + http_status_exit(404, 'Not found'); + + $maxwidth = $_REQUEST['maxwidth']; + $maxheight = $_REQUEST['maxheight']; + $format = $_REQUEST['format']; + if($format && $format !== 'json') + http_status_exit(501, 'Not implemented'); + + if(fnmatch('*/photos/*/album/*',$url)) + $arr = oep_album_reply($_REQUEST); + elseif(fnmatch('*/photos/*/image/*',$url)) + $arr = oep_photo_reply($_REQUEST); + elseif(fnmatch('*/photos*',$url)) + $arr = oep_phototop_reply($_REQUEST); + elseif(fnmatch('*/display/*',$url)) + $arr = oep_display_reply($_REQUEST); + elseif(fnmatch('*/channel/*mid=*',$url)) + $arr = oep_mid_reply($_REQUEST); + elseif(fnmatch('*/profile/*',$url)) + $arr = oep_profile_reply($_REQUEST); + + if($arr) { + header('Content-Type: application/json+oembed'); + echo json_encode($arr); + killme(); + } + + http_status_exit(404,'Not found'); + +} + +function oep_display_reply($args) { + + $ret = array(); + $url = $args['url']; + $maxwidth = intval($args['maxwidth']); + $maxheight = intval($args['maxheight']); + + if(preg_match('#//(.*?)/(.*?)/(.*?)/(.*?)mid\=(.*?)(&|$)#',$url,$matches)) { + $chn = $matches[3]; + $res = $matches[5]; + } + + if(! ($chn && $res)) + return; + $c = q("select * from channel where channel_address = '%s' limit 1", + dbesc($chn) + ); + + if(! $c) + return; + + $sql_extra = item_permissions_sql($c[0]['channel_id']); + + $p = q("select * from item where mid = '%s' and uid = %d $sql_extra limit 1", + dbesc($res), + intval($c[0]['channel_id']) + ); + if(! $p) + return; + + xchan_query($p,true); + $p = fetch_post_tags($p,true); + + $o = "[share author='".urlencode($p[0]['author']['xchan_name']). + "' profile='".$p[0]['author']['xchan_url'] . + "' avatar='".$p[0]['author']['xchan_photo_s']. + "' link='".$p[0]['plink']. + "' posted='".$p[0]['created']. + "' message_id='".$p[0]['mid']."']"; + if($p[0]['title']) + $o .= '[b]'.$p[0]['title'].'[/b]'."\r\n"; + $o .= $p[0]['body']; + $o .= "[/share]"; + $o = bbcode($o); + + $ret['type'] = 'rich'; + + $w = (($maxwidth) ? $maxwidth : 640); + $h = (($maxheight) ? $maxheight : $w * 2 / 3); + + $ret['html'] = '<div style="width: ' . $w . '; height: ' . $h . ';" >' . $o . '</div>'; + + $ret['width'] = $w; + $ret['height'] = $h; + + return $ret; + +} + +function oep_mid_reply($args) { + + $ret = array(); + $url = $args['url']; + $maxwidth = intval($args['maxwidth']); + $maxheight = intval($args['maxheight']); + + if(preg_match('#//(.*?)/(.*?)/(.*?)/(.*?)mid\=(.*?)(&|$)#',$url,$matches)) { + $chn = $matches[3]; + $res = $matches[5]; + } + + if(! ($chn && $res)) + return; + $c = q("select * from channel where channel_address = '%s' limit 1", + dbesc($chn) + ); + + if(! $c) + return; + + $sql_extra = item_permissions_sql($c[0]['channel_id']); + + $p = q("select * from item where mid = '%s' and uid = %d $sql_extra limit 1", + dbesc($res), + intval($c[0]['channel_id']) + ); + if(! $p) + return; + + xchan_query($p,true); + $p = fetch_post_tags($p,true); + + $o = "[share author='".urlencode($p[0]['author']['xchan_name']). + "' profile='".$p[0]['author']['xchan_url'] . + "' avatar='".$p[0]['author']['xchan_photo_s']. + "' link='".$p[0]['plink']. + "' posted='".$p[0]['created']. + "' message_id='".$p[0]['mid']."']"; + if($p[0]['title']) + $o .= '[b]'.$p[0]['title'].'[/b]'."\r\n"; + $o .= $p[0]['body']; + $o .= "[/share]"; + $o = bbcode($o); + + $ret['type'] = 'rich'; + + $w = (($maxwidth) ? $maxwidth : 640); + $h = (($maxheight) ? $maxheight : $w * 2 / 3); + + $ret['html'] = '<div style="width: ' . $w . '; height: ' . $h . ';" >' . $o . '</div>'; + + $ret['width'] = $w; + $ret['height'] = $h; + + return $ret; + +} + +function oep_profile_reply($args) { + + + require_once('include/identity.php'); + require_once('include/Contact.php'); + $url = $args['url']; + + if(preg_match('#//(.*?)/(.*?)/(.*?)(/|\?|&|$)#',$url,$matches)) { + $chn = $matches[3]; + } + + if(! $chn) + return; + + $c = channelx_by_nick($chn); + + if(! $c) + return; + + + $maxwidth = intval($args['maxwidth']); + $maxheight = intval($args['maxheight']); + + $width = 800; + $height = 375; + + if($maxwidth) { + $width = $maxwidth; + $height = (375 / 800) * $width; + } + if($maxheight) { + if($maxheight < $height) { + $width = (800 / 375) * $maxheight; + $height = $maxheight; + } + } + $ret = array(); + + $ret['type'] = 'rich'; + $ret['width'] = intval($width); + $ret['height'] = intval($height); + + $ret['html'] = get_zcard($c,get_observer_hash(),array('width' => $width, 'height' => $height)); + + return $ret; + +} + +function oep_album_reply($args) { + + $ret = array(); + $url = $args['url']; + $maxwidth = intval($args['maxwidth']); + $maxheight = intval($args['maxheight']); + + if(preg_match('|//(.*?)/(.*?)/(.*?)/album/|',$url,$matches)) { + $chn = $matches[3]; + $res = hex2bin(basename($url)); + } + + if(! ($chn && $res)) + return; + $c = q("select * from channel where channel_address = '%s' limit 1", + dbesc($chn) + ); + + if(! $c) + return; + + $sql_extra = permissions_sql($c[0]['channel_id']); + + $p = q("select resource_id from photo where album = '%s' and uid = %d and scale = 0 $sql_extra order by created desc limit 1", + dbesc($res), + intval($c[0]['channel_id']) + ); + if(! $p) + return; + + $res = $p[0]['resource_id']; + + $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc", + intval($c[0]['channel_id']), + dbesc($res) + ); + + if($r) { + foreach($r as $rr) { + $foundres = false; + if($maxheight && $rr['height'] > $maxheight) + continue; + if($maxwidth && $rr['width'] > $maxwidth) + continue; + $foundres = true; + break; + } + + if($foundres) { + $ret['type'] = 'link'; + $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale']; + $ret['thumbnail_width'] = $rr['width']; + $ret['thumbnail_height'] = $rr['height']; + } + + + } + return $ret; + +} + + +function oep_phototop_reply($args) { + + $ret = array(); + $url = $args['url']; + $maxwidth = intval($args['maxwidth']); + $maxheight = intval($args['maxheight']); + + if(preg_match('|//(.*?)/(.*?)/(.*?)$|',$url,$matches)) { + $chn = $matches[3]; + } + + if(! $chn) + return; + $c = q("select * from channel where channel_address = '%s' limit 1", + dbesc($chn) + ); + + if(! $c) + return; + + $sql_extra = permissions_sql($c[0]['channel_id']); + + $p = q("select resource_id from photo where uid = %d and scale = 0 $sql_extra order by created desc limit 1", + intval($c[0]['channel_id']) + ); + if(! $p) + return; + + $res = $p[0]['resource_id']; + + $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc", + intval($c[0]['channel_id']), + dbesc($res) + ); + + if($r) { + foreach($r as $rr) { + $foundres = false; + if($maxheight && $rr['height'] > $maxheight) + continue; + if($maxwidth && $rr['width'] > $maxwidth) + continue; + $foundres = true; + break; + } + + if($foundres) { + $ret['type'] = 'link'; + $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale']; + $ret['thumbnail_width'] = $rr['width']; + $ret['thumbnail_height'] = $rr['height']; + } + + + } + return $ret; + +} + + +function oep_photo_reply($args) { + + $ret = array(); + $url = $args['url']; + $maxwidth = intval($args['maxwidth']); + $maxheight = intval($args['maxheight']); + + if(preg_match('|//(.*?)/(.*?)/(.*?)/image/|',$url,$matches)) { + $chn = $matches[3]; + $res = basename($url); + } + + if(! ($chn && $res)) + return; + $c = q("select * from channel where channel_address = '%s' limit 1", + dbesc($chn) + ); + + if(! $c) + return; + + $sql_extra = permissions_sql($c[0]['channel_id']); + + + $r = q("select height, width, scale, resource_id from photo where uid = %d and resource_id = '%s' $sql_extra order by scale asc", + intval($c[0]['channel_id']), + dbesc($res) + ); + + if($r) { + foreach($r as $rr) { + $foundres = false; + if($maxheight && $rr['height'] > $maxheight) + continue; + if($maxwidth && $rr['width'] > $maxwidth) + continue; + $foundres = true; + break; + } + + if($foundres) { + $ret['type'] = 'link'; + $ret['thumbnail_url'] = z_root() . '/photo/' . '/' . $rr['resource_id'] . '-' . $rr['scale']; + $ret['thumbnail_width'] = $rr['width']; + $ret['thumbnail_height'] = $rr['height']; + } + + + } + return $ret; + +}
\ No newline at end of file diff --git a/mod/pdledit.php b/mod/pdledit.php index 93b8d52e6..f2a25566a 100644 --- a/mod/pdledit.php +++ b/mod/pdledit.php @@ -10,6 +10,7 @@ function pdledit_post(&$a) { goaway(z_root() . '/pdledit/' . $_REQUEST['module']); } set_pconfig(local_channel(),'system','mod_' . $_REQUEST['module'] . '.pdl',escape_tags($_REQUEST['content'])); + build_sync_packet(); info( t('Layout updated.') . EOL); goaway(z_root() . '/pdledit/' . $_REQUEST['module']); } diff --git a/mod/photos.php b/mod/photos.php index b0d9bc631..d6105c580 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -463,7 +463,7 @@ function photos_post(&$a) { $_REQUEST['group_deny'] = expand_acl($channel['channel_deny_gid']); } - $r = attach_store($a->channel,get_observer_hash(), '', $_REQUEST); + $r = attach_store($channel,get_observer_hash(), '', $_REQUEST); if(! $r['success']) { notice($r['message'] . EOL); @@ -660,6 +660,10 @@ function photos_content(&$a) { $album = (($datum) ? hex2bin($datum) : ''); + + $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->cmd) . '" title="oembed" />' . "\r\n"; + + $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s' AND `scale` <= 4 and photo_usage IN ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`", intval($owner_uid), @@ -804,6 +808,8 @@ function photos_content(&$a) { if($datatype === 'image') { + $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->cmd) . '" title="oembed" />' . "\r\n"; + // fetch image, item containing image, then comments $ph = q("SELECT id,aid,uid,xchan,resource_id,created,edited,title,`description`,album,filename,`type`,height,width,`size`,scale,photo_usage,is_nsfw,allow_cid,allow_gid,deny_cid,deny_gid FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s' @@ -1226,6 +1232,9 @@ function photos_content(&$a) { // Default - show recent photos with upload link (if applicable) //$o = ''; + $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->cmd) . '" title="oembed" />' . "\r\n"; + + $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' and photo_usage in ( %d, %d ) and is_nsfw = %d $sql_extra GROUP BY `resource_id`", intval($a->data['channel']['channel_id']), diff --git a/mod/ping.php b/mod/ping.php index 394dbf089..69d504da1 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -299,7 +299,7 @@ function ping_init(&$a) { if($r) { foreach($r as $rr) { $result[] = array( - 'notify_link' => $a->get_baseurl() . '/connedit/' . $rr['abook_id'], + 'notify_link' => $a->get_baseurl() . '/connections/ifpending', 'name' => $rr['xchan_name'], 'url' => $rr['xchan_url'], 'photo' => $rr['xchan_photo_s'], diff --git a/mod/profile.php b/mod/profile.php index 430d039e9..7ee03a77b 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -75,6 +75,7 @@ function profile_content(&$a, $update = 0) { $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']); + $a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\r\n"; $o .= advanced_profile($a); call_hooks('profile_advanced',$o); diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 2884505f0..0091d0585 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -502,8 +502,8 @@ function profile_photo_crop_ui_head(&$a, $ph, $hash, $smallest){ $width = $ph->getWidth(); $height = $ph->getHeight(); - if($width < 300 || $height < 300) { - $ph->scaleImageUp(200); + if($width < 500 || $height < 500) { + $ph->scaleImageUp(400); $width = $ph->getWidth(); $height = $ph->getHeight(); } diff --git a/mod/register.php b/mod/register.php index 2e9967c60..853728e10 100644 --- a/mod/register.php +++ b/mod/register.php @@ -1,5 +1,6 @@ <?php +require_once('include/identity.php'); function register_init(&$a) { @@ -97,15 +98,22 @@ function register_post(&$a) { require_once('include/security.php'); + if($_REQUEST['name']) + set_aconfig($result['account']['account_id'],'register','channel_name',$_REQUEST['name']); + if($_REQUEST['nickname']) + set_aconfig($result['account']['account_id'],'register','channel_address',$_REQUEST['nickname']); + if($_REQUEST['permissions_role']) + set_aconfig($result['account']['account_id'],'register','permissions_role',$_REQUEST['permissions_role']); + + $using_invites = intval(get_config('system','invitation_only')); $num_invites = intval(get_config('system','number_invites')); $invite_code = ((x($_POST,'invite_code')) ? notags(trim($_POST['invite_code'])) : ''); if($using_invites && $invite_code) { q("delete * from register where hash = '%s'", dbesc($invite_code)); -// @FIXME - this total needs to be stored by account, but pconfig operates on channels -// This also needs to be considered when using 'invites_remaining' in mod/invite.php -// set_pconfig($result['account']['account_id'],'system','invites_remaining',$num_invites); + // @FIXME - this also needs to be considered when using 'invites_remaining' in mod/invite.php + set_aconfig($result['account']['account_id'],'system','invites_remaining',$num_invites); } if($policy == REGISTER_OPEN ) { @@ -113,7 +121,7 @@ function register_post(&$a) { $res = verify_email_address($result); } else { - $res = send_verification_email($result['email'],$result['password']); + $res = send_register_success_email($result['email'],$result['password']); } if($res) { info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ; @@ -135,28 +143,43 @@ function register_post(&$a) { } authenticate_success($result['account'],true,false,true); + + $new_channel = false; + + if(get_config('system','auto_channel_create')) { + $new_channel = auto_channel_create($result['account']['account_id']); + if($new_channel['success']) { + $channel_id = $new_channel['channel']['channel_id']; + change_channel($channel_id); + $next_page = '~'; + } + else + $new_channel = false; + } + if(! $new_channel) { + if(! strlen($next_page = get_config('system','workflow_register_next'))) + $next_page = 'new_channel'; - if(! strlen($next_page = get_config('system','workflow_register_next'))) - $next_page = 'new_channel'; + $_SESSION['workflow'] = true; + } - $_SESSION['workflow'] = true; - goaway(z_root() . '/' . $next_page); } - - - - function register_content(&$a) { $registration_is = ''; $other_sites = ''; if(get_config('system','register_policy') == REGISTER_CLOSED) { + if(get_config('system','directory_mode') == DIRECTORY_MODE_STANDALONE) { + notice( t('Registration on this site is disabled.') . EOL); + return; + } + require_once('mod/pubsites.php'); return pubsites_content($a); } @@ -200,7 +223,12 @@ function register_content(&$a) { $password = ((x($_REQUEST,'password')) ? trim($_REQUEST['password']) : "" ); $password2 = ((x($_REQUEST,'password2')) ? trim($_REQUEST['password2']) : "" ); $invite_code = ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : "" ); + $name = ((x($_REQUEST,'name')) ? escape_tags(trim($_REQUEST['name'])) : "" ); + $nickname = ((x($_REQUEST,'nickname')) ? strip_tags(trim($_REQUEST['nickname'])) : "" ); + $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); + $auto_create = get_config('system','auto_channel_create'); + $default_role = get_config('system','default_permissions_role'); require_once('include/bbcode.php'); @@ -214,7 +242,17 @@ function register_content(&$a) { '$invite_desc' => t('Membership on this site is by invitation only.'), '$label_invite' => t('Please enter your invitation code'), '$invite_code' => $invite_code, - + '$auto_create' => $auto_create, + '$label_name' => t('Channel Name'), + '$help_name' => t('Enter your name'), + '$label_nick' => t('Choose a short nickname'), + '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), + '$name' => $name, + '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), + '$role' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()), + '$default_role' => $default_role, + '$nickname' => $nickname, + '$submit' => t('Create'), '$label_email' => t('Your email address'), '$label_pass1' => t('Choose a password'), '$label_pass2' => t('Please re-enter your password'), diff --git a/mod/regmod.php b/mod/regmod.php index c0a75ef48..a1d300e56 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -25,10 +25,10 @@ function regmod_content(&$a) { $hash = argv(2); if($cmd === 'deny') { - if (!user_deny($hash)) killme(); + if (! account_deny($hash)) killme(); } if($cmd === 'allow') { - if (!user_allow($hash)) killme(); + if (! account_allow($hash)) killme(); } } diff --git a/mod/regver.php b/mod/regver.php index c3ade2ee1..78f146ec5 100644 --- a/mod/regver.php +++ b/mod/regver.php @@ -13,10 +13,10 @@ function regver_content(&$a) { $hash = argv(2); if($cmd === 'deny') { - if (!user_deny($hash)) killme(); + if (! account_deny($hash)) killme(); } if($cmd === 'allow') { - if (!user_approve($hash)) killme(); + if (! account_approve($hash)) killme(); } } diff --git a/mod/rpost.php b/mod/rpost.php index d519a996b..ab5ef4ccd 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -111,7 +111,7 @@ function rpost_content(&$a) { 'default_location' => $channel['channel_location'], 'nickname' => $channel['channel_address'], 'lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'), - 'acl' => populate_acl($channel_acl), + 'acl' => populate_acl($channel_acl,true,(($channel['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')), 'bang' => '', 'visitor' => true, 'profile_uid' => local_channel(), diff --git a/mod/settings.php b/mod/settings.php index 339f83cfe..c1a4b019d 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -354,7 +354,7 @@ function settings_post(&$a) { ); } else { - notice( sprintf('Default privacy collection \'%s\' not found. Please create and re-submit permission change.', t('Friends')) . EOL); + notice( sprintf('Default privacy group \'%s\' not found. Please create and re-submit permission change.', t('Friends')) . EOL); return; } } @@ -367,7 +367,7 @@ function settings_post(&$a) { } $r = q("update abook set abook_my_perms = %d where abook_channel = %d and abook_self = 1", - intval(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0), + intval((array_key_exists('perms_accept',$role_permissions)) ? $role_permissions['perms_accept'] : 0), intval(local_channel()) ); set_pconfig(local_channel(),'system','autoperms',(($role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0)); @@ -846,9 +846,9 @@ function settings_content(&$a) { '$theme_config' => $theme_config, '$expert' => feature_enabled(local_channel(),'expert'), '$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(),'system','channel_list_mode'), t('(comments displayed separately)'), $yes_no), - '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on matrix page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no), + '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(),'system','network_list_mode'), t('(comments displayed separately)'), $yes_no), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')), - '$network_divmore_height' => array('network_divmore_height', t('Matrix page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')), + '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')), )); @@ -917,6 +917,7 @@ function settings_content(&$a) { $maxreq = $channel['channel_max_friend_req']; $expire = $channel['channel_expire_days']; $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT); + $sys_expire = get_config('system','default_expire_days'); // $unkmail = $a->user['unkmail']; // $cntunkmail = $a->user['cntunkmail']; @@ -1050,7 +1051,7 @@ function settings_content(&$a) { '$lbl_p2macro' => t('Advanced Privacy Settings'), - '$expire' => array('expire',t('Expire other channel content after this many days'),$expire,t('0 or blank prevents expiration')), + '$expire' => array('expire',t('Expire other channel content after this many days'),$expire,sprintf( t('0 or blank to use the website limit. The website expires after %d days.'),intval($sys_expire))), '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']) , t('May reduce spam activity')), '$permissions' => t('Default Post Permissions'), '$permdesc' => t("\x28click to open/close\x29"), @@ -1084,7 +1085,7 @@ function settings_content(&$a) { '$lbl_vnot' => t('Show visual notifications including:'), - '$vnotify1' => array('vnotify1', t('Unseen matrix activity'), ($vnotify & VNOTIFY_NETWORK), VNOTIFY_NETWORK, '', $yes_no), + '$vnotify1' => array('vnotify1', t('Unseen grid activity'), ($vnotify & VNOTIFY_NETWORK), VNOTIFY_NETWORK, '', $yes_no), '$vnotify2' => array('vnotify2', t('Unseen channel activity'), ($vnotify & VNOTIFY_CHANNEL), VNOTIFY_CHANNEL, '', $yes_no), '$vnotify3' => array('vnotify3', t('Unseen private messages'), ($vnotify & VNOTIFY_MAIL), VNOTIFY_MAIL, t('Recommended'), $yes_no), '$vnotify4' => array('vnotify4', t('Upcoming events'), ($vnotify & VNOTIFY_EVENT), VNOTIFY_EVENT, '', $yes_no), diff --git a/mod/share.php b/mod/share.php index 7ed6cf9a6..198a6b210 100644 --- a/mod/share.php +++ b/mod/share.php @@ -45,7 +45,7 @@ function share_init(&$a) { $is_photo = (($r[0]['obj_type'] === ACTIVITY_OBJ_PHOTO) ? true : false); if($is_photo) { $object = json_decode($r[0]['object'],true); - $photo_bb = $object['bbcode']; + $photo_bb = $object['body']; } if (strpos($r[0]['body'], "[/share]") !== false) { diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 52d014de1..f7423506f 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -12,7 +12,7 @@ function siteinfo_init(&$a) { function siteinfo_content(&$a) { if(! get_config('system','hidden_version_siteinfo')) { - $version = sprintf( t('Version %s'), RED_VERSION ); + $version = sprintf( t('Version %s'), get_project_version()); if(@is_dir('.git') && function_exists('shell_exec')) { $commit = @shell_exec('git log -1 --format="%h"'); $tag = get_std_version(); // @shell_exec('git describe --tags --abbrev=0'); diff --git a/mod/thing.php b/mod/thing.php index 280cc194d..7c5020e62 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -14,7 +14,6 @@ function thing_init(&$a) { if(! local_channel()) return; - $account_id = $a->get_account(); $channel = $a->get_channel(); $term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : ''); diff --git a/mod/wfinger.php b/mod/wfinger.php index 8b9abe4af..5270c8f31 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -101,6 +101,11 @@ function wfinger_init(&$a) { ), array( + 'rel' => 'http://ostatus.org/schema/1.0/subscribe', + 'template' => z_root() . '/follow/url={uri}', + ), + + array( 'rel' => 'http://purl.org/zot/protocol', 'href' => z_root() . '/.well-known/zot-info' . '?address=' . $r[0]['xchan_addr'], ) diff --git a/mod/xrd.php b/mod/xrd.php index a373f8bf5..34ed47149 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -50,6 +50,7 @@ function xrd_init(&$a) { // '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'], // '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'] . '/mention', '$modexp' => 'data:application/magic-public-key,' . $salmon_key, + '$subscribe' => $a->get_baseurl() . '/follow?url={uri}', // '$bigkey' => salmon_key($r[0]['pubkey']) )); |