diff options
-rwxr-xr-x | boot.php | 40 | ||||
-rw-r--r-- | include/api.php | 10 | ||||
-rw-r--r-- | include/enotify.php | 1 | ||||
-rw-r--r-- | include/event.php | 2 | ||||
-rw-r--r-- | include/identity.php | 2 | ||||
-rwxr-xr-x | include/items.php | 4 | ||||
-rw-r--r-- | include/language.php | 2 | ||||
-rw-r--r-- | include/network.php | 58 | ||||
-rw-r--r-- | include/security.php | 23 | ||||
-rw-r--r-- | include/zot.php | 4 | ||||
-rwxr-xr-x | index.php | 4 | ||||
-rw-r--r-- | mod/help.php | 8 | ||||
-rw-r--r-- | mod/linkinfo.php | 2 | ||||
-rw-r--r-- | mod/siteinfo.php | 2 | ||||
-rwxr-xr-x | view/tpl/email_notify_html.tpl | 2 | ||||
-rwxr-xr-x | view/tpl/oexchange_xrd.tpl | 12 |
16 files changed, 113 insertions, 63 deletions
@@ -998,7 +998,7 @@ class App { '$user_scalable' => $user_scalable, '$baseurl' => $this->get_baseurl(), '$local_channel' => local_channel(), - '$generator' => PLATFORM_NAME . ' ' . RED_VERSION, + '$generator' => get_platform_name() . ((get_project_version()) ? ' ' . get_project_version() : ''), '$update_interval' => $interval, '$icon' => head_get_icon(), '$head_css' => head_get_css(), @@ -2338,3 +2338,41 @@ function check_cron_broken() { set_config('system','lastpollcheck',datetime_convert()); return; } + + +function get_platform_name() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['platform_name']) + return $a->config['system']['platform_name']; + return PLATFORM_NAME; +} + +function get_project_version() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version']) + return ''; + return RED_VERSION; +} + +function get_update_version() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['hide_version']) + return ''; + return DB_UPDATE_VERSION; +} + + +function get_notify_icon() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['email_notify_icon_url']) + return $a->config['system']['email_notify_icon_url']; + return z_root() . '/images/hz-white-32.png'; +} + +function get_site_icon() { + $a = get_app(); + if(is_array($a->config) && is_array($a->config['system']) && $a->config['system']['site_icon_url']) + return $a->config['system']['site_icon_url']; + return z_root() . '/images/hz-32.png'; +} + diff --git a/include/api.php b/include/api.php index 5053977c5..ef41a4912 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' => PLATFORM_NAME, - 'RED_VERSION' => RED_VERSION, + 'PLATFORM_NAME' => get_platform_name(), + 'RED_VERSION' => get_project_version(), 'ZOT_REVISION' => ZOT_REVISION, - 'DB_UPDATE_VERSION' => DB_UPDATE_VERSION + 'DB_UPDATE_VERSION' => get_update_version() ) )); @@ -2142,12 +2142,12 @@ require_once('include/api_auth.php'); if($type === 'xml') { header("Content-type: application/xml"); - echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . RED_VERSION . '</version>' . "\r\n"; + echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . get_project_version() . '</version>' . "\r\n"; killme(); } elseif($type === 'json') { header("Content-type: application/json"); - echo '"' . RED_VERSION . '"'; + echo '"' . get_project_version() . '"'; killme(); } } diff --git a/include/enotify.php b/include/enotify.php index c9b6e0463..5bb53aa0e 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -529,6 +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(), '$product' => $datarray['product'], '$preamble' => $datarray['preamble'], '$sitename' => $datarray['sitename'], diff --git a/include/event.php b/include/event.php index 539bfe484..51988acac 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') . "//" . PLATFORM_NAME . "//" . strtoupper(get_app()->language). "\r\n"; + $o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . 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 deccaa299..2a02d4093 100644 --- a/include/identity.php +++ b/include/identity.php @@ -482,6 +482,8 @@ function identity_basic_export($channel_id, $items = false) { $ret = array(); + // 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); $r = q("select * from channel where channel_id = %d limit 1", diff --git a/include/items.php b/include/items.php index 0e16f7b8a..6acf1c883 100755 --- a/include/items.php +++ b/include/items.php @@ -604,8 +604,8 @@ function get_feed_for($channel, $observer_hash, $params) { $atom = ''; $atom .= replace_macros($feed_template, array( - '$version' => xmlify(RED_VERSION), - '$red' => xmlify(PLATFORM_NAME), + '$version' => xmlify(get_project_version()), + '$red' => xmlify(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 59979aa85..cea31924c 100644 --- a/include/language.php +++ b/include/language.php @@ -182,7 +182,7 @@ function t($s, $ctx = '') { function translate_projectname($s) { - return str_replace(array('$projectname','$Projectname'),array(PLATFORM_NAME,ucfirst(PLATFORM_NAME)),$s); + return str_replace(array('$projectname','$Projectname'),array(get_platform_name(),ucfirst(get_platform_name())),$s); } diff --git a/include/network.php b/include/network.php index 94298abef..fe6b553e9 100644 --- a/include/network.php +++ b/include/network.php @@ -1619,18 +1619,19 @@ function format_and_send_email($sender,$xchan,$item) { // load the template for private message notifications $tpl = get_markup_template('email_notify_html.tpl'); $email_html_body = replace_macros($tpl,array( - '$banner' => $banner, - '$product' => $product, - '$preamble' => '', - '$sitename' => $sitename, - '$siteurl' => $siteurl, + '$banner' => $banner, + '$notify_icon' => get_notify_icon(), + '$product' => $product, + '$preamble' => '', + '$sitename' => $sitename, + '$siteurl' => $siteurl, '$source_name' => $sender['xchan_name'], '$source_link' => $sender['xchan_url'], '$source_photo' => $sender['xchan_photo_m'], - '$username' => $xchan['xchan_name'], + '$username' => $xchan['xchan_name'], '$hsitelink' => $datarray['hsitelink'], '$hitemlink' => $datarray['hitemlink'], - '$thanks' => $thanks, + '$thanks' => $thanks, '$site_admin' => $site_admin, '$title' => $title, '$htmlversion' => $htmlversion, @@ -1639,20 +1640,20 @@ function format_and_send_email($sender,$xchan,$item) { // load the template for private message notifications $tpl = get_markup_template('email_notify_text.tpl'); $email_text_body = replace_macros($tpl, array( - '$banner' => $banner, - '$product' => $product, - '$preamble' => '', - '$sitename' => $sitename, - '$siteurl' => $siteurl, + '$banner' => $banner, + '$product' => $product, + '$preamble' => '', + '$sitename' => $sitename, + '$siteurl' => $siteurl, '$source_name' => $sender['xchan_name'], '$source_link' => $sender['xchan_url'], '$source_photo' => $sender['xchan_photo_m'], - '$username' => $xchan['xchan_name'], - '$hsitelink' => $datarray['hsitelink'], - '$hitemlink' => $datarray['hitemlink'], - '$thanks' => $thanks, + '$username' => $xchan['xchan_name'], + '$hsitelink' => $datarray['hsitelink'], + '$hitemlink' => $datarray['hitemlink'], + '$thanks' => $thanks, '$site_admin' => $site_admin, - '$title' => $title, + '$title' => $title, '$textversion' => $textversion )); @@ -1666,13 +1667,13 @@ function format_and_send_email($sender,$xchan,$item) { // use the EmailNotification library to send the message enotify::send(array( - 'fromName' => $product, - 'fromEmail' => $sender_email, - 'replyTo' => $sender_email, - 'toEmail' => str_replace('mailto:','',$xchan['xchan_addr']), - 'messageSubject' => (($title) ? $title : t('No Subject')), - 'htmlVersion' => $email_html_body, - 'textVersion' => $email_text_body, + 'fromName' => $product, + 'fromEmail' => $sender_email, + 'replyTo' => $sender_email, + 'toEmail' => str_replace('mailto:','',$xchan['xchan_addr']), + 'messageSubject' => (($title) ? $title : t('No Subject')), + 'htmlVersion' => $email_html_body, + 'textVersion' => $email_text_body, 'additionalMailHeader' => '', )); @@ -1767,16 +1768,13 @@ function get_site_info() { $site_info = get_config('system','info'); $site_name = get_config('system','sitename'); if(! get_config('system','hidden_version_siteinfo')) { - $version = RED_VERSION; + $version = get_project_version(); $tag = get_std_version(); if(@is_dir('.git') && function_exists('shell_exec')) { $commit = trim( @shell_exec('git log -1 --format="%h"')); -// if(! get_config('system','hidden_tag_siteinfo')) -// $tag = trim( @shell_exec('git describe --tags --abbrev=0')); -// else -// $tag = ''; } + if(! isset($commit) || strlen($commit) > 16) $commit = ''; } @@ -1820,7 +1818,7 @@ function get_site_info() { 'locked_features' => $locked_features, 'admin' => $admin, 'site_name' => (($site_name) ? $site_name : ''), - 'platform' => PLATFORM_NAME, + 'platform' => get_platform_name(), 'dbdriver' => $db->getdriver(), 'lastpoll' => get_config('system','lastpoll'), 'info' => (($site_info) ? $site_info : ''), diff --git a/include/security.php b/include/security.php index d4ebe0024..2a9a6e39e 100644 --- a/include/security.php +++ b/include/security.php @@ -18,20 +18,13 @@ function authenticate_success($user_record, $login_initial = false, $interactive $_SESSION['addr'] = $_SERVER['REMOTE_ADDR']; + $lastlog_updated = false; + if(x($user_record, 'account_id')) { $a->account = $user_record; $_SESSION['account_id'] = $user_record['account_id']; $_SESSION['authenticated'] = 1; - if($login_initial || $update_lastlog) { - q("update account set account_lastlog = '%s' where account_id = %d", - dbesc(datetime_convert()), - intval($_SESSION['account_id']) - ); - $a->account['account_lastlog'] = datetime_convert(); - call_hooks('logged_in', $a->account); - - } $uid_to_load = (((x($_SESSION,'uid')) && (intval($_SESSION['uid']))) ? intval($_SESSION['uid']) @@ -42,9 +35,19 @@ function authenticate_success($user_record, $login_initial = false, $interactive change_channel($uid_to_load); } + if($login_initial || $update_lastlog) { + q("update account set account_lastlog = '%s' where account_id = %d", + dbesc(datetime_convert()), + intval($_SESSION['account_id']) + ); + $a->account['account_lastlog'] = datetime_convert(); + $lastlog_updated = true; + call_hooks('logged_in', $a->account); + } + } - if($login_initial) { + if(($login_initial) && (! $lastlog_updated)) { call_hooks('logged_in', $user_record); diff --git a/include/zot.php b/include/zot.php index beaa54126..9d09aaf58 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3828,7 +3828,7 @@ function zotinfo($arr) { $ret['site']['channels'] = channel_total(); - $ret['site']['version'] = PLATFORM_NAME . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']'; + $ret['site']['version'] = get_platform_name() . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']'; $ret['site']['admin'] = get_config('system','admin_email'); @@ -3848,7 +3848,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'] = PLATFORM_NAME; + $ret['site']['project'] = get_platform_name(); } @@ -11,6 +11,10 @@ * bootstrap the application */ require_once('boot.php'); + +if(file_exists('.htsite.php')) + include('.htsite.php'); + // our global App object $a = new App; diff --git a/mod/help.php b/mod/help.php index c4549a2bd..e1c6fede8 100644 --- a/mod/help.php +++ b/mod/help.php @@ -157,7 +157,7 @@ function help_content(&$a) { $path = trim(substr($dirname,4),'/'); $o .= '<li><a href="help/' . (($path) ? $path . '/' : '') . $fname . '" >' . ucwords(str_replace('_',' ',notags($fname))) . '</a><br />' . - str_replace('$Projectname',PLATFORM_NAME,substr($rr['text'],0,200)) . '...<br /><br /></li>'; + str_replace('$Projectname',get_platform_name(),substr($rr['text'],0,200)) . '...<br /><br /></li>'; } $o .= '</ul>'; @@ -229,6 +229,8 @@ function help_content(&$a) { if($doctype === 'bbcode') { require_once('include/bbcode.php'); $content = bbcode($text); + // bbcode retargets external content to new windows. This content is internal. + $content = str_replace(' target="_blank"','',$content); } $content = preg_replace_callback("/#include (.*?)\;/ism", 'preg_callback_help_include', $content); @@ -248,7 +250,9 @@ function preg_callback_help_include($matches) { if(preg_match('/\.bb$/', $matches[1]) || preg_match('/\.txt$/', $matches[1])) { require_once('include/bbcode.php'); $include = bbcode($include); - } elseif(preg_match('/\.md$/', $matches[1])) { + $include = str_replace(' target="_blank"','',$include); + } + elseif(preg_match('/\.md$/', $matches[1])) { require_once('library/markdown.php'); $include = Markdown($include); } diff --git a/mod/linkinfo.php b/mod/linkinfo.php index c3df1305d..d615b178f 100644 --- a/mod/linkinfo.php +++ b/mod/linkinfo.php @@ -113,7 +113,7 @@ function linkinfo_content(&$a) { // If this is a Red site, use zrl rather than url so they get zids sent to them by default - if( x($siteinfo,'generator') && (strpos($siteinfo['generator'],PLATFORM_NAME . ' ') === 0)) + if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], get_platform_name() . ' ') === 0)) $template = str_replace('url','zrl',$template); if($siteinfo["title"] == "") { diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 52d014de1..f7423506f 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -12,7 +12,7 @@ function siteinfo_init(&$a) { function siteinfo_content(&$a) { if(! get_config('system','hidden_version_siteinfo')) { - $version = sprintf( t('Version %s'), RED_VERSION ); + $version = sprintf( t('Version %s'), get_project_version()); if(@is_dir('.git') && function_exists('shell_exec')) { $commit = @shell_exec('git log -1 --format="%h"'); $tag = get_std_version(); // @shell_exec('git describe --tags --abbrev=0'); diff --git a/view/tpl/email_notify_html.tpl b/view/tpl/email_notify_html.tpl index a2159c885..61ede1ca2 100755 --- a/view/tpl/email_notify_html.tpl +++ b/view/tpl/email_notify_html.tpl @@ -7,7 +7,7 @@ <body> <table style="border:1px solid #ccc; background-color: #FFFFFF; color: #000000;"> <tbody> - <tr><td colspan="2" style="background:#43488A; color:#FFFFFF; font-weight:bold; font-family:'lucida grande', tahoma, verdana,arial, sans-serif; padding: 4px 8px; vertical-align: middle; font-size:16px; letter-spacing: -0.03em; text-align: left;"><img style="width:32px;height:32px; float:left;" src='{{$siteurl}}/images/hz-white-32.png'><div style="padding:7px; margin-left: 5px; float:left; font-size:18px;letter-spacing:1px;">{{$product}}</div><div style="clear: both;"></div></td></tr> + <tr><td colspan="2" style="background:#43488A; color:#FFFFFF; font-weight:bold; font-family:'lucida grande', tahoma, verdana,arial, sans-serif; padding: 4px 8px; vertical-align: middle; font-size:16px; letter-spacing: -0.03em; text-align: left;"><img style="width:32px;height:32px; float:left;" src="{{$notify_icon}}"><div style="padding:7px; margin-left: 5px; float:left; font-size:18px;letter-spacing:1px;">{{$product}}</div><div style="clear: both;"></div></td></tr> <tr><td style="padding-top:22px;" colspan="2">{{$preamble}}</td></tr> diff --git a/view/tpl/oexchange_xrd.tpl b/view/tpl/oexchange_xrd.tpl index 74ef22874..e865e07d9 100755 --- a/view/tpl/oexchange_xrd.tpl +++ b/view/tpl/oexchange_xrd.tpl @@ -4,23 +4,23 @@ <Subject>{{$base}}</Subject> <Property - type="http://www.oexchange.org/spec/0.8/prop/vendor">Friendika</Property> + type="http://www.oexchange.org/spec/0.8/prop/vendor">Zotlabs</Property> <Property - type="http://www.oexchange.org/spec/0.8/prop/title">Friendika Social Network</Property> + type="http://www.oexchange.org/spec/0.8/prop/title">Hubzilla</Property> <Property - type="http://www.oexchange.org/spec/0.8/prop/name">Friendika</Property> + type="http://www.oexchange.org/spec/0.8/prop/name">Hubzilla</Property> <Property - type="http://www.oexchange.org/spec/0.8/prop/prompt">Send to Friendika</Property> + type="http://www.oexchange.org/spec/0.8/prop/prompt">Send to Hubzilla</Property> <Link rel="icon" - href="{{$base}}/images/friendika-16.png" + href="{{$base}}/images/hz-16.png" type="image/png" /> <Link rel="icon32" - href="{{$base}}/images/friendika-32.png" + href="{{$base}}/images/hz-32.png" type="image/png" /> |