X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=src%2FModel%2FEvent.php;h=3ce86017ba99028203aeb946a09c1a70bbe530cb;hb=08da1ed038c9b193ded0ca70b3b1c1085bb7e90a;hp=e6ed20f72cb4e77cff497050078ef16ad242207b;hpb=50da89d861dce3b648c8f9e5c1e4c480ee320a43;p=friendica.git
diff --git a/src/Model/Event.php b/src/Model/Event.php
index e6ed20f72c..3ce86017ba 100644
--- a/src/Model/Event.php
+++ b/src/Model/Event.php
@@ -7,19 +7,17 @@ namespace Friendica\Model;
use Friendica\BaseObject;
use Friendica\Content\Text\BBCode;
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
+use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
-use Friendica\Model\Contact;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map;
-
-require_once 'boot.php';
-require_once 'include/dba.php';
-require_once 'include/items.php';
+use Friendica\Util\Strings;
+use Friendica\Util\XML;
/**
* @brief functions for interacting with the event database table
@@ -35,13 +33,13 @@ class Event extends BaseObject
$bd_format = L10n::t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM.
- $event_start = day_translate(
+ $event_start = L10n::getDay(
!empty($event['adjust']) ?
DateTimeFormat::local($event['start'], $bd_format) : DateTimeFormat::utc($event['start'], $bd_format)
);
if (!empty($event['finish'])) {
- $event_end = day_translate(
+ $event_end = L10n::getDay(
!empty($event['adjust']) ?
DateTimeFormat::local($event['finish'], $bd_format) : DateTimeFormat::utc($event['finish'], $bd_format)
);
@@ -50,12 +48,14 @@ class Event extends BaseObject
}
if ($simple) {
+ $o = '';
+
if (!empty($event['summary'])) {
- $o = "
" . BBCode::convert($event['summary'], false, $simple) . "
";
+ $o .= "" . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . "
";
}
if (!empty($event['desc'])) {
- $o .= "" . BBCode::convert($event['desc'], false, $simple) . "
";
+ $o .= "" . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . "
";
}
$o .= "" . L10n::t('Starts:') . "
" . $event_start . "
";
@@ -65,7 +65,7 @@ class Event extends BaseObject
}
if (!empty($event['location'])) {
- $o .= "" . L10n::t('Location:') . "
" . BBCode::convert($event['location'], false, $simple) . "
";
+ $o .= "" . L10n::t('Location:') . "
" . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple) . "
";
}
return $o;
@@ -73,7 +73,7 @@ class Event extends BaseObject
$o = '' . "\r\n";
- $o .= '
' . BBCode::convert($event['summary'], false, $simple) . '
' . "\r\n";
+ $o .= '
' . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . '
' . "\r\n";
$o .= '
' . L10n::t('Starts:') . ' ' . BBCode::convert($event['desc'], false, $simple) . '
' . "\r\n";
+ $o .= '
' . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . '
' . "\r\n";
}
if (!empty($event['location'])) {
$o .= '
' . L10n::t('Location:') . ' '
- . BBCode::convert($event['location'], false, $simple)
+ . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple)
. '
' . "\r\n";
// Include a map of the location if the [map] BBCode is used.
@@ -150,6 +150,7 @@ class Event extends BaseObject
* @brief Extract bbcode formatted event data from a string.
*
* @params: string $s The string which should be parsed for event data.
+ * @param $text
* @return array The array with the event information.
*/
public static function fromBBCode($text)
@@ -217,6 +218,7 @@ class Event extends BaseObject
*
* @param int $event_id Event ID.
* @return void
+ * @throws \Exception
*/
public static function delete($event_id)
{
@@ -235,11 +237,10 @@ class Event extends BaseObject
*
* @param array $arr Array with event data.
* @return int The new event id.
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function store($arr)
{
- $a = self::getApp();
-
$event = [];
$event['id'] = intval(defaults($arr, 'id' , 0));
$event['uid'] = intval(defaults($arr, 'uid' , 0));
@@ -301,8 +302,8 @@ class Event extends BaseObject
$item = Item::selectFirst(['id'], ['event-id' => $event['id'], 'uid' => $event['uid']]);
if (DBA::isResult($item)) {
- $object = '