notags calls

implement removeTags function
This commit is contained in:
Adam Magness 2018-11-08 10:14:37 -05:00
parent 991f259ecb
commit a0f65ca7a1
51 changed files with 274 additions and 232 deletions

View file

@ -22,6 +22,7 @@ use Friendica\Module\Login;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
/**
* Manages and show Contacts and their content
@ -601,7 +602,7 @@ class Contact extends BaseModule
'$lbl_vis2' => L10n::t('Please choose the profile you would like to display to %s when viewing your profile securely.', $contact['name']),
'$lbl_info1' => $lbl_info1,
'$lbl_info2' => L10n::t('Their personal note'),
'$reason' => trim(notags($contact['reason'])),
'$reason' => trim(Strings::removeTags($contact['reason'])),
'$infedit' => L10n::t('Edit contact notes'),
'$common_link' => 'common/loc/' . local_user() . '/' . $contact['id'],
'$relation_text' => $relation_text,
@ -694,8 +695,8 @@ class Contact extends BaseModule
$sql_extra .= sprintf(" AND `network` != '%s' ", Protocol::PHANTOM);
$search = notags(trim(defaults($_GET, 'search', '')));
$nets = notags(trim(defaults($_GET, 'nets' , '')));
$search = Strings::removeTags(trim(defaults($_GET, 'search', '')));
$nets = Strings::removeTags(trim(defaults($_GET, 'nets' , '')));
$tabs = [
[

View file

@ -9,6 +9,7 @@ use Friendica\Database\DBStructure;
use Friendica\Core;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Util\Strings;
use Friendica\Util\Temporal;
class Install extends BaseModule
@ -70,10 +71,10 @@ class Install extends BaseModule
break;
case self::SITE_SETTINGS:
$dbhost = notags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
$dbuser = notags(trim(defaults($_POST, 'dbuser', '')));
$dbpass = notags(trim(defaults($_POST, 'dbpass', '')));
$dbdata = notags(trim(defaults($_POST, 'dbdata', '')));
$dbhost = Strings::removeTags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
$dbuser = Strings::removeTags(trim(defaults($_POST, 'dbuser', '')));
$dbpass = Strings::removeTags(trim(defaults($_POST, 'dbpass', '')));
$dbdata = Strings::removeTags(trim(defaults($_POST, 'dbdata', '')));
// If we cannot connect to the database, return to the previous step
if (!self::$installer->checkDB($dbhost, $dbuser, $dbpass, $dbdata)) {
@ -84,13 +85,13 @@ class Install extends BaseModule
case self::FINISHED:
$urlpath = $a->getURLPath();
$dbhost = notags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
$dbuser = notags(trim(defaults($_POST, 'dbuser', '')));
$dbpass = notags(trim(defaults($_POST, 'dbpass', '')));
$dbdata = notags(trim(defaults($_POST, 'dbdata', '')));
$timezone = notags(trim(defaults($_POST, 'timezone', Core\Installer::DEFAULT_TZ)));
$language = notags(trim(defaults($_POST, 'language', Core\Installer::DEFAULT_LANG)));
$adminmail = notags(trim(defaults($_POST, 'adminmail', '')));
$dbhost = Strings::removeTags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
$dbuser = Strings::removeTags(trim(defaults($_POST, 'dbuser', '')));
$dbpass = Strings::removeTags(trim(defaults($_POST, 'dbpass', '')));
$dbdata = Strings::removeTags(trim(defaults($_POST, 'dbdata', '')));
$timezone = Strings::removeTags(trim(defaults($_POST, 'timezone', Core\Installer::DEFAULT_TZ)));
$language = Strings::removeTags(trim(defaults($_POST, 'language', Core\Installer::DEFAULT_LANG)));
$adminmail = Strings::removeTags(trim(defaults($_POST, 'adminmail', '')));
// If we cannot connect to the database, return to the Database config wizard
if (!self::$installer->checkDB($dbhost, $dbuser, $dbpass, $dbdata)) {
@ -139,12 +140,12 @@ class Install extends BaseModule
break;
case self::DATABASE_CONFIG:
$dbhost = notags(trim(defaults($_POST, 'dbhost' , Core\Installer::DEFAULT_HOST)));
$dbuser = notags(trim(defaults($_POST, 'dbuser' , '' )));
$dbpass = notags(trim(defaults($_POST, 'dbpass' , '' )));
$dbdata = notags(trim(defaults($_POST, 'dbdata' , '' )));
$phpath = notags(trim(defaults($_POST, 'phpath' , '' )));
$adminmail = notags(trim(defaults($_POST, 'adminmail', '' )));
$dbhost = Strings::removeTags(trim(defaults($_POST, 'dbhost' , Core\Installer::DEFAULT_HOST)));
$dbuser = Strings::removeTags(trim(defaults($_POST, 'dbuser' , '' )));
$dbpass = Strings::removeTags(trim(defaults($_POST, 'dbpass' , '' )));
$dbdata = Strings::removeTags(trim(defaults($_POST, 'dbdata' , '' )));
$phpath = Strings::removeTags(trim(defaults($_POST, 'phpath' , '' )));
$adminmail = Strings::removeTags(trim(defaults($_POST, 'adminmail', '' )));
$tpl = Renderer::getMarkupTemplate('install_db.tpl');
$output .= Renderer::replaceMacros($tpl, [
@ -190,13 +191,13 @@ class Install extends BaseModule
break;
case self::SITE_SETTINGS:
$dbhost = notags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
$dbuser = notags(trim(defaults($_POST, 'dbuser', '' )));
$dbpass = notags(trim(defaults($_POST, 'dbpass', '' )));
$dbdata = notags(trim(defaults($_POST, 'dbdata', '' )));
$phpath = notags(trim(defaults($_POST, 'phpath', '' )));
$dbhost = Strings::removeTags(trim(defaults($_POST, 'dbhost', Core\Installer::DEFAULT_HOST)));
$dbuser = Strings::removeTags(trim(defaults($_POST, 'dbuser', '' )));
$dbpass = Strings::removeTags(trim(defaults($_POST, 'dbpass', '' )));
$dbdata = Strings::removeTags(trim(defaults($_POST, 'dbdata', '' )));
$phpath = Strings::removeTags(trim(defaults($_POST, 'phpath', '' )));
$adminmail = notags(trim(defaults($_POST, 'adminmail', '')));
$adminmail = Strings::removeTags(trim(defaults($_POST, 'adminmail', '')));
$timezone = defaults($_POST, 'timezone', Core\Installer::DEFAULT_TZ);
/* Installed langs */

View file

@ -17,6 +17,7 @@ use Friendica\Database\DBA;
use Friendica\Model\User;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\Strings;
use LightOpenID;
require_once 'boot.php';
@ -148,7 +149,7 @@ class Login extends BaseModule
);
}
} catch (Exception $e) {
Logger::log('authenticate: failed login attempt: ' . notags($username) . ' from IP ' . $_SERVER['REMOTE_ADDR']);
Logger::log('authenticate: failed login attempt: ' . Strings::removeTags($username) . ' from IP ' . $_SERVER['REMOTE_ADDR']);
info('Login failed. Please check your credentials.' . EOL);
$a->internalRedirect();
}