code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
$category_query = "select id from ".prefix_table("nested_tree")." where title LIKE '".$array_category[0]."' AND parent_id = 0"; } else { rest_error('NO_CATEGORY'); } // Delete item $response = DB::delete(prefix_tabl...
CWE-434
5
public function createComment($id, $source = "leaves/leaves"){ $this->auth->checkIfOperationIsAllowed('view_leaves'); $data = getUserContext($this); $oldComment = $this->leaves_model->getCommentsLeave($id); $newComment = new stdClass; $newComment->type = "comment"; $newComment->a...
CWE-79
1
public function getInt($key, $default = 0, $deep = false) { return (int) $this->get($key, $default, $deep); }
CWE-89
0
} elseif (!empty($this->params['src'])) { if ($this->params['src'] == $loc->src) { $this->config = $config->config; break; } } }
CWE-89
0
public function actionGetItems(){ $sql = 'SELECT id, name as value FROM x2_docs 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 = $command->queryAll(); echo CJSON::encod...
CWE-79
1
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
function edit_option_master() { expHistory::set('editable', $this->params); $params = isset($this->params['id']) ? $this->params['id'] : $this->params; $record = new option_master($params); assign_to_template(array( 'record'=>$record )); }
CWE-89
0
function build_daterange_sql($timestamp, $endtimestamp=null, $field='date', $multiday=false) { if (empty($endtimestamp)) { $date_sql = "((".$field." >= " . expDateTime::startOfDayTimestamp($timestamp) . " AND ".$field." <= " . expDateTime::endOfDayTimestamp($timestamp) . ")"; } else {...
CWE-89
0
function mso_segment_array() { $CI = &get_instance(); if (isset($_SERVER['REQUEST_URI']) and $_SERVER['REQUEST_URI']) { // http://localhost/page/privet?get=hello $url = getinfo('site_protocol'); $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $url = str_replace($CI->config->config['base_url'...
CWE-79
1
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
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 create(Codendi_Request $request) { $content_id = false; $vId = new Valid_UInt($this->widget_id . '_job_id'); $vId->setErrorMessage("Can't add empty job id"); $vId->required(); if ($request->valid($vId)) { $job_id = $request->get($this->widget_i...
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); $res = $results->current(); $this->id = $id; $this->...
CWE-89
0
public function testCanGiveCustomProtocolVersion() { $r = new Response(200, [], null, '1000'); $this->assertEquals('1000', $r->getProtocolVersion()); }
CWE-89
0
protected function _filePutContents($path, $content) { $res = false; if ($local = $this->getTempFile($path)) { if (@file_put_contents($local, $content, LOCK_EX) !== false && ($fp = @fopen($local, 'rb'))) { clearstatcache(); $res = $this->_save($fp, $path, '', array()); @fclose($fp); } file...
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 function update() { global $DB; $ok = $DB->execute(' UPDATE nv_menus SET codename = :codename, icon = :icon, lid = :lid, notes = :notes, functions = :functions, enabled = :enabled WHERE id = :id', array( 'id' => $this->id, 'codename' => value_or...
CWE-79
1
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
CWE-639
9
function delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->par...
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 configure() { parent::configure(); if (!empty($this->options['tmpPath'])) { if ((is_dir($this->options['tmpPath']) || @mkdir($this->options['tmpPath'], 0755, true)) && is_writable($this->options['tmpPath'])) { $this->tmp = $this->options['tmpPath']; } } if (!$this->tmp && ($tmp ...
CWE-89
0
public static function access ($grp='4') { if ( isset($_SESSION['gxsess']['val']['group']) ) { if($_SESSION['gxsess']['val']['group'] <= $grp) { return true; }else{ return false; } } }
CWE-89
0
$input = ['name' => 'ldap', 'rootdn_passwd' => $password]; $result = $ldap->prepareInputForUpdate($input); //Expected value to be encrypted using GLPIKEY key $expected = \Toolbox::encrypt(stripslashes($password), GLPIKEY); $this->string($result['rootdn_passwd'])->isIdenticalTo($expec...
CWE-798
18
public function limit($value) { if ($value >= 0) { $this->limit = $value; } return $this; }
CWE-79
1
foreach ($events as $event) { $extevents[$date][] = $event; }
CWE-89
0
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
CWE-89
0
public static function getItems($term) { $model = X2Model::model(Yii::app()->controller->modelClass); if (isset($model)) { $tableName = $model->tableName(); $sql = 'SELECT id, name as value FROM ' . $tableName . ' WHERE name LIKE :qterm ORDER BY name ASC'; ...
CWE-79
1
}elseif($vars['paging'] < $limit || $vars['paging'] = $limit ){ $prev = ($vars['paging'])-1; if($smart == true){ $url = $vars['url']."/paging/".$prev; }else{ $url = $vars['url']."&paging=".$prev...
CWE-89
0
private function validateCodeInjection() { $shortMimeType = $this->getShortMimeType(0); if ($this->validateAllCodeInjection || \in_array($shortMimeType, static::$phpInjection)) { $contents = $this->getContents(); if ((1 === preg_match('/(<\?php?(.*?))/si', $contents) || false !== stripos($contents, '<?='...
CWE-79
1
function set_menu_tabs() { $this->menu_tabs = array( 'tab1' => __('Ban Users', 'all-in-one-wp-security-and-firewall'), ); }
CWE-79
1
function checkRights(&$db,&$user) { return $user->hasRight($db,'testplan_metrics'); }
CWE-89
0
$this->archiveSize += filesize($p); } } } else {
CWE-89
0
foreach($functions as $function) { if($function->id == $f) { if($function->enabled=='1') $sortable_assigned[] = '<li class="ui-state-highlight" value="'.$function->id.'" category="'.$function->category.'"><img src="'.NAVIGATE_URL.'/'.$function->icon.'" align="absmiddle" /> '.t($function->lid, ...
CWE-79
1
public function sdm_save_thumbnail_meta_data($post_id) { // Save Thumbnail Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (!isset($_POST['sdm_thumbnail_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_thumbnail_box_nonce_check'], 'sdm_thumbnail_box_nonce')) return; if (i...
CWE-79
1
public function updateAmazonOrderTracking($order_id, $courier_id, $courier_from_list, $tracking_no) { $this->db->query(" UPDATE `" . DB_PREFIX . "amazon_order` SET `courier_id` = '" . $courier_id . "', `courier_other` = " . (int)!$courier_from_list . ", `tracking_no` = '" . $tracking_no . "' WHERE `...
CWE-89
0
public function saveLdapConfig(){ $login_user = $this->checkLogin(); $this->checkAdmin(); $ldap_open = intval(I("ldap_open")) ; $ldap_form = I("ldap_form") ; if ($ldap_open) { if (!$ldap_form['user_field']) { $ldap_form['user_field'] = 'cn...
CWE-338
21
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
function __construct() { }
CWE-89
0
public static function account_verification($email, $hash) { global $DB; $status = false; if(strpos($hash, "-") > 0) { list($foo, $expiry) = explode("-", $hash); if(time() > $expiry) { // expired unconfirmed account! ...
CWE-89
0
public function getDisplayName ($plural=true) { return Yii::t('users', '{user}', array( '{user}' => Modules::displayName($plural, 'Users'), )); }
CWE-79
1
$expanded = implode($joiner, $kvp); if ($isAssoc) { // Don't prepend the value name when using the explode // modifier with an associative array. $actuallyUseQuery = false; } ...
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
public function getQueryGroupby() { //Last update date is stored in the changeset (the date of the changeset) return 'c.submitted_on'; }
CWE-89
0
public function uploadImage() { $filesCheck = array_filter($_FILES); if (!empty($filesCheck) && $this->approvedFileExtension($_FILES['file']['name'], 'image') && strpos($_FILES['file']['type'], 'image/') !== false) { ini_set('upload_max_filesize', '10M'); ini_set('post_max_size', '10M'); $tempFile = $_FI...
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
public function quicksearch($text) { global $DB; global $website; $like = ' LIKE '.protect('%'.$text.'%'); // we search for the IDs at the dictionary NOW (to avoid inefficient requests) $DB->query('SELECT DISTINCT (nvw.node_id) FROM nv_webdictionary nvw WHERE nvw.node_type = ...
CWE-79
1
protected function info($args) { $files = array(); $sleep = 0; $compare = null; // long polling mode if ($args['compare'] && count($args['targets']) === 1) { $compare = intval($args['compare']); $hash = $args['targets'][0]; if ($volume = $this->volume($hash)) { $standby = (int)$volume->getOption...
CWE-89
0
foreach ($grpusers as $u) { $emails[$u->email] = trim(user::getUserAttribution($u->id)); }
CWE-89
0
static function displayname() { return gt("Navigation"); }
CWE-89
0
public static function recent($vars, $type = 'post') { $sql = "SELECT * FROM `posts` WHERE `type` = '{$type}' ORDER BY `date` DESC LIMIT {$vars}"; $posts = Db::result($sql); if(isset($posts['error'])){ $posts['error'] = "No Posts found."; }else{ $posts = $post...
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 static function DragnDropReRank2() { global $router, $db; $id = $router->params['id']; $page = new section($id); $old_rank = $page->rank; $old_parent = $page->parent; $new_rank = $router->params['position'] + 1; // rank $new_parent = intval($r...
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 function testNoAuthority($input) { $uri = new Uri($input); $this->assertEquals($input, (string) $uri); }
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
$layout[$loc] = array_merge($layout[$loc],$data); } } } return $layout; }
CWE-79
1
public function checkLdapLogin($username ,$password ){ $ldap_open = D("Options")->get("ldap_open" ) ; $ldap_form = D("Options")->get("ldap_form" ) ; $ldap_form = json_decode($ldap_form,1); if (!$ldap_open) { return false; } if (...
CWE-338
21
function delete_recurring() { $item = $this->event->find('first', 'id=' . $this->params['id']); if ($item->is_recurring == 1) { // need to give user options expHistory::set('editable', $this->params); assign_to_template(array( 'checked_date' => $this->par...
CWE-89
0
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully...
CWE-639
9
public function delete() { global $db; /* 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']) ? COMMENTS_REQUIRE_LO...
CWE-89
0
function searchCategory() { return gt('Event'); }
CWE-89
0
public static function pending_count() { global $DB; global $website; $pending_comments = $DB->query_single( 'COUNT(*)', 'nv_comments', ' website = '.protect($website->id).' AND status = -1' ); return $pendin...
CWE-89
0
protected function _fclose($fp, $path='') { @fclose($fp); if ($path) { @unlink($this->getTempFile($path)); } }
CWE-89
0
function manage() { global $db; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { ...
CWE-89
0
function load_gallery($auc_id) { $UPLOADED_PICTURES = array(); if (is_dir(UPLOAD_PATH . $auc_id)) { if ($dir = opendir(UPLOAD_PATH . $auc_id)) { while ($file = @readdir($dir)) { if ($file != '.' && $file != '..' && strpos($file, 'thumb-') === false) { $UPL...
CWE-89
0
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 static function dropdown($vars){ if(is_array($vars)){ //print_r($vars); $name = $vars['name']; $where = "WHERE `status` = '1' AND "; if(isset($vars['type'])) { $where .= " `type` = '{$vars['type']}' AND "; }else{ ...
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 update() { global $DB; global $events; if(!is_array($this->categories)) $this->categories = array(); $ok = $DB->execute(' UPDATE nv_feeds SET categories = :categories, format = :format, image = :image, entries = :entries, content = :content, views = :views...
CWE-79
1
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully...
CWE-639
9
private function runCallback() { foreach ($this->records as &$record) { if (isset($record->ref_type)) { $refType = $record->ref_type; if (class_exists($record->ref_type)) { $type = new $refType(); $classinfo = new Reflection...
CWE-89
0
public function sdm_save_upload_meta_data($post_id) { // Save File Upload metabox if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return; if (!isset($_POST['sdm_upload_box_nonce_check']) || !wp_verify_nonce($_POST['sdm_upload_box_nonce_check'], 'sdm_upload_box_nonce')) return; if (isset($_POST['sdm_...
CWE-79
1
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-22
2
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
foreach ($allgroups as $gid) { $g = group::getGroupById($gid); expPermissions::grantGroup($g, 'manage', $sloc); }
CWE-89
0
foreach ($week as $dayNum => $day) { if ($dayNum == $now['mday']) { $currentweek = $weekNum; } if ($dayNum <= $endofmonth) { // $monthly[$weekNum][$dayNum]['number'] = ...
CWE-89
0
self::removeLevel($kid->id); } }
CWE-89
0
protected function _archive($dir, $files, $name, $arc) { // get current directory $cwd = getcwd(); $tmpDir = $this->tempDir(); if (!$tmpDir) { return false; } //download data if (!$this->ftp_download_files($dir, $files, $tmpDir)) { //cleanup $this->rmdirRecursive($tmpDir); return false; ...
CWE-89
0
function move_standalone() { expSession::clearAllUsersSessionCache('navigation'); assign_to_template(array( 'parent' => $this->params['parent'], )); }
CWE-89
0
function categoryBreadcrumb() { // global $db, $router; //eDebug($this->category); /*if(isset($router->params['action'])) { $ancestors = $this->category->pathToNode(); }else if(isset($router->params['section'])) { $current = $db->select...
CWE-89
0
protected function removeNetVolume($key) { $netVolumes = $this->getNetVolumes(); if (is_string($key) && isset($netVolumes[$key])) { unset($netVolumes[$key]); $this->saveNetVolumes($netVolumes); } }
CWE-89
0
public static function get_session($vars) { }
CWE-89
0
public static function header($vars=""){ header("Cache-Control: must-revalidate,max-age=300,s-maxage=900"); $offset = 60 * 60 * 24 * 3; $ExpStr = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT"; header($ExpStr); header("Content-Type: text/html; charset=...
CWE-89
0
public function enable() { $this->checkCSRFParam(); $project = $this->getProject(); $swimlane_id = $this->request->getIntegerParam('swimlane_id'); if ($this->swimlaneModel->enable($project['id'], $swimlane_id)) { $this->flash->success(t('Swimlane updated successfully...
CWE-639
9
public static function initializeNavigation() { $sections = section::levelTemplate(0, 0); return $sections; }
CWE-89
0
function _makeChooseCheckbox($value, $title) { // return '<INPUT type=checkbox name=st_arr[] value=' . $value . ' checked>'; global $THIS_RET; return "<input name=unused[$THIS_RET[STUDENT_ID]] value=" . $THIS_RET[STUDENT_ID] . " type='checkbox' id=$THIS_RET[STUDENT_ID] onClick='setHiddenCheckboxStudents...
CWE-89
0
protected function connect() { if ($this->connection and $this->connection->isValid()) { return; } $command = sprintf('%s --authentication-file=/proc/self/fd/3 //%s/%s', Server::CLIENT, $this->server->getHost(), $this->name ); $this->connection = new Connection($command); $this->connection->wri...
CWE-78
6
unset($map[$n], $n, $d); } unset($map); if(!self::$client) { self::$client = false; } } }
CWE-502
15
public function display_sdm_stats_meta_box($post) { //Stats metabox $old_count = get_post_meta($post->ID, 'sdm_count_offset', true); $value = isset($old_count) && $old_count != '' ? $old_count : '0'; // Get checkbox for "disable download logging" $no_logs = get_post_meta($post->ID, 'sdm_item_no_log', true); ...
CWE-79
1
printf('<p>%s<br><strong>%s</strong> %s</p>',$row->post_title,$row->meta_key,$row->meta_value); } }
CWE-89
0
public function confirm() { $project = $this->getProject(); $swimlane = $this->getSwimlane(); $this->response->html($this->helper->layout->project('swimlane/remove', array( 'project' => $project, 'swimlane' => $swimlane, ))); }
CWE-639
9
function update_optiongroup_master() { global $db; $id = empty($this->params['id']) ? null : $this->params['id']; $og = new optiongroup_master($id); $oldtitle = $og->title; $og->update($this->params); // if the title of the master changed we should update th...
CWE-89
0
function manage() { global $db; expHistory::set('manageable', $this->params); // $classes = array(); $dir = BASE."framework/modules/ecommerce/billingcalculators"; if (is_readable($dir)) { $dh = opendir($dir); while (($file = readdir($dh)) !== false) { ...
CWE-89
0
public function getQueryOrderby() { return $this->getBind()->getQueryOrderby(); }
CWE-89
0
function _makeExtra($value, $title = '') { global $THIS_RET; if ($THIS_RET['WITH_TEACHER_ID']) $return .= ''._with.':&nbsp;' . GetTeacher($THIS_RET['WITH_TEACHER_ID']) . '<BR>'; if ($THIS_RET['NOT_TEACHER_ID']) $return .= ''._notWith.':&nbsp;' . GetTeacher($THIS_RET['NOT_TEACHER_ID']) . '<B...
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
public function getQuerySelect() { return $this->getBind()->getQuerySelect(); }
CWE-89
0
protected function unserialize(string $data) { if (is_numeric($data)) { return $data; } $unserialize = $this->options['serialize'][1] ?? "unserialize"; return $unserialize($data); }
CWE-502
15
$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-79
1
public function isAllowedFilename($filename){ $allow_array = array( '.jpg','.jpeg','.png','.bmp','.gif','.ico','.webp', '.mp3','.wav','.m4a','.ogg','.webma','.mp4','.flv', '.mov','.webmv','.flac','.mkv', '.zip','.tar','.gz','.tgz','.ipa','.apk','.rar','.iso','.bz2','.epub', '.pdf','.ofd','.swf','.epub...
CWE-79
1