mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
cleanup
This commit is contained in:
parent
460ac21127
commit
c8ab4adf76
2 changed files with 20 additions and 22 deletions
|
@ -51,15 +51,18 @@ class Expire {
|
|||
// service class default (if non-zero) over-rides the site default
|
||||
|
||||
$service_class_expire = service_class_fetch($rr['channel_id'], 'expire_days');
|
||||
if (intval($service_class_expire))
|
||||
if (intval($service_class_expire)) {
|
||||
$channel_expire = $service_class_expire;
|
||||
else
|
||||
}
|
||||
else {
|
||||
$channel_expire = $site_expire;
|
||||
|
||||
}
|
||||
|
||||
if (intval($channel_expire) && (intval($channel_expire) < intval($rr['channel_expire_days'])) ||
|
||||
intval($rr['channel_expire_days'] == 0)) {
|
||||
$expire_days = $channel_expire;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$expire_days = $rr['channel_expire_days'];
|
||||
}
|
||||
|
||||
|
@ -75,9 +78,7 @@ class Expire {
|
|||
// this should probably just fetch the channel_expire_days from the sys channel,
|
||||
// but there's no convenient way to set it.
|
||||
|
||||
$expire_days = get_config('system', 'sys_expire_days');
|
||||
if ($expire_days === false)
|
||||
$expire_days = 30;
|
||||
$expire_days = get_config('system', 'sys_expire_days',30);
|
||||
|
||||
if (intval($site_expire) && (intval($site_expire) < intval($expire_days))) {
|
||||
$expire_days = $site_expire;
|
||||
|
@ -85,9 +86,10 @@ class Expire {
|
|||
|
||||
logger('Expire: sys interval: ' . $expire_days, LOGGER_DEBUG);
|
||||
|
||||
if ($expire_days)
|
||||
if ($expire_days) {
|
||||
item_expire($x['channel_id'], $expire_days, $commented_days);
|
||||
|
||||
}
|
||||
|
||||
logger('Expire: sys: done', LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,16 +10,15 @@ class Expire extends Controller {
|
|||
|
||||
function post() {
|
||||
|
||||
logger('expire: ' . print_r($_POST,true));
|
||||
|
||||
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Expire Posts'))) {
|
||||
if (! ( local_channel() && Apps::system_app_installed(local_channel(),'Expire Posts'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($_POST['expire-submit']) {
|
||||
if ($_POST['expire-submit']) {
|
||||
$expire = intval($_POST['selfexpiredays']);
|
||||
if($expire < 0)
|
||||
if ($expire < 0) {
|
||||
$expire = 0;
|
||||
}
|
||||
set_pconfig(local_channel(),'system','selfexpiredays',$expire);
|
||||
info( t('Expiration settings updated.') . EOL);
|
||||
}
|
||||
|
@ -35,22 +34,19 @@ logger('expire: ' . print_r($_POST,true));
|
|||
|
||||
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
|
||||
|
||||
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Expire Posts'))) {
|
||||
if (! ( local_channel() && Apps::system_app_installed(local_channel(),'Expire Posts'))) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array(
|
||||
$setting_fields .= replace_macros(get_markup_template('field_input.tpl'), [
|
||||
'$field' => array('selfexpiredays', t('Expire and delete all my posts after this many days'), intval(get_pconfig(local_channel(),'system','selfexpiredays',0)), t('Leave at 0 if you wish to manually control expiration of specific posts.'))
|
||||
));
|
||||
]);
|
||||
|
||||
$s .= replace_macros(get_markup_template('generic_app_settings.tpl'), array(
|
||||
return replace_macros(get_markup_template('generic_app_settings.tpl'), [
|
||||
'$addon' => array('expire', t('Automatic Expiration Settings'), '', t('Submit')),
|
||||
'$content' => $setting_fields
|
||||
));
|
||||
]);
|
||||
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue