diff --git a/autoload/class.S.php b/autoload/class.S.php
index 38927e0..6ee55f3 100644
--- a/autoload/class.S.php
+++ b/autoload/class.S.php
@@ -1,6 +1,68 @@
]*)>/i',
+ function ($matches) {
+ $tag = $matches[1];
+ $attrs = $matches[2];
+
+ // Znajdź tylko atrybut "style"
+ preg_match('/\sstyle\s*=\s*("[^"]*"|\'[^\']*\'|[^"\'>\s]+)/i', $attrs, $styleMatch);
+ $style = isset($styleMatch[0]) ? ' ' . $styleMatch[0] : '';
+
+ return "<$tag$style>";
+ },
+ $html
+ );
+ }
+
+ static public function strip_attributes_except_style_and_clean_font($html) {
+ return preg_replace_callback(
+ '/<([a-z0-9]+)([^>]*)>/i',
+ function ($matches) {
+ $tag = $matches[1];
+ $attrs = $matches[2];
+
+ // Wyciągnij styl
+ preg_match('/\sstyle\s*=\s*("[^"]*"|\'[^\']*\'|[^"\'>\s]+)/i', $attrs, $styleMatch);
+ $style = '';
+
+ if (isset($styleMatch[1])) {
+ $rawStyle = trim($styleMatch[1], '\'"'); // bez cudzysłowów
+
+ // usuń font-family (również z fallbackami np. Arial, sans-serif)
+ $filtered = [];
+ foreach (explode(';', $rawStyle) as $rule) {
+ if (stripos(trim($rule), 'font-family') !== 0) {
+ $filtered[] = trim($rule);
+ }
+ }
+
+ if (!empty($filtered)) {
+ $style = ' style="' . implode('; ', $filtered) . '"';
+ }
+ }
+
+ return "<$tag$style>";
+ },
+ $html
+ );
+ }
+
+ static public function clear_advert_text( $text )
+ {
+ $text = preg_replace('##is', '', $text);
+ $text = preg_replace('##is', '', $text);
+ $text = preg_replace('/on\w+="[^"]*"/i', '', $text);
+ $text = preg_replace("/on\w+='[^']*'/i", '', $text);
+ $text = preg_replace('/(href|src)\s*=\s*["\']\s*javascript:[^"\']*["\']/i', '', $text);
+ $text = self::strip_attributes_except_style($text);
+ $text = self::strip_attributes_except_style_and_clean_font($text);
+ return $text;
+ }
+
static public function strpos_arr( $haystack, $needle )
{
if (!is_array($needle)) $needle = array($needle);
diff --git a/autoload/front/factory/class.GlobelusFirms.php b/autoload/front/factory/class.GlobelusFirms.php
index 35eea18..a22e3a1 100644
--- a/autoload/front/factory/class.GlobelusFirms.php
+++ b/autoload/front/factory/class.GlobelusFirms.php
@@ -1067,7 +1067,7 @@ class GlobelusFirms
'id_position' => $id_position ? $id_position : null,
'city' => $values['city'],
'region' => $values['region'],
- 'text' => $values['text'],
+ 'text' => \S::clear_advert_text( $values['text'] ),
'contact_person' => $values['contact_person'],
'email' => $values['email'],
'phone' => $values['phone'],
@@ -1104,7 +1104,7 @@ class GlobelusFirms
'id_position' => $id_position ? $id_position : null,
'city' => $values['city'],
'region' => $values['region'],
- 'text' => $values['text'],
+ 'text' => \S::clear_advert_text( $values['text'] ),
'contact_person' => $values['contact_person'],
'email' => $values['email'],
'phone' => $values['phone'],
diff --git a/templates_user/globelus/adverts/advert-details.php b/templates_user/globelus/adverts/advert-details.php
index 4c7273e..24d1a15 100644
--- a/templates_user/globelus/adverts/advert-details.php
+++ b/templates_user/globelus/adverts/advert-details.php
@@ -169,7 +169,7 @@
?>
- $text = $this->advert['text'];
+ $text = $this -> advert['text'];
if (!$this->g_user) :
$text = preg_replace('/[a-z0-9_\-\+\.]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i', '
Zaloguj się aby zobaczyć adres email ', $text);
$text = preg_replace(
@@ -178,6 +178,7 @@
$text
);
endif;
+ $text = \S::clear_advert_text( $text );
echo $text;
?>
diff --git a/templates_user/globelus/adverts/last-adverts.php b/templates_user/globelus/adverts/last-adverts.php
index 9568239..0bd1125 100644
--- a/templates_user/globelus/adverts/last-adverts.php
+++ b/templates_user/globelus/adverts/last-adverts.php
@@ -40,9 +40,9 @@
endif;?>
-
+
- = mb_substr( strip_tags( $advert['text'] ), 0, 100, 'UTF-8' );?>...
+ = mb_substr( strip_tags( \S::clear_advert_text( $advert['text'] ) ), 0, 100, 'UTF-8' );?>...
diff --git a/templates_user/globelus/adverts/main-page-adverts.php b/templates_user/globelus/adverts/main-page-adverts.php
index b0ae503..0bd1125 100644
--- a/templates_user/globelus/adverts/main-page-adverts.php
+++ b/templates_user/globelus/adverts/main-page-adverts.php
@@ -42,7 +42,7 @@
- = mb_substr( strip_tags( $advert['text'] ), 0, 100, 'UTF-8' );?>...
+ = mb_substr( strip_tags( \S::clear_advert_text( $advert['text'] ) ), 0, 100, 'UTF-8' );?>...
diff --git a/templates_user/globelus/candidates/adverts-list.php b/templates_user/globelus/candidates/adverts-list.php
index b499bab..7da40c6 100644
--- a/templates_user/globelus/candidates/adverts-list.php
+++ b/templates_user/globelus/candidates/adverts-list.php
@@ -55,7 +55,7 @@
= $advert['country'];?> - = $advert['city'];?> | = $advert['firm_name_profile'];?> | = $advert['category'];?>
- = mb_substr( strip_tags( $advert['text'] ), 0, 150, 'UTF-8' );?>...
+ = mb_substr( strip_tags( \S::clear_advert_text( $advert['text'] ) ), 0, 150, 'UTF-8' );?>...
= $lang['szczegoly-oferty'];?>
diff --git a/templates_user/globelus/cv/cv-list.php b/templates_user/globelus/cv/cv-list.php
index bfb7524..855acc3 100644
--- a/templates_user/globelus/cv/cv-list.php
+++ b/templates_user/globelus/cv/cv-list.php
@@ -143,7 +143,7 @@
= $cv['sex'] ? $lang['ostatnio-szukal-pracy'] : $lang['ostatnio-szukala-pracy'];?>: = $cv['last_refresh'] ? date( 'Y-m-d', strtotime( $cv['last_refresh'] ) ) : date( 'Y-m-d', strtotime( $cv['register_date'] ) );?>
- = $advert['short_text'];?>
+ = \S::clear_advert_text( $advert['short_text'] );?>
= $lang['profil-kandydata'];?>
diff --git a/templates_user/globelus/firms/firm-profile.php b/templates_user/globelus/firms/firm-profile.php
index ce48731..26c9d42 100644
--- a/templates_user/globelus/firms/firm-profile.php
+++ b/templates_user/globelus/firms/firm-profile.php
@@ -182,7 +182,7 @@
= $advert['country'];?> - = $advert['city'];?> | = $advert['firm_name_profile'];?> | = $advert['category'];?>
- = mb_substr( strip_tags( $advert['text'] ), 0, 150, 'UTF-8' );?>...
+ = mb_substr( strip_tags( \S::clear_advert_text( $advert['text'] ) ), 0, 150, 'UTF-8' );?>...
= $lang['szczegoly-oferty'];?>
diff --git a/templates_user/globelus/firms/followed-candidates.php b/templates_user/globelus/firms/followed-candidates.php
index 0c7b71d..e004253 100644
--- a/templates_user/globelus/firms/followed-candidates.php
+++ b/templates_user/globelus/firms/followed-candidates.php
@@ -43,7 +43,7 @@
= $lang['tel.'];?> = $candidate['phone'];?> | = $lang['email'];?>: = $candidate['email'];?>
- = $advert['short_text'];?>
+ = \S::clear_advert_text( $advert['short_text'] );?>
= $lang['profil-kandydata'];?>
diff --git a/templates_user/globelus/firms/proposed-candidates.php b/templates_user/globelus/firms/proposed-candidates.php
index 9924790..18d34a2 100644
--- a/templates_user/globelus/firms/proposed-candidates.php
+++ b/templates_user/globelus/firms/proposed-candidates.php
@@ -69,7 +69,7 @@
= $candidate['sex'] ? $lang['ostatnio-szukal-pracy'] : $lang['ostatnio-szukala-pracy'];?>: = $candidate['last_refresh'] ? date( 'Y-m-d', strtotime( $candidate['last_refresh'] ) ) : date( 'Y-m-d', strtotime( $candidate['register_date'] ) );?>
- = $advert['short_text'];?>
+ = \S::clear_advert_text( $advert['short_text'] );?>
= $lang['profil-kandydata'];?>