Merge branch '2.2RC' of https://github.com/redmatrix/hubzilla into 2.2RC_merge

This commit is contained in:
zotlabs 2017-02-27 14:55:34 -08:00
commit 1acfe53f74
10 changed files with 38 additions and 14 deletions

View File

@ -1,4 +1,5 @@
Hubzilla 2.2 (2017-??-??) Hubzilla 2.2 (2017-??-??)
- Provide version compatibility check for themes (minversion, maxversion)
- Use chanlink_hash() instead of chanlink_url() where appropriate - Use chanlink_hash() instead of chanlink_url() where appropriate
- Use head_add_link() for feed discovery - Use head_add_link() for feed discovery
- Provide HTTP header parser which honours continuation lines - Provide HTTP header parser which honours continuation lines

View File

@ -163,6 +163,14 @@ class Site {
foreach($files as $file) { foreach($files as $file) {
$vars = ''; $vars = '';
$f = basename($file); $f = basename($file);
$info = get_theme_info($f);
$compatible = check_plugin_versions($info);
if(!$compatible) {
$theme_choices[$f] = $theme_choices_mobile[$f] = sprintf(t('%s - (Incompatible)'), $f);
continue;
}
if (file_exists($file . '/library')) if (file_exists($file . '/library'))
continue; continue;
if (file_exists($file . '/mobile')) if (file_exists($file . '/mobile'))
@ -310,4 +318,4 @@ class Site {
)); ));
} }
} }

View File

@ -230,4 +230,4 @@ class Themes {
} }

View File

@ -130,12 +130,20 @@ class Display {
if($allowed_themes) { if($allowed_themes) {
foreach($allowed_themes as $th) { foreach($allowed_themes as $th) {
$f = $th; $f = $th;
$info = get_theme_info($th);
$compatible = check_plugin_versions($info);
if(!$compatible) {
$mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f);
continue;
}
$is_experimental = file_exists('view/theme/' . $th . '/experimental'); $is_experimental = file_exists('view/theme/' . $th . '/experimental');
$unsupported = file_exists('view/theme/' . $th . '/unsupported'); $unsupported = file_exists('view/theme/' . $th . '/unsupported');
$is_mobile = file_exists('view/theme/' . $th . '/mobile'); $is_mobile = file_exists('view/theme/' . $th . '/mobile');
$is_library = file_exists('view/theme/'. $th . '/library'); $is_library = file_exists('view/theme/'. $th . '/library');
$mobile_themes["---"] = t("No special theme for mobile devices"); $mobile_themes['---'] = t("No special theme for mobile devices");
if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){
$theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f); $theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f);
if (! $is_library) { if (! $is_library) {
@ -147,7 +155,6 @@ class Display {
} }
} }
} }
} }
} }

View File

@ -234,10 +234,8 @@ class Wiki extends \Zotlabs\Web\Controller {
$mimeType = $p['mimeType']; $mimeType = $p['mimeType'];
$rawContent = (($p['mimeType'] == 'text/bbcode') $rawContent = htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT);
? htmlspecialchars_decode(json_decode($p['content']),ENT_COMPAT)
: htmlspecialchars_decode($p['content'],ENT_COMPAT)
);
$content = ($p['content'] !== '' ? $rawContent : '"# New page\n"'); $content = ($p['content'] !== '' ? $rawContent : '"# New page\n"');
// Render the Markdown-formatted page content in HTML // Render the Markdown-formatted page content in HTML
if($mimeType == 'text/bbcode') { if($mimeType == 'text/bbcode') {
@ -245,7 +243,7 @@ class Wiki extends \Zotlabs\Web\Controller {
} }
else { else {
require_once('library/markdown.php'); require_once('library/markdown.php');
$html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(Markdown(Zlib\NativeWikiPage::bbcode(json_decode($content)))))); $html = Zlib\NativeWikiPage::generate_toc(zidify_text(purify_html(Markdown(Zlib\NativeWikiPage::bbcode($content)))));
$renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName); $renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
} }
$showPageControls = $wiki_editor; $showPageControls = $wiki_editor;

View File

@ -70,9 +70,15 @@ class Theme {
$chosen_theme = $_GET['theme_preview']; $chosen_theme = $_GET['theme_preview'];
// Allow theme selection of the form 'theme_name:schema_name' // Allow theme selection of the form 'theme_name:schema_name'
$themepair = explode(':', $chosen_theme); $themepair = explode(':', $chosen_theme);
// Check if $chosen_theme is compatible with core. If not fall back to default
$info = get_theme_info($themepair[0]);
$compatible = check_plugin_versions($info);
if(!$compatible) {
$chosen_theme = '';
}
if($chosen_theme && (file_exists('view/theme/' . $themepair[0] . '/css/style.css') || file_exists('view/theme/' . $themepair[0] . '/php/style.php'))) { if($chosen_theme && (file_exists('view/theme/' . $themepair[0] . '/css/style.css') || file_exists('view/theme/' . $themepair[0] . '/php/style.php'))) {
return($themepair); return($themepair);
} }

View File

@ -471,6 +471,8 @@ function get_theme_info($theme){
'description' => '', 'description' => '',
'author' => array(), 'author' => array(),
'version' => '', 'version' => '',
'minversion' => '',
'maxversion' => '',
'compat' => '', 'compat' => '',
'credits' => '', 'credits' => '',
'maintainer' => array(), 'maintainer' => array(),

View File

@ -3,7 +3,9 @@
/** /**
* * Name: Redbasic * * Name: Redbasic
* * Description: Hubzilla standard theme * * Description: Hubzilla standard theme
* * Version: 1.0 * * Version: 2.0
* * MinVersion: 2.2RC
* * MaxVersion: 3.0
* * Author: Fabrixxm * * Author: Fabrixxm
* * Maintainer: Mike Macgirvin * * Maintainer: Mike Macgirvin
* * Maintainer: Mario Vavti * * Maintainer: Mario Vavti

View File

@ -1,5 +1,5 @@
<div id="banner" class="hidden-sm hidden-xs">{{$banner}}</div> <div id="banner" class="hidden-sm hidden-xs">{{$banner}}</div>
<ul id="nav-notifications-template" rel="template"> <ul id="nav-notifications-template" rel="template">
<li class="{5}"><a href="{0}" title="{2} {3}"><img class="dropdown-menu-img-sm" data-src="{1}"><span class="contactname">{2}</span><span class="dropdown-sub-text">{3}<br>{4}</span></a></li> <li class="{5}"><a href="{0}" title="{2} {3}"><img class="dropdown-menu-img-sm" data-src="{1}"><span class="contactname">{2}</span><span class="dropdown-sub-text">{3}<br>{4}</span><div class="clear"></div></a></li>
</ul> </ul>

View File

@ -107,7 +107,7 @@
<script> <script>
window.wiki_resource_id = '{{$resource_id}}'; window.wiki_resource_id = '{{$resource_id}}';
window.wiki_page_name = '{{$page}}'; window.wiki_page_name = '{{$page}}';
window.wiki_page_content = {{if !$mimeType || $mimeType == 'text/markdown'}}{{$content}}{{else}}`{{$content}}`{{/if}}; window.wiki_page_content = `{{$content}}`;
window.wiki_page_commit = '{{$commit}}'; window.wiki_page_commit = '{{$commit}}';
$("#generic-modal-ok-{{$wikiModalID}}").removeClass('btn-primary'); $("#generic-modal-ok-{{$wikiModalID}}").removeClass('btn-primary');