From 342fda94e4162634eeb67c18c1d284e7d78f217f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 18 Feb 2016 15:24:58 -0800 Subject: Provide Zotlabs\Project and System class for querying details about the project/version info. Move these out of /boot.php --- include/api.php | 10 +++++----- include/enotify.php | 2 +- include/event.php | 2 +- include/identity.php | 2 +- include/items.php | 4 ++-- include/language.php | 2 +- include/network.php | 10 +++++----- include/plugin.php | 11 ----------- include/zot.php | 4 ++-- 9 files changed, 18 insertions(+), 29 deletions(-) (limited to 'include') diff --git a/include/api.php b/include/api.php index ef41a4912..e78e6cc37 100644 --- a/include/api.php +++ b/include/api.php @@ -2106,10 +2106,10 @@ require_once('include/api_auth.php'); 'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl, 'shorturllength' => '30', 'hubzilla' => array( - 'PLATFORM_NAME' => get_platform_name(), - 'RED_VERSION' => get_project_version(), + 'PLATFORM_NAME' => Zotlabs\Project\System::get_platform_name(), + 'RED_VERSION' => Zotlabs\Project\System::get_project_version(), 'ZOT_REVISION' => ZOT_REVISION, - 'DB_UPDATE_VERSION' => get_update_version() + 'DB_UPDATE_VERSION' => Zotlabs\Project\System::get_update_version() ) )); @@ -2142,12 +2142,12 @@ require_once('include/api_auth.php'); if($type === 'xml') { header("Content-type: application/xml"); - echo '' . "\r\n" . '' . get_project_version() . '' . "\r\n"; + echo '' . "\r\n" . '' . Zotlabs\Project\System::get_project_version() . '' . "\r\n"; killme(); } elseif($type === 'json') { header("Content-type: application/json"); - echo '"' . get_project_version() . '"'; + echo '"' . Zotlabs\Project\System::get_project_version() . '"'; killme(); } } diff --git a/include/enotify.php b/include/enotify.php index c4c49c8ff..e182377c0 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -529,7 +529,7 @@ function notification($params) { $tpl = get_markup_template('email_notify_html.tpl'); $email_html_body = replace_macros($tpl,array( '$banner' => $datarray['banner'], - '$notify_icon' => get_notify_icon(), + '$notify_icon' => Zotlabs\Project\System::get_notify_icon(), '$product' => $datarray['product'], '$preamble' => $datarray['preamble'], '$sitename' => $datarray['sitename'], diff --git a/include/event.php b/include/event.php index 51988acac..73033a1c3 100644 --- a/include/event.php +++ b/include/event.php @@ -67,7 +67,7 @@ function ical_wrapper($ev) { $o .= "BEGIN:VCALENDAR"; $o .= "\r\nVERSION:2.0"; $o .= "\r\nMETHOD:PUBLISH"; - $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . get_platform_name() . "//" . strtoupper(get_app()->language). "\r\n"; + $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Project\System::get_platform_name() . "//" . strtoupper(get_app()->language). "\r\n"; if(array_key_exists('start', $ev)) $o .= format_event_ical($ev); else { diff --git a/include/identity.php b/include/identity.php index 51744f7bf..717deca14 100644 --- a/include/identity.php +++ b/include/identity.php @@ -484,7 +484,7 @@ function identity_basic_export($channel_id, $items = false) { // use constants here as otherwise we will have no idea if we can import from a site // with a non-standard platform and version. - $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => get_server_role()); + $ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => Zotlabs\Project\System::get_server_role()); $r = q("select * from channel where channel_id = %d limit 1", intval($channel_id) diff --git a/include/items.php b/include/items.php index f5eccfccd..a9597c1cf 100755 --- a/include/items.php +++ b/include/items.php @@ -610,8 +610,8 @@ function get_feed_for($channel, $observer_hash, $params) { $atom = ''; $atom .= replace_macros($feed_template, array( - '$version' => xmlify(get_project_version()), - '$red' => xmlify(get_platform_name()), + '$version' => xmlify(Zotlabs\Project\System::get_project_version()), + '$red' => xmlify(Zotlabs\Project\System::get_platform_name()), '$feed_id' => xmlify($channel['xchan_url']), '$feed_title' => xmlify($channel['channel_name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now' , ATOM_TIME)) , diff --git a/include/language.php b/include/language.php index c843db85e..121816ae6 100644 --- a/include/language.php +++ b/include/language.php @@ -189,7 +189,7 @@ function t($s, $ctx = '') { function translate_projectname($s) { - return str_replace(array('$projectname','$Projectname'),array(get_platform_name(),ucfirst(get_platform_name())),$s); + return str_replace(array('$projectname','$Projectname'),array(Zotlabs\Project\System::get_platform_name(),ucfirst(Zotlabs\Project\System::get_platform_name())),$s); } diff --git a/include/network.php b/include/network.php index 7a9bca94a..aa6b54945 100644 --- a/include/network.php +++ b/include/network.php @@ -1620,7 +1620,7 @@ function format_and_send_email($sender,$xchan,$item) { $tpl = get_markup_template('email_notify_html.tpl'); $email_html_body = replace_macros($tpl,array( '$banner' => $banner, - '$notify_icon' => get_notify_icon(), + '$notify_icon' => Zotlabs\Project\System::get_notify_icon(), '$product' => $product, '$preamble' => '', '$sitename' => $sitename, @@ -1768,8 +1768,8 @@ function get_site_info() { $site_info = get_config('system','info'); $site_name = get_config('system','sitename'); if(! get_config('system','hidden_version_siteinfo')) { - $version = get_project_version(); - $tag = get_std_version(); + $version = Zotlabs\Project\System::get_project_version(); + $tag = Zotlabs\Project\System::get_std_version(); if(@is_dir('.git') && function_exists('shell_exec')) { $commit = trim( @shell_exec('git log -1 --format="%h"')); @@ -1805,7 +1805,7 @@ function get_site_info() { $data = Array( 'version' => $version, 'version_tag' => $tag, - 'server_role' => get_server_role(), + 'server_role' => Zotlabs\Project\System::get_server_role(), 'commit' => $commit, 'url' => z_root(), 'plugins' => $visible_plugins, @@ -1819,7 +1819,7 @@ function get_site_info() { 'locked_features' => $locked_features, 'admin' => $admin, 'site_name' => (($site_name) ? $site_name : ''), - 'platform' => get_platform_name(), + 'platform' => Zotlabs\Project\System::get_platform_name(), 'dbdriver' => $db->getdriver(), 'lastpoll' => get_config('system','lastpoll'), 'info' => (($site_info) ? $site_info : ''), diff --git a/include/plugin.php b/include/plugin.php index da4568ad7..5afded542 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -653,17 +653,6 @@ function get_markup_template($s, $root = '') { return $template; } -// return the standardised version. Since we can't easily compare -// before the STD_VERSION definition was applied, we have to treat -// all prior release versions the same. You can dig through them -// with other means (such as RED_VERSION) if necessary. - -function get_std_version() { - if(defined('STD_VERSION')) - return STD_VERSION; - return '0.0.0'; -} - function folder_exists($folder) { diff --git a/include/zot.php b/include/zot.php index e9335769e..6f3d57d06 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3835,7 +3835,7 @@ function zotinfo($arr) { $ret['site']['channels'] = channel_total(); - $ret['site']['version'] = get_platform_name() . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']'; + $ret['site']['version'] = Zotlabs\Project\System::get_platform_name() . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']'; $ret['site']['admin'] = get_config('system','admin_email'); @@ -3855,7 +3855,7 @@ function zotinfo($arr) { $ret['site']['sellpage'] = get_config('system','sellpage'); $ret['site']['location'] = get_config('system','site_location'); $ret['site']['realm'] = get_directory_realm(); - $ret['site']['project'] = get_platform_name(); + $ret['site']['project'] = Zotlabs\Project\System::get_platform_name(); } -- cgit v1.2.3