Merge branch 'dev' into sabre32

This commit is contained in:
Mario Vavti 2016-06-03 09:40:37 +02:00
commit 7582802f03
66 changed files with 147 additions and 9 deletions

View File

@ -13,6 +13,8 @@ require_once('include/channel.php');
class Apps {
static public $installed_system_apps = null;
static public function get_system_apps($translate = true) {
$ret = array();
@ -49,22 +51,62 @@ class Apps {
static public function import_system_apps() {
if(! local_channel())
return;
// Eventually we want to look at modification dates and update system apps.
$installed = get_pconfig(local_channel(),'system','apps_installed');
if($installed)
return;
$apps = self::get_system_apps(false);
self::$installed_system_apps = q("select * from app where app_system = 1 and app_channel = %d",
intval(local_channel())
);
if($apps) {
foreach($apps as $app) {
$id = self::check_install_system_app($app);
// $id will be boolean true or false to install an app, or an integer id to update an existing app
if($id === false)
continue;
if($id !== true) {
// if we already installed this app, but it changed, preserve any categories we created
$s = '';
$r = q("select * from term where otype = %d and oid = d",
intval(TERM_OBJ_APP),
intval($id)
);
if($r) {
foreach($r as $t) {
if($s)
$s .= ',';
$s .= $t['term'];
}
$app['categories'] = $s;
}
}
$app['uid'] = local_channel();
$app['guid'] = hash('whirlpool',$app['name']);
$app['system'] = 1;
self::app_install(local_channel(),$app);
}
}
set_pconfig(local_channel(),'system','apps_installed',1);
}
/**
* Install the system app if no system apps have been installed, or if a new system app
* is discovered, or if the version of a system app changes.
*/
static public function check_install_system_app($app) {
if((! is_array(self::$installed_system_apps)) || (! count(self::$installed_system_apps))) {
return true;
}
$notfound = true;
foreach(self::$installed_system_apps as $iapp) {
if($iapp['app_id'] == hash('whirlpool',$app['name'])) {
$notfound = false;
if($iapp['app_version'] != $app['version']) {
return intval($iapp['app_id']);
}
}
}
return $notfound;
}
@ -111,6 +153,10 @@ class Apps {
if(array_key_exists('target',$ret))
$ret['target'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['target']);
if(array_key_exists('version',$ret))
$ret['version'] = str_replace(array('\'','"'),array(''','&dquot;'),$ret['version']);
if(array_key_exists('requires',$ret)) {
$requires = explode(',',$ret['requires']);
foreach($requires as $require) {

50
Zotlabs/Module/React.php Normal file
View File

@ -0,0 +1,50 @@
<?php
namespace Zotlabs\Module;
class React extends \Zotlabs\Web\Controller {
function get() {
if(! local_channel())
return;
$postid = $_REQUEST['postid'];
if(! $postid)
return;
$emoji = $_REQUEST['emoji'];
if($_REQUEST['emoji']) {
$i = q("select * from item where id = %d and uid = %d",
intval($postid),
intval(local_channel())
);
if(! $i)
return;
$channel = \App::get_channel();
$n = array();
$n['aid'] = $channel['channel_account_id'];
$n['uid'] = $channel['channel_id'];
$n['parent'] = $postid;
$n['parent_mid'] = $i[0]['mid'];
$n['mid'] = item_message_id();
$n['verb'] = ACTIVITY_REACT . '#' . $emoji;
$n['body'] = "\n\n[zmg]" . z_root() . '/images/emoji/' . $emoji . '.png[/zmg]' . "\n\n";
$n['author_xchan'] = $channel['channel_hash'];
$x = item_store($n);
if($x['success']) {
$nid = $x['item_id'];
\Zotlabs\Daemon\Master::Summon(array('Notifier','like',$nid));
}
}
}
}

View File

@ -473,6 +473,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' );
* activity stream defines
*/
define ( 'ACTIVITY_REACT', NAMESPACE_ZOT . '/activity/react' );
define ( 'ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like' );
define ( 'ACTIVITY_DISLIKE', NAMESPACE_ZOT . '/activity/dislike' );
define ( 'ACTIVITY_AGREE', NAMESPACE_ZOT . '/activity/agree' );

BIN
images/emoji/1f37a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/emoji/1f37b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/emoji/1f37e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/emoji/1f3a4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/emoji/1f3b5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

BIN
images/emoji/1f3c6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

BIN
images/emoji/1f44b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/emoji/1f44c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

BIN
images/emoji/1f44d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

BIN
images/emoji/1f44e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

BIN
images/emoji/1f44f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
images/emoji/1f47d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
images/emoji/1f48b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

BIN
images/emoji/1f493.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

BIN
images/emoji/1f497.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

BIN
images/emoji/1f4a3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 702 B

BIN
images/emoji/1f4a4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

BIN
images/emoji/1f595.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B

BIN
images/emoji/1f5a4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 435 B

BIN
images/emoji/1f5e8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

BIN
images/emoji/1f607.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

BIN
images/emoji/1f608.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/emoji/1f60a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

BIN
images/emoji/1f60b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

BIN
images/emoji/1f60c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

BIN
images/emoji/1f60d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/emoji/1f60e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

BIN
images/emoji/1f60f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

BIN
images/emoji/1f619.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

BIN
images/emoji/1f61a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

BIN
images/emoji/1f61b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

BIN
images/emoji/1f61c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/emoji/1f61d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 B

BIN
images/emoji/1f61e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

BIN
images/emoji/1f61f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

BIN
images/emoji/1f622.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/emoji/1f628.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1002 B

BIN
images/emoji/1f62a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/emoji/1f62b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/emoji/1f62c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

BIN
images/emoji/1f62d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/emoji/1f62e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

BIN
images/emoji/1f62f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

BIN
images/emoji/1f631.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
images/emoji/1f634.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
images/emoji/1f64b.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
images/emoji/1f64f.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
images/emoji/1f6ab.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

BIN
images/emoji/1f918.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

BIN
images/emoji/1f919.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

BIN
images/emoji/1f91d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
images/emoji/262e.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

BIN
images/emoji/263a.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

BIN
images/emoji/2665.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

BIN
images/emoji/26a1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

BIN
images/emoji/270c.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1009 B

BIN
images/emoji/2714.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

BIN
images/emoji/2716.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

BIN
images/emoji/2754.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 449 B

2
images/emoji/README Normal file
View File

@ -0,0 +1,2 @@
These files supplied by emojione. License is CC BY 4.0. Attribution is required for commercial use.
See http://emojione.com

View File

@ -734,6 +734,10 @@ function get_tags($s) {
// '=' needs to be avoided because when the replacement is made (in handle_tag()) it has to be ignored there
// Feel free to allow '=' if the issue with '=' is solved in handle_tag()
// added / ? and [ to avoid issues with hashchars in url paths
// added ; to single word tags to allow emojis and other unicode character constructs in bbcode
// (this would actually be &#xnnnnn; but the ampersand will have been escaped to &amp; by the time we see it.)
if(preg_match_all('/(?<![a-zA-Z0-9=\/\?])(@[^ \x0D\x0A,:?\[]+ [^ \x0D\x0A@,:?\[]+)/',$s,$match)) {
foreach($match[1] as $mtch) {
if(substr($mtch,-1,1) === '.')
@ -746,7 +750,7 @@ function get_tags($s) {
// Otherwise pull out single word tags. These can be @nickname, @first_last
// and #hash tags.
if(preg_match_all('/(?<![a-zA-Z0-9=\/\?])([@#][^ \x0D\x0A,;:?\[]+)/',$s,$match)) {
if(preg_match_all('/(?<![a-zA-Z0-9=\/\?\;])([@#][^ \x0D\x0A,;:?\[]+)/',$s,$match)) {
foreach($match[1] as $mtch) {
if(substr($mtch,-1,1) === '.')
$mtch = substr($mtch,0,-1);

View File

@ -113,6 +113,33 @@
</button>
{{/if}}
{{if $item.toplevel}}
{{if $item.like}}
<span class="dropdown">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" id="wall-item-react-{{$item.id}}">
<img class="dropdown-menu-img-xs" style="margin-right: 0;" src="/images/emoji/1f60a.png" alt="1f60a" />
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="wall-item-react-{{$item.id}}">
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f60a'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f60a.png" alt="1f60a" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f44f'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f44f.png" alt="1f44f" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f37e'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f37e.png" alt="1f37e" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f48b'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f48b.png" alt="1f48b" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f61e'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f61e.png" alt="1f61e" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'2665'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/2665.png" alt="2665" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f622'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f622.png" alt="1f622" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f62e'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f62e.png" alt="1f62e" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f634'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f634.png" alt="1f634" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f61c'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f61c.png" alt="1f61c" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f607'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f607.png" alt="1f607" /></a></li>
<li role="presentation"><a role="menuitem" href="#" onclick="jotReact({{$item.id}},'1f608'); return false;"><img class="dropdown-menu-img-sm" src="/images/emoji/1f608.png" alt="1f608" /></a></li>
</ul>
</span>
{{/if}}
{{/if}}
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" id="wall-item-menu-{{$item.id}}">
<i class="fa fa-caret-down"></i>
</button>

View File

@ -349,6 +349,14 @@ function enableOnUser(){
}
}
function jotReact(id,icon) {
if(id && icon) {
$.get('{{$baseurl}}/react?f=&postid=' + id + '&emoji=' + icon);
if(timer) clearTimeout(timer);
timer = setTimeout(NavUpdate,1000);
}
}
function jotClearLocation() {
$('#jot-coord').val('');
$('#profile-nolocation-wrapper').attr('disabled', true);