code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n" ); } }
CWE-79
1
public function setCallback($callback) { if (!is_callable($callback)) { throw new \LogicException('The Response callback must be a valid PHP callable.'); } $this->callback = $callback; }
CWE-89
0
public function confirm() { $project = $this->getProject(); $category = $this->getCategory(); $this->response->html($this->helper->layout->project('category/remove', array( 'project' => $project, 'category' => $category, ))); }
CWE-639
9
public function withStatus($code, $reasonPhrase = '') { $new = clone $this; $new->statusCode = (int) $code; if (!$reasonPhrase && isset(self::$phrases[$new->statusCode])) { $reasonPhrase = self::$phrases[$new->statusCode]; } $new->reasonPhrase = $reasonPhrase;...
CWE-89
0
$res = preg_match("/^$map_part/", $this->url_parts[$i]); if ($res != 1) { $matched = false; break; } $pairs[$key] = $this->url_parts[$i]; $i++; } ...
CWE-89
0
public static function getMenuRaw($menuid){ $sql = sprintf("SELECT * FROM `menus` WHERE `menuid` = '%s' ORDER BY `order` ASC", $menuid); $menus = Db::result($sql); $n = Db::$num_rows; return $menus; }
CWE-89
0
$passwd = generate_password(PASSWORD_LENGTH); if (change_user_password($name, $passwd)) { $email = safe_field("email", 'txp_users', "name = '".doSlash($name)."'"); if (send_new_password($passwd, $email, $name)) { $changed[...
CWE-521
4
private static function listFilesInDirectory($dir, $omitSymlinks, $prefix = '') { if (!is_dir($dir)) { return false; } $excludes = array(".",".."); $result = array(); $files = self::localScandir($dir); if(!$files) { return array(); } foreach($files as $file) { if(!in_array($file, $excludes)) ...
CWE-89
0
public function getQuerySelect() { return ''; }
CWE-89
0
public function isBlacklisted($ip, $username) { // first remove old expired rows $this->clean(); // count $params = array('conditions' => array( 'Bruteforce.ip' => $ip, 'Bruteforce.username' => $username),); $count = $this->...
CWE-367
29
$keys = array_keys($value); // print_r($keys); if ($keys[0] == $lang) { $lang = $multilang[$key][$lang]; return $lang; } } } }
CWE-89
0
public function load_from_post() { $this->title = $_REQUEST['title']; $this->file = $_REQUEST['file']; $this->permission = intval($_REQUEST['permission']); $this->enabled = intval($_REQUEST['enabled']); // sections $this->sections = array(); for($s = 0; $s < count($_REQUEST['template...
CWE-22
2
public function delete() { global $db, $history; /* 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']) ? SIMPL...
CWE-89
0
function captureAuthorization() { //eDebug($this->params,true); $order = new order($this->params['id']); /*eDebug($this->params); //eDebug($order,true);*/ //eDebug($order,true); //$billing = new billing(); //eDebug($billing, true); //$billing->calcul...
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
$dt = date('Y-m-d', strtotime($match)); $sql = par_rep("/'$match'/", "'$dt'", $sql); } } if (substr($sql, 0, 6) == "BEGIN;") { $array = explode(";", $sql); foreach ($array as $value) { if ($value != "") { $user_agent = explode('/', $_SERVER['HTTP_USER_AGENT']); if ($user_...
CWE-79
1
protected function parseChunkedRequest(Request $request) { $session = $this->container->get('session'); $orig = $request->get('name'); $index = $request->get('chunk'); $last = (int) $request->get('chunks') - 1 === (int) $request->get('chunk'); // it is possible, that tw...
CWE-22
2
public static function canImportData() { return true; }
CWE-89
0
<div class='graphWrapper' style='width:100%;' id='wrapper_<?php print $graph['local_graph_id']?>' graph_width='<?php print $graph['width'];?>' graph_height='<?php print $graph['height'];?>' title_font_size='<?php print ((read_user_setting('custom_fonts') == 'on') ? read_user_setting('title_size') : read_config_o...
CWE-79
1
protected function assertCsvUploaded($csv) { $uploadedPath = implode(DIRECTORY_SEPARATOR, array( Yii::app()->basePath, 'data', 'data.csv' )); $this->assertFileExists ($uploadedPath); $this->assertFileEquals ($csv, $uploadedPath); }
CWE-79
1
public function __construct($message = null, $code = 404, Exception $previous = null) { if ($message === null) { $message = _('Nothing to show with this id'); } parent::__construct($message, $code, $previous); }
CWE-307
26
public function validate($type = false) { $return = true; try { if ($type && $this->getShortMimeType(0) !== $type) { throw new \App\Exceptions\DangerousFile('ERR_FILE_ILLEGAL_FORMAT'); } $this->checkFile(); if (!empty($this->validateAllowedFormat)) { $this->validateFormat(); } $this->val...
CWE-79
1
public function remove() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->remove($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane removed successfully...
CWE-639
9
public function downloadfile() { if (empty($this->params['fileid'])) { flash('error', gt('There was an error while trying to download your file. No File Specified.')); expHistory::back(); } $fd = new filedownload($this->params['fileid']); if (empty(...
CWE-89
0
protected function _save($fp, $dir, $name, $stat) { //TODO optionally encrypt $fp before uploading if mime is not already encrypted type $path = $this->_joinPath($dir, $name); return $this->connect->put($path, $fp) ? $path : false; }
CWE-918
16
$a = ${($_ = isset($this->services['App\Processor']) ? $this->services['App\Processor'] : $this->getProcessorService()) && false ?: '_'};
CWE-89
0
public function searchNew() { global $db, $user; //$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'] . "...
CWE-89
0
protected function loadSelectedViewName() { $code = $this->request->get('code', ''); if (false === \strpos($code, '-')) { $this->selectedViewName = $code; return; } $parts = \explode('-', $code); $this->selectedViewName = empty($parts) ? $code : $...
CWE-79
1
private function setColumnOption(&$column, string $name, string $key, bool $isWidget, bool $allowEmpty) { $newValue = $this->request->request->get($name . '-' . $key); if ($isWidget) { if (!empty($newValue) || $allowEmpty) { $column['children'][0][$key] = $newValue; ...
CWE-79
1
function edit_vendor() { $vendor = new vendor(); if(isset($this->params['id'])) { $vendor = $vendor->find('first', 'id =' .$this->params['id']); assign_to_template(array( 'vendor'=>$vendor )); } }
CWE-89
0
public function delete() { global $db, $history; /* 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']) ? SIMPL...
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
public function __construct() { if (System::existConf()) { new System(); }else{ $this->install(); } }
CWE-89
0
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition $v = null) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDef...
CWE-89
0
public static function error ($vars="", $val='') { if( isset($vars) && $vars != "" ) { $file = GX_PATH.'/inc/lib/Control/Error/'.$vars.'.control.php'; if (file_exists($file)) { include($file); } }else{ include(GX_PATH.'...
CWE-89
0
hb_map_clear (hb_map_t *map) { if (unlikely (hb_object_is_immutable (map))) return; return map->clear (); }
CWE-787
24
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
CWE-89
0
function insertServiceCategorieInDB(){ global $pearDB, $centreon; if (testServiceCategorieExistence($_POST["sc_name"])){ $DBRESULT = $pearDB->query("INSERT INTO `service_categories` (`sc_name`, `sc_description`, `level`, `icon_id`, `sc_activate` ) VALUES ('".$_POST["sc_name"]....
CWE-89
0
public function actionGetItems(){ $sql = 'SELECT id, name as value, subject FROM x2_bug_reports WHERE name LIKE :qterm ORDER BY name ASC'; $command = Yii::app()->db->createCommand($sql); $qterm = $_GET['term'].'%'; $command->bindParam(":qterm", $qterm, PDO::PARAM_STR); $resul...
CWE-79
1
public function routePutProvider() { return [ ['/api/articles/', 1, 'articles', 'batch', false, 200], ['/api/v1/articles/', 1, 'articles', 'batch', false, 200], ['/api/v2/articles/', 2, 'articles', 'batch', false, 200], ['/api/articles/5', 1, '...
CWE-601
11
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-79
1
function update_upcharge() { $this->loc->src = "@globalstoresettings"; $config = new expConfig($this->loc); $this->config = $config->config; //This will make sure that only the country or region that given a rate value will be saved in the db $upcharge = array(); foreach($this->params['upch...
CWE-89
0
public function get_info($object_id, $table_name = '') { $table_name = $table_name ? Dba::escape($table_name) : Dba::escape(strtolower(get_class($this))); // Make sure we've got a real id if ($object_id < 1) { return array(); } if (self::is_cached($table_nam...
CWE-89
0
public function manage_messages() { expHistory::set('manageable', $this->params); $page = new expPaginator(array( 'model'=>'order_status_messages', 'where'=>1, 'limit'=>10, 'order'=>'body', 'page'=>(isset($this->params['page']) ? $this->params['page'] : 1), ...
CWE-89
0
foreach ($pkeys as $k) { $where[] = $k . ' = "' . $row->$k . '"'; }
CWE-89
0
public function getUpcoming(){ $url = "http://api.themoviedb.org/3/movie/upcoming?api_key=".$this->apikey; $upcoming = $this->curl($url); return $upcoming; }
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
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
public function getNbOfVisibleMenuEntries() { $nb = 0; foreach ($this->liste as $val) { //if (dol_eval($val['enabled'], 1)) $nb++; if (!empty($val['enabled'])) { $nb++; // $val['enabled'] is already evaluated to 0 or 1, no need for dol_eval() } } return $nb; }
CWE-94
14
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 function saveConfig() { if (!empty($this->params['aggregate']) || !empty($this->params['pull_rss'])) { if ($this->params['order'] == 'rank ASC') { expValidator::failAndReturnToForm(gt('User defined ranking is not allowed when aggregating or pull RSS data feeds.'), $this->...
CWE-89
0
public static function validator($vars =""){ $GLOBALS['validator'] = true; $GLOBALS['validator_js'] = $vars; //return $editor; }
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
public static function recent_items($limit=5) { global $DB; global $user; global $website; // last month only! $DB->query(' SELECT DISTINCT nvul.website, nvul.function, nvul.item, nvul.item_title, nvf.lid as function_title, nvf.icon as function_icon, nvul.date FROM nv_users_log nvul,...
CWE-89
0
$src = substr($ref->source, strlen($prefix)) . $section->id; if (call_user_func(array($ref->module, 'hasContent'))) { $oloc = expCore::makeLocation($ref->module, $ref->source); $nloc = expCore::makeLocation($ref->module, $src); if ($ref->module...
CWE-89
0
public static function isHadParent($parent='', $menuid = ''){ if(isset($menuid)){ $where = " AND `menuid` = '{$menuid}'"; }else{ $where = ''; } if(isset($parent) && $parent != ''){ $parent = " `parent` = '{$parent}'"; }else{ ...
CWE-89
0
public static function setTransactionPart(Db $zdb, $trans_id, $contrib_id) { try { $update = $zdb->update(self::TABLE); $update->set( array(Transaction::PK => $trans_id) )->where(self::PK . ' = ' . $contrib_id); $zdb->execute($update); ...
CWE-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_items WHERE website = '.protect($website->id), 'object'); if($type='json') $out = json_encode($DB->result()); return $out; ...
CWE-89
0
public function save() { global $DB; if(!empty($this->id)) return $this->update(); else return $this->insert(); }
CWE-79
1
public static function totalUser() { $posts = Db::result("SELECT `id` FROM `user` WHERE `group` > '0' "); $npost = Db::$num_rows; return $npost; }
CWE-89
0
function download($disposition=false, $expires=false) { $disposition = $disposition ?: 'inline'; $bk = $this->open(); if ($bk->sendRedirectUrl($disposition)) return; $ttl = ($expires) ? $expires - Misc::gmtime() : false; $this->makeCacheable($ttl); $type =...
CWE-79
1
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 function __construct () { }
CWE-89
0
static function displayname() { return "Events"; }
CWE-89
0
public static function slugify($text) { // strip tags $text = strip_tags($text); // replace non letter or digits by - $text = preg_replace('~[^\\pL\d]+~u', '-', $text); // trim $text = trim($text, '-'); // transliterate setlocale(LC_CTYPE, Options::v('country')...
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
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 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
function cleanCSV($string) { $check = '/^[=@]/'; if (!is_numeric($string)) { $check = '/^[=@+-]/'; } return preg_replace($check, "", $string); }
CWE-640
20
public function getList($location, $features, $etag, $mediatypes) { $featuresArray = explode(';', $features); $mediaTypesArray = explode(';', $mediatypes); try { return $this->getFilesAndAlbums($location, $featuresArray, $etag, $mediaTypesArray); } catch (\Exception $exception) { return $this->jsonError(...
CWE-79
1
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 getBranches() { if (null === $this->branches) { $branches = array(); $bookmarks = array(); $this->process->execute('hg branches', $output, $this->repoDir); foreach ($this->process->splitLines($output) as $branch) { if ($bra...
CWE-94
14
function edit() { global $template; parent::edit(); $allforms = array(); $allforms[""] = gt('Disallow Feedback'); // calculate which event date is the one being edited $event_key = 0; foreach ($template->tpl->tpl_vars['record']->value->eventdate as $k...
CWE-89
0
public function getQuerySelect() { return ''; }
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
public function update_version() { // get the current version $hv = new help_version(); $current_version = $hv->find('first', 'is_current=1'); // check to see if the we have a new current version and unset the old current version. if (!empty($this->params['is_current'])) { // $db...
CWE-89
0
function reparent_standalone() { $standalone = $this->section->find($this->params['page']); if ($standalone) { $standalone->parent = $this->params['parent']; $standalone->update(); expSession::clearAllUsersSessionCache('navigation'); expHistory::...
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
protected static function __Load($path) { include_once($path); }
CWE-79
1
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
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 buildControl() { $control = new colorcontrol(); if (!empty($this->params['value'])) $control->value = $this->params['value']; if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value']; $control->default = $this->params['value']; ...
CWE-89
0
function get_plural_forms() { // lets assume message number 0 is header // this is true, right? $this->load_tables(); // cache header field for plural forms if (! is_string($this->pluralheader)) { if ($this->enable_cache) { $header = $this->cache_translations[""]; } else { ...
CWE-94
14
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
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_properties WHERE website = '.protect($website->id), 'object'); if($type='json') $out['nv_properties'] = json_encode($DB->result()); ...
CWE-89
0
public static function _date2timestamp( $datetime, $wtz=null ) { if( !isset( $datetime['hour'] )) $datetime['hour'] = 0; if( !isset( $datetime['min'] )) $datetime['min'] = 0; if( !isset( $datetime['sec'] )) $datetime['sec'] = 0; if( empty( $wtz ) && ( !isset( $datetime['tz'] ) || emp...
CWE-89
0
protected function _mkdir($path, $name) { $path = $this->_joinPath($path, $name); if ($this->connect->mkdir($path) === false) { return false; } $this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path); return $path; }
CWE-918
16
function send_reset_confirmation_request($name) { global $sitename; $rs = safe_row("email, nonce", 'txp_users', "name = '".doSlash($name)."'"); if ($rs) { extract($rs); $confirm = bin2hex(pack('H*', substr(md5($nonce), 0, 10)).$name); $message = gTxt('greeting').' '.$name.','. ...
CWE-521
4
public function search() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->prefix . "addresses as a "; //R J...
CWE-89
0
public function verifyPhoneNumber(App\Request $request) { if ('phone' !== $this->fieldModel->getFieldDataType()) { throw new \App\Exceptions\NoPermitted('ERR_NO_PERMISSIONS_TO_FIELD'); } $response = new Vtiger_Response(); $data = ['isValidNumber' => false]; if ($request->isEmpty('phoneCountry', true)) { ...
CWE-434
5
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
CWE-89
0
protected function getComment() { $comment = $this->commentModel->getById($this->request->getIntegerParam('comment_id')); if (empty($comment)) { throw new PageNotFoundException(); } if (! $this->userSession->isAdmin() && $comment['user_id'] != $this->userSession->ge...
CWE-639
9
public static function factory($type) { include_once './libraries/gis/GIS_Geometry.class.php'; $type_lower = strtolower($type); if (! file_exists('./libraries/gis/GIS_' . ucfirst($type_lower) . '.class.php')) { return false; } if (include_once './libraries/gi...
CWE-22
2
form_end_row(); $i++; } html_end_box(false); /* print "<pre>"; if (isset($check) && is_array($check)) { print_r($check); } print "</pre>"; */ }
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
public function update() { global $user; if (expSession::get('customer-signup')) expSession::set('customer-signup', false); if (isset($this->params['address_country_id'])) { $this->params['country'] = $this->params['address_country_id']; unset($this->params['address_cou...
CWE-89
0
static function description() { return gt("This module is for managing categories in your store."); }
CWE-89
0
foreach ($val as $k => $v) { unset($process[$key][$k]); $stripTags = \in_array($k, $whiteList) ? false : $stripTagsConf; if (\is_string($k)) { $filteredKey = self::filterValue($k, $regex, $stripTags); } else { ...
CWE-79
1
$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
public function testResolveTranslation() { $translator = $this->prophesize(TranslatorInterface::class); $translator->getLocale()->willReturn('de'); $translator->setLocale('de')->shouldBeCalled(); $translator->trans('test-key')->willReturn('TEST'); $entity = $this->prophes...
CWE-22
2