From: fabrixxm Date: Mon, 22 Aug 2011 11:56:08 +0000 (+0200) Subject: Merge branch 'master' into newui X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d8bd4fbb3e38bf0ff9c7b61dba58e20c0d097d75;hp=-c;p=friendica.git Merge branch 'master' into newui --- d8bd4fbb3e38bf0ff9c7b61dba58e20c0d097d75 diff --combined boot.php index 399e100d0b,ae3c04b77c..bfdae47be1 --- a/boot.php +++ b/boot.php @@@ -5,12 -5,11 +5,12 @@@ require_once('include/network.php') require_once('include/plugin.php'); require_once('include/text.php'); require_once("include/pgettext.php"); +require_once('include/nav.php'); - define ( 'FRIENDIKA_VERSION', '2.2.1074' ); + define ( 'FRIENDIKA_VERSION', '2.2.1079' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); - define ( 'DB_UPDATE_VERSION', 1079 ); + define ( 'DB_UPDATE_VERSION', 1081 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@@ -804,8 -803,12 +804,12 @@@ function profile_load(&$a, $nickname, $ if(! (x($a->page,'aside'))) $a->page['aside'] = ''; - $a->page['aside'] .= profile_sidebar($a->profile); - $a->page['aside'] .= contact_block(); + $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); + + $a->page['aside'] .= profile_sidebar($a->profile, $block); + + if(! $block) + $a->page['aside'] .= contact_block(); return; }} @@@ -828,7 -831,7 +832,7 @@@ if(! function_exists('profile_sidebar')) { - function profile_sidebar($profile) { + function profile_sidebar($profile, $block = 0) { $a = get_app(); @@@ -847,10 -850,9 +851,9 @@@ $tabs = ''; - $photo = '
' . $profile['name'] . '
'; + $photo = '
' . $profile['name'] . '
'; // don't show connect link to yourself - $connect = (($profile['uid'] != local_user()) ? '
  • ' . t('Connect') . '
  • ' : ''); // don't show connect link to authenticated visitors either @@@ -878,6 -880,7 +881,7 @@@ } + $gender = ((x($profile,'gender') == 1) ? '
    ' . t('Gender:') . ' ' . $profile['gender'] . '
    ' : ''); $pubkey = ((x($profile,'pubkey') == 1) ? '' : ''); @@@ -886,13 -889,13 +890,13 @@@ $homepage = ((x($profile,'homepage') == 1) ? '
    ' . t('Homepage:') . ' ' . linkify($profile['homepage']) . '
    ' : ''); - if($profile['hidewall'] && (! local_user()) && (! remote_user())) { - $location = $gender = $marital = $homepage = ''; + if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) { + $location = $pdesc = $connect = $gender = $marital = $homepage = ''; } $podloc = $a->get_baseurl(); $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ); - $nickname = $profile['nick']; + $nickname = $profile['nickname']; $photo300 = $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg'; $photo100 = $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg'; $photo50 = $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg'; @@@ -903,13 -906,19 +907,19 @@@
    Nickname
    - $nickname + $nickname +
    +
    +
    +
    Full name
    +
    + $fullname
    URL
    - $podloc + $podloc/
    @@@ -930,10 -939,10 +940,10 @@@
    -
    +
    Searchable
    - $searchable + $searchable
    @@@ -1034,11 -1043,14 +1044,14 @@@ function proc_run($cmd) $a = get_app(); $args = func_get_args(); - call_hooks("proc_run", $args); + $arr = array('args' => $args, 'run_cmd' => true); + + call_hooks("proc_run", $arr); + if(! $arr['run_cmd']) + return; if(count($args) && $args[0] === 'php') $args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); - foreach ($args as $arg){ $arg = escapeshellarg($arg); } @@@ -1157,4 -1169,3 +1170,4 @@@ function load_contact_links($uid) $a->contacts = $ret; return; }} + diff --combined mod/contacts.php index eb1de25ad8,efb0dc75b2..e4be93cd5c --- a/mod/contacts.php +++ b/mod/contacts.php @@@ -124,7 -124,7 +124,7 @@@ function contacts_content(&$a) $sort_type = 0; $o = ''; - $o .= ''; + nav_set_selected('contacts'); $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd; @@@ -141,7 -141,7 +141,7 @@@ $cmd = $a->argv[2]; - $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", + $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1", intval($contact_id), intval(local_user()) ); @@@ -222,7 -222,7 +222,7 @@@ } - contact_remove($contact_id); + contact_remove($orig_record[0]['id']); info( t('Contact has been removed.') . EOL ); goaway($a->get_baseurl() . '/contacts'); return; // NOTREACHED diff --combined mod/message.php index 9e89995928,165d638141..cc94730bc5 --- a/mod/message.php +++ b/mod/message.php @@@ -1,6 -1,7 +1,7 @@@ get_baseurl() . ':' . local_user() . ':' . $hash ; - - if(! strlen($replyto)) - $replyto = $uri; - - $r = q("INSERT INTO `mail` ( `uid`, `from-name`, `from-photo`, `from-url`, - `contact-id`, `title`, `body`, `seen`, `replied`, `uri`, `parent-uri`, `created`) - VALUES ( %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, '%s', '%s', '%s' )", - intval(local_user()), - dbesc($me[0]['name']), - dbesc($me[0]['thumb']), - dbesc($me[0]['url']), - intval($recipient), - dbesc($subject), - dbesc($body), - 1, - 0, - dbesc($uri), - dbesc($replyto), - datetime_convert() - ); - $r = q("SELECT * FROM `mail` WHERE `uri` = '%s' and `uid` = %d LIMIT 1", - dbesc($uri), - intval(local_user()) - ); - if(count($r)) - $post_id = $r[0]['id']; - - /** - * - * When a photo was uploaded into the message using the (profile wall) ajax - * uploader, The permissions are initially set to disallow anybody but the - * owner from seeing it. This is because the permissions may not yet have been - * set for the post. If it's private, the photo permissions should be set - * appropriately. But we didn't know the final permissions on the post until - * now. So now we'll look for links of uploaded messages that are in the - * post and set them to the same permissions as the post itself. - * - */ - - $match = null; - - if(preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) { - $images = $match[1]; - if(count($images)) { - foreach($images as $image) { - if(! stristr($image,$a->get_baseurl() . '/photo/')) - continue; - $image_uri = substr($image,strrpos($image,'/') + 1); - $image_uri = substr($image_uri,0, strpos($image_uri,'-')); - $r = q("UPDATE `photo` SET `allow_cid` = '%s' - WHERE `resource-id` = '%s' AND `album` = '%s' AND `uid` = %d ", - dbesc('<' . $recipient . '>'), - dbesc($image_uri), - dbesc( t('Wall Photos')), - intval(local_user()) - ); - } - } - } - if($post_id) { - proc_run('php',"include/notifier.php","mail","$post_id"); - info( t('Message sent.') . EOL ); + $ret = send_message($recipient, $body, $subject, $replyto); + + switch($ret){ + case -1: + notice( t('No recipient selected.') . EOL ); + break; + case -2: + notice( t('Unable to locate contact information.') . EOL ); + break; + case -3: + notice( t('Message could not be sent.') . EOL ); + default: + info( t('Message sent.') . EOL ); } - else { - notice( t('Message could not be sent.') . EOL ); - } - return; + } function message_content(&$a) { $o = ''; - $o .= ''; + nav_set_selected('messages'); if(! local_user()) { notice( t('Permission denied.') . EOL); diff --combined mod/profile.php index 5a66892daa,2dd5df7585..66fa175543 --- a/mod/profile.php +++ b/mod/profile.php @@@ -2,8 -2,7 +2,7 @@@ function profile_init(&$a) { - if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) - return; + $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); if($a->argc > 1) $which = $a->argv[1]; @@@ -31,10 -30,12 +30,12 @@@ $a->page['htmlhead'] .= '' . "\r\n"; } - $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : ''); - $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords); - if(strlen($keywords)) - $a->page['htmlhead'] .= '' . "\r\n" ; + if(! $blocked) { + $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : ''); + $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords); + if(strlen($keywords)) + $a->page['htmlhead'] .= '' . "\r\n" ; + } $a->page['htmlhead'] .= '' . "\r\n" ; $a->page['htmlhead'] .= '' . "\r\n" ; @@@ -69,9 -70,8 +70,9 @@@ function profile_content(&$a, $update $a->profile['profile_uid'] = $update; } else { - if($a->profile['profile_uid'] == local_user()) - $o .= ''; + if($a->profile['profile_uid'] == local_user()) { + nav_set_selected('home'); + } } $contact = null;