Merge branch 'dev'

This commit is contained in:
zotlabs 2019-06-24 17:53:21 -07:00
commit d229f1b02d
108 changed files with 138657 additions and 259268 deletions

View file

@ -82,19 +82,19 @@ class Activity {
}
static function fetch_profile($x) {
$r = q("select * from xchan where xchan_url like '%s' limit 1",
dbesc($x['id'] . '/%')
$r = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' limit 1",
dbesc($x['id'])
);
if (! $r) {
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
dbesc($x['id'])
);
}
}
if (! $r) {
return [];
}
return self::encode_person($r[0],false);
}
@ -288,6 +288,10 @@ class Activity {
$ret['commentPolicy'] = map_scope(PermissionLimits::Get($i['uid'],'post_comments'));
}
if (intval($i['item_private']) === 2) {
$ret['directMessage'] = true;
}
if (array_key_exists('comments_closed',$i) && $i['comments_closed'] !== EMPTY_STR && $i['comments_closed'] !== NULL_DATE) {
if($ret['commentPolicy']) {
$ret['commentPolicy'] .= ' ';
@ -1877,16 +1881,24 @@ class Activity {
}
$obj_actor = ((isset($act->obj['actor'])) ? $act->obj['actor'] : $act->get_actor('attributedTo', $act->obj));
// if the object is an actor it is not really a response activity, reset a couple of things
if (ActivityStreams::is_an_actor($act->obj['type'])) {
$obj_actor = $act->actor;
$s['parent_mid'] = $s['mid'];
}
// ensure we store the original actor
self::actor_store($obj_actor['id'],$obj_actor);
$mention = self::get_actor_bbmention($obj_actor['id']);
if ($act->type === 'Like') {
$content['content'] = sprintf( t('Likes %1$s\'s %2$s'),$mention,$act->obj['type']) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('Likes %1$s\'s %2$s'),$mention, ((ActivityStreams::is_an_actor($act->obj['type'])) ? t('Profile') : $act->obj['type'])) . EOL . EOL . $content['content'];
}
if ($act->type === 'Dislike') {
$content['content'] = sprintf( t('Doesn\'t like %1$s\'s %2$s'),$mention,$act->obj['type']) . EOL . EOL . $content['content'];
$content['content'] = sprintf( t('Doesn\'t like %1$s\'s %2$s'),$mention, ((ActivityStreams::is_an_actor($act->obj['type'])) ? t('Profile') : $act->obj['type'])) . EOL . EOL . $content['content'];
}
if ($act->type === 'Accept' && $act->obj['type'] === 'Event' ) {
$content['content'] = sprintf( t('Will attend %1$s\'s %2$s'),$mention,$act->obj['type']) . EOL . EOL . $content['content'];
@ -1932,6 +1944,8 @@ class Activity {
$s['item_deleted'] = 1;
}
$s['verb'] = self::activity_mapper($act->type);
@ -2170,6 +2184,11 @@ class Activity {
if ($act->recips && (! in_array(ACTIVITY_PUBLIC_INBOX,$act->recips)))
$s['item_private'] = 1;
if (array_key_exists('directMessage',$act->obj) && intval($act->obj['directMessage'])) {
$s['item_private'] = 2;
}
set_iconfig($s,'activitypub','recips',$act->raw_recips);
if ($parent) {
@ -2314,30 +2333,35 @@ class Activity {
intval($item['uid'])
);
if (! $p) {
$a = false;
if (PConfig::Get($channel['channel_id'],'system','hyperdrive',true) || $act->type === 'Announce') {
$a = (($fetch_parents) ? self::fetch_and_store_parents($channel,$observer_hash,$act,$item) : false);
}
if ($a) {
$p = q("select parent_mid from item where mid = '%s' and uid = %d limit 1",
dbesc($item['parent_mid']),
intval($item['uid'])
);
if (defined('NOMADIC')) {
return;
}
else {
// if no parent was fetched, turn into a top-level post
// @TODO we maybe could accept these is we formatted the body correctly with share_bb()
// or at least provided a link to the object
if (in_array($act->type,[ 'Like','Dislike','Announce' ])) {
return;
$a = false;
if (PConfig::Get($channel['channel_id'],'system','hyperdrive',true) || $act->type === 'Announce') {
$a = (($fetch_parents) ? self::fetch_and_store_parents($channel,$observer_hash,$act,$item) : false);
}
if ($a) {
$p = q("select parent_mid from item where mid = '%s' and uid = %d limit 1",
dbesc($item['parent_mid']),
intval($item['uid'])
);
}
else {
// if no parent was fetched, turn into a top-level post
// @TODO we maybe could accept these is we formatted the body correctly with share_bb()
// or at least provided a link to the object
if (in_array($act->type,[ 'Like','Dislike','Announce' ])) {
return;
}
// turn into a top level post
$item['parent_mid'] = $item['mid'];
$item['thr_parent'] = $item['mid'];
}
// turn into a top level post
$item['parent_mid'] = $item['mid'];
$item['thr_parent'] = $item['mid'];
}
}
if ($p[0]['parent_mid'] !== $item['parent_mid']) {
$item['thr_parent'] = $item['parent_mid'];
}

View file

@ -331,6 +331,7 @@ class Apps {
'Suggest Channels' => t('Suggest Channels'),
'Login' => t('Login'),
'Channel Manager' => t('Channel Manager'),
'Notes' => t('Notes'),
'Network' => t('Stream'),
'Settings' => t('Settings'),
'Files' => t('Files'),

View file

@ -399,6 +399,9 @@ class Libsync {
}
$columns = db_columns('channel');
$disallowed = [
'channel_id', 'channel_account_id', 'channel_primary', 'channel_prvkey',
'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_deleted',
@ -409,17 +412,15 @@ class Libsync {
'channel_a_delegate', 'channel_moved'
];
$clean = array();
foreach($arr['channel'] as $k => $v) {
if(in_array($k,$disallowed))
if (in_array($k,$disallowed)) {
continue;
$clean[$k] = $v;
}
if(count($clean)) {
foreach($clean as $k => $v) {
$r = dbq("UPDATE channel set " . dbesc($k) . " = '" . dbesc($v)
. "' where channel_id = " . intval($channel['channel_id']) );
}
if (! in_array($k,$columns)) {
continue;
}
$r = dbq("UPDATE channel set " . dbesc($k) . " = '" . dbesc($v)
. "' where channel_id = " . intval($channel['channel_id']) );
}
}

View file

@ -1289,8 +1289,8 @@ class Libzot {
$arr['owner_xchan'] = $env['sender'];
}
if ($private) {
$arr['item_private'] = true;
if ($private && (! intval($arr['item_private']))) {
$arr['item_private'] = 1;
}
if ($arr['mid'] === $arr['parent_mid']) {
if (is_array($AS->obj) && array_key_exists('commentPolicy',$AS->obj)) {

View file

@ -148,7 +148,7 @@ class Libzotdir {
$current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : $directory_sort_order);
$suggest = (($_REQUEST['suggest']) ? '&suggest=' . $_REQUEST['suggest'] : '');
$url = 'directory?f=';
$url = 'directory?f=&';
$tmp = array_merge($_GET,$_POST);
unset($tmp['suggest']);

View file

@ -68,7 +68,7 @@ class System {
static public function get_project_link() {
if(is_array(App::$config) && is_array(App::$config['system']) && App::$config['system']['project_link'])
return App::$config['system']['project_link'];
return 'https://framagit.org/zot/zap';
return 'https://zotlabs.com/zap';
}
static public function get_project_srclink() {

View file

@ -116,7 +116,7 @@ class ThreadItem {
// logger('parent: ' . $item['thr_parent']);
}
$lock = ((($item['item_private'] == 1) || (($item['uid'] == local_channel()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
$lock = (((intval($item['item_private'])) || (($item['uid'] == local_channel()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
? t('Private Message')
: false);
@ -132,7 +132,7 @@ class ThreadItem {
$privacy_warning = true;
}
if(($item['item_private'] == 1) && ($item['owner']['xchan_network'] === 'activitypub')) {
if(intval($item['item_private']) && ($item['owner']['xchan_network'] === 'activitypub')) {
$recips = get_iconfig($item['parent'], 'activitypub', 'recips');

View file

@ -1,28 +1,32 @@
<?php
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity as ZActivity;
use Zotlabs\Lib\Activity as ZlibActivity;
class Activity extends \Zotlabs\Web\Controller {
class Activity extends Controller {
function init() {
if(ActivityStreams::is_as_request()) {
if (ActivityStreams::is_as_request()) {
$item_id = argv(1);
if(! $item_id)
if (! $item_id) {
return;
}
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0
and item.item_delayed = 0 and item.item_blocked = 0 ";
// if passed an owner_id of 0, we force "guest access" or observer checking
$sql_extra = item_permissions_sql(0);
$r = q("select * from item where uuid = '%s' $item_normal $sql_extra limit 1",
dbesc($item_id)
);
if(! $r) {
if (! $r) {
$r = q("select * from item where uuid = '%s' $item_normal limit 1",
dbesc($item_id)
);
@ -38,11 +42,11 @@ class Activity extends \Zotlabs\Web\Controller {
$channel = channelx_by_n($items[0]['uid']);
$x = array_merge(['@context' => [
$x = array_merge( ['@context' => [
ACTIVITYSTREAMS_JSONLD_REV,
'https://w3id.org/security/v1',
z_root() . ZOT_APSCHEMA_REV
]], ZActivity::encode_activity($items[0]));
]], ZlibActivity::encode_activity($items[0]));

View file

@ -2,7 +2,7 @@
namespace Zotlabs\Module\Admin;
use App;
class Accounts {
@ -23,19 +23,20 @@ class Accounts {
check_form_security_token_redirectOnErr('/admin/accounts', 'admin_accounts');
// change to switch structure?
// account block/unblock button was submitted
if (x($_POST, 'page_accounts_block')) {
for ($i = 0; $i < count($users); $i++) {
// if account is blocked remove blocked bit-flag, otherwise add blocked bit-flag
$op = ($blocked[$i]) ? '& ~' : '| ';
q("UPDATE account SET account_flags = (account_flags $op%d) WHERE account_id = %d",
q("UPDATE account SET account_flags = (account_flags $op %d) WHERE account_id = %d",
intval(ACCOUNT_BLOCKED),
intval($users[$i])
);
}
notice( sprintf( tt("%s account blocked/unblocked", "%s account blocked/unblocked", count($users)), count($users)) );
}
// account delete button was submitted
if (x($_POST, 'page_accounts_delete')) {
foreach ($users as $uid){
@ -43,12 +44,14 @@ class Accounts {
}
notice( sprintf( tt("%s account deleted", "%s accounts deleted", count($users)), count($users)) );
}
// registration approved button was submitted
if (x($_POST, 'page_accounts_approve')) {
foreach ($pending as $hash) {
account_allow($hash);
}
}
// registration deny button was submitted
if (x($_POST, 'page_accounts_deny')) {
foreach ($pending as $hash) {
@ -83,7 +86,7 @@ class Accounts {
check_form_security_token_redirectOnErr('/admin/accounts', 'admin_accounts', 't');
switch (argv(2)){
switch (argv(2)) {
case 'delete':
// delete user
account_remove($uid,true,false);
@ -99,9 +102,9 @@ class Accounts {
notice( sprintf( t("Account '%s' blocked") , $account[0]['account_email']) . EOL);
break;
case 'unblock':
q("UPDATE account SET account_flags = ( account_flags & ~%d ) WHERE account_id = %d",
intval(ACCOUNT_BLOCKED),
intval($uid)
q("UPDATE account SET account_flags = ( account_flags & ~ %d ) WHERE account_id = %d",
intval(ACCOUNT_BLOCKED),
intval($uid)
);
notice( sprintf( t("Account '%s' unblocked"), $account[0]['account_email']) . EOL);
@ -112,7 +115,7 @@ class Accounts {
}
/* get pending */
$pending = q("SELECT account.*, register.hash from account left join register on account_id = register.uid where (account_flags & %d )>0 ",
$pending = q("SELECT account.*, register.hash from account left join register on account_id = register.uid where (account_flags & %d ) != 0 ",
intval(ACCOUNT_PENDING)
);
@ -120,17 +123,18 @@ class Accounts {
$total = q("SELECT count(*) as total FROM account");
if (count($total)) {
\App::set_pager_total($total[0]['total']);
\App::set_pager_itemspage(100);
App::set_pager_total($total[0]['total']);
App::set_pager_itemspage(100);
}
$serviceclass = (($_REQUEST['class']) ? " and account_service_class = '" . dbesc($_REQUEST['class']) . "' " : '');
$key = (($_REQUEST['key']) ? dbesc($_REQUEST['key']) : 'account_id');
$dir = 'asc';
if(array_key_exists('dir',$_REQUEST))
if (array_key_exists('dir',$_REQUEST)) {
$dir = ((intval($_REQUEST['dir'])) ? 'asc' : 'desc');
}
$base = z_root() . '/admin/accounts?f=';
$odir = (($dir === 'asc') ? '0' : '1');
@ -140,29 +144,25 @@ class Accounts {
intval(ACCOUNT_BLOCKED),
db_concat('ch.channel_address', ' '),
intval(ACCOUNT_BLOCKED | ACCOUNT_PENDING),
intval(\App::$pager['itemspage']),
intval(\App::$pager['start'])
intval(App::$pager['itemspage']),
intval(App::$pager['start'])
);
// function _setup_users($e){
// $accounts = Array(
// t('Normal Account'),
// t('Soapbox Account'),
// t('Community/Celebrity Account'),
// t('Automatic Friend Account')
// );
// $e['page_flags'] = $accounts[$e['page-flags']];
// $e['register_date'] = relative_date($e['register_date']);
// $e['login_date'] = relative_date($e['login_date']);
// $e['lastitem_date'] = relative_date($e['lastitem_date']);
// return $e;
// }
// $users = array_map("_setup_users", $users);
$t = get_markup_template('admin_accounts.tpl');
$o = replace_macros($t, array(
// strings //
if ($users) {
for($x = 0; $x < count($users); $x ++) {
$channel_arr = explode(' ',$users[$x]['channels']);
if ($channel_arr) {
$linked = [];
foreach ( $channel_arr as $c) {
$linked[] = '<a href="' . z_root() . '/channel/' . $c . '">' . $c . '</a>';
}
$users[$x]['channels'] = implode(' ',$linked);
}
}
}
$t =
$o = replace_macros(get_markup_template('admin_accounts.tpl'), [
'$title' => t('Administration'),
'$page' => t('Accounts'),
'$submit' => t('Submit'),
@ -178,30 +178,25 @@ class Accounts {
'$odir' => $odir,
'$base' => $base,
'$h_users' => t('Accounts'),
'$th_users' => array(
'$th_users' => [
[ t('ID'), 'account_id' ],
[ t('Email'), 'account_email' ],
[ t('All Channels'), 'channels' ],
[ t('Register date'), 'account_created' ],
[ t('Last login'), 'account_lastlog' ],
[ t('Expires'), 'account_expires' ],
[ t('Service Class'), 'account_service_class'] ),
[ t('Service Class'), 'account_service_class']
],
'$confirm_delete_multi' => t('Selected accounts will be deleted!\n\nEverything these accounts had posted on this site will be permanently deleted!\n\nAre you sure?'),
'$confirm_delete' => t('The account {0} will be deleted!\n\nEverything this account has posted on this site will be permanently deleted!\n\nAre you sure?'),
'$form_security_token' => get_form_security_token("admin_accounts"),
// values //
'$baseurl' => z_root(),
'$pending' => $pending,
'$users' => $users,
));
]);
$o .= paginate($a);
return $o;
}
}

View file

@ -2,6 +2,8 @@
namespace Zotlabs\Module\Admin;
use Zotlabs\Daemon\Master;
/**
* @brief Admin Module for Channels.
*
@ -26,7 +28,7 @@ class Channels {
intval(PAGE_CENSORED),
intval( $uid )
);
\Zotlabs\Daemon\Master::Summon(array('Directory', $uid, 'nopush'));
Master::Summon( [ 'Directory', $uid, 'nopush' ] );
}
notice( sprintf( tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)) );
}
@ -82,7 +84,7 @@ class Channels {
intval($pflags),
intval( $uid )
);
\Zotlabs\Daemon\Master::Summon(array('Directory',$uid,'nopush'));
Master::Summon( [ 'Directory', $uid, 'nopush' ]);
notice( sprintf( (($pflags & PAGE_CENSORED) ? t("Channel '%s' censored"): t("Channel '%s' uncensored")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL);
}; break;

View file

@ -177,10 +177,10 @@ class Site {
/* Installed langs */
$lang_choices = array();
$langs = glob('view/*/hstrings.php');
$langs = glob('view/*/strings.php');
if (is_array($langs) && count($langs)) {
if (! in_array('view/en/hstrings.php',$langs))
if (! in_array('view/en/strings.php',$langs))
$langs[] = 'view/en/';
asort($langs);
foreach ($langs as $l) {

View file

@ -1,116 +1,113 @@
<?php /** @file */
<?php
namespace Zotlabs\Module;
//require_once('include/apps.php');
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
use \Zotlabs\Lib as Zlib;
class Appman extends \Zotlabs\Web\Controller {
class Appman extends Controller {
function post() {
if(! local_channel())
if (! local_channel()) {
return;
}
if($_POST['url']) {
$arr = array(
'uid' => intval($_REQUEST['uid']),
'url' => escape_tags($_REQUEST['url']),
'guid' => escape_tags($_REQUEST['guid']),
'author' => escape_tags($_REQUEST['author']),
'addr' => escape_tags($_REQUEST['addr']),
'name' => escape_tags($_REQUEST['name']),
'desc' => escape_tags($_REQUEST['desc']),
'photo' => escape_tags($_REQUEST['photo']),
'version' => escape_tags($_REQUEST['version']),
'price' => escape_tags($_REQUEST['price']),
'page' => escape_tags($_REQUEST['page']),
'requires' => escape_tags($_REQUEST['requires']),
'system' => intval($_REQUEST['system']),
'plugin' => escape_tags($_REQUEST['plugin']),
'sig' => escape_tags($_REQUEST['sig']),
if ($_POST['url']) {
$arr = [
'uid' => intval($_REQUEST['uid']),
'url' => escape_tags($_REQUEST['url']),
'guid' => escape_tags($_REQUEST['guid']),
'author' => escape_tags($_REQUEST['author']),
'addr' => escape_tags($_REQUEST['addr']),
'name' => escape_tags($_REQUEST['name']),
'desc' => escape_tags($_REQUEST['desc']),
'photo' => escape_tags($_REQUEST['photo']),
'version' => escape_tags($_REQUEST['version']),
'price' => escape_tags($_REQUEST['price']),
'page' => escape_tags($_REQUEST['sellpage']), // do not use 'page' as a request variable here as it conflicts with pagination
'requires' => escape_tags($_REQUEST['requires']),
'system' => intval($_REQUEST['system']),
'plugin' => escape_tags($_REQUEST['plugin']),
'sig' => escape_tags($_REQUEST['sig']),
'categories' => escape_tags($_REQUEST['categories'])
);
];
$_REQUEST['appid'] = Zlib\Apps::app_install(local_channel(),$arr);
$_REQUEST['appid'] = Apps::app_install(local_channel(),$arr);
if(Zlib\Apps::app_installed(local_channel(),$arr))
if (Apps::app_installed(local_channel(),$arr)) {
info( t('App installed.') . EOL);
}
goaway(z_root() . '/apps');
return; //not reached
}
$papp = Zlib\Apps::app_decode($_POST['papp']);
$papp = Apps::app_decode($_POST['papp']);
if(! is_array($papp)) {
if (! is_array($papp)) {
notice( t('Malformed app.') . EOL);
return;
}
if($_POST['install']) {
Zlib\Apps::app_install(local_channel(),$papp);
if(Zlib\Apps::app_installed(local_channel(),$papp))
if ($_POST['install']) {
Apps::app_install(local_channel(),$papp);
if (Apps::app_installed(local_channel(),$papp))
info( t('App installed.') . EOL);
}
if($_POST['delete']) {
Zlib\Apps::app_destroy(local_channel(),$papp);
if ($_POST['delete']) {
Apps::app_destroy(local_channel(),$papp);
}
if($_POST['edit']) {
if ($_POST['edit']) {
return;
}
if($_POST['feature']) {
Zlib\Apps::app_feature(local_channel(), $papp, $_POST['feature']);
if ($_POST['feature']) {
Apps::app_feature(local_channel(), $papp, $_POST['feature']);
}
if($_POST['pin']) {
Zlib\Apps::app_feature(local_channel(), $papp, $_POST['pin']);
if ($_POST['pin']) {
Apps::app_feature(local_channel(), $papp, $_POST['pin']);
}
if($_SESSION['return_url'])
if ($_SESSION['return_url']) {
goaway(z_root() . '/' . $_SESSION['return_url']);
}
goaway(z_root() . '/apps');
}
function get() {
if(! local_channel()) {
if (! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
$channel = \App::get_channel();
$channel = App::get_channel();
if(argc() > 3) {
if (argc() > 3) {
if(argv(2) === 'moveup') {
Zlib\Apps::moveup(local_channel(),argv(1),argv(3));
Apps::moveup(local_channel(),argv(1),argv(3));
}
if(argv(2) === 'movedown') {
Zlib\Apps::movedown(local_channel(),argv(1),argv(3));
Apps::movedown(local_channel(),argv(1),argv(3));
}
goaway(z_root() . '/apporder');
}
$app = null;
$embed = null;
if($_REQUEST['appid']) {
if ($_REQUEST['appid']) {
$r = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
dbesc($_REQUEST['appid']),
dbesc(local_channel())
);
if($r) {
if ($r) {
$app = $r[0];
$term = q("select * from term where otype = %d and oid = %d and uid = %d",
@ -118,41 +115,34 @@ class Appman extends \Zotlabs\Web\Controller {
intval($r[0]['id']),
intval(local_channel())
);
if($term) {
$app['categories'] = '';
foreach($term as $t) {
if($app['categories'])
$app['categories'] .= ',';
$app['categories'] .= $t['term'];
}
if ($term) {
$app['categories'] = array_elm_to_str($term,'term');
}
}
$embed = array('embed', t('Embed code'), Zlib\Apps::app_encode($app,true),'', 'onclick="this.select();"');
$embed = [ 'embed', t('Embed code'), Apps::app_encode($app,true), EMPTY_STR, 'onclick="this.select();"' ];
}
return replace_macros(get_markup_template('app_create.tpl'), array(
'$banner' => (($app) ? t('Edit App') : t('Create App')),
'$app' => $app,
'$guid' => (($app) ? $app['app_id'] : ''),
'$author' => (($app) ? $app['app_author'] : $channel['channel_hash']),
'$addr' => (($app) ? $app['app_addr'] : $channel['xchan_addr']),
'$name' => array('name', t('Name of app'),(($app) ? $app['app_name'] : ''), t('Required')),
'$url' => array('url', t('Location (URL) of app'),(($app) ? $app['app_url'] : ''), t('Required')),
'$desc' => array('desc', t('Description'),(($app) ? $app['app_desc'] : ''), ''),
'$photo' => array('photo', t('Photo icon URL'),(($app) ? $app['app_photo'] : ''), t('80 x 80 pixels - optional')),
'$categories' => array('categories',t('Categories (optional, comma separated list)'),(($app) ? $app['categories'] : ''),''),
'$version' => array('version', t('Version ID'),(($app) ? $app['app_version'] : ''), ''),
'$price' => array('price', t('Price of app'),(($app) ? $app['app_price'] : ''), ''),
'$page' => array('page', t('Location (URL) to purchase app'),(($app) ? $app['app_page'] : ''), ''),
'$system' => (($app) ? intval($app['app_system']) : 0),
'$plugin' => (($app) ? $app['app_plugin'] : ''),
'$requires' => (($app) ? $app['app_requires'] : ''),
'$embed' => $embed,
'$submit' => t('Submit')
));
return replace_macros(get_markup_template('app_create.tpl'), [
'$banner' => (($app) ? t('Edit App') : t('Create App')),
'$app' => $app,
'$guid' => (($app) ? $app['app_id'] : EMPTY_STR),
'$author' => (($app) ? $app['app_author'] : $channel['channel_hash']),
'$addr' => (($app) ? $app['app_addr'] : $channel['xchan_addr']),
'$name' => [ 'name', t('Name of app'),(($app) ? $app['app_name'] : EMPTY_STR), t('Required') ],
'$url' => [ 'url', t('Location (URL) of app'),(($app) ? $app['app_url'] : EMPTY_STR), t('Required') ],
'$desc' => [ 'desc', t('Description'),(($app) ? $app['app_desc'] : EMPTY_STR), EMPTY_STR],
'$photo' => [ 'photo', t('Photo icon URL'),(($app) ? $app['app_photo'] : EMPTY_STR), t('80 x 80 pixels - optional') ],
'$categories' => [ 'categories',t('Categories (optional, comma separated list)'),(($app) ? $app['categories'] : EMPTY_STR), EMPTY_STR ],
'$version' => [ 'version', t('Version ID'),(($app) ? $app['app_version'] : EMPTY_STR), EMPTY_STR ],
'$price' => [ 'price', t('Price of app'),(($app) ? $app['app_price'] : EMPTY_STR), EMPTY_STR ],
'$page' => [ 'sellpage', t('Location (URL) to purchase app'),(($app) ? $app['app_page'] : EMPTY_STR), EMPTY_STR ],
'$system' => (($app) ? intval($app['app_system']) : 0),
'$plugin' => (($app) ? $app['app_plugin'] : EMPTY_STR),
'$requires' => (($app) ? $app['app_requires'] : EMPTY_STR),
'$embed' => $embed,
'$submit' => t('Submit')
]);
}

View file

@ -2,53 +2,51 @@
namespace Zotlabs\Module;
use \Zotlabs\Lib as Zlib;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Apporder extends \Zotlabs\Web\Controller {
function post() {
}
function get() {
if(! local_channel())
if (! local_channel()) {
return;
}
nav_set_selected('Order Apps');
foreach( [ 'nav_featured_app', 'nav_pinned_app' ] as $l ) {
foreach ( [ 'nav_featured_app', 'nav_pinned_app' ] as $l ) {
$syslist = [];
$list = Zlib\Apps::app_list(local_channel(), false, [ $l ]);
if($list) {
foreach($list as $li) {
$syslist[] = Zlib\Apps::app_encode($li);
$list = Apps::app_list(local_channel(), false, [ $l ]);
if ($list) {
foreach ($list as $li) {
$syslist[] = Apps::app_encode($li);
}
}
Zlib\Apps::translate_system_apps($syslist);
Apps::translate_system_apps($syslist);
usort($syslist,'Zotlabs\\Lib\\Apps::app_name_compare');
$syslist = Zlib\Apps::app_order(local_channel(),$syslist, $l);
$syslist = Apps::app_order(local_channel(),$syslist, $l);
foreach($syslist as $app) {
if($l === 'nav_pinned_app') {
$navbar_apps[] = Zlib\Apps::app_render($app,'nav-order');
foreach ($syslist as $app) {
if ($l === 'nav_pinned_app') {
$navbar_apps[] = Apps::app_render($app,'nav-order');
}
elseif(strpos($app['categories'],'nav_pinned_app') === false) {
$nav_apps[] = Zlib\Apps::app_render($app,'nav-order');
elseif (strpos($app['categories'],'nav_pinned_app') === false) {
$nav_apps[] = Apps::app_render($app,'nav-order');
}
}
}
return replace_macros(get_markup_template('apporder.tpl'),
[
'$header' => [t('Change Order of Pinned Navbar Apps'), t('Change Order of App Tray Apps')],
'$desc' => [t('Use arrows to move the corresponding app left (top) or right (bottom) in the navbar'), t('Use arrows to move the corresponding app up or down in the app tray')],
'$nav_apps' => $nav_apps,
return replace_macros(get_markup_template('apporder.tpl'), [
'$header' => [ t('Change Order of Pinned Navbar Apps'), t('Change Order of App Tray Apps') ],
'$desc' => [ t('Use arrows to move the corresponding app left (top) or right (bottom) in the navbar'),
t('Use arrows to move the corresponding app up or down in the app tray') ],
'$nav_apps' => $nav_apps,
'$navbar_apps' => $navbar_apps
]
);
]);
}
}

View file

@ -23,6 +23,7 @@ class Apschema extends \Zotlabs\Web\Controller {
'eventRepeat' => 'zot:eventRepeat',
'emojiReaction' => 'zot:emojiReaction',
'expires' => 'zot:expires',
'directMessage' => 'zot:directMessage',
]
];

View file

@ -429,12 +429,12 @@ class Calendar extends Controller {
'end' => $end,
'drop' => $drop,
'allDay' => $allDay,
'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8'),
'title' => html_entity_decode($rr['summary'], ENT_COMPAT, 'UTF-8'),
'editable' => $edit ? true : false,
'item' => $rr,
'plink' => [ $rr['plink'], t('Link to source') ],
'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8'),
'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8'),
'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8',false),
'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8',false),
'allow_cid' => expand_acl($rr['allow_cid']),
'allow_gid' => expand_acl($rr['allow_gid']),
'deny_cid' => expand_acl($rr['deny_cid']),
@ -443,7 +443,7 @@ class Calendar extends Controller {
];
}
}
if ($export) {
header('Content-type: text/calendar');
header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"' );

View file

@ -440,6 +440,7 @@ class Channel extends Controller {
'$nouveau' => '0',
'$wall' => '1',
'$fh' => '0',
'$dm' => '0',
'$static' => $static,
'$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1),
'$search' => $search,

View file

@ -18,14 +18,13 @@ class Directory extends Controller {
function init() {
App::set_pager_itemspage(DIRECTORY_PAGESIZE);
if(x($_GET,'ignore') && local_channel()) {
if (x($_GET,'ignore') && local_channel()) {
q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ",
intval(local_channel()),
dbesc($_GET['ignore'])
);
Libsync::build_sync_packet(local_channel(), [ 'xign' => [ [ 'uid' => local_channel(), 'xchan' => $_GET['ignore'] ]]] );
Libsync::build_sync_packet(local_channel(), [ 'xign' => [ [ 'uid' => local_channel(), 'xchan' => $_GET['ignore'] ]]] );
goaway(z_root() . '/directory?f=&suggest=1');
}
@ -34,62 +33,63 @@ class Directory extends Controller {
$safe_changed = false;
$type_changed = false;
if(array_key_exists('global',$_REQUEST)) {
if (array_key_exists('global',$_REQUEST)) {
$globaldir = intval($_REQUEST['global']);
if(get_config('system','localdir_hide')) {
if (get_config('system','localdir_hide')) {
$globaldir = 1;
}
$global_changed = true;
}
if($global_changed) {
if ($global_changed) {
$_SESSION['globaldir'] = $globaldir;
if($observer)
if ($observer) {
set_xconfig($observer,'directory','globaldir',$globaldir);
}
}
if(array_key_exists('safe',$_REQUEST)) {
if (array_key_exists('safe',$_REQUEST)) {
$safemode = intval($_REQUEST['safe']);
$safe_changed = true;
}
if($safe_changed) {
if ($safe_changed) {
$_SESSION['safemode'] = $safemode;
if($observer)
if ($observer) {
set_xconfig($observer,'directory','safemode',$safemode);
}
}
if(array_key_exists('type',$_REQUEST)) {
if (array_key_exists('type',$_REQUEST)) {
$type = intval($_REQUEST['type']);
$type_changed = true;
}
if($type_changed) {
if ($type_changed) {
$_SESSION['chantype'] = $type;
if($observer)
if ($observer) {
set_xconfig($observer,'directory','chantype',$type);
}
}
}
function get() {
if(observer_prohibited()) {
if (observer_prohibited()) {
notice( t('Public access denied.') . EOL);
return;
}
if(get_config('system','block_public_directory',false) && (! get_observer_hash())) {
$observer = get_observer_hash();
if (get_config('system','block_public_directory',false) && (! $observer)) {
notice( t('Public access denied.') . EOL);
return;
}
$observer = get_observer_hash();
$globaldir = Libzotdir::get_directory_setting($observer, 'globaldir');
// override your personal global search pref if we're doing a navbar search of the directory
if(intval($_REQUEST['navsearch']))
if (intval($_REQUEST['navsearch'])) {
$globaldir = 1;
}
$safe_mode = Libzotdir::get_directory_setting($observer, 'safemode');
@ -98,21 +98,23 @@ class Directory extends Controller {
$o = '';
nav_set_selected('Directory');
if(x($_POST,'search'))
if (x($_POST,'search')) {
$search = notags(trim($_POST['search']));
else
}
else {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
}
if(strpos($search,'=') && local_channel() && feature_enabled(local_channel(), 'advanced_dirsearch'))
if (strpos($search,'=')) {
$advanced = $search;
}
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
// Suggest channels if no search terms or keywords are given
$suggest = (local_channel() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
if($suggest) {
if ($suggest) {
// the directory options have no effect in suggestion mode
@ -120,14 +122,13 @@ class Directory extends Controller {
$safe_mode = 1;
$type = 0;
// only return DIRECTORY_PAGESIZE suggestions as the suggestion sorting
// only works if the suggestion query and the directory query have the
// same number of results
$r = suggestion_query(local_channel(),get_observer_hash(),0,DIRECTORY_PAGESIZE);
if(! $r) {
if (! $r) {
notice( t('No default suggestions were found.') . EOL);
return;
}
@ -136,14 +137,14 @@ class Directory extends Controller {
$addresses = array();
$common = array();
$index = 0;
foreach($r as $rr) {
foreach ($r as $rr) {
$common[$rr['xchan_addr']] = ((intval($rr['total']) > 0) ? intval($rr['total']) - 1 : 0);
$addresses[$rr['xchan_addr']] = $index++;
}
// Build query to get info about suggested people
$advanced = '';
foreach(array_keys($addresses) as $address) {
foreach (array_keys($addresses) as $address) {
$advanced .= "address=\"$address\" ";
}
// Remove last space in the advanced query
@ -172,76 +173,85 @@ class Directory extends Controller {
}
$token = get_config('system','realm_token');
logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
$contacts = array();
if(local_channel()) {
if (local_channel()) {
$x = q("select abook_xchan from abook where abook_channel = %d",
intval(local_channel())
);
if($x) {
foreach($x as $xx)
if ($x) {
foreach ($x as $xx) {
$contacts[] = $xx['abook_xchan'];
}
}
}
if($url) {
if ($url) {
$numtags = get_config('system','directorytags');
$kw = ((intval($numtags) > 0) ? intval($numtags) : 50);
if(get_config('system','disable_directory_keywords'))
if (get_config('system','disable_directory_keywords')) {
$kw = 0;
}
$query = $url . '?f=&kw=' . $kw . (($safe_mode != 1) ? '&safe=' . $safe_mode : '');
if($token)
if ($token) {
$query .= '&t=' . $token;
if(! $globaldir)
}
if (! $globaldir) {
$query .= '&hub=' . App::get_hostname();
if($search)
}
if ($search) {
$query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search);
if(strpos($search,'@'))
}
if (strpos($search,'@')) {
$query .= '&address=' . urlencode($search);
if($keywords)
}
if ($keywords) {
$query .= '&keywords=' . urlencode($keywords);
if($advanced)
}
if ($advanced) {
$query .= '&query=' . urlencode($advanced);
if(! is_null($type))
}
if (! is_null($type)) {
$query .= '&type=' . intval($type);
}
$directory_sort_order = get_config('system','directory_sort_order');
if(! $directory_sort_order)
if (! $directory_sort_order) {
$directory_sort_order = 'date';
}
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : $directory_sort_order);
if($sort_order)
if ($sort_order) {
$query .= '&order=' . urlencode($sort_order);
}
if(App::$pager['page'] != 1)
if (App::$pager['page'] != 1) {
$query .= '&p=' . App::$pager['page'];
}
logger('mod_directory: query: ' . $query);
$x = z_fetch_url($query);
// logger('directory: return from upstream: ' . print_r($x,true), LOGGER_DATA);
if($x['success']) {
if ($x['success']) {
$t = 0;
$j = json_decode($x['body'],true);
if($j) {
if ($j) {
if($j['results']) {
if ($j['results']) {
$results = $j['results'];
if($suggest) {
if ($suggest) {
// change order to "number of common friends descending"
$results = self::reorder_results($results,$addresses);
}
@ -250,7 +260,7 @@ class Directory extends Controller {
$photo = 'thumb';
foreach($results as $rr) {
foreach ($results as $rr) {
$profile_link = chanlink_url($rr['url']);
@ -261,54 +271,52 @@ class Directory extends Controller {
//$online = remote_online_status($rr['address']);
$online = '';
if(in_array($rr['hash'],$contacts))
if (in_array($rr['hash'],$contacts)) {
$connect_link = '';
}
$location = '';
if(strlen($rr['locale']))
if (strlen($rr['locale'])) {
$location .= $rr['locale'];
if(strlen($rr['region'])) {
if(strlen($rr['locale']))
}
if (strlen($rr['region'])) {
if (strlen($rr['locale'])) {
$location .= ', ';
}
$location .= $rr['region'];
}
if(strlen($rr['country'])) {
if(strlen($location))
if (strlen($rr['country'])) {
if (strlen($location)) {
$location .= ', ';
}
$location .= $rr['country'];
}
$age = '';
if(strlen($rr['birthday'])) {
if(($years = age($rr['birthday'],'UTC','')) > 0)
if (strlen($rr['birthday'])) {
if (($years = age($rr['birthday'],'UTC','')) > 0) {
$age = $years;
}
}
$page_type = '';
$rating_enabled = get_config('system','rating_enabled');
if($rr['total_ratings'] && $rating_enabled)
if ($rr['total_ratings'] && $rating_enabled) {
$total_ratings = sprintf( tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
else
}
else {
$total_ratings = '';
}
$profile = $rr;
if ((x($profile,'locale') == 1)
|| (x($profile,'region') == 1)
|| (x($profile,'postcode') == 1)
|| (x($profile,'country') == 1))
$gender = ((x($profile,'gender') == 1) ? t('Gender: ') . $profile['gender']: False);
$marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital']: False);
$marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital']: False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage: ') : False);
$homepageurl = ((x($profile,'homepage') == 1) ? html2plain($profile['homepage']) : '');
$homepageurl = ((x($profile,'homepage') == 1) ? html2plain($profile['homepage']) : '');
$hometown = ((x($profile,'hometown') == 1) ? html2plain($profile['hometown']) : False);
$about = ((x($profile,'about') == 1) ? zidify_links(bbcode($profile['about'])) : False);
if ($about && $safe_mode) {
$about = html2plain($about);
@ -316,81 +324,82 @@ class Directory extends Controller {
$keywords = ((x($profile,'keywords')) ? $profile['keywords'] : '');
$out = '';
if($keywords) {
if ($keywords) {
$keywords = str_replace(',',' ', $keywords);
$keywords = str_replace(' ',' ', $keywords);
$karr = explode(' ', $keywords);
if($karr) {
if(local_channel()) {
if ($karr) {
if (local_channel()) {
$r = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
intval(local_channel())
);
if($r) {
if ($r) {
$keywords = str_replace(',',' ', $r[0]['keywords']);
$keywords = str_replace(' ',' ', $keywords);
$marr = explode(' ', $keywords);
}
}
foreach($karr as $k) {
if(strlen($out))
foreach ($karr as $k) {
if (strlen($out)) {
$out .= ', ';
if($marr && in_arrayi($k,$marr))
}
if ($marr && in_arrayi($k,$marr)) {
$out .= '<a href="' . z_root() . '/directory/f=&keywords=' . urlencode($k) .'"><strong>' . $k . '</strong></a>';
else
}
else {
$out .= '<a href="' . z_root() . '/directory/f=&keywords=' . urlencode($k) .'">' . $k . '</a>';
}
}
}
}
$entry = array(
'id' => ++$t,
'profile_link' => $profile_link,
'type' => $rr['type'],
'photo' => $rr['photo'],
'hash' => $rr['hash'],
'alttext' => $rr['name'] . ((local_channel() || remote_channel()) ? ' ' . $rr['address'] : ''),
'name' => $rr['name'],
'age' => $age,
'age_label' => t('Age:'),
'profile' => $profile,
'address' => $rr['address'],
'nickname' => substr($rr['address'],0,strpos($rr['address'],'@')),
'location' => $location,
'location_label' => t('Location:'),
'gender' => $gender,
'total_ratings' => $total_ratings,
'viewrate' => true,
'canrate' => (($rating_enabled && local_channel()) ? true : false),
'pdesc' => $pdesc,
'pdesc_label' => t('Description:'),
'censor' => (($directory_admin) ? 'dircensor/' . $rr['hash'] : ''),
'censor_label' => (($rr['censored']) ? t('Uncensor') : t('Censor')),
'marital' => $marital,
'homepage' => $homepage,
'homepageurl' => (($safe_mode) ? $homepageurl : linkify($homepageurl)),
'hometown' => $hometown,
'hometown_label' => t('Hometown:'),
'about' => $about,
'about_label' => t('About:'),
'conn_label' => t('Connect'),
'forum_label' => t('Group'),
$entry = [
'id' => ++ $t,
'profile_link' => $profile_link,
'type' => $rr['type'],
'photo' => $rr['photo'],
'hash' => $rr['hash'],
'alttext' => $rr['name'] . ((local_channel() || remote_channel()) ? ' ' . $rr['address'] : ''),
'name' => $rr['name'],
'age' => $age,
'age_label' => t('Age:'),
'profile' => $profile,
'address' => $rr['address'],
'nickname' => substr($rr['address'],0,strpos($rr['address'],'@')),
'location' => $location,
'location_label' => t('Location:'),
'gender' => $gender,
'total_ratings' => $total_ratings,
'viewrate' => true,
'canrate' => (($rating_enabled && local_channel()) ? true : false),
'pdesc' => $pdesc,
'pdesc_label' => t('Description:'),
'censor' => (($directory_admin) ? 'dircensor/' . $rr['hash'] : ''),
'censor_label' => (($rr['censored']) ? t('Uncensor') : t('Censor')),
'marital' => $marital,
'homepage' => $homepage,
'homepageurl' => (($safe_mode) ? $homepageurl : linkify($homepageurl)),
'hometown' => $hometown,
'hometown_label' => t('Hometown:'),
'about' => $about,
'about_label' => t('About:'),
'conn_label' => t('Connect'),
'forum_label' => t('Group'),
'collections_label' => t('Collection'),
'connect' => $connect_link,
'online' => $online,
'kw' => (($out) ? t('Keywords: ') : ''),
'keywords' => $out,
'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '',
'ignore_label' => t('Don\'t suggest'),
'common_friends' => (($common[$rr['address']]) ? intval($common[$rr['address']]) : ''),
'common_label' => t('Common connections (estimated):'),
'common_count' => intval($common[$rr['address']]),
'safe' => $safe_mode
);
'connect' => $connect_link,
'online' => $online,
'kw' => (($out) ? t('Keywords: ') : ''),
'keywords' => $out,
'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '',
'ignore_label' => t('Don\'t suggest'),
'common_friends' => (($common[$rr['address']]) ? intval($common[$rr['address']]) : ''),
'common_label' => t('Common connections (estimated):'),
'common_count' => intval($common[$rr['address']]),
'safe' => $safe_mode
];
$arr = array('contact' => $rr, 'entry' => $entry);
@ -399,14 +408,13 @@ class Directory extends Controller {
unset($profile);
unset($location);
if(! $arr['entry']) {
if (! $arr['entry']) {
continue;
}
if($sort_order == '' && $suggest) {
if ($sort_order == '' && $suggest) {
$entries[$addresses[$rr['address']]] = $arr['entry']; // Use the same indexes as originally to get the best suggestion first
}
else {
$entries[] = $arr['entry'];
}
@ -414,18 +422,16 @@ class Directory extends Controller {
ksort($entries); // Sort array by key so that foreach-constructs work as expected
if($j['keywords']) {
if ($j['keywords']) {
App::$data['directory_keywords'] = $j['keywords'];
}
// logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA);
if($_REQUEST['aj']) {
if($entries) {
$o = replace_macros(get_markup_template('directajax.tpl'),array(
'$entries' => $entries
));
if ($_REQUEST['aj']) {
if ($entries) {
$o = replace_macros(get_markup_template('directajax.tpl'), [ '$entries' => $entries ] );
}
else {
$o = '<div id="content-complete"></div>';
@ -439,34 +445,31 @@ class Directory extends Controller {
$dirtitle = (($globaldir) ? t('Global Directory') : t('Local Directory'));
$o .= "<script> var page_query = '" . escape_tags(urlencode($_GET['req'])) . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . "; </script>";
$o .= replace_macros($tpl, array(
'$search' => $search,
'$desc' => t('Find'),
'$finddsc' => t('Finding:'),
'$safetxt' => htmlspecialchars($search,ENT_QUOTES,'UTF-8'),
'$entries' => $entries,
'$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle,
'$submit' => t('Find'),
'$next' => alt_pager($j['records'], t('next page'), t('previous page')),
'$sort' => t('Sort options'),
'$normal' => t('Alphabetic'),
'$reverse' => t('Reverse Alphabetic'),
'$date' => t('Newest to Oldest'),
$o .= replace_macros($tpl, [
'$search' => $search,
'$desc' => t('Find'),
'$finddsc' => t('Finding:'),
'$safetxt' => htmlspecialchars($search,ENT_QUOTES,'UTF-8'),
'$entries' => $entries,
'$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle,
'$submit' => t('Find'),
'$next' => alt_pager($j['records'], t('next page'), t('previous page')),
'$sort' => t('Sort options'),
'$normal' => t('Alphabetic'),
'$reverse' => t('Reverse Alphabetic'),
'$date' => t('Newest to Oldest'),
'$reversedate' => t('Oldest to Newest'),
'$suggest' => $suggest ? '&suggest=1' : ''
));
'$suggest' => $suggest ? '&suggest=1' : ''
]);
}
}
else {
if($_REQUEST['aj']) {
if ($_REQUEST['aj']) {
$o = '<div id="content-complete"></div>';
echo $o;
killme();
}
if(\App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) {
if (App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) {
goaway(z_root() . '/chanview/?f=&address=' . $search);
}
info( t("No entries (some entries may be hidden).") . EOL);
@ -479,22 +482,19 @@ class Directory extends Controller {
static public function reorder_results($results,$suggests) {
// return $results;
if(! $suggests)
if (! $suggests) {
return $results;
}
$out = [];
foreach($suggests as $k => $v) {
foreach($results as $rv) {
if($k == $rv['address']) {
foreach ($suggests as $k => $v) {
foreach ($results as $rv) {
if ($k == $rv['address']) {
$out[intval($v)] = $rv;
break;
}
}
}
return $out;
}

View file

@ -353,7 +353,7 @@ class Dirsearch extends Controller {
$ret['results'] = $entries;
if ($kw) {
$k = dir_tagadelic($kw, $hub, $type);
$k = dir_tagadelic($kw, $hub, $type,$safesql);
if ($k) {
$ret['keywords'] = array();
foreach ($k as $kv) {

View file

@ -224,6 +224,7 @@ class Display extends Controller {
'$conv' => '0',
'$spam' => '0',
'$fh' => '0',
'$dm' => '0',
'$nouveau' => '0',
'$wall' => '0',
'$static' => $static,

View file

@ -1,19 +1,23 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Hq extends \Zotlabs\Web\Controller {
class Hq extends Controller {
function init() {
if(! local_channel())
return;
\App::$profile_uid = local_channel();
App::$profile_uid = local_channel();
}
function post() {
@ -104,7 +108,7 @@ class Hq extends \Zotlabs\Web\Controller {
}
if(! $update) {
$channel = \App::get_channel();
$channel = App::get_channel();
$channel_acl = [
'allow_cid' => $channel['channel_allow_cid'],
@ -119,7 +123,7 @@ class Hq extends \Zotlabs\Web\Controller {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => populate_acl($channel_acl,true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,
@ -165,7 +169,7 @@ class Hq extends \Zotlabs\Web\Controller {
$o .= "<script> var profile_uid = " . local_channel()
. "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . ";</script>\r\n";
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),[
App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),[
'$baseurl' => z_root(),
'$pgtype' => 'hq',
'$uid' => local_channel(),
@ -178,6 +182,7 @@ class Hq extends \Zotlabs\Web\Controller {
'$conv' => '0',
'$spam' => '0',
'$fh' => '0',
'$dm' => '0',
'$nouveau' => '0',
'$wall' => '0',
'$static' => $static,

View file

@ -54,8 +54,9 @@ class Item extends Controller {
$i = null;
// do we have the item (at all)?
// add preferential bias to item owners (item_wall = 1)
$r = q("select * from item where mid = '%s' or uuid = '%s' $item_normal limit 1",
$r = q("select * from item where mid = '%s' or uuid = '%s' $item_normal order by item_wall desc limit 1",
dbesc(z_root() . '/item/' . $item_id),
dbesc($item_id)
);
@ -88,11 +89,12 @@ class Item extends Controller {
}
// if we don't have a parent id belonging to the signer see if we can obtain one as a visitor that we have permission to access
// with a bias towards those items owned by channels on this site (item_wall = 1)
$sql_extra = item_permissions_sql(0);
if (! $i) {
$i = q("select id as item_id from item where mid = '%s' $item_normal $sql_extra limit 1",
$i = q("select id as item_id from item where mid = '%s' $item_normal $sql_extra order by item_wall desc limit 1",
dbesc($r[0]['parent_mid'])
);
}
@ -189,11 +191,12 @@ class Item extends Controller {
}
// if we don't have a parent id belonging to the signer see if we can obtain one as a visitor that we have permission to access
// with a bias towards those items owned by channels on this site (item_wall = 1)
$sql_extra = item_permissions_sql(0);
if (! $i) {
$i = q("select id as item_id from item where mid = '%s' $item_normal $sql_extra limit 1",
$i = q("select id as item_id from item where mid = '%s' $item_normal $sql_extra order by item_wall desc limit 1",
dbesc($r[0]['parent_mid'])
);
}
@ -684,9 +687,9 @@ class Item extends Controller {
$private = $orig_post['item_private'];
}
if($private || $public_policy || $acl->is_private())
$private = 1;
if($public_policy || $acl->is_private()) {
$private = (($private) ? $private : 1);
}
$location = $orig_post['location'];
$coord = $orig_post['coord'];
@ -763,14 +766,14 @@ class Item extends Controller {
$allow_empty = ((array_key_exists('allow_empty',$_REQUEST)) ? intval($_REQUEST['allow_empty']) : 0);
$private = intval($acl->is_private() || ($public_policy));
$private = (($private) ? $private : intval($acl->is_private() || ($public_policy)));
// If this is a comment, set the permissions from the parent.
if($parent_item) {
$private = 0;
$acl->set($parent_item);
$private = intval($acl->is_private() || $parent_item['item_private']);
$private = ((intval($parent_item['item_private']) ? $parent_item['item_private'] : $acl->is_private()));
$public_policy = $parent_item['public_policy'];
$owner_hash = $parent_item['owner_xchan'];
$webpage = $parent_item['item_type'];
@ -1102,7 +1105,7 @@ class Item extends Controller {
$plink = z_root() . '/item/' . $uuid;
}
$datarray['aid'] = $channel['channel_account_id'];
$datarray['uid'] = $profile_uid;
$datarray['uuid'] = $uuid;
@ -1422,13 +1425,14 @@ class Item extends Controller {
if((argc() == 3) && (argv(1) === 'drop') && intval(argv(2))) {
$i = q("select id, uid, item_origin, resource_type, resource_id, author_xchan, owner_xchan, source_xchan, item_type from item where id = %d limit 1",
$i = q("select * from item where id = %d limit 1",
intval(argv(2))
);
if($i) {
$can_delete = false;
$local_delete = false;
$regular_delete = false;
if(local_channel() && local_channel() == $i[0]['uid']) {
$local_delete = true;
@ -1437,6 +1441,7 @@ class Item extends Controller {
$ob_hash = get_observer_hash();
if($ob_hash && ($ob_hash === $i[0]['author_xchan'] || $ob_hash === $i[0]['owner_xchan'] || $ob_hash === $i[0]['source_xchan'])) {
$can_delete = true;
$regular_delete = true;
}
// The site admin can delete any post/item on the site.
@ -1461,7 +1466,7 @@ class Item extends Controller {
dbesc($i[0]['resource_id']),
intval($i[0]['uid'])
);
if ($r) {
if ($r && $regular_delete) {
$sync_event = $r[0];
q("delete from event WHERE event_hash = '%s' AND uid = %d LIMIT 1",
dbesc($i[0]['resource_id']),
@ -1472,6 +1477,18 @@ class Item extends Controller {
}
}
if ($i[0]['resource_type'] === 'photo') {
attach_delete($i[0]['uid'], $i[0]['resource_id'], true );
$ch = channelx_by_n($i[0]['uid']);
if ($ch && $regular_delete) {
$sync = attach_export_data($ch,$i[0]['resource_id'], true);
if ($sync) {
Libsync::build_sync_packet($i[0]['uid'],array('file' => array($sync)));
}
}
}
// if this is a different page type or it's just a local delete
// but not by the item author or owner, do a simple deletion

View file

@ -1,6 +1,7 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Activity;
use Zotlabs\Web\Controller;
@ -46,7 +47,7 @@ class Like extends Controller {
$sys_channel = get_sys_channel();
$sys_channel_id = (($sys_channel) ? $sys_channel['channel_id'] : 0);
$observer = \App::get_observer();
$observer = App::get_observer();
$verb = notags(trim($_GET['verb']));
@ -178,7 +179,7 @@ class Like extends Controller {
$object = json_encode(Activity::fetch_profile([ 'id' => channel_url($ch[0]) ]));
// second like of the same thing is "undo" for the first like
$z = q("select * from likes where channel_id = %d and liker = '%s' and verb = '%s' and target_type = '%s' and target_id = '%s' limit 1",
@ -234,7 +235,7 @@ class Like extends Controller {
if($r) {
if($r[0]['uid'] === $sys_channel['channel_id'] && local_channel()) {
$r = [ copy_of_pubitem(\App::get_channel(), $r[0]['mid']) ];
$r = [ copy_of_pubitem(App::get_channel(), $r[0]['mid']) ];
}
}
@ -283,8 +284,10 @@ class Like extends Controller {
$multi_undo = false;
$item_normal = item_normal();
$item_normal = " and item.item_deleted = 0 and item.item_unpublished = 0 and item.item_delayed = 0
and item.item_pending_remove = 0 and item.item_blocked = 0 and item.obj_type != '" . ACTIVITY_OBJ_FILE . "' ";
$r = q("SELECT id, parent, uid, verb FROM item WHERE verb in ( $verbs ) $item_normal
AND author_xchan = '%s' AND thr_parent = '%s' and uid = %d ",
dbesc($observer['xchan_hash']),
@ -360,6 +363,16 @@ class Like extends Controller {
$r = q("update item set item_hidden = 0 where id = %d",
intval($item['id'])
);
$r = q("select * from item where id = %d",
intval($item['id'])
);
if($r) {
xchan_query($r);
$sync_item = fetch_post_tags($r);
Libsync::build_sync_packet($ch[0]['channel_id'], [ 'item' => [ encode_item($sync_item[0],true) ] ]);
}
Master::Summon(array('Notifier','wall-new',$item['id']));
}

View file

@ -76,7 +76,7 @@ class Lockview extends \Zotlabs\Web\Controller {
killme();
}
if(($item['item_private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
if(intval($item['item_private']) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid']))
&& (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) {
// if the post is private, but public_policy is blank ("visible to the internet"), and there aren't any

View file

@ -64,7 +64,7 @@ class Network extends Controller {
$category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
$hashtags = ((x($_REQUEST,'tag')) ? $_REQUEST['tag'] : '');
$verb = ((x($_REQUEST,'verb')) ? $_REQUEST['verb'] : '');
$dm = ((x($_REQUEST,'dm')) ? $_REQUEST['dm'] : 0);
$order = get_pconfig(local_channel(), 'mod_network', 'order', 0);
switch ($order) {
@ -336,6 +336,7 @@ class Network extends Controller {
'$conv' => (($conv) ? $conv : '0'),
'$spam' => (($spam) ? $spam : '0'),
'$fh' => '0',
'$dm' => (($dm) ? $dm : '0'),
'$nouveau' => (($nouveau) ? $nouveau : '0'),
'$wall' => '0',
'$static' => $static,
@ -399,6 +400,10 @@ class Network extends Controller {
$sql_extra .= term_query('item',$file,TERM_FILE);
}
if ($dm) {
$sql_extra .= " and item_private = 2 ";
}
if ($conv) {
$item_thread_top = '';

View file

@ -3,7 +3,7 @@ namespace Zotlabs\Module; /** @file */
use Zotlabs\Lib\Libsync;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
class Notes extends Controller {
@ -26,17 +26,38 @@ class Notes extends Controller {
set_pconfig(local_channel(),'notes','text.bak',$old_text);
}
set_pconfig(local_channel(),'notes','text',$body);
}
// push updates to channel clones
// push updates to channel clones
if((argc() > 1) && (argv(1) === 'sync')) {
Libsync::build_sync_packet();
}
if((argc() > 1) && (argv(1) === 'sync')) {
Libsync::build_sync_packet();
}
logger('notes saved.', LOGGER_DEBUG);
json_return_and_die($ret);
logger('notes saved.', LOGGER_DEBUG);
json_return_and_die($ret);
}
}
function get() {
$desc = t('This app allows you to create private notes for your personal use.');
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Notes'))) {
return $text;
}
$desc = t('This app is installed. The Notes tool can be found on your network stream page.');
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
return $text;
}
}

View file

@ -215,6 +215,71 @@ class Photos extends Controller {
}
}
// this still needs some work
if(defined('FIXED')) {
if((x($_POST,'rotate') !== false) && ( (intval($_POST['rotate']) == 1) || (intval($_POST['rotate']) == 2) )) {
logger('rotate');
$resource_id = argv(2);
$r = q("select * from photo where resource_id = '%s' and uid = %d and imgscale = 0 limit 1",
dbesc($resource_id),
intval($page_owner_uid)
);
if($r) {
$ph = photo_factory(@file_get_contents(dbunescbin($r[0]['content'])), $r[0]['mimetype']);
if($ph->is_valid()) {
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
$ph->rotate($rotate_deg);
$edited = datetime_convert();
q("update attach set filesize = %d, edited = '%s' where hash = '%s' and uid = %d",
strlen($ph->imageString()),
dbescdate($edited),
dbesc($resource_id),
intval($page_owner_uid)
);
$ph->saveImage(dbunescbin($r[0]['content']));
$arr = [
'aid' => get_account_id(),
'uid' => intval($page_owner_uid),
'resource_id' => dbesc($resource_id),
'filename' => $r[0]['filename'],
'imgscale' => 0,
'album' => $r[0]['album'],
'os_path' => $r[0]['os_path'],
'os_storage' => 1,
'os_syspath' => dbunescbin($r[0]['content']),
'display_path' => $r[0]['display_path'],
'photo_usage' => PHOTO_NORMAL,
'edited' => dbescdate($edited)
];
$ph->save($arr);
unset($arr['os_syspath']);
if($width > 1024 || $height > 1024)
$ph->scaleImage(1024);
$ph->storeThumbnail($arr, PHOTO_RES_1024);
if($width > 640 || $height > 640)
$ph->scaleImage(640);
$ph->storeThumbnail($arr, PHOTO_RES_640);
if($width > 320 || $height > 320)
$ph->scaleImage(320);
$ph->storeThumbnail($arr, PHOTO_RES_320);
}
}
}}
if((argc() > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false))) {
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');

View file

@ -1,11 +1,15 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Pubstream extends \Zotlabs\Web\Controller {
class Pubstream extends Controller {
function get($update = 0, $load = false) {
@ -51,7 +55,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if(local_channel() && (! $update)) {
$channel = \App::get_channel();
$channel = App::get_channel();
$channel_acl = array(
'allow_cid' => $channel['channel_allow_cid'],
@ -66,7 +70,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => populate_acl($channel_acl,true,PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,
@ -105,14 +109,14 @@ class Pubstream extends \Zotlabs\Web\Controller {
$o .= '<div id="live-pubstream"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
. "; var profile_page = " . \App::$pager['page']
. "; var profile_page = " . App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
//if we got a decoded hash we must encode it again before handing to javascript
if($decoded)
$mid = 'b64.' . base64url_encode($mid);
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
'$pgtype' => 'pubstream',
'$uid' => ((local_channel()) ? local_channel() : '0'),
@ -125,11 +129,12 @@ class Pubstream extends \Zotlabs\Web\Controller {
'$conv' => '0',
'$spam' => '0',
'$fh' => '1',
'$dm' => '0',
'$nouveau' => '0',
'$wall' => '0',
'$list' => '0',
'$static' => $static,
'$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1),
'$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1),
'$search' => '',
'$xchan' => '',
'$order' => 'comment',
@ -149,8 +154,8 @@ class Pubstream extends \Zotlabs\Web\Controller {
$pager_sql = '';
}
else {
\App::set_pager_itemspage(20);
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
App::set_pager_itemspage(20);
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
}
require_once('include/channel.php');
@ -163,7 +168,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$sys = get_sys_channel();
$uids = " and item.uid = " . intval($sys['channel_id']) . " ";
$sql_extra = item_permissions_sql($sys['channel_id']);
\App::$data['firehose'] = intval($sys['channel_id']);
App::$data['firehose'] = intval($sys['channel_id']);
}
if(get_config('system','public_list_mode'))
@ -179,7 +184,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
$net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : '');
$abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
$abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " ";
$simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : '');

View file

@ -131,6 +131,7 @@ class Search extends \Zotlabs\Web\Controller {
'$conv' => '0',
'$spam' => '0',
'$fh' => '0',
'$dm' => '0',
'$nouveau' => '0',
'$wall' => '0',
'$static' => $static,

View file

@ -12,7 +12,7 @@ class Webfinger extends Controller {
// This is a public resource with relaxed CORS policy. Close the current login session.
session_write_close();
header('Access-Control-Allow-Origin: *');
$result = [];

View file

@ -2,7 +2,7 @@
namespace Zotlabs\Thumbs;
use \ID3Parser\ID3Parser;
use ID3Parser\ID3Parser;
class Mp3audio {

View file

@ -2,8 +2,9 @@
namespace Zotlabs\Web;
use SessionHandlerInterface;
class SessionHandler implements \SessionHandlerInterface {
class SessionHandler implements SessionHandlerInterface {
function open ($s, $n) {
@ -17,10 +18,10 @@ class SessionHandler implements \SessionHandlerInterface {
function read ($id) {
if($id) {
if ($id) {
$r = q("SELECT sess_data FROM session WHERE sid= '%s'", dbesc($id));
if($r) {
if ($r) {
return $r[0]['sess_data'];
}
else {
@ -38,8 +39,11 @@ class SessionHandler implements \SessionHandlerInterface {
function write ($id, $data) {
if(! $id || ! $data) {
return false;
// Pretend everything is hunky-dory, even though it isn't. There probably isn't anything
// we can do about it in any event.
if (! $id) {
return true;
}
// Unless we authenticate somehow, only keep a session for 5 minutes
@ -50,12 +54,12 @@ class SessionHandler implements \SessionHandlerInterface {
$expire = time() + 300;
if($_SESSION) {
if(array_key_exists('remember_me',$_SESSION) && intval($_SESSION['remember_me']))
if ($_SESSION) {
if (array_key_exists('remember_me',$_SESSION) && intval($_SESSION['remember_me']))
$expire = time() + (60 * 60 * 24 * 365);
elseif(local_channel())
elseif (local_channel())
$expire = time() + (60 * 60 * 24 * 3);
elseif(remote_channel())
elseif (remote_channel())
$expire = time() + (60 * 60 * 24 * 1);
}

View file

@ -2,6 +2,9 @@
namespace Zotlabs\Widget;
use App;
class Activity_filter {
function widget($arr) {
@ -9,11 +12,23 @@ class Activity_filter {
if(! local_channel())
return '';
$cmd = \App::$cmd;
$cmd = App::$cmd;
$filter_active = false;
$tabs = [];
if(x($_GET,'dm')) {
$dm_active = (($_GET['dm'] == 1) ? 'active' : '');
$filter_active = 'dm';
}
$tabs[] = [
'label' => t('Direct Messages'),
'icon' => 'envelope-o',
'url' => z_root() . '/' . $cmd . '/?dm=1',
'sel' => $dm_active,
'title' => t('Show direct (private) messages')
];
if(x($_GET,'conv')) {
$conv_active = (($_GET['conv'] == 1) ? 'active' : '');
@ -28,6 +43,7 @@ class Activity_filter {
'title' => t('Show posts that mention or involve me')
];
if(x($_GET,'verb')) {
$verb_active = (($_GET['verb'] == 1) ? 'active' : '');
$filter_active = 'events';
@ -41,6 +57,7 @@ class Activity_filter {
'title' => t('Show posts that include events')
];
if(feature_enabled(local_channel(),'star_posts')) {
if(x($_GET,'star')) {
$starred_active = (($_GET['star'] == 1) ? 'active' : '');

View file

@ -2,21 +2,25 @@
namespace Zotlabs\Widget;
use Zotlabs\Lib\Apps;
class Notes {
function widget($arr) {
if(! local_channel())
if (! local_channel()) {
return '';
if(! feature_enabled(local_channel(),'private_notes'))
}
if (! Apps::system_app_installed(local_channel(),'Notes')) {
return '';
}
$text = get_pconfig(local_channel(),'notes','text');
$o = replace_macros(get_markup_template('notes.tpl'), array(
$o = replace_macros(get_markup_template('notes.tpl'), [
'$banner' => t('Notes'),
'$text' => $text,
'$save' => t('Save'),
));
]);
return $o;
}

6
app/notes.apd Normal file
View file

@ -0,0 +1,6 @@
version: 1
url: $baseurl/notes
requires: local_channel
name: Notes
photo: icon:pencil
categories: Productivity

View file

@ -45,11 +45,14 @@ require_once('include/items.php');
define ( 'STD_VERSION', '3.0' );
define ( 'STD_VERSION', '3.1' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1232 );
define ( 'PLATFORM_NAME', 'zap' );
define ( 'PLATFORM_ARCHITECTURE', 'zap' );
define ( 'PROJECT_BASE', __DIR__ );
/**
@ -463,7 +466,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' );
define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' );
define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.8' );
define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.9' );
/**
* activity stream defines
*/
@ -608,16 +611,6 @@ function sys_boot() {
@include('.htconfig.php');
if(defined('NOMADIC')) {
define ( 'PLATFORM_NAME', 'zap' );
define ( 'PLATFORM_ARCHITECTURE', 'zap' );
}
else {
define ( 'PLATFORM_NAME', 'osada' );
define ( 'PLATFORM_ARCHITECTURE', 'osada' );
}
// allow somebody to set some initial settings just in case they can't
// install without special fiddling

669
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1487,8 +1487,8 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
intval($channel_id)
);
$arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo];
call_hooks("attach_delete",$arr);
$arr = ['channel_id' => $channel_id, 'resource' => $resource, 'is_photo'=>$is_photo];
call_hooks("attach_delete",$arr);
file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', true);
@ -1498,7 +1498,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
function attach_drop_photo($channel_id,$resource) {
$x = q("select id, item_hidden from item where resource_id = '%s' and resource_type = 'photo' and uid = %d",
$x = q("select id, item_hidden from item where resource_id = '%s' and resource_type = 'photo' and uid = %d and item_deleted = 0",
dbesc($resource),
intval($channel_id)
);

View file

@ -1842,10 +1842,13 @@ function item_store($arr, $allow_exec = false, $deliver = true, $linkid = true)
}
if(strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid))
$private = 1;
else
$private = $arr['item_private'];
$private = intval($arr['item_private']);
if (! $private) {
if (strlen($allow_cid) || strlen($allow_gid) || strlen($deny_cid) || strlen($deny_gid)) {
$private = 1;
}
}
$arr['parent'] = $parent_id;
$arr['allow_cid'] = $allow_cid;
@ -2881,9 +2884,12 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $edit = false)
$arr['item_uplink'] = 1;
$arr['source_xchan'] = $item['owner_xchan'];
$arr['item_private'] = (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 1 : 0);
$arr['item_private'] = $item['item_private'];
if(! intval($arr['item_private'])) {
$arr['item_private'] = (($channel['channel_allow_cid'] || $channel['channel_allow_gid']
|| $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 1 : 0);
}
$arr['item_origin'] = 1;
$arr['item_wall'] = 1;
@ -3387,8 +3393,6 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
// logger('dropped_item: ' . print_r($item,true),LOGGER_ALL);
$linked_item = (($item['resource_id'] && $item['resource_type'] && in_array($item['resource_type'], $linked_resource_types)) ? true : false);
$ok_to_delete = false;
// system deletion
@ -3411,19 +3415,9 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
if($ok_to_delete) {
// set the deleted flag immediately on this item just in case the
// hook calls a remote process which loops. We'll delete it properly in a second.
if(($linked_item) && (! $force)) {
$r = q("UPDATE item SET item_hidden = 1 WHERE id = %d",
intval($item['id'])
);
}
else {
$r = q("UPDATE item SET item_deleted = 1 WHERE id = %d",
intval($item['id'])
);
}
$r = q("UPDATE item SET item_deleted = 1 WHERE id = %d",
intval($item['id'])
);
if ($item['resource_type'] === 'event' ) {
q("delete from event where event_hash = '%s' and uid = %d",
@ -3432,6 +3426,10 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
);
}
if ($item['resource_type'] === 'photo' ) {
attach_delete($item['uid'],$item['resource_id'],true);
}
$arr = [
'item' => $item,
'interactive' => $interactive,
@ -3494,7 +3492,6 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
*/
function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) {
$linked_item = (($item['resource_id'] && in_array($item['resource_type'],['photo'])) ? true : false);
logger('item: ' . $item['id'] . ' stage: ' . $stage . ' force: ' . $force, LOGGER_DATA);
@ -3509,39 +3506,19 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) {
break;
case DROPITEM_PHASE1:
if($linked_item && ! $force) {
$r = q("UPDATE item SET item_hidden = 1,
changed = '%s', edited = '%s' WHERE id = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($item['id'])
);
}
else {
$r = q("UPDATE item set item_deleted = 1, changed = '%s', edited = '%s' where id = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($item['id'])
);
}
$r = q("UPDATE item set item_deleted = 1, changed = '%s', edited = '%s' where id = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($item['id'])
);
break;
case DROPITEM_NORMAL:
default:
if($linked_item && ! $force) {
$r = q("UPDATE item SET item_hidden = 1,
changed = '%s', edited = '%s' WHERE id = %d",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($item['id'])
);
}
else {
$r = q("DELETE FROM item WHERE id = %d",
intval($item['id'])
);
}
$r = q("DELETE FROM item WHERE id = %d",
intval($item['id'])
);
break;
}
@ -4304,12 +4281,12 @@ function set_linkified_perms($linkified, &$str_contact_allow, &$str_group_allow,
if(strpos($access_tag,'cid:') === 0) {
$str_contact_allow .= '<' . substr($access_tag,4) . '>';
$access_tag = '';
$private = 1;
$private = 2;
}
elseif(strpos($access_tag,'gid:') === 0) {
$str_group_allow .= '<' . substr($access_tag,4) . '>';
$access_tag = '';
$private = 1;
$private = 2;
}
}
}

View file

@ -158,10 +158,7 @@ function load_translation_table($lang, $install = false) {
App::$strings = array();
if(file_exists("view/$lang/hstrings.php")) {
include("view/$lang/hstrings.php");
}
elseif(file_exists("view/$lang/strings.php")) {
if(file_exists("view/$lang/strings.php")) {
include("view/$lang/strings.php");
}
@ -170,10 +167,7 @@ function load_translation_table($lang, $install = false) {
if ($plugins !== false) {
foreach($plugins as $p) {
$name = $p['aname'];
if(file_exists("addon/$name/lang/$lang/hstrings.php")) {
include("addon/$name/lang/$lang/hstrings.php");
}
elseif(file_exists("addon/$name/lang/$lang/strings.php")) {
if(file_exists("addon/$name/lang/$lang/strings.php")) {
include("addon/$name/lang/$lang/strings.php");
}
}
@ -183,10 +177,7 @@ function load_translation_table($lang, $install = false) {
// Allow individual strings to be over-ridden on this site
// Either for the default language or for all languages
if(file_exists("view/local-$lang/hstrings.php")) {
include("view/local-$lang/hstrings.php");
}
elseif(file_exists("view/local-$lang/strings.php")) {
if(file_exists("view/local-$lang/strings.php")) {
include("view/local-$lang/strings.php");
}
}
@ -362,13 +353,13 @@ function get_language_name($s, $l = null) {
function language_list() {
$langs = glob('view/*/hstrings.php');
$langs = glob('view/*/strings.php');
$lang_options = array();
$selected = "";
if(is_array($langs) && count($langs)) {
if(! in_array('view/en/hstrings.php',$langs))
if(! in_array('view/en/strings.php',$langs))
$langs[] = 'view/en/';
asort($langs);
foreach($langs as $l) {
@ -382,14 +373,14 @@ function language_list() {
function lang_selector() {
$langs = glob('view/*/hstrings.php');
$langs = glob('view/*/strings.php');
$lang_options = array();
$selected = "";
if(is_array($langs) && count($langs)) {
$langs[] = '';
if(! in_array('view/en/hstrings.php',$langs))
if(! in_array('view/en/strings.php',$langs))
$langs[] = 'view/en/';
asort($langs);
foreach($langs as $l) {

View file

@ -258,7 +258,7 @@ function oembed_fetch_url($embedurl){
$j['html'] = purify_html($j['html'],$allow_position);
if($j['html'] != $orig) {
logger('oembed html was purified. original: ' . $orig . ' purified: ' . $j['html'], LOGGER_DEBUG, LOG_INFO);
// logger('oembed html was purified. original: ' . $orig . ' purified: ' . $j['html'], LOGGER_DEBUG, LOG_INFO);
}
$orig_len = mb_strlen(preg_replace('/\s+/','',$orig));

View file

@ -399,6 +399,8 @@ function photo_upload($channel, $observer, $args) {
$summary = (($args['body']) ? $args['body'] : '') . '[footer]' . $activity_format . '[/footer]';
// If uploaded into a post, this is the text that is returned to the webapp for inclusion in the post.
$obj_body = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']'
. $tag . z_root() . "/photo/{$photo_hash}-{$scale}." . $ph->getExt() . '[/zmg]'
. '[/zrl]';
@ -413,8 +415,8 @@ function photo_upload($channel, $observer, $args) {
// This is a placeholder and will get over-ridden by the item mid, which is critical for sharing as a conversational item over activitypub
'id' => z_root() . '/photo/' . $photo_hash,
'url' => $url,
'source' => [ 'content' => $obj_body, 'mediaType' => 'text/bbcode' ],
'content' => bbcode($obj_body)
'source' => [ 'content' => $summary, 'mediaType' => 'text/bbcode' ],
'content' => bbcode($summary)
];
// @FIXME - update to collection

View file

@ -376,7 +376,7 @@ function pub_tagadelic($net,$site,$limit,$recent,$safemode,$type) {
}
function dir_tagadelic($count = 0, $hub = '', $type = 0) {
function dir_tagadelic($count = 0, $hub = '', $type = 0, $safe = '') {
$count = intval($count);
@ -397,8 +397,8 @@ function dir_tagadelic($count = 0, $hub = '', $type = 0) {
);
}
else {
$r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0
$sql_extra
$r = q("select xtag_term as term, count(xtag_term) as total from xtag left join xchan on xtag_hash = xchan_hash where xtag_flags = 0
$sql_extra $safe
group by xtag_term order by total desc %s",
((intval($count)) ? "limit $count" : '')
);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -8,12 +8,12 @@
}
if ($argc!=2) {
print "Usage: ".$argv[0]." <hstrings.php>\n\n";
print "Usage: ".$argv[0]." <strings.php>\n\n";
return;
}
$phpfile = $argv[1];
$pofile = dirname($phpfile)."/hmessages.po";
$pofile = dirname($phpfile)."/messages.po";
if (!file_exists($phpfile)){
print "Unable to find '$phpfile'\n";

View file

@ -10,7 +10,7 @@ function po2php_run($argc,$argv) {
$rtl = false;
$pofile = $argv[1];
$outfile = dirname($pofile)."/hstrings.php";
$outfile = dirname($pofile)."/strings.php";
if($argc > 2) {
if($argv[2] === 'rtl')
@ -82,7 +82,7 @@ function po2php_run($argc,$argv) {
}
if (!$arr) {
$arr=True;
$out .= "array(\n";
$out .= "[\n";
}
$match=Array();
preg_match("|\[([0-9]*)\] (.*)|", $l, $match);
@ -106,7 +106,7 @@ function po2php_run($argc,$argv) {
if (substr($l,0,6)=="msgid "){
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($k!="") $out .= $arr?");\n":";\n";
if ($k!="") $out .= $arr?"];\n":";\n";
$arr=False;
$k = str_replace("msgid ","",$l);
$k = trim_message($k);
@ -133,7 +133,7 @@ function po2php_run($argc,$argv) {
}
if ($inv) { $inv = False; $out .= '"'.$v.'"'; }
if ($k!="") $out .= $arr?");\n":";\n";
if ($k!="") $out .= $arr?"];\n":";\n";
file_put_contents($outfile, $out);

View file

@ -22,12 +22,12 @@ if [ $ADDONMODE ]
then
cd "$FULLPATH/../addon/$ADDONNAME"
mkdir -p "$FULLPATH/../addon/$ADDONNAME/lang/C"
OUTFILE="$FULLPATH/../addon/$ADDONNAME/lang/C/hmessages.po"
OUTFILE="$FULLPATH/../addon/$ADDONNAME/lang/C/messages.po"
FINDSTARTDIR="."
FINDOPTS=
else
cd "$FULLPATH/../view/en/"
OUTFILE="$FULLPATH/hmessages.po"
OUTFILE="$FULLPATH/messages.po"
FINDSTARTDIR="../../"
# skip addon folder
FINDOPTS=

File diff suppressed because it is too large Load diff

View file

@ -72,11 +72,11 @@
echo "String files\n";
echo 'util/hstrings.php' . "\n";
include_once('util/hstrings.php');
echo 'util/strings.php' . "\n";
include_once('util/strings.php');
echo count(App::$strings) . ' strings' . "\n";
$files = glob('view/*/hstrings.php');
$files = glob('view/*/strings.php');
foreach($files as $file) {
echo exec($cmd . $file) . "\n";

View file

@ -1,6 +1,6 @@
{
"name": "blueimp-file-upload",
"version": "9.30.0",
"version": "9.31.0",
"title": "jQuery File Upload",
"description": "File Upload widget with multiple file selection, drag&amp;drop support, progress bar, validation and preview images.",
"keywords": [

View file

@ -1,6 +1,6 @@
{
"name": "blueimp-file-upload",
"version": "9.30.0",
"version": "9.31.0",
"title": "jQuery File Upload",
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
"keywords": [

View file

@ -43,9 +43,9 @@ class UploadHandler
const IMAGETYPE_PNG = 3;
protected $image_objects = array();
protected $response = array();
public function __construct($options = null, $initialize = true, $error_messages = null) {
$this->response = array();
$this->options = array(
'script_url' => $this->get_full_url().'/'.$this->basename($this->get_server_var('SCRIPT_NAME')),
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
@ -75,12 +75,12 @@ class UploadHandler
),
// By default, allow redirects to the referer protocol+host:
'redirect_allow_target' => '/^'.preg_quote(
parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_SCHEME)
.'://'
.parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_HOST)
.'/', // Trailing slash to not match subdomains by mistake
'/' // preg_quote delimiter param
).'/',
parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_SCHEME)
.'://'
.parse_url($this->get_server_var('HTTP_REFERER'), PHP_URL_HOST)
.'/', // Trailing slash to not match subdomains by mistake
'/' // preg_quote delimiter param
).'/',
// Enable to provide file downloads via GET requests to the PHP script:
// 1. Set to 1 to download files via readfile method through PHP
// 2. Set to 2 to send a X-Sendfile header for lighttpd/Apache
@ -151,21 +151,21 @@ class UploadHandler
'identify_bin' => 'identify',
'image_versions' => array(
// The empty image version key defines options for the original image.
// Keep in mind: these image manipulations are inherited by all other image versions from this point onwards.
// Keep in mind: these image manipulations are inherited by all other image versions from this point onwards.
// Also note that the property 'no_cache' is not inherited, since it's not a manipulation.
'' => array(
// Automatically rotate images based on EXIF meta data:
'auto_orient' => true
),
// You can add arrays to generate different versions.
// The name of the key is the name of the version (example: 'medium').
// The name of the key is the name of the version (example: 'medium').
// the array contains the options to apply.
/*
'medium' => array(
'max_width' => 800,
'max_height' => 600
),
*/
*/
'thumbnail' => array(
// Uncomment the following to use a defined directory for the thumbnails
// instead of a subdirectory based on the version identifier.
@ -223,13 +223,13 @@ class UploadHandler
protected function get_full_url() {
$https = !empty($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'], 'on') === 0 ||
!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) &&
strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0;
strcasecmp($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') === 0;
return
($https ? 'https://' : 'http://').
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
($https && $_SERVER['SERVER_PORT'] === 443 ||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
($https && $_SERVER['SERVER_PORT'] === 443 ||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
}
@ -377,7 +377,11 @@ class UploadHandler
public function get_config_bytes($val) {
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
$val = (int)$val;
if (is_numeric($val)) {
$val = (int)$val;
} else {
$val = (int)substr($val, 0, -1);
}
switch ($last) {
case 'g':
$val *= 1024;
@ -414,7 +418,7 @@ class UploadHandler
if ($this->options['max_file_size'] && (
$file_size > $this->options['max_file_size'] ||
$file->size > $this->options['max_file_size'])
) {
) {
$file->error = $this->get_error_message('max_file_size');
return false;
}
@ -424,9 +428,9 @@ class UploadHandler
return false;
}
if (is_int($this->options['max_number_of_files']) &&
($this->count_file_objects() >= $this->options['max_number_of_files']) &&
// Ignore additional chunks of existing files:
!is_file($this->get_upload_path($file->name))) {
($this->count_file_objects() >= $this->options['max_number_of_files']) &&
// Ignore additional chunks of existing files:
!is_file($this->get_upload_path($file->name))) {
$file->error = $this->get_error_message('max_number_of_files');
return false;
}
@ -451,7 +455,7 @@ class UploadHandler
unset($tmp);
}
}
if (!empty($img_width)) {
if (!empty($img_width) && !empty($img_height)) {
if ($max_width && $img_width > $max_width) {
$file->error = $this->get_error_message('max_width');
return false;
@ -488,7 +492,7 @@ class UploadHandler
}
protected function get_unique_filename($file_path, $name, $size, $type, $error,
$index, $content_range) {
$index, $content_range) {
while(is_dir($this->get_upload_path($name))) {
$name = $this->upcount_name($name);
}
@ -505,10 +509,10 @@ class UploadHandler
}
protected function fix_file_extension($file_path, $name, $size, $type, $error,
$index, $content_range) {
$index, $content_range) {
// Add missing file extension for known image types:
if (strpos($name, '.') === false &&
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
$name .= '.'.$matches[1];
}
if ($this->options['correct_image_extensions']) {
@ -538,7 +542,7 @@ class UploadHandler
}
protected function trim_file_name($file_path, $name, $size, $type, $error,
$index, $content_range) {
$index, $content_range) {
// Remove path information and dots around the filename, to prevent uploading
// into different directories or replacing hidden system files.
// Also remove control characters and spaces (\x00..\x20) around the filename:
@ -561,7 +565,7 @@ class UploadHandler
}
protected function get_file_name($file_path, $name, $size, $type, $error,
$index, $content_range) {
$index, $content_range) {
$name = $this->trim_file_name($file_path, $name, $size, $type, $error,
$index, $content_range);
return $this->get_unique_filename(
@ -795,25 +799,26 @@ class UploadHandler
// Handle transparency in GIF and PNG images:
switch ($type) {
case 'gif':
imagecolortransparent($new_img, imagecolorallocate($new_img, 0, 0, 0));
break;
case 'png':
imagecolortransparent($new_img, imagecolorallocate($new_img, 0, 0, 0));
case 'png':
imagealphablending($new_img, false);
imagesavealpha($new_img, true);
break;
}
$success = imagecopyresampled(
$new_img,
$src_img,
$dst_x,
$dst_y,
0,
0,
$new_width,
$new_height,
$img_width,
$img_height
) && $write_func($new_img, $new_file_path, $image_quality);
$new_img,
$src_img,
$dst_x,
$dst_y,
0,
0,
$new_width,
$new_height,
$img_width,
$img_height
) && $write_func($new_img, $new_file_path, $image_quality);
$this->gd_set_image_object($file_path, $new_img);
return $success;
}
@ -827,7 +832,12 @@ class UploadHandler
$image->setResourceLimit($type, $limit);
}
}
$image->readImage($file_path);
try {
$image->readImage($file_path);
} catch (ImagickException $e) {
error_log($e->getMessage());
return null;
}
$this->image_objects[$file_path] = $image;
}
return $this->image_objects[$file_path];
@ -884,6 +894,7 @@ class UploadHandler
$file_path,
!empty($options['crop']) || !empty($options['no_cache'])
);
if (is_null($image)) return false;
if ($image->getImageFormat() === 'GIF') {
// Handle animated GIFs:
$images = $image->coalesceImages();
@ -896,32 +907,28 @@ class UploadHandler
$image_oriented = false;
if (!empty($options['auto_orient'])) {
$image_oriented = $this->imagick_orient_image($image);
}
$image_resize = false;
}
$image_resize = false;
$new_width = $max_width = $img_width = $image->getImageWidth();
$new_height = $max_height = $img_height = $image->getImageHeight();
$new_height = $max_height = $img_height = $image->getImageHeight();
// use isset(). User might be setting max_width = 0 (auto in regular resizing). Value 0 would be considered empty when you use empty()
if (isset($options['max_width'])) {
$image_resize = true;
$new_width = $max_width = $options['max_width'];
$image_resize = true;
$new_width = $max_width = $options['max_width'];
}
if (isset($options['max_height'])) {
$image_resize = true;
$new_height = $max_height = $options['max_height'];
}
$image_strip = (isset($options['strip']) ? $options['strip'] : false);
if ( !$image_oriented && ($max_width >= $img_width) && ($max_height >= $img_height) && !$image_strip && empty($options["jpeg_quality"]) ) {
if ( !$image_oriented && ($max_width >= $img_width) && ($max_height >= $img_height) && !$image_strip && empty($options["jpeg_quality"]) ) {
if ($file_path !== $new_file_path) {
return copy($file_path, $new_file_path);
}
return true;
}
$crop = (isset($options['crop']) ? $options['crop'] : false);
if ($crop) {
$x = 0;
$y = 0;
@ -1111,14 +1118,14 @@ class UploadHandler
}
if (count($failed_versions)) {
$file->error = $this->get_error_message('image_resize')
.' ('.implode($failed_versions, ', ').')';
.' ('.implode($failed_versions, ', ').')';
}
// Free memory:
$this->destroy_image_object($file_path);
}
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error,
$index = null, $content_range = null) {
$index = null, $content_range = null) {
$file = new \stdClass();
$file->name = $this->get_file_name($uploaded_file, $name, $size, $type, $error,
$index, $content_range);
@ -1319,8 +1326,7 @@ class UploadHandler
$json = json_encode($content);
$redirect = stripslashes($this->get_post_param('redirect'));
if ($redirect && preg_match($this->options['redirect_allow_target'], $redirect)) {
$this->header('Location: '.sprintf($redirect, rawurlencode($json)));
return;
return $this->header('Location: '.sprintf($redirect, rawurlencode($json)));
}
$this->head();
if ($this->get_server_var('HTTP_CONTENT_RANGE')) {
@ -1411,11 +1417,11 @@ class UploadHandler
$files[] = $this->handle_file_upload(
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
$file_name ? $file_name : (isset($upload['name']) ?
$upload['name'] : null),
$upload['name'] : null),
$size ? $size : (isset($upload['size']) ?
$upload['size'] : $this->get_server_var('CONTENT_LENGTH')),
$upload['size'] : $this->get_server_var('CONTENT_LENGTH')),
isset($upload['type']) ?
$upload['type'] : $this->get_server_var('CONTENT_TYPE'),
$upload['type'] : $this->get_server_var('CONTENT_TYPE'),
isset($upload['error']) ? $upload['error'] : null,
null,
$content_range

View file

@ -1062,6 +1062,7 @@ return array(
'Zotlabs\\Lib\\JSalmon' => $baseDir . '/Zotlabs/Lib/JSalmon.php',
'Zotlabs\\Lib\\Keyutils' => $baseDir . '/Zotlabs/Lib/Keyutils.php',
'Zotlabs\\Lib\\LDSignatures' => $baseDir . '/Zotlabs/Lib/LDSignatures.php',
'Zotlabs\\Lib\\Libprofile' => $baseDir . '/Zotlabs/Lib/Libprofile.php',
'Zotlabs\\Lib\\Libsync' => $baseDir . '/Zotlabs/Lib/Libsync.php',
'Zotlabs\\Lib\\Libzot' => $baseDir . '/Zotlabs/Lib/Libzot.php',
'Zotlabs\\Lib\\Libzotdir' => $baseDir . '/Zotlabs/Lib/Libzotdir.php',
@ -1077,7 +1078,6 @@ return array(
'Zotlabs\\Lib\\SuperCurl' => $baseDir . '/Zotlabs/Lib/SuperCurl.php',
'Zotlabs\\Lib\\System' => $baseDir . '/Zotlabs/Lib/System.php',
'Zotlabs\\Lib\\TableConverter' => $baseDir . '/Zotlabs/Lib/Markdown.php',
'Zotlabs\\Lib\\Techlevels' => $baseDir . '/Zotlabs/Lib/Techlevels.php',
'Zotlabs\\Lib\\ThreadItem' => $baseDir . '/Zotlabs/Lib/ThreadItem.php',
'Zotlabs\\Lib\\ThreadListener' => $baseDir . '/Zotlabs/Lib/ThreadListener.php',
'Zotlabs\\Lib\\ThreadStream' => $baseDir . '/Zotlabs/Lib/ThreadStream.php',
@ -1114,6 +1114,7 @@ return array(
'Zotlabs\\Module\\Block' => $baseDir . '/Zotlabs/Module/Block.php',
'Zotlabs\\Module\\Blocks' => $baseDir . '/Zotlabs/Module/Blocks.php',
'Zotlabs\\Module\\Cal' => $baseDir . '/Zotlabs/Module/Cal.php',
'Zotlabs\\Module\\Calendar' => $baseDir . '/Zotlabs/Module/Calendar.php',
'Zotlabs\\Module\\Card_edit' => $baseDir . '/Zotlabs/Module/Card_edit.php',
'Zotlabs\\Module\\Cards' => $baseDir . '/Zotlabs/Module/Cards.php',
'Zotlabs\\Module\\Categories' => $baseDir . '/Zotlabs/Module/Categories.php',
@ -1134,6 +1135,7 @@ return array(
'Zotlabs\\Module\\Cover_photo' => $baseDir . '/Zotlabs/Module/Cover_photo.php',
'Zotlabs\\Module\\Dav' => $baseDir . '/Zotlabs/Module/Dav.php',
'Zotlabs\\Module\\Defperms' => $baseDir . '/Zotlabs/Module/Defperms.php',
'Zotlabs\\Module\\Dircensor' => $baseDir . '/Zotlabs/Module/Dircensor.php',
'Zotlabs\\Module\\Directory' => $baseDir . '/Zotlabs/Module/Directory.php',
'Zotlabs\\Module\\Dirsearch' => $baseDir . '/Zotlabs/Module/Dirsearch.php',
'Zotlabs\\Module\\Display' => $baseDir . '/Zotlabs/Module/Display.php',
@ -1157,8 +1159,6 @@ return array(
'Zotlabs\\Module\\Filestorage' => $baseDir . '/Zotlabs/Module/Filestorage.php',
'Zotlabs\\Module\\Finger' => $baseDir . '/Zotlabs/Module/Finger.php',
'Zotlabs\\Module\\Follow' => $baseDir . '/Zotlabs/Module/Follow.php',
'Zotlabs\\Module\\Followers' => $baseDir . '/Zotlabs/Module/Followers.php',
'Zotlabs\\Module\\Following' => $baseDir . '/Zotlabs/Module/Following.php',
'Zotlabs\\Module\\Getfile' => $baseDir . '/Zotlabs/Module/Getfile.php',
'Zotlabs\\Module\\Hashtags' => $baseDir . '/Zotlabs/Module/Hashtags.php',
'Zotlabs\\Module\\Hcard' => $baseDir . '/Zotlabs/Module/Hcard.php',
@ -1170,6 +1170,7 @@ return array(
'Zotlabs\\Module\\Impel' => $baseDir . '/Zotlabs/Module/Impel.php',
'Zotlabs\\Module\\Import' => $baseDir . '/Zotlabs/Module/Import.php',
'Zotlabs\\Module\\Import_items' => $baseDir . '/Zotlabs/Module/Import_items.php',
'Zotlabs\\Module\\Inspect' => $baseDir . '/Zotlabs/Module/Inspect.php',
'Zotlabs\\Module\\Invite' => $baseDir . '/Zotlabs/Module/Invite.php',
'Zotlabs\\Module\\Item' => $baseDir . '/Zotlabs/Module/Item.php',
'Zotlabs\\Module\\Lang' => $baseDir . '/Zotlabs/Module/Lang.php',
@ -1190,7 +1191,7 @@ return array(
'Zotlabs\\Module\\Mood' => $baseDir . '/Zotlabs/Module/Mood.php',
'Zotlabs\\Module\\Network' => $baseDir . '/Zotlabs/Module/Network.php',
'Zotlabs\\Module\\New_channel' => $baseDir . '/Zotlabs/Module/New_channel.php',
'Zotlabs\\Module\\Nojs' => $baseDir . '/Zotlabs/Module/Nojs.php',
'Zotlabs\\Module\\Nocomment' => $baseDir . '/Zotlabs/Module/Nocomment.php',
'Zotlabs\\Module\\Notes' => $baseDir . '/Zotlabs/Module/Notes.php',
'Zotlabs\\Module\\Notifications' => $baseDir . '/Zotlabs/Module/Notifications.php',
'Zotlabs\\Module\\Notify' => $baseDir . '/Zotlabs/Module/Notify.php',
@ -1200,6 +1201,7 @@ return array(
'Zotlabs\\Module\\Oep' => $baseDir . '/Zotlabs/Module/Oep.php',
'Zotlabs\\Module\\Oexchange' => $baseDir . '/Zotlabs/Module/Oexchange.php',
'Zotlabs\\Module\\Online' => $baseDir . '/Zotlabs/Module/Online.php',
'Zotlabs\\Module\\Outbox' => $baseDir . '/Zotlabs/Module/Outbox.php',
'Zotlabs\\Module\\Owa' => $baseDir . '/Zotlabs/Module/Owa.php',
'Zotlabs\\Module\\Page' => $baseDir . '/Zotlabs/Module/Page.php',
'Zotlabs\\Module\\Pconfig' => $baseDir . '/Zotlabs/Module/Pconfig.php',
@ -1210,6 +1212,7 @@ return array(
'Zotlabs\\Module\\Ping' => $baseDir . '/Zotlabs/Module/Ping.php',
'Zotlabs\\Module\\Poco' => $baseDir . '/Zotlabs/Module/Poco.php',
'Zotlabs\\Module\\Poke' => $baseDir . '/Zotlabs/Module/Poke.php',
'Zotlabs\\Module\\Poster' => $baseDir . '/Zotlabs/Module/Poster.php',
'Zotlabs\\Module\\Pretheme' => $baseDir . '/Zotlabs/Module/Pretheme.php',
'Zotlabs\\Module\\Profile' => $baseDir . '/Zotlabs/Module/Profile.php',
'Zotlabs\\Module\\Profile_photo' => $baseDir . '/Zotlabs/Module/Profile_photo.php',
@ -1252,7 +1255,7 @@ return array(
'Zotlabs\\Module\\Sslify' => $baseDir . '/Zotlabs/Module/Sslify.php',
'Zotlabs\\Module\\Starred' => $baseDir . '/Zotlabs/Module/Starred.php',
'Zotlabs\\Module\\Subthread' => $baseDir . '/Zotlabs/Module/Subthread.php',
'Zotlabs\\Module\\Suggest' => $baseDir . '/Zotlabs/Module/Suggest.php',
'Zotlabs\\Module\\Suggestions' => $baseDir . '/Zotlabs/Module/Suggestions.php',
'Zotlabs\\Module\\Tagger' => $baseDir . '/Zotlabs/Module/Tagger.php',
'Zotlabs\\Module\\Tagrm' => $baseDir . '/Zotlabs/Module/Tagrm.php',
'Zotlabs\\Module\\Tasks' => $baseDir . '/Zotlabs/Module/Tasks.php',
@ -1277,6 +1280,9 @@ return array(
'Zotlabs\\Module\\Zot_probe' => $baseDir . '/Zotlabs/Module/Zot_probe.php',
'Zotlabs\\Module\\Zotfeed' => $baseDir . '/Zotlabs/Module/Zotfeed.php',
'Zotlabs\\Module\\Zotfinger' => $baseDir . '/Zotlabs/Module/Zotfinger.php',
'Zotlabs\\Photo\\PhotoDriver' => $baseDir . '/Zotlabs/Photo/PhotoDriver.php',
'Zotlabs\\Photo\\PhotoGd' => $baseDir . '/Zotlabs/Photo/PhotoGd.php',
'Zotlabs\\Photo\\PhotoImagick' => $baseDir . '/Zotlabs/Photo/PhotoImagick.php',
'Zotlabs\\Render\\Comanche' => $baseDir . '/Zotlabs/Render/Comanche.php',
'Zotlabs\\Render\\SimpleTemplate' => $baseDir . '/Zotlabs/Render/SimpleTemplate.php',
'Zotlabs\\Render\\SmartyInterface' => $baseDir . '/Zotlabs/Render/SmartyInterface.php',
@ -1528,7 +1534,7 @@ return array(
'Zotlabs\\Update\\_1229' => $baseDir . '/Zotlabs/Update/_1229.php',
'Zotlabs\\Update\\_1230' => $baseDir . '/Zotlabs/Update/_1230.php',
'Zotlabs\\Update\\_1231' => $baseDir . '/Zotlabs/Update/_1231.php',
'Zotlabs\\Web\\CheckJS' => $baseDir . '/Zotlabs/Web/CheckJS.php',
'Zotlabs\\Update\\_1232' => $baseDir . '/Zotlabs/Update/_1232.php',
'Zotlabs\\Web\\Controller' => $baseDir . '/Zotlabs/Web/Controller.php',
'Zotlabs\\Web\\HTTPHeaders' => $baseDir . '/Zotlabs/Web/HTTPHeaders.php',
'Zotlabs\\Web\\HTTPSig' => $baseDir . '/Zotlabs/Web/HTTPSig.php',

View file

@ -1281,6 +1281,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Lib\\JSalmon' => __DIR__ . '/../..' . '/Zotlabs/Lib/JSalmon.php',
'Zotlabs\\Lib\\Keyutils' => __DIR__ . '/../..' . '/Zotlabs/Lib/Keyutils.php',
'Zotlabs\\Lib\\LDSignatures' => __DIR__ . '/../..' . '/Zotlabs/Lib/LDSignatures.php',
'Zotlabs\\Lib\\Libprofile' => __DIR__ . '/../..' . '/Zotlabs/Lib/Libprofile.php',
'Zotlabs\\Lib\\Libsync' => __DIR__ . '/../..' . '/Zotlabs/Lib/Libsync.php',
'Zotlabs\\Lib\\Libzot' => __DIR__ . '/../..' . '/Zotlabs/Lib/Libzot.php',
'Zotlabs\\Lib\\Libzotdir' => __DIR__ . '/../..' . '/Zotlabs/Lib/Libzotdir.php',
@ -1296,7 +1297,6 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Lib\\SuperCurl' => __DIR__ . '/../..' . '/Zotlabs/Lib/SuperCurl.php',
'Zotlabs\\Lib\\System' => __DIR__ . '/../..' . '/Zotlabs/Lib/System.php',
'Zotlabs\\Lib\\TableConverter' => __DIR__ . '/../..' . '/Zotlabs/Lib/Markdown.php',
'Zotlabs\\Lib\\Techlevels' => __DIR__ . '/../..' . '/Zotlabs/Lib/Techlevels.php',
'Zotlabs\\Lib\\ThreadItem' => __DIR__ . '/../..' . '/Zotlabs/Lib/ThreadItem.php',
'Zotlabs\\Lib\\ThreadListener' => __DIR__ . '/../..' . '/Zotlabs/Lib/ThreadListener.php',
'Zotlabs\\Lib\\ThreadStream' => __DIR__ . '/../..' . '/Zotlabs/Lib/ThreadStream.php',
@ -1333,6 +1333,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Block' => __DIR__ . '/../..' . '/Zotlabs/Module/Block.php',
'Zotlabs\\Module\\Blocks' => __DIR__ . '/../..' . '/Zotlabs/Module/Blocks.php',
'Zotlabs\\Module\\Cal' => __DIR__ . '/../..' . '/Zotlabs/Module/Cal.php',
'Zotlabs\\Module\\Calendar' => __DIR__ . '/../..' . '/Zotlabs/Module/Calendar.php',
'Zotlabs\\Module\\Card_edit' => __DIR__ . '/../..' . '/Zotlabs/Module/Card_edit.php',
'Zotlabs\\Module\\Cards' => __DIR__ . '/../..' . '/Zotlabs/Module/Cards.php',
'Zotlabs\\Module\\Categories' => __DIR__ . '/../..' . '/Zotlabs/Module/Categories.php',
@ -1353,6 +1354,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Cover_photo' => __DIR__ . '/../..' . '/Zotlabs/Module/Cover_photo.php',
'Zotlabs\\Module\\Dav' => __DIR__ . '/../..' . '/Zotlabs/Module/Dav.php',
'Zotlabs\\Module\\Defperms' => __DIR__ . '/../..' . '/Zotlabs/Module/Defperms.php',
'Zotlabs\\Module\\Dircensor' => __DIR__ . '/../..' . '/Zotlabs/Module/Dircensor.php',
'Zotlabs\\Module\\Directory' => __DIR__ . '/../..' . '/Zotlabs/Module/Directory.php',
'Zotlabs\\Module\\Dirsearch' => __DIR__ . '/../..' . '/Zotlabs/Module/Dirsearch.php',
'Zotlabs\\Module\\Display' => __DIR__ . '/../..' . '/Zotlabs/Module/Display.php',
@ -1376,8 +1378,6 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Filestorage' => __DIR__ . '/../..' . '/Zotlabs/Module/Filestorage.php',
'Zotlabs\\Module\\Finger' => __DIR__ . '/../..' . '/Zotlabs/Module/Finger.php',
'Zotlabs\\Module\\Follow' => __DIR__ . '/../..' . '/Zotlabs/Module/Follow.php',
'Zotlabs\\Module\\Followers' => __DIR__ . '/../..' . '/Zotlabs/Module/Followers.php',
'Zotlabs\\Module\\Following' => __DIR__ . '/../..' . '/Zotlabs/Module/Following.php',
'Zotlabs\\Module\\Getfile' => __DIR__ . '/../..' . '/Zotlabs/Module/Getfile.php',
'Zotlabs\\Module\\Hashtags' => __DIR__ . '/../..' . '/Zotlabs/Module/Hashtags.php',
'Zotlabs\\Module\\Hcard' => __DIR__ . '/../..' . '/Zotlabs/Module/Hcard.php',
@ -1389,6 +1389,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Impel' => __DIR__ . '/../..' . '/Zotlabs/Module/Impel.php',
'Zotlabs\\Module\\Import' => __DIR__ . '/../..' . '/Zotlabs/Module/Import.php',
'Zotlabs\\Module\\Import_items' => __DIR__ . '/../..' . '/Zotlabs/Module/Import_items.php',
'Zotlabs\\Module\\Inspect' => __DIR__ . '/../..' . '/Zotlabs/Module/Inspect.php',
'Zotlabs\\Module\\Invite' => __DIR__ . '/../..' . '/Zotlabs/Module/Invite.php',
'Zotlabs\\Module\\Item' => __DIR__ . '/../..' . '/Zotlabs/Module/Item.php',
'Zotlabs\\Module\\Lang' => __DIR__ . '/../..' . '/Zotlabs/Module/Lang.php',
@ -1409,7 +1410,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Mood' => __DIR__ . '/../..' . '/Zotlabs/Module/Mood.php',
'Zotlabs\\Module\\Network' => __DIR__ . '/../..' . '/Zotlabs/Module/Network.php',
'Zotlabs\\Module\\New_channel' => __DIR__ . '/../..' . '/Zotlabs/Module/New_channel.php',
'Zotlabs\\Module\\Nojs' => __DIR__ . '/../..' . '/Zotlabs/Module/Nojs.php',
'Zotlabs\\Module\\Nocomment' => __DIR__ . '/../..' . '/Zotlabs/Module/Nocomment.php',
'Zotlabs\\Module\\Notes' => __DIR__ . '/../..' . '/Zotlabs/Module/Notes.php',
'Zotlabs\\Module\\Notifications' => __DIR__ . '/../..' . '/Zotlabs/Module/Notifications.php',
'Zotlabs\\Module\\Notify' => __DIR__ . '/../..' . '/Zotlabs/Module/Notify.php',
@ -1419,6 +1420,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Oep' => __DIR__ . '/../..' . '/Zotlabs/Module/Oep.php',
'Zotlabs\\Module\\Oexchange' => __DIR__ . '/../..' . '/Zotlabs/Module/Oexchange.php',
'Zotlabs\\Module\\Online' => __DIR__ . '/../..' . '/Zotlabs/Module/Online.php',
'Zotlabs\\Module\\Outbox' => __DIR__ . '/../..' . '/Zotlabs/Module/Outbox.php',
'Zotlabs\\Module\\Owa' => __DIR__ . '/../..' . '/Zotlabs/Module/Owa.php',
'Zotlabs\\Module\\Page' => __DIR__ . '/../..' . '/Zotlabs/Module/Page.php',
'Zotlabs\\Module\\Pconfig' => __DIR__ . '/../..' . '/Zotlabs/Module/Pconfig.php',
@ -1429,6 +1431,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Ping' => __DIR__ . '/../..' . '/Zotlabs/Module/Ping.php',
'Zotlabs\\Module\\Poco' => __DIR__ . '/../..' . '/Zotlabs/Module/Poco.php',
'Zotlabs\\Module\\Poke' => __DIR__ . '/../..' . '/Zotlabs/Module/Poke.php',
'Zotlabs\\Module\\Poster' => __DIR__ . '/../..' . '/Zotlabs/Module/Poster.php',
'Zotlabs\\Module\\Pretheme' => __DIR__ . '/../..' . '/Zotlabs/Module/Pretheme.php',
'Zotlabs\\Module\\Profile' => __DIR__ . '/../..' . '/Zotlabs/Module/Profile.php',
'Zotlabs\\Module\\Profile_photo' => __DIR__ . '/../..' . '/Zotlabs/Module/Profile_photo.php',
@ -1471,7 +1474,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Sslify' => __DIR__ . '/../..' . '/Zotlabs/Module/Sslify.php',
'Zotlabs\\Module\\Starred' => __DIR__ . '/../..' . '/Zotlabs/Module/Starred.php',
'Zotlabs\\Module\\Subthread' => __DIR__ . '/../..' . '/Zotlabs/Module/Subthread.php',
'Zotlabs\\Module\\Suggest' => __DIR__ . '/../..' . '/Zotlabs/Module/Suggest.php',
'Zotlabs\\Module\\Suggestions' => __DIR__ . '/../..' . '/Zotlabs/Module/Suggestions.php',
'Zotlabs\\Module\\Tagger' => __DIR__ . '/../..' . '/Zotlabs/Module/Tagger.php',
'Zotlabs\\Module\\Tagrm' => __DIR__ . '/../..' . '/Zotlabs/Module/Tagrm.php',
'Zotlabs\\Module\\Tasks' => __DIR__ . '/../..' . '/Zotlabs/Module/Tasks.php',
@ -1496,6 +1499,9 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Zot_probe' => __DIR__ . '/../..' . '/Zotlabs/Module/Zot_probe.php',
'Zotlabs\\Module\\Zotfeed' => __DIR__ . '/../..' . '/Zotlabs/Module/Zotfeed.php',
'Zotlabs\\Module\\Zotfinger' => __DIR__ . '/../..' . '/Zotlabs/Module/Zotfinger.php',
'Zotlabs\\Photo\\PhotoDriver' => __DIR__ . '/../..' . '/Zotlabs/Photo/PhotoDriver.php',
'Zotlabs\\Photo\\PhotoGd' => __DIR__ . '/../..' . '/Zotlabs/Photo/PhotoGd.php',
'Zotlabs\\Photo\\PhotoImagick' => __DIR__ . '/../..' . '/Zotlabs/Photo/PhotoImagick.php',
'Zotlabs\\Render\\Comanche' => __DIR__ . '/../..' . '/Zotlabs/Render/Comanche.php',
'Zotlabs\\Render\\SimpleTemplate' => __DIR__ . '/../..' . '/Zotlabs/Render/SimpleTemplate.php',
'Zotlabs\\Render\\SmartyInterface' => __DIR__ . '/../..' . '/Zotlabs/Render/SmartyInterface.php',
@ -1747,7 +1753,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Update\\_1229' => __DIR__ . '/../..' . '/Zotlabs/Update/_1229.php',
'Zotlabs\\Update\\_1230' => __DIR__ . '/../..' . '/Zotlabs/Update/_1230.php',
'Zotlabs\\Update\\_1231' => __DIR__ . '/../..' . '/Zotlabs/Update/_1231.php',
'Zotlabs\\Web\\CheckJS' => __DIR__ . '/../..' . '/Zotlabs/Web/CheckJS.php',
'Zotlabs\\Update\\_1232' => __DIR__ . '/../..' . '/Zotlabs/Update/_1232.php',
'Zotlabs\\Web\\Controller' => __DIR__ . '/../..' . '/Zotlabs/Web/Controller.php',
'Zotlabs\\Web\\HTTPHeaders' => __DIR__ . '/../..' . '/Zotlabs/Web/HTTPHeaders.php',
'Zotlabs\\Web\\HTTPSig' => __DIR__ . '/../..' . '/Zotlabs/Web/HTTPSig.php',

View file

@ -1,20 +1,20 @@
[
{
"name": "blueimp/jquery-file-upload",
"version": "v9.30.0",
"version_normalized": "9.30.0.0",
"version": "v9.31.0",
"version_normalized": "9.31.0.0",
"source": {
"type": "git",
"url": "https://github.com/vkhramtsov/jQuery-File-Upload.git",
"reference": "1fceec556879403e5c1ae32a7c448aa12b8c3558"
"reference": "2485bf016e1085f0cd8308723064458cb0af5729"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vkhramtsov/jQuery-File-Upload/zipball/1fceec556879403e5c1ae32a7c448aa12b8c3558",
"reference": "1fceec556879403e5c1ae32a7c448aa12b8c3558",
"url": "https://api.github.com/repos/vkhramtsov/jQuery-File-Upload/zipball/2485bf016e1085f0cd8308723064458cb0af5729",
"reference": "2485bf016e1085f0cd8308723064458cb0af5729",
"shasum": ""
},
"time": "2019-04-22T09:21:57+00:00",
"time": "2019-05-24T07:59:46+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -164,17 +164,17 @@
},
{
"name": "doctrine/collections",
"version": "v1.6.1",
"version_normalized": "1.6.1.0",
"version": "v1.6.2",
"version_normalized": "1.6.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
"reference": "d2ae4ef05e25197343b6a39bae1d3c427a2f6956"
"reference": "c5e0bc17b1620e97c968ac409acbff28b8b850be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/collections/zipball/d2ae4ef05e25197343b6a39bae1d3c427a2f6956",
"reference": "d2ae4ef05e25197343b6a39bae1d3c427a2f6956",
"url": "https://api.github.com/repos/doctrine/collections/zipball/c5e0bc17b1620e97c968ac409acbff28b8b850be",
"reference": "c5e0bc17b1620e97c968ac409acbff28b8b850be",
"shasum": ""
},
"require": {
@ -186,7 +186,7 @@
"phpunit/phpunit": "^7.0",
"vimeo/psalm": "^3.2.2"
},
"time": "2019-03-25T19:03:48+00:00",
"time": "2019-06-09T13:48:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
@ -1623,27 +1623,27 @@
},
{
"name": "symfony/options-resolver",
"version": "v4.2.8",
"version_normalized": "4.2.8.0",
"version": "v4.3.1",
"version_normalized": "4.3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
"reference": "fd4a5f27b7cd085b489247b9890ebca9f3e10044"
"reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/fd4a5f27b7cd085b489247b9890ebca9f3e10044",
"reference": "fd4a5f27b7cd085b489247b9890ebca9f3e10044",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/914e0edcb7cd0c9f494bc023b1d47534f4542332",
"reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332",
"shasum": ""
},
"require": {
"php": "^7.1.3"
},
"time": "2019-04-10T16:20:36+00:00",
"time": "2019-05-10T05:38:46+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
"dev-master": "4.3-dev"
}
},
"installation-source": "dist",
@ -1739,27 +1739,27 @@
},
{
"name": "symfony/process",
"version": "v4.2.8",
"version_normalized": "4.2.8.0",
"version": "v4.3.1",
"version_normalized": "4.3.1.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "8cf39fb4ccff793340c258ee7760fd40bfe745fe"
"reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/8cf39fb4ccff793340c258ee7760fd40bfe745fe",
"reference": "8cf39fb4ccff793340c258ee7760fd40bfe745fe",
"url": "https://api.github.com/repos/symfony/process/zipball/856d35814cf287480465bb7a6c413bb7f5f5e69c",
"reference": "856d35814cf287480465bb7a6c413bb7f5f5e69c",
"shasum": ""
},
"require": {
"php": "^7.1.3"
},
"time": "2019-04-10T16:20:36+00:00",
"time": "2019-05-30T16:10:05+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
"dev-master": "4.3-dev"
}
},
"installation-source": "dist",

View file

@ -86,7 +86,7 @@ class ArrayCollection implements Collection, Selectable
* @return static
*
* @psalm-param array<TKey,T> $elements
* @psalm-return ArrayCollection<TKey,T>
* @psalm-return static<TKey,T>
*/
protected function createFrom(array $elements)
{
@ -323,7 +323,7 @@ class ArrayCollection implements Collection, Selectable
*
* @return static
*
* @psalm-return ArrayCollection<TKey,T>
* @psalm-return static<TKey,T>
*/
public function filter(Closure $p)
{

View file

@ -1,6 +1,11 @@
CHANGELOG
=========
4.3.0
-----
* added `OptionsResolver::addNormalizer` method
4.2.0
-----

View file

@ -84,6 +84,14 @@ class OptionsResolverIntrospector
* @throws NoConfigurationException on no configured normalizer
*/
public function getNormalizer(string $option): \Closure
{
return current($this->getNormalizers($option));
}
/**
* @throws NoConfigurationException when no normalizer is configured
*/
public function getNormalizers(string $option): array
{
return ($this->get)('normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
}

View file

@ -57,7 +57,7 @@ class OptionsResolver implements Options
/**
* A list of normalizer closures.
*
* @var \Closure[]
* @var \Closure[][]
*/
private $normalizers = [];
@ -484,7 +484,56 @@ class OptionsResolver implements Options
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
}
$this->normalizers[$option] = $normalizer;
$this->normalizers[$option] = [$normalizer];
// Make sure the option is processed
unset($this->resolved[$option]);
return $this;
}
/**
* Adds a normalizer for an option.
*
* The normalizer should be a closure with the following signature:
*
* function (Options $options, $value): mixed {
* // ...
* }
*
* The closure is invoked when {@link resolve()} is called. The closure
* has access to the resolved values of other options through the passed
* {@link Options} instance.
*
* The second parameter passed to the closure is the value of
* the option.
*
* The resolved option value is set to the return value of the closure.
*
* @param string $option The option name
* @param \Closure $normalizer The normalizer
* @param bool $forcePrepend If set to true, prepend instead of appending
*
* @return $this
*
* @throws UndefinedOptionsException If the option is undefined
* @throws AccessException If called from a lazy option or normalizer
*/
public function addNormalizer(string $option, \Closure $normalizer, bool $forcePrepend = false): self
{
if ($this->locked) {
throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
}
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined))));
}
if ($forcePrepend) {
array_unshift($this->normalizers[$option], $normalizer);
} else {
$this->normalizers[$option][] = $normalizer;
}
// Make sure the option is processed
unset($this->resolved[$option]);
@ -966,15 +1015,15 @@ class OptionsResolver implements Options
throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling))));
}
$normalizer = $this->normalizers[$option];
// The following section must be protected from cyclic
// calls. Set $calling for the current $option to detect a cyclic
// dependency
// BEGIN
$this->calling[$option] = true;
try {
$value = $normalizer($this, $value);
foreach ($this->normalizers[$option] as $normalizer) {
$value = $normalizer($this, $value);
}
} finally {
unset($this->calling[$option]);
}

View file

@ -201,6 +201,42 @@ class OptionsResolverIntrospectorTest extends TestCase
$this->assertSame('bar', $debug->getNormalizer('foo'));
}
public function testGetNormalizers()
{
$resolver = new OptionsResolver();
$resolver->setDefined('foo');
$resolver->addNormalizer('foo', $normalizer1 = function () {});
$resolver->addNormalizer('foo', $normalizer2 = function () {});
$debug = new OptionsResolverIntrospector($resolver);
$this->assertSame([$normalizer1, $normalizer2], $debug->getNormalizers('foo'));
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\NoConfigurationException
* @expectedExceptionMessage No normalizer was set for the "foo" option.
*/
public function testGetNormalizersThrowsOnNoConfiguredValue()
{
$resolver = new OptionsResolver();
$resolver->setDefined('foo');
$debug = new OptionsResolverIntrospector($resolver);
$debug->getNormalizers('foo');
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
* @expectedExceptionMessage The option "foo" does not exist.
*/
public function testGetNormalizersThrowsOnNotDefinedOption()
{
$resolver = new OptionsResolver();
$debug = new OptionsResolverIntrospector($resolver);
$debug->getNormalizers('foo');
}
public function testGetDeprecationMessage()
{
$resolver = new OptionsResolver();

View file

@ -751,7 +751,7 @@ class OptionsResolverTest extends TestCase
0,
];
yield 'It explicitly ignores a depreciation' => [
yield 'It explicitly ignores a deprecation' => [
function (OptionsResolver $resolver) {
$resolver
->setDefault('baz', function (Options $options) {
@ -1552,6 +1552,63 @@ class OptionsResolverTest extends TestCase
$this->assertEmpty($this->resolver->resolve());
}
public function testAddNormalizerReturnsThis()
{
$this->resolver->setDefault('foo', 'bar');
$this->assertSame($this->resolver, $this->resolver->addNormalizer('foo', function () {}));
}
public function testAddNormalizerClosure()
{
// defined by superclass
$this->resolver->setDefault('foo', 'bar');
$this->resolver->setNormalizer('foo', function (Options $options, $value) {
return '1st-normalized-'.$value;
});
// defined by subclass
$this->resolver->addNormalizer('foo', function (Options $options, $value) {
return '2nd-normalized-'.$value;
});
$this->assertEquals(['foo' => '2nd-normalized-1st-normalized-bar'], $this->resolver->resolve());
}
public function testForcePrependNormalizerClosure()
{
// defined by superclass
$this->resolver->setDefault('foo', 'bar');
$this->resolver->setNormalizer('foo', function (Options $options, $value) {
return '2nd-normalized-'.$value;
});
// defined by subclass
$this->resolver->addNormalizer('foo', function (Options $options, $value) {
return '1st-normalized-'.$value;
}, true);
$this->assertEquals(['foo' => '2nd-normalized-1st-normalized-bar'], $this->resolver->resolve());
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
*/
public function testAddNormalizerFailsIfUnknownOption()
{
$this->resolver->addNormalizer('foo', function () {});
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\AccessException
*/
public function testFailIfAddNormalizerFromLazyOption()
{
$this->resolver->setDefault('foo', function (Options $options) {
$options->addNormalizer('foo', function () {});
});
$this->resolver->resolve();
}
public function testSetDefaultsReturnsThis()
{
$this->assertSame($this->resolver, $this->resolver->setDefaults(['foo', 'bar']));

View file

@ -27,7 +27,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
"dev-master": "4.3-dev"
}
}
}

View file

@ -331,7 +331,7 @@ class Process implements \IteratorAggregate
}
if (!is_dir($this->cwd)) {
throw new RuntimeException('The provided cwd does not exist.');
throw new RuntimeException(sprintf('The provided cwd "%s" does not exist.', $this->cwd));
}
$this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $options);
@ -419,6 +419,7 @@ class Process implements \IteratorAggregate
} while ($running);
while ($this->isRunning()) {
$this->checkTimeout();
usleep(1000);
}

View file

@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Process\Tests;
use Symfony\Component\Process\Exception\ProcessTimedOutException;
use Symfony\Component\Process\Process;
require \dirname(__DIR__).'/vendor/autoload.php';
list('e' => $php) = getopt('e:') + ['e' => 'php'];
try {
$process = new Process("exec $php -r \"echo 'ready'; trigger_error('error', E_USER_ERROR);\"");
$process->start();
$process->setTimeout(0.5);
while (false === strpos($process->getOutput(), 'ready')) {
usleep(1000);
}
$process->signal(SIGSTOP);
$process->wait();
return $process->getExitCode();
} catch (ProcessTimedOutException $t) {
echo $t->getMessage().PHP_EOL;
return 1;
}

View file

@ -27,7 +27,7 @@ class ProcessFailedExceptionTest extends TestCase
$process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful'])->setConstructorArgs([['php']])->getMock();
$process->expects($this->once())
->method('isSuccessful')
->will($this->returnValue(true));
->willReturn(true);
if (method_exists($this, 'expectException')) {
$this->expectException(\InvalidArgumentException::class);
@ -55,31 +55,31 @@ class ProcessFailedExceptionTest extends TestCase
$process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'])->setConstructorArgs([[$cmd]])->getMock();
$process->expects($this->once())
->method('isSuccessful')
->will($this->returnValue(false));
->willReturn(false);
$process->expects($this->once())
->method('getOutput')
->will($this->returnValue($output));
->willReturn($output);
$process->expects($this->once())
->method('getErrorOutput')
->will($this->returnValue($errorOutput));
->willReturn($errorOutput);
$process->expects($this->once())
->method('getExitCode')
->will($this->returnValue($exitCode));
->willReturn($exitCode);
$process->expects($this->once())
->method('getExitCodeText')
->will($this->returnValue($exitText));
->willReturn($exitText);
$process->expects($this->once())
->method('isOutputDisabled')
->will($this->returnValue(false));
->willReturn(false);
$process->expects($this->once())
->method('getWorkingDirectory')
->will($this->returnValue($workingDirectory));
->willReturn($workingDirectory);
$exception = new ProcessFailedException($process);
@ -103,7 +103,7 @@ class ProcessFailedExceptionTest extends TestCase
$process = $this->getMockBuilder('Symfony\Component\Process\Process')->setMethods(['isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'])->setConstructorArgs([[$cmd]])->getMock();
$process->expects($this->once())
->method('isSuccessful')
->will($this->returnValue(false));
->willReturn(false);
$process->expects($this->never())
->method('getOutput');
@ -113,19 +113,19 @@ class ProcessFailedExceptionTest extends TestCase
$process->expects($this->once())
->method('getExitCode')
->will($this->returnValue($exitCode));
->willReturn($exitCode);
$process->expects($this->once())
->method('getExitCodeText')
->will($this->returnValue($exitText));
->willReturn($exitText);
$process->expects($this->once())
->method('isOutputDisabled')
->will($this->returnValue(true));
->willReturn(true);
$process->expects($this->once())
->method('getWorkingDirectory')
->will($this->returnValue($workingDirectory));
->willReturn($workingDirectory);
$exception = new ProcessFailedException($process);

View file

@ -49,7 +49,8 @@ class ProcessTest extends TestCase
/**
* @expectedException \Symfony\Component\Process\Exception\RuntimeException
* @expectedExceptionMessage The provided cwd does not exist.
* @expectedExceptionMessage The provided cwd "
* @expectedExceptionMessage "does not exist.
*/
public function testInvalidCwd()
{
@ -1510,6 +1511,25 @@ EOTXT;
$this->assertSame($env, $p->getEnv());
}
public function testWaitStoppedDeadProcess()
{
$process = $this->getProcess(self::$phpBin.' '.__DIR__.'/ErrorProcessInitiator.php -e '.self::$phpBin);
$process->start();
$process->setTimeout(2);
$process->wait();
$this->assertFalse($process->isRunning());
}
/**
* @param string $commandline
* @param string|null $cwd
* @param array|null $env
* @param string|null $input
* @param int $timeout
* @param array $options
*
* @return Process
*/
private function getProcess($commandline, string $cwd = null, array $env = null, $input = null, ?int $timeout = 60): Process
{
if (\is_string($commandline)) {

View file

@ -27,7 +27,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
"dev-master": "4.3-dev"
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
<?php
require_once('view/en-gb/strings.php');
App::$strings['Welcome %s. Remote authentication successful.'] = "G'day %s. Remote authentication successful";

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
[widget=activity_filter][/widget]
[widget=savedsearch][/widget]
[widget=suggestions][/widget]
[widget=tasklist][/widget]
[widget=notes][/widget]
[/region]

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

Some files were not shown because too many files have changed in this diff Show more