]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'friendika/master'
authorFabio Comuni <fabrix.xm@gmail.com>
Fri, 29 Jul 2011 15:23:09 +0000 (17:23 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Fri, 29 Jul 2011 15:23:09 +0000 (17:23 +0200)
1  2 
include/api.php

diff --combined include/api.php
index 5ebf04bb9936fb086fd78237d4f1e9cddfa49d57,d7c0124d716a47c077ee276671161e34eb587175..bc981646d36da12e7dd35bd1b365dc1d6154dd74
        api_register_func('api/account/verify_credentials','api_account_verify_credentials', true);
                
  
 +      /**
 +       * get data from $_POST or $_GET
 +       */
 +      function requestdata($k){
 +              if (isset($_POST[$k])){
 +                      return $_POST[$k];
 +              }
 +              if (isset($_GET[$k])){
 +                      return $_GET[$k];
 +              }
 +              return null;
 +      }
        // TODO - media uploads
 -      
        function api_statuses_update(&$a, $type) {
                if (local_user()===false) return false;
                $user_info = api_get_user($a);
  
                // convert $_POST array items to the form we use for web posts.
  
 -              $_POST['body'] = urldecode($_POST['status']);
 -              $_POST['parent'] = $_POST['in_reply_to_status_id'];
 -              if($_POST['lat'] && $_POST['long'])
 -                      $_POST['coord'] = sprintf("%s %s",$_POST['lat'],$_POST['long']);
 +              $_POST['body'] = urldecode(requestdata('status'));
 +              $_POST['parent'] = requestdata('in_reply_to_status_id');
 +              if(requestdata('lat') && requestdata('long'))
 +                      $_POST['coord'] = sprintf("%s %s",requestdata('lat'),requestdata('long'));
                $_POST['profile_uid'] = local_user();
 -              if($_POST['parent'])
 +              if(requestdata('parent'))
                        $_POST['type'] = 'net-comment';
                else
                        $_POST['type'] = 'wall';
  
        }
        api_register_func('api/account/rate_limit_status','api_account_rate_limit_status',true);
+       function api_statusnet_config(&$a,$type) {
+               $name = $a->config['sitename'];
+               $server = $a->get_hostname();
+               $logo = $a->get_baseurl() . '/images/friendika-64.png';
+               $email = $a->config['admin_email'];
+               $closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
+               $private = (($a->config['system']['block_public']) ? 'true' : 'false');
+               $textlimit = (($a->config['max_import_size']) ? $a->config['max_import_size'] : '200000');
+               $ssl = (($a->config['system']['have_ssl']) ? 'true' : 'false');
+               $sslserver = (($ssl === 'true') ? str_replace('http:','https:',$a->get_baseurl()) : '');
+               $config = array(
+                       'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
+                               'logo' => $logo, 'fancy' => 'true', 'language' => 'en', 'email' => $email, 'broughtby' => '',
+                               'broughtbyurl' => '', 'timezone' => 'UTC', 'closed' => $closed, 'inviteonly' => 'false',
+                               'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl,
+                               'shorturllength' => '30'
+                       ),
+               );  
+               return api_apply_template('config', $type, array('$config' => $config));
+       }
+       api_register_func('api/statusnet/config','api_statusnet_config',true);