X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=6cbb4f07c7200da51d3305c42e4d85e10cf427c6;hb=3eefe8b50003c858d4930c03cc06d2679a14347c;hp=85e1598831c015346aa3612a48682d20e6b43879;hpb=028460a5c1de4833bb1dcfaa945c1292952bf923;p=friendica.git diff --git a/boot.php b/boot.php index 85e1598831..6cbb4f07c7 100644 --- a/boot.php +++ b/boot.php @@ -2,14 +2,24 @@ set_time_limit(0); -define ( 'BUILD_ID', 1032 ); -define ( 'FRIENDIKA_VERSION', '2.01.1003' ); +define ( 'BUILD_ID', 1033 ); +define ( 'FRIENDIKA_VERSION', '2.10.0902' ); define ( 'DFRN_PROTOCOL_VERSION', '2.0' ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'DOWN_ARROW', '⇩' ); + +/** + * SSL redirection policies + */ + +define ( 'SSL_POLICY_NONE', 0 ); +define ( 'SSL_POLICY_FULL', 1 ); +define ( 'SSL_POLICY_SELFSIGN', 2 ); + + /** * log levels */ @@ -270,10 +280,17 @@ class App { } function get_baseurl($ssl = false) { - if(strlen($this->baseurl)) - return $this->baseurl; - $this->baseurl = (($ssl) ? 'https' : $this->scheme) . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); + $scheme = $this->scheme; + + if(x($this->config,'ssl_policy')) { + if(($ssl) || ($this->config['ssl_policy'] == SSL_POLICY_FULL)) + $scheme = 'https'; + if(($this->config['ssl_policy'] == SSL_POLICY_SELFSIGN) && (local_user() || x($_POST,'auth-params'))) + $scheme = 'https'; + } + + $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); return $this->baseurl; } @@ -1655,7 +1672,6 @@ function attribute_contains($attr,$s) { if(! function_exists('logger')) { function logger($msg,$level = 0) { - $debugging = get_config('system','debugging'); $loglevel = intval(get_config('system','loglevel')); $logfile = get_config('system','logfile'); @@ -1687,7 +1703,12 @@ function activity_match($haystack,$needle) { if(! function_exists('get_tags')) { function get_tags($s) { $ret = array(); - if(preg_match_all('/([@#][^ \x0D\x0A,:?]*)([ \x0D\x0A,:?]|$)/',$s,$match)) { + + // ignore anything in a code block + + $s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s); + + if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) { foreach($match[1] as $match) { if(strstr($match,"]")) { // we might be inside a bbcode color tag - leave it alone @@ -1873,7 +1894,7 @@ function aes_encrypt($val,$ky) if(! function_exists('linkify')) { function linkify($s) { - $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' $1', $s); + $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%]*)/", ' $1', $s); return($s); }} @@ -2009,8 +2030,12 @@ function profile_sidebar($profile) { if((! is_array($profile)) && (! count($profile))) return $o; + call_hooks('profile_sidebar_enter', $profile); + $fullname = '
' . $profile['name'] . '
'; + $pdesc = '
' . $profile['pdesc'] . '
'; + $tabs = ''; $photo = '
' . $profile['name'] . '
'; @@ -2049,6 +2074,7 @@ function profile_sidebar($profile) { $o .= replace_macros($tpl, array( '$fullname' => $fullname, + '$pdesc' => $pdesc, '$tabs' => $tabs, '$photo' => $photo, '$connect' => $connect, @@ -2059,7 +2085,10 @@ function profile_sidebar($profile) { '$homepage' => $homepage )); - call_hooks('profile_sidebar', $o); + + $arr = array('profile' => $profile, 'entry' => $o); + + call_hooks('profile_sidebar', $arr); return $o; }} @@ -2183,3 +2212,60 @@ function get_birthdays() { }} +/** + * + * Compare two URLs to see if they are the same, but ignore + * slight but hopefully insignificant differences such as if one + * is https and the other isn't, or if one is www.something and + * the other isn't - and also ignore case differences. + * + * Return true if the URLs match, otherwise false. + * + */ + +if(! function_exists('link_compare')) { +function link_compare($a,$b) { + $a1 = str_replace(array('https:','//www.'), array('http:','//'), $a); + $b1 = str_replace(array('https:','//www.'), array('http:','//'), $b); + if(strcasecmp($a1,$b1) === 0) + return true; + return false; +}} + + +if(! function_exists('prepare_body')) { +function prepare_body($item) { + + require_once('include/bbcode.php'); + + $s = smilies(bbcode($item['body'])); + + return $s; +}} + +/** + * + * Wrap calls to proc_close(proc_open()) and call hook + * so plugins can take part in process :) + * + * args: + * $cmd program to run + * next args are passed as $cmd command line + * + * e.g.: proc_run("ls","-la","/tmp"); + * + * $cmd and string args are surrounded with "" + */ + +if(! function_exists('run_proc')) { +function proc_run($cmd){ + $args = func_get_args(); + call_hooks("proc_run", $args); + + foreach ($args as &$arg){ + if(is_string($arg)) $arg='"'.$arg.'"'; + } + $cmdline = implode($args," "); + proc_close(proc_open($cmdline." &",array(),$foo)); +}} +