code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
public function withAddedHeader($header, $value) { if (!$this->hasHeader($header)) { return $this->withHeader($header, $value); } $new = clone $this; $new->headers[strtolower($header)][] = $value; $new->headerLines[$header][] = $value; return $new; ...
CWE-89
0
public function validate() { global $db; // check for an sef url field. If it exists make sure it's valid and not a duplicate //this needs to check for SEF URLS being turned on also: TODO if (property_exists($this, 'sef_url') && !(in_array('sef_url', $this->do_not_validate))) { ...
CWE-89
0
public function testCreateRelationshipMeta() { // test $GLOBALS['log']->reset(); SugarBean::createRelationshipMeta(null, null, null, array(), null); self::assertCount(1, $GLOBALS['log']->calls['fatal']); // test $GLOBALS['log']->reset(); SugarBean::create...
CWE-640
20
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
CWE-639
9
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
function PMA_getCentralColumnsCount($db) { $cfgCentralColumns = PMA_centralColumnsGetParams(); if (empty($cfgCentralColumns)) { return 0; } $pmadb = $cfgCentralColumns['db']; $GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']); $central_list_table = $cfgCentralColumns['table']; ...
CWE-89
0
public function approve_toggle() { global $history; 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 $r...
CWE-89
0
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.'_'...
CWE-22
2
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
public function gc($maxlifetime) { $this->getCollection()->remove(array( $this->options['expiry_field'] => array('$lt' => new \MongoDate()), )); return true; }
CWE-89
0
$link = str_replace(URL_FULL, '', makeLink(array('section' => $section->id)));
CWE-89
0
public function getDigits($key, $default = '', $deep = false) { // we need to remove - and + because they're allowed in the filter return str_replace(array('-', '+'), '', $this->filter($key, $default, FILTER_SANITIZE_NUMBER_INT, array(), $deep)); }
CWE-89
0
public function editTitle() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->title = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your title was updated succes...
CWE-89
0
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
Contacts::model()->deleteAll($criteria); } } echo $model->id; } }
CWE-79
1
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-79
1
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); break; } // Error code for...
CWE-22
2
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
CWE-89
0
public function testCreatesResponseWithAddedHeaderArray() { $r = new Response(); $r2 = $r->withAddedHeader('foo', ['baz', 'bar']); $this->assertFalse($r->hasHeader('foo')); $this->assertEquals('baz, bar', $r2->getHeaderLine('foo')); }
CWE-89
0
public function __construct($strSystemid = "") { //Generating all the required objects. For this we use our cool cool carrier-object //take care of loading just the necessary objects $objCarrier = class_carrier::getInstance(); $this->objConfig = $objCarrier->getObjConfig(); ...
CWE-79
1
$percent = round($percent, 0); } else { $percent = round($percent, 2); // school default } if ($ret == '%') return $percent; if (!$_openSIS['_makeLetterGrade']['grades'][$grade_scale_id]) $_openSIS['_makeLetterGrade']['grades'][$grade_scale_id] = DBGet(DBQuery('SELECT TI...
CWE-22
2
private function validateImageMetadata($data) { if (\is_array($data)) { foreach ($data as $value) { if (!$this->validateImageMetadata($value)) { return false; } } } else { if (1 === preg_match('/(<\?php?(.*?))/i', $data) || false !== stripos($data, '<?=') || false !== stripos($data, '<? ')) ...
CWE-79
1
function extract_plural_forms_header_from_po_header($header) { if (preg_match("/(^|\n)plural-forms: ([^\n]*)\n/i", $header, $regs)) $expr = $regs[2]; else $expr = "nplurals=2; plural=n == 1 ? 0 : 1;"; return $expr; }
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
protected function remove($path, $force = false) { $stat = $this->stat($path); if (empty($stat)) { return $this->setError(elFinder::ERROR_RM, $path, elFinder::ERROR_FILE_NOT_FOUND); } $stat['realpath'] = $path; $this->rmTmb($stat); $this->clearcache(...
CWE-78
6
public function newpassword() { if ($token = $this->param('token')) { $user = $this->app->storage->findOne('cockpit/accounts', ['_reset_token' => $token]); if (!$user) { return false; } $user['md5email'] = md5($user['email']); ...
CWE-89
0
public function getLayout(){ $layout = $this->getAttribute('layout'); $initLayout = $this->initLayout(); if(!$layout){ // layout hasn't been initialized? $layout = $initLayout; $this->layout = json_encode($layout); $this->update(array('layout')); ...
CWE-79
1
private function getSwimlane() { $swimlane = $this->swimlaneModel->getById($this->request->getIntegerParam('swimlane_id')); if (empty($swimlane)) { throw new PageNotFoundException(); } return $swimlane; }
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
public function onRouteShutdown(Enlight_Controller_EventArgs $args) { $request = $args->getRequest(); $response = $args->getResponse(); if (Shopware()->Container()->initialized('shop')) { /** @var DetachedShop $shop */ $shop = $this->get('shop'); if ...
CWE-601
11
public function testReturnsAsIsWhenNoChanges() { $request = new Psr7\Request('GET', 'http://foo.com'); $this->assertSame($request, Psr7\modify_request($request, [])); }
CWE-89
0
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_opportunities 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 = $co...
CWE-79
1
return @unlink($dir); } return false; }
CWE-89
0
private function load($id) { global $zdb; try { $select = $zdb->select(self::TABLE); $select->limit(1) ->where(self::PK . ' = ' . $id); $results = $zdb->execute($select); $this->loadFromRs($results->current()); } catch (Thr...
CWE-89
0
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $sql); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res); return $a...
CWE-89
0
public function sdm_save_other_details_meta_data($post_id) { // Save Statistics Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (!isset($_POST['sdm_other_details_nonce_check']) || !wp_verify_nonce($_POST['sdm_other_details_nonce_check'], 'sdm_other_details_nonce')) { ret...
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
public function getQueryGroupby() { // SubmittedOn is stored in the artifact return 'a.submitted_by'; }
CWE-89
0
public function backup($type='json') { global $DB; global $website; $out = array(); $DB->query(' SELECT * FROM nv_webdictionary_history WHERE website = '.protect($website->id), 'object' ); if($type='json') $out = json_en...
CWE-89
0
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->act...
CWE-639
9
public static function isActive($thm){ if(Options::v('themes') === $thm){ return true; }else{ return false; } }
CWE-89
0
public function beforeSave() { if(strpos($this->tag,self::DELIM) !== false) { $this->tag = strtr($this->tag,array(self::DELIM => '')); } return true; }
CWE-79
1
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
$contents = ['form' => tep_draw_form('languages', 'languages.php', 'page=' . $_GET['page'] . '&lID=' . $lInfo->languages_id . '&action=save')];
CWE-79
1
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
foreach ($nodes as $node) { if ((($perm == 'view' && $node->public == 1) || expPermissions::check($perm, expCore::makeLocation('navigation', '', $node->id))) && !in_array($node->id, $ignore_ids)) { if ($node->active == 1) { $text = str_pad('', ($depth + ($full ...
CWE-89
0
protected function canCreateTmb($path, $stat, $checkTmbPath = true) { return (!$checkTmbPath || $this->tmbPathWritable) && (!$this->tmbPath || strpos($path, $this->tmbPath) === false) // do not create thumnbnail for thumnbnail && $this->imgLib && strpos($stat['mime'], 'image') === 0 && ($this->imgLib ...
CWE-89
0
public function getSiteInfo() { // check for a site request param if(empty($this->getSite())){ $this->setName(get_bloginfo('name')); $this->setDescription(get_bloginfo('description')); $this->setRestApiUrl(get_rest_url()); $this->setSite(get_blogin...
CWE-918
16
public function update() { $project = $this->getProject(); $values = $this->request->getValues(); list($valid, $errors) = $this->swimlaneValidator->validateModification($values); if ($valid) { if ($this->swimlaneModel->update($values['id'], $values)) { ...
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
protected function connect() { $user = $this->getUser(); $workgroup = null; if (strpos($user, '/')) { list($workgroup, $user) = explode('/', $user); } $this->state->init($workgroup, $user, $this->getPassword()); }
CWE-78
6
public function testDeleteRoutes($uri, $expectedVersion, $expectedController, $expectedAction, $expectedId, $expectedCode) { $request = new Enlight_Controller_Request_RequestTestCase(); $request->setMethod('DELETE'); $response = new Enlight_Controller_Response_ResponseTestCase(); ...
CWE-601
11
public function getPurchaseOrderByJSON() { if(!empty($this->params['vendor'])) { $purchase_orders = $this->purchase_order->find('all', 'vendor_id=' . $this->params['vendor']); } else { $purchase_orders = $this->purchase_order->find('all'); } echo json_encode($purchase_orders); }
CWE-89
0
public static function start() { session_name('GeniXCMS'); session_start(); //unset($_SESSION); if (!isset($_SESSION['gxsess']) || $_SESSION['gxsess'] == "" ) { $_SESSION['gxsess'] = array ( 'key' => self::sesKey(), ...
CWE-89
0
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'"); } if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records); // eDebug($sql, true); // count the ...
CWE-89
0
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( 'calculato...
CWE-89
0
public function testNameExceptionPhp54() { session_start(); $this->proxy->setName('foo'); }
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 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
public function IsQmail() { if (stristr(ini_get('sendmail_path'), 'qmail')) { $this->Sendmail = '/var/qmail/bin/sendmail'; } $this->Mailer = 'sendmail'; }
CWE-79
1
function svn_utils_criteria_list_to_query($criteria_list) { $criteria_list = str_replace('>', ' ASC', $criteria_list); $criteria_list = str_replace('<', ' DESC', $criteria_list); return $criteria_list; }
CWE-89
0
foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else { $exptag = new expTag($tag->id); $used_tags[$tag->id] = $exptag; $used_tags[$tag->id]->c...
CWE-89
0
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
CWE-639
9
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
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
$save_value = expString::sanitize($value); $_REQUEST[$key] = $save_value; $_GET[$key] = $save_value; } return true; }
CWE-89
0
public static function parseAndTrimImport($str, $isHTML = false) { //�Death from above�? � //echo "1<br>"; eDebug($str); // global $db; $str = str_replace("�", "&rsquo;", $str); $str = str_replace("�", "&lsquo;", $str); $str = str_replace("�", "&#174;", $str); $str = ...
CWE-89
0
public function execute() { parent::execute(); // get parameters $term = SpoonFilter::getPostValue('term', null, ''); // validate if($term == '') $this->output(self::BAD_REQUEST, null, 'term-parameter is missing.'); // previous search result $previousTerm = SpoonSession::exists('searchTerm') ? SpoonS...
CWE-79
1
form_selectable_cell('<a class="linkEditMain" href="' . html_escape('automation_networks.php?action=edit&id=' . $network['id']) . '">' . $network['name'] . '</a>', $network['id']); form_selectable_cell($network['data_collector'], $network['id']); form_selectable_cell($sched_types[$network['sched_type']], $netw...
CWE-79
1
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, $sql); if ($res == null) ...
CWE-89
0
public function search_external() { // global $db, $user; global $db; $sql = "select DISTINCT(a.id) as id, a.source as source, a.firstname as firstname, a.middlename as middlename, a.lastname as lastname, a.organization as organization, a.email as email "; $sql .= "from " . $db->pref...
CWE-89
0
public function manage() { expHistory::set('manageable', $this->params); // build out a SQL query that gets all the data we need and is sortable. $sql = 'SELECT b.*, c.title as companyname, f.expfiles_id as file_id '; $sql .= 'FROM '.DB_TABLE_PREFIX.'_banner b, '.DB_TABLE_P...
CWE-89
0
protected function signDocument(\DOMDocument $document, $node) { $this->add509Cert($this->getCertificate()->getPublicKey()->getX509Certificate()); $this->setCanonicalMethod(XMLSecurityDSig::EXC_C14N); $this->addReference($document->documentElement, XMLSecurityDSig::SHA1, array('http://ww...
CWE-347
25
private function getNewPrinter() { $printer = getItemByTypeName('Printer', '_test_printer_all'); $pfields = $printer->fields; unset($pfields['id']); unset($pfields['date_creation']); unset($pfields['date_mod']); $pfields['name'] = $this->getUniqueString(); $this->integer((...
CWE-89
0
$bdd->exec($sql); } } }
CWE-78
6
$this->services['App\Bus'] = $instance = new \App\Bus(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'});
CWE-89
0
public function save(){ $cat_name = I("cat_name"); $s_number = I("s_number/d") ? I("s_number/d") : 99 ; $cat_id = I("cat_id/d")? I("cat_id/d") : 0; $parent_cat_id = I("parent_cat_id/d")? I("parent_cat_id/d") : 0; $item_id = I("item_id/d"); $login_user = $this->check...
CWE-425
27
function scan_page($parent_id) { global $db; $sections = $db->selectObjects('section','parent=' . $parent_id); $ret = ''; foreach ($sections as $page) { $cLoc = serialize(expCore::makeLocation('container','@section' . $page->id)); ...
CWE-89
0
private function getTaskLink() { $link = $this->taskLinkModel->getById($this->request->getIntegerParam('link_id')); if (empty($link)) { throw new PageNotFoundException(); } return $link; }
CWE-639
9
function update($vars, &$errors) { if (!$vars['grace_period']) $errors['grace_period'] = __('Grace period required'); elseif (!is_numeric($vars['grace_period'])) $errors['grace_period'] = __('Numeric value required (in hours)'); elseif ($vars['grace_period'] > 8760) ...
CWE-79
1
unset($return[$key]); } } break; } return @array_change_key_case($return, CASE_UPPER); }
CWE-79
1
public function Connected() { if(!empty($this->smtp_conn)) { $sock_status = socket_get_status($this->smtp_conn); if($sock_status["eof"]) { // the socket is valid but we are not connected if($this->do_debug >= 1) { $this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught ...
CWE-79
1
public static function error ($vars="") { if( isset($vars) && $vars != "" ) { include(GX_PATH.'/inc/lib/Control/Error/'.$vars.'.control.php'); }else{ include(GX_PATH.'/inc/lib/Control/Error/404.control.php'); } }
CWE-79
1
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 lang($vars) { $file = GX_PATH.'/inc/lang/'.$vars.'.lang.php'; if (file_exists($file)) { include($file); } }
CWE-89
0
$this->paths[substr($key, strlen('path-'))] = $value; }
CWE-79
1
public static function rss() { switch (SMART_URL) { case true: # code... $inFold = (Options::v('permalink_use_index_php') == "on")? "/index.php":""; $url = Site::$url.$inFold."/rss".GX_URL_PREFIX; break; default...
CWE-89
0
public function setFlashCookieObject($name, $object, $time = 60) { setcookie($name, json_encode($object), time() + $time, '/'); return $this; }
CWE-565
17
function edit_section() { global $db, $user; $parent = new section($this->params['parent']); if (empty($parent->id)) $parent->id = 0; assign_to_template(array( 'haveStandalone' => ($db->countObjects('section', 'parent=-1') && $parent->id >= 0), 'paren...
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
$f = function (\Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber $v) { return $v; }; return $f(${($_ = isset($this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber']) ? $this->services['Symfony\Component\DependencyInjection\Tests\Fixtures\TestSe...
CWE-89
0
protected function gdImageBackground($image, $bgcolor){ if( $bgcolor == 'transparent' ){ imagesavealpha($image,true); $bgcolor1 = imagecolorallocatealpha($image, 255, 255, 255, 127); }else{ list($r, $g, $b) = sscanf($bgcolor, "#%02x%02x%02x"); $bgcolor1 = imagecolorallocate($image, $r, $g, $b); } ...
CWE-89
0
public static function versionCheck() { $v = trim(self::latestVersion()); // print_r($v); if ($v > self::$version) { Hooks::attach("admin_page_notif_action", array('System', 'versionReport')); } }
CWE-89
0
public function Close() { $this->error = null; // so there is no confusion $this->helo_rply = null; if(!empty($this->smtp_conn)) { // close the connection and cleanup fclose($this->smtp_conn); $this->smtp_conn = 0; } }
CWE-79
1
$masteroption->delete(); } // delete the mastergroup $db->delete('optiongroup', 'optiongroup_master_id='.$mastergroup->id); $mastergroup->delete(); expHistory::back(); }
CWE-89
0
$this->assertEquals(array($flashes[$key]), $val); ++$i; }
CWE-89
0
function remove() { global $db; $section = $db->selectObject('section', 'id=' . $this->params['id']); if ($section) { section::removeLevel($section->id); $db->decrement('section', 'rank', 1, 'rank > ' . $section->rank . ' AND parent=' . $section->parent); ...
CWE-89
0
public function close() { $this->active = false; return (bool) $this->handler->close(); }
CWE-89
0
public function install(array $options = null, &$status=null) { parent::install($options); parent::setup($options); //check if ssl is enabled $this->appcontext->run('v-list-web-domain', [$this->appcontext->user(), $this->domain, 'json'], $status); $sslEnabled = ($status->json[$this->domain]['SSL'...
CWE-78
6
function get_rsvpversion() { return '9.2.5'; }
CWE-89
0