diff options
author | Simon L'nu <simon.lnu@gmail.com> | 2012-05-09 14:00:54 -0400 |
---|---|---|
committer | Simon L'nu <simon.lnu@gmail.com> | 2012-05-09 14:00:54 -0400 |
commit | 39a7926015f06c96aeb3ae1439fdec97fc123c59 (patch) | |
tree | 2e0fc7f6e58e8b1d216f1a03809d55e5fdcd1e96 /mod | |
parent | 34d3d455892cbad299aac8710016daffefb1c4cb (diff) | |
parent | 53157bb954acb7597347c6b4a87e64e7a2f6cc79 (diff) | |
download | volse-hubzilla-39a7926015f06c96aeb3ae1439fdec97fc123c59.tar.gz volse-hubzilla-39a7926015f06c96aeb3ae1439fdec97fc123c59.tar.bz2 volse-hubzilla-39a7926015f06c96aeb3ae1439fdec97fc123c59.zip |
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master:
send browser back to correct page (with query args) after posting
slight improvement in a couple of queries
Diabook-dark - do things the right way instead of the stupid way.
Fix TinyMCE, but needs adding to theme.php
Fix jquery.fancybox, but still needs adding to theme.php
Diabook-dark cleaned up a bit.
don't provide 'show more' on remote friends in common unless there are actually more
make it optional to optimize the item table after expire
wrap private message autocomplete in an ifdef to make it easier to test/develop
DE update for the strings
make mod-follow hookable (e.g. service class limits) and also begin to prepare it for functionalisation
* master:
Diffstat (limited to 'mod')
-rw-r--r-- | mod/follow.php | 45 | ||||
-rw-r--r-- | mod/message.php | 21 | ||||
-rw-r--r-- | mod/network.php | 16 |
3 files changed, 50 insertions, 32 deletions
diff --git a/mod/follow.php b/mod/follow.php index ae8cb200c..4a7f99bf0 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -10,7 +10,10 @@ function follow_init(&$a) { // NOTREACHED } + $uid = local_user(); $url = $orig_url = notags(trim($_REQUEST['url'])); + $return_url = $_SESSION['return_url']; + // remove ajax junk, e.g. Twitter @@ -18,19 +21,25 @@ function follow_init(&$a) { if(! allowed_url($url)) { notice( t('Disallowed profile URL.') . EOL); - goaway($_SESSION['return_url']); + goaway($return_url); // NOTREACHED } if(! $url) { notice( t('Connect URL missing.') . EOL); - goaway($_SESSION['return_url']); + goaway($return_url); // NOTREACHED } + $arr = array('url' => $url, 'contact' => array()); + + call_hooks('follow', $arr); - $ret = probe_url($url); + if(x($arr['contact'],'name')) + $ret = $arr['contact']; + else + $ret = probe_url($url); if($ret['network'] === NETWORK_DFRN) { if(strlen($a->path)) @@ -46,11 +55,11 @@ function follow_init(&$a) { if(get_config('system','dfrn_only')) { notice( t('This site is not configured to allow communications with other networks.') . EOL); notice( t('No compatible communication protocols or feeds were discovered.') . EOL); - goaway($_SESSION['return_url']); + goaway($return_url); } } - // This just confuses things, remove it + // This extra param just confuses things, remove it if($ret['network'] === NETWORK_DIASPORA) $ret['url'] = str_replace('?absolute=true','',$ret['url']); @@ -65,9 +74,11 @@ function follow_init(&$a) { notice( t('An author or name was not found.') . EOL); if(! x($ret,'url')) notice( t('No browser URL could be matched to this address.') . EOL); - if(strpos($url,'@') !== false) - notice('Unable to match @-style Identity Address with a known protocol or email contact'); - goaway($_SESSION['return_url']); + if(strpos($url,'@') !== false) { + notice( t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL); + notice( t('Use mailto: in front of address to force email check.') . EOL); + } + goaway($return_url); } if($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) { @@ -94,7 +105,7 @@ function follow_init(&$a) { // indirect links or webfinger links $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `poll` = '%s' LIMIT 1", - intval(local_user()), + intval($uid), dbesc($ret['poll']) ); @@ -104,7 +115,7 @@ function follow_init(&$a) { q("UPDATE `contact` SET `rel` = %d , `readonly` = 0 WHERE `id` = %d AND `uid` = %d LIMIT 1", intval(CONTACT_IS_FRIEND), intval($r[0]['id']), - intval(local_user()) + intval($uid) ); } } @@ -118,7 +129,7 @@ function follow_init(&$a) { $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`, `writable`, `hidden`, `blocked`, `readonly`, `pending` ) VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d, 0, 0, 0 ) ", - intval(local_user()), + intval($uid), dbesc(datetime_convert()), dbesc($ret['url']), dbesc(normalise_link($ret['url'])), @@ -142,12 +153,12 @@ function follow_init(&$a) { $r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1", dbesc($ret['url']), - intval(local_user()) + intval($uid) ); if(! count($r)) { notice( t('Unable to retrieve contact information.') . EOL); - goaway($_SESSION['return_url']); + goaway($return_url); // NOTREACHED } @@ -156,7 +167,7 @@ function follow_init(&$a) { require_once("Photo.php"); - $photos = import_profile_photo($ret['photo'],local_user(),$contact_id); + $photos = import_profile_photo($ret['photo'],$uid,$contact_id); $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', @@ -200,7 +211,7 @@ function follow_init(&$a) { $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` WHERE `user`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1", - intval(local_user()) + intval($uid) ); if(count($r)) { @@ -215,9 +226,9 @@ function follow_init(&$a) { } } - if(strstr($_SESSION['return_url'],'contacts')) + if(strstr($return_url,'contacts')) goaway($a->get_baseurl() . '/contacts/' . $contact_id); - goaway($_SESSION['return_url']); + goaway($return_url); // NOTREACHED } diff --git a/mod/message.php b/mod/message.php index 867f199c4..b8695fdd9 100644 --- a/mod/message.php +++ b/mod/message.php @@ -173,15 +173,22 @@ function message_content(&$a) { $preselect = (isset($a->argv[2])?array($a->argv[2]):false); - $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10); + if(defined('EMAIL_AUTOCOMP')) { -// here's sort of where we want to do contact autocomplete -// comment out the contact selector line just above and use the following one instead, -// then figure out how to make it do the right thing -// pictures would be nice, but that didn't seem to work when I tried it -// (the json backend is found in mod/acl.php) + // here's where we want to do contact autocomplete + // just figure out how to make it do the right thing + // pictures would be nice, but that didn't work when I tried. + // It sort of barely works, but needs help + // (the json backend is found in mod/acl.php) -// $select = '<input type="text" id="recip" name="messageto" value="' . $preselect .'" />'; + $select = '<input type="text" id="recip" name="messageto" value="' . $preselect .'" />'; + } + else { + + // the ugly select box + + $select = contact_select('messageto','message-to-select', $preselect, 4, true, false, false, 10); + } $tpl = get_markup_template('prv_message.tpl'); $o .= replace_macros($tpl,array( diff --git a/mod/network.php b/mod/network.php index 5655f1bfa..e59839ccc 100644 --- a/mod/network.php +++ b/mod/network.php @@ -340,7 +340,7 @@ function network_content(&$a, $update = 0) { info( t('Group is empty')); } - $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` REGEXP '<" . intval($group) . ">' ) and deleted = 0 ) "; + $sql_extra = " AND `item`.`parent` IN ( SELECT DISTINCT(`parent`) FROM `item` WHERE 1 $sql_options AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` like '" . protect_sprintf('%<' . intval($group) . '>%') . "' ) and deleted = 0 ) "; $o = '<h2>' . t('Group: ') . $r[0]['name'] . '</h2>' . $o; } elseif($cid) { @@ -398,9 +398,9 @@ function network_content(&$a, $update = 0) { if(x($_GET,'search')) { $search = escape_tags($_GET['search']); - $sql_extra .= sprintf(" AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) ", - dbesc(preg_quote($search)), - dbesc('\\]' . preg_quote($search) . '\\[') + $sql_extra .= sprintf(" AND ( `item`.`body` like '%s' OR `item`.`tag` like '%s' ) ", + dbesc(protect_sprintf('%' . $search . '%')), + dbesc(protect_sprintf('%]' . $search . '[%')) ); } if(strlen($file)) { @@ -412,10 +412,10 @@ function network_content(&$a, $update = 0) { $myurl = substr($myurl,strpos($myurl,'://')+3); $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); $diasp_url = str_replace('/profile/','/u/',$myurl); - $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` regexp '%s' or `tag` regexp '%s' or tag regexp '%s' )) ", - dbesc($myurl . '$'), - dbesc($myurl . '\\]'), - dbesc($diasp_url . '\\]') + $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` like '%s' or `tag` like '%s' or tag like '%s' )) ", + dbesc(protect_sprintf('%s' . $myurl)), + dbesc(protect_sprintf('%' . $myurl . '\\]%')), + dbesc(protect_sprintf('%' . $diasp_url . '\\]%')) ); } |