aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/acl.php20
-rw-r--r--mod/admin.php14
-rw-r--r--mod/channel.php3
-rw-r--r--mod/chanview.php6
-rw-r--r--mod/connections.php57
-rw-r--r--mod/dirsearch.php15
-rw-r--r--mod/display.php4
-rw-r--r--mod/editpost.php2
-rw-r--r--mod/editwebpage.php106
-rw-r--r--mod/home.php50
-rw-r--r--mod/item.php43
-rwxr-xr-xmod/like.php3
-rw-r--r--mod/message.php1
-rw-r--r--mod/network.php5
-rw-r--r--mod/page.php19
-rw-r--r--mod/photos.php134
-rw-r--r--mod/profile.php26
-rw-r--r--mod/profiles.php8
-rw-r--r--mod/search.php16
-rw-r--r--mod/settings.php24
-rw-r--r--mod/tagger.php5
-rw-r--r--mod/thing.php196
-rw-r--r--mod/webpages.php76
-rw-r--r--mod/zfinger.php12
24 files changed, 688 insertions, 157 deletions
diff --git a/mod/acl.php b/mod/acl.php
index dea0047f2..df6de13b2 100644
--- a/mod/acl.php
+++ b/mod/acl.php
@@ -123,7 +123,7 @@ function acl_init(&$a){
}
if ($type=='' || $type=='c') {
- $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
+ $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
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d AND not ( abook_flags & %d ) $sql_extra2 order by xchan_name asc" ,
intval(local_user()),
@@ -142,7 +142,7 @@ function acl_init(&$a){
);
}
elseif($type == 'a') {
- $r = q("SELECT abook_id as id, xchan_name as name, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag FROM abook left join xchan on abook_xchan = xchan_hash
+ $r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
$sql_extra3
ORDER BY xchan_name ASC ",
@@ -196,13 +196,15 @@ function acl_init(&$a){
if(count($r)) {
foreach($r as $g){
$contacts[] = array(
- "type" => "c",
- "photo" => $g['micro'],
- "name" => $g['name'],
- "id" => $g['id'],
- "xid" => $g['hash'],
- "link" => $g['nick'],
- "nick" => substr($g['nick'],0,strpos($g['nick'],'@'))
+ "type" => "c",
+ "photo" => $g['micro'],
+ "name" => $g['name'],
+ "id" => $g['id'],
+ "xid" => $g['hash'],
+ "link" => $g['nick'],
+ "nick" => substr($g['nick'],0,strpos($g['nick'],'@')),
+ "network" => '',
+ "taggable" => (($g['abook_their_perms'] & PERMS_W_TAGWALL) ? 'taggable' : '')
);
}
}
diff --git a/mod/admin.php b/mod/admin.php
index 670e89066..224a41867 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -212,6 +212,7 @@ function admin_page_site_post(&$a){
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : '');
$theme_mobile = ((x($_POST,'theme-mobile')) ? notags(trim($_POST['theme-mobile'])) : '');
$theme_accessibility = ((x($_POST,'theme-accessibility')) ? notags(trim($_POST['theme-accessibility'])) : '');
+ $site_channel = ((x($_POST,'site-channel')) ? notags(trim($_POST['site-channel'])) : '');
$maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0);
@@ -280,7 +281,7 @@ function admin_page_site_post(&$a){
set_config('system','delivery_interval',$delivery_interval);
set_config('system','poll_interval',$poll_interval);
set_config('system','maxloadavg',$maxloadavg);
- set_config('config','sitename',$sitename);
+ set_config('system','sitename',$sitename);
if ($banner=="") {
del_config('system','banner');
@@ -301,6 +302,8 @@ function admin_page_site_post(&$a){
} else {
set_config('system','accessibility-theme', $theme_accessibility);
}
+
+ set_config('system','site-channel', $site_channel);
set_config('system','maximagesize', $maximagesize);
set_config('system','register_policy', $register_policy);
@@ -349,7 +352,7 @@ function admin_page_site(&$a) {
$lang_choices[$t[1]] = $t[1];
}
}
-
+
/* Installed themes */
$theme_choices = array();
$theme_choices_mobile = array();
@@ -402,16 +405,17 @@ function admin_page_site(&$a) {
'$baseurl' => $a->get_baseurl(true),
// name, label, value, help string, extra data...
- '$sitename' => array('sitename', t("Site name"), htmlentities($a->config['sitename'], ENT_QUOTES), ""),
+ '$sitename' => array('sitename', t("Site name"), htmlentities(get_config('system','sitename'), ENT_QUOTES), ""),
'$banner' => array('banner', t("Banner/Logo"), $banner, ""),
'$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices),
'$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $theme_choices),
'$theme_mobile' => array('theme-mobile', t("Mobile system theme"), get_config('system','mobile-theme'), t("Theme for mobile devices"), $theme_choices_mobile),
'$theme_accessibility' => array('theme-accessibility', t("Accessibility system theme"), get_config('system','accessibility-theme'), t("Accessibility theme"), $theme_choices_accessibility),
+ '$site_channel' => array('site-channel', t("Channel to use for this website's static pages"), get_config('system','site-channel'), t("Site Channel")),
'$ssl_policy' => array('ssl_policy', t("SSL link policy"), (string) intval(get_config('system','ssl_policy')), t("Determines whether generated links should be forced to use SSL"), $ssl_choices),
'$maximagesize' => array('maximagesize', t("Maximum image size"), get_config('system','maximagesize'), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")),
- '$register_policy' => array('register_policy', t("Register policy"), $a->config['system']['register_policy'], "", $register_choices),
- '$register_text' => array('register_text', t("Register text"), htmlentities($a->config['register_text'], ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")),
+ '$register_policy' => array('register_policy', t("Register policy"), get_config('system','register_policy'), "", $register_choices),
+ '$register_text' => array('register_text', t("Register text"), htmlentities(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")),
'$abandon_days' => array('abandon_days', t('Accounts abandoned after x days'), get_config('system','account_abandon_days'), t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')),
'$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")),
diff --git a/mod/channel.php b/mod/channel.php
index 1442070a9..c7b631c96 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -47,6 +47,9 @@ function channel_aside(&$a) {
$a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$a->profile['profile_uid'],true));
$a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$cat));
}
+ if(feature_enabled($a->profile['profile_uid'],'tagadelic'))
+ $a->set_widget('tagcloud',tagblock('search',$a->profile['profile_uid'],50,$a->profile['channel_hash'],ITEM_WALL));
+
}
diff --git a/mod/chanview.php b/mod/chanview.php
index 8de59b92e..4f7638846 100644
--- a/mod/chanview.php
+++ b/mod/chanview.php
@@ -29,7 +29,11 @@ function chanview_content(&$a) {
);
}
elseif($_REQUEST['url']) {
- $r = q("select * from xchan where xchan_url = '%s' limit 1",
+
+ // if somebody re-installed they will have more than one xchan, use the most recent name date as this is
+ // the most useful consistently ascending table item we have.
+
+ $r = q("select * from xchan where xchan_url = '%s' order by xchan_name_date desc limit 1",
dbesc($_REQUEST['url'])
);
}
diff --git a/mod/connections.php b/mod/connections.php
index ff3edfeaa..1b97412d4 100644
--- a/mod/connections.php
+++ b/mod/connections.php
@@ -23,6 +23,11 @@ function connections_init(&$a) {
$a->data['abook'] = $r[0];
}
}
+
+ $channel = $a->get_channel();
+ if($channel)
+ head_set_icon($channel['xchan_photo_s']);
+
}
function connections_aside(&$a) {
@@ -63,10 +68,10 @@ function connections_post(&$a) {
call_hooks('contact_edit_post', $_POST);
- $profile_id = intval($_POST['profile-assign']);
+ $profile_id = $_POST['profile-assign'];
if($profile_id) {
- $r = q("SELECT `id` FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($profile_id),
+ $r = q("SELECT profile_guid FROM profile WHERE profile_guid = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($profile_id),
intval(local_user())
);
if(! count($r)) {
@@ -99,9 +104,9 @@ function connections_post(&$a) {
$abook_flags = ( $abook_flags ^ ABOOK_FLAG_PENDING );
}
- $r = q("UPDATE abook SET abook_profile = %d, abook_my_perms = %d , abook_closeness = %d, abook_flags = %d
+ $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 LIMIT 1",
- intval($profile_id),
+ dbesc($profile_id),
intval($abook_my_perms),
intval($closeness),
intval($abook_flags),
@@ -126,13 +131,27 @@ function connections_post(&$a) {
intval(local_user()),
intval($contact_id)
);
- if($r)
+ if($r) {
$a->data['abook'] = $r[0];
+ }
+
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']);
+ require_once('include/settings.php');
+ build_sync_packet(0 /* use the current local_user */, array('abook' => array($clone)));
+}
function connections_content(&$a) {
@@ -183,40 +202,48 @@ function connections_content(&$a) {
}
if($cmd === 'block') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_BLOCKED))
+ 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 );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
}
if($cmd === 'ignore') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_IGNORED))
+ 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 );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
}
if($cmd === 'archive') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_ARCHIVED))
+ 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 );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
}
if($cmd === 'hide') {
- if(abook_toggle_flag($orig_record[0],ABOOK_FLAG_HIDDEN))
+ 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 );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
goaway($a->get_baseurl(true) . '/connections/' . $contact_id);
@@ -226,10 +253,12 @@ function connections_content(&$a) {
if($cmd === 'approve') {
if($orig_record[0]['abook_flags'] & ABOOK_FLAG_PENDING) {
- if(abook_toggle_flag($orig_record[0],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 );
+ connections_clone($a);
+ }
else
notice(t('Unable to set address book parameters.') . EOL);
}
@@ -244,6 +273,7 @@ function connections_content(&$a) {
// terminate_friendship($a->get_channel(),$orig_record[0]);
contact_remove(local_user(), $orig_record[0]['abook_id']);
+// FIXME - send to clones
info( t('Contact has been removed.') . EOL );
if(x($_SESSION,'return_url'))
goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']);
@@ -380,7 +410,7 @@ function connections_content(&$a) {
'$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['name']),
+ '$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'],
@@ -413,7 +443,8 @@ function connections_content(&$a) {
'$updpub' => t('Update public posts'),
'$last_update' => $last_update,
'$udnow' => t('Update now'),
-// '$profile_select' => contact_profile_assign($contact['profile_id'],(($contact['network'] !== NETWORK_DFRN) ? true : false)),
+ '$profile_select' => contact_profile_assign($contact['abook_profile']),
+ '$multiprofs' => feature_enabled(local_user(),'multi_profiles'),
'$contact_id' => $contact['abook_id'],
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
'$ignore_text' => (($contact['readonly']) ? t('Unignore') : t('Ignore') ),
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index c7fa8a9d8..b2b28ce8c 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -23,6 +23,7 @@ function dirsearch_content(&$a) {
}
$name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : '');
+ $hub = ((x($_REQUEST,'hub')) ? $_REQUEST['hub'] : '');
$address = ((x($_REQUEST,'address')) ? $_REQUEST['address'] : '');
$locale = ((x($_REQUEST,'locale')) ? $_REQUEST['locale'] : '');
$region = ((x($_REQUEST,'region')) ? $_REQUEST['region'] : '');
@@ -31,6 +32,8 @@ function dirsearch_content(&$a) {
$gender = ((x($_REQUEST,'gender')) ? $_REQUEST['gender'] : '');
$marital = ((x($_REQUEST,'marital')) ? $_REQUEST['marital'] : '');
$keywords = ((x($_REQUEST,'keywords')) ? $_REQUEST['keywords'] : '');
+ $agege = ((x($_REQUEST,'agege')) ? intval($_REQUEST['agege']) : 0 );
+ $agele = ((x($_REQUEST,'agele')) ? intval($_REQUEST['agele']) : 0 );
// TODO - a meta search which joins all of these things to one search string
@@ -38,6 +41,8 @@ function dirsearch_content(&$a) {
if($name)
$sql_extra .= " OR xchan_name like '" . protect_sprintf( '%' . dbesc($name) . '%' ) . "' ";
+ if($hub)
+ $sql_extra .= " OR xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') ";
if($address)
$sql_extra .= " OR xchan_addr like '" . protect_sprintf( '%' . dbesc($address) . '%' ) . "' ";
if($city)
@@ -55,6 +60,14 @@ function dirsearch_content(&$a) {
if($keywords)
$sql_extra .= " OR xprof_keywords like '" . protect_sprintf( '%' . dbesc($keywords) . '%' ) . "' ";
+ // we only support an age range currently. You must set both agege
+ // (greater than or equal) and agele (less than or equal)
+
+ if($agele && $agege) {
+ $sql_extra .= " OR ( xprof_age <= " . intval($agele) . " ";
+ $sql_extra .= " AND xprof_age >= " . intval($agege) . ") ";
+ }
+
$perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 80);
$page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0);
$startrec = (($page+1) * $perpage) - $perpage;
@@ -96,7 +109,6 @@ function dirsearch_content(&$a) {
$order = " ORDER BY `xchan_name` ASC ";
-
$r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d ) $order $qlimit ",
intval(XCHAN_FLAGS_HIDDEN)
);
@@ -122,6 +134,7 @@ function dirsearch_content(&$a) {
$entry['postcode'] = $rr['xprof_postcode'];
$entry['country'] = $rr['xprof_country'];
$entry['birthday'] = $rr['xprof_dob'];
+ $entry['age'] = $rr['xprof_age'];
$entry['gender'] = $rr['xprof_gender'];
$entry['marital'] = $rr['xprof_marital'];
$entry['keywords'] = $rr['xprof_keywords'];
diff --git a/mod/display.php b/mod/display.php
index b1ae54df3..110dd1807 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -59,7 +59,7 @@ function display_content(&$a, $update = 0, $load = false) {
$o .= '<div id="live-display"></div>' . "\r\n";
- $o .= "<script> var profile_uid = " . intval(local_user())
+ $o .= "<script> var profile_uid = " . ((intval(local_user())) ? local_user() : (-1))
. "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
@@ -152,7 +152,7 @@ function display_content(&$a, $update = 0, $load = false) {
- $o .= conversation($a,$items,'display', $update, 'client');
+ $o .= conversation($a, $items, 'display', $update, 'client');
if($updateable) {
$x = q("UPDATE item SET item_flags = ( item_flags ^ %d )
diff --git a/mod/editpost.php b/mod/editpost.php
index b28e58348..af6f741c6 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -85,7 +85,7 @@ function editpost_content(&$a) {
'$jotnets' => $jotnets,
'$title' => htmlspecialchars($itm[0]['title']),
'$placeholdertitle' => t('Set title'),
- '$category' => file_tag_file_to_list($itm[0]['file'], 'category'),
+ '$category' => '', // FIXME
'$placeholdercategory' => t('Categories (comma-separated list)'),
'$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
diff --git a/mod/editwebpage.php b/mod/editwebpage.php
new file mode 100644
index 000000000..d15d9f364
--- /dev/null
+++ b/mod/editwebpage.php
@@ -0,0 +1,106 @@
+
+<?php
+
+require_once('acl_selectors.php');
+
+function editwebpage_content(&$a) {
+
+ $o = '';
+
+ // We can do better, but for now, editing only works for your own pages, so...
+ if(! local_user()) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ $post_id = ((argc() > 1) ? intval(argv(1)) : 0);
+
+ if(! $post_id) {
+ notice( t('Item not found') . EOL);
+ return;
+ }
+
+ // uid and author_xchan alone should be enough - but it doesn't seem to be any more expensive to use both, so keep it in case of edge cases
+ $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s and author_xchan = '%s' LIMIT 1",
+ intval($post_id),
+ intval(local_user()),
+ dbesc(get_observer_hash())
+ );
+
+
+
+ // All of the following is straight from editpost - but we'll need richer editing options for webpages eventually, so we may as well have it's own mod now.
+
+ $plaintext = true;
+ if(feature_enabled(local_user(),'richtext'))
+ $plaintext = false;
+
+ $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)/'),
+ '$ispublic' => '&nbsp;', // t('Visible to <strong>everybody</strong>'),
+ '$geotag' => $geotag,
+ '$nickname' => $a->user['nickname']
+ ));
+
+
+ $tpl = get_markup_template("jot.tpl");
+
+ $jotplugins = '';
+ $jotnets = '';
+
+ call_hooks('jot_tool', $jotplugins);
+ call_hooks('jot_networks', $jotnets);
+
+ $channel = $a->get_channel();
+
+ //$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
+
+
+ $o .= replace_macros($tpl,array(
+ '$return_path' => $_SESSION['return_url'],
+ '$action' => 'item',
+ '$share' => t('Edit'),
+ '$upload' => t('Upload photo'),
+ '$attach' => t('Attach file'),
+ '$weblink' => t('Insert web link'),
+ '$youtube' => t('Insert YouTube video'),
+ '$video' => t('Insert Vorbis [.ogg] video'),
+ '$audio' => t('Insert Vorbis [.ogg] audio'),
+ '$setloc' => t('Set your location'),
+ '$noloc' => t('Clear browser location'),
+ '$wait' => t('Please wait'),
+ '$permset' => t('Permission settings'),
+ '$ptyp' => $itm[0]['type'],
+ '$content' => undo_post_tagging($itm[0]['body']),
+ '$post_id' => $post_id,
+ '$baseurl' => $a->get_baseurl(),
+ '$defloc' => $channel['channel_location'],
+ '$visitor' => 'none',
+ '$pvisit' => 'none',
+ '$public' => t('Public post'),
+ '$jotnets' => $jotnets,
+ '$title' => htmlspecialchars($itm[0]['title']),
+ '$placeholdertitle' => t('Set title'),
+ '$category' => '',
+ '$placeholdercategory' => t('Categories (comma-separated list)'),
+ '$emtitle' => t('Example: bob@example.com, mary@example.com'),
+ '$lockstate' => $lockstate,
+ '$acl' => '',
+ '$bang' => '',
+ '$profile_uid' => local_user(),
+ '$preview' => ((feature_enabled(local_user(),'preview')) ? t('Preview') : ''),
+ '$jotplugins' => $jotplugins,
+ '$sourceapp' => t($a->sourcename),
+ ));
+
+ return $o;
+
+}
+
+
diff --git a/mod/home.php b/mod/home.php
index f05daf3c7..86d489853 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -33,15 +33,55 @@ function home_content(&$a) {
if(x($_SESSION,'mobile-theme'))
unset($_SESSION['mobile-theme']);
- $o .= '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';
+$channel_address = get_config("system", "site-channel" );
+ if ($channel_address){
+
+require_once('include/items.php');
+require_once('include/conversation.php');
+
+
+//We can do better, but until we figure out auto-linkification, let's keep things simple
+ $page_id = 'home';
+
+ $u = q("select channel_id from channel where channel_address = '%s' limit 1",
+ dbesc($channel_address)
+ );
+
+ if(! $u) {
+ notice( t('Channel not found.') . EOL);
+ return;
+ }
+
+ $r = q("select item.* from item left join item_id on item.id = item_id.iid
+ where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
+ item_restrict = %d limit 1",
+ intval($u[0]['channel_id']),
+ dbesc($page_id),
+ intval(ITEM_WEBPAGE)
+ );
+
+ if(! $r) {
+ notice( t('Item not found.') . EOL);
+ return;
+ }
+
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+ $a->profile = array('profile_uid' => $u[0]['channel_id']);
+ $o .= prepare_page($r[0]);
+
+}
+
+// If there's no site channel specified, fallback to the old behaviour
+ else { $o .= '<h1>' . ((x($a->config,'sitename')) ? sprintf( t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';
if(file_exists('home.html'))
$o .= file_get_contents('home.html');
+}
- $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
+ $o .= login(($a->config['system']['register_policy'] == REGISTER_CLOSED) ? 0 : 1);
call_hooks("home_content",$o);
-
return $o;
-
+}
-}}
+}
diff --git a/mod/item.php b/mod/item.php
index b09ee06f3..c504c77e1 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -140,7 +140,9 @@ function item_post(&$a) {
}
}
- if($parent) logger('mod_item: item_post parent=' . $parent);
+ if($parent) {
+ logger('mod_item: item_post parent=' . $parent);
+ }
$observer = $a->get_observer();
@@ -320,6 +322,18 @@ function item_post(&$a) {
$body = fix_mce_lf($body);
}
+ // If we're sending a private top-level message with a single @-taggable channel as a recipient, @-tag it.
+
+ if((! $parent) && (substr_count($str_contact_allow,'<') == 1) && ($str_group_allow == '') && ($str_contact_deny == '') && ($str_group_deny == '')) {
+ $x = q("select abook_id, abook_their_perms from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
+ dbesc(str_replace(array('<','>'),array('',''),$str_contact_allow)),
+ intval($profile_uid)
+ );
+ if($x && ($x[0]['abook_their_perms'] & PERMS_W_TAGWALL))
+ $body .= "\n\n@group+" . $x[0]['abook_id'] . "\n";
+ }
+
+
/**
* fix naked links by passing through a callback to see if this is a red site
@@ -532,6 +546,7 @@ function item_post(&$a) {
$datarray['item_restrict'] = $item_restrict;
$datarray['item_flags'] = $item_flags;
+ $datarray['comment_policy'] = map_scope($channel['channel_w_comment']);
// preview mode - prepare the body for display and send it via json
@@ -799,15 +814,23 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
if(strpos($tag,'[zrl='))
//...do nothing
return $replaced;
- //base tag has the tags name only
- $basetag = str_replace('_',' ',substr($tag,1));
- //create text for link
- $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag);
- $newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]';
- //replace tag by the link
- $body = str_replace($tag, $newtag, $body);
- $replaced = true;
-
+ if($tag == '#getzot') {
+ $basetag = 'getzot';
+ $url = 'http://getzot.com';
+ $newtag = '#[zrl=' . $url . ']' . $basetag . '[/zrl]';
+ $body = str_replace($tag,$newtag,$body);
+ $replace = true;
+ }
+ else {
+ //base tag has the tags name only
+ $basetag = str_replace('_',' ',substr($tag,1));
+ //create text for link
+ $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag);
+ $newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]';
+ //replace tag by the link
+ $body = str_replace($tag, $newtag, $body);
+ $replaced = true;
+ }
//is the link already in str_tags?
if(! stristr($str_tags,$newtag)) {
//append or set str_tags
diff --git a/mod/like.php b/mod/like.php
index bf707477c..f617391a1 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -102,8 +102,7 @@ function like_content(&$a) {
$post_type = (($item['resource_type'] === 'photo') ? $t('photo') : t('status'));
- $links = array(array('rel' => 'alternate','type' => 'text/html',
- 'href' => z_root() . '/display/' . $item['mid']));
+ $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $item['plink']));
$objtype = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
$body = $item['body'];
diff --git a/mod/message.php b/mod/message.php
index 54615f081..f5a2101ab 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -206,6 +206,7 @@ function message_content(&$a) {
}
$channel = $a->get_channel();
+ head_set_icon($channel['xchan_photo_s']);
$tpl = get_markup_template('mail_head.tpl');
$header = replace_macros($tpl, array(
diff --git a/mod/network.php b/mod/network.php
index bbd9f9de7..0f4b4f7e8 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -7,6 +7,9 @@ function network_init(&$a) {
notice( t('Permission denied.') . EOL);
return;
}
+
+ $channel = $a->get_channel();
+ head_set_icon($channel['xchan_photo_s']);
$is_a_date_query = false;
@@ -465,7 +468,7 @@ function network_content(&$a, $update = 0, $load = false) {
intval(local_user())
);
if($r) {
- $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_user()) . " AND ( author_xchan = " . dbesc($r[0]['abook_xchan']) . " or owner_xchan = " . dbesc($r[0]['abook_xchan']) . " ) and item_restrict = 0 ) ";
+ $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_user()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) and item_restrict = 0 ) ";
$o = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o;
}
else {
diff --git a/mod/page.php b/mod/page.php
index 62f9d9204..e1274fff6 100644
--- a/mod/page.php
+++ b/mod/page.php
@@ -2,6 +2,23 @@
require_once('include/items.php');
require_once('include/conversation.php');
+function page_init(&$a) {
+ // We need this to make sure the channel theme is always loaded.
+ $which = argv(1);
+ $profile = 0;
+ $channel = $a->get_channel();
+
+ if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
+ $which = $channel['channel_address'];
+ $profile = argv(1);
+ }
+
+ profile_load($a,$which,$profile);
+
+}
+
+
+
function page_content(&$a) {
@@ -41,4 +58,4 @@ function page_content(&$a) {
$o .= prepare_page($r[0]);
return $o;
-} \ No newline at end of file
+}
diff --git a/mod/photos.php b/mod/photos.php
index 65bf866f1..f0b2b882e 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -633,6 +633,9 @@ function photos_content(&$a) {
// dispatch request
//
+ /**
+ * Display upload form
+ */
if($datatype === 'upload') {
if(! ($can_post)) {
@@ -640,12 +643,8 @@ function photos_content(&$a) {
return;
}
-
$selname = (($datum) ? hex2bin($datum) : '');
-
-
$albumselect = '<select id="photos-upload-album-select" name="album" size="4">';
-
$albumselect .= '<option value="" ' . ((! $selname) ? ' selected="selected" ' : '') . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>';
if(count($a->data['albums'])) {
@@ -673,6 +672,7 @@ function photos_content(&$a) {
$default_upload = '<input id="photos-upload-choose" type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
<input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>';
+ /* Show space usage */
$r = q("select sum(size) as total from photo where uid = %d and scale = 0 ",
intval($a->data['channel']['channel_id'])
@@ -687,15 +687,8 @@ function photos_content(&$a) {
$usage_message = sprintf( t('You have used %1$.2f Mbytes of photo storage.'), $r[0]['total'] / 1024000 );
}
-
- if($a->get_template_engine() === 'internal') {
- $albumselect_e = template_escape($albumselect);
- $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user, $celeb)));
- }
- else {
- $albumselect_e = $albumselect;
- $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
- }
+ $albumselect_e = $albumselect;
+ $aclselect_e = (($visitor) ? '' : populate_acl($a->user, $celeb));
$tpl = get_markup_template('photos_upload.tpl');
$o .= replace_macros($tpl,array(
@@ -718,6 +711,10 @@ function photos_content(&$a) {
return $o;
}
+ /*
+ * Display a single photo album
+ */
+
if($datatype === 'album') {
$album = hex2bin($datum);
@@ -793,6 +790,7 @@ function photos_content(&$a) {
if(count($r))
$twist = 'rotright';
foreach($r as $rr) {
+
if($twist == 'rotright')
$twist = 'rotleft';
else
@@ -839,12 +837,12 @@ function photos_content(&$a) {
}
+ /**
+ * Display one photo
+ */
if($datatype === 'image') {
-
-
- //$o = '';
// fetch image, item containing image, then comments
$ph = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
@@ -853,13 +851,16 @@ function photos_content(&$a) {
dbesc($datum)
);
- if(! count($ph)) {
+ if(! $ph) {
+
+ /* Check again - this time without specifying permissions */
+
$ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource_id` = '%s'
LIMIT 1",
intval($owner_uid),
dbesc($datum)
);
- if(count($ph))
+ if($ph)
notice( t('Permission denied. Access to this item may be restricted.'));
else
notice( t('Photo not available') . EOL );
@@ -893,9 +894,9 @@ function photos_content(&$a) {
break;
}
}
- $edit_suffix = ((($cmd === 'edit') && ($can_post)) ? '/edit' : '');
- $prevlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
- $nextlink = $a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['resource_id'] . $edit_suffix . (($_GET['order'] === 'posted') ? '?f=&order=posted' : '');
+
+ $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' : '');
}
@@ -918,7 +919,6 @@ function photos_content(&$a) {
if($can_post && ($ph[0]['uid'] == $owner_uid)) {
$tools = array(
- 'edit' => array($a->get_baseurl() . '/photos/' . $a->data['channel']['channel_address'] . '/image/' . $datum . (($cmd === 'edit') ? '' : '/edit'), (($cmd === 'edit') ? t('View photo') : t('Edit photo'))),
'profile'=>array($a->get_baseurl() . '/profile_photo/use/'.$ph[0]['resource_id'], t('Use as profile photo')),
);
@@ -931,7 +931,7 @@ function photos_content(&$a) {
}
- if(! $cmd !== 'edit') {
+ if(! $can_post) {
$a->page['htmlhead'] .= '<script>
$(document).keydown(function(event) {' . "\n";
@@ -990,39 +990,33 @@ function photos_content(&$a) {
}
- $edit = Null;
- if(($cmd === 'edit') && ($can_post)) {
- if($a->get_template_engine() === 'internal') {
- $album_e = template_escape($ph[0]['album']);
- $caption_e = template_escape($ph[0]['desc']);
- $aclselect_e = template_escape(populate_acl($ph[0]));
- }
- else {
- $album_e = $ph[0]['album'];
- $caption_e = $ph[0]['desc'];
- $aclselect_e = populate_acl($ph[0]);
- }
+ $edit = null;
+ if($can_post) {
- $edit_tpl = get_markup_template('photo_edit.tpl');
- $edit = replace_macros($edit_tpl, array(
- '$id' => $ph[0]['id'],
- '$rotatecw' => t('Rotate CW (right)'),
- '$rotateccw' => t('Rotate CCW (left)'),
- '$album' => $album_e,
- '$newalbum' => t('New album name'),
- '$nickname' => $a->data['channel']['channel_address'],
- '$resource_id' => $ph[0]['resource_id'],
- '$capt_label' => t('Caption'),
- '$caption' => $caption_e,
- '$tag_label' => t('Add a Tag'),
- '$tags' => $link_item['tag'],
- '$permissions' => t('Permissions'),
- '$aclselect' => $aclselect_e,
- '$help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'),
- '$item_id' => ((count($linked_items)) ? $link_item['id'] : 0),
- '$submit' => t('Submit'),
- '$delete' => t('Delete Photo')
- ));
+ $album_e = $ph[0]['album'];
+ $caption_e = $ph[0]['desc'];
+ $aclselect_e = populate_acl($ph[0]);
+
+ $edit = array(
+ 'edit' => t('Edit photo'),
+ 'id' => $ph[0]['id'],
+ 'rotatecw' => t('Rotate CW (right)'),
+ 'rotateccw' => t('Rotate CCW (left)'),
+ 'album' => $album_e,
+ 'newalbum' => t('New album name'),
+ 'nickname' => $a->data['channel']['channel_address'],
+ 'resource_id' => $ph[0]['resource_id'],
+ 'capt_label' => t('Caption'),
+ 'caption' => $caption_e,
+ 'tag_label' => t('Add a Tag'),
+ 'tags' => $link_item['tag'],
+ 'permissions' => t('Permissions'),
+ 'aclselect' => $aclselect_e,
+ 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com, #California, #camping'),
+ 'item_id' => ((count($linked_items)) ? $link_item['id'] : 0),
+ 'submit' => t('Submit'),
+ 'delete' => t('Delete Photo')
+ );
}
if(count($linked_items)) {
@@ -1154,16 +1148,10 @@ function photos_content(&$a) {
$drop = replace_macros(get_markup_template('photo_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
- if($a->get_template_engine() === 'internal') {
- $name_e = template_escape($profile_name);
- $title_e = template_escape($item['title']);
- $body_e = template_escape(bbcode($item['body']));
- }
- else {
- $name_e = $profile_name;
- $title_e = $item['title'];
- $body_e = bbcode($item['body']);
- }
+ $name_e = $profile_name;
+ $title_e = $item['title'];
+ $body_e = bbcode($item['body']);
+
$comments .= replace_macros($template,array(
'$id' => $item['item_id'],
@@ -1184,18 +1172,10 @@ function photos_content(&$a) {
$paginate = paginate($a);
}
- if($a->get_template_engine() === 'internal') {
- $album_e = array($album_link,template_escape($ph[0]['album']));
- $tags_e = template_escape($tags);
- $like_e = template_escape($like);
- $dislike_e = template_escape($dislike);
- }
- else {
- $album_e = array($album_link,$ph[0]['album']);
- $tags_e = $tags;
- $like_e = $like;
- $dislike_e = $dislike;
- }
+ $album_e = array($album_link,$ph[0]['album']);
+ $tags_e = $tags;
+ $like_e = $like;
+ $dislike_e = $dislike;
$photo_tpl = get_markup_template('photo_view.tpl');
$o .= replace_macros($photo_tpl, array(
diff --git a/mod/profile.php b/mod/profile.php
index 2f869a533..d59602ba0 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -10,25 +10,35 @@ function profile_init(&$a) {
return;
}
- $profile = 0;
+ $profile = '';
$channel = $a->get_channel();
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
$which = $channel['channel_address'];
$profile = argv(1);
+ $r = q("select profile_guid from profile where id = %d and uid = %d limit 1",
+ intval($profile),
+ intval(local_user())
+ );
+ if(! $r)
+ $profile = '';
+ $profile = $r[0]['profile_guid'];
}
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ;
- $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];
+ 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];
+ }
+ }
// $channel_display = get_pconfig($a->profile['profile_uid'],'system','channel_format');
// if(! $channel_display)
- profile_load($a,$which,$profile);
- }
+ profile_load($a,$which,$profile);
+
}
diff --git a/mod/profiles.php b/mod/profiles.php
index ff6bc8ff6..173d97138 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -47,7 +47,7 @@ function profiles_init(&$a) {
if((argc() > 1) && (argv(1) === 'new')) {
- check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
+// check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
intval(local_user()));
@@ -200,6 +200,11 @@ function profiles_post(&$a) {
$day = intval($_POST['day']);
if(($day > $mtab[$month]) || ($day < 0))
$day = 0;
+
+ if($year && (! ($month && $day))) {
+ $month = 1; $day = 1;
+ }
+
$dob = '0000-00-00';
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
@@ -519,6 +524,7 @@ function profiles_content(&$a) {
'$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t='
. get_form_security_token("profile_drop"),
+ '$guid' => $r[0]['profile_guid'],
'$banner' => t('Edit Profile Details'),
'$submit' => t('Submit'),
'$viewprof' => t('View this profile'),
diff --git a/mod/search.php b/mod/search.php
index 4e093d865..1335ea508 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -153,7 +153,7 @@ function search_content(&$a,$update = 0, $load = false) {
// because browser prefetching might change it on us. We have to deliver it with the page.
$o .= '<div id="live-search"></div>' . "\r\n";
- $o .= "<script> var profile_uid = " . intval(local_user())
+ $o .= "<script> var profile_uid = " . ((intval(local_user())) ? local_user() : (-1))
. "; var netargs = '?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
$a->page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
@@ -171,7 +171,7 @@ function search_content(&$a,$update = 0, $load = false) {
'$nouveau' => '0',
'$wall' => '0',
'$page' => (($a->pager['page'] != 1) ? $a->pager['page'] : 1),
- '$search' => (($tag) ? '#' : '') . $search,
+ '$search' => (($tag) ? urlencode('#') : '') . $search,
'$order' => '',
'$file' => '',
'$cats' => '',
@@ -189,7 +189,7 @@ function search_content(&$a,$update = 0, $load = false) {
$pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage']));
dbg(1);
if($load) {
- $r = q("SELECT distinct(mid), item.* from item
+ $r = q("SELECT distinct mid, id as item_id from item
WHERE item_restrict = 0
AND (( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 )
OR ( `item`.`uid` = %d ))
@@ -209,15 +209,15 @@ dbg(0);
if($r) {
$parents_str = ids_to_querystr($r,'item_id');
-
+dbg(1);
$items = q("SELECT `item`.*, `item`.`id` AS `item_id`
FROM `item`
WHERE item_restrict = 0
- $sql_extra ",
- intval($a->profile['profile_uid']),
- dbesc($parents_str)
+ $sql_extra and parent in ( $parents_str ) "
+// intval($a->profile['profile_uid']),
+// dbesc($parents_str)
);
-
+dbg(0);
xchan_query($items);
$items = fetch_post_tags($items,true);
$items = conv_sort($items,'created');
diff --git a/mod/settings.php b/mod/settings.php
index f417586af..164a2a8a0 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -1,5 +1,7 @@
<?php
+require_once('include/settings.php');
+
function get_theme_config_file($theme){
@@ -115,13 +117,6 @@ function settings_post(&$a) {
return;
-// if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
-// notice( t('Permission denied.') . EOL);
-// return;
-// }
-
- $old_page_flags = $a->user['page-flags'];
-
if((argc() > 1) && (argv(1) === 'oauth') && x($_POST,'remove')){
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
@@ -182,6 +177,7 @@ function settings_post(&$a) {
check_form_security_token_redirectOnErr('/settings/featured', 'settings_featured');
call_hooks('feature_settings_post', $_POST);
+ build_sync_packet();
return;
}
@@ -194,6 +190,7 @@ function settings_post(&$a) {
set_pconfig(local_user(),'feature',substr($k,8),((intval($v)) ? 1 : 0));
}
}
+ build_sync_packet();
return;
}
@@ -237,6 +234,7 @@ function settings_post(&$a) {
);
call_hooks('display_settings_post', $_POST);
+ build_sync_packet();
goaway($a->get_baseurl(true) . '/settings/display' );
return; // NOTREACHED
}
@@ -292,7 +290,7 @@ function settings_post(&$a) {
$errs[] = t('Not valid email.');
$adm = trim(get_config('system','admin_email'));
if(($adm) && (strcasecmp($email,$adm) == 0)) {
- $errs[] = t('Protected email. Cannot change to that email.');
+ $errs[] = t('Protected email address. Cannot change to that email.');
$email = $a->user['email'];
}
if(! $errs) {
@@ -550,11 +548,12 @@ function settings_post(&$a) {
dbesc($username),
intval($channel['channel_id'])
);
- // we really need to send out notifications to all our friends
}
proc_run('php','include/directory.php',local_user());
+ build_sync_packet();
+
//$_SESSION['theme'] = $theme;
if($email_changed && $a->config['system']['register_policy'] == REGISTER_VERIFY) {
@@ -581,6 +580,11 @@ function settings_content(&$a) {
return;
}
+
+ $channel = $a->get_channel();
+ if($channel)
+ head_set_icon($channel['xchan_photo_s']);
+
// if(x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
// notice( t('Permission denied.') . EOL );
// return;
@@ -719,7 +723,6 @@ function settings_content(&$a) {
if((argc() > 1) && (argv(1) === 'features')) {
-
$arr = array();
$features = get_features();
@@ -739,6 +742,7 @@ function settings_content(&$a) {
'$submit' => t('Submit'),
'$field_yesno' => 'field_yesno.tpl',
));
+
return $o;
}
diff --git a/mod/tagger.php b/mod/tagger.php
index 28e10d131..ec5c92184 100644
--- a/mod/tagger.php
+++ b/mod/tagger.php
@@ -11,6 +11,8 @@ function tagger_content(&$a) {
return;
}
+ $observer_hash = get_observer_hash();
+
$term = notags(trim($_GET['term']));
// no commas allowed
$term = str_replace(array(',',' '),array('','_'),$term);
@@ -121,7 +123,8 @@ function tagger_content(&$a) {
$arr['obj_type'] = $objtype;
$arr['object'] = $obj;
$arr['parent_mid'] = $item['mid'];
-
+
+ store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_HASHTAG,$term,$tagid);
$ret = post_activity_item($arr);
if($ret['success'])
diff --git a/mod/thing.php b/mod/thing.php
new file mode 100644
index 000000000..91bdca78a
--- /dev/null
+++ b/mod/thing.php
@@ -0,0 +1,196 @@
+<?php /** @file */
+
+require_once('include/items.php');
+
+
+function thing_init(&$a) {
+
+ if(! local_user())
+ return;
+
+ $account_id = $a->get_account();
+ $channel = $a->get_channel();
+
+
+ $name = escape_tags($_REQUEST['term']);
+ $verb = escape_tags($_REQUEST['verb']);
+ $profile_guid = escape_tags($_REQUEST['profile']);
+ $url = $_REQUEST['link'];
+ $photo = $_REQUEST['photo'];
+
+ $hash = random_string();
+
+
+ $verbs = obj_verbs();
+
+ /**
+ * verbs: [0] = first person singular, e.g. "I want", [1] = 3rd person singular, e.g. "Bill wants"
+ * We use the first person form when creating an activity, but the third person for use in activities
+ * FIXME: There is no accounting for verb gender for languages where this is significant. We may eventually
+ * require obj_verbs() to provide full conjugations and specify which form to use in the $_REQUEST params to this module.
+ */
+
+ $translated_verb = $verbs[$verb][1];
+
+ /**
+ * The site administrator can do things that normals cannot.
+ * This is restricted because it will likely cause
+ * an activitystreams protocol violation and the activity might
+ * choke in some other network and result in unnecessary
+ * support requests. It isn't because we're trying to be heavy-handed
+ * about what you can and can't do.
+ */
+
+ if(! $translated_verb) {
+ if(is_site_admin())
+ $translated_verb = $verb;
+ }
+
+ /**
+ * Things, objects: We do not provide definite (a, an) or indefinite (the) articles or singular/plural designators
+ * That needs to be specified in your thing. e.g. Mike has "a carrot", Greg wants "balls", Bob likes "the Boston Red Sox".
+ */
+
+ /**
+ * Future work on this module might produce more complex activities with targets, e.g. Phillip likes Karen's moustache
+ * and to describe other non-thing objects like channels, such as Karl wants Susan - where Susan represents a channel profile.
+ */
+
+ if((! $name) || (! $translated_verb))
+ return;
+
+ $sql = (($profile_guid) ? " and profile_guid = '" . dbesc($profile_guid) . "' " : " and is_default = 1 ");
+ $p = q("select profile_guid, is_default from profile where uid = %d $sql limit 1",
+ intval(local_user())
+ );
+ if($p)
+ $profile = $p[0];
+ else
+ return;
+
+
+ $r = q("select * from term where uid = %d and otype = %d and type = %d and term = '%s' limit 1",
+ intval(local_user()),
+ intval(TERM_OBJ_THING),
+ intval(TERM_THING),
+ dbesc($name)
+ );
+ if(! $r) {
+ $r = q("insert into term ( aid, uid, oid, otype, type, term, url, imgurl, term_hash )
+ values( %d, %d, %d, %d, %d, '%s', '%s', '%s', '%s' ) ",
+ intval($account_id),
+ intval(local_user()),
+ 0,
+ intval(TERM_OBJ_THING),
+ intval(TERM_THING),
+ dbesc($name),
+ dbesc(($url) ? $url : z_root() . '/thing/' . $hash),
+ dbesc(($photo) ? $photo : ''),
+ dbesc($hash)
+ );
+ $r = q("select * from term where uid = %d and otype = %d and type = %d and term = '%s' limit 1",
+ intval(local_user()),
+ intval(TERM_OBJ_THING),
+ intval(TERM_THING),
+ dbesc($name)
+ );
+ }
+ $term = $r[0];
+
+ $r = q("insert into obj ( obj_page, obj_verb, obj_type, obj_channel, obj_obj) values ('%s','%s', %d, %d, '%s') ",
+ dbesc($profile['profile_guid']),
+ dbesc($verb),
+ intval(TERM_OBJ_THING),
+ intval(local_user()),
+ dbesc($term['term_hash'])
+ );
+
+ if(! $r) {
+ notice( t('Object store: failed'));
+ return;
+ }
+
+ info( t('thing/stuff added'));
+
+ $arr = array();
+ $links = array(array('rel' => 'alternate','type' => 'text/html',
+ 'href' => $term['url']));
+
+ $objtype = ACTIVITY_OBJ_THING;
+
+ $obj = json_encode(array(
+ 'type' => $objtype,
+ 'id' => $term['url'],
+ 'link' => $links,
+ 'title' => $term['term'],
+ 'content' => $term['term']
+ ));
+
+ $bodyverb = str_replace('OBJ: ', '',t('OBJ: %1$s %2$s %3$s'));
+
+ $arr['owner_xchan'] = $channel['channel_hash'];
+ $arr['author_xchan'] = $channel['channel_hash'];
+
+
+ $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP;
+
+ $ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
+ $plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]';
+
+ $arr['body'] = sprintf( $bodyverb, $ulink, $translated_verb, $plink );
+
+ $arr['verb'] = $verb;
+ $arr['obj_type'] = $objtype;
+ $arr['object'] = $obj;
+
+ if(! $profile['is_default']) {
+ $arr['item_private'] = true;
+ $str = '';
+ $r = q("select abook_hash from abook where abook_channel = %d and abook_profile = '%s'",
+ intval(local_user()),
+ dbesc($profile_guid)
+ );
+ if($r) {
+ $arr['allow_cid'] = '';
+ foreach($r as $rr)
+ $arr['allow_cid'] .= '<' . $rr['abook_hash'] . '>';
+ }
+ else
+ $arr['allow_cid'] = '<' . get_observer_hash() . '>';
+ }
+
+ $ret = post_activity_item($arr);
+
+ if($ret['success'])
+ proc_run('php','include/notifier.php','tag',$ret['activity']['id']);
+
+}
+
+
+function thing_content(&$a) {
+
+ /* placeholders */
+
+ if(argc() > 1) {
+ return t('not yet implemented.');
+ }
+
+ require_once('include/contact_selectors.php');
+
+ $o .= replace_macros(get_markup_template('thing_input.tpl'),array(
+ '$thing_hdr' => t('Add Stuff to your Profile'),
+ '$multiprof' => feature_enabled(local_user(),'multi_profiles'),
+ '$profile_lbl' => t('Select a profile'),
+ '$profile_select' => contact_profile_assign(''),
+ '$verb_lbl' => t('Select a category of stuff. e.g. I ______ something'),
+ '$verb_select' => obj_verb_selector(),
+ '$thing_lbl' => t('Name of thing or stuff e.g. something'),
+ '$url_lbl' => t('URL of thing or stuff (optional)'),
+ '$img_lbl' => t('URL for photo of thing or stuff (optional)'),
+ '$submit' => t('Submit')
+ ));
+
+ return $o;
+
+
+}
diff --git a/mod/webpages.php b/mod/webpages.php
new file mode 100644
index 000000000..3cb3ec6bd
--- /dev/null
+++ b/mod/webpages.php
@@ -0,0 +1,76 @@
+<?php
+
+function webpages_init(&$a) {
+
+ if(argc() > 1)
+ $which = argv(1);
+ else {
+ notice( t('Requested profile is not available.') . EOL );
+ $a->error = 404;
+ return;
+ }
+
+ $profile = 0;
+ $channel = $a->get_channel();
+
+ if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
+ $which = $channel['channel_address'];
+ $profile = argv(1);
+ }
+
+ profile_load($a,$which,$profile);
+
+}
+
+function webpages_content(&$a) {
+
+// We can do better, but since editing only works for local users and all posts are webpages, return anyone else for now.
+
+if (!local_user()) return;
+
+
+// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
+require_once ('include/conversation.php');
+ $x = array(
+ 'webpage' => 1,
+ 'is_owner' => true,
+ 'nickname' => $a->profile['channel_address'],
+ 'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
+ 'bang' => (($group || $cid) ? '!' : ''),
+ 'visitor' => 'block',
+ 'profile_uid' => local_user()
+ );
+
+ $o .= status_editor($a,$x);
+
+//Get a list of webpages. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
+// FIXME - we should sort these results, but it's not obvious what order yet. Alphabetical? Created order?
+
+$r = q("select * from item_id where uid = %d and service = 'WEBPAGE'",
+ intval(local_user())
+);
+
+ $pages = null;
+
+ if($r) {
+ $pages = array();
+ foreach($r as $rr) {
+ $pages[$rr['iid']][] = array('url' => $rr['iid'],'title' => $rr['sid']);
+ }
+ }
+
+ //Something is bound to go wrong, so we'll log it - if nothing has blown up in a few days, this should be nuked.
+ logger('mod_webpages: pages: ' . print_r($pages,true), LOGGER_DATA);
+
+
+// This isn't pretty, but it works. Until I figure out what to do with the UI, it's Good Enough(TM).
+ return $o . replace_macros(get_markup_template("webpagelist.tpl"), array(
+ '$editlink' => t('Edit'),
+ '$pages' => $pages,
+ '$channel' => $a->profile['channel_address'],
+ '$view' => t('View'),
+
+ ));
+
+
+}
diff --git a/mod/zfinger.php b/mod/zfinger.php
index 48582b3d6..d438940a1 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -91,6 +91,9 @@ function zfinger_init(&$a) {
$profile['birthday'] = $p[0]['dob'];
if($profile['birthday'] != '0000-00-00')
$profile['next_birthday'] = z_birthday($p[0]['dob'],$e['channel_timezone']);
+
+ if($age = age($p[0]['dob'],$e['channel_timezone'],''))
+ $profile['age'] = $age;
$profile['gender'] = $p[0]['gender'];
$profile['marital'] = $p[0]['marital'];
$profile['sexual'] = $p[0]['sexual'];
@@ -181,7 +184,14 @@ function zfinger_init(&$a) {
$ret['site']['directory_mode'] = 'standalone';
if($dirmode != DIRECTORY_MODE_NORMAL)
$ret['site']['directory_url'] = z_root() . '/dirsearch';
-
+ $register_policy = intval(get_config('system','register_policy'));
+ if($register_policy == REGISTER_CLOSED)
+ $ret['site']['register_policy'] = 'closed';
+ if($register_policy == REGISTER_APPROVE)
+ $ret['site']['register_policy'] = 'approve';
+ if($register_policy == REGISTER_OPEN)
+ $ret['site']['register_policy'] = 'open';
+
json_return_and_die($ret);
} \ No newline at end of file