code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
static function lookupByUsername($username) { if (strpos($username, '@') !== false) $user = static::lookup(array('user__emails__address'=>$username)); else $user = static::lookup(array('username'=>$username)); return $user; }
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 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
foreach($fields as $field) { if(substr($key, 0, strlen($field.'-'))==$field.'-') $this->dictionary[substr($key, strlen($field.'-'))][$field] = $value; }
CWE-79
1
public function convertQuotes($string) { $string = str_ireplace('[QUOTE]', '<div class="quote">', $string); $string = str_ireplace('[/QUOTE]', '</div>', $string); $string = preg_replace('%\[event\]\s*(\d*)\s*\[/event\]%isU', '<a href="' . h(Configure::read('MISP.baseurl')). '/events/view/$1> Event $1</a>', $...
CWE-79
1
public function actionGetLists() { if (!Yii::app()->user->checkAccess('ContactsAdminAccess')) { $condition = ' AND (visibility="1" OR assignedTo="Anyone" OR assignedTo="' . Yii::app()->user->getName() . '"'; /* x2temp */ $groupLinks = Yii::app()->db->createCommand()->sel...
CWE-79
1
public function manage() { expHistory::set('manageable',$this->params); $gc = new geoCountry(); $countries = $gc->find('all'); $gr = new geoRegion(); $regions = $gr->find('all',null,'rank asc,name asc'); assign_to_template(array( ...
CWE-89
0
function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1) { // List of special chars for filenames in windows are defined on page https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file // Char '>' '<' '|' '$' and ';' are special chars for shells. // Char '/' and '\' are file delimiters. $filesy...
CWE-88
3
static function isSearchable() { return true; }
CWE-89
0
public function upload() { // upload the file, but don't save the record yet... if ($this->params['resize'] != 'false') { $maxwidth = $this->params['max_width']; } else { $maxwidth = null; } $file = expFile::fileUpload('Filedata',false,false,n...
CWE-89
0
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
CWE-639
9
public function delete() { global $user; $count = $this->address->find('count', 'user_id=' . $user->id); if($count > 1) { $address = new address($this->params['id']); if ($user->isAdmin() || ($user->id == $address->user_id)) { if ($address->is_bill...
CWE-89
0
public function confirm() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask/remove', array( 'subtask' => $subtask, 'task' => $task, ))); }
CWE-639
9
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 NewSectionPrompt(){ global $langmessage; ob_start(); echo '<div class="inline_box">'; echo '<form method="post" action="'.common::GetUrl($this->title).'">'; echo '<h2>'.$langmessage['new_section_about'].'</h2>'; echo '<table class="bordered full_width">'; echo '<tr><th colspan="2">'.$langmess...
CWE-79
1
$incident_title = strip_tags(html_entity_decode(html_entity_decode($this->data->item_title, ENT_QUOTES)));
CWE-79
1
public function breadcrumb() { global $sectionObj; expHistory::set('viewable', $this->params); $id = $sectionObj->id; $current = null; // Show not only the location of a page in the hierarchy but also the location of a standalone page $current = new secti...
CWE-89
0
public static function parseAndTrimExport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = str_replace("�", "-",...
CWE-89
0
protected function assetExtensions() { return [ 'jpg', 'jpeg', 'bmp', 'png', 'webp', 'gif', 'ico', 'css', 'js', 'woff', 'woff2', 'svg', 'ttf', ...
CWE-79
1
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
print_r($single_error); } echo '</pre>'; }
CWE-79
1
public function save() { $user = $this->getUser(); $values = $this->request->getValues(); if (! $this->userSession->isAdmin()) { if (isset($values['role'])) { unset($values['role']); } } list($valid, $errors) = $this->userValidato...
CWE-640
20
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($ro...
CWE-79
1
public function update_discount() { $id = empty($this->params['id']) ? null : $this->params['id']; $discount = new discounts($id); // find required shipping method if needed if ($this->params['required_shipping_calculator_id'] > 0) { $this->params['required_shipping_metho...
CWE-89
0
function selectObjectBySql($sql) { //$logFile = "C:\\xampp\\htdocs\\supserg\\tmp\\queryLog.txt"; //$lfh = fopen($logFile, 'a'); //fwrite($lfh, $sql . "\n"); //fclose($lfh); $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($re...
CWE-89
0
public static function strValidCharacters($string, $checkType) { if (trim($string) === '') { return false; } switch ($checkType) { case 'noSpecialChar': // a simple e-mail address should still be possible (like username) $validRegex = '/^[\w.@+-]+...
CWE-79
1
$period_days_append_sql= substr($period_days_append_sql,0,-4).'))'; } $exist_RET= DBGet(DBQuery("SELECT s.ID FROM schedule s WHERE student_id=". $student_id." AND s.syear='".UserSyear()."' {$mp_append_sql}{$period_days_append_sql} UNION SELECT s.ID FROM temp_schedule s WHERE student_id=". $stude...
CWE-22
2
public static function get_param($key = NULL) { $info = [ 'stype' => htmlentities(self::$search_type), 'stext' => htmlentities(self::$search_text), 'method' => htmlentities(self::$search_method), 'datelimit' => self::$search_date_limit, ...
CWE-79
1
public function getMovie($id){ $url = "http://api.themoviedb.org/3/movie/".$id."?api_key=".$this->apikey; $movie = $this->curl($url); return $movie; }
CWE-89
0
public static function getDefaultLang() { $def = Options::v('multilang_default'); $lang = json_decode(Options::v('multilang_country'), true); $deflang = $lang[$def]; return $deflang; }
CWE-89
0
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ...
CWE-89
0
function edit_order_item() { $oi = new orderitem($this->params['id'], true, true); if (empty($oi->id)) { flash('error', gt('Order item doesn\'t exist.')); expHistory::back(); } $oi->user_input_fields = expUnserialize($oi->user_input_fields); $params['o...
CWE-89
0
function get_filedisplay_views() { expTemplate::get_filedisplay_views(); $paths = array( BASE.'framework/modules/common/views/file/', BASE.'themes/'.DISPLAY_THEME.'modules/common/views/file/', ); $views = array(); foreach ($paths as $path) { if (is_readable($path)) { ...
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
public static function modList(){ //$mod = ''; $handle = dir(GX_MOD); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $dir = GX_MOD.$entry; if(is_dir($dir) == true){ $mod...
CWE-89
0
function new_user() { global $db; $insert = $db->sql_query("INSERT INTO `mod_useronline` (`timestamp`, `ip`) VALUES ('mysql_real_escape_string($this->timestamp)', 'mysql_real_escape_string($this->ip)')"); if (!$insert) { $this->error[$this->i] = "Unable to record new visitor\r\n"; $this->i ++; ...
CWE-89
0
protected function getUserzoneCookie() { $cookie = $this->getContext()->getRequest()->getCookie('userzone'); $length = strlen($cookie); if ($length <= 0) return null; $serialized_data = substr($cookie, 0, $length - 32); $hash_signiture = substr($cookie, $length - 32); // check th...
CWE-798
18
public function insert() { global $DB; $ok = $DB->execute(' INSERT INTO nv_menus (id, codename, icon, lid, notes, functions, enabled) VALUES ( 0, :codename, :icon, :lid, :notes, :functions, :enabled)', array( 'codename' => value_or_default($this->codename, ""), 'icon' =...
CWE-79
1
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), 'control...
CWE-89
0
public function getModel() { return $this->model; }
CWE-22
2
public static function all_in_array() { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webuser_groups WHERE website = '.protect($website->id)); $rs = $DB->result(); foreach($rs as $r...
CWE-89
0
public static function thmList(){ //$mod = ''; $handle = dir(GX_THEME); while (false !== ($entry = $handle->read())) { if ($entry != "." && $entry != ".." ) { $dir = GX_THEME.$entry; if(is_dir($dir) == true){ ...
CWE-89
0
function delete_selected() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item && $item->is_recurring == 1) { $event_remaining = false; $eventdates = $item->eventdate[0]->find('all', 'event_id=' . $item->id); foreach ($eventdates as ...
CWE-89
0
public function disable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->disable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successful...
CWE-639
9
public function testNameExceptionPhp53() { if (PHP_VERSION_ID >= 50400) { $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } $this->proxy->setActive(true); $this->proxy->setName('foo'); }
CWE-89
0
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 .= $srchc...
CWE-89
0
public function getCast($id){ $url = "http://api.themoviedb.org/3/movie/{$id}/credits?api_key=".$this->apikey; $cast = $this->curl($url); return $cast; }
CWE-89
0
public function getAlpha($key, $default = '', $deep = false) { return preg_replace('/[^[:alpha:]]/', '', $this->get($key, $default, $deep)); }
CWE-89
0
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.mp4', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso', '.pdf','.ofd','.swf','.epub','.xps', '.doc','.docx','.wps', '.ppt'...
CWE-79
1
function db_properties($table) { global $DatabaseType, $DatabaseUsername; switch ($DatabaseType) { case 'mysqli': $result = DBQuery("SHOW COLUMNS FROM $table"); while ($row = db_fetch_row($result)) { $properties[strtoupper($row['FIELD'])]['TYPE'] = strtoupper($ro...
CWE-22
2
$modelNames[ucfirst($module->name)] = self::getModelTitle($modelName); } asort ($modelNames); if ($criteria !== null) { return $modelNames; } else { self::$_modelNames = $modelNames; } } retur...
CWE-79
1
protected function parseChunkedRequest(Request $request) { $index = $request->get('qqpartindex'); $total = $request->get('qqtotalparts'); $uuid = $request->get('qquuid'); $orig = $request->get('qqfilename'); $last = ((int) $total - 1) === (int) $index; return [$l...
CWE-22
2
foreach ($elem[2] as $field) { echo ' <tr class="tr_fields itemCatName_'.$itemCatName.'"> <td valign="top" class="td_title">&nbsp;&nbsp;<span class="ui-icon ui-icon-carat-1-e" style="float: left; margin: 0 .3em 0 15px; font-size:9px;">&nbsp;</span>...
CWE-79
1
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); }
CWE-89
0
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); }
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
public static function exist($cat) { $cat = Typo::int($cat); $sql = "SELECT `id` FROM `cat` WHERE `id` = '{$cat}' AND `type` = 'post'"; $q = Db::result($sql); // echo Db::$num_rows; if (Db::$num_rows > 0) { return true; } else { return fals...
CWE-89
0
$db->updateObject($value, 'section'); } $db->updateObject($moveSec, 'section'); //handle re-ranking of previous parent $oldSiblings = $db->selectObjects("section", "parent=" . $oldParent . " AND rank>" . $oldRank . " ORDER BY rank")...
CWE-89
0
public function setting($name, $value=NULL) { global $DB; global $website; $DB->query( 'SELECT * FROM nv_settings WHERE type = "user" AND user = '.protect($this->id).' AND website = '.protect($websi...
CWE-89
0
private function sub_resource_download() { if (empty($this->response->meta->sub_resource_id)) { $this->response->meta->sub_resource_id = 0; } $attachment = $this->m_devices->read_sub_resource($this->response->meta->id, $this->response->meta->sub_resource, $this->response->met...
CWE-22
2
public function store($zdb) { $data = array( 'short_label' => $this->short, 'long_label' => $this->long ); try { if ($this->id !== null && $this->id > 0) { $update = $zdb->update(self::TABLE); $update->set($data)->w...
CWE-89
0
public static function getParent($id=''){ $sql = sprintf("SELECT `parent` FROM `cat` WHERE `id` = '%d'", $id); $cat = Db::result($sql); return $cat; }
CWE-89
0
$ret[$key] = sprintf( $format, ++$i, $err[0], $err[1], $err[2], $err[3] ); } return $ret; }
CWE-79
1
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
foreach ($value_arr['ENROLLMENT_INFO'] as $eid => $ed) { echo '<ENROLLMENT_INFO_' . htmlentities($eid) . '>'; echo '<SCHOOL_ID>' . htmlentities($ed['SCHOOL_ID']) . '</SCHOOL_ID>'; echo '<CALENDAR>' . htmlentities...
CWE-79
1
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 , $...
CWE-1236
12
public function getQueryOrderby() { $R1 = 'R1_' . $this->field->id; $R2 = 'R2_' . $this->field->id; return $this->is_rank_alpha ? "$R2.label" : "$R2.rank"; }
CWE-89
0
public static function install ($var) { include(GX_PATH.'/gxadmin/themes/install/'.$var.'.php'); }
CWE-89
0
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); ...
CWE-89
0
$regx = str_replace('/','\/', $k); if ( preg_match('/^'.$regx.'$/Usi', $uri, $m) ) { $result = [$v,$m]; return $result; } } }
CWE-89
0
static function description() { return gt("This module is for managing categories in your store."); }
CWE-89
0
public function checkOverlap() { try { $select = $this->zdb->select(self::TABLE, 'c'); $select->columns( array('date_debut_cotis', 'date_fin_cotis') )->join( array('ct' => PREFIX_DB . ContributionsTypes::TABLE), 'c.' . C...
CWE-89
0
public function adminBodyEnd() { global $L; if (!in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) { return false; } // Spell Checker $spellCheckerEnable = $this->getValue('spellChecker')?'true':'false'; // Include plugin's Javascript files $html = $this->includeJS('simplemde.min.j...
CWE-434
5
public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); }
CWE-307
26
public function saveNewFromLink($name, $link, $page_id) { $largestExistingOrder = Attachment::where('uploaded_to', '=', $page_id)->max('order'); return Attachment::forceCreate([ 'name' => $name, 'path' => $link, 'external' => true, 'extension' => '...
CWE-79
1
public function store($zdb) { $data = array( 'short_label' => $this->short, 'long_label' => $this->long ); try { if ($this->id !== null && $this->id > 0) { $update = $zdb->update(self::TABLE); $update->set($data)->w...
CWE-79
1
public function install () { Session::start(); System::gZip(); Theme::install('header'); Control::handler('install'); Theme::install('footer'); System::Zipped(); }
CWE-89
0
public function remove() { $project = $this->getProject(); $this->checkCSRFParam(); $column_id = $this->request->getIntegerParam('column_id'); if ($this->columnModel->remove($column_id)) { $this->flash->success(t('Column removed successfully.')); } else { ...
CWE-639
9
public function save() { session_write_close(); if (!$this->saveHandler->isWrapper() && !$this->saveHandler->isSessionHandlerInterface()) { // This condition matches only PHP 5.3 with internal save handlers $this->saveHandler->setActive(false); } $this->...
CWE-89
0
function insertObject($object, $table) { //if ($table=="text") eDebug($object,true); $sql = "INSERT INTO `" . $this->prefix . "$table` ("; $values = ") VALUES ("; foreach (get_object_vars($object) as $var => $val) { //We do not want to save any fields that start with an ...
CWE-89
0
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
CWE-79
1
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 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()...
CWE-639
9
public static function validateSignature(array $data, XMLSecurityKey $key) { assert('array_key_exists("Query", $data)'); assert('array_key_exists("SigAlg", $data)'); assert('array_key_exists("Signature", $data)'); $query = $data['Query']; $sigAlg = $data['SigAlg']; ...
CWE-347
25
public function delete_version() { if (empty($this->params['id'])) { flash('error', gt('The version you are trying to delete could not be found')); } // get the version $version = new help_version($this->params['id']); if (empty($version->id)) { flash('error', gt('The v...
CWE-89
0
function selectBillingOptions() { }
CWE-89
0
public function testGetDeep() { $bag = new ParameterBag(array('foo' => array('bar' => array('moo' => 'boo')))); $this->assertEquals(array('moo' => 'boo'), $bag->get('foo[bar]', null, true)); $this->assertEquals('boo', $bag->get('foo[bar][moo]', null, true)); $this->assertEquals(...
CWE-89
0
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 (...
CWE-89
0
public function activate_address() { global $db, $user; $object = new stdClass(); $object->id = $this->params['id']; $db->setUniqueFlag($object, 'addresses', $this->params['is_what'], "user_id=" . $user->id); flash("message", gt("Successfully updated address.")); ...
CWE-89
0
$that->options['id_field'] => new \MongoDate(), ); }));
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 testPortMustBeValid() { (new Uri(''))->withPort(100000); }
CWE-89
0
public function confirm() { $project = $this->getProject(); $tag_id = $this->request->getIntegerParam('tag_id'); $tag = $this->tagModel->getById($tag_id); $this->response->html($this->template->render('project_tag/remove', array( 'tag' => $tag, 'proje...
CWE-639
9
$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
private function getCategory() { $category = $this->categoryModel->getById($this->request->getIntegerParam('category_id')); if (empty($category)) { throw new PageNotFoundException(); } return $category; }
CWE-639
9
public function rules() { return [ 'sku' => ['required'], 'name' => ['required', Rule::unique('products')->ignore($this->segment(3))], 'quantity' => ['required', 'integer', 'min:0'], 'price' => ['required', 'numeric', 'min:0'], 'sale_price' => ...
CWE-79
1
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-22
2
protected function filter($files) { foreach ($files as $i => $file) { if (!empty($file['hidden']) || !$this->default->mimeAccepted($file['mime'])) { unset($files[$i]); } } return array_merge($files, array()); }
CWE-89
0
static function description() { return gt("Places navigation links/menus on the page."); }
CWE-89
0
public static function recent_actions($function, $action, $limit=8) { global $DB; global $user; global $website; // last month only! $DB->query(' SELECT DISTINCT nvul.website, nvul.function, nvul.item, nvul.date FROM nv_users_log nvul WHERE nvul.user = '.protect($user->id).' AND nv...
CWE-89
0