diff options
Diffstat (limited to 'boot.php')
-rwxr-xr-x | boot.php | 197 |
1 files changed, 57 insertions, 140 deletions
@@ -5,14 +5,13 @@ */ /** - * Hubzilla. * - * Hubzilla is an open source decentralised communications + * This is an open source decentralised communications * platform combined with a decentralised identity/authentication framework * wrapped in an extensible content management system, providing website designers * the ability to embed fully decentralised communications and social tools * into many traditional website designs (blogs, forums, small business - * websites, charitable organisations, etc.). Hubzilla also provides DNS mobility + * websites, charitable organisations, etc.). Also provided is DNS mobility * and internet scale privacy/access control. * * This allows any individual website to participate in a matrix of linked @@ -49,8 +48,8 @@ require_once('include/xchan.php'); require_once('include/hubloc.php'); -define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '2.3' ); +define ( 'PLATFORM_NAME', 'red' ); +define ( 'STD_VERSION', '5.2' ); define ( 'ZOT_REVISION', '1.2' ); define ( 'DB_UPDATE_VERSION', 1188 ); @@ -126,7 +125,9 @@ define ( 'LANGUAGE_DETECT_MIN_CONFIDENCE', 0.01 ); * either more or less restrictive. */ -define ( 'STORAGE_DEFAULT_PERMISSIONS', 0770 ); +if(! defined('STORAGE_DEFAULT_PERMISSIONS')) { + define ( 'STORAGE_DEFAULT_PERMISSIONS', 0770 ); +} /** @@ -149,12 +150,6 @@ define ( 'MAX_IMAGE_LENGTH', -1 ); /** - * Not yet used - */ - -define ( 'DEFAULT_DB_ENGINE', 'MyISAM' ); - -/** * log levels */ @@ -166,14 +161,6 @@ define ( 'LOGGER_ALL', 4 ); /** - * Server roles - */ - -define ( 'SERVER_ROLE_BASIC', 0x0001 ); -define ( 'SERVER_ROLE_STANDARD', 0x0002 ); -define ( 'SERVER_ROLE_PRO', 0x0004 ); - -/** * registration policies */ @@ -192,15 +179,6 @@ define ( 'ACCESS_FREE', 2 ); define ( 'ACCESS_TIERED', 3 ); /** - * relationship types - */ - -define ( 'CONTACT_IS_FOLLOWER', 1); -define ( 'CONTACT_IS_SHARING', 2); -define ( 'CONTACT_IS_FRIEND', 3); - - -/** * DB update return values */ @@ -527,14 +505,6 @@ define ( 'ACTIVITY_OBJ_LOCATION',NAMESPACE_ZOT . '/activity/location' ); define ( 'ACTIVITY_OBJ_FILE', NAMESPACE_ZOT . '/activity/file' ); /** - * item weight for query ordering - */ - -define ( 'GRAVITY_PARENT', 0); -define ( 'GRAVITY_LIKE', 3); -define ( 'GRAVITY_COMMENT', 6); - -/** * Account Flags */ @@ -549,7 +519,6 @@ define ( 'ACCOUNT_PENDING', 0x0010 ); * Account roles */ -define ( 'ACCOUNT_ROLE_ALLOWCODE', 0x0001 ); define ( 'ACCOUNT_ROLE_SYSTEM', 0x0002 ); define ( 'ACCOUNT_ROLE_DEVELOPER', 0x0004 ); define ( 'ACCOUNT_ROLE_ADMIN', 0x1000 ); @@ -559,16 +528,16 @@ define ( 'ACCOUNT_ROLE_ADMIN', 0x1000 ); */ define ( 'ITEM_VISIBLE', 0x0000); -//define ( 'ITEM_HIDDEN', 0x0001); +define ( 'ITEM_HIDDEN', 0x0001); define ( 'ITEM_BLOCKED', 0x0002); define ( 'ITEM_MODERATED', 0x0004); define ( 'ITEM_SPAM', 0x0008); -//define ( 'ITEM_DELETED', 0x0010); +define ( 'ITEM_DELETED', 0x0010); define ( 'ITEM_UNPUBLISHED', 0x0020); -//define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item +define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item define ( 'ITEM_DELAYED_PUBLISH', 0x0080); define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED -//define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche +define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche define ( 'ITEM_BUG', 0x0400); // Is a bug, can be used by the internal bug tracker define ( 'ITEM_PENDING_REMOVE', 0x0800); // deleted, notification period has lapsed define ( 'ITEM_DOC', 0x1000); // hubzilla only, define here so that item import does the right thing @@ -620,26 +589,18 @@ function sys_boot() { $a->convert(); - if(defined('UNO')) { - if(UNO) - App::$config['system']['server_role'] = 'basic'; - else - App::$config['system']['server_role'] = 'standard'; - } - - if(! (array_key_exists('server_role',App::$config['system']) && App::$config['system']['server_role'])) - App::$config['system']['server_role'] = 'standard'; + App::$config['system']['server_role'] = 'pro'; App::$timezone = ((App::$config['system']['timezone']) ? App::$config['system']['timezone'] : 'UTC'); date_default_timezone_set(App::$timezone); if(! defined('DEFAULT_PLATFORM_ICON')) { - define( 'DEFAULT_PLATFORM_ICON', '/images/hz-32.png' ); + define( 'DEFAULT_PLATFORM_ICON', '/images/rm-32.png' ); } if(! defined('DEFAULT_NOTIFY_ICON')) { - define( 'DEFAULT_NOTIFY_ICON', '/images/hz-white-32.png' ); + define( 'DEFAULT_NOTIFY_ICON', '/images/rm-32.png' ); } if(! defined('CRYPTO_ALGORITHM')) { @@ -727,6 +688,7 @@ function startup() { * which is now static (although currently constructed at startup). We are only converting * 'system' config settings. */ + class miniApp { public $config = array('system' => array()); @@ -755,7 +717,6 @@ class miniApp { class App { public static $install = false; // true if we are installing the software - public static $role = 0; // server role (constant, not the string) public static $account = null; // account record of the logged-in account public static $channel = null; // channel record of the current channel of the logged-in account public static $observer = null; // xchan record of the page observer @@ -1030,36 +991,10 @@ class App { } } - public static function get_role() { - if(! self::$role) - return self::set_role(); - return self::$role; - } - - public static function set_role() { - $role_str = \Zotlabs\Lib\System::get_server_role(); - switch($role_str) { - case 'basic': - $role = SERVER_ROLE_BASIC; - break; - case 'pro': - $role = SERVER_ROLE_PRO; - break; - case 'standard': - default: - $role = SERVER_ROLE_STANDARD; - break; - } - self::$role = $role; - return $role; - } - - public static function get_scheme() { return self::$scheme; } - public static function get_hostname() { return self::$hostname; } @@ -1173,24 +1108,25 @@ class App { * since the code added by the modules frequently depends on it * being first */ - $tpl = get_markup_template('head.tpl'); - self::$page['htmlhead'] = replace_macros($tpl, array( - '$preload_images' => $preload_images, - '$user_scalable' => $user_scalable, - '$query' => urlencode(self::$query_string), - '$baseurl' => self::get_baseurl(), - '$local_channel' => local_channel(), - '$metas' => self::$meta->get(), - '$plugins' => $x['header'], - '$update_interval' => $interval, - 'osearch' => sprintf( t('Search %1$s (%2$s)','opensearch'), Zotlabs\Lib\System::get_site_name(), t('$Projectname','opensearch')), - '$head_css' => head_get_css(), - '$head_js' => head_get_js(), - '$linkrel' => head_get_links(), - '$js_strings' => js_strings(), - '$zid' => get_my_address(), - '$channel_id' => self::$profile['uid'], - )) . self::$page['htmlhead']; + + self::$page['htmlhead'] = replace_macros(get_markup_template('head.tpl'), + [ + '$preload_images' => $preload_images, + '$user_scalable' => $user_scalable, + '$query' => urlencode(self::$query_string), + '$baseurl' => self::get_baseurl(), + '$local_channel' => local_channel(), + '$metas' => self::$meta->get(), + '$plugins' => $x['header'], + '$update_interval' => $interval, + '$head_css' => head_get_css(), + '$head_js' => head_get_js(), + '$linkrel' => head_get_links(), + '$js_strings' => js_strings(), + '$zid' => get_my_address(), + '$channel_id' => self::$profile['uid'] + ] + ) . self::$page['htmlhead']; // always put main.js at the end self::$page['htmlhead'] .= head_get_main_js(); @@ -1203,11 +1139,13 @@ class App { * @param string $name */ public static function register_template_engine($class, $name = '') { - if ($name === ""){ - $v = get_class_vars( $class ); - if(x($v, "name")) $name = $v['name']; + if(! $name) { + $v = get_class_vars($class); + if(x($v, "name")) { + $name = $v['name']; + } } - if ($name === ""){ + if (! $name) { echo "template engine <tt>$class</tt> cannot be registered without a name.\n"; killme(); } @@ -1223,19 +1161,21 @@ class App { * @return object Template Engine instance */ public static function template_engine($name = ''){ - if ($name !== "") { + if($name !== '') { $template_engine = $name; - } else { + } + else { $template_engine = 'smarty3'; - if (x(self::$theme, 'template_engine')) { + if(x(self::$theme, 'template_engine')) { $template_engine = self::$theme['template_engine']; } } - if (isset(self::$template_engines[$template_engine])){ + if(isset(self::$template_engines[$template_engine])){ if(isset(self::$template_engine_instance[$template_engine])){ return self::$template_engine_instance[$template_engine]; - } else { + } + else { $class = self::$template_engines[$template_engine]; $obj = new $class; self::$template_engine_instance[$template_engine] = $obj; @@ -1243,7 +1183,8 @@ class App { } } - echo "template engine <tt>$template_engine</tt> is not registered!\n"; killme(); + echo "template engine <tt>$template_engine</tt> is not registered!\n"; + killme(); } /** @@ -1824,18 +1765,6 @@ function local_channel() { } /** - * local_user() got deprecated and replaced by local_channel(). - * - * @deprecated since v2.1, use local_channel() - * @see local_channel() - */ -function local_user() { - logger('local_user() is DEPRECATED, use local_channel()'); - return local_channel(); -} - - -/** * @brief Returns a xchan_hash (visitor_id) of remote authenticated visitor * or false. * @@ -1857,18 +1786,6 @@ function remote_channel() { } /** - * remote_user() got deprecated and replaced by remote_channel(). - * - * @deprecated since v2.1, use remote_channel() - * @see remote_channel() - */ -function remote_user() { - logger('remote_user() is DEPRECATED, use remote_channel()'); - return remote_channel(); -} - - -/** * Contents of $s are displayed prominently on the page the next time * a page is loaded. Usually used for errors or alerts. * @@ -2357,7 +2274,7 @@ function construct_page(&$a) { } /** - * @brief Returns Hubzilla's root directory. + * @brief Returns appplication root directory. * * @return string */ @@ -2373,7 +2290,7 @@ function appdirpath() { function head_set_icon($icon) { App::$data['pageicon'] = $icon; -// logger('head_set_icon: ' . $icon); + } /** @@ -2449,10 +2366,10 @@ function z_get_temp_dir() { function z_check_cert() { if(strpos(z_root(),'https://') !== false) { - $x = z_fetch_url(z_root() . '/siteinfo/json'); + $x = z_fetch_url(z_root() . '/siteinfo.json'); if(! $x['success']) { $recurse = 0; - $y = z_fetch_url(z_root() . '/siteinfo/json',false,$recurse,array('novalidate' => true)); + $y = z_fetch_url(z_root() . '/siteinfo.json',false,$recurse,array('novalidate' => true)); if($y['success']) cert_bad_email(); } @@ -2463,9 +2380,9 @@ function z_check_cert() { /** * @brief Send email to admin if server has an invalid certificate. * - * If a Hubzilla hub is available over https it must have a publicly valid - * certificate. + * If a hub is available over https it must have a publicly valid certificate. */ + function cert_bad_email() { $email_tpl = get_intltext_template("cert_bad_eml.tpl"); @@ -2475,7 +2392,7 @@ function cert_bad_email() { '$error' => t('Website SSL certificate is not valid. Please correct.') )); - $subject = email_header_encode(sprintf(t('[hubzilla] Website SSL error for %s'), App::get_hostname())); + $subject = email_header_encode(sprintf(t('[$Projectname] Website SSL error for %s'), App::get_hostname())); mail(App::$config['system']['admin_email'], $subject, $email_msg, 'From: Administrator' . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" @@ -2598,7 +2515,7 @@ function check_cron_broken() { '$lastdate' => (($d)? $d : t('never')) )); - $subject = email_header_encode(sprintf(t('[hubzilla] Cron tasks not running on %s'), App::get_hostname())); + $subject = email_header_encode(sprintf(t('[$Projectname] Cron tasks not running on %s'), App::get_hostname())); mail(App::$config['system']['admin_email'], $subject, $email_msg, 'From: Administrator' . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" |