X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=e8bd1087bf048e300aafcdd5937d706398a97c13;hb=4c6a43213058cebe76a68c6d2be83252a85c6eec;hp=f56a7031961651d529d6af847a6a02535fabfe0e;hpb=18d4cf05833574173f1645e40e68f2c9c775517e;p=friendica.git diff --git a/boot.php b/boot.php index f56a703196..e8bd1087bf 100644 --- a/boot.php +++ b/boot.php @@ -4,14 +4,15 @@ require_once('include/config.php'); require_once('include/network.php'); require_once('include/plugin.php'); require_once('include/text.php'); +require_once('include/datetime.php'); require_once('include/pgettext.php'); require_once('include/nav.php'); require_once('include/cache.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); -define ( 'FRIENDICA_VERSION', '3.0.1347' ); +define ( 'FRIENDICA_VERSION', '3.0.1378' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1144 ); +define ( 'DB_UPDATE_VERSION', 1149 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -28,6 +29,11 @@ define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); */ define ( 'JPEG_QUALITY', 100 ); +/** + * $a->config['system']['png_quality'] from 0 (uncompressed) to 9 + */ +define ( 'PNG_QUALITY', 8 ); + /** * Not yet used @@ -328,6 +334,12 @@ if(! class_exists('App')) { function __construct() { + global $default_timezone; + + $this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC'); + + date_default_timezone_set($this->timezone); + $this->config = array(); $this->page = array(); $this->pager= array(); @@ -402,9 +414,6 @@ if(! class_exists('App')) { $this->argc = count($this->argv); if((array_key_exists('0',$this->argv)) && strlen($this->argv[0])) { $this->module = str_replace(".", "_", $this->argv[0]); - if(array_key_exists('2',$this->argv)) { - $this->category = $this->argv[2]; - } } else { $this->argc = 1; @@ -427,7 +436,7 @@ if(! class_exists('App')) { * pagination */ - $this->pager['page'] = ((x($_GET,'page')) ? $_GET['page'] : 1); + $this->pager['page'] = ((x($_GET,'page') && intval($_GET['page']) > 0) ? intval($_GET['page']) : 1); $this->pager['itemspage'] = 50; $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage']; $this->pager['total'] = 0; @@ -441,22 +450,19 @@ if(! class_exists('App')) { if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL)) $scheme = 'https'; - // We need to populate the $ssl flag across the entire program before turning this on. - // Basically, we'll have $ssl = true on any links which can only be seen by a logged in user - // (and also the login link). Anything seen by an outsider will have it turned off. - // At present, setting SSL_POLICY_SELFSIGN will only force remote contacts to update their - // contact links to this site with "http:" if they are currently using "https:" - - // if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) { - // if($ssl) - // $scheme = 'https'; - // else - // $scheme = 'http'; - // } - } + // Basically, we have $ssl = true on any links which can only be seen by a logged in user + // (and also the login link). Anything seen by an outsider will have it turned off. + + if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) { + if($ssl) + $scheme = 'https'; + else + $scheme = 'http'; + } + } - $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); - return $this->baseurl; + $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' ); + return $this->baseurl; } function set_baseurl($url) { @@ -497,7 +503,7 @@ if(! class_exists('App')) { } function set_pager_itemspage($n) { - $this->pager['itemspage'] = intval($n); + $this->pager['itemspage'] = ((intval($n) > 0) ? intval($n) : 0); $this->pager['start'] = ($this->pager['page'] * $this->pager['itemspage']) - $this->pager['itemspage']; } @@ -511,6 +517,7 @@ if(! class_exists('App')) { $tpl = file_get_contents('view/head.tpl'); $this->page['htmlhead'] = replace_macros($tpl,array( '$baseurl' => $this->get_baseurl(), // FIXME for z_path!!!! + '$local_user' => local_user(), '$generator' => 'Friendica' . ' ' . FRIENDICA_VERSION, '$delitem' => t('Delete this item?'), '$comment' => t('Comment'), @@ -1323,6 +1330,25 @@ if(! function_exists('proc_run')) { $a = get_app(); $args = func_get_args(); + + $newargs = array(); + if(! count($args)) + return; + + // expand any arrays + + foreach($args as $arg) { + if(is_array($arg)) { + foreach($arg as $n) { + $newargs[] = $n; + } + } + else + $newargs[] = $arg; + } + + $args = $newargs; + $arr = array('args' => $args, 'run_cmd' => true); call_hooks("proc_run", $arr); @@ -1551,3 +1577,30 @@ function zrl($s,$force = false) { return $s . $achar . 'zrl=' . urlencode($mine); return $s; } + +/** +* returns querystring as string from a mapped array +* +* @param params Array +* @return string +*/ +function build_querystring($params, $name=null) { + $ret = ""; + foreach($params as $key=>$val) { + if(is_array($val)) { + if($name==null) { + $ret .= build_querystring($val, $key); + } else { + $ret .= build_querystring($val, $name."[$key]"); + } + } else { + $val = urlencode($val); + if($name!=null) { + $ret.=$name."[$key]"."=$val&"; + } else { + $ret.= "$key=$val&"; + } + } + } + return $ret; +}