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 testAdminFtpsAddCustomerRequired()
{
global $admin_userdata;
$data = [
'ftp_password' => 'h4xXx0r',
'path' => '/',
'ftp_description' => 'testing',
'sendinfomail' => 1
];
$this->expectExceptionCode(406);
$this->expectExceptionMessage('Requested parameter "loginname" is empty where it should not be for "Customers:get"');
$json_result = Ftps::getLocal($admin_userdata, $data)->add();
} | 0 | PHP | CWE-59 | Improper Link Resolution Before File Access ('Link Following') | The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. | https://cwe.mitre.org/data/definitions/59.html | vulnerable |
$slug = $item->getSlug();
$foundSlug = true;
if (strlen($slug) > 0) {
$document = Model\Document::getByPath($slug);
if ($document) {
throw new Model\Element\ValidationException('Slug must be unique. Found conflict with document path "' . $slug . '"');
}
if (strlen($slug) < 2 || $slug[0] !== '/') {
throw new Model\Element\ValidationException('Slug must be at least 2 characters long and start with slash');
}
if (strpos($slug, '//') !== false || !filter_var('https://example.com' . $slug, FILTER_VALIDATE_URL)) {
throw new Model\Element\ValidationException('Slug "' . $slug . '" is not valid');
}
}
}
}
if (!$omitMandatoryCheck && $this->getMandatory() && !$foundSlug) {
throw new Model\Element\ValidationException('Mandatory check failed');
}
parent::checkValidity($data, $omitMandatoryCheck);
} | 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 ($items as $item) {
$type = $item['type'];
unset($item['type']);
$pipe->addItem($type, $item, $mediaName);
} | 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 |
return ($mediaOrder[$a] < $mediaOrder[$b]) ? -1 : 1;
});
foreach ($mediaData as $mediaName => $items) {
foreach ($items as $item) {
$type = $item['type'];
unset($item['type']);
$pipe->addItem($type, $item, $mediaName);
}
}
$pipe->save();
return $this->adminJson(['success' => 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 |
$sql .= 'SELECT ' . $db->quoteIdentifier($selectField);
} else {
$sql .= 'SELECT *';
}
if (!empty($config['from'])) {
if (strpos(strtoupper(trim($config['from'])), 'FROM') !== 0) {
$sql .= ' FROM ';
}
$sql .= ' ' . str_replace("\n", ' ', $config['from']);
}
if (!empty($config['where'])) {
if (str_starts_with(strtoupper(trim($config['where'])), 'WHERE')) {
$config['where'] = preg_replace('/^\s*WHERE\s*/', '', $config['where']);
}
$sql .= ' WHERE (' . str_replace("\n", ' ', $config['where']) . ')';
}
if (!empty($config['groupby']) && !$ignoreSelectAndGroupBy) {
if (strpos(strtoupper(trim($config['groupby'])), 'GROUP BY') !== 0) {
$sql .= ' GROUP BY ';
}
$sql .= ' ' . str_replace("\n", ' ', $config['groupby']);
}
if ($drillDownFilters) {
$havingParts = [];
$db = Db::get();
foreach ($drillDownFilters as $field => $value) {
if ($value !== '' && $value !== null) {
$havingParts[] = "$field = " . $db->quote($value);
}
}
if ($havingParts) {
$sql .= ' HAVING ' . implode(' AND ', $havingParts);
}
}
return $sql;
} | 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 getByUuid($uuid)
{
$data = $this->db->fetchAssociative('SELECT * FROM ' . self::TABLE_NAME ." where uuid='" . $uuid . "'");
$model = new Model\Tool\UUID();
$model->setValues($data);
return $model;
} | 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 exists($uuid)
{
return (bool) $this->db->fetchOne('SELECT uuid FROM ' . self::TABLE_NAME . ' where uuid = ?', [$uuid]);
} | 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 setConverter($converter)
{
$this->converter = (string)$converter;
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 setReference($reference)
{
$this->reference = $reference;
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 setLongname($longname)
{
$this->longname = $longname;
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 setGroup($group)
{
$this->group = $group;
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 setAbbreviation($abbreviation)
{
$this->abbreviation = $abbreviation;
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 setName($name)
{
$this->name = $name;
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 setPattern($pattern)
{
$this->pattern = $pattern;
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 setController($controller)
{
$this->controller = $controller;
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 setDefaults($defaults)
{
$this->defaults = $defaults;
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 setVariables($variables)
{
$this->variables = $variables;
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 setReverse($reverse)
{
$this->reverse = $reverse;
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 setMethods($methods)
{
if (is_string($methods)) {
$methods = strlen($methods) ? explode(',', $methods) : [];
$methods = array_map('trim', $methods);
}
$this->methods = $methods;
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 setKey($key)
{
$this->key = $key;
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 setData($data)
{
$this->data = $data;
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 setDescription($description)
{
$this->description = $description;
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 setName($name)
{
$this->name = $name;
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 setConfig($config)
{
$this->config = $config;
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 setName($name, $locale = null)
{
$this->name = $name;
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 |
$filter['value'] = strtotime($filter['value']);
$field = $fieldname;
$value = $filter['value'];
}
}
if ($field && $value) {
$condition = $field . ' ' . $operator . ' ' . $db->quote($value);
if ($languageMode) {
$conditions[$fieldname] = $condition;
$joins[] = [
'language' => $fieldname,
];
} else {
$conditionFilters[] = $condition;
}
}
}
}
if ($request->get('searchString')) {
$filterTerm = $db->quote('%' . mb_strtolower($request->get('searchString')) . '%');
$conditionFilters[] = '(lower(' . $tableName . '.key) LIKE ' . $filterTerm . ' OR lower(' . $tableName . '.text) LIKE ' . $filterTerm . ')';
}
if ($languageMode) {
$result = [
'joins' => $joins,
'conditions' => $conditions,
];
return $result;
} else {
if (!empty($conditionFilters)) {
return implode(' AND ', $conditionFilters);
}
return null;
}
} | 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 loginAction(Request $request, CsrfProtectionHandler $csrfProtection, Config $config)
{
if ($request->get('_route') === 'pimcore_admin_login_fallback') {
return $this->redirectToRoute('pimcore_admin_login', $request->query->all(), Response::HTTP_MOVED_PERMANENTLY);
}
$csrfProtection->regenerateCsrfToken();
$user = $this->getAdminUser();
if ($user instanceof UserInterface) {
return $this->redirectToRoute('pimcore_admin_index');
}
$params = $this->buildLoginPageViewParams($config);
$session_gc_maxlifetime = ini_get('session.gc_maxlifetime');
if (empty($session_gc_maxlifetime)) {
$session_gc_maxlifetime = 120;
}
$params['csrfTokenRefreshInterval'] = ((int)$session_gc_maxlifetime - 60) * 1000;
if ($request->get('too_many_attempts')) {
$params['error'] = $request->get('too_many_attempts');
}
if ($request->get('auth_failed')) {
$params['error'] = 'error_auth_failed';
}
if ($request->get('session_expired')) {
$params['error'] = 'error_session_expired';
}
if ($request->get('deeplink')) {
$params['deeplink'] = true;
}
$params['browserSupported'] = $this->detectBrowser();
$params['debug'] = \Pimcore::inDebugMode();
return $this->render('@PimcoreAdmin/Admin/Login/login.html.twig', $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 setData($data)
{
if ($data instanceof ElementInterface) {
$this->setType(Service::getElementType($data));
$data = $data->getId();
}
$this->data = $data;
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 setName($name)
{
$this->name = $name;
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 __construct(\stdClass $config, array $context = [])
{
$this->label = $config->label;
$this->childs = $config->childs;
$this->context = $context;
} | 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 setLabel($label)
{
$this->label = $label;
} | 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 setAttribute($attribute)
{
$this->attribute = $attribute;
} | 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 setParam1($param1)
{
$this->param1 = $param1;
} | 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(\stdClass $config, $context = null)
{
if (!Admin::getCurrentUser()->isAdmin()) {
throw new \Exception('AnyGetter only allowed for admin users');
}
parent::__construct($config, $context);
$this->attribute = $config->attribute ?? '';
$this->param1 = $config->param1 ?? '';
$this->isArrayType = $config->isArrayType ?? false;
$this->forwardAttribute = $config->forwardAttribute ?? '';
$this->forwardParam1 = $config->forwardParam1 ?? '';
$this->returnLastResult = $config->returnLastResult ?? 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 |
public function getTabindex()
{
return $this->data['tabindex'] ?? '';
} | 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 getAccesskey()
{
return $this->data['accesskey'] ?? '';
} | 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 getParameters()
{
return $this->data['parameters'] ?? '';
} | 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 getHref()
{
$this->updatePathFromInternal();
$url = $this->data['path'] ?? '';
if (strlen($this->data['parameters'] ?? '') > 0) {
$url .= (strpos($url, '?') !== false ? '&' : '?') . str_replace('?', '', $this->getParameters());
}
if (strlen($this->data['anchor'] ?? '') > 0) {
$anchor = $this->getAnchor();
$anchor = str_replace('"', urlencode('"'), $anchor);
$url .= '#' . str_replace('#', '', $anchor);
}
return $url;
} | 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 getRel()
{
return $this->data['rel'] ?? '';
} | 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 getClass()
{
return $this->data['class'] ?? '';
} | 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 getAnchor()
{
return $this->data['anchor'] ?? '';
} | 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 initLogger()
{
// special request log -> if parameter pimcore_log is set
if (array_key_exists('pimcore_log', $_REQUEST) && self::inDebugMode()) {
$requestLogName = date('Y-m-d_H-i-s');
if (!empty($_REQUEST['pimcore_log'])) {
// slashed are not allowed, replace them with hyphens
$requestLogName = str_replace('/', '-', $_REQUEST['pimcore_log']);
}
$requestLogFile = resolvePath(PIMCORE_LOG_DIRECTORY . '/request-' . $requestLogName . '.log');
if (strpos($requestLogFile, PIMCORE_LOG_DIRECTORY) !== 0) {
throw new \Exception('Not allowed');
}
if (!file_exists($requestLogFile)) {
File::put($requestLogFile, '');
}
$requestDebugHandler = new \Monolog\Handler\StreamHandler($requestLogFile);
/** @var \Symfony\Component\DependencyInjection\Container $container */
$container = self::getContainer();
foreach ($container->getServiceIds() as $id) {
if (strpos($id, 'monolog.logger.') === 0) {
$logger = self::getContainer()->get($id);
if ($logger->getName() != 'event') {
// replace all handlers
$logger->setHandlers([$requestDebugHandler]);
}
}
}
}
} | 0 | PHP | CWE-29 | Path Traversal: '\..\filename' | The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '\..\filename' (leading backslash dot dot) sequences that can resolve to a location that is outside of that directory. | https://cwe.mitre.org/data/definitions/29.html | vulnerable |
function is_login() {
global $table_prefeix; // table prefix;
// If "Don't Signout on inactivity" is not checked and last activity is more then AUTO_LOGOUT_TIME
// Then return false and unset session.
if( isset($_COOKIE["keepAlive"]) !== true and isset($_SESSION["LAST_ACTIVITY"]) and (time() - $_SESSION["LAST_ACTIVITY"]) > AUTO_LOGOUT_TIME ) {
session_unset();
return false;
}
$sesionUserId = isset($_SESSION["uid"]) ? $_SESSION["uid"] : "";
$sessionPassAccessKey = isset($_SESSION["sak"]) ? $_SESSION["sak"] : "";
// Select the user
defined('selectUser') ?: define('selectUser', easySelectA(array(
"table" => "users as user",
"fields" => "user_email, user_emp_id, user_pass_aaccesskey",
"where" => array(
"user.is_trash = 0 and user_id" => $sesionUserId,
" and user_pass_aaccesskey" => $sessionPassAccessKey
)
)));
// define the variable
$sha1 = "";
if( selectUser !== false and isset($_SESSION["keepAliveOnNetworkChanges"]) and $_SESSION["keepAliveOnNetworkChanges"] === 1 ) {
$sha1 = sha1(selectUser["data"][0]["user_email"].$_SERVER["HTTP_USER_AGENT"]);
} else if(selectUser !== false) {
$sha1 = sha1(selectUser["data"][0]["user_email"].$_SERVER["HTTP_USER_AGENT"].$_SERVER["REMOTE_ADDR"]);
}
if(isset($_SESSION["uid"]) and isset($_SESSION["sak"]) and $sha1 === $_SESSION["sak"] and isset($_COOKIE["eid"]) and selectUser["count"] === 1 AND selectUser["data"][0]["user_emp_id"] === $_COOKIE["eid"]) {
// Return true to say that we are now logged in.
return true;
} else {
// If any internal user try to change the eid then ban him to punish
// Will make it later.
//if(selectUser["data"][0]["user_emp_id"] !== $_COOKIE["eid"]) { }
// if any unathorized sessions are set then unset them.
if( isset($_SESSION) ) {
session_unset();
}
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 |
function pageSlug() {
$URI = explode(root_domain(), rtrim($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], "/"));
$URI = explode("?", $URI[1]);
return trim($URI[0], '/');
} | 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 getEmployeePayableAmount(int $emp_id, string $salary_type) {
global $table_prefeix;
$emp_opening_balance_name = "emp_opening_". strtolower($salary_type);
$empPayableAmount = easySelectD("
select
emp_id,
( ( if(salary_amount_sum is null, 0, salary_amount_sum) - if(payment_items_amount_sum is null, 0, payment_items_amount_sum) ) + ({$emp_opening_balance_name}) ) as emp_payable_amount
from {$table_prefeix}employees
left join ( select salary_emp_id, salary_type, sum(salary_amount) as salary_amount_sum from {$table_prefeix}salaries where is_trash = 0 and salary_type='{$salary_type}' group by salary_emp_id ) as {$table_prefeix}salaries on salary_emp_id = emp_id
left join ( select payment_items_employee, sum(payment_items_amount) as payment_items_amount_sum from {$table_prefeix}payment_items where is_trash = 0 and payment_items_type='{$salary_type}' group by payment_items_employee ) as get_payments_items on payment_items_employee = emp_id
where emp_id = {$emp_id}
")["data"][0]["emp_payable_amount"];
// if salary type is salary then add the installment amount with payable amount
if($salary_type === "salary") {
$paidLoan = easySelectD("
select sum(loan_installment_paying_amount) as loan_paid_amount from {$table_prefeix}loan_installment where is_trash = 0 and loan_installment_provider = '{$emp_id}' group by loan_installment_provider
");
$empPayableAmount -= $paidLoan ? $paidLoan["data"][0]["loan_paid_amount"] : 0;
}
return $empPayableAmount;
} | 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 near_unit_qty($product_id, $qty, $unit) {
global $table_prefeix;
$getData = easySelectA(array(
"table" => "products as whereProduct",
"fields" => "joinProduct.product_unit as product_unit, equal_unit_qnt, base_qnt",
"join" => array(
"left join {$table_prefeix}products as joinProduct on joinProduct.product_name = whereProduct.product_name",
"left join {$table_prefeix}product_units on unit_name = joinProduct.product_unit"
),
"where" => array(
"joinProduct.is_trash = 0 and joinProduct.product_unit is not null and whereProduct.product_id" => $product_id
),
"orderby" => array(
"base_qnt" => "DESC"
)
));
if($getData !== false) {
$totalBaseQty = $qty;
$remainQty = 0;
$finalUnitName = "";
$finalQtyBasedOnUnit = 0;
// Generate the base qty based on unit
foreach($getData["data"] as $pKey => $pVal ) {
if( $pVal["product_unit"] === $unit) {
$totalBaseQty *= $pVal["base_qnt"];
break;
}
}
// Now get the unit which base_qnt is grater then or equal to unitDevider
foreach($getData["data"] as $pKey => $pVal ) {
if( $pVal["base_qnt"] <= $totalBaseQty) {
$finalUnitName = $pVal["product_unit"];
$remainQty = ($totalBaseQty % $pVal["base_qnt"]);
$finalQtyBasedOnUnit = ($totalBaseQty - $remainQty) / $pVal["base_qnt"];
break;
}
}
return $finalQtyBasedOnUnit . " " . $finalUnitName . ( $remainQty > 0 ? ", " . near_unit_qty($product_id, $remainQty, $unit) : "");
} else { | 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 easySelectD($query) {
global $table_prefeix; // table prefix;
global $conn; // MySQL connection variable.
$dataFromDB = [];
/* echo $query;
exit(); */
// Run the query and store the result into getResult variable.
$getResult = $conn->query($query);
// Check If the syntax has any error then throw an the error.
if($getResult === false) {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error; // Return the error
}
// Check if there is more then Zero (0) result.
if($getResult->num_rows > 0) {
// return all data in array format
return array(
"count" => $getResult->num_rows,
"data" => $getResult->fetch_all(true)
);
} else {
// Return false if there is no data.
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 |
function save_deleted_date($table, $data) {
global $table_prefeix; // table prefix;
global $conn; // MySQL connection variable.
// Serialize the data
$data = serialize($data);
// Insert deleted data
$conn->query("INSERT INTO {$table_prefeix}deleted_data (deleted_from, deleted_data, deleted_by) VALUES ('{$table}', '{$data}', '{$_SESSION['uid']}')");
} | 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 save_query($query) {
global $table_prefeix; // table prefix;
global $conn; // MySQL connection variable.
$query = json_encode($query);
$conn->query("INSERT INTO {$table_prefeix}latest_queries (query_value) VALUES ($query)");
} | 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 getCustomerPaymentInfo_back(int $customer_id) {
global $table_prefeix;
easySelectD(
"select customer_id, if(customer_opening_balance is null, 0, customer_opening_balance) as customer_opening_balance,
if(sales_grand_total is null, 0, sales_grand_total) as sales_grand_total,
if(returns_grand_total is null, 0, returns_grand_total) as returns_grand_total,
if(received_payments_amount is null, 0, received_payments_amount) as total_received_payments,
if(received_payments_bonus is null, 0, received_payments_bonus) as total_given_bonus
from {$table_prefeix}customers
left join (
select
sales_customer_id,
sum(sales_grand_total) as sales_grand_total
from {$table_prefeix}sales where is_trash = 0 group by sales_customer_id
) as sales on customer_id = sales_customer_id
left join (
select
product_returns_customer_id,
sum(product_returns_grand_total) as returns_grand_total
from {$table_prefeix}product_returns where is_trash = 0 group by product_returns_customer_id
) as product_returns on customer_id = product_returns_customer_id
left join (
select
received_payments_from,
sum(received_payments_amount) as received_payments_amount,
sum(received_payments_bonus) as received_payments_bonus
from {$table_prefeix}received_payments where is_trash = 0 group by received_payments_from
) as {$table_prefeix}received_payments on customer_id = received_payments_from
where customer_id = {$customer_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 |
$whereClause .= "{$whereField} = '".safe_input($whereValue)."'";
}
// Build the query
$sqlQuery = "UPDATE {$table_prefeix}{$table} SET is_trash=1 WHERE {$whereClause}";
// Run the query and check
if($conn->query($sqlQuery) === TRUE) {
return true;
} else {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error;
}
} | 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 calculateProductHavingQuantity(int $productId) {
global $table_prefeix;
return easySelect(
"products",
"product_id, ( IF(purchase_item_quantity IS NULL, 0, SUM(purchase_item_quantity) + if(returns_products_quantity is null, 0, returns_products_quantity) ) - IF(sale_item_quantity IS NULL, 0, SUM(sale_item_quantity))) AS having_item_quantity",
array (
"left join (select purchase_item_product_id, sum(purchase_item_quantity) as purchase_item_quantity from {$table_prefeix}product_purchase_items where is_trash = 0 group by purchase_item_product_id) as {$table_prefeix}product_purchase_items on purchase_item_product_id = product_id",
"left join (select sale_item_product_id, sum(sale_item_quantity) as sale_item_quantity from {$table_prefeix}sale_items where is_trash = 0 group by sale_item_product_id) as {$table_prefeix}sale_items on sale_item_product_id = product_id",
"left join (select product_return_items_product_id, sum(product_return_items_products_quantity) as returns_products_quantity from {$table_prefeix}product_return_items where is_trash = 0 group by product_return_items_product_id) as returns_product on product_id = product_return_items_product_id"
),
array (
"product_id " => $productId
)
)['data'][0]["having_item_quantity"];
} | 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 add_login_info(int $user_id) {
global $table_prefeix; // table prefix;
global $conn; // MySQL connection variable.
$user_ip = safe_input(get_ipaddr());
$user_aggent = safe_input($_SERVER['HTTP_USER_AGENT']);
// Insert User information Into Database
$conn->query("INSERT INTO {$table_prefeix}users_login_history (login_users_id, login_ip, login_user_aggent)
VALUES ('{$user_id}', '{$user_ip}', '{$user_aggent}')");
} | 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 easySelectD($query) {
global $table_prefix; // table prefix;
global $conn; // MySQL connection variable.
$dataFromDB = [];
/* echo $query;
exit(); */
// Run the query and store the result into getResult variable.
$getResult = $conn->query($query);
// Check If the syntax has any error then throw an the error.
if($getResult === false) {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error; // Return the error
}
// Check if there is more then Zero (0) result.
if($getResult->num_rows > 0) {
// return all data in array format
return array(
"count" => $getResult->num_rows,
"data" => $getResult->fetch_all(true)
);
} else {
// Return false if there is no data.
return false;
}
} | 0 | PHP | CWE-829 | Inclusion of Functionality from Untrusted Control Sphere | The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/829.html | vulnerable |
function easySelectD($query) {
global $table_prefix; // table prefix;
global $conn; // MySQL connection variable.
$dataFromDB = [];
/* echo $query;
exit(); */
// Run the query and store the result into getResult variable.
$getResult = $conn->query($query);
// Check If the syntax has any error then throw an the error.
if($getResult === false) {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error; // Return the error
}
// Check if there is more then Zero (0) result.
if($getResult->num_rows > 0) {
// return all data in array format
return array(
"count" => $getResult->num_rows,
"data" => $getResult->fetch_all(true)
);
} else {
// Return false if there is no data.
return false;
}
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
function save_query($query) {
global $table_prefix; // table prefix;
global $conn; // MySQL connection variable.
$query = json_encode($query);
$conn->query("INSERT INTO {$table_prefix}latest_queries (query_value) VALUES ($query)");
} | 0 | PHP | CWE-829 | Inclusion of Functionality from Untrusted Control Sphere | The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/829.html | vulnerable |
function save_query($query) {
global $table_prefix; // table prefix;
global $conn; // MySQL connection variable.
$query = json_encode($query);
$conn->query("INSERT INTO {$table_prefix}latest_queries (query_value) VALUES ($query)");
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
function runQuery($query){
global $conn; // MySQL connection variable.
$runQuery = $conn->query($query);
// Check If the syntax has any error then throw an the error. Otherwise return ture;
if($runQuery === false) {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error; // Return the error
} else {
return true;
}
} | 0 | PHP | CWE-829 | Inclusion of Functionality from Untrusted Control Sphere | The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/829.html | vulnerable |
function runQuery($query){
global $conn; // MySQL connection variable.
$runQuery = $conn->query($query);
// Check If the syntax has any error then throw an the error. Otherwise return ture;
if($runQuery === false) {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error; // Return the error
} else {
return true;
}
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
$whereClause .= "{$whereField} = '".safe_input($whereValue)."'";
}
// Build the query
$sqlQuery = "UPDATE {$table_prefix}{$table} SET is_trash=1 WHERE {$whereClause}";
// Run the query and check
if($conn->query($sqlQuery) === TRUE) {
return true;
} else {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error;
}
} | 0 | PHP | CWE-829 | Inclusion of Functionality from Untrusted Control Sphere | The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/829.html | vulnerable |
$whereClause .= "{$whereField} = '".safe_input($whereValue)."'";
}
// Build the query
$sqlQuery = "UPDATE {$table_prefix}{$table} SET is_trash=1 WHERE {$whereClause}";
// Run the query and check
if($conn->query($sqlQuery) === TRUE) {
return true;
} else {
// insert log
create_log($conn->error, debug_backtrace());
// Keep the transaction error record
$conn->get_all_error[] = $conn->error;
return $conn->error;
}
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
function add_login_info(int $user_id) {
global $table_prefix; // table prefix;
global $conn; // MySQL connection variable.
$user_ip = safe_input(get_ipaddr());
$user_aggent = safe_input($_SERVER['HTTP_USER_AGENT']);
// Insert User information Into Database
$conn->query("INSERT INTO {$table_prefix}users_login_history (login_users_id, login_ip, login_user_aggent)
VALUES ('{$user_id}', '{$user_ip}', '{$user_aggent}')");
} | 0 | PHP | CWE-829 | Inclusion of Functionality from Untrusted Control Sphere | The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/829.html | vulnerable |
function add_login_info(int $user_id) {
global $table_prefix; // table prefix;
global $conn; // MySQL connection variable.
$user_ip = safe_input(get_ipaddr());
$user_aggent = safe_input($_SERVER['HTTP_USER_AGENT']);
// Insert User information Into Database
$conn->query("INSERT INTO {$table_prefix}users_login_history (login_users_id, login_ip, login_user_aggent)
VALUES ('{$user_id}', '{$user_ip}', '{$user_aggent}')");
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
foreach($row as $field) {
if(is_null($field)) {
$fieldData .= " NULL,";
} elseif( is_numeric($field) ) {
$fieldData .= " ".$field.",";
} else {
$fieldData .= " '". $conn->real_escape_string($field) ."',";
}
} | 0 | PHP | CWE-829 | Inclusion of Functionality from Untrusted Control Sphere | The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/829.html | vulnerable |
foreach($row as $field) {
if(is_null($field)) {
$fieldData .= " NULL,";
} elseif( is_numeric($field) ) {
$fieldData .= " ".$field.",";
} else {
$fieldData .= " '". $conn->real_escape_string($field) ."',";
}
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
$rowData .= substr(trim($fieldData), 0, -1);
$rowData .= "),\n";
} | 0 | PHP | CWE-829 | Inclusion of Functionality from Untrusted Control Sphere | The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere. | https://cwe.mitre.org/data/definitions/829.html | vulnerable |
$rowData .= substr(trim($fieldData), 0, -1);
$rowData .= "),\n";
} | 0 | PHP | CWE-352 | Cross-Site Request Forgery (CSRF) | The web application does not, or can not, sufficiently verify whether a well-formed, valid, consistent request was intentionally provided by the user who submitted the request. | https://cwe.mitre.org/data/definitions/352.html | vulnerable |
public static function get_user($input_count, $input_type, $user, $full = 0)
{
$type = self::validate_type($input_type);
// If full then don't limit on date
$date = ($full > 0) ? '0' : time() - (86400 * (int)AmpConfig::get('stats_threshold', 7));
// Select Objects based on user
// FIXME:: Requires table scan, look at improving
$sql = "SELECT `object_id`, COUNT(`id`) AS `count` FROM `object_count` WHERE `object_type` = ? AND `date` >= ? AND `user` = ? GROUP BY `object_id` ORDER BY `count` DESC LIMIT $input_count";
$db_results = Dba::read($sql, array($type, $date, $user));
$results = array();
while ($row = Dba::fetch_assoc($db_results)) {
$results[] = $row;
}
return $results;
} // get_user | 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 |
protected function documentCreate($charset, $version = '1.0')
{
if (!$version) {
$version = '1.0';
}
$this->document = new DOMDocument($version, $charset);
$this->charset = $this->document->encoding;
// $this->document->encoding = $charset;
$this->document->formatOutput = true;
$this->document->preserveWhiteSpace = 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 user_can_access($permission)
{
$user = \Illuminate\Support\Facades\Auth::user();
if (!$user) {
return false;
}
if ($user->is_admin == 1) {
return true;
}
return false;
// return $user->can($permission);
} | 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 is_admin()
{
if(app()->bound('user_manager')){
return app()->user_manager->is_admin();
}
} | 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_ip()
{
$ipaddress = '127.0.0.1';
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$ipaddress = $_SERVER['HTTP_CF_CONNECTING_IP'];
} else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
} else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else if (isset($_SERVER['HTTP_X_FORWARDED'])) {
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
} else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) {
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
} else if (isset($_SERVER['HTTP_FORWARDED'])) {
$ipaddress = $_SERVER['HTTP_FORWARDED'];
} else if (isset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) {
$ipaddress = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
} else if (isset($_SERVER['HTTP_X_REAL_IP'])) {
$ipaddress = $_SERVER['HTTP_X_REAL_IP'];
} else if (isset($_SERVER['REMOTE_ADDR'])) {
$ipaddress = $_SERVER['REMOTE_ADDR'];
}
return $ipaddress;
} | 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_can_view_module($module)
{
//$permissions = \MicroweberPackages\Role\Repositories\Permission::generateModulePermissionsSlugs($module);
$user = \Illuminate\Support\Facades\Auth::user();
if (!$user) {
return false;
}
if ($user->is_admin == 1) {
return true;
}
/* if ($user->can($permissions['index'])) {
return true;
}*/
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 |
function detect_user_id_from_params($params){
if (!empty($params)) {
if (isset($params['username']) || isset($params['email'])) {
if (isset($params['username']) && $params['username'] != false and filter_var($params['username'], FILTER_VALIDATE_EMAIL)) {
$params['email'] = $params['username'];
}
$findUserId = false;
$findByUsername = false;
if (isset($params['username'])) {
$findByUsername = \MicroweberPackages\User\Models\User::where('username', $params['username'])->first();
}
if ($findByUsername) {
$findUserId = $findByUsername->id;
} else {
if (isset($params['email'])) {
$findByEmail = \MicroweberPackages\User\Models\User::where('email', $params['email'])->first();
if ($findByEmail) {
$findUserId = $findByEmail->id;
}
}
}
if (!$findUserId) {
return false;
}
return $findUserId;
}
}
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 |
function user_can_destroy_module($module)
{
// $permissions = \MicroweberPackages\Role\Repositories\Permission::generateModulePermissionsSlugs($module);
$user = \Illuminate\Support\Facades\Auth::user();
if (!$user) {
return false;
}
if ($user->is_admin == 1) {
return true;
}
/* if ($user->can($permissions['destroy'])) {
return true;
}*/
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 |
function is_live_edit()
{
if (!is_admin()) {
return false;
}
$editModeParam = app()->url_manager->param('editmode');
if ($editModeParam == 'n') {
return false;
}
$editModeParam = app()->url_manager->param('editmode');
if ($editModeParam == 'y') {
return true;
}
$editModeParam2 = app()->url_manager->param('editmode',true);
if ($editModeParam2 == 'y') {
return true;
}
if(defined('IN_EDIT') and IN_EDIT){
return true;
}
$editModeSession = app()->user_manager->session_get('editmode');
if ($editModeSession == true and !defined('IN_EDIT')) {
define('IN_EDIT', true);
return true;
}
return $editModeSession;
} | 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 _collect_user_data()
{
$data = array();
$data['user_ip'] = user_ip();
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$data['browser_agent'] = $_SERVER['HTTP_USER_AGENT'];
}
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
$data['language'] = $lang;
}
$last_page = url_current(true);
$ref = false;
if ($last_page == false) {
$last_page = $_SERVER['PHP_SELF'];
}
if (isset($_SERVER['HTTP_REFERER'])) {
$ref = $_SERVER['HTTP_REFERER'];
}
if (is_ajax()) {
if (isset($_POST['referrer'])) {
$ref = $_POST['referrer'];
}
}
if ($last_page) {
$last_page = rtrim($last_page, '?');
$last_page = rtrim($last_page, '#');
}
if (strstr($ref, admin_url())) {
return;
}
$data['visit_url'] = $last_page;
$data['referrer'] = $ref;
$data['session_id'] = mw()->user_manager->session_id();
$data['user_id'] = mw()->user_manager->id();
$data['content_id'] = content_id();
$data['category_id'] = category_id();
return $data;
} | 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->assertStringNotContainsString($stringItem, $findPage->content);
}
} | 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 |
$encoded = base64_encode(json_encode($fieldsData));
$response = $this->call(
'POST',
route('api.content.save_edit'),
[
'data_base64' => $encoded,
],
[],//params
$_COOKIE,//cookie
[],//files
$_SERVER //server
);
$fieldSaved = $response->decodeResponseJson();
$this->assertEquals(trim($fieldSaved[0]['content']), trim($contentFieldHtml));
$this->assertEquals($fieldSaved[0]['rel_type'], 'content');
$this->assertEquals($fieldSaved[0]['field'], 'content');
$pq2 = \phpQuery::newDocument($contentFieldHtml);
$this->assertEquals($contentFieldHtml, $pq2->htmlOuter());
$findPage = Page::whereId($fieldSaved[0]['id'])->first();
$contentFieldHtml1 = trim($contentFieldHtml);
$contentFieldHtml2 = trim($findPage->content);
$this->assertEquals($contentFieldHtml1, $contentFieldHtml2);
$this->assertEquals($contentFieldHtml, $findPage->content);
} | 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 |
$href = pq($stuffs)->attr('href');
if($href){
pq($stuffs)->attr('href', str_replace(' ', '%20', $href));
}
}
$text = $pq->htmlOuter();
$text = str_ireplace('___mw-site-url-temp-replace-on-clean___','{SITE_URL}', $text);
return $text;
} | 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 cleanupAndPrepare(){
$user = User::where('is_admin', '=', '1')->first();
Auth::login($user);
\Config::set('microweber.disable_model_cache', 1);
MultilanguageHelpers::setMultilanguageEnabled(0);
Page::truncate();
} | 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 get_by_order_id($order_id = false)
{
$order_id = intval($order_id);
if ($order_id == false) {
return;
}
$params = array();
$table = 'cart';
$params['table'] = $table;
$params['order_id'] = $order_id;
$get = $this->app->database_manager->get($params);
if (!empty($get)) {
foreach ($get as $k => $item) {
if (is_array($item) and isset($item['custom_fields_data']) and $item['custom_fields_data'] != '') {
$item = $this->app->format->render_item_custom_fields_data($item);
}
if (!isset($item['item_image']) and is_array($item) and isset($item['rel_id']) and isset($item['rel_type']) and $item['rel_type'] == 'content') {
$item['item_image'] = get_picture($item['rel_id']);
}
if (!isset($item['item_image'])) {
$item['item_image'] = false;
}
$get[$k] = $item;
}
}
return $get;
} | 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 table_name()
{
return 'cart';
} | 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 scopeActive($query)
{
return $query->where('is_active', 1)->where('is_deleted', 0);
} | 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 function save()
{
$validate = [
'state.comment_body' => 'required|min:3',
];
if (!user_id()) {
$validate['state.comment_name'] = 'required|min:3';
$validate['state.comment_email'] = 'required|email';
}
$this->validate($validate);
$comment = new \MicroweberPackages\Comment\Models\Comment();
if (isset($this->state['rel_id'])) {
$comment->rel_id = $this->state['rel_id'];
$comment->rel_type = 'content';
}
if (isset($this->state['reply_to_comment_id'])) {
$comment->reply_to_comment_id = $this->state['reply_to_comment_id'];
}
$comment->user_ip = user_ip();
$comment->session_id = session_id();
if (user_id()) {
$comment->created_by = user_id();
} else {
$comment->comment_name = $this->state['comment_name'];
$comment->comment_email = $this->state['comment_email'];
}
$comment->comment_body = $this->state['comment_body'];
$comment->save();
$this->state['comment_body'] = '';
$this->state['comment_name'] = '';
$this->state['comment_email'] = '';
$this->emit('commentAdded', $comment->id);
} | 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 |
save_media(array(
'allow_remote_download' => 1,
'rel_type' => 'content',
'rel_id' => $model->id,
'title' => 'Picture',
'media_type' => 'picture',
'src' => $url,
));
}
}
}
unset($model->media_urls);
} | 0 | PHP | CWE-755 | Improper Handling of Exceptional Conditions | The product does not handle or incorrectly handles an exceptional condition. | https://cwe.mitre.org/data/definitions/755.html | vulnerable |
public function up()
{
if (!Schema::hasTable('media')) {
Schema::create('media', function (Blueprint $table) {
$table->id();
$table->text('title')->nullable();
$table->text('description')->nullable();
$table->text('embed_code')->nullable();
$table->text('filename')->nullable();
$table->text('media_type')->nullable()->index();
$table->string('rel_type')->nullable()->index();
$table->string('rel_id')->nullable()->index();
$table->integer('created_by')->nullable();
$table->integer('edited_by')->nullable();
$table->string('session_id')->nullable();
$table->longText('image_options')->nullable();
$table->integer('position')->nullable();
$table->timestamps();
});
}
} | 0 | PHP | CWE-755 | Improper Handling of Exceptional Conditions | The product does not handle or incorrectly handles an exceptional condition. | https://cwe.mitre.org/data/definitions/755.html | vulnerable |
public function testSaveMedia()
{
$picture = array(
'rel_type' => 'content',
'rel_id' => 3,
'title' => 'My new pic',
'media_type' => 'picture',
'src' => 'http://lorempixel.com/400/200/',
);
$saved_pic_id = save_media($picture);
$picture_data = get_media_by_id($saved_pic_id);
$src = $picture_data['filename'];
$title = $picture_data['title'];
$this->assertEquals(intval($saved_pic_id) > 0, true);
$this->assertEquals(is_array($picture_data), true);
$this->assertEquals($title, 'My new pic');
$this->assertEquals($src, 'http://lorempixel.com/400/200/');
} | 0 | PHP | CWE-755 | Improper Handling of Exceptional Conditions | The product does not handle or incorrectly handles an exceptional condition. | https://cwe.mitre.org/data/definitions/755.html | vulnerable |
public function testDeleteMedia()
{
$picture = array(
'rel_type' => 'content',
'rel_id' => 3,
'title' => 'My new pic to del',
'media_type' => 'picture',
'src' => 'http://lorempixel.com/400/200/',
);
$saved_pic_id = save_media($picture);
$picture_data = get_media_by_id($saved_pic_id);
$to_delete = array('id' => $saved_pic_id);
$delete = delete_media($to_delete);
$title = $picture_data['title'];
$picture_null = get_media_by_id($saved_pic_id);
$this->assertEquals($picture_null, false);
$this->assertEquals(is_array($picture_data), true);
$this->assertEquals($title, 'My new pic to del');
$this->assertEquals(!($delete), false);
} | 0 | PHP | CWE-755 | Improper Handling of Exceptional Conditions | The product does not handle or incorrectly handles an exceptional condition. | https://cwe.mitre.org/data/definitions/755.html | vulnerable |
function twitter_feed_perform_api_request($url = 'https://api.twitter.com/1.1/search/tweets.json', $getfield = false) {
$oauth_access_token = get_option('access_token', 'twitter_feed');
$oauth_access_token_secret = get_option('access_token_secret', 'twitter_feed');
$consumer_key = get_option('consumer_key', 'twitter_feed');
$consumer_secret = get_option('consumer_secret', 'twitter_feed');
if ($oauth_access_token==false){
$oauth_access_token = "220111598-87eLa7MgXZmd7YeRSkenTSVxhZikok61PXMKZFti";
}
if ($oauth_access_token_secret==false){
$oauth_access_token_secret = "KsDrxrxoGqVVK0ethvcTTrV58RBH3WUjnPeI616fnxIFS";
}
if ($consumer_key==false){
$consumer_key = "WgDmyOjMgX1N7RhcLpQqzUrtR";
}
if ($consumer_secret==false){
$consumer_secret = "0e8PlzIeKlmGGyH1ajS2Ggaw0anPTX23p3gp2WqZ0PCNxkYYX1";
}
if (!$oauth_access_token || !$oauth_access_token_secret || !$consumer_key || !$consumer_secret){
return false;
}
$cache_expiration_minutes = 1500;
$cache_id = md5($url . $getfield);
$cache_group = 'twitter_feed_2';
$cached_results = cache_get($cache_id, $cache_group,$cache_expiration_minutes);
if ($cached_results!=false){
return $cached_results;
}
$settings = array(
'oauth_access_token' => $oauth_access_token,
'oauth_access_token_secret' => $oauth_access_token_secret,
'consumer_key' => $consumer_key,
'consumer_secret' => $consumer_secret
);
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$response = $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
$return = json_decode($response, true);
if (!empty($return)){
cache_save($return, $cache_id, $cache_group, $cache_expiration_minutes);
}
return $return;
} | 0 | PHP | CWE-798 | Use of Hard-coded Credentials | The product contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data. | https://cwe.mitre.org/data/definitions/798.html | vulnerable |
function twitter_feed_get_user_tweets($twitter_handle = false, $results_count = 5) {
$count = intval($results_count);
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?include_entities=true&include_rts=false&count=' . $count . '&exxclude_replies=true&nofilter=retweets&screen_name=' . $twitter_handle;
//dd($url, $getfield);
$items = twitter_feed_perform_api_request($url, $getfield);
if(isset($items["errors"])){
return;
}
return $items;
} | 0 | PHP | CWE-798 | Use of Hard-coded Credentials | The product contains hard-coded credentials, such as a password or cryptographic key, which it uses for its own inbound authentication, outbound communication to external components, or encryption of internal data. | https://cwe.mitre.org/data/definitions/798.html | vulnerable |
foreach($w as $c) {
/* print items */
$wdet = (array) $widgets[$c];
if(array_key_exists($c, $widgets)) {
//reset size if not set
if(is_blank($wdet['wsize'])) { $wdet['wsize'] = 6; }
print " <div class='col-xs-12 col-sm-12 col-md-12 col-lg-$wdet[wsize] widget-dash' id='w-$wdet[wfile]'>";
print " <div class='inner'><i class='fa fa-times remove-widget icon-action fa-gray pull-right'></i>";
// href?
if($wdet['whref']=="yes") { print "<a href='".create_link("widgets",$wdet['wfile'])."'> <h4>"._($wdet['wtitle'])."<i class='fa fa-external-link fa-gray pull-right'></i></h4></a>"; }
else { print "<h4>"._($wdet['wtitle'])."</h4>"; }
print " <div class='hContent'>";
print " <div style='text-align:center;padding-top:50px;'><strong>"._('Loading widget')."</strong><br><i class='fa fa-spinner fa-spin'></i></div>";
print " </div>";
print " </div>";
print " </div>";
}
# invalid widget
else {
print " <div class='col-xs-12 col-sm-12 col-md-12 col-lg-6' id='w-$c'>";
print " <div class='inner'>";
print " <blockquote style='margin-top:20px;margin-left:20px;'><p>Invalid widget $c</p></blockquote>";
print " </div>";
print " </div>";
}
} | 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 noxss_html($html) {
if (!is_string($html) || is_blank($html))
return "";
// Convert encoding to UTF-8
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8');
// Throw loadHTML() parsing errors
$err_mode = libxml_use_internal_errors(false);
$php_reporting = error_reporting(0);
try {
$dom = new \DOMDocument();
if ($dom->loadHTML("<html>".$html."</html>", LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS | LIBXML_NOWARNING | LIBXML_NOERROR) === false)
return "";
$banned_elements = ['script', 'iframe', 'embed'];
$remove_elements = [];
$elements = $dom->getElementsByTagName('*');
if (is_object($elements) && $elements->length>0) {
foreach($elements as $e) {
if (in_array($e->nodeName, $banned_elements)) {
$remove_elements[] = $e;
continue;
}
if (!$e->hasAttributes())
continue;
// remove on* HTML event attributes
foreach ($e->attributes as $attr) {
if (substr($attr->nodeName,0,2) == "on")
$e->removeAttribute($attr->nodeName);
}
}
// Remove banned elements
foreach($remove_elements as $e)
$e->parentNode->removeChild($e);
// Return sanitised HTML
$html = str_replace(['<html>', '</html>'], '', $dom->saveHTML());
}
} catch (Exception $e) {
$html = "";
}
// restore error mode
libxml_use_internal_errors($err_mode);
error_reporting($php_reporting);
return is_string($html) ? $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 |
foreach ([$this->classes, $this->interfaces, $this->traits, $this->enums] as $definitions) {
if (array_key_exists($fqdn, $definitions)) {
$definition = $definitions[$fqdn];
if (is_iterable($definition['context']->annotations)) {
foreach (array_reverse($definition['context']->annotations) as $annotation) {
if ($annotation->isRoot(OA\Schema::class) && !$annotation->_context->is('generated')) {
return $annotation;
}
}
}
}
} | 0 | PHP | CWE-1103 | Use of Platform-Dependent Third Party Components | The product relies on third-party components that do
not provide equivalent functionality across all desirable
platforms. | https://cwe.mitre.org/data/definitions/1103.html | vulnerable |
$object = new \stdClass();
foreach ($this->{$property} as $key => $item) {
if (is_numeric($key) === false && is_array($item)) {
$object->{$key} = $item;
} else {
$key = $item->{$keyField};
if (!Generator::isDefault($key) && empty($object->{$key})) {
if ($item instanceof \JsonSerializable) {
$object->{$key} = $item->jsonSerialize();
} else {
$object->{$key} = $item;
}
unset($object->{$key}->{$keyField});
}
}
}
$data->{$property} = $object;
}
// $ref
if (isset($data->ref)) {
// Only specific https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#reference-object
$ref = ['$ref' => $data->ref];
if ($this->_context->version == OpenApi::VERSION_3_1_0) {
$defaultValues = get_class_vars(get_class($this));
foreach (['summary', 'description'] as $prop) {
if (property_exists($this, $prop)) {
if ($this->{$prop} !== $defaultValues[$prop]) {
$ref[$prop] = $data->{$prop};
}
}
}
}
$data = (object) $ref;
}
if ($this->_context->version == OpenApi::VERSION_3_1_0) {
if (isset($data->nullable)) {
if (true === $data->nullable) {
$data->type = (array) $data->type;
$data->type[] = 'null';
}
unset($data->nullable);
}
}
return $data;
} | 0 | PHP | CWE-1103 | Use of Platform-Dependent Third Party Components | The product relies on third-party components that do
not provide equivalent functionality across all desirable
platforms. | https://cwe.mitre.org/data/definitions/1103.html | vulnerable |
function validate() {
if (!ctype_alnum($_POST ['fpuser']))
$err [] = "{$_POST['fpuser']} is not a valid username.
Username must be alphanumeric and should not contain spaces.";
if (strlen(trim(($_POST ['fppwd']))) < 6)
$err [] = "Password must contain at least 6 non-space characters";
if (($_POST ['fppwd']) != ($_POST ['fppwd2']))
$err [] = "Passwords did not match";
if (!(preg_match('!@.*@|\.\.|\,|\;!', $_POST ['email']) || preg_match('!^.+\@(\[?)[a-zA-Z0-9\.\-]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$!', $_POST ['email'])))
$err [] = "{$_POST['email']} is not a valid email address";
$www = $_POST ['www'];
if (!(preg_match('!^http(s)?://[\w-]+\.[\w-]+(\S+)?$!i', $www) || preg_match('!^http(s)?://localhost!', $www)))
$err [] = "$www is not a valid URL";
if ($www && $www [strlen($www) - 1] != '/')
$www .= '/';
global $fp_config;
$fp_config ['general'] ['author'] = $user ['userid'] = $_POST ['fpuser'];
$user ['password'] = $_POST ['fppwd'];
$fp_config ['general'] ['www'] = $user ['www'] = $www;
$fp_config ['general'] ['email'] = $user ['email'] = $_POST ['email'];
if (isset($err)) {
$GLOBALS ['err'] = $err;
return false;
}
$fp_config ['general'] ['blogid'] = system_generate_id(BLOG_ROOT . $user ['www'] . $user ['email'] . $user ['userid']);
config_save();
system_hashsalt_save();
user_add($user);
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 |
$static_list[$id] = static_parse($id);
}
$this->smarty->assign('static_list', $static_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 |
function cleartplcache() {
// if theme was switched, clear tpl cache
$tpl = new tpl_deleter();
$tpl->getList();
} | 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 onsave() {
global $fp_config;
$l = explode(',',$_POST['lang']);
$fp_config['general'] = array(
//'BLOG_ROOT' => $_POST['blog_root'],
'www' => $_POST['www'],
'title' => html_entity_decode(stripslashes($_POST['title'])),
'subtitle' => html_entity_decode(stripslashes($_POST['subtitle'])),
'footer' => html_entity_decode(stripslashes($_POST['blogfooter'])),
'author' => $_POST['author'],
'email' => $_POST['email'],
'startpage' => ($_POST['startpage'] == ':NULL:')? null : $_POST['startpage'],
'maxentries' => $_POST['maxentries'],
// 'voting' => $_POST['voting'],
'notify' => isset($_POST['notify']),
/* preserve the following */
'theme' => $fp_config['general']['theme'],
'style' => @$fp_config['general']['style'],
'blogid' => $fp_config['general']['blogid'],
'charset'=> 'utf-8',
);
$fp_config['locale'] = array(
'timeoffset' => $_POST['timeoffset'],
'timeformat' => $_POST['timeformat'],
'dateformat' => $_POST['dateformat'],
'dateformatshort' => $_POST['dateformatshort'],
'charset' => $_POST['charset'],
'lang' => $_POST['lang']
);
// 'LANG' => $l[0],
// 'CHARSET'=> $l[1],
$success = config_save()? 1: -1;
$this->smarty->assign('success', $success);
return 1;
} | 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 onerror() {
$this->main();
return 0;
} | 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.