code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
protected function getFooService() { return $this->services['Bar\Foo'] = new \Bar\Foo(); }
CWE-89
0
public function withFragment($fragment) { if (substr($fragment, 0, 1) === '#') { $fragment = substr($fragment, 1); } $fragment = $this->filterQueryAndFragment($fragment); if ($this->fragment === $fragment) { return $this; } $new = clone ...
CWE-89
0
public function search($q, $page=''){ $q = str_replace(' ', '+', trim($q)); if(isset($page) && $page !=''){ $page = "&page=".$page; }else{ $page = ""; } $url = "http://api.themoviedb.org/3/search/movie?query=".$q."&api_key=".$this->apikey.$page;...
CWE-89
0
public function testGetConfigWithBrokenSystem() { $slideshow = true; $exceptionMessage = 'Aïe!'; $this->configService->expects($this->any()) ->method('getFeaturesList') ->willThrowException(new ServiceException($exceptionMessage)); // Default status code when something breaks $status = Http::ST...
CWE-79
1
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 __invoke(Request $request, Expense $expense) { $this->authorize('update', $expense); $data = json_decode($request->attachment_receipt); if ($data) { if ($request->type === 'edit') { $expense->clearMediaCollection('receipts'); } ...
CWE-79
1
static function isSearchable() { return true; }
CWE-89
0
function lockTable($table,$lockType="WRITE") { $sql = "LOCK TABLES `" . $this->prefix . "$table` $lockType"; $res = mysqli_query($this->connection, $sql); return $res; }
CWE-89
0
function import() { $pullable_modules = expModules::listInstalledControllers($this->baseclassname); $modules = new expPaginator(array( 'records' => $pullable_modules, 'controller' => $this->loc->mod, 'action' => $this->params['action'], 'order' ...
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 editAlt() { global $user; $file = new expFile($this->params['id']); if ($user->id==$file->poster || $user->isAdmin()) { $file->alt = $this->params['newValue']; $file->save(); $ar = new expAjaxReply(200, gt('Your alt was updated succ...
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
public function onInfoAction( $context, &$pageInfo ) { $shortdesc = HookUtils::getShortDescription( $context->getTitle() ); if ( !$shortdesc ) { // The page has no short description return; } $pageInfo['header-basic'][] = [ $context->msg( 'shortdescription-info-label' ), $shortdesc ]; }
CWE-79
1
$module_views[$key]['name'] = gt($value['name']); } // look for a config form for this module's current view // $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod); //check to see if hcview was passed along, indicating a hard-coded module // if (!empty($contr...
CWE-89
0
$this->subtaskTimeTrackingModel->logEndTime($subtaskId, $this->userSession->getId()); $this->subtaskTimeTrackingModel->updateTaskTimeTracking($task['id']); }
CWE-639
9
public function getMailingDetails($id) { trigger_error(sprintf('%s:%s is deprecated since Shopware 5.6 and will be private with 5.8.', __CLASS__, __METHOD__), E_USER_DEPRECATED); $details = Shopware()->Modules()->Marketing()->sMailCampaignsGetDetail((int) $id); foreach ($details['conta...
CWE-79
1
public function showall_tags() { $images = $this->image->find('all'); $used_tags = array(); foreach ($images as $image) { foreach($image->expTag as $tag) { if (isset($used_tags[$tag->id])) { $used_tags[$tag->id]->count++; } else...
CWE-89
0
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
function searchName() { return gt("Calendar Event"); }
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
public function testInvalidRequests($requestRange) { $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, array('Content-Type' => 'application/octet-stream'))->setAutoEtag(); // prepare a request for a range of the testing file $request = Request::create('/'); ...
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 pathTestNoAuthority() { return [ // path-rootless ['urn:example:animal:ferret:nose'], // path-absolute ['urn:/example:animal:ferret:nose'], ['urn:/'], // path-empty ['urn:'], ['urn'], ...
CWE-89
0
function manage() { global $db, $router, $user; expHistory::set('manageable', $router->params); assign_to_template(array( 'canManageStandalones' => self::canManageStandalones(), 'sasections' => $db->selectObjects('section', 'parent=-1'), ...
CWE-89
0
$variable[$key] = self::filter($val); } } else { // Prevent XSS abuse $variable = preg_replace_callback('#</?([a-z]+)(\s.*)?/?>#i', function($matches) { $tag = strtolower($matches[1]); // Allowed tags if (in_array($tag, array( 'b', 'strong', 'small', 'i', 'em', 'u', 's', 'sub', 'sup', '...
CWE-79
1
public function getHeaders() { return $this->headerLines; }
CWE-89
0
public function getAmount() { $amount = $this->getParameter('amount'); if ($amount !== null) { // Don't allow integers for currencies that support decimals. // This is for legacy reasons - upgrades from v0.9 if ($this->getCurrencyDecimalPlaces() > 0) { ...
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
public static function exist($mod) { $file = GX_MOD."/".$mod."/options.php"; if(file_exists($file)){ return true; }else{ return false; } }
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
public function getBranches() { if (null === $this->branches) { $branches = array(); $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir); foreach ($this->process->splitLines($output) as $branch) { if ($branch && !P...
CWE-94
14
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 static function set($vars) { self::set_session($vars); }
CWE-89
0
public static function is_exist($user) { if(isset($_GET['act']) && $_GET['act'] == 'edit'){ $id = Typo::int($_GET['id']); $where = "AND `id` != '{$id}' "; }else{ $where = ''; } $user = sprintf('%s', Typo::cleanX($user)); $sql = sp...
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
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
protected function moveVotes() { $sql = "SELECT * FROM package_proposal_votes WHERE pkg_prop_id = {$this->proposal}"; $res = $this->mdb2->query($sql); if (MDB2::isError($res)) { throw new RuntimeException("DB error occurred: {$res->getDebugInfo()}"); } if ($re...
CWE-640
20
foreach($course_RET as $period_date) { // $period_days_append_sql .="(sp.start_time<='$period_date[END_TIME]' AND '$period_date[START_TIME]'<=sp.end_time AND IF(course_period_date IS NULL, course_period_date='$period_date[COURSE_PERIOD_DATE]',DAYS LIKE '%$period_date[DAYS]%')) OR "; ...
CWE-79
1
public function GetJsForUpdateFields() { $sWizardHelperJsVar = (!is_null($this->m_aData['m_sWizHelperJsVarName'])) ? utils::Sanitize($this->m_aData['m_sWizHelperJsVarName'], utils::ENUM_SANITIZATION_FILTER_PARAMETER) : 'oWizardHelper'.$this->GetFormPrefix(); //str_replace(['(', ')', ';'], '', $this->m_aData['m_sW...
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
public static function thmMenu(){ $thm = Options::v('themes'); //$mod = self::modList(); //print_r($mod); $list = ''; # code... $data = self::data($thm); if(isset($_GET['page']) && $_GET['page'] == 'themes' && isset($_GET['view...
CWE-89
0
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 testNoAuthorityWithInvalidPath() { $input = 'urn://example:animal:ferret:nose'; $uri = new Uri($input); }
CWE-89
0
public static function v($vars) { $opt = self::$_data; // echo "<pre>"; foreach ($opt as $k => $v) { // echo $v->name; if ($v->name == $vars) { return $v->value; } } // echo "</pre>"; }
CWE-89
0
$module_views[$key]['name'] = gt($value['name']); } // look for a config form for this module's current view // $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod); //check to see if hcview was passed along, indicating a hard-coded module // if (!empty($contr...
CWE-89
0
public function __construct() { self::$hooks = self::load(); }
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 onUpLoadPreSave(&$path, &$name, $src, $elfinder, $volume) { $opts = $this->opts; $volOpts = $volume->getOptionsPlugin('Watermark'); if (is_array($volOpts)) { $opts = array_merge($this->opts, $volOpts); } if (! $opts['enable']) { return false; } $srcImgInfo = @getimagesize($...
CWE-89
0
public function getQuerySelect() { }
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
foreach ($allusers as $uid) { $u = user::getUserById($uid); expPermissions::grant($u, 'manage', $sloc); }
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 from($dirName) { $this->from = $dirName; return $this; }
CWE-22
2
protected function imagickImage($img, $filename, $destformat, $jpgQuality = null ){ if (!$jpgQuality) { $jpgQuality = $this->options['jpgQuality']; } try { if ($destformat) { if ($destformat === 'gif') { $img->setImageFormat('gif'); } else if ($destformat === 'png') { $img->setImageFo...
CWE-89
0
$emails[$u->email] = trim(user::getUserAttribution($u->id)); }
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 fixupImportedAttributes($modelName, X2Model &$model) { if ($modelName === 'Contacts' || $modelName === 'X2Leads') $this->fixupImportedContactName ($model); if ($modelName === 'Actions' && isset($model->associationType)) $this->reconstructImportedActionAsso...
CWE-79
1
public function approvedFileExtension($filename, $type = 'image') { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($type == 'image') { switch ($ext) { case 'gif': case 'png': case 'jpeg': case 'jpg': case 'svg': return true; default: return false; } } els...
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
$date->delete(); // event automatically deleted if all assoc eventdates are deleted } expHistory::back(); }
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 run() { //print_r(self::$hooks[$var]); $hooks = self::$hooks; $num_args = func_num_args(); $args = func_get_args(); // print_r($args); // if($num_args < 2) // trigger_error("Insufficient arguments", E_USER_ERROR); /...
CWE-89
0
function singleQuoteReplace($param1 = false, $param2 = false, $param3) { return str_replace("'", "''", str_replace("\'", "'", $param3)); }
CWE-22
2
protected function _setContent($path, $fp) { rewind($fp); $fstat = fstat($fp); $size = $fstat['size']; }
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 backup($type='json') { global $DB; global $website; $out = array(); $DB->query('SELECT * FROM nv_webusers WHERE website = '.protect($website->id), 'object'); if($type='json') $out['nv_webusers'] = json_encode($DB->result()); ...
CWE-89
0
public function testCanCreateNewResponseWithStatusAndReason() { $r = new Response(200); $r2 = $r->withStatus(201, 'Foo'); $this->assertEquals(200, $r->getStatusCode()); $this->assertEquals('OK', $r->getReasonPhrase()); $this->assertEquals(201, $r2->getStatusCode()); ...
CWE-89
0
public static function delete($id) { $id = Typo::int($id); try { $vars1 = array( 'table' => 'posts', 'where' => array( 'id' => $id ) ...
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-94
14
function searchName() { return gt("Calendar Event"); }
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
function selectArraysBySql($sql) { $res = @mysqli_query($this->connection, $this->injectProof($sql)); if ($res == null) return array(); $arrays = array(); for ($i = 0, $iMax = mysqli_num_rows($res); $i < $iMax; $i++) $arrays[] = mysqli_fetch_assoc($res...
CWE-89
0
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
$files[$key]->save(); } // eDebug($files,true); }
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
static function validUTF($string) { if(!mb_check_encoding($string, 'UTF-8') OR !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { return false; } return true; }
CWE-89
0
public function update_groupdiscounts() { global $db; if (empty($this->params['id'])) { // look for existing discounts for the same group $existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']); if (!empty($existing_id)) flashAndFlow('er...
CWE-89
0
protected function _unlink($path) { $ret = @unlink($path); $ret && clearstatcache(); return $ret; }
CWE-89
0
$_ret[$_k] = $this->convEnc($_v, $from, $to, '', false, $unknown = '_'); } $var = $_ret; } else { $_var = false; if (is_string($var)) { $_var = $var; if (false !== ($_var = @iconv($from, $to.'//TRANSLIT', $_var))) { $_var = str_replace('?', $unknown, $_var); } } if ...
CWE-89
0
function download_selected($dir) { $dir = get_abs_dir($dir); global $site_name; require_once("_include/fun_archive.php"); $items = qxpage_selected_items(); // check if user selected any items to download switch (count($items)) { case 0: show_error($GLOBALS["error_msg"]["...
CWE-22
2
protected function getItemsInHand($hashes, $dir = null) { static $totalSize = 0; if (is_null($dir)) { $totalSize = 0; if (! $tmpDir = $this->getTempPath()) { return false; } $dir = tempnam($tmpDir, 'elf'); if (!unlink($dir) || !mkdir($dir, 0700, true)) { return false; } register_shutdo...
CWE-89
0
public function backup($type='json') { global $DB; global $website; $DB->query('SELECT * FROM nv_coupons WHERE website = '.protect($website->id), 'object'); $out = $DB->result(); if($type='json') $out = json_encode($out); return $out; ...
CWE-89
0
public function __construct () { }
CWE-89
0
public function __construct(App $app) { $this->Config = $app->Config; $this->Request = $app->Request; $this->Session = $app->Session; }
CWE-307
26
function columnUpdate($table, $col, $val, $where=1) { $res = @mysqli_query($this->connection, "UPDATE `" . $this->prefix . "$table` SET `$col`='" . $val . "' WHERE $where"); /*if ($res == null) return array(); $objects = array(); for ($i = 0; $i < mysqli_num_rows...
CWE-89
0
public function query_single($column, $table, $where = '1=1', $order = '') { $rs = null; if(!empty($order)) $order = ' ORDER BY '.$order; try { $stm = $this->db->query('SELECT ' . $column . ' FROM ' . $table . ' WHERE ' . $where . $order . ' LIMIT 1'); ...
CWE-89
0
public function pathTestProvider() { return [ // Percent encode spaces. ['http://foo.com/baz bar', 'http://foo.com/baz%20bar'], // Don't encoding something that's already encoded. ['http://foo.com/baz%20bar', 'http://foo.com/baz%20bar'], // Per...
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
function prepareInputForUpdate($input) { if (isset($input["passwd"])) { if (empty($input["passwd"])) { unset($input["passwd"]); } else { $input["passwd"] = Toolbox::encrypt(stripslashes($input["passwd"]), GLPIKEY); } } if (isset($input["_blank_pa...
CWE-798
18
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
$output = sprintf( '<form action="%s" method="get">%s (%s): <input type="text" name="amount" value="%s"><br />%s<br /><textarea name="stripenote" cols="80" rows="2"></textarea><br /><input type="hidden" name="txid" value="%s"><button class="stripebutton">%s</button>%s</form>', $url, __( 'Amount', 'rsvpmaker' ), esc_a...
CWE-89
0
$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-79
1
$content = ($vars['excerpt'])? substr( strip_tags( Typo::Xclean($p->content) ), 0, $excerptMax): ""; echo "<li class=\"".$liClass."\"> <h4 class=\"".$h4Class."\"><a href=\"".Url::post($p->id)."\">{...
CWE-89
0
public final function setAction($strAction) { $this->strAction = $strAction; }
CWE-79
1
$module_views[$key]['name'] = gt($value['name']); } // look for a config form for this module's current view // $controller->loc->mod = expModules::getControllerClassName($controller->loc->mod); //check to see if hcview was passed along, indicating a hard-coded module // if (!empty($contr...
CWE-89
0
protected function gdImageCreate($path,$mime){ switch($mime){ case 'image/jpeg': return @imagecreatefromjpeg($path); case 'image/png': return @imagecreatefrompng($path); case 'image/gif': return @imagecreatefromgif($path); case 'image/x-ms-bmp': if (!function_exists('imagecreatefrombmp')) ...
CWE-89
0
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-22
2
public static function desc($vars){ if(!empty($vars)){ $desc = substr(strip_tags(htmlspecialchars_decode($vars).". ".Options::get('sitedesc')),0,150); }else{ $desc = substr(Options::get('sitedesc'),0,150); } return $desc; }
CWE-89
0
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 setGroupBy($groupBy, $qoute = true) { $this->setData(null); if ($groupBy) { $this->groupBy = $groupBy; if ($qoute && strpos($groupBy, '`') !== 0) { $this->groupBy = '`' . $this->groupBy . '`'; } } return $this...
CWE-89
0