From e98fcf68f03361329b04ddff2ae358e49329cdec Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 24 Dec 2015 14:41:18 -0800 Subject: issue #235 --- mod/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index b3ef57529..bda33f4b3 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 ); -- cgit v1.2.3 From b1a77b2235e534f2b01c8b1bb9566a2e5085d43f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 25 Dec 2015 14:59:46 -0800 Subject: don't send wall-post notifications when creating webpages on another channel --- mod/item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index bda33f4b3..eecc3a9ac 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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'], -- cgit v1.2.3 From 5a229234e79597202954cb4604bb27ec83966d56 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 25 Dec 2015 15:56:29 -0800 Subject: Set accept permissions to that of role so if you change to a custom role you don't start with nothing. --- mod/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index 339f83cfe..275b2a96f 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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)); -- cgit v1.2.3 From 1964fa05e1b8874a094922206a1fb5f436194991 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Dec 2015 15:10:36 -0800 Subject: issue #239, provide 'Public' text on ACL selector when appropriate to do so. --- mod/channel.php | 2 +- mod/network.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index 2b9d0ed89..074017466 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), diff --git a/mod/network.php b/mod/network.php index 9f0604296..ba2ef761b 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() -- cgit v1.2.3 From 9ee7d60afe1ea02bb1e2c7bf3d3780a94067d057 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Dec 2015 15:17:12 -0800 Subject: more issue #239 --- mod/rpost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') 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(), -- cgit v1.2.3 From 49e4016ba2a4827cca16138071b8c21278058066 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Fri, 1 Jan 2016 05:53:29 -0500 Subject: Misspelled Titel should be Title --- mod/events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') 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')), -- cgit v1.2.3 From c38edfcb32747c7c25f1df5968288b9eef43fddc Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 1 Jan 2016 16:12:43 -0800 Subject: issue #241 (redmatrix issue 405) --- mod/wfinger.php | 5 +++++ mod/xrd.php | 1 + 2 files changed, 6 insertions(+) (limited to 'mod') diff --git a/mod/wfinger.php b/mod/wfinger.php index 8b9abe4af..5270c8f31 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -100,6 +100,11 @@ function wfinger_init(&$a) { 'href' => z_root() . '/channel/' . $r[0]['channel_address'], ), + 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']) )); -- cgit v1.2.3 From 5b0a17359d6b5b3e27219c9e56117f1017996175 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 2 Jan 2016 23:39:57 -0800 Subject: Provide the ability for a hub admin to specify a default permissions role for the first channel created by a new account. This simplifies channel creation by restricting the available options at registration time. The restriction is not applied to any additional channels created under the same account; and in any event can be changed immediately after channel creation, if desired. --- mod/new_channel.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mod') diff --git a/mod/new_channel.php b/mod/new_channel.php index 047048f0a..bec2a3c09 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -100,6 +100,17 @@ function new_channel_content(&$a) { 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'] : "" ); @@ -117,6 +128,7 @@ function new_channel_content(&$a) { '$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', ''.t('Read more about roles').'',get_roles()), + '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create') )); -- cgit v1.2.3 From 26139ee06fc47a99c24c3d63096ccba3cb943aeb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 4 Jan 2016 23:27:06 -0800 Subject: make 'refresh permissions' do something useful for non-zot connections --- mod/connedit.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/connedit.php b/mod/connedit.php index 9c46fa999..77b54d262 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -397,7 +397,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 +404,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); } -- cgit v1.2.3 From 93565ea768a726a02052bd1279dcf09738057460 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 Jan 2016 13:01:28 -0800 Subject: features management page for hubmins --- mod/admin.php | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 85ab3627c..c175a4a61 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; @@ -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"); -- cgit v1.2.3 From 1c982315dd2d1886432eaece7c7ccb8d385640ae Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 7 Jan 2016 20:04:13 -0800 Subject: issue #251 --- mod/item.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index eecc3a9ac..b6d00e030 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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; -- cgit v1.2.3 From 66c8658898b16f6a6468bddbbc6f882b3eaf3a7d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 11 Jan 2016 16:34:12 -0800 Subject: plugin version compatibility checking. To use, set MinVersion, MaxVersion or MinPHPversion in the plugin header block. Case is not important. We check the project versions against STD_VERSION, which should be rolled to a new y of x.x.y if the plugin interface or project code changes in an incompatible way. --- mod/admin.php | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index c175a4a61..2d859399b 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1092,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'); @@ -1142,6 +1159,7 @@ function admin_page_plugins(&$a){ } } + $t = get_markup_template('admin_plugins_details.tpl'); return replace_macros($t, array( '$title' => t('Administration'), @@ -1153,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', @@ -1177,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); } } } @@ -1190,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'), )); } -- cgit v1.2.3 From baedd253090e1129dfea8284ee6dc29649286b3b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 12 Jan 2016 15:43:08 -0800 Subject: 'auto channel creation' - if the corresponding config variable is set, create a channel when an account is created. Plugins can provide the necessary channel details (probably from an extended registration form). If no details are provided, a social (mostly public) channel will be created using the LHS of the email address and you will be directed to your channel page (unless email verification is required, in which case this step will be delayed until successful validation and login). If the reddress is already assigned a random name(1000-9999) reddress will be assigned. --- mod/register.php | 39 +++++++++++++++++++++++++++------------ mod/regmod.php | 4 ++-- mod/regver.php | 4 ++-- 3 files changed, 31 insertions(+), 16 deletions(-) (limited to 'mod') diff --git a/mod/register.php b/mod/register.php index 2e9967c60..3a4d5bcb9 100644 --- a/mod/register.php +++ b/mod/register.php @@ -1,5 +1,6 @@ Date: Wed, 13 Jan 2016 01:17:02 -0800 Subject: more work on auto channel creation during register --- mod/register.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/register.php b/mod/register.php index 3a4d5bcb9..853728e10 100644 --- a/mod/register.php +++ b/mod/register.php @@ -98,6 +98,14 @@ 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'])) : ''); @@ -215,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'); @@ -229,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', ''.t('Read more about roles').'',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'), -- cgit v1.2.3 From e1ddee6c26f149e7fd5262b5d45217af81f4ec64 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 13 Jan 2016 11:23:40 +0100 Subject: fix sharing of photo items --- mod/share.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') 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) { -- cgit v1.2.3 From 9584ca080c10777407c59c5939dd0cf2a88a847b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 13 Jan 2016 17:32:09 -0800 Subject: some initial work on uploading and cropping cover photos --- mod/profile_photo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') 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(); } -- cgit v1.2.3 From e500a08f152d641f60c7146c6a290042bdd37a73 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 13 Jan 2016 20:26:27 -0800 Subject: more progress on cover photo cropping and storage --- mod/cover_photo.php | 391 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 391 insertions(+) create mode 100644 mod/cover_photo.php (limited to 'mod') diff --git a/mod/cover_photo.php b/mod/cover_photo.php new file mode 100644 index 000000000..fd7d794f5 --- /dev/null +++ b/mod/cover_photo.php @@ -0,0 +1,391 @@ +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; + } + + 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 * 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()) { + + $g = q("select width, height from photo where resource_id = '%s' and uid = %d and scale = 3", + dbesc($image_id), + intval(local_channel()) + ); + + // scale these numbers to the original photo instead of the scaled photo we operated on + + $scaled_width = $g[0]['width']; + $scaled_height = $g[0]['height']; + + if((! $scaled_width) || (! $scaled_height)) { + logger('potential divide by zero scaling cover photo'); + return; + } + + $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('Profile Photos')); + + $p['scale'] = 7; + $p['photo_usage'] = PHOTO_COVER; + + $r1 = $im->save($p); + + $im->doScaleImage(850,310); + $p['scale'] = 8; + + $r2 = $im->save($p); + + if($r1 === false || $r2 === 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(); + + + } + else + notice( t('Unable to process image') . EOL); + } + + goaway($a->get_baseurl() . '/profiles'); + return; // NOTREACHED + } + + + $hash = photo_new_resource(); + $smallest = 0; + + require_once('include/attach.php'); + + $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Profile 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) { + + // for now only create activities for the default profile + + if(! intval($profile['is_default'])) + return; + + $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/profile/l/' . $channel['channel_id'], + 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/profile/l/' . $channel['channel_id']) + )); + + if(stripos($profile['gender'],t('female')) !== false) + $t = t('%1$s updated her %2$s'); + elseif(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('profile photo') . '[/zrl]'; + + $ltext = '[zrl=' . z_root() . '/profile/' . $channel['channel_address'] . ']' . '[zmg=150x150]' . z_root() . '/photo/' . $photo['resource_id'] . '-4[/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) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') + )); + + 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; +} + -- cgit v1.2.3 From e2b79c34bc0c1dc5f48295c1cca7261e8cb648fb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 14 Jan 2016 13:50:47 +0100 Subject: some work on connections --- mod/connections.php | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index 2060ca85e..915d14b77 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) { @@ -224,6 +231,7 @@ function connections_content(&$a) { $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, @@ -232,7 +240,9 @@ function connections_content(&$a) { 'username' => $rr['xchan_name'], 'classes' => (intval($rr['abook_archived']) ? 'archived' : ''), 'link' => z_root() . '/connedit/' . $rr['abook_id'], + 'deletelink' => z_root() . '/connedit/' . $rr['abook_id'] . '/drop', 'edit' => t('Edit'), + 'delete' => t('Delete'), 'url' => chanlink_url($rr['xchan_url']), 'network' => network_to_name($rr['network']), ); @@ -257,12 +267,13 @@ function connections_content(&$a) { else { $o .= ""; $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, -- cgit v1.2.3 From 4506d80198fb30d09239541f21fe11c173c6c84e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Jan 2016 11:45:48 -0800 Subject: revision update --- mod/cover_photo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/cover_photo.php b/mod/cover_photo.php index fd7d794f5..a6262ed7c 100644 --- a/mod/cover_photo.php +++ b/mod/cover_photo.php @@ -103,7 +103,7 @@ function cover_photo_post(&$a) { $aid = get_account_id(); $p = array('aid' => $aid, 'uid' => local_channel(), 'resource_id' => $base_image['resource_id'], - 'filename' => $base_image['filename'], 'album' => t('Profile Photos')); + 'filename' => $base_image['filename'], 'album' => t('Cover Photos')); $p['scale'] = 7; $p['photo_usage'] = PHOTO_COVER; @@ -143,7 +143,7 @@ function cover_photo_post(&$a) { require_once('include/attach.php'); - $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Profile Photos'), 'hash' => $hash)); + $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash)); logger('attach_store: ' . print_r($res,true)); -- cgit v1.2.3 From 588d022fbb8490f0531b7e44a6af0b596409dc38 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 14 Jan 2016 23:23:12 +0100 Subject: provide some info about our contacts - status (archived, hidden, etc.), public forum (like in directory) and show since when we are connected --- mod/connections.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index 915d14b77..1635dcee0 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -228,6 +228,24 @@ function connections_content(&$a) { foreach($r as $rr) { if($rr['xchan_url']) { + + $status_str = ''; + $status = array( + ((intval($rr['abook_pending'])) ? t('Pending') : ''), + ((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'), @@ -244,7 +262,12 @@ function connections_content(&$a) { 'edit' => t('Edit'), 'delete' => t('Delete'), 'url' => chanlink_url($rr['xchan_url']), - 'network' => network_to_name($rr['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') ); } } -- cgit v1.2.3 From ef2890fe5156cf83de00c077f530f1404b5b509a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 15 Jan 2016 00:03:15 +0100 Subject: this might be controversal - if approving a connection from the popup go back to connections page. if the popup is dismissed and the connection is approved from the page stay on /connedit page to be able to adjust perms etc... --- mod/connedit.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mod') diff --git a/mod/connedit.php b/mod/connedit.php index 77b54d262..bcf2d744b 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; } -- cgit v1.2.3 From be9442e7b30c27d3ab91dc79c8dd1ff721a2d260 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Jan 2016 16:29:50 -0800 Subject: more cover photo work --- mod/cover_photo.php | 57 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 22 deletions(-) (limited to 'mod') diff --git a/mod/cover_photo.php b/mod/cover_photo.php index a6262ed7c..832d5ad8e 100644 --- a/mod/cover_photo.php +++ b/mod/cover_photo.php @@ -1,7 +1,8 @@ get_channel(); check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo'); @@ -78,12 +81,17 @@ function cover_photo_post(&$a) { $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()) ); - // scale these numbers to the original photo instead of the scaled photo we operated on $scaled_width = $g[0]['width']; $scaled_height = $g[0]['height']; @@ -93,6 +101,14 @@ function cover_photo_post(&$a) { 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']; @@ -114,8 +130,14 @@ function cover_photo_post(&$a) { $p['scale'] = 8; $r2 = $im->save($p); + + + $im->doScaleImage(425,160); + $p['scale'] = 9; + + $r3 = $im->save($p); - if($r1 === false || $r2 === false) { + 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 ", @@ -126,6 +148,7 @@ function cover_photo_post(&$a) { } $channel = $a->get_channel(); + send_cover_photo_activity($channel,$base_image); } @@ -133,8 +156,8 @@ function cover_photo_post(&$a) { notice( t('Unable to process image') . EOL); } - goaway($a->get_baseurl() . '/profiles'); - return; // NOTREACHED + goaway(z_root() . '/channel/' . $channel['channel_address']); + } @@ -180,12 +203,7 @@ function cover_photo_post(&$a) { } -function send_cover_photo_activity($channel,$photo,$profile) { - - // for now only create activities for the default profile - - if(! intval($profile['is_default'])) - return; +function send_cover_photo_activity($channel,$photo) { $arr = array(); $arr['item_thread_top'] = 1; @@ -196,20 +214,15 @@ function send_cover_photo_activity($channel,$photo,$profile) { $arr['object'] = json_encode(array( 'type' => $arr['obj_type'], - 'id' => z_root() . '/photo/profile/l/' . $channel['channel_id'], - 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/profile/l/' . $channel['channel_id']) + 'id' => z_root() . '/photo/' . $photo['resource_id'] . '-7', + 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7') )); - if(stripos($profile['gender'],t('female')) !== false) - $t = t('%1$s updated her %2$s'); - elseif(stripos($profile['gender'],t('male')) !== false) - $t = t('%1$s updated his %2$s'); - else - $t = t('%1$s updated their %2$s'); + $t = t('%1$s updated their %2$s'); - $ptext = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' . t('profile photo') . '[/zrl]'; + $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=150x150]' . z_root() . '/photo/' . $photo['resource_id'] . '-4[/zmg][/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; -- cgit v1.2.3 From f888548e0e722933e5b03b49fd5e19dd6e55743e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Jan 2016 20:51:59 -0800 Subject: issue with plugin loadable layouts --- mod/cover_photo.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/cover_photo.php b/mod/cover_photo.php index 832d5ad8e..de11857b0 100644 --- a/mod/cover_photo.php +++ b/mod/cover_photo.php @@ -68,6 +68,14 @@ function cover_photo_post(&$a) { $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()) @@ -148,7 +156,7 @@ function cover_photo_post(&$a) { } $channel = $a->get_channel(); - send_cover_photo_activity($channel,$base_image); + send_cover_photo_activity($channel,$base_image,$profile); } @@ -203,7 +211,7 @@ function cover_photo_post(&$a) { } -function send_cover_photo_activity($channel,$photo) { +function send_cover_photo_activity($channel,$photo,$profile) { $arr = array(); $arr['item_thread_top'] = 1; @@ -218,7 +226,12 @@ function send_cover_photo_activity($channel,$photo) { 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7') )); - $t = t('%1$s updated their %2$s'); + 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]'; -- cgit v1.2.3 From 63ee0daac51b8c04123479f2ac91e1762492896f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 15 Jan 2016 10:42:44 +0100 Subject: provide more contact infos and update some protocol type definitions --- mod/connections.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index 1635dcee0..08da4a790 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -231,7 +231,7 @@ function connections_content(&$a) { $status_str = ''; $status = array( - ((intval($rr['abook_pending'])) ? t('Pending') : ''), + ((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') : ''), @@ -262,6 +262,9 @@ function connections_content(&$a) { 'edit' => t('Edit'), 'delete' => t('Delete'), 'url' => chanlink_url($rr['xchan_url']), + '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'), -- cgit v1.2.3 From f4e1b2123aed39e3f863ee327b27cb0e7f17520c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 15 Jan 2016 11:28:05 +0100 Subject: add an approve button to /connections and get rid of the modal popup in /connedit. for quick approval (default collection and perms etc.) we now can use the approve button in /connections else click the edit button and make changes and approval from /connedit. hope thats any better... --- mod/connections.php | 8 +++----- mod/connedit.php | 4 ---- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index 08da4a790..3297ae8f8 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -251,15 +251,11 @@ function connections_content(&$a) { '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'], 'deletelink' => z_root() . '/connedit/' . $rr['abook_id'] . '/drop', - 'edit' => t('Edit'), 'delete' => t('Delete'), 'url' => chanlink_url($rr['xchan_url']), 'webbie_label' => t('Channel address'), @@ -270,7 +266,9 @@ function connections_content(&$a) { 'status_label' => t('Status'), 'status' => $status_str, 'connected_label' => t('Connected'), - 'connected' => datetime_convert('UTC',date_default_timezone_get(),$rr['abook_created'], 'c') + 'connected' => datetime_convert('UTC',date_default_timezone_get(),$rr['abook_created'], 'c'), + 'approve_hover' => t('Approve connection'), + 'approve' => (($rr['abook_pending']) ? t('Approve') : false) ); } } diff --git a/mod/connedit.php b/mod/connedit.php index bcf2d744b..cb785fc31 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -714,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'), -- cgit v1.2.3 From d36aa4fc89f99dc408e356347e74eead746f3e53 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 15 Jan 2016 12:08:04 +0100 Subject: provide a recent activity link in /connections --- mod/connections.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index 3297ae8f8..f43dec73e 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -255,7 +255,7 @@ function connections_content(&$a) { 'name' => $rr['xchan_name'], 'classes' => (intval($rr['abook_archived']) ? 'archived' : ''), 'link' => z_root() . '/connedit/' . $rr['abook_id'], - 'deletelink' => z_root() . '/connedit/' . $rr['abook_id'] . '/drop', + 'deletelink' => z_root() . '/connedit/' . intval($rr['abook_id']) . '/drop', 'delete' => t('Delete'), 'url' => chanlink_url($rr['xchan_url']), 'webbie_label' => t('Channel address'), @@ -268,7 +268,9 @@ function connections_content(&$a) { '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) + 'approve' => (($rr['abook_pending']) ? t('Approve') : false), + 'recent_label' => t('Recent activity'), + 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']) ); } } -- cgit v1.2.3 From 110ef6201e0a3731967a662afed1606b7077d0b0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 16 Jan 2016 14:00:22 -0800 Subject: add $deliver flag to item_store() and item_store_update() [default true]. If false, do not send any notifications or process tag_deliver. This should avoid any network activity from happening as the result of a channel (actually item) import. Other minor fixes in the handling of the $allow_exec flag and further protecting CSS passed to widgets from rogue code and XSS. --- mod/import_items.php | 6 ------ mod/item.php | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) (limited to 'mod') 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 b6d00e030..f100c9dfe 100644 --- a/mod/item.php +++ b/mod/item.php @@ -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) ); -- cgit v1.2.3 From 9b3b2efe9aa374565c0c67bbc67c36f9c99d3add Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 17 Jan 2016 01:05:32 -0800 Subject: call build_sync_packet() on pdledit updates --- mod/pdledit.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') 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']); } -- cgit v1.2.3 From 819a331c4a9e604673e824631f2afe52ece3381b Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Sun, 17 Jan 2016 20:03:26 +0100 Subject: update es-es and nl strings. adjusted a few matrix to grid strings --- mod/admin.php | 2 +- mod/settings.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 2d859399b..b537992d7 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -492,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"), )); } diff --git a/mod/settings.php b/mod/settings.php index 275b2a96f..d2ba590a2 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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')), )); @@ -1084,7 +1084,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), -- cgit v1.2.3 From 10ed334e8c81d1db4a506716b78ece13dc69266c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 17 Jan 2016 16:29:32 -0800 Subject: various issues from the forums --- mod/help.php | 8 ++++++-- mod/linkinfo.php | 2 +- mod/siteinfo.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'mod') 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 .= '
  • ' . ucwords(str_replace('_',' ',notags($fname))) . '
    ' . - str_replace('$Projectname',PLATFORM_NAME,substr($rr['text'],0,200)) . '...

  • '; + str_replace('$Projectname',get_platform_name(),substr($rr['text'],0,200)) . '...

    '; } $o .= ''; @@ -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/linkinfo.php b/mod/linkinfo.php index c3df1305d..d615b178f 100644 --- a/mod/linkinfo.php +++ b/mod/linkinfo.php @@ -113,7 +113,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/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'); -- cgit v1.2.3 From 1d891984441fa2f4aa8e311191da23e9ddd6e928 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 20 Jan 2016 23:16:12 -0800 Subject: issue #263 - account_default_channel not set to 0 when last channel of an account is removed --- mod/item.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index f100c9dfe..fdc768c67 100644 --- a/mod/item.php +++ b/mod/item.php @@ -817,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(); } -- cgit v1.2.3 From 55e9bd36605690cc0dfdc03145ab8ed13a417866 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Thu, 21 Jan 2016 22:02:31 +0100 Subject: A few minor tweaks in schemas + link to login form in lostpass --- mod/lostpass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') 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' => '' . t('click here to login') . '.', + '$lbl5' => '' . t('click here to login') . '.', '$lbl6' => t('Your password may be changed from the Settings page after successful login.'), '$newpass' => $new_password, '$baseurl' => $a->get_baseurl() -- cgit v1.2.3 From e52f64e3d2c646f6c6ed1f4710db707d23b279bf Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 21 Jan 2016 19:26:04 -0800 Subject: fix visitor photo uploads --- mod/photos.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index b0d9bc631..f1b7aceed 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); -- cgit v1.2.3 From 48495f41e898498a91a1b3d9e8fa1950e60a12de Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 22 Jan 2016 02:22:27 -0800 Subject: provide mechanism for custom .well-known handlers and static files (e.g. for letsencypt ownership verification). Document that if you create a .well-known directory to validate a letsencrypt cert you need to remove it before installing hubzilla. We probably need a check for this in the install checklist. --- mod/_well_known.php | 13 +++++++++++++ mod/hostxrd.php | 1 + 2 files changed, 14 insertions(+) (limited to 'mod') diff --git a/mod/_well_known.php b/mod/_well_known.php index d88bc2391..58ed13ece 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -33,6 +33,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/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(); } -- cgit v1.2.3 From 7b73a689e1b8bc7de96b30f8080d6a7fb479e7ae Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 23 Jan 2016 16:25:38 -0800 Subject: provide option to use exec in proc_run --- mod/channel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index 074017466..3b80e2cb8 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -163,6 +163,7 @@ function channel_content(&$a, $update = 0, $load = false) { $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 +259,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, -- cgit v1.2.3 From 0db2fe6e39cca8eda1d2f53b3715a67e1bce4c5c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 24 Jan 2016 13:53:18 -0800 Subject: remote delegation issue when already logged in with different account on same site. --- mod/magic.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod') 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; } } -- cgit v1.2.3 From baed7d339ee0d5139fe1c93691a4225796e7e08c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 24 Jan 2016 15:20:25 -0800 Subject: make exec the default for proc_run - use system.use_proc_open to use proc_open. Also prohibit delegated channels from manually invoking new_channel under the delegated account. --- mod/new_channel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/new_channel.php b/mod/new_channel.php index bec2a3c09..0429bbee7 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -64,7 +64,7 @@ function new_channel_post(&$a) { $arr = $_POST; - if(($arr['account_id'] = get_account_id()) === false) { + if((! $a->get_account()) || ($arr['account_id'] = get_account_id()) === false) { notice( t('Permission denied.') . EOL ); return; } @@ -95,7 +95,7 @@ function new_channel_post(&$a) { function new_channel_content(&$a) { - if(! get_account_id()) { + if(! $a->get_account()) { notice( t('Permission denied.') . EOL); return; } -- cgit v1.2.3 From 5e9e1b2c9171905520672f7a833157d7dd53980c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 24 Jan 2016 15:44:16 -0800 Subject: cleanup and add comments about what we're trying to do here --- mod/new_channel.php | 14 ++++++++++++-- mod/thing.php | 1 - 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/new_channel.php b/mod/new_channel.php index 0429bbee7..07b6cfc85 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -64,7 +64,14 @@ function new_channel_post(&$a) { $arr = $_POST; - if((! $a->get_account()) || ($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,7 +102,10 @@ function new_channel_post(&$a) { function new_channel_content(&$a) { - if(! $a->get_account()) { + + $acc = $a->get_account(); + + if((! $acc) || $acc['account_id'] != get_account_id()) { notice( t('Permission denied.') . EOL); return; } 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'] : ''); -- cgit v1.2.3 From 1ccf836ebbc67a2eaf0a7c43a88c17235c94aef6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 24 Jan 2016 18:33:02 -0800 Subject: regression: channel name missing on delegate section of manage page --- mod/manage.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/manage.php b/mod/manage.php index b609ede44..0a0cfe921 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -148,6 +148,7 @@ 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']; } } else { -- cgit v1.2.3 From 9081ddb455993cef96e121cebb2f569ae63a50f3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 24 Jan 2016 18:36:38 -0800 Subject: don't provide notification icons on manage page for delegated channels --- mod/manage.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/manage.php b/mod/manage.php index 0a0cfe921..671003efd 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -149,6 +149,7 @@ function manage_content(&$a) { $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 { -- cgit v1.2.3 From 3494fddd7c13637c8fb25104002b59448f182e79 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 26 Jan 2016 15:12:34 -0800 Subject: change help text on other channel expiration setting to inform that there is a system limit. Ignore imported feed content that is older than expiration interval. --- mod/settings.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index d2ba590a2..cc75bbd56 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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"), -- cgit v1.2.3 From 68030d12cfefa8982774cca9714b0c1eed7b9537 Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Wed, 27 Jan 2016 00:24:05 +0100 Subject: Linking new connection notification to pending connections (see Channel 1) and improved email notifications about new connections. Could not find a way to do this also for the generic notifications. Added hub domain of channel address on the new channel page. A few people on my hub didn't understood. This example will make it more clear. Some minor bits. --- mod/new_channel.php | 1 + mod/ping.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/new_channel.php b/mod/new_channel.php index 07b6cfc85..630984bf2 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -133,6 +133,7 @@ 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 import an existing channel from another location'), '$name' => $name, 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'], -- cgit v1.2.3 From 9b08051703ff6695ba989f1cb968200ca59daeb1 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 26 Jan 2016 16:57:36 -0800 Subject: bring back the ability to ignore a pending connection request without deleting it and without always having it in your face and without jumping through hoops. --- mod/connections.php | 2 ++ mod/import.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/connections.php b/mod/connections.php index f43dec73e..1de8279c4 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -269,6 +269,8 @@ function connections_content(&$a) { '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']) ); 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 { -- cgit v1.2.3 From 202817740ab13f91ab9bd90de43116d1778cb751 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 26 Jan 2016 19:04:32 -0800 Subject: control the generation or acceptance of directory keywords --- mod/directory.php | 7 +++++-- mod/dirsearch.php | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'mod') 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 -- cgit v1.2.3 From d83b907cdcb4d7a7638b2be9a8024a43f6012827 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 26 Jan 2016 23:44:15 -0800 Subject: rename collections to privacy groups --- mod/group.php | 22 +++++++++++----------- mod/network.php | 4 ++-- mod/settings.php | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'mod') 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/network.php b/mod/network.php index ba2ef761b..17f57f498 100644 --- a/mod/network.php +++ b/mod/network.php @@ -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/settings.php b/mod/settings.php index cc75bbd56..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; } } -- cgit v1.2.3 From c214692f661488df30eaf00ca85da94a5ecc1e14 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 Jan 2016 17:06:13 -0800 Subject: add peer filtering to all .well-known services --- mod/_well_known.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mod') diff --git a/mod/_well_known.php b/mod/_well_known.php index 58ed13ece..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; -- cgit v1.2.3 From a341c889b751055e90eba9b7a14da5b7cd0e8032 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 31 Jan 2016 15:55:27 -0800 Subject: add oembed provider for photos --- mod/oep.php | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mod/photos.php | 2 ++ 2 files changed, 95 insertions(+) create mode 100644 mod/oep.php (limited to 'mod') diff --git a/mod/oep.php b/mod/oep.php new file mode 100644 index 000000000..d0f4bd193 --- /dev/null +++ b/mod/oep.php @@ -0,0 +1,93 @@ + $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/photos.php b/mod/photos.php index f1b7aceed..d187e1d45 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -804,6 +804,8 @@ function photos_content(&$a) { if($datatype === 'image') { + $a->page['htmlhead'] .= "\r\n" . '' . "\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' -- cgit v1.2.3 From fd9f792f90c2aa173627d38685829ac94909763e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 31 Jan 2016 20:05:47 -0800 Subject: add album embed (embed the most recent photo with link to album) --- mod/oep.php | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- mod/photos.php | 4 ++++ 2 files changed, 62 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/oep.php b/mod/oep.php index d0f4bd193..1cea83e95 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -35,7 +35,64 @@ function oep_init(&$a) { } -function oep_album_reply() { +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 group by resource_id $sql_extra order by created desc", + 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; } diff --git a/mod/photos.php b/mod/photos.php index d187e1d45..7864b9a18 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -660,6 +660,10 @@ function photos_content(&$a) { $album = (($datum) ? hex2bin($datum) : ''); + + $a->page['htmlhead'] .= "\r\n" . '' . "\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), -- cgit v1.2.3 From 01b5b1347521951ca78b1718b03c45897800bf5e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 31 Jan 2016 20:44:54 -0800 Subject: oep for the photo top page --- mod/oep.php | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- mod/photos.php | 3 +++ 2 files changed, 68 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/oep.php b/mod/oep.php index 1cea83e95..9bc0de98f 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -20,9 +20,10 @@ function oep_init(&$a) { if(fnmatch('*/photos/*/album/*',$url)) $arr = oep_album_reply($_REQUEST); - elseif(fnmatch('*/photos/*',$url)) + elseif(fnmatch('*/photos/*/image/*',$url)) $arr = oep_photo_reply($_REQUEST); - + elseif(fnmatch('*/photos*',$url)) + $arr = oep_phototop_reply($_REQUEST); if($arr) { header('Content-Type: application/json+oembed'); @@ -58,7 +59,7 @@ function oep_album_reply($args) { $sql_extra = permissions_sql($c[0]['channel_id']); - $p = q("select resource_id from photo where album = '%s' and uid = %d group by resource_id $sql_extra order by created desc", + $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']) ); @@ -96,6 +97,67 @@ function oep_album_reply($args) { } + +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(); diff --git a/mod/photos.php b/mod/photos.php index 7864b9a18..d6105c580 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1232,6 +1232,9 @@ function photos_content(&$a) { // Default - show recent photos with upload link (if applicable) //$o = ''; + $a->page['htmlhead'] .= "\r\n" . '' . "\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']), -- cgit v1.2.3 From ff487a02710c2a4833c78e0b015465810c3a7987 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 1 Feb 2016 14:52:08 -0800 Subject: more oembed provider work - channel articles --- mod/channel.php | 6 ++- mod/linkinfo.php | 2 + mod/oep.php | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 139 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index 3b80e2cb8..f88a5bf45 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -156,7 +156,11 @@ 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" . '' . "\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) diff --git a/mod/linkinfo.php b/mod/linkinfo.php index d615b178f..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; diff --git a/mod/oep.php b/mod/oep.php index 9bc0de98f..38b3a5c1b 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -6,9 +6,13 @@ 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']; + } - $url = $_REQUEST['url']; if(! $url) http_status_exit(404, 'Not found'); @@ -24,6 +28,12 @@ function oep_init(&$a) { $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'); @@ -35,6 +45,127 @@ function oep_init(&$a) { } +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'] = '
    ' . $o . '
    '; + + $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'] = '
    ' . $o . '
    '; + + $ret['width'] = $w; + $ret['height'] = $h; + + return $ret; + +} + +function oep_profile_reply($args) { + +} function oep_album_reply($args) { -- cgit v1.2.3 From 5edbc008659141349857363974f3760c41e7a5e5 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 1 Feb 2016 21:09:50 -0800 Subject: profile embeds (still needs a bit of work) --- mod/oep.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ mod/profile.php | 1 + 2 files changed, 45 insertions(+) (limited to 'mod') diff --git a/mod/oep.php b/mod/oep.php index 38b3a5c1b..8d959c3e2 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -165,6 +165,50 @@ function oep_mid_reply($args) { 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) { 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" . '' . "\r\n"; $o .= advanced_profile($a); call_hooks('profile_advanced',$o); -- cgit v1.2.3 From a7ed50ecd4b4defbc1d5fdf0bb4fd7d65d08a0fd Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 2 Feb 2016 19:39:47 -0800 Subject: more zcard tweaks --- mod/channel.php | 6 ++---- mod/oep.php | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index f88a5bf45..dcccb16b6 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -157,10 +157,8 @@ function channel_content(&$a, $update = 0, $load = false) { $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - if($mid) { - $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; - } - + $a->page['htmlhead'] .= "\r\n" . '' . "\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) diff --git a/mod/oep.php b/mod/oep.php index 8d959c3e2..3855a1b4a 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -32,6 +32,8 @@ function oep_init(&$a) { $arr = oep_display_reply($_REQUEST); elseif(fnmatch('*/channel/*mid=*',$url)) $arr = oep_mid_reply($_REQUEST); + elseif(fnmatch('*/channel*',$url)) + $arr = oep_profile_reply($_REQUEST); elseif(fnmatch('*/profile/*',$url)) $arr = oep_profile_reply($_REQUEST); -- cgit v1.2.3 From f9545dc35916648f88fa04c7003abe1196f38484 Mon Sep 17 00:00:00 2001 From: mrjive Date: Wed, 3 Feb 2016 14:02:34 -0800 Subject: Added section-title-wrapper and section-conent-wrapper to search result page in /help --- mod/help.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mod') diff --git a/mod/help.php b/mod/help.php index e1c6fede8..1539978f7 100644 --- a/mod/help.php +++ b/mod/help.php @@ -145,7 +145,10 @@ function help_content(&$a) { if($_REQUEST['search']) { $o .= '
    '; + $o .= '
    '; $o .= '

    ' . t('Documentation Search') . ' - ' . htmlspecialchars($_REQUEST['search']) . '

    '; + $o .= '
    '; + $o .= '
    '; $r = search_doc_files($_REQUEST['search']); if($r) { @@ -162,6 +165,7 @@ function help_content(&$a) { } $o .= ''; $o .= '
    '; + $o .= '
    '; } return $o; } -- cgit v1.2.3 From 28386d747115598ccd4851e049084219b2f99fef Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 3 Feb 2016 15:23:24 -0800 Subject: admin security page for configuring white and black lists and other security options. --- mod/admin.php | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mod/oep.php | 13 +++++++++++-- 2 files changed, 73 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index b537992d7..7ca2efa35 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 'security': + admin_page_security_post($a); + break; case 'features': admin_page_features_post($a); break; @@ -116,6 +119,9 @@ function admin_content(&$a) { // case 'hubloc': // $o = admin_page_hubloc($a); // break; + case 'security': + $o = admin_page_security($a); + break; case 'features': $o = admin_page_features($a); break; @@ -536,6 +542,15 @@ function admin_page_hubloc_post(&$a){ goaway($a->get_baseurl(true) . '/admin/hubloc' ); } +function admin_page_security_post(&$a){ + check_form_security_token_redirectOnErr('/admin/security', 'admin_security'); + + + goaway(z_root() . '/admin/security'); +} + + + function admin_page_features_post(&$a) { @@ -626,6 +641,53 @@ function admin_page_hubloc(&$a) { )); } +function admin_page_security(&$a) { + + $whitesites = get_config('system','whitelisted_sites'); + $whitesites_str = ((is_array($whitesites)) ? implode($whitesites,"\n") : ''); + + $blacksites = get_config('system','blacklisted_sites'); + $blacksites_str = ((is_array($blacksites)) ? implode($blacksites,"\n") : ''); + + + $whitechannels = get_config('system','whitelisted_channels'); + $whitechannels_str = ((is_array($whitechannels)) ? implode($whitechannels,"\n") : ''); + + $blackchannels = get_config('system','blacklisted_channels'); + $blackchannels_str = ((is_array($blackchannels)) ? implode($blackchannels,"\n") : ''); + + + $whiteembeds = get_config('system','embed_allow'); + $whiteembeds_str = ((is_array($whiteembeds)) ? implode($whiteembeds,"\n") : ''); + + $blackembeds = get_config('system','embed_deny'); + $blackembeds_str = ((is_array($blackembeds)) ? implode($blackembeds,"\n") : ''); + + $embed_coop = intval(get_config('system','embed_coop')); + + if((! $whiteembeds) && (! $blackembeds) && (! $embed_coop)) + $blackembeds_str = "youtube.com\nyoutu.be\ntwitter.com\nvimeo.com\nsoundcloud.com"; + + $t = get_markup_template('admin_security.tpl'); + return replace_macros($t, array( + '$title' => t('Administration'), + '$page' => t('Security'), + '$form_security_token' => get_form_security_token('admin_security'), + '$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently authenticated.")), + '$whitelisted_sites' => array('whitelisted_sites', t('Allow communications only from these sites'), $whitesites_str, t('One site per line. Leave empty to allow communication from anywhere by default')), + '$blacklisted_sites' => array('blacklisted_sites', t('Block communications from these sites'), $blacksites_str, ''), + '$whitelisted_channels' => array('whitelisted_channels', t('Allow communications only from these channels'), $whitechannels_str, t('One channel (hash) per line. Leave empty to allow from any channel by default')), + '$blacklisted_channels' => array('blacklisted_channels', t('Block communications from these channels'), $blackchannels_str, ''), + '$embed_allow' => array('embed_allow', t('Allow embedded HTML content only from these domains'), $whiteembeds_str, t('One site per line. Leave empty to allow from any site by default')), + '$embed_deny' => array('embed_deny', t('Block embedded HTML from these domains'), $blackembeds_str, ''), + + '$embed_coop' => array('embed_coop', t('Cooperative embed security'), $embed_coop, t('Enable to share embed security with other compatible sites/hubs')), + '$submit' => t('Submit') + )); +} + + + function admin_page_dbsync(&$a) { $o = ''; diff --git a/mod/oep.php b/mod/oep.php index 3855a1b4a..42535c069 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -8,6 +8,7 @@ function oep_init(&$a) { logger('oep: ' . print_r($_REQUEST,true), LOGGER_DEBUG, LOG_INFO); + $html = ((argc() > 1 && argv(1) === 'html') ? true : false); if($_REQUEST['url']) { $_REQUEST['url'] = strip_zids($_REQUEST['url']); $url = $_REQUEST['url']; @@ -38,8 +39,16 @@ function oep_init(&$a) { $arr = oep_profile_reply($_REQUEST); if($arr) { - header('Content-Type: application/json+oembed'); - echo json_encode($arr); + if($html) { + if($arr['type'] === 'rich') { + header('Content-Type: text/html'); + echo $arr['html']; + } + } + else { + header('Content-Type: application/json+oembed'); + echo json_encode($arr); + } killme(); } -- cgit v1.2.3 From c75f76f740be16f9880650fcff359d7afd85991d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 3 Feb 2016 20:24:46 -0800 Subject: heavy lifting on admin security page --- mod/admin.php | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 7ca2efa35..bdb4bf861 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -542,9 +542,47 @@ function admin_page_hubloc_post(&$a){ goaway($a->get_baseurl(true) . '/admin/hubloc' ); } +function trim_array_elems($arr) { + $narr = array(); + + if($arr && is_array($arr)) { + for($x = 0; $x < count($arr); $x ++) { + $y = trim($arr[$x]); + if($y) + $narr[] = $y; + } + } + return $narr; +} + function admin_page_security_post(&$a){ check_form_security_token_redirectOnErr('/admin/security', 'admin_security'); +logger('post: ' . print_r($_POST,true)); + + $block_public = ((x($_POST,'block_public')) ? True : False); + set_config('system','block_public',$block_public); + + $ws = trim_array_elems(explode("\n",$_POST['whitelisted_sites'])); + set_config('system','whitelisted_sites',$ws); + + $bs = trim_array_elems(explode("\n",$_POST['blacklisted_sites'])); + set_config('system','blacklisted_sites',$bs); + + $wc = trim_array_elems(explode("\n",$_POST['whitelisted_channels'])); + set_config('system','whitelisted_channels',$wc); + + $bc = trim_array_elems(explode("\n",$_POST['blacklisted_channels'])); + set_config('system','blacklisted_channels',$bc); + + $embed_coop = ((x($_POST,'embed_coop')) ? True : False); + set_config('system','embed_coop',$embed_coop); + + $we = trim_array_elems(explode("\n",$_POST['embed_allow'])); + set_config('system','embed_allow',$we); + + $be = trim_array_elems(explode("\n",$_POST['embed_deny'])); + set_config('system','embed_deny',$be); goaway(z_root() . '/admin/security'); } @@ -666,7 +704,7 @@ function admin_page_security(&$a) { $embed_coop = intval(get_config('system','embed_coop')); if((! $whiteembeds) && (! $blackembeds) && (! $embed_coop)) - $blackembeds_str = "youtube.com\nyoutu.be\ntwitter.com\nvimeo.com\nsoundcloud.com"; + $whiteembeds_str = "youtube.com\nyoutu.be\ntwitter.com\nvimeo.com\nsoundcloud.com\nwikipedia.com"; $t = get_markup_template('admin_security.tpl'); return replace_macros($t, array( -- cgit v1.2.3 From 24e2eedd0f3d119d9483ad787c288265e8429072 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 3 Feb 2016 20:29:46 -0800 Subject: don't implement the default embed whitelist just yet --- mod/admin.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index bdb4bf861..dfdc65245 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -703,8 +703,9 @@ function admin_page_security(&$a) { $embed_coop = intval(get_config('system','embed_coop')); - if((! $whiteembeds) && (! $blackembeds) && (! $embed_coop)) - $whiteembeds_str = "youtube.com\nyoutu.be\ntwitter.com\nvimeo.com\nsoundcloud.com\nwikipedia.com"; +// wait to implement this until we have a co-op in place. +// if((! $whiteembeds) && (! $blackembeds) && (! $embed_coop)) +// $whiteembeds_str = "youtube.com\nyoutu.be\ntwitter.com\nvimeo.com\nsoundcloud.com\nwikipedia.com"; $t = get_markup_template('admin_security.tpl'); return replace_macros($t, array( -- cgit v1.2.3 From e6f388d8694b3f33d2039a525a855775487ca77c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 3 Feb 2016 20:32:26 -0800 Subject: finish moving block_public to the new security page --- mod/admin.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index dfdc65245..09bfef84a 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -257,7 +257,6 @@ function admin_page_site_post(&$a){ $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : ''); $allowed_email = ((x($_POST,'allowed_email')) ? notags(trim($_POST['allowed_email'])) : ''); $not_allowed_email = ((x($_POST,'not_allowed_email')) ? notags(trim($_POST['not_allowed_email'])) : ''); - $block_public = ((x($_POST,'block_public')) ? True : False); $force_publish = ((x($_POST,'publish_all')) ? True : False); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); $login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False); @@ -322,7 +321,6 @@ function admin_page_site_post(&$a){ set_config('system','allowed_sites', $allowed_sites); set_config('system','allowed_email', $allowed_email); set_config('system','not_allowed_email', $not_allowed_email); - set_config('system','block_public', $block_public); set_config('system','publish_all', $force_publish); set_config('system','disable_discover_tab', $disable_discover_tab); if ($global_directory == '') { @@ -483,7 +481,6 @@ function admin_page_site(&$a) { '$allowed_sites' => array('allowed_sites', t("Allowed friend domains"), get_config('system','allowed_sites'), t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")), '$allowed_email' => array('allowed_email', t("Allowed email domains"), get_config('system','allowed_email'), t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")), '$not_allowed_email' => array('not_allowed_email', t("Not allowed email domains"), get_config('system','not_allowed_email'), t("Comma separated list of domains which are not allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains, unless allowed domains have been defined.")), - '$block_public' => array('block_public', t("Block public"), get_config('system','block_public'), t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")), '$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")), '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")), '$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')), -- cgit v1.2.3 From d586f64e406306a9fc55e55fa6d153e46fe0796c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 4 Feb 2016 18:35:40 -0800 Subject: update the poke page layout and UI --- mod/poke.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/poke.php b/mod/poke.php index f66d28956..15a69780c 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -158,16 +158,27 @@ function poke_content(&$a) { if($v[1] !== 'NOTRANSLATION') $shortlist[] = array($k,$v[1]); - $tpl = get_markup_template('poke_content.tpl'); - $o = replace_macros($tpl,array( - '$title' => t('Poke/Prod'), - '$desc' => t('poke, prod or do other things to somebody'), + $poke_basic = get_config('system','poke_basic'); + if($poke_basic) { + $title = t('Poke'); + $desc = t('Poke somebody'); + } + else { + $title = t('Poke/Prod'); + $desc = t('Poke, prod or do other things to somebody'); + } + + $o = replace_macros(get_markup_template('poke_content.tpl'),array( + '$title' => $title, + '$poke_basic' => $poke_basic, + '$desc' => $desc, '$clabel' => t('Recipient'), '$choice' => t('Choose what you wish to do to recipient'), '$verbs' => $shortlist, '$parent' => $parent, '$prv_desc' => t('Make this post private'), + '$private' => array('private', t('Make this post private'), false, ''), '$submit' => t('Submit'), '$name' => $name, '$id' => $id -- cgit v1.2.3 From 9cf105f8ea89165d46cfdfd6dbb729e7647c1fd0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 4 Feb 2016 23:58:31 -0800 Subject: initial uno config --- mod/setup.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'mod') diff --git a/mod/setup.php b/mod/setup.php index 5c9e988d9..886213b9d 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -138,16 +138,17 @@ function setup_post(&$a) { $tpl = get_intltext_template('htconfig.tpl'); $txt = replace_macros($tpl,array( - '$dbhost' => $dbhost, - '$dbport' => $dbport, - '$dbuser' => $dbuser, - '$dbpass' => $dbpass, - '$dbdata' => $dbdata, - '$dbtype' => $dbtype, - '$timezone' => $timezone, - '$siteurl' => $siteurl, - '$site_id' => random_string(), - '$phpath' => $phpath, + '$dbhost' => $dbhost, + '$dbport' => $dbport, + '$dbuser' => $dbuser, + '$dbpass' => $dbpass, + '$dbdata' => $dbdata, + '$dbtype' => $dbtype, + '$uno' => 0, + '$timezone' => $timezone, + '$siteurl' => $siteurl, + '$site_id' => random_string(), + '$phpath' => $phpath, '$adminmail' => $adminmail )); -- cgit v1.2.3 From 7868e476435b7d8d4530dea19686fdae04d5eb68 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 5 Feb 2016 13:32:15 -0800 Subject: more uno groundwork --- mod/register.php | 4 ++-- mod/settings.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/register.php b/mod/register.php index 853728e10..63f09a9b8 100644 --- a/mod/register.php +++ b/mod/register.php @@ -227,8 +227,8 @@ function register_content(&$a) { $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'); + $auto_create = ((UNO) || (get_config('system','auto_channel_create')) ? true : false); + $default_role = ((UNO) ? 'social' : get_config('system','default_permissions_role')); require_once('include/bbcode.php'); diff --git a/mod/settings.php b/mod/settings.php index c1a4b019d..eea3d9995 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -600,7 +600,7 @@ function settings_content(&$a) { local_channel()); if (!count($r)){ - notice(t("You can't edit this application.")); + notice(t('Application not found.')); return; } $app = $r[0]; -- cgit v1.2.3 From a5c111ef4f1876f0ae708ae0c15877a72891b5b5 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 5 Feb 2016 23:13:33 -0800 Subject: uno stuff --- mod/setup.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/setup.php b/mod/setup.php index 886213b9d..9bcbabbc5 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -67,7 +67,8 @@ function setup_post(&$a) { $phpath = trim($_POST['phpath']); $adminmail = trim($_POST['adminmail']); $siteurl = trim($_POST['siteurl']); - + $advanced = ((intval($_POST['advanced'])) ? 1 : 0); + // $siteurl should not have a trailing slash $siteurl = rtrim($siteurl,'/'); @@ -118,6 +119,7 @@ function setup_post(&$a) { $timezone = notags(trim($_POST['timezone'])); $adminmail = notags(trim($_POST['adminmail'])); $siteurl = notags(trim($_POST['siteurl'])); + $advanced = ((intval($_POST['advanced'])) ? 1 : 0); if($siteurl != z_root()) { $test = z_fetch_url($siteurl."/setup/testrewrite"); @@ -144,7 +146,7 @@ function setup_post(&$a) { '$dbpass' => $dbpass, '$dbdata' => $dbdata, '$dbtype' => $dbtype, - '$uno' => 0, + '$uno' => 1 - $advanced, '$timezone' => $timezone, '$siteurl' => $siteurl, '$site_id' => random_string(), @@ -322,7 +324,6 @@ function setup_content(&$a) { '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), - '$lbl_10' => t('Please select a default timezone for your website'), '$baseurl' => $a->get_baseurl(), @@ -364,6 +365,7 @@ function setup_content(&$a) { '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), + '$advanced' => array('advanced', t('Enable $Projectname advanced features?'), 0, t('Some advanced features, while useful - may be best suited for technically proficient audiences')), '$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()), -- cgit v1.2.3 From 021584d782c5bfafaa5ffe26d0c5850c8fffdd8f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 5 Feb 2016 23:45:16 -0800 Subject: fix uno import by disabling for now --- mod/import.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mod') diff --git a/mod/import.php b/mod/import.php index b6091d944..1a2c87a63 100644 --- a/mod/import.php +++ b/mod/import.php @@ -109,6 +109,9 @@ function import_account(&$a, $account_id) { return; } + if(UNO) + return; + if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) { $v1 = substr($data['compatibility']['database'],-4); $v2 = substr(DB_UPDATE_VERSION,-4); @@ -116,6 +119,12 @@ function import_account(&$a, $account_id) { $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 ); notice($t); } + if(array_key_exists('server_role',$data['compatibility']) + && $data['compatibility']['server_role'] != UNO) { + notice( t('Server platform is not compatible. Operation not permitted.') . EOL); + return; + } + } // import channel -- cgit v1.2.3 From d8e6fd5df0713ef4f52277944d15fd8230deec81 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 7 Feb 2016 18:11:10 -0800 Subject: provide get_server_role() to abstract different roles and capabilities --- mod/import.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/import.php b/mod/import.php index 1a2c87a63..0bbd38ffe 100644 --- a/mod/import.php +++ b/mod/import.php @@ -120,7 +120,7 @@ function import_account(&$a, $account_id) { notice($t); } if(array_key_exists('server_role',$data['compatibility']) - && $data['compatibility']['server_role'] != UNO) { + && $data['compatibility']['server_role'] != get_server_role()) { notice( t('Server platform is not compatible. Operation not permitted.') . EOL); return; } -- cgit v1.2.3 From a606173e07cfb1e9dda56d65e304f0ad53b934e6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 7 Feb 2016 20:11:08 -0800 Subject: change register workflow if uno is set --- mod/register.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/register.php b/mod/register.php index 63f09a9b8..49b010cc7 100644 --- a/mod/register.php +++ b/mod/register.php @@ -146,7 +146,7 @@ function register_post(&$a) { $new_channel = false; - if(get_config('system','auto_channel_create')) { + if(get_config('system','auto_channel_create') || UNO) { $new_channel = auto_channel_create($result['account']['account_id']); if($new_channel['success']) { $channel_id = $new_channel['channel']['channel_id']; -- cgit v1.2.3 From 00ae6bdac6062594d16870dbd9ca0593f534198e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 7 Feb 2016 21:06:17 -0800 Subject: a few tweaks to uno settings page to allow a default ACL to be created --- mod/settings.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod') diff --git a/mod/settings.php b/mod/settings.php index eea3d9995..3ca2d1218 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -1013,6 +1013,7 @@ function settings_content(&$a) { $permissions_role = 'custom'; $permissions_set = (($permissions_role != 'custom') ? true : false); + $vnotify = get_pconfig(local_channel(),'system','vnotify'); $always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices'); if($vnotify === false) @@ -1037,6 +1038,7 @@ function settings_content(&$a) { '$h_prv' => t('Security and Privacy Settings'), '$permissions_set' => $permissions_set, + '$server_role' => get_server_role(), '$perms_set_msg' => t('Your permissions are already configured. Click to view/adjust'), '$hide_presence' => array('hide_presence', t('Hide my online presence'),$hide_presence, t('Prevents displaying in your profile that you are online'), $yes_no), -- cgit v1.2.3 From be99c7fe12cc68bba1716a0b708bb171cfd223e6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 8 Feb 2016 13:57:40 -0800 Subject: sort out the well-known acme-challenge mess - at least on apache --- mod/_well_known.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/_well_known.php b/mod/_well_known.php index 47cfe1512..46714deaa 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -49,19 +49,12 @@ 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); + if(file_exists($a->cmd)) { + echo file_get_contents($a->cmd); killme(); } - elseif(file_exists($wk_file . '.php')) - require_once($wk_file . '.php'); + elseif(file_exists($a->cmd . '.php')) + require_once($a->cmd . '.php'); break; } -- cgit v1.2.3 From d96e985be0b316019fa26340a60c7247baa1090e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 8 Feb 2016 14:06:44 -0800 Subject: Revert "sort out the well-known acme-challenge mess - at least on apache" This reverts commit be99c7fe12cc68bba1716a0b708bb171cfd223e6. --- mod/_well_known.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/_well_known.php b/mod/_well_known.php index 46714deaa..47cfe1512 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -49,12 +49,19 @@ function _well_known_init(&$a){ break; default: - if(file_exists($a->cmd)) { - echo file_get_contents($a->cmd); + // 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($a->cmd . '.php')) - require_once($a->cmd . '.php'); + elseif(file_exists($wk_file . '.php')) + require_once($wk_file . '.php'); break; } -- cgit v1.2.3 From 90fd23e0cd1fe3b6d3471411f650b9b276473c68 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 8 Feb 2016 14:19:49 -0800 Subject: try that patch again --- mod/_well_known.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/_well_known.php b/mod/_well_known.php index 47cfe1512..46714deaa 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -49,19 +49,12 @@ 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); + if(file_exists($a->cmd)) { + echo file_get_contents($a->cmd); killme(); } - elseif(file_exists($wk_file . '.php')) - require_once($wk_file . '.php'); + elseif(file_exists($a->cmd . '.php')) + require_once($a->cmd . '.php'); break; } -- cgit v1.2.3 From 191a2fd5be42bef6210d4ff2e5c04efdbf7730f9 Mon Sep 17 00:00:00 2001 From: phellmes Date: Tue, 9 Feb 2016 14:20:26 +0100 Subject: [invite module] remove trailing spaces from translatable strings --- mod/invite.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/invite.php b/mod/invite.php index e8bb74ee2..7f4df6cc8 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -49,15 +49,15 @@ function invite_post(&$a) { notice( sprintf( t('%s : Not a valid email address.'), $recip) . EOL); continue; } - + else $nmessage = $message; $account = $a->get_account(); - $res = mail($recip, sprintf( t('Please join us on $Projectname'), $a->config['sitename']), - $nmessage, + $res = mail($recip, sprintf( t('Please join us on $Projectname'), $a->config['sitename']), + $nmessage, "From: " . $account['account_email'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); @@ -98,7 +98,7 @@ function invite_content(&$a) { notice( t('You have no more invitations available') . EOL); return ''; } - } + } if($invonly && ($x || is_site_admin())) { $invite_code = autoname(8) . rand(1000,9999); @@ -131,11 +131,11 @@ function invite_content(&$a) { '$msg_text' => t('Your message:'), '$default_message' => t('Please join my community on $Projectname.') . "\r\n" . "\r\n" . $linktxt - . (($invonly) ? "\r\n" . "\r\n" . t('You will need to supply this invitation code: ') . $invite_code . "\r\n" . "\r\n" : '') + . (($invonly) ? "\r\n" . "\r\n" . t('You will need to supply this invitation code:') . " " . $invite_code . "\r\n" . "\r\n" : '') . t('1. Register at any $Projectname location (they are all inter-connected)') . "\r\n" . "\r\n" . z_root() . '/register' . "\r\n" . "\r\n" . t('2. Enter my $Projectname network address into the site searchbar.') - . "\r\n" . "\r\n" . $ob['xchan_addr'] . ' (' . t('or visit ') . z_root() . '/channel/' . $channel['channel_address'] . ')' + . "\r\n" . "\r\n" . $ob['xchan_addr'] . ' (' . t('or visit') . " " . z_root() . '/channel/' . $channel['channel_address'] . ')' . "\r\n" . "\r\n" . t('3. Click [Connect]') . "\r\n" . "\r\n" , -- cgit v1.2.3 From a26d1794fea354c9c90570c6cdbdceb733d47e13 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 10 Feb 2016 23:00:40 -0800 Subject: feed dates weren't being honoured. When that was fixed they turned out to be reversed. --- mod/feed.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod') diff --git a/mod/feed.php b/mod/feed.php index eb72af9cf..087d3f827 100644 --- a/mod/feed.php +++ b/mod/feed.php @@ -31,7 +31,9 @@ function feed_init(&$a) { killme(); logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['channel_address']); + echo get_public_feed($channel,$params); + killme(); } -- cgit v1.2.3 From 55515a25d179e75bf88061b83eb102712eefdb4c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 11 Feb 2016 15:24:21 -0800 Subject: guest photo upload failing when js_upload is in use due to non-existent acl parameters --- mod/photos.php | 8 ++++++++ mod/setup.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index d6105c580..944686637 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -603,6 +603,14 @@ function photos_content(&$a) { $aclselect = (($_is_owner) ? populate_acl($channel_acl,false) : ''); + // this is wrong but is to work around an issue with js_upload wherein it chokes if these variables + // don't exist. They really should be set to a parseable representation of the channel's default permissions + // which can be processed by getSelected() + + if(! $aclselect) { + $aclselect = ''; + } + $selname = (($datum) ? hex2bin($datum) : ''); $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); diff --git a/mod/setup.php b/mod/setup.php index 9bcbabbc5..6dc141702 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -365,7 +365,7 @@ function setup_content(&$a) { '$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.')), '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), - '$advanced' => array('advanced', t('Enable $Projectname advanced features?'), 0, t('Some advanced features, while useful - may be best suited for technically proficient audiences')), + '$advanced' => array('advanced', t('Enable $Projectname advanced features?'), 1, t('Some advanced features, while useful - may be best suited for technically proficient audiences')), '$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()), -- cgit v1.2.3 From 4f285911f05fa07b14d16960180b2a4985824fa2 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 14 Feb 2016 16:15:55 -0800 Subject: form cleanup (profile_photo and cover_photo), admin 'user_approve' not found, missing close div in mood_content.tpl --- mod/admin.php | 6 +++--- mod/profile_photo.php | 54 ++------------------------------------------------- 2 files changed, 5 insertions(+), 55 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 09bfef84a..5195db320 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -7,7 +7,7 @@ */ require_once('include/queue_fn.php'); - +require_once('include/account.php'); /** * @param App &$a @@ -861,13 +861,13 @@ function admin_page_users_post($a) { // registration approved button was submitted if (x($_POST, 'page_users_approve')) { foreach ($pending as $hash) { - user_allow($hash); + account_allow($hash); } } // registration deny button was submitted if (x($_POST, 'page_users_deny')) { foreach ($pending as $hash) { - user_deny($hash); + account_deny($hash); } } diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 0091d0585..9dc71f256 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -274,58 +274,6 @@ function profile_photo_post(&$a) { } -function send_profile_photo_activity($channel,$photo,$profile) { - - // for now only create activities for the default profile - - if(! intval($profile['is_default'])) - return; - - $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/profile/l/' . $channel['channel_id'], - 'link' => array('rel' => 'photo', 'type' => $photo['type'], 'href' => z_root() . '/photo/profile/l/' . $channel['channel_id']) - )); - - if(stripos($profile['gender'],t('female')) !== false) - $t = t('%1$s updated her %2$s'); - elseif(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('profile photo') . '[/zrl]'; - - $ltext = '[zrl=' . z_root() . '/profile/' . $channel['channel_address'] . ']' . '[zmg=150x150]' . z_root() . '/photo/' . $photo['resource_id'] . '-4[/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 * @@ -452,6 +400,8 @@ function profile_photo_content(&$a) { '$title' => t('Upload Profile Photo'), '$submit' => t('Upload'), '$profiles' => $profiles, + '$single' => ((count($profiles) == 1) ? true : false), + '$profile0' => $profiles[0], '$form_security_token' => get_form_security_token("profile_photo"), // FIXME - yuk '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') -- cgit v1.2.3 From 3b97a9f76664be49ab70537bbc7fc1131f157e80 Mon Sep 17 00:00:00 2001 From: phellmes Date: Mon, 15 Feb 2016 21:23:04 +0100 Subject: Add string translation to auto approval option Make the description for the auto-approval option translatable. Put the switch array of that option (with another missing t-funtion) into a $yes_no variable to be consistent with other settings pages. --- mod/connedit.php | 66 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'mod') diff --git a/mod/connedit.php b/mod/connedit.php index cb785fc31..d50783d31 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -25,7 +25,7 @@ function connedit_init(&$a) { return; if((argc() >= 2) && intval(argv(1))) { - $r = q("SELECT abook.*, xchan.* + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), @@ -58,14 +58,14 @@ function connedit_post(&$a) { $channel = $a->get_channel(); // TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the - // connection enable is toggled to a special autopost url and set permissions immediately, leaving - // the other form elements alone pending a manual submit of the form. The downside is that there + // connection enable is toggled to a special autopost url and set permissions immediately, leaving + // the other form elements alone pending a manual submit of the form. The downside is that there // will be a window of opportunity when the permissions have been set but before you've had a chance // to review and possibly restrict them. The upside is we won't have to warn you that your connection - // can't do anything until you save the bloody form. + // can't do anything until you save the bloody form. $autopost = (((argc() > 2) && (argv(2) === 'auto')) ? true : false); - + $orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", intval($contact_id), intval(local_channel()) @@ -145,7 +145,7 @@ function connedit_post(&$a) { if($z) { $record = $z[0]['xlink_id']; - $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s' + $w = q("update xlink set xlink_rating = '%d', xlink_rating_text = '%s', xlink_sig = '%s', xlink_updated = '%s' where xlink_id = %d", intval($rating), dbesc($rating_text), @@ -172,7 +172,7 @@ function connedit_post(&$a) { } if($record) { proc_run('php','include/ratenotif.php','rating',$record); - } + } } if(($_REQUEST['pending']) && intval($orig_record[0]['abook_pending'])) { @@ -181,7 +181,7 @@ function connedit_post(&$a) { // @fixme it won't be common, but when you accept a new connection request // the permissions will now be that of your permissions role and ignore // any you may have set manually on the form. We'll probably see a bug if somebody - // tries to set the permissions *and* approve the connection in the same + // tries to set the permissions *and* approve the connection in the same // request. The workaround is to approve the connection, then go back and // adjust permissions as desired. @@ -210,7 +210,7 @@ function connedit_post(&$a) { intval(local_channel()) ); - if($orig_record[0]['abook_profile'] != $profile_id) { + if($orig_record[0]['abook_profile'] != $profile_id) { //Update profile photo permissions logger('A new profile was assigned - updating profile photos'); @@ -224,7 +224,7 @@ function connedit_post(&$a) { else notice( t('Failed to update connection record.') . EOL); - if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms + if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms && (! intval($a->poi['abook_self']))) { proc_run('php', 'include/notifier.php', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id); } @@ -238,8 +238,8 @@ function connedit_post(&$a) { group_add_member(local_channel(),'',$a->poi['abook_xchan'],$g['id']); } - // Check if settings permit ("post new friend activity" is allowed, and - // friends in general or this friend in particular aren't hidden) + // Check if settings permit ("post new friend activity" is allowed, and + // friends in general or this friend in particular aren't hidden) // and send out a new friend activity $pr = q("select * from profile where uid = %d and is_default = 1 and hide_friends = 0", @@ -285,7 +285,7 @@ function connedit_post(&$a) { // Refresh the structure in memory with the new data - $r = q("SELECT abook.*, xchan.* + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), @@ -300,7 +300,7 @@ function connedit_post(&$a) { call_hooks('accept_follow', $arr); } - if(! is_null($autoperms)) + if(! is_null($autoperms)) set_pconfig(local_channel(),'system','autoperms',(($autoperms) ? $abook_my_perms : 0)); connedit_clone($a); @@ -322,7 +322,7 @@ function connedit_clone(&$a) { if(! $a->poi) return; - $r = q("SELECT abook.*, xchan.* + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), @@ -365,6 +365,8 @@ function connedit_content(&$a) { $my_perms = $x['perms_accept']; } + $yes_no = array(t('No'),t('Yes')); + if($my_perms) { $o .= "" ; + + } + + return; +} + + + +function cal_content(&$a) { + + $channel = null; + + if(argc() > 1) { + $channel = channelx_by_nick(argv(1)); + } + + + if(! $channel) { + notice( t('Channel not found.') . EOL); + return; + } + + // since we don't currently have an event permission - use the stream permission + + if(! perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_stream')) { + notice( t('Permissions denied.') . EOL); + return; + } + + $sql_extra = permissions_sql($channel['channel_id'],get_observer_hash(),'event'); + + $first_day = get_pconfig(local_channel(),'system','cal_first_day'); + $first_day = (($first_day) ? $first_day : 0); + + $htpl = get_markup_template('event_head.tpl'); + $a->page['htmlhead'] .= replace_macros($htpl,array( + '$baseurl' => $a->get_baseurl(), + '$module_url' => '/cal/' . $channel['channel_address'], + '$modparams' => 2, + '$lang' => $a->language, + '$first_day' => $first_day + )); + + $o = ''; + + $mode = 'view'; + $y = 0; + $m = 0; + $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); + +logger('args: ' . print_r($a->argv,true)); + + if(argc() > 3 && intval(argv(2)) && intval(argv(3))) { + $mode = 'view'; + $y = intval(argv(2)); + $m = intval(argv(3)); + } + if(argc() <= 3) { + $mode = 'view'; + $event_id = argv(2); + } + + if($mode == 'view') { + + /* edit/create form */ + if($event_id) { + $r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1", + dbesc($event_id), + intval($channel['channel_id']) + ); + if(count($r)) + $orig_event = $r[0]; + } + + + // Passed parameters overrides anything found in the DB + if(!x($orig_event)) + $orig_event = array(); + + + + $tz = date_default_timezone_get(); + if(x($orig_event)) + $tz = (($orig_event['adjust']) ? date_default_timezone_get() : 'UTC'); + + $syear = datetime_convert('UTC', $tz, $sdt, 'Y'); + $smonth = datetime_convert('UTC', $tz, $sdt, 'm'); + $sday = datetime_convert('UTC', $tz, $sdt, 'd'); + $shour = datetime_convert('UTC', $tz, $sdt, 'H'); + $sminute = datetime_convert('UTC', $tz, $sdt, 'i'); + + $stext = datetime_convert('UTC',$tz,$sdt); + $stext = substr($stext,0,14) . "00:00"; + + $fyear = datetime_convert('UTC', $tz, $fdt, 'Y'); + $fmonth = datetime_convert('UTC', $tz, $fdt, 'm'); + $fday = datetime_convert('UTC', $tz, $fdt, 'd'); + $fhour = datetime_convert('UTC', $tz, $fdt, 'H'); + $fminute = datetime_convert('UTC', $tz, $fdt, 'i'); + + $ftext = datetime_convert('UTC',$tz,$fdt); + $ftext = substr($ftext,0,14) . "00:00"; + + $type = ((x($orig_event)) ? $orig_event['type'] : 'event'); + + $f = get_config('system','event_input_format'); + if(! $f) + $f = 'ymd'; + + $catsenabled = feature_enabled($channel['channel_id'],'categories'); + + + $show_bd = perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_contacts'); + if(! $show_bd) { + $sql_extra .= " and event.type != 'birthday' "; + } + + + $category = ''; + + $thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); + $thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m'); + if(! $y) + $y = intval($thisyear); + if(! $m) + $m = intval($thismonth); + + // Put some limits on dates. The PHP date functions don't seem to do so well before 1900. + // An upper limit was chosen to keep search engines from exploring links millions of years in the future. + + if($y < 1901) + $y = 1900; + if($y > 2099) + $y = 2100; + + $nextyear = $y; + $nextmonth = $m + 1; + if($nextmonth > 12) { + $nextmonth = 1; + $nextyear ++; + } + + $prevyear = $y; + if($m > 1) + $prevmonth = $m - 1; + else { + $prevmonth = 12; + $prevyear --; + } + + $dim = get_dim($y,$m); + $start = sprintf('%d-%d-%d %d:%d:%d',$y,$m,1,0,0,0); + $finish = sprintf('%d-%d-%d %d:%d:%d',$y,$m,$dim,23,59,59); + + + if (argv(2) === 'json'){ + if (x($_GET,'start')) $start = $_GET['start']; + if (x($_GET,'end')) $finish = $_GET['end']; + } + + $start = datetime_convert('UTC','UTC',$start); + $finish = datetime_convert('UTC','UTC',$finish); + + $adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start); + $adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish); + + if (x($_GET,'id')){ + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan + from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d $sql_extra limit 1", + intval($channel['channel_id']), + intval($_GET['id']) + ); + } + else { + // fixed an issue with "nofinish" events not showing up in the calendar. + // There's still an issue if the finish date crosses the end of month. + // Noting this for now - it will need to be fixed here and in Friendica. + // Ultimately the finish date shouldn't be involved in the query. + + $r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan + from event left join item on event_hash = resource_id + where resource_type = 'event' and event.uid = %d $ignored + AND (( adjust = 0 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' ) + OR ( adjust = 1 AND ( finish >= '%s' or nofinish = 1 ) AND start <= '%s' )) $sql_extra ", + intval($channel['channel_id']), + dbesc($start), + dbesc($finish), + dbesc($adjust_start), + dbesc($adjust_finish) + ); + + } + + $links = array(); + + if($r) { + xchan_query($r); + $r = fetch_post_tags($r,true); + + $r = sort_by_date($r); + } + + if($r) { + foreach($r as $rr) { + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); + if(! x($links,$j)) + $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j; + } + } + + $events=array(); + + $last_date = ''; + $fmt = t('l, F j'); + + if($r) { + + foreach($r as $rr) { + + $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); + $d = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], $fmt) : datetime_convert('UTC','UTC',$rr['start'],$fmt)); + $d = day_translate($d); + + $start = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'c') : datetime_convert('UTC','UTC',$rr['start'],'c')); + if ($rr['nofinish']){ + $end = null; + } else { + $end = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['finish'], 'c') : datetime_convert('UTC','UTC',$rr['finish'],'c')); + } + + + $is_first = ($d !== $last_date); + + $last_date = $d; + + $edit = false; + + $drop = false; + + $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8')); + if(! $title) { + list($title, $_trash) = explode("$rr['id'], + 'hash' => $rr['event_hash'], + 'start'=> $start, + 'end' => $end, + 'drop' => $drop, + 'allDay' => false, + 'title' => $title, + + 'j' => $j, + 'd' => $d, + 'edit' => $edit, + 'is_first'=>$is_first, + 'item'=>$rr, + 'html'=>$html, + 'plink' => array($rr['plink'],t('Link to Source'),'',''), + ); + + + } + } + + if (argv(2) === 'json'){ + echo json_encode($events); killme(); + } + + // links: array('href', 'text', 'extra css classes', 'title') + if (x($_GET,'id')){ + $tpl = get_markup_template("event_cal.tpl"); + } + else { + $tpl = get_markup_template("events_cal-js.tpl"); + } + + $nick = $channel['channel_address']; + + $o = replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(), + '$new_event' => array($a->get_baseurl().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''), + '$previus' => array($a->get_baseurl()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''), + '$next' => array($a->get_baseurl()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''), + '$export' => array($a->get_baseurl()."/cal/$nick/$y/$m/export",t('Export'),'',''), + '$calendar' => cal($y,$m,$links, ' eventcal'), + '$events' => $events, + '$upload' => t('Import'), + '$submit' => t('Submit'), + '$prev' => t('Previous'), + '$next' => t('Next'), + '$today' => t('Today'), + '$form' => $form, + '$expandform' => ((x($_GET,'expandform')) ? true : false), + )); + + if (x($_GET,'id')){ echo $o; killme(); } + + return $o; + } + +} diff --git a/mod/events.php b/mod/events.php index b07ffa184..be39902aa 100755 --- a/mod/events.php +++ b/mod/events.php @@ -283,6 +283,8 @@ function events_content(&$a) { $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => $a->get_baseurl(), + '$module_url' => '/events', + '$modparams' => 1, '$lang' => $a->language, '$first_day' => $first_day )); @@ -296,6 +298,11 @@ function events_content(&$a) { $m = 0; $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); + +logger('args: ' . print_r($a->argv,true)); + + + if(argc() > 1) { if(argc() > 2 && argv(1) === 'add') { $mode = 'add'; -- cgit v1.2.3 From ebfa1a12b9cc3d939ed49a7f66e5687267a409d3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 25 Feb 2016 00:36:35 -0800 Subject: when creating an event from a post in our stream, if the original post was private, set the event permissions to "just me". If it was a public event, set the event permissions to the channel default permissions. --- mod/cal.php | 2 +- mod/events.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/cal.php b/mod/cal.php index 9899b33b0..1e2405cd0 100755 --- a/mod/cal.php +++ b/mod/cal.php @@ -85,7 +85,7 @@ function cal_content(&$a) { $m = 0; $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); -logger('args: ' . print_r($a->argv,true)); + // logger('args: ' . print_r($a->argv,true)); if(argc() > 3 && intval(argv(2)) && intval(argv(3))) { $mode = 'view'; diff --git a/mod/events.php b/mod/events.php index be39902aa..8e3b3e06b 100755 --- a/mod/events.php +++ b/mod/events.php @@ -299,7 +299,7 @@ function events_content(&$a) { $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); -logger('args: ' . print_r($a->argv,true)); + // logger('args: ' . print_r($a->argv,true)); -- cgit v1.2.3 From be27fb56440c6687add239e10c5e46ee7f3018f1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 25 Feb 2016 13:40:15 +0100 Subject: we have got a button for events in the nav. no need for it in the tabs if we are local. --- mod/cal.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mod') diff --git a/mod/cal.php b/mod/cal.php index 1e2405cd0..453f46f69 100755 --- a/mod/cal.php +++ b/mod/cal.php @@ -80,6 +80,8 @@ function cal_content(&$a) { $o = ''; + $tabs = profile_tabs($a, True, $channel['channel_address']); + $mode = 'view'; $y = 0; $m = 0; @@ -333,6 +335,7 @@ function cal_content(&$a) { '$today' => t('Today'), '$form' => $form, '$expandform' => ((x($_GET,'expandform')) ? true : false), + '$tabs' => $tabs )); if (x($_GET,'id')){ echo $o; killme(); } -- cgit v1.2.3 From 5ad9b48f1d916425e41f475319c7237293d055b9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 25 Feb 2016 23:59:57 +0100 Subject: revert f62ec4132ed571288737423de386054a4cc8b0d5 - allow one self to be added to a privacy group. --- mod/group.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/group.php b/mod/group.php index 7eaad771f..c63ccfa9b 100644 --- a/mod/group.php +++ b/mod/group.php @@ -117,7 +117,7 @@ function group_content(&$a) { check_form_security_token_ForbiddenOnErr('group_member_change', 't'); - $r = q("SELECT abook_xchan from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and xchan_deleted = 0 and abook_blocked = 0 and abook_pending = 0 limit 1", + $r = q("SELECT abook_xchan from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 limit 1", dbesc(base64url_decode(argv(2))), intval(local_channel()) ); @@ -208,7 +208,7 @@ function group_content(&$a) { group_rmv_member(local_channel(),$group['name'],$member['xchan_hash']); } - $r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc", + $r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_self = 0 and abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc", intval(local_channel()) ); -- cgit v1.2.3 From dc8c7a2d2e8060d295c46637e2f1caac76aca6fa Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 25 Feb 2016 16:21:38 -0800 Subject: small improvements to profile like activity --- mod/like.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/like.php b/mod/like.php index ce8bc3063..26c39bf3b 100755 --- a/mod/like.php +++ b/mod/like.php @@ -107,13 +107,13 @@ function like_content(&$a) { // to them. $allow_cid = $allow_gid = $deny_cid = $deny_gid = ''; foreach($d as $dd) { - $allow_gid .= '<' . $dd['abook_xchan'] . '>'; + $allow_cid .= '<' . $dd['abook_xchan'] . '>'; } } $post_type = t('channel'); $objtype = ACTIVITY_OBJ_PROFILE; - + $profile = $r[0]; } elseif($obj_type == 'thing') { @@ -462,6 +462,13 @@ function like_content(&$a) { if($obj_type === 'thing' && $r[0]['imgurl']) { $arr['body'] .= "\n\n[zmg=80x80]" . $r[0]['imgurl'] . '[/zmg]'; } + if($obj_type === 'profile') { + if($public) { + $arr['body'] .= "\n\n" . '[embed]' . z_root() . '/profile/' . $ch[0]['channel_address'] . '[/embed]'; + } + else + $arr['body'] .= "\n\n[zmg=80x80]" . $profile['thumb'] . '[/zmg]'; + } $arr['verb'] = $activity; -- cgit v1.2.3 From df57c90d2d93fef1d021bee4b91a50b1b34ee938 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 26 Feb 2016 14:25:18 +0100 Subject: several photo item template fixes --- mod/update_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/update_display.php b/mod/update_display.php index b448c76ee..52903bb8c 100644 --- a/mod/update_display.php +++ b/mod/update_display.php @@ -39,4 +39,4 @@ function update_display_content(&$a) { // logger('update_display: ' . $text); killme(); -} \ No newline at end of file +} -- cgit v1.2.3 From a1f046992dd1897366f6ce67cb5a8c0895b8bf2a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sat, 27 Feb 2016 17:27:46 -0800 Subject: I haven't investigated 'why', but the addition of the router class in https://github.com/redmatrix/hubzilla/commit/1db3409f36f408bfc49816e1fab3df4b53b8f19e resulted in the setup global variable $install_wizard_pass to not get initiated at the global level when the setup module file was included. This corrects the situation and makes install work but without explaining why the variable wasn't instantiated in the first place. This may be important - if any other modules use global variables internally. I don't believe that any do, but the behaviour needs to be resolved or documented. --- mod/setup.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mod') diff --git a/mod/setup.php b/mod/setup.php index 6dc141702..282b9cbef 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -41,6 +41,9 @@ function setup_init(&$a) { global $install_wizard_pass; if (x($_POST, 'pass')) $install_wizard_pass = intval($_POST['pass']); + else + $install_wizard_pass = 1; + } /** -- cgit v1.2.3 From be2b7c0b5f7f9b8080affbb4bc44c5adda18e82f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 29 Feb 2016 19:31:52 -0800 Subject: abconfig --- mod/connedit.php | 7 +++++++ mod/follow.php | 8 +++++++- mod/import.php | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/connedit.php b/mod/connedit.php index d50783d31..008bc21ac 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -322,6 +322,9 @@ function connedit_clone(&$a) { if(! $a->poi) return; + + $channel = $a->get_channel(); + $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", @@ -338,6 +341,10 @@ function connedit_clone(&$a) { unset($clone['abook_account']); unset($clone['abook_channel']); + $abconfig = load_abconfig($channel['channel_hash'],$clone['abook_xchan']); + if($abconfig) + $clone['abconfig'] = $abconfig; + build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); } diff --git a/mod/follow.php b/mod/follow.php index 3ad2cb3bb..73e87c16f 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -14,7 +14,9 @@ function follow_init(&$a) { $return_url = $_SESSION['return_url']; $confirm = intval($_REQUEST['confirm']); - $result = new_contact($uid,$url,$a->get_channel(),true,$confirm); + $channel = $a->get_channel(); + + $result = new_contact($uid,$url,$channel,true,$confirm); if($result['success'] == false) { if($result['message']) @@ -34,6 +36,10 @@ function follow_init(&$a) { unset($clone['abook_account']); unset($clone['abook_channel']); + $abconfig = load_abconfig($channel['channel_hash'],$clone['abook_xchan']); + if($abconfig) + $clone['abconfig'] = $abconfig; + build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); diff --git a/mod/import.php b/mod/import.php index 184159585..0b239d822 100644 --- a/mod/import.php +++ b/mod/import.php @@ -341,6 +341,10 @@ function import_account(&$a, $account_id) { if($abooks) { foreach($abooks as $abook) { + $abconfig = null; + if(array_key_exists('abconfig',$abook) && is_array($abook['abconfig']) && count($abook['abconfig'])) + $abconfig = $abook['abconfig']; + unset($abook['abook_id']); unset($abook['abook_rating']); unset($abook['abook_rating_text']); @@ -382,6 +386,17 @@ function import_account(&$a, $account_id) { $friends ++; if(intval($abook['abook_feed'])) $feeds ++; + + if($abconfig) { + // @fixme does not handle sync of del_abconfig + foreach($abconfig as $abc) { + if($abc['chan'] === $channel['channel_hash']) + set_abconfig($abc['chan'],$abc['xchan'],$abc['cat'],$abc['k'],$abc['v']); + } + } + + + } } logger('import step 8'); -- cgit v1.2.3 From 548bf884a4b34a4881f3188e54c592597f755dc9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 1 Mar 2016 21:06:27 -0800 Subject: profile field admin page (functional only: still needs a lot of HTML/CSS cleanup) --- mod/admin.php | 121 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 104 insertions(+), 17 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 292a4e66a..2e2536af3 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1620,26 +1620,47 @@ readable."); function admin_page_profs_post(&$a) { - if($_REQUEST['id']) { - $r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d", - dbesc($_REQUEST['field_name']), - dbesc($_REQUEST['field_type']), - dbesc($_REQUEST['field_desc']), - dbesc($_REQUEST['field_help']), - dbesc($_REQUEST['field_inputs']), - intval($_REQUEST['id']) - ); + if(array_key_exists('basic',$_REQUEST)) { + $arr = explode(',',$_REQUEST['basic']); + for($x = 0; $x < count($arr); $x ++) + if(trim($arr[$x])) + $arr[$x] = trim($arr[$x]); + set_config('system','profile_fields_basic',$arr); + + if(array_key_exists('advanced',$_REQUEST)) { + $arr = explode(',',$_REQUEST['advanced']); + for($x = 0; $x < count($arr); $x ++) + if(trim($arr[$x])) + $arr[$x] = trim($arr[$x]); + set_config('system','profile_fields_advanced',$arr); + } + goaway(z_root() . '/admin/profs'); } - else { - $r = q("insert into profdef ( field_name, field_type, field_desc, field_help, field_inputs ) values ( '%s' , '%s', '%s', '%s', '%s' )", - dbesc($_REQUEST['field_name']), - dbesc($_REQUEST['field_type']), - dbesc($_REQUEST['field_desc']), - dbesc($_REQUEST['field_help']), - dbesc($_REQUEST['field_inputs']) - ); + + + if(array_key_exists('field_name',$_REQUEST)) { + if($_REQUEST['id']) { + $r = q("update profdef set field_name = '%s', field_type = '%s', field_desc = '%s' field_help = '%s', field_inputs = '%s' where id = %d", + dbesc($_REQUEST['field_name']), + dbesc($_REQUEST['field_type']), + dbesc($_REQUEST['field_desc']), + dbesc($_REQUEST['field_help']), + dbesc($_REQUEST['field_inputs']), + intval($_REQUEST['id']) + ); + } + else { + $r = q("insert into profdef ( field_name, field_type, field_desc, field_help, field_inputs ) values ( '%s' , '%s', '%s', '%s', '%s' )", + dbesc($_REQUEST['field_name']), + dbesc($_REQUEST['field_type']), + dbesc($_REQUEST['field_desc']), + dbesc($_REQUEST['field_help']), + dbesc($_REQUEST['field_inputs']) + ); + } } + // add to chosen array basic or advanced goaway(z_root() . '/admin/profs'); @@ -1686,4 +1707,70 @@ function admin_page_profs(&$a) { '$submit' => t('Save') )); } + + $basic = ''; + $barr = array(); + $fields = get_profile_fields_basic(); + if(! $fields) + $fields = get_profile_fields_basic(1); + if($fields) { + foreach($fields as $k => $v) { + if($basic) + $basic .= ', '; + $basic .= trim($k); + $barr[] = trim($k); + } + } + + $advanced = ''; + $fields = get_profile_fields_advanced(); + if(! $fields) + $fields = get_profile_fields_advanced(1); + if($fields) { + foreach($fields as $k => $v) { + if(in_array(trim($k),$barr)) + continue; + if($advanced) + $advanced .= ', '; + $advanced .= trim($k); + } + } + + $all = ''; + $fields = get_profile_fields_advanced(1); + if($fields) { + foreach($fields as $k => $v) { + if($all) + $all .= ', '; + $all .= trim($k); + } + } + + $r = q("select * from profdef where true"); + if($r) { + foreach($r as $rr) { + if($all) + $all .= ', '; + $all .= $rr['field_name']; + } + } + + + $o = replace_macros(get_markup_template('admin_profiles.tpl'),array( + '$title' => t('Profile Management'), + '$basic' => array('basic',t('Basic Profile Fields'),$basic,''), + '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('In addition to basic fields')), + '$all' => $all, + '$all_desc' => t('All available fields'), + '$cust_field_desc' => t('Custom Fields'), + '$cust_fields' => $r, + '$edit' => t('Edit'), + '$drop' => t('Delete'), + '$new' => t('Create'), + '$submit' => t('Submit') + )); + + return $o; + + } -- cgit v1.2.3 From 6f4c45a48912c9dfaaf7631c58849476878b4fe1 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Mar 2016 15:36:14 -0800 Subject: UI cleanup for admin profile field management page --- mod/admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 2e2536af3..6ec722691 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1759,14 +1759,14 @@ function admin_page_profs(&$a) { $o = replace_macros(get_markup_template('admin_profiles.tpl'),array( '$title' => t('Profile Management'), '$basic' => array('basic',t('Basic Profile Fields'),$basic,''), - '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('In addition to basic fields')), + '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('(In addition to basic fields)')), '$all' => $all, '$all_desc' => t('All available fields'), '$cust_field_desc' => t('Custom Fields'), '$cust_fields' => $r, '$edit' => t('Edit'), '$drop' => t('Delete'), - '$new' => t('Create'), + '$new' => t('Create Custom Field'), '$submit' => t('Submit') )); -- cgit v1.2.3 From 436e91a1e13bc488003262dfffb0a7d273a3106a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Mar 2016 16:39:34 -0800 Subject: rename the menu entry and page to 'Profile Fields' to maintain consistency --- mod/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 6ec722691..6300ac027 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1757,7 +1757,7 @@ function admin_page_profs(&$a) { $o = replace_macros(get_markup_template('admin_profiles.tpl'),array( - '$title' => t('Profile Management'), + '$title' => t('Profile Fields'), '$basic' => array('basic',t('Basic Profile Fields'),$basic,''), '$advanced' => array('advanced',t('Advanced Profile Fields'),$advanced,t('(In addition to basic fields)')), '$all' => $all, -- cgit v1.2.3 From 2cf54c465d25918d582efcf2bce0e3086d270e72 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 3 Mar 2016 14:47:39 -0800 Subject: remove the markdown feature. Do not re-enable unless you are willing to support it. --- mod/item.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'mod') diff --git a/mod/item.php b/mod/item.php index f23bff3ac..038a967b2 100644 --- a/mod/item.php +++ b/mod/item.php @@ -477,15 +477,28 @@ function item_post(&$a) { if($mimetype === 'text/bbcode') { require_once('include/text.php'); - if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) { - require_once('include/bb2diaspora.php'); - $body = escape_tags(trim($body)); - $body = str_replace("\n",'
    ', $body); - - $body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body); - $body = diaspora2bb($body,true); - $body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body); - } + + // Markdown doesn't work correctly. Do not re-enable unless you're willing to fix it and support it. + + // Sample that will probably give you grief - you must preserve the linebreaks + // and provide the correct markdown interpretation and you cannot allow unfiltered HTML + + // Markdown + // ======== + // + // **bold** abcde + // fghijkl + // *italic* + // + +// if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) { +// require_once('include/bb2diaspora.php'); +// $body = escape_tags(trim($body)); +// $body = str_replace("\n",'
    ', $body); +// $body = preg_replace_callback('/\[share(.*?)\]/ism','share_shield',$body); +// $body = diaspora2bb($body,true); +// $body = preg_replace_callback('/\[share(.*?)\]/ism','share_unshield',$body); +// } // BBCODE alert: the following functions assume bbcode input // and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.) -- cgit v1.2.3 From edf6da7189b69e05128ae6c433b9744f6a09b28f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 4 Mar 2016 15:44:33 +0100 Subject: add cover photo upload link to edit profile --- mod/profiles.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index 282d741ac..3ae1390df 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -675,6 +675,7 @@ function profiles_content(&$a) { '$submit' => t('Submit'), '$viewprof' => t('View this profile'), '$editvis' => t('Edit visibility'), + '$coverpic' => t('Change Cover Photo'), '$profpic' => t('Change Profile Photo'), '$cr_prof' => t('Create a new profile using these settings'), '$cl_prof' => t('Clone this profile'), -- cgit v1.2.3 From 9a0f0181a5c103476ad8617c2d71983f2f71da1b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 4 Mar 2016 14:38:14 -0800 Subject: issues #306 and #307 --- mod/like.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/like.php b/mod/like.php index 26c39bf3b..1de7882e9 100755 --- a/mod/like.php +++ b/mod/like.php @@ -299,7 +299,8 @@ function like_content(&$a) { $verbs = " '".dbesc($activity)."' "; - $multi_undo = 0; + + $multi_undo = false; // event participation and consensus items are essentially radio toggles. If you make a subsequent choice, // we need to eradicate your first choice. @@ -310,15 +311,14 @@ function like_content(&$a) { } if($activity === ACTIVITY_AGREE || $activity === ACTIVITY_DISAGREE || $activity === ACTIVITY_ABSTAIN) { $verbs = " '" . dbesc(ACTIVITY_AGREE) . "','" . dbesc(ACTIVITY_DISAGREE) . "','" . dbesc(ACTIVITY_ABSTAIN) . "' "; - $multi_undo = 1; + $multi_undo = true; } $item_normal = item_normal(); $r = q("SELECT id, parent, uid, verb FROM item WHERE verb in ( $verbs ) $item_normal - AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') and uid = %d ", + AND author_xchan = '%s' AND thr_parent = '%s' and uid = %d ", dbesc($observer['xchan_hash']), - intval($item_id), dbesc($item['mid']), intval($owner_uid) ); @@ -338,6 +338,12 @@ function like_content(&$a) { // don't fall through and create another if(activity_match($rr['verb'],$activity)) $multi_undo = false; + + // drop_item was not done interactively, so we need to invoke the notifier + // in order to push the changes to connections + + proc_run('php','include/notifier.php','drop',$rr['id']); + } if($interactive) -- cgit v1.2.3 From 848c0389704ab14aeecc77a5b8bd5d9e7ec4ad06 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 7 Mar 2016 16:54:58 -0800 Subject: issue #313 --- mod/profiles.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index 3ae1390df..fe45f1b92 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -272,9 +272,17 @@ function profiles_post(&$a) { $name = escape_tags(trim($_POST['name'])); - if($orig[0]['name'] != $name) + if($orig[0]['name'] != $name) { $namechanged = true; + $v = validate_channelname($name); + if($v) { + $notice($v); + $namechanged = false; + $name = $orig[0]['name']; + } + } + $pdesc = escape_tags(trim($_POST['pdesc'])); $gender = escape_tags(trim($_POST['gender'])); $address = escape_tags(trim($_POST['address'])); @@ -563,6 +571,10 @@ function profiles_post(&$a) { dbesc(datetime_convert()), dbesc($channel['xchan_hash']) ); + $r = q("UPDATE channel SET channel_name = '%s' WHERE channel_hash = '%s'", + dbesc($name), + dbesc($channel['xchan_hash']) + ); } if($is_default) { -- cgit v1.2.3 From 32e903e9560b3a6d1b133524493c3d72f384164c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 7 Mar 2016 18:49:17 -0800 Subject: a bit of page cleanup for edit profiles --- mod/profiles.php | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index fe45f1b92..57d3561b1 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -695,28 +695,28 @@ function profiles_content(&$a) { '$exportable' => feature_enabled(local_channel(),'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), - '$lbl_profname' => t('Profile Name:'), - '$lbl_fullname' => t('Your Full Name:'), - '$lbl_title' => t('Title/Description:'), - '$lbl_gender' => t('Your Gender:'), - '$lbl_bd' => t("Birthday :"), - '$lbl_address' => t('Street Address:'), - '$lbl_city' => t('Locality/City:'), - '$lbl_zip' => t('Postal/Zip Code:'), - '$lbl_country' => t('Country:'), - '$lbl_region' => t('Region/State:'), - '$lbl_marital' => t(' Marital Status:'), - '$lbl_with' => t("Who: \x28if applicable\x29"), + '$lbl_profname' => t('Profile Name'), + '$lbl_fullname' => t('Your Full Name'), + '$lbl_title' => t('Title/Description'), + '$lbl_gender' => t('Your Gender'), + '$lbl_bd' => t("Birthday"), + '$lbl_address' => t('Street Address'), + '$lbl_city' => t('Locality/City'), + '$lbl_zip' => t('Postal/Zip Code'), + '$lbl_country' => t('Country'), + '$lbl_region' => t('Region/State'), + '$lbl_marital' => t(' Marital Status'), + '$lbl_with' => t("Who (if applicable)"), '$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'), - '$lbl_howlong' => t('Since [date]:'), - '$lbl_sexual' => t('Sexual Preference:'), - '$lbl_homepage' => t('Homepage URL:'), - '$lbl_hometown' => t('Hometown:'), - '$lbl_politic' => t('Political Views:'), - '$lbl_religion' => t('Religious Views:'), - '$lbl_pubkey' => t('Keywords:'), - '$lbl_likes' => t('Likes:'), - '$lbl_dislikes' => t('Dislikes:'), + '$lbl_howlong' => t('Since [date]'), + '$lbl_sexual' => t('Sexual Preference'), + '$lbl_homepage' => t('Homepage URL'), + '$lbl_hometown' => t('Hometown'), + '$lbl_politic' => t('Political Views'), + '$lbl_religion' => t('Religious Views'), + '$lbl_pubkey' => t('Keywords'), + '$lbl_likes' => t('Likes'), + '$lbl_dislikes' => t('Dislikes'), '$lbl_ex2' => t('Example: fishing photography software'), '$lbl_pubdsc' => t("Used in directory listings"), '$lbl_about' => t('Tell us about yourself...'), -- cgit v1.2.3 From 256cd6baace37c24b39057fdee6f4d3f1428c190 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 9 Mar 2016 00:46:17 -0800 Subject: work on implementing account/channel move (as opposed to clone) --- mod/network.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod') diff --git a/mod/network.php b/mod/network.php index 17f57f498..134a4081d 100644 --- a/mod/network.php +++ b/mod/network.php @@ -174,8 +174,10 @@ function network_content(&$a, $update = 0, $load = false) { if($deftag) $x['pretext'] = $deftag; + $status_editor = status_editor($a,$x); $o .= $status_editor; + } -- cgit v1.2.3 From c2cdd41e8139068426175c9e6c5fe2f771ea7caf Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 9 Mar 2016 10:04:33 +0100 Subject: Issue #316 make /display updates work. Basically copy and paste what we do on load and add $simple_update to the query. --- mod/display.php | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/display.php b/mod/display.php index b2d9ba34b..ac1de17ca 100644 --- a/mod/display.php +++ b/mod/display.php @@ -116,7 +116,7 @@ function display_content(&$a, $update = 0, $load = false) { $simple_update = (($update) ? " AND item_unseen = 1 " : ''); if($update && $_SESSION['loadtime']) - $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_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 = ''; @@ -217,9 +217,54 @@ function display_content(&$a, $update = 0, $load = false) { } } - else { - $r = array(); + } + + elseif($update && !$load) { + $r = null; + + require_once('include/identity.php'); + $sys = get_sys_channel(); + $sysid = $sys['channel_id']; + + if(local_channel()) { + $r = q("SELECT * from item + WHERE uid = %d + and mid = '%s' + $item_normal + $simple_update + limit 1", + intval(local_channel()), + dbesc($target_item['parent_mid']) + ); + if($r) { + $updateable = true; + } } + if($r === null) { + // in case somebody turned off public access to sys channel content using permissions + // make that content unsearchable by ensuring the owner_xchan can't match + if(! perm_is_allowed($sysid,$observer_hash,'view_stream')) + $sysid = 0; + + $r = q("SELECT * from item + WHERE mid = '%s' + AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' + AND `item`.`deny_gid` = '' AND item_private = 0 ) + and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) + OR uid = %d ) + $sql_extra ) + $item_normal + $simple_update + limit 1", + dbesc($target_item['parent_mid']), + intval($sysid) + ); + } + $_SESSION['loadtime'] = datetime_convert(); + } + + else { + $r = array(); } if($r) { -- cgit v1.2.3 From 7732532964cfa43c371ee70418fea0279846c7b6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 9 Mar 2016 15:56:51 -0800 Subject: handle UNO move channel operation --- mod/import.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'mod') diff --git a/mod/import.php b/mod/import.php index 0b239d822..f91f261a5 100644 --- a/mod/import.php +++ b/mod/import.php @@ -108,10 +108,9 @@ function import_account(&$a, $account_id) { import_diaspora($data); return; } - - if(UNO) - return; - + + $moving = false; + if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) { $v1 = substr($data['compatibility']['database'],-4); $v2 = substr(DB_UPDATE_VERSION,-4); @@ -119,14 +118,13 @@ function import_account(&$a, $account_id) { $t = sprintf( t('Warning: Database versions differ by %1$d updates.'), $v2 - $v1 ); notice($t); } - if(array_key_exists('server_role',$data['compatibility']) - && $data['compatibility']['server_role'] != Zotlabs\Project\System::get_server_role()) { - notice( t('Server platform is not compatible. Operation not permitted.') . EOL); - return; - } - + if(array_key_exists('server_role',$data['compatibility']) && $data['compatibility']['server_role'] == 'basic') + $moving = true; } + if($moving) + $seize = 1; + // import channel if(array_key_exists('channel',$data)) { @@ -189,7 +187,7 @@ function import_account(&$a, $account_id) { if($completed < 4) { - if(is_array($data['hubloc'])) { + if(is_array($data['hubloc']) && (! $moving)) { import_hublocs($channel,$data['hubloc'],$seize); } -- cgit v1.2.3 From 4e9440396cbff64e1ffbe3025a2e02baeb41f9c0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 11 Mar 2016 10:54:04 +0100 Subject: remove superfluous return --- mod/display.php | 1 - 1 file changed, 1 deletion(-) (limited to 'mod') diff --git a/mod/display.php b/mod/display.php index ac1de17ca..40427846b 100644 --- a/mod/display.php +++ b/mod/display.php @@ -329,6 +329,5 @@ function display_content(&$a, $update = 0, $load = false) { } */ - return $o; } -- cgit v1.2.3 From 2d8deb60826a12b5bbe6ac1a8c123796c201d6fd Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 12 Mar 2016 22:13:46 +0100 Subject: some janitor work on profiles --- mod/profiles.php | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index 57d3561b1..f6d75bb7e 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -639,14 +639,13 @@ function profiles_content(&$a) { else $fields = $profile_fields_basic; - - $opt_tpl = get_markup_template("profile_hide_friends.tpl"); - $hide_friends = replace_macros($opt_tpl,array('$field' => array( - 'hide_friends', - t('Hide your contact/friend list from viewers of this profile?'), - $r[0]['hide_friends'], - '', - ))); + $hide_friends = array( + 'hide_friends', + t('Hide your contact/friend list from viewers of this profile?'), + $r[0]['hide_friends'], + '', + array(t('No'),t('Yes')) + ); $q = q("select * from profdef where true"); if($q) { @@ -672,6 +671,7 @@ function profiles_content(&$a) { $f = 'ymd'; $is_default = (($r[0]['is_default']) ? 1 : 0); + $tpl = get_markup_template("profile_edit.tpl"); $o .= replace_macros($tpl,array( @@ -695,11 +695,7 @@ function profiles_content(&$a) { '$exportable' => feature_enabled(local_channel(),'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), - '$lbl_profname' => t('Profile Name'), - '$lbl_fullname' => t('Your Full Name'), - '$lbl_title' => t('Title/Description'), '$lbl_gender' => t('Your Gender'), - '$lbl_bd' => t("Birthday"), '$lbl_address' => t('Street Address'), '$lbl_city' => t('Locality/City'), '$lbl_zip' => t('Postal/Zip Code'), @@ -733,12 +729,12 @@ function profiles_content(&$a) { '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => $a->get_baseurl(true), '$profile_id' => $r[0]['id'], - '$profile_name' => $r[0]['profile_name'], + '$profile_name' => array('profile_name', t('Profile Name'), $r[0]['profile_name'], '', '*'), '$is_default' => $is_default, '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$advanced' => $advanced, - '$name' => $r[0]['name'], - '$pdesc' => $r[0]['pdesc'], + '$name' => array('name', t('Your Full Name'), $r[0]['name']), + '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']), '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, '$address' => $r[0]['address'], @@ -746,9 +742,8 @@ function profiles_content(&$a) { '$region' => $r[0]['region'], '$postal_code' => $r[0]['postal_code'], '$country_name' => $r[0]['country_name'], - '$age' => ((intval($r[0]['dob'])) ? '(' . t('Age: ') . age($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''), '$gender' => gender_selector($r[0]['gender']), - '$gender_min' => gender_selector_min($r[0]['gender']), + '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), '$with' => $r[0]['with'], -- cgit v1.2.3 From 370a007ee215d2889d9bf760b0247678c08d31ac Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 13 Mar 2016 21:19:15 +0100 Subject: more janitor work on profiles --- mod/profiles.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index f6d75bb7e..209a7a32d 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -641,7 +641,7 @@ function profiles_content(&$a) { $hide_friends = array( 'hide_friends', - t('Hide your contact/friend list from viewers of this profile?'), + t('Hide your connections list from viewers of this profile'), $r[0]['hide_friends'], '', array(t('No'),t('Yes')) @@ -696,18 +696,12 @@ function profiles_content(&$a) { '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), '$lbl_gender' => t('Your Gender'), - '$lbl_address' => t('Street Address'), - '$lbl_city' => t('Locality/City'), - '$lbl_zip' => t('Postal/Zip Code'), - '$lbl_country' => t('Country'), - '$lbl_region' => t('Region/State'), '$lbl_marital' => t(' Marital Status'), '$lbl_with' => t("Who (if applicable)"), '$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'), '$lbl_howlong' => t('Since [date]'), '$lbl_sexual' => t('Sexual Preference'), '$lbl_homepage' => t('Homepage URL'), - '$lbl_hometown' => t('Hometown'), '$lbl_politic' => t('Political Views'), '$lbl_religion' => t('Religious Views'), '$lbl_pubkey' => t('Keywords'), @@ -737,22 +731,22 @@ function profiles_content(&$a) { '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']), '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, - '$address' => $r[0]['address'], - '$locality' => $r[0]['locality'], - '$region' => $r[0]['region'], - '$postal_code' => $r[0]['postal_code'], - '$country_name' => $r[0]['country_name'], + '$address' => array('address', t('Street Address'), $r[0]['address']), + '$locality' => array('locality', t('Locality/City'), $r[0]['locality']), + '$region' => array('region', t('Region/State'), $r[0]['region']), + '$postal_code' => array('postal_code', t('Postal/Zip Code'), $r[0]['postal_code']), + '$country_name' => array('country', t('Country'), $r[0]['country_name']), '$gender' => gender_selector($r[0]['gender']), '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), - '$marital_min' => marital_selector_min($r[0]['marital']), + '$marital_min' => marital_selector_min($r[0]['marital']), '$with' => $r[0]['with'], '$howlong' => ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong'])), '$sexual' => sexpref_selector($r[0]['sexual']), - '$sexual_min' => sexpref_selector_min($r[0]['sexual']), + '$sexual_min' => sexpref_selector_min($r[0]['sexual']), '$about' => $r[0]['about'], '$homepage' => $r[0]['homepage'], - '$hometown' => $r[0]['hometown'], + '$hometown' => array('hometown', t('Hometown'), $r[0]['hometown']), '$politic' => $r[0]['politic'], '$religion' => $r[0]['religion'], '$keywords' => $r[0]['keywords'], -- cgit v1.2.3 From ef7494359ff78596f42ae034a0f04529b9d5afe5 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 14 Mar 2016 18:12:35 -0700 Subject: some re-working of webfinger and hcard parsing which will be necessary going forward. --- mod/webfinger.php | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'mod') diff --git a/mod/webfinger.php b/mod/webfinger.php index 74bfc3ce5..e35767338 100644 --- a/mod/webfinger.php +++ b/mod/webfinger.php @@ -4,6 +4,7 @@ function webfinger_content(&$a) { + $o .= '

    Webfinger Diagnostic

    '; $o .= '
    '; @@ -11,18 +12,34 @@ function webfinger_content(&$a) { $o .= '
    '; $o .= '

    '; - + + $old = false; if(x($_GET,'addr')) { $addr = trim($_GET['addr']); - if(strpos($addr,'@') !== false) { +// if(strpos($addr,'@') !== false) { $res = webfinger_rfc7033($addr,true); - if(! $res) + if(! $res) { $res = old_webfinger($addr); + $old = true; + } +// } +// else { +// if(function_exists('lrdd')) +// $res = lrdd($addr); +// } + + if($res && $old) { + foreach($res as $r) { + if($r['@attributes']['rel'] === 'http://microformats.org/profile/hcard') { + $hcard = unamp($r['@attributes']['href']); + require_once('library/HTML5/Parser.php'); + $res['vcard'] = scrape_vcard($hcard); + break; + } + } } - else { - if(function_exists('lrdd')) - $res = lrdd($addr); - } + + $o .= '
    ';
     		$o .= str_replace("\n",'
    ',print_r($res,true)); $o .= '
    '; -- cgit v1.2.3 From d98d7003edfb54c3bbe624e1feb53904f4756f0e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 15 Mar 2016 21:38:03 +0100 Subject: even more janitor work on profiles --- mod/profiles.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index 209a7a32d..c135814a8 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -696,10 +696,7 @@ function profiles_content(&$a) { '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), '$lbl_gender' => t('Your Gender'), - '$lbl_marital' => t(' Marital Status'), - '$lbl_with' => t("Who (if applicable)"), - '$lbl_ex1' => t('Examples: cathy123, Cathy Williams, cathy@example.com'), - '$lbl_howlong' => t('Since [date]'), + '$lbl_marital' => t('Marital Status'), '$lbl_sexual' => t('Sexual Preference'), '$lbl_homepage' => t('Homepage URL'), '$lbl_politic' => t('Political Views'), @@ -740,8 +737,8 @@ function profiles_content(&$a) { '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), '$marital_min' => marital_selector_min($r[0]['marital']), - '$with' => $r[0]['with'], - '$howlong' => ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong'])), + '$with' => array('with', t("Who (if applicable)"), $r[0]['with'], t('Examples: cathy123, Cathy Williams, cathy@example.com')), + '$howlong' => array('howlong', t('Since (date)'), ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))), '$sexual' => sexpref_selector($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']), '$about' => $r[0]['about'], -- cgit v1.2.3 From d22b21c56f978d6b1ed42c9edde2a0214a16aef7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 16 Mar 2016 13:45:24 +0100 Subject: still more janitor work on profiles --- mod/profiles.php | 53 +++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 36 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index c135814a8..2ffe7da63 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -698,25 +698,6 @@ function profiles_content(&$a) { '$lbl_gender' => t('Your Gender'), '$lbl_marital' => t('Marital Status'), '$lbl_sexual' => t('Sexual Preference'), - '$lbl_homepage' => t('Homepage URL'), - '$lbl_politic' => t('Political Views'), - '$lbl_religion' => t('Religious Views'), - '$lbl_pubkey' => t('Keywords'), - '$lbl_likes' => t('Likes'), - '$lbl_dislikes' => t('Dislikes'), - '$lbl_ex2' => t('Example: fishing photography software'), - '$lbl_pubdsc' => t("Used in directory listings"), - '$lbl_about' => t('Tell us about yourself...'), - '$lbl_hobbies' => t('Hobbies/Interests'), - '$lbl_social' => t('Contact information and Social Networks'), - '$lbl_channels' => t('My other channels'), - '$lbl_music' => t('Musical interests'), - '$lbl_book' => t('Books, literature'), - '$lbl_tv' => t('Television'), - '$lbl_film' => t('Film/dance/culture/entertainment'), - '$lbl_love' => t('Love/romance'), - '$lbl_work' => t('Work/employment'), - '$lbl_school' => t('School/education'), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => $a->get_baseurl(true), '$profile_id' => $r[0]['id'], @@ -741,24 +722,24 @@ function profiles_content(&$a) { '$howlong' => array('howlong', t('Since (date)'), ($r[0]['howlong'] === NULL_DATE ? '' : datetime_convert('UTC',date_default_timezone_get(),$r[0]['howlong']))), '$sexual' => sexpref_selector($r[0]['sexual']), '$sexual_min' => sexpref_selector_min($r[0]['sexual']), - '$about' => $r[0]['about'], - '$homepage' => $r[0]['homepage'], + '$about' => array('about', t('Tell us about yourself'), $r[0]['about']), + '$homepage' => array('homepage', t('Homepage URL'), $r[0]['homepage']), '$hometown' => array('hometown', t('Hometown'), $r[0]['hometown']), - '$politic' => $r[0]['politic'], - '$religion' => $r[0]['religion'], - '$keywords' => $r[0]['keywords'], - '$likes' => $r[0]['likes'], - '$dislikes' => $r[0]['dislikes'], - '$music' => $r[0]['music'], - '$book' => $r[0]['book'], - '$tv' => $r[0]['tv'], - '$film' => $r[0]['film'], - '$interest' => $r[0]['interest'], - '$romance' => $r[0]['romance'], - '$work' => $r[0]['work'], - '$education' => $r[0]['education'], - '$contact' => $r[0]['contact'], - '$channels' => $r[0]['channels'], + '$politic' => array('politic', t('Political Views'), $r[0]['politic']), + '$religion' => array('religion', t('Religious Views'), $r[0]['religion']), + '$keywords' => array('keywords', t('Keywords used in directory listings'), $r[0]['keywords'], t('Example: fishing photography software')), + '$likes' => array('likes', t('Likes'), $r[0]['likes']), + '$dislikes' => array('dislikes', t('Dislikes'), $r[0]['dislikes']), + '$music' => array('music', t('Musical interests'), $r[0]['music']), + '$book' => array('book', t('Books, literature'), $r[0]['book']), + '$tv' => array('tv', t('Television'), $r[0]['tv']), + '$film' => array('film', t('Film/dance/culture/entertainment'), $r[0]['film']), + '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), + '$romance' => array('romance',t('Love/romance'), $r[0]['romance']), + '$work' => array('work', t('Work/employment'), $r[0]['work']), + '$education' => array('education', t('School/education'), $r[0]['education']), + '$contact' => array('contact', t('Contact information and Social Networks'), $r[0]['contact']), + '$channels' => array('channels', t('My other channels'), $r[0]['channels']), '$extra_fields' => $extra_fields, )); -- cgit v1.2.3 From 2165733ddce0bcae386d8b4b25ef7fec83266db7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 16 Mar 2016 23:07:29 +0100 Subject: move buttons to dropdown menu and some cleanup --- mod/profiles.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index 2ffe7da63..c3f5679fe 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -686,7 +686,7 @@ function profiles_content(&$a) { '$banner' => t('Edit Profile Details'), '$submit' => t('Submit'), '$viewprof' => t('View this profile'), - '$editvis' => t('Edit visibility'), + '$editvis' => t('Edit visibility'), '$coverpic' => t('Change Cover Photo'), '$profpic' => t('Change Profile Photo'), '$cr_prof' => t('Create a new profile using these settings'), @@ -698,7 +698,6 @@ function profiles_content(&$a) { '$lbl_gender' => t('Your Gender'), '$lbl_marital' => t('Marital Status'), '$lbl_sexual' => t('Sexual Preference'), - '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$baseurl' => $a->get_baseurl(true), '$profile_id' => $r[0]['id'], '$profile_name' => array('profile_name', t('Profile Name'), $r[0]['profile_name'], '', '*'), @@ -713,7 +712,7 @@ function profiles_content(&$a) { '$locality' => array('locality', t('Locality/City'), $r[0]['locality']), '$region' => array('region', t('Region/State'), $r[0]['region']), '$postal_code' => array('postal_code', t('Postal/Zip Code'), $r[0]['postal_code']), - '$country_name' => array('country', t('Country'), $r[0]['country_name']), + '$country_name' => array('country_name', t('Country'), $r[0]['country_name']), '$gender' => gender_selector($r[0]['gender']), '$gender_min' => gender_selector_min($r[0]['gender']), '$marital' => marital_selector($r[0]['marital']), -- cgit v1.2.3 From 38eb79705e4de252f29e56543de8a287132b488e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 16 Mar 2016 18:00:13 -0700 Subject: lots of work on federated channel discovery --- mod/wfinger.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/wfinger.php b/mod/wfinger.php index 3f9826f9b..5c1a74f10 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -73,13 +73,15 @@ function wfinger_init(&$a) { $result['aliases'] = array(); - $result['properties'] = array('http://webfinger.net/ns/name' => $r[0]['channel_name']); + $result['properties'] = array( + 'http://webfinger.net/ns/name' => $r[0]['channel_name'], + 'http://xmlns.com/foaf/0.1/name' => $r[0]['channel_name'] + ); foreach($aliases as $alias) if($alias != $resource) $result['aliases'][] = $alias; - $result['links'] = array( array( -- cgit v1.2.3 From a41a05e6c0b0fa5f9497f0880a2db9d8d7374092 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 17 Mar 2016 11:50:53 +0100 Subject: bring more structure to profiles edit --- mod/profiles.php | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index c3f5679fe..aebcc9022 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -248,7 +248,7 @@ function profiles_post(&$a) { $profile_name = notags(trim($_POST['profile_name'])); if(! strlen($profile_name)) { - notify( t('Profile Name is required.') . EOL); + notice( t('Profile Name is required.') . EOL); return; } @@ -277,7 +277,7 @@ function profiles_post(&$a) { $v = validate_channelname($name); if($v) { - $notice($v); + notice($v); $namechanged = false; $name = $orig[0]['name']; } @@ -687,31 +687,36 @@ function profiles_content(&$a) { '$submit' => t('Submit'), '$viewprof' => t('View this profile'), '$editvis' => t('Edit visibility'), - '$coverpic' => t('Change Cover Photo'), - '$profpic' => t('Change Profile Photo'), + '$coverpic' => t('Change cover photo'), + '$profpic' => t('Change profile photo'), '$cr_prof' => t('Create a new profile using these settings'), '$cl_prof' => t('Clone this profile'), '$del_prof' => t('Delete this profile'), + '$addthing' => t('Add profile things'), + '$personal' => t('Personal'), + '$location' => t('Location'), + '$relation' => t('Relation'), + '$miscellaneous'=> t('Miscellaneous'), '$exportable' => feature_enabled(local_channel(),'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), - '$lbl_gender' => t('Your Gender'), - '$lbl_marital' => t('Marital Status'), - '$lbl_sexual' => t('Sexual Preference'), + '$lbl_gender' => t('Your gender'), + '$lbl_marital' => t('Marital status'), + '$lbl_sexual' => t('Sexual preference'), '$baseurl' => $a->get_baseurl(true), '$profile_id' => $r[0]['id'], - '$profile_name' => array('profile_name', t('Profile Name'), $r[0]['profile_name'], '', '*'), + '$profile_name' => array('profile_name', t('Profile name'), $r[0]['profile_name'], t('Required'), '*'), '$is_default' => $is_default, '$default' => t('This is your default profile.') . EOL . translate_scope(map_scope($channel['channel_r_profile'])), '$advanced' => $advanced, - '$name' => array('name', t('Your Full Name'), $r[0]['name']), + '$name' => array('name', t('Your full name'), $r[0]['name'], t('Required'), '*'), '$pdesc' => array('pdesc', t('Title/Description'), $r[0]['pdesc']), '$dob' => dob($r[0]['dob']), '$hide_friends' => $hide_friends, - '$address' => array('address', t('Street Address'), $r[0]['address']), + '$address' => array('address', t('Street address'), $r[0]['address']), '$locality' => array('locality', t('Locality/City'), $r[0]['locality']), '$region' => array('region', t('Region/State'), $r[0]['region']), - '$postal_code' => array('postal_code', t('Postal/Zip Code'), $r[0]['postal_code']), + '$postal_code' => array('postal_code', t('Postal/Zip code'), $r[0]['postal_code']), '$country_name' => array('country_name', t('Country'), $r[0]['country_name']), '$gender' => gender_selector($r[0]['gender']), '$gender_min' => gender_selector_min($r[0]['gender']), @@ -724,20 +729,20 @@ function profiles_content(&$a) { '$about' => array('about', t('Tell us about yourself'), $r[0]['about']), '$homepage' => array('homepage', t('Homepage URL'), $r[0]['homepage']), '$hometown' => array('hometown', t('Hometown'), $r[0]['hometown']), - '$politic' => array('politic', t('Political Views'), $r[0]['politic']), - '$religion' => array('religion', t('Religious Views'), $r[0]['religion']), + '$politic' => array('politic', t('Political views'), $r[0]['politic']), + '$religion' => array('religion', t('Religious views'), $r[0]['religion']), '$keywords' => array('keywords', t('Keywords used in directory listings'), $r[0]['keywords'], t('Example: fishing photography software')), '$likes' => array('likes', t('Likes'), $r[0]['likes']), '$dislikes' => array('dislikes', t('Dislikes'), $r[0]['dislikes']), '$music' => array('music', t('Musical interests'), $r[0]['music']), '$book' => array('book', t('Books, literature'), $r[0]['book']), '$tv' => array('tv', t('Television'), $r[0]['tv']), - '$film' => array('film', t('Film/dance/culture/entertainment'), $r[0]['film']), + '$film' => array('film', t('Film/Dance/Culture/Entertainment'), $r[0]['film']), '$interest' => array('interest', t('Hobbies/Interests'), $r[0]['interest']), - '$romance' => array('romance',t('Love/romance'), $r[0]['romance']), - '$work' => array('work', t('Work/employment'), $r[0]['work']), - '$education' => array('education', t('School/education'), $r[0]['education']), - '$contact' => array('contact', t('Contact information and Social Networks'), $r[0]['contact']), + '$romance' => array('romance',t('Love/Romance'), $r[0]['romance']), + '$work' => array('work', t('Work/Employment'), $r[0]['work']), + '$education' => array('education', t('School/Education'), $r[0]['education']), + '$contact' => array('contact', t('Contact information and social networks'), $r[0]['contact']), '$channels' => array('channels', t('My other channels'), $r[0]['channels']), '$extra_fields' => $extra_fields, )); -- cgit v1.2.3 From 40162cd6b712f45ecd21f41d7793b2a6be6ac021 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 17 Mar 2016 12:56:55 +0100 Subject: some work on profile listing --- mod/profiles.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'mod') diff --git a/mod/profiles.php b/mod/profiles.php index aebcc9022..f891c6033 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -758,21 +758,9 @@ function profiles_content(&$a) { local_channel()); if(count($r)) { - $tpl_header = get_markup_template('profile_listing_header.tpl'); - $o .= replace_macros($tpl_header,array( - '$header' => t('Edit/Manage Profiles'), - '$addstuff' => t('Add profile things'), - '$stuff_desc' => t('Include desirable objects in your profile'), - '$chg_photo' => t('Change profile photo'), - '$cr_new' => t('Create New Profile'), - '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new") - )); - - $tpl = get_markup_template('profile_entry.tpl'); - foreach($r as $rr) { - $o .= replace_macros($tpl, array( + $profiles .= replace_macros($tpl, array( '$photo' => $rr['thumb'], '$id' => $rr['id'], '$alt' => t('Profile Image'), @@ -782,6 +770,17 @@ function profiles_content(&$a) { : '' . t('Edit visibility') . '') )); } + + $tpl_header = get_markup_template('profile_listing_header.tpl'); + $o .= replace_macros($tpl_header,array( + '$header' => t('Edit Profiles'), + '$cr_new' => t('Create New'), + '$cr_new_link' => 'profiles/new?t=' . get_form_security_token("profile_new"), + '$profiles' => $profiles + )); + + + } return $o; -- cgit v1.2.3 From bd249b276d5b0a7f9934272c5443dfe2e0eb010f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 18 Mar 2016 17:49:31 +0100 Subject: add use as cover photo link to photos view --- mod/photos.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index 8f44f01b2..07138e6cf 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -896,6 +896,7 @@ function photos_content(&$a) { if($can_post && ($ph[0]['uid'] == $owner_uid)) { $tools = array( 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')), + 'cover'=>array($a->get_baseurl() . '/cover_photo/use/'.$ph[0]['resource_id'], t('Use as cover photo')), ); } -- cgit v1.2.3 From 34b42566b6e2e413f7280ea73a415c9829d4ded1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 20 Mar 2016 02:25:59 +0100 Subject: add fixme --- mod/acl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/acl.php b/mod/acl.php index aaf056b60..d48a9b19c 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -47,7 +47,7 @@ function acl_init(&$a){ $contacts = array(); if ($type=='' || $type=='g'){ - + $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`, %s as uids FROM `groups`,`group_member` @@ -71,6 +71,8 @@ function acl_init(&$a){ "name" => $g['name'], "id" => $g['id'], "xid" => $g['hash'], + //FIXME: db_concat aka GROUP_CONCAT has a defoult setting of group_concat_max_len = 1024 in mysql. + // This value is quickly exceeded here. As a result $g['uids'] only contains a part of the complete xchan set. "uids" => explode(",",$g['uids']), "link" => '' ); -- cgit v1.2.3 From 9fcd470acacf3dc283c91c52f591f5aaa3983ba4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 20 Mar 2016 20:26:55 +0100 Subject: fix #328 by using a seperate query instead of group_concat --- mod/acl.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'mod') diff --git a/mod/acl.php b/mod/acl.php index d48a9b19c..6eeca8af0 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -2,6 +2,7 @@ /* ACL selector json backend */ require_once("include/acl_selectors.php"); +require_once("include/group.php"); function acl_init(&$a){ @@ -48,32 +49,28 @@ function acl_init(&$a){ if ($type=='' || $type=='g'){ - $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name`, - %s as uids + $r = q("SELECT `groups`.`id`, `groups`.`hash`, `groups`.`name` FROM `groups`,`group_member` WHERE `groups`.`deleted` = 0 AND `groups`.`uid` = %d - AND `group_member`.`gid`=`groups`.`id` - $sql_extra + AND `group_member`.`gid`=`groups`.`id` + $sql_extra GROUP BY `groups`.`id` ORDER BY `groups`.`name` LIMIT %d OFFSET %d", - db_concat('group_member.xchan', ','), intval(local_channel()), intval($count), intval($start) ); foreach($r as $g){ -// logger('acl: group: ' . $g['name'] . ' members: ' . $g['uids']); +// logger('acl: group: ' . $g['name'] . ' members: ' . group_get_members_xchan($g['id'])); $groups[] = array( "type" => "g", "photo" => "images/twopeople.png", "name" => $g['name'], "id" => $g['id'], "xid" => $g['hash'], - //FIXME: db_concat aka GROUP_CONCAT has a defoult setting of group_concat_max_len = 1024 in mysql. - // This value is quickly exceeded here. As a result $g['uids'] only contains a part of the complete xchan set. - "uids" => explode(",",$g['uids']), + "uids" => group_get_members_xchan($g['id']), "link" => '' ); } -- cgit v1.2.3 From eb68b66c58fb0fb0511827a51d39ef0b6aff6d33 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 20 Mar 2016 15:27:26 -0700 Subject: issue #330 - permit archived connections in ACLs. If they are to be blocked for delivery (or some other purpose) this should probably happen in the delivery mechanism (or other related sub-system) rather than the permissions mechanism, although currently we still attempt direct delivery to archived connections. Technically "archived" means merely that we won't 'poll' the connection according to the current definition. --- mod/acl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/acl.php b/mod/acl.php index aaf056b60..d3e006e87 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -94,7 +94,7 @@ function acl_init(&$a){ $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags, abook_self FROM abook left join xchan on abook_xchan = xchan_hash - WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , + WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , intval(local_channel()) ); @@ -118,7 +118,7 @@ function acl_init(&$a){ $r2 = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, abook_flags, abook_self FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND abook_blocked = 0 and abook_pending = 0 and abook_archived = 0 and abook_hidden = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc"); + WHERE abook_channel IN ($extra_channels_sql) $known_hashes_sql AND abook_blocked = 0 and abook_pending = 0 and abook_hidden = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc"); if($r2) $r = array_merge($r,$r2); -- cgit v1.2.3 From fea532af4da522001c71eb79df5fc49c83833da9 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 20 Mar 2016 19:55:53 -0700 Subject: rework salmon - important, update addons also if you have enabled gnusoc addon --- mod/oep.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/oep.php b/mod/oep.php index 42535c069..36741a752 100644 --- a/mod/oep.php +++ b/mod/oep.php @@ -106,7 +106,7 @@ function oep_display_reply($args) { $w = (($maxwidth) ? $maxwidth : 640); $h = (($maxheight) ? $maxheight : $w * 2 / 3); - $ret['html'] = '
    ' . $o . '
    '; + $ret['html'] = '
    ' . $o . '
    '; $ret['width'] = $w; $ret['height'] = $h; @@ -165,7 +165,7 @@ function oep_mid_reply($args) { $w = (($maxwidth) ? $maxwidth : 640); $h = (($maxheight) ? $maxheight : $w * 2 / 3); - $ret['html'] = '
    ' . $o . '
    '; + $ret['html'] = '
    ' . $o . '
    '; $ret['width'] = $w; $ret['height'] = $h; -- cgit v1.2.3 From 97e1a6dfde7d8d8e23d463ab22f24011cbce0d8c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 22 Mar 2016 02:06:19 +0100 Subject: whip mod manage into shape --- mod/manage.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/manage.php b/mod/manage.php index 671003efd..1f7c26cd8 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -134,9 +134,7 @@ function manage_content(&$a) { } } - $links = array( - array( 'new_channel', t('Create a new channel'), t('Create a new channel')) - ); + $create = array( 'new_channel', t('Create a new channel'), t('Create New')); $delegates = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and (abook_their_perms & %d) > 0", @@ -156,8 +154,6 @@ function manage_content(&$a) { $delegates = null; } - - $o = replace_macros(get_markup_template('channels.tpl'), array( '$header' => t('Channel Manager'), '$msg_selected' => t('Current Channel'), @@ -165,17 +161,16 @@ function manage_content(&$a) { '$desc' => t('Switch to one of your channels by selecting it.'), '$msg_default' => t('Default Channel'), '$msg_make_default' => t('Make Default'), - '$links' => $links, + '$create' => $create, '$all_channels' => $channels, '$mail_format' => t('%d new messages'), '$intros_format' => t('%d new introductions'), '$channel_usage_message' => $channel_usage_message, - '$delegate_header' => t('Delegated Channels'), + '$delegated_desc' => t('Delegated Channel'), '$delegates' => $delegates, )); - return $o; } -- cgit v1.2.3 From c6b89b99b9a98a5a25087190eeeee15365c7a853 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 22 Mar 2016 10:29:17 +0100 Subject: Add a link to /locs to channel manager --- mod/manage.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/manage.php b/mod/manage.php index 1f7c26cd8..cb845befe 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -168,6 +168,7 @@ function manage_content(&$a) { '$channel_usage_message' => $channel_usage_message, '$delegated_desc' => t('Delegated Channel'), '$delegates' => $delegates, + '$locs' => t('Manage locations') )); -- cgit v1.2.3 From 6f2ba0c6193a229b3f371de2cae7b314927d4cbb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 22 Mar 2016 19:58:59 -0700 Subject: rewrite the webfinger discovery logic --- mod/xrd.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/xrd.php b/mod/xrd.php index da4ab51a4..ed8e1eabe 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -7,8 +7,12 @@ function xrd_init(&$a) { $uri = urldecode(notags(trim($_GET['uri']))); logger('xrd: ' . $uri,LOGGER_DEBUG); - if(substr($uri,0,4) === 'http') + $resource = $uri; + + if(substr($uri,0,4) === 'http') { + $uri = str_replace('~','',$uri); $name = basename($uri); + } else { $local = str_replace('acct:', '', $uri); if(substr($local,0,2) == '//') @@ -35,9 +39,18 @@ function xrd_init(&$a) { header("Content-type: application/xrd+xml"); + $aliases = array('acct:' . $r[0]['channel_address'] . '@' . $a->get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']); + + for($x = 0; $x < count($aliases); $x ++) { + if($aliases[$x] === $resource) + unset($aliases[$x]); + } + + $o = replace_macros(get_markup_template('xrd_person.tpl'), array( '$nick' => $r[0]['channel_address'], - '$accturi' => $uri, + '$accturi' => $resource, + '$aliases' => $aliases, '$profile_url' => $a->get_baseurl() . '/channel/' . $r[0]['channel_address'], '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['channel_address'], '$atom' => $a->get_baseurl() . '/feed/' . $r[0]['channel_address'], -- cgit v1.2.3 From a50706317435d09cacb95cad0a6ccaf8ae5b5f6c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 26 Mar 2016 18:43:38 +0100 Subject: move link to /locs to settings menu if we have more than one location and some template work on locs --- mod/locs.php | 11 ++++++----- mod/manage.php | 4 +--- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/locs.php b/mod/locs.php index 9f66e3263..8452f62d1 100644 --- a/mod/locs.php +++ b/mod/locs.php @@ -110,11 +110,12 @@ function locs_content(&$a) { $o = replace_macros(get_markup_template('locmanage.tpl'), array( '$header' => t('Manage Channel Locations'), - '$loc' => t('Location (address)'), - '$mkprm' => t('Primary Location'), - '$drop' => t('Drop location'), + '$loc' => t('Location'), + '$addr' => t('Address'), + '$mkprm' => t('Primary'), + '$drop' => t('Drop'), '$submit' => t('Submit'), - '$sync' => t('Sync now'), + '$sync' => t('Sync Now'), '$sync_text' => t('Please wait several minutes between consecutive operations.'), '$drop_text' => t('When possible, drop a location by logging into that website/hub and removing your channel.'), '$last_resort' => t('Use this form to drop the location if the hub is no longer operating.'), @@ -122,4 +123,4 @@ function locs_content(&$a) { )); return $o; -} \ No newline at end of file +} diff --git a/mod/manage.php b/mod/manage.php index cb845befe..d769f0393 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -167,9 +167,7 @@ function manage_content(&$a) { '$intros_format' => t('%d new introductions'), '$channel_usage_message' => $channel_usage_message, '$delegated_desc' => t('Delegated Channel'), - '$delegates' => $delegates, - '$locs' => t('Manage locations') - + '$delegates' => $delegates )); return $o; -- cgit v1.2.3 From eeb1c463e37380c4dd7ac3fccf32d26e91a469ce Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Sat, 26 Mar 2016 22:32:46 +0100 Subject: Small, but I think useful hack. Added a top posts only atom feed, so people can choose directly from their browser which feed they need. --- mod/channel.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index dcccb16b6..7bdc056a2 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -34,7 +34,8 @@ function channel_init(&$a) { $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; // Not yet ready for prime time -- cgit v1.2.3 From dbde9a0940297f1ed5c02e0578013da3d052349e Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Sun, 27 Mar 2016 14:03:02 +0200 Subject: Update es_es+n. Switch the feeds as requested by Mike. --- mod/channel.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index 7bdc056a2..eb65a66f3 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -34,9 +34,8 @@ function channel_init(&$a) { $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; $a->page['htmlhead'] .= '' . "\r\n" ; - + $a->page['htmlhead'] .= '' . "\r\n" ; // Not yet ready for prime time // $a->page['htmlhead'] .= '' . "\r\n" ; -- cgit v1.2.3 From e4f360505466d4701ea4ac8f8bec18fac5b4c3ec Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 29 Mar 2016 14:14:17 -0700 Subject: add page title to the html title --- mod/page.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mod') diff --git a/mod/page.php b/mod/page.php index ae572ca1e..d4aefc1cd 100644 --- a/mod/page.php +++ b/mod/page.php @@ -91,6 +91,9 @@ function page_init(&$a) { return; } + if($r[0]['title']) + $a->page['title'] = escape_tags($r[0]['title']); + if($r[0]['item_type'] == ITEM_TYPE_PDL) { require_once('include/comanche.php'); comanche_parser(get_app(),$r[0]['body']); -- cgit v1.2.3 From 5462453bf2bde50166c68f90b08d24826dd07ba8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Mar 2016 14:31:55 +0200 Subject: some work on mod chat --- mod/chat.php | 48 ++++++++++++++++++++++-------------------------- mod/lockview.php | 30 +++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 31 deletions(-) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index f219bde73..6c0a61880 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -194,42 +194,38 @@ function chat_content(&$a) { } + require_once('include/conversation.php'); + $o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']); + $acl = new Zotlabs\Access\AccessList($channel); + $channel_acl = $acl->get(); - if(local_channel() && argc() > 2 && argv(2) === 'new') { - - $acl = new Zotlabs\Access\AccessList($channel); - $channel_acl = $acl->get(); - - require_once('include/acl_selectors.php'); - - $o = replace_macros(get_markup_template('chatroom_new.tpl'),array( - '$header' => t('New Chatroom'), - '$name' => array('room_name',t('Chatroom Name'),'', ''), - '$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''), - '$permissions' => t('Permissions'), - '$acl' => populate_acl($channel_acl,false), - '$submit' => t('Submit') - )); - return $o; - } - - + $lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock'); + require_once('include/acl_selectors.php'); - require_once('include/conversation.php'); + $chatroom_new = replace_macros(get_markup_template('chatroom_new.tpl'),array( + '$header' => t('New Chatroom'), + '$name' => array('room_name',t('Chatroom name'),'', ''), + '$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''), + '$permissions' => t('Permissions'), + '$acl' => populate_acl($channel_acl,false), + '$lockstate' => $lockstate, + '$submit' => t('Submit') - $o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']); + )); - require_once('include/widgets.php'); + $rooms = chatroom_list($a->profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( '$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']), '$baseurl' => z_root(), - '$nickname' => $channel['channel_address'], - '$rooms' => widget_chatroom_list(array()), - '$newroom' => t('New Chatroom'), - '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0) + '$nickname' => $a->profile['channel_address'], + '$rooms' => $rooms, + '$norooms' => t('No chatrooms available'), + '$newroom' => t('Create New'), + '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0), + '$chatroom_new' => $chatroom_new )); return $o; diff --git a/mod/lockview.php b/mod/lockview.php index 84c16f658..d4a626a11 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -14,11 +14,21 @@ function lockview_content(&$a) { if(! $item_id) killme(); - if (!in_array($type, array('item','photo','event', 'menu_item'))) + if (!in_array($type, array('item','photo','event', 'menu_item', 'chatroom'))) killme(); - //we have different naming in in menu_item table - $id = (($type == 'menu_item') ? 'mitem_id' : 'id'); + //we have different naming in in menu_item table and chatroom table + switch($type) { + case 'menu_item': + $id = 'mitem_id'; + break; + case 'chatroom': + $id = 'cr_id'; + break; + default: + $id = 'id'; + break; + } $r = q("SELECT * FROM %s WHERE $id = %d LIMIT 1", dbesc($type), @@ -30,8 +40,18 @@ function lockview_content(&$a) { $item = $r[0]; - //we have different naming in in menu_item table - $uid = (($type == 'menu_item') ? $item['mitem_channel_id'] : $item['uid']); + //we have different naming in in menu_item table and chatroom table + switch($type) { + case 'menu_item': + $uid = $item['mitem_channel_id']; + break; + case 'chatroom': + $uid = $item['cr_uid']; + break; + default: + $uid = $item['uid']; + break; + } if($uid != local_channel()) { echo '
  • ' . t('Remote privacy information not available.') . '
  • '; -- cgit v1.2.3 From 08461c7049ee5c9788e815537b540b9987a5eace Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 30 Mar 2016 14:44:03 +0200 Subject: more on mod chat --- mod/chat.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index 6c0a61880..ecd94bd95 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -203,22 +203,26 @@ function chat_content(&$a) { $lockstate = (($channel_acl['allow_cid'] || $channel_acl['allow_gid'] || $channel_acl['deny_cid'] || $channel_acl['deny_gid']) ? 'lock' : 'unlock'); require_once('include/acl_selectors.php'); + + $chatroom_new = ''; + if(local_channel()) { + $chatroom_new = replace_macros(get_markup_template('chatroom_new.tpl'),array( + '$header' => t('New Chatroom'), + '$name' => array('room_name',t('Chatroom name'),'', ''), + '$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''), + '$permissions' => t('Permissions'), + '$acl' => populate_acl($channel_acl,false), + '$lockstate' => $lockstate, + '$submit' => t('Submit') - $chatroom_new = replace_macros(get_markup_template('chatroom_new.tpl'),array( - '$header' => t('New Chatroom'), - '$name' => array('room_name',t('Chatroom name'),'', ''), - '$chat_expire' => array('chat_expire',t('Expiration of chats (minutes)'),120,''), - '$permissions' => t('Permissions'), - '$acl' => populate_acl($channel_acl,false), - '$lockstate' => $lockstate, - '$submit' => t('Submit') - - )); + )); + } $rooms = chatroom_list($a->profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( '$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']), + '$name' => t('Name'), '$baseurl' => z_root(), '$nickname' => $a->profile['channel_address'], '$rooms' => $rooms, -- cgit v1.2.3 From df891f4ad2eee3b07bad73d703a46364dad03508 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 31 Mar 2016 00:37:40 +0200 Subject: more work on mod chat --- mod/chat.php | 18 ++++++++++++++---- mod/chatsvc.php | 4 +++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index ecd94bd95..95b3802a8 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -161,6 +161,7 @@ function chat_content(&$a) { intval($room_id), intval($a->profile['profile_uid']) ); + if($x) { $acl = new Zotlabs\Access\AccessList(false); $acl->set($x[0]); @@ -175,6 +176,11 @@ function chat_content(&$a) { return; } + $cipher = get_pconfig(local_channel(),'system','default_cipher'); + if(! $cipher) + $cipher = 'aes256'; + + $o = replace_macros(get_markup_template('chat.tpl'),array( '$is_owner' => ((local_channel() && local_channel() == $x[0]['cr_uid']) ? true : false), '$room_name' => $room_name, @@ -183,12 +189,16 @@ function chat_content(&$a) { '$nickname' => argv(1), '$submit' => t('Submit'), '$leave' => t('Leave Room'), - '$drop' => t('Delete This Room'), + '$drop' => t('Delete Room'), '$away' => t('I am away right now'), '$online' => t('I am online'), '$bookmark_link' => $bookmark_link, - '$bookmark' => t('Bookmark this room') - + '$bookmark' => t('Bookmark this room'), + '$feature_encrypt' => ((feature_enabled(local_channel(),'content_encrypt')) ? true : false), + '$cipher' => $cipher, + '$linkurl' => t('Please enter a link URL:'), + '$encrypt' => t('Encrypt text'), + '$insert' => t('Insert web link') )); return $o; } @@ -229,7 +239,7 @@ function chat_content(&$a) { '$norooms' => t('No chatrooms available'), '$newroom' => t('Create New'), '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0), - '$chatroom_new' => $chatroom_new + '$chatroom_new' => $chatroom_new, )); return $o; diff --git a/mod/chatsvc.php b/mod/chatsvc.php index 44225e6dd..829fef6f8 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -109,14 +109,16 @@ function chatsvc_content(&$a) { switch($rr['cp_status']) { case 'away': $status = t('Away'); + $status_class = 'away'; break; case 'online': default: $status = t('Online'); + $status_class = 'online'; break; } - $inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], status => $status); + $inroom[] = array('img' => zid($rr['xchan_photo_m']), 'img_type' => $rr['xchan_photo_mimetype'],'name' => $rr['xchan_name'], 'status' => $status, 'status_class' => $status_class); } } -- cgit v1.2.3 From 1cd3b4182595b838a535dd6b6990251db05d49e6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 30 Mar 2016 22:13:24 -0700 Subject: deprecate $a->get_baseurl() --- mod/admin.php | 50 ++++++++++++++++++++--------------------- mod/cal.php | 14 ++++++------ mod/channel.php | 8 +++---- mod/chat.php | 2 +- mod/cloud.php | 2 +- mod/connedit.php | 38 +++++++++++++++---------------- mod/cover_photo.php | 4 ++-- mod/dav.php | 2 +- mod/directory.php | 2 +- mod/editblock.php | 4 ++-- mod/editlayout.php | 4 ++-- mod/editpost.php | 4 ++-- mod/editwebpage.php | 4 ++-- mod/events.php | 24 ++++++++++---------- mod/fbrowser.php | 16 ++++++------- mod/filerm.php | 2 +- mod/group.php | 10 ++++----- mod/hcard.php | 2 +- mod/import.php | 6 ++--- mod/item.php | 38 +++++++++++++++---------------- mod/like.php | 2 +- mod/lostpass.php | 10 ++++----- mod/mail.php | 10 ++++----- mod/match.php | 6 ++--- mod/message.php | 2 +- mod/msearch.php | 4 ++-- mod/network.php | 6 ++--- mod/new_channel.php | 2 +- mod/notifications.php | 6 ++--- mod/notify.php | 4 ++-- mod/oexchange.php | 4 ++-- mod/opensearch.php | 2 +- mod/photos.php | 62 +++++++++++++++++++++++++-------------------------- mod/ping.php | 8 +++---- mod/profile.php | 2 +- mod/profile_photo.php | 12 +++++----- mod/profiles.php | 18 +++++++-------- mod/randprof.php | 2 +- mod/register.php | 2 +- mod/removeaccount.php | 2 +- mod/removeme.php | 2 +- mod/rsd_xml.php | 2 +- mod/search_ac.php | 2 +- mod/settings.php | 20 ++++++++--------- mod/setup.php | 10 ++++----- mod/subthread.php | 2 +- mod/suggest.php | 6 ++--- mod/tagger.php | 6 ++--- mod/tagrm.php | 18 +++++++-------- mod/toggle_mobile.php | 2 +- mod/xrd.php | 20 ++++++++--------- 51 files changed, 246 insertions(+), 246 deletions(-) (limited to 'mod') diff --git a/mod/admin.php b/mod/admin.php index 6300ac027..0d8bf8395 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -40,7 +40,7 @@ function admin_post(&$a){ $func($a); } } - goaway($a->get_baseurl(true) . '/admin/plugins/' . argv(2) ); + goaway(z_root() . '/admin/plugins/' . argv(2) ); break; case 'themes': $theme = argv(2); @@ -54,7 +54,7 @@ function admin_post(&$a){ info(t('Theme settings updated.')); if(is_ajax()) return; - goaway($a->get_baseurl(true) . '/admin/themes/' . $theme ); + goaway(z_root() . '/admin/themes/' . $theme ); break; case 'logs': admin_page_logs_post($a); @@ -77,7 +77,7 @@ function admin_post(&$a){ } } - goaway($a->get_baseurl(true) . '/admin' ); + goaway(z_root() . '/admin' ); } /** @@ -337,7 +337,7 @@ function admin_page_site_post(&$a){ set_config('system','curl_timeout', $timeout); info( t('Site settings updated.') . EOL); - goaway($a->get_baseurl(true) . '/admin/site' ); + goaway(z_root() . '/admin/site' ); } /** @@ -460,7 +460,7 @@ function admin_page_site(&$a) { '$corporate' => t('Policies'), '$advanced' => t('Advanced'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), // name, label, value, help string, extra data... '$sitename' => array('sitename', t("Site name"), htmlspecialchars(get_config('system','sitename'), ENT_QUOTES, 'UTF-8'),''), '$banner' => array('banner', t("Banner/Logo"), $banner, ""), @@ -536,7 +536,7 @@ function admin_page_hubloc_post(&$a){ //after repair set hubloc flags to 0 } - goaway($a->get_baseurl(true) . '/admin/hubloc' ); + goaway(z_root() . '/admin/hubloc' ); } function trim_array_elems($arr) { @@ -659,7 +659,7 @@ function admin_page_hubloc(&$a) { if(! $hubloc){ notice( t('No server found') . EOL); - goaway($a->get_baseurl(true) . '/admin/hubloc'); + goaway(z_root() . '/admin/hubloc'); } $t = get_markup_template('admin_hubloc.tpl'); @@ -733,7 +733,7 @@ function admin_page_dbsync(&$a) { if(intval(get_config('system','db_version')) <= intval(argv(3))) set_config('system','db_version',intval(argv(3)) + 1); info( t('Update has been marked successful') . EOL); - goaway($a->get_baseurl(true) . '/admin/dbsync'); + goaway(z_root() . '/admin/dbsync'); } if(argc() > 2 && intval(argv(2))) { @@ -771,7 +771,7 @@ function admin_page_dbsync(&$a) { return '

    ' . t('No failed updates.') . '

    '; $o = replace_macros(get_markup_template('failed_updates.tpl'),array( - '$base' => $a->get_baseurl(true), + '$base' => z_root(), '$banner' => t('Failed Updates'), '$desc' => '', '$mark' => t('Mark success (if update was manually applied)'), @@ -871,7 +871,7 @@ function admin_page_users_post($a) { } } - goaway($a->get_baseurl(true) . '/admin/users' ); + goaway(z_root() . '/admin/users' ); } /** @@ -893,7 +893,7 @@ function admin_page_users(&$a){ if (! $account) { notice( t('Account not found') . EOL); - goaway($a->get_baseurl(true) . '/admin/users' ); + goaway(z_root() . '/admin/users' ); } check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't'); @@ -924,7 +924,7 @@ function admin_page_users(&$a){ break; } - goaway($a->get_baseurl(true) . '/admin/users' ); + goaway(z_root() . '/admin/users' ); } /* get pending */ @@ -1003,7 +1003,7 @@ function admin_page_users(&$a){ '$form_security_token' => get_form_security_token("admin_users"), // values // - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$pending' => $pending, '$users' => $users, @@ -1053,7 +1053,7 @@ function admin_page_channels_post(&$a) { notice( sprintf( tt("%s channel deleted", "%s channels deleted", count($channels)), count($channels)) ); } - goaway($a->get_baseurl(true) . '/admin/channels' ); + goaway(z_root() . '/admin/channels' ); } /** @@ -1071,7 +1071,7 @@ function admin_page_channels(&$a){ if (! $channel) { notice( t('Channel not found') . EOL); - goaway($a->get_baseurl(true) . '/admin/channels' ); + goaway(z_root() . '/admin/channels' ); } switch(argv(2)) { @@ -1110,7 +1110,7 @@ function admin_page_channels(&$a){ default: break; } - goaway($a->get_baseurl(true) . '/admin/channels' ); + goaway(z_root() . '/admin/channels' ); } /* get channels */ @@ -1163,7 +1163,7 @@ function admin_page_channels(&$a){ '$form_security_token' => get_form_security_token("admin_channels"), // values // - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$channels' => $channels, )); $o .= paginate($a); @@ -1222,7 +1222,7 @@ function admin_page_plugins(&$a){ info( sprintf( t("Plugin %s enabled."), $plugin ) ); } set_config("system","addon", implode(", ",$a->plugins)); - goaway($a->get_baseurl(true) . '/admin/plugins' ); + goaway(z_root() . '/admin/plugins' ); } // display plugin details require_once('library/markdown.php'); @@ -1264,7 +1264,7 @@ function admin_page_plugins(&$a){ '$page' => t('Plugins'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$plugin' => $plugin, '$status' => $status, @@ -1324,7 +1324,7 @@ function admin_page_plugins(&$a){ '$title' => t('Administration'), '$page' => t('Plugins'), '$submit' => t('Submit'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$function' => 'plugins', '$plugins' => $plugins, '$disabled' => t('Disabled - version incompatibility'), @@ -1448,7 +1448,7 @@ function admin_page_themes(&$a){ info( sprintf('Theme %s disabled.', $theme)); set_config('system', 'allowed_themes', $s); - goaway($a->get_baseurl(true) . '/admin/themes' ); + goaway(z_root() . '/admin/themes' ); } // display theme details @@ -1486,7 +1486,7 @@ function admin_page_themes(&$a){ '$page' => t('Themes'), '$toggle' => t('Toggle'), '$settings' => t('Settings'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$plugin' => $theme, '$status' => $status, @@ -1519,7 +1519,7 @@ function admin_page_themes(&$a){ '$title' => t('Administration'), '$page' => t('Themes'), '$submit' => t('Submit'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$function' => 'themes', '$plugins' => $xthemes, '$experimental' => t('[Experimental]'), @@ -1548,7 +1548,7 @@ function admin_page_logs_post(&$a) { } info( t('Log settings updated.') ); - goaway($a->get_baseurl(true) . '/admin/logs' ); + goaway(z_root() . '/admin/logs' ); } /** @@ -1606,7 +1606,7 @@ readable."); '$submit' => t('Submit'), '$clear' => t('Clear'), '$data' => $data, - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$logname' => get_config('system','logfile'), // name, label, value, help string, extra data... diff --git a/mod/cal.php b/mod/cal.php index 453f46f69..80a484c27 100755 --- a/mod/cal.php +++ b/mod/cal.php @@ -71,7 +71,7 @@ function cal_content(&$a) { $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl,array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$module_url' => '/cal/' . $channel['channel_address'], '$modparams' => 2, '$lang' => $a->language, @@ -243,7 +243,7 @@ function cal_content(&$a) { foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if(! x($links,$j)) - $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = z_root() . '/' . $a->cmd . '#link-' . $j; } } @@ -321,11 +321,11 @@ function cal_content(&$a) { $nick = $channel['channel_address']; $o = replace_macros($tpl, array( - '$baseurl' => $a->get_baseurl(), - '$new_event' => array($a->get_baseurl().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''), - '$previus' => array($a->get_baseurl()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''), - '$next' => array($a->get_baseurl()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''), - '$export' => array($a->get_baseurl()."/cal/$nick/$y/$m/export",t('Export'),'',''), + '$baseurl' => z_root(), + '$new_event' => array(z_root().'/cal',(($event_id) ? t('Edit Event') : t('Create Event')),'',''), + '$previus' => array(z_root()."/cal/$nick/$prevyear/$prevmonth",t('Previous'),'',''), + '$next' => array(z_root()."/cal/$nick/$nextyear/$nextmonth",t('Next'),'',''), + '$export' => array(z_root()."/cal/$nick/$y/$m/export",t('Export'),'',''), '$calendar' => cal($y,$m,$links, ' eventcal'), '$events' => $events, '$upload' => t('Import'), diff --git a/mod/channel.php b/mod/channel.php index eb65a66f3..d609d6802 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -34,12 +34,12 @@ function channel_init(&$a) { $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; // Not yet ready for prime time -// $a->page['htmlhead'] .= '' . "\r\n" ; -// $a->page['htmlhead'] .= '' . "\r\n" ; +// $a->page['htmlhead'] .= '' . "\r\n" ; +// $a->page['htmlhead'] .= '' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content diff --git a/mod/chat.php b/mod/chat.php index 95b3802a8..682921ec2 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -28,7 +28,7 @@ function chat_init(&$a) { $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content diff --git a/mod/cloud.php b/mod/cloud.php index 82d454477..dc3e11ef3 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -30,7 +30,7 @@ function cloud_init(&$a) { $profile = 0; - $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; if ($which) profile_load($a, $which, $profile); diff --git a/mod/connedit.php b/mod/connedit.php index 008bc21ac..5d087a3b1 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -73,7 +73,7 @@ function connedit_post(&$a) { if(! $orig_record) { notice( t('Could not access contact record.') . EOL); - goaway($a->get_baseurl(true) . '/connections'); + goaway(z_root() . '/connections'); return; // NOTREACHED } @@ -306,7 +306,7 @@ function connedit_post(&$a) { connedit_clone($a); if(($_REQUEST['pending']) && (!$_REQUEST['done'])) - goaway($a->get_baseurl(true) . '/connections/ifpending'); + goaway(z_root() . '/connections/ifpending'); return; @@ -405,13 +405,13 @@ function connedit_content(&$a) { if(! count($orig_record)) { notice( t('Could not access address book record.') . EOL); - goaway($a->get_baseurl(true) . '/connections'); + goaway(z_root() . '/connections'); } 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); + goaway(z_root() . '/connedit/' . $contact_id); } @@ -425,7 +425,7 @@ function connedit_content(&$a) { // 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); + goaway(z_root() . '/connedit/' . $contact_id); } if($cmd === 'block') { @@ -434,7 +434,7 @@ function connedit_content(&$a) { } else notice(t('Unable to set address book parameters.') . EOL); - goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); + goaway(z_root() . '/connedit/' . $contact_id); } if($cmd === 'ignore') { @@ -443,7 +443,7 @@ function connedit_content(&$a) { } else notice(t('Unable to set address book parameters.') . EOL); - goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); + goaway(z_root() . '/connedit/' . $contact_id); } if($cmd === 'archive') { @@ -452,7 +452,7 @@ function connedit_content(&$a) { } else notice(t('Unable to set address book parameters.') . EOL); - goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); + goaway(z_root() . '/connedit/' . $contact_id); } if($cmd === 'hide') { @@ -461,7 +461,7 @@ function connedit_content(&$a) { } else notice(t('Unable to set address book parameters.') . EOL); - goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); + goaway(z_root() . '/connedit/' . $contact_id); } // We'll prevent somebody from unapproving an already approved contact. @@ -475,7 +475,7 @@ function connedit_content(&$a) { else notice(t('Unable to set address book parameters.') . EOL); } - goaway($a->get_baseurl(true) . '/connedit/' . $contact_id); + goaway(z_root() . '/connedit/' . $contact_id); } @@ -499,8 +499,8 @@ function connedit_content(&$a) { info( t('Connection has been removed.') . EOL ); if(x($_SESSION,'return_url')) - goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); - goaway($a->get_baseurl(true) . '/contacts'); + goaway(z_root() . '/' . $_SESSION['return_url']); + goaway(z_root() . '/contacts'); } } @@ -521,21 +521,21 @@ function connedit_content(&$a) { 'refresh' => array( 'label' => t('Refresh Permissions'), - 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/refresh', + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/refresh', 'sel' => '', 'title' => t('Fetch updated permissions'), ), 'recent' => array( 'label' => t('Recent Activity'), - 'url' => $a->get_baseurl(true) . '/network/?f=&cid=' . $contact['abook_id'], + 'url' => z_root() . '/network/?f=&cid=' . $contact['abook_id'], 'sel' => '', 'title' => t('View recent posts and comments'), ), 'block' => array( 'label' => (intval($contact['abook_blocked']) ? t('Unblock') : t('Block')), - 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/block', + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/block', 'sel' => (intval($contact['abook_blocked']) ? 'active' : ''), 'title' => t('Block (or Unblock) all communications with this connection'), 'info' => (intval($contact['abook_blocked']) ? t('This connection is blocked!') : ''), @@ -543,7 +543,7 @@ function connedit_content(&$a) { 'ignore' => array( 'label' => (intval($contact['abook_ignored']) ? t('Unignore') : t('Ignore')), - 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/ignore', + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/ignore', 'sel' => (intval($contact['abook_ignored']) ? 'active' : ''), 'title' => t('Ignore (or Unignore) all inbound communications from this connection'), 'info' => (intval($contact['abook_ignored']) ? t('This connection is ignored!') : ''), @@ -551,7 +551,7 @@ function connedit_content(&$a) { 'archive' => array( 'label' => (intval($contact['abook_archived']) ? t('Unarchive') : t('Archive')), - 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/archive', + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/archive', 'sel' => (intval($contact['abook_archived']) ? 'active' : ''), 'title' => t('Archive (or Unarchive) this connection - mark channel dead but keep content'), 'info' => (intval($contact['abook_archived']) ? t('This connection is archived!') : ''), @@ -559,7 +559,7 @@ function connedit_content(&$a) { 'hide' => array( 'label' => (intval($contact['abook_hidden']) ? t('Unhide') : t('Hide')), - 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/hide', + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/hide', 'sel' => (intval($contact['abook_hidden']) ? 'active' : ''), 'title' => t('Hide or Unhide this connection from your other connections'), 'info' => (intval($contact['abook_hidden']) ? t('This connection is hidden!') : ''), @@ -567,7 +567,7 @@ function connedit_content(&$a) { 'delete' => array( 'label' => t('Delete'), - 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/drop', + 'url' => z_root() . '/connedit/' . $contact['abook_id'] . '/drop', 'sel' => '', 'title' => t('Delete this connection'), ), diff --git a/mod/cover_photo.php b/mod/cover_photo.php index 9c99859ea..9e7136c14 100644 --- a/mod/cover_photo.php +++ b/mod/cover_photo.php @@ -354,7 +354,7 @@ function cover_photo_content(&$a) { '$profiles' => $profiles, '$form_security_token' => get_form_security_token("cover_photo"), // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') + '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') )); call_hooks('cover_photo_content_end', $o); @@ -369,7 +369,7 @@ function cover_photo_content(&$a) { '$filename' => $filename, '$profile' => intval($_REQUEST['profile']), '$resource' => $a->data['imagecrop'] . '-3', - '$image_url' => $a->get_baseurl() . '/photo/' . $filename, + '$image_url' => z_root() . '/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"), diff --git a/mod/dav.php b/mod/dav.php index 272dae4c8..b745dbb5c 100644 --- a/mod/dav.php +++ b/mod/dav.php @@ -49,7 +49,7 @@ function dav_init(&$a) { $profile = 0; - $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= '' . "\r\n"; if ($which) profile_load($a, $which, $profile); diff --git a/mod/directory.php b/mod/directory.php index dca96694e..fe5799c88 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -324,7 +324,7 @@ function directory_content(&$a) { 'online' => $online, 'kw' => (($out) ? t('Keywords: ') : ''), 'keywords' => $out, - 'ignlink' => $suggest ? $a->get_baseurl() . '/directory?ignore=' . $rr['hash'] : '', + 'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '', 'ignore_label' => t('Don\'t suggest'), 'common_friends' => (($common[$rr['address']]) ? intval($common[$rr['address']]) : ''), 'common_label' => t('Common connections:'), diff --git a/mod/editblock.php b/mod/editblock.php index 9269676b1..a49beca3d 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -109,7 +109,7 @@ function editblock_content(&$a) { $mimeselect = mimetype_select($itm[0]['uid'],$mimetype); $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', '$ispublic' => ' ', // t('Visible to everybody'), @@ -153,7 +153,7 @@ function editblock_content(&$a) { '$mimeselect' => $mimeselect, '$content' => undo_post_tagging($itm[0]['body']), '$post_id' => $post_id, - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$defloc' => $channel['channel_location'], '$visitor' => false, '$public' => t('Public post'), diff --git a/mod/editlayout.php b/mod/editlayout.php index fc68cfe3c..2c77a2381 100644 --- a/mod/editlayout.php +++ b/mod/editlayout.php @@ -103,7 +103,7 @@ function editlayout_content(&$a) { $plaintext = true; $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', '$ispublic' => ' ', // t('Visible to everybody'), @@ -150,7 +150,7 @@ function editlayout_content(&$a) { '$ptyp' => $itm[0]['type'], '$content' => undo_post_tagging($itm[0]['body']), '$post_id' => $post_id, - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$defloc' => $channel['channel_location'], '$visitor' => false, '$public' => t('Public post'), diff --git a/mod/editpost.php b/mod/editpost.php index 030d8d671..7555ef37c 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -47,7 +47,7 @@ function editpost_content(&$a) { $channel = $a->get_channel(); $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', '$ispublic' => ' ', // t('Visible to everybody'), @@ -132,7 +132,7 @@ function editpost_content(&$a) { '$content' => undo_post_tagging($itm[0]['body']), '$post_id' => $post_id, '$parent' => (($itm[0]['parent'] != $itm[0]['id']) ? $itm[0]['parent'] : ''), - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$defloc' => $channel['channel_location'], '$visitor' => false, '$public' => t('Public post'), diff --git a/mod/editwebpage.php b/mod/editwebpage.php index 0192fd9c0..f6cf22390 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -144,7 +144,7 @@ function editwebpage_content(&$a) { $layoutselect = layout_select($itm[0]['uid'],$itm[0]['layout_mid']); $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', '$ispublic' => ' ', // t('Visible to everybody'), @@ -192,7 +192,7 @@ function editwebpage_content(&$a) { '$ptyp' => $itm[0]['type'], '$content' => undo_post_tagging($itm[0]['body']), '$post_id' => $post_id, - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$defloc' => $itm[0]['location'], '$visitor' => ($is_owner) ? true : false, '$acl' => populate_acl($itm[0],false), diff --git a/mod/events.php b/mod/events.php index 8e3b3e06b..30c083e4f 100755 --- a/mod/events.php +++ b/mod/events.php @@ -93,8 +93,8 @@ function events_post(&$a) { //$action = ($event_hash == '') ? 'new' : "event/" . $event_hash; //fixme: this url gives a wsod if there is a linebreak detected in one of the variables ($desc or $location) - //$onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type"; - $onerror_url = $a->get_baseurl() . "/events"; + //$onerror_url = z_root() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish&type=$type"; + $onerror_url = z_root() . "/events"; if(strcmp($finish,$start) < 0 && !$nofinish) { notice( t('Event can not end before it has started.') . EOL); @@ -282,7 +282,7 @@ function events_content(&$a) { $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl,array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$module_url' => '/events', '$modparams' => 1, '$lang' => $a->language, @@ -435,7 +435,7 @@ function events_content(&$a) { $tpl = get_markup_template('event_form.tpl'); $form = replace_macros($tpl,array( - '$post' => $a->get_baseurl() . '/events', + '$post' => z_root() . '/events', '$eid' => $eid, '$type' => $type, '$xchan' => $event_xchan, @@ -571,7 +571,7 @@ function events_content(&$a) { foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if(! x($links,$j)) - $links[$j] = $a->get_baseurl() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = z_root() . '/' . $a->cmd . '#link-' . $j; } } @@ -600,9 +600,9 @@ function events_content(&$a) { $last_date = $d; - $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array($a->get_baseurl().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false); + $edit = ((local_channel() && $rr['author_xchan'] == get_observer_hash()) ? array(z_root().'/events/'.$rr['event_hash'].'?expandform=1',t('Edit event'),'','') : false); - $drop = array($a->get_baseurl().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); + $drop = array(z_root().'/events/drop/'.$rr['event_hash'],t('Delete event'),'',''); $title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8')); if(! $title) { @@ -654,11 +654,11 @@ function events_content(&$a) { } $o = replace_macros($tpl, array( - '$baseurl' => $a->get_baseurl(), - '$new_event' => array($a->get_baseurl().'/events',(($event_id) ? t('Edit Event') : t('Create Event')),'',''), - '$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''), - '$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''), - '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''), + '$baseurl' => z_root(), + '$new_event' => array(z_root().'/events',(($event_id) ? t('Edit Event') : t('Create Event')),'',''), + '$previus' => array(z_root()."/events/$prevyear/$prevmonth",t('Previous'),'',''), + '$next' => array(z_root()."/events/$nextyear/$nextmonth",t('Next'),'',''), + '$export' => array(z_root()."/events/$y/$m/export",t('Export'),'',''), '$calendar' => cal($y,$m,$links, ' eventcal'), '$events' => $events, '$upload' => t('Import'), diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 13abbfd8a..6ce1292c8 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -22,7 +22,7 @@ function fbrowser_content($a){ switch($a->argv[1]){ case "image": - $path = array( array($a->get_baseurl()."/fbrowser/image/", t("Photos"))); + $path = array( array(z_root()."/fbrowser/image/", t("Photos"))); $albums = false; $sql_extra = ""; $sql_extra2 = " ORDER BY created DESC LIMIT 0, 10"; @@ -42,7 +42,7 @@ function fbrowser_content($a){ $album = hex2bin($a->argv[2]); $sql_extra = sprintf("AND `album` = '%s' ",dbesc($album)); $sql_extra2 = ""; - $path[]=array($a->get_baseurl()."/fbrowser/image/".$a->argv[2]."/", $album); + $path[]=array(z_root()."/fbrowser/image/".$a->argv[2]."/", $album); } $r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `description` @@ -60,9 +60,9 @@ function fbrowser_content($a){ $filename_e = $rr['filename']; return array( - $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['hiq'] . '.' .$ext, + z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['hiq'] . '.' .$ext, $filename_e, - $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['loq'] . '.'. $ext + z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['loq'] . '.'. $ext ); } $files = array_map("files1", $r); @@ -70,7 +70,7 @@ function fbrowser_content($a){ $tpl = get_markup_template("filebrowser.tpl"); echo replace_macros($tpl, array( '$type' => 'image', - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$path' => $path, '$folders' => $albums, '$files' =>$files, @@ -96,7 +96,7 @@ function fbrowser_content($a){ $filename_e = $rr['filename']; } - return array( $a->get_baseurl() . '/attach/' . $rr['id'], $filename_e, $a->get_baseurl() . '/images/icons/16/' . $filetype . '.png'); + return array( z_root() . '/attach/' . $rr['id'], $filename_e, z_root() . '/images/icons/16/' . $filetype . '.png'); } $files = array_map("files2", $files); //echo "
    "; var_dump($files); killme();
    @@ -105,8 +105,8 @@ function fbrowser_content($a){
     				$tpl = get_markup_template("filebrowser.tpl");
     				echo replace_macros($tpl, array(
     					'$type' => 'file',
    -					'$baseurl' => $a->get_baseurl(),
    -					'$path' => array( array($a->get_baseurl()."/fbrowser/image/", t("Files")) ),
    +					'$baseurl' => z_root(),
    +					'$path' => array( array(z_root()."/fbrowser/image/", t("Files")) ),
     					'$folders' => false,
     					'$files' =>$files,
     					'$cancel' => t('Cancel'),
    diff --git a/mod/filerm.php b/mod/filerm.php
    index bd8ce7cfc..6a6c4ff15 100644
    --- a/mod/filerm.php
    +++ b/mod/filerm.php
    @@ -27,7 +27,7 @@ function filerm_content(&$a) {
     	}
     
     	if(x($_SESSION,'return_url'))
    -		goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
    +		goaway(z_root() . '/' . $_SESSION['return_url']);
     	
     	killme();
     }
    diff --git a/mod/group.php b/mod/group.php
    index c63ccfa9b..defac572a 100644
    --- a/mod/group.php
    +++ b/mod/group.php
    @@ -20,11 +20,11 @@ function group_post(&$a) {
     			info( t('Privacy group created.') . EOL );
     			$r = group_byname(local_channel(),$name);
     			if($r)
    -				goaway($a->get_baseurl() . '/group/' . $r);
    +				goaway(z_root() . '/group/' . $r);
     		}
     		else
     			notice( t('Could not create privacy group.') . EOL );	
    -		goaway($a->get_baseurl() . '/group');
    +		goaway(z_root() . '/group');
     
     	}
     	if((argc() == 2) && (intval(argv(1)))) {
    @@ -36,7 +36,7 @@ function group_post(&$a) {
     		);
     		if(! $r) {
     			notice( t('Privacy group not found.') . EOL );
    -			goaway($a->get_baseurl() . '/connections');
    +			goaway(z_root() . '/connections');
     
     		}
     		$group = $r[0];
    @@ -108,7 +108,7 @@ function group_content(&$a) {
     			else
     				notice( t('Unable to remove privacy group.') . EOL);
     		}
    -		goaway($a->get_baseurl() . '/group');
    +		goaway(z_root() . '/group');
     		// NOTREACHED
     	}
     
    @@ -135,7 +135,7 @@ function group_content(&$a) {
     		);
     		if(! $r) {
     			notice( t('Privacy group not found.') . EOL );
    -			goaway($a->get_baseurl() . '/connections');
    +			goaway(z_root() . '/connections');
     		}
     		$group = $r[0];
     
    diff --git a/mod/hcard.php b/mod/hcard.php
    index 014a63b35..8339fd013 100644
    --- a/mod/hcard.php
    +++ b/mod/hcard.php
    @@ -25,7 +25,7 @@ function hcard_init(&$a) {
             $profile = $r[0]['profile_guid'];
         }
     
    -    $a->page['htmlhead'] .= '' . "\r\n" ;
    +    $a->page['htmlhead'] .= '' . "\r\n" ;
     
         if(! $profile) {
             $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
    diff --git a/mod/import.php b/mod/import.php
    index f91f261a5..0e41d41f3 100644
    --- a/mod/import.php
    +++ b/mod/import.php
    @@ -246,9 +246,9 @@ function import_account(&$a, $account_id) {
     				dbesc($channel['channel_guid']),
     				dbesc($channel['channel_guid_sig']),
     				dbesc($channel['channel_pubkey']),
    -				dbesc($a->get_baseurl() . "/photo/profile/l/" . $channel['channel_id']),
    -				dbesc($a->get_baseurl() . "/photo/profile/m/" . $channel['channel_id']),
    -				dbesc($a->get_baseurl() . "/photo/profile/s/" . $channel['channel_id']),
    +				dbesc(z_root() . "/photo/profile/l/" . $channel['channel_id']),
    +				dbesc(z_root() . "/photo/profile/m/" . $channel['channel_id']),
    +				dbesc(z_root() . "/photo/profile/s/" . $channel['channel_id']),
     				dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()),
     				dbesc(z_root() . '/channel/' . $channel['channel_address']),
     				dbesc(z_root() . '/follow?f=&url=%s'),
    diff --git a/mod/item.php b/mod/item.php
    index 038a967b2..b84a7ff8d 100644
    --- a/mod/item.php
    +++ b/mod/item.php
    @@ -119,7 +119,7 @@ function item_post(&$a) {
     		if (!$ret['success']) { 
     			notice( t($ret['message']) . EOL) ;
     			if(x($_REQUEST,'return')) 
    -				goaway($a->get_baseurl() . "/" . $return_path );
    +				goaway(z_root() . "/" . $return_path );
     			killme();
     		}
     	}
    @@ -173,7 +173,7 @@ function item_post(&$a) {
     		if(($r === false) || (! count($r))) {
     			notice( t('Unable to locate original post.') . EOL);
     			if(x($_REQUEST,'return')) 
    -				goaway($a->get_baseurl() . "/" . $return_path );
    +				goaway(z_root() . "/" . $return_path );
     			killme();
     		}
     
    @@ -205,7 +205,7 @@ function item_post(&$a) {
     		if(! $can_comment) {
     			notice( t('Permission denied.') . EOL) ;
     			if(x($_REQUEST,'return')) 
    -				goaway($a->get_baseurl() . "/" . $return_path );
    +				goaway(z_root() . "/" . $return_path );
     			killme();
     		}
     	}
    @@ -213,7 +213,7 @@ function item_post(&$a) {
     		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 );
    +				goaway(z_root() . "/" . $return_path );
     			killme();
     		}
     	}
    @@ -267,7 +267,7 @@ function item_post(&$a) {
     	if(! $channel) {
     		logger("mod_item: no channel.");
     		if(x($_REQUEST,'return')) 
    -			goaway($a->get_baseurl() . "/" . $return_path );
    +			goaway(z_root() . "/" . $return_path );
     		killme();
     	}
     
    @@ -282,7 +282,7 @@ function item_post(&$a) {
     	else {
     		logger("mod_item: no owner.");
     		if(x($_REQUEST,'return')) 
    -			goaway($a->get_baseurl() . "/" . $return_path );
    +			goaway(z_root() . "/" . $return_path );
     		killme();
     	}
     
    @@ -422,7 +422,7 @@ function item_post(&$a) {
     				killme();
     			info( t('Empty post discarded.') . EOL );
     			if(x($_REQUEST,'return')) 
    -				goaway($a->get_baseurl() . "/" . $return_path );
    +				goaway(z_root() . "/" . $return_path );
     			killme();
     		}
     	}
    @@ -462,7 +462,7 @@ function item_post(&$a) {
     			else {
     				notice( t('Executable content type not permitted to this channel.') . EOL);
     				if(x($_REQUEST,'return')) 
    -					goaway($a->get_baseurl() . "/" . $return_path );
    +					goaway(z_root() . "/" . $return_path );
     				killme();
     			}
     		}
    @@ -636,7 +636,7 @@ function item_post(&$a) {
     				$r = attach_by_hash_nodata($hash,$rev);
     				if($r['success']) {
     					$attachments[] = array(
    -						'href'     => $a->get_baseurl() . '/attach/' . $r['data']['hash'],
    +						'href'     => z_root() . '/attach/' . $r['data']['hash'],
     						'length'   => $r['data']['filesize'],
     						'type'     => $r['data']['filetype'],
     						'title'    => urlencode($r['data']['filename']),
    @@ -852,10 +852,10 @@ function item_post(&$a) {
     	if(x($datarray,'cancel')) {
     		logger('mod_item: post cancelled by plugin or duplicate suppressed.');
     		if($return_path)
    -			goaway($a->get_baseurl() . "/" . $return_path);
    +			goaway(z_root() . "/" . $return_path);
     
     		$json = array('cancel' => 1);
    -		$json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
    +		$json['reload'] = z_root() . '/' . $_REQUEST['jsreload'];
     		echo json_encode($json);
     		killme();
     	}
    @@ -901,7 +901,7 @@ function item_post(&$a) {
     
     		if((x($_REQUEST,'return')) && strlen($return_path)) {
     			logger('return: ' . $return_path);
    -			goaway($a->get_baseurl() . "/" . $return_path );
    +			goaway(z_root() . "/" . $return_path );
     		}
     		killme();
     	}
    @@ -926,7 +926,7 @@ function item_post(&$a) {
     					'from_xchan'   => $datarray['author_xchan'],
     					'to_xchan'     => $datarray['owner_xchan'],
     					'item'         => $datarray,
    -					'link'		   => $a->get_baseurl() . '/display/' . $datarray['mid'],
    +					'link'		   => z_root() . '/display/' . $datarray['mid'],
     					'verb'         => ACTIVITY_POST,
     					'otype'        => 'item',
     					'parent'       => $parent,
    @@ -944,7 +944,7 @@ function item_post(&$a) {
     					'from_xchan'   => $datarray['author_xchan'],
     					'to_xchan'     => $datarray['owner_xchan'],
     					'item'         => $datarray,
    -					'link'		   => $a->get_baseurl() . '/display/' . $datarray['mid'],
    +					'link'		   => z_root() . '/display/' . $datarray['mid'],
     					'verb'         => ACTIVITY_POST,
     					'otype'        => 'item'
     				));
    @@ -971,7 +971,7 @@ function item_post(&$a) {
     	else {
     		logger('mod_item: unable to retrieve post that was just stored.');
     		notice( t('System error. Post not saved.') . EOL);
    -		goaway($a->get_baseurl() . "/" . $return_path );
    +		goaway(z_root() . "/" . $return_path );
     		// NOTREACHED
     	}
     
    @@ -999,7 +999,7 @@ function item_post(&$a) {
     	}
     
     	$datarray['id']    = $post_id;
    -	$datarray['llink'] = $a->get_baseurl() . '/display/' . $channel['channel_address'] . '/' . $post_id;
    +	$datarray['llink'] = z_root() . '/display/' . $channel['channel_address'] . '/' . $post_id;
     
     	call_hooks('post_local_end', $datarray);
     
    @@ -1019,12 +1019,12 @@ function item_post(&$a) {
     		return $post;
     
     	if($return_path) {
    -		goaway($a->get_baseurl() . "/" . $return_path);
    +		goaway(z_root() . "/" . $return_path);
     	}
     
     	$json = array('success' => 1);
     	if(x($_REQUEST,'jsreload') && strlen($_REQUEST['jsreload']))
    -		$json['reload'] = $a->get_baseurl() . '/' . $_REQUEST['jsreload'];
    +		$json['reload'] = z_root() . '/' . $_REQUEST['jsreload'];
     
     	logger('post_json: ' . print_r($json,true), LOGGER_DEBUG);
     
    @@ -1099,7 +1099,7 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
     		$images = $match[2];
     		if($images) {
     			foreach($images as $image) {
    -				if(! stristr($image,get_app()->get_baseurl() . '/photo/'))
    +				if(! stristr($image,z_root() . '/photo/'))
     					continue;
     				$image_uri = substr($image,strrpos($image,'/') + 1);
     				if(strpos($image_uri,'-') !== false)
    diff --git a/mod/like.php b/mod/like.php
    index 1de7882e9..9901c1cfa 100755
    --- a/mod/like.php
    +++ b/mod/like.php
    @@ -444,7 +444,7 @@ function like_content(&$a) {
     		$arr['thr_parent']   = $item['mid'];
     		$ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]';
     		$alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
    -		$plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
    +		$plink = '[zrl=' . z_root() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]';
     		$allow_cid       = $item['allow_cid'];
     		$allow_gid       = $item['allow_gid'];
     		$deny_cid        = $item['deny_cid'];
    diff --git a/mod/lostpass.php b/mod/lostpass.php
    index ffdd7b62e..9a52ac7a9 100644
    --- a/mod/lostpass.php
    +++ b/mod/lostpass.php
    @@ -31,10 +31,10 @@ function lostpass_post(&$a) {
     	$email_tpl = get_intltext_template("lostpass_eml.tpl");
     	$message = replace_macros($email_tpl, array(
     			'$sitename' => get_config('system','sitename'),
    -			'$siteurl' =>  $a->get_baseurl(),
    +			'$siteurl' =>  z_root(),
     			'$username' => sprintf( t('Site Member (%s)'), $email),
     			'$email' => $email,
    -			'$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $hash
    +			'$reset_link' => z_root() . '/lostpass?verify=' . $hash
     	));
     
     	$subject = email_header_encode(sprintf( t('Password reset requested at %s'),get_config('system','sitename')), 'UTF-8');
    @@ -87,10 +87,10 @@ 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' => '' . t('click here to login') . '.',
    +				'$lbl5' => '' . t('click here to login') . '.',
     				'$lbl6' => t('Your password may be changed from the Settings page after successful login.'),
     				'$newpass' => $new_password,
    -				'$baseurl' => $a->get_baseurl()
    +				'$baseurl' => z_root()
     
     			));
     			
    @@ -99,7 +99,7 @@ function lostpass_content(&$a) {
     			$email_tpl = get_intltext_template("passchanged_eml.tpl");
     			$message = replace_macros($email_tpl, array(
     			'$sitename' => $a->config['sitename'],
    -			'$siteurl' =>  $a->get_baseurl(),
    +			'$siteurl' =>  z_root(),
     			'$username' => sprintf( t('Site Member (%s)'), $email),
     			'$email' => $email,
     			'$new_password' => $new_password,
    diff --git a/mod/mail.php b/mod/mail.php
    index 59d15772b..32bb19952 100644
    --- a/mod/mail.php
    +++ b/mod/mail.php
    @@ -149,7 +149,7 @@ function mail_content(&$a) {
     		if($r) {
     			//info( t('Message deleted.') . EOL );
     		}
    -		goaway($a->get_baseurl(true) . '/mail/' . $mailbox);
    +		goaway(z_root() . '/mail/' . $mailbox);
     	}
     
     	if((argc() == 4) && (argv(2) === 'recall')) {
    @@ -174,7 +174,7 @@ function mail_content(&$a) {
     		if($r) {
     				info( t('Message recalled.') . EOL );
     		}
    -		goaway($a->get_baseurl(true) . '/mail/' . $mailbox . '/' . argv(3));
    +		goaway(z_root() . '/mail/' . $mailbox . '/' . argv(3));
     
     	}
     
    @@ -186,7 +186,7 @@ function mail_content(&$a) {
     		$r = private_messages_drop(local_channel(), argv(3), true);
     		if($r)
     			info( t('Conversation removed.') . EOL );
    -		goaway($a->get_baseurl(true) . '/mail/' . $mailbox);
    +		goaway(z_root() . '/mail/' . $mailbox);
     	}
     
     	if((argc() > 1) && (argv(1) === 'new')) {
    @@ -196,7 +196,7 @@ function mail_content(&$a) {
     		$tpl = get_markup_template('msg-header.tpl');
     
     		$header = replace_macros($tpl, array(
    -			'$baseurl' => $a->get_baseurl(true),
    +			'$baseurl' => z_root(),
     			'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
     			'$nickname' => $channel['channel_address'],
     			'$linkurl' => t('Please enter a link URL:'),
    @@ -311,7 +311,7 @@ function mail_content(&$a) {
     	
     	$a->page['htmlhead'] .= replace_macros($tpl, array(
     		'$nickname' => $channel['channel_address'],
    -		'$baseurl' => $a->get_baseurl(true),
    +		'$baseurl' => z_root(),
     		'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
     		'$linkurl' => t('Please enter a link URL:'),
     		'$expireswhen' => t('Expires YYYY-MM-DD HH:MM')
    diff --git a/mod/match.php b/mod/match.php
    index fd739ba2c..60c281861 100644
    --- a/mod/match.php
    +++ b/mod/match.php
    @@ -17,7 +17,7 @@ function match_content(&$a) {
     	if (! local_channel())
     		return;
     
    -	$_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
    +	$_SESSION['return_url'] = z_root() . '/' . $a->cmd;
     
     	$o .= '

    ' . t('Profile Match') . '

    '; @@ -43,7 +43,7 @@ function match_content(&$a) { // if(strlen(get_config('system','directory_submit_url'))) // $x = post_url('http://dir.friendica.com/msearch', $params); // else -// $x = post_url($a->get_baseurl() . '/msearch', $params); +// $x = post_url(z_root() . '/msearch', $params); $j = json_decode($x); @@ -55,7 +55,7 @@ function match_content(&$a) { if (count($j->results)) { $tpl = get_markup_template('match.tpl'); foreach ($j->results as $jj) { - $connlnk = $a->get_baseurl() . '/follow/?url=' . $jj->url; + $connlnk = z_root() . '/follow/?url=' . $jj->url; $o .= replace_macros($tpl,array( '$url' => zid($jj->url), '$name' => $jj->name, diff --git a/mod/message.php b/mod/message.php index 73239d2cb..a97ab5399 100644 --- a/mod/message.php +++ b/mod/message.php @@ -32,7 +32,7 @@ function message_content(&$a) { $r = private_messages_drop(local_channel(), argv(2), true); if($r) info( t('Conversation removed.') . EOL ); - goaway($a->get_baseurl(true) . '/mail/combined' ); + goaway(z_root() . '/mail/combined' ); } if(argc() == 2) { diff --git a/mod/msearch.php b/mod/msearch.php index b51c4e097..f94b75910 100644 --- a/mod/msearch.php +++ b/mod/msearch.php @@ -27,8 +27,8 @@ function msearch_post(&$a) { foreach($r as $rr) $results[] = array( 'name' => $rr['name'], - 'url' => $a->get_baseurl() . '/channel/' . $rr['nickname'], - 'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'], + 'url' => z_root() . '/channel/' . $rr['nickname'], + 'photo' => z_root() . '/photo/avatar/' . $rr['uid'], 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['keywords']) ); } diff --git a/mod/network.php b/mod/network.php index 134a4081d..0def662cc 100644 --- a/mod/network.php +++ b/mod/network.php @@ -89,7 +89,7 @@ function network_content(&$a, $update = 0, $load = false) { if($update) killme(); notice( t('No such group') . EOL ); - goaway($a->get_baseurl(true) . '/network'); + goaway(z_root() . '/network'); // NOTREACHED } @@ -129,7 +129,7 @@ function network_content(&$a, $update = 0, $load = false) { killme(); } notice( t('No such channel') . EOL ); - goaway($a->get_baseurl(true) . '/network'); + goaway(z_root() . '/network'); // NOTREACHED } if($_GET['pf'] === '1') @@ -242,7 +242,7 @@ function network_content(&$a, $update = 0, $load = false) { } else { notice( t('Invalid connection.') . EOL); - goaway($a->get_baseurl(true) . '/network'); + goaway(z_root() . '/network'); } } diff --git a/mod/new_channel.php b/mod/new_channel.php index 577137c37..db5fff82a 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -122,7 +122,7 @@ function new_channel_content(&$a) { } $name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"')); - $nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')); + $nickhub = '@' . get_app()->get_hostname(); $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub)); $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' ' . t('Read more about roles') . '',get_roles()); diff --git a/mod/notifications.php b/mod/notifications.php index f679fbb3b..f6a75e2c0 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -46,12 +46,12 @@ function notifications_post(&$a) { intval(local_channel()) ); } - goaway($a->get_baseurl(true) . '/notifications/intros'); + goaway(z_root() . '/notifications/intros'); } if($_POST['submit'] == t('Ignore')) { $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d", intval($intro_id)); - goaway($a->get_baseurl(true) . '/notifications/intros'); + goaway(z_root() . '/notifications/intros'); } } } @@ -84,7 +84,7 @@ function notifications_content(&$a) { $notifications_available =1; foreach ($r as $it) { $notif_content .= replace_macros($not_tpl,array( - '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], + '$item_link' => z_root().'/notify/view/'. $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date']) diff --git a/mod/notify.php b/mod/notify.php index 4c9d1977b..d56871880 100644 --- a/mod/notify.php +++ b/mod/notify.php @@ -19,7 +19,7 @@ function notify_init(&$a) { ); goaway($r[0]['link']); } - goaway($a->get_baseurl(true)); + goaway(z_root()); } @@ -42,7 +42,7 @@ function notify_content(&$a) { if($r) { foreach ($r as $it) { $notif_content .= replace_macros($not_tpl,array( - '$item_link' => $a->get_baseurl(true).'/notify/view/'. $it['id'], + '$item_link' => z_root().'/notify/view/'. $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date']) diff --git a/mod/oexchange.php b/mod/oexchange.php index 867cea6f2..d59a8d127 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -6,7 +6,7 @@ function oexchange_init(&$a) { if((argc() > 1) && (argv(1) === 'xrd')) { $tpl = get_markup_template('oexchange_xrd.tpl'); - $o = replace_macros($tpl, array('$base' => $a->get_baseurl())); + $o = replace_macros($tpl, array('$base' => z_root())); echo $o; killme(); } @@ -47,7 +47,7 @@ function oexchange_content(&$a) { $tags = (((x($_REQUEST,'tags')) && strlen($_REQUEST['tags'])) ? '&tags=' . urlencode(notags(trim($_REQUEST['tags']))) : ''); - $ret = z_fetch_url($a->get_baseurl() . '/urlinfo?f=&url=' . $url . $title . $description . $tags); + $ret = z_fetch_url(z_root() . '/urlinfo?f=&url=' . $url . $title . $description . $tags); if($ret['success']) $s = $ret['body']; diff --git a/mod/opensearch.php b/mod/opensearch.php index d28c4f1b8..212773b96 100644 --- a/mod/opensearch.php +++ b/mod/opensearch.php @@ -7,7 +7,7 @@ function opensearch_init(&$a) { header("Content-type: application/opensearchdescription+xml"); $o = replace_macros($tpl, array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$nodename' => $a->get_hostname(), )); diff --git a/mod/photos.php b/mod/photos.php index 07138e6cf..ddacc38a3 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -93,12 +93,12 @@ function photos_post(&$a) { if($album === t('Profile Photos')) { // not allowed - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); } if(! photos_album_exists($page_owner_uid,$album)) { notice( t('Album not found.') . EOL); - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); } @@ -111,12 +111,12 @@ function photos_post(&$a) { // @fixme - syncronise with DAV or disallow completely - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); // $x = photos_album_rename($page_owner_uid,$album,$newalbum); // if($x) { // $newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']); -// goaway($a->get_baseurl() . '/' . $newurl); +// goaway(z_root() . '/' . $newurl); // } } @@ -140,7 +140,7 @@ function photos_post(&$a) { $str = null; } if(! $str) { - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); } $r = q("select id from item where resource_id in ( $str ) and resource_type = 'photo' and uid = %d " . item_normal(), @@ -165,7 +165,7 @@ function photos_post(&$a) { } - goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address']); + goaway(z_root() . '/photos/' . $a->data['channel']['channel_address']); } if((argc() > 2) && (x($_REQUEST,'delete')) && ($_REQUEST['delete'] === t('Delete Photo'))) { @@ -174,7 +174,7 @@ function photos_post(&$a) { $ob_hash = get_observer_hash(); if(! $ob_hash) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); $r = q("SELECT `id`, `resource_id` FROM `photo` WHERE ( xchan = '%s' or `uid` = %d ) AND `resource_id` = '%s' LIMIT 1", dbesc($ob_hash), @@ -197,12 +197,12 @@ function photos_post(&$a) { ); if(count($i)) { drop_item($i[0]['id'],true,DROPITEM_PHASE1); - $url = $a->get_baseurl(); + $url = z_root(); } */ } - goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); + goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); } @@ -440,7 +440,7 @@ function photos_post(&$a) { } - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); return; // NOTREACHED } @@ -470,9 +470,9 @@ function photos_post(&$a) { } if($_REQUEST['newalbum']) - goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($_REQUEST['newalbum'])); + goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($_REQUEST['newalbum'])); else - goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex(datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'))); + goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex(datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'))); } @@ -571,7 +571,7 @@ function photos_content(&$a) { $uploader = ''; - $ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'], + $ret = array('post_url' => z_root() . '/photos/' . $a->data['channel']['channel_address'], 'addon_text' => $uploader, 'default_upload' => true); @@ -684,7 +684,7 @@ function photos_content(&$a) { $a->set_pager_total(count($r)); $a->set_pager_itemspage(60); } else { - goaway($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address']); + goaway(z_root() . '/photos/' . $a->data['channel']['channel_address']); } if($_GET['order'] === 'posted') @@ -731,9 +731,9 @@ function photos_content(&$a) { } if($_GET['order'] === 'posted') - $order = array(t('Show Newest First'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album)); + $order = array(t('Show Newest First'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album)); else - $order = array(t('Show Oldest First'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted'); + $order = array(t('Show Oldest First'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted'); $photos = array(); if(count($r)) { @@ -750,7 +750,7 @@ function photos_content(&$a) { $imgalt_e = $rr['filename']; $desc_e = $rr['description']; - $imagelink = ($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] + $imagelink = (z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '')); $photos[] = array( @@ -758,7 +758,7 @@ function photos_content(&$a) { 'twist' => ' ' . $twist . rand(2,4), 'link' => $imagelink, 'title' => t('View Photo'), - 'src' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext, + 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . $rr['scale'] . '.' .$ext, 'alt' => $imgalt_e, 'desc'=> $desc_e, 'ext' => $ext, @@ -790,7 +790,7 @@ function photos_content(&$a) { '$album_id' => bin2hex($album), '$album_edit' => array(t('Edit Album'), $album_edit), '$can_post' => $can_post, - '$upload' => array(t('Upload'), $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), + '$upload' => array(t('Upload'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), '$order' => $order, '$upload_form' => $upload_form, '$usage' => $usage_message @@ -871,8 +871,8 @@ function photos_content(&$a) { } } - $prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); - $nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $prevlink = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $nextlink = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); } @@ -889,14 +889,14 @@ function photos_content(&$a) { } } - $album_link = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($ph[0]['album']); + $album_link = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($ph[0]['album']); $tools = Null; $lock = Null; if($can_post && ($ph[0]['uid'] == $owner_uid)) { $tools = array( - 'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')), - 'cover'=>array($a->get_baseurl() . '/cover_photo/use/'.$ph[0]['resource_id'], t('Use as cover photo')), + 'profile'=>array(z_root() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')), + 'cover'=>array(z_root() . '/cover_photo/use/'.$ph[0]['resource_id'], t('Use as cover photo')), ); } @@ -917,9 +917,9 @@ function photos_content(&$a) { $prevlink = array($prevlink, t('Previous')); $photo = array( - 'href' => $a->get_baseurl() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']], + 'href' => z_root() . '/photo/' . $hires['resource_id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']], 'title'=> t('View Full Size'), - 'src' => $a->get_baseurl() . '/photo/' . $lores['resource_id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis') + 'src' => z_root() . '/photo/' . $lores['resource_id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . datetime_convert('','','','ymdhis') ); if($nextlink) @@ -1123,7 +1123,7 @@ function photos_content(&$a) { if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) continue; - $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; + $redirect_url = z_root() . '/redir/' . $item['cid'] ; $profile_url = zid($item['author']['xchan_url']); @@ -1297,12 +1297,12 @@ function photos_content(&$a) { $photos[] = array( 'id' => $rr['id'], 'twist' => ' ' . $twist . rand(2,4), - 'link' => $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'], + 'link' => z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'], 'title' => t('View Photo'), - 'src' => $a->get_baseurl() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext, + 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext, 'alt' => $alt_e, 'album' => array( - 'link' => $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']), + 'link' => z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']), 'name' => $name_e, 'alt' => t('View Album'), ), @@ -1331,7 +1331,7 @@ function photos_content(&$a) { '$title' => t('Recent Photos'), '$album_id' => bin2hex(t('Recent Photos')), '$can_post' => $can_post, - '$upload' => array(t('Upload'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'), + '$upload' => array(t('Upload'), z_root().'/photos/'.$a->data['channel']['channel_address'].'/upload'), '$photos' => $photos, '$upload_form' => $upload_form, '$usage' => $usage_message diff --git a/mod/ping.php b/mod/ping.php index 69d504da1..c93644317 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -224,7 +224,7 @@ function ping_init(&$a) { if(count($z)) { foreach($z as $zz) { $notifs[] = array( - 'notify_link' => $a->get_baseurl() . '/notify/view/' . $zz['id'], + 'notify_link' => z_root() . '/notify/view/' . $zz['id'], 'name' => $zz['name'], 'url' => $zz['url'], 'photo' => $zz['photo'], @@ -251,7 +251,7 @@ function ping_init(&$a) { if($t) { foreach($t as $zz) { $notifs[] = array( - 'notify_link' => $a->get_baseurl() . '/mail/' . $zz['id'], + 'notify_link' => z_root() . '/mail/' . $zz['id'], 'name' => $zz['xchan_name'], 'url' => $zz['xchan_url'], 'photo' => $zz['xchan_photo_s'], @@ -299,7 +299,7 @@ function ping_init(&$a) { if($r) { foreach($r as $rr) { $result[] = array( - 'notify_link' => $a->get_baseurl() . '/connections/ifpending', + 'notify_link' => z_root() . '/connections/ifpending', 'name' => $rr['xchan_name'], 'url' => $rr['xchan_url'], 'photo' => $rr['xchan_photo_s'], @@ -341,7 +341,7 @@ function ping_init(&$a) { $when = day_translate(datetime_convert('UTC', (($rr['adjust']) ? date_default_timezone_get() : 'UTC'), $rr['start'], $bd_format)) . (($today) ? ' ' . t('[today]') : ''); $result[] = array( - 'notify_link' => $a->get_baseurl() . '/events', // FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'], + 'notify_link' => z_root() . '/events', // FIXME this takes you to an edit page and it may not be yours, we really want to just view the single event --> '/events/event/' . $rr['event_hash'], 'name' => $rr['xchan_name'], 'url' => $rr['xchan_url'], 'photo' => $rr['xchan_photo_s'], diff --git a/mod/profile.php b/mod/profile.php index 7ee03a77b..3c9c7808d 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -33,7 +33,7 @@ function profile_init(&$a) { $profile = $r[0]['profile_guid']; } - $a->page['htmlhead'] .= '' . "\r\n" ; + $a->page['htmlhead'] .= '' . "\r\n" ; if(! $profile) { $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 9dc71f256..789989ff2 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -189,8 +189,8 @@ function profile_photo_post(&$a) { } else { $r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d", - dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-4'), - dbesc($a->get_baseurl() . '/photo/' . $base_image['resource_id'] . '-5'), + dbesc(z_root() . '/photo/' . $base_image['resource_id'] . '-4'), + dbesc(z_root() . '/photo/' . $base_image['resource_id'] . '-5'), intval($_REQUEST['profile']), intval(local_channel()) ); @@ -225,7 +225,7 @@ function profile_photo_post(&$a) { notice( t('Unable to process image') . EOL); } - goaway($a->get_baseurl() . '/profiles'); + goaway(z_root() . '/profiles'); return; // NOTREACHED } @@ -345,7 +345,7 @@ function profile_photo_content(&$a) { profile_photo_set_profile_perms(); //Reset default photo permissions to public proc_run('php','include/directory.php',local_channel()); - goaway($a->get_baseurl() . '/profiles'); + goaway(z_root() . '/profiles'); } $r = q("SELECT `data`, `type`, resource_id, os_storage FROM photo WHERE id = %d and uid = %d limit 1", @@ -404,7 +404,7 @@ function profile_photo_content(&$a) { '$profile0' => $profiles[0], '$form_security_token' => get_form_security_token("profile_photo"), // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') + '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') )); call_hooks('profile_photo_content_end', $o); @@ -419,7 +419,7 @@ function profile_photo_content(&$a) { '$filename' => $filename, '$profile' => intval($_REQUEST['profile']), '$resource' => $a->data['imagecrop'] . '-' . $a->data['imagecrop_resolution'], - '$image_url' => $a->get_baseurl() . '/photo/' . $filename, + '$image_url' => z_root() . '/photo/' . $filename, '$title' => t('Crop Image'), '$desc' => t('Please adjust the image cropping for optimum viewing.'), '$form_security_token' => get_form_security_token("profile_photo"), diff --git a/mod/profiles.php b/mod/profiles.php index f891c6033..fca2ff429 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -17,7 +17,7 @@ function profiles_init(&$a) { ); if(! count($r)) { notice( t('Profile not found.') . EOL); - goaway($a->get_baseurl(true) . '/profiles'); + goaway(z_root() . '/profiles'); return; // NOTREACHED } $profile_guid = $r['profile_guid']; @@ -44,7 +44,7 @@ function profiles_init(&$a) { // profiles_build_sync(local_channel()); - goaway($a->get_baseurl(true) . '/profiles'); + goaway(z_root() . '/profiles'); return; // NOTREACHED } @@ -83,9 +83,9 @@ function profiles_init(&$a) { info( t('New profile created.') . EOL); if(count($r3) == 1) - goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']); + goaway(z_root() . '/profiles/' . $r3[0]['id']); - goaway($a->get_baseurl(true) . '/profiles'); + goaway(z_root() . '/profiles'); } if((argc() > 2) && (argv(1) === 'clone')) { @@ -129,9 +129,9 @@ function profiles_init(&$a) { profiles_build_sync(local_channel()); if(($r3) && (count($r3) == 1)) - goaway($a->get_baseurl(true) . '/profiles/' . $r3[0]['id']); + goaway(z_root() . '/profiles/' . $r3[0]['id']); - goaway($a->get_baseurl(true) . '/profiles'); + goaway(z_root() . '/profiles'); return; // NOTREACHED } @@ -629,7 +629,7 @@ function profiles_content(&$a) { // $editselect = 'textareas'; $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$editselect' => $editselect, )); @@ -703,7 +703,7 @@ function profiles_content(&$a) { '$lbl_gender' => t('Your gender'), '$lbl_marital' => t('Marital status'), '$lbl_sexual' => t('Sexual preference'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$profile_id' => $r[0]['id'], '$profile_name' => array('profile_name', t('Profile name'), $r[0]['profile_name'], t('Required'), '*'), '$is_default' => $is_default, @@ -767,7 +767,7 @@ function profiles_content(&$a) { '$profile_name' => $rr['profile_name'], '$visible' => (($rr['is_default']) ? '' . translate_scope(map_scope($channel['channel_r_profile'])) . '' - : '' . t('Edit visibility') . '') + : '' . t('Edit visibility') . '') )); } diff --git a/mod/randprof.php b/mod/randprof.php index 9817685c8..124117e96 100644 --- a/mod/randprof.php +++ b/mod/randprof.php @@ -8,5 +8,5 @@ function randprof_init(&$a) { goaway(chanlink_url($x)); /** FIXME this doesn't work at the moment as a fallback */ - goaway($a->get_baseurl() . '/profile'); + goaway(z_root() . '/profile'); } diff --git a/mod/register.php b/mod/register.php index b533483f7..712691547 100644 --- a/mod/register.php +++ b/mod/register.php @@ -206,7 +206,7 @@ function register_content(&$a) { $tosurl = get_config('system','tos_url'); if(! $tosurl) - $tosurl = $a->get_baseurl() . '/help/TermsOfService'; + $tosurl = z_root() . '/help/TermsOfService'; $toslink = '' . t('Terms of Service') . ''; diff --git a/mod/removeaccount.php b/mod/removeaccount.php index f3fa53f75..2752a2ee7 100644 --- a/mod/removeaccount.php +++ b/mod/removeaccount.php @@ -52,7 +52,7 @@ function removeaccount_content(&$a) { $_SESSION['remove_account_verify'] = $hash; $tpl = get_markup_template('removeaccount.tpl'); $o .= replace_macros($tpl, array( - '$basedir' => $a->get_baseurl(), + '$basedir' => z_root(), '$hash' => $hash, '$title' => t('Remove This Account'), '$desc' => array(t('WARNING: '), t('This account and all its channels will be completely removed from the network. '), t('This action is permanent and can not be undone!')), diff --git a/mod/removeme.php b/mod/removeme.php index b604bc7db..452ee5ef5 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -52,7 +52,7 @@ function removeme_content(&$a) { $tpl = get_markup_template('removeme.tpl'); $o .= replace_macros($tpl, array( - '$basedir' => $a->get_baseurl(), + '$basedir' => z_root(), '$hash' => $hash, '$title' => t('Remove This Channel'), '$desc' => array(t('WARNING: '), t('This channel will be completely removed from the network. '), t('This action is permanent and can not be undone!')), diff --git a/mod/rsd_xml.php b/mod/rsd_xml.php index 6fd9514cd..4ce82dbe0 100644 --- a/mod/rsd_xml.php +++ b/mod/rsd_xml.php @@ -10,7 +10,7 @@ function rsd_xml_content(&$a) { Red http://friendica.com/ - + http://status.net/wiki/TwitterCompatibleAPI false diff --git a/mod/search_ac.php b/mod/search_ac.php index 19c1dc940..6ffdc6ed5 100644 --- a/mod/search_ac.php +++ b/mod/search_ac.php @@ -50,7 +50,7 @@ function search_ac_init(&$a){ if(count($r)) { foreach($r as $g) { $results[] = array( - "photo" => $a->get_baseurl() . '/images/hashtag.png', + "photo" => z_root() . '/images/hashtag.png', "name" => '#'.$g['term'], "id" => $g['tid'], "link" => $g['url'], diff --git a/mod/settings.php b/mod/settings.php index a6655f46a..d8aa069d0 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -57,7 +57,7 @@ function settings_post(&$a) { q("DELETE FROM tokens WHERE id='%s' AND uid=%d", dbesc($key), local_channel()); - goaway($a->get_baseurl(true)."/settings/oauth/"); + goaway(z_root()."/settings/oauth/"); return; } @@ -114,7 +114,7 @@ function settings_post(&$a) { ); } } - goaway($a->get_baseurl(true)."/settings/oauth/"); + goaway(z_root()."/settings/oauth/"); return; } @@ -211,7 +211,7 @@ function settings_post(&$a) { call_hooks('display_settings_post', $_POST); build_sync_packet(); - goaway($a->get_baseurl(true) . '/settings/display' ); + goaway(z_root() . '/settings/display' ); return; // NOTREACHED } @@ -294,7 +294,7 @@ function settings_post(&$a) { foreach($errs as $err) notice($err . EOL); } - goaway($a->get_baseurl(true) . '/settings/account' ); + goaway(z_root() . '/settings/account' ); } @@ -563,7 +563,7 @@ function settings_post(&$a) { } - goaway($a->get_baseurl(true) . '/settings' ); + goaway(z_root() . '/settings' ); return; // NOTREACHED } @@ -637,7 +637,7 @@ function settings_content(&$a) { $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d", dbesc(argv(3)), local_channel()); - goaway($a->get_baseurl(true)."/settings/oauth/"); + goaway(z_root()."/settings/oauth/"); return; } @@ -653,7 +653,7 @@ function settings_content(&$a) { $tpl = get_markup_template("settings_oauth.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_oauth"), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$title' => t('Connected Apps'), '$add' => t('Add application'), '$edit' => t('Edit'), @@ -847,7 +847,7 @@ function settings_content(&$a) { '$d_cset' => t('Content Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Submit'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$uid' => local_channel(), '$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false), @@ -989,7 +989,7 @@ function settings_content(&$a) { )); - $subdir = ((strlen($a->get_path())) ? '
    ' . t('or') . ' ' . $a->get_baseurl(true) . '/channel/' . $nickname : ''); + $subdir = ((strlen($a->get_path())) ? '
    ' . t('or') . ' ' . z_root() . '/channel/' . $nickname : ''); $tpl_addr = get_markup_template("settings_nick_set.tpl"); @@ -1039,7 +1039,7 @@ function settings_content(&$a) { '$ptitle' => t('Channel Settings'), '$submit' => t('Submit'), - '$baseurl' => $a->get_baseurl(true), + '$baseurl' => z_root(), '$uid' => local_channel(), '$form_security_token' => get_form_security_token("settings"), '$nickname_block' => $prof_addr, diff --git a/mod/setup.php b/mod/setup.php index 282b9cbef..84fb752c3 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -291,7 +291,7 @@ function setup_content(&$a) { '$next' => t('Next'), '$reload' => t('Check again'), '$phpath' => $phpath, - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), )); return $o; }; break; @@ -329,7 +329,7 @@ function setup_content(&$a) { '$siteurl' => array('siteurl', t('Website URL'), z_root(), t('Please use SSL (https) URL if available.')), '$lbl_10' => t('Please select a default timezone for your website'), - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$phpath' => $phpath, @@ -372,7 +372,7 @@ function setup_content(&$a) { '$timezone' => array('timezone', t('Please select a default timezone for your website'), $timezone, '', get_timezones()), - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$submit' => t('Submit'), )); @@ -633,7 +633,7 @@ function check_htaccess(&$checks) { $help = ''; $ssl_error = false; - $url = $a->get_baseurl() . '/setup/testrewrite'; + $url = z_root() . '/setup/testrewrite'; if (function_exists('curl_init')){ $test = z_fetch_url($url); @@ -733,7 +733,7 @@ function what_next() { require_once ('include/identity.php'); create_sys_channel(); - $baseurl = $a->get_baseurl(); + $baseurl = z_root(); return t('

    What next

    ') ."

    ".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') diff --git a/mod/subthread.php b/mod/subthread.php index ce087806e..9438b545c 100755 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -134,7 +134,7 @@ function subthread_content(&$a) { $ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]'; $alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]'; - $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]'; + $plink = '[zrl=' . z_root() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]'; $arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink ); diff --git a/mod/suggest.php b/mod/suggest.php index 438d884ca..ebe0e0f78 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -27,7 +27,7 @@ function suggest_content(&$a) { return; } - $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; + $_SESSION['return_url'] = z_root() . '/' . $a->cmd; $r = suggestion_query(local_channel(),get_observer_hash()); @@ -40,7 +40,7 @@ function suggest_content(&$a) { foreach($r as $rr) { - $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['xchan_addr']; + $connlnk = z_root() . '/follow/?url=' . $rr['xchan_addr']; $arr[] = array( 'url' => chanlink_url($rr['xchan_url']), @@ -48,7 +48,7 @@ function suggest_content(&$a) { 'profile' => $rr['xchan_url'], 'name' => $rr['xchan_name'], 'photo' => $rr['xchan_photo_m'], - 'ignlnk' => $a->get_baseurl() . '/suggest?ignore=' . $rr['xchan_hash'], + 'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'], 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'ignore' => t('Ignore/Hide') diff --git a/mod/tagger.php b/mod/tagger.php index 27a8a15ea..eba02c9c4 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -80,9 +80,9 @@ function tagger_content(&$a) { $link = xmlify('' . "\n") ; + . z_root() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ; - $tagid = $a->get_baseurl() . '/search?tag=' . $term; + $tagid = z_root() . '/search?tag=' . $term; $objtype = ACTIVITY_OBJ_TAGTERM; $obj = json_encode(array( @@ -98,7 +98,7 @@ function tagger_content(&$a) { // saving here for reference // also check out x22d5 and x2317 and x0d6b and x0db8 and x24d0 and xff20 !!! - $termlink = html_entity_decode('⋕') . '[zrl=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]'; + $termlink = html_entity_decode('⋕') . '[zrl=' . z_root() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]'; $channel = $a->get_channel(); diff --git a/mod/tagrm.php b/mod/tagrm.php index 56e842fb8..5523a8dd3 100644 --- a/mod/tagrm.php +++ b/mod/tagrm.php @@ -5,11 +5,11 @@ require_once('bbcode.php'); function tagrm_post(&$a) { if(! local_channel()) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); if((x($_POST,'submit')) && ($_POST['submit'] === t('Cancel'))) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); $tag = ((x($_POST,'tag')) ? trim($_POST['tag']) : ''); $item = ((x($_POST,'item')) ? intval($_POST['item']) : 0 ); @@ -20,7 +20,7 @@ function tagrm_post(&$a) { ); if(! $r) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); $r = fetch_post_tags($r,true); @@ -42,7 +42,7 @@ function tagrm_post(&$a) { item_store_update($item); info( t('Tag removed') . EOL ); - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); // NOTREACHED @@ -53,7 +53,7 @@ function tagrm_post(&$a) { function tagrm_content(&$a) { if(! local_channel()) { - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); // NOTREACHED } @@ -69,7 +69,7 @@ function tagrm_content(&$a) { ); if(! $r) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); $r = fetch_post_tags($r,true); @@ -92,7 +92,7 @@ function tagrm_content(&$a) { item_store_update($item); info( t('Tag removed') . EOL ); - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); } @@ -109,12 +109,12 @@ function tagrm_content(&$a) { ); if(! $r) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); $r = fetch_post_tags($r,true); if(! count($r[0]['term'])) - goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']); + goaway(z_root() . '/' . $_SESSION['photo_return']); $o .= '

    ' . t('Remove Item Tag') . '

    '; diff --git a/mod/toggle_mobile.php b/mod/toggle_mobile.php index 06dadca04..918c4aad6 100644 --- a/mod/toggle_mobile.php +++ b/mod/toggle_mobile.php @@ -10,7 +10,7 @@ function toggle_mobile_init(&$a) { if(isset($_GET['address'])) $address = $_GET['address']; else - $address = $a->get_baseurl(); + $address = z_root(); goaway($address); } diff --git a/mod/xrd.php b/mod/xrd.php index ed8e1eabe..0719407f6 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -28,7 +28,7 @@ function xrd_init(&$a) { killme(); $dspr = replace_macros(get_markup_template('xrd_diaspora.tpl'),array( - '$baseurl' => $a->get_baseurl(), + '$baseurl' => z_root(), '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',$a->get_hostname()), '$dspr_key' => base64_encode(pemtorsa($r[0]['channel_pubkey'])) )); @@ -51,17 +51,17 @@ function xrd_init(&$a) { '$nick' => $r[0]['channel_address'], '$accturi' => $resource, '$aliases' => $aliases, - '$profile_url' => $a->get_baseurl() . '/channel/' . $r[0]['channel_address'], - '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['channel_address'], - '$atom' => $a->get_baseurl() . '/feed/' . $r[0]['channel_address'], - '$zot_post' => $a->get_baseurl() . '/post/' . $r[0]['channel_address'], - '$poco_url' => $a->get_baseurl() . '/poco/' . $r[0]['channel_address'], - '$photo' => $a->get_baseurl() . '/photo/profile/l/' . $r[0]['channel_id'], + '$profile_url' => z_root() . '/channel/' . $r[0]['channel_address'], + '$hcard_url' => z_root() . '/hcard/' . $r[0]['channel_address'], + '$atom' => z_root() . '/feed/' . $r[0]['channel_address'], + '$zot_post' => z_root() . '/post/' . $r[0]['channel_address'], + '$poco_url' => z_root() . '/poco/' . $r[0]['channel_address'], + '$photo' => z_root() . '/photo/profile/l/' . $r[0]['channel_id'], '$dspr' => $dspr, -// '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'], -// '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'] . '/mention', +// '$salmon' => z_root() . '/salmon/' . $r[0]['channel_address'], +// '$salmen' => z_root() . '/salmon/' . $r[0]['channel_address'] . '/mention', '$modexp' => 'data:application/magic-public-key,' . $salmon_key, - '$subscribe' => $a->get_baseurl() . '/follow?url={uri}', + '$subscribe' => z_root() . '/follow?url={uri}', '$bigkey' => salmon_key($r[0]['channel_pubkey']) )); -- cgit v1.2.3 From 3fdd110e0775113d2246a9db16c6c920ecddf19d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 31 Mar 2016 13:21:48 +0200 Subject: mod chat rework continued --- mod/chatsvc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/chatsvc.php b/mod/chatsvc.php index 829fef6f8..bdf4a9f8c 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -137,7 +137,8 @@ function chatsvc_content(&$a) { 'name' => $rr['xchan_name'], 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $rr['created'], 'r'), - 'text' => smilies(bbcode($rr['chat_text'])) + 'text' => smilies(bbcode($rr['chat_text'])), + 'self' => ((get_observer_hash() == $rr['chat_xchan']) ? 'self' : '') ); } } -- cgit v1.2.3 From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- mod/_well_known.php | 26 ++++----- mod/achievements.php | 2 +- mod/admin.php | 56 ++++++++++---------- mod/api.php | 6 +-- mod/appman.php | 2 +- mod/apps.php | 2 +- mod/block.php | 6 +-- mod/blocks.php | 16 +++--- mod/bookmarks.php | 4 +- mod/branchtopic.php | 2 +- mod/cal.php | 18 +++---- mod/channel.php | 78 +++++++++++++-------------- mod/chanview.php | 14 ++--- mod/chat.php | 26 ++++----- mod/chatsvc.php | 36 ++++++------- mod/cloud.php | 6 +-- mod/common.php | 10 ++-- mod/connect.php | 34 ++++++------ mod/connections.php | 18 +++---- mod/connedit.php | 50 +++++++++--------- mod/cover_photo.php | 26 ++++----- mod/dav.php | 6 +-- mod/directory.php | 12 ++--- mod/dirsearch.php | 4 +- mod/display.php | 16 +++--- mod/dreport.php | 2 +- mod/editblock.php | 14 ++--- mod/editlayout.php | 16 +++--- mod/editpost.php | 12 ++--- mod/editwebpage.php | 16 +++--- mod/events.php | 18 +++---- mod/fbrowser.php | 18 +++---- mod/fhublocs.php | 6 +-- mod/filer.php | 2 +- mod/filerm.php | 2 +- mod/filestorage.php | 10 ++-- mod/follow.php | 2 +- mod/fsuggest.php | 8 +-- mod/group.php | 2 +- mod/hcard.php | 8 +-- mod/help.php | 18 +++---- mod/home.php | 8 +-- mod/hostxrd.php | 2 +- mod/id.php | 10 ++-- mod/impel.php | 2 +- mod/import.php | 8 +-- mod/import_items.php | 2 +- mod/invite.php | 8 +-- mod/item.php | 4 +- mod/layouts.php | 16 +++--- mod/like.php | 4 +- mod/locs.php | 4 +- mod/login.php | 2 +- mod/lostpass.php | 2 +- mod/magic.php | 4 +- mod/mail.php | 18 +++---- mod/manage.php | 4 +- mod/match.php | 10 ++-- mod/menu.php | 20 +++---- mod/message.php | 4 +- mod/mitem.php | 46 ++++++++-------- mod/mood.php | 4 +- mod/network.php | 22 ++++---- mod/new_channel.php | 8 +-- mod/notifications.php | 2 +- mod/oembed.php | 2 +- mod/oexchange.php | 2 +- mod/openid.php | 6 +-- mod/opensearch.php | 2 +- mod/page.php | 20 +++---- mod/pconfig.php | 2 +- mod/photo.php | 4 +- mod/photos.php | 138 ++++++++++++++++++++++++------------------------ mod/ping.php | 8 +-- mod/poke.php | 2 +- mod/prate.php | 4 +- mod/probe.php | 2 +- mod/profile.php | 18 +++---- mod/profile_photo.php | 26 ++++----- mod/profiles.php | 22 ++++---- mod/profperm.php | 4 +- mod/public.php | 12 ++--- mod/rate.php | 36 ++++++------- mod/ratings.php | 14 ++--- mod/rbmark.php | 4 +- mod/regmod.php | 4 +- mod/regver.php | 2 +- mod/removeaccount.php | 2 +- mod/removeme.php | 2 +- mod/rmagic.php | 4 +- mod/rpost.php | 6 +-- mod/search.php | 20 +++---- mod/service_limits.php | 2 +- mod/settings.php | 38 ++++++------- mod/setup.php | 40 +++++++------- mod/share.php | 2 +- mod/sharedwithme.php | 2 +- mod/siteinfo.php | 2 +- mod/smilies.php | 2 +- mod/sources.php | 2 +- mod/subthread.php | 2 +- mod/suggest.php | 2 +- mod/tagger.php | 2 +- mod/tasks.php | 2 +- mod/thing.php | 4 +- mod/uexport.php | 2 +- mod/view.php | 2 +- mod/viewconnections.php | 18 +++---- mod/viewsrc.php | 2 +- mod/wall_attach.php | 6 +-- mod/wall_upload.php | 2 +- mod/webpages.php | 22 ++++---- mod/wfinger.php | 2 +- mod/xrd.php | 4 +- mod/zotfeed.php | 2 +- mod/zping.php | 2 +- 116 files changed, 689 insertions(+), 689 deletions(-) (limited to 'mod') diff --git a/mod/_well_known.php b/mod/_well_known.php index 46714deaa..23d79bb1d 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -25,36 +25,36 @@ function _well_known_init(&$a){ switch(argv(1)) { case 'zot-info': - $a->argc -= 1; - array_shift($a->argv); - $a->argv[0] = 'zfinger'; + App::$argc -= 1; + array_shift(App::$argv); + App::$argv[0] = 'zfinger'; require_once('mod/zfinger.php'); zfinger_init($a); break; case 'webfinger': - $a->argc -= 1; - array_shift($a->argv); - $a->argv[0] = 'wfinger'; + App::$argc -= 1; + array_shift(App::$argv); + App::$argv[0] = 'wfinger'; require_once('mod/wfinger.php'); wfinger_init($a); break; case 'host-meta': - $a->argc -= 1; - array_shift($a->argv); - $a->argv[0] = 'hostxrd'; + App::$argc -= 1; + array_shift(App::$argv); + App::$argv[0] = 'hostxrd'; require_once('mod/hostxrd.php'); hostxrd_init($a); break; default: - if(file_exists($a->cmd)) { - echo file_get_contents($a->cmd); + if(file_exists(App::$cmd)) { + echo file_get_contents(App::$cmd); killme(); } - elseif(file_exists($a->cmd . '.php')) - require_once($a->cmd . '.php'); + elseif(file_exists(App::$cmd . '.php')) + require_once(App::$cmd . '.php'); break; } diff --git a/mod/achievements.php b/mod/achievements.php index 1d0018b08..9d4dad35b 100644 --- a/mod/achievements.php +++ b/mod/achievements.php @@ -23,7 +23,7 @@ function achievements_content(&$a) { $owner = intval($r[0]['channel_id']); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); $perms = get_all_perms($owner,$ob_hash); if(! $perms['view_profile']) { diff --git a/mod/admin.php b/mod/admin.php index 0d8bf8395..be703f922 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -196,7 +196,7 @@ function admin_page_summary(&$a) { $queues = array( 'label' => t('Message queues'), 'queue' => $queue ); // If no plugins active return 0, otherwise list of plugin names - $plugins = (count($a->plugins) == 0) ? count($a->plugins) : $a->plugins; + $plugins = (count(App::$plugins) == 0) ? count(App::$plugins) : App::$plugins; // Could be extended to provide also other alerts to the admin $alertmsg = ''; @@ -514,7 +514,7 @@ function admin_page_hubloc_post(&$a){ $hublocurl = $arrhublocurl[0]['hubloc_url'] . '/post'; //perform ping - $m = zot_build_packet($a->get_channel(),'ping'); + $m = zot_build_packet(App::get_channel(),'ping'); $r = zot_zot($hublocurl,$m); //handle results and set the hubloc flags in db to make results visible $r2 = $r['body']; @@ -671,7 +671,7 @@ function admin_page_hubloc(&$a) { '$queues' => $queues, //'$accounts' => $accounts, /*$accounts is empty here*/ '$pending' => array( t('Pending registrations'), $pending), - '$plugins' => array( t('Active plugins'), $a->plugins ), + '$plugins' => array( t('Active plugins'), App::$plugins ), '$form_security_token' => get_form_security_token('admin_hubloc') )); } @@ -936,8 +936,8 @@ function admin_page_users(&$a){ $total = q("SELECT count(*) as total FROM account"); if (count($total)) { - $a->set_pager_total($total[0]['total']); - $a->set_pager_itemspage(100); + App::set_pager_total($total[0]['total']); + App::set_pager_itemspage(100); } @@ -958,8 +958,8 @@ function admin_page_users(&$a){ "FROM account as ac where true $serviceclass $order limit %d offset %d ", intval(ACCOUNT_BLOCKED), db_concat('ch.channel_address', ' '), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); // function _setup_users($e){ @@ -1117,15 +1117,15 @@ function admin_page_channels(&$a){ $total = q("SELECT count(*) as total FROM channel where channel_removed = 0 and channel_system = 0"); if($total) { - $a->set_pager_total($total[0]['total']); - $a->set_pager_itemspage(100); + App::set_pager_total($total[0]['total']); + App::set_pager_itemspage(100); } $order = " order by channel_name asc "; $channels = q("SELECT * from channel where channel_removed = 0 and channel_system = 0 $order limit %d offset %d ", - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); if($channels) { @@ -1183,14 +1183,14 @@ function admin_page_plugins(&$a){ /* * Single plugin */ - if ($a->argc == 3){ - $plugin = $a->argv[2]; + if (App::$argc == 3){ + $plugin = App::$argv[2]; if (!is_file("addon/$plugin/$plugin.php")){ notice( t("Item not found.") ); return ''; } - $enabled = in_array($plugin,$a->plugins); + $enabled = in_array($plugin,App::$plugins); $info = get_plugin_info($plugin); $x = check_plugin_versions($info); @@ -1198,11 +1198,11 @@ function admin_page_plugins(&$a){ if($enabled && ! $x) { $enabled = false; - $idz = array_search($plugin, $a->plugins); + $idz = array_search($plugin, App::$plugins); if ($idz !== false) { - unset($a->plugins[$idz]); + unset(App::$plugins[$idz]); uninstall_plugin($plugin); - set_config("system","addon", implode(", ",$a->plugins)); + set_config("system","addon", implode(", ",App::$plugins)); } } $info['disabled'] = 1-intval($x); @@ -1211,23 +1211,23 @@ function admin_page_plugins(&$a){ check_form_security_token_redirectOnErr('/admin/plugins', 'admin_plugins', 't'); // Toggle plugin status - $idx = array_search($plugin, $a->plugins); + $idx = array_search($plugin, App::$plugins); if ($idx !== false){ - unset($a->plugins[$idx]); + unset(App::$plugins[$idx]); uninstall_plugin($plugin); info( sprintf( t("Plugin %s disabled."), $plugin ) ); } else { - $a->plugins[] = $plugin; + App::$plugins[] = $plugin; install_plugin($plugin); info( sprintf( t("Plugin %s enabled."), $plugin ) ); } - set_config("system","addon", implode(", ",$a->plugins)); + set_config("system","addon", implode(", ",App::$plugins)); goaway(z_root() . '/admin/plugins' ); } // display plugin details require_once('library/markdown.php'); - if (in_array($plugin, $a->plugins)){ + if (in_array($plugin, App::$plugins)){ $status = 'on'; $action = t('Disable'); } else { @@ -1298,18 +1298,18 @@ function admin_page_plugins(&$a){ if (is_dir($file)){ list($tmp, $id) = array_map('trim', explode('/', $file)); $info = get_plugin_info($id); - $enabled = in_array($id,$a->plugins); + $enabled = in_array($id,App::$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); + $idz = array_search($id, App::$plugins); if ($idz !== false) { - unset($a->plugins[$idz]); + unset(App::$plugins[$idz]); uninstall_plugin($id); - set_config("system","addon", implode(", ",$a->plugins)); + set_config("system","addon", implode(", ",App::$plugins)); } } $info['disabled'] = 1-intval($x); @@ -1428,8 +1428,8 @@ function admin_page_themes(&$a){ * Single theme */ - if ($a->argc == 3){ - $theme = $a->argv[2]; + if (App::$argc == 3){ + $theme = App::$argv[2]; if(! is_dir("view/theme/$theme")){ notice( t("Item not found.") ); return ''; diff --git a/mod/api.php b/mod/api.php index 232349292..aa95b81dd 100644 --- a/mod/api.php +++ b/mod/api.php @@ -27,7 +27,7 @@ function api_post(&$a) { return; } - if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_channel()) { + if(count(App::$user) && x(App::$user,'uid') && App::$user['uid'] != local_channel()) { notice( t('Permission denied.') . EOL); return; } @@ -35,13 +35,13 @@ function api_post(&$a) { } function api_content(&$a) { - if($a->cmd=='api/oauth/authorize'){ + if(App::$cmd=='api/oauth/authorize'){ /* * api/oauth/authorize interact with the user. return a standard page */ - $a->page['template'] = "minimal"; + App::$page['template'] = "minimal"; // get consumer/client from request token try { diff --git a/mod/appman.php b/mod/appman.php index e31492f0b..d8d030465 100644 --- a/mod/appman.php +++ b/mod/appman.php @@ -67,7 +67,7 @@ function appman_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $app = null; $embed = null; if($_REQUEST['appid']) { diff --git a/mod/apps.php b/mod/apps.php index fcf545421..3539b2bc0 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -9,7 +9,7 @@ function apps_content(&$a) { else $mode = 'list'; - $_SESSION['return_url'] = $a->cmd; + $_SESSION['return_url'] = App::$cmd; $apps = array(); diff --git a/mod/block.php b/mod/block.php index df3909629..301993d03 100644 --- a/mod/block.php +++ b/mod/block.php @@ -10,15 +10,15 @@ function block_init(&$a) { $profile = 0; profile_load($a,$which,$profile); - if($a->profile['profile_uid']) - head_set_icon($a->profile['thumb']); + if(App::$profile['profile_uid']) + head_set_icon(App::$profile['thumb']); } function block_content(&$a) { - if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_pages')) { + if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_pages')) { notice( t('Permission denied.') . EOL); return; } diff --git a/mod/blocks.php b/mod/blocks.php index 97cc5cd53..96005e9a3 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -9,7 +9,7 @@ function blocks_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -25,24 +25,24 @@ function blocks_init(&$a) { function blocks_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $which = argv(1); - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -86,7 +86,7 @@ function blocks_content(&$a) { $x = array( 'webpage' => ITEM_TYPE_BLOCK, 'is_owner' => true, - 'nickname' => $a->profile['channel_address'], + 'nickname' => App::$profile['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'bang' => '', 'showacl' => false, diff --git a/mod/bookmarks.php b/mod/bookmarks.php index c3d25253f..02fe2f2e1 100644 --- a/mod/bookmarks.php +++ b/mod/bookmarks.php @@ -7,7 +7,7 @@ function bookmarks_init(&$a) { if(! $item_id) return; - $u = $a->get_channel(); + $u = App::get_channel(); $item_normal = item_normal(); @@ -53,7 +53,7 @@ function bookmarks_content(&$a) { require_once('include/menu.php'); require_once('include/conversation.php'); - $channel = $a->get_channel(); + $channel = App::get_channel(); $o = profile_tabs($a,true,$channel['channel_address']); diff --git a/mod/branchtopic.php b/mod/branchtopic.php index d49bbaf4c..3702e6d53 100644 --- a/mod/branchtopic.php +++ b/mod/branchtopic.php @@ -13,7 +13,7 @@ function branchtopic_init(&$a) { if(! $item_id) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if(! $channel) return; diff --git a/mod/cal.php b/mod/cal.php index 80a484c27..ffefd895e 100755 --- a/mod/cal.php +++ b/mod/cal.php @@ -25,16 +25,16 @@ function cal_init(&$a) { if(! $channelx) return; - $a->data['channel'] = $channelx; + App::$data['channel'] = $channelx; - $observer = $a->get_observer(); - $a->data['observer'] = $observer; + $observer = App::get_observer(); + App::$data['observer'] = $observer; $observer_xchan = (($observer) ? $observer['xchan_hash'] : ''); - head_set_icon($a->data['channel']['xchan_photo_s']); + head_set_icon(App::$data['channel']['xchan_photo_s']); - $a->page['htmlhead'] .= "" ; + App::$page['htmlhead'] .= "" ; } @@ -70,11 +70,11 @@ function cal_content(&$a) { $first_day = (($first_day) ? $first_day : 0); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl,array( + App::$page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => z_root(), '$module_url' => '/cal/' . $channel['channel_address'], '$modparams' => 2, - '$lang' => $a->language, + '$lang' => App::$language, '$first_day' => $first_day )); @@ -87,7 +87,7 @@ function cal_content(&$a) { $m = 0; $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); - // logger('args: ' . print_r($a->argv,true)); + // logger('args: ' . print_r(App::$argv,true)); if(argc() > 3 && intval(argv(2)) && intval(argv(3))) { $mode = 'view'; @@ -243,7 +243,7 @@ function cal_content(&$a) { foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if(! x($links,$j)) - $links[$j] = z_root() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = z_root() . '/' . App::$cmd . '#link-' . $j; } } diff --git a/mod/channel.php b/mod/channel.php index d609d6802..88c420366 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -16,7 +16,7 @@ function channel_init(&$a) { $which = argv(1); if(! $which) { if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel && $channel['channel_address']) $which = $channel['channel_address']; } @@ -27,19 +27,19 @@ function channel_init(&$a) { } $profile = 0; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; - $a->page['htmlhead'] .= '' . "\r\n" ; + App::$page['htmlhead'] .= '' . "\r\n" ; + App::$page['htmlhead'] .= '' . "\r\n" ; // Not yet ready for prime time -// $a->page['htmlhead'] .= '' . "\r\n" ; -// $a->page['htmlhead'] .= '' . "\r\n" ; +// App::$page['htmlhead'] .= '' . "\r\n" ; +// App::$page['htmlhead'] .= '' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content @@ -75,27 +75,27 @@ function channel_content(&$a, $update = 0, $load = false) { if($update) { // Ensure we've got a profile owner if updating. - $a->profile['profile_uid'] = $a->profile_uid = $update; + App::$profile['profile_uid'] = App::$profile_uid = $update; } else { - if($a->profile['profile_uid'] == local_channel()) { + if(App::$profile['profile_uid'] == local_channel()) { nav_set_selected('home'); } } - $is_owner = (((local_channel()) && ($a->profile['profile_uid'] == local_channel())) ? true : false); + $is_owner = (((local_channel()) && (App::$profile['profile_uid'] == local_channel())) ? true : false); - $channel = $a->get_channel(); - $observer = $a->get_observer(); + $channel = App::get_channel(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); - $perms = get_all_perms($a->profile['profile_uid'],$ob_hash); + $perms = get_all_perms(App::$profile['profile_uid'],$ob_hash); if(! $perms['view_stream']) { // We may want to make the target of this redirect configurable if($perms['view_profile']) { notice( t('Insufficient permissions. Request redirected to profile page.') . EOL); - goaway (z_root() . "/profile/" . $a->profile['channel_address']); + goaway (z_root() . "/profile/" . App::$profile['channel_address']); } notice( t('Permission denied.') . EOL); return; @@ -104,9 +104,9 @@ function channel_content(&$a, $update = 0, $load = false) { if(! $update) { - $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']); + $o .= profile_tabs($a, $is_owner, App::$profile['channel_address']); - $o .= common_friends_visitor_widget($a->profile['profile_uid']); + $o .= common_friends_visitor_widget(App::$profile['profile_uid']); if($channel && $is_owner) { $channel_acl = array( @@ -124,15 +124,15 @@ function channel_content(&$a, $update = 0, $load = false) { $x = array( 'is_owner' => $is_owner, - 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig($a->profile['profile_uid'],'system','use_browser_location')))) ? true : 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,true,(($a->profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), + 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false), + 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''), + 'nickname' => App::$profile['channel_address'], + 'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($channel_acl,true,((App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), 'showacl' => (($is_owner) ? 'yes' : ''), 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), - 'profile_uid' => $a->profile['profile_uid'] + 'profile_uid' => App::$profile['profile_uid'] ); $o .= status_editor($a,$x); @@ -146,18 +146,18 @@ function channel_content(&$a, $update = 0, $load = false) { */ $item_normal = item_normal(); - $sql_extra = item_permissions_sql($a->profile['profile_uid']); + $sql_extra = item_permissions_sql(App::$profile['profile_uid']); - if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode') && (! $mid)) + if(get_pconfig(App::$profile['profile_uid'],'system','channel_list_mode') && (! $mid)) $page_mode = 'list'; else $page_mode = 'client'; - $abook_uids = " and abook.abook_channel = " . intval($a->profile['profile_uid']) . " "; + $abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " "; $simple_update = (($update) ? " AND item_unseen = 1 " : ''); - $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '' . "\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']) . "' ) "; @@ -170,7 +170,7 @@ function channel_content(&$a, $update = 0, $load = false) { $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", dbesc($mid . '%'), - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); } else { $r = q("SELECT distinct parent AS `item_id`, created from item @@ -180,7 +180,7 @@ function channel_content(&$a, $update = 0, $load = false) { AND (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra ORDER BY created DESC", - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); $_SESSION['loadtime'] = datetime_convert(); } @@ -203,15 +203,15 @@ function channel_content(&$a, $update = 0, $load = false) { } $itemspage = get_pconfig(local_channel(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); if($load || ($_COOKIE['jsAvailable'] != 1)) { if ($mid) { $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", dbesc($mid), - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); if (! $r) { notice( t('Permission denied.') . EOL); @@ -225,7 +225,7 @@ function channel_content(&$a, $update = 0, $load = false) { AND (abook_blocked = 0 or abook.abook_flags is null) $sql_extra $sql_extra2 ORDER BY created DESC $pager_sql ", - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); } } @@ -243,7 +243,7 @@ function channel_content(&$a, $update = 0, $load = false) { WHERE `item`.`uid` = %d $item_normal AND `item`.`parent` IN ( %s ) $sql_extra ", - intval($a->profile['profile_uid']), + intval(App::$profile['profile_uid']), dbesc($parents_str) ); @@ -266,19 +266,19 @@ function channel_content(&$a, $update = 0, $load = false) { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. - $maxheight = get_pconfig($a->profile['profile_uid'],'system','channel_divmore_height'); + $maxheight = get_pconfig(App::$profile['profile_uid'],'system','channel_divmore_height'); if(! $maxheight) $maxheight = 400; $o .= '
    ' . "\r\n"; - $o .= "\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'channel', - '$uid' => (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : '0'), + '$uid' => ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : '0'), '$gid' => '0', '$cid' => '0', '$cmin' => '0', @@ -290,7 +290,7 @@ function channel_content(&$a, $update = 0, $load = false) { '$nouveau' => '0', '$wall' => '1', '$fh' => '0', - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => '', '$order' => '', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), @@ -344,7 +344,7 @@ function channel_content(&$a, $update = 0, $load = false) { if((! $update) || ($_COOKIE['jsAvailable'] != 1)) { $o .= alt_pager($a,count($items)); if ($mid && $items[0]['title']) - $a->page['title'] = $items[0]['title'] . " - " . $a->page['title']; + App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; } if($mid) diff --git a/mod/chanview.php b/mod/chanview.php index 0cbcb2e57..705fb5a7d 100644 --- a/mod/chanview.php +++ b/mod/chanview.php @@ -5,7 +5,7 @@ require_once('include/zot.php'); function chanview_content(&$a) { - $observer = $a->get_observer(); + $observer = App::get_observer(); $xchan = null; $r = null; @@ -38,7 +38,7 @@ function chanview_content(&$a) { ); } if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } @@ -47,7 +47,7 @@ function chanview_content(&$a) { // address, we can and should try to import it. If it's just a hash, we can't continue, but we // probably wouldn't have a hash if we don't already have an xchan for this channel. - if(! $a->poi) { + if(! App::$poi) { logger('mod_chanview: fallback'); // This is hackish - construct a zot address from the url if($_REQUEST['url']) { @@ -67,13 +67,13 @@ function chanview_content(&$a) { dbesc($_REQUEST['address']) ); if($r) - $a->poi = $r[0]; + App::$poi = $r[0]; } } } - if(! $a->poi) { + if(! App::$poi) { // We don't know who this is, and we can't figure it out from the URL // On the plus side, there's a good chance we know somebody else at that // hub so sending them there with a Zid will probably work anyway. @@ -82,8 +82,8 @@ function chanview_content(&$a) { $url = zid($url); } - if ($a->poi) { - $url = $a->poi['xchan_url']; + if (App::$poi) { + $url = App::$poi['xchan_url']; if($observer) $url = zid($url); } diff --git a/mod/chat.php b/mod/chat.php index 682921ec2..211846964 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -10,7 +10,7 @@ function chat_init(&$a) { $which = argv(1); if(! $which) { if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel && $channel['channel_address']) $which = $channel['channel_address']; } @@ -21,14 +21,14 @@ function chat_init(&$a) { } $profile = 0; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; $profile = argv(1); } - $a->page['htmlhead'] .= '' . "\r\n" ; + App::$page['htmlhead'] .= '' . "\r\n" ; // Run profile_load() here to make sure the theme is set before // we start loading content @@ -45,7 +45,7 @@ function chat_post(&$a) { if((! $room) || (! local_channel())) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($_POST['action'] === 'drop') { @@ -86,16 +86,16 @@ function chat_post(&$a) { function chat_content(&$a) { if(local_channel()) - $channel = $a->get_channel(); + $channel = App::get_channel(); - $ob = $a->get_observer(); + $ob = App::get_observer(); $observer = get_observer_hash(); if(! $observer) { notice( t('Permission denied.') . EOL); return; } - if(! perm_is_allowed($a->profile['profile_uid'],$observer,'chat')) { + if(! perm_is_allowed(App::$profile['profile_uid'],$observer,'chat')) { notice( t('Permission denied.') . EOL); return; } @@ -159,7 +159,7 @@ function chat_content(&$a) { return; $x = q("select * from chatroom where cr_id = %d and cr_uid = %d $sql_extra limit 1", intval($room_id), - intval($a->profile['profile_uid']) + intval(App::$profile['profile_uid']) ); if($x) { @@ -206,7 +206,7 @@ function chat_content(&$a) { require_once('include/conversation.php'); - $o = profile_tabs($a,((local_channel() && local_channel() == $a->profile['profile_uid']) ? true : false),$a->profile['channel_address']); + $o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']); $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); @@ -228,17 +228,17 @@ function chat_content(&$a) { )); } - $rooms = chatroom_list($a->profile['profile_uid']); + $rooms = chatroom_list(App::$profile['profile_uid']); $o .= replace_macros(get_markup_template('chatrooms.tpl'), array( - '$header' => sprintf( t('%1$s\'s Chatrooms'), $a->profile['name']), + '$header' => sprintf( t('%1$s\'s Chatrooms'), App::$profile['name']), '$name' => t('Name'), '$baseurl' => z_root(), - '$nickname' => $a->profile['channel_address'], + '$nickname' => App::$profile['channel_address'], '$rooms' => $rooms, '$norooms' => t('No chatrooms available'), '$newroom' => t('Create New'), - '$is_owner' => ((local_channel() && local_channel() == $a->profile['profile_uid']) ? 1 : 0), + '$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0), '$chatroom_new' => $chatroom_new, )); diff --git a/mod/chatsvc.php b/mod/chatsvc.php index 829fef6f8..f0497bfd9 100644 --- a/mod/chatsvc.php +++ b/mod/chatsvc.php @@ -8,16 +8,16 @@ function chatsvc_init(&$a) { $ret = array('success' => false); - $a->data['chat']['room_id'] = intval($_REQUEST['room_id']); + App::$data['chat']['room_id'] = intval($_REQUEST['room_id']); $x = q("select cr_uid from chatroom where cr_id = %d and cr_id != 0 limit 1", - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['room_id']) ); if(! $x) json_return_and_die($ret); - $a->data['chat']['uid'] = $x[0]['cr_uid']; + App::$data['chat']['uid'] = $x[0]['cr_uid']; - if(! perm_is_allowed($a->data['chat']['uid'],get_observer_hash(),'chat')) { + if(! perm_is_allowed(App::$data['chat']['uid'],get_observer_hash(),'chat')) { json_return_and_die($ret); } @@ -27,22 +27,22 @@ function chatsvc_post(&$a) { $ret = array('success' => false); - $room_id = $a->data['chat']['room_id']; + $room_id = App::$data['chat']['room_id']; $text = escape_tags($_REQUEST['chat_text']); if(! $text) return; - $sql_extra = permissions_sql($a->data['chat']['uid']); + $sql_extra = permissions_sql(App::$data['chat']['uid']); $r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra", - intval($a->data['chat']['uid']), - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['uid']), + intval(App::$data['chat']['room_id']) ); if(! $r) json_return_and_die($ret); $arr = array( - 'chat_room' => $a->data['chat']['room_id'], + 'chat_room' => App::$data['chat']['room_id'], 'chat_xchan' => get_observer_hash(), 'chat_text' => $text ); @@ -51,7 +51,7 @@ function chatsvc_post(&$a) { $x = q("insert into chat ( chat_room, chat_xchan, created, chat_text ) values( %d, '%s', '%s', '%s' )", - intval($a->data['chat']['room_id']), + intval(App::$data['chat']['room_id']), dbesc(get_observer_hash()), dbesc(datetime_convert()), dbesc($arr['chat_text']) @@ -64,13 +64,13 @@ function chatsvc_post(&$a) { function chatsvc_content(&$a) { $status = strip_tags($_REQUEST['status']); - $room_id = intval($a->data['chat']['room_id']); + $room_id = intval(App::$data['chat']['room_id']); $stopped = ((x($_REQUEST,'stopped') && intval($_REQUEST['stopped'])) ? true : false); if($status && $room_id) { $x = q("select channel_address from channel where channel_id = %d limit 1", - intval($a->data['chat']['uid']) + intval(App::$data['chat']['uid']) ); $r = q("update chatpresence set cp_status = '%s', cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'", @@ -90,11 +90,11 @@ function chatsvc_content(&$a) { $ret = array('success' => false); - $sql_extra = permissions_sql($a->data['chat']['uid']); + $sql_extra = permissions_sql(App::$data['chat']['uid']); $r = q("select * from chatroom where cr_uid = %d and cr_id = %d $sql_extra", - intval($a->data['chat']['uid']), - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['uid']), + intval(App::$data['chat']['room_id']) ); if(! $r) json_return_and_die($ret); @@ -102,7 +102,7 @@ function chatsvc_content(&$a) { $inroom = array(); $r = q("select * from chatpresence left join xchan on xchan_hash = cp_xchan where cp_room = %d order by xchan_name", - intval($a->data['chat']['room_id']) + intval(App::$data['chat']['room_id']) ); if($r) { foreach($r as $rr) { @@ -125,7 +125,7 @@ function chatsvc_content(&$a) { $chats = array(); $r = q("select * from chat left join xchan on chat_xchan = xchan_hash where chat_room = %d and chat_id > %d order by created", - intval($a->data['chat']['room_id']), + intval(App::$data['chat']['room_id']), intval($lastseen) ); if($r) { @@ -145,7 +145,7 @@ function chatsvc_content(&$a) { $r = q("update chatpresence set cp_last = '%s' where cp_room = %d and cp_xchan = '%s' and cp_client = '%s'", dbesc(datetime_convert()), - intval($a->data['chat']['room_id']), + intval(App::$data['chat']['room_id']), dbesc(get_observer_hash()), dbesc($_SERVER['REMOTE_ADDR']) ); diff --git a/mod/cloud.php b/mod/cloud.php index dc3e11ef3..eed941ff7 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -30,7 +30,7 @@ function cloud_init(&$a) { $profile = 0; - $a->page['htmlhead'] .= '' . "\r\n"; + App::$page['htmlhead'] .= '' . "\r\n"; if ($which) profile_load($a, $which, $profile); @@ -41,7 +41,7 @@ function cloud_init(&$a) { if ($ob_hash) { if (local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $auth->setCurrentUser($channel['channel_address']); $auth->channel_id = $channel['channel_id']; $auth->channel_hash = $channel['channel_hash']; @@ -77,7 +77,7 @@ function cloud_init(&$a) { if($_SERVER['REQUEST_METHOD'] === 'GET') { try { - $x = RedFileData('/' . $a->cmd, $auth); + $x = RedFileData('/' . App::$cmd, $auth); } catch(\Exception $e) { if($e instanceof Sabre\DAV\Exception\Forbidden) { diff --git a/mod/common.php b/mod/common.php index e19a9d3a9..3390bd997 100644 --- a/mod/common.php +++ b/mod/common.php @@ -8,7 +8,7 @@ function common_init(&$a) { $channel_id = intval(argv(1)); else { notice( t('No channel.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -25,27 +25,27 @@ function common_content(&$a) { $o = ''; - if(! $a->profile['profile_uid']) + if(! App::$profile['profile_uid']) return; $observer_hash = get_observer_hash(); - if(! perm_is_allowed($a->profile['profile_uid'],$observer_hash,'view_contacts')) { + if(! perm_is_allowed(App::$profile['profile_uid'],$observer_hash,'view_contacts')) { notice( t('Permission denied.') . EOL); return; } $o .= '

    ' . t('Common connections') . '

    '; - $t = count_common_friends($a->profile['profile_uid'],$observer_hash); + $t = count_common_friends(App::$profile['profile_uid'],$observer_hash); if(! $t) { notice( t('No connections in common.') . EOL); return $o; } - $r = common_friends($a->profile['profile_uid'],$observer_hash); + $r = common_friends(App::$profile['profile_uid'],$observer_hash); if($r) { diff --git a/mod/connect.php b/mod/connect.php index c36aef433..84c67e4d2 100644 --- a/mod/connect.php +++ b/mod/connect.php @@ -11,7 +11,7 @@ function connect_init(&$a) { $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -20,20 +20,20 @@ function connect_init(&$a) { ); if($r) - $a->data['channel'] = $r[0]; + App::$data['channel'] = $r[0]; profile_load($a,$which,''); } function connect_post(&$a) { - if(! array_key_exists('channel', $a->data)) + if(! array_key_exists('channel', App::$data)) return; - $edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false); + $edit = ((local_channel() && (local_channel() == App::$data['channel']['channel_id'])) ? true : false); if($edit) { - $has_premium = (($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0); + $has_premium = ((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? 1 : 0); $premium = (($_POST['premium']) ? intval($_POST['premium']) : 0); $text = escape_tags($_POST['text']); @@ -43,25 +43,25 @@ function connect_post(&$a) { intval(PAGE_PREMIUM), intval(local_channel()) ); - proc_run('php','include/notifier.php','refresh_all',$a->data['channel']['channel_id']); + proc_run('php','include/notifier.php','refresh_all',App::$data['channel']['channel_id']); } - set_pconfig($a->data['channel']['channel_id'],'system','selltext',$text); + set_pconfig(App::$data['channel']['channel_id'],'system','selltext',$text); // reload the page completely to get fresh data - goaway(z_root() . '/' . $a->query_string); + goaway(z_root() . '/' . App::$query_string); } $url = ''; - $observer = $a->get_observer(); + $observer = App::get_observer(); if(($observer) && ($_POST['submit'] === t('Continue'))) { if($observer['xchan_follow']) - $url = sprintf($observer['xchan_follow'],urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname())); + $url = sprintf($observer['xchan_follow'],urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname())); if(! $url) { $r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1", dbesc($observer['xchan_hash']) ); if($r) - $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode($a->data['channel']['channel_address'] . '@' . $a->get_hostname()); + $url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(App::$data['channel']['channel_address'] . '@' . App::get_hostname()); } } if($url) @@ -75,16 +75,16 @@ function connect_post(&$a) { function connect_content(&$a) { - $edit = ((local_channel() && (local_channel() == $a->data['channel']['channel_id'])) ? true : false); + $edit = ((local_channel() && (local_channel() == App::$data['channel']['channel_id'])) ? true : false); - $text = get_pconfig($a->data['channel']['channel_id'],'system','selltext'); + $text = get_pconfig(App::$data['channel']['channel_id'],'system','selltext'); if($edit) { $o = replace_macros(get_markup_template('sellpage_edit.tpl'),array( '$header' => t('Premium Channel Setup'), - '$address' => $a->data['channel']['channel_address'], - '$premium' => array('premium', t('Enable premium channel connection restrictions'),(($a->data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''), + '$address' => App::$data['channel']['channel_address'], + '$premium' => array('premium', t('Enable premium channel connection restrictions'),((App::$data['channel']['channel_pageflags'] & PAGE_PREMIUM) ? '1' : ''),''), '$lbl_about' => t('Please enter your restrictions or conditions, such as paypal receipt, usage guidelines, etc.'), '$text' => $text, '$desc' => t('This channel may require additional steps or acknowledgement of the following conditions prior to connecting:'), @@ -102,7 +102,7 @@ function connect_content(&$a) { $submit = replace_macros(get_markup_template('sellpage_submit.tpl'), array( '$continue' => t('Continue'), - '$address' => $a->data['channel']['channel_address'] + '$address' => App::$data['channel']['channel_address'] )); $o = replace_macros(get_markup_template('sellpage_view.tpl'),array( @@ -115,7 +115,7 @@ function connect_content(&$a) { )); - $arr = array('channel' => $a->data['channel'],'observer' => $a->get_observer(), 'sellpage' => $o, 'submit' => $submit); + $arr = array('channel' => App::$data['channel'],'observer' => App::get_observer(), 'sellpage' => $o, 'submit' => $submit); call_hooks('connect_premium', $arr); $o = $arr['sellpage']; diff --git a/mod/connections.php b/mod/connections.php index 1de8279c4..992d485bd 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -13,7 +13,7 @@ function connections_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); @@ -40,7 +40,7 @@ function connections_content(&$a) { $all = false; if(! $_REQUEST['aj']) - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $search_flags = ''; $head = ''; @@ -82,14 +82,14 @@ function connections_content(&$a) { $head = t('New'); $pending = true; nav_set_selected('intros'); - $a->argv[1] = 'pending'; + App::$argv[1] = 'pending'; } else { $head = t('All'); $search_flags = ''; $all = true; - $a->argc = 1; - unset($a->argv[1]); + App::$argc = 1; + unset(App::$argv[1]); } nav_set_selected('intros'); break; @@ -211,15 +211,15 @@ function connections_content(&$a) { intval(local_channel()) ); if($r) { - $a->set_pager_total($r[0]['total']); + App::set_pager_total($r[0]['total']); $total = $r[0]['total']; } $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash WHERE abook_channel = %d and abook_self = 0 and xchan_deleted = 0 and xchan_orphan = 0 $sql_extra $sql_extra2 ORDER BY xchan_name LIMIT %d OFFSET %d ", intval(local_channel()), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); $contacts = array(); @@ -304,7 +304,7 @@ function connections_content(&$a) { '$finding' => (($searching) ? t('Connections search') . ": '" . $search . "'" : ""), '$submit' => t('Find'), '$edit' => t('Edit'), - '$cmd' => $a->cmd, + '$cmd' => App::$cmd, '$contacts' => $contacts, '$paginate' => paginate($a), diff --git a/mod/connedit.php b/mod/connedit.php index 5d087a3b1..f57fdefc6 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -32,11 +32,11 @@ function connedit_init(&$a) { intval(argv(1)) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); @@ -55,7 +55,7 @@ function connedit_post(&$a) { if(! $contact_id) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); // TODO if configured for hassle-free permissions, we'll post the form with ajax as soon as the // connection enable is toggled to a special autopost url and set permissions immediately, leaving @@ -224,8 +224,8 @@ function connedit_post(&$a) { else notice( t('Failed to update connection record.') . EOL); - if($a->poi && $a->poi['abook_my_perms'] != $abook_my_perms - && (! intval($a->poi['abook_self']))) { + if(App::$poi && App::$poi['abook_my_perms'] != $abook_my_perms + && (! intval(App::$poi['abook_self']))) { proc_run('php', 'include/notifier.php', (($new_friend) ? 'permission_create' : 'permission_update'), $contact_id); } @@ -235,7 +235,7 @@ function connedit_post(&$a) { require_once('include/group.php'); $g = group_rec_byhash(local_channel(),$default_group); if($g) - group_add_member(local_channel(),'',$a->poi['abook_xchan'],$g['id']); + group_add_member(local_channel(),'',App::$poi['abook_xchan'],$g['id']); } // Check if settings permit ("post new friend activity" is allowed, and @@ -259,19 +259,19 @@ function connedit_post(&$a) { $xarr['item_private'] = (($xarr['allow_cid']||$xarr['allow_gid']||$xarr['deny_cid']||$xarr['deny_gid']) ? 1 : 0); $obj = array( 'type' => ACTIVITY_OBJ_PERSON, - 'title' => $a->poi['xchan_name'], - 'id' => $a->poi['xchan_hash'], + 'title' => App::$poi['xchan_name'], + 'id' => App::$poi['xchan_hash'], 'link' => array( - array('rel' => 'alternate', 'type' => 'text/html', 'href' => $a->poi['xchan_url']), - array('rel' => 'photo', 'type' => $a->poi['xchan_photo_mimetype'], 'href' => $a->poi['xchan_photo_l']) + array('rel' => 'alternate', 'type' => 'text/html', 'href' => App::$poi['xchan_url']), + array('rel' => 'photo', 'type' => App::$poi['xchan_photo_mimetype'], 'href' => App::$poi['xchan_photo_l']) ), ); $xarr['object'] = json_encode($obj); $xarr['obj_type'] = ACTIVITY_OBJ_PERSON; - $xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . $a->poi['xchan_url'] . ']' . $a->poi['xchan_name'] . '[/zrl]'; + $xarr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . t('is now connected to') . ' ' . '[zrl=' . App::$poi['xchan_url'] . ']' . App::$poi['xchan_name'] . '[/zrl]'; - $xarr['body'] .= "\n\n\n" . '[zrl=' . $a->poi['xchan_url'] . '][zmg=80x80]' . $a->poi['xchan_photo_m'] . '[/zmg][/zrl]'; + $xarr['body'] .= "\n\n\n" . '[zrl=' . App::$poi['xchan_url'] . '][zmg=80x80]' . App::$poi['xchan_photo_m'] . '[/zmg][/zrl]'; post_activity_item($xarr); @@ -292,11 +292,11 @@ function connedit_post(&$a) { intval($contact_id) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } if($new_friend) { - $arr = array('channel_id' => local_channel(), 'abook' => $a->poi); + $arr = array('channel_id' => local_channel(), 'abook' => App::$poi); call_hooks('accept_follow', $arr); } @@ -319,23 +319,23 @@ function connedit_post(&$a) { function connedit_clone(&$a) { - if(! $a->poi) + if(! App::$poi) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_id = %d LIMIT 1", intval(local_channel()), - intval($a->poi['abook_id']) + intval(App::$poi['abook_id']) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } - $clone = $a->poi; + $clone = App::$poi; unset($clone['abook_id']); unset($clone['abook_account']); @@ -363,7 +363,7 @@ function connedit_content(&$a) { return login(); } - $channel = $a->get_channel(); + $channel = App::get_channel(); $my_perms = get_channel_default_perms(local_channel()); $role = get_pconfig(local_channel(),'system','permissions_role'); if($role) { @@ -417,7 +417,7 @@ function connedit_content(&$a) { if($cmd === 'refresh') { if($orig_record[0]['xchan_network'] === 'zot') { - if(! zot_refresh($orig_record[0],get_app()->get_channel())) + if(! zot_refresh($orig_record[0],App::get_channel())) notice( t('Refresh failed - channel is currently unavailable.') ); } else { @@ -505,10 +505,10 @@ function connedit_content(&$a) { } } - if($a->poi) { + if(App::$poi) { - $contact_id = $a->poi['abook_id']; - $contact = $a->poi; + $contact_id = App::$poi['abook_id']; + $contact = App::$poi; $buttons = array( @@ -645,7 +645,7 @@ function connedit_content(&$a) { $perms = array(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $global_perms = get_perms(); $existing = get_all_perms(local_channel(),$contact['abook_xchan']); diff --git a/mod/cover_photo.php b/mod/cover_photo.php index 9e7136c14..c99fdf7de 100644 --- a/mod/cover_photo.php +++ b/mod/cover_photo.php @@ -24,7 +24,7 @@ function cover_photo_init(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); profile_load($a,$channel['channel_address']); } @@ -42,7 +42,7 @@ function cover_photo_post(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); check_form_security_token_redirectOnErr('/cover_photo', 'cover_photo'); @@ -155,7 +155,7 @@ function cover_photo_post(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); send_cover_photo_activity($channel,$base_image,$profile); @@ -174,7 +174,7 @@ function cover_photo_post(&$a) { require_once('include/attach.php'); - $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash)); + $res = attach_store(App::get_channel(), get_observer_hash(), '', array('album' => t('Cover Photos'), 'hash' => $hash)); logger('attach_store: ' . print_r($res,true)); @@ -274,7 +274,7 @@ function cover_photo_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $newuser = false; @@ -341,12 +341,12 @@ function cover_photo_content(&$a) { } - if(! x($a->data,'imagecrop')) { + if(! x(App::$data,'imagecrop')) { $tpl = get_markup_template('cover_photo.tpl'); $o .= replace_macros($tpl,array( - '$user' => $a->channel['channel_address'], + '$user' => App::$channel['channel_address'], '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), '$title' => t('Upload Cover Photo'), @@ -354,7 +354,7 @@ function cover_photo_content(&$a) { '$profiles' => $profiles, '$form_security_token' => get_form_security_token("cover_photo"), // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') + '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') )); call_hooks('cover_photo_content_end', $o); @@ -362,13 +362,13 @@ function cover_photo_content(&$a) { return $o; } else { - $filename = $a->data['imagecrop'] . '-3'; + $filename = App::$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', + '$resource' => App::$data['imagecrop'] . '-3', '$image_url' => z_root() . '/photo/' . $filename, '$title' => t('Crop Image'), '$desc' => t('Please adjust the image cropping for optimum viewing.'), @@ -409,9 +409,9 @@ function cover_photo_crop_ui_head(&$a, $ph, $hash, $smallest){ } - $a->data['imagecrop'] = $hash; - $a->data['imagecrop_resolution'] = $smallest; - $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); + App::$data['imagecrop'] = $hash; + App::$data['imagecrop_resolution'] = $smallest; + App::$page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); return; } diff --git a/mod/dav.php b/mod/dav.php index b745dbb5c..e2a857dca 100644 --- a/mod/dav.php +++ b/mod/dav.php @@ -49,7 +49,7 @@ function dav_init(&$a) { $profile = 0; - $a->page['htmlhead'] .= '' . "\r\n"; + App::$page['htmlhead'] .= '' . "\r\n"; if ($which) profile_load($a, $which, $profile); @@ -60,7 +60,7 @@ function dav_init(&$a) { if ($ob_hash) { if (local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $auth->setCurrentUser($channel['channel_address']); $auth->channel_id = $channel['channel_id']; $auth->channel_hash = $channel['channel_hash']; @@ -107,7 +107,7 @@ function dav_init(&$a) { if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) { try { - $x = RedFileData('/' . $a->cmd, $auth); + $x = RedFileData('/' . App::$cmd, $auth); if($x instanceof Zotlabs\Storage\File) $isapublic_file = true; } diff --git a/mod/directory.php b/mod/directory.php index fe5799c88..79c03777e 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -6,7 +6,7 @@ require_once('include/widgets.php'); require_once('include/bbcode.php'); function directory_init(&$a) { - $a->set_pager_itemspage(60); + App::set_pager_itemspage(60); if(x($_GET,'ignore')) { q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ", @@ -158,7 +158,7 @@ function directory_content(&$a) { $query .= '&t=' . $token; if(! $globaldir) - $query .= '&hub=' . get_app()->get_hostname(); + $query .= '&hub=' . App::get_hostname(); if($search) $query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search); @@ -180,8 +180,8 @@ function directory_content(&$a) { if($sort_order) $query .= '&order=' . urlencode($sort_order); - if($a->pager['page'] != 1) - $query .= '&p=' . $a->pager['page']; + if(App::$pager['page'] != 1) + $query .= '&p=' . App::$pager['page']; logger('mod_directory: query: ' . $query); @@ -355,7 +355,7 @@ function directory_content(&$a) { ksort($entries); // Sort array by key so that foreach-constructs work as expected if($j['keywords']) { - $a->data['directory_keywords'] = $j['keywords']; + App::$data['directory_keywords'] = $j['keywords']; } logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA); @@ -406,7 +406,7 @@ function directory_content(&$a) { echo $o; killme(); } - if($a->pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) { + if(App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) { goaway(z_root() . '/chanview/?f=&address=' . $search); } info( t("No entries (some entries may be hidden).") . EOL); diff --git a/mod/dirsearch.php b/mod/dirsearch.php index bc2fa108f..1273c5ccd 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -4,7 +4,7 @@ require_once('include/dir_fns.php'); function dirsearch_init(&$a) { - $a->set_pager_itemspage(60); + App::set_pager_itemspage(60); } @@ -166,7 +166,7 @@ function dirsearch_content(&$a) { $logic = 'true'; if($dirmode == DIRECTORY_MODE_STANDALONE) { - $sql_extra .= " and xchan_addr like '%%" . get_app()->get_hostname() . "' "; + $sql_extra .= " and xchan_addr like '%%" . App::get_hostname() . "' "; } $safesql = (($safe > 0) ? " and xchan_censored = 0 and xchan_selfcensored = 0 " : ''); diff --git a/mod/display.php b/mod/display.php index 40427846b..e4a6a0e66 100644 --- a/mod/display.php +++ b/mod/display.php @@ -21,7 +21,7 @@ function display_content(&$a, $update = 0, $load = false) { require_once('include/items.php'); - $a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), array()); + App::$page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), array()); if(argc() > 1 && argv(1) !== 'load') $item_hash = argv(1); @@ -32,7 +32,7 @@ function display_content(&$a, $update = 0, $load = false) { if(! $item_hash) { - $a->error = 404; + App::$error = 404; notice( t('Item not found.') . EOL); return; } @@ -42,7 +42,7 @@ function display_content(&$a, $update = 0, $load = false) { if(local_channel() && (! $update)) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $channel_acl = array( @@ -127,9 +127,9 @@ function display_content(&$a, $update = 0, $load = false) { $o .= '
    ' . "\r\n"; $o .= "\r\n"; + . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; \r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'display', '$uid' => '0', @@ -144,7 +144,7 @@ function display_content(&$a, $update = 0, $load = false) { '$fh' => '0', '$nouveau' => '0', '$wall' => '0', - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), '$search' => '', '$order' => '', @@ -169,7 +169,7 @@ function display_content(&$a, $update = 0, $load = false) { $updateable = false; - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']),intval($a->pager['start'])); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']),intval(App::$pager['start'])); if($load || ($_COOKIE['jsAvailable'] != 1)) { $r = null; @@ -292,7 +292,7 @@ function display_content(&$a, $update = 0, $load = false) { } else { $o .= conversation($a, $items, 'display', $update, 'traditional'); if ($items[0]['title']) - $a->page['title'] = $items[0]['title'] . " - " . $a->page['title']; + App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; } diff --git a/mod/dreport.php b/mod/dreport.php index 1ad1eca7c..4edec2e2b 100644 --- a/mod/dreport.php +++ b/mod/dreport.php @@ -9,7 +9,7 @@ function dreport_content(&$a) { $table = 'item'; - $channel = $a->get_channel(); + $channel = App::get_channel(); $mid = ((argc() > 1) ? argv(1) : ''); diff --git a/mod/editblock.php b/mod/editblock.php index a49beca3d..35922e483 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -8,7 +8,7 @@ function editblock_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -25,9 +25,9 @@ function editblock_init(&$a) { function editblock_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -36,11 +36,11 @@ function editblock_content(&$a) { $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -108,7 +108,7 @@ function editblock_content(&$a) { else $mimeselect = mimetype_select($itm[0]['uid'],$mimetype); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', diff --git a/mod/editlayout.php b/mod/editlayout.php index 2c77a2381..9c27afa30 100644 --- a/mod/editlayout.php +++ b/mod/editlayout.php @@ -8,7 +8,7 @@ function editlayout_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -23,9 +23,9 @@ function editlayout_init(&$a) { function editlayout_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -34,11 +34,11 @@ function editlayout_content(&$a) { $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -102,7 +102,7 @@ function editlayout_content(&$a) { $plaintext = true; - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', @@ -167,7 +167,7 @@ function editlayout_content(&$a) { '$bang' => '', '$profile_uid' => (intval($owner)), '$jotplugins' => $jotplugins, - '$sourceapp' => t($a->sourcename), + '$sourceapp' => t(App::$sourcename), '$defexpire' => '', '$feature_expire' => false, '$expires' => t('Set expiration date'), diff --git a/mod/editpost.php b/mod/editpost.php index 7555ef37c..dffc9c0da 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -44,9 +44,9 @@ function editpost_content(&$a) { // if(feature_enabled(local_channel(),'richtext')) // $plaintext = false; - $channel = $a->get_channel(); + $channel = App::get_channel(); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', @@ -101,7 +101,7 @@ function editpost_content(&$a) { } } - $cipher = get_pconfig(get_app()->profile['profile_uid'],'system','default_cipher'); + $cipher = get_pconfig(App::$profile['profile_uid'],'system','default_cipher'); if(! $cipher) $cipher = 'aes256'; @@ -148,12 +148,12 @@ function editpost_content(&$a) { '$profile_uid' => $owner_uid, '$preview' => t('Preview'), '$jotplugins' => $jotplugins, - '$sourceapp' => t($a->sourcename), + '$sourceapp' => t(App::$sourcename), '$catsenabled' => $catsenabled, '$defexpire' => datetime_convert('UTC', date_default_timezone_get(),$itm[0]['expires']), - '$feature_expire' => ((feature_enabled(get_app()->profile['profile_uid'],'content_expire') && (! $webpage)) ? true : false), + '$feature_expire' => ((feature_enabled(App::$profile['profile_uid'],'content_expire') && (! $webpage)) ? true : false), '$expires' => t('Set expiration date'), - '$feature_encrypt' => ((feature_enabled(get_app()->profile['profile_uid'],'content_encrypt') && (! $webpage)) ? true : false), + '$feature_encrypt' => ((feature_enabled(App::$profile['profile_uid'],'content_encrypt') && (! $webpage)) ? true : false), '$encrypt' => t('Encrypt text'), '$cipher' => $cipher, '$expiryModalOK' => t('OK'), diff --git a/mod/editwebpage.php b/mod/editwebpage.php index f6cf22390..445c31ad4 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -8,7 +8,7 @@ function editwebpage_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -24,9 +24,9 @@ function editwebpage_init(&$a) { function editwebpage_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } @@ -35,11 +35,11 @@ function editwebpage_content(&$a) { $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -143,7 +143,7 @@ function editwebpage_content(&$a) { else $layoutselect = layout_select($itm[0]['uid'],$itm[0]['layout_mid']); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), '$pretext' => '', @@ -211,7 +211,7 @@ function editwebpage_content(&$a) { '$profile_uid' => (intval($owner)), '$preview' => t('Preview'), '$jotplugins' => $jotplugins, - '$sourceapp' => $a->sourcename, + '$sourceapp' => App::$sourcename, '$defexpire' => '', '$feature_expire' => false, '$expires' => t('Set expiration date'), diff --git a/mod/events.php b/mod/events.php index 30c083e4f..30cf5f303 100755 --- a/mod/events.php +++ b/mod/events.php @@ -116,7 +116,7 @@ function events_post(&$a) { $share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0); - $channel = $a->get_channel(); + $channel = App::get_channel(); $acl = new Zotlabs\Access\AccessList(false); @@ -158,7 +158,7 @@ function events_post(&$a) { } $post_tags = array(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $ac = $acl->get(); if(strlen($categories)) { @@ -281,17 +281,17 @@ function events_content(&$a) { $first_day = (($first_day) ? $first_day : 0); $htpl = get_markup_template('event_head.tpl'); - $a->page['htmlhead'] .= replace_macros($htpl,array( + App::$page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => z_root(), '$module_url' => '/events', '$modparams' => 1, - '$lang' => $a->language, + '$lang' => App::$language, '$first_day' => $first_day )); $o = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); $mode = 'view'; $y = 0; @@ -299,7 +299,7 @@ function events_content(&$a) { $ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : ''); - // logger('args: ' . print_r($a->argv,true)); + // logger('args: ' . print_r(App::$argv,true)); @@ -340,7 +340,7 @@ function events_content(&$a) { $orig_event = $r[0]; } - $channel = $a->get_channel(); + $channel = App::get_channel(); // Passed parameters overrides anything found in the DB if(!x($orig_event)) @@ -571,7 +571,7 @@ function events_content(&$a) { foreach($r as $rr) { $j = (($rr['adjust']) ? datetime_convert('UTC',date_default_timezone_get(),$rr['start'], 'j') : datetime_convert('UTC','UTC',$rr['start'],'j')); if(! x($links,$j)) - $links[$j] = z_root() . '/' . $a->cmd . '#link-' . $j; + $links[$j] = z_root() . '/' . App::$cmd . '#link-' . $j; } } @@ -641,7 +641,7 @@ function events_content(&$a) { killme(); } - if ($a->argv[1] === 'json'){ + if (App::$argv[1] === 'json'){ echo json_encode($events); killme(); } diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 6ce1292c8..96e0fe953 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -15,19 +15,19 @@ function fbrowser_content($a){ if (!local_channel()) killme(); - if ($a->argc==1) + if (App::$argc==1) killme(); - //echo "
    "; var_dump($a->argv); killme();	
    +	//echo "
    "; var_dump(App::$argv); killme();	
     	
    -	switch($a->argv[1]){
    +	switch(App::$argv[1]){
     		case "image":
     			$path = array( array(z_root()."/fbrowser/image/", t("Photos")));
     			$albums = false;
     			$sql_extra = "";
     			$sql_extra2 = " ORDER BY created DESC LIMIT 0, 10";
     			
    -			if ($a->argc==2){
    +			if (App::$argc==2){
     				$albums = q("SELECT distinct(`album`) AS `album` FROM `photo` WHERE `uid` = %d ",
     					intval(local_channel())
     				);
    @@ -38,11 +38,11 @@ function fbrowser_content($a){
     			}
     			
     			$album = "";
    -			if ($a->argc==3){
    -				$album = hex2bin($a->argv[2]);
    +			if (App::$argc==3){
    +				$album = hex2bin(App::$argv[2]);
     				$sql_extra = sprintf("AND `album` = '%s' ",dbesc($album));
     				$sql_extra2 = "";
    -				$path[]=array(z_root()."/fbrowser/image/".$a->argv[2]."/", $album);
    +				$path[]=array(z_root()."/fbrowser/image/".App::$argv[2]."/", $album);
     			}
     				
     			$r = q("SELECT `resource_id`, `id`, `filename`, type, min(`scale`) AS `hiq`,max(`scale`) AS `loq`, `description`  
    @@ -80,7 +80,7 @@ function fbrowser_content($a){
     				
     			break;
     		case "file":
    -			if ($a->argc==2){
    +			if (App::$argc==2){
     				$files = q("SELECT id, filename, filetype FROM `attach` WHERE `uid` = %d ",
     					intval(local_channel())
     				);
    @@ -89,7 +89,7 @@ function fbrowser_content($a){
     					list($m1,$m2) = explode("/",$rr['filetype']);
     					$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
     
    -					if($a->get_template_engine() === 'internal') {
    +					if(App::get_template_engine() === 'internal') {
     						$filename_e = template_escape($rr['filename']);
     					}
     					else {
    diff --git a/mod/fhublocs.php b/mod/fhublocs.php
    index dce00e383..7eab2b811 100644
    --- a/mod/fhublocs.php
    +++ b/mod/fhublocs.php
    @@ -38,7 +38,7 @@ function fhublocs_content(&$a) {
     			if($y)
     				$primary_address = $y[0]['xchan_addr'];
     
    -			$hub_address = $rr['channel']['channel_address'] . '@' . get_app()->get_hostname();
    +			$hub_address = $rr['channel']['channel_address'] . '@' . App::get_hostname();
     
     		
     			$primary = (($hub_address === $primary_address) ? 1 : 0);
    @@ -57,11 +57,11 @@ function fhublocs_content(&$a) {
     				dbesc($rr['channel_guid']),
     				dbesc($rr['channel_guid_sig']),
     				dbesc($rr['channel_hash']),
    -				dbesc($rr['channel_address'] . '@' . get_app()->get_hostname()),
    +				dbesc($rr['channel_address'] . '@' . App::get_hostname()),
     				intval($primary),
     				dbesc(z_root()),
     				dbesc(base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey']))),
    -				dbesc(get_app()->get_hostname()),
    +				dbesc(App::get_hostname()),
     				dbesc(z_root() . '/post'),
     				dbesc($sitekey),
     				dbesc('zot')
    diff --git a/mod/filer.php b/mod/filer.php
    index 8d69503b2..b09c73f0a 100644
    --- a/mod/filer.php
    +++ b/mod/filer.php
    @@ -12,7 +12,7 @@ function filer_content(&$a) {
     	}
     
     	$term = unxmlify(trim($_GET['term']));
    -	$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
    +	$item_id = ((App::$argc > 1) ? intval(App::$argv[1]) : 0);
     
     	logger('filer: tag ' . $term . ' item ' . $item_id);
     
    diff --git a/mod/filerm.php b/mod/filerm.php
    index 6a6c4ff15..82eed83f8 100644
    --- a/mod/filerm.php
    +++ b/mod/filerm.php
    @@ -13,7 +13,7 @@ function filerm_content(&$a) {
     	if($category)
     		$term = $cat;
     
    -	$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
    +	$item_id = ((App::$argc > 1) ? intval(App::$argv[1]) : 0);
     
     	logger('filerm: tag ' . $term . ' item ' . $item_id);
     
    diff --git a/mod/filestorage.php b/mod/filestorage.php
    index 753300e89..1feffa9ee 100644
    --- a/mod/filestorage.php
    +++ b/mod/filestorage.php
    @@ -28,7 +28,7 @@ function filestorage_post(&$a) {
     		return;
     	}
     
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     
     	$acl = new Zotlabs\Access\AccessList($channel);
     	$acl->set_from_array($_REQUEST);
    @@ -52,7 +52,7 @@ function filestorage_content(&$a) {
     		$which = argv(1);
     	else {
     		notice( t('Requested profile is not available.') . EOL );
    -		$a->error = 404;
    +		App::$error = 404;
     		return;
     	}
     
    @@ -64,7 +64,7 @@ function filestorage_content(&$a) {
     		$owner = intval($r[0]['channel_id']);
     	}
     
    -	$observer = $a->get_observer();
    +	$observer = App::get_observer();
     	$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
     
     	$perms = get_all_perms($owner, $ob_hash);
    @@ -100,7 +100,7 @@ function filestorage_content(&$a) {
     		}
     
     		$f = $r[0];
    -		$channel = $a->get_channel();
    +		$channel = App::get_channel();
     
     		$parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']);
     
    @@ -123,7 +123,7 @@ function filestorage_content(&$a) {
     		);
     
     		$f = $r[0];
    -		$channel = $a->get_channel();
    +		$channel = App::get_channel();
     
     		$cloudpath = get_cloudpath($f) . (intval($f['is_dir']) ? '?f=&davguest=1' : '');
     		$parentpath = get_parent_cloudpath($channel['channel_id'], $channel['channel_address'], $f['hash']);
    diff --git a/mod/follow.php b/mod/follow.php
    index 73e87c16f..207a99dd7 100644
    --- a/mod/follow.php
    +++ b/mod/follow.php
    @@ -14,7 +14,7 @@ function follow_init(&$a) {
     	$return_url = $_SESSION['return_url'];
     	$confirm = intval($_REQUEST['confirm']);
     
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     
     	$result = new_contact($uid,$url,$channel,true,$confirm);
     	
    diff --git a/mod/fsuggest.php b/mod/fsuggest.php
    index ec87af6ae..261679e6b 100644
    --- a/mod/fsuggest.php
    +++ b/mod/fsuggest.php
    @@ -7,10 +7,10 @@ function fsuggest_post(&$a) {
     		return;
     	}
     
    -	if($a->argc != 2)
    +	if(App::$argc != 2)
     		return;
     
    -	$contact_id = intval($a->argv[1]);
    +	$contact_id = intval(App::$argv[1]);
     
     	$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
     		intval($contact_id),
    @@ -79,10 +79,10 @@ function fsuggest_content(&$a) {
     		return;
     	}
     
    -	if($a->argc != 2)
    +	if(App::$argc != 2)
     		return;
     
    -	$contact_id = intval($a->argv[1]);
    +	$contact_id = intval(App::$argv[1]);
     
     	$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
     		intval($contact_id),
    diff --git a/mod/group.php b/mod/group.php
    index defac572a..d5f2129bd 100644
    --- a/mod/group.php
    +++ b/mod/group.php
    @@ -62,7 +62,7 @@ function group_post(&$a) {
     function group_content(&$a) {
     	$change = false;
     
    -	logger('mod_group: ' . $a->cmd,LOGGER_DEBUG);
    +	logger('mod_group: ' . App::$cmd,LOGGER_DEBUG);
     	
     	if(! local_channel()) {
     		notice( t('Permission denied') . EOL);
    diff --git a/mod/hcard.php b/mod/hcard.php
    index 8339fd013..9954e0838 100644
    --- a/mod/hcard.php
    +++ b/mod/hcard.php
    @@ -6,12 +6,12 @@ function hcard_init(&$a) {
             $which = argv(1);
         else {
             notice( t('Requested profile is not available.') . EOL );
    -        $a->error = 404;
    +        App::$error = 404;
             return;
         }
     
         $profile = '';
    -    $channel = $a->get_channel();
    +    $channel = App::get_channel();
     
         if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) {
             $which = $channel['channel_address'];
    @@ -25,14 +25,14 @@ function hcard_init(&$a) {
             $profile = $r[0]['profile_guid'];
         }
     
    -    $a->page['htmlhead'] .= '' . "\r\n" ;
    +    App::$page['htmlhead'] .= '' . "\r\n" ;
     
         if(! $profile) {
             $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1",
                 dbesc(argv(1))
             );
             if($x) {
    -            $a->profile = $x[0];
    +            App::$profile = $x[0];
             }
         }
     
    diff --git a/mod/help.php b/mod/help.php
    index 19bf251bd..a266dbf7f 100644
    --- a/mod/help.php
    +++ b/mod/help.php
    @@ -13,7 +13,7 @@
     
     
     function load_doc_file($s) {
    -	$lang = get_app()->language;
    +	$lang = App::$language;
     	if(! isset($lang))
     		$lang = 'en';
     	$b = basename($s);
    @@ -39,8 +39,8 @@ function search_doc_files($s) {
     	$a = get_app();
     
     	$itemspage = get_pconfig(local_channel(),'system','itemspage');
    -	$a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
    -	$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start']));
    +	App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
    +	$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
     
     	$regexop = db_getfunc('REGEXP');
     
    @@ -68,7 +68,7 @@ function search_doc_files($s) {
     			$r[$x]['rank'] ++;
     		$r[$x]['rank'] += substr_count(strtolower($r[$x]['text']),strtolower($s));
     		// bias the results to the observer's native language
    -		if($r[$x]['lang'] === $a->language)
    +		if($r[$x]['lang'] === App::$language)
     			$r[$x]['rank'] = $r[$x]['rank'] + 10;
     
     	}
    @@ -187,30 +187,30 @@ function help_content(&$a) {
     		$title = basename($path);
     
     		$text = load_doc_file('doc/' . $path . '.md');
    -		$a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
    +		App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
     
     		if(! $text) {
     			$text = load_doc_file('doc/' . $path . '.bb');
     			if($text)
     				$doctype = 'bbcode';
    -			$a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags($title)));
    +			App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('_',' ',notags($title)));
     		}
     		if(! $text) {
     			$text = load_doc_file('doc/' . $path . '.html');
     			if($text)
     				$doctype = 'html';
    -			$a->page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
    +			App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
     		}
     	}
     
     	if(! $text) {
     		$text = load_doc_file('doc/Site.md');
    -		$a->page['title'] = t('Help');
    +		App::$page['title'] = t('Help');
     	}
     	if(! $text) {
     		$doctype = 'bbcode';
     		$text = load_doc_file('doc/main.bb');
    -		$a->page['title'] = t('Help');
    +		App::$page['title'] = t('Help');
     	}
     	
     	if(! strlen($text)) {
    diff --git a/mod/home.php b/mod/home.php
    index bfac17eab..478c764ea 100644
    --- a/mod/home.php
    +++ b/mod/home.php
    @@ -12,7 +12,7 @@ function home_init(&$a) {
     
     	$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
     
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     	if(local_channel() && $channel && $channel['xchan_url'] && ! $splash) {
     		$dest = $channel['channel_startpage'];
     		if(! $dest)
    @@ -53,8 +53,8 @@ function home_content(&$a, $update = 0, $load = false) {
     		if(strpos($frontpage,'include:') !== false) {
     			$file = trim(str_replace('include:' , '', $frontpage));
     			if(file_exists($file)) {
    -				$a->page['template'] = 'full';
    -				$a->page['title'] = t('$Projectname');
    +				App::$page['template'] = 'full';
    +				App::$page['title'] = t('$Projectname');
     				$o .= file_get_contents($file);
     				return $o;
     			}
    @@ -76,7 +76,7 @@ function home_content(&$a, $update = 0, $load = false) {
     
     	$loginbox = get_config('system','login_on_homepage');
     	if(intval($loginbox) || $loginbox === false)
    -		$o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
    +		$o .= login((App::$config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
     
     	return $o;
     
    diff --git a/mod/hostxrd.php b/mod/hostxrd.php
    index 18066b7bf..0e19d8af6 100644
    --- a/mod/hostxrd.php
    +++ b/mod/hostxrd.php
    @@ -7,7 +7,7 @@ function hostxrd_init(&$a) {
     
     	$tpl = get_markup_template('xrd_host.tpl');
     	$x = replace_macros(get_markup_template('xrd_host.tpl'), array(
    -		'$zhost' => $a->get_hostname(),
    +		'$zhost' => App::get_hostname(),
     		'$zroot' => z_root()
     	));
     	$arr = array('xrd' => $x);
    diff --git a/mod/id.php b/mod/id.php
    index bd4c1fa89..382df45d8 100644
    --- a/mod/id.php
    +++ b/mod/id.php
    @@ -46,12 +46,12 @@ function id_init(&$a) {
     	if(argc() > 1) {
     		$which = argv(1);
     	} else {
    -		$a->error = 404;
    +		App::$error = 404;
     		return;
     	}
     
     	$profile = '';
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     	profile_load($a,$which,$profile);
     
     	$op = new MysqlProvider;
    @@ -69,7 +69,7 @@ function id_init(&$a) {
     function getUserData($handle = null) {
     	if (! local_channel()) {
     		notice( t('Permission denied.') . EOL);
    -		get_app()->page['content'] =  login();
    +		App::$page['content'] =  login();
     
     		return false;
     	}
    @@ -235,7 +235,7 @@ class MysqlProvider extends LightOpenIDProvider {
                . ' '
                . '';
     
    -		get_app()->page['content'] .= $o;
    +		App::$page['content'] .= $o;
     	}
     
     	function checkid($realm, &$attributes) {
    @@ -279,7 +279,7 @@ class MysqlProvider extends LightOpenIDProvider {
     
     	function assoc_handle() {
     		logger('assoc_handle');
    -		$channel = get_app()->get_channel();
    +		$channel = App::get_channel();
     
     		return z_root() . '/channel/' . $channel['channel_address']; 
     	}
    diff --git a/mod/impel.php b/mod/impel.php
    index da7138438..a0cb1d949 100644
    --- a/mod/impel.php
    +++ b/mod/impel.php
    @@ -22,7 +22,7 @@ function impel_init(&$a) {
     	if(! $j)
     		json_return_and_die($ret);
     
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     
     	$arr = array();
     	$is_menu = false;
    diff --git a/mod/import.php b/mod/import.php
    index 0e41d41f3..e0c2ffa82 100644
    --- a/mod/import.php
    +++ b/mod/import.php
    @@ -149,7 +149,7 @@ function import_account(&$a, $account_id) {
     	}
     
     	if(! $channel)
    -		$channel = $a->get_channel();
    +		$channel = App::get_channel();
     	
     	if(! $channel) {
     		logger('mod_import: channel not found. ', print_r($channel,true));
    @@ -205,12 +205,12 @@ function import_account(&$a, $account_id) {
     			dbesc($channel['channel_guid']),
     			dbesc($channel['channel_guid_sig']),
     			dbesc($channel['channel_hash']),
    -			dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()),
    +			dbesc($channel['channel_address'] . '@' . App::get_hostname()),
     			dbesc('zot'),
     			intval(($seize) ? 1 : 0),
     			dbesc(z_root()),
     			dbesc(base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey']))),
    -			dbesc(get_app()->get_hostname()),
    +			dbesc(App::get_hostname()),
     			dbesc(z_root() . '/post'),
     			dbesc(get_config('system','pubkey'))
     		);
    @@ -249,7 +249,7 @@ function import_account(&$a, $account_id) {
     				dbesc(z_root() . "/photo/profile/l/" . $channel['channel_id']),
     				dbesc(z_root() . "/photo/profile/m/" . $channel['channel_id']),
     				dbesc(z_root() . "/photo/profile/s/" . $channel['channel_id']),
    -				dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()),
    +				dbesc($channel['channel_address'] . '@' . App::get_hostname()),
     				dbesc(z_root() . '/channel/' . $channel['channel_address']),
     				dbesc(z_root() . '/follow?f=&url=%s'),
     				dbesc(z_root() . '/poco/' . $channel['channel_address']),
    diff --git a/mod/import_items.php b/mod/import_items.php
    index f369ad780..df3afb3ea 100644
    --- a/mod/import_items.php
    +++ b/mod/import_items.php
    @@ -84,7 +84,7 @@ function import_items_post(&$a) {
     		}
     	}
     
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     
     
     	if(array_key_exists('item',$data) && $data['item']) {
    diff --git a/mod/invite.php b/mod/invite.php
    index 7f4df6cc8..2adad8257 100644
    --- a/mod/invite.php
    +++ b/mod/invite.php
    @@ -53,10 +53,10 @@ function invite_post(&$a) {
     		else
     			$nmessage = $message;
     
    -		$account = $a->get_account();
    +		$account = App::get_account();
     
     
    -		$res = mail($recip, sprintf( t('Please join us on $Projectname'), $a->config['sitename']),
    +		$res = mail($recip, sprintf( t('Please join us on $Projectname'), App::$config['sitename']),
     			$nmessage,
     			"From: " . $account['account_email'] . "\n"
     			. 'Content-type: text/plain; charset=UTF-8' . "\n"
    @@ -118,11 +118,11 @@ function invite_content(&$a) {
     			}
     		}
     
    -	$ob = $a->get_observer();
    +	$ob = App::get_observer();
     	if(! $ob)
     		return $o;
     
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     
     	$o = replace_macros($tpl, array(
     		'$form_security_token' => get_form_security_token("send_invite"),
    diff --git a/mod/item.php b/mod/item.php
    index b84a7ff8d..6e7c77a4d 100644
    --- a/mod/item.php
    +++ b/mod/item.php
    @@ -192,7 +192,7 @@ function item_post(&$a) {
     	}
     
     	if(! $observer)
    -		$observer = $a->get_observer();
    +		$observer = App::get_observer();
     
     	if($parent) {
     		logger('mod_item: item_post parent=' . $parent);
    @@ -251,7 +251,7 @@ function item_post(&$a) {
     
     	if(! $channel) {
     		if($uid && $uid == $profile_uid) {
    -			$channel = $a->get_channel();
    +			$channel = App::get_channel();
     		}
     		else {
     			// posting as yourself but not necessarily to a channel you control
    diff --git a/mod/layouts.php b/mod/layouts.php
    index fd77cfc37..dbb005e08 100644
    --- a/mod/layouts.php
    +++ b/mod/layouts.php
    @@ -9,7 +9,7 @@ function layouts_init(&$a) {
     	if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
     		$sys = get_sys_channel();
     		if($sys && intval($sys['channel_id'])) {
    -			$a->is_sys = true;
    +			App::$is_sys = true;
     		}
     	}
     
    @@ -25,24 +25,24 @@ function layouts_init(&$a) {
     
     function layouts_content(&$a) {
     
    -	if(! $a->profile) {
    +	if(! App::$profile) {
     		notice( t('Requested profile is not available.') . EOL );
    -		$a->error = 404;
    +		App::$error = 404;
     		return;
     	}
     
     	$which = argv(1);
     
    -	$_SESSION['return_url'] = $a->query_string;
    +	$_SESSION['return_url'] = App::$query_string;
     
     	$uid = local_channel();
     	$owner = 0;
     	$channel = null;
    -	$observer = $a->get_observer();
    +	$observer = App::get_observer();
     
    -	$channel = $a->get_channel();
    +	$channel = App::get_channel();
     
    -	if($a->is_sys && is_site_admin()) {
    +	if(App::$is_sys && is_site_admin()) {
     		$sys = get_sys_channel();
     		if($sys && intval($sys['channel_id'])) {
     			$uid = $owner = intval($sys['channel_id']);
    @@ -113,7 +113,7 @@ function layouts_content(&$a) {
     	$x = array(
     		'webpage'     => ITEM_TYPE_PDL,
     		'is_owner'    => true,
    -		'nickname'    => $a->profile['channel_address'],
    +		'nickname'    => App::$profile['channel_address'],
     		'bang'        => '',
     		'showacl'     => false,
     		'visitor'     => false,
    diff --git a/mod/like.php b/mod/like.php
    index 9901c1cfa..0fbdd5c30 100755
    --- a/mod/like.php
    +++ b/mod/like.php
    @@ -9,14 +9,14 @@ function like_content(&$a) {
     
     	$o = '';
     
    -	$observer = $a->get_observer();
    +	$observer = App::get_observer();
     	$interactive = $_REQUEST['interactive'];
     	if($interactive) {
     		$o .= '

    ' . t('Like/Dislike') . '

    '; $o .= EOL . EOL; if(! $observer) { - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $o .= t('This action is restricted to members.') . EOL; $o .= t('Please login with your $Projectname ID or register as a new $Projectname member to continue.') . EOL; return $o; diff --git a/mod/locs.php b/mod/locs.php index 8452f62d1..1daf41b89 100644 --- a/mod/locs.php +++ b/mod/locs.php @@ -6,7 +6,7 @@ function locs_post(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($_REQUEST['primary']) { $hubloc_id = intval($_REQUEST['primary']); @@ -84,7 +84,7 @@ function locs_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($_REQUEST['sync']) { proc_run('php','include/notifier.php','location',$channel['channel_id']); diff --git a/mod/login.php b/mod/login.php index 12c7d339e..31a4e7fc0 100644 --- a/mod/login.php +++ b/mod/login.php @@ -3,5 +3,5 @@ function login_content(&$a) { if(local_channel()) goaway(z_root()); - return login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? false : true); + return login((App::$config['system']['register_policy'] == REGISTER_CLOSED) ? false : true); } diff --git a/mod/lostpass.php b/mod/lostpass.php index 9a52ac7a9..2ae955983 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -98,7 +98,7 @@ function lostpass_content(&$a) { $email_tpl = get_intltext_template("passchanged_eml.tpl"); $message = replace_macros($email_tpl, array( - '$sitename' => $a->config['sitename'], + '$sitename' => App::$config['sitename'], '$siteurl' => z_root(), '$username' => sprintf( t('Site Member (%s)'), $email), '$email' => $email, diff --git a/mod/magic.php b/mod/magic.php index 12679773b..2f746507b 100644 --- a/mod/magic.php +++ b/mod/magic.php @@ -128,7 +128,7 @@ function magic_init(&$a) { } if(local_channel()) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $token = random_string(); $token_sig = base64url_encode(rsa_sign($token,$channel['channel_prvkey'])); @@ -142,7 +142,7 @@ function magic_init(&$a) { dbesc($x[0]['hubloc_url']), dbesc(datetime_convert()) ); - $target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode($channel['channel_address'] . '@' . $a->get_hostname()) + $target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode($channel['channel_address'] . '@' . App::get_hostname()) . '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION; if($delegate) diff --git a/mod/mail.php b/mod/mail.php index 32bb19952..1ab2bc5ab 100644 --- a/mod/mail.php +++ b/mod/mail.php @@ -26,7 +26,7 @@ function mail_post(&$a) { // finger them and find out before we try and send it. if(! $recipient) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $ret = zot_finger($rstr,$channel); @@ -96,8 +96,8 @@ function mail_post(&$a) { if(! $recipient) { notice('No recipient found.'); - $a->argc = 2; - $a->argv[1] = 'new'; + App::$argc = 2; + App::$argv[1] = 'new'; return; } @@ -127,7 +127,7 @@ function mail_content(&$a) { return login(); } - $channel = $a->get_channel(); + $channel = App::get_channel(); head_set_icon($channel['xchan_photo_s']); @@ -203,7 +203,7 @@ function mail_content(&$a) { '$expireswhen' => t('Expires YYYY-MM-DD HH:MM') )); - $a->page['htmlhead'] .= $header; + App::$page['htmlhead'] .= $header; $prename = ''; $preid = ''; @@ -298,18 +298,18 @@ function mail_content(&$a) { } if($messages[0]['to_xchan'] === $channel['channel_hash']) - $a->poi = $messages[0]['from']; + App::$poi = $messages[0]['from']; else - $a->poi = $messages[0]['to']; + App::$poi = $messages[0]['to']; // require_once('include/Contact.php'); -// $a->set_widget('mail_conversant',vcard_from_xchan($a->poi,$get_observer_hash,'mail')); +// App::set_widget('mail_conversant',vcard_from_xchan(App::$poi,$get_observer_hash,'mail')); $tpl = get_markup_template('msg-header.tpl'); - $a->page['htmlhead'] .= replace_macros($tpl, array( + App::$page['htmlhead'] .= replace_macros($tpl, array( '$nickname' => $channel['channel_address'], '$baseurl' => z_root(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), diff --git a/mod/manage.php b/mod/manage.php index d769f0393..5ac3e6af8 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -29,7 +29,7 @@ function manage_content(&$a) { $r = change_channel($change_channel); if((argc() > 2) && !(argv(2) === 'default')) { - goaway(z_root() . '/' . implode('/',array_slice($a->argv,2))); // Go to whatever is after /manage/, but with the new channel + goaway(z_root() . '/' . implode('/',array_slice(App::$argv,2))); // Go to whatever is after /manage/, but with the new channel } else { if($r && $r['channel_startpage']) @@ -45,7 +45,7 @@ function manage_content(&$a) { intval(get_account_id()) ); - $account = get_app()->get_account(); + $account = App::get_account(); if($r && count($r)) { $channels = $r; diff --git a/mod/match.php b/mod/match.php index 60c281861..f7fc6cebd 100644 --- a/mod/match.php +++ b/mod/match.php @@ -17,7 +17,7 @@ function match_content(&$a) { if (! local_channel()) return; - $_SESSION['return_url'] = z_root() . '/' . $a->cmd; + $_SESSION['return_url'] = z_root() . '/' . App::$cmd; $o .= '

    ' . t('Profile Match') . '

    '; @@ -37,8 +37,8 @@ function match_content(&$a) { if ($tags) { $params['s'] = $tags; - if ($a->pager['page'] != 1) - $params['p'] = $a->pager['page']; + if (App::$pager['page'] != 1) + $params['p'] = App::$pager['page']; // if(strlen(get_config('system','directory_submit_url'))) // $x = post_url('http://dir.friendica.com/msearch', $params); @@ -48,8 +48,8 @@ function match_content(&$a) { $j = json_decode($x); if ($j->total) { - $a->set_pager_total($j->total); - $a->set_pager_itemspage($j->items_page); + App::set_pager_total($j->total); + App::set_pager_itemspage($j->items_page); } if (count($j->results)) { diff --git a/mod/menu.php b/mod/menu.php index bfc45adef..e11483c2d 100644 --- a/mod/menu.php +++ b/mod/menu.php @@ -7,7 +7,7 @@ function menu_init(&$a) { if (array_key_exists('sys', $_REQUEST) && $_REQUEST['sys'] && is_site_admin()) { $sys = get_sys_channel(); if ($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } } @@ -19,7 +19,7 @@ function menu_post(&$a) { if(array_key_exists('sys', $_REQUEST) && $_REQUEST['sys'] && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); - $a->is_sys = true; + App::$is_sys = true; } if(! $uid) @@ -39,7 +39,7 @@ function menu_post(&$a) { 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' : '')); + goaway(z_root() . '/mitem/' . $menu_id . ((App::$is_sys) ? '?f=&sys=1' : '')); } else notice( t('Unable to update menu.'). EOL); @@ -50,7 +50,7 @@ function menu_post(&$a) { menu_sync_packet($uid,get_observer_hash(),$r); //info( t('Menu created.') . EOL); - goaway(z_root() . '/mitem/' . $r . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/mitem/' . $r . ((App::$is_sys) ? '?f=&sys=1' : '')); } else notice( t('Unable to create menu.'). EOL); @@ -65,7 +65,7 @@ function menu_content(&$a) { $uid = local_channel(); - if ($a->is_sys && is_site_admin()) { + if (App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); } @@ -95,7 +95,7 @@ function menu_content(&$a) { '$menu_desc' => array('menu_desc', t('Menu Title'), '', t('Visible on webpage - leave empty for no title'), ''), '$menu_bookmark' => array('menu_bookmark', t('Allow Bookmarks'), 0 , t('Menu may be used to store saved bookmarks'), array(t('No'), t('Yes'))), '$submit' => t('Submit and proceed'), - '$sys' => $a->is_sys, + '$sys' => App::$is_sys, '$display' => 'none' )); @@ -115,7 +115,7 @@ function menu_content(&$a) { '$hintdrop' => t('Delete this menu'), '$hintcontent' => t('Edit menu contents'), '$hintedit' => t('Edit this menu'), - '$sys' => $a->is_sys + '$sys' => App::$is_sys )); return $o; @@ -131,7 +131,7 @@ function menu_content(&$a) { if(!$r) notice( t('Menu could not be deleted.'). EOL); - goaway(z_root() . '/menu' . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/menu' . ((App::$is_sys) ? '?f=&sys=1' : '')); } $m = menu_fetch_id(intval(argv(1)),$uid); @@ -143,9 +143,9 @@ function menu_content(&$a) { $o = replace_macros(get_markup_template('menuedit.tpl'), array( '$header' => t('Edit Menu'), - '$sys' => $a->is_sys, + '$sys' => App::$is_sys, '$menu_id' => intval(argv(1)), - '$menu_edit_link' => 'mitem/' . intval(argv(1)) . (($a->is_sys) ? '?f=&sys=1' : ''), + '$menu_edit_link' => 'mitem/' . intval(argv(1)) . ((App::$is_sys) ? '?f=&sys=1' : ''), '$hintedit' => t('Add or remove entries to this menu'), '$editcontents' => t('Edit menu contents'), '$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'), diff --git a/mod/message.php b/mod/message.php index a97ab5399..f6d1d020c 100644 --- a/mod/message.php +++ b/mod/message.php @@ -17,7 +17,7 @@ function message_content(&$a) { return login(); } - $channel = $a->get_channel(); + $channel = App::get_channel(); head_set_icon($channel['xchan_photo_s']); $cipher = get_pconfig(local_channel(),'system','default_cipher'); @@ -56,7 +56,7 @@ function message_content(&$a) { // private_messages_list() can do other more complicated stuff, for now keep it simple - $r = private_messages_list(local_channel(), $mailbox, $a->pager['start'], $a->pager['itemspage']); + $r = private_messages_list(local_channel(), $mailbox, App::$pager['start'], App::$pager['itemspage']); if(! $r) { info( t('No messages.') . EOL); diff --git a/mod/mitem.php b/mod/mitem.php index 7f582c649..5503e93f6 100644 --- a/mod/mitem.php +++ b/mod/mitem.php @@ -10,7 +10,7 @@ function mitem_init(&$a) { if(array_key_exists('sys',$_REQUEST) && $_REQUEST['sys'] && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); - $a->is_sys = true; + App::$is_sys = true; } if(! $uid) @@ -24,7 +24,7 @@ function mitem_init(&$a) { notice( t('Menu not found.') . EOL); return ''; } - $a->data['menu'] = $m; + App::$data['menu'] = $m; } @@ -32,7 +32,7 @@ function mitem_post(&$a) { $uid = local_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); } @@ -41,7 +41,7 @@ function mitem_post(&$a) { return; } - if(! $a->data['menu']) + if(! App::$data['menu']) return; if(!$_REQUEST['mitem_desc'] || !$_REQUEST['mitem_link']) { @@ -50,7 +50,7 @@ function mitem_post(&$a) { } $_REQUEST['mitem_channel_id'] = $uid; - $_REQUEST['menu_id'] = $a->data['menu']['menu_id']; + $_REQUEST['menu_id'] = App::$data['menu']['menu_id']; $_REQUEST['mitem_flags'] = 0; if($_REQUEST['usezid']) @@ -66,7 +66,7 @@ function mitem_post(&$a) { 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' : '')); + goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . ((App::$is_sys) ? '?f=&sys=1' : '')); } else notice( t('Unable to update menu element.') . EOL); @@ -78,10 +78,10 @@ function mitem_post(&$a) { 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' : '')); + goaway(z_root() . '/menu' . ((App::$is_sys) ? '?f=&sys=1' : '')); } if($_REQUEST['submit-more']) { - goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . '?f=&display=block' . (($a->is_sys) ? '&sys=1' : '') ); + goaway(z_root() . '/mitem/' . $_REQUEST['menu_id'] . '?f=&display=block' . ((App::$is_sys) ? '&sys=1' : '') ); } } else @@ -95,12 +95,12 @@ function mitem_post(&$a) { function mitem_content(&$a) { $uid = local_channel(); - $channel = $a->get_channel(); - $observer = $a->get_observer(); + $channel = App::get_channel(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); $channel = $sys; @@ -112,13 +112,13 @@ function mitem_content(&$a) { return ''; } - if(argc() < 2 || (! $a->data['menu'])) { + if(argc() < 2 || (! App::$data['menu'])) { notice( t('Not found.') . EOL); return ''; } - $m = menu_fetch($a->data['menu']['menu_name'],$uid,$ob_hash); - $a->data['menu_item'] = $m; + $m = menu_fetch(App::$data['menu']['menu_name'],$uid,$ob_hash); + App::$data['menu_item'] = $m; $menu_list = menu_list($uid); @@ -133,7 +133,7 @@ function mitem_content(&$a) { if(argc() == 2) { $r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc", - intval($a->data['menu']['menu_id']), + intval(App::$data['menu']['menu_id']), intval($uid) ); @@ -145,7 +145,7 @@ function mitem_content(&$a) { } $create = replace_macros(get_markup_template('mitemedit.tpl'), array( - '$menu_id' => $a->data['menu']['menu_id'], + '$menu_id' => App::$data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($acl->get(),false), @@ -159,7 +159,7 @@ function mitem_content(&$a) { '$display' => $display, '$lockstate' => $lockstate, '$menu_names' => $menu_names, - '$sys' => $a->is_sys + '$sys' => App::$is_sys )); $o .= replace_macros(get_markup_template('mitemlist.tpl'),array( @@ -167,10 +167,10 @@ function mitem_content(&$a) { '$create' => $create, '$nametitle' => t('Link Name'), '$targettitle' => t('Link Target'), - '$menuname' => $a->data['menu']['menu_name'], - '$menudesc' => $a->data['menu']['menu_desc'], + '$menuname' => App::$data['menu']['menu_name'], + '$menudesc' => App::$data['menu']['menu_desc'], '$edmenu' => t('Edit menu'), - '$menu_id' => $a->data['menu']['menu_id'], + '$menu_id' => App::$data['menu']['menu_id'], '$mlist' => $r, '$edit' => t('Edit element'), '$drop' => t('Drop element'), @@ -196,7 +196,7 @@ function mitem_content(&$a) { if(! $m) { notice( t('Menu item not found.') . EOL); - goaway(z_root() . '/menu'. (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/menu'. ((App::$is_sys) ? '?f=&sys=1' : '')); } $mitem = $m[0]; @@ -212,13 +212,13 @@ function mitem_content(&$a) { else notice( t('Menu item could not be deleted.'). EOL); - goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id'] . (($a->is_sys) ? '?f=&sys=1' : '')); + goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id'] . ((App::$is_sys) ? '?f=&sys=1' : '')); } // edit menu item $o = replace_macros(get_markup_template('mitemedit.tpl'), array( '$header' => t('Edit Menu Element'), - '$menu_id' => $a->data['menu']['menu_id'], + '$menu_id' => App::$data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("\x28click to open/close\x29"), '$aclselect' => populate_acl($mitem,false), diff --git a/mod/mood.php b/mod/mood.php index 92a4f391b..3ded65469 100755 --- a/mod/mood.php +++ b/mod/mood.php @@ -11,7 +11,7 @@ function mood_init(&$a) { return; $uid = local_channel(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $verb = notags(trim($_GET['verb'])); if(! $verb) @@ -56,7 +56,7 @@ function mood_init(&$a) { $deny_gid = $channel['channel_deny_gid']; } - $poster = $a->get_observer(); + $poster = App::get_observer(); $mid = item_message_id(); diff --git a/mod/network.php b/mod/network.php index 0def662cc..e195ac496 100644 --- a/mod/network.php +++ b/mod/network.php @@ -19,8 +19,8 @@ function network_init(&$a) { goaway('network' . '?f=&' . $network_options); } - $channel = $a->get_channel(); - $a->profile_uid = local_channel(); + $channel = App::get_channel(); + App::$profile_uid = local_channel(); head_set_icon($channel['xchan_photo_s']); } @@ -28,18 +28,18 @@ function network_init(&$a) { function network_content(&$a, $update = 0, $load = false) { if(! local_channel()) { - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; return login(false); } if($load) $_SESSION['loadtime'] = datetime_convert(); - $arr = array('query' => $a->query_string); + $arr = array('query' => App::$query_string); call_hooks('network_content_init', $arr); - $channel = $a->get_channel(); + $channel = App::get_channel(); $item_normal = item_normal(); $datequery = $datequery2 = ''; @@ -268,10 +268,10 @@ function network_content(&$a, $update = 0, $load = false) { $o .= '
    ' . "\r\n"; $o .= "\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'network', '$uid' => ((local_channel()) ? local_channel() : '0'), @@ -287,7 +287,7 @@ function network_content(&$a, $update = 0, $load = false) { '$nouveau' => (($nouveau) ? $nouveau : '0'), '$wall' => '0', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => (($search) ? $search : ''), '$order' => $order, '$file' => $file, @@ -348,8 +348,8 @@ function network_content(&$a, $update = 0, $load = false) { } else { $itemspage = get_pconfig(local_channel(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); } @@ -380,7 +380,7 @@ function network_content(&$a, $update = 0, $load = false) { require_once('include/identity.php'); $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; - $a->data['firehose'] = intval($sys['channel_id']); + App::$data['firehose'] = intval($sys['channel_id']); } else { $uids = " and item.uid = " . local_channel() . " "; diff --git a/mod/new_channel.php b/mod/new_channel.php index db5fff82a..f3b63b655 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -62,11 +62,11 @@ function new_channel_post(&$a) { $arr = $_POST; - $acc = $a->get_account(); + $acc = App::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 + // get_account_id() returns the account_id from the session. But App::$account // may point to the original authenticated account. if((! $acc) || ($acc['account_id'] != $arr['account_id'])) { @@ -94,7 +94,7 @@ function new_channel_post(&$a) { function new_channel_content(&$a) { - $acc = $a->get_account(); + $acc = App::get_account(); if((! $acc) || $acc['account_id'] != get_account_id()) { notice( t('Permission denied.') . EOL); @@ -122,7 +122,7 @@ function new_channel_content(&$a) { } $name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"')); - $nickhub = '@' . get_app()->get_hostname(); + $nickhub = '@' . App::get_hostname(); $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub)); $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' ' . t('Read more about roles') . '',get_roles()); diff --git a/mod/notifications.php b/mod/notifications.php index f6a75e2c0..45eb6483b 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -6,7 +6,7 @@ function notifications_post(&$a) { goaway(z_root()); } - $request_id = (($a->argc > 1) ? $a->argv[1] : 0); + $request_id = ((App::$argc > 1) ? App::$argv[1] : 0); if($request_id === "all") return; diff --git a/mod/oembed.php b/mod/oembed.php index d4a4424f5..a3ac8672d 100644 --- a/mod/oembed.php +++ b/mod/oembed.php @@ -2,7 +2,7 @@ require_once("include/oembed.php"); function oembed_init(&$a){ - // logger('mod_oembed ' . $a->query_string, LOGGER_ALL); + // logger('mod_oembed ' . App::$query_string, LOGGER_ALL); if(argc() > 1) { if (argv(1) == 'b2h'){ diff --git a/mod/oexchange.php b/mod/oexchange.php index d59a8d127..342b8c3cd 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -16,7 +16,7 @@ function oexchange_content(&$a) { if(! local_channel()) { if(remote_channel()) { - $observer = $a->get_observer(); + $observer = App::get_observer(); if($observer && $observer['xchan_url']) { $parsed = @parse_url($observer['xchan_url']); if(! $parsed) { diff --git a/mod/openid.php b/mod/openid.php index b9ca672a9..1ca1ba91e 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -66,9 +66,9 @@ function openid_content(&$a) { $_SESSION['my_address'] = $r[0]['xchan_addr']; $arr = array('xchan' => $r[0], 'session' => $_SESSION); call_hooks('magic_auth_openid_success',$arr); - $a->set_observer($r[0]); + App::set_observer($r[0]); require_once('include/security.php'); - $a->set_groups(init_groups_visitor($_SESSION['visitor_id'])); + App::set_groups(init_groups_visitor($_SESSION['visitor_id'])); info(sprintf( t('Welcome %s. Remote authentication successful.'),$r[0]['xchan_name'])); logger('mod_openid: remote auth success from ' . $r[0]['xchan_addr']); if($_SESSION['return_url']) @@ -175,7 +175,7 @@ function openid_content(&$a) { $_SESSION['my_address'] = $r[0]['xchan_addr']; $arr = array('xchan' => $r[0], 'session' => $_SESSION); call_hooks('magic_auth_openid_success',$arr); - $a->set_observer($r[0]); + App::set_observer($r[0]); info(sprintf( t('Welcome %s. Remote authentication successful.'),$r[0]['xchan_name'])); logger('mod_openid: remote auth success from ' . $r[0]['xchan_addr']); if($_SESSION['return_url']) diff --git a/mod/opensearch.php b/mod/opensearch.php index 212773b96..19f7985c5 100644 --- a/mod/opensearch.php +++ b/mod/opensearch.php @@ -8,7 +8,7 @@ function opensearch_init(&$a) { $o = replace_macros($tpl, array( '$baseurl' => z_root(), - '$nodename' => $a->get_hostname(), + '$nodename' => App::get_hostname(), )); echo $o; diff --git a/mod/page.php b/mod/page.php index d4aefc1cd..c7b827e4d 100644 --- a/mod/page.php +++ b/mod/page.php @@ -13,21 +13,21 @@ function page_init(&$a) { - if($a->profile['profile_uid']) - head_set_icon($a->profile['thumb']); + if(App::$profile['profile_uid']) + head_set_icon(App::$profile['thumb']); // load the item here in the init function because we need to extract // the page layout and initialise the correct theme. - $observer = $a->get_observer(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); // perm_is_allowed is denied unconditionally when 'site blocked to unauthenticated members'. // This bypasses that restriction for sys channel (public) content - if((! perm_is_allowed($a->profile['profile_uid'],$ob_hash,'view_pages')) && (! is_sys_channel($a->profile['profile_uid']))) { + if((! perm_is_allowed(App::$profile['profile_uid'],$ob_hash,'view_pages')) && (! is_sys_channel(App::$profile['profile_uid']))) { notice( t('Permission denied.') . EOL); return; } @@ -92,12 +92,12 @@ function page_init(&$a) { } if($r[0]['title']) - $a->page['title'] = escape_tags($r[0]['title']); + App::$page['title'] = escape_tags($r[0]['title']); if($r[0]['item_type'] == ITEM_TYPE_PDL) { require_once('include/comanche.php'); comanche_parser(get_app(),$r[0]['body']); - get_app()->pdl = $r[0]['body']; + App::$pdl = $r[0]['body']; } elseif($r[0]['layout_mid']) { $l = q("select body from item where mid = '%s' and uid = %d limit 1", @@ -108,11 +108,11 @@ function page_init(&$a) { if($l) { require_once('include/comanche.php'); comanche_parser(get_app(),$l[0]['body']); - get_app()->pdl = $l[0]['body']; + App::$pdl = $l[0]['body']; } } - $a->data['webpage'] = $r; + App::$data['webpage'] = $r; } @@ -121,7 +121,7 @@ function page_init(&$a) { function page_content(&$a) { - $r = $a->data['webpage']; + $r = App::$data['webpage']; if(! $r) return; @@ -136,7 +136,7 @@ function page_content(&$a) { $r = fetch_post_tags($r,true); if($r[0]['mimetype'] === 'application/x-pdl') - $a->page['pdl_content'] = true; + App::$page['pdl_content'] = true; $o .= prepare_page($r[0]); return $o; diff --git a/mod/pconfig.php b/mod/pconfig.php index 413dd2911..64fc1271c 100755 --- a/mod/pconfig.php +++ b/mod/pconfig.php @@ -68,7 +68,7 @@ function pconfig_content(&$a) { if(argc() == 2) { $content .= 'pconfig[' . local_channel() . ']' . EOL; load_pconfig(local_channel(),escape_tags(argv(1))); - foreach($a->config[local_channel()][escape_tags(argv(1))] as $k => $x) { + foreach(App::$config[local_channel()][escape_tags(argv(1))] as $k => $x) { $content .= 'pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . $k . '] = ' . escape_tags($x) . EOL; } } diff --git a/mod/photo.php b/mod/photo.php index e8cd95f1c..93c6efa95 100644 --- a/mod/photo.php +++ b/mod/photo.php @@ -156,8 +156,8 @@ function photo_init(&$a) { ); if($r) { - logger('mod_photo: forbidden. ' . $a->query_string); - $observer = $a->get_observer(); + logger('mod_photo: forbidden. ' . App::$query_string); + $observer = App::get_observer(); logger('mod_photo: observer = ' . (($observer) ? $observer['xchan_addr'] : '(not authenticated)')); $data = file_get_contents('images/nosign.png'); $mimetype = 'image/png'; diff --git a/mod/photos.php b/mod/photos.php index ddacc38a3..0adbf752a 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -29,16 +29,16 @@ function photos_init(&$a) { if(! $channelx) return; - $a->data['channel'] = $channelx; + App::$data['channel'] = $channelx; - $observer = $a->get_observer(); - $a->data['observer'] = $observer; + $observer = App::get_observer(); + App::$data['observer'] = $observer; $observer_xchan = (($observer) ? $observer['xchan_hash'] : ''); - head_set_icon($a->data['channel']['xchan_photo_s']); + head_set_icon(App::$data['channel']['xchan_photo_s']); - $a->page['htmlhead'] .= "" ; + App::$page['htmlhead'] .= "" ; } @@ -61,7 +61,7 @@ function photos_post(&$a) { $can_post = false; - $page_owner_uid = $a->data['channel']['channel_id']; + $page_owner_uid = App::$data['channel']['channel_id']; if(perm_is_allowed($page_owner_uid,get_observer_hash(),'write_storage')) $can_post = true; @@ -85,7 +85,7 @@ function photos_post(&$a) { $owner_record = $s[0]; - $acl = new Zotlabs\Access\AccessList($a->data['channel']); + $acl = new Zotlabs\Access\AccessList(App::$data['channel']); if((argc() > 3) && (argv(2) === 'album')) { @@ -165,7 +165,7 @@ function photos_post(&$a) { } - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address']); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address']); } if((argc() > 2) && (x($_REQUEST,'delete')) && ($_REQUEST['delete'] === t('Delete Photo'))) { @@ -179,7 +179,7 @@ function photos_post(&$a) { $r = q("SELECT `id`, `resource_id` FROM `photo` WHERE ( xchan = '%s' or `uid` = %d ) AND `resource_id` = '%s' LIMIT 1", dbesc($ob_hash), intval(local_channel()), - dbesc($a->argv[2]) + dbesc(App::$argv[2]) ); if($r) { @@ -202,11 +202,11 @@ function photos_post(&$a) { */ } - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); } - if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { + if((App::$argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) { $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : ''); @@ -218,7 +218,7 @@ function photos_post(&$a) { $acl->set_from_array($_POST); $perm = $acl->get(); - $resource_id = $a->argv[2]; + $resource_id = App::$argv[2]; if(! strlen($albname)) $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); @@ -349,7 +349,7 @@ function photos_post(&$a) { $visibility = 1; if(! $item_id) { - $item_id = photos_create_item($a->data['channel'],get_observer_hash(),$p[0],$visibility); + $item_id = photos_create_item(App::$data['channel'],get_observer_hash(),$p[0],$visibility); } @@ -401,7 +401,7 @@ function photos_post(&$a) { $rawtags = '@' . $rawtags; require_once('include/text.php'); - $profile_uid = $a->profile['profile_uid']; + $profile_uid = App::$profile['profile_uid']; $results = linkify_tags($a, $rawtags, (local_channel()) ? local_channel() : $profile_uid); @@ -450,8 +450,8 @@ function photos_post(&$a) { * default post action - upload a photo */ - $channel = $a->data['channel']; - $observer = $a->data['observer']; + $channel = App::$data['channel']; + $observer = App::$data['observer']; $_REQUEST['source'] = 'photos'; require_once('include/attach.php'); @@ -470,9 +470,9 @@ function photos_post(&$a) { } if($_REQUEST['newalbum']) - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($_REQUEST['newalbum'])); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($_REQUEST['newalbum'])); else - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex(datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'))); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex(datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'))); } @@ -497,7 +497,7 @@ function photos_content(&$a) { require_once('include/security.php'); require_once('include/conversation.php'); - if(! x($a->data,'channel')) { + if(! x(App::$data,'channel')) { notice( t('No photos selected') . EOL ); return; } @@ -505,13 +505,13 @@ function photos_content(&$a) { $ph = photo_factory(''); $phototypes = $ph->supportedTypes(); - $_SESSION['photo_return'] = $a->cmd; + $_SESSION['photo_return'] = App::$cmd; // // Parse arguments // - $can_comment = perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'post_comments'); + $can_comment = perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'post_comments'); if(argc() > 3) { $datatype = argv(2); @@ -538,10 +538,10 @@ function photos_content(&$a) { $visitor = 0; - $owner_uid = $a->data['channel']['channel_id']; - $owner_aid = $a->data['channel']['channel_account_id']; + $owner_uid = App::$data['channel']['channel_id']; + $owner_aid = App::$data['channel']['channel_account_id']; - $observer = $a->get_observer(); + $observer = App::get_observer(); $can_post = perm_is_allowed($owner_uid,$observer['xchan_hash'],'write_storage'); $can_view = perm_is_allowed($owner_uid,$observer['xchan_hash'],'view_storage'); @@ -555,13 +555,13 @@ function photos_content(&$a) { $o = ""; - $o .= "\r\n"; + $o .= "\r\n"; // tabs $_is_owner = (local_channel() && (local_channel() == $owner_uid)); - $o .= profile_tabs($a,$_is_owner, $a->data['channel']['channel_address']); + $o .= profile_tabs($a,$_is_owner, App::$data['channel']['channel_address']); /** * Display upload form @@ -571,7 +571,7 @@ function photos_content(&$a) { $uploader = ''; - $ret = array('post_url' => z_root() . '/photos/' . $a->data['channel']['channel_address'], + $ret = array('post_url' => z_root() . '/photos/' . App::$data['channel']['channel_address'], 'addon_text' => $uploader, 'default_upload' => true); @@ -580,11 +580,11 @@ function photos_content(&$a) { /* Show space usage */ $r = q("select sum(size) as total from photo where aid = %d and scale = 0 ", - intval($a->data['channel']['channel_account_id']) + intval(App::$data['channel']['channel_account_id']) ); - $limit = service_class_fetch($a->data['channel']['channel_id'],'photo_upload_limit'); + $limit = service_class_fetch(App::$data['channel']['channel_id'],'photo_upload_limit'); if($limit !== false) { $usage_message = sprintf( t("%1$.2f MB of %2$.2f MB photo storage used."), $r[0]['total'] / 1024000, $limit / 1024000 ); } @@ -593,7 +593,7 @@ function photos_content(&$a) { } if($_is_owner) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); @@ -613,10 +613,10 @@ function photos_content(&$a) { $selname = (($datum) ? hex2bin($datum) : ''); - $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $albums = ((array_key_exists('albums', App::$data)) ? App::$data['albums'] : photos_albums_list(App::$data['channel'],App::$data['observer'])); if(! $selname) { - $def_album = get_pconfig($a->data['channel']['channel_id'],'system','photo_path'); + $def_album = get_pconfig(App::$data['channel']['channel_id'],'system','photo_path'); if($def_album) { $selname = filepath_macro($def_album); $albums['album'][] = array('text' => $selname); @@ -628,7 +628,7 @@ function photos_content(&$a) { '$pagename' => t('Upload Photos'), '$sessid' => session_id(), '$usage' => $usage_message, - '$nickname' => $a->data['channel']['channel_address'], + '$nickname' => App::$data['channel']['channel_address'], '$newalbum_label' => t('Enter an album name'), '$newalbum_placeholder' => t('or select an existing album (doubleclick)'), '$visible' => array('visible', t('Create a status post for this upload'), 0,'', array(t('No'), t('Yes')), 'onclick="showHideBodyTextarea();"'), @@ -669,7 +669,7 @@ function photos_content(&$a) { $album = (($datum) ? hex2bin($datum) : ''); - $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; $r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s' @@ -681,10 +681,10 @@ function photos_content(&$a) { intval($unsafe) ); if(count($r)) { - $a->set_pager_total(count($r)); - $a->set_pager_itemspage(60); + App::set_pager_total(count($r)); + App::set_pager_itemspage(60); } else { - goaway(z_root() . '/photos/' . $a->data['channel']['channel_address']); + goaway(z_root() . '/photos/' . App::$data['channel']['channel_address']); } if($_GET['order'] === 'posted') @@ -702,8 +702,8 @@ function photos_content(&$a) { intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); //edit album name @@ -711,7 +711,7 @@ function photos_content(&$a) { if(($album !== t('Profile Photos')) && ($album !== 'Profile Photos') && ($album !== 'Contact Photos') && ($album !== t('Contact Photos'))) { if($can_post) { $album_e = $album; - $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $albums = ((array_key_exists('albums', App::$data)) ? App::$data['albums'] : photos_albums_list(App::$data['channel'],App::$data['observer'])); // @fixme - syncronise actions with DAV @@ -719,7 +719,7 @@ function photos_content(&$a) { // $album_edit = replace_macros($edit_tpl,array( // '$nametext' => t('Enter a new album name'), // '$name_placeholder' => t('or select an existing one (doubleclick)'), -// '$nickname' => $a->data['channel']['channel_address'], +// '$nickname' => App::$data['channel']['channel_address'], // '$album' => $album_e, // '$albums' => $albums['albums'], // '$hexalbum' => bin2hex($album), @@ -731,9 +731,9 @@ function photos_content(&$a) { } if($_GET['order'] === 'posted') - $order = array(t('Show Newest First'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album)); + $order = array(t('Show Newest First'), z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($album)); else - $order = array(t('Show Oldest First'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted'); + $order = array(t('Show Oldest First'), z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($album) . '?f=&order=posted'); $photos = array(); if(count($r)) { @@ -750,7 +750,7 @@ function photos_content(&$a) { $imgalt_e = $rr['filename']; $desc_e = $rr['description']; - $imagelink = (z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'] + $imagelink = (z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $rr['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '')); $photos[] = array( @@ -790,7 +790,7 @@ function photos_content(&$a) { '$album_id' => bin2hex($album), '$album_edit' => array(t('Edit Album'), $album_edit), '$can_post' => $can_post, - '$upload' => array(t('Upload'), z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/upload/' . bin2hex($album)), + '$upload' => array(t('Upload'), z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/upload/' . bin2hex($album)), '$order' => $order, '$upload_form' => $upload_form, '$usage' => $usage_message @@ -816,7 +816,7 @@ function photos_content(&$a) { if($datatype === 'image') { - $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; // fetch image, item containing image, then comments @@ -871,8 +871,8 @@ function photos_content(&$a) { } } - $prevlink = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); - $nextlink = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $prevlink = z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $nextlink = z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); } @@ -889,7 +889,7 @@ function photos_content(&$a) { } } - $album_link = z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($ph[0]['album']); + $album_link = z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($ph[0]['album']); $tools = Null; $lock = Null; @@ -906,12 +906,12 @@ function photos_content(&$a) { ? array('lock', t('Private Photo')) : array('unlock', Null)); - $a->page['htmlhead'] .= ''; + App::$page['htmlhead'] .= 'if(event.ctrlKey && event.keyCode == 39) { event.preventDefault(); window.location.href = \'' . $nextlink . '\'; }' . "\n"; + App::$page['htmlhead'] .= '});'; if($prevlink) $prevlink = array($prevlink, t('Previous')); @@ -992,7 +992,7 @@ function photos_content(&$a) { $album_e = $ph[0]['album']; $caption_e = $ph[0]['description']; $aclselect_e = (($_is_owner) ? populate_acl($ph[0]) : ''); - $albums = ((array_key_exists('albums', $a->data)) ? $a->data['albums'] : photos_albums_list($a->data['channel'],$a->data['observer'])); + $albums = ((array_key_exists('albums', App::$data)) ? App::$data['albums'] : photos_albums_list(App::$data['channel'],App::$data['observer'])); $_SESSION['album_return'] = bin2hex($ph[0]['album']); @@ -1005,7 +1005,7 @@ function photos_content(&$a) { 'album' => $album_e, 'newalbum_label' => t('Enter a new album name'), 'newalbum_placeholder' => t('or select an existing one (doubleclick)'), - 'nickname' => $a->data['channel']['channel_address'], + 'nickname' => App::$data['channel']['channel_address'], 'resource_id' => $ph[0]['resource_id'], 'capt_label' => t('Caption'), 'caption' => $caption_e, @@ -1026,7 +1026,7 @@ function photos_content(&$a) { $cmnt_tpl = get_markup_template('comment_item.tpl'); $tpl = get_markup_template('photo_item.tpl'); - $return_url = $a->cmd; + $return_url = App::$cmd; $like_tpl = get_markup_template('like_noshare.tpl'); @@ -1233,7 +1233,7 @@ function photos_content(&$a) { '$paginate' => $paginate, )); - $a->data['photo_html'] = $o; + App::$data['photo_html'] = $o; return $o; } @@ -1241,12 +1241,12 @@ function photos_content(&$a) { // Default - show recent photos with upload link (if applicable) //$o = ''; - $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '' . "\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']), + intval(App::$data['channel']['channel_id']), dbesc('Contact Photos'), dbesc( t('Contact Photos')), intval(PHOTO_NORMAL), @@ -1254,8 +1254,8 @@ function photos_content(&$a) { intval($unsafe) ); if(count($r)) { - $a->set_pager_total(count($r)); - $a->set_pager_itemspage(60); + App::set_pager_total(count($r)); + App::set_pager_itemspage(60); } $r = q("SELECT p.resource_id, p.id, p.filename, p.type, p.album, p.scale, p.created FROM photo p INNER JOIN @@ -1263,14 +1263,14 @@ function photos_content(&$a) { 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) ph ON (p.resource_id = ph.resource_id and p.scale = ph.scale) ORDER by p.created DESC LIMIT %d OFFSET %d", - intval($a->data['channel']['channel_id']), + intval(App::$data['channel']['channel_id']), dbesc('Contact Photos'), dbesc( t('Contact Photos')), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE), intval($unsafe), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); @@ -1285,7 +1285,7 @@ function photos_content(&$a) { $twist = 'rotright'; $ext = $phototypes[$rr['type']]; - if($a->get_template_engine() === 'internal') { + if(App::get_template_engine() === 'internal') { $alt_e = template_escape($rr['filename']); $name_e = template_escape($rr['album']); } @@ -1297,12 +1297,12 @@ function photos_content(&$a) { $photos[] = array( 'id' => $rr['id'], 'twist' => ' ' . $twist . rand(2,4), - 'link' => z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $rr['resource_id'], + 'link' => z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/image/' . $rr['resource_id'], 'title' => t('View Photo'), 'src' => z_root() . '/photo/' . $rr['resource_id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext, 'alt' => $alt_e, 'album' => array( - 'link' => z_root() . '/photos/' . $a->data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']), + 'link' => z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . bin2hex($rr['album']), 'name' => $name_e, 'alt' => t('View Album'), ), @@ -1331,7 +1331,7 @@ function photos_content(&$a) { '$title' => t('Recent Photos'), '$album_id' => bin2hex(t('Recent Photos')), '$can_post' => $can_post, - '$upload' => array(t('Upload'), z_root().'/photos/'.$a->data['channel']['channel_address'].'/upload'), + '$upload' => array(t('Upload'), z_root().'/photos/'.App::$data['channel']['channel_address'].'/upload'), '$photos' => $photos, '$upload_form' => $upload_form, '$usage' => $usage_message diff --git a/mod/ping.php b/mod/ping.php index c93644317..32bc9753e 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -93,7 +93,7 @@ function ping_init(&$a) { $result['notice'] = array(); - if($a->install) { + if(App::$install) { echo json_encode($result); killme(); } @@ -240,7 +240,7 @@ function ping_init(&$a) { } if(argc() > 1 && argv(1) === 'messages') { - $channel = $a->get_channel(); + $channel = App::get_channel(); $t = q("select mail.*, xchan.* from mail left join xchan on xchan_hash = from_xchan where channel_id = %d and mail_seen = 0 and mail_deleted = 0 and from_xchan != '%s' order by created desc limit 50", @@ -413,7 +413,7 @@ function ping_init(&$a) { } $t4 = dba_timer(); - $channel = get_app()->get_channel(); + $channel = App::get_channel(); if($vnotify & VNOTIFY_MAIL) { $mails = q("SELECT count(id) as total from mail @@ -426,7 +426,7 @@ function ping_init(&$a) { } if($vnotify & VNOTIFY_REGISTER) { - if ($a->config['system']['register_policy'] == REGISTER_APPROVE && is_site_admin()) { + if (App::$config['system']['register_policy'] == REGISTER_APPROVE && is_site_admin()) { $regs = q("SELECT count(account_id) as total from account where (account_flags & %d) > 0", intval(ACCOUNT_PENDING) ); diff --git a/mod/poke.php b/mod/poke.php index 15a69780c..7245ceee7 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -22,7 +22,7 @@ function poke_init(&$a) { return; $uid = local_channel(); - $channel = $a->get_channel(); + $channel = App::get_channel(); $verb = notags(trim($_REQUEST['verb'])); diff --git a/mod/prate.php b/mod/prate.php index b89d16f42..2da6855dd 100644 --- a/mod/prate.php +++ b/mod/prate.php @@ -7,7 +7,7 @@ function prate_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $target = argv(1); if(! $target) @@ -27,7 +27,7 @@ function prate_post(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $target = trim($_REQUEST['target']); if(! $target) diff --git a/mod/probe.php b/mod/probe.php index 62a2227b0..6408a8c4f 100644 --- a/mod/probe.php +++ b/mod/probe.php @@ -13,7 +13,7 @@ function probe_content(&$a) { $o .= '

    '; if(x($_GET,'addr')) { - $channel = $a->get_channel(); + $channel = App::get_channel(); $addr = trim($_GET['addr']); $do_import = ((intval($_GET['import']) && is_site_admin()) ? true : false); $res = zot_finger($addr,$channel,false); diff --git a/mod/profile.php b/mod/profile.php index 3c9c7808d..09bcfd56a 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -14,12 +14,12 @@ function profile_init(&$a) { $which = argv(1); else { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $profile = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((local_channel()) && (argc() > 2) && (argv(2) === 'view')) { $which = $channel['channel_address']; @@ -33,14 +33,14 @@ function profile_init(&$a) { $profile = $r[0]['profile_guid']; } - $a->page['htmlhead'] .= '' . "\r\n" ; + App::$page['htmlhead'] .= '' . "\r\n" ; if(! $profile) { $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)) ); if($x) { - $a->profile = $x[0]; + App::$profile = $x[0]; } } @@ -60,22 +60,22 @@ function profile_content(&$a, $update = 0) { $tab = 'profile'; $o = ''; - if(! (perm_is_allowed($a->profile['profile_uid'],get_observer_hash(), 'view_profile'))) { + if(! (perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(), 'view_profile'))) { notice( t('Permission denied.') . EOL); return; } - $is_owner = ((local_channel()) && (local_channel() == $a->profile['profile_uid']) ? true : false); + $is_owner = ((local_channel()) && (local_channel() == App::$profile['profile_uid']) ? true : false); - if($a->profile['hidewall'] && (! $is_owner) && (! remote_channel())) { + if(App::$profile['hidewall'] && (! $is_owner) && (! remote_channel())) { notice( t('Permission denied.') . EOL); return; } - $o .= profile_tabs($a, $is_owner, $a->profile['channel_address']); + $o .= profile_tabs($a, $is_owner, App::$profile['channel_address']); - $a->page['htmlhead'] .= "\r\n" . '' . "\r\n"; + App::$page['htmlhead'] .= "\r\n" . '' . "\r\n"; $o .= advanced_profile($a); call_hooks('profile_advanced',$o); diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 789989ff2..bac93555f 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -67,7 +67,7 @@ function profile_photo_init(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); profile_load($a,$channel['channel_address']); } @@ -171,7 +171,7 @@ function profile_photo_post(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); // If setting for the default profile, unset the profile photo flag from any other photos I own @@ -236,7 +236,7 @@ function profile_photo_post(&$a) { require_once('include/attach.php'); - $res = attach_store($a->get_channel(), get_observer_hash(), '', array('album' => t('Profile Photos'), 'hash' => $hash)); + $res = attach_store(App::get_channel(), get_observer_hash(), '', array('album' => t('Profile Photos'), 'hash' => $hash)); logger('attach_store: ' . print_r($res,true)); @@ -290,7 +290,7 @@ function profile_photo_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $newuser = false; @@ -389,12 +389,12 @@ function profile_photo_content(&$a) { intval(local_channel()) ); - if(! x($a->data,'imagecrop')) { + if(! x(App::$data,'imagecrop')) { $tpl = get_markup_template('profile_photo.tpl'); $o .= replace_macros($tpl,array( - '$user' => $a->channel['channel_address'], + '$user' => App::$channel['channel_address'], '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), '$title' => t('Upload Profile Photo'), @@ -404,7 +404,7 @@ function profile_photo_content(&$a) { '$profile0' => $profiles[0], '$form_security_token' => get_form_security_token("profile_photo"), // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') + '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') )); call_hooks('profile_photo_content_end', $o); @@ -412,13 +412,13 @@ function profile_photo_content(&$a) { return $o; } else { - $filename = $a->data['imagecrop'] . '-' . $a->data['imagecrop_resolution']; - $resolution = $a->data['imagecrop_resolution']; + $filename = App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution']; + $resolution = App::$data['imagecrop_resolution']; $tpl = get_markup_template("cropbody.tpl"); $o .= replace_macros($tpl,array( '$filename' => $filename, '$profile' => intval($_REQUEST['profile']), - '$resource' => $a->data['imagecrop'] . '-' . $a->data['imagecrop_resolution'], + '$resource' => App::$data['imagecrop'] . '-' . App::$data['imagecrop_resolution'], '$image_url' => z_root() . '/photo/' . $filename, '$title' => t('Crop Image'), '$desc' => t('Please adjust the image cropping for optimum viewing.'), @@ -459,9 +459,9 @@ function profile_photo_crop_ui_head(&$a, $ph, $hash, $smallest){ } - $a->data['imagecrop'] = $hash; - $a->data['imagecrop_resolution'] = $smallest; - $a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); + App::$data['imagecrop'] = $hash; + App::$data['imagecrop_resolution'] = $smallest; + App::$page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array()); return; } diff --git a/mod/profiles.php b/mod/profiles.php index fca2ff429..75c05b634 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -99,11 +99,11 @@ function profiles_init(&$a) { $name = t('Profile-') . ($num_profiles + 1); $r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1", intval(local_channel()), - intval($a->argv[2]) + intval(App::$argv[2]) ); if(! count($r1)) { notice( t('Profile unavailable to clone.') . EOL); - $a->error = 404; + App::$error = 404; return; } unset($r1[0]['id']); @@ -144,7 +144,7 @@ function profiles_init(&$a) { ); if(! $r1) { notice( t('Profile unavailable to export.') . EOL); - $a->error = 404; + App::$error = 404; return; } header('content-type: application/octet_stream'); @@ -168,7 +168,7 @@ function profiles_init(&$a) { // we start loading content if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) { if(feature_enabled(local_channel(),'multi_profiles')) - $id = $a->argv[1]; + $id = App::$argv[1]; else { $x = q("select id from profile where uid = %d and is_default = 1", intval(local_channel()) @@ -182,11 +182,11 @@ function profiles_init(&$a) { ); if(! count($r)) { notice( t('Profile not found.') . EOL); - $a->error = 404; + App::$error = 404; return; } - $chan = $a->get_channel(); + $chan = App::get_channel(); profile_load($a,$chan['channel_address'],$r[0]['id']); } @@ -234,7 +234,7 @@ function profiles_post(&$a) { if((argc() > 1) && (argv(1) !== "new") && intval(argv(1))) { $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($a->argv[1]), + intval(App::$argv[1]), intval(local_channel()) ); if(! count($orig)) { @@ -563,7 +563,7 @@ function profiles_post(&$a) { build_sync_packet(local_channel(),array('profile' => $r)); } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($namechanged && $is_default) { $r = q("UPDATE xchan SET xchan_name = '%s', xchan_name_date = '%s' WHERE xchan_hash = '%s'", @@ -590,7 +590,7 @@ function profiles_content(&$a) { $o = ''; - $channel = $a->get_channel(); + $channel = App::get_channel(); if(! local_channel()) { notice( t('Permission denied.') . EOL); @@ -604,7 +604,7 @@ function profiles_content(&$a) { if(((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(),'multi_profiles')) { if(feature_enabled(local_channel(),'multi_profiles')) - $id = $a->argv[1]; + $id = App::$argv[1]; else { $x = q("select id from profile where uid = %d and is_default = 1", intval(local_channel()) @@ -628,7 +628,7 @@ function profiles_content(&$a) { // if(feature_enabled(local_channel(),'richtext')) // $editselect = 'textareas'; - $a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( + App::$page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), array( '$baseurl' => z_root(), '$editselect' => $editselect, )); diff --git a/mod/profperm.php b/mod/profperm.php index 4556119a4..2e3f708c8 100644 --- a/mod/profperm.php +++ b/mod/profperm.php @@ -7,10 +7,10 @@ function profperm_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $which = $channel['channel_address']; - $profile = $a->argv[1]; + $profile = App::$argv[1]; profile_load($a,$which,$profile); diff --git a/mod/public.php b/mod/public.php index 45edda6c0..fd89e0776 100644 --- a/mod/public.php +++ b/mod/public.php @@ -26,10 +26,10 @@ function public_content(&$a, $update = 0, $load = false) { $o .= '
    ' . "\r\n"; $o .= "\r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'public', '$uid' => ((local_channel()) ? local_channel() : '0'), @@ -45,7 +45,7 @@ function public_content(&$a, $update = 0, $load = false) { '$nouveau' => '0', '$wall' => '0', '$list' => '0', - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => '', '$order' => 'comment', '$file' => '', @@ -63,8 +63,8 @@ function public_content(&$a, $update = 0, $load = false) { $pager_sql = ''; } else { - $a->set_pager_itemspage(20); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(20); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); } require_once('include/identity.php'); @@ -77,7 +77,7 @@ function public_content(&$a, $update = 0, $load = false) { $sys = get_sys_channel(); $uids = " and item.uid = " . intval($sys['channel_id']) . " "; $sql_extra = item_permissions_sql($sys['channel_id']); - $a->data['firehose'] = intval($sys['channel_id']); + App::$data['firehose'] = intval($sys['channel_id']); } if(get_config('system','public_list_mode')) diff --git a/mod/rate.php b/mod/rate.php index f30afed64..41e06e794 100644 --- a/mod/rate.php +++ b/mod/rate.php @@ -6,20 +6,20 @@ function rate_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $target = $_REQUEST['target']; if(! $target) return; - $a->data['target'] = $target; + App::$data['target'] = $target; if($target) { $r = q("SELECT * FROM xchan where xchan_hash like '%s' LIMIT 1", dbesc($target) ); if($r) { - $a->poi = $r[0]; + App::$poi = $r[0]; } else { $r = q("select * from site where site_url like '%s' and site_type = %d", @@ -27,8 +27,8 @@ function rate_init(&$a) { intval(SITE_TYPE_ZOT) ); if($r) { - $a->data['site'] = $r[0]; - $a->data['site']['site_url'] = strtolower($r[0]['site_url']); + App::$data['site'] = $r[0]; + App::$data['site']['site_url'] = strtolower($r[0]['site_url']); } } } @@ -44,13 +44,13 @@ function rate_post(&$a) { if(! local_channel()) return; - if(! $a->data['target']) + if(! App::$data['target']) return; if(! $_REQUEST['execute']) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $rating = intval($_POST['rating']); if($rating < (-10)) @@ -60,13 +60,13 @@ function rate_post(&$a) { $rating_text = trim(escape_tags($_REQUEST['rating_text'])); - $signed = $a->data['target'] . '.' . $rating . '.' . $rating_text; + $signed = App::$data['target'] . '.' . $rating . '.' . $rating_text; $sig = base64url_encode(rsa_sign($signed,$channel['channel_prvkey'])); $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), - dbesc($a->data['target']) + dbesc(App::$data['target']) ); if($z) { @@ -83,7 +83,7 @@ function rate_post(&$a) { else { $w = q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_sig, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', '%s', 1 ) ", dbesc($channel['channel_hash']), - dbesc($a->data['target']), + dbesc(App::$data['target']), intval($rating), dbesc($rating_text), dbesc($sig), @@ -91,7 +91,7 @@ function rate_post(&$a) { ); $z = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1 limit 1", dbesc($channel['channel_hash']), - dbesc($a->data['target']) + dbesc(App::$data['target']) ); if($z) $record = $z[0]['xlink_id']; @@ -112,7 +112,7 @@ function rate_content(&$a) { return; } -// if(! $a->data['target']) { +// if(! App::$data['target']) { // notice( t('No recipients.') . EOL); // return; // } @@ -123,14 +123,14 @@ function rate_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1", dbesc($channel['channel_hash']), - dbesc($a->data['target']) + dbesc(App::$data['target']) ); if($r) { - $a->data['xlink'] = $r[0]; + App::$data['xlink'] = $r[0]; $rating_val = $r[0]['xlink_rating']; $rating_text = $r[0]['xlink_rating_text']; } @@ -156,9 +156,9 @@ function rate_content(&$a) { $o = replace_macros(get_markup_template('rating_form.tpl'),array( '$header' => t('Rating'), '$website' => t('Website:'), - '$site' => (($a->data['site']) ? '' . $a->data['site']['site_url'] . '' : ''), - 'target' => $a->data['target'], - '$tgt_name' => (($a->poi && $a->poi['xchan_name']) ? $a->poi['xchan_name'] : sprintf( t('Remote Channel [%s] (not yet known on this site)'), substr($a->data['target'],0,16))), + '$site' => ((App::$data['site']) ? '' . App::$data['site']['site_url'] . '' : ''), + 'target' => App::$data['target'], + '$tgt_name' => ((App::$poi && App::$poi['xchan_name']) ? App::$poi['xchan_name'] : sprintf( t('Remote Channel [%s] (not yet known on this site)'), substr(App::$data['target'],0,16))), '$lbl_rating' => t('Rating (this information is public)'), '$lbl_rating_txt' => t('Optionally explain your rating (this information is public)'), '$rating_txt' => $rating_text, diff --git a/mod/ratings.php b/mod/ratings.php index dc98eb238..d99be974c 100644 --- a/mod/ratings.php +++ b/mod/ratings.php @@ -49,23 +49,23 @@ function ratings_init(&$a) { } if(array_key_exists('xchan_hash',$results['target'])) - $a->poi = $results['target']; + App::$poi = $results['target']; $friends = array(); $others = array(); if($results['ratings']) { foreach($results['ratings'] as $n) { - if(is_array($a->contacts) && array_key_exists($n['xchan_hash'],$a->contacts)) + if(is_array(App::$contacts) && array_key_exists($n['xchan_hash'],App::$contacts)) $friends[] = $n; else $others[] = $n; } } - $a->data = array('target' => $results['target'], 'results' => array_merge($friends,$others)); + App::$data = array('target' => $results['target'], 'results' => array_merge($friends,$others)); - if(! $a->data['results']) { + if(! App::$data['results']) { notice( t('No ratings') . EOL); } @@ -91,8 +91,8 @@ function ratings_content(&$a) { if(! $poco_rating) return; - $site_target = ((array_key_exists('target',$a->data) && array_key_exists('site_url',$a->data['target'])) ? - '' . $a->data['target']['site_url'] . '' : ''); + $site_target = ((array_key_exists('target',App::$data) && array_key_exists('site_url',App::$data['target'])) ? + '' . App::$data['target']['site_url'] . '' : ''); $o = replace_macros(get_markup_template('prep.tpl'),array( @@ -101,7 +101,7 @@ function ratings_content(&$a) { '$website' => t('Website: '), '$site' => $site_target, '$rating_text_lbl' => t('Description: '), - '$raters' => $a->data['results'] + '$raters' => App::$data['results'] )); return $o; diff --git a/mod/rbmark.php b/mod/rbmark.php index 4401e3626..563b5cbd5 100644 --- a/mod/rbmark.php +++ b/mod/rbmark.php @@ -30,7 +30,7 @@ function rbmark_post(&$a) { logger('rbmark_post: ' . print_r($_REQUEST,true)); - $channel = $a->get_channel(); + $channel = App::get_channel(); $t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title'])); bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0), @@ -75,7 +75,7 @@ function rbmark_content(&$a) { goaway(z_root() . '/bookmarks'); } - $channel = $a->get_channel(); + $channel = App::get_channel(); $m = menu_list($channel['channel_id'],'',MENU_BOOKMARK); diff --git a/mod/regmod.php b/mod/regmod.php index a1d300e56..d500de0dc 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -5,11 +5,11 @@ function regmod_content(&$a) { global $lang; - $_SESSION['return_url'] = $a->cmd; + $_SESSION['return_url'] = App::$cmd; if(! local_channel()) { info( t('Please login.') . EOL); - $o .= '

    ' . login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1); + $o .= '

    ' . login((App::$config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1); return $o; } diff --git a/mod/regver.php b/mod/regver.php index 78f146ec5..a26843376 100644 --- a/mod/regver.php +++ b/mod/regver.php @@ -4,7 +4,7 @@ function regver_content(&$a) { global $lang; - $_SESSION['return_url'] = $a->cmd; + $_SESSION['return_url'] = App::$cmd; if(argc() != 3) killme(); diff --git a/mod/removeaccount.php b/mod/removeaccount.php index 2752a2ee7..b4c2bad33 100644 --- a/mod/removeaccount.php +++ b/mod/removeaccount.php @@ -18,7 +18,7 @@ function removeaccount_post(&$a) { return; - $account = $a->get_account(); + $account = App::get_account(); $account_id = get_account_id(); if(! account_verify_password($account['account_email'],$_POST['qxz_password'])) diff --git a/mod/removeme.php b/mod/removeme.php index 452ee5ef5..ab1d5fe4f 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -18,7 +18,7 @@ function removeme_post(&$a) { return; - $account = $a->get_account(); + $account = App::get_account(); if(! account_verify_password($account['account_email'],$_POST['qxz_password'])) return; diff --git a/mod/rmagic.php b/mod/rmagic.php index 597c6ed9c..6a47b495a 100644 --- a/mod/rmagic.php +++ b/mod/rmagic.php @@ -14,7 +14,7 @@ function rmagic_init(&$a) { if($r) { if($r[0]['hubloc_url'] === z_root()) goaway(z_root() . '/login'); - $dest = z_root() . '/' . str_replace('zid=','zid_=',get_app()->query_string); + $dest = z_root() . '/' . str_replace('zid=','zid_=',App::$query_string); goaway($r[0]['hubloc_url'] . '/magic' . '?f=&dest=' . $dest); } } @@ -70,7 +70,7 @@ function rmagic_post(&$a) { if($_SESSION['return_url']) $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',$_SESSION['return_url'])); else - $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',$a->query_string)); + $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',App::$query_string)); goaway($url . '/magic' . '?f=&dest=' . $dest); } diff --git a/mod/rpost.php b/mod/rpost.php index 915b1ca96..bc9842b63 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -37,9 +37,9 @@ function rpost_content(&$a) { // by the wretched beast called 'suhosin'. All the browsers now allow long GET requests, but suhosin // blocks them. - $url = get_rpost_path($a->get_observer()); + $url = get_rpost_path(App::get_observer()); // make sure we're not looping to our own hub - if(($url) && (! stristr($url, $a->get_hostname()))) { + if(($url) && (! stristr($url, App::get_hostname()))) { foreach($_REQUEST as $key => $arg) { $url .= '&' . $key . '=' . $arg; } @@ -92,7 +92,7 @@ function rpost_content(&$a) { $_REQUEST['body'] = html2bbcode($_REQUEST['body']); } - $channel = $a->get_channel(); + $channel = App::get_channel(); $acl = new Zotlabs\Access\AccessList($channel); diff --git a/mod/search.php b/mod/search.php index 555d46f6a..37bd00a66 100644 --- a/mod/search.php +++ b/mod/search.php @@ -2,7 +2,7 @@ function search_init(&$a) { if(x($_REQUEST,'search')) - $a->data['search'] = $_REQUEST['search']; + App::$data['search'] = $_REQUEST['search']; } @@ -30,7 +30,7 @@ function search_content(&$a,$update = 0, $load = false) { $update = $load = 1; } - $observer = $a->get_observer(); + $observer = App::get_observer(); $observer_hash = (($observer) ? $observer['xchan_hash'] : ''); $o = '' . "\r\n"; @@ -39,8 +39,8 @@ function search_content(&$a,$update = 0, $load = false) { $o .= '

    ' . t('Search') . '

    '; - if(x($a->data,'search')) - $search = trim($a->data['search']); + if(x(App::$data,'search')) + $search = trim(App::$data['search']); else $search = ((x($_GET,'search')) ? trim(rawurldecode($_GET['search'])) : ''); @@ -99,12 +99,12 @@ function search_content(&$a,$update = 0, $load = false) { $o .= '' . "\r\n"; $o .= "\r\n"; + . "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; \r\n"; - $a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( + App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array( '$baseurl' => z_root(), '$pgtype' => 'search', - '$uid' => (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : '0'), + '$uid' => ((App::$profile['profile_uid']) ? App::$profile['profile_uid'] : '0'), '$gid' => '0', '$cid' => '0', '$cmin' => '0', @@ -117,7 +117,7 @@ function search_content(&$a,$update = 0, $load = false) { '$nouveau' => '0', '$wall' => '0', '$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0), - '$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1), + '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1), '$search' => (($tag) ? urlencode('#') : '') . $search, '$order' => '', '$file' => '', @@ -141,8 +141,8 @@ function search_content(&$a,$update = 0, $load = false) { if(($update) && ($load)) { $itemspage = get_pconfig(local_channel(),'system','itemspage'); - $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); - $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval($a->pager['itemspage']), intval($a->pager['start'])); + App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); + $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); // in case somebody turned off public access to sys channel content with permissions diff --git a/mod/service_limits.php b/mod/service_limits.php index ac96668ab..8ce410ab6 100644 --- a/mod/service_limits.php +++ b/mod/service_limits.php @@ -8,7 +8,7 @@ function service_limits_content(&$a) { return; } - $account = $a->get_account(); + $account = App::get_account(); if($account['account_service_class']) { $x = get_config('service_class',$account['account_service_class']); if($x) { diff --git a/mod/settings.php b/mod/settings.php index d8aa069d0..dbb381191 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -4,7 +4,7 @@ require_once('include/zot.php'); function get_theme_config_file($theme){ - $base_theme = get_app()->theme_info['extends']; + $base_theme = App::$theme_info['extends']; if (file_exists("view/theme/$theme/php/config.php")){ return "view/theme/$theme/php/config.php"; @@ -22,14 +22,14 @@ function settings_init(&$a) { if($_SESSION['delegate']) return; - $a->profile_uid = local_channel(); + App::$profile_uid = local_channel(); // default is channel settings in the absence of other arguments if(argc() == 1) { // We are setting these values - don't use the argc(), argv() functions here - $a->argc = 2; - $a->argv[] = 'channel'; + App::$argc = 2; + App::$argv[] = 'channel'; } @@ -45,7 +45,7 @@ function settings_post(&$a) { if($_SESSION['delegate']) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); logger('mod_settings: ' . print_r($_REQUEST,true)); @@ -153,7 +153,7 @@ function settings_post(&$a) { check_form_security_token_redirectOnErr('/settings/display', 'settings_display'); - $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->channel['channel_theme']); + $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : App::$channel['channel_theme']); $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : ''); $preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0); $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); @@ -196,7 +196,7 @@ function settings_post(&$a) { set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height); set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height); - if ($theme == $a->channel['channel_theme']){ + if ($theme == App::$channel['channel_theme']){ // call theme_post only if theme has not been changed if( ($themeconfigfile = get_theme_config_file($theme)) != null){ require_once($themeconfigfile); @@ -226,14 +226,14 @@ function settings_post(&$a) { $errs = array(); $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : ''); - $account = $a->get_account(); + $account = App::get_account(); if($email != $account['account_email']) { if(! valid_email($email)) $errs[] = t('Not valid email.'); $adm = trim(get_config('system','admin_email')); if(($adm) && (strcasecmp($email,$adm) == 0)) { $errs[] = t('Protected email address. Cannot change to that email.'); - $email = $a->user['email']; + $email = App::$user['email']; } if(! $errs) { $r = q("update account set account_email = '%s' where account_id = %d", @@ -428,7 +428,7 @@ function settings_post(&$a) { $cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0); - $channel = $a->get_channel(); + $channel = App::get_channel(); $pageflags = $channel['channel_pageflags']; $existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0); if($adult != $existing_adult) @@ -482,7 +482,7 @@ function settings_post(&$a) { $always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0; - $channel = $a->get_channel(); + $channel = App::get_channel(); $err = ''; @@ -556,7 +556,7 @@ function settings_post(&$a) { //$_SESSION['theme'] = $theme; - if($email_changed && $a->config['system']['register_policy'] == REGISTER_VERIFY) { + if($email_changed && App::$config['system']['register_policy'] == REGISTER_VERIFY) { // FIXME - set to un-verified, blocked and redirect to logout // Why? Are we verifying people or email addresses? @@ -581,7 +581,7 @@ function settings_content(&$a) { } - $channel = $a->get_channel(); + $channel = App::get_channel(); if($channel) head_set_icon($channel['xchan_photo_s']); @@ -697,7 +697,7 @@ function settings_content(&$a) { call_hooks('account_settings', $account_settings); - $email = $a->account['account_email']; + $email = App::$account['account_email']; $tpl = get_markup_template("settings_account.tpl"); @@ -890,7 +890,7 @@ function settings_content(&$a) { load_pconfig(local_channel(),'expire'); - $channel = $a->get_channel(); + $channel = App::get_channel(); $global_perms = get_perms(); @@ -935,8 +935,8 @@ function settings_content(&$a) { $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT); $sys_expire = get_config('system','default_expire_days'); -// $unkmail = $a->user['unkmail']; -// $cntunkmail = $a->user['cntunkmail']; +// $unkmail = App::$user['unkmail']; +// $cntunkmail = App::$user['cntunkmail']; $hide_presence = intval(get_pconfig(local_channel(), 'system','hide_online_status')); @@ -989,7 +989,7 @@ function settings_content(&$a) { )); - $subdir = ((strlen($a->get_path())) ? '
    ' . t('or') . ' ' . z_root() . '/channel/' . $nickname : ''); + $subdir = ((strlen(App::get_path())) ? '
    ' . t('or') . ' ' . z_root() . '/channel/' . $nickname : ''); $tpl_addr = get_markup_template("settings_nick_set.tpl"); @@ -997,7 +997,7 @@ function settings_content(&$a) { '$desc' => t('Your channel address is'), '$nickname' => $nickname, '$subdir' => $subdir, - '$basepath' => $a->get_hostname() + '$basepath' => App::get_hostname() )); $stpl = get_markup_template('settings.tpl'); diff --git a/mod/setup.php b/mod/setup.php index 84fb752c3..5dccc1711 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -60,7 +60,7 @@ function setup_post(&$a) { return; break; // just in case return don't return :) case 3: - $urlpath = $a->get_path(); + $urlpath = App::get_path(); $dbhost = trim($_POST['dbhost']); $dbport = intval(trim($_POST['dbport'])); $dbuser = trim($_POST['dbuser']); @@ -83,7 +83,7 @@ function setup_post(&$a) { if(! $db->connected) { echo 'Database Connect failed: ' . $db->error; killme(); - $a->data['db_conn_failed']=true; + App::$data['db_conn_failed']=true; } /*if(get_db_errno()) { unset($db); @@ -97,10 +97,10 @@ function setup_post(&$a) { unset($db); $db = new dba($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true); } else { - $a->data['db_create_failed']=true; + App::$data['db_create_failed']=true; } } else { - $a->data['db_conn_failed']=true; + App::$data['db_conn_failed']=true; return; } }*/ @@ -111,7 +111,7 @@ function setup_post(&$a) { return; break; case 4: - $urlpath = $a->get_path(); + $urlpath = App::get_path(); $dbhost = notags(trim($_POST['dbhost'])); $dbport = intval(notags(trim($_POST['dbport']))); $dbuser = notags(trim($_POST['dbuser'])); @@ -127,8 +127,8 @@ function setup_post(&$a) { if($siteurl != z_root()) { $test = z_fetch_url($siteurl."/setup/testrewrite"); if((! $test['success']) || ($test['body'] != 'ok')) { - $a->data['url_fail'] = true; - $a->data['url_error'] = $test['error']; + App::$data['url_fail'] = true; + App::$data['url_error'] = $test['error']; return; } } @@ -159,15 +159,15 @@ function setup_post(&$a) { $result = file_put_contents('.htconfig.php', $txt); if(! $result) { - $a->data['txt'] = $txt; + App::$data['txt'] = $txt; } $errors = load_database($db); if($errors) - $a->data['db_failed'] = $errors; + App::$data['db_failed'] = $errors; else - $a->data['db_installed'] = true; + App::$data['db_installed'] = true; return; break; @@ -196,31 +196,31 @@ function setup_content(&$a) { $wizard_status = ''; $install_title = t('$Projectname Server - Setup'); - if(x($a->data, 'db_conn_failed')) { + if(x(App::$data, 'db_conn_failed')) { $install_wizard_pass = 2; $wizard_status = t('Could not connect to database.'); } - if(x($a->data, 'url_fail')) { + if(x(App::$data, 'url_fail')) { $install_wizard_pass = 3; $wizard_status = t('Could not connect to specified site URL. Possible SSL certificate or DNS issue.'); - if($a->data['url_error']) - $wizard_status .= ' ' . $a->data['url_error']; + if(App::$data['url_error']) + $wizard_status .= ' ' . App::$data['url_error']; } - if(x($a->data, 'db_create_failed')) { + if(x(App::$data, 'db_create_failed')) { $install_wizard_pass = 2; $wizard_status = t('Could not create table.'); } $db_return_text = ''; - if(x($a->data, 'db_installed')) { + if(x(App::$data, 'db_installed')) { $txt = '

    '; $txt .= t('Your site database has been installed.') . EOL; $db_return_text .= $txt; } - if(x($a->data, 'db_failed')) { + if(x(App::$data, 'db_failed')) { $txt = t('You may need to import the file "install/schema_xxx.sql" manually using a database client.') . EOL; $txt .= t('Please see the file "install/INSTALL.txt".') . EOL ."


    " ; - $txt .= "
    ".$a->data['db_failed'] . "
    ". EOL ; + $txt .= "
    ".App::$data['db_failed'] . "
    ". EOL ; $db_return_text .= $txt; } if($db && $db->connected) { @@ -236,7 +236,7 @@ function setup_content(&$a) { } } - if(x($a->data, 'txt') && strlen($a->data['txt'])) { + if(x(App::$data, 'txt') && strlen(App::$data['txt'])) { $db_return_text .= manual_config($a); } @@ -676,7 +676,7 @@ function check_htaccess(&$checks) { function manual_config(&$a) { - $data = htmlspecialchars($a->data['txt'], ENT_COMPAT, 'UTF-8'); + $data = htmlspecialchars(App::$data['txt'], ENT_COMPAT, 'UTF-8'); $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.'); $o .= ""; diff --git a/mod/share.php b/mod/share.php index 198a6b210..c9adaf094 100644 --- a/mod/share.php +++ b/mod/share.php @@ -69,7 +69,7 @@ function share_init(&$a) { killme(); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $parsed = $observer['xchan_url']; if($parsed) { $post_url = $parsed['scheme'] . ':' . $parsed['host'] . (($parsed['port']) ? ':' . $parsed['port'] : '') diff --git a/mod/sharedwithme.php b/mod/sharedwithme.php index bee072ea7..27c238270 100644 --- a/mod/sharedwithme.php +++ b/mod/sharedwithme.php @@ -8,7 +8,7 @@ function sharedwithme_content(&$a) { return; } - $channel = $a->get_channel(); + $channel = App::get_channel(); $is_owner = (local_channel() && (local_channel() == $channel['channel_id'])); diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 19b566b73..7711fafb2 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -24,7 +24,7 @@ function siteinfo_content(&$a) { $version = $commit = ''; } $visible_plugins = array(); - if(is_array($a->plugins) && count($a->plugins)) { + if(is_array(App::$plugins) && count(App::$plugins)) { $r = q("select * from addon where hidden = 0"); if(count($r)) foreach($r as $rr) diff --git a/mod/smilies.php b/mod/smilies.php index b22d0c6d2..2ccc007b4 100644 --- a/mod/smilies.php +++ b/mod/smilies.php @@ -1,7 +1,7 @@ argv[1]==="json"){ + if (App::$argv[1]==="json"){ $tmp = list_smilies(); $results = array(); for($i = 0; $i < count($tmp['texts']); $i++) { diff --git a/mod/sources.php b/mod/sources.php index 0aaaa82b1..6ea0743aa 100644 --- a/mod/sources.php +++ b/mod/sources.php @@ -14,7 +14,7 @@ function sources_post(&$a) { $frequency = $_REQUEST['frequency']; $name = $_REQUEST['name']; - $channel = $a->get_channel(); + $channel = App::get_channel(); if($name == '*') $xchan = '*'; diff --git a/mod/subthread.php b/mod/subthread.php index 9438b545c..aca034d43 100755 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -37,7 +37,7 @@ function subthread_content(&$a) { $item = $r[0]; $owner_uid = $item['uid']; - $observer = $a->get_observer(); + $observer = App::get_observer(); $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); if(! perm_is_allowed($owner_uid,$ob_hash,'post_comments')) diff --git a/mod/suggest.php b/mod/suggest.php index ebe0e0f78..ca888310a 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -27,7 +27,7 @@ function suggest_content(&$a) { return; } - $_SESSION['return_url'] = z_root() . '/' . $a->cmd; + $_SESSION['return_url'] = z_root() . '/' . App::$cmd; $r = suggestion_query(local_channel(),get_observer_hash()); diff --git a/mod/tagger.php b/mod/tagger.php index eba02c9c4..330b65b91 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -100,7 +100,7 @@ function tagger_content(&$a) { $termlink = html_entity_decode('⋕') . '[zrl=' . z_root() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]'; - $channel = $a->get_channel(); + $channel = App::get_channel(); $arr = array(); diff --git a/mod/tasks.php b/mod/tasks.php index b1b81473b..e11166f93 100644 --- a/mod/tasks.php +++ b/mod/tasks.php @@ -37,7 +37,7 @@ function tasks_post(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); if((argc() > 2) && (argv(1) === 'complete') && intval(argv(2))) { $ret = array('success' => false); diff --git a/mod/thing.php b/mod/thing.php index 7e7d1bdc7..44e9d9e2e 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -14,7 +14,7 @@ function thing_init(&$a) { if(! local_channel()) return; - $channel = $a->get_channel(); + $channel = App::get_channel(); $term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : ''); @@ -264,7 +264,7 @@ function thing_content(&$a) { } } - $channel = $a->get_channel(); + $channel = App::get_channel(); if(! (local_channel() && $channel)) { notice( t('Permission denied.') . EOL); diff --git a/mod/uexport.php b/mod/uexport.php index ee22383a3..4a16903f8 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -5,7 +5,7 @@ function uexport_init(&$a) { killme(); if(argc() > 1) { - $channel = $a->get_channel(); + $channel = App::get_channel(); require_once('include/identity.php'); diff --git a/mod/view.php b/mod/view.php index d4381743c..f18646cb9 100644 --- a/mod/view.php +++ b/mod/view.php @@ -1,6 +1,6 @@ profile)) || ($a->profile['hide_friends']))) { + if(((! count(App::$profile)) || (App::$profile['hide_friends']))) { notice( t('Permission denied.') . EOL); return; } - if(! perm_is_allowed($a->profile['uid'], get_observer_hash(),'view_contacts')) { + if(! perm_is_allowed(App::$profile['uid'], get_observer_hash(),'view_contacts')) { notice( t('Permission denied.') . EOL); return; } if(! $_REQUEST['aj']) - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; - $is_owner = ((local_channel() && local_channel() == $a->profile['uid']) ? true : false); + $is_owner = ((local_channel() && local_channel() == App::$profile['uid']) ? true : false); $abook_flags = " and abook_pending = 0 and abook_self = 0 "; $sql_extra = ''; @@ -43,16 +43,16 @@ function viewconnections_content(&$a) { } $r = q("SELECT count(*) as total FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d $abook_flags and xchan_orphan = 0 and xchan_deleted = 0 $sql_extra ", - intval($a->profile['uid']) + intval(App::$profile['uid']) ); if($r) { - $a->set_pager_total($r[0]['total']); + App::set_pager_total($r[0]['total']); } $r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d $abook_flags and xchan_orphan = 0 and xchan_deleted = 0 $sql_extra order by xchan_name LIMIT %d OFFSET %d ", - intval($a->profile['uid']), - intval($a->pager['itemspage']), - intval($a->pager['start']) + intval(App::$profile['uid']), + intval(App::$pager['itemspage']), + intval(App::$pager['start']) ); if((! $r) && (! $_REQUEST['aj'])) { diff --git a/mod/viewsrc.php b/mod/viewsrc.php index cffb01b6e..a4efd1214 100644 --- a/mod/viewsrc.php +++ b/mod/viewsrc.php @@ -16,7 +16,7 @@ function viewsrc_content(&$a) { if(! $item_id) { - $a->error = 404; + App::$error = 404; notice( t('Item not found.') . EOL); } diff --git a/mod/wall_attach.php b/mod/wall_attach.php index f52a4f2e5..75786b479 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -8,9 +8,9 @@ function wall_attach_post(&$a) { $using_api = false; - if($a->data['api_info'] && array_key_exists('media',$_FILES)) { + if(App::$data['api_info'] && array_key_exists('media',$_FILES)) { $using_api = true; - $user_info = $a->data['api_info']; + $user_info = App::$data['api_info']; $nick = $user_info['screen_name']; $channel = get_channel_by_nick($user_info['screen_name']); } @@ -20,7 +20,7 @@ function wall_attach_post(&$a) { if(! $channel) killme(); - $observer = $a->get_observer(); + $observer = App::get_observer(); // if($_FILES['userfile']['tmp_name']) { diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 31a497f0f..54e2f8526 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -30,7 +30,7 @@ function wall_upload_post(&$a) { killme(); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $args = array( 'source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash'])); diff --git a/mod/webpages.php b/mod/webpages.php index 6b157073e..2196eb9fc 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -9,7 +9,7 @@ function webpages_init(&$a) { if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { - $a->is_sys = true; + App::$is_sys = true; } } @@ -25,24 +25,24 @@ function webpages_init(&$a) { function webpages_content(&$a) { - if(! $a->profile) { + if(! App::$profile) { notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + App::$error = 404; return; } $which = argv(1); - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_url'] = App::$query_string; $uid = local_channel(); $owner = 0; $channel = null; - $observer = $a->get_observer(); + $observer = App::get_observer(); - $channel = $a->get_channel(); + $channel = App::get_channel(); - if($a->is_sys && is_site_admin()) { + if(App::$is_sys && is_site_admin()) { $sys = get_sys_channel(); if($sys && intval($sys['channel_id'])) { $uid = $owner = intval($sys['channel_id']); @@ -84,8 +84,8 @@ function webpages_content(&$a) { // Nickname is set to the observers xchan, and profile_uid to the owner's. // This lets you post pages at other people's channels. - if((! $channel) && ($uid) && ($uid == $a->profile_uid)) { - $channel = $a->get_channel(); + if((! $channel) && ($uid) && ($uid == App::$profile_uid)) { + $channel = App::get_channel(); } if($channel) { $channel_acl = array( @@ -99,12 +99,12 @@ function webpages_content(&$a) { $channel_acl = array(); $is_owner = ($uid && $uid == $owner); - $o = profile_tabs($a, $is_owner, $a->profile['channel_address']); + $o = profile_tabs($a, $is_owner, App::$profile['channel_address']); $x = array( 'webpage' => ITEM_TYPE_WEBPAGE, 'is_owner' => true, - 'nickname' => $a->profile['channel_address'], + 'nickname' => App::$profile['channel_address'], 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), 'bang' => '', 'acl' => (($is_owner) ? populate_acl($channel_acl,false) : ''), diff --git a/mod/wfinger.php b/mod/wfinger.php index 5c1a74f10..445dbb349 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -32,7 +32,7 @@ function wfinger_init(&$a) { $channel = str_replace('acct:','',$resource); if(strpos($channel,'@') !== false) { $host = substr($channel,strpos($channel,'@')+1); - if(strcasecmp($host,get_app()->get_hostname())) { + if(strcasecmp($host,App::get_hostname())) { goaway('https://' . $host . '/.well-known/webfinger?f=&resource=' . $resource . (($zot) ? '&zot=' . $zot : '')); } $channel = substr($channel,0,strpos($channel,'@')); diff --git a/mod/xrd.php b/mod/xrd.php index 0719407f6..463cda662 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -29,7 +29,7 @@ function xrd_init(&$a) { $dspr = replace_macros(get_markup_template('xrd_diaspora.tpl'),array( '$baseurl' => z_root(), - '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',$a->get_hostname()), + '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',App::get_hostname()), '$dspr_key' => base64_encode(pemtorsa($r[0]['channel_pubkey'])) )); @@ -39,7 +39,7 @@ function xrd_init(&$a) { header("Content-type: application/xrd+xml"); - $aliases = array('acct:' . $r[0]['channel_address'] . '@' . $a->get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']); + $aliases = array('acct:' . $r[0]['channel_address'] . '@' . App::get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']); for($x = 0; $x < count($aliases); $x ++) { if($aliases[$x] === $resource) diff --git a/mod/zotfeed.php b/mod/zotfeed.php index fffb0e4ab..5041532ae 100644 --- a/mod/zotfeed.php +++ b/mod/zotfeed.php @@ -16,7 +16,7 @@ function zotfeed_init(&$a) { json_return_and_die($result); } - $observer = $a->get_observer(); + $observer = App::get_observer(); $channel_address = ((argc() > 1) ? argv(1) : ''); diff --git a/mod/zping.php b/mod/zping.php index 311517701..4cc4abb73 100644 --- a/mod/zping.php +++ b/mod/zping.php @@ -21,7 +21,7 @@ function zping_content(&$a) { return; - $m = zot_build_packet($a->get_channel(),'ping'); + $m = zot_build_packet(App::get_channel(),'ping'); $r = zot_zot($url,$m); return print_r($r,true); -- cgit v1.2.3 From 5d884c2f3dddabb475e4246fc9837e1ac3b5750f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 1 Apr 2016 00:59:30 -0700 Subject: suddenly we have includepath issues - provide the explicit paths --- mod/cal.php | 2 +- mod/editpost.php | 2 +- mod/rbmark.php | 2 +- mod/rpost.php | 2 +- mod/share.php | 2 +- mod/tagrm.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/cal.php b/mod/cal.php index ffefd895e..b58f3a1f1 100755 --- a/mod/cal.php +++ b/mod/cal.php @@ -5,7 +5,7 @@ require_once('include/bbcode.php'); require_once('include/datetime.php'); require_once('include/event.php'); require_once('include/items.php'); -require_once('Contact.php'); +require_once('include/Contact.php'); function cal_init(&$a) { diff --git a/mod/editpost.php b/mod/editpost.php index dffc9c0da..a433d91f4 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -1,6 +1,6 @@ Date: Sun, 3 Apr 2016 11:34:07 +0200 Subject: show chat expiration time in overview and minor fixes --- mod/chat.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index 211846964..75c364008 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -240,6 +240,8 @@ function chat_content(&$a) { '$newroom' => t('Create New'), '$is_owner' => ((local_channel() && local_channel() == App::$profile['profile_uid']) ? 1 : 0), '$chatroom_new' => $chatroom_new, + '$expire' => t('Expiration'), + '$expire_unit' => t('min') //minutes )); return $o; -- cgit v1.2.3 From bf3f3564e08754c3f91524798523839ae7b9094c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 3 Apr 2016 16:41:40 -0700 Subject: issue #138 ; make ajaxchat optional and configurable. For reasons we've discussed repeatedly the ajax chat will not be removed from core as XMPP chat does not provide decentralised access control compatible with nomadic identity. --- mod/chat.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mod') diff --git a/mod/chat.php b/mod/chat.php index 75c364008..375d069be 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -208,6 +208,12 @@ function chat_content(&$a) { $o = profile_tabs($a,((local_channel() && local_channel() == App::$profile['profile_uid']) ? true : false),App::$profile['channel_address']); + if(! feature_enabled(App::$profile['profile_uid'],'ajaxchat')) { + notice( t('Feature disabled.') . EOL); + return $o; + } + + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); -- cgit v1.2.3 From 2e7d2a63c33bc3047b9d743d965fbe3f51c56c3b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 3 Apr 2016 19:34:19 -0700 Subject: provide a backup copy of prior notes widget content if the contents were just nuked. --- mod/notes.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/notes.php b/mod/notes.php index 4bb97fc9e..9bf37d0f9 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -6,8 +6,18 @@ function notes_init(&$a) { return; $ret = array('success' => true); - if($_REQUEST['note_text'] || $_REQUEST['note_text'] == '') { + if(array_key_exists('note_text',$_REQUEST)) { $body = escape_tags($_REQUEST['note_text']); + + // I've had my notes vanish into thin air twice in four years. + // Provide a backup copy if there were contents previously + // and there are none being saved now. + + if(! $body) { + $old_text = get_pconfig(local_channel(),'notes','text'); + if($old_text) + set_pconfig(local_channel(),'notes','text.bak',$old_text); + } set_pconfig(local_channel(),'notes','text',$body); } -- cgit v1.2.3 From 9fd8634b62a728e3e6047319548e5029a3d89275 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 5 Apr 2016 21:10:08 -0700 Subject: server side of file/photo sync to deliver the file data. We'll sign it using our channel_hash and the current time to make it difficult to forge a request; as the sync process is not going to have magic-auth ability. --- mod/getfile.php | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 mod/getfile.php (limited to 'mod') diff --git a/mod/getfile.php b/mod/getfile.php new file mode 100644 index 000000000..8a8fa6465 --- /dev/null +++ b/mod/getfile.php @@ -0,0 +1,76 @@ + d1) || ($time < d2)) { + logger('time outside allowable range'); + killme(); + } + + if(! rsa_verify($hash . '.' . $time,base64url_decode($sig),$channel['channel_pubkey'])) { + logger('verify failed.'); + killme(); + } + + + $r = attach_by_hash($resource,$revision); + + if(! $r['success']) { + notice( $r['message'] . EOL); + return; + } + + + $unsafe_types = array('text/html','text/css','application/javascript'); + + if(in_array($r['data']['filetype'],$unsafe_types)) { + header('Content-type: text/plain'); + } + else { + header('Content-type: ' . $r['data']['filetype']); + } + + header('Content-disposition: attachment; filename="' . $r['data']['filename'] . '"'); + if(intval($r['data']['os_storage'])) { + $fname = dbunescbin($r['data']['data']); + if(strpos($fname,'store') !== false) + $istream = fopen($fname,'rb'); + else + $istream = fopen('store/' . $channel['channel_address'] . '/' . $fname,'rb'); + $ostream = fopen('php://output','wb'); + if($istream && $ostream) { + pipe_streams($istream,$ostream); + fclose($istream); + fclose($ostream); + } + } + else + echo dbunescbin($r['data']['data']); + killme(); + + + +} \ No newline at end of file -- cgit v1.2.3 From 10f1e2d51b25c8c770419317a7d5ca78ce0ccd6a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 5 Apr 2016 21:20:23 -0700 Subject: add some doco to getfile module --- mod/getfile.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'mod') diff --git a/mod/getfile.php b/mod/getfile.php index 8a8fa6465..16392f8dd 100644 --- a/mod/getfile.php +++ b/mod/getfile.php @@ -1,5 +1,25 @@ Date: Tue, 5 Apr 2016 23:11:24 -0700 Subject: provide function to collect file/photo sync data per help/filesync --- mod/getfile.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod') diff --git a/mod/getfile.php b/mod/getfile.php index 16392f8dd..6eca7ee34 100644 --- a/mod/getfile.php +++ b/mod/getfile.php @@ -21,6 +21,7 @@ require_once('include/Contact.php'); +require_once('include/attach.php'); function getfile_post(&$a) { -- cgit v1.2.3 From a20ef706fd6e7011a0dc95df71222b9a5871e3b3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 Apr 2016 05:44:40 -0700 Subject: issue #340 --- mod/help.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mod') diff --git a/mod/help.php b/mod/help.php index a266dbf7f..fb0339cd9 100644 --- a/mod/help.php +++ b/mod/help.php @@ -84,7 +84,21 @@ function doc_rank_sort($s1,$s2) { } +function load_context_help() { + + $path = App::$cmd; + $args = App::$argv; + + while($path) { + $context_help = load_doc_file('doc/context/' . $path . '/help.html'); + if($context_help) + break; + array_pop($args); + $path = implode($args,'/'); + } + return $context_help; +} function store_doc_file($s) { -- cgit v1.2.3 From 861f5232d3b6c5bd2cf8bd895f57424b730ce270 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 6 Apr 2016 19:56:38 -0700 Subject: more work on file sync to clones, 60-70% test coverage, mostly working but many changes made during testing which themselves have not yet been tested --- mod/getfile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/getfile.php b/mod/getfile.php index 6eca7ee34..c0916de79 100644 --- a/mod/getfile.php +++ b/mod/getfile.php @@ -46,7 +46,7 @@ function getfile_post(&$a) { $d1 = datetime_convert('UTC','UTC',"now + $slop minutes"); $d2 = datetime_convert('UTC','UTC',"now - $slop minutes"); - if(($time > d1) || ($time < d2)) { + if(($time > $d1) || ($time < $d2)) { logger('time outside allowable range'); killme(); } -- cgit v1.2.3 From 279f32b13deb45f3fe0ab2d32f6d2a0ea6e224e5 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 7 Apr 2016 18:54:48 -0700 Subject: send file sync packets for all known file operations --- mod/photos.php | 71 ++++++++++++++++++++++++++++++++++++----------------- mod/wall_attach.php | 17 ------------- 2 files changed, 49 insertions(+), 39 deletions(-) (limited to 'mod') diff --git a/mod/photos.php b/mod/photos.php index 0adbf752a..bf904db22 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -126,6 +126,34 @@ function photos_post(&$a) { if($_REQUEST['dropalbum'] == t('Delete Album')) { + + // This is dangerous because we combined file storage and photos into one interface + // This function will remove all photos from any directory with the same name since + // we have not passed the path value. + + // The correct solution would be to use a full pathname from your storage root for 'album' + // We also need to prevent/block removing the storage root folder. + + $folder_hash = ''; + + $r = q("select * from attach where is_dir = 1 and uid = %d and filename = '%s'", + intval($page_owner_uid), + dbesc($album) + ); + if(! $r) { + notice( t('Album not found.') . EOL); + return; + } + if(count($r) > 1) { + notice( t('Multiple storage folders exist with this album name, but within different directories. Please remove the desired folder or folders using the Files manager') . EOL); + return; + } + else { + $folder_hash = $r[0]['hash']; + } + + + $res = array(); // get the list of photos we are about to delete @@ -149,9 +177,6 @@ function photos_post(&$a) { if($r) { foreach($r as $i) { attach_delete($page_owner_uid, $i['resource_id'], 1 ); - // This is now being done in attach_delete() - // drop_item($i['id'],false,DROPITEM_PHASE1,true /* force removal of linked items */); - // proc_run('php','include/notifier.php','drop',$i['id']); } } @@ -163,6 +188,15 @@ function photos_post(&$a) { // @FIXME do the same for the linked attach + if($folder_hash) { + attach_delete($page_owner_uid,$folder_hash, 1); + + $sync = attach_export_data(App::$data['channel'],$folder_hash, true); + + if($sync) + build_sync_packet($page_owner_uid,array('file' => array($sync))); + } + } goaway(z_root() . '/photos/' . App::$data['channel']['channel_address']); @@ -183,23 +217,11 @@ function photos_post(&$a) { ); if($r) { -/* - q("DELETE FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'", - intval($page_owner_uid), - dbesc($r[0]['resource_id']) - ); -*/ attach_delete($page_owner_uid, $r[0]['resource_id'], 1 ); -/* - $i = q("SELECT * FROM `item` WHERE `resource_id` = '%s' AND resource_type = 'photo' and `uid` = %d LIMIT 1", - dbesc($r[0]['resource_id']), - intval($page_owner_uid) - ); - if(count($i)) { - drop_item($i[0]['id'],true,DROPITEM_PHASE1); - $url = z_root(); - } -*/ + $sync = attach_export_data(App::$data['channel'],$r[0]['resource_id'], true); + + if($sync) + build_sync_packet($page_owner_uid,array('file' => array($sync))); } goaway(z_root() . '/photos/' . App::$data['channel']['channel_address'] . '/album/' . $_SESSION['album_return']); @@ -218,7 +240,7 @@ function photos_post(&$a) { $acl->set_from_array($_POST); $perm = $acl->get(); - $resource_id = App::$argv[2]; + $resource_id = argv(2); if(! strlen($albname)) $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y'); @@ -443,6 +465,11 @@ function photos_post(&$a) { goaway(z_root() . '/' . $_SESSION['photo_return']); return; // NOTREACHED + $sync = attach_export_data(App::$data['channel'],$resource_id); + + if($sync) + build_sync_packet($page_owner_uid,array('file' => array($sync))); + } @@ -555,8 +582,8 @@ function photos_content(&$a) { $o = ""; - $o .= "\r\n"; + $o .= "\r\n"; // tabs diff --git a/mod/wall_attach.php b/mod/wall_attach.php index 75786b479..7f054705f 100644 --- a/mod/wall_attach.php +++ b/mod/wall_attach.php @@ -23,23 +23,6 @@ function wall_attach_post(&$a) { $observer = App::get_observer(); -// if($_FILES['userfile']['tmp_name']) { -// $x = @getimagesize($_FILES['userfile']['tmp_name']); -// logger('getimagesize: ' . print_r($x,true), LOGGER_DATA); -// if(($x) && ($x[2] === IMAGETYPE_GIF || $x[2] === IMAGETYPE_JPEG || $x[2] === IMAGETYPE_PNG)) { -// $args = array( 'source' => 'editor', 'visible' => 0, 'contact_allow' => array($channel['channel_hash'])); -// $ret = photo_upload($channel,$observer,$args); -// if($ret['success']) { -// echo "\n\n" . $ret['body'] . "\n\n"; -// killme(); -// } -// if($using_api) -// return; -// notice($ret['message']); -// killme(); -// } -// } - $def_album = get_pconfig($channel['channel_id'],'system','photo_path'); $def_attach = get_pconfig($channel['channel_id'],'system','attach_path'); -- cgit v1.2.3 From e2b4d33627d5f4cf5f68eb087059d86c78eec41e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 9 Apr 2016 12:16:42 +0200 Subject: some work on comanche autocomplete --- mod/blocks.php | 4 +++- mod/channel.php | 16 +++++++++------- mod/editblock.php | 4 +++- mod/editlayout.php | 3 ++- mod/editpost.php | 4 +++- mod/editwebpage.php | 5 +++-- mod/layouts.php | 3 ++- mod/network.php | 5 ++++- mod/webpages.php | 4 +++- 9 files changed, 32 insertions(+), 16 deletions(-) (limited to 'mod') diff --git a/mod/blocks.php b/mod/blocks.php index 96005e9a3..3c9274991 100644 --- a/mod/blocks.php +++ b/mod/blocks.php @@ -95,7 +95,9 @@ function blocks_content(&$a) { 'ptlabel' => t('Block Name'), 'profile_uid' => intval($owner), 'expanded' => true, - 'novoting' => true + 'novoting' => true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true ); if($_REQUEST['title']) diff --git a/mod/channel.php b/mod/channel.php index 88c420366..87ced9246 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -124,15 +124,17 @@ function channel_content(&$a, $update = 0, $load = false) { $x = array( 'is_owner' => $is_owner, - 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false), - 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''), - 'nickname' => App::$profile['channel_address'], - 'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl,true,((App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), + 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig(App::$profile['profile_uid'],'system','use_browser_location')))) ? true : false), + 'default_location' => (($is_owner) ? App::$profile['channel_location'] : ''), + 'nickname' => App::$profile['channel_address'], + 'lockstate' => (((strlen(App::$profile['channel_allow_cid'])) || (strlen(App::$profile['channel_allow_gid'])) || (strlen(App::$profile['channel_deny_cid'])) || (strlen(App::$profile['channel_deny_gid']))) ? 'lock' : 'unlock'), + 'acl' => (($is_owner) ? populate_acl($channel_acl,true,((App::$profile['channel_r_stream'] & PERMS_PUBLIC) ? t('Public') : '')) : ''), 'showacl' => (($is_owner) ? 'yes' : ''), - 'bang' => '', + 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), - 'profile_uid' => App::$profile['profile_uid'] + 'profile_uid' => App::$profile['profile_uid'], + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true ); $o .= status_editor($a,$x); diff --git a/mod/editblock.php b/mod/editblock.php index 35922e483..214c495dd 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -115,7 +115,8 @@ function editblock_content(&$a) { '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => '', '$nickname' => $channel['channel_address'], - '$confirmdelete' => t('Delete block?') + '$confirmdelete' => t('Delete block?'), + '$bbco_autocomplete'=> (($mimetype == 'text/bbcode') ? 'bbcode' : 'comanche-block') )); $tpl = get_markup_template("jot.tpl"); @@ -174,6 +175,7 @@ function editblock_content(&$a) { '$defexpire' => '', '$feature_expire' => false, '$expires' => t('Set expiration date'), + '$bbcode' => (($mimetype == 'text/bbcode') ? true : false) )); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( diff --git a/mod/editlayout.php b/mod/editlayout.php index 9c27afa30..0b58fe5fe 100644 --- a/mod/editlayout.php +++ b/mod/editlayout.php @@ -109,7 +109,8 @@ function editlayout_content(&$a) { '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => $geotag, '$nickname' => $channel['channel_address'], - '$confirmdelete' => t('Delete layout?') + '$confirmdelete' => t('Delete layout?'), + '$bbco_autocomplete'=> 'comanche' )); diff --git a/mod/editpost.php b/mod/editpost.php index a433d91f4..397254a48 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -54,7 +54,9 @@ function editpost_content(&$a) { '$geotag' => $geotag, '$nickname' => $channel['channel_address'], '$expireswhen' => t('Expires YYYY-MM-DD HH:MM'), - '$confirmdelete' => t('Delete item?'), + '$confirmdelete' => t('Delete item?'), + '$editor_autocomplete'=> true, + '$bbco_autocomplete'=> 'bbcode' )); if(intval($itm[0]['item_obscured'])) { diff --git a/mod/editwebpage.php b/mod/editwebpage.php index 445c31ad4..9f6df9536 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -150,7 +150,8 @@ function editwebpage_content(&$a) { '$ispublic' => ' ', // t('Visible to everybody'), '$geotag' => $geotag, '$nickname' => $channel['channel_address'], - '$confirmdelete' => t('Delete webpage?') + '$confirmdelete' => t('Delete webpage?'), + '$bbco_autocomplete'=> 'bbcode', )); $tpl = get_markup_template("jot.tpl"); @@ -215,7 +216,7 @@ function editwebpage_content(&$a) { '$defexpire' => '', '$feature_expire' => false, '$expires' => t('Set expiration date'), - + '$bbco_autocomplete'=> 'bbcode' )); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( diff --git a/mod/layouts.php b/mod/layouts.php index dbb005e08..e28c9a066 100644 --- a/mod/layouts.php +++ b/mod/layouts.php @@ -122,7 +122,8 @@ function layouts_content(&$a) { 'profile_uid' => intval($owner), 'expanded' => true, 'placeholdertitle' => t('Layout Description (Optional)'), - 'novoting' => true + 'novoting' => true, + 'bbco_autocomplete' => 'comanche' ); if($_REQUEST['title']) diff --git a/mod/network.php b/mod/network.php index e195ac496..5465cd064 100644 --- a/mod/network.php +++ b/mod/network.php @@ -169,7 +169,10 @@ function network_content(&$a, $update = 0, $load = false) { '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() + 'profile_uid' => local_channel(), + 'editor_autocomplete' => true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true ); if($deftag) $x['pretext'] = $deftag; diff --git a/mod/webpages.php b/mod/webpages.php index 2196eb9fc..c20a147da 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -114,7 +114,9 @@ function webpages_content(&$a) { 'mimetype' => $mimetype, 'layout' => $layout, 'expanded' => true, - 'novoting' => true + 'novoting'=> true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true ); if($_REQUEST['title']) -- cgit v1.2.3 From 46ed79c87a23f442eadc4244b62a6f85f3d431e8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 9 Apr 2016 12:27:36 +0200 Subject: fix autocomplete for /channel and /display --- mod/channel.php | 1 + mod/display.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index 87ced9246..2ef911bbb 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -133,6 +133,7 @@ function channel_content(&$a, $update = 0, $load = false) { 'bang' => '', 'visitor' => (($is_owner || $observer) ? true : false), 'profile_uid' => App::$profile['profile_uid'], + 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', 'bbcode' => true ); diff --git a/mod/display.php b/mod/display.php index e4a6a0e66..ef140d454 100644 --- a/mod/display.php +++ b/mod/display.php @@ -65,7 +65,10 @@ function display_content(&$a, $update = 0, $load = false) { 'visitor' => true, 'profile_uid' => local_channel(), 'return_path' => 'channel/' . $channel['channel_address'], - 'expanded' => true + 'expanded' => true, + 'editor_autocomplete' => true, + 'bbco_autocomplete' => 'bbcode', + 'bbcode' => true ); $o = '
    '; -- cgit v1.2.3 From abfbe9c9375c7505e0422b8adc1d9d5426d7df1a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 10 Apr 2016 16:56:08 -0700 Subject: a few issues: block public not blocking mod_cal, typo in sql for one clone file sync operation, fix_system_urls not catching cached contact photos, extend sessionhandler expiration when remember_me is enabled as the stored session is expiring long before the browser session. --- mod/cal.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mod') diff --git a/mod/cal.php b/mod/cal.php index b58f3a1f1..56d65d3f2 100755 --- a/mod/cal.php +++ b/mod/cal.php @@ -45,6 +45,11 @@ function cal_init(&$a) { function cal_content(&$a) { + if((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) { + return; + } + + $channel = null; if(argc() > 1) { -- cgit v1.2.3 From 1b83d88fe66b8d0185b748874e3f15b763778c99 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 11 Apr 2016 13:03:34 -0700 Subject: remove references to ref_session_write - can't use --- mod/import.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'mod') diff --git a/mod/import.php b/mod/import.php index e0c2ffa82..b14b97777 100644 --- a/mod/import.php +++ b/mod/import.php @@ -165,7 +165,6 @@ function import_account(&$a, $account_id) { logger('import step 2'); $_SESSION['import_step'] = 2; - ref_session_write(session_id(), serialize($_SESSION)); } @@ -181,7 +180,6 @@ function import_account(&$a, $account_id) { logger('import step 3'); $_SESSION['import_step'] = 3; - ref_session_write(session_id(), serialize($_SESSION)); } @@ -193,7 +191,6 @@ function import_account(&$a, $account_id) { } logger('import step 4'); $_SESSION['import_step'] = 4; - ref_session_write(session_id(), serialize($_SESSION)); } if($completed < 5) { @@ -225,7 +222,6 @@ function import_account(&$a, $account_id) { } logger('import step 5'); $_SESSION['import_step'] = 5; - ref_session_write(session_id(), serialize($_SESSION)); } @@ -262,7 +258,6 @@ function import_account(&$a, $account_id) { } logger('import step 6'); $_SESSION['import_step'] = 6; - ref_session_write(session_id(), serialize($_SESSION)); } if($completed < 7) { @@ -323,7 +318,7 @@ function import_account(&$a, $account_id) { } logger('import step 7'); $_SESSION['import_step'] = 7; - ref_session_write(session_id(), serialize($_SESSION)); + } @@ -399,7 +394,6 @@ function import_account(&$a, $account_id) { } logger('import step 8'); $_SESSION['import_step'] = 8; - ref_session_write(session_id(), serialize($_SESSION)); } @@ -449,7 +443,6 @@ function import_account(&$a, $account_id) { } logger('import step 9'); $_SESSION['import_step'] = 9; - ref_session_write(session_id(), serialize($_SESSION)); } if(is_array($data['obj'])) -- cgit v1.2.3 From 09861abab7ba79f50801623f6dfc9d3278c40942 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 11 Apr 2016 20:53:08 -0700 Subject: when saving bookmarks from a post allow choice of bookmark to be saved (default is all of them); this implements the backend. Additional work will be required on the front end or within plugins to make this happen. --- mod/bookmarks.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/bookmarks.php b/mod/bookmarks.php index 02fe2f2e1..5c48ce5a9 100644 --- a/mod/bookmarks.php +++ b/mod/bookmarks.php @@ -4,6 +4,8 @@ function bookmarks_init(&$a) { if(! local_channel()) return; $item_id = intval($_REQUEST['item']); + $burl = trim($_REQUEST['burl']); + if(! $item_id) return; @@ -36,7 +38,14 @@ function bookmarks_init(&$a) { killme(); } foreach($terms as $t) { - bookmark_add($u,$s[0],$t,$item['item_private']); + if($burl) { + if($burl == $t['url']) { + bookmark_add($u,$s[0],$t,$item['item_private']); + } + } + else + bookmark_add($u,$s[0],$t,$item['item_private']); + info( t('Bookmark added') . EOL); } } -- cgit v1.2.3 From 91cc36514306e827c126ceed6c17486c85f5544c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 12 Apr 2016 22:55:26 -0700 Subject: reverse the logic of the jsenabled setting so that sessions without js are performance penalised instead of regular sessions. --- mod/channel.php | 10 +++++----- mod/display.php | 12 ++++++------ mod/network.php | 2 +- mod/nojs.php | 9 +++++++++ 4 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 mod/nojs.php (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index 2ef911bbb..9119f91a6 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -209,7 +209,7 @@ function channel_content(&$a, $update = 0, $load = false) { App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); - if($load || ($_COOKIE['jsAvailable'] != 1)) { + if($load || ($_COOKIE['jsdisabled'] == 1)) { if ($mid) { $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", @@ -338,13 +338,13 @@ function channel_content(&$a, $update = 0, $load = false) { } - if($_COOKIE['jsAvailable'] == 1) { - $o .= conversation($a,$items,'channel',$update,$page_mode); - } else { + if($_COOKIE['jsdisabled'] == 1) { $o .= conversation($a,$items,'channel',$update,'traditional'); + } else { + $o .= conversation($a,$items,'channel',$update,$page_mode); } - if((! $update) || ($_COOKIE['jsAvailable'] != 1)) { + if((! $update) || ($_COOKIE['jsdisabled'] == 1)) { $o .= alt_pager($a,count($items)); if ($mid && $items[0]['title']) App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; diff --git a/mod/display.php b/mod/display.php index ef140d454..9c50eb9c0 100644 --- a/mod/display.php +++ b/mod/display.php @@ -168,13 +168,13 @@ function display_content(&$a, $update = 0, $load = false) { $sql_extra = public_permissions_sql($observer_hash); - if(($update && $load) || ($_COOKIE['jsAvailable'] != 1)) { + if(($update && $load) || ($_COOKIE['jsdisabled'] == 1)) { $updateable = false; $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']),intval(App::$pager['start'])); - if($load || ($_COOKIE['jsAvailable'] != 1)) { + if($load || ($_COOKIE['jsdisabled'] == 1)) { $r = null; require_once('include/identity.php'); @@ -290,13 +290,13 @@ function display_content(&$a, $update = 0, $load = false) { } - if ($_COOKIE['jsAvailable'] == 1) { - $o .= conversation($a, $items, 'display', $update, 'client'); - } else { + if ($_COOKIE['jsdisabled'] == 1) { $o .= conversation($a, $items, 'display', $update, 'traditional'); if ($items[0]['title']) App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; - + } + else { + $o .= conversation($a, $items, 'display', $update, 'client'); } if($updateable) { diff --git a/mod/network.php b/mod/network.php index 5465cd064..e6d02f572 100644 --- a/mod/network.php +++ b/mod/network.php @@ -13,7 +13,7 @@ function network_init(&$a) { return; } - if((count($_GET) < 2) || (count($_GET) < 3 && $_GET['JS'])) { + if(count($_GET) < 2) { $network_options = get_pconfig(local_channel(),'system','network_page_default'); if($network_options) goaway('network' . '?f=&' . $network_options); diff --git a/mod/nojs.php b/mod/nojs.php new file mode 100644 index 000000000..3d894d13e --- /dev/null +++ b/mod/nojs.php @@ -0,0 +1,9 @@ + Date: Wed, 13 Apr 2016 11:56:43 +0200 Subject: some bbcode autocomplete refinement for edit webpage --- mod/editwebpage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod') diff --git a/mod/editwebpage.php b/mod/editwebpage.php index 9f6df9536..7cf738989 100644 --- a/mod/editwebpage.php +++ b/mod/editwebpage.php @@ -151,7 +151,7 @@ function editwebpage_content(&$a) { '$geotag' => $geotag, '$nickname' => $channel['channel_address'], '$confirmdelete' => t('Delete webpage?'), - '$bbco_autocomplete'=> 'bbcode', + '$bbco_autocomplete'=> (($mimetype == 'text/bbcode') ? 'bbcode' : '') )); $tpl = get_markup_template("jot.tpl"); @@ -216,7 +216,7 @@ function editwebpage_content(&$a) { '$defexpire' => '', '$feature_expire' => false, '$expires' => t('Set expiration date'), - '$bbco_autocomplete'=> 'bbcode' + '$bbcode' => (($mimetype == 'text/bbcode') ? true : false) )); $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( -- cgit v1.2.3 From 9a0b61e4afed94727679eee966afb76e1add2beb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 13 Apr 2016 16:31:06 -0700 Subject: refactor the js detection into a checkjs class which is only enabled on demand (currently only the channel and display pages). Will probably require a bit more work to hide/disable the cover photo when js is disabled. Have not actually tested without js to discover any other potential page issues. Have only confirmed that the detection class works and redirects to set a jsdisabled cookie and reload the page with that cookie+variable set if called from the channel page. --- mod/channel.php | 7 ++++--- mod/display.php | 10 +++++++--- mod/nojs.php | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'mod') diff --git a/mod/channel.php b/mod/channel.php index 9119f91a6..9bc7332dc 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -54,6 +54,7 @@ function channel_content(&$a, $update = 0, $load = false) { if($load) $_SESSION['loadtime'] = datetime_convert(); + $checkjs = new Zotlabs\Web\CheckJS(); $category = $datequery = $datequery2 = ''; @@ -209,7 +210,7 @@ function channel_content(&$a, $update = 0, $load = false) { App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start'])); - if($load || ($_COOKIE['jsdisabled'] == 1)) { + if($load || ($checkjs->disabled())) { if ($mid) { $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", @@ -338,13 +339,13 @@ function channel_content(&$a, $update = 0, $load = false) { } - if($_COOKIE['jsdisabled'] == 1) { + if($checkjs->disabled()) { $o .= conversation($a,$items,'channel',$update,'traditional'); } else { $o .= conversation($a,$items,'channel',$update,$page_mode); } - if((! $update) || ($_COOKIE['jsdisabled'] == 1)) { + if((! $update) || ($checkjs->disabled())) { $o .= alt_pager($a,count($items)); if ($mid && $items[0]['title']) App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; diff --git a/mod/display.php b/mod/display.php index 9c50eb9c0..2844a1205 100644 --- a/mod/display.php +++ b/mod/display.php @@ -5,6 +5,10 @@ function display_content(&$a, $update = 0, $load = false) { // logger("mod-display: update = $update load = $load"); + + $checkjs = new Zotlabs\Web\CheckJS(); + + if($load) $_SESSION['loadtime'] = datetime_convert(); @@ -168,13 +172,13 @@ function display_content(&$a, $update = 0, $load = false) { $sql_extra = public_permissions_sql($observer_hash); - if(($update && $load) || ($_COOKIE['jsdisabled'] == 1)) { + if(($update && $load) || ($checkjs->disabled())) { $updateable = false; $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']),intval(App::$pager['start'])); - if($load || ($_COOKIE['jsdisabled'] == 1)) { + if($load || ($checkjs->disabled())) { $r = null; require_once('include/identity.php'); @@ -290,7 +294,7 @@ function display_content(&$a, $update = 0, $load = false) { } - if ($_COOKIE['jsdisabled'] == 1) { + if ($checkjs->disabled()) { $o .= conversation($a, $items, 'display', $update, 'traditional'); if ($items[0]['title']) App::$page['title'] = $items[0]['title'] . " - " . App::$page['title']; diff --git a/mod/nojs.php b/mod/nojs.php index 3d894d13e..c6e04a72b 100644 --- a/mod/nojs.php +++ b/mod/nojs.php @@ -4,6 +4,7 @@ function nojs_init(&$a) { setcookie('jsdisabled', 1, 0); $p = $_GET['query']; - goaway(z_root() . (($p) ? '/' . $p : '')); + $hasq = strpos($p,'?'); + goaway(z_root() . (($p) ? '/' . $p : '') . (($hasq) ? '' : '?f=' ) . '&jsdisabled=1'); } \ No newline at end of file -- cgit v1.2.3 From a8f7af20798de3bde73023c6e3f2b540e985767b Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 14 Apr 2016 18:51:06 -0700 Subject: provide general purpose verification class, remove include/session.php (no longer used) --- mod/magic.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'mod') diff --git a/mod/magic.php b/mod/magic.php index 2f746507b..74adbfd6d 100644 --- a/mod/magic.php +++ b/mod/magic.php @@ -135,13 +135,9 @@ function magic_init(&$a) { $channel['token'] = $token; $channel['token_sig'] = $token_sig; - $r = q("insert into verify ( type, channel, token, meta, created) values ('%s','%d','%s','%s','%s')", - dbesc('auth'), - intval($channel['channel_id']), - dbesc($token), - dbesc($x[0]['hubloc_url']), - dbesc(datetime_convert()) - ); + + Zotlabs\Zot\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']); + $target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode($channel['channel_address'] . '@' . App::get_hostname()) . '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION; -- cgit v1.2.3