code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
function cleanCSV($string) { $check = '/^[=@]/'; if (!is_numeric($string)) { $check = '/^[=@+-]/'; } return preg_replace($check, "", $string); }
CWE-1236
12
$this->{$callback[0]}->{$callback[1]}($objPage, $objLayout, $this); } } $headBag = $this->responseContext->get(HtmlHeadBag::class); // Set the page title and description AFTER the modules have been generated $this->Template->mainTitle = $objPage->rootPageTitle; $this->Template->pageTitle = htmlspecia...
CWE-79
1
public function confirm() { $task = $this->getTask(); $link_id = $this->request->getIntegerParam('link_id'); $link = $this->taskExternalLinkModel->getById($link_id); if (empty($link)) { throw new PageNotFoundException(); } $this->response->html($this...
CWE-639
9
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
CWE-639
9
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); $ret .= scan_container($cLoc, $page->id); $ret .= scan_page($page->id); }
CWE-89
0
public static function title($id){ $sql = sprintf("SELECT `title` FROM `posts` WHERE `id` = '%d'", $id); try { $r = Db::result($sql); if(isset($r['error'])){ $title['error'] = $r['error']; //echo $title['error']; }el...
CWE-89
0
echo '</SCHOOL_' . htmlentities($i) . '>'; $i++; } echo '</SCHOOL_ACCESS>'; // } echo '</STAFF_' . htmlentities($j) . '>'; $j++; }
CWE-79
1
public function getQuerySelect() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.id AS `" . $this->field->name . "`"; }
CWE-89
0
$q->close(); } self::$num_rows = $n; return $r; }
CWE-89
0
public function confirm() { $task = $this->getTask(); $link_id = $this->request->getIntegerParam('link_id'); $link = $this->taskExternalLinkModel->getById($link_id); if (empty($link)) { throw new PageNotFoundException(); } $this->response->html($this...
CWE-639
9
function edit() { global $user; /* 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_LOG...
CWE-89
0
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('D...
CWE-89
0
$args['name'][$i] = $this->normalize($name, $opts); } } else { $args['name'] = $this->normalize($args['name'], $opts); } } return true; }
CWE-89
0
public function remove($key) { $session =& $this->getSessionRef($key); unset($session); return $this; }
CWE-89
0
$result = $search->getSearchResults($item->query, false, true); if(empty($result) && !in_array($item->query, $badSearchArr)) { $badSearchArr[] = $item->query; $badSearch[$ctr2]['query'] = $item->query; $badSearch[$ctr2]['count'] = $db->countObjects("search_queries", "query='{$item->query}'"); $ct...
CWE-89
0
$section = new section(intval($page)); if ($section) { // self::deleteLevel($section->id); $section->delete(); } } }
CWE-89
0
public function getQueryOrderby() { $uh = UserHelper::instance(); $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return "$R2.ugroup_id"; }
CWE-89
0
protected function _mkfile($path, $name) { $path = $this->_joinPath($path, $name); if (($fp = @fopen($path, 'w'))) { @fclose($fp); @chmod($path, $this->options['fileMode']); clearstatcache(); return $path; } return false; }
CWE-89
0
$stat = $this->stat($p); if (!$stat) { // invalid links continue; } if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'], $mimes)) { continue; } $name = $stat['name']; if ((!$mimes || $stat['mime'] !== 'directory') && $this->stripos($name, $q) !== false) { $stat['pat...
CWE-89
0
public function popupnewsitem($id) { $query = 'SELECT * FROM ' . TABLE_PREFIX .'news WHERE id=' . $id . ' '; return DB::get_row($query); }
CWE-89
0
public static function generated(){ $end_time = microtime(TRUE); $time_taken = $end_time - $GLOBALS['start_time']; $time_taken = round($time_taken,5); echo '<center><small>Page generated in '.$time_taken.' seconds.</small></center>'; }
CWE-89
0
public function __construct () { }
CWE-89
0
public static function canView($section) { global $db; if ($section == null) { return false; } if ($section->public == 0) { // Not a public section. Check permissions. return expPermissions::check('view', expCore::makeLocation('navigation...
CWE-89
0
public function store($zdb) { try { $values = array( self::PK => $this->id, 'model_fields' => serialize($this->fields) ); if (!isset($this->id) || $this->id == '') { //we're inserting a new model ...
CWE-89
0
public function confirm() { $task = $this->getTask(); $comment = $this->getComment(); $this->response->html($this->template->render('comment/remove', array( 'comment' => $comment, 'task' => $task, 'title' => t('Remove a comment') ))); }
CWE-639
9
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
CWE-22
2
protected function fsock_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp) { $connect_timeout = 3; $connect_try = 3; $method = 'GET'; $readsize = 4096; $ssl = ''; $getSize = null; $headers = ''; $arr = parse_url($url); if (!$arr) ...
CWE-78
6
protected function LoadData() { $this->dataLoaded = true; $args = array(); $args[] = $this->hash; $args[] = '--no-merges'; $canSkip = true; if ($this->skip > 0) $canSkip = $this->exe->CanSkip(); if ($canSkip) { if ($this->limit > 0) { $args[] = '--max-count=' . $this->limit; } if ($th...
CWE-78
6
function delete_option_master() { global $db; $masteroption = new option_master($this->params['id']); // delete any implementations of this option master $db->delete('option', 'option_master_id='.$masteroption->id); $masteroption->delete('optiongroup_master_id=' . $...
CWE-89
0
public function confirm() { $task = $this->getTask(); $link = $this->getTaskLink(); $this->response->html($this->template->render('task_internal_link/remove', array( 'link' => $link, 'task' => $task, ))); }
CWE-639
9
protected function curl_get_contents(&$url, $timeout, $redirect_max, $ua, $outfp) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); if ($outfp) { curl_setopt($ch, CURLOPT_FILE, $outfp); } else { curl...
CWE-918
16
public static function insert($vars) { if(is_array($vars)) { $slug = Typo::slugify($vars['title']); $vars = array_merge($vars, array('slug' => $slug)); //print_r($vars); $ins = array( 'table' => 'options', 'key' ...
CWE-89
0
public function save() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->categoryValidator->validateCreation($values); if ($valid) { if ($this->categoryModel->create($values) !== false) { $this->f...
CWE-639
9
public static function getParent($id){ $q = self::getId($id); return $q[0]->parent; }
CWE-89
0
function teampass_decrypt_pw($encrypted, $salt, $rand_key, $itcount = 2072) { $encrypted = base64_decode($encrypted); $pass_salt = substr($encrypted, -64); $encrypted = substr($encrypted, 0, -64); $key = teampass_pbkdf2_hash($salt, $pass_salt, $itcount, 16, 32); $iv = base64_decode(subs...
CWE-89
0
public static function rss() { switch (SMART_URL) { case true: # code... $url = Options::get('siteurl')."/rss".GX_URL_PREFIX; break; default: # code... $url = Options::get('siteurl')."/index....
CWE-89
0
function update_vendor() { $vendor = new vendor(); $vendor->update($this->params['vendor']); expHistory::back(); }
CWE-89
0
public function __construct($handler) { $this->handler=$handler; }
CWE-22
2
$schedules[$scheduleCode] = $this->model->createScheduleItem($scheduleCode); } return $this->schedulesCache = $schedules; }
CWE-79
1
public function getQuerySelect() { }
CWE-89
0
function verify(){ echo $_GET['challenge']; }
CWE-79
1
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->getCoupon...
CWE-89
0
function searchName() { return gt("Calendar Event"); }
CWE-89
0
public function execute(&$params){ $options = &$this->config['options']; $event = new Events; $notif = new Notification; $user = $this->parseOption('user', $params); $type = $this->parseOption('type', $params); if($type === 'auto'){ if(!isset($params['...
CWE-79
1
public static function regdate($id){ $usr = Db::result( sprintf("SELECT * FROM `user` WHERE `id` = '%d' OR `userid` = '%s' LIMIT 1", Typo::int($id), Typo::cleanX($id) ) ); return $usr[0]->join_date; }
CWE-89
0
public function confirm() { $project = $this->getProject(); $filter = $this->customFilterModel->getById($this->request->getIntegerParam('filter_id')); $this->response->html($this->helper->layout->project('custom_filter/remove', array( 'project' => $project, 'filt...
CWE-639
9
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
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...
CWE-89
0
public function confirm() { global $db; // make sure we have what we need. if (empty($this->params['key'])) expQueue::flashAndFlow('error', gt('The security key for account was not supplied.')); if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('The subscrib...
CWE-89
0
public function showUnpublished() { expHistory::set('viewable', $this->params); // setup the where clause for looking up records. $where = parent::aggregateWhereClause(); $where = "((unpublish != 0 AND unpublish < ".time().") OR (publish > ".time().")) AND ".$where; ...
CWE-89
0
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_shipping_methods WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return ...
CWE-89
0
recyclebin::sendToRecycleBin($loc, $parent); //FIXME if we delete the module & sectionref the module completely disappears // if (class_exists($secref->module)) { // $modclass = $secref->module; // //FIXME: more module/controller glue code // ...
CWE-89
0
$evs = $this->event->find('all', "id=" . $edate->event_id . $featuresql); foreach ($evs as $key=>$event) { if ($condense) { $eventid = $event->id; $multiday_event = array_filter($events, create_function('$event', 'global $eventid; retur...
CWE-89
0
$ok = $DB->execute(' INSERT INTO nv_paths (id, website, type, object_id, lang, path, cache_file, cache_expires, views) VALUES ( 0, :website, :type, :object_id, :lang, :path, "", 0, :views ) ', array( ':website' => $website_id, ':type' => $type, ':object_id' => $object...
CWE-89
0
public static function BBCode2Html($text) { $text = trim($text); $text = self::parseEmoji($text); // Smileys to find... $in = array( ); // And replace them by... $out = array( ); $in[] = '[/*]'; $in[] = '[*]'; $out[] = '</li...
CWE-79
1
public function event() { $project = $this->getProject(); $values = $this->request->getValues(); if (empty($values['action_name']) || empty($values['project_id'])) { return $this->create(); } return $this->response->html($this->template->render('action_creat...
CWE-639
9
$val = self::escape($val); $set .= "'{$val}',"; $k .= "`{$key}`,"; } $set = substr($set, 0,-1); $k = substr($k, 0,-1); $sql = sprintf("INSERT INTO `%s` (%s) VALUES (%s) ", $vars['table'], $k...
CWE-89
0
$arcs['create']['application/x-rar'] = array('cmd' => ELFINDER_RAR_PATH, 'argc' => 'a -inul' . (defined('ELFINDER_RAR_MA4') && ELFINDER_RAR_MA4? ' -ma4' : ''), 'ext' => 'rar');
CWE-918
16
private function userAuth() { $user = new User(); $nick = $this->request->request->get('fsNick', ''); if ($nick === '') { return $this->cookieAuth($user); } if ($user->loadFromCode($nick) && $user->enabled) { if ($user->verifyPassword($this->reque...
CWE-79
1
function html_escape_request_var($string) { return htmlspecialchars(get_request_var($string), ENT_QUOTES, 'UTF-8'); }
CWE-79
1
protected function _stat($path) { $sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs FROM '.$this->tbf.' AS f LEFT JOIN '.$this->tbf.' AS p ON p.id=f.parent_id LEFT JOIN '.$this->tbf.' AS ch ON ch.paren...
CWE-89
0
function delete_option_master() { global $db; $masteroption = new option_master($this->params['id']); // delete any implementations of this option master $db->delete('option', 'option_master_id='.$masteroption->id); $masteroption->delete('optiongroup_master_id=' . $...
CWE-89
0
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getA...
CWE-639
9
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $category = $this->getCategory(); if ($this->categoryModel->remove($category['id'])) { $this->flash->success(t('Category removed successfully.')); } else { $this->...
CWE-639
9
public function theme_switch() { if (!expUtil::isReallyWritable(BASE.'framework/conf/config.php')) { // we can't write to the config.php file flash('error',gt('The file /framework/conf/config.php is NOT Writeable. You will be unable to change the theme.')); } expSettings::change('D...
CWE-89
0
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('action/remove', array( 'action' => $this->actionModel->getById($this->request->getIntegerParam('action_id')), 'available_events' => $this->eventManager->getA...
CWE-639
9
elseif ( $columns['TITLE'] ) { $id_new = DBSeqNextID( 'school_marking_periods_marking_period_id_seq' ); $sql = "INSERT INTO SCHOOL_MARKING_PERIODS "; $fields = "MARKING_PERIOD_ID,MP,SYEAR,SCHOOL_ID,"; $values = "'" . $id_new . "','" . $_REQUEST['mp_term'] . "','" . UserSyear() . "','" . UserSchool() ...
CWE-89
0
$db->insertObject($obj, 'expeAlerts_subscribers'); } $count = count($this->params['ealerts']); if ($count > 0) { flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.')); } else { ...
CWE-89
0
function RemoveXSSchars(&$val) { static $patterns = NULL; static $replacements = NULL; $val_before = $val; $found = true; if ( $patterns == NULL ) { $patterns = array(); $replacements = array(); // remove all non-printable characters. CR(0a) and LF(0b) and TAB(9) are // allowed this prevents s...
CWE-79
1
function manage_vendors () { expHistory::set('viewable', $this->params); $vendor = new vendor(); $vendors = $vendor->find('all'); assign_to_template(array( 'vendors'=>$vendors )); }
CWE-89
0
foreach($course_RET as $period_date) { // $period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND IF(course_period_date IS NULL, course_period_date='$period_date[COURSE_PERIOD_DATE]',DAYS LIKE '%$period_date[DAYS]%')) OR "; ...
CWE-22
2
private function _finishUp($callFrom = '') { $this->logger->setLogInfo('Call from: ' . $callFrom); if (function_exists('mw_post_update')) { mw_post_update(); } $this->logger->setLogInfo('Cleaning up system cache'); mw()->cache_manager->clear(); $zipReader = new ZipReader(); ...
CWE-434
5
public function update_groupdiscounts() { global $db; if (empty($this->params['id'])) { // look for existing discounts for the same group $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']); if (!empty($existing_id)) flashAndFlow('er...
CWE-89
0
protected function _tempdir($dir, $prefix = '', $mode = 0700) { if (substr($dir, -1) != DIRECTORY_SEPARATOR) { $dir .= DIRECTORY_SEPARATOR; } do { $path = $dir.$prefix.mt_rand(0, 9999999); } while (!mkdir($path, $mode)); return $path; }
CWE-434
5
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $action = $this->actionModel->getById($this->request->getIntegerParam('action_id')); if (! empty($action) && $this->actionModel->remove($action['id'])) { $this->flash->success(t('Acti...
CWE-639
9
public static function updatePassword(Db $zdb, $id_adh, $pass) { try { $cpass = password_hash($pass, PASSWORD_BCRYPT); $update = $zdb->update(self::TABLE); $update->set( array('mdp_adh' => $cpass) )->where(self::PK . ' = ' . $id_adh); ...
CWE-89
0
public function confirm() { $project = $this->getProject(); $this->response->html($this->helper->layout->project('column/remove', array( 'column' => $this->columnModel->getById($this->request->getIntegerParam('column_id')), 'project' => $project, ))); }
CWE-639
9
public function delete($fileName = null) { $this->validateFileName(); list($name, $extension) = $this->model->getFileNameParts(); return $this->datasource->delete( $this->model->getObjectTypeDirName(), $name, $extension ); }
CWE-79
1
$contents = ['form' => tep_draw_form('rates', 'tax_rates.php', 'page=' . $_GET['page'] . '&action=insert')];
CWE-79
1
$row_rub = sql_fetsel("id_rubrique", "spip_rubriques", "lang='" . $GLOBALS['spip_lang'] . "' AND id_parent=$id_parent"); if ($row_rub) { $row['id_rubrique'] = $row_rub['id_rubrique']; } } } } return $row; }
CWE-89
0
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
CWE-89
0
return getenv('REMOTE_ADDR'); } else { return false; } }
CWE-89
0
$res = @unserialize ( base64_decode (str_replace ( array ( "|02" , "|01" ) , array ( "/" , "|" ) , $str ) ) ) ;
CWE-798
18
public static function html() { new Xaptcha(); $html = "<div class=\"form-group\"> <div class=\"g-recaptcha\" data-sitekey=\"".self::$key."\"></div></div> <script type=\"text/javascript\" src=\"https://www.google.com/recaptcha/api.js?hl=".self::$lang....
CWE-89
0
protected function _move($source, $targetDir, $name) { $target = $this->_joinPath($targetDir, $name); return $this->connect->rename($source, $target) ? $target : false; }
CWE-78
6
public function update($data) { if ($this->securityController->isWikiHibernated()) { throw new \Exception(_t('WIKI_IN_HIBERNATION')); } return $this->dbService->query('UPDATE' . $this->dbService->prefixTable('nature') . 'SET ' . '`bn_label_nature`="' . addslashes(...
CWE-89
0
public function approve_toggle() { if (empty($this->params['id'])) return; /* 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['re...
CWE-89
0
public static function navtojson() { return json_encode(self::navhierarchy()); }
CWE-89
0
public function read($source) { $source = $this->escapePath($source); // close the single quote, open a double quote where we put the single quote... $source = str_replace('\'', '\'"\'"\'', $source); // since returned stream is closed by the caller we need to create a new instance // since we can't re-use th...
CWE-78
6
protected function dataValue() { return [ ['foo', "'foo'"], ['bar', "'bar'"], ['42', "'42'"], ['+33', "'+33'"], [null, 'NULL'], ['null', 'NULL'], ['NULL', 'NULL'], ['`field`', '`field`'], ['`field', "'`field'"] ]; }
CWE-89
0
public function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::ge...
CWE-89
0
function token($str) { $fw=$this->fw; $str=trim(preg_replace('/\{\{(.+?)\}\}/s',trim('\1'), $fw->compile($str))); if (preg_match('/^(.+)(?<!\|)\|((?:\h*\w+(?:\h*[,;]?))+)$/s', $str,$parts)) { $str=trim($parts[1]); foreach ($fw->split(trim($parts[2],"\xC2\xA0")) as $func) $str=((empty($this->filte...
CWE-94
14
function draw_vdef_preview($vdef_id) { ?> <tr class='even'> <td style='padding:4px'> <pre>vdef=<?php print get_vdef($vdef_id, true);?></pre> </td> </tr> <?php }
CWE-79
1
public function pending() { // global $db; // make sure we have what we need. if (empty($this->params['id'])) expQueue::flashAndFlow('error', gt('Your subscriber ID was not supplied.')); // find the subscriber and their pending subscriptions $ealerts = expeAlerts::ge...
CWE-89
0
function edit_optiongroup_master() { expHistory::set('editable', $this->params); $id = isset($this->params['id']) ? $this->params['id'] : null; $record = new optiongroup_master($id); assign_to_template(array( 'record'=>$record )); }
CWE-89
0
private function drain(StreamInterface $source, StreamInterface $sink) { Psr7\copy_to_stream($source, $sink); $sink->seek(0); $source->close(); return $sink; }
CWE-89
0
public function destroy(Appointment $appointment) { if (!auth()->user()->can("appointment-create")) { return response("Access denied", 403); } $deleted = $appointment->delete(); if ($deleted) { return response("Success"); } return response...
CWE-521
4
public function saveconfig() { 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']); $conf = serialize($calc->parseConfig($this->...
CWE-89
0
function edit() { global $user; /* 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_LOG...
CWE-89
0
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0