code
stringlengths 14
2.05k
| label
int64 0
1
| programming_language
stringclasses 7
values | cwe_id
stringlengths 6
14
| cwe_name
stringlengths 5
98
⌀ | description
stringlengths 36
379
⌀ | url
stringlengths 36
48
⌀ | label_name
stringclasses 2
values |
---|---|---|---|---|---|---|---|
public function resizeImage($source_file, $size){
$dest_dir = $this->getUploadDestinationDirectory();
$dest_ext = pathinfo($source_file, PATHINFO_EXTENSION);
$dest_name = $this->getFileName($dest_dir, $dest_ext);
$dest_file = $dest_dir . $dest_name;
if (!isset($size['height'])) { $size['height'] = 0; }
if (!isset($size['quality'])) { $size['quality'] = 90; }
if (img_resize($source_file, $dest_file, $size['width'], $size['height'], $size['is_square'], $size['quality'])) {
return str_replace($this->site_cfg->upload_path, '', $dest_file);
}
return false;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function moveUploadedFile($source, $destination, $errorCode, $orig_name='', $orig_size=0){
if($errorCode !== UPLOAD_ERR_OK && isset($this->upload_errors[$errorCode])){
return array(
'success' => false,
'error' => $this->upload_errors[$errorCode],
'name' => $orig_name,
'path' => ''
);
}
$upload_dir = dirname($destination);
if (!is_writable($upload_dir)){ @chmod($upload_dir, 0777); }
if (!is_writable($upload_dir)){
return array(
'success' => false,
'error' => LANG_UPLOAD_ERR_CANT_WRITE,
'name' => $orig_name,
'path' => ''
);
}
return array(
'success' => @move_uploaded_file($source, $destination),
'path' => $destination,
'url' => str_replace($this->site_cfg->upload_path, '', $destination),
'name' => basename($destination),
'size' => $orig_size,
'error' => $this->upload_errors[$errorCode]
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function isUploadedXHR($name){
return !empty($_GET['qqfile']);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function setUserId($id) {
$this->user_id = $id; return $this;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function uploadXHR($post_filename, $allowed_ext = false, $allowed_size = 0, $destination = false){
$dest_name = files_sanitize_name($_GET['qqfile'], false);
$dest_ext = pathinfo($dest_name, PATHINFO_EXTENSION);
if(!$this->checkExt($dest_ext, $allowed_ext)){
return array(
'error' => LANG_UPLOAD_ERR_MIME,
'success' => false,
'name' => $dest_name
);
}
if ($allowed_size){
if ($this->getXHRFileSize() > $allowed_size){
return array(
'error' => sprintf(LANG_UPLOAD_ERR_INI_SIZE, files_format_bytes($allowed_size)),
'success' => false,
'name' => $dest_name
);
}
}
if (!$destination){
$destination = $this->getUploadDestinationDirectory();
} else {
$destination = $this->site_cfg->upload_path . $destination . '/';
}
$destination .= $this->getFileName($destination, $dest_ext);
return $this->saveXHRFile($destination, $dest_name);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$aext = mb_strtolower(trim(trim((string)$aext, '., '))); | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function uploadForm($post_filename, $allowed_ext = false, $allowed_size = 0, $destination = false){
$source = $_FILES[$post_filename]['tmp_name'];
$error_code = $_FILES[$post_filename]['error'];
$dest_size = (int)$_FILES[$post_filename]['size'];
$dest_name = files_sanitize_name($_FILES[$post_filename]['name']);
$dest_ext = pathinfo($dest_name, PATHINFO_EXTENSION);
if(!$this->checkExt($dest_ext, $allowed_ext)){
return array(
'error' => LANG_UPLOAD_ERR_MIME,
'success' => false,
'name' => $dest_name
);
}
if($this->allowed_mime !== false){
if(!$this->isMimeTypeAllowed($source)){
return array(
'error' => LANG_UPLOAD_ERR_MIME.'. '.sprintf(LANG_PARSER_FILE_EXTS_FIELD_HINT, implode(', ', $this->allowed_mime_ext)),
'success' => false,
'name' => $dest_name
);
}
}
if ($allowed_size){
if ($dest_size > $allowed_size){
return array(
'error' => sprintf(LANG_UPLOAD_ERR_INI_SIZE, files_format_bytes($allowed_size)),
'success' => false,
'name' => $dest_name
);
}
}
if (!$destination){
$destination = $this->getUploadDestinationDirectory();
} else {
$destination = $this->site_cfg->upload_path . $destination . '/';
}
if (!$this->file_name) {
$this->file_name = pathinfo($dest_name, PATHINFO_FILENAME);
}
$destination .= $this->getFileName($destination, $dest_ext);
return $this->moveUploadedFile($source, $destination, $error_code, $dest_name, $dest_size);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function setAllowedMime($types) {
$this->allowed_mime = $types;
$mime_types = (new cmsConfigs('mimetypes.php'))->getAll();
foreach ($this->allowed_mime as $mime) {
if(isset($mime_types[$mime])){
$this->allowed_mime_ext[] = $mime_types[$mime];
}
}
return $this;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function disableRemoteUpload() {
$this->allow_remote = false; return $this;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function isMimeTypeAllowed($file_path) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$file_mime = finfo_file($finfo, $file_path);
if($file_mime === false){ return false; }
return in_array($file_mime, $this->allowed_mime);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function isUploadedFromLink($name){
return $this->allow_remote && !empty($_POST[$name]);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function getMaxUploadSize(){
// вычисляем по тому, что меньше, т.к. если post_max_size меньше upload_max_filesize,
// то максимум можно будет загрузить post_max_size
$max_size = min(files_convert_bytes(@ini_get('upload_max_filesize')), files_convert_bytes(@ini_get('post_max_size')));
return files_format_bytes($max_size);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function upload($post_filename, $allowed_ext = false, $allowed_size = 0, $destination = false){
if ($this->isUploadedFromLink($post_filename)){
return $this->uploadFromLink($post_filename, $allowed_ext, $allowed_size, $destination);
}
if ($this->isUploadedXHR($post_filename)){
return $this->uploadXHR($post_filename, $allowed_ext, $allowed_size, $destination);
}
if ($this->isUploaded($post_filename)){
return $this->uploadForm($post_filename, $allowed_ext, $allowed_size, $destination);
}
$last_error = $this->getLastError();
return array(
'success' => false,
'error' => ($last_error ? $last_error : LANG_UPLOAD_ERR_NO_FILE)
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function isUploaded($name){
if (!isset($_FILES[$name])) { return false; }
if (empty($_FILES[$name]['size'])) {
if(isset($_FILES[$name]['error'])){
if(isset($this->upload_errors[$_FILES[$name]['error']]) && $this->upload_errors[$_FILES[$name]['error']] !== UPLOAD_ERR_OK){
$this->last_error = $this->upload_errors[$_FILES[$name]['error']];
}
}
return false;
}
return true;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function __construct() {
$this->upload_errors = array(
UPLOAD_ERR_OK => LANG_UPLOAD_ERR_OK,
UPLOAD_ERR_INI_SIZE => sprintf(LANG_UPLOAD_ERR_INI_SIZE, $this->getMaxUploadSize()),
UPLOAD_ERR_FORM_SIZE => LANG_UPLOAD_ERR_FORM_SIZE,
UPLOAD_ERR_PARTIAL => LANG_UPLOAD_ERR_PARTIAL,
UPLOAD_ERR_NO_FILE => LANG_UPLOAD_ERR_NO_FILE,
UPLOAD_ERR_NO_TMP_DIR => LANG_UPLOAD_ERR_NO_TMP_DIR,
UPLOAD_ERR_CANT_WRITE => LANG_UPLOAD_ERR_CANT_WRITE,
UPLOAD_ERR_EXTENSION => LANG_UPLOAD_ERR_EXTENSION
);
$this->user_id = cmsUser::getInstance()->id;
$this->site_cfg = cmsConfig::getInstance();
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function file_save_from_url($url, $destination){
if (!function_exists('curl_init')){ return false; }
$dest_file = @fopen($destination, "w");
$curl = curl_init();
if(strpos($url, 'https') === 0){
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FILE, $dest_file);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_exec($curl);
curl_close($curl);
fclose($dest_file);
return true;
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function getProfileEditMenu($profile) {
$menu = [];
$menu[] = [
'title' => LANG_USERS_EDIT_PROFILE_MAIN,
'url' => href_to_profile($profile, ['edit'])
];
if ($this->cms_template->hasProfileThemesOptions() && $this->options['is_themes_on']) {
$menu[] = [
'title' => LANG_USERS_EDIT_PROFILE_THEME,
'url' => href_to_profile($profile, ['edit', 'theme'])
];
}
if (cmsEventsManager::getEventListeners('user_notify_types')) {
$menu[] = [
'title' => LANG_USERS_EDIT_PROFILE_NOTICES,
'url' => href_to_profile($profile, ['edit', 'notices'])
];
}
if (!empty($this->options['is_friends_on'])) {
$menu[] = [
'title' => LANG_USERS_EDIT_PROFILE_PRIVACY,
'url' => href_to_profile($profile, ['edit', 'privacy'])
];
}
$menu[] = [
'title' => LANG_SECURITY,
'url' => href_to_profile($profile, ['edit', 'password'])
];
$menu[] = [
'title' => LANG_USERS_SESSIONS,
'url' => href_to_profile($profile, ['edit', 'sessions'])
];
list($menu, $profile) = cmsEventsManager::hook('profile_edit_menu', [$menu, $profile]);
return $menu;
} | 0 | PHP | CWE-284 | Improper Access Control | The product does not restrict or incorrectly restricts access to a resource from an unauthorized actor. | https://cwe.mitre.org/data/definitions/284.html | vulnerable |
public static function setCookie($key, $value, $time = 3600, $path = '/', $http_only = true, $domain = '') {
$cookie_domain = cmsConfig::get('cookie_domain');
if (!$domain && $cookie_domain) {
$domain = $cookie_domain;
}
if (PHP_VERSION_ID < 70300) {
return setcookie('icms[' . $key . ']', $value, time() + $time, $path, $domain, false, $http_only);
} else {
return setcookie('icms[' . $key . ']', $value, [
'expires' => time() + $time,
'path' => $path,
'domain' => $domain,
'samesite' => 'Lax',
'secure' => false,
'httponly' => $http_only
]);
}
} | 0 | PHP | CWE-384 | Session Fixation | Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions. | https://cwe.mitre.org/data/definitions/384.html | vulnerable |
public static function setCookie($key, $value, $time = 3600, $path = '/', $http_only = true, $domain = '') {
$cookie_domain = cmsConfig::get('cookie_domain');
if (!$domain && $cookie_domain) {
$domain = $cookie_domain;
}
if (PHP_VERSION_ID < 70300) {
return setcookie('icms[' . $key . ']', $value, time() + $time, $path, $domain, false, $http_only);
} else {
return setcookie('icms[' . $key . ']', $value, [
'expires' => time() + $time,
'path' => $path,
'domain' => $domain,
'samesite' => 'Lax',
'secure' => false,
'httponly' => $http_only
]);
}
} | 0 | PHP | CWE-614 | Sensitive Cookie in HTTPS Session Without 'Secure' Attribute | The Secure attribute for sensitive cookies in HTTPS sessions is not set, which could cause the user agent to send those cookies in plaintext over an HTTP session. | https://cwe.mitre.org/data/definitions/614.html | vulnerable |
$user = cmsCore::getModel('users')->getUserByAuth($profile['email'], $value);
if (!$user){
return LANG_OLD_PASS_INCORRECT;
}
return true;
})
)
)), | 0 | PHP | NVD-CWE-Other | Other | NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset. | https://nvd.nist.gov/vuln/categories | vulnerable |
$user = cmsCore::getModel('users')->getUserByAuth($profile['email'], $value);
if (!$user){
return LANG_OLD_PASS_INCORRECT;
}
return true;
})
)
)),
new fieldString('password1', array(
'title' => LANG_NEW_PASS,
'is_password' => true,
'options'=>array(
'min_length'=> 6,
'max_length'=> 72
)
)),
new fieldString('password2', array(
'title' => LANG_RETYPE_NEW_PASS,
'is_password' => true,
'options'=>array(
'min_length'=> 6,
'max_length'=> 72
)
))
)
) | 0 | PHP | NVD-CWE-Other | Other | NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset. | https://nvd.nist.gov/vuln/categories | vulnerable |
public function uploadForm($filename, $allowed_size = 0, $destination = false) {
$source = $_FILES[$filename]['tmp_name'];
$error_code = $_FILES[$filename]['error'];
$dest_size = (int) $_FILES[$filename]['size'];
$dest_name = files_sanitize_name($_FILES[$filename]['name']);
$file = new cmsUploadfile($source, $this->allowed_mime);
if (!$file->isAllowed()) {
return [
'error' => LANG_UPLOAD_ERR_MIME . '. ' . sprintf(LANG_PARSER_FILE_EXTS_FIELD_HINT, implode(', ', $this->allowed_mime_ext)),
'success' => false,
'name' => $dest_name
];
}
if ($allowed_size) {
if ($dest_size > $allowed_size) {
return [
'error' => sprintf(LANG_UPLOAD_ERR_INI_SIZE, files_format_bytes($allowed_size)),
'success' => false,
'name' => $dest_name
];
}
}
$dest_ext = $file->getExt();
if (!$destination) {
$destination = $this->getUploadDestinationDirectory();
} else {
$destination = $this->site_cfg->upload_path . $destination . '/';
}
if (!$this->file_name) {
$this->file_name = pathinfo($dest_name, PATHINFO_FILENAME);
}
$destination .= $this->getFileName($destination, $dest_ext);
return $this->moveUploadedFile($source, $destination, $error_code, $dest_name, $dest_size);
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function uploadForm($filename, $allowed_size = 0, $destination = false) {
$source = $_FILES[$filename]['tmp_name'];
$error_code = $_FILES[$filename]['error'];
$dest_size = (int) $_FILES[$filename]['size'];
$dest_name = files_sanitize_name($_FILES[$filename]['name']);
$file = new cmsUploadfile($source, $this->allowed_mime);
if (!$file->isAllowed()) {
return [
'error' => LANG_UPLOAD_ERR_MIME . '. ' . sprintf(LANG_PARSER_FILE_EXTS_FIELD_HINT, implode(', ', $this->allowed_mime_ext)),
'success' => false,
'name' => $dest_name
];
}
if ($allowed_size) {
if ($dest_size > $allowed_size) {
return [
'error' => sprintf(LANG_UPLOAD_ERR_INI_SIZE, files_format_bytes($allowed_size)),
'success' => false,
'name' => $dest_name
];
}
}
$dest_ext = $file->getExt();
if (!$destination) {
$destination = $this->getUploadDestinationDirectory();
} else {
$destination = $this->site_cfg->upload_path . $destination . '/';
}
if (!$this->file_name) {
$this->file_name = pathinfo($dest_name, PATHINFO_FILENAME);
}
$destination .= $this->getFileName($destination, $dest_ext);
return $this->moveUploadedFile($source, $destination, $error_code, $dest_name, $dest_size);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function saveFileFromString($file_bin, $allowed_size, $destination, $dest_name) {
$file = new cmsUploadfile($file_bin, $this->allowed_mime);
if (!$file->isAllowed()) {
return [
'error' => LANG_UPLOAD_ERR_MIME . '. ' . sprintf(LANG_PARSER_FILE_EXTS_FIELD_HINT, implode(', ', $this->allowed_mime_ext)),
'success' => false,
'name' => $dest_name
];
}
$dest_ext = $file->getExt();
$file_size = strlen($file_bin);
if ($allowed_size) {
if ($file_size > $allowed_size) {
return [
'error' => sprintf(LANG_UPLOAD_ERR_INI_SIZE, files_format_bytes($allowed_size)),
'success' => false,
'name' => $dest_name
];
}
}
if (!$destination) {
$destination = $this->getUploadDestinationDirectory();
} else {
$destination = $this->site_cfg->upload_path . $destination . '/';
}
$destination .= $this->getFileName($destination, $dest_ext);
if (!is_writable(dirname($destination))) {
return [
'success' => false,
'error' => LANG_UPLOAD_ERR_CANT_WRITE,
'name' => $dest_name,
'path' => ''
];
}
if(file_put_contents($destination, $file_bin) === false){
return [
'success' => false,
'error' => LANG_UPLOAD_ERR_CANT_WRITE,
'name' => $dest_name,
'path' => ''
];
}
return [
'success' => true,
'path' => $destination,
'url' => str_replace($this->site_cfg->upload_path, '', $destination),
'name' => basename($destination),
'size' => $file_size
];
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
private function saveFileFromString($file_bin, $allowed_size, $destination, $dest_name) {
$file = new cmsUploadfile($file_bin, $this->allowed_mime);
if (!$file->isAllowed()) {
return [
'error' => LANG_UPLOAD_ERR_MIME . '. ' . sprintf(LANG_PARSER_FILE_EXTS_FIELD_HINT, implode(', ', $this->allowed_mime_ext)),
'success' => false,
'name' => $dest_name
];
}
$dest_ext = $file->getExt();
$file_size = strlen($file_bin);
if ($allowed_size) {
if ($file_size > $allowed_size) {
return [
'error' => sprintf(LANG_UPLOAD_ERR_INI_SIZE, files_format_bytes($allowed_size)),
'success' => false,
'name' => $dest_name
];
}
}
if (!$destination) {
$destination = $this->getUploadDestinationDirectory();
} else {
$destination = $this->site_cfg->upload_path . $destination . '/';
}
$destination .= $this->getFileName($destination, $dest_ext);
if (!is_writable(dirname($destination))) {
return [
'success' => false,
'error' => LANG_UPLOAD_ERR_CANT_WRITE,
'name' => $dest_name,
'path' => ''
];
}
if(file_put_contents($destination, $file_bin) === false){
return [
'success' => false,
'error' => LANG_UPLOAD_ERR_CANT_WRITE,
'name' => $dest_name,
'path' => ''
];
}
return [
'success' => true,
'path' => $destination,
'url' => str_replace($this->site_cfg->upload_path, '', $destination),
'name' => basename($destination),
'size' => $file_size
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function __construct($file_path, $allowed_mime = null) {
$this->allowed_mime = $allowed_mime;
$this->mime_types = (new cmsConfigs('mimetypes.php'))->getAll();
$finfo = finfo_open(FILEINFO_MIME_TYPE);
if(strpos($file_path, DIRECTORY_SEPARATOR) === 0){
$this->file_mime = finfo_file($finfo, $file_path);
} else {
$this->file_mime = finfo_buffer($finfo, $file_path);
}
finfo_close($finfo);
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
public function __construct($file_path, $allowed_mime = null) {
$this->allowed_mime = $allowed_mime;
$this->mime_types = (new cmsConfigs('mimetypes.php'))->getAll();
$finfo = finfo_open(FILEINFO_MIME_TYPE);
if(strpos($file_path, DIRECTORY_SEPARATOR) === 0){
$this->file_mime = finfo_file($finfo, $file_path);
} else {
$this->file_mime = finfo_buffer($finfo, $file_path);
}
finfo_close($finfo);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$template->addJSFromContext('wysiwyg/redactor/files/plugins/'.$plugin.'/'.$plugin.'.js');
}
if (in_array('clips', $this->options['plugins'])){
$this->options['clipsUrl'] = href_to('wysiwyg/redactor/files/plugins/clips/index.html');
}
}
if($this->lang !== 'en'){
$template->addJSFromContext('wysiwyg/redactor/files/lang/'.$this->lang.'.js');
}
ob_start(); ?>
<script>
var redactor_global_options = {};
function init_redactor (dom_id){
var imperavi_options = {};
if(redactor_global_options.hasOwnProperty('field_'+dom_id)){
imperavi_options = redactor_global_options['field_'+dom_id];
} else if(redactor_global_options.hasOwnProperty('default')) {
imperavi_options = redactor_global_options.default;
}
icms.files.url_delete = '<?php echo href_to('files', 'delete'); ?>';
imperavi_options.imageDeleteCallback = function (element){
if(confirm('<?php echo LANG_PARSER_IMAGE_DELETE; ?>')){
icms.files.deleteByPath($(element).attr('src'));
}
};
$('#'+dom_id).redactor(imperavi_options);
icms.forms.addWysiwygsInsertPool(dom_id, function(field_element, text){
$('#'+field_element).redactor('set', text);
$('#'+field_element).redactor('focus');
});
icms.forms.addWysiwygsAddPool(dom_id, function(field_element, text){
$('#'+field_element).redactor('insertHtml', text);
});
}
</script>
<?php $template->addBottom(ob_get_clean());
self::$redactor_loaded = true;
} | 0 | PHP | CWE-918 | Server-Side Request Forgery (SSRF) | The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination. | https://cwe.mitre.org/data/definitions/918.html | vulnerable |
$template->addJSFromContext('wysiwyg/redactor/files/plugins/'.$plugin.'/'.$plugin.'.js');
}
if (in_array('clips', $this->options['plugins'])){
$this->options['clipsUrl'] = href_to('wysiwyg/redactor/files/plugins/clips/index.html');
}
}
if($this->lang !== 'en'){
$template->addJSFromContext('wysiwyg/redactor/files/lang/'.$this->lang.'.js');
}
ob_start(); ?>
<script>
var redactor_global_options = {};
function init_redactor (dom_id){
var imperavi_options = {};
if(redactor_global_options.hasOwnProperty('field_'+dom_id)){
imperavi_options = redactor_global_options['field_'+dom_id];
} else if(redactor_global_options.hasOwnProperty('default')) {
imperavi_options = redactor_global_options.default;
}
icms.files.url_delete = '<?php echo href_to('files', 'delete'); ?>';
imperavi_options.imageDeleteCallback = function (element){
if(confirm('<?php echo LANG_PARSER_IMAGE_DELETE; ?>')){
icms.files.deleteByPath($(element).attr('src'));
}
};
$('#'+dom_id).redactor(imperavi_options);
icms.forms.addWysiwygsInsertPool(dom_id, function(field_element, text){
$('#'+field_element).redactor('set', text);
$('#'+field_element).redactor('focus');
});
icms.forms.addWysiwygsAddPool(dom_id, function(field_element, text){
$('#'+field_element).redactor('insertHtml', text);
});
}
</script>
<?php $template->addBottom(ob_get_clean());
self::$redactor_loaded = true;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
foreach ($hooks as $event_name) {
$hook_class_name = 'on' . string_to_camel('_', $controller_name) . string_to_camel('_', $event_name);
$hook_object = new $hook_class_name($controller_object);
// Некоторые хуки не требуют регистрации в базе данных,
// Например, хуки для CRON или иные, которые вызываются напрямую
// Свойство $disallow_event_db_register в классе хука регулирует это поведение
if(empty($hook_object->disallow_event_db_register)){
$events[$controller_name][$index] = $event_name;
$index++;
}
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
$controller_object = cmsCore::getController($controller_name);
foreach ($hooks as $event_name) {
$hook_class_name = 'on' . string_to_camel('_', $controller_name) . string_to_camel('_', $event_name);
$hook_object = new $hook_class_name($controller_object);
// Некоторые хуки не требуют регистрации в базе данных,
// Например, хуки для CRON или иные, которые вызываются напрямую
// Свойство $disallow_event_db_register в классе хука регулирует это поведение
if(empty($hook_object->disallow_event_db_register)){
$events[$controller_name][$index] = $event_name;
$index++;
}
}
}
return $events;
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
$item['controller_title'] = string_lang($item['target_controller'].'_CONTROLLER');
$item['subject_title'] = $item['controller_title'];
if($subj_controller !== null){
$ctype = $subj_controller->getContentTypeForModeration($item['target_subject']);
$item['subject_title'] = $ctype['title'];
}
return $item;
});
$this->cms_template->renderGridRowsJSON($grid, $data, $total, $pages);
$this->halt();
}
if($additional_h1){
$this->cms_template->setPageH1($additional_h1);
}
$this->model->resetFilters();
return $this->cms_template->render('backend/logs', array(
'grid' => $grid,
'sub_url' => $sub_url,
'url_query' => $url_query,
'url' => $url.($sub_url ? '/'.implode('/', $sub_url) : '').(($action > -1) ? '?'.http_build_query($url_query) : '')
)); | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
$this->grid[$key] = array_merge(($this->grid[$key] ?? []), $data);
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function applyGridFilter(cmsGrid $grid, $filter) {
$grid->applyGridFilter($this, $filter);
return $this;
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function getListItems($ignore_field = false){
if (!$ignore_field) {
$this->model->setPerPage($this->default_perpage);
$visible_columns = cmsUser::getUPSActual($this->ups_key.'.visible_columns', $this->request->get('visible_columns', []));
if ($visible_columns) {
$switchable_columns = $this->grid->getSwitchableColumns();
if ($switchable_columns) {
foreach ($switchable_columns as $name => $column) {
if (!in_array($name, $visible_columns)) {
$this->grid->disableColumn($name);
} else {
$this->grid->enableColumn($name);
}
}
}
}
$filter = $this->grid->filter;
$pre_filter = cmsUser::getUPSActual($this->ups_key, $this->request->get('filter', ''));
if ($pre_filter) {
parse_str($pre_filter, $filter);
}
if ($filter) {
if ($this->filter_callback) {
$filter = call_user_func_array($this->filter_callback, [$filter]);
}
$this->grid->applyGridFilter($this->model, $filter);
}
}
if($this->list_callback){
$this->model = call_user_func_array($this->list_callback, [$this->model]);
}
$total = $this->model->getCount($this->table_name);
$data = $this->model->get($this->table_name, $this->item_callback) ?: [];
if($this->items_callback){
$data = call_user_func_array($this->items_callback, [$data]);
}
return $this->grid->makeGridRows($data, $total);
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/89.html | vulnerable |
public function destroy(DeviceGroup $deviceGroup)
{
if ($deviceGroup->serviceTemplates()->exists()) {
$msg = __('Device Group :name still has Service Templates associated with it. Please remove or update the Service Template accordingly', ['name' => $deviceGroup->name]);
return response($msg, 200);
}
$deviceGroup->delete();
$msg = __('Device Group :name deleted', ['name' => htmlentities($deviceGroup->name)]);
return response($msg, 200);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function store(Request $request, FlasherInterface $flasher)
{
$this->validate($request, [
'name' => 'required|string|unique:device_groups',
'type' => 'required|in:dynamic,static',
'devices' => 'array|required_if:type,static',
'devices.*' => 'integer',
'rules' => 'json|required_if:type,dynamic',
]);
$deviceGroup = DeviceGroup::make($request->only(['name', 'desc', 'type']));
$deviceGroup->rules = json_decode($request->rules);
$deviceGroup->save();
if ($request->type == 'static') {
$deviceGroup->devices()->sync($request->devices);
}
$flasher->addSuccess(__('Device Group :name created', ['name' => $deviceGroup->name]));
return redirect()->route('device-groups.index');
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$query->where('id', '!=', $deviceGroup->id);
}),
],
'type' => 'required|in:dynamic,static',
'devices' => 'array|required_if:type,static',
'devices.*' => 'integer',
'rules' => 'json|required_if:type,dynamic',
]);
$deviceGroup->fill($request->only(['name', 'desc', 'type']));
$devices_updated = false;
if ($deviceGroup->type == 'static') {
// sync device_ids from input
$updated = $deviceGroup->devices()->sync($request->get('devices', []));
// check for attached/detached/updated
$devices_updated = array_sum(array_map(function ($device_ids) {
return count($device_ids);
}, $updated)) > 0;
} else {
$deviceGroup->rules = json_decode($request->rules);
}
if ($deviceGroup->isDirty() || $devices_updated) {
try {
if ($deviceGroup->save() || $devices_updated) {
$flasher->addSuccess(__('Device Group :name updated', ['name' => $deviceGroup->name]));
} else {
$flasher->addError(__('Failed to save'));
return redirect()->back()->withInput();
}
} catch (\Illuminate\Database\QueryException $e) {
return redirect()->back()->withInput()->withErrors([
'rules' => __('Rules resulted in invalid query: ') . $e->getMessage(),
]);
}
} else {
$flasher->addInfo(__('No changes made'));
}
return redirect()->route('device-groups.index');
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function contain_preserve_esi( $content ) {
$hit_list = array();
foreach ( $this->_esi_preserve_list as $k => $v ) {
if ( strpos( $content, '"' . $k . '"' ) !== false ) {
$hit_list[] = '"' . $k . '"';
}
if ( strpos( $content, "'" . $k . "'" ) !== false ) {
$hit_list[] = "'" . $k . "'";
}
}
return $hit_list;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function sub_widget_block( $instance, $widget, $args ) {
// #210407
if ( ! is_array( $instance ) ) {
return $instance;
}
$name = get_class( $widget );
if ( ! isset( $instance[ Base::OPTION_NAME ] ) ) {
return $instance;
}
$options = $instance[ Base::OPTION_NAME ];
if ( ! isset( $options ) || ! $options[ self::WIDGET_O_ESIENABLE ] ) {
defined( 'LSCWP_LOG' ) && Debug2::debug( 'ESI 0 ' . $name . ': '. ( ! isset( $options ) ? 'not set' : 'set off' ) );
return $instance;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function _hooks() {
add_filter( 'template_include', array( $this, 'esi_template' ), 99999 );
add_action( 'load-widgets.php', __NAMESPACE__ . '\Purge::purge_widget' );
add_action( 'wp_update_comment_count', __NAMESPACE__ . '\Purge::purge_comment_widget' );
/**
* Recover REQUEST_URI
* @since 1.8.1
*/
if ( ! empty( $_GET[ self::QS_ACTION ] ) ) {
$this->_register_esi_actions();
}
/**
* Shortcode ESI
*
* To use it, just change the origianl shortcode as below:
* old: [someshortcode aa='bb']
* new: [esi someshortcode aa='bb' cache='private,no-vary' ttl='600']
*
* 1. `cache` attribute is optional, default to 'public,no-vary'.
* 2. `ttl` attribute is optional, default is your public TTL setting.
* 3. `_ls_silence` attribute is optional, default is false.
*
* @since 2.8
* @since 2.8.1 Check is_admin for Elementor compatibility #726013
*/
if ( ! is_admin() ) {
add_shortcode( 'esi', array( $this, 'shortcode' ) );
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private static function _build_inline( $url, $inline_param ) {
if ( ! $url || empty( $inline_param[ 'val' ] ) || empty( $inline_param[ 'control' ] ) || empty( $inline_param[ 'tag' ] ) ) {
return '';
}
return "<esi:inline name='$url' cache-control='" . $inline_param[ 'control' ] . "' cache-tag='" . $inline_param[ 'tag' ] . "'>" . $inline_param[ 'val' ] . "</esi:inline>";
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function is_nonce_action( $action ) {
// If GM not run yet, then ESI not init yet, then ESI nonce will not be allowed even nonce func replaced.
if ( ! defined( 'LITESPEED_ESI_INITED' ) ) {
return null;
}
if ( is_admin() ) {
return null;
}
if ( defined( 'LITESPEED_ESI_OFF' ) ) {
return null;
}
foreach ( $this->_nonce_actions as $k => $v ) {
if ( strpos( $k, '*' ) !== false ) {
if( preg_match( '#' . $k . '#iU', $action ) ) {
return $v;
}
}
else {
if ( $k == $action ) {
return $v;
}
}
}
return null;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$atts_ori[] = is_string( $k ) ? "$k='" . addslashes( $v ) . "'" : $v;
}
Tag::add( Tag::TYPE_ESI . "esi.$shortcode" );
// Output original shortcode final content
echo do_shortcode( "[$shortcode " . implode( ' ', $atts_ori ) . " ]" );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function load_esi_block() {
/**
* Validate if is a legal ESI req
* @since 2.9.6
*/
if ( empty( $_GET[ '_hash' ] ) || $this->_gen_esi_md5( $_GET ) != $_GET[ '_hash' ] ) {
Debug2::debug( '[ESI] ❌ Failed to validate _hash' );
return;
}
$params = $this->_parse_esi_param();
if ( defined( 'LSCWP_LOG' ) ) {
$logInfo = '[ESI] ⭕ ';
if( ! empty( $params[ self::PARAM_NAME ] ) ) {
$logInfo .= ' Name: ' . $params[ self::PARAM_NAME ] . ' ----- ';
}
$logInfo .= ' [ID] ' . LSCACHE_IS_ESI;
Debug2::debug( $logInfo );
}
if ( ! empty( $params[ '_ls_silence' ] ) ) {
! defined( 'LSCACHE_ESI_SILENCE' ) && define( 'LSCACHE_ESI_SILENCE', true );
}
/**
* Buffer needs to be JSON format
* @since 2.9.4
*/
if ( ! empty( $params[ 'is_json' ] ) ) {
add_filter( 'litespeed_is_json', '__return_true' );
}
Tag::add( rtrim( Tag::TYPE_ESI, '.' ) );
Tag::add( Tag::TYPE_ESI . LSCACHE_IS_ESI );
// Debug2::debug(var_export($params, true ));
/**
* Handle default cache control 'private,no-vary' for sub_esi_block() @ticket #923505
*
* @since 2.2.3
*/
if ( ! empty( $_GET[ '_control' ] ) ) {
$control = explode( ',', $_GET[ '_control' ] );
if ( in_array( 'private', $control ) ) {
Control::set_private();
}
if ( in_array( 'no-vary', $control ) ) {
Control::set_no_vary();
}
}
do_action('litespeed_esi_load-' . LSCACHE_IS_ESI, $params);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function load_admin_bar_block( $params ) {
if ( ! empty( $params[ 'ref' ] ) ) {
$ref_qs = parse_url( $params[ 'ref' ], PHP_URL_QUERY );
if ( ! empty( $ref_qs ) ) {
parse_str( $ref_qs, $ref_qs_arr );
if ( ! empty( $ref_qs_arr ) ) {
foreach ( $ref_qs_arr as $k => $v ) {
$_GET[ $k ] = $v;
}
}
}
}
wp_admin_bar_render();
if ( ! $this->conf( Base::O_ESI_CACHE_ADMBAR ) ) {
Control::set_nocache( 'build-in set to not cacheable' );
}
else {
Control::set_private();
Control::set_no_vary();
}
defined( 'LSCWP_LOG' ) && Debug2::debug( 'ESI: adminbar ref: ' . $_SERVER[ 'REQUEST_URI' ] );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function _register_esi_actions() {
! defined( 'LSCACHE_IS_ESI' ) && define( 'LSCACHE_IS_ESI', $_GET[ self::QS_ACTION ] );// Reused this to ESI block ID
! empty( $_SERVER[ 'ESI_REFERER' ] ) && defined( 'LSCWP_LOG' ) && Debug2::debug( '[ESI] ESI_REFERER: ' . $_SERVER[ 'ESI_REFERER' ] );
/**
* Only when ESI's parent is not REST, replace REQUEST_URI to avoid breaking WP5 editor REST call
* @since 2.9.3
*/
if ( ! empty( $_SERVER[ 'ESI_REFERER' ] ) && ! $this->cls( 'REST' )->is_rest( $_SERVER[ 'ESI_REFERER' ] ) ) {
$_SERVER[ 'REQUEST_URI' ] = $_SERVER[ 'ESI_REFERER' ];
}
if ( ! empty( $_SERVER[ 'ESI_CONTENT_TYPE' ] ) && strpos( $_SERVER[ 'ESI_CONTENT_TYPE' ], 'application/json' ) === 0 ) {
add_filter( 'litespeed_is_json', '__return_true' );
}
/**
* Make REST call be able to parse ESI
* NOTE: Not effective due to ESI req are all to `/` yet
* @since 2.9.4
*/
add_action( 'rest_api_init', array( $this, 'load_esi_block' ), 101 );
// Register ESI blocks
add_action('litespeed_esi_load-widget', array($this, 'load_widget_block'));
add_action('litespeed_esi_load-admin-bar', array($this, 'load_admin_bar_block'));
add_action('litespeed_esi_load-comment-form', array($this, 'load_comment_form_block'));
add_action('litespeed_esi_load-nonce', array( $this, 'load_nonce_block' ) );
add_action('litespeed_esi_load-esi', array( $this, 'load_esi_shortcode' ) );
add_action('litespeed_esi_load-' . self::COMBO, array( $this, 'load_combo' ) );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function combine( $block_id ) {
if ( ! isset( $_SERVER[ 'X-LSCACHE' ] ) || strpos( $_SERVER[ 'X-LSCACHE' ], 'combine' ) === false ) {
return;
}
if ( in_array( $block_id, self::$_combine_ids ) ) {
return;
}
self::$_combine_ids[] = $block_id;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function sub_admin_bar_block() {
global $wp_admin_bar;
if ( ! is_admin_bar_showing() || ! is_object($wp_admin_bar) ) {
return;
}
// To make each admin bar ESI request different for `Edit` button different link
$params = array(
'ref' => $_SERVER[ 'REQUEST_URI' ],
);
echo $this->sub_esi_block( 'admin-bar', 'adminbar', $params );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function load_widget_block( $params ) {
// global $wp_widget_factory;
// $widget = $wp_widget_factory->widgets[ $params[ self::PARAM_NAME ] ];
$option = $params[ self::PARAM_INSTANCE ];
$option = $option[ Base::OPTION_NAME ];
// Since we only reach here via esi, safe to assume setting exists.
$ttl = $option[ self::WIDGET_O_TTL ];
defined( 'LSCWP_LOG' ) && Debug2::debug( 'ESI widget render: name ' . $params[ self::PARAM_NAME ] . ', id ' . $params[ self::PARAM_ID ] . ', ttl ' . $ttl );
if ( $ttl == 0 ) {
Control::set_nocache( 'ESI Widget time to live set to 0' );
}
else {
Control::set_custom_ttl( $ttl );
if ( $option[ self::WIDGET_O_ESIENABLE ] == Base::VAL_ON2 ) {
Control::set_private();
}
Control::set_no_vary();
Tag::add( Tag::TYPE_WIDGET . $params[ self::PARAM_ID ] );
}
the_widget( $params[ self::PARAM_NAME ], $params[ self::PARAM_INSTANCE ], $params[ self::PARAM_ARGS ] );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function shortcode( $atts ) {
if ( empty( $atts[ 0 ] ) ) {
Debug2::debug( '[ESI] ===shortcode wrong format', $atts );
return 'Wrong shortcode esi format';
}
$cache = 'public,no-vary';
if ( ! empty( $atts[ 'cache' ] ) ) {
$cache = $atts[ 'cache' ];
unset( $atts[ 'cache' ] );
}
$silence = false;
if ( ! empty( $atts[ '_ls_silence' ] ) ) {
$silence = true;
}
do_action( 'litespeed_esi_shortcode-' . $atts[ 0 ] );
// Show ESI link
return $this->sub_esi_block( 'esi', 'esi-shortcode', $atts, $cache, $silence );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$qs = parse_url( htmlspecialchars_decode( $url ), PHP_URL_QUERY );
parse_str( $qs, $qs );
if ( empty( $qs[ self::QS_ACTION ] ) ) {
continue;
}
$esi_id = $qs[ self::QS_ACTION ];
$esi_param = ! empty( $qs[ self::QS_PARAMS ] ) ? $this->_parse_esi_param( $qs[ self::QS_PARAMS ] ) : false;
$inline_param = apply_filters( 'litespeed_esi_inline-' . $esi_id, array(), $esi_param ); // Returned array need to be [ val, control, tag ]
if ( $inline_param ) {
$output .= self::_build_inline( $url, $inline_param );
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function load_comment_form_block( $params ) {
comment_form( $params[ self::PARAM_ARGS ], $params[ self::PARAM_ID ] );
if ( ! $this->conf( Base::O_ESI_CACHE_COMMFORM ) ) {
Control::set_nocache( 'build-in set to not cacheable' );
}
else {
// by default comment form is public
if ( Vary::has_vary() ) {
Control::set_private();
Control::set_no_vary();
}
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function set_has_esi() {
self::$has_esi = true;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function _register_not_esi_actions() {
do_action( 'litespeed_tpl_normal' );
if ( ! Control::is_cacheable() ) {
return;
}
if ( Router::is_ajax() ) {
return;
}
add_filter('widget_display_callback', array( $this, 'sub_widget_block' ), 0, 3);
// Add admin_bar esi
if ( Router::is_logged_in() ) {
remove_action('wp_footer', 'wp_admin_bar_render', 1000);
add_action('wp_footer', array($this, 'sub_admin_bar_block'), 1000);
}
// Add comment forum esi for logged-in user or commenter
if ( ! Router::is_ajax() && Vary::has_vary() ) {
add_filter( 'comment_form_defaults', array( $this, 'register_comment_form_actions' ) );
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function comment_form_sub_clean() {
echo GUI::clean_wrapper_end();
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$diff = array_diff_assoc( $v, $this->esi_args[ $k ] );
if ( ! empty( $diff ) ) {
$esi_args[ $k ] = $diff;
}
}
elseif ( $v !== $this->esi_args[ $k ] ) {
$esi_args[ $k ] = $v;
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function sub_comment_form_block( $post_id ) {
echo GUI::clean_wrapper_end();
$params = array(
self::PARAM_ID => $post_id,
self::PARAM_ARGS => $this->esi_args,
);
echo $this->sub_esi_block( 'comment-form', 'comment form', $params );
echo GUI::clean_wrapper_begin();
add_action( 'comment_form_after', array( $this, 'comment_form_sub_clean' ) );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function finalize( $buffer ) {
// Prepend combo esi block
if ( self::$_combine_ids ) {
Debug2::debug( '[ESI] 🍔 Enabled combo' );
$esi_block = $this->sub_esi_block( self::COMBO, '__COMBINE_MAIN__', array(), 'no-cache', true );
$buffer = $esi_block . $buffer;
}
// Bypass if no preserved list to be replaced
if ( ! $this->_esi_preserve_list ) {
return $buffer;
}
$keys = array_keys( $this->_esi_preserve_list );
Debug2::debug( '[ESI] replacing preserved blocks', $keys );
$buffer = str_replace( $keys, $this->_esi_preserve_list, $buffer );
return $buffer;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function register_comment_form_actions( $defaults ) {
$this->esi_args = $defaults;
echo GUI::clean_wrapper_begin();
add_filter( 'comment_form_submit_button', array( $this, 'sub_comment_form_btn' ), 1000, 2 ); // To save the params passed in
add_action( 'comment_form', array( $this, 'sub_comment_form_block' ), 1000 );
return $defaults;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$this->nonce_action( $action );
}
}
add_action( 'litespeed_nonce', array( $this, 'nonce_action' ) );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function esi_template( $template ) {
// Check if is an ESI request
if ( defined( 'LSCACHE_IS_ESI' ) ) {
Debug2::debug( '[ESI] calling template' );
return LSCWP_DIR . 'tpl/esi.tpl.php';
}
$this->_register_not_esi_actions();
return $template;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function widget_default_options($options, $widget) {
if ( ! is_array($options) ) {
return $options;
}
$widget_name = get_class($widget);
switch ($widget_name) {
case 'WP_Widget_Recent_Posts' :
case 'WP_Widget_Recent_Comments' :
$options[self::WIDGET_O_ESIENABLE] = Base::VAL_OFF;
$options[self::WIDGET_O_TTL] = 86400;
break;
default :
break;
}
return $options;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function _parse_esi_param( $qs_params = false ) {
$req_params = false;
if ( $qs_params ) {
$req_params = $qs_params;
}
elseif ( isset( $_REQUEST[ self::QS_PARAMS ] ) ) {
$req_params = $_REQUEST[ self::QS_PARAMS ];
}
if ( ! $req_params ) {
return false;
}
$unencrypted = base64_decode( $req_params );
if ( $unencrypted === false ) {
return false;
}
Debug2::debug2( '[ESI] parms', $unencrypted );
// $unencoded = urldecode($unencrypted); no need to do this as $_GET is already parsed
$params = json_decode( $unencrypted, true );
return $params;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public static function has_esi() {
return self::$has_esi;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function init() {
/**
* Bypass ESI related funcs if disabled ESI to fix potential DIVI compatibility issue
* @since 2.9.7.2
*/
if ( Router::is_ajax() || ! $this->cls( 'Router' )->esi_enabled() ) {
return;
}
// Guest mode, don't need to use ESI
if ( defined( 'LITESPEED_GUEST' ) && LITESPEED_GUEST ) {
return;
}
if ( defined( 'LITESPEED_ESI_OFF' ) ) {
return;
}
// Init ESI in `after_setup_theme` hook after detected if LITESPEED_DISABLE_ALL is ON or not
$this->_hooks();
/**
* Overwrite wp_create_nonce func
* @since 2.9.5
*/
$this->_transform_nonce();
! defined( 'LITESPEED_ESI_INITED' ) && define( 'LITESPEED_ESI_INITED', true );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function _gen_esi_md5( $params ) {
$keys = array(
self::QS_ACTION,
'_control',
self::QS_PARAMS,
);
$str = '';
foreach ( $keys as $v ) {
if ( isset( $params[ $v ] ) && is_string( $params[ $v ] ) ) {
$str .= $params[ $v ];
}
}
Debug2::debug2( '[ESI] md5_string=' . $str );
return md5( $this->conf( Base::HASH ) . $str );
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
public function load_nonce_block( $params ) {
$action = $params[ 'action' ];
Debug2::debug( '[ESI] load_nonce_block [action] ' . $action );
// set nonce TTL to half day
Control::set_custom_ttl( 43200 );
if ( Router::is_logged_in() ) {
Control::set_private();
}
if ( function_exists( 'wp_create_nonce_litespeed_esi' ) ) {
echo wp_create_nonce_litespeed_esi( $action );
}
else {
echo wp_create_nonce( $action );
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
private function wash_uri($uri, $blocked_source = false, $is_image = true)
{
if (!empty($this->config['cid_map'][$uri])) {
return $this->config['cid_map'][$uri];
}
$key = $this->config['base_url'] . $uri;
if (!empty($this->config['cid_map'][$key])) {
return $this->config['cid_map'][$key];
}
// allow url(#id) used in SVG
if (isset($uri[0]) && $uri[0] == '#') {
if ($this->_css_prefix !== null) {
$uri = '#' . $this->_css_prefix . substr($uri, 1);
}
return $uri;
}
if (preg_match('/^(http|https|ftp):.+/i', $uri)) {
if (!empty($this->config['allow_remote'])) {
return $uri;
}
$this->extlinks = true;
if ($is_image && !empty($this->config['blocked_src'])) {
return $this->config['blocked_src'];
}
}
else if ($is_image && preg_match('/^data:image\/([^,]+),(.+)$/is', $uri, $matches)) { // RFC2397
// svg images can be insecure, we'll sanitize them
if (stripos($matches[1], 'svg') !== false) {
$svg = $matches[2];
if (stripos($matches[1], ';base64') !== false) {
$svg = base64_decode($svg);
$type = $matches[1];
}
else {
$type = $matches[1] . ';base64';
}
$washer = new self($this->config);
$svg = $washer->wash($svg);
// Invalid svg content
if (empty($svg)) {
return null;
}
return 'data:image/' . $type . ',' . base64_encode($svg);
}
return $uri;
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function angeltype_delete_controller()
{
if (!auth()->can('admin_angel_types')) {
throw_redirect(page_link_to('angeltypes'));
}
$angeltype = AngelType::findOrFail(request()->input('angeltype_id'));
if (request()->hasPostData('delete')) {
$angeltype->delete();
engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype, true));
success(sprintf(__('Angeltype %s deleted.'), $angeltype->name));
throw_redirect(page_link_to('angeltypes'));
}
return [
sprintf(__('Delete angeltype %s'), $angeltype->name),
AngelType_delete_view($angeltype),
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function angeltype_controller()
{
$user = auth()->user();
if (!auth()->can('angeltypes')) {
throw_redirect(page_link_to('/'));
}
$angeltype = AngelType::findOrFail(request()->input('angeltype_id'));
/** @var UserAngelType $user_angeltype */
$user_angeltype = UserAngelType::whereUserId($user->id)->where('angel_type_id', $angeltype->id)->first();
$members = $angeltype->userAngelTypes->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE);
$days = angeltype_controller_shiftsFilterDays($angeltype);
$shiftsFilter = angeltype_controller_shiftsFilter($angeltype, $days);
if (request()->input('showFilledShifts')) {
$shiftsFilter->setFilled([ShiftsFilter::FILLED_FREE, ShiftsFilter::FILLED_FILLED]);
}
$shiftsFilterRenderer = new ShiftsFilterRenderer($shiftsFilter);
$shiftsFilterRenderer->enableDaySelection($days);
$shiftCalendarRenderer = shiftCalendarRendererByShiftFilter($shiftsFilter);
$request = request();
$tab = 0;
if ($request->has('shifts_filter_day') || $request->has('showShiftsTab')) {
$tab = 1;
}
$isSupporter = !is_null($user_angeltype) && $user_angeltype->supporter;
return [
sprintf(__('Team %s'), $angeltype->name),
AngelType_view(
$angeltype,
$members,
$user_angeltype,
auth()->can('admin_user_angeltypes') || $isSupporter,
auth()->can('admin_angel_types'),
$isSupporter,
$user->license,
$user,
$shiftsFilterRenderer,
$shiftCalendarRenderer,
$tab
),
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$angel_types_spinner .= form_spinner(
'angeltype_count_' . $angeltype_id,
$angeltype_name,
$needed_angel_types[$angeltype_id]
);
}
return page_with_title(
shifts_title(),
[
msg(),
'<noscript>'
. info(__('This page is much more comfortable with javascript.'), true)
. '</noscript>',
form([
form_select('shifttype_id', __('Shifttype'), $shifttypes, $shifttype_id),
form_text('title', __('Title'), $title),
form_select('rid', __('Room:'), $rooms, $rid),
form_text('start', __('Start:'), $start->format('Y-m-d H:i')),
form_text('end', __('End:'), $end->format('Y-m-d H:i')),
form_textarea('description', __('Additional description'), $description),
form_info('', __('This description is for single shifts, otherwise please use the description in shift type.')),
'<h2>' . __('Needed angels') . '</h2>',
$angel_types_spinner,
form_submit('submit', __('Save')),
]),
]
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function shifttype_controller()
{
$request = request();
if (!$request->has('shifttype_id')) {
throw_redirect(page_link_to('shifttypes'));
}
$shifttype = ShiftType::findOrFail($request->input('shifttype_id'));
return [
$shifttype->name,
ShiftType_view($shifttype),
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function shifttype_delete_controller()
{
$request = request();
if (!$request->has('shifttype_id')) {
throw_redirect(page_link_to('shifttypes'));
}
$shifttype = ShiftType::findOrFail($request->input('shifttype_id'));
if ($request->hasPostData('delete')) {
engelsystem_log('Deleted shifttype ' . $shifttype->name);
success(sprintf(__('Shifttype %s deleted.'), $shifttype->name));
$shifttype->delete();
throw_redirect(page_link_to('shifttypes'));
}
return [
sprintf(__('Delete shifttype %s'), $shifttype->name),
ShiftType_delete_view($shifttype),
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
. page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $user_angeltype->angel_type_id])
. '">' . $user_angeltype->angelType->name
. ' (+' . $user_angeltype->count . ')'
. '</a>';
}
$count = $unconfirmed_user_angeltypes->count();
return
_e(
'There is %d unconfirmed angeltype.',
'There are %d unconfirmed angeltypes.',
$count,
[$count]
)
. ' ' . __('Angel types which need approvals:')
. ' ' . join(', ', $unconfirmed_links);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function user_delete_controller()
{
$user = auth()->user();
$auth = auth();
$request = request();
if ($request->has('user_id')) {
$user_source = User::find($request->query->get('user_id'));
} else {
$user_source = $user;
}
if (!auth()->can('admin_user')) {
throw_redirect(page_link_to());
}
// You cannot delete yourself
if ($user->id == $user_source->id) {
error(__('You cannot delete yourself.'));
throw_redirect(user_link($user->id));
}
if ($request->hasPostData('submit')) {
$valid = true;
if (
!(
$request->has('password')
&& $auth->verifyPassword($user, $request->postData('password'))
)
) {
$valid = false;
error(__('auth.password.error'));
}
if ($valid) {
// Load data before user deletion to prevent errors when displaying
$user_source->load(['contact', 'personalData', 'settings', 'state']);
$user_source->delete();
mail_user_delete($user_source);
success(__('User deleted.'));
engelsystem_log(sprintf('Deleted %s', User_Nick_render($user_source, true)));
throw_redirect(users_link());
}
}
return [
sprintf(__('Delete %s'), $user_source->displayName),
User_delete_view($user_source),
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function user_edit_vouchers_controller()
{
$user = auth()->user();
$request = request();
if ($request->has('user_id')) {
$user_source = User::find($request->input('user_id'));
} else {
$user_source = $user;
}
if (
(!auth()->can('admin_user') && !auth()->can('voucher.edit'))
|| !config('enable_voucher')
) {
throw_redirect(page_link_to());
}
if ($request->hasPostData('submit')) {
$valid = true;
$vouchers = '';
if (
$request->has('vouchers')
&& test_request_int('vouchers')
&& trim($request->input('vouchers')) >= 0
) {
$vouchers = trim($request->input('vouchers'));
} else {
$valid = false;
error(__('Please enter a valid number of vouchers.'));
}
if ($valid) {
$user_source->state->got_voucher = $vouchers;
$user_source->state->save();
success(__('Saved the number of vouchers.'));
engelsystem_log(User_Nick_render($user_source, true) . ': ' . sprintf(
'Got %s vouchers',
$user_source->state->got_voucher
));
throw_redirect(user_link($user_source->id));
}
}
return [
sprintf(__('%s\'s vouchers'), $user_source->displayName),
User_edit_vouchers_view($user_source),
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$shift->needed_angeltypes = Db::select(
'
SELECT DISTINCT `angel_types`.*
FROM `shift_entries`
JOIN `angel_types` ON `shift_entries`.`angel_type_id`=`angel_types`.`id`
WHERE `shift_entries`.`shift_id` = ?
ORDER BY `angel_types`.`name`
',
[$shift->id]
);
$neededAngeltypes = $shift->needed_angeltypes;
foreach ($neededAngeltypes as &$needed_angeltype) {
$needed_angeltype['users'] = Db::select(
'
SELECT `shift_entries`.`freeloaded`, `users`.*
FROM `shift_entries`
JOIN `users` ON `shift_entries`.`user_id`=`users`.`id`
WHERE `shift_entries`.`shift_id` = ?
AND `shift_entries`.`angel_type_id` = ?
',
[$shift->id, $needed_angeltype['id']]
);
}
$shift->needed_angeltypes = $neededAngeltypes;
}
if (empty($user_source->api_key)) {
User_reset_api_key($user_source, false);
}
if ($user_source->state->force_active) {
$tshirt_score = __('Enough');
} else {
$tshirt_score = sprintf('%.2f', User_tshirt_score($user_source->id)) . ' h';
}
return [
$user_source->displayName,
User_view(
$user_source,
auth()->can('admin_user'),
$user_source->isFreeloader(),
$user_source->userAngelTypes,
$user_source->groups,
$shifts,
$user->id == $user_source->id,
$tshirt_score,
auth()->can('admin_active'),
auth()->can('admin_user_worklog'),
UserWorkLogsForUser($user_source->id)
),
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function error($msg, $immediately = false)
{
return alert(NotificationType::ERROR, $msg, $immediately);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function warning($msg, $immediately = false)
{
return alert(NotificationType::WARNING, $msg, $immediately);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function success($msg, $immediately = false)
{
return alert(NotificationType::MESSAGE, $msg, $immediately);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function info($msg, $immediately = false)
{
return alert(NotificationType::INFORMATION, $msg, $immediately);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function alert(NotificationType $type, $msg, $immediately = false)
{
if (empty($msg)) {
return '';
}
if ($immediately) {
$type = str_replace(
[
NotificationType::ERROR->value,
NotificationType::WARNING->value,
NotificationType::INFORMATION->value,
NotificationType::MESSAGE->value,
],
['danger', 'warning', 'info', 'success'],
$type->value
);
return '<div class="alert alert-' . $type . '" role="alert">' . $msg . '</div>';
}
$type = 'messages.' . $type->value;
$session = session();
$messages = $session->get($type, []);
$messages[] = $msg;
$session->set($type, $messages);
return '';
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
foreach ($privileges as $privilege) {
$privileges_html[] = $privilege['name'];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
. $start->format(__('Y-m-d H:i'))
. ' - '
. '<span title="' . $end->format(__('Y-m-d')) . '">'
. $end->format(__('H:i'))
. '</span>'
. ', ' . round($end->copy()->diffInMinutes($start) / 60, 2) . 'h'
. '<br>'
. Room_name_render(Room::find($shift['room_id'])),
'title' =>
ShiftType_name_render(ShiftType::find($shifttype_id))
. ($shift['title'] ? '<br />' . $shift['title'] : ''),
'needed_angels' => '',
];
foreach ($types as $type) {
if (isset($needed_angel_types[$type->id]) && $needed_angel_types[$type->id] > 0) {
$shifts_table_entry['needed_angels'] .= '<b>' . AngelType_name_render($type) . ':</b> '
. $needed_angel_types[$type->id] . '<br />';
}
}
$shifts_table[] = $shifts_table_entry;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
. (in_array($i['id'], $selected) ? ' checked="checked"' : '')
. '><label class="form-check-label" for="' . $id . '">' . $i['name'] . '</label>'
. (!isset($i['enabled']) || $i['enabled'] ? '' : icon('mortarboard-fill')) | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function get_ids_from_array($array)
{
return $array['id'];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function form_checkbox($name, $label, $selected, $value = 'checked', $html_id = null)
{
if (is_null($html_id)) {
$html_id = $name;
}
return '<div class="form-check">'
. '<input class="form-check-input" type="checkbox" id="' . $html_id . '" name="' . $name . '" value="' . htmlspecialchars((string) $value) . '" '
. ($selected ? ' checked="checked"' : '') . ' /><label class="form-check-label" for="' . $html_id . '">' | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function html_select_key($dom_id, $name, $rows, $selected, $selectText = '')
{
$html = '<select class="form-control" id="' . $dom_id . '" name="' . $name . '">';
if (!empty($selectText)) {
$html .= '<option value="">' . $selectText . '</option>';
}
foreach ($rows as $key => $row) {
if (($key == $selected) || ($row === $selected)) {
$html .= '<option value="' . $key . '" selected="selected">' . $row . '</option>';
} else {
$html .= '<option value="' . $key . '">' . $row . '</option>';
}
}
$html .= '</select>';
return $html;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function form_password_placeholder($name, $placeholder, $disabled = false)
{
$disabled = $disabled ? ' disabled="disabled"' : '';
return form_element(
'',
'<input class="form-control" id="form_' . $name . '" type="password" name="'
. $name . '" value="" placeholder="' . $placeholder . '" ' . $disabled . '/>',
'form_' . $name
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function form_file($name, $label)
{
return form_element(
$label,
sprintf('<input id="form_%1$s" type="file" name="%1$s" />', $name),
'form_' . $name
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function form_password($name, $label, $autocomplete, $disabled = false)
{
$disabled = $disabled ? ' disabled="disabled"' : '';
return form_element(
$label,
sprintf(
'<input class="form-control" id="form_%1$s" type="password" name="%1$s" minlength="%2$s" value="" autocomplete="%3$s"%4$s/>',
$name,
config('min_password_length'),
$autocomplete,
$disabled
),
'form_' . $name
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function form_text_placeholder($name, $placeholder, $value, $disabled = false)
{
$disabled = $disabled ? ' disabled="disabled"' : '';
return form_element(
'',
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
. '" value="' . htmlspecialchars((string) $value) . '" placeholder="' . $placeholder
. '" ' . $disabled . '/>'
);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
$title = ((array) $options)[0];
$menu[] = toolbar_item_link(page_link_to($menu_page), '', $title, $menu_page == $page);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function raw_output($output = '')
{
echo $output;
die();
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function strip_request_tags($name, $default_value = null)
{
$request = request();
if ($request->has($name)) {
return strip_tags($request->input($name));
}
return $default_value;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function mute($text)
{
return '<span class="text-muted">' . $text . '</span>';
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function AngelType_delete_view(AngelType $angeltype)
{
return page_with_title(sprintf(__('Delete angeltype %s'), $angeltype->name), [
info(sprintf(__('Do you want to delete angeltype %s?'), $angeltype->name), true),
form([
buttons([
button(page_link_to('angeltypes'), icon('x-lg') . __('cancel')),
form_submit('delete', icon('trash') . __('delete'), 'btn-danger', false),
]),
]),
], true);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function AngelTypes_render_contact_info(AngelType $angeltype)
{
$info = [
__('Name') => [$angeltype->contact_name, $angeltype->contact_name],
__('DECT') => config('enable_dect') ? [sprintf('<a href="tel:%s">%1$s</a>', $angeltype->contact_dect), $angeltype->contact_dect] : null,
__('E-Mail') => [sprintf('<a href="mailto:%s">%1$s</a>', $angeltype->contact_email), $angeltype->contact_email],
];
$contactInfo = [];
foreach ($info as $name => $data) {
if (!empty($data[1])) {
$contactInfo[$name] = $data[0];
}
}
return heading(__('Contact'), 3) . description($contactInfo);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
function AngelType_view(
AngelType $angeltype,
$members,
?UserAngelType $user_angeltype,
$admin_user_angeltypes,
$admin_angeltypes,
$supporter,
$user_driver_license,
$user,
ShiftsFilterRenderer $shiftsFilterRenderer,
ShiftCalendarRenderer $shiftCalendarRenderer,
$tab
) {
return page_with_title(sprintf(__('Team %s'), $angeltype->name), [
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user),
msg(),
tabs([
__('Info') => AngelType_view_info(
$angeltype,
$members,
$admin_user_angeltypes,
$admin_angeltypes,
$supporter
),
__('Shifts') => AngelType_view_shifts(
$angeltype,
$shiftsFilterRenderer,
$shiftCalendarRenderer
),
], $tab),
], true);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. | https://cwe.mitre.org/data/definitions/79.html | vulnerable |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.