code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
private function load($id) { try { $select = $this->zdb->select(self::TABLE); $select->limit(1)->where(self::PK . ' = ' . $id); $results = $this->zdb->execute($select); $res = $results->current(); $this->id = $id; $this->name = $r...
CWE-89
0
$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-94
14
public function update($key, $qty) { if ((int)$qty && ((int)$qty > 0)) { $this->session->data['cart'][$key] = (int)$qty; } else { $this->remove($key); } $this->data = array(); }
CWE-918
16
$resp = $this->asEditor()->get($entity->getUrl('/export/html')); $resp->assertDontSee('window.donkey'); $resp->assertDontSee('script'); $resp->assertSee('.my-test-class { color: red; }'); }
CWE-79
1
public static function destroy () { session_destroy(); unset($_SESSION['gxsess']); }
CWE-89
0
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-89
0
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
function db_start() { global $DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort, $DatabaseType; switch ($DatabaseType) { case 'mysqli': $connection = new mysqli($DatabaseServer, $DatabaseUsername, $DatabasePassword, $DatabaseName, $DatabasePort); ...
CWE-22
2
public function validateByMode(App\Request $request) { if ($request->isEmpty('purifyMode') || !$request->has('value')) { throw new \App\Exceptions\NoPermitted('ERR_ILLEGAL_VALUE', 406); } $response = new Vtiger_Response(); $response->setResult([ 'raw' => $request->getByType('value', $request->getByType(...
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 function getQuerySelect() { // SubmittedOn is stored in the artifact return "a.submitted_on AS `" . $this->name . "`"; }
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 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 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-1236
12
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
function showallSubcategories() { // global $db; expHistory::set('viewable', $this->params); // $parent = isset($this->params['cat']) ? $this->params['cat'] : expSession::get('catid'); $catid = expSession::get('catid'); $parent = !empty($catid) ? $catid : (!empty($this->params...
CWE-89
0
public function display_sdm_other_details_meta_box($post) { //Other details metabox $file_size = get_post_meta($post->ID, 'sdm_item_file_size', true); $file_size = isset($file_size) ? $file_size : ''; $version = get_post_meta($post->ID, 'sdm_item_version', true); $version = isset($version) ? $version : ''; e...
CWE-79
1
protected function getSubtask() { $subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id')); if (empty($subtask)) { throw new PageNotFoundException(); } return $subtask; }
CWE-639
9
public function take($value) { return $this->limit($value); }
CWE-22
2
public function getQueryOrderby() { return $this->name; }
CWE-89
0
public function getHeader($header) { $name = strtolower($header); return isset($this->headers[$name]) ? $this->headers[$name] : []; }
CWE-89
0
function get_allowed_mime_types( $user = null ) { $t = wp_get_mime_types(); unset( $t['swf'], $t['exe'] ); if ( function_exists( 'current_user_can' ) ) $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' ); if ( empty( $unfiltered ) ) unset( $t['htm|html'] ); /**...
CWE-79
1
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
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 function getQuerySelect() { return "a.id AS `" . $this->name . "`"; }
CWE-89
0
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_orders WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; ...
CWE-89
0
protected function _stat($path) { static $statOwner; if (is_null($statOwner)) { $statOwner = (!empty($this->options['statOwner'])); } $stat = array(); if (!file_exists($path) && !is_link($path)) { return $stat; } //Verifies the given path is the root or is inside the root. Prevents director...
CWE-89
0
public function save_change_password() { global $user; $isuser = ($this->params['uid'] == $user->id) ? 1 : 0; if (!$user->isAdmin() && !$isuser) { flash('error', gt('You do not have permissions to change this users password.')); expHistory::back(); } ...
CWE-89
0
public static function isActive($mod){ $json = Options::v('modules'); $mods = json_decode($json, true); //print_r($mods); if (!is_array($mods) || $mods == "") { $mods = array(); } if(in_array($mod, $mods)){ return true; }else...
CWE-89
0
$item = array(); $item['id'] = $incident->id; $item['title'] = $incident->incident_title; $item['link'] = $site_url.'reports/view/'.$incident->id; $item['description'] = $incident->incident_description; $item['date'] = $incident->incident_date; $item['categories'] = $categories; if ...
CWE-79
1
function init_args() { $_REQUEST = strings_stripSlashes($_REQUEST); $args = new stdClass(); $args->user_id = $_SESSION['userID']; $args->tproject_id = $_SESSION['testprojectID']; $args->tproject_name = $_SESSION['testprojectName']; $args->tplan_id = isset($_REQUEST['tplan_id']) ? $_REQUES...
CWE-89
0
function testMissingExtensionFatal() { $ext = 'php_ext'; $warn = 'The <a href="' . PMA_getPHPDocLink('book.' . $ext . '.php') . '" target="Documentation"><em>' . $ext . '</em></a> extension is missing. Please check your PHP configuration.'; $this->expectOutputReg...
CWE-94
14
public static function userid($id){ $usr = Db::result( sprintf("SELECT * FROM `user` WHERE `id` = '%d' LIMIT 1", Typo::int($id) ) ); return $usr[0]->userid; }
CWE-89
0
private function curl($url){ $ca = curl_init(); curl_setopt($ca, CURLOPT_URL, $url); curl_setopt($ca, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ca, CURLOPT_HEADER, FALSE); curl_setopt($ca, CURLOPT_HTTPHEADER, array("Accept: application/json")); $response = cur...
CWE-89
0
function insertCommandCategorieInDB(){ global $pearDB; if (testCommandCategorieExistence($_POST["category_name"])){ $DBRESULT = $pearDB->query("INSERT INTO `command_categories` (`category_name` , `category_alias`, `category_order`) VALUES ('".$_POST["category_name"]."', '".$_POST["category_alias"]."', '1')")...
CWE-89
0
public static function data($vars){ $file = GX_MOD.'/'.$vars.'/index.php'; $handle = fopen($file, 'r'); $data = fread($handle, filesize($file)); fclose($handle); preg_match('/\* Name: (.*)\n\*/U', $data, $matches); $d['name'] = $matches[1]; preg_match('...
CWE-89
0
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
CWE-22
2
static function activate($uid, $karmalevel = 'pear.dev') { require_once 'Damblan/Karma.php'; global $dbh, $auth_user; $karma = new Damblan_Karma($dbh); $user = user::info($uid, null, 0); if (!isset($user['registered'])) { return false; } @$a...
CWE-502
15
function edit_internalalias() { $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 ...
CWE-89
0
public function request($method, $uri = null, array $options = []) { $options[RequestOptions::SYNCHRONOUS] = true; return $this->requestAsync($method, $uri, $options)->wait(); }
CWE-89
0
Session::set(array('lang' => $lang ) ); }
CWE-89
0
public static function getParent($id=''){ return Categories::getParent($id); }
CWE-89
0
public function fixsessions() { global $db; // $test = $db->sql('CHECK TABLE '.$db->prefix.'sessionticket'); $fix = $db->sql('REPAIR TABLE '.$db->prefix.'sessionticket'); flash('message', gt('Sessions Table was Repaired')); expHistory::back(); }
CWE-89
0
public static function autoload() { include (GX_LIB."Vendor/autoload.php"); }
CWE-89
0
public static function getFolder() { $uri = explode('/', Site::$url); if(count($uri) > 3) { unset($uri[0]); unset($uri[1]); unset($uri[2]); $uri = array_values($uri); $uris = ""; for($i=0; $i<count($uri); $i++){ ...
CWE-89
0
public static function loadElementPaths($type, $object_id, $website_id=null) { global $DB; global $website; if(empty($website_id)) $website_id = $website->id; $ok = $DB->query(' SELECT * FROM nv_paths WHERE type = '.protect($type).' AND object_id = '.protect($object_id).' ...
CWE-89
0
function db_seq_nextval($seqname) { global $DatabaseType; if ($DatabaseType == 'mysqli') $seq = "fn_" . strtolower($seqname) . "()"; return $seq; }
CWE-79
1
public static function ca() { if (is_null(self::$ca)) new CertificateAuthenticate(); return self::$ca; }
CWE-502
15
public function addUser(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $username = I("post.username"); $password = I("post.password"); $uid = I("post.uid"); $name = I("post.name"); if(!$username){ $this->sendError(10101,'用户名不允许为空'); ...
CWE-89
0
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, // EN...
CWE-89
0
$files[$key]->save(); } // eDebug($files,true); }
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
function get_show_item ($directory, $file) { if ( preg_match( "/\.\./", $directory ) ) return false; if ( isset($file) && preg_match( "/\.\./", $file ) ) return false; // dont display own directory if ( $file == "." ) return false; if ( substr( $file, 0, 1) == "." && $GLOB...
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
public function getFlashCookieObject($name) { if (isset($_COOKIE[$name])) { $object = json_decode($_COOKIE[$name], false); setcookie($name, '', time() - 3600, '/'); return $object; } return null; }
CWE-565
17
$pageView = $this->get($page->getUrl()); $pageView->assertStatus(200); $pageView->assertElementNotContains('.page-content', '<a id="xss">'); $pageView->assertElementNotContains('.page-content', 'href=javascript:'); }
CWE-79
1
public function limit($value) { if ($value >= 0) { $this->limit = $value; } return $this; }
CWE-22
2
public function changeTableInfoAction() { $field = $_REQUEST['field']; if ($field == 'pma_null') { $this->response->addJSON('field_type', ''); $this->response->addJSON('field_collation', ''); $this->response->addJSON('field_operators', ''); $this->...
CWE-79
1
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) { (file_exists($dir...
CWE-89
0
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); }
CWE-89
0
function connect() { return $this->connectToServer($this->fields['host'], $this->fields['port'], $this->fields['rootdn'], Toolbox::decrypt($this->fields['rootdn_passwd'], GLPIKEY), $this->fields['use_tl...
CWE-798
18
public function setContainer($container) { $this->container = $container; $container->setType('ctArticles'); }
CWE-79
1
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 __construct() { $this->options['alias'] = ''; // alias to replace root dir name $this->options['dirMode'] = 0755; // new dirs mode $this->options['fileMode'] = 0644; // new files mode $this->options['quarantine'] = '.quarantine';...
CWE-78
6
function functions_list() { $navibars = new navibars(); $navitable = new navitable("functions_list"); $navibars->title(t(244, 'Menus')); $navibars->add_actions( array( '<a href="?fid='.$_REQUEST['fid'].'&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> '.t(38, 'Create').'...
CWE-79
1
public function offset($value) { $this->offset = max(0, $value); return $this; }
CWE-79
1
public function setLoggerChannel($channel = 'Organizr', $username = null) { if ($this->hasDB()) { $setLogger = false; if ($username) { $username = htmlspecialchars($username); } if ($this->logger) { if ($channel) { if (strtolower($this->logger->getChannel()) !== strtolower($channel)) { ...
CWE-79
1
$newret = recyclebin::restoreFromRecycleBin($iLoc, $page_id); if (!empty($newret)) $ret .= $newret . '<br>'; if ($iLoc->mod == 'container') { $ret .= scan_container($container->internal, $page_id); } } retu...
CWE-89
0
function productFeed() { // global $db; //check query password to avoid DDOS /* * condition = new * description * id - SKU * link * price * title * brand - manufacturer ...
CWE-89
0
private function getMergeSql() { switch ($this->driver) { case 'mysql': return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ". "ON DUPLICATE KEY UPDATE $this->dataCol = V...
CWE-89
0
public static function getHelpVersion($version_id) { global $db; return $db->selectValue('help_version', 'version', 'id="'.$version_id.'"'); }
CWE-89
0
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
public static function options($var) { $file = GX_MOD.$var.'/options.php'; if(file_exists($file)){ include ($file); } }
CWE-89
0
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 constructo...
CWE-89
0
function __construct() { # code... self::$smtphost = Options::get('smtphost'); self::$smtpuser = Options::get('smtpuser'); self::$smtppass = Options::get('smtppass'); self::$smtpssl = Options::get('smtpssl'); self::$siteemail = Options::get('siteema...
CWE-89
0
public function execute(&$params){ $options = &$this->config['options']; $notif = new Notification; $notif->user = $this->parseOption('user', $params); $notif->createdBy = 'API'; $notif->createDate = time(); // file_put_contents('triggerLog.txt',"\n".$notif->user,FILE...
CWE-79
1
public function get_view_config() { global $template; // set paths we will search in for the view $paths = array( BASE.'themes/'.DISPLAY_THEME.'/modules/common/views/file/configure', BASE.'framework/modules/common/views/file/configure', ); fo...
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 Hello($host = '') { $this->error = null; // so no confusion is caused if(!$this->connected()) { $this->error = array( "error" => "Called Hello() without being connected"); return false; } // if hostname for HELO was not specified send default if(empty($hos...
CWE-79
1
protected function _chmod($path, $mode) { $modeOct = is_string($mode) ? octdec($mode) : octdec(sprintf("%04o",$mode)); $ret = @chmod($path, $modeOct); $ret && clearstatcache(); return $ret; }
CWE-89
0
protected function getCheckFileQuery() { global $zdb; $select = $zdb->select(self::TABLE); $select->columns( array( 'picture', 'format' ) ); $select->where(self::PK . ' = ' . $this->db_id); return $select; ...
CWE-89
0
$count += $db->dropTable($basename); } flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.'); expHistory::back(); }
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
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name); if (!$view) { // unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child $attr = new stdClass(); $attr->class = 'hidde...
CWE-89
0
public function show() { $task = $this->getTask(); $subtask = $this->getSubtask(); $this->response->html($this->template->render('subtask_restriction/show', array( 'status_list' => array( SubtaskModel::STATUS_TODO => t('Todo'), SubtaskModel::S...
CWE-639
9
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
static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = []) { global $CFG_GLPI; $rand = mt_rand(); $field_id = Html::cleanId("dropdown_".$myname.$rand); $param = [ 'entity_restrict' => ...
CWE-639
9
public function setObjectSrc(Response $response) { if (config('app.allow_content_scripts')) { return; } $response->headers->set('Content-Security-Policy', 'object-src \'self\'', false); }
CWE-79
1
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
function fix_serialized_columns() { global $smcFunc; $request = $smcFunc['db_query']('', ' SELECT id_action, extra FROM {db_prefix}log_actions WHERE action IN ({string:remove}, {string:delete})', array( 'remove' => 'remove', 'delete' => 'delete', ) ); while ($row = $smcFunc['db_fetch_assoc']($reque...
CWE-94
14
$pos = strpos($line, $match); if ($pos !== false) { $var = getvarname(strtok($field, '#')); if ($var != '[]') eval('$r' . $var . '=$block;'); } } } return $r; }
CWE-94
14
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 getName($translated = true) { if ($translated === true) { return _T($this->name); } else { return $this->name; } }
CWE-79
1
public function testCanSetHeaderAsArray() { $r = new Response(200, [ 'foo' => ['baz ', ' bar '] ]); $this->assertEquals('baz, bar', $r->getHeaderLine('foo')); $this->assertEquals(['baz', 'bar'], $r->getHeader('foo')); }
CWE-89
0
function searchName() { return gt('Webpage'); }
CWE-89
0
public static function remove($var) { unset($_SESSION['gxsess']['val'][$var]); }
CWE-89
0
public static function types_update($array) { global $DB; global $website; $array = array_filter($array); sort($array); $array = serialize($array); $ok = $DB->execute(' UPDATE nv_websites SET block_types = '.protect($array).' WHERE id = '.$website->...
CWE-89
0
public static function load_element_strings($node_type, $node_id, $savedOn="latest") { global $DB; // load all webdictionary history elements and keep only the latest $DB->query(' SELECT subtype, lang, text FROM nv_webdictionary_history WHERE node_type = '.protect($node_type).' AND...
CWE-89
0
foreach ($days as $event) { if (empty($event->eventdate->date) || ($viewrange == 'upcoming' && $event->eventdate->date < time())) break; if (empty($event->eventstart)) $eve...
CWE-89
0
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
CWE-89
0