code
stringlengths 12
2.05k
| label
int64 0
1
| programming_language
stringclasses 9
values | cwe_id
stringlengths 6
14
| cwe_name
stringlengths 5
103
⌀ | description
stringlengths 36
1.23k
⌀ | url
stringlengths 36
48
⌀ | label_name
stringclasses 2
values |
---|---|---|---|---|---|---|---|
public function enable()
{
$this->checkCSRFParam();
$project = $this->getProject();
$swimlane_id = $this->request->getIntegerParam('swimlane_id');
if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) {
$this->flash->success(t('Swimlane updated successfully.'));
} else {
$this->flash->failure(t('Unable to update this swimlane.'));
}
$this->response->redirect($this->helper->url->to('SwimlaneController', 'index', array('project_id' => $project['id'])));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
function getResourceTypeID($name) {
$name = mysql_real_escape_string($name);
$query = "SELECT id "
. "FROM resourcetype "
. "WHERE name = '$name'";
$qh = doQuery($query, 101);
if($row = mysql_fetch_row($qh))
return $row[0];
else
return NULL;
} | 1 | PHP | CWE-264 | Permissions, Privileges, and Access Controls | Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control. | https://cwe.mitre.org/data/definitions/264.html | safe |
$count += $db->dropTable($basename);
}
flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');
expHistory::back();
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 popupnewsitem($id) {
$id = intval($id);
if(!is_numeric($id)){header('Location: '.url('/'));}
$result = PopUpNewsData::popupnewsitem($id);
Template::Set('item', $result);
Template::Show('popupnews/popupnews_item.tpl');
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function tokenizeHTML($html, $config, $context) {
$new_html = $this->normalize($html, $config, $context);
$new_html = $this->wrapHTML($new_html, $config, $context);
try {
$parser = new HTML5($new_html);
$doc = $parser->save();
} catch (DOMException $e) {
// Uh oh, it failed. Punt to DirectLex.
$lexer = new HTMLPurifier_Lexer_DirectLex();
$context->register('PH5PError', $e); // save the error, so we can detect it
return $lexer->tokenizeHTML($html, $config, $context); // use original HTML
}
$tokens = array();
$this->tokenizeDOM(
$doc->getElementsByTagName('html')->item(0)-> // <html>
getElementsByTagName('body')->item(0)-> // <body>
getElementsByTagName('div')->item(0) // <div>
, $tokens);
return $tokens;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
static function getForm($id) {
$id = sqlescape($id);
$form = sqlfetch(sqlquery("SELECT * FROM btx_form_builder_forms WHERE id = '$id'"));
if (!$form) {
return false;
}
$fields = array();
$object_count = 0;
$field_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE form = '$id' AND `column` = '0' ORDER BY position DESC, id ASC");
while ($field = sqlfetch($field_query)) {
$object_count++;
if ($field["type"] == "column") {
// Get left column
$column_fields = array();
$column_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE `column` = '".$field["id"]."' AND `alignment` = 'left' ORDER BY position DESC, id ASC");
while ($sub_field = sqlfetch($column_query)) {
$column_fields[] = $sub_field;
$object_count++;
}
$field["fields"] = $column_fields;
$fields[] = $field;
// Get right column
$column_fields = array();
$column_query = sqlquery("SELECT * FROM btx_form_builder_fields WHERE `column` = '".$field["id"]."' AND `alignment` = 'right' ORDER BY position DESC, id ASC");
while ($sub_field = sqlfetch($column_query)) {
$column_fields[] = $sub_field;
$object_count++;
}
$field["fields"] = $column_fields;
$fields[] = $field;
// Column start/end count as objects so we add 3 since there's two columns
$object_count += 3;
} else {
$fields[] = $field;
}
}
$form["fields"] = $fields;
$form["object_count"] = $object_count - 1; // We start at 0
return $form;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
$layout[$position] = array($elem => $initLayout[$position][$elem]) + $layout[$position]; // unshift key-value pair
$changed = true;
}
// remove obsolete widgets
$arrayDiff =
array_diff(array_keys($layoutWidgets), array_keys($initLayoutWidgets));
foreach($arrayDiff as $elem){
if(in_array ($elem, array_keys ($layout[$position]))) {
unset($layout[$position][$elem]);
$changed = true;
} else if($position === 'center' && in_array ($elem, array_keys ($layout['hidden']))) {
unset($layout['hidden'][$elem]);
$changed = true;
}
}
// ensure that widget properties are the same as those in the default layout
foreach($layout[$position] as $name=>$arr){
if (in_array ($name, array_keys ($initLayout[$position])) &&
$initLayout[$position][$name]['title'] !== $arr['title']) {
$layout[$position][$name]['title'] = $initLayout[$position][$name]['title'];
$changed = true;
}
}
if ($position === 'center') {
foreach($layout['hidden'] as $name=>$arr){
if (in_array ($name, array_keys ($initLayout[$position])) &&
$initLayout[$position][$name]['title'] !== $arr['title']) {
$layout['hidden'][$name]['title'] = $initLayout[$position][$name]['title'];
$changed = true;
}
}
}
if($changed){
$this->layout = json_encode($layout);
$this->update(array('layout'));
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 connect($host, $port = false, $tval = 30)
{
// Are we already connected?
if ($this->connected) {
return true;
}
//On Windows this will raise a PHP Warning error if the hostname doesn't exist.
//Rather than suppress it with @fsockopen, capture it cleanly instead
set_error_handler(array($this, 'catchWarning'));
if (false === $port) {
$port = $this->POP3_PORT;
}
// connect to the POP3 server
$this->pop_conn = fsockopen(
$host, // POP3 Host
$port, // Port #
$errno, // Error Number
$errstr, // Error Message
$tval
); // Timeout (seconds)
// Restore the error handler
restore_error_handler();
// Did we connect?
if (false === $this->pop_conn) {
// It would appear not...
$this->setError(array(
'error' => "Failed to connect to server $host on port $port",
'errno' => $errno,
'errstr' => $errstr
));
return false;
}
// Increase the stream time-out
stream_set_timeout($this->pop_conn, $tval, 0);
// Get the POP3 server response
$pop3_response = $this->getResponse();
// Check for the +OK
if ($this->checkResponse($pop3_response)) {
// The connection is established and the POP3 server is talking
$this->connected = true;
return true;
}
return false;
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public static function getTestHost () {
return preg_replace ('/^https?:\/\/([^\/]+)\/.*$/', '$1', TEST_WEBROOT_URL);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
$module_views[$key]['name'] = gt($value['name']);
}
// look for a config form for this module's current view
// $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod);
//check to see if hcview was passed along, indicating a hard-coded module
// if (!empty($controller->params['hcview'])) {
// $viewname = $controller->params['hcview'];
// } else {
// $viewname = $db->selectValue('container', 'view', "internal='".serialize($controller->loc)."'");
// }
// $viewconfig = $viewname.'.config';
// foreach ($modpaths as $path) {
// if (file_exists($path.'/'.$viewconfig)) {
// $fileparts = explode('_', $viewname);
// if ($fileparts[0]=='show'||$fileparts[0]=='showall') array_shift($fileparts);
// $module_views[$viewname]['name'] = ucwords(implode(' ', $fileparts)).' '.gt('View Configuration');
// $module_views[$viewname]['file'] =$path.'/'.$viewconfig;
// }
// }
// sort the views highest to lowest by filename
// we are reverse sorting now so our array merge
// will overwrite property..we will run array_reverse
// when we're finished to get them back in the right order
krsort($common_views);
krsort($module_views);
if (!empty($moduleconfig)) $common_views = array_merge($common_views, $moduleconfig);
$views = array_merge($common_views, $module_views);
$views = array_reverse($views);
return $views;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
function draw_vdef_preview($vdef_id) {
?>
<tr class='even'>
<td style='padding:4px'>
<pre>vdef=<?php print html_escape(get_vdef($vdef_id, true));?></pre>
</td>
</tr>
<?php
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
$result[$index][1] = preg_replace(
"/" . $find . "/",
$replaceWith,
$row[0]
);
}
}
return $result;
} | 0 | PHP | CWE-94 | Improper Control of Generation of Code ('Code Injection') | The software constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. | https://cwe.mitre.org/data/definitions/94.html | vulnerable |
public function getRaw() {
return $this->errors;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
function edit_externalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
if (empty($section->id)) {
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 testSameInstanceWhenSameProtocol()
{
$r = new Response(200);
$this->assertSame($r, $r->withProtocolVersion('1.1'));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
static function validUTF($string) {
if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {
return false;
}
return true;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
protected function makeArchive($dir, $files, $name, $arc) {
if ($arc['cmd'] === 'phpfunction') {
if (is_callable($arc['argc'])) {
call_user_func_array($arc['argc'], array($dir, $files, $name));
}
} else {
$cwd = getcwd();
chdir($dir);
foreach($files as $i => $file) {
$files[$i] = '.'.DIRECTORY_SEPARATOR.$file;
}
$files = array_map('escapeshellarg', $files);
$cmd = $arc['cmd'].' '.$arc['argc'].' '.escapeshellarg($name).' '.implode(' ', $files);
$this->procExec($cmd, $o, $c);
chdir($cwd);
}
$path = $dir.DIRECTORY_SEPARATOR.$name;
return file_exists($path) ? $path : false;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
function addDiscountToCart() {
// global $user, $order;
global $order;
//lookup discount to see if it's real and valid, and not already in our cart
//this will change once we allow more than one coupon code
$discount = new discounts();
$discount = $discount->getCouponByName(expString::escape($this->params['coupon_code']));
if (empty($discount)) {
flash('error', gt("This discount code you entered does not exist."));
//redirect_to(array('controller'=>'cart', 'action'=>'checkout'));
expHistory::back();
}
//check to see if it's in our cart already
if ($this->isDiscountInCart($discount->id)) {
flash('error', gt("This discount code is already in your cart."));
//redirect_to(array('controller'=>'cart', 'action'=>'checkout'));
expHistory::back();
}
//this should really be reworked, as it shoudn't redirect directly and not return
$validateDiscountMessage = $discount->validateDiscount();
if ($validateDiscountMessage == "") {
//if all good, add to cart, otherwise it will have redirected
$od = new order_discounts();
$od->orders_id = $order->id;
$od->discounts_id = $discount->id;
$od->coupon_code = $discount->coupon_code;
$od->title = $discount->title;
$od->body = $discount->body;
$od->save();
// set this to just the discount applied via this coupon?? if so, when though? $od->discount_total = ??;
flash('message', gt("The discount code has been applied to your cart."));
} else {
flash('error', $validateDiscountMessage);
}
//redirect_to(array('controller'=>'cart', 'action'=>'checkout'));
expHistory::back();
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public function downloadFiles() {
App()->loadLibrary('admin.pclzip');
$folder = basename(Yii::app()->request->getPost('folder', 'global'));
$files = Yii::app()->request->getPost('files');
$tempdir = Yii::app()->getConfig('tempdir');
$randomizedFileName = $folder.'_'.substr(md5(time()),3,13).'.zip';
$zipfile = $tempdir.DIRECTORY_SEPARATOR.$randomizedFileName;
$arrayOfFiles = array_map( function($file){ return $file['path']; }, $files);
$archive = new PclZip($zipfile);
$checkFileCreate = $archive->create($arrayOfFiles, PCLZIP_OPT_REMOVE_ALL_PATH);
$urlFormat = Yii::app()->getUrlManager()->getUrlFormat();
$getFileLink = Yii::app()->createUrl('admin/filemanager/sa/getZipFile');
$_SESSION['__path'] = $zipfile;
$this->_printJsonResponse(
[
'success' => true,
'message' => sprintf(gT("Files are ready for download in archive %s."), $randomizedFileName),
'downloadLink' => $getFileLink ,
]
);
} | 1 | PHP | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. | https://cwe.mitre.org/data/definitions/22.html | safe |
public static function parentPlaceholder($section = '')
{
if (! isset(static::$parentPlaceholder[$section])) {
static::$parentPlaceholder[$section] = '##parent-placeholder-'.sha1($section).'##';
}
return static::$parentPlaceholder[$section];
} | 0 | PHP | CWE-327 | Use of a Broken or Risky Cryptographic Algorithm | The use of a broken or risky cryptographic algorithm is an unnecessary risk that may result in the exposure of sensitive information. | https://cwe.mitre.org/data/definitions/327.html | vulnerable |
public function setAttributes ($values, $safeOnly=true) {
if (isset ($values['type']) && $this->type !== $values['type']) {
$this->_typeChanged = true;
}
return parent::setAttributes ($values, $safeOnly);
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
static function isSearchable() { return true; } | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function display_sdm_thumbnail_meta_box($post) { // Thumbnail upload metabox
$old_thumbnail = get_post_meta($post->ID, 'sdm_upload_thumbnail', true);
$old_value = isset($old_thumbnail) ? $old_thumbnail : '';
_e('Manually enter a valid URL, or click "Select Image" to upload (or choose) the file thumbnail image.', 'simple-download-monitor');
?>
<br /><br />
<input id="sdm_upload_thumbnail" type="text" size="100" name="sdm_upload_thumbnail" value="<?php echo $old_value; ?>" placeholder="http://..." />
<br /><br />
<input id="upload_thumbnail_button" type="button" class="button-primary" value="<?php _e('Select Image', 'simple-download-monitor'); ?>" />
<input id="remove_thumbnail_button" type="button" class="button" value="<?php _e('Remove Image', 'simple-download-monitor'); ?>" />
<br /><br />
<span id="sdm_admin_thumb_preview">
<?php
if (!empty($old_value)) {
?><img id="sdm_thumbnail_image" src="<?php echo $old_value; ?>" style="max-width:200px;" />
<?php
}
?>
</span>
<?php
echo '<p class="description">';
_e('This thumbnail image will be used to create a fancy file download box if you want to use it.', 'simple-download-monitor');
echo '</p>';
wp_nonce_field('sdm_thumbnail_box_nonce', 'sdm_thumbnail_box_nonce_check');
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 dplChapterParserFunction( &$parser, $text = '', $heading = ' ', $maxLength = -1, $page = '?page?', $link = 'default', $trim = false ) {
$parser->addTrackingCategory( 'dplchapter-parserfunc-tracking-category' );
$output = \DPL\LST::extractHeadingFromText( $parser, $page, '?title?', $text, $heading, '', $sectionHeading, true, $maxLength, $link, $trim );
return $output[0];
} | 0 | PHP | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | vulnerable |
private function formatMessage($message)
{
if ($this->timezone) {
$graylogTime = new DateTime($message['message']['timestamp']);
$offset = $this->timezone->getOffset($graylogTime);
$timeInterval = DateInterval::createFromDateString((string) $offset . 'seconds');
$graylogTime->add($timeInterval);
$displayTime = $graylogTime->format('Y-m-d H:i:s');
} else {
$displayTime = $message['message']['timestamp'];
}
$device = $this->deviceFromSource($message['message']['source']);
$level = $message['message']['level'] ?? '';
$facility = $message['message']['facility'] ?? '';
return [
'severity' => $this->severityLabel($level),
'timestamp' => $displayTime,
'source' => $device ? Url::deviceLink($device) : $message['message']['source'],
'message' => $message['message']['message'] ?? '',
'facility' => is_numeric($facility) ? "($facility) " . __("syslog.facility.$facility") : $facility,
'level' => (is_numeric($level) && $level >= 0) ? "($level) " . __("syslog.severity.$level") : $level,
];
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 open($savePath, $sessionName)
{
$return = (bool) $this->handler->open($savePath, $sessionName);
if (true === $return) {
$this->active = true;
}
return $return;
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 actionGetItems($term){
X2LinkableBehavior::getItems ($term);
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
private function assertProduces($bbcode, $html)
{
$this->assertEquals($html, $this->defaultParse($bbcode));
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
function getTypes($subtype="both") {
$types = array("users" => array(),
"resources" => array());
if($subtype == "users" || $subtype == "both") {
$query = "SELECT id, name FROM userprivtype";
$qh = doQuery($query, 365);
while($row = mysql_fetch_assoc($qh)) {
if($row["name"] == "block" || $row["name"] == "cascade")
continue;
$types["users"][$row["id"]] = $row["name"];
}
}
if($subtype == "resources" || $subtype == "both") {
$query = "SELECT id, name FROM resourcetype";
$qh = doQuery($query, 366);
while($row = mysql_fetch_assoc($qh)) {
if($row["name"] == "block" || $row["name"] == "cascade")
continue;
$types["resources"][$row["id"]] = $row["name"];
}
}
return $types;
} | 0 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
public function actionGetItems($term){
X2LinkableBehavior::getItems ($term);
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public function getQueryGroupby()
{
return "a.per_tracker_artifact_id";
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 search(){
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria;
$username = Yii::app()->user->name;
$criteria->addCondition("uploadedBy='$username' OR private=0 OR private=null");
$criteria->addCondition("associationType != 'theme'");
return $this->searchBase($criteria);
} | 0 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
public function toolbar() {
// global $user;
$menu = array();
$dirs = array(
BASE.'framework/modules/administration/menus',
BASE.'themes/'.DISPLAY_THEME.'/modules/administration/menus'
);
foreach ($dirs as $dir) {
if (is_readable($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if (substr($file,-4,4) == '.php' && is_readable($dir.'/'.$file) && is_file($dir.'/'.$file)) {
$menu[substr($file,0,-4)] = include($dir.'/'.$file);
if (empty($menu[substr($file,0,-4)])) unset($menu[substr($file,0,-4)]);
}
}
}
}
// sort the top level menus alphabetically by filename
ksort($menu);
$sorted = array();
foreach($menu as $m) $sorted[] = $m;
// slingbar position
if (isset($_COOKIE['slingbar-top'])){
$top = $_COOKIE['slingbar-top'];
} else {
$top = SLINGBAR_TOP;
}
assign_to_template(array(
'menu'=>(bs3()) ? $sorted : json_encode($sorted),
"top"=>$top
));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 turn()
{
$this->setError('The SMTP TURN command is not implemented');
$this->edebug('SMTP NOTICE: ' . $this->error['error'], self::DEBUG_CLIENT);
return false;
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public function params()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
function cfdef_input_textbox( array $p_field_def, $p_custom_field_value, $p_required = '' ) {
echo '<input ', helper_get_tab_index(), ' type="text" id="custom_field_', $p_field_def['id']
, '" name="custom_field_', $p_field_def['id'], '" ', $p_required;
if( $p_field_def['length_max'] > 0 ) {
echo ' maxlength="' . $p_field_def['length_max'] . '"'
, ' size="' . min( 80, $p_field_def['length_max'] ) . '"';
} else {
echo ' maxlength="255" size="80"';
}
if( !empty( $p_field_def['valid_regexp'] ) ) {
# the custom field regex is evaluated with preg_match and looks for a partial match in the string
# however, the html property is matched for the whole string.
# unless we have explicit start and end tokens, adapt the html regex to allow a substring match.
$t_cf_regex = $p_field_def['valid_regexp'];
if( substr( $t_cf_regex, 0, 1 ) != '^' ) {
$t_cf_regex = '.*' . $t_cf_regex;
}
if( substr( $t_cf_regex, -1 ) != '$' ) {
$t_cf_regex .= '.*';
}
echo ' pattern="' . string_attribute( $t_cf_regex ) . '"';
}
echo ' value="' . string_attribute( $p_custom_field_value ) .'" />';
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
function select_atversion($v=0){
global $sort_versions;
$menu = '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
$menu.= '<select name="atversions">';
$menu.= '<option value="0">'._AT("all").'</option>';
foreach($sort_versions as $version){
if($version == $v){
$menu .= '<option value="'.$version.'" selected="selected">'.$version.'</option>';
}else if($version == VERSION){
$menu .= '<option value="'.$version.'" selected="selected">'.$version.'</option>';
}else{
$menu .= '<option value="'.$version.'" >'.$version.'</option>';
}
}
$menu .='</select>';
$menu .='<input type="submit" value="'. _AT('filter').'"/></form>';
return $menu;
} | 1 | 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 | safe |
public function index()
{
System::gZip();
Control::handler('frontend');
System::Zipped();
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function testEncodeFormulasWithSettingsPassedInContext()
{
$this->assertSame(<<<'CSV'
0
" =2+3"
CSV
, $this->encoder->encode(['=2+3'], 'csv', [
CsvEncoder::ESCAPE_FORMULAS_KEY => true,
]));
$this->assertSame(<<<'CSV'
0
" -2+3"
CSV
, $this->encoder->encode(['-2+3'], 'csv', [
CsvEncoder::ESCAPE_FORMULAS_KEY => true,
]));
$this->assertSame(<<<'CSV'
0
" +2+3"
CSV
, $this->encoder->encode(['+2+3'], 'csv', [
CsvEncoder::ESCAPE_FORMULAS_KEY => true,
]));
$this->assertSame(<<<'CSV'
0
" @MyDataColumn"
CSV
, $this->encoder->encode(['@MyDataColumn'], 'csv', [
CsvEncoder::ESCAPE_FORMULAS_KEY => true,
]));
} | 0 | PHP | CWE-1236 | Improper Neutralization of Formula Elements in a CSV File | The software saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by spreadsheet software. | https://cwe.mitre.org/data/definitions/1236.html | vulnerable |
public function testPortMustBeValid()
{
(new Uri(''))->withPort(100000);
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 actionGetItems(){
$sql = 'SELECT id, name as value FROM x2_docs WHERE name LIKE :qterm ORDER BY name ASC';
$command = Yii::app()->db->createCommand($sql);
$qterm = '%'.$_GET['term'].'%';
$command->bindParam(":qterm", $qterm, PDO::PARAM_STR);
$result = $command->queryAll();
echo CJSON::encode($result); exit;
} | 0 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
public function approve() {
expHistory::set('editable', $this->params);
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for comment to approve'));
expHistory::back();
}
$comment = new expComment($this->params['id']);
assign_to_template(array(
'comment'=>$comment
));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function decrementCounter()
{
$this->elCounter--;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
public function register()
{
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
// Get the application
$app = JFactory::getApplication();
// Get the form data.
$data = $this->input->post->get('user', array(), 'array');
// Get the model and validate the data.
$model = $this->getModel('Registration', 'UsersModel');
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
$return = $model->validate($form, $data);
// Check for errors.
if ($return === false)
{
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof Exception)
{
$app->enqueueMessage($errors[$i]->getMessage(), 'notice');
continue;
}
$app->enqueueMessage($errors[$i], 'notice');
}
// Save the data in the session.
$app->setUserState('users.registration.form.data', $data);
// Redirect back to the registration form.
$this->setRedirect('index.php?option=com_users&view=registration');
return false;
}
// Finish the registration.
$return = $model->register($data);
// Check for errors.
if ($return === false)
{
// Save the data in the session.
$app->setUserState('users.registration.form.data', $data);
// Redirect back to the registration form.
$message = JText::sprintf('COM_USERS_REGISTRATION_SAVE_FAILED', $model->getError());
$this->setRedirect('index.php?option=com_users&view=registration', $message, 'error');
return false;
}
// Flush the data from the session.
$app->setUserState('users.registration.form.data', null);
return true;
} | 0 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | vulnerable |
protected function tearDown()
{
static::$functions = [];
static::$fopen = null;
static::$fread = null;
parent::tearDown();
} | 0 | PHP | CWE-330 | Use of Insufficiently Random Values | The software uses insufficiently random numbers or values in a security context that depends on unpredictable numbers. | https://cwe.mitre.org/data/definitions/330.html | vulnerable |
public function manage() {
expHistory::set('viewable', $this->params);
$page = new expPaginator(array(
'model'=>'order_status',
'where'=>1,
'limit'=>10,
'order'=>'rank',
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
//'columns'=>array('Name'=>'title')
));
assign_to_template(array(
'page'=>$page
));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 showall() {
expHistory::set('viewable', $this->params);
$limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;
if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {
$limit = '0';
}
$order = isset($this->config['order']) ? $this->config['order'] : "rank";
$page = new expPaginator(array(
'model'=>'photo',
'where'=>$this->aggregateWhereClause(),
'limit'=>$limit,
'order'=>$order,
'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],
'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),
'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),
'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null,
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title'
),
));
assign_to_template(array(
'page'=>$page,
'params'=>$this->params,
));
} | 1 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | safe |
function update_option_master() {
global $db;
$id = empty($this->params['id']) ? null : $this->params['id'];
$opt = new option_master($id);
$oldtitle = $opt->title;
$opt->update($this->params);
// if the title of the master changed we should update the option groups that are already using it.
if ($oldtitle != $opt->title) {
}$db->sql('UPDATE '.$db->prefix.'option SET title="'.$opt->title.'" WHERE option_master_id='.$opt->id);
expHistory::back();
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 _fclose($fp, $path='') {
return fclose($fp);
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function transform($attr, $config, $context) {
if (!isset($attr['border'])) return $attr;
$border_width = $this->confiscateAttr($attr, 'border');
// some validation should happen here
$this->prependCSS($attr, "border:{$border_width}px solid;");
return $attr;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
public function replace($def, $config) {
return $this->cache->replace($def, $config);
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
public static function cleanX($c)
{
$val = self::strip_tags_content($c, '<script>', true);
$val = htmlspecialchars(
$val,
ENT_QUOTES | ENT_HTML5,
'utf-8'
);
// $val = htmlentities(
// $c,
// ENT_QUOTES | ENT_IGNORE, "UTF-8");
return $val;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
function columnUpdate($table, $col, $val, $where=1) {
$res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where");
/*if ($res == null)
return array();
$objects = array();
for ($i = 0; $i < mysqli_num_rows($res); $i++)
$objects[] = mysqli_fetch_object($res);*/
//return $objects;
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 queryGetRow($table, $data, $where, $extra = "", $inner = "")
{
$q = $this->prepareData($table, $data, $where, $extra, $inner);
$query_id = $this->query($q);
if (isset($this->query_id)) {
$record = mysql_fetch_row($this->query_id);
} else {
$this->oops("Invalid query_id: <b>$this->query_id</b>. Records could not be fetched.");
}
$this->freeResult($query_id);
return $record;
}#-#queryGetRow() | 1 | PHP | CWE-264 | Permissions, Privileges, and Access Controls | Weaknesses in this category are related to the management of permissions, privileges, and other security features that are used to perform access control. | https://cwe.mitre.org/data/definitions/264.html | safe |
public function autocomplete() {
return;
global $db;
$model = $this->params['model'];
$mod = new $model();
$srchcol = explode(",",$this->params['searchoncol']);
/*for ($i=0; $i<count($srchcol); $i++) {
if ($i>=1) $sql .= " OR ";
$sql .= $srchcol[$i].' LIKE \'%'.$this->params['query'].'%\'';
}*/
// $sql .= ' AND parent_id=0';
//eDebug($sql);
//$res = $mod->find('all',$sql,'id',25);
$sql = "select DISTINCT(p.id), p.title, model, sef_url, f.id as fileid from ".$db->prefix."product as p INNER JOIN ".$db->prefix."content_expfiles as cef ON p.id=cef.content_id INNER JOIN ".$db->prefix."expfiles as f ON cef.expfiles_id = f.id where match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') AND p.parent_id=0 order by match (p.title,p.model,p.body) against ('" . $this->params['query'] . "') desc LIMIT 25";
//$res = $db->selectObjectsBySql($sql);
//$res = $db->selectObjectBySql('SELECT * FROM `exponent_product`');
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
function main() {
$bin_repr = "\x00\x00\x00\x00\x00\x00\x00\x80";
$double_num = unpack("dnum", $bin_repr)['num'];
var_dump(number_format($double_num, 100));
} | 1 | PHP | CWE-119 | Improper Restriction of Operations within the Bounds of a Memory Buffer | The software performs operations on a memory buffer, but it can read from or write to a memory location that is outside of the intended boundary of the buffer. | https://cwe.mitre.org/data/definitions/119.html | safe |
public static function fixName($name) {
$name = preg_replace('/[^A-Za-z0-9\.]/','_',$name);
if ($name[0] == '.')
$name[0] = '_';
return $name;
// return preg_replace('/[^A-Za-z0-9\.]/', '-', $name);
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 showall() {
expHistory::set('viewable', $this->params);
$limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;
if (!empty($this->params['view']) && ($this->params['view'] == 'showall_accordion' || $this->params['view'] == 'showall_tabbed')) {
$limit = '0';
}
$order = isset($this->config['order']) ? $this->config['order'] : "rank";
$page = new expPaginator(array(
'model'=>'photo',
'where'=>$this->aggregateWhereClause(),
'limit'=>$limit,
'order'=>$order,
'categorize'=>empty($this->config['usecategories']) ? false : $this->config['usecategories'],
'uncat'=>!empty($this->config['uncat']) ? $this->config['uncat'] : gt('Not Categorized'),
'groups'=>!isset($this->params['gallery']) ? array() : array($this->params['gallery']),
'grouplimit'=>!empty($this->params['view']) && $this->params['view'] == 'showall_galleries' ? 1 : null,
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->baseclassname,
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'columns'=>array(
gt('Title')=>'title'
),
));
assign_to_template(array(
'page'=>$page,
'params'=>$this->params,
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function testMethodSafe($method, $safe)
{
$request = new Request();
$request->setMethod($method);
$this->assertEquals($safe, $request->isMethodSafe());
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function pathsProvider()
{
return array(
array(
'/phpmyadmin/index.php/; cookieinj=value/',
'/phpmyadmin/index.php/;%20cookieinj=value///',
'/; cookieinj=value/',
'/phpmyadmin/index.php'
),
array(
'',
'/phpmyadmin/index.php/;%20cookieinj=value///',
'/; cookieinj=value/',
'/phpmyadmin/index.php'
),
array(
'/phpmyadmin/index.php',
'/phpmyadmin/index.php',
'',
'/phpmyadmin/index.php'
),
array(
'',
'/phpmyadmin/index.php',
'',
'/phpmyadmin/index.php'
),
);
} | 1 | PHP | CWE-254 | 7PK - Security Features | Software security is not security software. Here we're concerned with topics like authentication, access control, confidentiality, cryptography, and privilege management. | https://cwe.mitre.org/data/definitions/254.html | safe |
function new_pass_form()
{
pagetop(gTxt('tab_site_admin'), '');
echo form(
hed(gTxt('change_password'), 2).
inputLabel(
'new_pass',
fInput('password', 'new_pass', '', '', '', '', INPUT_REGULAR, '', 'new_pass'),
'new_password', '', array('class' => 'txp-form-field edit-admin-new-password')
).
graf(
checkbox('mail_password', '1', true, '', 'mail_password').
n.tag(gTxt('mail_it'), 'label', array('for' => 'mail_password')), array('class' => 'edit-admin-mail-password')).
graf(fInput('submit', 'change_pass', gTxt('submit'), 'publish')).
eInput('admin').
sInput('change_pass'),
'', '', 'post', 'txp-edit', '', 'change_password');
} | 0 | PHP | CWE-521 | Weak Password Requirements | The product does not require that users should have strong passwords, which makes it easier for attackers to compromise user accounts. | https://cwe.mitre.org/data/definitions/521.html | vulnerable |
foreach ($events as $event) {
$extevents[$date][] = $event;
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
function logon($username, $password, &$sessionId)
{
global $_POST, $_COOKIE;
global $strUsernameOrPasswordWrong;
/**
* @todo Please check if the following statement is in correct place because
* it seems illogical that user can get session ID from internal login with
* a bad username or password.
*/
if (!$this->_verifyUsernameAndPasswordLength($username, $password)) {
return false;
}
$_POST['username'] = $username;
$_POST['password'] = $password;
$_POST['login'] = 'Login';
$_COOKIE['sessionID'] = uniqid('phpads', 1);
$_POST['phpAds_cookiecheck'] = $_COOKIE['sessionID'];
$this->preInitSession();
if ($this->_internalLogin($username, $password)) {
// Check if the user has administrator access to Openads.
if (OA_Permission::isUserLinkedToAdmin()) {
$this->postInitSession();
$sessionId = $_COOKIE['sessionID'];
return true;
} else {
$this->raiseError('User must be OA installation admin');
return false;
}
} else {
$this->raiseError($strUsernameOrPasswordWrong);
return false;
}
} | 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 function __construct($attr, $enum_to_css, $case_sensitive = false) {
$this->attr = $attr;
$this->enumToCSS = $enum_to_css;
$this->caseSensitive = (bool) $case_sensitive;
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
public function afterSave($event) {
// look up current tags
$oldTags = $this->getTags();
$newTags = array();
foreach ($this->scanForTags() as $tag) {
if (!in_array($tag, $oldTags)) { // don't add duplicates if there are already tags
$tagModel = new Tags;
$tagModel->tag = $tag; // includes the #
$tagModel->type = get_class($this->getOwner());
$tagModel->itemId = $this->getOwner()->id;
$tagModel->itemName = $this->getOwner()->name;
$tagModel->taggedBy = Yii::app()->getSuName();
$tagModel->timestamp = time();
if ($tagModel->save())
$newTags[] = $tag;
}
}
$this->_tags = $newTags + $oldTags; // update tag cache
if (!empty($newTags) && $this->flowTriggersEnabled) {
X2Flow::trigger('RecordTagAddTrigger', array(
'model' => $this->getOwner(),
'tags' => $newTags,
));
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 |
$_fn[] = self::buildCondition($v, ' && ');
}
$fn[] = '('.\implode(' || ', $_fn).')';
break;
case '$where':
if (\is_callable($value)) {
// need implementation
}
break;
default:
$d = '$document';
if (\strpos($key, '.') !== false) {
$keys = \explode('.', $key);
foreach ($keys as $k) {
$d .= '[\''.$k.'\']';
}
} else {
$d .= '[\''.$key.'\']';
}
if (\is_array($value)) {
$fn[] = "\\MongoLite\\UtilArrayQuery::check((isset({$d}) ? {$d} : null), ".\var_export($value, true).')';
} else {
if (is_null($value)) {
$fn[] = "(!isset({$d}))";
} else {
$_value = \var_export($value, true);
$fn[] = "(isset({$d}) && (
is_array({$d}) && is_string({$_value})
? in_array({$_value}, {$d})
: {$d}=={$_value}
)
)";
}
}
}
}
return \count($fn) ? \trim(\implode($concat, $fn)) : 'true';
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 editspeed() {
global $db;
if (empty($this->params['id'])) return false;
$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);
$calc = new $calcname($this->params['id']);
assign_to_template(array(
'calculator'=>$calc
));
} | 0 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
function db_seq_nextval($seqname)
{
global $DatabaseType;
if ($DatabaseType == 'mysqli')
$seq = "fn_" . strtolower($seqname) . "()";
return $seq;
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 pageToContainedHtml(Page $page)
{
$page->html = (new PageContent($page))->render();
$pageHtml = view('pages.export', [
'page' => $page,
'format' => 'html',
])->render();
return $this->containHtml($pageHtml);
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 send_feedback() {
$success = false;
if (isset($this->params['id'])) {
$ed = new eventdate($this->params['id']);
// $email_addrs = array();
if ($ed->event->feedback_email != '') {
$msgtemplate = expTemplate::get_template_for_action($this, 'email/_' . expString::escape($this->params['formname']), $this->loc);
$msgtemplate->assign('params', $this->params);
$msgtemplate->assign('event', $ed);
$email_addrs = explode(',', $ed->event->feedback_email);
//This is an easy way to remove duplicates
$email_addrs = array_flip(array_flip($email_addrs));
$email_addrs = array_map('trim', $email_addrs);
$mail = new expMail();
$success += $mail->quickSend(array(
"text_message" => $msgtemplate->render(),
'to' => $email_addrs,
'from' => !empty($this->params['email']) ? $this->params['email'] : trim(SMTP_FROMADDRESS),
'subject' => $this->params['subject'],
));
}
}
if ($success) {
flashAndFlow('message', gt('Your feedback was successfully sent.'));
} else {
flashAndFlow('error', gt('We could not send your feedback. Please contact your administrator.'));
}
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
$files[$i] = '.' . DIRECTORY_SEPARATOR . basename($file);
}
$files = array_map('escapeshellarg', $files);
$cmd = $arc['cmd'] . ' ' . $arc['argc'] . ' ' . escapeshellarg($name) . ' ' . implode(' ', $files);
$err_out = '';
$this->procExec($cmd, $o, $c, $err_out, $dir);
chdir($cwd);
} else {
return false;
}
}
$path = $dir . DIRECTORY_SEPARATOR . $name;
return file_exists($path) ? $path : false;
} | 0 | PHP | CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. | https://cwe.mitre.org/data/definitions/22.html | vulnerable |
function call($methodname, $args)
{
if (!$this->hasMethod($methodname)) {
return new Error(-32601, 'server error. requested method ' . $methodname . ' does not exist.');
}
$method = $this->callbacks[$methodname];
// Perform the callback and send the response
if (count($args) == 1) {
// If only one paramater just send that instead of the whole array
$args = $args[0];
}
// See if this method comes from one of our objects or maybe self
if (is_array($method) || (substr($method, 0, 5) == 'this:')) {
if (is_array($method)) {
$object = $this->_objects[$method[0]];
$method = $method[1];
} else {
$object = $this;
$method = substr($method, 5);
}
// It's a class method - check it exists
if (!method_exists($object, $method)) {
return new Error(-32601, 'server error. requested class method "' . $method . '" does not exist.');
}
// Call the method
$result = $object->$method($args);
} else {
// It's a function - does it exist?
if (!function_exists($method)) {
return new Error(-32601, 'server error. requested function "' . $method . '" does not exist.');
}
// Call the function
$result = $method($args);
}
return $result;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
{
trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function __construct($exceptions = false)
{
$this->exceptions = (boolean)$exceptions;
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public static function recent($vars)
{
$catW = isset($vars['cat']) ? " AND `cat` = '".$vars['cat']."'" : '';
$type = isset($vars['type']) ? $vars['type'] : 'post';
$num = isset($vars['num']) ? $vars['num'] : '10';
$sql = "SELECT * FROM `posts`
WHERE `type` = '{$type}' {$catW} AND `status` = '1'
ORDER BY `date` DESC LIMIT {$num}";
$posts = Db::result($sql);
if (isset($posts['error'])) {
$posts['error'] = 'No Posts found.';
} else {
$posts = self::prepare($posts);
}
return $posts;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function url($p, $absolute = false, $full = false, $secure = false)
{
if (!is_array($p)) {
if (strpos($p, 'http') === 0) {
return $p;
}
$p = array('_action' => @func_get_arg(0));
}
$pre = array();
$task = $p['_task'] ?: ($p['task'] ?: $this->task);
$pre['_task'] = $task;
unset($p['task'], $p['_task']);
$url = $this->filename;
$delm = '?';
foreach (array_merge($pre, $p) as $key => $val) {
if ($val !== '' && $val !== null) {
$par = $key[0] == '_' ? $key : '_'.$key;
$url .= $delm.urlencode($par).'='.urlencode($val);
$delm = '&';
}
}
$base_path = strval($_SERVER['REDIRECT_SCRIPT_URL'] ?: $_SERVER['SCRIPT_NAME']);
$base_path = preg_replace('![^/]+$!', '', $base_path);
if ($secure && ($token = $this->get_secure_url_token(true))) {
// add token to the url
$url = $token . '/' . $url;
// remove old token from the path
$base_path = rtrim($base_path, '/');
$base_path = preg_replace('/\/[a-zA-Z0-9]{' . strlen($token) . '}$/', '', $base_path);
// this need to be full url to make redirects work
$absolute = true;
}
else if ($secure && ($token = $this->get_request_token()))
$url .= $delm . '_token=' . urlencode($token);
if ($absolute || $full) {
// add base path to this Roundcube installation
if ($base_path == '') $base_path = '/';
$prefix = $base_path;
// prepend protocol://hostname:port
if ($full) {
$prefix = rcube_utils::resolve_url($prefix);
}
$prefix = rtrim($prefix, '/') . '/';
}
else {
$prefix = './';
}
return $prefix . $url;
} | 1 | 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 | safe |
$this->assertSame(['OWS' => ['Foo']], $r->getHeaders());
$this->assertSame('Foo', $r->getHeaderLine('OWS'));
$this->assertSame(['Foo'], $r->getHeader('OWS'));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function setItemAttributes( $attributes ) {
$this->itemAttributes = \Sanitizer::fixTagAttributes( $attributes, 'li' );
} | 0 | PHP | CWE-400 | Uncontrolled Resource Consumption | The software does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources. | https://cwe.mitre.org/data/definitions/400.html | vulnerable |
function manage_vendors () {
expHistory::set('viewable', $this->params);
$vendor = new vendor();
$vendors = $vendor->find('all');
assign_to_template(array(
'vendors'=>$vendors
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
function edit_externalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
if (empty($section->id)) {
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
}
| 0 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | vulnerable |
public function approve() {
expHistory::set('editable', $this->params);
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
$require_login = empty($this->params['require_login']) ? SIMPLENOTE_REQUIRE_LOGIN : $this->params['require_login'];
$require_approval = empty($this->params['require_approval']) ? SIMPLENOTE_REQUIRE_APPROVAL : $this->params['require_approval'];
$require_notification = empty($this->params['require_notification']) ? SIMPLENOTE_REQUIRE_NOTIFICATION : $this->params['require_notification'];
$notification_email = empty($this->params['notification_email']) ? SIMPLENOTE_NOTIFICATION_EMAIL : $this->params['notification_email'];
if (empty($this->params['id'])) {
flash('error', gt('No ID supplied for note to approve'));
$lastUrl = expHistory::getLast('editable');
}
$simplenote = new expSimpleNote($this->params['id']);
assign_to_template(array(
'simplenote'=>$simplenote,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
'tab'=>$this->params['tab']
));
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
foreach ($days as $event) {
if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time()))
break;
if (empty($event->eventstart))
$event->eventstart = $event->eventdate->date;
$extitem[] = $event;
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
function manage() {
global $db;
expHistory::set('manageable', $this->params);
// $classes = array();
$dir = BASE."framework/modules/ecommerce/billingcalculators";
if (is_readable($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if (is_file("$dir/$file") && substr("$dir/$file", -4) == ".php") {
include_once("$dir/$file");
$classname = substr($file, 0, -4);
$id = $db->selectValue('billingcalculator', 'id', 'calculator_name="'.$classname.'"');
if (empty($id)) {
// $calobj = null;
$calcobj = new $classname();
if ($calcobj->isSelectable() == true) {
$obj = new billingcalculator(array(
'title'=>$calcobj->name(),
// 'user_title'=>$calcobj->title,
'body'=>$calcobj->description(),
'calculator_name'=>$classname,
'enabled'=>false));
$obj->save();
}
}
}
}
}
$bcalc = new billingcalculator();
$calculators = $bcalc->find('all');
assign_to_template(array(
'calculators'=>$calculators
));
} | 1 | PHP | CWE-74 | Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') | The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. | https://cwe.mitre.org/data/definitions/74.html | safe |
public function editspeed() {
global $db;
if (empty($this->params['id'])) return false;
$calcname = $db->selectValue('shippingcalculator', 'calculator_name', 'id='.$this->params['id']);
$calc = new $calcname($this->params['id']);
assign_to_template(array(
'calculator'=>$calc
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function getQuerySelect()
{
} | 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 testLeftBracketsThenTag()
{
$this->assertProduces('[[[[[b]bold![/b]',
'[[[[<strong>bold!</strong>');
} | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
public function searchNew() {
global $db, $user;
$this->params['query'] = expString::escape($this->params['query']);
//$this->params['query'] = str_ireplace('-','\-',$this->params['query']);
$sql = "select DISTINCT(p.id) as id, p.title, model, sef_url, f.id as fileid, ";
$sql .= "match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) as relevance, ";
$sql .= "CASE when p.model like '" . $this->params['query'] . "%' then 1 else 0 END as modelmatch, ";
$sql .= "CASE when p.title like '%" . $this->params['query'] . "%' then 1 else 0 END as titlematch ";
$sql .= "from " . $db->prefix . "product as p INNER JOIN " .
$db->prefix . "content_expFiles as cef ON p.id=cef.content_id AND cef.content_type IN ('product','eventregistration','donation','giftcard') AND cef.subtype='mainimage' INNER JOIN " . $db->prefix .
"expFiles as f ON cef.expFiles_id = f.id WHERE ";
if (!$user->isAdmin()) $sql .= '(p.active_type=0 OR p.active_type=1) AND ';
$sql .= " match (p.title,p.model,p.body) against ('" . $this->params['query'] . "*' IN BOOLEAN MODE) AND p.parent_id=0 ";
$sql .= " HAVING relevance > 0 ";
//$sql .= "GROUP BY p.id ";
$sql .= "order by modelmatch,titlematch,relevance desc LIMIT 10";
eDebug($sql);
$res = $db->selectObjectsBySql($sql);
eDebug($res, true);
$ar = new expAjaxReply(200, gt('Here\'s the items you wanted'), $res);
$ar->send();
} | 1 | PHP | CWE-20 | Improper Input Validation | The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. | https://cwe.mitre.org/data/definitions/20.html | safe |
public function __construct()
{
self::create();
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($this->tagModel->remove($tag_id)) {
$this->flash->success(t('Tag removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} | 0 | PHP | CWE-639 | Authorization Bypass Through User-Controlled Key | The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. | https://cwe.mitre.org/data/definitions/639.html | vulnerable |
$tableBody[] = array($row['label'], $row['nb_visits'], $row['bounce_rate']);
if ($count == 10) break;
}
$this->table($tableHead, $tableBody, null);
}
} | 0 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 install($var)
{
include GX_PATH.'/gxadmin/themes/install/'.$var.'.php';
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public function testLogout()
{
$restoreInstance = PMA\libraries\Response::getInstance();
$mockResponse = $this->getMockBuilder('PMA\libraries\Response')
->disableOriginalConstructor()
->setMethods(array('isAjax', 'headersSent', 'header'))
->getMock();
$mockResponse->expects($this->any())
->method('headersSent')
->with()
->will($this->returnValue(false));
$mockResponse->expects($this->once())
->method('header')
->with('Location: ./index.php' . ((SID) ? '?' . SID : '')); | 1 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | safe |
public static function getStylesheet($styleName)
{
// Get custom stylesheet, of the default stylesheet if the custom stylesheet does not exist
$stylesheet = get_option($styleName, '');
if (strlen($stylesheet) <= 0)
{
$stylesheetFile = SlideshowPluginMain::getPluginPath() . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'SlideshowPlugin' . DIRECTORY_SEPARATOR . $styleName . '.css';
if (!file_exists($stylesheetFile))
{
$stylesheetFile = SlideshowPluginMain::getPluginPath() . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'SlideshowPlugin' . DIRECTORY_SEPARATOR . 'style-light.css';
}
// Get contents of stylesheet
ob_start();
include($stylesheetFile);
$stylesheet .= ob_get_clean();
}
// Replace the URL placeholders with actual URLs and add a unique identifier to separate stylesheets
$stylesheet = str_replace('%plugin-url%', SlideshowPluginMain::getPluginUrl(), $stylesheet);
$stylesheet = str_replace('%site-url%', get_bloginfo('url'), $stylesheet);
$stylesheet = str_replace('%stylesheet-url%', get_stylesheet_directory_uri(), $stylesheet);
$stylesheet = str_replace('%template-url%', get_template_directory_uri(), $stylesheet);
$stylesheet = str_replace('.slideshow_container', '.slideshow_container_' . $styleName, $stylesheet);
return $stylesheet;
} | 0 | PHP | CWE-200 | Exposure of Sensitive Information to an Unauthorized Actor | The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. | https://cwe.mitre.org/data/definitions/200.html | vulnerable |
static function author() {
return "Dave Leffler";
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
function edit() {
if (empty($this->params['content_id'])) {
flash('message',gt('An error occurred: No content id set.'));
expHistory::back();
}
/* The global constants can be overridden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$id = empty($this->params['id']) ? null : $this->params['id'];
$comment = new expComment($id);
//FIXME here is where we might sanitize the comment before displaying/editing it
assign_to_template(array(
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'comment'=>$comment
));
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
public static function getId($id = '')
{
if (isset($id)) {
$sql = sprintf("SELECT * FROM `menus` WHERE `id` = '%d'", $id);
$menus = Db::result($sql);
$n = Db::$num_rows;
} else {
$menus = '';
}
return $menus;
} | 1 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 | safe |
form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . html_escape($network['name']) . '</a>', $network['id']);
form_selectable_ecell($network['data_collector'], $network['id']);
form_selectable_cell($sched_types[$network['sched_type']], $network['id']);
form_selectable_cell(number_format_i18n($network['total_ips']), $network['id'], '', 'right');
form_selectable_cell($mystat, $network['id'], '', 'right');
form_selectable_cell($progress, $network['id'], '', 'right');
form_selectable_cell(number_format_i18n($updown['up']) . '/' . number_format_i18n($updown['snmp']), $network['id'], '', 'right');
form_selectable_cell(number_format_i18n($network['threads']), $network['id'], '', 'right');
form_selectable_cell(round($network['last_runtime'],2), $network['id'], '', 'right');
form_selectable_cell($network['enabled'] == '' || $network['sched_type'] == '1' ? __('N/A'):($network['next_start'] == '0000-00-00 00:00:00' ? substr($network['start_at'],0,16):substr($network['next_start'],0,16)), $network['id'], '', 'right');
form_selectable_cell($network['last_started'] == '0000-00-00 00:00:00' ? __('Never'):substr($network['last_started'],0,16), $network['id'], '', 'right');
form_checkbox_cell($network['name'], $network['id']);
form_end_row();
}
} else { | 1 | PHP | CWE-79 | Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') | The software 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 | safe |
public function testGetDropdownConnect($params, $expected, $session_params = []) {
$this->login();
$bkp_params = [];
//set session params if any
if (count($session_params)) {
foreach ($session_params as $param => $value) {
if (isset($_SESSION[$param])) {
$bkp_params[$param] = $_SESSION[$param];
}
$_SESSION[$param] = $value;
}
}
$params['_idor_token'] = \Session::getNewIDORToken($params['itemtype'] ?? '');
$result = \Dropdown::getDropdownConnect($params, false);
//reset session params before executing test
if (count($session_params)) {
foreach ($session_params as $param => $value) {
if (isset($bkp_params[$param])) {
$_SESSION[$param] = $bkp_params[$param];
} else {
unset($_SESSION[$param]);
}
}
}
$this->array($result)->isIdenticalTo($expected);
} | 0 | PHP | CWE-862 | Missing Authorization | The software does not perform an authorization check when an actor attempts to access a resource or perform an action. | https://cwe.mitre.org/data/definitions/862.html | vulnerable |
function manage() {
global $db, $router, $user;
expHistory::set('manageable', $router->params);
assign_to_template(array(
'canManageStandalones' => self::canManageStandalones(),
'sasections' => $db->selectObjects('section', 'parent=-1'),
'user' => $user,
// 'canManagePagesets' => $user->isAdmin(),
// 'templates' => $db->selectObjects('section_template', 'parent=0'),
));
}
| 0 | PHP | CWE-89 | Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') | The software 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.