diff options
author | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2012-03-17 08:44:36 +0100 |
---|---|---|
committer | Tobias Diekershoff <tobias.diekershoff@gmx.net> | 2012-03-17 08:44:36 +0100 |
commit | 96da328acf838faff3fe823f3dd7557d16fe1d8b (patch) | |
tree | fb26adfc9fc61077033fa707fae24ba70ee9876a /mod | |
parent | 74c64ef2d244df47b2bea6527bbeb5cc62ca8845 (diff) | |
parent | 057a142b8cd01cd8ab6212e9d958989c82dfccc3 (diff) | |
download | volse-hubzilla-96da328acf838faff3fe823f3dd7557d16fe1d8b.tar.gz volse-hubzilla-96da328acf838faff3fe823f3dd7557d16fe1d8b.tar.bz2 volse-hubzilla-96da328acf838faff3fe823f3dd7557d16fe1d8b.zip |
Merge branch 'master' of https://github.com/friendica/friendica
Diffstat (limited to 'mod')
-rwxr-xr-x | mod/display.php | 10 | ||||
-rwxr-xr-x | mod/item.php | 192 | ||||
-rwxr-xr-x | mod/message.php | 2 | ||||
-rwxr-xr-x | mod/network.php | 2 | ||||
-rwxr-xr-x | mod/settings.php | 14 |
5 files changed, 114 insertions, 106 deletions
diff --git a/mod/display.php b/mod/display.php index f428149e8..81ed174ac 100755 --- a/mod/display.php +++ b/mod/display.php @@ -16,7 +16,15 @@ function display_content(&$a) { $o = '<div id="live-display"></div>' . "\r\n"; - $a->page['htmlhead'] .= '<script>$(document).ready(function() { $(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl"); });</script>'; + $a->page['htmlhead'] .= <<<EOT +<script> +$(document).ready(function() { + $(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl"); + // make auto-complete work in more places + $(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl"); +}); +</script> +EOT; $nick = (($a->argc > 1) ? $a->argv[1] : ''); diff --git a/mod/item.php b/mod/item.php index 98cfb4338..fe570075f 100755 --- a/mod/item.php +++ b/mod/item.php @@ -832,129 +832,129 @@ function item_content(&$a) { */ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { //is it a hash tag? - if(strpos($tag,'#') === 0) {
+ if(strpos($tag,'#') === 0) { //if the tag is replaced... if(strpos($tag,'[url=')) - //...do nothing
- continue; - //base tag has the tags name only
- $basetag = str_replace('_',' ',substr($tag,1));
+ //...do nothing + return; + //base tag has the tags name only + $basetag = str_replace('_',' ',substr($tag,1)); //create text for link $newtag = '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]'; - //replace tag by the link
- $body = str_replace($tag, $newtag, $body);
+ //replace tag by the link + $body = str_replace($tag, $newtag, $body); - //is the link already in str_tags?
- if(! stristr($str_tags,$newtag)) {
+ //is the link already in str_tags? + if(! stristr($str_tags,$newtag)) { //append or set str_tags - if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= $newtag;
- }
- return;
+ if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= $newtag; + } + return; } - //is it a person tag?
- if(strpos($tag,'@') === 0) {
+ //is it a person tag? + if(strpos($tag,'@') === 0) { //is it already replaced? - if(strpos($tag,'[url='))
- continue;
- $stat = false;
+ if(strpos($tag,'[url=')) + return; + $stat = false; //get the person's name $name = substr($tag,1); - //is it a link or a full dfrn address?
- if((strpos($name,'@')) || (strpos($name,'http://'))) {
- $newname = $name;
+ //is it a link or a full dfrn address? + if((strpos($name,'@')) || (strpos($name,'http://'))) { + $newname = $name; //get the profile links - $links = @lrdd($name);
- if(count($links)) {
+ $links = @lrdd($name); + if(count($links)) { //for all links, collect how is to inform and how's profile is to link - foreach($links as $link) {
- if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
- $profile = $link['@attributes']['href'];
- if($link['@attributes']['rel'] === 'salmon') {
- if(strlen($inform))
- $inform .= ',';
- $inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']);
- }
- }
- }
- } else { //if it is a name rather than an address
- $newname = $name;
- $alias = '';
+ foreach($links as $link) { + if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page') + $profile = $link['@attributes']['href']; + if($link['@attributes']['rel'] === 'salmon') { + if(strlen($inform)) + $inform .= ','; + $inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']); + } + } + } + } else { //if it is a name rather than an address + $newname = $name; + $alias = ''; $tagcid = 0; - //is it some generated name?
- if(strrpos($newname,'+')) {
+ //is it some generated name? + if(strrpos($newname,'+')) { //get the id - $tagcid = intval(substr($newname,strrpos($newname,'+') + 1));
+ $tagcid = intval(substr($newname,strrpos($newname,'+') + 1)); //remove the next word from tag's name - if(strpos($name,' ')) {
+ if(strpos($name,' ')) { $name = substr($name,0,strpos($name,' ')); - }
+ } } if($tagcid) { //if there was an id - //select contact with that id from the logged in user's contact list
- $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($tagcid),
+ //select contact with that id from the logged in user's contact list + $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + intval($tagcid), intval($profile_uid) - );
+ ); } elseif(strstr($name,'_') || strstr($name,' ')) { //no id - //get the real name
- $newname = str_replace('_',' ',$name);
+ //get the real name + $newname = str_replace('_',' ',$name); //select someone from this user's contacts by name - $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
- dbesc($newname),
- intval($profile_uid)
- );
+ $r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1", + dbesc($newname), + intval($profile_uid) + ); } else { - //select someone by attag or nick and the name passed in
- $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
- dbesc($name),
- dbesc($name),
- intval($profile_uid)
- );
+ //select someone by attag or nick and the name passed in + $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", + dbesc($name), + dbesc($name), + intval($profile_uid) + ); } - //$r is set, if someone could be selected
- if(count($r)) {
+ //$r is set, if someone could be selected + if(count($r)) { $profile = $r[0]['url']; - //set newname to nick, find alias
- if($r[0]['network'] === 'stat') {
- $newname = $r[0]['nick'];
- $stat = true;
- if($r[0]['alias'])
- $alias = $r[0]['alias'];
- }
- else
- $newname = $r[0]['name'];
+ //set newname to nick, find alias + if($r[0]['network'] === 'stat') { + $newname = $r[0]['nick']; + $stat = true; + if($r[0]['alias']) + $alias = $r[0]['alias']; + } + else + $newname = $r[0]['name']; //add person's id to $inform - if(strlen($inform))
- $inform .= ',';
- $inform .= 'cid:' . $r[0]['id'];
- }
+ if(strlen($inform)) + $inform .= ','; + $inform .= 'cid:' . $r[0]['id']; + } } - //if there is an url for this persons profile
- if(isset($profile)) {
+ //if there is an url for this persons profile + if(isset($profile)) { //create profile link - $profile = str_replace(',','%2c',$profile);
- $newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
- $body = str_replace('@' . $name, $newtag, $body);
+ $profile = str_replace(',','%2c',$profile); + $newtag = '@[url=' . $profile . ']' . $newname . '[/url]'; + $body = str_replace('@' . $name, $newtag, $body); //append tag to str_tags - if(! stristr($str_tags,$newtag)) {
- if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= $newtag;
- }
-
- // Status.Net seems to require the numeric ID URL in a mention if the person isn't
- // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
-
- if(strlen($alias)) {
- $newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
- if(! stristr($str_tags,$newtag)) {
- if(strlen($str_tags))
- $str_tags .= ',';
- $str_tags .= $newtag;
- }
- }
- }
+ if(! stristr($str_tags,$newtag)) { + if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= $newtag; + } + + // Status.Net seems to require the numeric ID URL in a mention if the person isn't + // subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both. + + if(strlen($alias)) { + $newtag = '@[url=' . $alias . ']' . $newname . '[/url]'; + if(! stristr($str_tags,$newtag)) { + if(strlen($str_tags)) + $str_tags .= ','; + $str_tags .= $newtag; + } + } + } } } diff --git a/mod/message.php b/mod/message.php index 55e313776..0907abd77 100755 --- a/mod/message.php +++ b/mod/message.php @@ -154,7 +154,7 @@ function message_content(&$a) { $preselect = (isset($a->argv[2])?array($a->argv[2]):false); - $select = contact_select('messageto','message-to-select', $preselect, 4, true); + $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( '$header' => t('Send Private Message'), diff --git a/mod/network.php b/mod/network.php index d0f1733f4..9ec8c23b5 100755 --- a/mod/network.php +++ b/mod/network.php @@ -90,7 +90,7 @@ function saved_searches($search) { $o = replace_macros($tpl, array( '$title' => t('Saved Searches'), '$add' => t('add'), - '$searchbox' => search($search,'netsearch-box',$a->get_baseurl(true) . $srchurl,true), + '$searchbox' => search($search,'netsearch-box',$srchurl,true), '$saved' => $saved, )); diff --git a/mod/settings.php b/mod/settings.php index f694b5840..3a8ad29d2 100755 --- a/mod/settings.php +++ b/mod/settings.php @@ -652,20 +652,20 @@ function settings_content(&$a) { $blocktags = $a->user['blocktags']; $expire_items = get_pconfig(local_user(), 'expire','items'); - $expire_items = (($expire_items===false)?1:$expire_items); // default if not set: 1 + $expire_items = (($expire_items===false)? '1' : $expire_items); // default if not set: 1 $expire_notes = get_pconfig(local_user(), 'expire','notes'); - $expire_notes = (($expire_notes===false)?1:$expire_notes); // default if not set: 1 + $expire_notes = (($expire_notes===false)? '1' : $expire_notes); // default if not set: 1 $expire_starred = get_pconfig(local_user(), 'expire','starred'); - $expire_starred = (($expire_starred===false)?1:$expire_starred); // default if not set: 1 + $expire_starred = (($expire_starred===false)? '1' : $expire_starred); // default if not set: 1 $expire_photos = get_pconfig(local_user(), 'expire','photos'); - $expire_photos = (($expire_photos===false)?0:$expire_photos); // default if not set: 0 + $expire_photos = (($expire_photos===false)? '0' : $expire_photos); // default if not set: 0 $suggestme = get_pconfig(local_user(), 'system','suggestme'); - $suggestme = (($suggestme===false)?0:$suggestme); // default if not set: 0 + $suggestme = (($suggestme===false)? '0': $suggestme); // default if not set: 0 $browser_update = intval(get_pconfig(local_user(), 'system','update_interval')); $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds @@ -736,13 +736,13 @@ function settings_content(&$a) { )); $blockwall = replace_macros($opt_tpl,array( - '$field' => array('blockwall', t('Allow friends to post to your profile page?'), ! $a->user['blockwall'], '', array(t('No'),t('Yes'))), + '$field' => array('blockwall', t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', array(t('No'),t('Yes'))), )); $blocktags = replace_macros($opt_tpl,array( - '$field' => array('blocktags', t('Allow friends to tag your posts?'), ! $a->user['blocktags'], '', array(t('No'),t('Yes'))), + '$field' => array('blocktags', t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', array(t('No'),t('Yes'))), )); |