Merge branch 'dev' into wip-app-bin

This commit is contained in:
Mario Vavti 2017-02-03 09:24:09 +01:00
commit dd2a5e6b28
18 changed files with 75 additions and 240 deletions

View File

@ -159,6 +159,8 @@ class Apps {
if(array_key_exists('version',$ret))
$ret['version'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['version']);
if(array_key_exists('categories',$ret))
$ret['categories'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['categories']);
if(array_key_exists('requires',$ret)) {
$requires = explode(',',$ret['requires']);

View File

@ -1,71 +0,0 @@
<?php
namespace Zotlabs\Module;
class Ffsapi extends \Zotlabs\Web\Controller {
function get() {
$baseurl = z_root();
$name = get_config('system','sitename');
$description = t('Share content from Firefox to $Projectname');
$author = 'Mike Macgirvin';
$homepage = 'http://hubzilla.org';
$activate = t('Activate the Firefox $Projectname provider');
$s = <<< EOT
<script>
var baseurl = '$baseurl';
var data = {
"origin": baseurl,
// currently required
"name": '$name',
"iconURL": baseurl+"/images/hz-16.png",
"icon32URL": baseurl+"/images/hz-32.png",
"icon64URL": baseurl+"/images/hz-64.png",
// at least one of these must be defined
// "workerURL": baseurl+"/worker.js",
// "sidebarURL": baseurl+"/sidebar.htm",
"shareURL": baseurl+"/rpost?f=&url=%{url}",
// status buttons are scheduled for Firefox 26 or 27
//"statusURL": baseurl+"/statusPanel.html",
// social bookmarks are available in Firefox 26
"markURL": baseurl+"/rbmark?f=&url=%{url}&title=%{title}",
// icons should be 32x32 pixels
// "markedIcon": baseurl+"/images/checkbox-checked-32.png",
// "unmarkedIcon": baseurl+"/images/checkbox-unchecked-32.png",
"unmarkedIcon": baseurl+"/images/hz-bookmark-32.png",
// should be available for display purposes
"description": "$description",
"author": "$author",
"homepageURL": "$homepage",
// optional
"version": "1.0"
}
function activate(node) {
var event = new CustomEvent("ActivateSocialFeature");
var jdata = JSON.stringify(data);
node.setAttribute("data-service", JSON.stringify(data));
node.dispatchEvent(event);
}
</script>
<button onclick="activate(this)" title="$activate" class="btn btn-primary">$activate</button>
EOT;
return $s;
}
}

View File

@ -523,7 +523,7 @@ class Item extends \Zotlabs\Web\Controller {
// <img src="javascript:alert('hacked');" />
// if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) {
// require_once('include/bb2diaspora.php');
// require_once('include/markdown.php');
// $body = escape_tags(trim($body));
// $body = str_replace("\n",'<br />', $body);
// $body = preg_replace_callback('/\[share(.*?)\]/ism','\share_shield',$body);

View File

@ -1,84 +0,0 @@
<?php
namespace Zotlabs\Module;
/**
* @brief Controller for /match.
*
* It takes keywords from your profile and queries the directory server for
* matching keywords from other profiles.
*
* @FIXME this has never been properly ported from Friendica.
*
* @param App &$a
* @return void|string
*/
class Match extends \Zotlabs\Web\Controller {
function get() {
$o = '';
if (! local_channel())
return;
$_SESSION['return_url'] = z_root() . '/' . \App::$cmd;
$o .= '<h2>' . t('Profile Match') . '</h2>';
$r = q("SELECT keywords FROM profile WHERE is_default = 1 AND uid = %d LIMIT 1",
intval(local_channel())
);
if (! count($r))
return;
if (! $r[0]['keywords']) {
notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
return;
}
$params = array();
$tags = trim($r[0]['keywords']);
if ($tags) {
$params['s'] = $tags;
if (\App::$pager['page'] != 1)
$params['p'] = \App::$pager['page'];
// if(strlen(get_config('system','directory_submit_url')))
// $x = post_url('http://dir.friendica.com/msearch', $params);
// else
// $x = post_url(z_root() . '/msearch', $params);
$j = json_decode($x);
if ($j->total) {
\App::set_pager_total($j->total);
\App::set_pager_itemspage($j->items_page);
}
if (count($j->results)) {
$tpl = get_markup_template('match.tpl');
foreach ($j->results as $jj) {
$connlnk = z_root() . '/follow/?url=' . $jj->url;
$o .= replace_macros($tpl,array(
'$url' => zid($jj->url),
'$name' => $jj->name,
'$photo' => $jj->photo,
'$inttxt' => ' ' . t('is interested in:'),
'$conntxt' => t('Connect'),
'$connlnk' => $connlnk,
'$tags' => $jj->tags
));
}
} else {
info( t('No matches') . EOL);
}
}
$o .= cleardiv();
$o .= paginate($a);
return $o;
}
}

View File

@ -1,24 +0,0 @@
<?php
namespace Zotlabs\Module;
class Opensearch extends \Zotlabs\Web\Controller {
function init() {
$tpl = get_markup_template('opensearch.tpl');
header("Content-type: application/opensearchdescription+xml");
$o = replace_macros($tpl, array(
'$baseurl' => z_root(),
'$nodename' => \App::get_hostname(),
));
echo $o;
killme();
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace Zotlabs\Module;
class Rsd_xml extends \Zotlabs\Web\Controller {
function init() {
header ("Content-Type: text/xml");
echo replace_macros(get_markup_template('rsd.tpl'),array(
'$project' => \Zotlabs\Lib\System::get_platform_name(),
'$baseurl' => z_root(),
'$apipath' => z_root() . '/api/'
));
killme();
}
}

View File

@ -448,7 +448,10 @@ class Channel {
$always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices');
if($vnotify === false)
$vnotify = (-1);
$plugin = [ 'basic' => '', 'security' => '', 'notify' => '', 'misc' => '' ];
call_hooks('channel_settings',$plugin);
$o .= replace_macros($stpl,array(
'$ptitle' => t('Channel Settings'),
@ -537,6 +540,10 @@ class Channel {
'$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
'$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),
'$basic_addon' => $plugin['basic'],
'$sec_addon' => $plugin['security'],
'$notify_addon' => $plugin['notify'],
'$misc_addon' => $plugin['misc'],
'$h_advn' => t('Advanced Account/Page Type Settings'),
'$h_descadvn' => t('Change the behaviour of this account for special situations'),

View File

@ -802,6 +802,7 @@ class App {
public static $identities;
public static $css_sources = array();
public static $js_sources = array();
public static $linkrel = array();
public static $theme_info = array();
public static $is_sys = false;
public static $nav_sel;
@ -1164,6 +1165,11 @@ class App {
self::$meta->set('generator', Zotlabs\Lib\System::get_platform_name());
head_add_link(['rel' => 'shortcut icon', 'href' => head_get_icon()]);
$x = [ 'header' => '' ];
call_hooks('build_pagehead',$x);
/* put the head template at the beginning of page['htmlhead']
* since the code added by the modules frequently depends on it
* being first
@ -1176,11 +1182,12 @@ class App {
'$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')),
'$icon' => head_get_icon(),
'$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'],

View File

@ -0,0 +1,2 @@
[b]build_pagehead[/b]

View File

@ -76,12 +76,18 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/bb_translate_video]bb_translate_video[/zrl]
Called when extracting embedded services from bbcode video elements (rarely used)
[zrl=[baseurl]/help/hook/build_pagehead]build_pagehead[/zrl]
Called when creating the HTML page header
[zrl=[baseurl]/help/hook/change_channel]change_channel[/zrl]
Called when logging in to a channel (either during login or afterward through the channel manager)
[zrl=[baseurl]/help/hook/channel_remove]channel_remove[/zrl]
Called when removing a channel
[zrl=[baseurl]/help/hook/channel_settings]channel_settings[/zrl]
Called when displaying the channel settings page
[zrl=[baseurl]/help/hook/chat_message]chat_message[/zrl]
Called to create a chat message.

File diff suppressed because one or more lines are too long

View File

@ -2191,7 +2191,7 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id,
// since Diaspora doesn't handle edits we can only do this for the original text and not update it.
require_once('include/bb2diaspora.php');
require_once('include/markdown.php');
$signed_body = bb2diaspora_itembody($datarray,$walltowall);
if($walltowall) {

View File

@ -1,6 +1,6 @@
<?php
/**
* @file include/bb2diaspora.php
* @file include/markdown.php
* @brief Some functions for BB conversions for Diaspora protocol.
*/

View File

@ -556,21 +556,47 @@ function head_add_css($src, $media = 'screen') {
function head_remove_css($src, $media = 'screen') {
$index = array_search(array($src, $media), App::$css_sources);
if ($index !== false)
if($index !== false)
unset(App::$css_sources[$index]);
}
function head_get_css() {
$str = '';
$sources = App::$css_sources;
if (count($sources)) {
foreach ($sources as $source)
if(count($sources)) {
foreach($sources as $source)
$str .= format_css_if_exists($source);
}
return $str;
}
function head_add_link($arr) {
if($arr) {
App::$linkrel[] = $arr;
}
}
function head_get_links() {
$str = '';
$sources = App::$linkrel;
if(count($sources)) {
foreach($sources as $source) {
if(is_array($source) && count($source)) {
$str .= '<link';
foreach($source as $k => $v) {
$str .= ' ' . $k . '="' . $v . '"';
}
$str .= ' />' . "\r\n";
}
}
}
return $str;
}
function format_css_if_exists($source) {
$path_prefix = script_path() . '/';

View File

@ -5,9 +5,8 @@
{{$head_css}}
{{$js_strings}}
{{$head_js}}
<link rel="shortcut icon" href="{{$icon}}" />
<link rel="search" href="{{$baseurl}}/opensearch" type="application/opensearchdescription+xml" title="{{$osearch}}" />
<link rel="EditURI" type="application/rsd+xml" href="{{$baseurl}}/rsd.xml" />
{{$linkrel}}
{{$plugins}}
<script>
var updateInterval = {{$update_interval}};
var localUser = {{if $local_channel}}{{$local_channel}}{{else}}false{{/if}};

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Hubzilla@{{$nodename}}</ShortName>
<Description>Search in Hubzilla@{{$nodename}}</Description>
<Contact>http://github.com/redmatrix/hubzilla/</Contact>
<Image height="16" width="16" type="image/png">{{$baseurl}}/images/hz-16.png</Image>
<Image height="64" width="64" type="image/png">{{$baseurl}}/images/hz-64.png</Image>
<Url type="text/html"
template="{{$baseurl}}/search?search={searchTerms}"/>
<Url type="application/opensearchdescription+xml"
rel="self"
template="{{$baseurl}}/opensearch" />
</OpenSearchDescription>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
<service>
<engineName>{{$project}}</engineName>
<engineLink>{{$baseurl}}</engineLink>
<apis>
<api name="Twitter" preferred="true" apiLink="{{$apipath}}" blogID="">
<settings>
<docs>http://status.net/wiki/TwitterCompatibleAPI</docs>
<setting name="OAuth">true</setting>
</settings>
</api>
</apis>
</service>
</rsd>

View File

@ -25,7 +25,9 @@
{{include file="field_checkbox.tpl" field=$adult}}
{{include file="field_input.tpl" field=$photo_path}}
{{include file="field_input.tpl" field=$attach_path}}
{{if $basic_addon}}
{{$basic_addon}}
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>
@ -82,6 +84,9 @@
{{include file="field_checkbox.tpl" field=$blocktags}}
{{include file="field_input.tpl" field=$expire}}
</div>
{{if $sec_addon}}
{{$sec_addon}}
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>
@ -135,6 +140,9 @@
{{include file="field_input.tpl" field=$evdays}}
</div>
</div>
{{if $notify_addon}}
{{$notify_addon}}
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>
@ -152,9 +160,6 @@
</div>
<div id="miscellaneous-settings-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="miscellaneous-settings">
<div class="section-content-tools-wrapper">
<div class="ffsapilink">
<a type="button" class="btn btn-default" href="/ffsapi">{{$firefoxshare}}</a>
</div>
{{if $menus}}
<div class="form-group channel-menu">
<label for="channel_menu">{{$menu_desc}}</label>
@ -166,6 +171,11 @@
</div>
{{/if}}
{{include file="field_checkbox.tpl" field=$cal_first_day}}
{{if $misc_addon}}
{{$misc_addon}}
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>