aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/contacts.php24
-rw-r--r--mod/dfrn_confirm.php4
-rw-r--r--mod/dfrn_notify.php146
-rw-r--r--mod/dfrn_poll.php1
-rw-r--r--mod/display.php19
-rw-r--r--mod/follow.php77
-rw-r--r--mod/invite.php8
-rw-r--r--mod/item.php67
-rw-r--r--mod/like.php8
-rw-r--r--mod/lockview.php17
-rw-r--r--mod/message.php4
-rw-r--r--mod/network.php18
-rw-r--r--mod/photos.php153
-rw-r--r--mod/profile.php11
-rw-r--r--mod/profile_photo.php4
-rw-r--r--mod/profiles.php4
-rw-r--r--mod/removeme.php50
-rw-r--r--mod/settings.php24
-rw-r--r--mod/viewcontacts.php2
19 files changed, 484 insertions, 157 deletions
diff --git a/mod/contacts.php b/mod/contacts.php
index 7236a200d..61d9ce398 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -53,9 +53,9 @@ function contacts_post(&$a) {
return;
}
}
+logger('contact_edit ' . print_r($_POST,true));
-
- $priority = intval($_POST['priority']);
+ $priority = intval($_POST['poll']);
if($priority == (-1))
if($priority > 5 || $priority < 0)
@@ -121,6 +121,15 @@ function contacts_content(&$a) {
return; // NOTREACHED
}
+ if($cmd === 'update') {
+
+ // pull feed and consume it, which should subscribe to the hub.
+
+ $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+ proc_run($php_path,"include/poller.php","$contact_id");
+ goaway($a->get_baseurl() . '/contacts/' . $contact_id);
+ // NOTREACHED
+ }
if($cmd === 'block') {
$blocked = (($orig_record[0]['blocked']) ? 0 : 1);
@@ -177,6 +186,12 @@ function contacts_content(&$a) {
}
}
+ if($orig_record[0]['network'] === 'dfrn') {
+ require_once('include/items.php');
+ dfrn_deliver($a->user,$orig_record[0],'placeholder', 1);
+ }
+
+
contact_remove($contact_id);
notice( t('Contact has been removed.') . EOL );
goaway($a->get_baseurl() . '/contacts');
@@ -242,11 +257,12 @@ function contacts_content(&$a) {
'$last_update' => (($r[0]['last-update'] == '0000-00-00 00:00:00')
? t('Never')
: datetime_convert('UTC',date_default_timezone_get(),$r[0]['last-update'],'D, j M Y, g:i A')),
+ '$udnow' => t('Update now'),
'$profile_select' => contact_profile_assign($r[0]['profile-id'],(($r[0]['network'] !== 'dfrn') ? true : false)),
'$contact_id' => $r[0]['id'],
'$block_text' => (($r[0]['blocked']) ? t('Unblock this contact') : t('Block this contact') ),
'$ignore_text' => (($r[0]['readonly']) ? t('Unignore this contact') : t('Ignore this contact') ),
- '$insecure' => (($r[0]['network'] === 'dfrn') ? '' : load_view_file('view/insecure_net.tpl')),
+ '$insecure' => (($r[0]['network'] === 'stat') ? load_view_file('view/insecure_net.tpl') : ''),
'$info' => $r[0]['info'],
'$blocked' => (($r[0]['blocked']) ? '<div id="block-message">' . t('Currently blocked') . '</div>' : ''),
'$ignored' => (($r[0]['readonly']) ? '<div id="ignore-message">' . t('Currently ignored') . '</div>' : ''),
@@ -351,7 +367,7 @@ function contacts_content(&$a) {
'$alt_text' => $alt_text,
'$dir_icon' => $dir_icon,
'$thumb' => $rr['thumb'],
- '$name' => $rr['name'],
+ '$name' => substr($rr['name'],0,20),
'$sparkle' => $sparkle,
'$url' => $url
));
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index 41e0771af..24e8bf106 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -438,8 +438,8 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"activity\" \"$i\" &", array(),$foo));
+ proc_run($php_path,"include/notifier.php","activity","$i");
}
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index 49356d358..142d13284 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -11,6 +11,7 @@ function dfrn_notify_post(&$a) {
$challenge = ((x($_POST,'challenge')) ? notags(trim($_POST['challenge'])) : '');
$data = ((x($_POST,'data')) ? $_POST['data'] : '');
$key = ((x($_POST,'key')) ? $_POST['key'] : '');
+ $dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0);
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
@@ -23,7 +24,7 @@ function dfrn_notify_post(&$a) {
dbesc($challenge)
);
if(! count($r)) {
- logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id);
+ logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
xml_status(3);
}
@@ -65,17 +66,24 @@ function dfrn_notify_post(&$a) {
//NOTREACHED
}
+ // $importer in this case contains the contact record for the remote contact joined with the user record of our user.
+
$importer = $r[0];
logger('dfrn_notify: received notify from ' . $importer['name'] . ' for ' . $importer['username']);
logger('dfrn_notify: data: ' . $data, LOGGER_DATA);
- if($importer['readonly']) {
- // We aren't receiving stuff from this person. But we will quietly ignore them
- // rather than a blatant "go away" message.
- logger('dfrn_notify: ignoring');
+ if($dissolve == 1) {
+
+ /**
+ * Relationship is dissolved permanently
+ */
+
+ require_once('include/Contact.php');
+ contact_remove($importer['id']);
+ logger('relationship dissolved : ' . $importer['name'] . ' dissolved ' . $importer['username']);
xml_status(0);
- //NOTREACHED
+
}
if(strlen($key)) {
@@ -83,11 +91,21 @@ function dfrn_notify_post(&$a) {
logger('rino: md5 raw key: ' . md5($rawkey));
$final_key = '';
- if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
- openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
+ if($dfrn_version >= 2.1) {
+ if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
+ openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
+ }
+ else {
+ openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
+ }
}
else {
- openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
+ if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
+ openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
+ }
+ else {
+ openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
+ }
}
logger('rino: received key : ' . $final_key);
@@ -95,6 +113,17 @@ function dfrn_notify_post(&$a) {
logger('rino: decrypted data: ' . $data, LOGGER_DATA);
}
+
+
+
+ if($importer['readonly']) {
+ // We aren't receiving stuff from this person. But we will quietly ignore them
+ // rather than a blatant "go away" message.
+ logger('dfrn_notify: ignoring');
+ xml_status(0);
+ //NOTREACHED
+ }
+
// Consume notification feed. This may differ from consuming a public feed in several ways
// - might contain email
// - might contain remote followup to our message
@@ -260,54 +289,58 @@ function dfrn_notify_post(&$a) {
$datarray['last-child'] = 0;
}
$posted_id = item_store($datarray);
+ $parent = 0;
if($posted_id) {
+ $r = q("SELECT `parent` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($posted_id),
+ intval($importer['importer_uid'])
+ );
+ if(count($r))
+ $parent = $r[0]['parent'];
+
if(! $is_like) {
- $r = q("SELECT `parent` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($posted_id),
- intval($importer['importer_uid'])
+ $r1 = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d",
+ dbesc(datetime_convert()),
+ intval($importer['importer_uid']),
+ intval($r[0]['parent'])
);
- if(count($r)) {
- $r1 = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d",
- dbesc(datetime_convert()),
- intval($importer['importer_uid']),
- intval($r[0]['parent'])
- );
- }
+
$r2 = q("UPDATE `item` SET `last-child` = 1, `changed` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
- dbesc(datetime_convert()),
- intval($importer['importer_uid']),
- intval($posted_id)
+ dbesc(datetime_convert()),
+ intval($importer['importer_uid']),
+ intval($posted_id)
);
}
- $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &",
- array(),$foo));
-
- if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
- require_once('bbcode.php');
- $from = stripslashes($datarray['author-name']);
- $tpl = load_view_file('view/cmnt_received_eml.tpl');
- $email_tpl = replace_macros($tpl, array(
- '$sitename' => $a->config['sitename'],
- '$siteurl' => $a->get_baseurl(),
- '$username' => $importer['username'],
- '$email' => $importer['email'],
- '$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
- '$from' => $from,
- '$body' => strip_tags(bbcode(stripslashes($datarray['body'])))
- ));
-
- $res = mail($importer['email'], $from . t(' commented on an item at ') . $a->config['sitename'],
- $email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() );
- }
- }
+ if($posted_id && $parent) {
+
+ $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
- xml_status(0);
- // NOTREACHED
+ proc_run($php_path,"include/notifier.php","comment-import","$posted_id");
+
+ if((! $is_like) && ($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
+ require_once('bbcode.php');
+ $from = stripslashes($datarray['author-name']);
+ $tpl = load_view_file('view/cmnt_received_eml.tpl');
+ $email_tpl = replace_macros($tpl, array(
+ '$sitename' => $a->config['sitename'],
+ '$siteurl' => $a->get_baseurl(),
+ '$username' => $importer['username'],
+ '$email' => $importer['email'],
+ '$display' => $a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $posted_id,
+ '$from' => $from,
+ '$body' => strip_tags(bbcode(stripslashes($datarray['body'])))
+ ));
+
+ $res = mail($importer['email'], $from . t(' commented on an item at ') . $a->config['sitename'],
+ $email_tpl, "From: " . t('Administrator') . '@' . $a->get_hostname() );
+ }
+ }
+ xml_status(0);
+ // NOTREACHED
+ }
}
else {
// regular comment that is part of this total conversation. Have we seen it? If not, import it.
@@ -346,13 +379,13 @@ function dfrn_notify_post(&$a) {
if(($datarray['type'] != 'activity') && ($importer['notify-flags'] & NOTIFY_COMMENT)) {
- $myconv = q("SELECT `author-link` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d",
+ $myconv = q("SELECT `author-link` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `parent` != 0 ",
dbesc($parent_uri),
intval($importer['importer_uid'])
);
if(count($myconv)) {
foreach($myconv as $conv) {
- if($conv['author-link'] != $importer['url'])
+ if(! link_compare($conv['author-link'],$importer['url']))
continue;
require_once('bbcode.php');
$from = stripslashes($datarray['author-name']);
@@ -439,12 +472,13 @@ function dfrn_notify_content(&$a) {
$r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
$r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` )
- VALUES( '%s', '%s', '%s') ",
+ VALUES( '%s', '%s', %d ) ",
dbesc($hash),
dbesc($dfrn_id),
- intval(time() + 60 )
+ intval(time() + 90 )
);
+ logger('dfrn_notify: challenge=' . $hash );
$sql_extra = '';
switch($direction) {
@@ -477,14 +511,14 @@ function dfrn_notify_content(&$a) {
$encrypted_id = '';
$id_str = $my_id . '.' . mt_rand(1000,9999);
- if((($r[0]['duplex']) && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) {
- openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
- openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
- }
- else {
+ if((($r[0]['duplex']) && strlen($r[0]['prvkey'])) || (! strlen($r[0]['pubkey']))) {
openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
}
+ else {
+ openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
+ openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
+ }
$challenge = bin2hex($challenge);
$encrypted_id = bin2hex($encrypted_id);
diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php
index 1061cdb89..85e7fc0af 100644
--- a/mod/dfrn_poll.php
+++ b/mod/dfrn_poll.php
@@ -26,6 +26,7 @@ function dfrn_poll_init(&$a) {
}
if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) {
+ logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] );
header("Content-type: application/atom+xml");
$o = get_feed_for($a, '*', $a->argv[1],$last_update);
echo $o;
diff --git a/mod/display.php b/mod/display.php
index de11ec35d..3215ae90a 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -173,6 +173,9 @@ function display_content(&$a) {
$redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
+ // I think this is redundant now but too chicken to remove it unless
+ // I've had six cups of coffee and tested it completely
+
if(($item['network'] === 'dfrn') && (! $item['self'] )) {
$profile_url = $redirect_url;
$sparkle = ' sparkle';
@@ -216,7 +219,18 @@ function display_content(&$a) {
$profile_name = (((strlen($item['author-name'])) && $diff_author) ? $item['author-name'] : $item['name']);
$profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $item['thumb']);
- $profile_link = $profile_url;
+ // Can we use our special contact URL for this author?
+
+ if(strlen($item['author-link'])) {
+ if((link_compare($item['author-link'],$item['url'])) && ($item['network'] === 'dfrn') && (! $item['self'])) {
+ $profile_link = $redirect_url;
+ $sparkle = ' sparkle';
+ }
+ else {
+ $profile_link = $item['author-link'];
+ $sparkle = '';
+ }
+ }
if(($item['contact-id'] == remote_user()) || ($item['uid'] == local_user()))
$drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id']));
@@ -291,6 +305,9 @@ function display_content(&$a) {
}
}
+
+ $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+
return $o;
}
diff --git a/mod/follow.php b/mod/follow.php
index 14bdb9fc6..8c1dc348f 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -10,7 +10,9 @@ function follow_post(&$a) {
// NOTREACHED
}
- $url = notags(trim($_POST['url']));
+ $url = $orig_url = notags(trim($_POST['url']));
+
+ $email_conversant = false;
if($url) {
$links = lrdd($url);
@@ -29,6 +31,11 @@ function follow_post(&$a) {
}
}
+ else {
+ if((strpos($orig_url,'@')) && validate_email($orig_url)) {
+ $email_conversant = true;
+ }
+ }
}
// If we find a DFRN site, send our subscriber to the other person's
@@ -48,6 +55,9 @@ function follow_post(&$a) {
}
}
+ $network = 'stat';
+ $priority = 0;
+
if($hcard) {
$vcard = scrape_vcard($hcard);
@@ -63,13 +73,64 @@ function follow_post(&$a) {
if(! $profile)
$profile = $url;
- // do we have enough information?
if(! x($vcard,'fn'))
if(x($vcard,'nick'))
$vcard['fn'] = $vcard['nick'];
+ if((! isset($vcard)) && (! $poll)) {
+
+ $ret = scrape_feed($url);
+
+ if(count($ret) && ($ret['feed_atom'] || $ret['feed_rss'])) {
+ $poll = ((x($ret,'feed_atom')) ? $ret['feed_atom'] : $ret['feed_rss']);
+ $vcard = array();
+ require_once('simplepie/simplepie.inc');
+ $feed = new SimplePie();
+ $xml = fetch_url($poll);
+
+ $feed->set_raw_data($xml);
+
+ $feed->init();
+
+ $vcard['photo'] = $feed->get_image_url();
+ $author = $feed->get_author();
+ if($author) {
+ $vcard['fn'] = trim($author->get_name());
+ $vcard['nick'] = strtolower($vcard['fn']);
+ if(strpos($vcard['nick'],' '))
+ $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
+ $email = $author->get_email();
+ }
+ else {
+ $item = $feed->get_item(0);
+ if($item) {
+ $author = $item->get_author();
+ if($author) {
+ $vcard['fn'] = trim($author->get_name());
+ $vcard['nick'] = strtolower($vcard['fn']);
+ if(strpos($vcard['nick'],' '))
+ $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
+ $email = $author->get_email();
+ }
+ if(! $vcard['photo']) {
+ $rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
+ if($rawmedia && $rawmedia[0]['attribs']['']['url'])
+ $vcard['photo'] = $rawmedia[0]['attribs']['']['url'];
+ }
+ }
+ }
+ if((! $vcard['photo']) && strlen($email))
+ $vcard['photo'] = gravatar_img($email);
+
+ $network = 'feed';
+ $priority = 2;
+ }
+ }
+
logger('follow: poll=' . $poll . ' notify=' . $notify . ' profile=' . $profile . ' vcard=' . print_r($vcard,true));
+
+ // do we have enough information?
if(! ((x($vcard['fn'])) && ($poll) && ($profile))) {
notice( t('The profile address specified does not provide adequate information.') . EOL);
@@ -104,9 +165,9 @@ function follow_post(&$a) {
}
else {
// create contact record
- $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`,
+ $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
`blocked`, `readonly`, `pending` )
- VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 0 ) ",
+ VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 0, 0, 0 ) ",
intval(local_user()),
dbesc(datetime_convert()),
dbesc($profile),
@@ -115,8 +176,9 @@ function follow_post(&$a) {
dbesc($vcard['fn']),
dbesc($vcard['nick']),
dbesc($vcard['photo']),
- dbesc('stat'),
- intval(REL_FAN)
+ dbesc($network),
+ intval(REL_FAN),
+ intval($priority)
);
}
@@ -158,6 +220,9 @@ function follow_post(&$a) {
// pull feed and consume it, which should subscribe to the hub.
+ $php_path = ((x($a->config,'php_path') && strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+ //proc_close(proc_open("\"$php_path\" \"include/poller.php\" \"$contact_id\" &", array(), $foo));
+ proc_run($php_path,"include/poller.php","$contact_id");
// create a follow slap
diff --git a/mod/invite.php b/mod/invite.php
index 9d4497f5d..f67432746 100644
--- a/mod/invite.php
+++ b/mod/invite.php
@@ -57,10 +57,10 @@ function invite_content(&$a) {
'$invite' => t('Send invitations'),
'$addr_text' => t('Enter email addresses, one per line:'),
'$msg_text' => t('Your message:'),
- '$default_message' => t('Please join my social network on ') . $a->config['sitename'] . t("\r\n") . t("\r\n")
- . t('To accept this invitation, please visit:') . t("\r\n") . t("\r\n") . $a->get_baseurl()
- . t("\r\n") . t("\r\n") . t('Once you have registered, please connect with me via my profile page at:')
- . t("\r\n") . t("\r\n") . $a->get_baseurl() . '/profile/' . $a->user['nickname'] ,
+ '$default_message' => t('Please join my social network on ') . $a->config['sitename'] . "\r\n" . "\r\n"
+ . t('To accept this invitation, please visit:') . "\r\n" . "\r\n" . $a->get_baseurl()
+ . "\r\n" . "\r\n" . t('Once you have registered, please connect with me via my profile page at:')
+ . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] ,
'$submit' => t('Submit')
));
diff --git a/mod/item.php b/mod/item.php
index f964e7737..38ef580af 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -1,11 +1,17 @@
<?php
-// This is the POST destination for most all locally posted
-// text stuff. This function handles status, wall-to-wall status,
-// local comments, and remote coments - that are posted on this site
-// (as opposed to being delivered in a feed).
-// All of these become an "item" which is our basic unit of
-// information.
+/**
+ *
+ * This is the POST destination for most all locally posted
+ * text stuff. This function handles status, wall-to-wall status,
+ * local comments, and remote coments - that are posted on this site
+ * (as opposed to being delivered in a feed).
+ * All of these become an "item" which is our basic unit of
+ * information.
+ * Posts that originate externally or do not fall into the above
+ * posting categories go through item_store() instead of this function.
+ *
+ */
function item_post(&$a) {
@@ -71,6 +77,7 @@ function item_post(&$a) {
$location = notags(trim($_POST['location']));
$coord = notags(trim($_POST['coord']));
$verb = notags(trim($_POST['verb']));
+ $emailcc = notags(trim($_POST['emailcc']));
if(! strlen($body)) {
notice( t('Empty post discarded.') . EOL );
@@ -165,7 +172,11 @@ function item_post(&$a) {
}
}
+ /**
+ * Fold multi-line [code] sequences
+ */
+ $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body);
/**
* Look for any tags and linkify them
@@ -412,21 +423,51 @@ function item_post(&$a) {
);
}
}
+ else {
+ logger('mod_item: unable to retrieve post that was just stored.');
+ notify( t('System error. Post not saved.'));
+ goaway($a->get_baseurl() . "/" . $_POST['return'] );
+ // NOTREACHED
+ }
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
logger('mod_item: notifier invoked: ' . "\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &");
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &",
- array(),$foo));
+ proc_run($php_path, "include/notifier.php", $notify_type, "$post_id");
$datarray['id'] = $post_id;
call_hooks('post_local_end', $datarray);
-
+
+ if(strlen($emailcc) && $profile_uid == local_user()) {
+ $erecips = explode(',', $emailcc);
+ if(count($erecips)) {
+ foreach($erecips as $recip) {
+ $addr = trim($recip);
+ if(! strlen($addr))
+ continue;
+ $disclaimer = '<hr />' . t('This message was sent to you by ') . $a->user['username']
+ . t(', a member of the Friendika social network.') . '<br />';
+ $disclaimer .= t('You may visit them online at') . ' '
+ . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '<br />';
+ $disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . '<br />';
+
+ $subject = '[Friendika]' . ' ' . $a->user['username'] . ' ' . t('posted an update.');
+ $headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
+ $headers .= 'MIME-Version: 1.0' . "\n";
+ $headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
+ $headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
+ $link = '<a href="' . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
+ $html = prepare_body($datarray);
+ $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
+ @mail($addr, $subject, $message, $headers);
+ }
+ }
+ }
goaway($a->get_baseurl() . "/" . $_POST['return'] );
- return; // NOTREACHED
+ // NOTREACHED
}
@@ -516,11 +557,11 @@ function item_content(&$a) {
// send the notification upstream/downstream as the case may be
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &",
- array(), $foo));
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" &", array(), $foo));
+ proc_run($php_path,"include/notifier.php","drop","$drop_id");
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
- return; //NOTREACHED
+ //NOTREACHED
}
else {
notice( t('Permission denied.') . EOL);
diff --git a/mod/like.php b/mod/like.php
index 7b2097578..c78c1f030 100644
--- a/mod/like.php
+++ b/mod/like.php
@@ -102,8 +102,8 @@ function like_content(&$a) {
);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
+ proc_run($php_path,"include/notifier.php","like","$post_id");
return;
}
@@ -176,8 +176,8 @@ EOT;
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"like\" \"$post_id\" &", array(),$foo));
+ proc_run($php_path,"include/notifier.php","like","$post_id");
return; // NOTREACHED
} \ No newline at end of file
diff --git a/mod/lockview.php b/mod/lockview.php
index a886effeb..9e64e2608 100644
--- a/mod/lockview.php
+++ b/mod/lockview.php
@@ -2,12 +2,23 @@
function lockview_content(&$a) {
-
- $item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
+
+ $type = (($a->argc > 1) ? $a->argv[1] : 0);
+ if (is_numeric($type)) {
+ $item_id = intval($type);
+ $type='item';
+ } else {
+ $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
+ }
+
if(! $item_id)
killme();
- $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
+ if (!in_array($type, array('item','photo','event')))
+ killme();
+
+ $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1",
+ dbesc($type),
intval($item_id)
);
if(! count($r))
diff --git a/mod/message.php b/mod/message.php
index 9cc2e2826..7615f22be 100644
--- a/mod/message.php
+++ b/mod/message.php
@@ -72,8 +72,8 @@ function message_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
if($post_id) {
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"mail\" \"$post_id\" &", array(),$foo));
+ proc_run($php_path,"include/notifier.php","mail","$post_id");
notice( t('Message sent.') . EOL );
}
else {
diff --git a/mod/network.php b/mod/network.php
index 096c8a79f..2ec06fe61 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -38,11 +38,11 @@ function network_content(&$a, $update = 0) {
$group = 0;
+ $nouveau = false;
+
if(! $update) {
$o .= '<script> $(document).ready(function() { $(\'#nav-network-link\').addClass(\'nav-selected\'); });</script>';
- $nouveau = false;
-
if(($a->argc > 2) && $a->argv[2] === 'new')
$nouveau = true;
@@ -79,15 +79,21 @@ function network_content(&$a, $update = 0) {
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
+ $jotplugins = "";
+ call_hooks('jot_tool', $jotplugins);
+
$o .= replace_macros($tpl,array(
'$return_path' => $a->cmd,
'$baseurl' => $a->get_baseurl(),
'$defloc' => $a->user['default-location'],
'$visitor' => 'block',
+ '$emailcc' => t('CC: email addresses'),
+ '$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb),
'$bang' => (($group) ? '!' : ''),
- '$profile_uid' => $_SESSION['uid']
+ '$profile_uid' => $_SESSION['uid'],
+ '$jotplugins' => $jotplugins
));
@@ -240,7 +246,7 @@ function network_content(&$a, $update = 0) {
'$lock' => $lock,
'$thumb' => $profile_avatar,
'$title' => $item['title'],
- '$body' => bbcode($item['body']),
+ '$body' => smilies(bbcode($item['body'])),
'$ago' => relative_date($item['created']),
'$location' => $location,
'$indent' => '',
@@ -430,8 +436,10 @@ function network_content(&$a, $update = 0) {
}
}
- if(! $update)
+ if(! $update) {
$o .= paginate($a);
+ $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+ }
return $o;
} \ No newline at end of file
diff --git a/mod/photos.php b/mod/photos.php
index e811ca395..52cc66eae 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1,5 +1,4 @@
<?php
-
require_once('include/Photo.php');
require_once('include/items.php');
require_once('include/acl_selectors.php');
@@ -49,9 +48,18 @@ function photos_init(&$a) {
-
function photos_post(&$a) {
+logger('mod/photos.php: photos_post(): begin' , 'LOGGER_DEBUG');
+
+foreach($_REQUEST AS $key => $val) {
+ logger('mod/photos.php: photos_post(): $_REQUEST key: ' . $key . ' val: ' . $val , 'LOGGER_DEBUG');
+}
+
+foreach($_FILES AS $key => $val) {
+ logger('mod/photos.php: photos_post(): $_FILES key: ' . $key . ' val: ' . $val , 'LOGGER_DEBUG');
+}
+
$can_post = false;
$visitor = 0;
@@ -179,9 +187,8 @@ function photos_post(&$a) {
// send the notification upstream/downstream as the case may be
if($rr['visible'])
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",
- array(),$foo));
-
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",array(),$foo));
+ proc_run($php_path,"include/notifier.php","drop","$drop_id");
}
}
}
@@ -228,8 +235,8 @@ function photos_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
if($i[0]['visible'])
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"drop\" \"$drop_id\" & ", array(),$foo));
+ proc_run($php_path,"include/notifier.php","drop","$drop_id");
}
}
@@ -237,20 +244,26 @@ function photos_post(&$a) {
return; // NOTREACHED
}
- if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false))) {
+ if(($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
- $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
- $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
- $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
+ $desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
+ $rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
+ $item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
+ $albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
$resource_id = $a->argv[2];
+ if(! strlen($albname))
+ $albname = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
+
+
$p = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ORDER BY `scale` DESC",
dbesc($resource_id),
intval($page_owner_uid)
);
- if((count($p)) && ($p[0]['desc'] !== $desc)) {
- $r = q("UPDATE `photo` SET `desc` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d",
+ if((count($p)) && (($p[0]['desc'] !== $desc) || ($p[0]['album'] !== $albname))) {
+ $r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d",
dbesc($desc),
+ dbesc($albname),
dbesc($resource_id),
intval($page_owner_uid)
);
@@ -454,8 +467,8 @@ function photos_post(&$a) {
$item_id = item_store($arr);
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"tag\" \"$item_id\" & ",array(),$foo));
+ proc_run($php_path,"include/notifier.php","tag","$item_id");
}
}
@@ -466,18 +479,20 @@ function photos_post(&$a) {
}
- // default post action - upload a photo
+ /**
+ * default post action - upload a photo
+ */
- if(! x($_FILES,'userfile'))
- killme();
+ call_hooks('photo_post_init', $_POST);
- if($_POST['partitionCount'])
- $java_upload = true;
- else
- $java_upload = false;
+ /**
+ * Determine the album to use
+ */
- $album = notags(trim($_POST['album']));
- $newalbum = notags(trim($_POST['newalbum']));
+ $album = notags(trim($_REQUEST['album']));
+ $newalbum = notags(trim($_REQUEST['newalbum']));
+
+ logger('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum , 'LOGGER_DEBUG');
if(! strlen($album)) {
if(strlen($newalbum))
@@ -486,6 +501,16 @@ function photos_post(&$a) {
$album = datetime_convert('UTC',date_default_timezone_get(),'now', 'Y');
}
+ /**
+ *
+ * We create a wall item for every photo, but we don't want to
+ * overwhelm the data stream with a hundred newly uploaded photos.
+ * So we will make one photo (the first one uploaded to this album)
+ * visible by default, the rest will become visible over time when and if
+ * they acquire comments, likes, dislikes, and/or tags
+ *
+ */
+
$r = q("SELECT * FROM `photo` WHERE `album` = '%s' AND `uid` = %d",
dbesc($album),
intval($page_owner_uid)
@@ -495,15 +520,25 @@ function photos_post(&$a) {
else
$visible = 0;
+ $str_group_allow = perms2str(((is_array($_REQUEST['group_allow'])) ? $_REQUEST['group_allow'] : explode(',',$_REQUEST['group_allow'])));
+ $str_contact_allow = perms2str(((is_array($_REQUEST['contact_allow'])) ? $_REQUEST['contact_allow'] : explode(',',$_REQUEST['contact_allow'])));
+ $str_group_deny = perms2str(((is_array($_REQUEST['group_deny'])) ? $_REQUEST['group_deny'] : explode(',',$_REQUEST['group_deny'])));
+ $str_contact_deny = perms2str(((is_array($_REQUEST['contact_deny'])) ? $_REQUEST['contact_deny'] : explode(',',$_REQUEST['contact_deny'])));
- $str_group_allow = perms2str($_POST['group_allow']);
- $str_contact_allow = perms2str($_POST['contact_allow']);
- $str_group_deny = perms2str($_POST['group_deny']);
- $str_contact_deny = perms2str($_POST['contact_deny']);
+ $ret = array('src' => '', 'filename' => '', 'filesize' => 0);
- $src = $_FILES['userfile']['tmp_name'];
- $filename = basename($_FILES['userfile']['name']);
- $filesize = intval($_FILES['userfile']['size']);
+ call_hooks('photo_post_file',$ret);
+
+ if(x($ret,'src') && x($ret,'filesize')) {
+ $src = $ret['src'];
+ $filename = $ret['filename'];
+ $filesize = $ret['filesize'];
+ }
+ else {
+ $src = $_FILES['userfile']['tmp_name'];
+ $filename = basename($_FILES['userfile']['name']);
+ $filesize = intval($_FILES['userfile']['size']);
+ }
$maximagesize = get_config('system','maximagesize');
@@ -513,10 +548,13 @@ function photos_post(&$a) {
return;
}
+ logger('mod/photos.php: photos_post(): loading the contents of ' . $src , 'LOGGER_DEBUG');
+
$imagedata = @file_get_contents($src);
$ph = new Photo($imagedata);
if(! $ph->is_valid()) {
+ logger('mod/photos.php: photos_post(): unable to process image' , 'LOGGER_DEBUG');
notice( t('Unable to process image.') . EOL );
@unlink($src);
killme();
@@ -524,7 +562,7 @@ function photos_post(&$a) {
@unlink($src);
- $width = $ph->getWidth();
+ $width = $ph->getWidth();
$height = $ph->getHeight();
$smallest = 0;
@@ -534,6 +572,7 @@ function photos_post(&$a) {
$r = $ph->store($page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
if(! $r) {
+ logger('mod/photos.php: photos_post(): image store failed' , 'LOGGER_DEBUG');
notice( t('Image upload failed.') . EOL );
killme();
}
@@ -555,7 +594,6 @@ function photos_post(&$a) {
// Create item container
-
$arr = array();
$arr['uid'] = $page_owner_uid;
@@ -584,14 +622,13 @@ function photos_post(&$a) {
$item_id = item_store($arr);
- if(! $java_upload) {
- goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
- return; // NOTREACHED
- }
+ call_hooks('photo_post_end',intval($item_id));
- killme();
- return; // NOTREACHED
+ // addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
+ // if they do not wish to be redirected
+ goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
+ // NOTREACHED
}
@@ -737,6 +774,22 @@ function photos_content(&$a) {
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
$albumselect .= '</select>';
+
+ $uploader = '';
+
+ $ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'],
+ 'addon_text' => $uploader,
+ 'default_upload' => true);
+
+
+ call_hooks('photo_upload_form',$ret);
+
+ $default_upload = '<input type="file" name="userfile" /> <div class="photos-upload-submit-wrapper" >
+ <input type="submit" name="submit" value="' . t('Submit') . '" id="photos-upload-submit" /> </div>';
+
+
+
+
$tpl = load_view_file('view/photos_upload.tpl');
$o .= replace_macros($tpl,array(
'$pagename' => t('Upload Photos'),
@@ -744,14 +797,13 @@ function photos_content(&$a) {
'$nickname' => $a->data['user']['nickname'],
'$newalbum' => t('New album name: '),
'$existalbumtext' => t('or existing album name: '),
- '$filestext' => t('Select files to upload: '),
'$albumselect' => $albumselect,
'$permissions' => t('Permissions'),
'$aclselect' => (($visitor) ? '' : populate_acl($a->user, $celeb)),
- '$archive' => $a->get_baseurl() . '/jumploader_z.jar',
- '$nojava' => t('Use the following controls only if the Java uploader [above] fails to launch.'),
- '$uploadurl' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'],
- '$submit' => t('Submit')
+ '$uploader' => $ret['addon_text'],
+ '$default' => (($ret['default_upload']) ? $default_upload : ''),
+ '$uploadurl' => $ret['post_url']
+
));
return $o;
@@ -861,7 +913,15 @@ function photos_content(&$a) {
$o .= '<h3>' . '<a href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($ph[0]['album']) . '">' . $ph[0]['album'] . '</a></h3>';
if($can_post && ($ph[0]['uid'] == $owner_uid)) {
- $o .= '<div id="photo-edit-link-wrap" ><a id="photo-edit-link" href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit' . '">' . t('Edit photo') . '</a></div>';
+ $o .= '<div id="photo-edit-link-wrap" ><a id="photo-edit-link" href="' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $datum . '/edit' . '">' . t('Edit photo') . '</a>';
+
+ // lock
+ $o .= ( ( ($ph[0]['uid'] == local_user()) && (strlen($ph[0]['allow_cid']) || strlen($ph[0]['allow_gid'])
+ || strlen($ph[0]['deny_cid']) || strlen($ph[0]['deny_gid'])) )
+ ? ' - <img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,\'photo/' . $ph[0]['id'] . '\');" />'
+ : '');
+
+ $o .= '</div>';
}
@@ -943,6 +1003,8 @@ function photos_content(&$a) {
$edit_tpl = load_view_file('view/photo_edit.tpl');
$o .= replace_macros($edit_tpl, array(
'$id' => $ph[0]['id'],
+ '$album' => $ph[0]['album'],
+ '$newalbum' => t('New album name'),
'$nickname' => $a->data['user']['nickname'],
'$resource_id' => $ph[0]['resource-id'],
'$capt_label' => t('Caption'),
@@ -1154,3 +1216,4 @@ function photos_content(&$a) {
$o .= paginate($a);
return $o;
}
+
diff --git a/mod/profile.php b/mod/profile.php
index 936379360..91c1ba6d8 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -134,15 +134,22 @@ function profile_content(&$a, $update = 0) {
$lockstate = 'lock';
else
$lockstate = 'unlock';
+
+ $jotplugins = "";
+ call_hooks('jot_tool', $jotplugins);
+
$o .= replace_macros($tpl,array(
'$baseurl' => $a->get_baseurl(),
'$defloc' => (($is_owner) ? $a->user['default-location'] : ''),
'$return_path' => $a->cmd,
'$visitor' => (($is_owner || $commvisitor) ? 'block' : 'none'),
'$lockstate' => $lockstate,
+ '$emailcc' => t('CC: email addresses'),
+ '$emtitle' => t('Example: bob@example.com, mary@example.com'),
'$bang' => '',
'$acl' => (($is_owner) ? populate_acl($a->user, $celeb) : ''),
- '$profile_uid' => $a->profile['profile_uid']
+ '$profile_uid' => $a->profile['profile_uid'],
+ '$jotplugins' => $jotplugins
));
}
@@ -379,6 +386,8 @@ function profile_content(&$a, $update = 0) {
}
$o .= paginate($a);
+ $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
+
return $o;
}
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index 64093b2de..8b72bfca0 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -90,8 +90,8 @@ function profile_photo_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url')))
- proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo));
+ proc_run($php_path,"include/directory.php","$url");
}
else
notice( t('Unable to process image') . EOL);
diff --git a/mod/profiles.php b/mod/profiles.php
index 0bb476549..d74219501 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -203,8 +203,8 @@ function profiles_post(&$a) {
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url')))
- proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &", array(),$foo));
+ proc_run($php_path,"include/directory.php","$url");
}
}
}
diff --git a/mod/removeme.php b/mod/removeme.php
new file mode 100644
index 000000000..62b9a6d13
--- /dev/null
+++ b/mod/removeme.php
@@ -0,0 +1,50 @@
+<?php
+
+function removeme_post(&$a) {
+
+ if(! local_user())
+ return;
+
+ if((! x($_POST,'qxz_password')) || (! strlen(trim($_POST['qxz_password']))))
+ return;
+
+ if((! x($_POST,'verify')) || (! strlen(trim($_POST['verify']))))
+ return;
+
+ if($_POST['verify'] !== $_SESSION['remove_account_verify'])
+ return;
+
+ $encrypted = hash('whirlpool',trim($_POST['qxz_password']));
+
+ if((strlen($a->user['password'])) && ($encrypted === $a->user['password'])) {
+ require_once('include/Contact.php');
+ user_remove($a->user['uid']);
+ // NOTREACHED
+ }
+
+}
+
+
+
+function removeme_content(&$a) {
+
+ if(! local_user())
+ goaway($a->get_baseurl());
+
+ $hash = random_string();
+
+ $_SESSION['remove_account_verify'] = $hash;
+
+ $tpl = load_view_file('view/removeme.tpl');
+ $o .= replace_macros($tpl, array(
+ '$basedir' => $a->get_baseurl(),
+ '$hash' => $hash,
+ '$title' => t('Remove My Account'),
+ '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'),
+ '$passwd' => t('Please enter your password for verification:'),
+ '$submit' => t('Remove My Account')
+ ));
+
+ return $o;
+
+} \ No newline at end of file
diff --git a/mod/settings.php b/mod/settings.php
index 1923c58da..dbbac8bde 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -87,11 +87,14 @@ function settings_post(&$a) {
$err = '';
+ $name_change = false;
+
if($username != $a->user['username']) {
- if(strlen($username) > 40)
- $err .= t(' Please use a shorter name.');
- if(strlen($username) < 3)
- $err .= t(' Name too short.');
+ $name_change = true;
+ if(strlen($username) > 40)
+ $err .= t(' Please use a shorter name.');
+ if(strlen($username) < 3)
+ $err .= t(' Name too short.');
}
if($email != $a->user['email']) {
@@ -165,13 +168,22 @@ function settings_post(&$a) {
intval(local_user())
);
+
+ if($name_change) {
+ q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
+ dbesc($username),
+ dbesc(datetime_convert()),
+ intval(local_user())
+ );
+ }
+
if($old_visibility != $net_publish) {
// Update global directory in background
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
$url = $_SESSION['my_url'];
if($url && strlen(get_config('system','directory_submit_url')))
- proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
- array(),$foo));
+ //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo));
+ proc_run($php_path,"include/directory.php","$url");
}
$_SESSION['theme'] = $theme;
diff --git a/mod/viewcontacts.php b/mod/viewcontacts.php
index bd73b2ffb..90ff85b9d 100644
--- a/mod/viewcontacts.php
+++ b/mod/viewcontacts.php
@@ -43,7 +43,7 @@ function viewcontacts_content(&$a) {
'$id' => $rr['id'],
'$alt_text' => t('Visit ') . $rr['name'] . t('\'s profile'),
'$thumb' => $rr['thumb'],
- '$name' => $rr['name'],
+ '$name' => substr($rr['name'],0,20),
'$url' => $rr['url']
));
}