diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/admin.php | 14 | ||||
-rw-r--r-- | mod/connections.php | 140 | ||||
-rw-r--r-- | mod/connedit.php | 177 | ||||
-rw-r--r-- | mod/directory.php | 35 | ||||
-rw-r--r-- | mod/display.php | 6 | ||||
-rw-r--r-- | mod/editblock.php | 15 | ||||
-rw-r--r-- | mod/editlayout.php | 16 | ||||
-rw-r--r-- | mod/editpost.php | 14 | ||||
-rwxr-xr-x | mod/events.php | 22 | ||||
-rw-r--r-- | mod/import.php | 70 | ||||
-rwxr-xr-x | mod/like.php | 3 | ||||
-rw-r--r-- | mod/lostpass.php | 5 | ||||
-rw-r--r-- | mod/menu.php | 2 | ||||
-rw-r--r-- | mod/mitem.php | 9 | ||||
-rw-r--r-- | mod/profile_photo.php | 4 | ||||
-rwxr-xr-x | mod/setup.php | 2 | ||||
-rw-r--r-- | mod/thing.php | 28 | ||||
-rw-r--r-- | mod/uexport.php | 14 |
18 files changed, 273 insertions, 303 deletions
diff --git a/mod/admin.php b/mod/admin.php index 74abc0b34..beb629396 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -680,7 +680,7 @@ function admin_page_users_post($a) { intval($users[$i]) ); } - notice( sprintf( tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)), count($users)) ); + notice( sprintf( tt("%s account blocked/unblocked", "%s account blocked/unblocked", count($users)), count($users)) ); } // account delete button was submitted if (x($_POST, 'page_users_delete')) { @@ -688,7 +688,7 @@ function admin_page_users_post($a) { foreach ($users as $uid){ account_remove($uid, true, false); } - notice( sprintf( tt("%s user deleted", "%s users deleted", count($users)), count($users)) ); + notice( sprintf( tt("%s account deleted", "%s accounts deleted", count($users)), count($users)) ); } // registration approved button was submitted if (x($_POST, 'page_users_approve')) { @@ -736,7 +736,7 @@ function admin_page_users(&$a){ require_once('include/Contact.php'); account_remove($uid,true,false); - notice( sprintf(t("User '%s' deleted"), $account[0]['account_email']) . EOL); + notice( sprintf(t("Account '%s' deleted"), $account[0]['account_email']) . EOL); break; case 'block': q("UPDATE account SET account_flags = ( account_flags | %d ) WHERE account_id = %d", @@ -744,7 +744,7 @@ function admin_page_users(&$a){ intval($uid) ); - notice( sprintf( t("User '%s' blocked") , $account[0]['account_email']) . EOL); + notice( sprintf( t("Account '%s' blocked") , $account[0]['account_email']) . EOL); break; case 'unblock': q("UPDATE account SET account_flags = ( account_flags & ~%d ) WHERE account_id = %d", @@ -752,7 +752,7 @@ function admin_page_users(&$a){ intval($uid) ); - notice( sprintf( t("User '%s' unblocked"), $account[0]['account_email']) . EOL); + notice( sprintf( t("Account '%s' unblocked"), $account[0]['account_email']) . EOL); break; } @@ -830,8 +830,8 @@ function admin_page_users(&$a){ '$h_users' => t('Users'), '$th_users' => array( t('ID'), t('Email'), t('All Channels'), t('Register date'), t('Last login'), t('Expires'), t('Service Class')), - '$confirm_delete_multi' => t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'), - '$confirm_delete' => t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'), + '$confirm_delete_multi' => t('Selected accounts will be deleted!\n\nEverything these accounts had posted on this site will be permanently deleted!\n\nAre you sure?'), + '$confirm_delete' => t('The account {0} will be deleted!\n\nEverything this account has posted on this site will be permanently deleted!\n\nAre you sure?'), '$form_security_token' => get_form_security_token("admin_users"), diff --git a/mod/connections.php b/mod/connections.php index 469d3a62f..8b95cbf2a 100644 --- a/mod/connections.php +++ b/mod/connections.php @@ -19,146 +19,6 @@ function connections_init(&$a) { } -function connections_post(&$a) { - - if(! local_channel()) - return; - - $contact_id = intval(argv(1)); - if(! $contact_id) - return; - - $orig_record = q("SELECT * FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", - intval($contact_id), - intval(local_channel()) - ); - - if(! $orig_record) { - notice( t('Could not access contact record.') . EOL); - goaway(z_root() . '/connections'); - return; // NOTREACHED - } - - call_hooks('contact_edit_post', $_POST); - - $profile_id = $_POST['profile_assign']; - if($profile_id) { - $r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1", - dbesc($profile_id), - intval(local_channel()) - ); - if(! count($r)) { - notice( t('Could not locate selected profile.') . EOL); - return; - } - } - - $hidden = intval($_POST['hidden']); - - $priority = intval($_POST['poll']); - if($priority > 5 || $priority < 0) - $priority = 0; - - $closeness = intval($_POST['closeness']); - if($closeness < 0) - $closeness = 99; - - $abook_my_perms = 0; - - foreach($_POST as $k => $v) { - if(strpos($k,'perms_') === 0) { - $abook_my_perms += $v; - } - } - - $abook_flags = $orig_record[0]['abook_flags']; - $new_friend = false; - - - if(($_REQUEST['pending']) && ($abook_flags & ABOOK_FLAG_PENDING)) { - $abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING ); - $new_friend = true; - } - - $r = q("UPDATE abook SET abook_profile = '%s', abook_my_perms = %d , abook_closeness = %d, abook_flags = %d - where abook_id = %d AND abook_channel = %d", - dbesc($profile_id), - intval($abook_my_perms), - intval($closeness), - intval($abook_flags), - intval($contact_id), - intval(local_channel()) - ); - - if($r) - info( t('Connection updated.') . EOL); - else - notice( t('Failed to update connection record.') . EOL); - - if((x($a->data,'abook')) && $a->data['abook']['abook_my_perms'] != $abook_my_perms - && (! ($a->data['abook']['abook_flags'] & ABOOK_FLAG_SELF))) { - proc_run('php', 'include/notifier.php', 'permission_update', $contact_id); - } - - if($new_friend) { - $channel = $a->get_channel(); - $default_group = $channel['channel_default_group']; - if($default_group) { - require_once('include/group.php'); - $g = group_rec_byhash(local_channel(),$default_group); - if($g) - group_add_member(local_channel(),'',$a->data['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) - // and send out a new friend activity - // TODO - - // pull in a bit of content if there is any to pull in - proc_run('php','include/onepoll.php',$contact_id); - - } - - // Refresh the structure in memory with the new data - - $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($contact_id) - ); - if($r) { - $a->data['abook'] = $r[0]; - } - - if($new_friend) { - $arr = array('channel_id' => local_channel(), 'abook' => $a->data['abook']); - call_hooks('accept_follow', $arr); - } - - connections_clone($a); - - return; - -} - -function connections_clone(&$a) { - - if(! array_key_exists('abook',$a->data)) - return; - $clone = $a->data['abook']; - - unset($clone['abook_id']); - unset($clone['abook_account']); - unset($clone['abook_channel']); - - build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); -} - - function connections_content(&$a) { $sort_type = 0; diff --git a/mod/connedit.php b/mod/connedit.php index 71166b2cc..0944a3dca 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -144,7 +144,6 @@ function connedit_post(&$a) { dbesc($orig_record[0]['abook_xchan']) ); - 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' @@ -314,6 +313,18 @@ function connedit_clone(&$a) { if(! $a->poi) return; + + $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']) + ); + if($r) { + $a->poi = $r[0]; + } + + $clone = $a->poi; unset($clone['abook_id']); @@ -398,9 +409,9 @@ function connedit_content(&$a) { if($cmd === 'block') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED)) { - info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_BLOCKED) - ? t('Channel has been unblocked') - : t('Channel has been blocked')) . EOL ); + // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_BLOCKED) + // ? t('Channel has been unblocked') + // : t('Channel has been blocked')) . EOL ); connedit_clone($a); } else @@ -410,9 +421,9 @@ function connedit_content(&$a) { if($cmd === 'ignore') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED)) { - info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_IGNORED) - ? t('Channel has been unignored') - : t('Channel has been ignored')) . EOL ); + // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_IGNORED) + // ? t('Channel has been unignored') + // : t('Channel has been ignored')) . EOL ); connedit_clone($a); } else @@ -422,9 +433,9 @@ function connedit_content(&$a) { if($cmd === 'archive') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED)) { - info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_ARCHIVED) - ? t('Channel has been unarchived') - : t('Channel has been archived')) . EOL ); + // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_ARCHIVED) + // ? t('Channel has been unarchived') + // : t('Channel has been archived')) . EOL ); connedit_clone($a); } else @@ -434,9 +445,9 @@ function connedit_content(&$a) { if($cmd === 'hide') { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN)) { - info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_HIDDEN) - ? t('Channel has been unhidden') - : t('Channel has been hidden')) . EOL ); + // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_HIDDEN) + // ? t('Channel has been unhidden') + // : t('Channel has been hidden')) . EOL ); connedit_clone($a); } else @@ -450,9 +461,9 @@ function connedit_content(&$a) { if($cmd === 'approve') { if($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) { if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_PENDING)) { - info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) - ? t('Channel has been approved') - : t('Channel has been unapproved')) . EOL ); + // info((($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) + // ? t('Channel has been approved') + // : t('Channel has been unapproved')) . EOL ); connedit_clone($a); } else @@ -493,59 +504,62 @@ function connedit_content(&$a) { $contact_id = $a->poi['abook_id']; $contact = $a->poi; + $buttons = array( - $tabs = array( - - array( + 'view' => array( 'label' => t('View Profile'), 'url' => chanlink_cid($contact['abook_id']), 'sel' => '', 'title' => sprintf( t('View %s\'s profile'), $contact['xchan_name']), ), - array( + 'refresh' => array( 'label' => t('Refresh Permissions'), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/refresh', 'sel' => '', 'title' => t('Fetch updated permissions'), ), - array( + 'recent' => array( 'label' => t('Recent Activity'), 'url' => $a->get_baseurl(true) . '/network/?f=&cid=' . $contact['abook_id'], 'sel' => '', 'title' => t('View recent posts and comments'), - ) - ); + ), - $buttons = array( - array( + 'block' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? t('Unblock') : t('Block')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/block', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? 'active' : ''), 'title' => t('Block (or Unblock) all communications with this connection'), + 'info' => (($contact['abook_flags'] & ABOOK_FLAG_BLOCKED) ? t('This connection is blocked!') : ''), ), - array( + 'ignore' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? t('Unignore') : t('Ignore')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/ignore', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? 'active' : ''), 'title' => t('Ignore (or Unignore) all inbound communications from this connection'), + 'info' => (($contact['abook_flags'] & ABOOK_FLAG_IGNORED) ? t('This connection is ignored!') : ''), ), - array( + + 'archive' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? t('Unarchive') : t('Archive')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/archive', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? 'active' : ''), 'title' => t('Archive (or Unarchive) this connection - mark channel dead but keep content'), + 'info' => (($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) ? t('This connection is archived!') : ''), ), - array( + + 'hide' => array( 'label' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? t('Unhide') : t('Hide')), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/hide', 'sel' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? 'active' : ''), 'title' => t('Hide or Unhide this connection from your other connections'), + 'info' => (($contact['abook_flags'] & ABOOK_FLAG_HIDDEN) ? t('This connection is hidden!') : ''), ), - array( + 'delete' => array( 'label' => t('Delete'), 'url' => $a->get_baseurl(true) . '/connedit/' . $contact['abook_id'] . '/drop', 'sel' => '', @@ -556,18 +570,9 @@ function connedit_content(&$a) { $self = false; - if(! ($contact['abook_flags'] & ABOOK_FLAG_SELF)) { - $tab_tpl = get_markup_template('common_tabs.tpl'); - $t = replace_macros($tab_tpl, array('$tabs'=>$tabs)); - } - else + if(($contact['abook_flags'] & ABOOK_FLAG_SELF)) $self = true; - $a->page['htmlhead'] .= replace_macros(get_markup_template('contact_head.tpl'), array( - '$baseurl' => $a->get_baseurl(true), - '$editselect' => $editselect - )); - require_once('include/contact_selectors.php'); $tpl = get_markup_template("abook_edit.tpl"); @@ -616,7 +621,6 @@ function connedit_content(&$a) { $rating_text = $xl[0]['xlink_rating_text']; } - $poco_rating = get_config('system','poco_rating_enable'); // if unset default to enabled @@ -640,101 +644,78 @@ function connedit_content(&$a) { $global_perms = get_perms(); $existing = get_all_perms(local_channel(),$contact['abook_xchan']); - $unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication')); - + $unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication'), array(t('No'),('Yes'))); + + $multiprofs = ((feature_enabled(local_channel(),'multi_profiles')) ? true : false); + + if($slide && !$multiprofs) + $affinity = t('Set Affinity'); + + if(!$slide && $multiprofs) + $affinity = t('Set Profile'); + + if($slide && $multiprofs) + $affinity = t('Set Affinity & Profile'); + foreach($global_perms as $k => $v) { $thisperm = (($contact['abook_my_perms'] & $v[1]) ? "1" : ''); + $checkinherited = ((($channel[$v[0]]) && ($channel[$v[0]] != PERMS_SPECIFIC)) ? "1" : ''); // For auto permissions (when $self is true) we don't want to look at existing // permissions because they are enabled for the channel owner - if((! $self) && ($existing[$k])) $thisperm = "1"; - $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC || $self) ? '' : '1'), $v[4]); + $perms[] = array('perms_' . $k, $v[3], (($contact['abook_their_perms'] & $v[1]) ? "1" : ""),$thisperm, $v[1], (($channel[$v[0]] == PERMS_SPECIFIC) ? '' : '1'), $v[4], $checkinherited); } $o .= replace_macros($tpl,array( - '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connections: settings for %s'),$contact['xchan_name'])), - '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), ''), + '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])), + '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), 'Connection requests will be approved without your interaction', array(t('No'),('Yes'))), '$addr' => $contact['xchan_addr'], + '$addr_text' => t('This connection\'s address is'), '$notself' => (($self) ? '' : '1'), '$self' => (($self) ? '1' : ''), - '$autolbl' => t('Apply the permissions indicated on this page to all new connections.'), + '$autolbl' => t('The permissions indicated on this page will be applied to all new connections.'), '$buttons' => (($self) ? '' : $buttons), - '$viewprof' => t('View Profile'), - '$clickme' => t('Click to open/close'), '$lbl_slider' => t('Slide to adjust your degree of friendship'), - '$lbl_rating' => t('Rating (this information is public)'), - '$lbl_rating_txt' => t('Optionally explain your rating (this information is public)'), + '$lbl_rating' => t('Rating'), + '$lbl_rating_label' => t('Slide to adjust your rating'), + '$lbl_rating_txt' => t('Optionally explain your rating'), '$connfilter' => feature_enabled(local_channel(),'connfilter'), + '$connfilter_label' => t('Custom Filter'), '$incl' => array('abook_incl',t('Only import posts with this text'), $contact['abook_incl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')), '$excl' => array('abook_excl',t('Do not import posts with this text'), $contact['abook_excl'],t('words one per line or #tags or /patterns/, leave blank to import all posts')), - '$rating_text' => array('rating_text', t('Optionally explain your rating (this information is public)'),$rating_text,''), + '$rating_text' => array('rating_text', t('Optionally explain your rating'),$rating_text,''), + '$rating_info' => t('This information is public!'), '$rating' => $rating, '$rating_val' => $rating_val, '$slide' => $slide, - '$tabs' => $t, - '$tab_str' => $tab_str, - '$perms_step1' => t('Default permissions for your channel type have (just) been applied. They have not yet been submitted. Please review the permissions on this page and make any desired changes at this time. This new connection may <em>not</em> be able to communicate with you until you submit this page, which will install and apply the selected permissions.'), + '$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' => (($contact['abook_flags'] & ABOOK_FLAG_PENDING) ? 1 : ''), '$unapproved' => $unapproved, '$inherited' => t('inherited'), - '$approve' => t('Approve this connection'), - '$noperms' => (($contact['abook_my_perms']) ? false : true), - '$no_perms' => (((! $self) && (! $contact['abook_my_perms'])) ? t('Connection has no individual permissions!') : ''), - '$noperm_desc' => (((! $self) && (! $contact['abook_my_perms'])) ? t('This may be appropriate based on your <a href="settings">privacy settings</a>, though you may wish to review the "Advanced Permissions".') : ''), '$submit' => t('Submit'), - '$lbl_vis1' => t('Profile Visibility'), '$lbl_vis2' => sprintf( t('Please choose the profile you would like to display to %s when viewing your profile securely.'), $contact['xchan_name']), - '$lbl_info1' => t('Contact Information / Notes'), - '$infedit' => t('Edit contact notes'), '$close' => $contact['abook_closeness'], '$them' => t('Their Settings'), '$me' => t('My Settings'), '$perms' => $perms, - '$perms_new' => t('Default permissions for this channel type have (just) been applied. They have <em>not</em> been saved and there are currently no stored default permissions. Please review/edit the applied settings and click [Submit] to finalize.'), - '$clear' => t('Clear/Disable Automatic Permissions'), - '$forum' => t('Forum Members'), - '$soapbox' => t('Soapbox'), - '$full' => t('Full Sharing (typical social network permissions)'), - '$cautious' => t('Cautious Sharing '), - '$follow' => t('Follow Only'), '$permlbl' => t('Individual Permissions'), - '$permnote' => t('Some permissions may be inherited from your channel <a href="settings">privacy settings</a>, which have higher priority than individual settings. Changing those inherited settings on this page will have no effect.'), - '$advanced' => t('Advanced Permissions'), - '$quick' => t('Simple Permissions (select one and submit)'), - '$common_link' => $a->get_baseurl(true) . '/common/loc/' . local_channel() . '/' . $contact['id'], - '$all_friends' => $all_friends, - '$relation_text' => $relation_text, - '$visit' => sprintf( t('Visit %s\'s profile - %s'),$contact['xchan_name'],$contact['xchan_url']), - '$blockunblock' => t('Block/Unblock contact'), - '$ignorecont' => t('Ignore contact'), - '$lblcrepair' => t("Repair URL settings"), - '$lblrecent' => t('View conversations'), - '$lblsuggest' => $lblsuggest, - '$delete' => t('Delete contact'), - - '$poll_interval' => contact_poll_interval($contact['priority'],(! $poll_enabled)), - '$poll_enabled' => $poll_enabled, + '$permnote' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can <strong>not</strong> change those settings here.'), + '$permnote_self' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can change those settings here but they wont have any impact unless the inherited setting changes.'), '$lastupdtext' => t('Last update:'), - '$lost_contact' => $lost_contact, - '$updpub' => t('Update public posts'), '$last_update' => relative_date($contact['abook_connected']), - '$udnow' => t('Update now'), '$profile_select' => contact_profile_assign($contact['abook_profile']), - '$multiprofs' => feature_enabled(local_channel(),'multi_profiles'), + '$multiprofs' => $multiprofs, '$contact_id' => $contact['abook_id'], - '$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ), - '$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ), - '$blocked' => (($contact['blocked']) ? t('Currently blocked') : ''), - '$ignored' => (($contact['readonly']) ? t('Currently ignored') : ''), - '$archived' => (($contact['archive']) ? t('Currently archived') : ''), - '$pending' => (($contact['archive']) ? t('Currently pending') : ''), - '$name' => $contact['name'], - '$alt_text' => $alt_text, - '$url' => $url + '$name' => $contact['xchan_name'], )); diff --git a/mod/directory.php b/mod/directory.php index 6d066a21b..44d80cff1 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -19,6 +19,7 @@ function directory_init(&$a) { $observer = get_observer_hash(); $global_changed = false; $safe_changed = false; + $pubforums_changed = false; if(array_key_exists('global',$_REQUEST)) { $globaldir = intval($_REQUEST['global']); @@ -28,7 +29,7 @@ function directory_init(&$a) { $_SESSION['globaldir'] = $globaldir; if($observer) set_xconfig($observer,'directory','globaldir',$globaldir); - } + } if(array_key_exists('safe',$_REQUEST)) { $safemode = intval($_REQUEST['safe']); @@ -37,9 +38,19 @@ function directory_init(&$a) { if($safe_changed) { $_SESSION['safemode'] = $safemode; if($observer) - set_xconfig($observer,'directory','safe_mode',$safemode); - } + set_xconfig($observer,'directory','safemode',$safemode); + } + + if(array_key_exists('pubforums',$_REQUEST)) { + $pubforums = intval($_REQUEST['pubforums']); + $pubforums_changed = true; + } + if($pubforums_changed) { + $_SESSION['pubforums'] = $pubforums; + if($observer) + set_xconfig($observer,'directory','pubforums',$pubforums); + } } function directory_content(&$a) { @@ -51,18 +62,14 @@ function directory_content(&$a) { $observer = get_observer_hash(); - $globaldir = get_globaldir_setting($observer); + $globaldir = get_directory_setting($observer, 'globaldir'); // override your personal global search pref if we're doing a navbar search of the directory if(intval($_REQUEST['navsearch'])) $globaldir = 1; - $safe_mode = get_safemode_setting($observer); + $safe_mode = get_directory_setting($observer, 'safemode'); - $pubforums = null; - if(array_key_exists('pubforums',$_REQUEST)) - $pubforums = intval($_REQUEST['pubforums']); - if(! $pubforums) - $pubforums = null; + $pubforums = get_directory_setting($observer, 'pubforums'); $o = ''; nav_set_selected('directory'); @@ -375,7 +382,13 @@ function directory_content(&$a) { '$entries' => $entries, '$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle, '$submit' => t('Find'), - '$next' => alt_pager($a,$j['records'], t('next page'), t('previous page')) + '$next' => alt_pager($a,$j['records'], t('next page'), t('previous page')), + '$sort' => t('Sort options'), + '$normal' => t('Alphabetic'), + '$reverse' => t('Reverse Alphabetic'), + '$date' => t('Newest to Oldest'), + '$reversedate' => t('Oldest to Newest'), + '$suggest' => $suggest ? '&suggest=1' : '' )); diff --git a/mod/display.php b/mod/display.php index b5daea2de..8c4707bb2 100644 --- a/mod/display.php +++ b/mod/display.php @@ -52,6 +52,7 @@ function display_content(&$a, $update = 0, $load = false) { 'deny_gid' => $channel['channel_deny_gid'] ); + $x = array( 'is_owner' => true, 'allow_location' => ((intval(get_pconfig($channel['channel_id'],'system','use_browser_location'))) ? '1' : ''), @@ -63,10 +64,13 @@ function display_content(&$a, $update = 0, $load = false) { 'bang' => '', 'visitor' => true, 'profile_uid' => local_channel(), - 'return_path' => 'channel/' . $channel['channel_address'] + 'return_path' => 'channel/' . $channel['channel_address'], + 'expanded' => true ); + $o = '<div id="jot-popup">'; $o .= status_editor($a,$x); + $o .= '</div>'; } diff --git a/mod/editblock.php b/mod/editblock.php index a0ece8133..faa283b63 100644 --- a/mod/editblock.php +++ b/mod/editblock.php @@ -108,12 +108,6 @@ function editblock_content(&$a) { else $mimeselect = mimetype_select($itm[0]['uid'],$mimetype); - $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( - '$title' => t('Edit Block'), - '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), - '$id' => $itm[0]['id'] - )); - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), @@ -133,7 +127,7 @@ function editblock_content(&$a) { $rp = 'blocks/' . $channel['channel_address']; - $o .= replace_macros($tpl,array( + $editor = replace_macros($tpl,array( '$return_path' => $rp, '$action' => 'item', '$webpage' => ITEM_BUILDBLOCK, @@ -181,6 +175,13 @@ function editblock_content(&$a) { '$expires' => t('Set expiration date'), )); + $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( + '$title' => t('Edit Block'), + '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), + '$id' => $itm[0]['id'], + '$editor' => $editor + )); + return $o; } diff --git a/mod/editlayout.php b/mod/editlayout.php index 8ab5aab22..a39611a58 100644 --- a/mod/editlayout.php +++ b/mod/editlayout.php @@ -101,12 +101,6 @@ function editlayout_content(&$a) { $layout_title = $item_id[0]['sid']; $plaintext = true; - - $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( - '$title' => t('Edit Layout'), - '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), - '$id' => $itm[0]['id'] - )); $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), @@ -132,7 +126,7 @@ function editlayout_content(&$a) { $rp = 'layouts/' . $which; - $o .= replace_macros($tpl,array( + $editor = replace_macros($tpl,array( '$return_path' => $rp, '$action' => 'item', '$webpage' => ITEM_PDL, @@ -178,6 +172,14 @@ function editlayout_content(&$a) { '$expires' => t('Set expiration date'), )); + + $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( + '$title' => t('Edit Layout'), + '$delete' => ((($itm[0]['author_xchan'] === $ob_hash) || ($itm[0]['owner_xchan'] === $ob_hash)) ? t('Delete') : false), + '$id' => $itm[0]['id'], + '$editor' => $editor + )); + return $o; } diff --git a/mod/editpost.php b/mod/editpost.php index 81bb91b2a..e907a07d0 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -38,11 +38,6 @@ function editpost_content(&$a) { $channel = $a->get_channel(); - $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( - '$title' => t('Edit post') - )); - - $a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'), @@ -53,8 +48,6 @@ function editpost_content(&$a) { '$confirmdelete' => t('Delete item?'), )); - - if($itm[0]['item_flags'] & ITEM_OBSCURED) { $key = get_config('system','prvkey'); if($itm[0]['title']) @@ -107,7 +100,7 @@ function editpost_content(&$a) { $cipher = 'aes256'; - $o .= replace_macros($tpl,array( + $editor = replace_macros($tpl,array( '$return_path' => $_SESSION['return_url'], '$action' => 'item', '$share' => t('Edit'), @@ -161,6 +154,11 @@ function editpost_content(&$a) { '$expiryModalCANCEL' => t('Cancel'), )); + $o .= replace_macros(get_markup_template('edpost_head.tpl'), array( + '$title' => t('Edit post'), + '$editor' => $editor + )); + return $o; } diff --git a/mod/events.php b/mod/events.php index 289ddfb15..9c94d433d 100755 --- a/mod/events.php +++ b/mod/events.php @@ -13,6 +13,20 @@ function events_post(&$a) { if(! local_channel()) return; + if(($_FILES) && array_key_exists('userfile',$_FILES) && intval($_FILES['userfile']['size'])) { + $src = $_FILES['userfile']['tmp_name']; + if($src) { + $result = parse_ical_file($src,local_channel()); + if($result) + info( t('Calendar entries imported.') . EOL); + else + notice( t('No calendar entries found.') . EOL); + @unlink($src); + } + goaway(z_root() . '/events'); + } + + $event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0); $event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : ''); @@ -148,10 +162,9 @@ function events_post(&$a) { } } else { - // Note: do not set `private` field for self-only events. It will - // keep even you from seeing them! $str_contact_allow = '<' . $channel['channel_hash'] . '>'; $str_group_allow = $str_contact_deny = $str_group_deny = ''; + $private_event = true; } } @@ -450,6 +463,7 @@ function events_content(&$a) { if($export) { header('Content-type: text/calendar'); + header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"' ); echo ical_wrapper($r); killme(); } @@ -476,8 +490,8 @@ function events_content(&$a) { '$export' => array($a->get_baseurl()."/events/$y/$m/export",t('Export'),'',''), '$calendar' => cal($y,$m,$links, ' eventcal'), '$events' => $events, - - + '$upload' => t('Import'), + '$submit' => t('Submit') )); if (x($_GET,'id')){ echo $o; killme(); } diff --git a/mod/import.php b/mod/import.php index 9877ce9f3..24780b6c4 100644 --- a/mod/import.php +++ b/mod/import.php @@ -225,10 +225,36 @@ function import_post(&$a) { foreach($hublocs as $hubloc) { $arr = array( 'guid' => $hubloc['hubloc_guid'], - 'guid_sig' => $hubloc['guid_sig'], + 'guid_sig' => $hubloc['hubloc_guid_sig'], 'url' => $hubloc['hubloc_url'], 'url_sig' => $hubloc['hubloc_url_sig'] ); + + $hash = make_xchan_hash($hubloc['hubloc_guid'],$hubloc['hubloc_guid_sig']); + if($hubloc['hubloc_network'] === 'zot' && $hash !== $hubloc['hubloc_hash']) { + logger('forged hubloc: ' . print_r($hubloc,true)); + continue; + } + + if(array_key_exists('hubloc_primary',$hubloc)) { + if(intval($hubloc['hubloc_primary'])) { + $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_PRIMARY; + unset($hubloc['hubloc_primary']); + } + if(intval($hubloc['hubloc_orphancheck'])) { + $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_ORPHANCHECK; + unset($hubloc['hubloc_orphancheck']); + } + if(intval($hubloc['hubloc_deleted'])) { + $hubloc['hubloc_flags'] |= HUBLOC_FLAGS_DELETED; + unset($hubloc['hubloc_deleted']); + } + if(intval($hubloc['hubloc_error'])) { + $hubloc['hubloc_status'] |= HUBLOC_ERROR; + unset($hubloc['hubloc_error']); + } + } + if(($hubloc['hubloc_hash'] === $channel['channel_hash']) && ($hubloc['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) && ($seize)) $hubloc['hubloc_flags'] = ($hubloc['hubloc_flags'] ^ HUBLOC_FLAGS_PRIMARY); @@ -308,6 +334,12 @@ function import_post(&$a) { if($xchans) { foreach($xchans as $xchan) { + $hash = make_xchan_hash($xchan['xchan_guid'],$xchan['xchan_guid_sig']); + if($xchan['xchan_network'] === 'zot' && $hash !== $xchan['xchan_hash']) { + logger('forged xchan: ' . print_r($xchan,true)); + continue; + } + $r = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", dbesc($xchan['xchan_hash']) ); @@ -353,11 +385,37 @@ function import_post(&$a) { $abooks = $data['abook']; if($abooks) { foreach($abooks as $abook) { - if($max_friends !== false && $friends > $max_friends) - continue; - if($max_feeds !== false && ($abook['abook_flags'] & ABOOK_FLAG_FEED) && $feeds > $max_feeds) - continue; + if(array_key_exists('abook_blocked',$abook) && intval($abook['abook_blocked'])) { + $abook['abook_flags'] |= ABOOK_FLAG_BLOCKED; + } + if(array_key_exists('abook_ignored',$abook) && intval($abook['abook_ignored'])) { + $abook['abook_flags'] |= ABOOK_FLAG_IGNORED; + } + if(array_key_exists('abook_hidden',$abook) && intval($abook['abook_hidden'])) { + $abook['abook_flags'] |= ABOOK_FLAG_HIDDEN; + } + if(array_key_exists('abook_archived',$abook) && intval($abook['abook_archived'])) { + $abook['abook_flags'] |= ABOOK_FLAG_ARCHIVED; + } + if(array_key_exists('abook_pending',$abook) && intval($abook['abook_pending'])) { + $abook['abook_flags'] |= ABOOK_FLAG_PENDING; + } + if(array_key_exists('abook_unconnected',$abook) && intval($abook['abook_unconnected'])) { + $abook['abook_flags'] |= ABOOK_FLAG_UNCONNECTED; + } + if(array_key_exists('abook_self',$abook) && intval($abook['abook_self'])) { + $abook['abook_flags'] |= ABOOK_FLAG_SELF; + } + if(array_key_exists('abook_feed',$abook) && intval($abook['abook_feed'])) { + $abook['abook_flags'] |= ABOOK_FLAG_FEED; + } + if(! ( $abook['abook_flags'] & ABOOK_FLAG_SELF)) { + if($max_friends !== false && $friends > $max_friends) + continue; + if($max_feeds !== false && ($abook['abook_flags'] & ABOOK_FLAG_FEED) && $feeds > $max_feeds) + continue; + } unset($abook['abook_id']); $abook['abook_account'] = get_account_id(); $abook['abook_channel'] = $channel['channel_id']; @@ -414,7 +472,7 @@ function import_post(&$a) { } $group_members = $data['group_member']; - if($groups_members) { + if($group_members) { foreach($group_members as $group_member) { unset($group_member['id']); $group_member['uid'] = $channel['channel_id']; diff --git a/mod/like.php b/mod/like.php index e79ff5f48..8789b7633 100755 --- a/mod/like.php +++ b/mod/like.php @@ -473,11 +473,12 @@ function like_content(&$a) { if($extended_like) { - $r = q("insert into likes (channel_id,liker,likee,iid,verb,target_type,target_id,target) values (%d,'%s','%s',%d,'%s','%s','%s','%s')", + $r = q("insert into likes (channel_id,liker,likee,iid,i_mid,verb,target_type,target_id,target) values (%d,'%s','%s',%d,'%s','%s','%s','%s','%s')", intval($ch[0]['channel_id']), dbesc($observer['xchan_hash']), dbesc($ch[0]['channel_hash']), intval($post_id), + dbesc($mid), dbesc($activity), dbesc(($tgttype)?$tgttype:$objtype), dbesc($obj_id), diff --git a/mod/lostpass.php b/mod/lostpass.php index 3269128f1..3dbc2fe7d 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -72,10 +72,11 @@ function lostpass_content(&$a) { $salt = random_string(32); $password_encoded = hash('whirlpool', $salt . $new_password); - - $r = q("UPDATE account SET account_salt = '%s', account_password = '%s', account_reset = '' where account_id = %d", + + $r = q("UPDATE account SET account_salt = '%s', account_password = '%s', account_reset = '', account_flags = (account_flags & ~%d) where account_id = %d", dbesc($salt), dbesc($password_encoded), + intval(ACCOUNT_UNVERIFIED), intval($aid) ); diff --git a/mod/menu.php b/mod/menu.php index f46dc9471..7763c4ed1 100644 --- a/mod/menu.php +++ b/mod/menu.php @@ -137,7 +137,9 @@ function menu_content(&$a) { $o = replace_macros(get_markup_template('menuedit.tpl'), array( '$header' => t('Edit Menu'), + '$sys' => $a->is_sys, '$menu_id' => intval(argv(1)), + '$menu_edit_link' => 'mitem/' . intval(argv(1)) . (($a->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/mitem.php b/mod/mitem.php index c4c293d1e..bc93165ac 100644 --- a/mod/mitem.php +++ b/mod/mitem.php @@ -44,9 +44,6 @@ function mitem_post(&$a) { if(! $a->data['menu']) return; - - $channel = $a->get_channel(); - if(!$_REQUEST['mitem_desc'] || !$_REQUEST['mitem_link']) { notice( t('Unable to create element.') . EOL); return; @@ -90,9 +87,6 @@ function mitem_post(&$a) { } - - - } @@ -167,7 +161,8 @@ function mitem_content(&$a) { '$submit_more' => t('Submit and continue'), '$display' => $display, '$lockstate' => $lockstate, - '$menu_names' => $menu_names + '$menu_names' => $menu_names, + '$sys' => $a->is_sys )); $o .= replace_macros(get_markup_template('mitemlist.tpl'),array( diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 597b5f66d..c70e8fc94 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -135,7 +135,7 @@ function profile_photo_post(&$a) { $im = photo_factory($base_image['data'], $base_image['type']); if($im->is_valid()) { - $im->cropImage(175,$srcX,$srcY,$srcW,$srcH); + $im->cropImage(300,$srcX,$srcY,$srcW,$srcH); $aid = get_account_id(); @@ -411,7 +411,7 @@ function profile_photo_crop_ui_head(&$a, $ph){ $width = $ph->getWidth(); $height = $ph->getHeight(); - if($width < 175 || $height < 175) { + if($width < 300 || $height < 300) { $ph->scaleImageUp(200); $width = $ph->getWidth(); $height = $ph->getHeight(); diff --git a/mod/setup.php b/mod/setup.php index d88cf73f1..bba29921e 100755 --- a/mod/setup.php +++ b/mod/setup.php @@ -729,6 +729,6 @@ function what_next() { ."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') .t('Please see the file "install/INSTALL.txt".') ."</p><p>" - .t("Go to your new Red node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.") + .t("Go to your new hub <a href='$baseurl/register'>registration page</a> and register as new member. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.") ."</p>"; } diff --git a/mod/thing.php b/mod/thing.php index c6b70fbb4..842832d16 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -92,6 +92,20 @@ function thing_init(&$a) { ); info( t('Thing updated') . EOL); + + $datestamp = datetime_convert(); + + $r = q("select obj.*, term.term as obj_term, term.url as obj_url, term.imgurl as obj_imgurl, '%s' as obj_created, '%s' as obj_edited, '%s' as obj_baseurl from obj left join term on obj_obj = term.term_hash where obj_channel = %d and term.term_hash = '%s'", + dbesc($datestamp), + dbesc($datestamp), + dbesc(z_root()), + intval(local_channel()), + dbesc($term_hash) + ); + + if($r) + build_sync_packet(0,array('obj' => $r)); + return; } @@ -156,6 +170,20 @@ function thing_init(&$a) { info( t('Thing added')); + $datestamp = datetime_convert(); + + $r = q("select obj.*, term.term as obj_term, term.url as obj_url, term.imgurl as obj_imgurl, '%s' as obj_created, '%s' as obj_edited, '%s' as obj_baseurl from obj left join term on obj_obj = term.term_hash where obj_channel = %d and term.term_hash = '%s' ", + dbesc($datestamp), + dbesc($datestamp), + dbesc(z_root()), + intval(local_channel()), + dbesc($term['term_hash']) + ); + + if($r) + build_sync_packet(0,array('obj' => $r)); + + if($activity) { $arr = array(); $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $term['url'])); diff --git a/mod/uexport.php b/mod/uexport.php index edcb2fa84..fbbe9953b 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -9,9 +9,21 @@ function uexport_init(&$a) { require_once('include/identity.php'); + if(argc() > 1 && intval(argv(1)) > 1900) { + $year = intval(argv(1)); + } + + if(argc() > 2 && intval(argv(2)) > 0 && intval(argv(2)) <= 12) { + $month = intval(argv(2)); + } + header('content-type: application/octet_stream'); - header('content-disposition: attachment; filename="' . $channel['channel_address'] . '.json"' ); + header('content-disposition: attachment; filename="' . $channel['channel_address'] . (($year) ? '-' . $year : '') . (($month) ? '-' . $month : '') . '.json"' ); + if($year) { + echo json_encode(identity_export_year(local_channel(),$year,$month)); + killme(); + } if(argc() > 1 && argv(1) === 'basic') { echo json_encode(identity_basic_export(local_channel())); |