Fixed xss on social buttons
This commit is contained in:
parent
ca0d973a24
commit
d240ceb345
2 changed files with 9 additions and 2 deletions
|
@ -30,6 +30,12 @@ class Sanitize {
|
|||
return htmlspecialchars_decode($text, $flags);
|
||||
}
|
||||
|
||||
// Remove javacript from links
|
||||
public static function noJSLink($text)
|
||||
{
|
||||
return preg_replace("/javascript\s*:\s*/", "", $text);
|
||||
}
|
||||
|
||||
public static function pathFile($path, $file=false)
|
||||
{
|
||||
if ($file!==false){
|
||||
|
@ -81,4 +87,4 @@ class Sanitize {
|
|||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ class Site extends dbJSON {
|
|||
foreach ($this->dbFields as $field=>$value) {
|
||||
if (isset($args[$field])) {
|
||||
$finalValue = Sanitize::html($args[$field]);
|
||||
$finalValue = Sanitize::noJSLink($args[$field]);
|
||||
if ($finalValue==='false') { $finalValue = false; }
|
||||
elseif ($finalValue==='true') { $finalValue = true; }
|
||||
settype($finalValue, gettype($value));
|
||||
|
@ -414,4 +415,4 @@ class Site extends dbJSON {
|
|||
return json_decode($customFields, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue