aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-12-23 10:09:46 +0100
committerMario Vavti <mario@mariovavti.com>2016-12-23 10:09:46 +0100
commit3b9b03cf86979b28e7fa249133176bed84b0105c (patch)
tree336dc8b8b9627e7f4a93e5c35fe3e98555274616 /boot.php
parent2e5a993f880d619aedf3693927e7b3e164fbfcc0 (diff)
parentef39c1e94b5149a3019d417d08dc7c16c8aef9c1 (diff)
downloadvolse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.tar.gz
volse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.tar.bz2
volse-hubzilla-3b9b03cf86979b28e7fa249133176bed84b0105c.zip
Merge branch '2.0RC'
Diffstat (limited to 'boot.php')
-rwxr-xr-xboot.php128
1 files changed, 57 insertions, 71 deletions
diff --git a/boot.php b/boot.php
index f5733a234..41c52c68b 100755
--- a/boot.php
+++ b/boot.php
@@ -27,6 +27,9 @@
* documented.
*/
+// composer autoloader for all namespaced Classes
+require_once('vendor/autoload.php');
+
require_once('include/config.php');
require_once('include/network.php');
require_once('include/plugin.php');
@@ -41,13 +44,14 @@ require_once('include/taxonomy.php');
require_once('include/channel.php');
require_once('include/connections.php');
require_once('include/account.php');
+require_once('include/zid.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '1.14.3' );
-define ( 'ZOT_REVISION', '1.1' );
+define ( 'STD_VERSION', '2.0RC' );
+define ( 'ZOT_REVISION', '1.2' );
-define ( 'DB_UPDATE_VERSION', 1183 );
+define ( 'DB_UPDATE_VERSION', 1185 );
/**
@@ -59,7 +63,6 @@ define ( 'DB_UPDATE_VERSION', 1183 );
*/
define ( 'EOL', '<br>' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
-//define ( 'NULL_DATE', '0000-00-00 00:00:00' );
define ( 'TEMPLATE_BUILD_PATH', 'store/[data]/smarty3' );
define ( 'DIRECTORY_MODE_NORMAL', 0x0000); // A directory client
@@ -80,8 +83,7 @@ $DIRECTORY_FALLBACK_SERVERS = array(
'https://hubzilla.zottel.net',
'https://hub.pixelbits.de',
'https://my.federated.social',
- 'https://hubzilla.nl',
- 'https://blablanet.es'
+ 'https://hubzilla.nl'
);
@@ -401,6 +403,7 @@ define ( 'NOTIFY_PROFILE', 0x0040 );
define ( 'NOTIFY_TAGSELF', 0x0080 );
define ( 'NOTIFY_TAGSHARE', 0x0100 );
define ( 'NOTIFY_POKE', 0x0200 );
+define ( 'NOTIFY_LIKE', 0x0400 );
define ( 'NOTIFY_SYSTEM', 0x8000 );
@@ -602,6 +605,12 @@ function sys_boot() {
@include('.htconfig.php');
+ // allow somebody to set some initial settings just in case they can't
+ // install without special fiddling
+
+ if(App::$install && file_exists('.htpreconfig.php'))
+ @include('.htpreconfig.php');
+
if(array_key_exists('default_timezone',get_defined_vars())) {
App::$config['system']['timezone'] = $default_timezone;
}
@@ -622,6 +631,18 @@ function sys_boot() {
date_default_timezone_set(App::$timezone);
+ if(! defined('DEFAULT_PLATFORM_ICON')) {
+ define( 'DEFAULT_PLATFORM_ICON', '/images/hz-32.png' );
+ }
+
+ if(! defined('DEFAULT_NOTIFY_ICON')) {
+ define( 'DEFAULT_NOTIFY_ICON', '/images/hz-white-32.png' );
+ }
+
+ if(! defined('CRYPTO_ALGORITHM')) {
+ define( 'CRYPTO_ALGORITHM', 'aes256cbc' );
+ }
+
/*
* Try to open the database;
*/
@@ -695,44 +716,14 @@ function startup() {
}
-class ZotlabsAutoloader {
- static public function loader($className) {
- $debug = false;
- $filename = str_replace('\\', '/', $className) . ".php";
- if(file_exists($filename)) {
- include($filename);
- if (class_exists($className)) {
- return TRUE;
- }
- }
- $arr = explode('\\',$className);
- if($arr && count($arr) > 1) {
- if(! $arr[0])
- $arr = array_shift($arr);
- $filename = 'addon/' . lcfirst($arr[0]) . '/' . $arr[1] . ((count($arr) === 2) ? '.php' : '/' . $arr[2] . ".php");
- if(file_exists($filename)) {
- include($filename);
- if (class_exists($className)) {
- return TRUE;
- }
- }
- }
-
- return FALSE;
- }
-}
-
-
/**
* class miniApp
*
* this is a transient structure which is needed to convert the $a->config settings
* from older (existing) htconfig files which used a global App ($a) into the updated App structure
- * which is now static (although currently constructed at startup). We are only converting
- * 'system' config settings.
+ * which is now static (although currently constructed at startup). We are only converting
+ * 'system' config settings.
*/
-
-
class miniApp {
public $config = array('system' => array());
@@ -976,29 +967,19 @@ class App {
self::$is_mobile = $mobile_detect->isMobile();
self::$is_tablet = $mobile_detect->isTablet();
- self::head_set_icon('/images/hz-32.png');
+ self::head_set_icon(DEFAULT_PLATFORM_ICON);
/*
* register template engines
*/
- spl_autoload_register('ZotlabsAutoloader::loader');
-
self::$meta= new Zotlabs\Web\HttpMeta();
// create an instance of the smarty template engine so we can register it.
$smarty = new Zotlabs\Render\SmartyTemplate();
-
- $dc = get_declared_classes();
-
- foreach ($dc as $k) {
- if(in_array('Zotlabs\\Render\\TemplateEngine', class_implements($k))) {
- self::register_template_engine($k);
- }
- }
-
-
+ /// @todo validate if this is still the desired behavior
+ self::register_template_engine(get_class($smarty));
}
@@ -1159,9 +1140,9 @@ class App {
public static function build_pagehead() {
- $user_scalable = ((local_channel()) ? get_pconfig(local_channel(),'system','user_scalable') : 1);
+ $user_scalable = ((local_channel()) ? get_pconfig(local_channel(),'system','user_scalable') : 0);
if ($user_scalable === false)
- $user_scalable = 1;
+ $user_scalable = 0;
$preload_images = ((local_channel()) ? get_pconfig(local_channel(),'system','preload_images') : 0);
if ($preload_images === false)
@@ -1758,14 +1739,6 @@ function login($register = false, $form_id = 'main-login', $hiddens=false) {
*/
function killme() {
- // Ensure that closing the database is the last function on the shutdown stack.
- // If it is closed prematurely sessions might not get saved correctly.
- // Note the second arg to PHP's session_set_save_handler() seems to order that shutdown
- // procedure last despite our best efforts, so we don't use that and implictly
- // call register_shutdown_function('session_write_close'); within Zotlabs\Web\Session::init()
- // and then register the database close function here where nothing else can register
- // after it.
-
register_shutdown_function('shutdown');
exit;
}
@@ -2480,6 +2453,11 @@ function cert_bad_email() {
function check_for_new_perms() {
+ // Do not execute if we are in the middle of a git update and the relevant versions don't match
+
+ if( \Zotlabs\Access\Permissions::version() != \Zotlabs\Access\PermissionRoles::version())
+ return;
+
$pregistered = get_config('system','perms');
$pcurrent = array_keys(\Zotlabs\Access\Permissions::Perms());
@@ -2509,19 +2487,27 @@ function check_for_new_perms() {
// get the permissions role details
$rp = \Zotlabs\Access\PermissionRoles::role_perms($r[0]['v']);
if($rp) {
- // set the channel limits if appropriate or 0
- if(array_key_exists('limits',$rp) && array_key_exists($p,$rp['limits'])) {
- \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,$rp['limits'][$p]);
+
+ // for custom permission roles we need to customise how we initiate this new permission
+ if(array_key_exists('role',$rp) && ($rp['role'] === 'custom' || $rp['role'] === '')) {
+ \Zotlabs\Access\PermissionRoles::new_custom_perms($cc['uid'],$p,$x);
}
else {
- \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,0);
- }
+ // set the channel limits if appropriate or 0
+ if(array_key_exists('limits',$rp) && array_key_exists($p,$rp['limits'])) {
+ \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,$rp['limits'][$p]);
+ }
+ else {
+ \Zotlabs\Access\PermissionLimits::Set($cc['uid'],$p,0);
+ }
+
- $set = ((array_key_exists('perms_connect',$rp) && array_key_exists($p,$rp['perms_connect'])) ? true : false);
- // foreach connection set to the perms_connect value
- if($x) {
- foreach($x as $xx) {
- set_abconfig($cc['uid'],$xx['abook_xchan'],'my_perms',$p,intval($set));
+ $set = ((array_key_exists('perms_connect',$rp) && array_key_exists($p,$rp['perms_connect'])) ? true : false);
+ // foreach connection set to the perms_connect value
+ if($x) {
+ foreach($x as $xx) {
+ set_abconfig($cc['uid'],$xx['abook_xchan'],'my_perms',$p,intval($set));
+ }
}
}
}