aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/dfrn_confirm.php56
-rw-r--r--mod/dfrn_request.php1
-rw-r--r--mod/follow.php2
-rw-r--r--mod/install.php19
-rw-r--r--mod/item.php106
-rw-r--r--mod/profile.php3
-rw-r--r--mod/settings.php8
7 files changed, 152 insertions, 43 deletions
diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php
index c20770481..6b9bbfe13 100644
--- a/mod/dfrn_confirm.php
+++ b/mod/dfrn_confirm.php
@@ -386,7 +386,63 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if($r === false)
notice( t('Unable to set contact photo.') . EOL);
+ // reload contact info
+ $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
+ intval($contact_id)
+ );
+ if(count($r))
+ $contact = $r[0];
+ else
+ $contact = null;
+
+ // Send a new friend post if we are allowed to...
+
+ $r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
+ intval($uid)
+ );
+ if((count($r)) && ($r[0]['hide-friends'] == 0) && (is_array($contact)) && isset($new_relation) && ($new_relation == REL_BUD)) {
+
+ require_once('include/items.php');
+
+ $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
+ intval($uid)
+ );
+
+ if(count($self)) {
+
+ $arr = array();
+ $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
+ $arr['uid'] = $uid;
+ $arr['contact-id'] = $self[0]['id'];
+ $arr['wall'] = 1;
+ $arr['type'] = 'wall';
+ $arr['gravity'] = 0;
+ $arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
+ $arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
+ $arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
+ $arr['verb'] = ACTIVITY_FRIEND;
+ $arr['object-type'] = ACTIVITY_OBJ_PERSON;
+ $arr['body'] = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url] ' . t('is now friends with')
+ . ' [url=' . $contact['url'] . ']' . $contact['name'] . '[/url]' . "\n\n\n"
+ . ' [url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
+
+ $arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
+ . '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>';
+ $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
+ $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
+ $arr['object'] .= '</link></object>' . "\n";
+
+ $i = item_store($arr);
+
+ $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));
+
+ }
+
+ }
// Let's send our user to the contact editor in case they want to
// do anything special with this new friend.
diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php
index 6cefdd28e..93ef4097b 100644
--- a/mod/dfrn_request.php
+++ b/mod/dfrn_request.php
@@ -444,7 +444,6 @@ function dfrn_request_content(&$a) {
if(($a->argc != 2) || (! count($a->profile)))
return "";
- $a->page['template'] = 'profile';
// "Homecoming". Make sure we're logged in to this site as the correct user. Then offer a confirm button
// to send us to the post section to record the introduction.
diff --git a/mod/follow.php b/mod/follow.php
index d5651ea39..5f0f3f7e3 100644
--- a/mod/follow.php
+++ b/mod/follow.php
@@ -182,7 +182,7 @@ function follow_post(&$a) {
);
- if((x($contact,'notify')) && (strlen($contact['notify']))) {
+ if((count($r)) && (x($contact,'notify')) && (strlen($contact['notify']))) {
require_once('include/salmon.php');
slapper($r[0],$contact['notify'],$slap);
}
diff --git a/mod/install.php b/mod/install.php
index 9043459b8..643f9a55c 100644
--- a/mod/install.php
+++ b/mod/install.php
@@ -15,7 +15,7 @@ function install_post(&$a) {
require_once("dba.php");
- $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
+ $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
if(mysqli_connect_errno()) {
$db = new dba($dbhost, $dbuser, $dbpass, '', true);
@@ -24,7 +24,7 @@ function install_post(&$a) {
dbesc($dbdata)
);
if($r)
- $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, $true);
+ $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
}
if(mysqli_connect_errno()) {
notice( t('Could not create/connect to database.') . EOL);
@@ -65,14 +65,14 @@ function install_post(&$a) {
notice( t('Database import succeeded.') . EOL
. t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.') . EOL
- . t('Please see the file INSTALL.') . EOL );
+ . t('Please see the file "INSTALL.txt".') . EOL );
goaway($a->get_baseurl() . '/register' );
}
else {
$db = null; // start fresh
notice( t('Database import failed.') . EOL
. t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL
- . t('Please see the file INSTALL.') . EOL );
+ . t('Please see the file "INSTALL.txt".') . EOL );
}
}
@@ -151,9 +151,10 @@ function check_keys() {
// Get private key
- if(! $res)
- $o .= t('Error: the "openssl_pkey_new" function on this system is not able to generate encryption keys') . EOL;
-
+ if(! $res) {
+ $o .= t('Error: the "openssl_pkey_new" function on this system is not able to generate encryption keys') . EOL;
+ $o .= t('If running under Windows, please see "http://www.php.net/manual/en/openssl.installation.php".') . EOL;
+ }
return $o;
}
@@ -171,7 +172,7 @@ function check_funcs() {
if(! function_exists('mysqli_connect'))
notice( t('Error: mysqli PHP module required but not installed.') . EOL);
if((x($_SESSION,'sysmsg')) && strlen($_SESSION['sysmsg']))
- notice( t('Please see the file "INSTALL".') . EOL);
+ notice( t('Please see the file "INSTALL.txt".') . EOL);
}
@@ -183,7 +184,7 @@ function check_htconfig() {
$o = t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.');
$o .= t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.');
$o .= t('Please check with your site documentation or support people to see if this situation can be corrected.');
- $o .= t('If not, you may be required to perform a manual installation. Please see the file "INSTALL" for instructions.');
+ $o .= t('If not, you may be required to perform a manual installation. Please see the file "INSTALL.txt" for instructions.');
}
return $o;
diff --git a/mod/item.php b/mod/item.php
index f0c2cc644..0982bb35d 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -81,8 +81,10 @@ function item_post(&$a) {
// get contact info for poster
$author = null;
+ $self = false;
if(($_SESSION['uid']) && ($_SESSION['uid'] == $profile_uid)) {
+ $self = true;
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($_SESSION['uid'])
);
@@ -206,40 +208,82 @@ function item_post(&$a) {
$uri = item_new_uri($a->get_hostname(),$profile_uid);
+ $datarray = array();
+ $datarray['uid'] = $profile_uid;
+ $datarray['type'] = $post_type;
+ $datarray['wall'] = $wall;
+ $datarray['gravity'] = $gravity;
+ $datarray['contact-id'] = $contact_id;
+ $datarray['owner-name'] = $contact_record['name'];
+ $datarray['owner-link'] = $contact_record['url'];
+ $datarray['owner-avatar'] = $contact_record['thumb'];
+ $datarray['author-name'] = $author['name'];
+ $datarray['author-link'] = $author['url'];
+ $datarray['author-avatar'] = $author['thumb'];
+ $datarray['created'] = datetime_convert();
+ $datarray['edited'] = datetime_convert();
+ $datarray['changed'] = datetime_convert();
+ $datarray['uri'] = $uri;
+ $datarray['title'] = $title;
+ $datarray['body'] = $body;
+ $datarray['location'] = $location;
+ $datarray['coord'] = $coord;
+ $datarray['tag'] = $str_tags;
+ $datarray['inform'] = $inform;
+ $datarray['verb'] = $verb;
+ $datarray['allow_cid'] = $str_contact_allow;
+ $datarray['allow_gid'] = $str_group_allow;
+ $datarray['deny_cid'] = $str_contact_deny;
+ $datarray['deny_gid'] = $str_group_deny;
+ $datarray['private'] = $private;
+
+ /**
+ * These fields are for the convenience of plugins...
+ * 'self' if true indicates the owner is posting on their own wall
+ * If parent is 0 it is a top-level post.
+ */
+
+ $datarray['parent'] = $parent;
+ $datarray['self'] = $self;
+
+
+ call_hooks('post_local',$datarray);
+
$r = q("INSERT INTO `item` (`uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `changed`, `uri`, `title`, `body`, `location`, `coord`,
`tag`, `inform`, `verb`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private` )
VALUES( %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )",
- intval($profile_uid),
- dbesc($post_type),
- intval($wall),
- intval($gravity),
- intval($contact_id),
- dbesc($contact_record['name']),
- dbesc($contact_record['url']),
- dbesc($contact_record['thumb']),
- dbesc($author['name']),
- dbesc($author['url']),
- dbesc($author['thumb']),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($uri),
- dbesc($title),
- dbesc($body),
- dbesc($location),
- dbesc($coord),
- dbesc($str_tags),
- dbesc($inform),
- dbesc($verb),
- dbesc($str_contact_allow),
- dbesc($str_group_allow),
- dbesc($str_contact_deny),
- dbesc($str_group_deny),
- intval($private)
+ intval($datarray['uid']),
+ dbesc($datarray['type']),
+ intval($datarray['wall']),
+ intval($datarray['gravity']),
+ intval($datarray['contact-id']),
+ dbesc($datarray['owner-name']),
+ dbesc($datarray['owner-link']),
+ dbesc($datarray['owner-avatar']),
+ dbesc($datarray['author-name']),
+ dbesc($datarray['author-link']),
+ dbesc($datarray['author-avatar']),
+ dbesc($datarray['created']),
+ dbesc($datarray['edited']),
+ dbesc($datarray['changed']),
+ dbesc($datarray['uri']),
+ dbesc($datarray['title']),
+ dbesc($datarray['body']),
+ dbesc($datarray['location']),
+ dbesc($datarray['coord']),
+ dbesc($datarray['tag']),
+ dbesc($datarray['inform']),
+ dbesc($datarray['verb']),
+ dbesc($datarray['allow_cid']),
+ dbesc($datarray['allow_gid']),
+ dbesc($datarray['deny_cid']),
+ dbesc($datarray['deny_gid']),
+ intval($datarray['private'])
);
+
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
- dbesc($uri));
+ dbesc($datarray['uri']));
if(count($r)) {
$post_id = $r[0]['id'];
logger('mod_item: saved item ' . $post_id);
@@ -276,7 +320,7 @@ function item_post(&$a) {
'$email' => $user['email'],
'$from' => $from,
'$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
- '$body' => strip_tags(bbcode($body))
+ '$body' => strip_tags(bbcode($datarray['body']))
));
$res = mail($user['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
@@ -299,7 +343,7 @@ function item_post(&$a) {
'$email' => $user['email'],
'$from' => $from,
'$display' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
- '$body' => strip_tags(bbcode($body))
+ '$body' => strip_tags(bbcode($datarray['body']))
));
$res = mail($user['email'], $from . t(" posted on your profile wall at ") . $a->config['sitename'],
@@ -352,7 +396,7 @@ function item_post(&$a) {
'cookie' => true
));
try {
- $statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> bbcode($body), 'cb' => ''));
+ $statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> bbcode($datarray['body']), 'cb' => ''));
}
catch (FacebookApiException $e) {
notice( t('Facebook status update failed.') . EOL);
diff --git a/mod/profile.php b/mod/profile.php
index b40617d03..b1f020930 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -97,6 +97,9 @@ function profile_content(&$a, $update = 0) {
require_once("view/$profile_lang/profile_advanced.php");
else
require_once('view/profile_advanced.php');
+
+ call_hooks('profile_advanced',$o);
+
return $o;
}
diff --git a/mod/settings.php b/mod/settings.php
index b86ff4c1c..4743ecd66 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -14,6 +14,9 @@ function settings_post(&$a) {
notice( t('Permission denied.') . EOL);
return;
}
+
+ call_hooks('settings_post', $_POST);
+
if(count($a->user) && x($a->user,'uid') && $a->user['uid'] != local_user()) {
notice( t('Permission denied.') . EOL);
return;
@@ -298,6 +301,9 @@ function settings_content(&$a) {
'$pagetype' => $pagetype
));
+ call_hooks('settings_page',$o);
+
return $o;
-}} \ No newline at end of file
+}}
+