]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'master' into newui
authorfabrixxm <fabrix.xm@gmail.com>
Mon, 22 Aug 2011 11:56:08 +0000 (13:56 +0200)
committerfabrixxm <fabrix.xm@gmail.com>
Mon, 22 Aug 2011 11:56:08 +0000 (13:56 +0200)
1  2 
boot.php
mod/contacts.php
mod/message.php
mod/profile.php

diff --combined boot.php
index 399e100d0b20159aae7324bd35b8c671d26689fa,ae3c04b77cd42499577aa701071fb9c448821b9e..bfdae47be18af5816488d7d3e5eba313fb3b5123
+++ 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',                    "<br />\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;
  }}
  
  
  if(! function_exists('profile_sidebar')) {
- function profile_sidebar($profile) {
+ function profile_sidebar($profile, $block = 0) {
  
        $a = get_app();
  
  
        $tabs = '';
  
-       $photo = '<div id="profile-photo-wrapper"><img class="photo" src="' . $profile['photo'] . '" alt="' . $profile['name'] . '" /></div>';
+       $photo = '<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="' . $profile['photo'] . '" alt="' . $profile['name'] . '" /></div>';
  
        // don't show connect link to yourself
-       
        $connect = (($profile['uid'] != local_user()) ? '<li><a id="dfrn-request-link" href="dfrn_request/' . $profile['nickname'] . '">' . t('Connect') . '</a></li>' : '');
  
        // don't show connect link to authenticated visitors either
  
        }
  
        $gender = ((x($profile,'gender') == 1) ? '<div class="mf"><span class="gender-label">' . t('Gender:') . '</span> <span class="x-gender">' . $profile['gender'] . '</span></div><div class="profile-clear"></div>' : '');
  
        $pubkey = ((x($profile,'pubkey') == 1) ? '<div class="key" style="display:none;">' . $profile['pubkey'] . '</div>' : '');
  
        $homepage = ((x($profile,'homepage') == 1) ? '<div class="homepage"><span class="homepage-label">' . t('Homepage:') . ' </span><span class="homepage-url">' . linkify($profile['homepage']) . '</span></div><div class="profile-clear"></div>' : '');
  
-       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';
  <dl class='entity_nickname'>
  <dt>Nickname</dt>
  <dd>
- <a class="nickname url uid" href="$podloc" rel="me">$nickname</a>
+ <a class="nickname url uid" href="$podloc/" rel="me">$nickname</a>
+ </dd>
+ </dl>
+ <dl class='entity_fn'>
+ <dt>Full name</dt>
+ <dd>
+ <span class='fn'>$fullname</span>
  </dd>
  </dl>
  <dl class="entity_url">
  <dt>URL</dt>
  <dd>
- <a class="url" href="$podloc" id="pod_location" rel="me">$podloc</a>
+ <a class="url" href="$podloc/" id="pod_location" rel="me">$podloc/</a>
  </dd>
  </dl>
  <dl class="entity_photo">
  <img class="photo avatar" height="50px" width="50px" src="$photo50">
  </dd>
  </dl>
- <dl class='entity_searchable'>
+ <dl class="entity_searchable">
  <dt>Searchable</dt>
  <dd>
- <span class='searchable'>$searchable</span>
+ <span class="searchable">$searchable</span>
  </dd>
  </dl>
  </div>
@@@ -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 eb1de25ad8f69c01953dabe881542a35d955644e,efb0dc75b2b22e51a105c7e0d73d77767f67e1d8..e4be93cd5c13d6b162f58e47a9c632a863f5c8e3
@@@ -124,7 -124,7 +124,7 @@@ function contacts_content(&$a) 
  
        $sort_type = 0;
        $o = '';
 -      $o .= '<script> $(document).ready(function() { $(\'#nav-contacts-link\').addClass(\'nav-selected\'); });</script>';
 +      nav_set_selected('contacts');
  
        $_SESSION['return_url'] = $a->get_baseurl() . '/' . $a->cmd;
  
  
                $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())
                );
                        }
  
  
-                       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 9e89995928bbd9fdbb369ff984fe761ffe4915b5,165d638141ce98ac1dcb7bc2b4f6b3af2dc7c7e4..cc94730bc561b2d393c5bacaab6b3c94fbdfd934
@@@ -1,6 -1,7 +1,7 @@@
  <?php
  
  require_once('include/acl_selectors.php');
+ require_once('include/message.php');
  
  function message_post(&$a) {
  
        $body      = ((x($_POST,'body'))      ? escape_tags(trim($_POST['body'])) : '');
        $recipient = ((x($_POST,'messageto')) ? intval($_POST['messageto'])       : 0 );
  
-       if(! $recipient) {
-               notice( t('No recipient selected.') . EOL );
-               return;
-       }
-       if(! strlen($subject))
-               $subject = t('[no subject]');
-       $me = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
-               intval(local_user())
-       );
-       $contact = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
-                       intval($recipient),
-                       intval(local_user())
-       );
-       if(! (count($me) && (count($contact)))) {
-               notice( t('Unable to locate contact information.') . EOL );
-               return;
-       }
-       $hash = random_string();
-       $uri = 'urn:X-dfrn:' . $a->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 .= '<script> $(document).ready(function() { $(\'#nav-messages-link\').addClass(\'nav-selected\'); });</script>';
 +      nav_set_selected('messages');
  
        if(! local_user()) {
                notice( t('Permission denied.') . EOL);
diff --combined mod/profile.php
index 5a66892daaf4ee49b370319d643e6f985b60551a,2dd5df75855079153c9bb47e5b22736baa50b510..66fa175543aca7fd75b4e869078ac80742e6b9fc
@@@ -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];
                $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
        }
  
-       $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
-       $keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords);
-       if(strlen($keywords))
-               $a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\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'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
+       }
  
        $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
        $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which .'" />' . "\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 .= '<script> $(document).ready(function() { $(\'#nav-home-link\').addClass(\'nav-selected\'); });</script>';
 +              if($a->profile['profile_uid'] == local_user()) {
 +                      nav_set_selected('home');
 +              }
        }
  
        $contact = null;