X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=fbf7df1e2529cb7f86988f04e0c70f76c00652ad;hb=75c4e6e9a6d2230a467c6ffc37c66ae971b498b6;hp=f2c2b39bc039e2d5363616a3a8fc76539baff37a;hpb=245a56f0c1c7db884d0bbd4265f6f74a20442748;p=friendica.git diff --git a/boot.php b/boot.php index f2c2b39bc0..fbf7df1e25 100644 --- a/boot.php +++ b/boot.php @@ -1,15 +1,27 @@ \r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'DOWN_ARROW', '⇩' ); - + +/** + * + * Image storage quality. Lower numbers save space at cost of image detail. + * For ease of upgrade, please do not change here. Change jpeg quality with + * set_config('system','jpeg_quality',n) in .htconfig.php + * where n is netween 1 and 100, and with very poor results below about 50 + * + */ + +define ( 'JPEG_QUALITY', 100 ); /** * SSL redirection policies @@ -201,6 +213,7 @@ class App { public $user; public $cid; public $contact; + public $contacts; public $page_contact; public $content; public $data; @@ -277,7 +290,7 @@ class App { $this->argv = explode('/',$this->cmd); $this->argc = count($this->argv); if((array_key_exists('0',$this->argv)) && strlen($this->argv[0])) { - $this->module = $this->argv[0]; + $this->module = str_replace(".", "_", $this->argv[0]); } else { $this->module = 'home'; @@ -365,9 +378,9 @@ class App { function init_pagehead() { $this->page['title'] = $this->config['sitename']; - $tpl = load_view_file('view/head.tpl'); + $tpl = file_get_contents('view/head.tpl'); $this->page['htmlhead'] = replace_macros($tpl,array( - '$baseurl' => $this->get_baseurl() . '/', + '$baseurl' => $this->get_baseurl(), '$generator' => 'Friendika' . ' ' . FRIENDIKA_VERSION, '$delitem' => t('Delete this item?'), '$comment' => t('Comment') @@ -815,7 +828,7 @@ function escape_tags($string) { if(! function_exists('login')) { function login($register = false) { $o = ""; - $register_tpl = (($register) ? load_view_file("view/register-link.tpl") : ""); + $register_tpl = (($register) ? get_markup_template("register-link.tpl") : ""); $register_html = replace_macros($register_tpl,array( '$title' => t('Create a New Account'), @@ -839,14 +852,16 @@ function login($register = false) { $lostlink = t('Password Reset'); if(local_user()) { - $tpl = load_view_file("view/logout.tpl"); + $tpl = get_markup_template("logout.tpl"); } else { - $tpl = load_view_file("view/login.tpl"); + $tpl = get_markup_template("login.tpl"); } - - $o = replace_macros($tpl,array( + + $o = ''; + + $o .= replace_macros($tpl,array( '$logout' => t('Logout'), '$register_html' => $register_html, '$classname' => $classname, @@ -1849,6 +1864,8 @@ function allowed_email($email) { // wrapper to load a view template, checking for alternate // languages before falling back to the default +// obsolete, deprecated. + if(! function_exists('load_view_file')) { function load_view_file($s) { global $lang, $a; @@ -1867,6 +1884,37 @@ function load_view_file($s) { return file_get_contents($s); }} +if(! function_exists('get_intltext_template')) { +function get_intltext_template($s) { + global $lang; + + if(! isset($lang)) + $lang = 'en'; + + if(file_exists("view/$lang/$s")) + return file_get_contents("view/$lang/$s"); + elseif(file_exists("view/en/$s")) + return file_get_contents("view/en/$s"); + else + return file_get_contents("view/$s"); +}} + +if(! function_exists('get_markup_template')) { +function get_markup_template($s) { + + $theme = current_theme(); + + if(file_exists("view/theme/$theme/$s")) + return file_get_contents("view/theme/$theme/$s"); + else + return file_get_contents("view/$s"); + +}} + + + + + // for html,xml parsing - let's say you've got // an attribute foobar="class1 class2 class3" // and you want to find out if it contains 'class3'. @@ -2292,7 +2340,7 @@ function profile_sidebar($profile) { $homepage = ((x($profile,'homepage') == 1) ? '
' . t('Homepage:') . ' ' . linkify($profile['homepage']) . '
' : ''); - $tpl = load_view_file('view/profile_vcard.tpl'); + $tpl = get_markup_template('profile_vcard.tpl'); $o .= replace_macros($tpl, array( '$fullname' => $fullname, @@ -2417,28 +2465,34 @@ function get_birthdays() { if(strlen($rr['name'])) $total ++; - $o .= ''; - $o .= ''; } - - $o .= ''; } + return $o; +}} - return $o; +if(! function_exists('normalise_link')) { +function normalise_link($url) { + $ret = str_replace(array('https:','//www.'), array('http:','//'), $url); + return(rtrim($ret,'/')); }} /** @@ -2454,9 +2508,7 @@ function get_birthdays() { 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) + if(strcasecmp(normalise_link($a),normalise_link($b)) === 0) return true; return false; }} @@ -2631,7 +2683,7 @@ if(! function_exists('get_plink')) { function get_plink($item) { $a = get_app(); $plink = (((x($item,'plink')) && (! $item['private'])) ? '' : ''); + . $item['plink'] . '" title="' . t('link to source') . '" target="external-link" class="icon remote-link">' : ''); return $plink; }}