Useless info messages removed

This commit is contained in:
Michael 2020-07-23 06:11:21 +00:00
parent 0b423b73ac
commit 3fc3ded750
39 changed files with 47 additions and 90 deletions

View File

@ -584,8 +584,6 @@ function events_content(App $a)
if (Item::exists(['id' => $ev[0]['itemid']])) {
notice(DI::l10n()->t('Failed to remove event') . EOL);
} else {
info(DI::l10n()->t('Event removed') . EOL);
}
DI::baseUrl()->redirect('events');

View File

@ -62,7 +62,7 @@ function follow_post(App $a)
DI::baseUrl()->redirect('contact/' . $result['cid']);
}
info(DI::l10n()->t('The contact could not be added.'));
notice(DI::l10n()->t('The contact could not be added.'));
DI::baseUrl()->redirect($return_path);
// NOTREACHED

View File

@ -333,7 +333,7 @@ function item_post(App $a) {
System::jsonExit(['preview' => '']);
}
info(DI::l10n()->t('Empty post discarded.'));
notice(DI::l10n()->t('Empty post discarded.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
@ -703,7 +703,6 @@ function item_post(App $a) {
// update filetags in pconfig
FileTag::updatePconfig($uid, $categories_old, $categories_new, 'category');
info(DI::l10n()->t('Post updated.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
@ -725,7 +724,7 @@ function item_post(App $a) {
$post_id = Item::insert($datarray);
if (!$post_id) {
info(DI::l10n()->t('Item wasn\'t stored.'));
notice(DI::l10n()->t('Item wasn\'t stored.'));
if ($return_path) {
DI::baseUrl()->redirect($return_path);
}
@ -826,7 +825,6 @@ function item_post(App $a) {
return $post_id;
}
info(DI::l10n()->t('Post published.'));
item_post_return(DI::baseUrl(), $api_source, $return_path);
// NOTREACHED
}

View File

@ -94,8 +94,6 @@ function message_post(App $a)
case -4:
notice(DI::l10n()->t('Message collection failure.') . EOL);
break;
default:
info(DI::l10n()->t('Message sent.') . EOL);
}
// fake it to go back to the input form if no recipient listed
@ -178,17 +176,16 @@ function message_content(App $a)
if ($cmd === 'drop') {
$message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
if(!DBA::isResult($message)){
info(DI::l10n()->t('Conversation not found.') . EOL);
notice(DI::l10n()->t('Conversation not found.') . EOL);
DI::baseUrl()->redirect('message');
}
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
info(DI::l10n()->t('Message deleted.') . EOL);
if (!DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
notice(DI::l10n()->t('Message was not deleted.') . EOL);
}
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
if(!DBA::isResult($conversation)){
info(DI::l10n()->t('Conversation removed.') . EOL);
DI::baseUrl()->redirect('message');
}
@ -201,8 +198,8 @@ function message_content(App $a)
if (DBA::isResult($r)) {
$parent = $r[0]['parent-uri'];
if (DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
info(DI::l10n()->t('Conversation removed.') . EOL);
if (!DBA::delete('mail', ['parent-uri' => $parent, 'uid' => local_user()])) {
notice(DI::l10n()->t('Conversation was not removed.') . EOL);
}
}
DI::baseUrl()->redirect('message');
@ -301,7 +298,7 @@ function message_content(App $a)
$r = get_messages(local_user(), $pager->getStart(), $pager->getItemsPerPage());
if (!DBA::isResult($r)) {
info(DI::l10n()->t('No messages.') . EOL);
notice(DI::l10n()->t('No messages.') . EOL);
return $o;
}

View File

@ -305,7 +305,7 @@ function network_content(App $a, $update = 0, $parent = 0)
}
if ($o === '') {
info("No items found");
notice("No items found");
}
return $o;
@ -569,7 +569,7 @@ function networkThreadedView(App $a, $update, $parent)
$sql_extra3 .= " OR (`thread`.`contact-id` = '$contact_str_self' AND `temp1`.`allow_gid` LIKE '" . Strings::protectSprintf('%<' . intval($gid) . '>%') . "' AND `temp1`.`private`))";
} else {
$sql_extra3 .= " AND false ";
info(DI::l10n()->t('Group is empty'));
notice(DI::l10n()->t('Group is empty'));
}
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [

View File

@ -45,7 +45,6 @@ function oexchange_content(App $a) {
}
if (($a->argc > 1) && $a->argv[1] === 'done') {
info(DI::l10n()->t('Post successful.') . EOL);
return;
}

View File

@ -295,7 +295,6 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
notice('Successfully deleted the photo.');
} else {
notice('Failed to delete the photo.');
DI::baseUrl()->redirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);

View File

@ -202,9 +202,6 @@ function settings_post(App $a)
}
}
}
if (!$failed) {
info(DI::l10n()->t('Email settings updated.') . EOL);
}
}
}
@ -219,7 +216,6 @@ function settings_post(App $a)
DI::pConfig()->set(local_user(), 'feature', substr($k, 8), ((intval($v)) ? 1 : 0));
}
}
info(DI::l10n()->t('Features updated') . EOL);
return;
}
@ -231,7 +227,7 @@ function settings_post(App $a)
// was there an error
if ($_FILES['importcontact-filename']['error'] > 0) {
Logger::notice('Contact CSV file upload error');
info(DI::l10n()->t('Contact CSV file upload error'));
notice(DI::l10n()->t('Contact CSV file upload error'));
} else {
$csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
// import contacts
@ -443,8 +439,8 @@ function settings_post(App $a)
$fields['openidserver'] = '';
}
if (DBA::update('user', $fields, ['uid' => local_user()])) {
info(DI::l10n()->t('Settings updated.') . EOL);
if (!DBA::update('user', $fields, ['uid' => local_user()])) {
notice(DI::l10n()->t('Settings were not updated.') . EOL);
}
// clear session language

View File

@ -44,7 +44,6 @@ function tagrm_post(App $a)
$item_id = $_POST['item'] ?? 0;
update_tags($item_id, $tags);
info(DI::l10n()->t('Tag(s) removed') . EOL);
DI::baseUrl()->redirect($_SESSION['photo_return']);
// NOTREACHED

View File

@ -79,7 +79,6 @@ function unfollow_post(App $a)
$return_path = $base_return_path . '/' . $contact['id'];
}
info(DI::l10n()->t('Contact unfollowed'));
DI::baseUrl()->redirect($return_path);
// NOTREACHED
}

