]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
detect empty .htconfig.php - in case permissions need to be set on it in order to...
[friendica.git] / boot.php
index d4398a11a6b8bfcf5067124875dbf6b0a92fa7bc..d3380a395b6815e73ed826d6c7152d2c79bb4e07 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -3,7 +3,7 @@
 set_time_limit(0);
 
 define ( 'BUILD_ID',               1039   );
-define ( 'FRIENDIKA_VERSION',      '2.10.0907' );
+define ( 'FRIENDIKA_VERSION',      '2.10.0910' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.1'  );
 
 define ( 'EOL',                    "<br />\r\n"     );
@@ -40,6 +40,8 @@ define ( 'REGISTER_OPEN',          2 );
 
 /**
  * relationship types
+ * When used in contact records, this indicates that 'uid' has 
+ * this relationship with contact['name']
  */
 
 define ( 'REL_VIP',        1);
@@ -197,6 +199,7 @@ class App {
        public  $interactive = true;
        public  $plugins;
        public  $apps;
+       public  $identities;
 
        private $scheme;
        private $hostname;
@@ -300,7 +303,7 @@ class App {
        }
 
        function set_baseurl($url) {
-               $parsed = parse_url($url);
+               $parsed = @parse_url($url);
 
                $this->baseurl = $url;
 
@@ -626,7 +629,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
         $matches = array();
         preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
         $url = trim(array_pop($matches));
-        $url_parsed = parse_url($url);
+        $url_parsed = @parse_url($url);
         if (isset($url_parsed)) {
             $redirects++;
             return fetch_url($url,$binary,$redirects);
@@ -698,7 +701,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0) {
         $matches = array();
         preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches);
         $url = trim(array_pop($matches));
-        $url_parsed = parse_url($url);
+        $url_parsed = @parse_url($url);
         if (isset($url_parsed)) {
             $redirects++;
             return post_url($url,$binary,$headers,$redirects);
@@ -768,7 +771,12 @@ function escape_tags($string) {
 if(! function_exists('login')) {
 function login($register = false) {
        $o = "";
-       $register_html = (($register) ? load_view_file("view/register-link.tpl") : "");
+       $register_tpl = (($register) ? load_view_file("view/register-link.tpl") : "");
+       
+       $register_html = replace_macros($register_tpl,array(
+               '$title' => t('Create a New Account'),
+               '$desc' => t('Register')
+       ));
 
        $noid = get_config('system','no_openid');
        if($noid) {
@@ -795,6 +803,7 @@ function login($register = false) {
        }
        
        $o = replace_macros($tpl,array(
+               '$logout'        => t('Logout'),
                '$register_html' => $register_html, 
                '$classname'     => $classname,
                '$namelabel'     => $namelabel,
@@ -1417,7 +1426,7 @@ function lrdd($uri) {
 
        // get the host meta file
 
-       $host = parse_url($uri);
+       $host = @parse_url($uri);
 
        if($host) {
                $url  = ((x($host,'scheme')) ? $host['scheme'] : 'http') . '://';
@@ -1678,7 +1687,7 @@ if(! function_exists('validate_url')) {
 function validate_url(&$url) {
        if(substr($url,0,4) != 'http')
                $url = 'http://' . $url;
-       $h = parse_url($url);
+       $h = @parse_url($url);
 
        if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) {
                return true;
@@ -1709,7 +1718,7 @@ function validate_email($addr) {
 if(! function_exists('allowed_url')) {
 function allowed_url($url) {
 
-       $h = parse_url($url);
+       $h = @parse_url($url);
 
        if(! $h) {
                return false;
@@ -1935,8 +1944,10 @@ function get_mentions($item) {
        $arr = explode(',',$item['tag']);
        foreach($arr as $x) {
                $matches = null;
-               if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches))
+               if(preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
                        $o .= "\t\t" . '<link rel="mentioned" href="' . $matches[1] . '" />' . "\r\n";
+                       $o .= "\t\t" . '<link rel="ostatus:attention" href="' . $matches[1] . '" />' . "\r\n";
+               }
        }
        return $o;
 }}
@@ -2408,10 +2419,15 @@ function link_compare($a,$b) {
 
 if(! function_exists('prepare_body')) {
 function prepare_body($item) {
+       return prepare_text($item['body']);
+}}
+
+if(! function_exists('prepare_text')) {
+function prepare_text($text) {
 
        require_once('include/bbcode.php');
 
-       $s = smilies(bbcode($item['body']));
+       $s = smilies(bbcode($text));
 
        return $s;
 }}
@@ -2430,13 +2446,19 @@ function prepare_body($item) {
  * $cmd and string args are surrounded with ""
  */
 
-if(! function_exists('run_proc')) {
+if(! function_exists('proc_run')) {
 function proc_run($cmd){
+
+       $a = get_app();
+
        $args = func_get_args();
        call_hooks("proc_run", $args);
+
+       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){
-               if(is_string($arg)) $arg='"'.$arg.'"';
+       foreach ($args as $arg){
+               $arg = escapeshellarg($arg);
        }
        $cmdline = implode($args," ");
        proc_close(proc_open($cmdline." &",array(),$foo));
@@ -2569,3 +2591,29 @@ function unamp($s) {
        return str_replace('&amp;', '&', $s);
 }}
 
+if(! function_exists('extract_item_authors')) {
+function extract_item_authors($arr,$uid) {
+
+       if((! $uid) || (! is_array($arr)) || (! count($arr)))
+               return array();
+       $urls = array();
+       foreach($arr as $rr) {
+               if(! in_array("'" . dbesc($rr['author-link']) . "'",$urls))
+                       $urls[] = "'" . dbesc($rr['author-link']) . "'";
+       }
+
+       // pre-quoted, don't put quotes on %s
+       if(count($urls)) {
+               $r = q("SELECT `id`,`url` FROM `contact` WHERE `uid` = %d AND `url` IN ( %s ) AND `network` = 'dfrn' AND `self` = 0 AND `blocked` = 0 ",
+                       intval($uid),
+                       implode(',',$urls)
+               );
+               if(count($r)) {
+                       $ret = array();
+                       foreach($r as $rr)
+                               $ret[$rr['url']] = $rr['id'];
+                       return $ret;
+               }
+       }
+       return array();         
+}}
\ No newline at end of file