mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:35:19 +00:00
cleanup
This commit is contained in:
parent
ceb9334d17
commit
6411b56406
15 changed files with 53 additions and 117 deletions
|
@ -756,7 +756,7 @@ class Channel
|
|||
);
|
||||
}
|
||||
|
||||
xchan_change_key($oldxchan, $newxchan, $stored);
|
||||
xchan_change_key($oldxchan, $newxchan);
|
||||
|
||||
Run::Summon([ 'Notifier', 'keychange', $channel['channel_id'] ]);
|
||||
|
||||
|
|
|
@ -1290,6 +1290,6 @@ class Libsync
|
|||
);
|
||||
}
|
||||
|
||||
xchan_change_key($oldxchan, $newxchan, $arr['keychange']);
|
||||
xchan_change_key($oldxchan, $newxchan);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -469,7 +469,7 @@ class Display extends Controller
|
|||
if ($item['item_private']) {
|
||||
continue;
|
||||
}
|
||||
$atom .= atom_entry($item, $type, [], [], true, '', false);
|
||||
$atom .= atom_entry($item, $type, [], [], true, '');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ class NomadHandler implements IHandler
|
|||
// if ! $update create a linked identity
|
||||
|
||||
|
||||
xchan_change_key($xchan, $newxchan, $data);
|
||||
xchan_change_key($xchan, $newxchan);
|
||||
|
||||
$ret['success'] = true;
|
||||
return $ret;
|
||||
|
|
|
@ -227,27 +227,27 @@ class Theme
|
|||
}
|
||||
}
|
||||
|
||||
public static function get_template($s, $root = '')
|
||||
public static function get_template($filename, $root = '')
|
||||
{
|
||||
$testroot = ($root=='') ? $testroot = "ROOT" : $root;
|
||||
|
||||
$t = App::template_engine();
|
||||
|
||||
if (isset(App::$override_markup_templates[$testroot][$s]["content"])) {
|
||||
return App::$override_markup_templates[$testroot][$s]["content"];
|
||||
if (isset(App::$override_markup_templates[$testroot][$filename]["content"])) {
|
||||
return App::$override_markup_templates[$testroot][$filename]["content"];
|
||||
} else {
|
||||
if (isset(App::$override_markup_templates[$testroot][$s]["root"]) &&
|
||||
isset(App::$override_markup_templates[$testroot][$s]["file"])) {
|
||||
$s = App::$override_markup_templates[$testroot][$s]["file"];
|
||||
$root = App::$override_markup_templates[$testroot][$s]["root"];
|
||||
if (isset(App::$override_markup_templates[$testroot][$filename]["root"]) &&
|
||||
isset(App::$override_markup_templates[$testroot][$filename]["file"])) {
|
||||
$filename = App::$override_markup_templates[$testroot][$filename]["file"];
|
||||
$root = App::$override_markup_templates[$testroot][$filename]["root"];
|
||||
} elseif (App::$override_templateroot) {
|
||||
$newroot = App::$override_templateroot.$root;
|
||||
if ($newroot != '' && !str_ends_with($newroot, '/')) {
|
||||
$newroot .= '/';
|
||||
}
|
||||
$template = $t->get_template($s, $newroot);
|
||||
$template = $t->get_template($filename, $newroot);
|
||||
}
|
||||
$template = $t->get_template($s, $root);
|
||||
$template = $t->get_template($filename, $root);
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,14 +75,6 @@ class Settings_menu implements WidgetInterface
|
|||
'selected' => ''
|
||||
];
|
||||
|
||||
// if(Features::enabled(local_channel(),'oauth_clients')) {
|
||||
// $tabs[] = array(
|
||||
// 'label' => t('OAuth1 apps'),
|
||||
// 'url' => z_root() . '/settings/oauth',
|
||||
// 'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
|
||||
// );
|
||||
// }
|
||||
|
||||
if (Apps::system_app_installed(local_channel(), 'Clients')) {
|
||||
$tabs[] = [
|
||||
'label' => t('Client apps'),
|
||||
|
@ -91,41 +83,15 @@ class Settings_menu implements WidgetInterface
|
|||
];
|
||||
}
|
||||
|
||||
// if(Features::enabled(local_channel(),'access_tokens')) {
|
||||
// $tabs[] = array(
|
||||
// 'label' => t('Guest Access Tokens'),
|
||||
// 'url' => z_root() . '/settings/tokens',
|
||||
// 'selected' => ((argv(1) === 'tokens') ? 'active' : ''),
|
||||
// );
|
||||
// }
|
||||
|
||||
if(Apps::system_app_installed(local_channel(),'Roles')) {
|
||||
if(Apps::system_app_installed(local_channel(),'Roles')) {
|
||||
$tabs[] = [
|
||||
'label' => t('Permission Roles'),
|
||||
'url' => z_root() . '/settings/permcats',
|
||||
'selected' => ((argv(1) === 'permcats') ? 'active' : ''),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if($role === false || $role === 'custom') {
|
||||
// $tabs[] = array(
|
||||
// 'label' => t('Connection Default Permissions'),
|
||||
// 'url' => z_root() . '/defperms',
|
||||
// 'selected' => ''
|
||||
// );
|
||||
// }
|
||||
|
||||
// if(Features::enabled(local_channel(),'channel_sources')) {
|
||||
// $tabs[] = array(
|
||||
// 'label' => t('Channel Sources'),
|
||||
// 'url' => z_root() . '/sources',
|
||||
// 'selected' => ''
|
||||
// );
|
||||
// }
|
||||
|
||||
$tabtpl = Theme::get_template("generic_links_widget.tpl");
|
||||
return replace_macros($tabtpl, [
|
||||
return replace_macros(Theme::get_template('generic_links_widget.tpl'), [
|
||||
'$title' => t('Settings'),
|
||||
'$class' => 'settings-widget',
|
||||
'$items' => $tabs,
|
||||
|
|
|
@ -37,9 +37,9 @@ class Suggestedchats implements WidgetInterface
|
|||
$r[$x]['xchat_url'] = zid($r[$x]['xchat_url']);
|
||||
}
|
||||
}
|
||||
return replace_macros(Theme::get_template('bookmarkedchats.tpl'), array(
|
||||
return replace_macros(Theme::get_template('bookmarkedchats.tpl'), [
|
||||
'$header' => t('Suggested Chatrooms'),
|
||||
'$rooms' => $r
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class Suggestions implements WidgetInterface
|
|||
|
||||
// Get two random entries from the top 20 returned.
|
||||
// We'll grab the first one and the one immediately following.
|
||||
// This will throw some entropy into the situation so you won't
|
||||
// This will throw some entropy into the situation, so you won't
|
||||
// be looking at the same two mug shots every time the widget runs
|
||||
|
||||
$index = ((count($r) > 2) ? mt_rand(0, count($r) - 2) : 0);
|
||||
|
@ -52,12 +52,10 @@ class Suggestions implements WidgetInterface
|
|||
];
|
||||
}
|
||||
|
||||
$o = replace_macros(Theme::get_template('suggest_widget.tpl'), [
|
||||
return replace_macros(Theme::get_template('suggest_widget.tpl'), [
|
||||
'$title' => t('Suggestions'),
|
||||
'$more' => t('See more...'),
|
||||
'$entries' => $arguments
|
||||
]);
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php /** @noinspection PhpUnused */
|
||||
|
||||
/**
|
||||
* @file include/config.php
|
||||
|
|
|
@ -470,13 +470,6 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
|
|||
}
|
||||
}
|
||||
|
||||
$sp = false;
|
||||
// $profile_link = best_link_url($item,$sp);
|
||||
// if($sp)
|
||||
// $sparkle = ' sparkle';
|
||||
// else
|
||||
// $profile_link = zid($profile_link);
|
||||
|
||||
$profile_name = $item['author']['xchan_name'];
|
||||
$profile_link = $item['author']['xchan_url'];
|
||||
$profile_avatar = $item['author']['xchan_photo_m'];
|
||||
|
|
|
@ -246,9 +246,9 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke
|
|||
$readable_format = str_replace('i', 'MM', $readable_format);
|
||||
|
||||
$tpl = Theme::get_template('field_input.tpl');
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$field' => array($id, $label, $input_text, (($required) ? t('Required') : ''), (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'),
|
||||
));
|
||||
$o .= replace_macros($tpl, [
|
||||
'$field' => [$id, $label, $input_text, (($required) ? t('Required') : ''), (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'],
|
||||
]);
|
||||
$o .= "<script>\$(function () {var picker = \$('#id_$id').datetimepicker({step:15,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs,dayOfWeekStart:$first_day}) $extra_js})</script>";
|
||||
|
||||
return $o;
|
||||
|
@ -290,14 +290,14 @@ function relative_date($posted_date, $format = null)
|
|||
return sprintf(t('less than a second %s'), $direction);
|
||||
}
|
||||
|
||||
$a = array( 12 * 30 * 24 * 60 * 60 => 'y',
|
||||
$a = [12 * 30 * 24 * 60 * 60 => 'y',
|
||||
30 * 24 * 60 * 60 => 'm',
|
||||
7 * 24 * 60 * 60 => 'w',
|
||||
24 * 60 * 60 => 'd',
|
||||
60 * 60 => 'h',
|
||||
60 => 'i',
|
||||
1 => 's'
|
||||
);
|
||||
];
|
||||
|
||||
|
||||
foreach ($a as $secs => $str) {
|
||||
|
@ -315,31 +315,16 @@ function relative_date($posted_date, $format = null)
|
|||
function plural_dates($k, $n)
|
||||
{
|
||||
|
||||
switch ($k) {
|
||||
case 'y':
|
||||
return tt('year', 'years', $n, 'relative_date');
|
||||
break;
|
||||
case 'm':
|
||||
return tt('month', 'months', $n, 'relative_date');
|
||||
break;
|
||||
case 'w':
|
||||
return tt('week', 'weeks', $n, 'relative_date');
|
||||
break;
|
||||
case 'd':
|
||||
return tt('day', 'days', $n, 'relative_date');
|
||||
break;
|
||||
case 'h':
|
||||
return tt('hour', 'hours', $n, 'relative_date');
|
||||
break;
|
||||
case 'i':
|
||||
return tt('minute', 'minutes', $n, 'relative_date');
|
||||
break;
|
||||
case 's':
|
||||
return tt('second', 'seconds', $n, 'relative_date');
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
return match ($k) {
|
||||
'y' => tt('year', 'years', $n, 'relative_date'),
|
||||
'm' => tt('month', 'months', $n, 'relative_date'),
|
||||
'w' => tt('week', 'weeks', $n, 'relative_date'),
|
||||
'd' => tt('day', 'days', $n, 'relative_date'),
|
||||
'h' => tt('hour', 'hours', $n, 'relative_date'),
|
||||
'i' => tt('minute', 'minutes', $n, 'relative_date'),
|
||||
's' => tt('second', 'seconds', $n, 'relative_date'),
|
||||
default => '',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -490,7 +475,7 @@ function cal($y = 0, $m = 0, $links = false, $class = '')
|
|||
$day = str_replace(' ', ' ', sprintf('%2.2d', $d));
|
||||
if ($started) {
|
||||
if (is_array($links) && isset($links[$d])) {
|
||||
$o .= "<a href=\"{$links[$d]}\">$day</a>";
|
||||
$o .= "<a href=\"$links[$d]\">$day</a>";
|
||||
} else {
|
||||
$o .= $day;
|
||||
}
|
||||
|
@ -594,7 +579,7 @@ function update_birthdays()
|
|||
|
||||
$z = event_store_event($ev);
|
||||
if ($z) {
|
||||
$item_id = event_store_item($ev, $z);
|
||||
event_store_item($ev, $z);
|
||||
q(
|
||||
"update abook set abook_dob = '%s' where abook_id = %d",
|
||||
dbesc(intval($rr['abook_dob']) + 1 . substr($rr['abook_dob'], 4)),
|
||||
|
|
|
@ -98,7 +98,7 @@ function get_feed_for($channel, $observer_hash, $params)
|
|||
|
||||
$feed_author = '';
|
||||
|
||||
$atom .= replace_macros($feed_template, array(
|
||||
$atom .= replace_macros($feed_template, [
|
||||
'$version' => xmlify(Code\Lib\System::get_project_version()),
|
||||
'$generator' => xmlify(Code\Lib\System::get_project_name()),
|
||||
'$generator_uri' => z_root(),
|
||||
|
@ -107,7 +107,7 @@ function get_feed_for($channel, $observer_hash, $params)
|
|||
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)),
|
||||
'$author' => $feed_author,
|
||||
'$profile_page' => xmlify($channel['xchan_url']),
|
||||
));
|
||||
]);
|
||||
|
||||
|
||||
$x = [
|
||||
|
@ -161,7 +161,7 @@ function get_feed_for($channel, $observer_hash, $params)
|
|||
continue;
|
||||
}
|
||||
|
||||
$atom .= atom_entry($item, $type, null, $owner, true, '', $params['compat']);
|
||||
$atom .= atom_entry($item, $type, null, $owner, true, '');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,18 +287,17 @@ function compat_photos_list($s)
|
|||
/**
|
||||
* @brief Create an item for the Atom feed.
|
||||
*
|
||||
* @see get_feed_for()
|
||||
*
|
||||
* @param array $item
|
||||
* @param string $type
|
||||
* @param array $author
|
||||
* @param array|null $author
|
||||
* @param array $owner
|
||||
* @param string $comment default false
|
||||
* @param number $cid default 0
|
||||
* @param bool $compat default false
|
||||
* @return void|string
|
||||
*@see get_feed_for()
|
||||
*
|
||||
*/
|
||||
function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0, $compat = false)
|
||||
function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0)
|
||||
{
|
||||
|
||||
if (! $item['parent']) {
|
||||
|
|
|
@ -30,7 +30,7 @@ use Symfony\Component\Uid\Uuid;
|
|||
*
|
||||
* @return string substituted string
|
||||
*/
|
||||
function replace_macros($s, $r)
|
||||
function replace_macros($template, $map)
|
||||
{
|
||||
$arr = [
|
||||
'template' => $s,
|
||||
|
|
|
@ -105,12 +105,12 @@ function http_status_exit($val, $msg = '')
|
|||
function unparse_url($parsed_url)
|
||||
{
|
||||
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
|
||||
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
|
||||
$host = $parsed_url['host'] ?? '';
|
||||
$port = ((isset($parsed_url['port']) && intval($parsed_url['port'])) ? ':' . intval($parsed_url['port']) : '');
|
||||
$user = isset($parsed_url['user']) ? $parsed_url['user'] : '';
|
||||
$user = $parsed_url['user'] ?? '';
|
||||
$pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
|
||||
$pass = ($user || $pass) ? "$pass@" : '';
|
||||
$path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
|
||||
$path = $parsed_url['path'] ?? '';
|
||||
$query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
|
||||
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
|
||||
return "$scheme$user$pass$host$port$path$query$fragment";
|
||||
|
@ -422,11 +422,8 @@ function xml2array($contents, $namespaces = true, $get_attributes = 1, $priority
|
|||
return [];
|
||||
}
|
||||
|
||||
//Initializations
|
||||
// Initializations
|
||||
$xml_array = [];
|
||||
$parents = [];
|
||||
$opened_tags = [];
|
||||
$arr = [];
|
||||
|
||||
$current = &$xml_array; // Reference
|
||||
|
||||
|
@ -600,8 +597,6 @@ function email_header_encode($in_str, $charset = 'UTF-8', $header = 'Subject')
|
|||
*/
|
||||
function discover_resource(string $resource, $protocol = '', $verify = true)
|
||||
{
|
||||
$network = null;
|
||||
|
||||
$x = Webfinger::exec($resource);
|
||||
|
||||
$address = EMPTY_STR;
|
||||
|
@ -1398,7 +1393,7 @@ function get_request_string($url)
|
|||
|
||||
$m = parse_url($url);
|
||||
if ($m) {
|
||||
return ( (isset($m['path']) ? $m['path'] : '/' ) . (isset($m['query']) ? '?' . $m['query'] : '') );
|
||||
return ( ($m['path'] ?? '/') . (isset($m['query']) ? '?' . $m['query'] : '') );
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
|
@ -109,7 +109,7 @@ function xchan_store($arr)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (in_array($columns, 'xchan_' . $k)) {
|
||||
if (in_array('xchan_' . $k, $columns)) {
|
||||
$x['xchan_' . $k] = escape_tags($v);
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ function xchan_keychange_acl($table, $column, $oldxchan, $newxchan)
|
|||
}
|
||||
|
||||
|
||||
function xchan_change_key($oldx, $newx, $data)
|
||||
function xchan_change_key($oldx, $newx)
|
||||
{
|
||||
|
||||
$tables = [
|
||||
|
|
Loading…
Reference in a new issue