View File

@ -84,8 +84,6 @@ function wallmessage_post(App $a) {
case -4:
notice(DI::l10n()->t('Message collection failure.') . EOL);
break;
default:
info(DI::l10n()->t('Message sent.') . EOL);
}
DI::baseUrl()->redirect('profile/'.$user['nickname']);

View File

@ -270,7 +270,7 @@ class Authentication
}
} catch (Exception $e) {
$this->logger->warning('authenticate: failed login attempt', ['action' => 'login', 'username' => Strings::escapeTags($username), 'ip' => $_SERVER['REMOTE_ADDR']]);
info($this->l10n->t('Login failed. Please check your credentials.' . EOL));
notice($this->l10n->t('Login failed. Please check your credentials.' . EOL));
$this->baseUrl->redirect();
}
@ -389,8 +389,6 @@ class Authentication
info($this->l10n->t('Welcome %s', $user_record['username']));
info($this->l10n->t('Please upload a profile photo.'));
$this->baseUrl->redirect('settings/profile/photo/new');
} else {
info($this->l10n->t("Welcome back %s", $user_record['username']));
}
}

View File

@ -237,7 +237,7 @@ class Module
public function run(Core\L10n $l10n, App\BaseURL $baseUrl, LoggerInterface $logger, array $server, array $post)
{
if ($this->printNotAllowedAddon) {
info($l10n->t("You must be logged in to use addons. "));
notice($l10n->t("You must be logged in to use addons. "));
}
/* The URL provided does not resolve to a valid module.

View File

@ -271,7 +271,7 @@ class UserImport
if ($r === false) {
Logger::log("uimport:insert profile: ERROR : " . DBA::errorMessage(), Logger::INFO);
info(DI::l10n()->t("User profile creation error"));
notice(DI::l10n()->t("User profile creation error"));
DBA::delete('user', ['uid' => $newuid]);
DBA::delete('profile_field', ['uid' => $newuid]);
return;

View File

@ -271,8 +271,6 @@ class FileTag
if (!strlen($saved) || !stristr($saved, '[' . self::encode($file) . ']')) {
DI::pConfig()->set($uid, 'system', 'filetags', $saved . '[' . self::encode($file) . ']');
}
info(DI::l10n()->t('Item filed'));
}
return true;

View File

@ -50,7 +50,7 @@ class Index extends BaseAdmin
} elseif (Addon::install($addon)) {
info(DI::l10n()->t('Addon %s enabled.', $addon));
} else {
info(DI::l10n()->t('Addon %s failed to install.', $addon));
notice(DI::l10n()->t('Addon %s failed to install.', $addon));
}
break;

View File

@ -62,7 +62,6 @@ class Server extends BaseAdmin
}
}
DI::config()->set('system', 'blocklist', $blocklist);
info(DI::l10n()->t('Site blocklist updated.') . EOL);
}
DI::baseUrl()->redirect('admin/blocklist/server');

View File

@ -51,7 +51,6 @@ class Settings extends BaseAdmin
DI::config()->set('system', 'loglevel', $loglevel);
}
info(DI::l10n()->t("Log settings updated."));
DI::baseUrl()->redirect('admin/logs');
}

View File

@ -250,7 +250,7 @@ class Site extends BaseAdmin
DI::baseUrl()->redirect('admin/site' . $active_panel);
}
} else {
info(DI::l10n()->t('Invalid storage backend setting value.'));
notice(DI::l10n()->t('Invalid storage backend setting value.'));
}
// Has the directory url changed? If yes, then resubmit the existing profiles there
@ -433,8 +433,6 @@ class Site extends BaseAdmin
DI::config()->set('system', 'rino_encrypt' , $rino);
info(DI::l10n()->t('Site settings updated.') . EOL);
DI::baseUrl()->redirect('admin/site' . $active_panel);
}

View File

@ -48,8 +48,6 @@ class Details extends BaseAdmin
}
}
info(DI::l10n()->t('Theme settings updated.'));
if (DI::mode()->isAjax()) {
return;
}
@ -91,7 +89,7 @@ class Details extends BaseAdmin
} elseif (Theme::install($theme)) {
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
} else {
info(DI::l10n()->t('Theme %s failed to install.', $theme));
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
}
DI::baseUrl()->redirect('admin/themes/' . $theme);

View File

@ -62,8 +62,6 @@ class Embed extends BaseAdmin
}
}
info(DI::l10n()->t('Theme settings updated.'));
if (DI::mode()->isAjax()) {
return;
}

View File

@ -66,7 +66,7 @@ class Index extends BaseAdmin
} elseif (Theme::install($theme)) {
info(DI::l10n()->t('Theme %s successfully enabled.', $theme));
} else {
info(DI::l10n()->t('Theme %s failed to install.', $theme));
notice(DI::l10n()->t('Theme %s failed to install.', $theme));
}
}

View File

@ -45,8 +45,6 @@ class Tos extends BaseAdmin
DI::config()->set('system', 'tosprivstatement', $displayprivstatement);
DI::config()->set('system', 'tostext', $tostext);
info(DI::l10n()->t('The Terms of Service settings have been updated.'));
DI::baseUrl()->redirect('admin/tos');
}

View File

@ -116,7 +116,7 @@ class BaseSearch extends BaseModule
protected static function printResult(ResultList $results, Pager $pager, $header = '')
{
if ($results->getTotal() == 0) {
info(DI::l10n()->t('No matches'));
notice(DI::l10n()->t('No matches'));
return '';
}

View File

@ -144,9 +144,7 @@ class Contact extends BaseModule
['id' => $contact_id, 'uid' => local_user()]
);
if (DBA::isResult($r)) {
info(DI::l10n()->t('Contact updated.') . EOL);
} else {
if (!DBA::isResult($r)) {
notice(DI::l10n()->t('Failed to update contact record.') . EOL);
}

View File

@ -90,9 +90,7 @@ class Advanced extends BaseModule
Model\Contact::updateAvatar($photo, local_user(), $contact['id'], true);
}
if ($r) {
info(DI::l10n()->t('Contact settings applied.') . EOL);
} else {
if (!$r) {
notice(DI::l10n()->t('Contact update failed.') . EOL);
}

View File

@ -110,9 +110,7 @@ class Poke extends BaseModule
*/
private static function postReturn(bool $success)
{
if ($success) {
info(DI::l10n()->t('Poke successfully sent.'));
} else {
if (!$success) {
notice(DI::l10n()->t('Error while sending poke, please retry.'));
}

View File

@ -81,7 +81,7 @@ class Community extends BaseModule
$items = self::getItems();
if (!DBA::isResult($items)) {
info(DI::l10n()->t('No results.'));
notice(DI::l10n()->t('No results.'));
return $o;
}

View File

@ -36,7 +36,7 @@ class Feed extends BaseModule
public static function init(array $parameters = [])
{
if (!local_user()) {
info(DI::l10n()->t('You must be logged in to use this module'));
notice(DI::l10n()->t('You must be logged in to use this module'));
DI::baseUrl()->redirect();
}
}

View File

@ -75,7 +75,7 @@ class Directory extends BaseModule
$profiles = Profile::searchProfiles($pager->getStart(), $pager->getItemsPerPage(), $search);
if ($profiles['total'] === 0) {
info(DI::l10n()->t('No entries (some entries may be hidden).') . EOL);
notice(DI::l10n()->t('No entries (some entries may be hidden).') . EOL);
} else {
if (in_array('small', $app->argv)) {
$photo = 'thumb';

View File

@ -59,11 +59,11 @@ class RemoveTag extends BaseModule
]);
if ($item_id && strlen($term)) {
if (FileTag::unsaveFile(local_user(), $item_id, $term, $category)) {
info('Item removed');
if (!FileTag::unsaveFile(local_user(), $item_id, $term, $category)) {
notice(DI::l10n()->t('Item was not removed'));
}
} else {
info('Item was not deleted');
notice(DI::l10n()->t('Item was not deleted'));
}
DI::baseUrl()->redirect('network?file=' . rawurlencode($term));

View File

@ -35,7 +35,7 @@ class SaveTag extends BaseModule
public static function init(array $parameters = [])
{
if (!local_user()) {
info(DI::l10n()->t('You must be logged in to use this module'));
notice(DI::l10n()->t('You must be logged in to use this module'));
DI::baseUrl()->redirect();
}
}
@ -54,7 +54,6 @@ class SaveTag extends BaseModule
if ($item_id && strlen($term)) {
// file item
Model\FileTag::saveFile(local_user(), $item_id, $term);
info(DI::l10n()->t('Filetag %s saved to item', $term));
}
// return filer dialog

View File

@ -53,7 +53,6 @@ class Group extends BaseModule
$name = Strings::escapeTags(trim($_POST['groupname']));
$r = Model\Group::create(local_user(), $name);
if ($r) {
info(DI::l10n()->t('Group created.'));
$r = Model\Group::getIdByName(local_user(), $name);
if ($r) {
DI::baseUrl()->redirect('group/' . $r);
@ -75,8 +74,8 @@ class Group extends BaseModule
}
$groupname = Strings::escapeTags(trim($_POST['groupname']));
if (strlen($groupname) && ($groupname != $group['name'])) {
if (Model\Group::update($group['id'], $groupname)) {
info(DI::l10n()->t('Group name changed.'));
if (!Model\Group::update($group['id'], $groupname)) {
notice(DI::l10n()->t('Group name was not changed.'));
}
}
}
@ -216,9 +215,7 @@ class Group extends BaseModule
DI::baseUrl()->redirect('contact');
}
if (Model\Group::remove($a->argv[2])) {
info(DI::l10n()->t('Group removed.'));
} else {
if (!Model\Group::remove($a->argv[2])) {
notice(DI::l10n()->t('Unable to remove group.'));
}
}

View File

@ -191,7 +191,7 @@ class Introductions extends BaseNotifications
}
if (count($notifications['notifications']) == 0) {
info(DI::l10n()->t('No introductions.') . EOL);
notice(DI::l10n()->t('No introductions.') . EOL);
$notificationNoContent = DI::l10n()->t('No more %s notifications.', $notifications['ident']);
}

View File

@ -92,7 +92,7 @@ class Contacts extends BaseProfile
$contacts_stmt = DBA::select('contact', [], $condition, $params);
if (!DBA::isResult($contacts_stmt)) {
info(DI::l10n()->t('No contacts.') . EOL);
notice(DI::l10n()->t('No contacts.') . EOL);
return $o;
}

View File

@ -176,7 +176,7 @@ class Index extends BaseSearch
}
if (!DBA::isResult($r)) {
info(DI::l10n()->t('No results.'));
notice(DI::l10n()->t('No results.'));
return $o;
}

View File

@ -41,16 +41,18 @@ class Saved extends BaseModule
case 'add':
$fields = ['uid' => local_user(), 'term' => $search];
if (!DBA::exists('search', $fields)) {
DBA::insert('search', $fields);
info(DI::l10n()->t('Search term successfully saved.'));
if (!DBA::insert('search', $fields)) {
notice(DI::l10n()->t('Search term was not saved.'));
}
} else {
info(DI::l10n()->t('Search term already saved.'));
notice(DI::l10n()->t('Search term already saved.'));
}
break;
case 'remove':
DBA::delete('search', ['uid' => local_user(), 'term' => $search]);
info(DI::l10n()->t('Search term successfully removed.'));
if (!DBA::delete('search', ['uid' => local_user(), 'term' => $search])) {
notice(DI::l10n()->t('Search term was not removed.'));
}
break;
}
}

View File

@ -134,9 +134,7 @@ class Index extends BaseSettings
['uid' => local_user()]
);
if ($result) {
info(DI::l10n()->t('Profile updated.'));
} else {
if (!$result) {
notice(DI::l10n()->t('Profile couldn\'t be updated.'));
return;
}

View File

@ -93,9 +93,7 @@ class Index extends BaseSettings
$filename = '';
if (Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 0)) {
info(DI::l10n()->t('Image uploaded successfully.'));
} else {
if (!Photo::store($Image, local_user(), 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 0)) {
notice(DI::l10n()->t('Image upload failed.'));
}