Merge pull request #770 from zeroadam/TextToXML

XML functions were moved
This commit is contained in:
Hypolite Petovan 2018-11-05 13:55:57 -05:00 committed by GitHub
commit 3e7be22fd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 22 deletions

View file

@ -13,6 +13,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML;
function blogger_install() function blogger_install()
{ {
@ -178,14 +179,14 @@ function blogger_send(App $a, array &$b)
return; return;
} }
$bl_username = xmlify(PConfig::get($b['uid'], 'blogger', 'bl_username')); $bl_username = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_username'));
$bl_password = xmlify(PConfig::get($b['uid'], 'blogger', 'bl_password')); $bl_password = XML::escape(PConfig::get($b['uid'], 'blogger', 'bl_password'));
$bl_blog = PConfig::get($b['uid'], 'blogger', 'bl_blog'); $bl_blog = PConfig::get($b['uid'], 'blogger', 'bl_blog');
if ($bl_username && $bl_password && $bl_blog) { if ($bl_username && $bl_password && $bl_blog) {
$title = '<title>' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . '</title>'; $title = '<title>' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . '</title>';
$post = $title . BBCode::convert($b['body']); $post = $title . BBCode::convert($b['body']);
$post = xmlify($post); $post = XML::escape($post);
$xml = <<< EOT $xml = <<< EOT
<?xml version=\"1.0\" encoding=\"utf-8\"?> <?xml version=\"1.0\" encoding=\"utf-8\"?>

View file

@ -17,6 +17,7 @@ use Friendica\Core\PConfig;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML;
function dwpost_install() function dwpost_install()
{ {
@ -189,7 +190,7 @@ function dwpost_send(App $a, array &$b)
if ($dw_username && $dw_password && $dw_blog) { if ($dw_username && $dw_password && $dw_blog) {
$title = $b['title']; $title = $b['title'];
$post = BBCode::convert($b['body']); $post = BBCode::convert($b['body']);
$post = xmlify($post); $post = XML::escape($post);
$tags = dwpost_get_tags($b['tag']); $tags = dwpost_get_tags($b['tag']);
$date = DateTimeFormat::convert($b['created'], $tz); $date = DateTimeFormat::convert($b['created'], $tz);

View file

@ -15,6 +15,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML;
function ijpost_install() function ijpost_install()
{ {
@ -185,7 +186,7 @@ function ijpost_send(&$a, &$b)
if ($ij_username && $ij_password && $ij_blog) { if ($ij_username && $ij_password && $ij_blog) {
$title = $b['title']; $title = $b['title'];
$post = BBCode::convert($b['body']); $post = BBCode::convert($b['body']);
$post = xmlify($post); $post = XML::escape($post);
$tags = ijpost_get_tags($b['tag']); $tags = ijpost_get_tags($b['tag']);
$date = DateTimeFormat::convert($b['created'], $tz); $date = DateTimeFormat::convert($b['created'], $tz);

View file

@ -15,6 +15,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML;
function ljpost_install() { function ljpost_install() {
Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local'); Addon::registerHook('post_local', 'addon/ljpost/ljpost.php', 'ljpost_post_local');
@ -169,20 +170,20 @@ function ljpost_send(&$a,&$b) {
if($x && strlen($x[0]['timezone'])) if($x && strlen($x[0]['timezone']))
$tz = $x[0]['timezone']; $tz = $x[0]['timezone'];
$lj_username = xmlify(PConfig::get($b['uid'],'ljpost','lj_username')); $lj_username = XML::escape(PConfig::get($b['uid'],'ljpost','lj_username'));
$lj_password = xmlify(PConfig::get($b['uid'],'ljpost','lj_password')); $lj_password = XML::escape(PConfig::get($b['uid'],'ljpost','lj_password'));
$lj_journal = xmlify(PConfig::get($b['uid'],'ljpost','lj_journal')); $lj_journal = XML::escape(PConfig::get($b['uid'],'ljpost','lj_journal'));
// if(! $lj_journal) // if(! $lj_journal)
// $lj_journal = $lj_username; // $lj_journal = $lj_username;
$lj_blog = xmlify(PConfig::get($b['uid'],'ljpost','lj_blog')); $lj_blog = XML::escape(PConfig::get($b['uid'],'ljpost','lj_blog'));
if(! strlen($lj_blog)) if(! strlen($lj_blog))
$lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc'); $lj_blog = XML::escape('http://www.livejournal.com/interface/xmlrpc');
if($lj_username && $lj_password && $lj_blog) { if($lj_username && $lj_password && $lj_blog) {
$title = xmlify($b['title']); $title = XML::escape($b['title']);
$post = BBCode::convert($b['body']); $post = BBCode::convert($b['body']);
$post = xmlify($post); $post = XML::escape($post);
$tags = ljpost_get_tags($b['tag']); $tags = ljpost_get_tags($b['tag']);
$date = DateTimeFormat::convert($b['created'], $tz); $date = DateTimeFormat::convert($b['created'], $tz);

View file

@ -25,6 +25,7 @@ use Friendica\Model\Queue;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML;
require 'addon/pumpio/oauth/http.php'; require 'addon/pumpio/oauth/http.php';
require 'addon/pumpio/oauth/oauth_client.php'; require 'addon/pumpio/oauth/oauth_client.php';
@ -981,7 +982,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion =
$likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink);
$likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' . $likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>'; '<id>' . $orig_post['uri'] . '</id><link>' . XML::escape('<link rel="alternate" type="text/html" href="' . XML::escape($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
$ret = Item::insert($likedata); $ret = Item::insert($likedata);

View file

@ -20,6 +20,7 @@
use Friendica\Core\Addon; use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Util\XML;
function qcomment_install() { function qcomment_install() {
Addon::registerHook('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings'); Addon::registerHook('addon_settings', 'addon/qcomment/qcomment.php', 'qcomment_addon_settings');
@ -50,7 +51,7 @@ function qcomment_addon_settings(&$a, &$s)
$s .= '<div id="qcomment-wrapper">'; $s .= '<div id="qcomment-wrapper">';
$s .= '<div id="qcomment-desc">' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '</div>'; $s .= '<div id="qcomment-desc">' . L10n::t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.") . '</div>';
$s .= '<label id="qcomment-label" for="qcomment-words">' . L10n::t('Enter quick comments, one per line') . ' </label>'; $s .= '<label id="qcomment-label" for="qcomment-words">' . L10n::t('Enter quick comments, one per line') . ' </label>';
$s .= '<textarea id="qcomment-words" type="text" name="qcomment-words" >' . htmlspecialchars(unxmlify($words)) . '</textarea>'; $s .= '<textarea id="qcomment-words" type="text" name="qcomment-words" >' . htmlspecialchars(XML::unescape($words)) . '</textarea>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="qcomment-submit" name="qcomment-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>'; $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="qcomment-submit" name="qcomment-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
@ -59,13 +60,14 @@ function qcomment_addon_settings(&$a, &$s)
return; return;
} }
function qcomment_addon_settings_post(&$a,&$b) { function qcomment_addon_settings_post(&$a, &$b)
{
if(! local_user()) if (! local_user()) {
return; return;
}
if ($_POST['qcomment-submit']) { if ($_POST['qcomment-submit']) {
PConfig::set(local_user(),'qcomment','words',xmlify($_POST['qcomment-words'])); PConfig::set(local_user(), 'qcomment', 'words', XML::escape($_POST['qcomment-words']));
info(L10n::t('Quick Comment settings saved.') . EOL); info(L10n::t('Quick Comment settings saved.') . EOL);
} }
} }

View file

@ -14,6 +14,7 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML;
function wppost_install() { function wppost_install() {
Addon::registerHook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local'); Addon::registerHook('post_local', 'addon/wppost/wppost.php', 'wppost_post_local');
@ -216,8 +217,8 @@ function wppost_send(&$a,&$b) {
return; return;
} }
$wp_username = xmlify(PConfig::get($b['uid'],'wppost','wp_username')); $wp_username = XML::(PConfig::get($b['uid'], 'wppost', 'wp_username'));
$wp_password = xmlify(PConfig::get($b['uid'],'wppost','wp_password')); $wp_password = XML::escape(PConfig::get($b['uid'], 'wppost',' wp_password'));
$wp_blog = PConfig::get($b['uid'],'wppost','wp_blog'); $wp_blog = PConfig::get($b['uid'],'wppost','wp_blog');
$wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text'); $wp_backlink_text = PConfig::get($b['uid'],'wppost','wp_backlink_text');
if ($wp_backlink_text == '') { if ($wp_backlink_text == '') {
@ -294,7 +295,7 @@ function wppost_send(&$a,&$b) {
. $wp_backlink_text . '</a>' . EOL . EOL; . $wp_backlink_text . '</a>' . EOL . EOL;
} }
$post = xmlify($post); $post = XML::escape($post);
$xml = <<< EOT $xml = <<< EOT